aliyun-oss-sdk.js 1.3 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587
  1. // Aliyun OSS SDK for JavaScript v6.18.1
  2. // Copyright Aliyun.com, Inc. or its affiliates. All Rights Reserved.
  3. // License at https://github.com/ali-sdk/ali-oss/blob/master/LICENSE
  4. (function(global){(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.OSS = 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){
  5. "use strict";
  6. var OSS = require('./browser/client');
  7. OSS.Buffer = require('buffer').Buffer;
  8. OSS.urllib = require('../shims/xhr');
  9. OSS.version = require('./browser/version').version;
  10. module.exports = OSS;
  11. },{"../shims/xhr":475,"./browser/client":3,"./browser/version":6,"buffer":90}],2:[function(require,module,exports){
  12. "use strict";
  13. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  14. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  15. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  16. require("core-js/modules/es.object.to-string.js");
  17. require("core-js/modules/web.dom-collections.for-each.js");
  18. require("core-js/modules/es.object.keys.js");
  19. require("core-js/modules/es.array.slice.js");
  20. var assert = require('assert');
  21. var _require = require('../common/utils/checkBucketName'),
  22. _checkBucketName = _require.checkBucketName;
  23. var proto = exports;
  24. function isArray(arr) {
  25. if (Array.isArray) return Array.isArray(arr);
  26. return Object.prototype.toString.call(arr) === '[object Array]';
  27. }
  28. function toArray(obj) {
  29. if (!obj) return [];
  30. if (isArray(obj)) return obj;
  31. return [obj];
  32. }
  33. /**
  34. * Bucket opertaions
  35. */
  36. // TODO: OSS server currently do not support CORS requests for bucket operations
  37. // proto.listBuckets = function* listBuckets(query, options) {
  38. // // prefix, marker, max-keys
  39. // var result = yield this.request({
  40. // method: 'GET',
  41. // query: query,
  42. // timeout: options && options.timeout,
  43. // ctx: options && options.ctx,
  44. // });
  45. //
  46. // if (result.status === 200) {
  47. // var data = yield this.parseXML(result.data);
  48. // var buckets = data.Buckets || null;
  49. // if (buckets) {
  50. // if (buckets.Bucket) {
  51. // buckets = buckets.Bucket;
  52. // }
  53. // if (!isArray(buckets)) {
  54. // buckets = [buckets];
  55. // }
  56. // buckets = buckets.map(function (item) {
  57. // return {
  58. // name: item.Name,
  59. // region: item.Location,
  60. // creationDate: item.CreationDate,
  61. // };
  62. // });
  63. // }
  64. // return {
  65. // buckets: buckets,
  66. // owner: {
  67. // id: data.Owner.ID,
  68. // displayName: data.Owner.DisplayName,
  69. // },
  70. // isTruncated: data.IsTruncated === 'true',
  71. // nextMarker: data.NextMarker || null,
  72. // res: result.res
  73. // };
  74. // }
  75. //
  76. // throw yield this.requestError(result);
  77. // };
  78. proto.useBucket = function useBucket(name) {
  79. _checkBucketName(name);
  80. this.options.bucket = name;
  81. return this;
  82. };
  83. proto.setBucket = function useBucket(name) {
  84. _checkBucketName(name);
  85. this.options.bucket = name;
  86. return this;
  87. };
  88. proto.getBucket = function getBucket() {
  89. return this.options.bucket;
  90. };
  91. proto.deleteBucket = /*#__PURE__*/function () {
  92. var _deleteBucket = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
  93. var params, result;
  94. return _regenerator.default.wrap(function _callee$(_context) {
  95. while (1) {
  96. switch (_context.prev = _context.next) {
  97. case 0:
  98. params = this._bucketRequestParams('DELETE', name, '', options);
  99. _context.next = 3;
  100. return this.request(params);
  101. case 3:
  102. result = _context.sent;
  103. if (!(result.status === 200 || result.status === 204)) {
  104. _context.next = 6;
  105. break;
  106. }
  107. return _context.abrupt("return", {
  108. res: result.res
  109. });
  110. case 6:
  111. _context.next = 8;
  112. return this.requestError(result);
  113. case 8:
  114. throw _context.sent;
  115. case 9:
  116. case "end":
  117. return _context.stop();
  118. }
  119. }
  120. }, _callee, this);
  121. }));
  122. function deleteBucket(_x, _x2) {
  123. return _deleteBucket.apply(this, arguments);
  124. }
  125. return deleteBucket;
  126. }(); // acl
  127. proto.putBucketACL = /*#__PURE__*/function () {
  128. var _putBucketACL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(name, acl, options) {
  129. var params, result;
  130. return _regenerator.default.wrap(function _callee2$(_context2) {
  131. while (1) {
  132. switch (_context2.prev = _context2.next) {
  133. case 0:
  134. params = this._bucketRequestParams('PUT', name, 'acl', options);
  135. params.headers = {
  136. 'x-oss-acl': acl
  137. };
  138. params.successStatuses = [200];
  139. _context2.next = 5;
  140. return this.request(params);
  141. case 5:
  142. result = _context2.sent;
  143. return _context2.abrupt("return", {
  144. bucket: result.headers.location && result.headers.location.substring(1) || null,
  145. res: result.res
  146. });
  147. case 7:
  148. case "end":
  149. return _context2.stop();
  150. }
  151. }
  152. }, _callee2, this);
  153. }));
  154. function putBucketACL(_x3, _x4, _x5) {
  155. return _putBucketACL.apply(this, arguments);
  156. }
  157. return putBucketACL;
  158. }();
  159. proto.getBucketACL = /*#__PURE__*/function () {
  160. var _getBucketACL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(name, options) {
  161. var params, result;
  162. return _regenerator.default.wrap(function _callee3$(_context3) {
  163. while (1) {
  164. switch (_context3.prev = _context3.next) {
  165. case 0:
  166. params = this._bucketRequestParams('GET', name, 'acl', options);
  167. params.successStatuses = [200];
  168. params.xmlResponse = true;
  169. _context3.next = 5;
  170. return this.request(params);
  171. case 5:
  172. result = _context3.sent;
  173. return _context3.abrupt("return", {
  174. acl: result.data.AccessControlList.Grant,
  175. owner: {
  176. id: result.data.Owner.ID,
  177. displayName: result.data.Owner.DisplayName
  178. },
  179. res: result.res
  180. });
  181. case 7:
  182. case "end":
  183. return _context3.stop();
  184. }
  185. }
  186. }, _callee3, this);
  187. }));
  188. function getBucketACL(_x6, _x7) {
  189. return _getBucketACL.apply(this, arguments);
  190. }
  191. return getBucketACL;
  192. }(); // logging
  193. proto.putBucketLogging = /*#__PURE__*/function () {
  194. var _putBucketLogging = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(name, prefix, options) {
  195. var params, xml, result;
  196. return _regenerator.default.wrap(function _callee4$(_context4) {
  197. while (1) {
  198. switch (_context4.prev = _context4.next) {
  199. case 0:
  200. params = this._bucketRequestParams('PUT', name, 'logging', options);
  201. xml = '<?xml version="1.0" encoding="UTF-8"?>\n<BucketLoggingStatus>\n<LoggingEnabled>\n<TargetBucket>'.concat(name, "</TargetBucket>\n");
  202. if (prefix) {
  203. xml += "<TargetPrefix>".concat(prefix, "</TargetPrefix>\n");
  204. }
  205. xml += '</LoggingEnabled>\n</BucketLoggingStatus>';
  206. params.content = xml;
  207. params.mime = 'xml';
  208. params.successStatuses = [200];
  209. _context4.next = 9;
  210. return this.request(params);
  211. case 9:
  212. result = _context4.sent;
  213. return _context4.abrupt("return", {
  214. res: result.res
  215. });
  216. case 11:
  217. case "end":
  218. return _context4.stop();
  219. }
  220. }
  221. }, _callee4, this);
  222. }));
  223. function putBucketLogging(_x8, _x9, _x10) {
  224. return _putBucketLogging.apply(this, arguments);
  225. }
  226. return putBucketLogging;
  227. }();
  228. proto.getBucketLogging = /*#__PURE__*/function () {
  229. var _getBucketLogging = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(name, options) {
  230. var params, result, enable;
  231. return _regenerator.default.wrap(function _callee5$(_context5) {
  232. while (1) {
  233. switch (_context5.prev = _context5.next) {
  234. case 0:
  235. params = this._bucketRequestParams('GET', name, 'logging', options);
  236. params.successStatuses = [200];
  237. params.xmlResponse = true;
  238. _context5.next = 5;
  239. return this.request(params);
  240. case 5:
  241. result = _context5.sent;
  242. enable = result.data.LoggingEnabled;
  243. return _context5.abrupt("return", {
  244. enable: !!enable,
  245. prefix: enable && enable.TargetPrefix || null,
  246. res: result.res
  247. });
  248. case 8:
  249. case "end":
  250. return _context5.stop();
  251. }
  252. }
  253. }, _callee5, this);
  254. }));
  255. function getBucketLogging(_x11, _x12) {
  256. return _getBucketLogging.apply(this, arguments);
  257. }
  258. return getBucketLogging;
  259. }();
  260. proto.deleteBucketLogging = /*#__PURE__*/function () {
  261. var _deleteBucketLogging = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(name, options) {
  262. var params, result;
  263. return _regenerator.default.wrap(function _callee6$(_context6) {
  264. while (1) {
  265. switch (_context6.prev = _context6.next) {
  266. case 0:
  267. params = this._bucketRequestParams('DELETE', name, 'logging', options);
  268. params.successStatuses = [204, 200];
  269. _context6.next = 4;
  270. return this.request(params);
  271. case 4:
  272. result = _context6.sent;
  273. return _context6.abrupt("return", {
  274. res: result.res
  275. });
  276. case 6:
  277. case "end":
  278. return _context6.stop();
  279. }
  280. }
  281. }, _callee6, this);
  282. }));
  283. function deleteBucketLogging(_x13, _x14) {
  284. return _deleteBucketLogging.apply(this, arguments);
  285. }
  286. return deleteBucketLogging;
  287. }();
  288. proto.putBucketCORS = /*#__PURE__*/function () {
  289. var _putBucketCORS = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(name, rules, options) {
  290. var params, xml, parseOrigin, parseMethod, parseHeader, parseExposeHeader, i, l, rule, result;
  291. return _regenerator.default.wrap(function _callee7$(_context7) {
  292. while (1) {
  293. switch (_context7.prev = _context7.next) {
  294. case 0:
  295. rules = rules || [];
  296. assert(rules.length, 'rules is required');
  297. rules.forEach(function (rule) {
  298. assert(rule.allowedOrigin, 'allowedOrigin is required');
  299. assert(rule.allowedMethod, 'allowedMethod is required');
  300. });
  301. params = this._bucketRequestParams('PUT', name, 'cors', options);
  302. xml = '<?xml version="1.0" encoding="UTF-8"?>\n<CORSConfiguration>';
  303. parseOrigin = function parseOrigin(val) {
  304. xml += "<AllowedOrigin>".concat(val, "</AllowedOrigin>");
  305. };
  306. parseMethod = function parseMethod(val) {
  307. xml += "<AllowedMethod>".concat(val, "</AllowedMethod>");
  308. };
  309. parseHeader = function parseHeader(val) {
  310. xml += "<AllowedHeader>".concat(val, "</AllowedHeader>");
  311. };
  312. parseExposeHeader = function parseExposeHeader(val) {
  313. xml += "<ExposeHeader>".concat(val, "</ExposeHeader>");
  314. };
  315. for (i = 0, l = rules.length; i < l; i++) {
  316. rule = rules[i];
  317. xml += '<CORSRule>';
  318. toArray(rule.allowedOrigin).forEach(parseOrigin);
  319. toArray(rule.allowedMethod).forEach(parseMethod);
  320. toArray(rule.allowedHeader).forEach(parseHeader);
  321. toArray(rule.exposeHeader).forEach(parseExposeHeader);
  322. if (rule.maxAgeSeconds) {
  323. xml += "<MaxAgeSeconds>".concat(rule.maxAgeSeconds, "</MaxAgeSeconds>");
  324. }
  325. xml += '</CORSRule>';
  326. }
  327. xml += '</CORSConfiguration>';
  328. params.content = xml;
  329. params.mime = 'xml';
  330. params.successStatuses = [200];
  331. _context7.next = 16;
  332. return this.request(params);
  333. case 16:
  334. result = _context7.sent;
  335. return _context7.abrupt("return", {
  336. res: result.res
  337. });
  338. case 18:
  339. case "end":
  340. return _context7.stop();
  341. }
  342. }
  343. }, _callee7, this);
  344. }));
  345. function putBucketCORS(_x15, _x16, _x17) {
  346. return _putBucketCORS.apply(this, arguments);
  347. }
  348. return putBucketCORS;
  349. }();
  350. proto.getBucketCORS = /*#__PURE__*/function () {
  351. var _getBucketCORS = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(name, options) {
  352. var params, result, rules, CORSRule;
  353. return _regenerator.default.wrap(function _callee8$(_context8) {
  354. while (1) {
  355. switch (_context8.prev = _context8.next) {
  356. case 0:
  357. params = this._bucketRequestParams('GET', name, 'cors', options);
  358. params.successStatuses = [200];
  359. params.xmlResponse = true;
  360. _context8.next = 5;
  361. return this.request(params);
  362. case 5:
  363. result = _context8.sent;
  364. rules = [];
  365. if (result.data && result.data.CORSRule) {
  366. CORSRule = result.data.CORSRule;
  367. if (!isArray(CORSRule)) CORSRule = [CORSRule];
  368. CORSRule.forEach(function (rule) {
  369. var r = {};
  370. Object.keys(rule).forEach(function (key) {
  371. r[key.slice(0, 1).toLowerCase() + key.slice(1, key.length)] = rule[key];
  372. });
  373. rules.push(r);
  374. });
  375. }
  376. return _context8.abrupt("return", {
  377. rules: rules,
  378. res: result.res
  379. });
  380. case 9:
  381. case "end":
  382. return _context8.stop();
  383. }
  384. }
  385. }, _callee8, this);
  386. }));
  387. function getBucketCORS(_x18, _x19) {
  388. return _getBucketCORS.apply(this, arguments);
  389. }
  390. return getBucketCORS;
  391. }();
  392. proto.deleteBucketCORS = /*#__PURE__*/function () {
  393. var _deleteBucketCORS = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(name, options) {
  394. var params, result;
  395. return _regenerator.default.wrap(function _callee9$(_context9) {
  396. while (1) {
  397. switch (_context9.prev = _context9.next) {
  398. case 0:
  399. params = this._bucketRequestParams('DELETE', name, 'cors', options);
  400. params.successStatuses = [204];
  401. _context9.next = 4;
  402. return this.request(params);
  403. case 4:
  404. result = _context9.sent;
  405. return _context9.abrupt("return", {
  406. res: result.res
  407. });
  408. case 6:
  409. case "end":
  410. return _context9.stop();
  411. }
  412. }
  413. }, _callee9, this);
  414. }));
  415. function deleteBucketCORS(_x20, _x21) {
  416. return _deleteBucketCORS.apply(this, arguments);
  417. }
  418. return deleteBucketCORS;
  419. }(); // referer
  420. proto.putBucketReferer = /*#__PURE__*/function () {
  421. var _putBucketReferer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(name, allowEmpty, referers, options) {
  422. var params, xml, i, result;
  423. return _regenerator.default.wrap(function _callee10$(_context10) {
  424. while (1) {
  425. switch (_context10.prev = _context10.next) {
  426. case 0:
  427. params = this._bucketRequestParams('PUT', name, 'referer', options);
  428. xml = '<?xml version="1.0" encoding="UTF-8"?>\n<RefererConfiguration>\n';
  429. xml += " <AllowEmptyReferer>".concat(allowEmpty ? 'true' : 'false', "</AllowEmptyReferer>\n");
  430. if (referers && referers.length > 0) {
  431. xml += ' <RefererList>\n';
  432. for (i = 0; i < referers.length; i++) {
  433. xml += " <Referer>".concat(referers[i], "</Referer>\n");
  434. }
  435. xml += ' </RefererList>\n';
  436. } else {
  437. xml += ' <RefererList />\n';
  438. }
  439. xml += '</RefererConfiguration>';
  440. params.content = xml;
  441. params.mime = 'xml';
  442. params.successStatuses = [200];
  443. _context10.next = 10;
  444. return this.request(params);
  445. case 10:
  446. result = _context10.sent;
  447. return _context10.abrupt("return", {
  448. res: result.res
  449. });
  450. case 12:
  451. case "end":
  452. return _context10.stop();
  453. }
  454. }
  455. }, _callee10, this);
  456. }));
  457. function putBucketReferer(_x22, _x23, _x24, _x25) {
  458. return _putBucketReferer.apply(this, arguments);
  459. }
  460. return putBucketReferer;
  461. }();
  462. proto.getBucketReferer = /*#__PURE__*/function () {
  463. var _getBucketReferer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(name, options) {
  464. var params, result, referers;
  465. return _regenerator.default.wrap(function _callee11$(_context11) {
  466. while (1) {
  467. switch (_context11.prev = _context11.next) {
  468. case 0:
  469. params = this._bucketRequestParams('GET', name, 'referer', options);
  470. params.successStatuses = [200];
  471. params.xmlResponse = true;
  472. _context11.next = 5;
  473. return this.request(params);
  474. case 5:
  475. result = _context11.sent;
  476. referers = result.data.RefererList.Referer || null;
  477. if (referers) {
  478. if (!isArray(referers)) {
  479. referers = [referers];
  480. }
  481. }
  482. return _context11.abrupt("return", {
  483. allowEmpty: result.data.AllowEmptyReferer === 'true',
  484. referers: referers,
  485. res: result.res
  486. });
  487. case 9:
  488. case "end":
  489. return _context11.stop();
  490. }
  491. }
  492. }, _callee11, this);
  493. }));
  494. function getBucketReferer(_x26, _x27) {
  495. return _getBucketReferer.apply(this, arguments);
  496. }
  497. return getBucketReferer;
  498. }();
  499. proto.deleteBucketReferer = /*#__PURE__*/function () {
  500. var _deleteBucketReferer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(name, options) {
  501. return _regenerator.default.wrap(function _callee12$(_context12) {
  502. while (1) {
  503. switch (_context12.prev = _context12.next) {
  504. case 0:
  505. _context12.next = 2;
  506. return this.putBucketReferer(name, true, null, options);
  507. case 2:
  508. return _context12.abrupt("return", _context12.sent);
  509. case 3:
  510. case "end":
  511. return _context12.stop();
  512. }
  513. }
  514. }, _callee12, this);
  515. }));
  516. function deleteBucketReferer(_x28, _x29) {
  517. return _deleteBucketReferer.apply(this, arguments);
  518. }
  519. return deleteBucketReferer;
  520. }(); // private apis
  521. proto._bucketRequestParams = function _bucketRequestParams(method, bucket, subres, options) {
  522. return {
  523. method: method,
  524. bucket: bucket,
  525. subres: subres,
  526. timeout: options && options.timeout,
  527. ctx: options && options.ctx
  528. };
  529. };
  530. },{"../common/utils/checkBucketName":51,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"assert":82,"core-js/modules/es.array.slice.js":281,"core-js/modules/es.object.keys.js":290,"core-js/modules/es.object.to-string.js":291,"core-js/modules/web.dom-collections.for-each.js":339}],3:[function(require,module,exports){
  531. (function (Buffer,process){(function (){
  532. "use strict";
  533. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  534. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  535. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  536. require("core-js/modules/es.function.name.js");
  537. require("core-js/modules/es.regexp.exec.js");
  538. require("core-js/modules/es.string.split.js");
  539. require("core-js/modules/es.object.assign.js");
  540. require("core-js/modules/es.array.includes.js");
  541. require("core-js/modules/es.string.replace.js");
  542. require("core-js/modules/es.array.concat.js");
  543. require("core-js/modules/es.symbol.js");
  544. require("core-js/modules/es.symbol.description.js");
  545. require("core-js/modules/es.array.slice.js");
  546. require("core-js/modules/es.object.to-string.js");
  547. require("core-js/modules/es.promise.js");
  548. require("core-js/modules/es.regexp.to-string.js");
  549. var debug = require('debug')('ali-oss');
  550. var xml = require('xml2js');
  551. var AgentKeepalive = require('agentkeepalive');
  552. var merge = require('merge-descriptors');
  553. var platform = require('platform');
  554. var utility = require('utility');
  555. var urllib = require('urllib');
  556. var pkg = require('./version');
  557. var bowser = require('bowser');
  558. var signUtils = require('../common/signUtils');
  559. var _initOptions = require('../common/client/initOptions');
  560. var _require = require('../common/utils/createRequest'),
  561. createRequest = _require.createRequest;
  562. var _require2 = require('../common/utils/encoder'),
  563. encoder = _require2.encoder;
  564. var _require3 = require('../common/client/getReqUrl'),
  565. getReqUrl = _require3.getReqUrl;
  566. var _require4 = require('../common/utils/setSTSToken'),
  567. setSTSToken = _require4.setSTSToken;
  568. var _require5 = require('../common/utils/retry'),
  569. retry = _require5.retry;
  570. var _require6 = require('../common/utils/isFunction'),
  571. isFunction = _require6.isFunction;
  572. var globalHttpAgent = new AgentKeepalive();
  573. function _unSupportBrowserTip() {
  574. var name = platform.name,
  575. version = platform.version;
  576. if (name && name.toLowerCase && name.toLowerCase() === 'ie' && version.split('.')[0] < 10) {
  577. // eslint-disable-next-line no-console
  578. console.warn('ali-oss does not support the current browser');
  579. }
  580. } // check local web protocol,if https secure default set true , if http secure default set false
  581. function isHttpsWebProtocol() {
  582. // for web worker not use window.location.
  583. // eslint-disable-next-line no-restricted-globals
  584. return location && location.protocol === 'https:';
  585. }
  586. function Client(options, ctx) {
  587. _unSupportBrowserTip();
  588. if (!(this instanceof Client)) {
  589. return new Client(options, ctx);
  590. }
  591. if (options && options.inited) {
  592. this.options = options;
  593. } else {
  594. this.options = Client.initOptions(options);
  595. }
  596. this.options.cancelFlag = false; // cancel flag: if true need to be cancelled, default false
  597. // support custom agent and urllib client
  598. if (this.options.urllib) {
  599. this.urllib = this.options.urllib;
  600. } else {
  601. this.urllib = urllib;
  602. this.agent = this.options.agent || globalHttpAgent;
  603. }
  604. this.ctx = ctx;
  605. this.userAgent = this._getUserAgent();
  606. this.stsTokenFreshTime = new Date(); // record the time difference between client and server
  607. this.options.amendTimeSkewed = 0;
  608. }
  609. /**
  610. * Expose `Client`
  611. */
  612. module.exports = Client;
  613. Client.initOptions = function initOptions(options) {
  614. if (!options.stsToken) {
  615. console.warn('Please use STS Token for safety, see more details at https://help.aliyun.com/document_detail/32077.html');
  616. }
  617. var opts = Object.assign({
  618. secure: isHttpsWebProtocol(),
  619. // for browser compatibility disable fetch.
  620. useFetch: false
  621. }, options);
  622. return _initOptions(opts);
  623. };
  624. /**
  625. * prototype
  626. */
  627. var proto = Client.prototype; // mount debug on proto
  628. proto.debug = debug;
  629. /**
  630. * Object operations
  631. */
  632. merge(proto, require('./object'));
  633. /**
  634. * Bucket operations
  635. */
  636. merge(proto, require('./bucket'));
  637. merge(proto, require('../common/bucket/getBucketWebsite'));
  638. merge(proto, require('../common/bucket/putBucketWebsite'));
  639. merge(proto, require('../common/bucket/deleteBucketWebsite')); // lifecycle
  640. merge(proto, require('../common/bucket/getBucketLifecycle'));
  641. merge(proto, require('../common/bucket/putBucketLifecycle'));
  642. merge(proto, require('../common/bucket/deleteBucketLifecycle')); // multiversion
  643. merge(proto, require('../common/bucket/putBucketVersioning'));
  644. merge(proto, require('../common/bucket/getBucketVersioning')); // inventory
  645. merge(proto, require('../common/bucket/getBucketInventory'));
  646. merge(proto, require('../common/bucket/deleteBucketInventory'));
  647. merge(proto, require('../common/bucket/listBucketInventory'));
  648. merge(proto, require('../common/bucket/putBucketInventory')); // worm
  649. merge(proto, require('../common/bucket/abortBucketWorm'));
  650. merge(proto, require('../common/bucket/completeBucketWorm'));
  651. merge(proto, require('../common/bucket/extendBucketWorm'));
  652. merge(proto, require('../common/bucket/getBucketWorm'));
  653. merge(proto, require('../common/bucket/initiateBucketWorm')); // multipart upload
  654. merge(proto, require('./managed-upload'));
  655. /**
  656. * common multipart-copy support node and browser
  657. */
  658. merge(proto, require('../common/multipart-copy'));
  659. /**
  660. * Multipart operations
  661. */
  662. merge(proto, require('../common/multipart'));
  663. /**
  664. * Common module parallel
  665. */
  666. merge(proto, require('../common/parallel'));
  667. /**
  668. * get OSS signature
  669. * @param {String} stringToSign
  670. * @return {String} the signature
  671. */
  672. proto.signature = function signature(stringToSign) {
  673. this.debug('authorization stringToSign: %s', stringToSign, 'info');
  674. return signUtils.computeSignature(this.options.accessKeySecret, stringToSign, this.options.headerEncoding);
  675. };
  676. proto._getReqUrl = getReqUrl;
  677. /**
  678. * get author header
  679. *
  680. * "Authorization: OSS " + Access Key Id + ":" + Signature
  681. *
  682. * Signature = base64(hmac-sha1(Access Key Secret + "\n"
  683. * + VERB + "\n"
  684. * + CONTENT-MD5 + "\n"
  685. * + CONTENT-TYPE + "\n"
  686. * + DATE + "\n"
  687. * + CanonicalizedOSSHeaders
  688. * + CanonicalizedResource))
  689. *
  690. * @param {String} method
  691. * @param {String} resource
  692. * @param {Object} header
  693. * @return {String}
  694. *
  695. * @api private
  696. */
  697. proto.authorization = function authorization(method, resource, subres, headers) {
  698. var stringToSign = signUtils.buildCanonicalString(method.toUpperCase(), resource, {
  699. headers: headers,
  700. parameters: subres
  701. });
  702. return signUtils.authorization(this.options.accessKeyId, this.options.accessKeySecret, stringToSign, this.options.headerEncoding);
  703. };
  704. /**
  705. * request oss server
  706. * @param {Object} params
  707. * - {String} object
  708. * - {String} bucket
  709. * - {Object} [headers]
  710. * - {Object} [query]
  711. * - {Buffer} [content]
  712. * - {Stream} [stream]
  713. * - {Stream} [writeStream]
  714. * - {String} [mime]
  715. * - {Boolean} [xmlResponse]
  716. * - {Boolean} [customResponse]
  717. * - {Number} [timeout]
  718. * - {Object} [ctx] request context, default is `this.ctx`
  719. *
  720. * @api private
  721. */
  722. proto.request = /*#__PURE__*/function () {
  723. var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(params) {
  724. var _this = this;
  725. return _regenerator.default.wrap(function _callee$(_context) {
  726. while (1) {
  727. switch (_context.prev = _context.next) {
  728. case 0:
  729. if (!this.options.retryMax) {
  730. _context.next = 6;
  731. break;
  732. }
  733. _context.next = 3;
  734. return retry(request.bind(this), this.options.retryMax, {
  735. errorHandler: function errorHandler(err) {
  736. var _errHandle = function _errHandle(_err) {
  737. if (params.stream) return false;
  738. var statusErr = [-1, -2].includes(_err.status);
  739. var requestErrorRetryHandle = _this.options.requestErrorRetryHandle || function () {
  740. return true;
  741. };
  742. return statusErr && requestErrorRetryHandle(_err);
  743. };
  744. if (_errHandle(err)) return true;
  745. return false;
  746. }
  747. })(params);
  748. case 3:
  749. return _context.abrupt("return", _context.sent);
  750. case 6:
  751. return _context.abrupt("return", request.call(this, params));
  752. case 7:
  753. case "end":
  754. return _context.stop();
  755. }
  756. }
  757. }, _callee, this);
  758. }));
  759. return function (_x) {
  760. return _ref.apply(this, arguments);
  761. };
  762. }();
  763. function request(_x2) {
  764. return _request.apply(this, arguments);
  765. }
  766. function _request() {
  767. _request = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(params) {
  768. var reqParams, result, reqErr, useStream, err, parseData;
  769. return _regenerator.default.wrap(function _callee3$(_context3) {
  770. while (1) {
  771. switch (_context3.prev = _context3.next) {
  772. case 0:
  773. if (!(this.options.stsToken && isFunction(this.options.refreshSTSToken))) {
  774. _context3.next = 3;
  775. break;
  776. }
  777. _context3.next = 3;
  778. return setSTSToken.call(this);
  779. case 3:
  780. reqParams = createRequest.call(this, params);
  781. if (!this.options.useFetch) {
  782. reqParams.params.mode = 'disable-fetch';
  783. }
  784. useStream = !!params.stream;
  785. _context3.prev = 6;
  786. _context3.next = 9;
  787. return this.urllib.request(reqParams.url, reqParams.params);
  788. case 9:
  789. result = _context3.sent;
  790. this.debug('response %s %s, got %s, headers: %j', params.method, reqParams.url, result.status, result.headers, 'info');
  791. _context3.next = 16;
  792. break;
  793. case 13:
  794. _context3.prev = 13;
  795. _context3.t0 = _context3["catch"](6);
  796. reqErr = _context3.t0;
  797. case 16:
  798. if (!(result && params.successStatuses && params.successStatuses.indexOf(result.status) === -1)) {
  799. _context3.next = 28;
  800. break;
  801. }
  802. _context3.next = 19;
  803. return this.requestError(result);
  804. case 19:
  805. err = _context3.sent;
  806. if (!(err.code === 'RequestTimeTooSkewed' && !useStream)) {
  807. _context3.next = 25;
  808. break;
  809. }
  810. this.options.amendTimeSkewed = +new Date(err.serverTime) - new Date();
  811. _context3.next = 24;
  812. return this.request(params);
  813. case 24:
  814. return _context3.abrupt("return", _context3.sent);
  815. case 25:
  816. err.params = params;
  817. _context3.next = 32;
  818. break;
  819. case 28:
  820. if (!reqErr) {
  821. _context3.next = 32;
  822. break;
  823. }
  824. _context3.next = 31;
  825. return this.requestError(reqErr);
  826. case 31:
  827. err = _context3.sent;
  828. case 32:
  829. if (!err) {
  830. _context3.next = 34;
  831. break;
  832. }
  833. throw err;
  834. case 34:
  835. if (!params.xmlResponse) {
  836. _context3.next = 39;
  837. break;
  838. }
  839. _context3.next = 37;
  840. return this.parseXML(result.data);
  841. case 37:
  842. parseData = _context3.sent;
  843. result.data = parseData;
  844. case 39:
  845. return _context3.abrupt("return", result);
  846. case 40:
  847. case "end":
  848. return _context3.stop();
  849. }
  850. }
  851. }, _callee3, this, [[6, 13]]);
  852. }));
  853. return _request.apply(this, arguments);
  854. }
  855. proto._getResource = function _getResource(params) {
  856. var resource = '/';
  857. if (params.bucket) resource += "".concat(params.bucket, "/");
  858. if (params.object) resource += encoder(params.object, this.options.headerEncoding);
  859. return resource;
  860. };
  861. proto._escape = function _escape(name) {
  862. return utility.encodeURIComponent(name).replace(/%2F/g, '/');
  863. };
  864. /*
  865. * Get User-Agent for browser & node.js
  866. * @example
  867. * aliyun-sdk-nodejs/4.1.2 Node.js 5.3.0 on Darwin 64-bit
  868. * aliyun-sdk-js/4.1.2 Safari 9.0 on Apple iPhone(iOS 9.2.1)
  869. * aliyun-sdk-js/4.1.2 Chrome 43.0.2357.134 32-bit on Windows Server 2008 R2 / 7 64-bit
  870. */
  871. proto._getUserAgent = function _getUserAgent() {
  872. var agent = process && process.browser ? 'js' : 'nodejs';
  873. var sdk = "aliyun-sdk-".concat(agent, "/").concat(pkg.version);
  874. var plat = platform.description;
  875. if (!plat && process) {
  876. plat = "Node.js ".concat(process.version.slice(1), " on ").concat(process.platform, " ").concat(process.arch);
  877. }
  878. return this._checkUserAgent("".concat(sdk, " ").concat(plat));
  879. };
  880. proto._checkUserAgent = function _checkUserAgent(ua) {
  881. var userAgent = ua.replace(/\u03b1/, 'alpha').replace(/\u03b2/, 'beta');
  882. return userAgent;
  883. };
  884. /*
  885. * Check Browser And Version
  886. * @param {String} [name] browser name: like IE, Chrome, Firefox
  887. * @param {String} [version] browser major version: like 10(IE 10.x), 55(Chrome 55.x), 50(Firefox 50.x)
  888. * @return {Bool} true or false
  889. * @api private
  890. */
  891. proto.checkBrowserAndVersion = function checkBrowserAndVersion(name, version) {
  892. return bowser.name === name && bowser.version.split('.')[0] === version;
  893. };
  894. /**
  895. * thunkify xml.parseString
  896. * @param {String|Buffer} str
  897. *
  898. * @api private
  899. */
  900. proto.parseXML = function parseXMLThunk(str) {
  901. return new Promise(function (resolve, reject) {
  902. if (Buffer.isBuffer(str)) {
  903. str = str.toString();
  904. }
  905. xml.parseString(str, {
  906. explicitRoot: false,
  907. explicitArray: false
  908. }, function (err, result) {
  909. if (err) {
  910. reject(err);
  911. } else {
  912. resolve(result);
  913. }
  914. });
  915. });
  916. };
  917. /**
  918. * generater a request error with request response
  919. * @param {Object} result
  920. *
  921. * @api private
  922. */
  923. proto.requestError = /*#__PURE__*/function () {
  924. var _requestError = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(result) {
  925. var err, message, info, msg;
  926. return _regenerator.default.wrap(function _callee2$(_context2) {
  927. while (1) {
  928. switch (_context2.prev = _context2.next) {
  929. case 0:
  930. err = null;
  931. if (!(!result.data || !result.data.length)) {
  932. _context2.next = 5;
  933. break;
  934. }
  935. if (result.status === -1 || result.status === -2) {
  936. // -1 is net error , -2 is timeout
  937. err = new Error(result.message);
  938. err.name = result.name;
  939. err.status = result.status;
  940. err.code = result.name;
  941. } else {
  942. // HEAD not exists resource
  943. if (result.status === 404) {
  944. err = new Error('Object not exists');
  945. err.name = 'NoSuchKeyError';
  946. err.status = 404;
  947. err.code = 'NoSuchKey';
  948. } else if (result.status === 412) {
  949. err = new Error('Pre condition failed');
  950. err.name = 'PreconditionFailedError';
  951. err.status = 412;
  952. err.code = 'PreconditionFailed';
  953. } else {
  954. err = new Error("Unknow error, status: ".concat(result.status));
  955. err.name = 'UnknownError';
  956. err.status = result.status;
  957. }
  958. err.requestId = result.headers['x-oss-request-id'];
  959. err.host = '';
  960. }
  961. _context2.next = 32;
  962. break;
  963. case 5:
  964. message = String(result.data);
  965. this.debug('request response error data: %s', message, 'error');
  966. _context2.prev = 7;
  967. _context2.next = 10;
  968. return this.parseXML(message);
  969. case 10:
  970. _context2.t0 = _context2.sent;
  971. if (_context2.t0) {
  972. _context2.next = 13;
  973. break;
  974. }
  975. _context2.t0 = {};
  976. case 13:
  977. info = _context2.t0;
  978. _context2.next = 23;
  979. break;
  980. case 16:
  981. _context2.prev = 16;
  982. _context2.t1 = _context2["catch"](7);
  983. this.debug(message, 'error');
  984. _context2.t1.message += "\nraw xml: ".concat(message);
  985. _context2.t1.status = result.status;
  986. _context2.t1.requestId = result.headers['x-oss-request-id'];
  987. return _context2.abrupt("return", _context2.t1);
  988. case 23:
  989. msg = info.Message || "unknow request error, status: ".concat(result.status);
  990. if (info.Condition) {
  991. msg += " (condition: ".concat(info.Condition, ")");
  992. }
  993. err = new Error(msg);
  994. err.name = info.Code ? "".concat(info.Code, "Error") : 'UnknownError';
  995. err.status = result.status;
  996. err.code = info.Code;
  997. err.requestId = info.RequestId;
  998. err.hostId = info.HostId;
  999. err.serverTime = info.ServerTime;
  1000. case 32:
  1001. this.debug('generate error %j', err, 'error');
  1002. return _context2.abrupt("return", err);
  1003. case 34:
  1004. case "end":
  1005. return _context2.stop();
  1006. }
  1007. }
  1008. }, _callee2, this, [[7, 16]]);
  1009. }));
  1010. function requestError(_x3) {
  1011. return _requestError.apply(this, arguments);
  1012. }
  1013. return requestError;
  1014. }();
  1015. }).call(this)}).call(this,{"isBuffer":require("../../node_modules/is-buffer/index.js")},require('_process'))
  1016. },{"../../node_modules/is-buffer/index.js":366,"../common/bucket/abortBucketWorm":7,"../common/bucket/completeBucketWorm":8,"../common/bucket/deleteBucketInventory":9,"../common/bucket/deleteBucketLifecycle":10,"../common/bucket/deleteBucketWebsite":11,"../common/bucket/extendBucketWorm":12,"../common/bucket/getBucketInventory":13,"../common/bucket/getBucketLifecycle":14,"../common/bucket/getBucketVersioning":15,"../common/bucket/getBucketWebsite":16,"../common/bucket/getBucketWorm":17,"../common/bucket/initiateBucketWorm":18,"../common/bucket/listBucketInventory":19,"../common/bucket/putBucketInventory":20,"../common/bucket/putBucketLifecycle":21,"../common/bucket/putBucketVersioning":22,"../common/bucket/putBucketWebsite":23,"../common/client/getReqUrl":25,"../common/client/initOptions":26,"../common/multipart":30,"../common/multipart-copy":29,"../common/parallel":49,"../common/signUtils":50,"../common/utils/createRequest":56,"../common/utils/encoder":59,"../common/utils/isFunction":68,"../common/utils/retry":74,"../common/utils/setSTSToken":76,"./bucket":2,"./managed-upload":4,"./object":5,"./version":6,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"_process":467,"agentkeepalive":81,"bowser":88,"core-js/modules/es.array.concat.js":272,"core-js/modules/es.array.includes.js":277,"core-js/modules/es.array.slice.js":281,"core-js/modules/es.function.name.js":284,"core-js/modules/es.object.assign.js":287,"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.promise.js":295,"core-js/modules/es.regexp.exec.js":300,"core-js/modules/es.regexp.to-string.js":301,"core-js/modules/es.string.replace.js":305,"core-js/modules/es.string.split.js":307,"core-js/modules/es.symbol.description.js":310,"core-js/modules/es.symbol.js":313,"debug":465,"merge-descriptors":372,"platform":379,"urllib":475,"utility":474,"xml2js":426}],4:[function(require,module,exports){
  1017. (function (Buffer){(function (){
  1018. "use strict";
  1019. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  1020. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  1021. require("core-js/modules/es.function.name.js");
  1022. require("core-js/modules/es.object.to-string.js");
  1023. require("core-js/modules/es.promise.js");
  1024. require("core-js/modules/es.array.from.js");
  1025. require("core-js/modules/es.string.iterator.js");
  1026. require("core-js/modules/es.array.map.js");
  1027. require("core-js/modules/es.array.filter.js");
  1028. require("core-js/modules/es.array.find.js");
  1029. require("core-js/modules/es.array.concat.js");
  1030. require("core-js/modules/es.regexp.to-string.js");
  1031. require("core-js/modules/es.array.slice.js");
  1032. require("core-js/modules/es.array.iterator.js");
  1033. require("core-js/modules/es.array-buffer.slice.js");
  1034. require("core-js/modules/es.typed-array.uint8-array.js");
  1035. require("core-js/modules/es.typed-array.copy-within.js");
  1036. require("core-js/modules/es.typed-array.every.js");
  1037. require("core-js/modules/es.typed-array.fill.js");
  1038. require("core-js/modules/es.typed-array.filter.js");
  1039. require("core-js/modules/es.typed-array.find.js");
  1040. require("core-js/modules/es.typed-array.find-index.js");
  1041. require("core-js/modules/es.typed-array.for-each.js");
  1042. require("core-js/modules/es.typed-array.includes.js");
  1043. require("core-js/modules/es.typed-array.index-of.js");
  1044. require("core-js/modules/es.typed-array.iterator.js");
  1045. require("core-js/modules/es.typed-array.join.js");
  1046. require("core-js/modules/es.typed-array.last-index-of.js");
  1047. require("core-js/modules/es.typed-array.map.js");
  1048. require("core-js/modules/es.typed-array.reduce.js");
  1049. require("core-js/modules/es.typed-array.reduce-right.js");
  1050. require("core-js/modules/es.typed-array.reverse.js");
  1051. require("core-js/modules/es.typed-array.set.js");
  1052. require("core-js/modules/es.typed-array.slice.js");
  1053. require("core-js/modules/es.typed-array.some.js");
  1054. require("core-js/modules/es.typed-array.sort.js");
  1055. require("core-js/modules/es.typed-array.subarray.js");
  1056. require("core-js/modules/es.typed-array.to-locale-string.js");
  1057. require("core-js/modules/es.typed-array.to-string.js");
  1058. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  1059. // var debug = require('debug')('ali-oss:multipart');
  1060. var util = require('util');
  1061. var path = require('path');
  1062. var mime = require('mime');
  1063. var copy = require('copy-to');
  1064. var _require = require('../common/utils/isBlob'),
  1065. isBlob = _require.isBlob;
  1066. var _require2 = require('../common/utils/isFile'),
  1067. isFile = _require2.isFile;
  1068. var _require3 = require('../common/utils/isBuffer'),
  1069. isBuffer = _require3.isBuffer;
  1070. var proto = exports;
  1071. /**
  1072. * Multipart operations
  1073. */
  1074. /**
  1075. * Upload a file to OSS using multipart uploads
  1076. * @param {String} name
  1077. * @param {String|File|Buffer} file
  1078. * @param {Object} options
  1079. * {Object} options.callback The callback parameter is composed of a JSON string encoded in Base64
  1080. * {String} options.callback.url the OSS sends a callback request to this URL
  1081. * {String} options.callback.host The host header value for initiating callback requests
  1082. * {String} options.callback.body The value of the request body when a callback is initiated
  1083. * {String} options.callback.contentType The Content-Type of the callback requests initiatiated
  1084. * {Object} options.callback.customValue Custom parameters are a map of key-values, e.g:
  1085. * customValue = {
  1086. * key1: 'value1',
  1087. * key2: 'value2'
  1088. * }
  1089. */
  1090. proto.multipartUpload = /*#__PURE__*/function () {
  1091. var _multipartUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, file) {
  1092. var options,
  1093. minPartSize,
  1094. fileSize,
  1095. result,
  1096. ret,
  1097. initResult,
  1098. uploadId,
  1099. partSize,
  1100. checkpoint,
  1101. _args = arguments;
  1102. return _regenerator.default.wrap(function _callee$(_context) {
  1103. while (1) {
  1104. switch (_context.prev = _context.next) {
  1105. case 0:
  1106. options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
  1107. this.resetCancelFlag();
  1108. options.disabledMD5 = options.disabledMD5 === undefined ? true : !!options.disabledMD5;
  1109. if (!(options.checkpoint && options.checkpoint.uploadId)) {
  1110. _context.next = 8;
  1111. break;
  1112. }
  1113. if (file && isFile(file)) options.checkpoint.file = file;
  1114. _context.next = 7;
  1115. return this._resumeMultipart(options.checkpoint, options);
  1116. case 7:
  1117. return _context.abrupt("return", _context.sent);
  1118. case 8:
  1119. minPartSize = 100 * 1024;
  1120. if (!options.mime) {
  1121. if (isFile(file)) {
  1122. options.mime = mime.getType(path.extname(file.name));
  1123. } else if (isBlob(file)) {
  1124. options.mime = file.type;
  1125. } else if (isBuffer(file)) {
  1126. options.mime = '';
  1127. } else {
  1128. options.mime = mime.getType(path.extname(file));
  1129. }
  1130. }
  1131. options.headers = options.headers || {};
  1132. this._convertMetaToHeaders(options.meta, options.headers);
  1133. _context.next = 14;
  1134. return this._getFileSize(file);
  1135. case 14:
  1136. fileSize = _context.sent;
  1137. if (!(fileSize < minPartSize)) {
  1138. _context.next = 26;
  1139. break;
  1140. }
  1141. options.contentLength = fileSize;
  1142. _context.next = 19;
  1143. return this.put(name, file, options);
  1144. case 19:
  1145. result = _context.sent;
  1146. if (!(options && options.progress)) {
  1147. _context.next = 23;
  1148. break;
  1149. }
  1150. _context.next = 23;
  1151. return options.progress(1);
  1152. case 23:
  1153. ret = {
  1154. res: result.res,
  1155. bucket: this.options.bucket,
  1156. name: name,
  1157. etag: result.res.headers.etag
  1158. };
  1159. if (options.headers && options.headers['x-oss-callback'] || options.callback) {
  1160. ret.data = result.data;
  1161. }
  1162. return _context.abrupt("return", ret);
  1163. case 26:
  1164. if (!(options.partSize && !(parseInt(options.partSize, 10) === options.partSize))) {
  1165. _context.next = 28;
  1166. break;
  1167. }
  1168. throw new Error('partSize must be int number');
  1169. case 28:
  1170. if (!(options.partSize && options.partSize < minPartSize)) {
  1171. _context.next = 30;
  1172. break;
  1173. }
  1174. throw new Error("partSize must not be smaller than ".concat(minPartSize));
  1175. case 30:
  1176. _context.next = 32;
  1177. return this.initMultipartUpload(name, options);
  1178. case 32:
  1179. initResult = _context.sent;
  1180. uploadId = initResult.uploadId;
  1181. partSize = this._getPartSize(fileSize, options.partSize);
  1182. checkpoint = {
  1183. file: file,
  1184. name: name,
  1185. fileSize: fileSize,
  1186. partSize: partSize,
  1187. uploadId: uploadId,
  1188. doneParts: []
  1189. };
  1190. if (!(options && options.progress)) {
  1191. _context.next = 39;
  1192. break;
  1193. }
  1194. _context.next = 39;
  1195. return options.progress(0, checkpoint, initResult.res);
  1196. case 39:
  1197. _context.next = 41;
  1198. return this._resumeMultipart(checkpoint, options);
  1199. case 41:
  1200. return _context.abrupt("return", _context.sent);
  1201. case 42:
  1202. case "end":
  1203. return _context.stop();
  1204. }
  1205. }
  1206. }, _callee, this);
  1207. }));
  1208. function multipartUpload(_x, _x2) {
  1209. return _multipartUpload.apply(this, arguments);
  1210. }
  1211. return multipartUpload;
  1212. }();
  1213. /*
  1214. * Resume multipart upload from checkpoint. The checkpoint will be
  1215. * updated after each successful part upload.
  1216. * @param {Object} checkpoint the checkpoint
  1217. * @param {Object} options
  1218. */
  1219. proto._resumeMultipart = /*#__PURE__*/function () {
  1220. var _resumeMultipart2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(checkpoint, options) {
  1221. var that, file, fileSize, partSize, uploadId, doneParts, name, internalDoneParts, partOffs, numParts, multipartFinish, uploadPartJob, all, done, todo, defaultParallel, parallel, jobErr, abortEvent;
  1222. return _regenerator.default.wrap(function _callee3$(_context3) {
  1223. while (1) {
  1224. switch (_context3.prev = _context3.next) {
  1225. case 0:
  1226. that = this;
  1227. if (!this.isCancel()) {
  1228. _context3.next = 3;
  1229. break;
  1230. }
  1231. throw this._makeCancelEvent();
  1232. case 3:
  1233. file = checkpoint.file, fileSize = checkpoint.fileSize, partSize = checkpoint.partSize, uploadId = checkpoint.uploadId, doneParts = checkpoint.doneParts, name = checkpoint.name;
  1234. internalDoneParts = [];
  1235. if (doneParts.length > 0) {
  1236. copy(doneParts).to(internalDoneParts);
  1237. }
  1238. partOffs = this._divideParts(fileSize, partSize);
  1239. numParts = partOffs.length;
  1240. multipartFinish = false;
  1241. uploadPartJob = function uploadPartJob(self, partNo) {
  1242. // eslint-disable-next-line no-async-promise-executor
  1243. return new Promise( /*#__PURE__*/function () {
  1244. var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(resolve, reject) {
  1245. var pi, content, data, result, tempErr;
  1246. return _regenerator.default.wrap(function _callee2$(_context2) {
  1247. while (1) {
  1248. switch (_context2.prev = _context2.next) {
  1249. case 0:
  1250. _context2.prev = 0;
  1251. if (self.isCancel()) {
  1252. _context2.next = 29;
  1253. break;
  1254. }
  1255. pi = partOffs[partNo - 1];
  1256. _context2.next = 5;
  1257. return self._createBuffer(file, pi.start, pi.end);
  1258. case 5:
  1259. content = _context2.sent;
  1260. data = {
  1261. content: content,
  1262. size: pi.end - pi.start
  1263. };
  1264. _context2.prev = 7;
  1265. _context2.next = 10;
  1266. return self._uploadPart(name, uploadId, partNo, data, options);
  1267. case 10:
  1268. result = _context2.sent;
  1269. _context2.next = 18;
  1270. break;
  1271. case 13:
  1272. _context2.prev = 13;
  1273. _context2.t0 = _context2["catch"](7);
  1274. if (!(_context2.t0.status === 404)) {
  1275. _context2.next = 17;
  1276. break;
  1277. }
  1278. throw self._makeAbortEvent();
  1279. case 17:
  1280. throw _context2.t0;
  1281. case 18:
  1282. if (!(!self.isCancel() && !multipartFinish)) {
  1283. _context2.next = 26;
  1284. break;
  1285. }
  1286. checkpoint.doneParts.push({
  1287. number: partNo,
  1288. etag: result.res.headers.etag
  1289. });
  1290. if (!options.progress) {
  1291. _context2.next = 23;
  1292. break;
  1293. }
  1294. _context2.next = 23;
  1295. return options.progress(doneParts.length / (numParts + 1), checkpoint, result.res);
  1296. case 23:
  1297. resolve({
  1298. number: partNo,
  1299. etag: result.res.headers.etag
  1300. });
  1301. _context2.next = 27;
  1302. break;
  1303. case 26:
  1304. resolve();
  1305. case 27:
  1306. _context2.next = 30;
  1307. break;
  1308. case 29:
  1309. resolve();
  1310. case 30:
  1311. _context2.next = 41;
  1312. break;
  1313. case 32:
  1314. _context2.prev = 32;
  1315. _context2.t1 = _context2["catch"](0);
  1316. tempErr = new Error();
  1317. tempErr.name = _context2.t1.name;
  1318. tempErr.message = _context2.t1.message;
  1319. tempErr.stack = _context2.t1.stack;
  1320. tempErr.partNum = partNo;
  1321. copy(_context2.t1).to(tempErr);
  1322. reject(tempErr);
  1323. case 41:
  1324. case "end":
  1325. return _context2.stop();
  1326. }
  1327. }
  1328. }, _callee2, null, [[0, 32], [7, 13]]);
  1329. }));
  1330. return function (_x5, _x6) {
  1331. return _ref.apply(this, arguments);
  1332. };
  1333. }());
  1334. };
  1335. all = Array.from(new Array(numParts), function (x, i) {
  1336. return i + 1;
  1337. });
  1338. done = internalDoneParts.map(function (p) {
  1339. return p.number;
  1340. });
  1341. todo = all.filter(function (p) {
  1342. return done.indexOf(p) < 0;
  1343. });
  1344. defaultParallel = 5;
  1345. parallel = options.parallel || defaultParallel; // upload in parallel
  1346. _context3.next = 17;
  1347. return this._parallel(todo, parallel, function (value) {
  1348. return new Promise(function (resolve, reject) {
  1349. uploadPartJob(that, value).then(function (result) {
  1350. if (result) {
  1351. internalDoneParts.push(result);
  1352. }
  1353. resolve();
  1354. }).catch(function (err) {
  1355. reject(err);
  1356. });
  1357. });
  1358. });
  1359. case 17:
  1360. jobErr = _context3.sent;
  1361. multipartFinish = true;
  1362. abortEvent = jobErr.find(function (err) {
  1363. return err.name === 'abort';
  1364. });
  1365. if (!abortEvent) {
  1366. _context3.next = 22;
  1367. break;
  1368. }
  1369. throw abortEvent;
  1370. case 22:
  1371. if (!this.isCancel()) {
  1372. _context3.next = 25;
  1373. break;
  1374. }
  1375. uploadPartJob = null;
  1376. throw this._makeCancelEvent();
  1377. case 25:
  1378. if (!(jobErr && jobErr.length > 0)) {
  1379. _context3.next = 28;
  1380. break;
  1381. }
  1382. jobErr[0].message = "Failed to upload some parts with error: ".concat(jobErr[0].toString(), " part_num: ").concat(jobErr[0].partNum);
  1383. throw jobErr[0];
  1384. case 28:
  1385. _context3.next = 30;
  1386. return this.completeMultipartUpload(name, uploadId, internalDoneParts, options);
  1387. case 30:
  1388. return _context3.abrupt("return", _context3.sent);
  1389. case 31:
  1390. case "end":
  1391. return _context3.stop();
  1392. }
  1393. }
  1394. }, _callee3, this);
  1395. }));
  1396. function _resumeMultipart(_x3, _x4) {
  1397. return _resumeMultipart2.apply(this, arguments);
  1398. }
  1399. return _resumeMultipart;
  1400. }();
  1401. /**
  1402. * Get file size
  1403. */
  1404. proto._getFileSize = /*#__PURE__*/function () {
  1405. var _getFileSize2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(file) {
  1406. return _regenerator.default.wrap(function _callee4$(_context4) {
  1407. while (1) {
  1408. switch (_context4.prev = _context4.next) {
  1409. case 0:
  1410. if (!isBuffer(file)) {
  1411. _context4.next = 4;
  1412. break;
  1413. }
  1414. return _context4.abrupt("return", file.length);
  1415. case 4:
  1416. if (!(isBlob(file) || isFile(file))) {
  1417. _context4.next = 6;
  1418. break;
  1419. }
  1420. return _context4.abrupt("return", file.size);
  1421. case 6:
  1422. throw new Error('_getFileSize requires Buffer/File/Blob.');
  1423. case 7:
  1424. case "end":
  1425. return _context4.stop();
  1426. }
  1427. }
  1428. }, _callee4);
  1429. }));
  1430. function _getFileSize(_x7) {
  1431. return _getFileSize2.apply(this, arguments);
  1432. }
  1433. return _getFileSize;
  1434. }();
  1435. /*
  1436. * Readable stream for Web File
  1437. */
  1438. var _require4 = require('stream'),
  1439. Readable = _require4.Readable;
  1440. function WebFileReadStream(file, options) {
  1441. if (!(this instanceof WebFileReadStream)) {
  1442. return new WebFileReadStream(file, options);
  1443. }
  1444. Readable.call(this, options);
  1445. this.file = file;
  1446. this.reader = new FileReader();
  1447. this.start = 0;
  1448. this.finish = false;
  1449. this.fileBuffer = null;
  1450. }
  1451. util.inherits(WebFileReadStream, Readable);
  1452. WebFileReadStream.prototype.readFileAndPush = function readFileAndPush(size) {
  1453. if (this.fileBuffer) {
  1454. var pushRet = true;
  1455. while (pushRet && this.fileBuffer && this.start < this.fileBuffer.length) {
  1456. var start = this.start;
  1457. var end = start + size;
  1458. end = end > this.fileBuffer.length ? this.fileBuffer.length : end;
  1459. this.start = end;
  1460. pushRet = this.push(this.fileBuffer.slice(start, end));
  1461. }
  1462. }
  1463. };
  1464. WebFileReadStream.prototype._read = function _read(size) {
  1465. if (this.file && this.start >= this.file.size || this.fileBuffer && this.start >= this.fileBuffer.length || this.finish || this.start === 0 && !this.file) {
  1466. if (!this.finish) {
  1467. this.fileBuffer = null;
  1468. this.finish = true;
  1469. }
  1470. this.push(null);
  1471. return;
  1472. }
  1473. var defaultReadSize = 16 * 1024;
  1474. size = size || defaultReadSize;
  1475. var that = this;
  1476. this.reader.onload = function onload(e) {
  1477. that.fileBuffer = Buffer.from(new Uint8Array(e.target.result));
  1478. that.file = null;
  1479. that.readFileAndPush(size);
  1480. };
  1481. if (this.start === 0) {
  1482. this.reader.readAsArrayBuffer(this.file);
  1483. } else {
  1484. this.readFileAndPush(size);
  1485. }
  1486. };
  1487. function getBuffer(file) {
  1488. // Some browsers do not support Blob.prototype.arrayBuffer, such as IE
  1489. if (file.arrayBuffer) return file.arrayBuffer();
  1490. return new Promise(function (resolve, reject) {
  1491. var reader = new FileReader();
  1492. reader.onload = function (e) {
  1493. resolve(e.target.result);
  1494. };
  1495. reader.onerror = function (e) {
  1496. reject(e);
  1497. };
  1498. reader.readAsArrayBuffer(file);
  1499. });
  1500. }
  1501. proto._createBuffer = /*#__PURE__*/function () {
  1502. var _createBuffer2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(file, start, end) {
  1503. var _file, fileContent;
  1504. return _regenerator.default.wrap(function _callee5$(_context5) {
  1505. while (1) {
  1506. switch (_context5.prev = _context5.next) {
  1507. case 0:
  1508. if (!(isBlob(file) || isFile(file))) {
  1509. _context5.next = 8;
  1510. break;
  1511. }
  1512. _file = file.slice(start, end);
  1513. _context5.next = 4;
  1514. return getBuffer(_file);
  1515. case 4:
  1516. fileContent = _context5.sent;
  1517. return _context5.abrupt("return", Buffer.from(fileContent));
  1518. case 8:
  1519. if (!isBuffer(file)) {
  1520. _context5.next = 12;
  1521. break;
  1522. }
  1523. return _context5.abrupt("return", file.subarray(start, end));
  1524. case 12:
  1525. throw new Error('_createBuffer requires File/Blob/Buffer.');
  1526. case 13:
  1527. case "end":
  1528. return _context5.stop();
  1529. }
  1530. }
  1531. }, _callee5);
  1532. }));
  1533. function _createBuffer(_x8, _x9, _x10) {
  1534. return _createBuffer2.apply(this, arguments);
  1535. }
  1536. return _createBuffer;
  1537. }();
  1538. proto._getPartSize = function _getPartSize(fileSize, partSize) {
  1539. var maxNumParts = 10 * 1000;
  1540. var defaultPartSize = 1 * 1024 * 1024;
  1541. if (!partSize) partSize = defaultPartSize;
  1542. var safeSize = Math.ceil(fileSize / maxNumParts);
  1543. if (partSize < safeSize) {
  1544. partSize = safeSize;
  1545. console.warn("partSize has been set to ".concat(partSize, ", because the partSize you provided causes partNumber to be greater than 10,000"));
  1546. }
  1547. return partSize;
  1548. };
  1549. proto._divideParts = function _divideParts(fileSize, partSize) {
  1550. var numParts = Math.ceil(fileSize / partSize);
  1551. var partOffs = [];
  1552. for (var i = 0; i < numParts; i++) {
  1553. var start = partSize * i;
  1554. var end = Math.min(start + partSize, fileSize);
  1555. partOffs.push({
  1556. start: start,
  1557. end: end
  1558. });
  1559. }
  1560. return partOffs;
  1561. };
  1562. }).call(this)}).call(this,require("buffer").Buffer)
  1563. },{"../common/utils/isBlob":64,"../common/utils/isBuffer":65,"../common/utils/isFile":67,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"buffer":90,"copy-to":94,"core-js/modules/es.array-buffer.slice.js":271,"core-js/modules/es.array.concat.js":272,"core-js/modules/es.array.filter.js":274,"core-js/modules/es.array.find.js":275,"core-js/modules/es.array.from.js":276,"core-js/modules/es.array.iterator.js":278,"core-js/modules/es.array.map.js":280,"core-js/modules/es.array.slice.js":281,"core-js/modules/es.function.name.js":284,"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.promise.js":295,"core-js/modules/es.regexp.to-string.js":301,"core-js/modules/es.string.iterator.js":303,"core-js/modules/es.typed-array.copy-within.js":315,"core-js/modules/es.typed-array.every.js":316,"core-js/modules/es.typed-array.fill.js":317,"core-js/modules/es.typed-array.filter.js":318,"core-js/modules/es.typed-array.find-index.js":319,"core-js/modules/es.typed-array.find.js":320,"core-js/modules/es.typed-array.for-each.js":321,"core-js/modules/es.typed-array.includes.js":322,"core-js/modules/es.typed-array.index-of.js":323,"core-js/modules/es.typed-array.iterator.js":324,"core-js/modules/es.typed-array.join.js":325,"core-js/modules/es.typed-array.last-index-of.js":326,"core-js/modules/es.typed-array.map.js":327,"core-js/modules/es.typed-array.reduce-right.js":328,"core-js/modules/es.typed-array.reduce.js":329,"core-js/modules/es.typed-array.reverse.js":330,"core-js/modules/es.typed-array.set.js":331,"core-js/modules/es.typed-array.slice.js":332,"core-js/modules/es.typed-array.some.js":333,"core-js/modules/es.typed-array.sort.js":334,"core-js/modules/es.typed-array.subarray.js":335,"core-js/modules/es.typed-array.to-locale-string.js":336,"core-js/modules/es.typed-array.to-string.js":337,"core-js/modules/es.typed-array.uint8-array.js":338,"mime":374,"path":378,"stream":398,"util":419}],5:[function(require,module,exports){
  1564. "use strict";
  1565. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  1566. require("core-js/modules/es.function.name.js");
  1567. require("core-js/modules/es.object.to-string.js");
  1568. require("core-js/modules/es.regexp.to-string.js");
  1569. require("core-js/modules/es.array.map.js");
  1570. require("core-js/modules/es.number.constructor.js");
  1571. require("core-js/modules/es.object.assign.js");
  1572. require("core-js/modules/es.regexp.exec.js");
  1573. require("core-js/modules/es.string.replace.js");
  1574. require("core-js/modules/web.dom-collections.for-each.js");
  1575. require("core-js/modules/es.object.keys.js");
  1576. require("core-js/modules/es.promise.js");
  1577. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  1578. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  1579. // const debug = require('debug')('ali-oss:object');
  1580. var fs = require('fs');
  1581. var copy = require('copy-to');
  1582. var path = require('path');
  1583. var mime = require('mime');
  1584. var callback = require('../common/callback');
  1585. var merge = require('merge-descriptors');
  1586. var _require = require('../common/utils/isBlob'),
  1587. isBlob = _require.isBlob;
  1588. var _require2 = require('../common/utils/isFile'),
  1589. isFile = _require2.isFile;
  1590. var _require3 = require('../common/utils/isBuffer'),
  1591. isBuffer = _require3.isBuffer;
  1592. var _require4 = require('../common/utils/obj2xml'),
  1593. obj2xml = _require4.obj2xml; // var assert = require('assert');
  1594. var proto = exports;
  1595. /**
  1596. * Object operations
  1597. */
  1598. /**
  1599. * append an object from String(file path)/Buffer/ReadableStream
  1600. * @param {String} name the object key
  1601. * @param {Mixed} file String(file path)/Buffer/ReadableStream
  1602. * @param {Object} options
  1603. * @return {Object}
  1604. */
  1605. proto.append = /*#__PURE__*/function () {
  1606. var _append = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, file, options) {
  1607. var result;
  1608. return _regenerator.default.wrap(function _callee$(_context) {
  1609. while (1) {
  1610. switch (_context.prev = _context.next) {
  1611. case 0:
  1612. options = options || {};
  1613. if (options.position === undefined) options.position = '0';
  1614. options.subres = {
  1615. append: '',
  1616. position: options.position
  1617. };
  1618. options.method = 'POST';
  1619. _context.next = 6;
  1620. return this.put(name, file, options);
  1621. case 6:
  1622. result = _context.sent;
  1623. result.nextAppendPosition = result.res.headers['x-oss-next-append-position'];
  1624. return _context.abrupt("return", result);
  1625. case 9:
  1626. case "end":
  1627. return _context.stop();
  1628. }
  1629. }
  1630. }, _callee, this);
  1631. }));
  1632. function append(_x, _x2, _x3) {
  1633. return _append.apply(this, arguments);
  1634. }
  1635. return append;
  1636. }();
  1637. /**
  1638. * put an object from String(file path)/Buffer/ReadableStream
  1639. * @param {String} name the object key
  1640. * @param {Mixed} file String(file path)/Buffer/ReadableStream
  1641. * @param {Object} options
  1642. * {Object} options.callback The callback parameter is composed of a JSON string encoded in Base64
  1643. * {String} options.callback.url the OSS sends a callback request to this URL
  1644. * {String} options.callback.host The host header value for initiating callback requests
  1645. * {String} options.callback.body The value of the request body when a callback is initiated
  1646. * {String} options.callback.contentType The Content-Type of the callback requests initiatiated
  1647. * {Object} options.callback.customValue Custom parameters are a map of key-values, e.g:
  1648. * customValue = {
  1649. * key1: 'value1',
  1650. * key2: 'value2'
  1651. * }
  1652. * @return {Object}
  1653. */
  1654. proto.put = /*#__PURE__*/function () {
  1655. var _put = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(name, file, options) {
  1656. var content, method, params, result, ret;
  1657. return _regenerator.default.wrap(function _callee2$(_context2) {
  1658. while (1) {
  1659. switch (_context2.prev = _context2.next) {
  1660. case 0:
  1661. options = options || {};
  1662. options.disabledMD5 = options.disabledMD5 === undefined ? true : !!options.disabledMD5;
  1663. options.headers = options.headers || {};
  1664. name = this._objectName(name);
  1665. if (!isBuffer(file)) {
  1666. _context2.next = 8;
  1667. break;
  1668. }
  1669. content = file;
  1670. _context2.next = 19;
  1671. break;
  1672. case 8:
  1673. if (!(isBlob(file) || isFile(file))) {
  1674. _context2.next = 18;
  1675. break;
  1676. }
  1677. if (!options.mime) {
  1678. if (isFile(file)) {
  1679. options.mime = mime.getType(path.extname(file.name));
  1680. } else {
  1681. options.mime = file.type;
  1682. }
  1683. }
  1684. _context2.next = 12;
  1685. return this._createBuffer(file, 0, file.size);
  1686. case 12:
  1687. content = _context2.sent;
  1688. _context2.next = 15;
  1689. return this._getFileSize(file);
  1690. case 15:
  1691. options.contentLength = _context2.sent;
  1692. _context2.next = 19;
  1693. break;
  1694. case 18:
  1695. throw new TypeError('Must provide Buffer/Blob/File for put.');
  1696. case 19:
  1697. this._convertMetaToHeaders(options.meta, options.headers);
  1698. method = options.method || 'PUT';
  1699. params = this._objectRequestParams(method, name, options);
  1700. callback.encodeCallback(params, options);
  1701. params.mime = options.mime;
  1702. params.disabledMD5 = options.disabledMD5;
  1703. params.content = content;
  1704. params.successStatuses = [200];
  1705. _context2.next = 29;
  1706. return this.request(params);
  1707. case 29:
  1708. result = _context2.sent;
  1709. ret = {
  1710. name: name,
  1711. url: this._objectUrl(name),
  1712. res: result.res
  1713. };
  1714. if (params.headers && params.headers['x-oss-callback']) {
  1715. ret.data = JSON.parse(result.data.toString());
  1716. }
  1717. return _context2.abrupt("return", ret);
  1718. case 33:
  1719. case "end":
  1720. return _context2.stop();
  1721. }
  1722. }
  1723. }, _callee2, this);
  1724. }));
  1725. function put(_x4, _x5, _x6) {
  1726. return _put.apply(this, arguments);
  1727. }
  1728. return put;
  1729. }();
  1730. /**
  1731. * put an object from ReadableStream. If `options.contentLength` is
  1732. * not provided, chunked encoding is used.
  1733. * @param {String} name the object key
  1734. * @param {Readable} stream the ReadableStream
  1735. * @param {Object} options
  1736. * @return {Object}
  1737. */
  1738. proto.putStream = /*#__PURE__*/function () {
  1739. var _putStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(name, stream, options) {
  1740. var method, params, result, ret;
  1741. return _regenerator.default.wrap(function _callee3$(_context3) {
  1742. while (1) {
  1743. switch (_context3.prev = _context3.next) {
  1744. case 0:
  1745. options = options || {};
  1746. options.headers = options.headers || {};
  1747. name = this._objectName(name);
  1748. if (options.contentLength) {
  1749. options.headers['Content-Length'] = options.contentLength;
  1750. } else {
  1751. options.headers['Transfer-Encoding'] = 'chunked';
  1752. }
  1753. this._convertMetaToHeaders(options.meta, options.headers);
  1754. method = options.method || 'PUT';
  1755. params = this._objectRequestParams(method, name, options);
  1756. callback.encodeCallback(params, options);
  1757. params.mime = options.mime;
  1758. params.stream = stream;
  1759. params.successStatuses = [200];
  1760. _context3.next = 13;
  1761. return this.request(params);
  1762. case 13:
  1763. result = _context3.sent;
  1764. ret = {
  1765. name: name,
  1766. url: this._objectUrl(name),
  1767. res: result.res
  1768. };
  1769. if (params.headers && params.headers['x-oss-callback']) {
  1770. ret.data = JSON.parse(result.data.toString());
  1771. }
  1772. return _context3.abrupt("return", ret);
  1773. case 17:
  1774. case "end":
  1775. return _context3.stop();
  1776. }
  1777. }
  1778. }, _callee3, this);
  1779. }));
  1780. function putStream(_x7, _x8, _x9) {
  1781. return _putStream.apply(this, arguments);
  1782. }
  1783. return putStream;
  1784. }();
  1785. merge(proto, require('../common/object/copyObject'));
  1786. merge(proto, require('../common/object/getObjectTagging'));
  1787. merge(proto, require('../common/object/putObjectTagging'));
  1788. merge(proto, require('../common/object/deleteObjectTagging'));
  1789. merge(proto, require('../common/image'));
  1790. merge(proto, require('../common/object/getBucketVersions'));
  1791. merge(proto, require('../common/object/getACL'));
  1792. merge(proto, require('../common/object/putACL'));
  1793. merge(proto, require('../common/object/head'));
  1794. merge(proto, require('../common/object/delete'));
  1795. merge(proto, require('../common/object/get'));
  1796. merge(proto, require('../common/object/putSymlink'));
  1797. merge(proto, require('../common/object/getSymlink'));
  1798. merge(proto, require('../common/object/deleteMulti'));
  1799. merge(proto, require('../common/object/getObjectMeta'));
  1800. merge(proto, require('../common/object/getObjectUrl'));
  1801. merge(proto, require('../common/object/generateObjectUrl'));
  1802. merge(proto, require('../common/object/signatureUrl'));
  1803. merge(proto, require('../common/object/asyncSignatureUrl'));
  1804. proto.putMeta = /*#__PURE__*/function () {
  1805. var _putMeta = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(name, meta, options) {
  1806. var copyResult;
  1807. return _regenerator.default.wrap(function _callee4$(_context4) {
  1808. while (1) {
  1809. switch (_context4.prev = _context4.next) {
  1810. case 0:
  1811. _context4.next = 2;
  1812. return this.copy(name, name, {
  1813. meta: meta || {},
  1814. timeout: options && options.timeout,
  1815. ctx: options && options.ctx
  1816. });
  1817. case 2:
  1818. copyResult = _context4.sent;
  1819. return _context4.abrupt("return", copyResult);
  1820. case 4:
  1821. case "end":
  1822. return _context4.stop();
  1823. }
  1824. }
  1825. }, _callee4, this);
  1826. }));
  1827. function putMeta(_x10, _x11, _x12) {
  1828. return _putMeta.apply(this, arguments);
  1829. }
  1830. return putMeta;
  1831. }();
  1832. proto.list = /*#__PURE__*/function () {
  1833. var _list = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(query, options) {
  1834. var params, result, objects, that, prefixes;
  1835. return _regenerator.default.wrap(function _callee5$(_context5) {
  1836. while (1) {
  1837. switch (_context5.prev = _context5.next) {
  1838. case 0:
  1839. // prefix, marker, max-keys, delimiter
  1840. params = this._objectRequestParams('GET', '', options);
  1841. params.query = query;
  1842. params.xmlResponse = true;
  1843. params.successStatuses = [200];
  1844. _context5.next = 6;
  1845. return this.request(params);
  1846. case 6:
  1847. result = _context5.sent;
  1848. objects = result.data.Contents || [];
  1849. that = this;
  1850. if (objects) {
  1851. if (!Array.isArray(objects)) {
  1852. objects = [objects];
  1853. }
  1854. objects = objects.map(function (obj) {
  1855. return {
  1856. name: obj.Key,
  1857. url: that._objectUrl(obj.Key),
  1858. lastModified: obj.LastModified,
  1859. etag: obj.ETag,
  1860. type: obj.Type,
  1861. size: Number(obj.Size),
  1862. storageClass: obj.StorageClass,
  1863. owner: {
  1864. id: obj.Owner.ID,
  1865. displayName: obj.Owner.DisplayName
  1866. }
  1867. };
  1868. });
  1869. }
  1870. prefixes = result.data.CommonPrefixes || null;
  1871. if (prefixes) {
  1872. if (!Array.isArray(prefixes)) {
  1873. prefixes = [prefixes];
  1874. }
  1875. prefixes = prefixes.map(function (item) {
  1876. return item.Prefix;
  1877. });
  1878. }
  1879. return _context5.abrupt("return", {
  1880. res: result.res,
  1881. objects: objects,
  1882. prefixes: prefixes,
  1883. nextMarker: result.data.NextMarker || null,
  1884. isTruncated: result.data.IsTruncated === 'true'
  1885. });
  1886. case 13:
  1887. case "end":
  1888. return _context5.stop();
  1889. }
  1890. }
  1891. }, _callee5, this);
  1892. }));
  1893. function list(_x13, _x14) {
  1894. return _list.apply(this, arguments);
  1895. }
  1896. return list;
  1897. }();
  1898. proto.listV2 = /*#__PURE__*/function () {
  1899. var _listV = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(query) {
  1900. var options,
  1901. continuation_token,
  1902. params,
  1903. result,
  1904. objects,
  1905. that,
  1906. prefixes,
  1907. _args6 = arguments;
  1908. return _regenerator.default.wrap(function _callee6$(_context6) {
  1909. while (1) {
  1910. switch (_context6.prev = _context6.next) {
  1911. case 0:
  1912. options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
  1913. continuation_token = query['continuation-token'] || query.continuationToken;
  1914. if (continuation_token) {
  1915. options.subres = Object.assign({
  1916. 'continuation-token': continuation_token
  1917. }, options.subres);
  1918. }
  1919. params = this._objectRequestParams('GET', '', options);
  1920. params.query = Object.assign({
  1921. 'list-type': 2
  1922. }, query);
  1923. delete params.query['continuation-token'];
  1924. delete params.query.continuationToken;
  1925. params.xmlResponse = true;
  1926. params.successStatuses = [200];
  1927. _context6.next = 11;
  1928. return this.request(params);
  1929. case 11:
  1930. result = _context6.sent;
  1931. objects = result.data.Contents || [];
  1932. that = this;
  1933. if (objects) {
  1934. if (!Array.isArray(objects)) {
  1935. objects = [objects];
  1936. }
  1937. objects = objects.map(function (obj) {
  1938. var owner = null;
  1939. if (obj.Owner) {
  1940. owner = {
  1941. id: obj.Owner.ID,
  1942. displayName: obj.Owner.DisplayName
  1943. };
  1944. }
  1945. return {
  1946. name: obj.Key,
  1947. url: that._objectUrl(obj.Key),
  1948. lastModified: obj.LastModified,
  1949. etag: obj.ETag,
  1950. type: obj.Type,
  1951. size: Number(obj.Size),
  1952. storageClass: obj.StorageClass,
  1953. owner: owner
  1954. };
  1955. });
  1956. }
  1957. prefixes = result.data.CommonPrefixes || null;
  1958. if (prefixes) {
  1959. if (!Array.isArray(prefixes)) {
  1960. prefixes = [prefixes];
  1961. }
  1962. prefixes = prefixes.map(function (item) {
  1963. return item.Prefix;
  1964. });
  1965. }
  1966. return _context6.abrupt("return", {
  1967. res: result.res,
  1968. objects: objects,
  1969. prefixes: prefixes,
  1970. isTruncated: result.data.IsTruncated === 'true',
  1971. keyCount: +result.data.KeyCount,
  1972. continuationToken: result.data.ContinuationToken || null,
  1973. nextContinuationToken: result.data.NextContinuationToken || null
  1974. });
  1975. case 18:
  1976. case "end":
  1977. return _context6.stop();
  1978. }
  1979. }
  1980. }, _callee6, this);
  1981. }));
  1982. function listV2(_x15) {
  1983. return _listV.apply(this, arguments);
  1984. }
  1985. return listV2;
  1986. }();
  1987. /**
  1988. * Restore Object
  1989. * @param {String} name the object key
  1990. * @param {Object} options
  1991. * @returns {{res}}
  1992. */
  1993. proto.restore = /*#__PURE__*/function () {
  1994. var _restore = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(name) {
  1995. var options,
  1996. params,
  1997. paramsXMLObj,
  1998. result,
  1999. _args7 = arguments;
  2000. return _regenerator.default.wrap(function _callee7$(_context7) {
  2001. while (1) {
  2002. switch (_context7.prev = _context7.next) {
  2003. case 0:
  2004. options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {
  2005. type: 'Archive'
  2006. };
  2007. options = options || {};
  2008. options.subres = Object.assign({
  2009. restore: ''
  2010. }, options.subres);
  2011. if (options.versionId) {
  2012. options.subres.versionId = options.versionId;
  2013. }
  2014. params = this._objectRequestParams('POST', name, options);
  2015. if (options.type === 'ColdArchive') {
  2016. paramsXMLObj = {
  2017. RestoreRequest: {
  2018. Days: options.Days ? options.Days : 2,
  2019. JobParameters: {
  2020. Tier: options.JobParameters ? options.JobParameters : 'Standard'
  2021. }
  2022. }
  2023. };
  2024. params.content = obj2xml(paramsXMLObj, {
  2025. headers: true
  2026. });
  2027. params.mime = 'xml';
  2028. }
  2029. params.successStatuses = [202];
  2030. _context7.next = 9;
  2031. return this.request(params);
  2032. case 9:
  2033. result = _context7.sent;
  2034. return _context7.abrupt("return", {
  2035. res: result.res
  2036. });
  2037. case 11:
  2038. case "end":
  2039. return _context7.stop();
  2040. }
  2041. }
  2042. }, _callee7, this);
  2043. }));
  2044. function restore(_x16) {
  2045. return _restore.apply(this, arguments);
  2046. }
  2047. return restore;
  2048. }();
  2049. proto._objectUrl = function _objectUrl(name) {
  2050. return this._getReqUrl({
  2051. bucket: this.options.bucket,
  2052. object: name
  2053. });
  2054. };
  2055. /**
  2056. * generator request params
  2057. * @return {Object} params
  2058. *
  2059. * @api private
  2060. */
  2061. proto._objectRequestParams = function _objectRequestParams(method, name, options) {
  2062. if (!this.options.bucket && !this.options.cname) {
  2063. throw new Error('Please create a bucket first');
  2064. }
  2065. options = options || {};
  2066. name = this._objectName(name);
  2067. var params = {
  2068. object: name,
  2069. bucket: this.options.bucket,
  2070. method: method,
  2071. subres: options && options.subres,
  2072. timeout: options && options.timeout,
  2073. ctx: options && options.ctx
  2074. };
  2075. if (options.headers) {
  2076. params.headers = {};
  2077. copy(options.headers).to(params.headers);
  2078. }
  2079. return params;
  2080. };
  2081. proto._objectName = function _objectName(name) {
  2082. return name.replace(/^\/+/, '');
  2083. };
  2084. proto._convertMetaToHeaders = function _convertMetaToHeaders(meta, headers) {
  2085. if (!meta) {
  2086. return;
  2087. }
  2088. Object.keys(meta).forEach(function (k) {
  2089. headers["x-oss-meta-".concat(k)] = meta[k];
  2090. });
  2091. };
  2092. proto._deleteFileSafe = function _deleteFileSafe(filepath) {
  2093. var _this = this;
  2094. return new Promise(function (resolve) {
  2095. fs.exists(filepath, function (exists) {
  2096. if (!exists) {
  2097. resolve();
  2098. } else {
  2099. fs.unlink(filepath, function (err) {
  2100. if (err) {
  2101. _this.debug('unlink %j error: %s', filepath, err, 'error');
  2102. }
  2103. resolve();
  2104. });
  2105. }
  2106. });
  2107. });
  2108. };
  2109. },{"../common/callback":24,"../common/image":27,"../common/object/asyncSignatureUrl":31,"../common/object/copyObject":32,"../common/object/delete":33,"../common/object/deleteMulti":34,"../common/object/deleteObjectTagging":35,"../common/object/generateObjectUrl":36,"../common/object/get":37,"../common/object/getACL":38,"../common/object/getBucketVersions":39,"../common/object/getObjectMeta":40,"../common/object/getObjectTagging":41,"../common/object/getObjectUrl":42,"../common/object/getSymlink":43,"../common/object/head":44,"../common/object/putACL":45,"../common/object/putObjectTagging":46,"../common/object/putSymlink":47,"../common/object/signatureUrl":48,"../common/utils/isBlob":64,"../common/utils/isBuffer":65,"../common/utils/isFile":67,"../common/utils/obj2xml":72,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"copy-to":94,"core-js/modules/es.array.map.js":280,"core-js/modules/es.function.name.js":284,"core-js/modules/es.number.constructor.js":286,"core-js/modules/es.object.assign.js":287,"core-js/modules/es.object.keys.js":290,"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.promise.js":295,"core-js/modules/es.regexp.exec.js":300,"core-js/modules/es.regexp.to-string.js":301,"core-js/modules/es.string.replace.js":305,"core-js/modules/web.dom-collections.for-each.js":339,"fs":89,"merge-descriptors":372,"mime":374,"path":378}],6:[function(require,module,exports){
  2110. "use strict";
  2111. exports.version = '6.18.1';
  2112. },{}],7:[function(require,module,exports){
  2113. "use strict";
  2114. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2115. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2116. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2117. Object.defineProperty(exports, "__esModule", {
  2118. value: true
  2119. });
  2120. exports.abortBucketWorm = void 0;
  2121. var checkBucketName_1 = require("../utils/checkBucketName");
  2122. function abortBucketWorm(_x, _x2) {
  2123. return _abortBucketWorm.apply(this, arguments);
  2124. }
  2125. function _abortBucketWorm() {
  2126. _abortBucketWorm = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
  2127. var params, result;
  2128. return _regenerator.default.wrap(function _callee$(_context) {
  2129. while (1) {
  2130. switch (_context.prev = _context.next) {
  2131. case 0:
  2132. checkBucketName_1.checkBucketName(name);
  2133. params = this._bucketRequestParams('DELETE', name, 'worm', options);
  2134. _context.next = 4;
  2135. return this.request(params);
  2136. case 4:
  2137. result = _context.sent;
  2138. return _context.abrupt("return", {
  2139. res: result.res,
  2140. status: result.status
  2141. });
  2142. case 6:
  2143. case "end":
  2144. return _context.stop();
  2145. }
  2146. }
  2147. }, _callee, this);
  2148. }));
  2149. return _abortBucketWorm.apply(this, arguments);
  2150. }
  2151. exports.abortBucketWorm = abortBucketWorm;
  2152. },{"../utils/checkBucketName":51,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80}],8:[function(require,module,exports){
  2153. "use strict";
  2154. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2155. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2156. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2157. Object.defineProperty(exports, "__esModule", {
  2158. value: true
  2159. });
  2160. exports.completeBucketWorm = void 0;
  2161. var checkBucketName_1 = require("../utils/checkBucketName");
  2162. function completeBucketWorm(_x, _x2, _x3) {
  2163. return _completeBucketWorm.apply(this, arguments);
  2164. }
  2165. function _completeBucketWorm() {
  2166. _completeBucketWorm = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, wormId, options) {
  2167. var params, result;
  2168. return _regenerator.default.wrap(function _callee$(_context) {
  2169. while (1) {
  2170. switch (_context.prev = _context.next) {
  2171. case 0:
  2172. checkBucketName_1.checkBucketName(name);
  2173. params = this._bucketRequestParams('POST', name, {
  2174. wormId: wormId
  2175. }, options);
  2176. _context.next = 4;
  2177. return this.request(params);
  2178. case 4:
  2179. result = _context.sent;
  2180. return _context.abrupt("return", {
  2181. res: result.res,
  2182. status: result.status
  2183. });
  2184. case 6:
  2185. case "end":
  2186. return _context.stop();
  2187. }
  2188. }
  2189. }, _callee, this);
  2190. }));
  2191. return _completeBucketWorm.apply(this, arguments);
  2192. }
  2193. exports.completeBucketWorm = completeBucketWorm;
  2194. },{"../utils/checkBucketName":51,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80}],9:[function(require,module,exports){
  2195. "use strict";
  2196. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2197. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2198. require("core-js/modules/es.object.assign.js");
  2199. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2200. Object.defineProperty(exports, "__esModule", {
  2201. value: true
  2202. });
  2203. exports.deleteBucketInventory = void 0;
  2204. var checkBucketName_1 = require("../utils/checkBucketName");
  2205. /**
  2206. * deleteBucketInventory
  2207. * @param {String} bucketName - bucket name
  2208. * @param {String} inventoryId
  2209. * @param {Object} options
  2210. */
  2211. function deleteBucketInventory(_x, _x2) {
  2212. return _deleteBucketInventory.apply(this, arguments);
  2213. }
  2214. function _deleteBucketInventory() {
  2215. _deleteBucketInventory = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(bucketName, inventoryId) {
  2216. var options,
  2217. subres,
  2218. params,
  2219. result,
  2220. _args = arguments;
  2221. return _regenerator.default.wrap(function _callee$(_context) {
  2222. while (1) {
  2223. switch (_context.prev = _context.next) {
  2224. case 0:
  2225. options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
  2226. subres = Object.assign({
  2227. inventory: '',
  2228. inventoryId: inventoryId
  2229. }, options.subres);
  2230. checkBucketName_1.checkBucketName(bucketName);
  2231. params = this._bucketRequestParams('DELETE', bucketName, subres, options);
  2232. params.successStatuses = [204];
  2233. _context.next = 7;
  2234. return this.request(params);
  2235. case 7:
  2236. result = _context.sent;
  2237. return _context.abrupt("return", {
  2238. status: result.status,
  2239. res: result.res
  2240. });
  2241. case 9:
  2242. case "end":
  2243. return _context.stop();
  2244. }
  2245. }
  2246. }, _callee, this);
  2247. }));
  2248. return _deleteBucketInventory.apply(this, arguments);
  2249. }
  2250. exports.deleteBucketInventory = deleteBucketInventory;
  2251. },{"../utils/checkBucketName":51,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.object.assign.js":287}],10:[function(require,module,exports){
  2252. "use strict";
  2253. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2254. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2255. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2256. var _require = require('../utils/checkBucketName'),
  2257. _checkBucketName = _require.checkBucketName;
  2258. var proto = exports;
  2259. proto.deleteBucketLifecycle = /*#__PURE__*/function () {
  2260. var _deleteBucketLifecycle = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
  2261. var params, result;
  2262. return _regenerator.default.wrap(function _callee$(_context) {
  2263. while (1) {
  2264. switch (_context.prev = _context.next) {
  2265. case 0:
  2266. _checkBucketName(name);
  2267. params = this._bucketRequestParams('DELETE', name, 'lifecycle', options);
  2268. params.successStatuses = [204];
  2269. _context.next = 5;
  2270. return this.request(params);
  2271. case 5:
  2272. result = _context.sent;
  2273. return _context.abrupt("return", {
  2274. res: result.res
  2275. });
  2276. case 7:
  2277. case "end":
  2278. return _context.stop();
  2279. }
  2280. }
  2281. }, _callee, this);
  2282. }));
  2283. function deleteBucketLifecycle(_x, _x2) {
  2284. return _deleteBucketLifecycle.apply(this, arguments);
  2285. }
  2286. return deleteBucketLifecycle;
  2287. }();
  2288. },{"../utils/checkBucketName":51,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80}],11:[function(require,module,exports){
  2289. "use strict";
  2290. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2291. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2292. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2293. var _require = require('../utils/checkBucketName'),
  2294. _checkBucketName = _require.checkBucketName;
  2295. var proto = exports;
  2296. proto.deleteBucketWebsite = /*#__PURE__*/function () {
  2297. var _deleteBucketWebsite = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
  2298. var params, result;
  2299. return _regenerator.default.wrap(function _callee$(_context) {
  2300. while (1) {
  2301. switch (_context.prev = _context.next) {
  2302. case 0:
  2303. _checkBucketName(name);
  2304. params = this._bucketRequestParams('DELETE', name, 'website', options);
  2305. params.successStatuses = [204];
  2306. _context.next = 5;
  2307. return this.request(params);
  2308. case 5:
  2309. result = _context.sent;
  2310. return _context.abrupt("return", {
  2311. res: result.res
  2312. });
  2313. case 7:
  2314. case "end":
  2315. return _context.stop();
  2316. }
  2317. }
  2318. }, _callee, this);
  2319. }));
  2320. function deleteBucketWebsite(_x, _x2) {
  2321. return _deleteBucketWebsite.apply(this, arguments);
  2322. }
  2323. return deleteBucketWebsite;
  2324. }();
  2325. },{"../utils/checkBucketName":51,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80}],12:[function(require,module,exports){
  2326. "use strict";
  2327. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2328. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2329. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2330. Object.defineProperty(exports, "__esModule", {
  2331. value: true
  2332. });
  2333. exports.extendBucketWorm = void 0;
  2334. var checkBucketName_1 = require("../utils/checkBucketName");
  2335. var obj2xml_1 = require("../utils/obj2xml");
  2336. function extendBucketWorm(_x, _x2, _x3, _x4) {
  2337. return _extendBucketWorm.apply(this, arguments);
  2338. }
  2339. function _extendBucketWorm() {
  2340. _extendBucketWorm = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, wormId, days, options) {
  2341. var params, paramlXMLObJ, result;
  2342. return _regenerator.default.wrap(function _callee$(_context) {
  2343. while (1) {
  2344. switch (_context.prev = _context.next) {
  2345. case 0:
  2346. checkBucketName_1.checkBucketName(name);
  2347. params = this._bucketRequestParams('POST', name, {
  2348. wormExtend: '',
  2349. wormId: wormId
  2350. }, options);
  2351. paramlXMLObJ = {
  2352. ExtendWormConfiguration: {
  2353. RetentionPeriodInDays: days
  2354. }
  2355. };
  2356. params.mime = 'xml';
  2357. params.content = obj2xml_1.obj2xml(paramlXMLObJ, {
  2358. headers: true
  2359. });
  2360. params.successStatuses = [200];
  2361. _context.next = 8;
  2362. return this.request(params);
  2363. case 8:
  2364. result = _context.sent;
  2365. return _context.abrupt("return", {
  2366. res: result.res,
  2367. status: result.status
  2368. });
  2369. case 10:
  2370. case "end":
  2371. return _context.stop();
  2372. }
  2373. }
  2374. }, _callee, this);
  2375. }));
  2376. return _extendBucketWorm.apply(this, arguments);
  2377. }
  2378. exports.extendBucketWorm = extendBucketWorm;
  2379. },{"../utils/checkBucketName":51,"../utils/obj2xml":72,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80}],13:[function(require,module,exports){
  2380. "use strict";
  2381. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2382. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2383. require("core-js/modules/es.object.assign.js");
  2384. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2385. Object.defineProperty(exports, "__esModule", {
  2386. value: true
  2387. });
  2388. exports.getBucketInventory = void 0;
  2389. var checkBucketName_1 = require("../utils/checkBucketName");
  2390. var formatInventoryConfig_1 = require("../utils/formatInventoryConfig");
  2391. /**
  2392. * getBucketInventory
  2393. * @param {String} bucketName - bucket name
  2394. * @param {String} inventoryId
  2395. * @param {Object} options
  2396. */
  2397. function getBucketInventory(_x, _x2) {
  2398. return _getBucketInventory.apply(this, arguments);
  2399. }
  2400. function _getBucketInventory() {
  2401. _getBucketInventory = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(bucketName, inventoryId) {
  2402. var options,
  2403. subres,
  2404. params,
  2405. result,
  2406. _args = arguments;
  2407. return _regenerator.default.wrap(function _callee$(_context) {
  2408. while (1) {
  2409. switch (_context.prev = _context.next) {
  2410. case 0:
  2411. options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
  2412. subres = Object.assign({
  2413. inventory: '',
  2414. inventoryId: inventoryId
  2415. }, options.subres);
  2416. checkBucketName_1.checkBucketName(bucketName);
  2417. params = this._bucketRequestParams('GET', bucketName, subres, options);
  2418. params.successStatuses = [200];
  2419. params.xmlResponse = true;
  2420. _context.next = 8;
  2421. return this.request(params);
  2422. case 8:
  2423. result = _context.sent;
  2424. return _context.abrupt("return", {
  2425. status: result.status,
  2426. res: result.res,
  2427. inventory: formatInventoryConfig_1.formatInventoryConfig(result.data)
  2428. });
  2429. case 10:
  2430. case "end":
  2431. return _context.stop();
  2432. }
  2433. }
  2434. }, _callee, this);
  2435. }));
  2436. return _getBucketInventory.apply(this, arguments);
  2437. }
  2438. exports.getBucketInventory = getBucketInventory;
  2439. },{"../utils/checkBucketName":51,"../utils/formatInventoryConfig":60,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.object.assign.js":287}],14:[function(require,module,exports){
  2440. "use strict";
  2441. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2442. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2443. require("core-js/modules/es.array.map.js");
  2444. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2445. var _require = require('../utils/checkBucketName'),
  2446. _checkBucketName = _require.checkBucketName;
  2447. var _require2 = require('../utils/isArray'),
  2448. isArray = _require2.isArray;
  2449. var _require3 = require('../utils/formatObjKey'),
  2450. formatObjKey = _require3.formatObjKey;
  2451. var proto = exports;
  2452. proto.getBucketLifecycle = /*#__PURE__*/function () {
  2453. var _getBucketLifecycle = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
  2454. var params, result, rules;
  2455. return _regenerator.default.wrap(function _callee$(_context) {
  2456. while (1) {
  2457. switch (_context.prev = _context.next) {
  2458. case 0:
  2459. _checkBucketName(name);
  2460. params = this._bucketRequestParams('GET', name, 'lifecycle', options);
  2461. params.successStatuses = [200];
  2462. params.xmlResponse = true;
  2463. _context.next = 6;
  2464. return this.request(params);
  2465. case 6:
  2466. result = _context.sent;
  2467. rules = result.data.Rule || null;
  2468. if (rules) {
  2469. if (!isArray(rules)) {
  2470. rules = [rules];
  2471. }
  2472. rules = rules.map(function (_) {
  2473. if (_.ID) {
  2474. _.id = _.ID;
  2475. delete _.ID;
  2476. }
  2477. if (_.Tag && !isArray(_.Tag)) {
  2478. _.Tag = [_.Tag];
  2479. }
  2480. return formatObjKey(_, 'firstLowerCase');
  2481. });
  2482. }
  2483. return _context.abrupt("return", {
  2484. rules: rules,
  2485. res: result.res
  2486. });
  2487. case 10:
  2488. case "end":
  2489. return _context.stop();
  2490. }
  2491. }
  2492. }, _callee, this);
  2493. }));
  2494. function getBucketLifecycle(_x, _x2) {
  2495. return _getBucketLifecycle.apply(this, arguments);
  2496. }
  2497. return getBucketLifecycle;
  2498. }();
  2499. },{"../utils/checkBucketName":51,"../utils/formatObjKey":61,"../utils/isArray":63,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.array.map.js":280}],15:[function(require,module,exports){
  2500. "use strict";
  2501. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2502. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2503. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2504. var _require = require('../utils/checkBucketName'),
  2505. _checkBucketName = _require.checkBucketName;
  2506. var proto = exports;
  2507. /**
  2508. * getBucketVersioning
  2509. * @param {String} bucketName - bucket name
  2510. */
  2511. proto.getBucketVersioning = /*#__PURE__*/function () {
  2512. var _getBucketVersioning = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(bucketName, options) {
  2513. var params, result, versionStatus;
  2514. return _regenerator.default.wrap(function _callee$(_context) {
  2515. while (1) {
  2516. switch (_context.prev = _context.next) {
  2517. case 0:
  2518. _checkBucketName(bucketName);
  2519. params = this._bucketRequestParams('GET', bucketName, 'versioning', options);
  2520. params.xmlResponse = true;
  2521. params.successStatuses = [200];
  2522. _context.next = 6;
  2523. return this.request(params);
  2524. case 6:
  2525. result = _context.sent;
  2526. versionStatus = result.data.Status;
  2527. return _context.abrupt("return", {
  2528. status: result.status,
  2529. versionStatus: versionStatus,
  2530. res: result.res
  2531. });
  2532. case 9:
  2533. case "end":
  2534. return _context.stop();
  2535. }
  2536. }
  2537. }, _callee, this);
  2538. }));
  2539. function getBucketVersioning(_x, _x2) {
  2540. return _getBucketVersioning.apply(this, arguments);
  2541. }
  2542. return getBucketVersioning;
  2543. }();
  2544. },{"../utils/checkBucketName":51,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80}],16:[function(require,module,exports){
  2545. "use strict";
  2546. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2547. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2548. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2549. var _require = require('../utils/checkBucketName'),
  2550. _checkBucketName = _require.checkBucketName;
  2551. var _require2 = require('../utils/isObject'),
  2552. isObject = _require2.isObject;
  2553. var proto = exports;
  2554. proto.getBucketWebsite = /*#__PURE__*/function () {
  2555. var _getBucketWebsite = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
  2556. var params, result, routingRules;
  2557. return _regenerator.default.wrap(function _callee$(_context) {
  2558. while (1) {
  2559. switch (_context.prev = _context.next) {
  2560. case 0:
  2561. _checkBucketName(name);
  2562. params = this._bucketRequestParams('GET', name, 'website', options);
  2563. params.successStatuses = [200];
  2564. params.xmlResponse = true;
  2565. _context.next = 6;
  2566. return this.request(params);
  2567. case 6:
  2568. result = _context.sent;
  2569. routingRules = [];
  2570. if (result.data.RoutingRules && result.data.RoutingRules.RoutingRule) {
  2571. if (isObject(result.data.RoutingRules.RoutingRule)) {
  2572. routingRules = [result.data.RoutingRules.RoutingRule];
  2573. } else {
  2574. routingRules = result.data.RoutingRules.RoutingRule;
  2575. }
  2576. }
  2577. return _context.abrupt("return", {
  2578. index: result.data.IndexDocument && result.data.IndexDocument.Suffix || '',
  2579. supportSubDir: result.data.IndexDocument && result.data.IndexDocument.SupportSubDir || 'false',
  2580. type: result.data.IndexDocument && result.data.IndexDocument.Type,
  2581. routingRules: routingRules,
  2582. error: result.data.ErrorDocument && result.data.ErrorDocument.Key || null,
  2583. res: result.res
  2584. });
  2585. case 10:
  2586. case "end":
  2587. return _context.stop();
  2588. }
  2589. }
  2590. }, _callee, this);
  2591. }));
  2592. function getBucketWebsite(_x, _x2) {
  2593. return _getBucketWebsite.apply(this, arguments);
  2594. }
  2595. return getBucketWebsite;
  2596. }();
  2597. },{"../utils/checkBucketName":51,"../utils/isObject":70,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80}],17:[function(require,module,exports){
  2598. "use strict";
  2599. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2600. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2601. require("core-js/modules/es.object.assign.js");
  2602. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2603. Object.defineProperty(exports, "__esModule", {
  2604. value: true
  2605. });
  2606. exports.getBucketWorm = void 0;
  2607. var checkBucketName_1 = require("../utils/checkBucketName");
  2608. var dataFix_1 = require("../utils/dataFix");
  2609. function getBucketWorm(_x, _x2) {
  2610. return _getBucketWorm.apply(this, arguments);
  2611. }
  2612. function _getBucketWorm() {
  2613. _getBucketWorm = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
  2614. var params, result;
  2615. return _regenerator.default.wrap(function _callee$(_context) {
  2616. while (1) {
  2617. switch (_context.prev = _context.next) {
  2618. case 0:
  2619. checkBucketName_1.checkBucketName(name);
  2620. params = this._bucketRequestParams('GET', name, 'worm', options);
  2621. params.successStatuses = [200];
  2622. params.xmlResponse = true;
  2623. _context.next = 6;
  2624. return this.request(params);
  2625. case 6:
  2626. result = _context.sent;
  2627. dataFix_1.dataFix(result.data, {
  2628. lowerFirst: true,
  2629. rename: {
  2630. RetentionPeriodInDays: 'days'
  2631. }
  2632. });
  2633. return _context.abrupt("return", Object.assign(Object.assign({}, result.data), {
  2634. res: result.res,
  2635. status: result.status
  2636. }));
  2637. case 9:
  2638. case "end":
  2639. return _context.stop();
  2640. }
  2641. }
  2642. }, _callee, this);
  2643. }));
  2644. return _getBucketWorm.apply(this, arguments);
  2645. }
  2646. exports.getBucketWorm = getBucketWorm;
  2647. },{"../utils/checkBucketName":51,"../utils/dataFix":57,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.object.assign.js":287}],18:[function(require,module,exports){
  2648. "use strict";
  2649. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2650. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2651. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2652. Object.defineProperty(exports, "__esModule", {
  2653. value: true
  2654. });
  2655. exports.initiateBucketWorm = void 0;
  2656. var obj2xml_1 = require("../utils/obj2xml");
  2657. var checkBucketName_1 = require("../utils/checkBucketName");
  2658. function initiateBucketWorm(_x, _x2, _x3) {
  2659. return _initiateBucketWorm.apply(this, arguments);
  2660. }
  2661. function _initiateBucketWorm() {
  2662. _initiateBucketWorm = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, days, options) {
  2663. var params, paramlXMLObJ, result;
  2664. return _regenerator.default.wrap(function _callee$(_context) {
  2665. while (1) {
  2666. switch (_context.prev = _context.next) {
  2667. case 0:
  2668. checkBucketName_1.checkBucketName(name);
  2669. params = this._bucketRequestParams('POST', name, 'worm', options);
  2670. paramlXMLObJ = {
  2671. InitiateWormConfiguration: {
  2672. RetentionPeriodInDays: days
  2673. }
  2674. };
  2675. params.mime = 'xml';
  2676. params.content = obj2xml_1.obj2xml(paramlXMLObJ, {
  2677. headers: true
  2678. });
  2679. params.successStatuses = [200];
  2680. _context.next = 8;
  2681. return this.request(params);
  2682. case 8:
  2683. result = _context.sent;
  2684. return _context.abrupt("return", {
  2685. res: result.res,
  2686. wormId: result.res.headers['x-oss-worm-id'],
  2687. status: result.status
  2688. });
  2689. case 10:
  2690. case "end":
  2691. return _context.stop();
  2692. }
  2693. }
  2694. }, _callee, this);
  2695. }));
  2696. return _initiateBucketWorm.apply(this, arguments);
  2697. }
  2698. exports.initiateBucketWorm = initiateBucketWorm;
  2699. },{"../utils/checkBucketName":51,"../utils/obj2xml":72,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80}],19:[function(require,module,exports){
  2700. "use strict";
  2701. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2702. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2703. require("core-js/modules/es.object.assign.js");
  2704. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2705. Object.defineProperty(exports, "__esModule", {
  2706. value: true
  2707. });
  2708. exports.listBucketInventory = void 0;
  2709. var checkBucketName_1 = require("../utils/checkBucketName");
  2710. var formatInventoryConfig_1 = require("../utils/formatInventoryConfig");
  2711. /**
  2712. * listBucketInventory
  2713. * @param {String} bucketName - bucket name
  2714. * @param {String} inventoryId
  2715. * @param {Object} options
  2716. */
  2717. function listBucketInventory(_x) {
  2718. return _listBucketInventory.apply(this, arguments);
  2719. }
  2720. function _listBucketInventory() {
  2721. _listBucketInventory = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(bucketName) {
  2722. var options,
  2723. continuationToken,
  2724. subres,
  2725. params,
  2726. result,
  2727. data,
  2728. res,
  2729. status,
  2730. _args = arguments;
  2731. return _regenerator.default.wrap(function _callee$(_context) {
  2732. while (1) {
  2733. switch (_context.prev = _context.next) {
  2734. case 0:
  2735. options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  2736. continuationToken = options.continuationToken;
  2737. subres = Object.assign({
  2738. inventory: ''
  2739. }, continuationToken && {
  2740. 'continuation-token': continuationToken
  2741. }, options.subres);
  2742. checkBucketName_1.checkBucketName(bucketName);
  2743. params = this._bucketRequestParams('GET', bucketName, subres, options);
  2744. params.successStatuses = [200];
  2745. params.xmlResponse = true;
  2746. _context.next = 9;
  2747. return this.request(params);
  2748. case 9:
  2749. result = _context.sent;
  2750. data = result.data, res = result.res, status = result.status;
  2751. return _context.abrupt("return", {
  2752. isTruncated: data.IsTruncated === 'true',
  2753. nextContinuationToken: data.NextContinuationToken,
  2754. inventoryList: formatInventoryConfig_1.formatInventoryConfig(data.InventoryConfiguration, true),
  2755. status: status,
  2756. res: res
  2757. });
  2758. case 12:
  2759. case "end":
  2760. return _context.stop();
  2761. }
  2762. }
  2763. }, _callee, this);
  2764. }));
  2765. return _listBucketInventory.apply(this, arguments);
  2766. }
  2767. exports.listBucketInventory = listBucketInventory;
  2768. },{"../utils/checkBucketName":51,"../utils/formatInventoryConfig":60,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.object.assign.js":287}],20:[function(require,module,exports){
  2769. "use strict";
  2770. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2771. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2772. require("core-js/modules/es.object.assign.js");
  2773. require("core-js/modules/es.array.concat.js");
  2774. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2775. Object.defineProperty(exports, "__esModule", {
  2776. value: true
  2777. });
  2778. exports.putBucketInventory = void 0;
  2779. var checkBucketName_1 = require("../utils/checkBucketName");
  2780. var obj2xml_1 = require("../utils/obj2xml");
  2781. /**
  2782. * putBucketInventory
  2783. * @param {String} bucketName - bucket name
  2784. * @param {Inventory} inventory
  2785. * @param {Object} options
  2786. */
  2787. function putBucketInventory(_x, _x2) {
  2788. return _putBucketInventory.apply(this, arguments);
  2789. }
  2790. function _putBucketInventory() {
  2791. _putBucketInventory = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(bucketName, inventory) {
  2792. var options,
  2793. subres,
  2794. OSSBucketDestination,
  2795. optionalFields,
  2796. includedObjectVersions,
  2797. destinationBucketPrefix,
  2798. rolePrefix,
  2799. paramXMLObj,
  2800. paramXML,
  2801. params,
  2802. result,
  2803. _args = arguments;
  2804. return _regenerator.default.wrap(function _callee$(_context) {
  2805. while (1) {
  2806. switch (_context.prev = _context.next) {
  2807. case 0:
  2808. options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
  2809. subres = Object.assign({
  2810. inventory: '',
  2811. inventoryId: inventory.id
  2812. }, options.subres);
  2813. checkBucketName_1.checkBucketName(bucketName);
  2814. OSSBucketDestination = inventory.OSSBucketDestination, optionalFields = inventory.optionalFields, includedObjectVersions = inventory.includedObjectVersions;
  2815. destinationBucketPrefix = 'acs:oss:::';
  2816. rolePrefix = "acs:ram::".concat(OSSBucketDestination.accountId, ":role/");
  2817. paramXMLObj = {
  2818. InventoryConfiguration: {
  2819. Id: inventory.id,
  2820. IsEnabled: inventory.isEnabled,
  2821. Filter: {
  2822. Prefix: inventory.prefix || ''
  2823. },
  2824. Destination: {
  2825. OSSBucketDestination: {
  2826. Format: OSSBucketDestination.format,
  2827. AccountId: OSSBucketDestination.accountId,
  2828. RoleArn: "".concat(rolePrefix).concat(OSSBucketDestination.rolename),
  2829. Bucket: "".concat(destinationBucketPrefix).concat(OSSBucketDestination.bucket),
  2830. Prefix: OSSBucketDestination.prefix || '',
  2831. Encryption: OSSBucketDestination.encryption || ''
  2832. }
  2833. },
  2834. Schedule: {
  2835. Frequency: inventory.frequency
  2836. },
  2837. IncludedObjectVersions: includedObjectVersions,
  2838. OptionalFields: {
  2839. Field: (optionalFields === null || optionalFields === void 0 ? void 0 : optionalFields.field) || []
  2840. }
  2841. }
  2842. };
  2843. paramXML = obj2xml_1.obj2xml(paramXMLObj, {
  2844. headers: true,
  2845. firstUpperCase: true
  2846. });
  2847. params = this._bucketRequestParams('PUT', bucketName, subres, options);
  2848. params.successStatuses = [200];
  2849. params.mime = 'xml';
  2850. params.content = paramXML;
  2851. _context.next = 14;
  2852. return this.request(params);
  2853. case 14:
  2854. result = _context.sent;
  2855. return _context.abrupt("return", {
  2856. status: result.status,
  2857. res: result.res
  2858. });
  2859. case 16:
  2860. case "end":
  2861. return _context.stop();
  2862. }
  2863. }
  2864. }, _callee, this);
  2865. }));
  2866. return _putBucketInventory.apply(this, arguments);
  2867. }
  2868. exports.putBucketInventory = putBucketInventory;
  2869. },{"../utils/checkBucketName":51,"../utils/obj2xml":72,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.array.concat.js":272,"core-js/modules/es.object.assign.js":287}],21:[function(require,module,exports){
  2870. "use strict";
  2871. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2872. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2873. require("core-js/modules/es.object.to-string.js");
  2874. require("core-js/modules/web.dom-collections.for-each.js");
  2875. require("core-js/modules/es.regexp.exec.js");
  2876. require("core-js/modules/es.array.includes.js");
  2877. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2878. /* eslint-disable no-use-before-define */
  2879. var _require = require('../utils/checkBucketName'),
  2880. _checkBucketName = _require.checkBucketName;
  2881. var _require2 = require('../utils/isArray'),
  2882. isArray = _require2.isArray;
  2883. var _require3 = require('../utils/deepCopy'),
  2884. deepCopy = _require3.deepCopy;
  2885. var _require4 = require('../utils/isObject'),
  2886. isObject = _require4.isObject;
  2887. var _require5 = require('../utils/obj2xml'),
  2888. obj2xml = _require5.obj2xml;
  2889. var _require6 = require('../utils/checkObjectTag'),
  2890. checkObjectTag = _require6.checkObjectTag;
  2891. var _require7 = require('../utils/getStrBytesCount'),
  2892. getStrBytesCount = _require7.getStrBytesCount;
  2893. var proto = exports;
  2894. proto.putBucketLifecycle = /*#__PURE__*/function () {
  2895. var _putBucketLifecycle = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, rules, options) {
  2896. var params, Rule, paramXMLObj, paramXML, result;
  2897. return _regenerator.default.wrap(function _callee$(_context) {
  2898. while (1) {
  2899. switch (_context.prev = _context.next) {
  2900. case 0:
  2901. _checkBucketName(name);
  2902. if (isArray(rules)) {
  2903. _context.next = 3;
  2904. break;
  2905. }
  2906. throw new Error('rules must be Array');
  2907. case 3:
  2908. params = this._bucketRequestParams('PUT', name, 'lifecycle', options);
  2909. Rule = [];
  2910. paramXMLObj = {
  2911. LifecycleConfiguration: {
  2912. Rule: Rule
  2913. }
  2914. };
  2915. rules.forEach(function (_) {
  2916. defaultDaysAndDate2Expiration(_); // todo delete, 兼容旧版本
  2917. checkRule(_);
  2918. if (_.id) {
  2919. _.ID = _.id;
  2920. delete _.id;
  2921. }
  2922. Rule.push(_);
  2923. });
  2924. paramXML = obj2xml(paramXMLObj, {
  2925. headers: true,
  2926. firstUpperCase: true
  2927. });
  2928. params.content = paramXML;
  2929. params.mime = 'xml';
  2930. params.successStatuses = [200];
  2931. _context.next = 13;
  2932. return this.request(params);
  2933. case 13:
  2934. result = _context.sent;
  2935. return _context.abrupt("return", {
  2936. res: result.res
  2937. });
  2938. case 15:
  2939. case "end":
  2940. return _context.stop();
  2941. }
  2942. }
  2943. }, _callee, this);
  2944. }));
  2945. function putBucketLifecycle(_x, _x2, _x3) {
  2946. return _putBucketLifecycle.apply(this, arguments);
  2947. }
  2948. return putBucketLifecycle;
  2949. }(); // todo delete, 兼容旧版本
  2950. function defaultDaysAndDate2Expiration(obj) {
  2951. if (obj.days) {
  2952. obj.expiration = {
  2953. days: obj.days
  2954. };
  2955. }
  2956. if (obj.date) {
  2957. obj.expiration = {
  2958. createdBeforeDate: obj.date
  2959. };
  2960. }
  2961. }
  2962. function checkDaysAndDate(obj, key) {
  2963. var days = obj.days,
  2964. createdBeforeDate = obj.createdBeforeDate;
  2965. if (!days && !createdBeforeDate) {
  2966. throw new Error("".concat(key, " must includes days or createdBeforeDate"));
  2967. } else if (days && !/^[1-9][0-9]*$/.test(days)) {
  2968. throw new Error('days must be a positive integer');
  2969. } else if (createdBeforeDate && !/\d{4}-\d{2}-\d{2}T00:00:00.000Z/.test(createdBeforeDate)) {
  2970. throw new Error('createdBeforeDate must be date and conform to iso8601 format');
  2971. }
  2972. }
  2973. function handleCheckTag(tag) {
  2974. if (!isArray(tag) && !isObject(tag)) {
  2975. throw new Error('tag must be Object or Array');
  2976. }
  2977. tag = isObject(tag) ? [tag] : tag;
  2978. var tagObj = {};
  2979. var tagClone = deepCopy(tag);
  2980. tagClone.forEach(function (v) {
  2981. tagObj[v.key] = v.value;
  2982. });
  2983. checkObjectTag(tagObj);
  2984. }
  2985. function checkRule(rule) {
  2986. if (rule.id && getStrBytesCount(rule.id) > 255) throw new Error('ID is composed of 255 bytes at most');
  2987. if (rule.prefix === undefined) throw new Error('Rule must includes prefix');
  2988. if (!['Enabled', 'Disabled'].includes(rule.status)) throw new Error('Status must be Enabled or Disabled');
  2989. if (rule.transition) {
  2990. if (!['IA', 'Archive'].includes(rule.transition.storageClass)) throw new Error('StorageClass must be IA or Archive');
  2991. checkDaysAndDate(rule.transition, 'Transition');
  2992. }
  2993. if (rule.expiration) {
  2994. if (!rule.expiration.expiredObjectDeleteMarker) {
  2995. checkDaysAndDate(rule.expiration, 'Expiration');
  2996. } else if (rule.expiration.days || rule.expiration.createdBeforeDate) {
  2997. throw new Error('expiredObjectDeleteMarker cannot be used with days or createdBeforeDate');
  2998. }
  2999. }
  3000. if (rule.abortMultipartUpload) {
  3001. checkDaysAndDate(rule.abortMultipartUpload, 'AbortMultipartUpload');
  3002. }
  3003. if (!rule.expiration && !rule.abortMultipartUpload && !rule.transition && !rule.noncurrentVersionTransition) {
  3004. throw new Error('Rule must includes expiration or abortMultipartUpload or transition or noncurrentVersionTransition');
  3005. }
  3006. if (rule.tag) {
  3007. if (rule.abortMultipartUpload) {
  3008. throw new Error('Tag cannot be used with abortMultipartUpload');
  3009. }
  3010. handleCheckTag(rule.tag);
  3011. }
  3012. }
  3013. },{"../utils/checkBucketName":51,"../utils/checkObjectTag":54,"../utils/deepCopy":58,"../utils/getStrBytesCount":62,"../utils/isArray":63,"../utils/isObject":70,"../utils/obj2xml":72,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.array.includes.js":277,"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.regexp.exec.js":300,"core-js/modules/web.dom-collections.for-each.js":339}],22:[function(require,module,exports){
  3014. "use strict";
  3015. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  3016. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  3017. require("core-js/modules/es.array.includes.js");
  3018. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  3019. var _require = require('../utils/checkBucketName'),
  3020. _checkBucketName = _require.checkBucketName;
  3021. var _require2 = require('../utils/obj2xml'),
  3022. obj2xml = _require2.obj2xml;
  3023. var proto = exports;
  3024. /**
  3025. * putBucketVersioning
  3026. * @param {String} name - bucket name
  3027. * @param {String} status
  3028. * @param {Object} options
  3029. */
  3030. proto.putBucketVersioning = /*#__PURE__*/function () {
  3031. var _putBucketVersioning = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, status) {
  3032. var options,
  3033. params,
  3034. paramXMLObj,
  3035. result,
  3036. _args = arguments;
  3037. return _regenerator.default.wrap(function _callee$(_context) {
  3038. while (1) {
  3039. switch (_context.prev = _context.next) {
  3040. case 0:
  3041. options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
  3042. _checkBucketName(name);
  3043. if (['Enabled', 'Suspended'].includes(status)) {
  3044. _context.next = 4;
  3045. break;
  3046. }
  3047. throw new Error('status must be Enabled or Suspended');
  3048. case 4:
  3049. params = this._bucketRequestParams('PUT', name, 'versioning', options);
  3050. paramXMLObj = {
  3051. VersioningConfiguration: {
  3052. Status: status
  3053. }
  3054. };
  3055. params.mime = 'xml';
  3056. params.content = obj2xml(paramXMLObj, {
  3057. headers: true
  3058. });
  3059. _context.next = 10;
  3060. return this.request(params);
  3061. case 10:
  3062. result = _context.sent;
  3063. return _context.abrupt("return", {
  3064. res: result.res,
  3065. status: result.status
  3066. });
  3067. case 12:
  3068. case "end":
  3069. return _context.stop();
  3070. }
  3071. }
  3072. }, _callee, this);
  3073. }));
  3074. function putBucketVersioning(_x, _x2) {
  3075. return _putBucketVersioning.apply(this, arguments);
  3076. }
  3077. return putBucketVersioning;
  3078. }();
  3079. },{"../utils/checkBucketName":51,"../utils/obj2xml":72,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.array.includes.js":277}],23:[function(require,module,exports){
  3080. "use strict";
  3081. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  3082. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  3083. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  3084. var _require = require('../utils/checkBucketName'),
  3085. _checkBucketName = _require.checkBucketName;
  3086. var _require2 = require('../utils/obj2xml'),
  3087. obj2xml = _require2.obj2xml;
  3088. var _require3 = require('../utils/isArray'),
  3089. isArray = _require3.isArray;
  3090. var proto = exports;
  3091. proto.putBucketWebsite = /*#__PURE__*/function () {
  3092. var _putBucketWebsite = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name) {
  3093. var config,
  3094. options,
  3095. params,
  3096. IndexDocument,
  3097. WebsiteConfiguration,
  3098. website,
  3099. result,
  3100. _args = arguments;
  3101. return _regenerator.default.wrap(function _callee$(_context) {
  3102. while (1) {
  3103. switch (_context.prev = _context.next) {
  3104. case 0:
  3105. config = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  3106. options = _args.length > 2 ? _args[2] : undefined;
  3107. _checkBucketName(name);
  3108. params = this._bucketRequestParams('PUT', name, 'website', options);
  3109. IndexDocument = {
  3110. Suffix: config.index || 'index.html'
  3111. };
  3112. WebsiteConfiguration = {
  3113. IndexDocument: IndexDocument
  3114. };
  3115. website = {
  3116. WebsiteConfiguration: WebsiteConfiguration
  3117. };
  3118. if (config.supportSubDir) {
  3119. IndexDocument.SupportSubDir = config.supportSubDir;
  3120. }
  3121. if (config.type) {
  3122. IndexDocument.Type = config.type;
  3123. }
  3124. if (config.error) {
  3125. WebsiteConfiguration.ErrorDocument = {
  3126. Key: config.error
  3127. };
  3128. }
  3129. if (!(config.routingRules !== undefined)) {
  3130. _context.next = 14;
  3131. break;
  3132. }
  3133. if (isArray(config.routingRules)) {
  3134. _context.next = 13;
  3135. break;
  3136. }
  3137. throw new Error('RoutingRules must be Array');
  3138. case 13:
  3139. WebsiteConfiguration.RoutingRules = {
  3140. RoutingRule: config.routingRules
  3141. };
  3142. case 14:
  3143. website = obj2xml(website);
  3144. params.content = website;
  3145. params.mime = 'xml';
  3146. params.successStatuses = [200];
  3147. _context.next = 20;
  3148. return this.request(params);
  3149. case 20:
  3150. result = _context.sent;
  3151. return _context.abrupt("return", {
  3152. res: result.res
  3153. });
  3154. case 22:
  3155. case "end":
  3156. return _context.stop();
  3157. }
  3158. }
  3159. }, _callee, this);
  3160. }));
  3161. function putBucketWebsite(_x) {
  3162. return _putBucketWebsite.apply(this, arguments);
  3163. }
  3164. return putBucketWebsite;
  3165. }();
  3166. },{"../utils/checkBucketName":51,"../utils/isArray":63,"../utils/obj2xml":72,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80}],24:[function(require,module,exports){
  3167. (function (Buffer){(function (){
  3168. "use strict";
  3169. require("core-js/modules/es.object.to-string.js");
  3170. require("core-js/modules/es.regexp.to-string.js");
  3171. require("core-js/modules/web.dom-collections.for-each.js");
  3172. require("core-js/modules/es.object.keys.js");
  3173. exports.encodeCallback = function encodeCallback(reqParams, options) {
  3174. reqParams.headers = reqParams.headers || {};
  3175. if (!Object.prototype.hasOwnProperty.call(reqParams.headers, 'x-oss-callback')) {
  3176. if (options.callback) {
  3177. var json = {
  3178. callbackUrl: encodeURI(options.callback.url),
  3179. callbackBody: options.callback.body
  3180. };
  3181. if (options.callback.host) {
  3182. json.callbackHost = options.callback.host;
  3183. }
  3184. if (options.callback.contentType) {
  3185. json.callbackBodyType = options.callback.contentType;
  3186. }
  3187. var callback = Buffer.from(JSON.stringify(json)).toString('base64');
  3188. reqParams.headers['x-oss-callback'] = callback;
  3189. if (options.callback.customValue) {
  3190. var callbackVar = {};
  3191. Object.keys(options.callback.customValue).forEach(function (key) {
  3192. callbackVar["x:".concat(key)] = options.callback.customValue[key].toString();
  3193. });
  3194. reqParams.headers['x-oss-callback-var'] = Buffer.from(JSON.stringify(callbackVar)).toString('base64');
  3195. }
  3196. }
  3197. }
  3198. };
  3199. }).call(this)}).call(this,require("buffer").Buffer)
  3200. },{"buffer":90,"core-js/modules/es.object.keys.js":290,"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.regexp.to-string.js":301,"core-js/modules/web.dom-collections.for-each.js":339}],25:[function(require,module,exports){
  3201. "use strict";
  3202. require("core-js/modules/es.array.concat.js");
  3203. require("core-js/modules/es.regexp.exec.js");
  3204. require("core-js/modules/es.string.replace.js");
  3205. require("core-js/modules/es.object.to-string.js");
  3206. require("core-js/modules/web.dom-collections.for-each.js");
  3207. var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
  3208. return mod && mod.__esModule ? mod : {
  3209. "default": mod
  3210. };
  3211. };
  3212. Object.defineProperty(exports, "__esModule", {
  3213. value: true
  3214. });
  3215. exports.getReqUrl = void 0;
  3216. var copy_to_1 = __importDefault(require("copy-to"));
  3217. var url_1 = __importDefault(require("url"));
  3218. var merge_descriptors_1 = __importDefault(require("merge-descriptors"));
  3219. var is_type_of_1 = __importDefault(require("is-type-of"));
  3220. var isIP_1 = require("../utils/isIP");
  3221. var checkConfigValid_1 = require("../utils/checkConfigValid");
  3222. function getReqUrl(params) {
  3223. var ep = {};
  3224. var isCname = this.options.cname;
  3225. checkConfigValid_1.checkConfigValid(this.options.endpoint, 'endpoint');
  3226. copy_to_1.default(this.options.endpoint, false).to(ep);
  3227. if (params.bucket && !isCname && !isIP_1.isIP(ep.hostname) && !this.options.sldEnable) {
  3228. ep.host = "".concat(params.bucket, ".").concat(ep.host);
  3229. }
  3230. var resourcePath = '/';
  3231. if (params.bucket && this.options.sldEnable) {
  3232. resourcePath += "".concat(params.bucket, "/");
  3233. }
  3234. if (params.object) {
  3235. // Preserve '/' in result url
  3236. resourcePath += this._escape(params.object).replace(/\+/g, '%2B');
  3237. }
  3238. ep.pathname = resourcePath;
  3239. var query = {};
  3240. if (params.query) {
  3241. merge_descriptors_1.default(query, params.query);
  3242. }
  3243. if (params.subres) {
  3244. var subresAsQuery = {};
  3245. if (is_type_of_1.default.string(params.subres)) {
  3246. subresAsQuery[params.subres] = '';
  3247. } else if (is_type_of_1.default.array(params.subres)) {
  3248. params.subres.forEach(function (k) {
  3249. subresAsQuery[k] = '';
  3250. });
  3251. } else {
  3252. subresAsQuery = params.subres;
  3253. }
  3254. merge_descriptors_1.default(query, subresAsQuery);
  3255. }
  3256. ep.query = query;
  3257. return url_1.default.format(ep);
  3258. }
  3259. exports.getReqUrl = getReqUrl;
  3260. },{"../utils/checkConfigValid":52,"../utils/isIP":69,"copy-to":94,"core-js/modules/es.array.concat.js":272,"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.regexp.exec.js":300,"core-js/modules/es.string.replace.js":305,"core-js/modules/web.dom-collections.for-each.js":339,"is-type-of":466,"merge-descriptors":372,"url":472}],26:[function(require,module,exports){
  3261. "use strict";
  3262. require("core-js/modules/es.array.concat.js");
  3263. require("core-js/modules/es.object.assign.js");
  3264. require("core-js/modules/es.string.trim.js");
  3265. var ms = require('humanize-ms');
  3266. var urlutil = require('url');
  3267. var _require = require('../utils/checkBucketName'),
  3268. _checkBucketName = _require.checkBucketName;
  3269. var _require2 = require('../utils/setRegion'),
  3270. setRegion = _require2.setRegion;
  3271. var _require3 = require('../utils/checkConfigValid'),
  3272. checkConfigValid = _require3.checkConfigValid;
  3273. function setEndpoint(endpoint, secure) {
  3274. checkConfigValid(endpoint, 'endpoint');
  3275. var url = urlutil.parse(endpoint);
  3276. if (!url.protocol) {
  3277. url = urlutil.parse("http".concat(secure ? 's' : '', "://").concat(endpoint));
  3278. }
  3279. if (url.protocol !== 'http:' && url.protocol !== 'https:') {
  3280. throw new Error('Endpoint protocol must be http or https.');
  3281. }
  3282. return url;
  3283. }
  3284. module.exports = function (options) {
  3285. if (!options || !options.accessKeyId || !options.accessKeySecret) {
  3286. throw new Error('require accessKeyId, accessKeySecret');
  3287. }
  3288. if (options.stsToken && !options.refreshSTSToken && !options.refreshSTSTokenInterval) {
  3289. console.warn("It's recommended to set 'refreshSTSToken' and 'refreshSTSTokenInterval' to refresh" + ' stsToken、accessKeyId、accessKeySecret automatically when sts token has expired');
  3290. }
  3291. if (options.bucket) {
  3292. _checkBucketName(options.bucket);
  3293. }
  3294. var opts = Object.assign({
  3295. region: 'oss-cn-hangzhou',
  3296. internal: false,
  3297. secure: false,
  3298. timeout: 60000,
  3299. bucket: null,
  3300. endpoint: null,
  3301. cname: false,
  3302. isRequestPay: false,
  3303. sldEnable: false,
  3304. headerEncoding: 'utf-8',
  3305. refreshSTSToken: null,
  3306. refreshSTSTokenInterval: 60000 * 5,
  3307. retryMax: 0
  3308. }, options);
  3309. opts.accessKeyId = opts.accessKeyId.trim();
  3310. opts.accessKeySecret = opts.accessKeySecret.trim();
  3311. if (opts.timeout) {
  3312. opts.timeout = ms(opts.timeout);
  3313. }
  3314. if (opts.endpoint) {
  3315. opts.endpoint = setEndpoint(opts.endpoint, opts.secure);
  3316. } else if (opts.region) {
  3317. opts.endpoint = setRegion(opts.region, opts.internal, opts.secure);
  3318. } else {
  3319. throw new Error('require options.endpoint or options.region');
  3320. }
  3321. opts.inited = true;
  3322. return opts;
  3323. };
  3324. },{"../utils/checkBucketName":51,"../utils/checkConfigValid":52,"../utils/setRegion":75,"core-js/modules/es.array.concat.js":272,"core-js/modules/es.object.assign.js":287,"core-js/modules/es.string.trim.js":308,"humanize-ms":356,"url":472}],27:[function(require,module,exports){
  3325. "use strict";
  3326. var merge = require('merge-descriptors');
  3327. var proto = exports;
  3328. merge(proto, require('./processObjectSave'));
  3329. },{"./processObjectSave":28,"merge-descriptors":372}],28:[function(require,module,exports){
  3330. "use strict";
  3331. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  3332. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  3333. require("core-js/modules/es.array.concat.js");
  3334. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  3335. /* eslint-disable no-use-before-define */
  3336. var _require = require('../utils/checkBucketName'),
  3337. _checkBucketName = _require.checkBucketName;
  3338. var querystring = require('querystring');
  3339. var _require2 = require('js-base64'),
  3340. str2Base64 = _require2.Base64.encode;
  3341. var proto = exports;
  3342. proto.processObjectSave = /*#__PURE__*/function () {
  3343. var _processObjectSave = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(sourceObject, targetObject, process, targetBucket) {
  3344. var params, bucketParam, content, result;
  3345. return _regenerator.default.wrap(function _callee$(_context) {
  3346. while (1) {
  3347. switch (_context.prev = _context.next) {
  3348. case 0:
  3349. checkArgs(sourceObject, 'sourceObject');
  3350. checkArgs(targetObject, 'targetObject');
  3351. checkArgs(process, 'process');
  3352. targetObject = this._objectName(targetObject);
  3353. if (targetBucket) {
  3354. _checkBucketName(targetBucket);
  3355. }
  3356. params = this._objectRequestParams('POST', sourceObject, {
  3357. subres: 'x-oss-process'
  3358. });
  3359. bucketParam = targetBucket ? ",b_".concat(str2Base64(targetBucket)) : '';
  3360. targetObject = str2Base64(targetObject);
  3361. content = {
  3362. 'x-oss-process': "".concat(process, "|sys/saveas,o_").concat(targetObject).concat(bucketParam)
  3363. };
  3364. params.content = querystring.stringify(content);
  3365. _context.next = 12;
  3366. return this.request(params);
  3367. case 12:
  3368. result = _context.sent;
  3369. return _context.abrupt("return", {
  3370. res: result.res,
  3371. status: result.res.status
  3372. });
  3373. case 14:
  3374. case "end":
  3375. return _context.stop();
  3376. }
  3377. }
  3378. }, _callee, this);
  3379. }));
  3380. function processObjectSave(_x, _x2, _x3, _x4) {
  3381. return _processObjectSave.apply(this, arguments);
  3382. }
  3383. return processObjectSave;
  3384. }();
  3385. function checkArgs(name, key) {
  3386. if (!name) {
  3387. throw new Error("".concat(key, " is required"));
  3388. }
  3389. if (typeof name !== 'string') {
  3390. throw new Error("".concat(key, " must be String"));
  3391. }
  3392. }
  3393. },{"../utils/checkBucketName":51,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.array.concat.js":272,"js-base64":371,"querystring":385}],29:[function(require,module,exports){
  3394. "use strict";
  3395. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  3396. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  3397. require("core-js/modules/es.array.concat.js");
  3398. require("core-js/modules/es.function.name.js");
  3399. require("core-js/modules/es.object.to-string.js");
  3400. require("core-js/modules/es.promise.js");
  3401. require("core-js/modules/es.array.from.js");
  3402. require("core-js/modules/es.string.iterator.js");
  3403. require("core-js/modules/es.array.map.js");
  3404. require("core-js/modules/es.array.filter.js");
  3405. require("core-js/modules/es.array.find.js");
  3406. require("core-js/modules/es.regexp.to-string.js");
  3407. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  3408. /* eslint-disable no-async-promise-executor */
  3409. var debug = require('debug')('ali-oss:multipart-copy');
  3410. var copy = require('copy-to');
  3411. var proto = exports;
  3412. /**
  3413. * Upload a part copy in a multipart from the source bucket/object
  3414. * used with initMultipartUpload and completeMultipartUpload.
  3415. * @param {String} name copy object name
  3416. * @param {String} uploadId the upload id
  3417. * @param {Number} partNo the part number
  3418. * @param {String} range like 0-102400 part size need to copy
  3419. * @param {Object} sourceData
  3420. * {String} sourceData.sourceKey the source object name
  3421. * {String} sourceData.sourceBucketName the source bucket name
  3422. * @param {Object} options
  3423. */
  3424. /* eslint max-len: [0] */
  3425. proto.uploadPartCopy = /*#__PURE__*/function () {
  3426. var _uploadPartCopy = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, uploadId, partNo, range, sourceData) {
  3427. var options,
  3428. versionId,
  3429. copySource,
  3430. params,
  3431. result,
  3432. _args = arguments;
  3433. return _regenerator.default.wrap(function _callee$(_context) {
  3434. while (1) {
  3435. switch (_context.prev = _context.next) {
  3436. case 0:
  3437. options = _args.length > 5 && _args[5] !== undefined ? _args[5] : {};
  3438. options.headers = options.headers || {};
  3439. versionId = options.versionId || options.subres && options.subres.versionId || null;
  3440. if (versionId) {
  3441. copySource = "/".concat(sourceData.sourceBucketName, "/").concat(encodeURIComponent(sourceData.sourceKey), "?versionId=").concat(versionId);
  3442. } else {
  3443. copySource = "/".concat(sourceData.sourceBucketName, "/").concat(encodeURIComponent(sourceData.sourceKey));
  3444. }
  3445. options.headers['x-oss-copy-source'] = copySource;
  3446. if (range) {
  3447. options.headers['x-oss-copy-source-range'] = "bytes=".concat(range);
  3448. }
  3449. options.subres = {
  3450. partNumber: partNo,
  3451. uploadId: uploadId
  3452. };
  3453. params = this._objectRequestParams('PUT', name, options);
  3454. params.mime = options.mime;
  3455. params.successStatuses = [200];
  3456. _context.next = 12;
  3457. return this.request(params);
  3458. case 12:
  3459. result = _context.sent;
  3460. return _context.abrupt("return", {
  3461. name: name,
  3462. etag: result.res.headers.etag,
  3463. res: result.res
  3464. });
  3465. case 14:
  3466. case "end":
  3467. return _context.stop();
  3468. }
  3469. }
  3470. }, _callee, this);
  3471. }));
  3472. function uploadPartCopy(_x, _x2, _x3, _x4, _x5) {
  3473. return _uploadPartCopy.apply(this, arguments);
  3474. }
  3475. return uploadPartCopy;
  3476. }();
  3477. /**
  3478. * @param {String} name copy object name
  3479. * @param {Object} sourceData
  3480. * {String} sourceData.sourceKey the source object name
  3481. * {String} sourceData.sourceBucketName the source bucket name
  3482. * {Number} sourceData.startOffset data copy start byte offset, e.g: 0
  3483. * {Number} sourceData.endOffset data copy end byte offset, e.g: 102400
  3484. * @param {Object} options
  3485. * {Number} options.partSize
  3486. */
  3487. proto.multipartUploadCopy = /*#__PURE__*/function () {
  3488. var _multipartUploadCopy = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(name, sourceData) {
  3489. var options,
  3490. _options$versionId,
  3491. versionId,
  3492. metaOpt,
  3493. objectMeta,
  3494. fileSize,
  3495. minPartSize,
  3496. copySize,
  3497. init,
  3498. uploadId,
  3499. partSize,
  3500. checkpoint,
  3501. _args2 = arguments;
  3502. return _regenerator.default.wrap(function _callee2$(_context2) {
  3503. while (1) {
  3504. switch (_context2.prev = _context2.next) {
  3505. case 0:
  3506. options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
  3507. this.resetCancelFlag();
  3508. _options$versionId = options.versionId, versionId = _options$versionId === void 0 ? null : _options$versionId;
  3509. metaOpt = {
  3510. versionId: versionId
  3511. };
  3512. _context2.next = 6;
  3513. return this._getObjectMeta(sourceData.sourceBucketName, sourceData.sourceKey, metaOpt);
  3514. case 6:
  3515. objectMeta = _context2.sent;
  3516. fileSize = objectMeta.res.headers['content-length'];
  3517. sourceData.startOffset = sourceData.startOffset || 0;
  3518. sourceData.endOffset = sourceData.endOffset || fileSize;
  3519. if (!(options.checkpoint && options.checkpoint.uploadId)) {
  3520. _context2.next = 14;
  3521. break;
  3522. }
  3523. _context2.next = 13;
  3524. return this._resumeMultipartCopy(options.checkpoint, sourceData, options);
  3525. case 13:
  3526. return _context2.abrupt("return", _context2.sent);
  3527. case 14:
  3528. minPartSize = 100 * 1024;
  3529. copySize = sourceData.endOffset - sourceData.startOffset;
  3530. if (!(copySize < minPartSize)) {
  3531. _context2.next = 18;
  3532. break;
  3533. }
  3534. throw new Error("copySize must not be smaller than ".concat(minPartSize));
  3535. case 18:
  3536. if (!(options.partSize && options.partSize < minPartSize)) {
  3537. _context2.next = 20;
  3538. break;
  3539. }
  3540. throw new Error("partSize must not be smaller than ".concat(minPartSize));
  3541. case 20:
  3542. _context2.next = 22;
  3543. return this.initMultipartUpload(name, options);
  3544. case 22:
  3545. init = _context2.sent;
  3546. uploadId = init.uploadId;
  3547. partSize = this._getPartSize(copySize, options.partSize);
  3548. checkpoint = {
  3549. name: name,
  3550. copySize: copySize,
  3551. partSize: partSize,
  3552. uploadId: uploadId,
  3553. doneParts: []
  3554. };
  3555. if (!(options && options.progress)) {
  3556. _context2.next = 29;
  3557. break;
  3558. }
  3559. _context2.next = 29;
  3560. return options.progress(0, checkpoint, init.res);
  3561. case 29:
  3562. _context2.next = 31;
  3563. return this._resumeMultipartCopy(checkpoint, sourceData, options);
  3564. case 31:
  3565. return _context2.abrupt("return", _context2.sent);
  3566. case 32:
  3567. case "end":
  3568. return _context2.stop();
  3569. }
  3570. }
  3571. }, _callee2, this);
  3572. }));
  3573. function multipartUploadCopy(_x6, _x7) {
  3574. return _multipartUploadCopy.apply(this, arguments);
  3575. }
  3576. return multipartUploadCopy;
  3577. }();
  3578. /*
  3579. * Resume multipart copy from checkpoint. The checkpoint will be
  3580. * updated after each successful part copy.
  3581. * @param {Object} checkpoint the checkpoint
  3582. * @param {Object} options
  3583. */
  3584. proto._resumeMultipartCopy = /*#__PURE__*/function () {
  3585. var _resumeMultipartCopy2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(checkpoint, sourceData, options) {
  3586. var _options$versionId2, versionId, metaOpt, copySize, partSize, uploadId, doneParts, name, partOffs, numParts, uploadPartCopyOptions, uploadPartJob, all, done, todo, defaultParallel, parallel, i, errors, abortEvent, err;
  3587. return _regenerator.default.wrap(function _callee4$(_context4) {
  3588. while (1) {
  3589. switch (_context4.prev = _context4.next) {
  3590. case 0:
  3591. if (!this.isCancel()) {
  3592. _context4.next = 2;
  3593. break;
  3594. }
  3595. throw this._makeCancelEvent();
  3596. case 2:
  3597. _options$versionId2 = options.versionId, versionId = _options$versionId2 === void 0 ? null : _options$versionId2;
  3598. metaOpt = {
  3599. versionId: versionId
  3600. };
  3601. copySize = checkpoint.copySize, partSize = checkpoint.partSize, uploadId = checkpoint.uploadId, doneParts = checkpoint.doneParts, name = checkpoint.name;
  3602. partOffs = this._divideMultipartCopyParts(copySize, partSize, sourceData.startOffset);
  3603. numParts = partOffs.length;
  3604. uploadPartCopyOptions = {
  3605. headers: {}
  3606. };
  3607. if (options.copyheaders) {
  3608. copy(options.copyheaders).to(uploadPartCopyOptions.headers);
  3609. }
  3610. if (versionId) {
  3611. copy(metaOpt).to(uploadPartCopyOptions);
  3612. }
  3613. uploadPartJob = function uploadPartJob(self, partNo, source) {
  3614. return new Promise( /*#__PURE__*/function () {
  3615. var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(resolve, reject) {
  3616. var pi, range, result;
  3617. return _regenerator.default.wrap(function _callee3$(_context3) {
  3618. while (1) {
  3619. switch (_context3.prev = _context3.next) {
  3620. case 0:
  3621. _context3.prev = 0;
  3622. if (self.isCancel()) {
  3623. _context3.next = 22;
  3624. break;
  3625. }
  3626. pi = partOffs[partNo - 1];
  3627. range = "".concat(pi.start, "-").concat(pi.end - 1);
  3628. _context3.prev = 4;
  3629. _context3.next = 7;
  3630. return self.uploadPartCopy(name, uploadId, partNo, range, source, uploadPartCopyOptions);
  3631. case 7:
  3632. result = _context3.sent;
  3633. _context3.next = 15;
  3634. break;
  3635. case 10:
  3636. _context3.prev = 10;
  3637. _context3.t0 = _context3["catch"](4);
  3638. if (!(_context3.t0.status === 404)) {
  3639. _context3.next = 14;
  3640. break;
  3641. }
  3642. throw self._makeAbortEvent();
  3643. case 14:
  3644. throw _context3.t0;
  3645. case 15:
  3646. if (self.isCancel()) {
  3647. _context3.next = 22;
  3648. break;
  3649. }
  3650. debug("content-range ".concat(result.res.headers['content-range']));
  3651. doneParts.push({
  3652. number: partNo,
  3653. etag: result.res.headers.etag
  3654. });
  3655. checkpoint.doneParts = doneParts;
  3656. if (!(options && options.progress)) {
  3657. _context3.next = 22;
  3658. break;
  3659. }
  3660. _context3.next = 22;
  3661. return options.progress(doneParts.length / numParts, checkpoint, result.res);
  3662. case 22:
  3663. resolve();
  3664. _context3.next = 29;
  3665. break;
  3666. case 25:
  3667. _context3.prev = 25;
  3668. _context3.t1 = _context3["catch"](0);
  3669. _context3.t1.partNum = partNo;
  3670. reject(_context3.t1);
  3671. case 29:
  3672. case "end":
  3673. return _context3.stop();
  3674. }
  3675. }
  3676. }, _callee3, null, [[0, 25], [4, 10]]);
  3677. }));
  3678. return function (_x11, _x12) {
  3679. return _ref.apply(this, arguments);
  3680. };
  3681. }());
  3682. };
  3683. all = Array.from(new Array(numParts), function (x, i) {
  3684. return i + 1;
  3685. });
  3686. done = doneParts.map(function (p) {
  3687. return p.number;
  3688. });
  3689. todo = all.filter(function (p) {
  3690. return done.indexOf(p) < 0;
  3691. });
  3692. defaultParallel = 5;
  3693. parallel = options.parallel || defaultParallel;
  3694. if (!(this.checkBrowserAndVersion('Internet Explorer', '10') || parallel === 1)) {
  3695. _context4.next = 28;
  3696. break;
  3697. }
  3698. i = 0;
  3699. case 18:
  3700. if (!(i < todo.length)) {
  3701. _context4.next = 26;
  3702. break;
  3703. }
  3704. if (!this.isCancel()) {
  3705. _context4.next = 21;
  3706. break;
  3707. }
  3708. throw this._makeCancelEvent();
  3709. case 21:
  3710. _context4.next = 23;
  3711. return uploadPartJob(this, todo[i], sourceData);
  3712. case 23:
  3713. i++;
  3714. _context4.next = 18;
  3715. break;
  3716. case 26:
  3717. _context4.next = 40;
  3718. break;
  3719. case 28:
  3720. _context4.next = 30;
  3721. return this._parallelNode(todo, parallel, uploadPartJob, sourceData);
  3722. case 30:
  3723. errors = _context4.sent;
  3724. abortEvent = errors.find(function (err) {
  3725. return err.name === 'abort';
  3726. });
  3727. if (!abortEvent) {
  3728. _context4.next = 34;
  3729. break;
  3730. }
  3731. throw abortEvent;
  3732. case 34:
  3733. if (!this.isCancel()) {
  3734. _context4.next = 36;
  3735. break;
  3736. }
  3737. throw this._makeCancelEvent();
  3738. case 36:
  3739. if (!(errors && errors.length > 0)) {
  3740. _context4.next = 40;
  3741. break;
  3742. }
  3743. err = errors[0];
  3744. err.message = "Failed to copy some parts with error: ".concat(err.toString(), " part_num: ").concat(err.partNum);
  3745. throw err;
  3746. case 40:
  3747. _context4.next = 42;
  3748. return this.completeMultipartUpload(name, uploadId, doneParts, options);
  3749. case 42:
  3750. return _context4.abrupt("return", _context4.sent);
  3751. case 43:
  3752. case "end":
  3753. return _context4.stop();
  3754. }
  3755. }
  3756. }, _callee4, this);
  3757. }));
  3758. function _resumeMultipartCopy(_x8, _x9, _x10) {
  3759. return _resumeMultipartCopy2.apply(this, arguments);
  3760. }
  3761. return _resumeMultipartCopy;
  3762. }();
  3763. proto._divideMultipartCopyParts = function _divideMultipartCopyParts(fileSize, partSize, startOffset) {
  3764. var numParts = Math.ceil(fileSize / partSize);
  3765. var partOffs = [];
  3766. for (var i = 0; i < numParts; i++) {
  3767. var start = partSize * i + startOffset;
  3768. var end = Math.min(start + partSize, fileSize + startOffset);
  3769. partOffs.push({
  3770. start: start,
  3771. end: end
  3772. });
  3773. }
  3774. return partOffs;
  3775. };
  3776. /**
  3777. * Get Object Meta
  3778. * @param {String} bucket bucket name
  3779. * @param {String} name object name
  3780. * @param {Object} options
  3781. */
  3782. proto._getObjectMeta = /*#__PURE__*/function () {
  3783. var _getObjectMeta2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(bucket, name, options) {
  3784. var currentBucket, data;
  3785. return _regenerator.default.wrap(function _callee5$(_context5) {
  3786. while (1) {
  3787. switch (_context5.prev = _context5.next) {
  3788. case 0:
  3789. currentBucket = this.getBucket();
  3790. this.setBucket(bucket);
  3791. _context5.next = 4;
  3792. return this.head(name, options);
  3793. case 4:
  3794. data = _context5.sent;
  3795. this.setBucket(currentBucket);
  3796. return _context5.abrupt("return", data);
  3797. case 7:
  3798. case "end":
  3799. return _context5.stop();
  3800. }
  3801. }
  3802. }, _callee5, this);
  3803. }));
  3804. function _getObjectMeta(_x13, _x14, _x15) {
  3805. return _getObjectMeta2.apply(this, arguments);
  3806. }
  3807. return _getObjectMeta;
  3808. }();
  3809. },{"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"copy-to":94,"core-js/modules/es.array.concat.js":272,"core-js/modules/es.array.filter.js":274,"core-js/modules/es.array.find.js":275,"core-js/modules/es.array.from.js":276,"core-js/modules/es.array.map.js":280,"core-js/modules/es.function.name.js":284,"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.promise.js":295,"core-js/modules/es.regexp.to-string.js":301,"core-js/modules/es.string.iterator.js":303,"debug":465}],30:[function(require,module,exports){
  3810. (function (process){(function (){
  3811. "use strict";
  3812. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  3813. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  3814. require("core-js/modules/es.array.map.js");
  3815. require("core-js/modules/es.array.filter.js");
  3816. require("core-js/modules/es.object.to-string.js");
  3817. require("core-js/modules/es.array.sort.js");
  3818. require("core-js/modules/es.array.concat.js");
  3819. require("core-js/modules/es.regexp.to-string.js");
  3820. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  3821. var copy = require('copy-to');
  3822. var callback = require('./callback');
  3823. var _require = require('./utils/deepCopy'),
  3824. deepCopyWith = _require.deepCopyWith;
  3825. var _require2 = require('./utils/isBuffer'),
  3826. isBuffer = _require2.isBuffer;
  3827. var _require3 = require('./utils/omit'),
  3828. omit = _require3.omit;
  3829. var proto = exports;
  3830. /**
  3831. * List the on-going multipart uploads
  3832. * https://help.aliyun.com/document_detail/31997.html
  3833. * @param {Object} options
  3834. * @return {Array} the multipart uploads
  3835. */
  3836. proto.listUploads = /*#__PURE__*/function () {
  3837. var _listUploads = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(query, options) {
  3838. var opt, params, result, uploads;
  3839. return _regenerator.default.wrap(function _callee$(_context) {
  3840. while (1) {
  3841. switch (_context.prev = _context.next) {
  3842. case 0:
  3843. options = options || {};
  3844. opt = {};
  3845. copy(options).to(opt);
  3846. opt.subres = 'uploads';
  3847. params = this._objectRequestParams('GET', '', opt);
  3848. params.query = query;
  3849. params.xmlResponse = true;
  3850. params.successStatuses = [200];
  3851. _context.next = 10;
  3852. return this.request(params);
  3853. case 10:
  3854. result = _context.sent;
  3855. uploads = result.data.Upload || [];
  3856. if (!Array.isArray(uploads)) {
  3857. uploads = [uploads];
  3858. }
  3859. uploads = uploads.map(function (up) {
  3860. return {
  3861. name: up.Key,
  3862. uploadId: up.UploadId,
  3863. initiated: up.Initiated
  3864. };
  3865. });
  3866. return _context.abrupt("return", {
  3867. res: result.res,
  3868. uploads: uploads,
  3869. bucket: result.data.Bucket,
  3870. nextKeyMarker: result.data.NextKeyMarker,
  3871. nextUploadIdMarker: result.data.NextUploadIdMarker,
  3872. isTruncated: result.data.IsTruncated === 'true'
  3873. });
  3874. case 15:
  3875. case "end":
  3876. return _context.stop();
  3877. }
  3878. }
  3879. }, _callee, this);
  3880. }));
  3881. function listUploads(_x, _x2) {
  3882. return _listUploads.apply(this, arguments);
  3883. }
  3884. return listUploads;
  3885. }();
  3886. /**
  3887. * List the done uploadPart parts
  3888. * @param {String} name object name
  3889. * @param {String} uploadId multipart upload id
  3890. * @param {Object} query
  3891. * {Number} query.max-parts The maximum part number in the response of the OSS. Default value: 1000
  3892. * {Number} query.part-number-marker Starting position of a specific list.
  3893. * {String} query.encoding-type Specify the encoding of the returned content and the encoding type.
  3894. * @param {Object} options
  3895. * @return {Object} result
  3896. */
  3897. proto.listParts = /*#__PURE__*/function () {
  3898. var _listParts = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(name, uploadId, query, options) {
  3899. var opt, params, result;
  3900. return _regenerator.default.wrap(function _callee2$(_context2) {
  3901. while (1) {
  3902. switch (_context2.prev = _context2.next) {
  3903. case 0:
  3904. options = options || {};
  3905. opt = {};
  3906. copy(options).to(opt);
  3907. opt.subres = {
  3908. uploadId: uploadId
  3909. };
  3910. params = this._objectRequestParams('GET', name, opt);
  3911. params.query = query;
  3912. params.xmlResponse = true;
  3913. params.successStatuses = [200];
  3914. _context2.next = 10;
  3915. return this.request(params);
  3916. case 10:
  3917. result = _context2.sent;
  3918. return _context2.abrupt("return", {
  3919. res: result.res,
  3920. uploadId: result.data.UploadId,
  3921. bucket: result.data.Bucket,
  3922. name: result.data.Key,
  3923. partNumberMarker: result.data.PartNumberMarker,
  3924. nextPartNumberMarker: result.data.NextPartNumberMarker,
  3925. maxParts: result.data.MaxParts,
  3926. isTruncated: result.data.IsTruncated,
  3927. parts: result.data.Part || []
  3928. });
  3929. case 12:
  3930. case "end":
  3931. return _context2.stop();
  3932. }
  3933. }
  3934. }, _callee2, this);
  3935. }));
  3936. function listParts(_x3, _x4, _x5, _x6) {
  3937. return _listParts.apply(this, arguments);
  3938. }
  3939. return listParts;
  3940. }();
  3941. /**
  3942. * Abort a multipart upload transaction
  3943. * @param {String} name the object name
  3944. * @param {String} uploadId the upload id
  3945. * @param {Object} options
  3946. */
  3947. proto.abortMultipartUpload = /*#__PURE__*/function () {
  3948. var _abortMultipartUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(name, uploadId, options) {
  3949. var opt, params, result;
  3950. return _regenerator.default.wrap(function _callee3$(_context3) {
  3951. while (1) {
  3952. switch (_context3.prev = _context3.next) {
  3953. case 0:
  3954. this._stop();
  3955. options = options || {};
  3956. opt = {};
  3957. copy(options).to(opt);
  3958. opt.subres = {
  3959. uploadId: uploadId
  3960. };
  3961. params = this._objectRequestParams('DELETE', name, opt);
  3962. params.successStatuses = [204];
  3963. _context3.next = 9;
  3964. return this.request(params);
  3965. case 9:
  3966. result = _context3.sent;
  3967. return _context3.abrupt("return", {
  3968. res: result.res
  3969. });
  3970. case 11:
  3971. case "end":
  3972. return _context3.stop();
  3973. }
  3974. }
  3975. }, _callee3, this);
  3976. }));
  3977. function abortMultipartUpload(_x7, _x8, _x9) {
  3978. return _abortMultipartUpload.apply(this, arguments);
  3979. }
  3980. return abortMultipartUpload;
  3981. }();
  3982. /**
  3983. * Initiate a multipart upload transaction
  3984. * @param {String} name the object name
  3985. * @param {Object} options
  3986. * @return {String} upload id
  3987. */
  3988. proto.initMultipartUpload = /*#__PURE__*/function () {
  3989. var _initMultipartUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(name, options) {
  3990. var opt, params, result;
  3991. return _regenerator.default.wrap(function _callee4$(_context4) {
  3992. while (1) {
  3993. switch (_context4.prev = _context4.next) {
  3994. case 0:
  3995. options = options || {};
  3996. opt = {};
  3997. copy(options).to(opt);
  3998. opt.headers = opt.headers || {};
  3999. this._convertMetaToHeaders(options.meta, opt.headers);
  4000. opt.subres = 'uploads';
  4001. params = this._objectRequestParams('POST', name, opt);
  4002. params.mime = options.mime;
  4003. params.xmlResponse = true;
  4004. params.successStatuses = [200];
  4005. _context4.next = 12;
  4006. return this.request(params);
  4007. case 12:
  4008. result = _context4.sent;
  4009. return _context4.abrupt("return", {
  4010. res: result.res,
  4011. bucket: result.data.Bucket,
  4012. name: result.data.Key,
  4013. uploadId: result.data.UploadId
  4014. });
  4015. case 14:
  4016. case "end":
  4017. return _context4.stop();
  4018. }
  4019. }
  4020. }, _callee4, this);
  4021. }));
  4022. function initMultipartUpload(_x10, _x11) {
  4023. return _initMultipartUpload.apply(this, arguments);
  4024. }
  4025. return initMultipartUpload;
  4026. }();
  4027. /**
  4028. * Upload a part in a multipart upload transaction
  4029. * @param {String} name the object name
  4030. * @param {String} uploadId the upload id
  4031. * @param {Integer} partNo the part number
  4032. * @param {File} file upload File, whole File
  4033. * @param {Integer} start part start bytes e.g: 102400
  4034. * @param {Integer} end part end bytes e.g: 204800
  4035. * @param {Object} options
  4036. */
  4037. proto.uploadPart = /*#__PURE__*/function () {
  4038. var _uploadPart2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(name, uploadId, partNo, file, start, end, options) {
  4039. var data, isBrowserEnv;
  4040. return _regenerator.default.wrap(function _callee5$(_context5) {
  4041. while (1) {
  4042. switch (_context5.prev = _context5.next) {
  4043. case 0:
  4044. data = {
  4045. size: end - start
  4046. };
  4047. isBrowserEnv = process && process.browser;
  4048. if (!isBrowserEnv) {
  4049. _context5.next = 8;
  4050. break;
  4051. }
  4052. _context5.next = 5;
  4053. return this._createBuffer(file, start, end);
  4054. case 5:
  4055. data.content = _context5.sent;
  4056. _context5.next = 11;
  4057. break;
  4058. case 8:
  4059. _context5.next = 10;
  4060. return this._createStream(file, start, end);
  4061. case 10:
  4062. data.stream = _context5.sent;
  4063. case 11:
  4064. _context5.next = 13;
  4065. return this._uploadPart(name, uploadId, partNo, data, options);
  4066. case 13:
  4067. return _context5.abrupt("return", _context5.sent);
  4068. case 14:
  4069. case "end":
  4070. return _context5.stop();
  4071. }
  4072. }
  4073. }, _callee5, this);
  4074. }));
  4075. function uploadPart(_x12, _x13, _x14, _x15, _x16, _x17, _x18) {
  4076. return _uploadPart2.apply(this, arguments);
  4077. }
  4078. return uploadPart;
  4079. }();
  4080. /**
  4081. * Complete a multipart upload transaction
  4082. * @param {String} name the object name
  4083. * @param {String} uploadId the upload id
  4084. * @param {Array} parts the uploaded parts, each in the structure:
  4085. * {Integer} number partNo
  4086. * {String} etag part etag uploadPartCopy result.res.header.etag
  4087. * @param {Object} options
  4088. * {Object} options.callback The callback parameter is composed of a JSON string encoded in Base64
  4089. * {String} options.callback.url the OSS sends a callback request to this URL
  4090. * {String} options.callback.host The host header value for initiating callback requests
  4091. * {String} options.callback.body The value of the request body when a callback is initiated
  4092. * {String} options.callback.contentType The Content-Type of the callback requests initiatiated
  4093. * {Object} options.callback.customValue Custom parameters are a map of key-values, e.g:
  4094. * customValue = {
  4095. * key1: 'value1',
  4096. * key2: 'value2'
  4097. * }
  4098. */
  4099. proto.completeMultipartUpload = /*#__PURE__*/function () {
  4100. var _completeMultipartUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(name, uploadId, parts, options) {
  4101. var completeParts, xml, i, p, opt, params, result, ret;
  4102. return _regenerator.default.wrap(function _callee6$(_context6) {
  4103. while (1) {
  4104. switch (_context6.prev = _context6.next) {
  4105. case 0:
  4106. completeParts = parts.concat().sort(function (a, b) {
  4107. return a.number - b.number;
  4108. }).filter(function (item, index, arr) {
  4109. return !index || item.number !== arr[index - 1].number;
  4110. });
  4111. xml = '<?xml version="1.0" encoding="UTF-8"?>\n<CompleteMultipartUpload>\n';
  4112. for (i = 0; i < completeParts.length; i++) {
  4113. p = completeParts[i];
  4114. xml += '<Part>\n';
  4115. xml += "<PartNumber>".concat(p.number, "</PartNumber>\n");
  4116. xml += "<ETag>".concat(p.etag, "</ETag>\n");
  4117. xml += '</Part>\n';
  4118. }
  4119. xml += '</CompleteMultipartUpload>';
  4120. options = options || {};
  4121. opt = {};
  4122. opt = deepCopyWith(options, function (_) {
  4123. if (isBuffer(_)) return null;
  4124. });
  4125. opt.subres = {
  4126. uploadId: uploadId
  4127. };
  4128. opt.headers = omit(opt.headers, ['x-oss-server-side-encryption', 'x-oss-storage-class']);
  4129. params = this._objectRequestParams('POST', name, opt);
  4130. callback.encodeCallback(params, opt);
  4131. params.mime = 'xml';
  4132. params.content = xml;
  4133. if (!(params.headers && params.headers['x-oss-callback'])) {
  4134. params.xmlResponse = true;
  4135. }
  4136. params.successStatuses = [200];
  4137. _context6.next = 17;
  4138. return this.request(params);
  4139. case 17:
  4140. result = _context6.sent;
  4141. if (!options.progress) {
  4142. _context6.next = 21;
  4143. break;
  4144. }
  4145. _context6.next = 21;
  4146. return options.progress(1, null, result.res);
  4147. case 21:
  4148. ret = {
  4149. res: result.res,
  4150. bucket: params.bucket,
  4151. name: name,
  4152. etag: result.res.headers.etag
  4153. };
  4154. if (params.headers && params.headers['x-oss-callback']) {
  4155. ret.data = JSON.parse(result.data.toString());
  4156. }
  4157. return _context6.abrupt("return", ret);
  4158. case 24:
  4159. case "end":
  4160. return _context6.stop();
  4161. }
  4162. }
  4163. }, _callee6, this);
  4164. }));
  4165. function completeMultipartUpload(_x19, _x20, _x21, _x22) {
  4166. return _completeMultipartUpload.apply(this, arguments);
  4167. }
  4168. return completeMultipartUpload;
  4169. }();
  4170. /**
  4171. * Upload a part in a multipart upload transaction
  4172. * @param {String} name the object name
  4173. * @param {String} uploadId the upload id
  4174. * @param {Integer} partNo the part number
  4175. * @param {Object} data the body data
  4176. * @param {Object} options
  4177. */
  4178. proto._uploadPart = /*#__PURE__*/function () {
  4179. var _uploadPart3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(name, uploadId, partNo, data, options) {
  4180. var opt, params, isBrowserEnv, result;
  4181. return _regenerator.default.wrap(function _callee7$(_context7) {
  4182. while (1) {
  4183. switch (_context7.prev = _context7.next) {
  4184. case 0:
  4185. options = options || {};
  4186. opt = {};
  4187. copy(options).to(opt);
  4188. opt.headers = opt.headers || {};
  4189. opt.headers['Content-Length'] = data.size; // Uploading shards does not require x-oss server side encryption
  4190. opt.headers = omit(opt.headers, ['x-oss-server-side-encryption']);
  4191. opt.subres = {
  4192. partNumber: partNo,
  4193. uploadId: uploadId
  4194. };
  4195. params = this._objectRequestParams('PUT', name, opt);
  4196. params.mime = opt.mime;
  4197. isBrowserEnv = process && process.browser;
  4198. isBrowserEnv ? params.content = data.content : params.stream = data.stream;
  4199. params.successStatuses = [200];
  4200. params.disabledMD5 = options.disabledMD5;
  4201. _context7.next = 15;
  4202. return this.request(params);
  4203. case 15:
  4204. result = _context7.sent;
  4205. if (result.res.headers.etag) {
  4206. _context7.next = 18;
  4207. break;
  4208. }
  4209. throw new Error('Please set the etag of expose-headers in OSS \n https://help.aliyun.com/document_detail/32069.html');
  4210. case 18:
  4211. if (data.stream) {
  4212. data.stream = null;
  4213. params.stream = null;
  4214. }
  4215. return _context7.abrupt("return", {
  4216. name: name,
  4217. etag: result.res.headers.etag,
  4218. res: result.res
  4219. });
  4220. case 20:
  4221. case "end":
  4222. return _context7.stop();
  4223. }
  4224. }
  4225. }, _callee7, this);
  4226. }));
  4227. function _uploadPart(_x23, _x24, _x25, _x26, _x27) {
  4228. return _uploadPart3.apply(this, arguments);
  4229. }
  4230. return _uploadPart;
  4231. }();
  4232. }).call(this)}).call(this,require('_process'))
  4233. },{"./callback":24,"./utils/deepCopy":58,"./utils/isBuffer":65,"./utils/omit":73,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"_process":467,"copy-to":94,"core-js/modules/es.array.concat.js":272,"core-js/modules/es.array.filter.js":274,"core-js/modules/es.array.map.js":280,"core-js/modules/es.array.sort.js":282,"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.regexp.to-string.js":301}],31:[function(require,module,exports){
  4234. "use strict";
  4235. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  4236. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  4237. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  4238. var urlutil = require('url');
  4239. var utility = require('utility');
  4240. var copy = require('copy-to');
  4241. var signHelper = require('../../common/signUtils');
  4242. var _require = require('../utils/isIP'),
  4243. isIP = _require.isIP;
  4244. var _require2 = require('../utils/setSTSToken'),
  4245. setSTSToken = _require2.setSTSToken;
  4246. var _require3 = require('../utils/isFunction'),
  4247. isFunction = _require3.isFunction;
  4248. var proto = exports;
  4249. proto.asyncSignatureUrl = /*#__PURE__*/function () {
  4250. var _asyncSignatureUrl = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
  4251. var expires, params, resource, signRes, url;
  4252. return _regenerator.default.wrap(function _callee$(_context) {
  4253. while (1) {
  4254. switch (_context.prev = _context.next) {
  4255. case 0:
  4256. if (!isIP(this.options.endpoint.hostname)) {
  4257. _context.next = 2;
  4258. break;
  4259. }
  4260. throw new Error('can not get the object URL when endpoint is IP');
  4261. case 2:
  4262. options = options || {};
  4263. name = this._objectName(name);
  4264. options.method = options.method || 'GET';
  4265. expires = utility.timestamp() + (options.expires || 1800);
  4266. params = {
  4267. bucket: this.options.bucket,
  4268. object: name
  4269. };
  4270. resource = this._getResource(params);
  4271. if (!(this.options.stsToken && isFunction(this.options.refreshSTSToken))) {
  4272. _context.next = 11;
  4273. break;
  4274. }
  4275. _context.next = 11;
  4276. return setSTSToken.call(this);
  4277. case 11:
  4278. if (this.options.stsToken) {
  4279. options['security-token'] = this.options.stsToken;
  4280. }
  4281. signRes = signHelper._signatureForURL(this.options.accessKeySecret, options, resource, expires);
  4282. url = urlutil.parse(this._getReqUrl(params));
  4283. url.query = {
  4284. OSSAccessKeyId: this.options.accessKeyId,
  4285. Expires: expires,
  4286. Signature: signRes.Signature
  4287. };
  4288. copy(signRes.subResource).to(url.query);
  4289. return _context.abrupt("return", url.format());
  4290. case 17:
  4291. case "end":
  4292. return _context.stop();
  4293. }
  4294. }
  4295. }, _callee, this);
  4296. }));
  4297. function asyncSignatureUrl(_x, _x2) {
  4298. return _asyncSignatureUrl.apply(this, arguments);
  4299. }
  4300. return asyncSignatureUrl;
  4301. }();
  4302. },{"../../common/signUtils":50,"../utils/isFunction":68,"../utils/isIP":69,"../utils/setSTSToken":76,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"copy-to":94,"url":472,"utility":474}],32:[function(require,module,exports){
  4303. "use strict";
  4304. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  4305. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  4306. require("core-js/modules/es.object.to-string.js");
  4307. require("core-js/modules/web.dom-collections.for-each.js");
  4308. require("core-js/modules/es.object.keys.js");
  4309. require("core-js/modules/es.array.find.js");
  4310. require("core-js/modules/es.array.includes.js");
  4311. require("core-js/modules/es.array.concat.js");
  4312. require("core-js/modules/es.regexp.exec.js");
  4313. require("core-js/modules/es.string.replace.js");
  4314. var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
  4315. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  4316. var _require = require('../utils/checkBucketName'),
  4317. _checkBucketName = _require.checkBucketName;
  4318. var proto = exports;
  4319. var REPLACE_HEDERS = ['content-type', 'content-encoding', 'content-language', 'content-disposition', 'cache-control', 'expires'];
  4320. proto.copy = /*#__PURE__*/function () {
  4321. var _copy = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, sourceName, bucketName, options) {
  4322. var params, result, data;
  4323. return _regenerator.default.wrap(function _callee$(_context) {
  4324. while (1) {
  4325. switch (_context.prev = _context.next) {
  4326. case 0:
  4327. if ((0, _typeof2.default)(bucketName) === 'object') {
  4328. options = bucketName; // 兼容旧版本,旧版本第三个参数为options
  4329. }
  4330. options = options || {};
  4331. options.headers = options.headers || {};
  4332. Object.keys(options.headers).forEach(function (key) {
  4333. options.headers["x-oss-copy-source-".concat(key.toLowerCase())] = options.headers[key];
  4334. });
  4335. if (options.meta || Object.keys(options.headers).find(function (_) {
  4336. return REPLACE_HEDERS.includes(_.toLowerCase());
  4337. })) {
  4338. options.headers['x-oss-metadata-directive'] = 'REPLACE';
  4339. }
  4340. this._convertMetaToHeaders(options.meta, options.headers);
  4341. sourceName = this._getSourceName(sourceName, bucketName);
  4342. if (options.versionId) {
  4343. sourceName = "".concat(sourceName, "?versionId=").concat(options.versionId);
  4344. }
  4345. options.headers['x-oss-copy-source'] = sourceName;
  4346. params = this._objectRequestParams('PUT', name, options);
  4347. params.xmlResponse = true;
  4348. params.successStatuses = [200, 304];
  4349. _context.next = 14;
  4350. return this.request(params);
  4351. case 14:
  4352. result = _context.sent;
  4353. data = result.data;
  4354. if (data) {
  4355. data = {
  4356. etag: data.ETag,
  4357. lastModified: data.LastModified
  4358. };
  4359. }
  4360. return _context.abrupt("return", {
  4361. data: data,
  4362. res: result.res
  4363. });
  4364. case 18:
  4365. case "end":
  4366. return _context.stop();
  4367. }
  4368. }
  4369. }, _callee, this);
  4370. }));
  4371. function copy(_x, _x2, _x3, _x4) {
  4372. return _copy.apply(this, arguments);
  4373. }
  4374. return copy;
  4375. }(); // todo delete
  4376. proto._getSourceName = function _getSourceName(sourceName, bucketName) {
  4377. if (typeof bucketName === 'string') {
  4378. sourceName = this._objectName(sourceName);
  4379. } else if (sourceName[0] !== '/') {
  4380. bucketName = this.options.bucket;
  4381. } else {
  4382. bucketName = sourceName.replace(/\/(.+?)(\/.*)/, '$1');
  4383. sourceName = sourceName.replace(/(\/.+?\/)(.*)/, '$2');
  4384. }
  4385. _checkBucketName(bucketName);
  4386. sourceName = encodeURIComponent(sourceName);
  4387. sourceName = "/".concat(bucketName, "/").concat(sourceName);
  4388. return sourceName;
  4389. };
  4390. },{"../utils/checkBucketName":51,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/helpers/typeof":79,"@babel/runtime/regenerator":80,"core-js/modules/es.array.concat.js":272,"core-js/modules/es.array.find.js":275,"core-js/modules/es.array.includes.js":277,"core-js/modules/es.object.keys.js":290,"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.regexp.exec.js":300,"core-js/modules/es.string.replace.js":305,"core-js/modules/web.dom-collections.for-each.js":339}],33:[function(require,module,exports){
  4391. "use strict";
  4392. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  4393. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  4394. require("core-js/modules/es.object.assign.js");
  4395. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  4396. var proto = exports;
  4397. /**
  4398. * delete
  4399. * @param {String} name - object name
  4400. * @param {Object} options
  4401. * @param {{res}}
  4402. */
  4403. proto.delete = /*#__PURE__*/function () {
  4404. var _delete2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name) {
  4405. var options,
  4406. params,
  4407. result,
  4408. _args = arguments;
  4409. return _regenerator.default.wrap(function _callee$(_context) {
  4410. while (1) {
  4411. switch (_context.prev = _context.next) {
  4412. case 0:
  4413. options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  4414. options.subres = Object.assign({}, options.subres);
  4415. if (options.versionId) {
  4416. options.subres.versionId = options.versionId;
  4417. }
  4418. params = this._objectRequestParams('DELETE', name, options);
  4419. params.successStatuses = [204];
  4420. _context.next = 7;
  4421. return this.request(params);
  4422. case 7:
  4423. result = _context.sent;
  4424. return _context.abrupt("return", {
  4425. res: result.res
  4426. });
  4427. case 9:
  4428. case "end":
  4429. return _context.stop();
  4430. }
  4431. }
  4432. }, _callee, this);
  4433. }));
  4434. function _delete(_x) {
  4435. return _delete2.apply(this, arguments);
  4436. }
  4437. return _delete;
  4438. }();
  4439. },{"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.object.assign.js":287}],34:[function(require,module,exports){
  4440. "use strict";
  4441. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  4442. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  4443. require("core-js/modules/es.object.assign.js");
  4444. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  4445. /* eslint-disable object-curly-newline */
  4446. var utility = require('utility');
  4447. var _require = require('../utils/obj2xml'),
  4448. obj2xml = _require.obj2xml;
  4449. var proto = exports;
  4450. proto.deleteMulti = /*#__PURE__*/function () {
  4451. var _deleteMulti = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(names) {
  4452. var options,
  4453. objects,
  4454. i,
  4455. object,
  4456. _names$i,
  4457. key,
  4458. versionId,
  4459. paramXMLObj,
  4460. paramXML,
  4461. params,
  4462. result,
  4463. r,
  4464. deleted,
  4465. _args = arguments;
  4466. return _regenerator.default.wrap(function _callee$(_context) {
  4467. while (1) {
  4468. switch (_context.prev = _context.next) {
  4469. case 0:
  4470. options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  4471. objects = [];
  4472. if (!(!names || !names.length)) {
  4473. _context.next = 4;
  4474. break;
  4475. }
  4476. throw new Error('names is required');
  4477. case 4:
  4478. for (i = 0; i < names.length; i++) {
  4479. object = {};
  4480. if (typeof names[i] === 'string') {
  4481. object.Key = utility.escape(this._objectName(names[i]));
  4482. } else {
  4483. _names$i = names[i], key = _names$i.key, versionId = _names$i.versionId;
  4484. object.Key = utility.escape(this._objectName(key));
  4485. object.VersionId = versionId;
  4486. }
  4487. objects.push(object);
  4488. }
  4489. paramXMLObj = {
  4490. Delete: {
  4491. Quiet: !!options.quiet,
  4492. Object: objects
  4493. }
  4494. };
  4495. paramXML = obj2xml(paramXMLObj, {
  4496. headers: true
  4497. });
  4498. options.subres = Object.assign({
  4499. delete: ''
  4500. }, options.subres);
  4501. if (options.versionId) {
  4502. options.subres.versionId = options.versionId;
  4503. }
  4504. params = this._objectRequestParams('POST', '', options);
  4505. params.mime = 'xml';
  4506. params.content = paramXML;
  4507. params.xmlResponse = true;
  4508. params.successStatuses = [200];
  4509. _context.next = 16;
  4510. return this.request(params);
  4511. case 16:
  4512. result = _context.sent;
  4513. r = result.data;
  4514. deleted = r && r.Deleted || null;
  4515. if (deleted) {
  4516. if (!Array.isArray(deleted)) {
  4517. deleted = [deleted];
  4518. }
  4519. }
  4520. return _context.abrupt("return", {
  4521. res: result.res,
  4522. deleted: deleted || []
  4523. });
  4524. case 21:
  4525. case "end":
  4526. return _context.stop();
  4527. }
  4528. }
  4529. }, _callee, this);
  4530. }));
  4531. function deleteMulti(_x) {
  4532. return _deleteMulti.apply(this, arguments);
  4533. }
  4534. return deleteMulti;
  4535. }();
  4536. },{"../utils/obj2xml":72,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.object.assign.js":287,"utility":474}],35:[function(require,module,exports){
  4537. "use strict";
  4538. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  4539. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  4540. require("core-js/modules/es.object.assign.js");
  4541. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  4542. var proto = exports;
  4543. /**
  4544. * deleteObjectTagging
  4545. * @param {String} name - object name
  4546. * @param {Object} options
  4547. */
  4548. proto.deleteObjectTagging = /*#__PURE__*/function () {
  4549. var _deleteObjectTagging = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name) {
  4550. var options,
  4551. params,
  4552. result,
  4553. _args = arguments;
  4554. return _regenerator.default.wrap(function _callee$(_context) {
  4555. while (1) {
  4556. switch (_context.prev = _context.next) {
  4557. case 0:
  4558. options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  4559. options.subres = Object.assign({
  4560. tagging: ''
  4561. }, options.subres);
  4562. if (options.versionId) {
  4563. options.subres.versionId = options.versionId;
  4564. }
  4565. name = this._objectName(name);
  4566. params = this._objectRequestParams('DELETE', name, options);
  4567. params.successStatuses = [204];
  4568. _context.next = 8;
  4569. return this.request(params);
  4570. case 8:
  4571. result = _context.sent;
  4572. return _context.abrupt("return", {
  4573. status: result.status,
  4574. res: result.res
  4575. });
  4576. case 10:
  4577. case "end":
  4578. return _context.stop();
  4579. }
  4580. }
  4581. }, _callee, this);
  4582. }));
  4583. function deleteObjectTagging(_x) {
  4584. return _deleteObjectTagging.apply(this, arguments);
  4585. }
  4586. return deleteObjectTagging;
  4587. }();
  4588. },{"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.object.assign.js":287}],36:[function(require,module,exports){
  4589. "use strict";
  4590. require("core-js/modules/es.array.concat.js");
  4591. var urlutil = require('url');
  4592. var _require = require('../utils/isIP'),
  4593. isIP = _require.isIP;
  4594. var proto = exports;
  4595. /**
  4596. * Get Object url by name
  4597. * @param {String} name - object name
  4598. * @param {String} [baseUrl] - If provide `baseUrl`, will use `baseUrl` instead the default `endpoint and bucket`.
  4599. * @return {String} object url include bucket
  4600. */
  4601. proto.generateObjectUrl = function generateObjectUrl(name, baseUrl) {
  4602. if (isIP(this.options.endpoint.hostname)) {
  4603. throw new Error('can not get the object URL when endpoint is IP');
  4604. }
  4605. if (!baseUrl) {
  4606. baseUrl = this.options.endpoint.format();
  4607. var copyUrl = urlutil.parse(baseUrl);
  4608. var bucket = this.options.bucket;
  4609. copyUrl.hostname = "".concat(bucket, ".").concat(copyUrl.hostname);
  4610. copyUrl.host = "".concat(bucket, ".").concat(copyUrl.host);
  4611. baseUrl = copyUrl.format();
  4612. } else if (baseUrl[baseUrl.length - 1] !== '/') {
  4613. baseUrl += '/';
  4614. }
  4615. return baseUrl + this._escape(this._objectName(name));
  4616. };
  4617. },{"../utils/isIP":69,"core-js/modules/es.array.concat.js":272,"url":472}],37:[function(require,module,exports){
  4618. (function (process){(function (){
  4619. "use strict";
  4620. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  4621. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  4622. require("core-js/modules/es.object.assign.js");
  4623. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  4624. var fs = require('fs');
  4625. var is = require('is-type-of');
  4626. var proto = exports;
  4627. /**
  4628. * get
  4629. * @param {String} name - object name
  4630. * @param {String | Stream} file
  4631. * @param {Object} options
  4632. * @param {{res}}
  4633. */
  4634. proto.get = /*#__PURE__*/function () {
  4635. var _get = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, file) {
  4636. var options,
  4637. writeStream,
  4638. needDestroy,
  4639. isBrowserEnv,
  4640. responseCacheControl,
  4641. defaultSubresOptions,
  4642. result,
  4643. params,
  4644. _args = arguments;
  4645. return _regenerator.default.wrap(function _callee$(_context) {
  4646. while (1) {
  4647. switch (_context.prev = _context.next) {
  4648. case 0:
  4649. options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
  4650. writeStream = null;
  4651. needDestroy = false;
  4652. if (is.writableStream(file)) {
  4653. writeStream = file;
  4654. } else if (is.string(file)) {
  4655. writeStream = fs.createWriteStream(file);
  4656. needDestroy = true;
  4657. } else {
  4658. // get(name, options)
  4659. options = file;
  4660. }
  4661. options = options || {};
  4662. isBrowserEnv = process && process.browser;
  4663. responseCacheControl = options.responseCacheControl === null ? '' : 'no-cache';
  4664. defaultSubresOptions = isBrowserEnv && responseCacheControl ? {
  4665. 'response-cache-control': responseCacheControl
  4666. } : {};
  4667. options.subres = Object.assign(defaultSubresOptions, options.subres);
  4668. if (options.versionId) {
  4669. options.subres.versionId = options.versionId;
  4670. }
  4671. if (options.process) {
  4672. options.subres['x-oss-process'] = options.process;
  4673. }
  4674. _context.prev = 11;
  4675. params = this._objectRequestParams('GET', name, options);
  4676. params.writeStream = writeStream;
  4677. params.successStatuses = [200, 206, 304];
  4678. _context.next = 17;
  4679. return this.request(params);
  4680. case 17:
  4681. result = _context.sent;
  4682. if (needDestroy) {
  4683. writeStream.destroy();
  4684. }
  4685. _context.next = 28;
  4686. break;
  4687. case 21:
  4688. _context.prev = 21;
  4689. _context.t0 = _context["catch"](11);
  4690. if (!needDestroy) {
  4691. _context.next = 27;
  4692. break;
  4693. }
  4694. writeStream.destroy(); // should delete the exists file before throw error
  4695. _context.next = 27;
  4696. return this._deleteFileSafe(file);
  4697. case 27:
  4698. throw _context.t0;
  4699. case 28:
  4700. return _context.abrupt("return", {
  4701. res: result.res,
  4702. content: result.data
  4703. });
  4704. case 29:
  4705. case "end":
  4706. return _context.stop();
  4707. }
  4708. }
  4709. }, _callee, this, [[11, 21]]);
  4710. }));
  4711. function get(_x, _x2) {
  4712. return _get.apply(this, arguments);
  4713. }
  4714. return get;
  4715. }();
  4716. }).call(this)}).call(this,require('_process'))
  4717. },{"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"_process":467,"core-js/modules/es.object.assign.js":287,"fs":89,"is-type-of":466}],38:[function(require,module,exports){
  4718. "use strict";
  4719. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  4720. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  4721. require("core-js/modules/es.object.assign.js");
  4722. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  4723. var proto = exports;
  4724. /*
  4725. * Get object's ACL
  4726. * @param {String} name the object key
  4727. * @param {Object} options
  4728. * @return {Object}
  4729. */
  4730. proto.getACL = /*#__PURE__*/function () {
  4731. var _getACL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name) {
  4732. var options,
  4733. params,
  4734. result,
  4735. _args = arguments;
  4736. return _regenerator.default.wrap(function _callee$(_context) {
  4737. while (1) {
  4738. switch (_context.prev = _context.next) {
  4739. case 0:
  4740. options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  4741. options.subres = Object.assign({
  4742. acl: ''
  4743. }, options.subres);
  4744. if (options.versionId) {
  4745. options.subres.versionId = options.versionId;
  4746. }
  4747. name = this._objectName(name);
  4748. params = this._objectRequestParams('GET', name, options);
  4749. params.successStatuses = [200];
  4750. params.xmlResponse = true;
  4751. _context.next = 9;
  4752. return this.request(params);
  4753. case 9:
  4754. result = _context.sent;
  4755. return _context.abrupt("return", {
  4756. acl: result.data.AccessControlList.Grant,
  4757. owner: {
  4758. id: result.data.Owner.ID,
  4759. displayName: result.data.Owner.DisplayName
  4760. },
  4761. res: result.res
  4762. });
  4763. case 11:
  4764. case "end":
  4765. return _context.stop();
  4766. }
  4767. }
  4768. }, _callee, this);
  4769. }));
  4770. function getACL(_x) {
  4771. return _getACL.apply(this, arguments);
  4772. }
  4773. return getACL;
  4774. }();
  4775. },{"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.object.assign.js":287}],39:[function(require,module,exports){
  4776. "use strict";
  4777. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  4778. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  4779. require("core-js/modules/es.regexp.exec.js");
  4780. require("core-js/modules/es.string.replace.js");
  4781. require("core-js/modules/es.object.to-string.js");
  4782. require("core-js/modules/web.dom-collections.for-each.js");
  4783. require("core-js/modules/es.object.keys.js");
  4784. require("core-js/modules/es.object.assign.js");
  4785. require("core-js/modules/es.array.map.js");
  4786. require("core-js/modules/es.number.constructor.js");
  4787. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  4788. /* eslint-disable no-use-before-define */
  4789. var proto = exports;
  4790. var _require = require('../utils/isObject'),
  4791. isObject = _require.isObject;
  4792. var _require2 = require('../utils/isArray'),
  4793. isArray = _require2.isArray;
  4794. proto.getBucketVersions = getBucketVersions;
  4795. proto.listObjectVersions = getBucketVersions;
  4796. function getBucketVersions() {
  4797. return _getBucketVersions.apply(this, arguments);
  4798. }
  4799. function _getBucketVersions() {
  4800. _getBucketVersions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
  4801. var query,
  4802. options,
  4803. params,
  4804. result,
  4805. objects,
  4806. deleteMarker,
  4807. that,
  4808. prefixes,
  4809. _args = arguments;
  4810. return _regenerator.default.wrap(function _callee$(_context) {
  4811. while (1) {
  4812. switch (_context.prev = _context.next) {
  4813. case 0:
  4814. query = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
  4815. options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  4816. if (!(query.versionIdMarker && query.keyMarker === undefined)) {
  4817. _context.next = 4;
  4818. break;
  4819. }
  4820. throw new Error('A version-id marker cannot be specified without a key marker');
  4821. case 4:
  4822. options.subres = Object.assign({
  4823. versions: ''
  4824. }, options.subres);
  4825. if (options.versionId) {
  4826. options.subres.versionId = options.versionId;
  4827. }
  4828. params = this._objectRequestParams('GET', '', options);
  4829. params.xmlResponse = true;
  4830. params.successStatuses = [200];
  4831. params.query = formatQuery(query);
  4832. _context.next = 12;
  4833. return this.request(params);
  4834. case 12:
  4835. result = _context.sent;
  4836. objects = result.data.Version || [];
  4837. deleteMarker = result.data.DeleteMarker || [];
  4838. that = this;
  4839. if (objects) {
  4840. if (!Array.isArray(objects)) {
  4841. objects = [objects];
  4842. }
  4843. objects = objects.map(function (obj) {
  4844. return {
  4845. name: obj.Key,
  4846. url: that._objectUrl(obj.Key),
  4847. lastModified: obj.LastModified,
  4848. isLatest: obj.IsLatest === 'true',
  4849. versionId: obj.VersionId,
  4850. etag: obj.ETag,
  4851. type: obj.Type,
  4852. size: Number(obj.Size),
  4853. storageClass: obj.StorageClass,
  4854. owner: {
  4855. id: obj.Owner.ID,
  4856. displayName: obj.Owner.DisplayName
  4857. }
  4858. };
  4859. });
  4860. }
  4861. if (deleteMarker) {
  4862. if (!isArray(deleteMarker)) {
  4863. deleteMarker = [deleteMarker];
  4864. }
  4865. deleteMarker = deleteMarker.map(function (obj) {
  4866. return {
  4867. name: obj.Key,
  4868. lastModified: obj.LastModified,
  4869. versionId: obj.VersionId,
  4870. owner: {
  4871. id: obj.Owner.ID,
  4872. displayName: obj.Owner.DisplayName
  4873. }
  4874. };
  4875. });
  4876. }
  4877. prefixes = result.data.CommonPrefixes || null;
  4878. if (prefixes) {
  4879. if (!isArray(prefixes)) {
  4880. prefixes = [prefixes];
  4881. }
  4882. prefixes = prefixes.map(function (item) {
  4883. return item.Prefix;
  4884. });
  4885. }
  4886. return _context.abrupt("return", {
  4887. res: result.res,
  4888. objects: objects,
  4889. deleteMarker: deleteMarker,
  4890. prefixes: prefixes,
  4891. // attirbute of legacy error
  4892. nextMarker: result.data.NextKeyMarker || null,
  4893. // attirbute of legacy error
  4894. NextVersionIdMarker: result.data.NextVersionIdMarker || null,
  4895. nextKeyMarker: result.data.NextKeyMarker || null,
  4896. nextVersionIdMarker: result.data.NextVersionIdMarker || null,
  4897. isTruncated: result.data.IsTruncated === 'true'
  4898. });
  4899. case 21:
  4900. case "end":
  4901. return _context.stop();
  4902. }
  4903. }
  4904. }, _callee, this);
  4905. }));
  4906. return _getBucketVersions.apply(this, arguments);
  4907. }
  4908. function camel2Line(name) {
  4909. return name.replace(/([A-Z])/g, '-$1').toLowerCase();
  4910. }
  4911. function formatQuery() {
  4912. var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  4913. var obj = {};
  4914. if (isObject(query)) {
  4915. Object.keys(query).forEach(function (key) {
  4916. obj[camel2Line(key)] = query[key];
  4917. });
  4918. }
  4919. return obj;
  4920. }
  4921. },{"../utils/isArray":63,"../utils/isObject":70,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.array.map.js":280,"core-js/modules/es.number.constructor.js":286,"core-js/modules/es.object.assign.js":287,"core-js/modules/es.object.keys.js":290,"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.regexp.exec.js":300,"core-js/modules/es.string.replace.js":305,"core-js/modules/web.dom-collections.for-each.js":339}],40:[function(require,module,exports){
  4922. "use strict";
  4923. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  4924. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  4925. require("core-js/modules/es.object.assign.js");
  4926. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  4927. var proto = exports;
  4928. /**
  4929. * getObjectMeta
  4930. * @param {String} name - object name
  4931. * @param {Object} options
  4932. * @param {{res}}
  4933. */
  4934. proto.getObjectMeta = /*#__PURE__*/function () {
  4935. var _getObjectMeta = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
  4936. var params, result;
  4937. return _regenerator.default.wrap(function _callee$(_context) {
  4938. while (1) {
  4939. switch (_context.prev = _context.next) {
  4940. case 0:
  4941. options = options || {};
  4942. name = this._objectName(name);
  4943. options.subres = Object.assign({
  4944. objectMeta: ''
  4945. }, options.subres);
  4946. if (options.versionId) {
  4947. options.subres.versionId = options.versionId;
  4948. }
  4949. params = this._objectRequestParams('HEAD', name, options);
  4950. params.successStatuses = [200];
  4951. _context.next = 8;
  4952. return this.request(params);
  4953. case 8:
  4954. result = _context.sent;
  4955. return _context.abrupt("return", {
  4956. status: result.status,
  4957. res: result.res
  4958. });
  4959. case 10:
  4960. case "end":
  4961. return _context.stop();
  4962. }
  4963. }
  4964. }, _callee, this);
  4965. }));
  4966. function getObjectMeta(_x, _x2) {
  4967. return _getObjectMeta.apply(this, arguments);
  4968. }
  4969. return getObjectMeta;
  4970. }();
  4971. },{"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.object.assign.js":287}],41:[function(require,module,exports){
  4972. "use strict";
  4973. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  4974. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  4975. require("core-js/modules/es.object.assign.js");
  4976. require("core-js/modules/es.object.to-string.js");
  4977. require("core-js/modules/web.dom-collections.for-each.js");
  4978. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  4979. var proto = exports;
  4980. var _require = require('../utils/isObject'),
  4981. isObject = _require.isObject;
  4982. /**
  4983. * getObjectTagging
  4984. * @param {String} name - object name
  4985. * @param {Object} options
  4986. * @return {Object}
  4987. */
  4988. proto.getObjectTagging = /*#__PURE__*/function () {
  4989. var _getObjectTagging = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name) {
  4990. var options,
  4991. params,
  4992. result,
  4993. Tagging,
  4994. Tag,
  4995. tag,
  4996. _args = arguments;
  4997. return _regenerator.default.wrap(function _callee$(_context) {
  4998. while (1) {
  4999. switch (_context.prev = _context.next) {
  5000. case 0:
  5001. options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  5002. options.subres = Object.assign({
  5003. tagging: ''
  5004. }, options.subres);
  5005. if (options.versionId) {
  5006. options.subres.versionId = options.versionId;
  5007. }
  5008. name = this._objectName(name);
  5009. params = this._objectRequestParams('GET', name, options);
  5010. params.successStatuses = [200];
  5011. _context.next = 8;
  5012. return this.request(params);
  5013. case 8:
  5014. result = _context.sent;
  5015. _context.next = 11;
  5016. return this.parseXML(result.data);
  5017. case 11:
  5018. Tagging = _context.sent;
  5019. Tag = Tagging.TagSet.Tag;
  5020. Tag = Tag && isObject(Tag) ? [Tag] : Tag || [];
  5021. tag = {};
  5022. Tag.forEach(function (item) {
  5023. tag[item.Key] = item.Value;
  5024. });
  5025. return _context.abrupt("return", {
  5026. status: result.status,
  5027. res: result.res,
  5028. tag: tag
  5029. });
  5030. case 17:
  5031. case "end":
  5032. return _context.stop();
  5033. }
  5034. }
  5035. }, _callee, this);
  5036. }));
  5037. function getObjectTagging(_x) {
  5038. return _getObjectTagging.apply(this, arguments);
  5039. }
  5040. return getObjectTagging;
  5041. }();
  5042. },{"../utils/isObject":70,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.object.assign.js":287,"core-js/modules/es.object.to-string.js":291,"core-js/modules/web.dom-collections.for-each.js":339}],42:[function(require,module,exports){
  5043. "use strict";
  5044. var _require = require('../utils/isIP'),
  5045. isIP = _require.isIP;
  5046. var proto = exports;
  5047. /**
  5048. * Get Object url by name
  5049. * @param {String} name - object name
  5050. * @param {String} [baseUrl] - If provide `baseUrl`,
  5051. * will use `baseUrl` instead the default `endpoint`.
  5052. * @return {String} object url
  5053. */
  5054. proto.getObjectUrl = function getObjectUrl(name, baseUrl) {
  5055. if (isIP(this.options.endpoint.hostname)) {
  5056. throw new Error('can not get the object URL when endpoint is IP');
  5057. }
  5058. if (!baseUrl) {
  5059. baseUrl = this.options.endpoint.format();
  5060. } else if (baseUrl[baseUrl.length - 1] !== '/') {
  5061. baseUrl += '/';
  5062. }
  5063. return baseUrl + this._escape(this._objectName(name));
  5064. };
  5065. },{"../utils/isIP":69}],43:[function(require,module,exports){
  5066. "use strict";
  5067. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  5068. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  5069. require("core-js/modules/es.object.assign.js");
  5070. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  5071. var proto = exports;
  5072. /**
  5073. * getSymlink
  5074. * @param {String} name - object name
  5075. * @param {Object} options
  5076. * @param {{res}}
  5077. */
  5078. proto.getSymlink = /*#__PURE__*/function () {
  5079. var _getSymlink = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name) {
  5080. var options,
  5081. params,
  5082. result,
  5083. target,
  5084. _args = arguments;
  5085. return _regenerator.default.wrap(function _callee$(_context) {
  5086. while (1) {
  5087. switch (_context.prev = _context.next) {
  5088. case 0:
  5089. options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  5090. options.subres = Object.assign({
  5091. symlink: ''
  5092. }, options.subres);
  5093. if (options.versionId) {
  5094. options.subres.versionId = options.versionId;
  5095. }
  5096. name = this._objectName(name);
  5097. params = this._objectRequestParams('GET', name, options);
  5098. params.successStatuses = [200];
  5099. _context.next = 8;
  5100. return this.request(params);
  5101. case 8:
  5102. result = _context.sent;
  5103. target = result.res.headers['x-oss-symlink-target'];
  5104. return _context.abrupt("return", {
  5105. targetName: decodeURIComponent(target),
  5106. res: result.res
  5107. });
  5108. case 11:
  5109. case "end":
  5110. return _context.stop();
  5111. }
  5112. }
  5113. }, _callee, this);
  5114. }));
  5115. function getSymlink(_x) {
  5116. return _getSymlink.apply(this, arguments);
  5117. }
  5118. return getSymlink;
  5119. }();
  5120. },{"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.object.assign.js":287}],44:[function(require,module,exports){
  5121. "use strict";
  5122. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  5123. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  5124. require("core-js/modules/es.object.assign.js");
  5125. require("core-js/modules/es.object.to-string.js");
  5126. require("core-js/modules/web.dom-collections.for-each.js");
  5127. require("core-js/modules/es.object.keys.js");
  5128. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  5129. var _require = require('../utils/checkEnv'),
  5130. checkEnv = _require.checkEnv;
  5131. var proto = exports;
  5132. /**
  5133. * head
  5134. * @param {String} name - object name
  5135. * @param {Object} options
  5136. * @param {{res}}
  5137. */
  5138. proto.head = /*#__PURE__*/function () {
  5139. var _head = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name) {
  5140. var options,
  5141. params,
  5142. result,
  5143. data,
  5144. _args = arguments;
  5145. return _regenerator.default.wrap(function _callee$(_context) {
  5146. while (1) {
  5147. switch (_context.prev = _context.next) {
  5148. case 0:
  5149. options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  5150. checkEnv('Because HeadObject has gzip enabled, head cannot get the file size correctly. If you need to get the file size, please use getObjectMeta');
  5151. options.subres = Object.assign({}, options.subres);
  5152. if (options.versionId) {
  5153. options.subres.versionId = options.versionId;
  5154. }
  5155. params = this._objectRequestParams('HEAD', name, options);
  5156. params.successStatuses = [200, 304];
  5157. _context.next = 8;
  5158. return this.request(params);
  5159. case 8:
  5160. result = _context.sent;
  5161. data = {
  5162. meta: null,
  5163. res: result.res,
  5164. status: result.status
  5165. };
  5166. if (result.status === 200) {
  5167. Object.keys(result.headers).forEach(function (k) {
  5168. if (k.indexOf('x-oss-meta-') === 0) {
  5169. if (!data.meta) {
  5170. data.meta = {};
  5171. }
  5172. data.meta[k.substring(11)] = result.headers[k];
  5173. }
  5174. });
  5175. }
  5176. return _context.abrupt("return", data);
  5177. case 12:
  5178. case "end":
  5179. return _context.stop();
  5180. }
  5181. }
  5182. }, _callee, this);
  5183. }));
  5184. function head(_x) {
  5185. return _head.apply(this, arguments);
  5186. }
  5187. return head;
  5188. }();
  5189. },{"../utils/checkEnv":53,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.object.assign.js":287,"core-js/modules/es.object.keys.js":290,"core-js/modules/es.object.to-string.js":291,"core-js/modules/web.dom-collections.for-each.js":339}],45:[function(require,module,exports){
  5190. "use strict";
  5191. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  5192. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  5193. require("core-js/modules/es.object.assign.js");
  5194. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  5195. var proto = exports;
  5196. /*
  5197. * Set object's ACL
  5198. * @param {String} name the object key
  5199. * @param {String} acl the object ACL
  5200. * @param {Object} options
  5201. */
  5202. proto.putACL = /*#__PURE__*/function () {
  5203. var _putACL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, acl, options) {
  5204. var params, result;
  5205. return _regenerator.default.wrap(function _callee$(_context) {
  5206. while (1) {
  5207. switch (_context.prev = _context.next) {
  5208. case 0:
  5209. options = options || {};
  5210. options.subres = Object.assign({
  5211. acl: ''
  5212. }, options.subres);
  5213. if (options.versionId) {
  5214. options.subres.versionId = options.versionId;
  5215. }
  5216. options.headers = options.headers || {};
  5217. options.headers['x-oss-object-acl'] = acl;
  5218. name = this._objectName(name);
  5219. params = this._objectRequestParams('PUT', name, options);
  5220. params.successStatuses = [200];
  5221. _context.next = 10;
  5222. return this.request(params);
  5223. case 10:
  5224. result = _context.sent;
  5225. return _context.abrupt("return", {
  5226. res: result.res
  5227. });
  5228. case 12:
  5229. case "end":
  5230. return _context.stop();
  5231. }
  5232. }
  5233. }, _callee, this);
  5234. }));
  5235. function putACL(_x, _x2, _x3) {
  5236. return _putACL.apply(this, arguments);
  5237. }
  5238. return putACL;
  5239. }();
  5240. },{"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.object.assign.js":287}],46:[function(require,module,exports){
  5241. "use strict";
  5242. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  5243. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  5244. require("core-js/modules/es.object.assign.js");
  5245. require("core-js/modules/es.array.map.js");
  5246. require("core-js/modules/es.object.keys.js");
  5247. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  5248. var _require = require('../utils/obj2xml'),
  5249. obj2xml = _require.obj2xml;
  5250. var _require2 = require('../utils/checkObjectTag'),
  5251. checkObjectTag = _require2.checkObjectTag;
  5252. var proto = exports;
  5253. /**
  5254. * putObjectTagging
  5255. * @param {String} name - object name
  5256. * @param {Object} tag - object tag, eg: `{a: "1", b: "2"}`
  5257. * @param {Object} options
  5258. */
  5259. proto.putObjectTagging = /*#__PURE__*/function () {
  5260. var _putObjectTagging = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, tag) {
  5261. var options,
  5262. params,
  5263. paramXMLObj,
  5264. result,
  5265. _args = arguments;
  5266. return _regenerator.default.wrap(function _callee$(_context) {
  5267. while (1) {
  5268. switch (_context.prev = _context.next) {
  5269. case 0:
  5270. options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
  5271. checkObjectTag(tag);
  5272. options.subres = Object.assign({
  5273. tagging: ''
  5274. }, options.subres);
  5275. if (options.versionId) {
  5276. options.subres.versionId = options.versionId;
  5277. }
  5278. name = this._objectName(name);
  5279. params = this._objectRequestParams('PUT', name, options);
  5280. params.successStatuses = [200];
  5281. tag = Object.keys(tag).map(function (key) {
  5282. return {
  5283. Key: key,
  5284. Value: tag[key]
  5285. };
  5286. });
  5287. paramXMLObj = {
  5288. Tagging: {
  5289. TagSet: {
  5290. Tag: tag
  5291. }
  5292. }
  5293. };
  5294. params.mime = 'xml';
  5295. params.content = obj2xml(paramXMLObj);
  5296. _context.next = 13;
  5297. return this.request(params);
  5298. case 13:
  5299. result = _context.sent;
  5300. return _context.abrupt("return", {
  5301. res: result.res,
  5302. status: result.status
  5303. });
  5304. case 15:
  5305. case "end":
  5306. return _context.stop();
  5307. }
  5308. }
  5309. }, _callee, this);
  5310. }));
  5311. function putObjectTagging(_x, _x2) {
  5312. return _putObjectTagging.apply(this, arguments);
  5313. }
  5314. return putObjectTagging;
  5315. }();
  5316. },{"../utils/checkObjectTag":54,"../utils/obj2xml":72,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.array.map.js":280,"core-js/modules/es.object.assign.js":287,"core-js/modules/es.object.keys.js":290}],47:[function(require,module,exports){
  5317. "use strict";
  5318. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  5319. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  5320. require("core-js/modules/es.object.assign.js");
  5321. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  5322. var proto = exports;
  5323. /**
  5324. * putSymlink
  5325. * @param {String} name - object name
  5326. * @param {String} targetName - target name
  5327. * @param {Object} options
  5328. * @param {{res}}
  5329. */
  5330. proto.putSymlink = /*#__PURE__*/function () {
  5331. var _putSymlink = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, targetName, options) {
  5332. var params, result;
  5333. return _regenerator.default.wrap(function _callee$(_context) {
  5334. while (1) {
  5335. switch (_context.prev = _context.next) {
  5336. case 0:
  5337. options = options || {};
  5338. options.headers = options.headers || {};
  5339. targetName = this._escape(this._objectName(targetName));
  5340. this._convertMetaToHeaders(options.meta, options.headers);
  5341. options.headers['x-oss-symlink-target'] = targetName;
  5342. options.subres = Object.assign({
  5343. symlink: ''
  5344. }, options.subres);
  5345. if (options.versionId) {
  5346. options.subres.versionId = options.versionId;
  5347. }
  5348. if (options.storageClass) {
  5349. options.headers['x-oss-storage-class'] = options.storageClass;
  5350. }
  5351. name = this._objectName(name);
  5352. params = this._objectRequestParams('PUT', name, options);
  5353. params.successStatuses = [200];
  5354. _context.next = 13;
  5355. return this.request(params);
  5356. case 13:
  5357. result = _context.sent;
  5358. return _context.abrupt("return", {
  5359. res: result.res
  5360. });
  5361. case 15:
  5362. case "end":
  5363. return _context.stop();
  5364. }
  5365. }
  5366. }, _callee, this);
  5367. }));
  5368. function putSymlink(_x, _x2, _x3) {
  5369. return _putSymlink.apply(this, arguments);
  5370. }
  5371. return putSymlink;
  5372. }();
  5373. },{"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.object.assign.js":287}],48:[function(require,module,exports){
  5374. "use strict";
  5375. var urlutil = require('url');
  5376. var utility = require('utility');
  5377. var copy = require('copy-to');
  5378. var signHelper = require('../../common/signUtils');
  5379. var _require = require('../utils/isIP'),
  5380. isIP = _require.isIP;
  5381. var proto = exports;
  5382. /**
  5383. * signatureUrl
  5384. * @deprecated will be deprecated in 7.x
  5385. * @param {String} name object name
  5386. * @param {Object} options options
  5387. */
  5388. proto.signatureUrl = function signatureUrl(name, options) {
  5389. if (isIP(this.options.endpoint.hostname)) {
  5390. throw new Error('can not get the object URL when endpoint is IP');
  5391. }
  5392. options = options || {};
  5393. name = this._objectName(name);
  5394. options.method = options.method || 'GET';
  5395. var expires = utility.timestamp() + (options.expires || 1800);
  5396. var params = {
  5397. bucket: this.options.bucket,
  5398. object: name
  5399. };
  5400. var resource = this._getResource(params);
  5401. if (this.options.stsToken) {
  5402. options['security-token'] = this.options.stsToken;
  5403. }
  5404. var signRes = signHelper._signatureForURL(this.options.accessKeySecret, options, resource, expires);
  5405. var url = urlutil.parse(this._getReqUrl(params));
  5406. url.query = {
  5407. OSSAccessKeyId: this.options.accessKeyId,
  5408. Expires: expires,
  5409. Signature: signRes.Signature
  5410. };
  5411. copy(signRes.subResource).to(url.query);
  5412. return url.format();
  5413. };
  5414. },{"../../common/signUtils":50,"../utils/isIP":69,"copy-to":94,"url":472,"utility":474}],49:[function(require,module,exports){
  5415. "use strict";
  5416. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  5417. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  5418. require("core-js/modules/es.array.iterator.js");
  5419. require("core-js/modules/es.object.to-string.js");
  5420. require("core-js/modules/es.promise.js");
  5421. require("core-js/modules/es.string.iterator.js");
  5422. require("core-js/modules/web.dom-collections.iterator.js");
  5423. require("core-js/modules/web.dom-collections.for-each.js");
  5424. require("core-js/modules/es.function.name.js");
  5425. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  5426. var _require = require('./utils/isArray'),
  5427. isArray = _require.isArray;
  5428. var proto = exports;
  5429. proto._parallelNode = /*#__PURE__*/function () {
  5430. var _parallelNode2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(todo, parallel, fn, sourceData) {
  5431. var that, jobErr, jobs, tempBatch, remainder, batch, taskIndex, i;
  5432. return _regenerator.default.wrap(function _callee$(_context) {
  5433. while (1) {
  5434. switch (_context.prev = _context.next) {
  5435. case 0:
  5436. that = this; // upload in parallel
  5437. jobErr = [];
  5438. jobs = [];
  5439. tempBatch = todo.length / parallel;
  5440. remainder = todo.length % parallel;
  5441. batch = remainder === 0 ? tempBatch : (todo.length - remainder) / parallel + 1;
  5442. taskIndex = 1;
  5443. i = 0;
  5444. case 8:
  5445. if (!(i < todo.length)) {
  5446. _context.next = 26;
  5447. break;
  5448. }
  5449. if (!that.isCancel()) {
  5450. _context.next = 11;
  5451. break;
  5452. }
  5453. return _context.abrupt("break", 26);
  5454. case 11:
  5455. if (sourceData) {
  5456. jobs.push(fn(that, todo[i], sourceData));
  5457. } else {
  5458. jobs.push(fn(that, todo[i]));
  5459. }
  5460. if (!(jobs.length === parallel || taskIndex === batch && i === todo.length - 1)) {
  5461. _context.next = 23;
  5462. break;
  5463. }
  5464. _context.prev = 13;
  5465. taskIndex += 1;
  5466. /* eslint no-await-in-loop: [0] */
  5467. _context.next = 17;
  5468. return Promise.all(jobs);
  5469. case 17:
  5470. _context.next = 22;
  5471. break;
  5472. case 19:
  5473. _context.prev = 19;
  5474. _context.t0 = _context["catch"](13);
  5475. jobErr.push(_context.t0);
  5476. case 22:
  5477. jobs = [];
  5478. case 23:
  5479. i++;
  5480. _context.next = 8;
  5481. break;
  5482. case 26:
  5483. return _context.abrupt("return", jobErr);
  5484. case 27:
  5485. case "end":
  5486. return _context.stop();
  5487. }
  5488. }
  5489. }, _callee, this, [[13, 19]]);
  5490. }));
  5491. function _parallelNode(_x, _x2, _x3, _x4) {
  5492. return _parallelNode2.apply(this, arguments);
  5493. }
  5494. return _parallelNode;
  5495. }();
  5496. proto._parallel = function _parallel(todo, parallel, jobPromise) {
  5497. var that = this;
  5498. return new Promise(function (resolve) {
  5499. var _jobErr = [];
  5500. if (parallel <= 0 || !todo) {
  5501. resolve(_jobErr);
  5502. return;
  5503. }
  5504. function onlyOnce(fn) {
  5505. return function () {
  5506. if (fn === null) throw new Error('Callback was already called.');
  5507. var callFn = fn;
  5508. fn = null;
  5509. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  5510. args[_key] = arguments[_key];
  5511. }
  5512. callFn.apply(this, args);
  5513. };
  5514. }
  5515. function createArrayIterator(coll) {
  5516. var i = -1;
  5517. var len = coll.length;
  5518. return function next() {
  5519. return ++i < len && !that.isCancel() ? {
  5520. value: coll[i],
  5521. key: i
  5522. } : null;
  5523. };
  5524. }
  5525. var nextElem = createArrayIterator(todo);
  5526. var done = false;
  5527. var running = 0;
  5528. var looping = false;
  5529. function iterateeCallback(err) {
  5530. running -= 1;
  5531. if (err) {
  5532. done = true;
  5533. _jobErr.push(err);
  5534. resolve(_jobErr);
  5535. } else if (done && running <= 0) {
  5536. done = true;
  5537. resolve(_jobErr);
  5538. } else if (!looping) {
  5539. /* eslint no-use-before-define: [0] */
  5540. if (that.isCancel()) {
  5541. resolve(_jobErr);
  5542. } else {
  5543. replenish();
  5544. }
  5545. }
  5546. }
  5547. function iteratee(value, callback) {
  5548. jobPromise(value).then(function (result) {
  5549. callback(null, result);
  5550. }).catch(function (err) {
  5551. callback(err);
  5552. });
  5553. }
  5554. function replenish() {
  5555. looping = true;
  5556. while (running < parallel && !done && !that.isCancel()) {
  5557. var elem = nextElem();
  5558. if (elem === null || _jobErr.length > 0) {
  5559. done = true;
  5560. if (running <= 0) {
  5561. resolve(_jobErr);
  5562. }
  5563. return;
  5564. }
  5565. running += 1;
  5566. iteratee(elem.value, onlyOnce(iterateeCallback));
  5567. }
  5568. looping = false;
  5569. }
  5570. replenish();
  5571. });
  5572. };
  5573. /**
  5574. * cancel operation, now can use with multipartUpload
  5575. * @param {Object} abort
  5576. * {String} anort.name object key
  5577. * {String} anort.uploadId upload id
  5578. * {String} anort.options timeout
  5579. */
  5580. proto.cancel = function cancel(abort) {
  5581. this.options.cancelFlag = true;
  5582. if (isArray(this.multipartUploadStreams)) {
  5583. this.multipartUploadStreams.forEach(function (_) {
  5584. if (_.destroyed === false) {
  5585. var err = {
  5586. name: 'cancel',
  5587. message: 'cancel'
  5588. };
  5589. _.destroy(err);
  5590. }
  5591. });
  5592. }
  5593. this.multipartUploadStreams = [];
  5594. if (abort) {
  5595. this.abortMultipartUpload(abort.name, abort.uploadId, abort.options);
  5596. }
  5597. };
  5598. proto.isCancel = function isCancel() {
  5599. return this.options.cancelFlag;
  5600. };
  5601. proto.resetCancelFlag = function resetCancelFlag() {
  5602. this.options.cancelFlag = false;
  5603. };
  5604. proto._stop = function _stop() {
  5605. this.options.cancelFlag = true;
  5606. }; // cancel is not error , so create an object
  5607. proto._makeCancelEvent = function _makeCancelEvent() {
  5608. var cancelEvent = {
  5609. status: 0,
  5610. name: 'cancel'
  5611. };
  5612. return cancelEvent;
  5613. }; // abort is not error , so create an object
  5614. proto._makeAbortEvent = function _makeAbortEvent() {
  5615. var abortEvent = {
  5616. status: 0,
  5617. name: 'abort',
  5618. message: 'upload task has been abort'
  5619. };
  5620. return abortEvent;
  5621. };
  5622. },{"./utils/isArray":63,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.array.iterator.js":278,"core-js/modules/es.function.name.js":284,"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.promise.js":295,"core-js/modules/es.string.iterator.js":303,"core-js/modules/web.dom-collections.for-each.js":339,"core-js/modules/web.dom-collections.iterator.js":340}],50:[function(require,module,exports){
  5623. (function (Buffer){(function (){
  5624. "use strict";
  5625. require("core-js/modules/es.string.trim.js");
  5626. require("core-js/modules/es.array.sort.js");
  5627. require("core-js/modules/es.array.join.js");
  5628. require("core-js/modules/es.object.to-string.js");
  5629. require("core-js/modules/web.dom-collections.for-each.js");
  5630. require("core-js/modules/es.object.keys.js");
  5631. require("core-js/modules/es.array.concat.js");
  5632. require("core-js/modules/es.regexp.to-string.js");
  5633. var crypto = require('./../../shims/crypto/crypto.js');
  5634. var is = require('is-type-of');
  5635. var _require = require('./utils/lowercaseKeyHeader'),
  5636. lowercaseKeyHeader = _require.lowercaseKeyHeader;
  5637. /**
  5638. *
  5639. * @param {String} resourcePath
  5640. * @param {Object} parameters
  5641. * @return
  5642. */
  5643. exports.buildCanonicalizedResource = function buildCanonicalizedResource(resourcePath, parameters) {
  5644. var canonicalizedResource = "".concat(resourcePath);
  5645. var separatorString = '?';
  5646. if (is.string(parameters) && parameters.trim() !== '') {
  5647. canonicalizedResource += separatorString + parameters;
  5648. } else if (is.array(parameters)) {
  5649. parameters.sort();
  5650. canonicalizedResource += separatorString + parameters.join('&');
  5651. } else if (parameters) {
  5652. var compareFunc = function compareFunc(entry1, entry2) {
  5653. if (entry1[0] > entry2[0]) {
  5654. return 1;
  5655. } else if (entry1[0] < entry2[0]) {
  5656. return -1;
  5657. }
  5658. return 0;
  5659. };
  5660. var processFunc = function processFunc(key) {
  5661. canonicalizedResource += separatorString + key;
  5662. if (parameters[key] || parameters[key] === 0) {
  5663. canonicalizedResource += "=".concat(parameters[key]);
  5664. }
  5665. separatorString = '&';
  5666. };
  5667. Object.keys(parameters).sort(compareFunc).forEach(processFunc);
  5668. }
  5669. return canonicalizedResource;
  5670. };
  5671. /**
  5672. * @param {String} method
  5673. * @param {String} resourcePath
  5674. * @param {Object} request
  5675. * @param {String} expires
  5676. * @return {String} canonicalString
  5677. */
  5678. exports.buildCanonicalString = function canonicalString(method, resourcePath, request, expires) {
  5679. request = request || {};
  5680. var headers = lowercaseKeyHeader(request.headers);
  5681. var OSS_PREFIX = 'x-oss-';
  5682. var ossHeaders = [];
  5683. var headersToSign = {};
  5684. var signContent = [method.toUpperCase(), headers['content-md5'] || '', headers['content-type'], expires || headers['x-oss-date']];
  5685. Object.keys(headers).forEach(function (key) {
  5686. var lowerKey = key.toLowerCase();
  5687. if (lowerKey.indexOf(OSS_PREFIX) === 0) {
  5688. headersToSign[lowerKey] = String(headers[key]).trim();
  5689. }
  5690. });
  5691. Object.keys(headersToSign).sort().forEach(function (key) {
  5692. ossHeaders.push("".concat(key, ":").concat(headersToSign[key]));
  5693. });
  5694. signContent = signContent.concat(ossHeaders);
  5695. signContent.push(this.buildCanonicalizedResource(resourcePath, request.parameters));
  5696. return signContent.join('\n');
  5697. };
  5698. /**
  5699. * @param {String} accessKeySecret
  5700. * @param {String} canonicalString
  5701. */
  5702. exports.computeSignature = function computeSignature(accessKeySecret, canonicalString) {
  5703. var headerEncoding = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'utf-8';
  5704. var signature = crypto.createHmac('sha1', accessKeySecret);
  5705. return signature.update(Buffer.from(canonicalString, headerEncoding)).digest('base64');
  5706. };
  5707. /**
  5708. * @param {String} accessKeyId
  5709. * @param {String} accessKeySecret
  5710. * @param {String} canonicalString
  5711. */
  5712. exports.authorization = function authorization(accessKeyId, accessKeySecret, canonicalString, headerEncoding) {
  5713. return "OSS ".concat(accessKeyId, ":").concat(this.computeSignature(accessKeySecret, canonicalString, headerEncoding));
  5714. };
  5715. /**
  5716. *
  5717. * @param {String} accessKeySecret
  5718. * @param {Object} options
  5719. * @param {String} resource
  5720. * @param {Number} expires
  5721. */
  5722. exports._signatureForURL = function _signatureForURL(accessKeySecret) {
  5723. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  5724. var resource = arguments.length > 2 ? arguments[2] : undefined;
  5725. var expires = arguments.length > 3 ? arguments[3] : undefined;
  5726. var headerEncoding = arguments.length > 4 ? arguments[4] : undefined;
  5727. var headers = {};
  5728. var _options$subResource = options.subResource,
  5729. subResource = _options$subResource === void 0 ? {} : _options$subResource;
  5730. if (options.process) {
  5731. var processKeyword = 'x-oss-process';
  5732. subResource[processKeyword] = options.process;
  5733. }
  5734. if (options.trafficLimit) {
  5735. var trafficLimitKey = 'x-oss-traffic-limit';
  5736. subResource[trafficLimitKey] = options.trafficLimit;
  5737. }
  5738. if (options.response) {
  5739. Object.keys(options.response).forEach(function (k) {
  5740. var key = "response-".concat(k.toLowerCase());
  5741. subResource[key] = options.response[k];
  5742. });
  5743. }
  5744. Object.keys(options).forEach(function (key) {
  5745. var lowerKey = key.toLowerCase();
  5746. var value = options[key];
  5747. if (lowerKey.indexOf('x-oss-') === 0) {
  5748. headers[lowerKey] = value;
  5749. } else if (lowerKey.indexOf('content-md5') === 0) {
  5750. headers[key] = value;
  5751. } else if (lowerKey.indexOf('content-type') === 0) {
  5752. headers[key] = value;
  5753. }
  5754. });
  5755. if (Object.prototype.hasOwnProperty.call(options, 'security-token')) {
  5756. subResource['security-token'] = options['security-token'];
  5757. }
  5758. if (Object.prototype.hasOwnProperty.call(options, 'callback')) {
  5759. var json = {
  5760. callbackUrl: encodeURI(options.callback.url),
  5761. callbackBody: options.callback.body
  5762. };
  5763. if (options.callback.host) {
  5764. json.callbackHost = options.callback.host;
  5765. }
  5766. if (options.callback.contentType) {
  5767. json.callbackBodyType = options.callback.contentType;
  5768. }
  5769. subResource.callback = Buffer.from(JSON.stringify(json)).toString('base64');
  5770. if (options.callback.customValue) {
  5771. var callbackVar = {};
  5772. Object.keys(options.callback.customValue).forEach(function (key) {
  5773. callbackVar["x:".concat(key)] = options.callback.customValue[key];
  5774. });
  5775. subResource['callback-var'] = Buffer.from(JSON.stringify(callbackVar)).toString('base64');
  5776. }
  5777. }
  5778. var canonicalString = this.buildCanonicalString(options.method, resource, {
  5779. headers: headers,
  5780. parameters: subResource
  5781. }, expires.toString());
  5782. return {
  5783. Signature: this.computeSignature(accessKeySecret, canonicalString, headerEncoding),
  5784. subResource: subResource
  5785. };
  5786. };
  5787. }).call(this)}).call(this,require("buffer").Buffer)
  5788. },{"./../../shims/crypto/crypto.js":461,"./utils/lowercaseKeyHeader":71,"buffer":90,"core-js/modules/es.array.concat.js":272,"core-js/modules/es.array.join.js":279,"core-js/modules/es.array.sort.js":282,"core-js/modules/es.object.keys.js":290,"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.regexp.to-string.js":301,"core-js/modules/es.string.trim.js":308,"core-js/modules/web.dom-collections.for-each.js":339,"is-type-of":466}],51:[function(require,module,exports){
  5789. "use strict";
  5790. require("core-js/modules/es.regexp.exec.js");
  5791. Object.defineProperty(exports, "__esModule", {
  5792. value: true
  5793. });
  5794. exports.checkBucketName = void 0;
  5795. exports.checkBucketName = function (name) {
  5796. var createBucket = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  5797. var bucketRegex = createBucket ? /^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/ : /^[a-z0-9_][a-z0-9-_]{1,61}[a-z0-9_]$/;
  5798. if (!bucketRegex.test(name)) {
  5799. throw new Error('The bucket must be conform to the specifications');
  5800. }
  5801. };
  5802. },{"core-js/modules/es.regexp.exec.js":300}],52:[function(require,module,exports){
  5803. "use strict";
  5804. require("core-js/modules/es.regexp.exec.js");
  5805. Object.defineProperty(exports, "__esModule", {
  5806. value: true
  5807. });
  5808. exports.checkConfigValid = void 0;
  5809. var checkConfigMap = {
  5810. endpoint: checkEndpoint,
  5811. region: /^[a-zA-Z0-9\-_]+$/
  5812. };
  5813. function checkEndpoint(endpoint) {
  5814. if (typeof endpoint === 'string') {
  5815. return /^[a-zA-Z0-9._:/-]+$/.test(endpoint);
  5816. } else if (endpoint.host) {
  5817. return /^[a-zA-Z0-9._:/-]+$/.test(endpoint.host);
  5818. }
  5819. return false;
  5820. }
  5821. exports.checkConfigValid = function (conf, key) {
  5822. if (checkConfigMap[key]) {
  5823. var isConfigValid = true;
  5824. if (checkConfigMap[key] instanceof Function) {
  5825. isConfigValid = checkConfigMap[key](conf);
  5826. } else {
  5827. isConfigValid = checkConfigMap[key].test(conf);
  5828. }
  5829. if (!isConfigValid) {
  5830. throw new Error("The ".concat(key, " must be conform to the specifications"));
  5831. }
  5832. }
  5833. };
  5834. },{"core-js/modules/es.regexp.exec.js":300}],53:[function(require,module,exports){
  5835. (function (process){(function (){
  5836. "use strict";
  5837. Object.defineProperty(exports, "__esModule", {
  5838. value: true
  5839. });
  5840. exports.checkEnv = void 0;
  5841. function checkEnv(msg) {
  5842. if (process.browser) {
  5843. console.warn(msg);
  5844. }
  5845. }
  5846. exports.checkEnv = checkEnv;
  5847. }).call(this)}).call(this,require('_process'))
  5848. },{"_process":467}],54:[function(require,module,exports){
  5849. "use strict";
  5850. require("core-js/modules/es.array.concat.js");
  5851. require("core-js/modules/es.object.entries.js");
  5852. require("core-js/modules/es.object.to-string.js");
  5853. require("core-js/modules/web.dom-collections.for-each.js");
  5854. Object.defineProperty(exports, "__esModule", {
  5855. value: true
  5856. });
  5857. exports.checkObjectTag = void 0;
  5858. var _require = require('./checkValid'),
  5859. checkValid = _require.checkValid;
  5860. var _require2 = require('./isObject'),
  5861. isObject = _require2.isObject;
  5862. var commonRules = [{
  5863. validator: function validator(value) {
  5864. if (typeof value !== 'string') {
  5865. throw new Error('the key and value of the tag must be String');
  5866. }
  5867. }
  5868. }, {
  5869. pattern: /^[a-zA-Z0-9 +-=._:/]+$/,
  5870. msg: 'tag can contain letters, numbers, spaces, and the following symbols: plus sign (+), hyphen (-), equal sign (=), period (.), underscore (_), colon (:), and forward slash (/)'
  5871. }];
  5872. var rules = {
  5873. key: [].concat(commonRules, [{
  5874. pattern: /^.{1,128}$/,
  5875. msg: 'tag key can be a maximum of 128 bytes in length'
  5876. }]),
  5877. value: [].concat(commonRules, [{
  5878. pattern: /^.{0,256}$/,
  5879. msg: 'tag value can be a maximum of 256 bytes in length'
  5880. }])
  5881. };
  5882. function checkObjectTag(tag) {
  5883. if (!isObject(tag)) {
  5884. throw new Error('tag must be Object');
  5885. }
  5886. var entries = Object.entries(tag);
  5887. if (entries.length > 10) {
  5888. throw new Error('maximum of 10 tags for a object');
  5889. }
  5890. var rulesIndexKey = ['key', 'value'];
  5891. entries.forEach(function (keyValue) {
  5892. keyValue.forEach(function (item, index) {
  5893. checkValid(item, rules[rulesIndexKey[index]]);
  5894. });
  5895. });
  5896. }
  5897. exports.checkObjectTag = checkObjectTag;
  5898. },{"./checkValid":55,"./isObject":70,"core-js/modules/es.array.concat.js":272,"core-js/modules/es.object.entries.js":288,"core-js/modules/es.object.to-string.js":291,"core-js/modules/web.dom-collections.for-each.js":339}],55:[function(require,module,exports){
  5899. "use strict";
  5900. require("core-js/modules/es.object.to-string.js");
  5901. require("core-js/modules/web.dom-collections.for-each.js");
  5902. require("core-js/modules/es.regexp.exec.js");
  5903. Object.defineProperty(exports, "__esModule", {
  5904. value: true
  5905. });
  5906. exports.checkValid = void 0;
  5907. function checkValid(_value, _rules) {
  5908. _rules.forEach(function (rule) {
  5909. if (rule.validator) {
  5910. rule.validator(_value);
  5911. } else if (rule.pattern && !rule.pattern.test(_value)) {
  5912. throw new Error(rule.msg);
  5913. }
  5914. });
  5915. }
  5916. exports.checkValid = checkValid;
  5917. },{"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.regexp.exec.js":300,"core-js/modules/web.dom-collections.for-each.js":339}],56:[function(require,module,exports){
  5918. (function (Buffer){(function (){
  5919. "use strict";
  5920. require("core-js/modules/es.array.includes.js");
  5921. require("core-js/modules/es.string.includes.js");
  5922. require("core-js/modules/es.object.assign.js");
  5923. require("core-js/modules/es.array.concat.js");
  5924. Object.defineProperty(exports, "__esModule", {
  5925. value: true
  5926. });
  5927. exports.createRequest = void 0;
  5928. var crypto = require('./../../../shims/crypto/crypto.js');
  5929. var debug = require('debug')('ali-oss');
  5930. var mime = require('mime');
  5931. var dateFormat = require('dateformat');
  5932. var copy = require('copy-to');
  5933. var path = require('path');
  5934. var _require = require('./encoder'),
  5935. encoder = _require.encoder;
  5936. var _require2 = require('./isIP'),
  5937. isIP = _require2.isIP;
  5938. var _require3 = require('./setRegion'),
  5939. setRegion = _require3.setRegion;
  5940. var _require4 = require('../client/getReqUrl'),
  5941. getReqUrl = _require4.getReqUrl;
  5942. var _require5 = require('./isDingTalk'),
  5943. isDingTalk = _require5.isDingTalk;
  5944. function getHeader(headers, name) {
  5945. return headers[name] || headers[name.toLowerCase()];
  5946. }
  5947. function delHeader(headers, name) {
  5948. delete headers[name];
  5949. delete headers[name.toLowerCase()];
  5950. }
  5951. function createRequest(params) {
  5952. var date = new Date();
  5953. if (this.options.amendTimeSkewed) {
  5954. date = +new Date() + this.options.amendTimeSkewed;
  5955. }
  5956. var headers = {
  5957. 'x-oss-date': dateFormat(date, "UTC:ddd, dd mmm yyyy HH:MM:ss 'GMT'")
  5958. };
  5959. if (typeof window !== 'undefined') {
  5960. headers['x-oss-user-agent'] = this.userAgent;
  5961. }
  5962. if (this.userAgent.includes('nodejs')) {
  5963. headers['User-Agent'] = this.userAgent;
  5964. }
  5965. if (this.options.isRequestPay) {
  5966. Object.assign(headers, {
  5967. 'x-oss-request-payer': 'requester'
  5968. });
  5969. }
  5970. if (this.options.stsToken) {
  5971. headers['x-oss-security-token'] = this.options.stsToken;
  5972. }
  5973. copy(params.headers).to(headers);
  5974. if (!getHeader(headers, 'Content-Type')) {
  5975. if (params.mime && params.mime.indexOf('/') > 0) {
  5976. headers['Content-Type'] = params.mime;
  5977. } else if (isDingTalk()) {
  5978. headers['Content-Type'] = 'application/octet-stream';
  5979. } else {
  5980. headers['Content-Type'] = mime.getType(params.mime || path.extname(params.object || ''));
  5981. }
  5982. }
  5983. if (!getHeader(headers, 'Content-Type')) {
  5984. delHeader(headers, 'Content-Type');
  5985. }
  5986. if (params.content) {
  5987. if (!params.disabledMD5) {
  5988. if (!params.headers || !params.headers['Content-MD5']) {
  5989. headers['Content-MD5'] = crypto.createHash('md5').update(Buffer.from(params.content, 'utf8')).digest('base64');
  5990. } else {
  5991. headers['Content-MD5'] = params.headers['Content-MD5'];
  5992. }
  5993. }
  5994. if (!headers['Content-Length']) {
  5995. headers['Content-Length'] = params.content.length;
  5996. }
  5997. }
  5998. var hasOwnProperty = Object.prototype.hasOwnProperty;
  5999. for (var k in headers) {
  6000. if (headers[k] && hasOwnProperty.call(headers, k)) {
  6001. headers[k] = encoder(String(headers[k]), this.options.headerEncoding);
  6002. }
  6003. }
  6004. var authResource = this._getResource(params);
  6005. headers.authorization = this.authorization(params.method, authResource, params.subres, headers, this.options.headerEncoding); // const url = this._getReqUrl(params);
  6006. if (isIP(this.options.endpoint.hostname)) {
  6007. var _this$options = this.options,
  6008. region = _this$options.region,
  6009. internal = _this$options.internal,
  6010. secure = _this$options.secure;
  6011. var hostInfo = setRegion(region, internal, secure);
  6012. headers.host = "".concat(params.bucket, ".").concat(hostInfo.host);
  6013. }
  6014. var url = getReqUrl.bind(this)(params);
  6015. debug('request %s %s, with headers %j, !!stream: %s', params.method, url, headers, !!params.stream);
  6016. var timeout = params.timeout || this.options.timeout;
  6017. var reqParams = {
  6018. method: params.method,
  6019. content: params.content,
  6020. stream: params.stream,
  6021. headers: headers,
  6022. timeout: timeout,
  6023. writeStream: params.writeStream,
  6024. customResponse: params.customResponse,
  6025. ctx: params.ctx || this.ctx
  6026. };
  6027. if (this.agent) {
  6028. reqParams.agent = this.agent;
  6029. }
  6030. if (this.httpsAgent) {
  6031. reqParams.httpsAgent = this.httpsAgent;
  6032. }
  6033. reqParams.enableProxy = !!this.options.enableProxy;
  6034. reqParams.proxy = this.options.proxy ? this.options.proxy : null;
  6035. return {
  6036. url: url,
  6037. params: reqParams
  6038. };
  6039. }
  6040. exports.createRequest = createRequest;
  6041. }).call(this)}).call(this,require("buffer").Buffer)
  6042. },{"../client/getReqUrl":25,"./../../../shims/crypto/crypto.js":461,"./encoder":59,"./isDingTalk":66,"./isIP":69,"./setRegion":75,"buffer":90,"copy-to":94,"core-js/modules/es.array.concat.js":272,"core-js/modules/es.array.includes.js":277,"core-js/modules/es.object.assign.js":287,"core-js/modules/es.string.includes.js":302,"dateformat":342,"debug":465,"mime":374,"path":378}],57:[function(require,module,exports){
  6043. "use strict";
  6044. require("core-js/modules/es.object.to-string.js");
  6045. require("core-js/modules/web.dom-collections.for-each.js");
  6046. require("core-js/modules/es.object.entries.js");
  6047. require("core-js/modules/es.regexp.exec.js");
  6048. require("core-js/modules/es.string.replace.js");
  6049. require("core-js/modules/es.array.includes.js");
  6050. require("core-js/modules/es.object.keys.js");
  6051. Object.defineProperty(exports, "__esModule", {
  6052. value: true
  6053. });
  6054. exports.dataFix = void 0;
  6055. var isObject_1 = require("./isObject");
  6056. var TRUE = ['true', 'TRUE', '1', 1];
  6057. var FALSE = ['false', 'FALSE', '0', 0];
  6058. function dataFix(o, conf, finalKill) {
  6059. if (!isObject_1.isObject(o)) return;
  6060. var _conf$remove = conf.remove,
  6061. remove = _conf$remove === void 0 ? [] : _conf$remove,
  6062. _conf$rename = conf.rename,
  6063. rename = _conf$rename === void 0 ? {} : _conf$rename,
  6064. _conf$camel = conf.camel,
  6065. camel = _conf$camel === void 0 ? [] : _conf$camel,
  6066. _conf$bool = conf.bool,
  6067. bool = _conf$bool === void 0 ? [] : _conf$bool,
  6068. _conf$lowerFirst = conf.lowerFirst,
  6069. lowerFirst = _conf$lowerFirst === void 0 ? false : _conf$lowerFirst; // 删除不需要的数据
  6070. remove.forEach(function (v) {
  6071. return delete o[v];
  6072. }); // 重命名
  6073. Object.entries(rename).forEach(function (v) {
  6074. if (!o[v[0]]) return;
  6075. if (o[v[1]]) return;
  6076. o[v[1]] = o[v[0]];
  6077. delete o[v[0]];
  6078. }); // 驼峰化
  6079. camel.forEach(function (v) {
  6080. if (!o[v]) return;
  6081. var afterKey = v.replace(/^(.)/, function ($0) {
  6082. return $0.toLowerCase();
  6083. }).replace(/-(\w)/g, function (_, $1) {
  6084. return $1.toUpperCase();
  6085. });
  6086. if (o[afterKey]) return;
  6087. o[afterKey] = o[v]; // todo 暂时兼容以前数据,不做删除
  6088. // delete o[v];
  6089. }); // 转换值为布尔值
  6090. bool.forEach(function (v) {
  6091. o[v] = fixBool(o[v]);
  6092. }); // finalKill
  6093. if (typeof finalKill === 'function') {
  6094. finalKill(o);
  6095. } // 首字母转小写
  6096. fixLowerFirst(o, lowerFirst);
  6097. return dataFix;
  6098. }
  6099. exports.dataFix = dataFix;
  6100. function fixBool(value) {
  6101. if (!value) return false;
  6102. if (TRUE.includes(value)) return true;
  6103. return FALSE.includes(value) ? false : value;
  6104. }
  6105. function fixLowerFirst(o, lowerFirst) {
  6106. if (lowerFirst) {
  6107. Object.keys(o).forEach(function (key) {
  6108. var lowerK = key.replace(/^\w/, function (match) {
  6109. return match.toLowerCase();
  6110. });
  6111. if (typeof o[lowerK] === 'undefined') {
  6112. o[lowerK] = o[key];
  6113. delete o[key];
  6114. }
  6115. });
  6116. }
  6117. }
  6118. },{"./isObject":70,"core-js/modules/es.array.includes.js":277,"core-js/modules/es.object.entries.js":288,"core-js/modules/es.object.keys.js":290,"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.regexp.exec.js":300,"core-js/modules/es.string.replace.js":305,"core-js/modules/web.dom-collections.for-each.js":339}],58:[function(require,module,exports){
  6119. "use strict";
  6120. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  6121. require("core-js/modules/es.array.slice.js");
  6122. require("core-js/modules/es.object.to-string.js");
  6123. require("core-js/modules/web.dom-collections.for-each.js");
  6124. require("core-js/modules/es.object.keys.js");
  6125. var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
  6126. Object.defineProperty(exports, "__esModule", {
  6127. value: true
  6128. });
  6129. exports.deepCopyWith = exports.deepCopy = void 0;
  6130. var isBuffer_1 = require("./isBuffer");
  6131. exports.deepCopy = function (obj) {
  6132. if (obj === null || (0, _typeof2.default)(obj) !== 'object') {
  6133. return obj;
  6134. }
  6135. if (isBuffer_1.isBuffer(obj)) {
  6136. return obj.slice();
  6137. }
  6138. var copy = Array.isArray(obj) ? [] : {};
  6139. Object.keys(obj).forEach(function (key) {
  6140. copy[key] = exports.deepCopy(obj[key]);
  6141. });
  6142. return copy;
  6143. };
  6144. exports.deepCopyWith = function (obj, customizer) {
  6145. function deepCopyWithHelper(value, innerKey, innerObject) {
  6146. var result = customizer(value, innerKey, innerObject);
  6147. if (result !== undefined) return result;
  6148. if (value === null || (0, _typeof2.default)(value) !== 'object') {
  6149. return value;
  6150. }
  6151. if (isBuffer_1.isBuffer(value)) {
  6152. return value.slice();
  6153. }
  6154. var copy = Array.isArray(value) ? [] : {};
  6155. Object.keys(value).forEach(function (k) {
  6156. copy[k] = deepCopyWithHelper(value[k], k, value);
  6157. });
  6158. return copy;
  6159. }
  6160. if (customizer) {
  6161. return deepCopyWithHelper(obj, '', null);
  6162. } else {
  6163. return exports.deepCopy(obj);
  6164. }
  6165. };
  6166. },{"./isBuffer":65,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/helpers/typeof":79,"core-js/modules/es.array.slice.js":281,"core-js/modules/es.object.keys.js":290,"core-js/modules/es.object.to-string.js":291,"core-js/modules/web.dom-collections.for-each.js":339}],59:[function(require,module,exports){
  6167. (function (Buffer){(function (){
  6168. "use strict";
  6169. require("core-js/modules/es.object.to-string.js");
  6170. require("core-js/modules/es.regexp.to-string.js");
  6171. Object.defineProperty(exports, "__esModule", {
  6172. value: true
  6173. });
  6174. exports.encoder = void 0;
  6175. function encoder(str) {
  6176. var encoding = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'utf-8';
  6177. if (encoding === 'utf-8') return str;
  6178. return Buffer.from(str).toString('latin1');
  6179. }
  6180. exports.encoder = encoder;
  6181. }).call(this)}).call(this,require("buffer").Buffer)
  6182. },{"buffer":90,"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.regexp.to-string.js":301}],60:[function(require,module,exports){
  6183. "use strict";
  6184. require("core-js/modules/es.array.map.js");
  6185. require("core-js/modules/es.regexp.exec.js");
  6186. require("core-js/modules/es.string.replace.js");
  6187. Object.defineProperty(exports, "__esModule", {
  6188. value: true
  6189. });
  6190. exports.formatInventoryConfig = void 0;
  6191. var dataFix_1 = require("../utils/dataFix");
  6192. var isObject_1 = require("../utils/isObject");
  6193. var isArray_1 = require("../utils/isArray");
  6194. var formatObjKey_1 = require("../utils/formatObjKey");
  6195. function formatInventoryConfig(inventoryConfig) {
  6196. var toArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  6197. if (toArray && isObject_1.isObject(inventoryConfig)) inventoryConfig = [inventoryConfig];
  6198. if (isArray_1.isArray(inventoryConfig)) {
  6199. inventoryConfig = inventoryConfig.map(formatFn);
  6200. } else {
  6201. inventoryConfig = formatFn(inventoryConfig);
  6202. }
  6203. return inventoryConfig;
  6204. }
  6205. exports.formatInventoryConfig = formatInventoryConfig;
  6206. function formatFn(_) {
  6207. dataFix_1.dataFix(_, {
  6208. bool: ['IsEnabled']
  6209. }, function (conf) {
  6210. var _a, _b; // prefix
  6211. conf.prefix = conf.Filter.Prefix;
  6212. delete conf.Filter; // OSSBucketDestination
  6213. conf.OSSBucketDestination = conf.Destination.OSSBucketDestination; // OSSBucketDestination.rolename
  6214. conf.OSSBucketDestination.rolename = conf.OSSBucketDestination.RoleArn.replace(/.*\//, '');
  6215. delete conf.OSSBucketDestination.RoleArn; // OSSBucketDestination.bucket
  6216. conf.OSSBucketDestination.bucket = conf.OSSBucketDestination.Bucket.replace(/.*:::/, '');
  6217. delete conf.OSSBucketDestination.Bucket;
  6218. delete conf.Destination; // frequency
  6219. conf.frequency = conf.Schedule.Frequency;
  6220. delete conf.Schedule.Frequency; // optionalFields
  6221. if (((_a = conf === null || conf === void 0 ? void 0 : conf.OptionalFields) === null || _a === void 0 ? void 0 : _a.Field) && !isArray_1.isArray((_b = conf.OptionalFields) === null || _b === void 0 ? void 0 : _b.Field)) conf.OptionalFields.Field = [conf.OptionalFields.Field];
  6222. }); // firstLowerCase
  6223. _ = formatObjKey_1.formatObjKey(_, 'firstLowerCase', {
  6224. exclude: ['OSSBucketDestination', 'SSE-OSS', 'SSE-KMS']
  6225. });
  6226. return _;
  6227. }
  6228. },{"../utils/dataFix":57,"../utils/formatObjKey":61,"../utils/isArray":63,"../utils/isObject":70,"core-js/modules/es.array.map.js":280,"core-js/modules/es.regexp.exec.js":300,"core-js/modules/es.string.replace.js":305}],61:[function(require,module,exports){
  6229. "use strict";
  6230. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  6231. require("core-js/modules/es.object.to-string.js");
  6232. require("core-js/modules/web.dom-collections.for-each.js");
  6233. require("core-js/modules/es.object.keys.js");
  6234. require("core-js/modules/es.array.includes.js");
  6235. require("core-js/modules/es.string.includes.js");
  6236. require("core-js/modules/es.regexp.exec.js");
  6237. require("core-js/modules/es.string.replace.js");
  6238. var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
  6239. Object.defineProperty(exports, "__esModule", {
  6240. value: true
  6241. });
  6242. exports.formatObjKey = void 0;
  6243. function formatObjKey(obj, type, options) {
  6244. if (obj === null || (0, _typeof2.default)(obj) !== 'object') {
  6245. return obj;
  6246. }
  6247. var o;
  6248. if (Array.isArray(obj)) {
  6249. o = [];
  6250. for (var i = 0; i < obj.length; i++) {
  6251. o.push(formatObjKey(obj[i], type, options));
  6252. }
  6253. } else {
  6254. o = {};
  6255. Object.keys(obj).forEach(function (key) {
  6256. o[handelFormat(key, type, options)] = formatObjKey(obj[key], type, options);
  6257. });
  6258. }
  6259. return o;
  6260. }
  6261. exports.formatObjKey = formatObjKey;
  6262. function handelFormat(key, type, options) {
  6263. if (options && options.exclude && options.exclude.includes(key)) return key;
  6264. if (type === 'firstUpperCase') {
  6265. key = key.replace(/^./, function (_) {
  6266. return _.toUpperCase();
  6267. });
  6268. } else if (type === 'firstLowerCase') {
  6269. key = key.replace(/^./, function (_) {
  6270. return _.toLowerCase();
  6271. });
  6272. }
  6273. return key;
  6274. }
  6275. },{"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/helpers/typeof":79,"core-js/modules/es.array.includes.js":277,"core-js/modules/es.object.keys.js":290,"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.regexp.exec.js":300,"core-js/modules/es.string.includes.js":302,"core-js/modules/es.string.replace.js":305,"core-js/modules/web.dom-collections.for-each.js":339}],62:[function(require,module,exports){
  6276. "use strict";
  6277. require("core-js/modules/es.regexp.exec.js");
  6278. Object.defineProperty(exports, "__esModule", {
  6279. value: true
  6280. });
  6281. exports.getStrBytesCount = void 0;
  6282. function getStrBytesCount(str) {
  6283. var bytesCount = 0;
  6284. for (var i = 0; i < str.length; i++) {
  6285. var c = str.charAt(i);
  6286. if (/^[\u00-\uff]$/.test(c)) {
  6287. bytesCount += 1;
  6288. } else {
  6289. bytesCount += 2;
  6290. }
  6291. }
  6292. return bytesCount;
  6293. }
  6294. exports.getStrBytesCount = getStrBytesCount;
  6295. },{"core-js/modules/es.regexp.exec.js":300}],63:[function(require,module,exports){
  6296. "use strict";
  6297. require("core-js/modules/es.object.to-string.js");
  6298. Object.defineProperty(exports, "__esModule", {
  6299. value: true
  6300. });
  6301. exports.isArray = void 0;
  6302. exports.isArray = function (obj) {
  6303. return Object.prototype.toString.call(obj) === '[object Array]';
  6304. };
  6305. },{"core-js/modules/es.object.to-string.js":291}],64:[function(require,module,exports){
  6306. "use strict";
  6307. Object.defineProperty(exports, "__esModule", {
  6308. value: true
  6309. });
  6310. exports.isBlob = void 0;
  6311. function isBlob(blob) {
  6312. return typeof Blob !== 'undefined' && blob instanceof Blob;
  6313. }
  6314. exports.isBlob = isBlob;
  6315. },{}],65:[function(require,module,exports){
  6316. (function (Buffer){(function (){
  6317. "use strict";
  6318. Object.defineProperty(exports, "__esModule", {
  6319. value: true
  6320. });
  6321. exports.isBuffer = void 0;
  6322. function isBuffer(obj) {
  6323. return Buffer.isBuffer(obj);
  6324. }
  6325. exports.isBuffer = isBuffer;
  6326. }).call(this)}).call(this,{"isBuffer":require("../../../node_modules/is-buffer/index.js")})
  6327. },{"../../../node_modules/is-buffer/index.js":366}],66:[function(require,module,exports){
  6328. (function (process){(function (){
  6329. "use strict";
  6330. require("core-js/modules/es.array.includes.js");
  6331. require("core-js/modules/es.string.includes.js");
  6332. Object.defineProperty(exports, "__esModule", {
  6333. value: true
  6334. });
  6335. exports.isDingTalk = void 0;
  6336. function isDingTalk() {
  6337. if (process.browser && window.navigator.userAgent.toLowerCase().includes('aliapp(dingtalk')) {
  6338. return true;
  6339. }
  6340. return false;
  6341. }
  6342. exports.isDingTalk = isDingTalk;
  6343. }).call(this)}).call(this,require('_process'))
  6344. },{"_process":467,"core-js/modules/es.array.includes.js":277,"core-js/modules/es.string.includes.js":302}],67:[function(require,module,exports){
  6345. "use strict";
  6346. Object.defineProperty(exports, "__esModule", {
  6347. value: true
  6348. });
  6349. exports.isFile = void 0;
  6350. exports.isFile = function (obj) {
  6351. return typeof File !== 'undefined' && obj instanceof File;
  6352. };
  6353. },{}],68:[function(require,module,exports){
  6354. "use strict";
  6355. Object.defineProperty(exports, "__esModule", {
  6356. value: true
  6357. });
  6358. exports.isFunction = void 0;
  6359. exports.isFunction = function (v) {
  6360. return typeof v === 'function';
  6361. };
  6362. },{}],69:[function(require,module,exports){
  6363. "use strict";
  6364. require("core-js/modules/es.regexp.exec.js");
  6365. Object.defineProperty(exports, "__esModule", {
  6366. value: true
  6367. });
  6368. exports.isIP = void 0; // it provide commont methods for node and browser , we will add more solutions later in this file
  6369. /**
  6370. * Judge isIP include ipv4 or ipv6
  6371. * @param {String} options
  6372. * @return {Array} the multipart uploads
  6373. */
  6374. exports.isIP = function (host) {
  6375. var ipv4Regex = /^(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}$/;
  6376. var ipv6Regex = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/;
  6377. return ipv4Regex.test(host) || ipv6Regex.test(host);
  6378. };
  6379. },{"core-js/modules/es.regexp.exec.js":300}],70:[function(require,module,exports){
  6380. "use strict";
  6381. require("core-js/modules/es.object.to-string.js");
  6382. Object.defineProperty(exports, "__esModule", {
  6383. value: true
  6384. });
  6385. exports.isObject = void 0;
  6386. exports.isObject = function (obj) {
  6387. return Object.prototype.toString.call(obj) === '[object Object]';
  6388. };
  6389. },{"core-js/modules/es.object.to-string.js":291}],71:[function(require,module,exports){
  6390. "use strict";
  6391. require("core-js/modules/es.object.to-string.js");
  6392. require("core-js/modules/web.dom-collections.for-each.js");
  6393. require("core-js/modules/es.object.keys.js");
  6394. Object.defineProperty(exports, "__esModule", {
  6395. value: true
  6396. });
  6397. exports.lowercaseKeyHeader = void 0;
  6398. var isObject_1 = require("./isObject");
  6399. function lowercaseKeyHeader(headers) {
  6400. var lowercaseHeader = {};
  6401. if (isObject_1.isObject(headers)) {
  6402. Object.keys(headers).forEach(function (key) {
  6403. lowercaseHeader[key.toLowerCase()] = headers[key];
  6404. });
  6405. }
  6406. return lowercaseHeader;
  6407. }
  6408. exports.lowercaseKeyHeader = lowercaseKeyHeader;
  6409. },{"./isObject":70,"core-js/modules/es.object.keys.js":290,"core-js/modules/es.object.to-string.js":291,"core-js/modules/web.dom-collections.for-each.js":339}],72:[function(require,module,exports){
  6410. "use strict";
  6411. require("core-js/modules/es.regexp.exec.js");
  6412. require("core-js/modules/es.string.replace.js");
  6413. require("core-js/modules/es.object.to-string.js");
  6414. require("core-js/modules/web.dom-collections.for-each.js");
  6415. require("core-js/modules/es.object.keys.js");
  6416. require("core-js/modules/es.array.concat.js");
  6417. require("core-js/modules/es.array.join.js");
  6418. require("core-js/modules/es.array.map.js");
  6419. require("core-js/modules/es.regexp.to-string.js");
  6420. Object.defineProperty(exports, "__esModule", {
  6421. value: true
  6422. });
  6423. exports.obj2xml = void 0;
  6424. var formatObjKey_1 = require("./formatObjKey");
  6425. function type(params) {
  6426. return Object.prototype.toString.call(params).replace(/(.*? |])/g, '').toLowerCase();
  6427. }
  6428. function obj2xml(obj, options) {
  6429. var s = '';
  6430. if (options && options.headers) {
  6431. s = '<?xml version="1.0" encoding="UTF-8"?>\n';
  6432. }
  6433. if (options && options.firstUpperCase) {
  6434. obj = formatObjKey_1.formatObjKey(obj, 'firstUpperCase');
  6435. }
  6436. if (type(obj) === 'object') {
  6437. Object.keys(obj).forEach(function (key) {
  6438. // filter undefined or null
  6439. if (type(obj[key]) !== 'undefined' && type(obj[key]) !== 'null') {
  6440. if (type(obj[key]) === 'string' || type(obj[key]) === 'number') {
  6441. s += "<".concat(key, ">").concat(obj[key], "</").concat(key, ">");
  6442. } else if (type(obj[key]) === 'object') {
  6443. s += "<".concat(key, ">").concat(obj2xml(obj[key]), "</").concat(key, ">");
  6444. } else if (type(obj[key]) === 'array') {
  6445. s += obj[key].map(function (keyChild) {
  6446. return "<".concat(key, ">").concat(obj2xml(keyChild), "</").concat(key, ">");
  6447. }).join('');
  6448. } else {
  6449. s += "<".concat(key, ">").concat(obj[key].toString(), "</").concat(key, ">");
  6450. }
  6451. }
  6452. });
  6453. } else {
  6454. s += obj.toString();
  6455. }
  6456. return s;
  6457. }
  6458. exports.obj2xml = obj2xml;
  6459. },{"./formatObjKey":61,"core-js/modules/es.array.concat.js":272,"core-js/modules/es.array.join.js":279,"core-js/modules/es.array.map.js":280,"core-js/modules/es.object.keys.js":290,"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.regexp.exec.js":300,"core-js/modules/es.regexp.to-string.js":301,"core-js/modules/es.string.replace.js":305,"core-js/modules/web.dom-collections.for-each.js":339}],73:[function(require,module,exports){
  6460. "use strict";
  6461. require("core-js/modules/es.array.slice.js");
  6462. require("core-js/modules/es.object.to-string.js");
  6463. require("core-js/modules/es.function.name.js");
  6464. require("core-js/modules/es.array.from.js");
  6465. require("core-js/modules/es.string.iterator.js");
  6466. require("core-js/modules/es.regexp.exec.js");
  6467. require("core-js/modules/es.symbol.js");
  6468. require("core-js/modules/es.symbol.description.js");
  6469. require("core-js/modules/es.symbol.iterator.js");
  6470. require("core-js/modules/es.array.iterator.js");
  6471. require("core-js/modules/web.dom-collections.iterator.js");
  6472. require("core-js/modules/es.object.assign.js");
  6473. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
  6474. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  6475. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  6476. Object.defineProperty(exports, "__esModule", {
  6477. value: true
  6478. });
  6479. exports.omit = void 0;
  6480. function omit(originalObject, keysToOmit) {
  6481. var cloneObject = Object.assign({}, originalObject);
  6482. var _iterator = _createForOfIteratorHelper(keysToOmit),
  6483. _step;
  6484. try {
  6485. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  6486. var path = _step.value;
  6487. delete cloneObject[path];
  6488. }
  6489. } catch (err) {
  6490. _iterator.e(err);
  6491. } finally {
  6492. _iterator.f();
  6493. }
  6494. return cloneObject;
  6495. }
  6496. exports.omit = omit;
  6497. },{"core-js/modules/es.array.from.js":276,"core-js/modules/es.array.iterator.js":278,"core-js/modules/es.array.slice.js":281,"core-js/modules/es.function.name.js":284,"core-js/modules/es.object.assign.js":287,"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.regexp.exec.js":300,"core-js/modules/es.string.iterator.js":303,"core-js/modules/es.symbol.description.js":310,"core-js/modules/es.symbol.iterator.js":312,"core-js/modules/es.symbol.js":313,"core-js/modules/web.dom-collections.iterator.js":340}],74:[function(require,module,exports){
  6498. "use strict";
  6499. require("core-js/modules/es.object.to-string.js");
  6500. require("core-js/modules/es.promise.js");
  6501. Object.defineProperty(exports, "__esModule", {
  6502. value: true
  6503. });
  6504. exports.retry = void 0;
  6505. function retry(func, retryMax) {
  6506. var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  6507. var retryNum = 0;
  6508. var _config$retryDelay = config.retryDelay,
  6509. retryDelay = _config$retryDelay === void 0 ? 500 : _config$retryDelay,
  6510. _config$errorHandler = config.errorHandler,
  6511. errorHandler = _config$errorHandler === void 0 ? function () {
  6512. return true;
  6513. } : _config$errorHandler;
  6514. var funcR = function funcR() {
  6515. for (var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++) {
  6516. arg[_key] = arguments[_key];
  6517. }
  6518. return new Promise(function (resolve, reject) {
  6519. func.apply(void 0, arg).then(function (result) {
  6520. retryNum = 0;
  6521. resolve(result);
  6522. }).catch(function (err) {
  6523. if (retryNum < retryMax && errorHandler(err)) {
  6524. retryNum++;
  6525. setTimeout(function () {
  6526. resolve(funcR.apply(void 0, arg));
  6527. }, retryDelay);
  6528. } else {
  6529. retryNum = 0;
  6530. reject(err);
  6531. }
  6532. });
  6533. });
  6534. };
  6535. return funcR;
  6536. }
  6537. exports.retry = retry;
  6538. },{"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.promise.js":295}],75:[function(require,module,exports){
  6539. "use strict";
  6540. var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
  6541. return mod && mod.__esModule ? mod : {
  6542. "default": mod
  6543. };
  6544. };
  6545. Object.defineProperty(exports, "__esModule", {
  6546. value: true
  6547. });
  6548. exports.setRegion = void 0;
  6549. var url_1 = __importDefault(require("url"));
  6550. var checkConfigValid_1 = require("./checkConfigValid");
  6551. function setRegion(region) {
  6552. var internal = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  6553. var secure = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  6554. checkConfigValid_1.checkConfigValid(region, 'region');
  6555. var protocol = secure ? 'https://' : 'http://';
  6556. var suffix = internal ? '-internal.aliyuncs.com' : '.aliyuncs.com';
  6557. var prefix = 'vpc100-oss-cn-'; // aliyun VPC region: https://help.aliyun.com/knowledge_detail/38740.html
  6558. if (region.substr(0, prefix.length) === prefix) {
  6559. suffix = '.aliyuncs.com';
  6560. }
  6561. return url_1.default.parse(protocol + region + suffix);
  6562. }
  6563. exports.setRegion = setRegion;
  6564. },{"./checkConfigValid":52,"url":472}],76:[function(require,module,exports){
  6565. "use strict";
  6566. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  6567. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  6568. require("core-js/modules/es.object.keys.js");
  6569. require("core-js/modules/es.object.to-string.js");
  6570. require("core-js/modules/es.array.find.js");
  6571. require("core-js/modules/es.object.assign.js");
  6572. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  6573. Object.defineProperty(exports, "__esModule", {
  6574. value: true
  6575. });
  6576. exports.checkCredentials = exports.setSTSToken = void 0;
  6577. var formatObjKey_1 = require("./formatObjKey");
  6578. function setSTSToken() {
  6579. return _setSTSToken.apply(this, arguments);
  6580. }
  6581. function _setSTSToken() {
  6582. _setSTSToken = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
  6583. var now, credentials;
  6584. return _regenerator.default.wrap(function _callee$(_context) {
  6585. while (1) {
  6586. switch (_context.prev = _context.next) {
  6587. case 0:
  6588. if (!this.options) this.options = {};
  6589. now = new Date();
  6590. if (!this.stsTokenFreshTime) {
  6591. _context.next = 14;
  6592. break;
  6593. }
  6594. if (!(+now - this.stsTokenFreshTime >= this.options.refreshSTSTokenInterval)) {
  6595. _context.next = 12;
  6596. break;
  6597. }
  6598. this.stsTokenFreshTime = now;
  6599. _context.next = 7;
  6600. return this.options.refreshSTSToken();
  6601. case 7:
  6602. credentials = _context.sent;
  6603. credentials = formatObjKey_1.formatObjKey(credentials, 'firstLowerCase');
  6604. if (credentials.securityToken) {
  6605. credentials.stsToken = credentials.securityToken;
  6606. }
  6607. checkCredentials(credentials);
  6608. Object.assign(this.options, credentials);
  6609. case 12:
  6610. _context.next = 15;
  6611. break;
  6612. case 14:
  6613. this.stsTokenFreshTime = now;
  6614. case 15:
  6615. return _context.abrupt("return", null);
  6616. case 16:
  6617. case "end":
  6618. return _context.stop();
  6619. }
  6620. }
  6621. }, _callee, this);
  6622. }));
  6623. return _setSTSToken.apply(this, arguments);
  6624. }
  6625. exports.setSTSToken = setSTSToken;
  6626. function checkCredentials(obj) {
  6627. var stsTokenKey = ['accessKeySecret', 'accessKeyId', 'stsToken'];
  6628. var objKeys = Object.keys(obj);
  6629. stsTokenKey.forEach(function (_) {
  6630. if (!objKeys.find(function (key) {
  6631. return key === _;
  6632. })) {
  6633. throw Error("refreshSTSToken must return contains ".concat(_));
  6634. }
  6635. });
  6636. }
  6637. exports.checkCredentials = checkCredentials;
  6638. },{"./formatObjKey":61,"@babel/runtime/helpers/asyncToGenerator":77,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/regenerator":80,"core-js/modules/es.array.find.js":275,"core-js/modules/es.object.assign.js":287,"core-js/modules/es.object.keys.js":290,"core-js/modules/es.object.to-string.js":291}],77:[function(require,module,exports){
  6639. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  6640. try {
  6641. var info = gen[key](arg);
  6642. var value = info.value;
  6643. } catch (error) {
  6644. reject(error);
  6645. return;
  6646. }
  6647. if (info.done) {
  6648. resolve(value);
  6649. } else {
  6650. Promise.resolve(value).then(_next, _throw);
  6651. }
  6652. }
  6653. function _asyncToGenerator(fn) {
  6654. return function () {
  6655. var self = this,
  6656. args = arguments;
  6657. return new Promise(function (resolve, reject) {
  6658. var gen = fn.apply(self, args);
  6659. function _next(value) {
  6660. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
  6661. }
  6662. function _throw(err) {
  6663. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
  6664. }
  6665. _next(undefined);
  6666. });
  6667. };
  6668. }
  6669. module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
  6670. },{}],78:[function(require,module,exports){
  6671. function _interopRequireDefault(obj) {
  6672. return obj && obj.__esModule ? obj : {
  6673. "default": obj
  6674. };
  6675. }
  6676. module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
  6677. },{}],79:[function(require,module,exports){
  6678. function _typeof(obj) {
  6679. "@babel/helpers - typeof";
  6680. return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
  6681. return typeof obj;
  6682. } : function (obj) {
  6683. return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  6684. }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
  6685. }
  6686. module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
  6687. },{}],80:[function(require,module,exports){
  6688. module.exports = require("regenerator-runtime");
  6689. },{"regenerator-runtime":395}],81:[function(require,module,exports){
  6690. module.exports = noop;
  6691. module.exports.HttpsAgent = noop;
  6692. // Noop function for browser since native api's don't use agents.
  6693. function noop () {}
  6694. },{}],82:[function(require,module,exports){
  6695. (function (global){(function (){
  6696. 'use strict';
  6697. var objectAssign = require('object-assign');
  6698. // compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
  6699. // original notice:
  6700. /*!
  6701. * The buffer module from node.js, for the browser.
  6702. *
  6703. * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  6704. * @license MIT
  6705. */
  6706. function compare(a, b) {
  6707. if (a === b) {
  6708. return 0;
  6709. }
  6710. var x = a.length;
  6711. var y = b.length;
  6712. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6713. if (a[i] !== b[i]) {
  6714. x = a[i];
  6715. y = b[i];
  6716. break;
  6717. }
  6718. }
  6719. if (x < y) {
  6720. return -1;
  6721. }
  6722. if (y < x) {
  6723. return 1;
  6724. }
  6725. return 0;
  6726. }
  6727. function isBuffer(b) {
  6728. if (global.Buffer && typeof global.Buffer.isBuffer === 'function') {
  6729. return global.Buffer.isBuffer(b);
  6730. }
  6731. return !!(b != null && b._isBuffer);
  6732. }
  6733. // based on node assert, original notice:
  6734. // NB: The URL to the CommonJS spec is kept just for tradition.
  6735. // node-assert has evolved a lot since then, both in API and behavior.
  6736. // http://wiki.commonjs.org/wiki/Unit_Testing/1.0
  6737. //
  6738. // THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
  6739. //
  6740. // Originally from narwhal.js (http://narwhaljs.org)
  6741. // Copyright (c) 2009 Thomas Robinson <280north.com>
  6742. //
  6743. // Permission is hereby granted, free of charge, to any person obtaining a copy
  6744. // of this software and associated documentation files (the 'Software'), to
  6745. // deal in the Software without restriction, including without limitation the
  6746. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  6747. // sell copies of the Software, and to permit persons to whom the Software is
  6748. // furnished to do so, subject to the following conditions:
  6749. //
  6750. // The above copyright notice and this permission notice shall be included in
  6751. // all copies or substantial portions of the Software.
  6752. //
  6753. // THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6754. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6755. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6756. // AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  6757. // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  6758. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  6759. var util = require('util/');
  6760. var hasOwn = Object.prototype.hasOwnProperty;
  6761. var pSlice = Array.prototype.slice;
  6762. var functionsHaveNames = (function () {
  6763. return function foo() {}.name === 'foo';
  6764. }());
  6765. function pToString (obj) {
  6766. return Object.prototype.toString.call(obj);
  6767. }
  6768. function isView(arrbuf) {
  6769. if (isBuffer(arrbuf)) {
  6770. return false;
  6771. }
  6772. if (typeof global.ArrayBuffer !== 'function') {
  6773. return false;
  6774. }
  6775. if (typeof ArrayBuffer.isView === 'function') {
  6776. return ArrayBuffer.isView(arrbuf);
  6777. }
  6778. if (!arrbuf) {
  6779. return false;
  6780. }
  6781. if (arrbuf instanceof DataView) {
  6782. return true;
  6783. }
  6784. if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {
  6785. return true;
  6786. }
  6787. return false;
  6788. }
  6789. // 1. The assert module provides functions that throw
  6790. // AssertionError's when particular conditions are not met. The
  6791. // assert module must conform to the following interface.
  6792. var assert = module.exports = ok;
  6793. // 2. The AssertionError is defined in assert.
  6794. // new assert.AssertionError({ message: message,
  6795. // actual: actual,
  6796. // expected: expected })
  6797. var regex = /\s*function\s+([^\(\s]*)\s*/;
  6798. // based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
  6799. function getName(func) {
  6800. if (!util.isFunction(func)) {
  6801. return;
  6802. }
  6803. if (functionsHaveNames) {
  6804. return func.name;
  6805. }
  6806. var str = func.toString();
  6807. var match = str.match(regex);
  6808. return match && match[1];
  6809. }
  6810. assert.AssertionError = function AssertionError(options) {
  6811. this.name = 'AssertionError';
  6812. this.actual = options.actual;
  6813. this.expected = options.expected;
  6814. this.operator = options.operator;
  6815. if (options.message) {
  6816. this.message = options.message;
  6817. this.generatedMessage = false;
  6818. } else {
  6819. this.message = getMessage(this);
  6820. this.generatedMessage = true;
  6821. }
  6822. var stackStartFunction = options.stackStartFunction || fail;
  6823. if (Error.captureStackTrace) {
  6824. Error.captureStackTrace(this, stackStartFunction);
  6825. } else {
  6826. // non v8 browsers so we can have a stacktrace
  6827. var err = new Error();
  6828. if (err.stack) {
  6829. var out = err.stack;
  6830. // try to strip useless frames
  6831. var fn_name = getName(stackStartFunction);
  6832. var idx = out.indexOf('\n' + fn_name);
  6833. if (idx >= 0) {
  6834. // once we have located the function frame
  6835. // we need to strip out everything before it (and its line)
  6836. var next_line = out.indexOf('\n', idx + 1);
  6837. out = out.substring(next_line + 1);
  6838. }
  6839. this.stack = out;
  6840. }
  6841. }
  6842. };
  6843. // assert.AssertionError instanceof Error
  6844. util.inherits(assert.AssertionError, Error);
  6845. function truncate(s, n) {
  6846. if (typeof s === 'string') {
  6847. return s.length < n ? s : s.slice(0, n);
  6848. } else {
  6849. return s;
  6850. }
  6851. }
  6852. function inspect(something) {
  6853. if (functionsHaveNames || !util.isFunction(something)) {
  6854. return util.inspect(something);
  6855. }
  6856. var rawname = getName(something);
  6857. var name = rawname ? ': ' + rawname : '';
  6858. return '[Function' + name + ']';
  6859. }
  6860. function getMessage(self) {
  6861. return truncate(inspect(self.actual), 128) + ' ' +
  6862. self.operator + ' ' +
  6863. truncate(inspect(self.expected), 128);
  6864. }
  6865. // At present only the three keys mentioned above are used and
  6866. // understood by the spec. Implementations or sub modules can pass
  6867. // other keys to the AssertionError's constructor - they will be
  6868. // ignored.
  6869. // 3. All of the following functions must throw an AssertionError
  6870. // when a corresponding condition is not met, with a message that
  6871. // may be undefined if not provided. All assertion methods provide
  6872. // both the actual and expected values to the assertion error for
  6873. // display purposes.
  6874. function fail(actual, expected, message, operator, stackStartFunction) {
  6875. throw new assert.AssertionError({
  6876. message: message,
  6877. actual: actual,
  6878. expected: expected,
  6879. operator: operator,
  6880. stackStartFunction: stackStartFunction
  6881. });
  6882. }
  6883. // EXTENSION! allows for well behaved errors defined elsewhere.
  6884. assert.fail = fail;
  6885. // 4. Pure assertion tests whether a value is truthy, as determined
  6886. // by !!guard.
  6887. // assert.ok(guard, message_opt);
  6888. // This statement is equivalent to assert.equal(true, !!guard,
  6889. // message_opt);. To test strictly for the value true, use
  6890. // assert.strictEqual(true, guard, message_opt);.
  6891. function ok(value, message) {
  6892. if (!value) fail(value, true, message, '==', assert.ok);
  6893. }
  6894. assert.ok = ok;
  6895. // 5. The equality assertion tests shallow, coercive equality with
  6896. // ==.
  6897. // assert.equal(actual, expected, message_opt);
  6898. assert.equal = function equal(actual, expected, message) {
  6899. if (actual != expected) fail(actual, expected, message, '==', assert.equal);
  6900. };
  6901. // 6. The non-equality assertion tests for whether two objects are not equal
  6902. // with != assert.notEqual(actual, expected, message_opt);
  6903. assert.notEqual = function notEqual(actual, expected, message) {
  6904. if (actual == expected) {
  6905. fail(actual, expected, message, '!=', assert.notEqual);
  6906. }
  6907. };
  6908. // 7. The equivalence assertion tests a deep equality relation.
  6909. // assert.deepEqual(actual, expected, message_opt);
  6910. assert.deepEqual = function deepEqual(actual, expected, message) {
  6911. if (!_deepEqual(actual, expected, false)) {
  6912. fail(actual, expected, message, 'deepEqual', assert.deepEqual);
  6913. }
  6914. };
  6915. assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
  6916. if (!_deepEqual(actual, expected, true)) {
  6917. fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual);
  6918. }
  6919. };
  6920. function _deepEqual(actual, expected, strict, memos) {
  6921. // 7.1. All identical values are equivalent, as determined by ===.
  6922. if (actual === expected) {
  6923. return true;
  6924. } else if (isBuffer(actual) && isBuffer(expected)) {
  6925. return compare(actual, expected) === 0;
  6926. // 7.2. If the expected value is a Date object, the actual value is
  6927. // equivalent if it is also a Date object that refers to the same time.
  6928. } else if (util.isDate(actual) && util.isDate(expected)) {
  6929. return actual.getTime() === expected.getTime();
  6930. // 7.3 If the expected value is a RegExp object, the actual value is
  6931. // equivalent if it is also a RegExp object with the same source and
  6932. // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
  6933. } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
  6934. return actual.source === expected.source &&
  6935. actual.global === expected.global &&
  6936. actual.multiline === expected.multiline &&
  6937. actual.lastIndex === expected.lastIndex &&
  6938. actual.ignoreCase === expected.ignoreCase;
  6939. // 7.4. Other pairs that do not both pass typeof value == 'object',
  6940. // equivalence is determined by ==.
  6941. } else if ((actual === null || typeof actual !== 'object') &&
  6942. (expected === null || typeof expected !== 'object')) {
  6943. return strict ? actual === expected : actual == expected;
  6944. // If both values are instances of typed arrays, wrap their underlying
  6945. // ArrayBuffers in a Buffer each to increase performance
  6946. // This optimization requires the arrays to have the same type as checked by
  6947. // Object.prototype.toString (aka pToString). Never perform binary
  6948. // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their
  6949. // bit patterns are not identical.
  6950. } else if (isView(actual) && isView(expected) &&
  6951. pToString(actual) === pToString(expected) &&
  6952. !(actual instanceof Float32Array ||
  6953. actual instanceof Float64Array)) {
  6954. return compare(new Uint8Array(actual.buffer),
  6955. new Uint8Array(expected.buffer)) === 0;
  6956. // 7.5 For all other Object pairs, including Array objects, equivalence is
  6957. // determined by having the same number of owned properties (as verified
  6958. // with Object.prototype.hasOwnProperty.call), the same set of keys
  6959. // (although not necessarily the same order), equivalent values for every
  6960. // corresponding key, and an identical 'prototype' property. Note: this
  6961. // accounts for both named and indexed properties on Arrays.
  6962. } else if (isBuffer(actual) !== isBuffer(expected)) {
  6963. return false;
  6964. } else {
  6965. memos = memos || {actual: [], expected: []};
  6966. var actualIndex = memos.actual.indexOf(actual);
  6967. if (actualIndex !== -1) {
  6968. if (actualIndex === memos.expected.indexOf(expected)) {
  6969. return true;
  6970. }
  6971. }
  6972. memos.actual.push(actual);
  6973. memos.expected.push(expected);
  6974. return objEquiv(actual, expected, strict, memos);
  6975. }
  6976. }
  6977. function isArguments(object) {
  6978. return Object.prototype.toString.call(object) == '[object Arguments]';
  6979. }
  6980. function objEquiv(a, b, strict, actualVisitedObjects) {
  6981. if (a === null || a === undefined || b === null || b === undefined)
  6982. return false;
  6983. // if one is a primitive, the other must be same
  6984. if (util.isPrimitive(a) || util.isPrimitive(b))
  6985. return a === b;
  6986. if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
  6987. return false;
  6988. var aIsArgs = isArguments(a);
  6989. var bIsArgs = isArguments(b);
  6990. if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
  6991. return false;
  6992. if (aIsArgs) {
  6993. a = pSlice.call(a);
  6994. b = pSlice.call(b);
  6995. return _deepEqual(a, b, strict);
  6996. }
  6997. var ka = objectKeys(a);
  6998. var kb = objectKeys(b);
  6999. var key, i;
  7000. // having the same number of owned properties (keys incorporates
  7001. // hasOwnProperty)
  7002. if (ka.length !== kb.length)
  7003. return false;
  7004. //the same set of keys (although not necessarily the same order),
  7005. ka.sort();
  7006. kb.sort();
  7007. //~~~cheap key test
  7008. for (i = ka.length - 1; i >= 0; i--) {
  7009. if (ka[i] !== kb[i])
  7010. return false;
  7011. }
  7012. //equivalent values for every corresponding key, and
  7013. //~~~possibly expensive deep test
  7014. for (i = ka.length - 1; i >= 0; i--) {
  7015. key = ka[i];
  7016. if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))
  7017. return false;
  7018. }
  7019. return true;
  7020. }
  7021. // 8. The non-equivalence assertion tests for any deep inequality.
  7022. // assert.notDeepEqual(actual, expected, message_opt);
  7023. assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
  7024. if (_deepEqual(actual, expected, false)) {
  7025. fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
  7026. }
  7027. };
  7028. assert.notDeepStrictEqual = notDeepStrictEqual;
  7029. function notDeepStrictEqual(actual, expected, message) {
  7030. if (_deepEqual(actual, expected, true)) {
  7031. fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);
  7032. }
  7033. }
  7034. // 9. The strict equality assertion tests strict equality, as determined by ===.
  7035. // assert.strictEqual(actual, expected, message_opt);
  7036. assert.strictEqual = function strictEqual(actual, expected, message) {
  7037. if (actual !== expected) {
  7038. fail(actual, expected, message, '===', assert.strictEqual);
  7039. }
  7040. };
  7041. // 10. The strict non-equality assertion tests for strict inequality, as
  7042. // determined by !==. assert.notStrictEqual(actual, expected, message_opt);
  7043. assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
  7044. if (actual === expected) {
  7045. fail(actual, expected, message, '!==', assert.notStrictEqual);
  7046. }
  7047. };
  7048. function expectedException(actual, expected) {
  7049. if (!actual || !expected) {
  7050. return false;
  7051. }
  7052. if (Object.prototype.toString.call(expected) == '[object RegExp]') {
  7053. return expected.test(actual);
  7054. }
  7055. try {
  7056. if (actual instanceof expected) {
  7057. return true;
  7058. }
  7059. } catch (e) {
  7060. // Ignore. The instanceof check doesn't work for arrow functions.
  7061. }
  7062. if (Error.isPrototypeOf(expected)) {
  7063. return false;
  7064. }
  7065. return expected.call({}, actual) === true;
  7066. }
  7067. function _tryBlock(block) {
  7068. var error;
  7069. try {
  7070. block();
  7071. } catch (e) {
  7072. error = e;
  7073. }
  7074. return error;
  7075. }
  7076. function _throws(shouldThrow, block, expected, message) {
  7077. var actual;
  7078. if (typeof block !== 'function') {
  7079. throw new TypeError('"block" argument must be a function');
  7080. }
  7081. if (typeof expected === 'string') {
  7082. message = expected;
  7083. expected = null;
  7084. }
  7085. actual = _tryBlock(block);
  7086. message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
  7087. (message ? ' ' + message : '.');
  7088. if (shouldThrow && !actual) {
  7089. fail(actual, expected, 'Missing expected exception' + message);
  7090. }
  7091. var userProvidedMessage = typeof message === 'string';
  7092. var isUnwantedException = !shouldThrow && util.isError(actual);
  7093. var isUnexpectedException = !shouldThrow && actual && !expected;
  7094. if ((isUnwantedException &&
  7095. userProvidedMessage &&
  7096. expectedException(actual, expected)) ||
  7097. isUnexpectedException) {
  7098. fail(actual, expected, 'Got unwanted exception' + message);
  7099. }
  7100. if ((shouldThrow && actual && expected &&
  7101. !expectedException(actual, expected)) || (!shouldThrow && actual)) {
  7102. throw actual;
  7103. }
  7104. }
  7105. // 11. Expected to throw an error:
  7106. // assert.throws(block, Error_opt, message_opt);
  7107. assert.throws = function(block, /*optional*/error, /*optional*/message) {
  7108. _throws(true, block, error, message);
  7109. };
  7110. // EXTENSION! This is annoying to write outside this module.
  7111. assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
  7112. _throws(false, block, error, message);
  7113. };
  7114. assert.ifError = function(err) { if (err) throw err; };
  7115. // Expose a strict only variant of assert
  7116. function strict(value, message) {
  7117. if (!value) fail(value, true, message, '==', strict);
  7118. }
  7119. assert.strict = objectAssign(strict, assert, {
  7120. equal: assert.strictEqual,
  7121. deepEqual: assert.deepStrictEqual,
  7122. notEqual: assert.notStrictEqual,
  7123. notDeepEqual: assert.notDeepStrictEqual
  7124. });
  7125. assert.strict.strict = assert.strict;
  7126. var objectKeys = Object.keys || function (obj) {
  7127. var keys = [];
  7128. for (var key in obj) {
  7129. if (hasOwn.call(obj, key)) keys.push(key);
  7130. }
  7131. return keys;
  7132. };
  7133. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  7134. },{"object-assign":377,"util/":85}],83:[function(require,module,exports){
  7135. if (typeof Object.create === 'function') {
  7136. // implementation from standard node.js 'util' module
  7137. module.exports = function inherits(ctor, superCtor) {
  7138. ctor.super_ = superCtor
  7139. ctor.prototype = Object.create(superCtor.prototype, {
  7140. constructor: {
  7141. value: ctor,
  7142. enumerable: false,
  7143. writable: true,
  7144. configurable: true
  7145. }
  7146. });
  7147. };
  7148. } else {
  7149. // old school shim for old browsers
  7150. module.exports = function inherits(ctor, superCtor) {
  7151. ctor.super_ = superCtor
  7152. var TempCtor = function () {}
  7153. TempCtor.prototype = superCtor.prototype
  7154. ctor.prototype = new TempCtor()
  7155. ctor.prototype.constructor = ctor
  7156. }
  7157. }
  7158. },{}],84:[function(require,module,exports){
  7159. module.exports = function isBuffer(arg) {
  7160. return arg && typeof arg === 'object'
  7161. && typeof arg.copy === 'function'
  7162. && typeof arg.fill === 'function'
  7163. && typeof arg.readUInt8 === 'function';
  7164. }
  7165. },{}],85:[function(require,module,exports){
  7166. (function (process,global){(function (){
  7167. // Copyright Joyent, Inc. and other Node contributors.
  7168. //
  7169. // Permission is hereby granted, free of charge, to any person obtaining a
  7170. // copy of this software and associated documentation files (the
  7171. // "Software"), to deal in the Software without restriction, including
  7172. // without limitation the rights to use, copy, modify, merge, publish,
  7173. // distribute, sublicense, and/or sell copies of the Software, and to permit
  7174. // persons to whom the Software is furnished to do so, subject to the
  7175. // following conditions:
  7176. //
  7177. // The above copyright notice and this permission notice shall be included
  7178. // in all copies or substantial portions of the Software.
  7179. //
  7180. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  7181. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  7182. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  7183. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  7184. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  7185. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  7186. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  7187. var formatRegExp = /%[sdj%]/g;
  7188. exports.format = function(f) {
  7189. if (!isString(f)) {
  7190. var objects = [];
  7191. for (var i = 0; i < arguments.length; i++) {
  7192. objects.push(inspect(arguments[i]));
  7193. }
  7194. return objects.join(' ');
  7195. }
  7196. var i = 1;
  7197. var args = arguments;
  7198. var len = args.length;
  7199. var str = String(f).replace(formatRegExp, function(x) {
  7200. if (x === '%%') return '%';
  7201. if (i >= len) return x;
  7202. switch (x) {
  7203. case '%s': return String(args[i++]);
  7204. case '%d': return Number(args[i++]);
  7205. case '%j':
  7206. try {
  7207. return JSON.stringify(args[i++]);
  7208. } catch (_) {
  7209. return '[Circular]';
  7210. }
  7211. default:
  7212. return x;
  7213. }
  7214. });
  7215. for (var x = args[i]; i < len; x = args[++i]) {
  7216. if (isNull(x) || !isObject(x)) {
  7217. str += ' ' + x;
  7218. } else {
  7219. str += ' ' + inspect(x);
  7220. }
  7221. }
  7222. return str;
  7223. };
  7224. // Mark that a method should not be used.
  7225. // Returns a modified function which warns once by default.
  7226. // If --no-deprecation is set, then it is a no-op.
  7227. exports.deprecate = function(fn, msg) {
  7228. // Allow for deprecating things in the process of starting up.
  7229. if (isUndefined(global.process)) {
  7230. return function() {
  7231. return exports.deprecate(fn, msg).apply(this, arguments);
  7232. };
  7233. }
  7234. if (process.noDeprecation === true) {
  7235. return fn;
  7236. }
  7237. var warned = false;
  7238. function deprecated() {
  7239. if (!warned) {
  7240. if (process.throwDeprecation) {
  7241. throw new Error(msg);
  7242. } else if (process.traceDeprecation) {
  7243. console.trace(msg);
  7244. } else {
  7245. console.error(msg);
  7246. }
  7247. warned = true;
  7248. }
  7249. return fn.apply(this, arguments);
  7250. }
  7251. return deprecated;
  7252. };
  7253. var debugs = {};
  7254. var debugEnviron;
  7255. exports.debuglog = function(set) {
  7256. if (isUndefined(debugEnviron))
  7257. debugEnviron = process.env.NODE_DEBUG || '';
  7258. set = set.toUpperCase();
  7259. if (!debugs[set]) {
  7260. if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
  7261. var pid = process.pid;
  7262. debugs[set] = function() {
  7263. var msg = exports.format.apply(exports, arguments);
  7264. console.error('%s %d: %s', set, pid, msg);
  7265. };
  7266. } else {
  7267. debugs[set] = function() {};
  7268. }
  7269. }
  7270. return debugs[set];
  7271. };
  7272. /**
  7273. * Echos the value of a value. Trys to print the value out
  7274. * in the best way possible given the different types.
  7275. *
  7276. * @param {Object} obj The object to print out.
  7277. * @param {Object} opts Optional options object that alters the output.
  7278. */
  7279. /* legacy: obj, showHidden, depth, colors*/
  7280. function inspect(obj, opts) {
  7281. // default options
  7282. var ctx = {
  7283. seen: [],
  7284. stylize: stylizeNoColor
  7285. };
  7286. // legacy...
  7287. if (arguments.length >= 3) ctx.depth = arguments[2];
  7288. if (arguments.length >= 4) ctx.colors = arguments[3];
  7289. if (isBoolean(opts)) {
  7290. // legacy...
  7291. ctx.showHidden = opts;
  7292. } else if (opts) {
  7293. // got an "options" object
  7294. exports._extend(ctx, opts);
  7295. }
  7296. // set default options
  7297. if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
  7298. if (isUndefined(ctx.depth)) ctx.depth = 2;
  7299. if (isUndefined(ctx.colors)) ctx.colors = false;
  7300. if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
  7301. if (ctx.colors) ctx.stylize = stylizeWithColor;
  7302. return formatValue(ctx, obj, ctx.depth);
  7303. }
  7304. exports.inspect = inspect;
  7305. // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
  7306. inspect.colors = {
  7307. 'bold' : [1, 22],
  7308. 'italic' : [3, 23],
  7309. 'underline' : [4, 24],
  7310. 'inverse' : [7, 27],
  7311. 'white' : [37, 39],
  7312. 'grey' : [90, 39],
  7313. 'black' : [30, 39],
  7314. 'blue' : [34, 39],
  7315. 'cyan' : [36, 39],
  7316. 'green' : [32, 39],
  7317. 'magenta' : [35, 39],
  7318. 'red' : [31, 39],
  7319. 'yellow' : [33, 39]
  7320. };
  7321. // Don't use 'blue' not visible on cmd.exe
  7322. inspect.styles = {
  7323. 'special': 'cyan',
  7324. 'number': 'yellow',
  7325. 'boolean': 'yellow',
  7326. 'undefined': 'grey',
  7327. 'null': 'bold',
  7328. 'string': 'green',
  7329. 'date': 'magenta',
  7330. // "name": intentionally not styling
  7331. 'regexp': 'red'
  7332. };
  7333. function stylizeWithColor(str, styleType) {
  7334. var style = inspect.styles[styleType];
  7335. if (style) {
  7336. return '\u001b[' + inspect.colors[style][0] + 'm' + str +
  7337. '\u001b[' + inspect.colors[style][1] + 'm';
  7338. } else {
  7339. return str;
  7340. }
  7341. }
  7342. function stylizeNoColor(str, styleType) {
  7343. return str;
  7344. }
  7345. function arrayToHash(array) {
  7346. var hash = {};
  7347. array.forEach(function(val, idx) {
  7348. hash[val] = true;
  7349. });
  7350. return hash;
  7351. }
  7352. function formatValue(ctx, value, recurseTimes) {
  7353. // Provide a hook for user-specified inspect functions.
  7354. // Check that value is an object with an inspect function on it
  7355. if (ctx.customInspect &&
  7356. value &&
  7357. isFunction(value.inspect) &&
  7358. // Filter out the util module, it's inspect function is special
  7359. value.inspect !== exports.inspect &&
  7360. // Also filter out any prototype objects using the circular check.
  7361. !(value.constructor && value.constructor.prototype === value)) {
  7362. var ret = value.inspect(recurseTimes, ctx);
  7363. if (!isString(ret)) {
  7364. ret = formatValue(ctx, ret, recurseTimes);
  7365. }
  7366. return ret;
  7367. }
  7368. // Primitive types cannot have properties
  7369. var primitive = formatPrimitive(ctx, value);
  7370. if (primitive) {
  7371. return primitive;
  7372. }
  7373. // Look up the keys of the object.
  7374. var keys = Object.keys(value);
  7375. var visibleKeys = arrayToHash(keys);
  7376. if (ctx.showHidden) {
  7377. keys = Object.getOwnPropertyNames(value);
  7378. }
  7379. // IE doesn't make error fields non-enumerable
  7380. // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
  7381. if (isError(value)
  7382. && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
  7383. return formatError(value);
  7384. }
  7385. // Some type of object without properties can be shortcutted.
  7386. if (keys.length === 0) {
  7387. if (isFunction(value)) {
  7388. var name = value.name ? ': ' + value.name : '';
  7389. return ctx.stylize('[Function' + name + ']', 'special');
  7390. }
  7391. if (isRegExp(value)) {
  7392. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  7393. }
  7394. if (isDate(value)) {
  7395. return ctx.stylize(Date.prototype.toString.call(value), 'date');
  7396. }
  7397. if (isError(value)) {
  7398. return formatError(value);
  7399. }
  7400. }
  7401. var base = '', array = false, braces = ['{', '}'];
  7402. // Make Array say that they are Array
  7403. if (isArray(value)) {
  7404. array = true;
  7405. braces = ['[', ']'];
  7406. }
  7407. // Make functions say that they are functions
  7408. if (isFunction(value)) {
  7409. var n = value.name ? ': ' + value.name : '';
  7410. base = ' [Function' + n + ']';
  7411. }
  7412. // Make RegExps say that they are RegExps
  7413. if (isRegExp(value)) {
  7414. base = ' ' + RegExp.prototype.toString.call(value);
  7415. }
  7416. // Make dates with properties first say the date
  7417. if (isDate(value)) {
  7418. base = ' ' + Date.prototype.toUTCString.call(value);
  7419. }
  7420. // Make error with message first say the error
  7421. if (isError(value)) {
  7422. base = ' ' + formatError(value);
  7423. }
  7424. if (keys.length === 0 && (!array || value.length == 0)) {
  7425. return braces[0] + base + braces[1];
  7426. }
  7427. if (recurseTimes < 0) {
  7428. if (isRegExp(value)) {
  7429. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  7430. } else {
  7431. return ctx.stylize('[Object]', 'special');
  7432. }
  7433. }
  7434. ctx.seen.push(value);
  7435. var output;
  7436. if (array) {
  7437. output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
  7438. } else {
  7439. output = keys.map(function(key) {
  7440. return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
  7441. });
  7442. }
  7443. ctx.seen.pop();
  7444. return reduceToSingleString(output, base, braces);
  7445. }
  7446. function formatPrimitive(ctx, value) {
  7447. if (isUndefined(value))
  7448. return ctx.stylize('undefined', 'undefined');
  7449. if (isString(value)) {
  7450. var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
  7451. .replace(/'/g, "\\'")
  7452. .replace(/\\"/g, '"') + '\'';
  7453. return ctx.stylize(simple, 'string');
  7454. }
  7455. if (isNumber(value))
  7456. return ctx.stylize('' + value, 'number');
  7457. if (isBoolean(value))
  7458. return ctx.stylize('' + value, 'boolean');
  7459. // For some reason typeof null is "object", so special case here.
  7460. if (isNull(value))
  7461. return ctx.stylize('null', 'null');
  7462. }
  7463. function formatError(value) {
  7464. return '[' + Error.prototype.toString.call(value) + ']';
  7465. }
  7466. function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
  7467. var output = [];
  7468. for (var i = 0, l = value.length; i < l; ++i) {
  7469. if (hasOwnProperty(value, String(i))) {
  7470. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  7471. String(i), true));
  7472. } else {
  7473. output.push('');
  7474. }
  7475. }
  7476. keys.forEach(function(key) {
  7477. if (!key.match(/^\d+$/)) {
  7478. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  7479. key, true));
  7480. }
  7481. });
  7482. return output;
  7483. }
  7484. function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
  7485. var name, str, desc;
  7486. desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
  7487. if (desc.get) {
  7488. if (desc.set) {
  7489. str = ctx.stylize('[Getter/Setter]', 'special');
  7490. } else {
  7491. str = ctx.stylize('[Getter]', 'special');
  7492. }
  7493. } else {
  7494. if (desc.set) {
  7495. str = ctx.stylize('[Setter]', 'special');
  7496. }
  7497. }
  7498. if (!hasOwnProperty(visibleKeys, key)) {
  7499. name = '[' + key + ']';
  7500. }
  7501. if (!str) {
  7502. if (ctx.seen.indexOf(desc.value) < 0) {
  7503. if (isNull(recurseTimes)) {
  7504. str = formatValue(ctx, desc.value, null);
  7505. } else {
  7506. str = formatValue(ctx, desc.value, recurseTimes - 1);
  7507. }
  7508. if (str.indexOf('\n') > -1) {
  7509. if (array) {
  7510. str = str.split('\n').map(function(line) {
  7511. return ' ' + line;
  7512. }).join('\n').substr(2);
  7513. } else {
  7514. str = '\n' + str.split('\n').map(function(line) {
  7515. return ' ' + line;
  7516. }).join('\n');
  7517. }
  7518. }
  7519. } else {
  7520. str = ctx.stylize('[Circular]', 'special');
  7521. }
  7522. }
  7523. if (isUndefined(name)) {
  7524. if (array && key.match(/^\d+$/)) {
  7525. return str;
  7526. }
  7527. name = JSON.stringify('' + key);
  7528. if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
  7529. name = name.substr(1, name.length - 2);
  7530. name = ctx.stylize(name, 'name');
  7531. } else {
  7532. name = name.replace(/'/g, "\\'")
  7533. .replace(/\\"/g, '"')
  7534. .replace(/(^"|"$)/g, "'");
  7535. name = ctx.stylize(name, 'string');
  7536. }
  7537. }
  7538. return name + ': ' + str;
  7539. }
  7540. function reduceToSingleString(output, base, braces) {
  7541. var numLinesEst = 0;
  7542. var length = output.reduce(function(prev, cur) {
  7543. numLinesEst++;
  7544. if (cur.indexOf('\n') >= 0) numLinesEst++;
  7545. return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
  7546. }, 0);
  7547. if (length > 60) {
  7548. return braces[0] +
  7549. (base === '' ? '' : base + '\n ') +
  7550. ' ' +
  7551. output.join(',\n ') +
  7552. ' ' +
  7553. braces[1];
  7554. }
  7555. return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
  7556. }
  7557. // NOTE: These type checking functions intentionally don't use `instanceof`
  7558. // because it is fragile and can be easily faked with `Object.create()`.
  7559. function isArray(ar) {
  7560. return Array.isArray(ar);
  7561. }
  7562. exports.isArray = isArray;
  7563. function isBoolean(arg) {
  7564. return typeof arg === 'boolean';
  7565. }
  7566. exports.isBoolean = isBoolean;
  7567. function isNull(arg) {
  7568. return arg === null;
  7569. }
  7570. exports.isNull = isNull;
  7571. function isNullOrUndefined(arg) {
  7572. return arg == null;
  7573. }
  7574. exports.isNullOrUndefined = isNullOrUndefined;
  7575. function isNumber(arg) {
  7576. return typeof arg === 'number';
  7577. }
  7578. exports.isNumber = isNumber;
  7579. function isString(arg) {
  7580. return typeof arg === 'string';
  7581. }
  7582. exports.isString = isString;
  7583. function isSymbol(arg) {
  7584. return typeof arg === 'symbol';
  7585. }
  7586. exports.isSymbol = isSymbol;
  7587. function isUndefined(arg) {
  7588. return arg === void 0;
  7589. }
  7590. exports.isUndefined = isUndefined;
  7591. function isRegExp(re) {
  7592. return isObject(re) && objectToString(re) === '[object RegExp]';
  7593. }
  7594. exports.isRegExp = isRegExp;
  7595. function isObject(arg) {
  7596. return typeof arg === 'object' && arg !== null;
  7597. }
  7598. exports.isObject = isObject;
  7599. function isDate(d) {
  7600. return isObject(d) && objectToString(d) === '[object Date]';
  7601. }
  7602. exports.isDate = isDate;
  7603. function isError(e) {
  7604. return isObject(e) &&
  7605. (objectToString(e) === '[object Error]' || e instanceof Error);
  7606. }
  7607. exports.isError = isError;
  7608. function isFunction(arg) {
  7609. return typeof arg === 'function';
  7610. }
  7611. exports.isFunction = isFunction;
  7612. function isPrimitive(arg) {
  7613. return arg === null ||
  7614. typeof arg === 'boolean' ||
  7615. typeof arg === 'number' ||
  7616. typeof arg === 'string' ||
  7617. typeof arg === 'symbol' || // ES6 symbol
  7618. typeof arg === 'undefined';
  7619. }
  7620. exports.isPrimitive = isPrimitive;
  7621. exports.isBuffer = require('./support/isBuffer');
  7622. function objectToString(o) {
  7623. return Object.prototype.toString.call(o);
  7624. }
  7625. function pad(n) {
  7626. return n < 10 ? '0' + n.toString(10) : n.toString(10);
  7627. }
  7628. var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
  7629. 'Oct', 'Nov', 'Dec'];
  7630. // 26 Feb 16:19:34
  7631. function timestamp() {
  7632. var d = new Date();
  7633. var time = [pad(d.getHours()),
  7634. pad(d.getMinutes()),
  7635. pad(d.getSeconds())].join(':');
  7636. return [d.getDate(), months[d.getMonth()], time].join(' ');
  7637. }
  7638. // log is just a thin wrapper to console.log that prepends a timestamp
  7639. exports.log = function() {
  7640. console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
  7641. };
  7642. /**
  7643. * Inherit the prototype methods from one constructor into another.
  7644. *
  7645. * The Function.prototype.inherits from lang.js rewritten as a standalone
  7646. * function (not on Function.prototype). NOTE: If this file is to be loaded
  7647. * during bootstrapping this function needs to be rewritten using some native
  7648. * functions as prototype setup using normal JavaScript does not work as
  7649. * expected during bootstrapping (see mirror.js in r114903).
  7650. *
  7651. * @param {function} ctor Constructor function which needs to inherit the
  7652. * prototype.
  7653. * @param {function} superCtor Constructor function to inherit prototype from.
  7654. */
  7655. exports.inherits = require('inherits');
  7656. exports._extend = function(origin, add) {
  7657. // Don't do anything if add isn't an object
  7658. if (!add || !isObject(add)) return origin;
  7659. var keys = Object.keys(add);
  7660. var i = keys.length;
  7661. while (i--) {
  7662. origin[keys[i]] = add[keys[i]];
  7663. }
  7664. return origin;
  7665. };
  7666. function hasOwnProperty(obj, prop) {
  7667. return Object.prototype.hasOwnProperty.call(obj, prop);
  7668. }
  7669. }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  7670. },{"./support/isBuffer":84,"_process":467,"inherits":83}],86:[function(require,module,exports){
  7671. (function (global){(function (){
  7672. 'use strict';
  7673. var possibleNames = [
  7674. 'BigInt64Array',
  7675. 'BigUint64Array',
  7676. 'Float32Array',
  7677. 'Float64Array',
  7678. 'Int16Array',
  7679. 'Int32Array',
  7680. 'Int8Array',
  7681. 'Uint16Array',
  7682. 'Uint32Array',
  7683. 'Uint8Array',
  7684. 'Uint8ClampedArray'
  7685. ];
  7686. var g = typeof globalThis === 'undefined' ? global : globalThis;
  7687. module.exports = function availableTypedArrays() {
  7688. var out = [];
  7689. for (var i = 0; i < possibleNames.length; i++) {
  7690. if (typeof g[possibleNames[i]] === 'function') {
  7691. out[out.length] = possibleNames[i];
  7692. }
  7693. }
  7694. return out;
  7695. };
  7696. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  7697. },{}],87:[function(require,module,exports){
  7698. 'use strict'
  7699. exports.byteLength = byteLength
  7700. exports.toByteArray = toByteArray
  7701. exports.fromByteArray = fromByteArray
  7702. var lookup = []
  7703. var revLookup = []
  7704. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  7705. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  7706. for (var i = 0, len = code.length; i < len; ++i) {
  7707. lookup[i] = code[i]
  7708. revLookup[code.charCodeAt(i)] = i
  7709. }
  7710. // Support decoding URL-safe base64 strings, as Node.js does.
  7711. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  7712. revLookup['-'.charCodeAt(0)] = 62
  7713. revLookup['_'.charCodeAt(0)] = 63
  7714. function getLens (b64) {
  7715. var len = b64.length
  7716. if (len % 4 > 0) {
  7717. throw new Error('Invalid string. Length must be a multiple of 4')
  7718. }
  7719. // Trim off extra bytes after placeholder bytes are found
  7720. // See: https://github.com/beatgammit/base64-js/issues/42
  7721. var validLen = b64.indexOf('=')
  7722. if (validLen === -1) validLen = len
  7723. var placeHoldersLen = validLen === len
  7724. ? 0
  7725. : 4 - (validLen % 4)
  7726. return [validLen, placeHoldersLen]
  7727. }
  7728. // base64 is 4/3 + up to two characters of the original data
  7729. function byteLength (b64) {
  7730. var lens = getLens(b64)
  7731. var validLen = lens[0]
  7732. var placeHoldersLen = lens[1]
  7733. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  7734. }
  7735. function _byteLength (b64, validLen, placeHoldersLen) {
  7736. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  7737. }
  7738. function toByteArray (b64) {
  7739. var tmp
  7740. var lens = getLens(b64)
  7741. var validLen = lens[0]
  7742. var placeHoldersLen = lens[1]
  7743. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  7744. var curByte = 0
  7745. // if there are placeholders, only get up to the last complete 4 chars
  7746. var len = placeHoldersLen > 0
  7747. ? validLen - 4
  7748. : validLen
  7749. var i
  7750. for (i = 0; i < len; i += 4) {
  7751. tmp =
  7752. (revLookup[b64.charCodeAt(i)] << 18) |
  7753. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  7754. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  7755. revLookup[b64.charCodeAt(i + 3)]
  7756. arr[curByte++] = (tmp >> 16) & 0xFF
  7757. arr[curByte++] = (tmp >> 8) & 0xFF
  7758. arr[curByte++] = tmp & 0xFF
  7759. }
  7760. if (placeHoldersLen === 2) {
  7761. tmp =
  7762. (revLookup[b64.charCodeAt(i)] << 2) |
  7763. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  7764. arr[curByte++] = tmp & 0xFF
  7765. }
  7766. if (placeHoldersLen === 1) {
  7767. tmp =
  7768. (revLookup[b64.charCodeAt(i)] << 10) |
  7769. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  7770. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  7771. arr[curByte++] = (tmp >> 8) & 0xFF
  7772. arr[curByte++] = tmp & 0xFF
  7773. }
  7774. return arr
  7775. }
  7776. function tripletToBase64 (num) {
  7777. return lookup[num >> 18 & 0x3F] +
  7778. lookup[num >> 12 & 0x3F] +
  7779. lookup[num >> 6 & 0x3F] +
  7780. lookup[num & 0x3F]
  7781. }
  7782. function encodeChunk (uint8, start, end) {
  7783. var tmp
  7784. var output = []
  7785. for (var i = start; i < end; i += 3) {
  7786. tmp =
  7787. ((uint8[i] << 16) & 0xFF0000) +
  7788. ((uint8[i + 1] << 8) & 0xFF00) +
  7789. (uint8[i + 2] & 0xFF)
  7790. output.push(tripletToBase64(tmp))
  7791. }
  7792. return output.join('')
  7793. }
  7794. function fromByteArray (uint8) {
  7795. var tmp
  7796. var len = uint8.length
  7797. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  7798. var parts = []
  7799. var maxChunkLength = 16383 // must be multiple of 3
  7800. // go through the array every three bytes, we'll deal with trailing stuff later
  7801. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  7802. parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
  7803. }
  7804. // pad the end with zeros, but make sure to not forget the extra bytes
  7805. if (extraBytes === 1) {
  7806. tmp = uint8[len - 1]
  7807. parts.push(
  7808. lookup[tmp >> 2] +
  7809. lookup[(tmp << 4) & 0x3F] +
  7810. '=='
  7811. )
  7812. } else if (extraBytes === 2) {
  7813. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  7814. parts.push(
  7815. lookup[tmp >> 10] +
  7816. lookup[(tmp >> 4) & 0x3F] +
  7817. lookup[(tmp << 2) & 0x3F] +
  7818. '='
  7819. )
  7820. }
  7821. return parts.join('')
  7822. }
  7823. },{}],88:[function(require,module,exports){
  7824. /*!
  7825. * Bowser - a browser detector
  7826. * https://github.com/ded/bowser
  7827. * MIT License | (c) Dustin Diaz 2015
  7828. */
  7829. !function (root, name, definition) {
  7830. if (typeof module != 'undefined' && module.exports) module.exports = definition()
  7831. else if (typeof define == 'function' && define.amd) define(name, definition)
  7832. else root[name] = definition()
  7833. }(this, 'bowser', function () {
  7834. /**
  7835. * See useragents.js for examples of navigator.userAgent
  7836. */
  7837. var t = true
  7838. function detect(ua) {
  7839. function getFirstMatch(regex) {
  7840. var match = ua.match(regex);
  7841. return (match && match.length > 1 && match[1]) || '';
  7842. }
  7843. function getSecondMatch(regex) {
  7844. var match = ua.match(regex);
  7845. return (match && match.length > 1 && match[2]) || '';
  7846. }
  7847. var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase()
  7848. , likeAndroid = /like android/i.test(ua)
  7849. , android = !likeAndroid && /android/i.test(ua)
  7850. , nexusMobile = /nexus\s*[0-6]\s*/i.test(ua)
  7851. , nexusTablet = !nexusMobile && /nexus\s*[0-9]+/i.test(ua)
  7852. , chromeos = /CrOS/.test(ua)
  7853. , silk = /silk/i.test(ua)
  7854. , sailfish = /sailfish/i.test(ua)
  7855. , tizen = /tizen/i.test(ua)
  7856. , webos = /(web|hpw)(o|0)s/i.test(ua)
  7857. , windowsphone = /windows phone/i.test(ua)
  7858. , samsungBrowser = /SamsungBrowser/i.test(ua)
  7859. , windows = !windowsphone && /windows/i.test(ua)
  7860. , mac = !iosdevice && !silk && /macintosh/i.test(ua)
  7861. , linux = !android && !sailfish && !tizen && !webos && /linux/i.test(ua)
  7862. , edgeVersion = getSecondMatch(/edg([ea]|ios)\/(\d+(\.\d+)?)/i)
  7863. , versionIdentifier = getFirstMatch(/version\/(\d+(\.\d+)?)/i)
  7864. , tablet = /tablet/i.test(ua) && !/tablet pc/i.test(ua)
  7865. , mobile = !tablet && /[^-]mobi/i.test(ua)
  7866. , xbox = /xbox/i.test(ua)
  7867. , result
  7868. if (/opera/i.test(ua)) {
  7869. // an old Opera
  7870. result = {
  7871. name: 'Opera'
  7872. , opera: t
  7873. , version: versionIdentifier || getFirstMatch(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i)
  7874. }
  7875. } else if (/opr\/|opios/i.test(ua)) {
  7876. // a new Opera
  7877. result = {
  7878. name: 'Opera'
  7879. , opera: t
  7880. , version: getFirstMatch(/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i) || versionIdentifier
  7881. }
  7882. }
  7883. else if (/SamsungBrowser/i.test(ua)) {
  7884. result = {
  7885. name: 'Samsung Internet for Android'
  7886. , samsungBrowser: t
  7887. , version: versionIdentifier || getFirstMatch(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i)
  7888. }
  7889. }
  7890. else if (/Whale/i.test(ua)) {
  7891. result = {
  7892. name: 'NAVER Whale browser'
  7893. , whale: t
  7894. , version: getFirstMatch(/(?:whale)[\s\/](\d+(?:\.\d+)+)/i)
  7895. }
  7896. }
  7897. else if (/MZBrowser/i.test(ua)) {
  7898. result = {
  7899. name: 'MZ Browser'
  7900. , mzbrowser: t
  7901. , version: getFirstMatch(/(?:MZBrowser)[\s\/](\d+(?:\.\d+)+)/i)
  7902. }
  7903. }
  7904. else if (/coast/i.test(ua)) {
  7905. result = {
  7906. name: 'Opera Coast'
  7907. , coast: t
  7908. , version: versionIdentifier || getFirstMatch(/(?:coast)[\s\/](\d+(\.\d+)?)/i)
  7909. }
  7910. }
  7911. else if (/focus/i.test(ua)) {
  7912. result = {
  7913. name: 'Focus'
  7914. , focus: t
  7915. , version: getFirstMatch(/(?:focus)[\s\/](\d+(?:\.\d+)+)/i)
  7916. }
  7917. }
  7918. else if (/yabrowser/i.test(ua)) {
  7919. result = {
  7920. name: 'Yandex Browser'
  7921. , yandexbrowser: t
  7922. , version: versionIdentifier || getFirstMatch(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)
  7923. }
  7924. }
  7925. else if (/ucbrowser/i.test(ua)) {
  7926. result = {
  7927. name: 'UC Browser'
  7928. , ucbrowser: t
  7929. , version: getFirstMatch(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i)
  7930. }
  7931. }
  7932. else if (/mxios/i.test(ua)) {
  7933. result = {
  7934. name: 'Maxthon'
  7935. , maxthon: t
  7936. , version: getFirstMatch(/(?:mxios)[\s\/](\d+(?:\.\d+)+)/i)
  7937. }
  7938. }
  7939. else if (/epiphany/i.test(ua)) {
  7940. result = {
  7941. name: 'Epiphany'
  7942. , epiphany: t
  7943. , version: getFirstMatch(/(?:epiphany)[\s\/](\d+(?:\.\d+)+)/i)
  7944. }
  7945. }
  7946. else if (/puffin/i.test(ua)) {
  7947. result = {
  7948. name: 'Puffin'
  7949. , puffin: t
  7950. , version: getFirstMatch(/(?:puffin)[\s\/](\d+(?:\.\d+)?)/i)
  7951. }
  7952. }
  7953. else if (/sleipnir/i.test(ua)) {
  7954. result = {
  7955. name: 'Sleipnir'
  7956. , sleipnir: t
  7957. , version: getFirstMatch(/(?:sleipnir)[\s\/](\d+(?:\.\d+)+)/i)
  7958. }
  7959. }
  7960. else if (/k-meleon/i.test(ua)) {
  7961. result = {
  7962. name: 'K-Meleon'
  7963. , kMeleon: t
  7964. , version: getFirstMatch(/(?:k-meleon)[\s\/](\d+(?:\.\d+)+)/i)
  7965. }
  7966. }
  7967. else if (windowsphone) {
  7968. result = {
  7969. name: 'Windows Phone'
  7970. , osname: 'Windows Phone'
  7971. , windowsphone: t
  7972. }
  7973. if (edgeVersion) {
  7974. result.msedge = t
  7975. result.version = edgeVersion
  7976. }
  7977. else {
  7978. result.msie = t
  7979. result.version = getFirstMatch(/iemobile\/(\d+(\.\d+)?)/i)
  7980. }
  7981. }
  7982. else if (/msie|trident/i.test(ua)) {
  7983. result = {
  7984. name: 'Internet Explorer'
  7985. , msie: t
  7986. , version: getFirstMatch(/(?:msie |rv:)(\d+(\.\d+)?)/i)
  7987. }
  7988. } else if (chromeos) {
  7989. result = {
  7990. name: 'Chrome'
  7991. , osname: 'Chrome OS'
  7992. , chromeos: t
  7993. , chromeBook: t
  7994. , chrome: t
  7995. , version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)
  7996. }
  7997. } else if (/edg([ea]|ios)/i.test(ua)) {
  7998. result = {
  7999. name: 'Microsoft Edge'
  8000. , msedge: t
  8001. , version: edgeVersion
  8002. }
  8003. }
  8004. else if (/vivaldi/i.test(ua)) {
  8005. result = {
  8006. name: 'Vivaldi'
  8007. , vivaldi: t
  8008. , version: getFirstMatch(/vivaldi\/(\d+(\.\d+)?)/i) || versionIdentifier
  8009. }
  8010. }
  8011. else if (sailfish) {
  8012. result = {
  8013. name: 'Sailfish'
  8014. , osname: 'Sailfish OS'
  8015. , sailfish: t
  8016. , version: getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i)
  8017. }
  8018. }
  8019. else if (/seamonkey\//i.test(ua)) {
  8020. result = {
  8021. name: 'SeaMonkey'
  8022. , seamonkey: t
  8023. , version: getFirstMatch(/seamonkey\/(\d+(\.\d+)?)/i)
  8024. }
  8025. }
  8026. else if (/firefox|iceweasel|fxios/i.test(ua)) {
  8027. result = {
  8028. name: 'Firefox'
  8029. , firefox: t
  8030. , version: getFirstMatch(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i)
  8031. }
  8032. if (/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(ua)) {
  8033. result.firefoxos = t
  8034. result.osname = 'Firefox OS'
  8035. }
  8036. }
  8037. else if (silk) {
  8038. result = {
  8039. name: 'Amazon Silk'
  8040. , silk: t
  8041. , version : getFirstMatch(/silk\/(\d+(\.\d+)?)/i)
  8042. }
  8043. }
  8044. else if (/phantom/i.test(ua)) {
  8045. result = {
  8046. name: 'PhantomJS'
  8047. , phantom: t
  8048. , version: getFirstMatch(/phantomjs\/(\d+(\.\d+)?)/i)
  8049. }
  8050. }
  8051. else if (/slimerjs/i.test(ua)) {
  8052. result = {
  8053. name: 'SlimerJS'
  8054. , slimer: t
  8055. , version: getFirstMatch(/slimerjs\/(\d+(\.\d+)?)/i)
  8056. }
  8057. }
  8058. else if (/blackberry|\bbb\d+/i.test(ua) || /rim\stablet/i.test(ua)) {
  8059. result = {
  8060. name: 'BlackBerry'
  8061. , osname: 'BlackBerry OS'
  8062. , blackberry: t
  8063. , version: versionIdentifier || getFirstMatch(/blackberry[\d]+\/(\d+(\.\d+)?)/i)
  8064. }
  8065. }
  8066. else if (webos) {
  8067. result = {
  8068. name: 'WebOS'
  8069. , osname: 'WebOS'
  8070. , webos: t
  8071. , version: versionIdentifier || getFirstMatch(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)
  8072. };
  8073. /touchpad\//i.test(ua) && (result.touchpad = t)
  8074. }
  8075. else if (/bada/i.test(ua)) {
  8076. result = {
  8077. name: 'Bada'
  8078. , osname: 'Bada'
  8079. , bada: t
  8080. , version: getFirstMatch(/dolfin\/(\d+(\.\d+)?)/i)
  8081. };
  8082. }
  8083. else if (tizen) {
  8084. result = {
  8085. name: 'Tizen'
  8086. , osname: 'Tizen'
  8087. , tizen: t
  8088. , version: getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i) || versionIdentifier
  8089. };
  8090. }
  8091. else if (/qupzilla/i.test(ua)) {
  8092. result = {
  8093. name: 'QupZilla'
  8094. , qupzilla: t
  8095. , version: getFirstMatch(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i) || versionIdentifier
  8096. }
  8097. }
  8098. else if (/chromium/i.test(ua)) {
  8099. result = {
  8100. name: 'Chromium'
  8101. , chromium: t
  8102. , version: getFirstMatch(/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i) || versionIdentifier
  8103. }
  8104. }
  8105. else if (/chrome|crios|crmo/i.test(ua)) {
  8106. result = {
  8107. name: 'Chrome'
  8108. , chrome: t
  8109. , version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)
  8110. }
  8111. }
  8112. else if (android) {
  8113. result = {
  8114. name: 'Android'
  8115. , version: versionIdentifier
  8116. }
  8117. }
  8118. else if (/safari|applewebkit/i.test(ua)) {
  8119. result = {
  8120. name: 'Safari'
  8121. , safari: t
  8122. }
  8123. if (versionIdentifier) {
  8124. result.version = versionIdentifier
  8125. }
  8126. }
  8127. else if (iosdevice) {
  8128. result = {
  8129. name : iosdevice == 'iphone' ? 'iPhone' : iosdevice == 'ipad' ? 'iPad' : 'iPod'
  8130. }
  8131. // WTF: version is not part of user agent in web apps
  8132. if (versionIdentifier) {
  8133. result.version = versionIdentifier
  8134. }
  8135. }
  8136. else if(/googlebot/i.test(ua)) {
  8137. result = {
  8138. name: 'Googlebot'
  8139. , googlebot: t
  8140. , version: getFirstMatch(/googlebot\/(\d+(\.\d+))/i) || versionIdentifier
  8141. }
  8142. }
  8143. else {
  8144. result = {
  8145. name: getFirstMatch(/^(.*)\/(.*) /),
  8146. version: getSecondMatch(/^(.*)\/(.*) /)
  8147. };
  8148. }
  8149. // set webkit or gecko flag for browsers based on these engines
  8150. if (!result.msedge && /(apple)?webkit/i.test(ua)) {
  8151. if (/(apple)?webkit\/537\.36/i.test(ua)) {
  8152. result.name = result.name || "Blink"
  8153. result.blink = t
  8154. } else {
  8155. result.name = result.name || "Webkit"
  8156. result.webkit = t
  8157. }
  8158. if (!result.version && versionIdentifier) {
  8159. result.version = versionIdentifier
  8160. }
  8161. } else if (!result.opera && /gecko\//i.test(ua)) {
  8162. result.name = result.name || "Gecko"
  8163. result.gecko = t
  8164. result.version = result.version || getFirstMatch(/gecko\/(\d+(\.\d+)?)/i)
  8165. }
  8166. // set OS flags for platforms that have multiple browsers
  8167. if (!result.windowsphone && (android || result.silk)) {
  8168. result.android = t
  8169. result.osname = 'Android'
  8170. } else if (!result.windowsphone && iosdevice) {
  8171. result[iosdevice] = t
  8172. result.ios = t
  8173. result.osname = 'iOS'
  8174. } else if (mac) {
  8175. result.mac = t
  8176. result.osname = 'macOS'
  8177. } else if (xbox) {
  8178. result.xbox = t
  8179. result.osname = 'Xbox'
  8180. } else if (windows) {
  8181. result.windows = t
  8182. result.osname = 'Windows'
  8183. } else if (linux) {
  8184. result.linux = t
  8185. result.osname = 'Linux'
  8186. }
  8187. function getWindowsVersion (s) {
  8188. switch (s) {
  8189. case 'NT': return 'NT'
  8190. case 'XP': return 'XP'
  8191. case 'NT 5.0': return '2000'
  8192. case 'NT 5.1': return 'XP'
  8193. case 'NT 5.2': return '2003'
  8194. case 'NT 6.0': return 'Vista'
  8195. case 'NT 6.1': return '7'
  8196. case 'NT 6.2': return '8'
  8197. case 'NT 6.3': return '8.1'
  8198. case 'NT 10.0': return '10'
  8199. default: return undefined
  8200. }
  8201. }
  8202. // OS version extraction
  8203. var osVersion = '';
  8204. if (result.windows) {
  8205. osVersion = getWindowsVersion(getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i))
  8206. } else if (result.windowsphone) {
  8207. osVersion = getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i);
  8208. } else if (result.mac) {
  8209. osVersion = getFirstMatch(/Mac OS X (\d+([_\.\s]\d+)*)/i);
  8210. osVersion = osVersion.replace(/[_\s]/g, '.');
  8211. } else if (iosdevice) {
  8212. osVersion = getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i);
  8213. osVersion = osVersion.replace(/[_\s]/g, '.');
  8214. } else if (android) {
  8215. osVersion = getFirstMatch(/android[ \/-](\d+(\.\d+)*)/i);
  8216. } else if (result.webos) {
  8217. osVersion = getFirstMatch(/(?:web|hpw)os\/(\d+(\.\d+)*)/i);
  8218. } else if (result.blackberry) {
  8219. osVersion = getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i);
  8220. } else if (result.bada) {
  8221. osVersion = getFirstMatch(/bada\/(\d+(\.\d+)*)/i);
  8222. } else if (result.tizen) {
  8223. osVersion = getFirstMatch(/tizen[\/\s](\d+(\.\d+)*)/i);
  8224. }
  8225. if (osVersion) {
  8226. result.osversion = osVersion;
  8227. }
  8228. // device type extraction
  8229. var osMajorVersion = !result.windows && osVersion.split('.')[0];
  8230. if (
  8231. tablet
  8232. || nexusTablet
  8233. || iosdevice == 'ipad'
  8234. || (android && (osMajorVersion == 3 || (osMajorVersion >= 4 && !mobile)))
  8235. || result.silk
  8236. ) {
  8237. result.tablet = t
  8238. } else if (
  8239. mobile
  8240. || iosdevice == 'iphone'
  8241. || iosdevice == 'ipod'
  8242. || android
  8243. || nexusMobile
  8244. || result.blackberry
  8245. || result.webos
  8246. || result.bada
  8247. ) {
  8248. result.mobile = t
  8249. }
  8250. // Graded Browser Support
  8251. // http://developer.yahoo.com/yui/articles/gbs
  8252. if (result.msedge ||
  8253. (result.msie && result.version >= 10) ||
  8254. (result.yandexbrowser && result.version >= 15) ||
  8255. (result.vivaldi && result.version >= 1.0) ||
  8256. (result.chrome && result.version >= 20) ||
  8257. (result.samsungBrowser && result.version >= 4) ||
  8258. (result.whale && compareVersions([result.version, '1.0']) === 1) ||
  8259. (result.mzbrowser && compareVersions([result.version, '6.0']) === 1) ||
  8260. (result.focus && compareVersions([result.version, '1.0']) === 1) ||
  8261. (result.firefox && result.version >= 20.0) ||
  8262. (result.safari && result.version >= 6) ||
  8263. (result.opera && result.version >= 10.0) ||
  8264. (result.ios && result.osversion && result.osversion.split(".")[0] >= 6) ||
  8265. (result.blackberry && result.version >= 10.1)
  8266. || (result.chromium && result.version >= 20)
  8267. ) {
  8268. result.a = t;
  8269. }
  8270. else if ((result.msie && result.version < 10) ||
  8271. (result.chrome && result.version < 20) ||
  8272. (result.firefox && result.version < 20.0) ||
  8273. (result.safari && result.version < 6) ||
  8274. (result.opera && result.version < 10.0) ||
  8275. (result.ios && result.osversion && result.osversion.split(".")[0] < 6)
  8276. || (result.chromium && result.version < 20)
  8277. ) {
  8278. result.c = t
  8279. } else result.x = t
  8280. return result
  8281. }
  8282. var bowser = detect(typeof navigator !== 'undefined' ? navigator.userAgent || '' : '')
  8283. bowser.test = function (browserList) {
  8284. for (var i = 0; i < browserList.length; ++i) {
  8285. var browserItem = browserList[i];
  8286. if (typeof browserItem=== 'string') {
  8287. if (browserItem in bowser) {
  8288. return true;
  8289. }
  8290. }
  8291. }
  8292. return false;
  8293. }
  8294. /**
  8295. * Get version precisions count
  8296. *
  8297. * @example
  8298. * getVersionPrecision("1.10.3") // 3
  8299. *
  8300. * @param {string} version
  8301. * @return {number}
  8302. */
  8303. function getVersionPrecision(version) {
  8304. return version.split(".").length;
  8305. }
  8306. /**
  8307. * Array::map polyfill
  8308. *
  8309. * @param {Array} arr
  8310. * @param {Function} iterator
  8311. * @return {Array}
  8312. */
  8313. function map(arr, iterator) {
  8314. var result = [], i;
  8315. if (Array.prototype.map) {
  8316. return Array.prototype.map.call(arr, iterator);
  8317. }
  8318. for (i = 0; i < arr.length; i++) {
  8319. result.push(iterator(arr[i]));
  8320. }
  8321. return result;
  8322. }
  8323. /**
  8324. * Calculate browser version weight
  8325. *
  8326. * @example
  8327. * compareVersions(['1.10.2.1', '1.8.2.1.90']) // 1
  8328. * compareVersions(['1.010.2.1', '1.09.2.1.90']); // 1
  8329. * compareVersions(['1.10.2.1', '1.10.2.1']); // 0
  8330. * compareVersions(['1.10.2.1', '1.0800.2']); // -1
  8331. *
  8332. * @param {Array<String>} versions versions to compare
  8333. * @return {Number} comparison result
  8334. */
  8335. function compareVersions(versions) {
  8336. // 1) get common precision for both versions, for example for "10.0" and "9" it should be 2
  8337. var precision = Math.max(getVersionPrecision(versions[0]), getVersionPrecision(versions[1]));
  8338. var chunks = map(versions, function (version) {
  8339. var delta = precision - getVersionPrecision(version);
  8340. // 2) "9" -> "9.0" (for precision = 2)
  8341. version = version + new Array(delta + 1).join(".0");
  8342. // 3) "9.0" -> ["000000000"", "000000009"]
  8343. return map(version.split("."), function (chunk) {
  8344. return new Array(20 - chunk.length).join("0") + chunk;
  8345. }).reverse();
  8346. });
  8347. // iterate in reverse order by reversed chunks array
  8348. while (--precision >= 0) {
  8349. // 4) compare: "000000009" > "000000010" = false (but "9" > "10" = true)
  8350. if (chunks[0][precision] > chunks[1][precision]) {
  8351. return 1;
  8352. }
  8353. else if (chunks[0][precision] === chunks[1][precision]) {
  8354. if (precision === 0) {
  8355. // all version chunks are same
  8356. return 0;
  8357. }
  8358. }
  8359. else {
  8360. return -1;
  8361. }
  8362. }
  8363. }
  8364. /**
  8365. * Check if browser is unsupported
  8366. *
  8367. * @example
  8368. * bowser.isUnsupportedBrowser({
  8369. * msie: "10",
  8370. * firefox: "23",
  8371. * chrome: "29",
  8372. * safari: "5.1",
  8373. * opera: "16",
  8374. * phantom: "534"
  8375. * });
  8376. *
  8377. * @param {Object} minVersions map of minimal version to browser
  8378. * @param {Boolean} [strictMode = false] flag to return false if browser wasn't found in map
  8379. * @param {String} [ua] user agent string
  8380. * @return {Boolean}
  8381. */
  8382. function isUnsupportedBrowser(minVersions, strictMode, ua) {
  8383. var _bowser = bowser;
  8384. // make strictMode param optional with ua param usage
  8385. if (typeof strictMode === 'string') {
  8386. ua = strictMode;
  8387. strictMode = void(0);
  8388. }
  8389. if (strictMode === void(0)) {
  8390. strictMode = false;
  8391. }
  8392. if (ua) {
  8393. _bowser = detect(ua);
  8394. }
  8395. var version = "" + _bowser.version;
  8396. for (var browser in minVersions) {
  8397. if (minVersions.hasOwnProperty(browser)) {
  8398. if (_bowser[browser]) {
  8399. if (typeof minVersions[browser] !== 'string') {
  8400. throw new Error('Browser version in the minVersion map should be a string: ' + browser + ': ' + String(minVersions));
  8401. }
  8402. // browser version and min supported version.
  8403. return compareVersions([version, minVersions[browser]]) < 0;
  8404. }
  8405. }
  8406. }
  8407. return strictMode; // not found
  8408. }
  8409. /**
  8410. * Check if browser is supported
  8411. *
  8412. * @param {Object} minVersions map of minimal version to browser
  8413. * @param {Boolean} [strictMode = false] flag to return false if browser wasn't found in map
  8414. * @param {String} [ua] user agent string
  8415. * @return {Boolean}
  8416. */
  8417. function check(minVersions, strictMode, ua) {
  8418. return !isUnsupportedBrowser(minVersions, strictMode, ua);
  8419. }
  8420. bowser.isUnsupportedBrowser = isUnsupportedBrowser;
  8421. bowser.compareVersions = compareVersions;
  8422. bowser.check = check;
  8423. /*
  8424. * Set our detect method to the main bowser object so we can
  8425. * reuse it to test other user agents.
  8426. * This is needed to implement future tests.
  8427. */
  8428. bowser._detect = detect;
  8429. /*
  8430. * Set our detect public method to the main bowser object
  8431. * This is needed to implement bowser in server side
  8432. */
  8433. bowser.detect = detect;
  8434. return bowser
  8435. });
  8436. },{}],89:[function(require,module,exports){
  8437. },{}],90:[function(require,module,exports){
  8438. (function (Buffer){(function (){
  8439. /*!
  8440. * The buffer module from node.js, for the browser.
  8441. *
  8442. * @author Feross Aboukhadijeh <https://feross.org>
  8443. * @license MIT
  8444. */
  8445. /* eslint-disable no-proto */
  8446. 'use strict'
  8447. var base64 = require('base64-js')
  8448. var ieee754 = require('ieee754')
  8449. exports.Buffer = Buffer
  8450. exports.SlowBuffer = SlowBuffer
  8451. exports.INSPECT_MAX_BYTES = 50
  8452. var K_MAX_LENGTH = 0x7fffffff
  8453. exports.kMaxLength = K_MAX_LENGTH
  8454. /**
  8455. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  8456. * === true Use Uint8Array implementation (fastest)
  8457. * === false Print warning and recommend using `buffer` v4.x which has an Object
  8458. * implementation (most compatible, even IE6)
  8459. *
  8460. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  8461. * Opera 11.6+, iOS 4.2+.
  8462. *
  8463. * We report that the browser does not support typed arrays if the are not subclassable
  8464. * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
  8465. * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
  8466. * for __proto__ and has a buggy typed array implementation.
  8467. */
  8468. Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
  8469. if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
  8470. typeof console.error === 'function') {
  8471. console.error(
  8472. 'This browser lacks typed array (Uint8Array) support which is required by ' +
  8473. '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
  8474. )
  8475. }
  8476. function typedArraySupport () {
  8477. // Can typed array instances can be augmented?
  8478. try {
  8479. var arr = new Uint8Array(1)
  8480. arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } }
  8481. return arr.foo() === 42
  8482. } catch (e) {
  8483. return false
  8484. }
  8485. }
  8486. Object.defineProperty(Buffer.prototype, 'parent', {
  8487. enumerable: true,
  8488. get: function () {
  8489. if (!Buffer.isBuffer(this)) return undefined
  8490. return this.buffer
  8491. }
  8492. })
  8493. Object.defineProperty(Buffer.prototype, 'offset', {
  8494. enumerable: true,
  8495. get: function () {
  8496. if (!Buffer.isBuffer(this)) return undefined
  8497. return this.byteOffset
  8498. }
  8499. })
  8500. function createBuffer (length) {
  8501. if (length > K_MAX_LENGTH) {
  8502. throw new RangeError('The value "' + length + '" is invalid for option "size"')
  8503. }
  8504. // Return an augmented `Uint8Array` instance
  8505. var buf = new Uint8Array(length)
  8506. buf.__proto__ = Buffer.prototype
  8507. return buf
  8508. }
  8509. /**
  8510. * The Buffer constructor returns instances of `Uint8Array` that have their
  8511. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  8512. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  8513. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  8514. * returns a single octet.
  8515. *
  8516. * The `Uint8Array` prototype remains unmodified.
  8517. */
  8518. function Buffer (arg, encodingOrOffset, length) {
  8519. // Common case.
  8520. if (typeof arg === 'number') {
  8521. if (typeof encodingOrOffset === 'string') {
  8522. throw new TypeError(
  8523. 'The "string" argument must be of type string. Received type number'
  8524. )
  8525. }
  8526. return allocUnsafe(arg)
  8527. }
  8528. return from(arg, encodingOrOffset, length)
  8529. }
  8530. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  8531. if (typeof Symbol !== 'undefined' && Symbol.species != null &&
  8532. Buffer[Symbol.species] === Buffer) {
  8533. Object.defineProperty(Buffer, Symbol.species, {
  8534. value: null,
  8535. configurable: true,
  8536. enumerable: false,
  8537. writable: false
  8538. })
  8539. }
  8540. Buffer.poolSize = 8192 // not used by this implementation
  8541. function from (value, encodingOrOffset, length) {
  8542. if (typeof value === 'string') {
  8543. return fromString(value, encodingOrOffset)
  8544. }
  8545. if (ArrayBuffer.isView(value)) {
  8546. return fromArrayLike(value)
  8547. }
  8548. if (value == null) {
  8549. throw TypeError(
  8550. 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
  8551. 'or Array-like Object. Received type ' + (typeof value)
  8552. )
  8553. }
  8554. if (isInstance(value, ArrayBuffer) ||
  8555. (value && isInstance(value.buffer, ArrayBuffer))) {
  8556. return fromArrayBuffer(value, encodingOrOffset, length)
  8557. }
  8558. if (typeof value === 'number') {
  8559. throw new TypeError(
  8560. 'The "value" argument must not be of type number. Received type number'
  8561. )
  8562. }
  8563. var valueOf = value.valueOf && value.valueOf()
  8564. if (valueOf != null && valueOf !== value) {
  8565. return Buffer.from(valueOf, encodingOrOffset, length)
  8566. }
  8567. var b = fromObject(value)
  8568. if (b) return b
  8569. if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
  8570. typeof value[Symbol.toPrimitive] === 'function') {
  8571. return Buffer.from(
  8572. value[Symbol.toPrimitive]('string'), encodingOrOffset, length
  8573. )
  8574. }
  8575. throw new TypeError(
  8576. 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
  8577. 'or Array-like Object. Received type ' + (typeof value)
  8578. )
  8579. }
  8580. /**
  8581. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  8582. * if value is a number.
  8583. * Buffer.from(str[, encoding])
  8584. * Buffer.from(array)
  8585. * Buffer.from(buffer)
  8586. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  8587. **/
  8588. Buffer.from = function (value, encodingOrOffset, length) {
  8589. return from(value, encodingOrOffset, length)
  8590. }
  8591. // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
  8592. // https://github.com/feross/buffer/pull/148
  8593. Buffer.prototype.__proto__ = Uint8Array.prototype
  8594. Buffer.__proto__ = Uint8Array
  8595. function assertSize (size) {
  8596. if (typeof size !== 'number') {
  8597. throw new TypeError('"size" argument must be of type number')
  8598. } else if (size < 0) {
  8599. throw new RangeError('The value "' + size + '" is invalid for option "size"')
  8600. }
  8601. }
  8602. function alloc (size, fill, encoding) {
  8603. assertSize(size)
  8604. if (size <= 0) {
  8605. return createBuffer(size)
  8606. }
  8607. if (fill !== undefined) {
  8608. // Only pay attention to encoding if it's a string. This
  8609. // prevents accidentally sending in a number that would
  8610. // be interpretted as a start offset.
  8611. return typeof encoding === 'string'
  8612. ? createBuffer(size).fill(fill, encoding)
  8613. : createBuffer(size).fill(fill)
  8614. }
  8615. return createBuffer(size)
  8616. }
  8617. /**
  8618. * Creates a new filled Buffer instance.
  8619. * alloc(size[, fill[, encoding]])
  8620. **/
  8621. Buffer.alloc = function (size, fill, encoding) {
  8622. return alloc(size, fill, encoding)
  8623. }
  8624. function allocUnsafe (size) {
  8625. assertSize(size)
  8626. return createBuffer(size < 0 ? 0 : checked(size) | 0)
  8627. }
  8628. /**
  8629. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  8630. * */
  8631. Buffer.allocUnsafe = function (size) {
  8632. return allocUnsafe(size)
  8633. }
  8634. /**
  8635. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  8636. */
  8637. Buffer.allocUnsafeSlow = function (size) {
  8638. return allocUnsafe(size)
  8639. }
  8640. function fromString (string, encoding) {
  8641. if (typeof encoding !== 'string' || encoding === '') {
  8642. encoding = 'utf8'
  8643. }
  8644. if (!Buffer.isEncoding(encoding)) {
  8645. throw new TypeError('Unknown encoding: ' + encoding)
  8646. }
  8647. var length = byteLength(string, encoding) | 0
  8648. var buf = createBuffer(length)
  8649. var actual = buf.write(string, encoding)
  8650. if (actual !== length) {
  8651. // Writing a hex string, for example, that contains invalid characters will
  8652. // cause everything after the first invalid character to be ignored. (e.g.
  8653. // 'abxxcd' will be treated as 'ab')
  8654. buf = buf.slice(0, actual)
  8655. }
  8656. return buf
  8657. }
  8658. function fromArrayLike (array) {
  8659. var length = array.length < 0 ? 0 : checked(array.length) | 0
  8660. var buf = createBuffer(length)
  8661. for (var i = 0; i < length; i += 1) {
  8662. buf[i] = array[i] & 255
  8663. }
  8664. return buf
  8665. }
  8666. function fromArrayBuffer (array, byteOffset, length) {
  8667. if (byteOffset < 0 || array.byteLength < byteOffset) {
  8668. throw new RangeError('"offset" is outside of buffer bounds')
  8669. }
  8670. if (array.byteLength < byteOffset + (length || 0)) {
  8671. throw new RangeError('"length" is outside of buffer bounds')
  8672. }
  8673. var buf
  8674. if (byteOffset === undefined && length === undefined) {
  8675. buf = new Uint8Array(array)
  8676. } else if (length === undefined) {
  8677. buf = new Uint8Array(array, byteOffset)
  8678. } else {
  8679. buf = new Uint8Array(array, byteOffset, length)
  8680. }
  8681. // Return an augmented `Uint8Array` instance
  8682. buf.__proto__ = Buffer.prototype
  8683. return buf
  8684. }
  8685. function fromObject (obj) {
  8686. if (Buffer.isBuffer(obj)) {
  8687. var len = checked(obj.length) | 0
  8688. var buf = createBuffer(len)
  8689. if (buf.length === 0) {
  8690. return buf
  8691. }
  8692. obj.copy(buf, 0, 0, len)
  8693. return buf
  8694. }
  8695. if (obj.length !== undefined) {
  8696. if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
  8697. return createBuffer(0)
  8698. }
  8699. return fromArrayLike(obj)
  8700. }
  8701. if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
  8702. return fromArrayLike(obj.data)
  8703. }
  8704. }
  8705. function checked (length) {
  8706. // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
  8707. // length is NaN (which is otherwise coerced to zero.)
  8708. if (length >= K_MAX_LENGTH) {
  8709. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  8710. 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
  8711. }
  8712. return length | 0
  8713. }
  8714. function SlowBuffer (length) {
  8715. if (+length != length) { // eslint-disable-line eqeqeq
  8716. length = 0
  8717. }
  8718. return Buffer.alloc(+length)
  8719. }
  8720. Buffer.isBuffer = function isBuffer (b) {
  8721. return b != null && b._isBuffer === true &&
  8722. b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
  8723. }
  8724. Buffer.compare = function compare (a, b) {
  8725. if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
  8726. if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
  8727. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  8728. throw new TypeError(
  8729. 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
  8730. )
  8731. }
  8732. if (a === b) return 0
  8733. var x = a.length
  8734. var y = b.length
  8735. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  8736. if (a[i] !== b[i]) {
  8737. x = a[i]
  8738. y = b[i]
  8739. break
  8740. }
  8741. }
  8742. if (x < y) return -1
  8743. if (y < x) return 1
  8744. return 0
  8745. }
  8746. Buffer.isEncoding = function isEncoding (encoding) {
  8747. switch (String(encoding).toLowerCase()) {
  8748. case 'hex':
  8749. case 'utf8':
  8750. case 'utf-8':
  8751. case 'ascii':
  8752. case 'latin1':
  8753. case 'binary':
  8754. case 'base64':
  8755. case 'ucs2':
  8756. case 'ucs-2':
  8757. case 'utf16le':
  8758. case 'utf-16le':
  8759. return true
  8760. default:
  8761. return false
  8762. }
  8763. }
  8764. Buffer.concat = function concat (list, length) {
  8765. if (!Array.isArray(list)) {
  8766. throw new TypeError('"list" argument must be an Array of Buffers')
  8767. }
  8768. if (list.length === 0) {
  8769. return Buffer.alloc(0)
  8770. }
  8771. var i
  8772. if (length === undefined) {
  8773. length = 0
  8774. for (i = 0; i < list.length; ++i) {
  8775. length += list[i].length
  8776. }
  8777. }
  8778. var buffer = Buffer.allocUnsafe(length)
  8779. var pos = 0
  8780. for (i = 0; i < list.length; ++i) {
  8781. var buf = list[i]
  8782. if (isInstance(buf, Uint8Array)) {
  8783. buf = Buffer.from(buf)
  8784. }
  8785. if (!Buffer.isBuffer(buf)) {
  8786. throw new TypeError('"list" argument must be an Array of Buffers')
  8787. }
  8788. buf.copy(buffer, pos)
  8789. pos += buf.length
  8790. }
  8791. return buffer
  8792. }
  8793. function byteLength (string, encoding) {
  8794. if (Buffer.isBuffer(string)) {
  8795. return string.length
  8796. }
  8797. if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
  8798. return string.byteLength
  8799. }
  8800. if (typeof string !== 'string') {
  8801. throw new TypeError(
  8802. 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
  8803. 'Received type ' + typeof string
  8804. )
  8805. }
  8806. var len = string.length
  8807. var mustMatch = (arguments.length > 2 && arguments[2] === true)
  8808. if (!mustMatch && len === 0) return 0
  8809. // Use a for loop to avoid recursion
  8810. var loweredCase = false
  8811. for (;;) {
  8812. switch (encoding) {
  8813. case 'ascii':
  8814. case 'latin1':
  8815. case 'binary':
  8816. return len
  8817. case 'utf8':
  8818. case 'utf-8':
  8819. return utf8ToBytes(string).length
  8820. case 'ucs2':
  8821. case 'ucs-2':
  8822. case 'utf16le':
  8823. case 'utf-16le':
  8824. return len * 2
  8825. case 'hex':
  8826. return len >>> 1
  8827. case 'base64':
  8828. return base64ToBytes(string).length
  8829. default:
  8830. if (loweredCase) {
  8831. return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
  8832. }
  8833. encoding = ('' + encoding).toLowerCase()
  8834. loweredCase = true
  8835. }
  8836. }
  8837. }
  8838. Buffer.byteLength = byteLength
  8839. function slowToString (encoding, start, end) {
  8840. var loweredCase = false
  8841. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  8842. // property of a typed array.
  8843. // This behaves neither like String nor Uint8Array in that we set start/end
  8844. // to their upper/lower bounds if the value passed is out of range.
  8845. // undefined is handled specially as per ECMA-262 6th Edition,
  8846. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  8847. if (start === undefined || start < 0) {
  8848. start = 0
  8849. }
  8850. // Return early if start > this.length. Done here to prevent potential uint32
  8851. // coercion fail below.
  8852. if (start > this.length) {
  8853. return ''
  8854. }
  8855. if (end === undefined || end > this.length) {
  8856. end = this.length
  8857. }
  8858. if (end <= 0) {
  8859. return ''
  8860. }
  8861. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  8862. end >>>= 0
  8863. start >>>= 0
  8864. if (end <= start) {
  8865. return ''
  8866. }
  8867. if (!encoding) encoding = 'utf8'
  8868. while (true) {
  8869. switch (encoding) {
  8870. case 'hex':
  8871. return hexSlice(this, start, end)
  8872. case 'utf8':
  8873. case 'utf-8':
  8874. return utf8Slice(this, start, end)
  8875. case 'ascii':
  8876. return asciiSlice(this, start, end)
  8877. case 'latin1':
  8878. case 'binary':
  8879. return latin1Slice(this, start, end)
  8880. case 'base64':
  8881. return base64Slice(this, start, end)
  8882. case 'ucs2':
  8883. case 'ucs-2':
  8884. case 'utf16le':
  8885. case 'utf-16le':
  8886. return utf16leSlice(this, start, end)
  8887. default:
  8888. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  8889. encoding = (encoding + '').toLowerCase()
  8890. loweredCase = true
  8891. }
  8892. }
  8893. }
  8894. // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
  8895. // to detect a Buffer instance. It's not possible to use `instanceof Buffer`
  8896. // reliably in a browserify context because there could be multiple different
  8897. // copies of the 'buffer' package in use. This method works even for Buffer
  8898. // instances that were created from another copy of the `buffer` package.
  8899. // See: https://github.com/feross/buffer/issues/154
  8900. Buffer.prototype._isBuffer = true
  8901. function swap (b, n, m) {
  8902. var i = b[n]
  8903. b[n] = b[m]
  8904. b[m] = i
  8905. }
  8906. Buffer.prototype.swap16 = function swap16 () {
  8907. var len = this.length
  8908. if (len % 2 !== 0) {
  8909. throw new RangeError('Buffer size must be a multiple of 16-bits')
  8910. }
  8911. for (var i = 0; i < len; i += 2) {
  8912. swap(this, i, i + 1)
  8913. }
  8914. return this
  8915. }
  8916. Buffer.prototype.swap32 = function swap32 () {
  8917. var len = this.length
  8918. if (len % 4 !== 0) {
  8919. throw new RangeError('Buffer size must be a multiple of 32-bits')
  8920. }
  8921. for (var i = 0; i < len; i += 4) {
  8922. swap(this, i, i + 3)
  8923. swap(this, i + 1, i + 2)
  8924. }
  8925. return this
  8926. }
  8927. Buffer.prototype.swap64 = function swap64 () {
  8928. var len = this.length
  8929. if (len % 8 !== 0) {
  8930. throw new RangeError('Buffer size must be a multiple of 64-bits')
  8931. }
  8932. for (var i = 0; i < len; i += 8) {
  8933. swap(this, i, i + 7)
  8934. swap(this, i + 1, i + 6)
  8935. swap(this, i + 2, i + 5)
  8936. swap(this, i + 3, i + 4)
  8937. }
  8938. return this
  8939. }
  8940. Buffer.prototype.toString = function toString () {
  8941. var length = this.length
  8942. if (length === 0) return ''
  8943. if (arguments.length === 0) return utf8Slice(this, 0, length)
  8944. return slowToString.apply(this, arguments)
  8945. }
  8946. Buffer.prototype.toLocaleString = Buffer.prototype.toString
  8947. Buffer.prototype.equals = function equals (b) {
  8948. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  8949. if (this === b) return true
  8950. return Buffer.compare(this, b) === 0
  8951. }
  8952. Buffer.prototype.inspect = function inspect () {
  8953. var str = ''
  8954. var max = exports.INSPECT_MAX_BYTES
  8955. str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
  8956. if (this.length > max) str += ' ... '
  8957. return '<Buffer ' + str + '>'
  8958. }
  8959. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  8960. if (isInstance(target, Uint8Array)) {
  8961. target = Buffer.from(target, target.offset, target.byteLength)
  8962. }
  8963. if (!Buffer.isBuffer(target)) {
  8964. throw new TypeError(
  8965. 'The "target" argument must be one of type Buffer or Uint8Array. ' +
  8966. 'Received type ' + (typeof target)
  8967. )
  8968. }
  8969. if (start === undefined) {
  8970. start = 0
  8971. }
  8972. if (end === undefined) {
  8973. end = target ? target.length : 0
  8974. }
  8975. if (thisStart === undefined) {
  8976. thisStart = 0
  8977. }
  8978. if (thisEnd === undefined) {
  8979. thisEnd = this.length
  8980. }
  8981. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  8982. throw new RangeError('out of range index')
  8983. }
  8984. if (thisStart >= thisEnd && start >= end) {
  8985. return 0
  8986. }
  8987. if (thisStart >= thisEnd) {
  8988. return -1
  8989. }
  8990. if (start >= end) {
  8991. return 1
  8992. }
  8993. start >>>= 0
  8994. end >>>= 0
  8995. thisStart >>>= 0
  8996. thisEnd >>>= 0
  8997. if (this === target) return 0
  8998. var x = thisEnd - thisStart
  8999. var y = end - start
  9000. var len = Math.min(x, y)
  9001. var thisCopy = this.slice(thisStart, thisEnd)
  9002. var targetCopy = target.slice(start, end)
  9003. for (var i = 0; i < len; ++i) {
  9004. if (thisCopy[i] !== targetCopy[i]) {
  9005. x = thisCopy[i]
  9006. y = targetCopy[i]
  9007. break
  9008. }
  9009. }
  9010. if (x < y) return -1
  9011. if (y < x) return 1
  9012. return 0
  9013. }
  9014. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  9015. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  9016. //
  9017. // Arguments:
  9018. // - buffer - a Buffer to search
  9019. // - val - a string, Buffer, or number
  9020. // - byteOffset - an index into `buffer`; will be clamped to an int32
  9021. // - encoding - an optional encoding, relevant is val is a string
  9022. // - dir - true for indexOf, false for lastIndexOf
  9023. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  9024. // Empty buffer means no match
  9025. if (buffer.length === 0) return -1
  9026. // Normalize byteOffset
  9027. if (typeof byteOffset === 'string') {
  9028. encoding = byteOffset
  9029. byteOffset = 0
  9030. } else if (byteOffset > 0x7fffffff) {
  9031. byteOffset = 0x7fffffff
  9032. } else if (byteOffset < -0x80000000) {
  9033. byteOffset = -0x80000000
  9034. }
  9035. byteOffset = +byteOffset // Coerce to Number.
  9036. if (numberIsNaN(byteOffset)) {
  9037. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  9038. byteOffset = dir ? 0 : (buffer.length - 1)
  9039. }
  9040. // Normalize byteOffset: negative offsets start from the end of the buffer
  9041. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  9042. if (byteOffset >= buffer.length) {
  9043. if (dir) return -1
  9044. else byteOffset = buffer.length - 1
  9045. } else if (byteOffset < 0) {
  9046. if (dir) byteOffset = 0
  9047. else return -1
  9048. }
  9049. // Normalize val
  9050. if (typeof val === 'string') {
  9051. val = Buffer.from(val, encoding)
  9052. }
  9053. // Finally, search either indexOf (if dir is true) or lastIndexOf
  9054. if (Buffer.isBuffer(val)) {
  9055. // Special case: looking for empty string/buffer always fails
  9056. if (val.length === 0) {
  9057. return -1
  9058. }
  9059. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  9060. } else if (typeof val === 'number') {
  9061. val = val & 0xFF // Search for a byte value [0-255]
  9062. if (typeof Uint8Array.prototype.indexOf === 'function') {
  9063. if (dir) {
  9064. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  9065. } else {
  9066. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  9067. }
  9068. }
  9069. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  9070. }
  9071. throw new TypeError('val must be string, number or Buffer')
  9072. }
  9073. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  9074. var indexSize = 1
  9075. var arrLength = arr.length
  9076. var valLength = val.length
  9077. if (encoding !== undefined) {
  9078. encoding = String(encoding).toLowerCase()
  9079. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  9080. encoding === 'utf16le' || encoding === 'utf-16le') {
  9081. if (arr.length < 2 || val.length < 2) {
  9082. return -1
  9083. }
  9084. indexSize = 2
  9085. arrLength /= 2
  9086. valLength /= 2
  9087. byteOffset /= 2
  9088. }
  9089. }
  9090. function read (buf, i) {
  9091. if (indexSize === 1) {
  9092. return buf[i]
  9093. } else {
  9094. return buf.readUInt16BE(i * indexSize)
  9095. }
  9096. }
  9097. var i
  9098. if (dir) {
  9099. var foundIndex = -1
  9100. for (i = byteOffset; i < arrLength; i++) {
  9101. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  9102. if (foundIndex === -1) foundIndex = i
  9103. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  9104. } else {
  9105. if (foundIndex !== -1) i -= i - foundIndex
  9106. foundIndex = -1
  9107. }
  9108. }
  9109. } else {
  9110. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  9111. for (i = byteOffset; i >= 0; i--) {
  9112. var found = true
  9113. for (var j = 0; j < valLength; j++) {
  9114. if (read(arr, i + j) !== read(val, j)) {
  9115. found = false
  9116. break
  9117. }
  9118. }
  9119. if (found) return i
  9120. }
  9121. }
  9122. return -1
  9123. }
  9124. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  9125. return this.indexOf(val, byteOffset, encoding) !== -1
  9126. }
  9127. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  9128. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  9129. }
  9130. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  9131. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  9132. }
  9133. function hexWrite (buf, string, offset, length) {
  9134. offset = Number(offset) || 0
  9135. var remaining = buf.length - offset
  9136. if (!length) {
  9137. length = remaining
  9138. } else {
  9139. length = Number(length)
  9140. if (length > remaining) {
  9141. length = remaining
  9142. }
  9143. }
  9144. var strLen = string.length
  9145. if (length > strLen / 2) {
  9146. length = strLen / 2
  9147. }
  9148. for (var i = 0; i < length; ++i) {
  9149. var parsed = parseInt(string.substr(i * 2, 2), 16)
  9150. if (numberIsNaN(parsed)) return i
  9151. buf[offset + i] = parsed
  9152. }
  9153. return i
  9154. }
  9155. function utf8Write (buf, string, offset, length) {
  9156. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  9157. }
  9158. function asciiWrite (buf, string, offset, length) {
  9159. return blitBuffer(asciiToBytes(string), buf, offset, length)
  9160. }
  9161. function latin1Write (buf, string, offset, length) {
  9162. return asciiWrite(buf, string, offset, length)
  9163. }
  9164. function base64Write (buf, string, offset, length) {
  9165. return blitBuffer(base64ToBytes(string), buf, offset, length)
  9166. }
  9167. function ucs2Write (buf, string, offset, length) {
  9168. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  9169. }
  9170. Buffer.prototype.write = function write (string, offset, length, encoding) {
  9171. // Buffer#write(string)
  9172. if (offset === undefined) {
  9173. encoding = 'utf8'
  9174. length = this.length
  9175. offset = 0
  9176. // Buffer#write(string, encoding)
  9177. } else if (length === undefined && typeof offset === 'string') {
  9178. encoding = offset
  9179. length = this.length
  9180. offset = 0
  9181. // Buffer#write(string, offset[, length][, encoding])
  9182. } else if (isFinite(offset)) {
  9183. offset = offset >>> 0
  9184. if (isFinite(length)) {
  9185. length = length >>> 0
  9186. if (encoding === undefined) encoding = 'utf8'
  9187. } else {
  9188. encoding = length
  9189. length = undefined
  9190. }
  9191. } else {
  9192. throw new Error(
  9193. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  9194. )
  9195. }
  9196. var remaining = this.length - offset
  9197. if (length === undefined || length > remaining) length = remaining
  9198. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  9199. throw new RangeError('Attempt to write outside buffer bounds')
  9200. }
  9201. if (!encoding) encoding = 'utf8'
  9202. var loweredCase = false
  9203. for (;;) {
  9204. switch (encoding) {
  9205. case 'hex':
  9206. return hexWrite(this, string, offset, length)
  9207. case 'utf8':
  9208. case 'utf-8':
  9209. return utf8Write(this, string, offset, length)
  9210. case 'ascii':
  9211. return asciiWrite(this, string, offset, length)
  9212. case 'latin1':
  9213. case 'binary':
  9214. return latin1Write(this, string, offset, length)
  9215. case 'base64':
  9216. // Warning: maxLength not taken into account in base64Write
  9217. return base64Write(this, string, offset, length)
  9218. case 'ucs2':
  9219. case 'ucs-2':
  9220. case 'utf16le':
  9221. case 'utf-16le':
  9222. return ucs2Write(this, string, offset, length)
  9223. default:
  9224. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  9225. encoding = ('' + encoding).toLowerCase()
  9226. loweredCase = true
  9227. }
  9228. }
  9229. }
  9230. Buffer.prototype.toJSON = function toJSON () {
  9231. return {
  9232. type: 'Buffer',
  9233. data: Array.prototype.slice.call(this._arr || this, 0)
  9234. }
  9235. }
  9236. function base64Slice (buf, start, end) {
  9237. if (start === 0 && end === buf.length) {
  9238. return base64.fromByteArray(buf)
  9239. } else {
  9240. return base64.fromByteArray(buf.slice(start, end))
  9241. }
  9242. }
  9243. function utf8Slice (buf, start, end) {
  9244. end = Math.min(buf.length, end)
  9245. var res = []
  9246. var i = start
  9247. while (i < end) {
  9248. var firstByte = buf[i]
  9249. var codePoint = null
  9250. var bytesPerSequence = (firstByte > 0xEF) ? 4
  9251. : (firstByte > 0xDF) ? 3
  9252. : (firstByte > 0xBF) ? 2
  9253. : 1
  9254. if (i + bytesPerSequence <= end) {
  9255. var secondByte, thirdByte, fourthByte, tempCodePoint
  9256. switch (bytesPerSequence) {
  9257. case 1:
  9258. if (firstByte < 0x80) {
  9259. codePoint = firstByte
  9260. }
  9261. break
  9262. case 2:
  9263. secondByte = buf[i + 1]
  9264. if ((secondByte & 0xC0) === 0x80) {
  9265. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  9266. if (tempCodePoint > 0x7F) {
  9267. codePoint = tempCodePoint
  9268. }
  9269. }
  9270. break
  9271. case 3:
  9272. secondByte = buf[i + 1]
  9273. thirdByte = buf[i + 2]
  9274. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  9275. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  9276. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  9277. codePoint = tempCodePoint
  9278. }
  9279. }
  9280. break
  9281. case 4:
  9282. secondByte = buf[i + 1]
  9283. thirdByte = buf[i + 2]
  9284. fourthByte = buf[i + 3]
  9285. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  9286. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  9287. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  9288. codePoint = tempCodePoint
  9289. }
  9290. }
  9291. }
  9292. }
  9293. if (codePoint === null) {
  9294. // we did not generate a valid codePoint so insert a
  9295. // replacement char (U+FFFD) and advance only 1 byte
  9296. codePoint = 0xFFFD
  9297. bytesPerSequence = 1
  9298. } else if (codePoint > 0xFFFF) {
  9299. // encode to utf16 (surrogate pair dance)
  9300. codePoint -= 0x10000
  9301. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  9302. codePoint = 0xDC00 | codePoint & 0x3FF
  9303. }
  9304. res.push(codePoint)
  9305. i += bytesPerSequence
  9306. }
  9307. return decodeCodePointsArray(res)
  9308. }
  9309. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  9310. // the lowest limit is Chrome, with 0x10000 args.
  9311. // We go 1 magnitude less, for safety
  9312. var MAX_ARGUMENTS_LENGTH = 0x1000
  9313. function decodeCodePointsArray (codePoints) {
  9314. var len = codePoints.length
  9315. if (len <= MAX_ARGUMENTS_LENGTH) {
  9316. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  9317. }
  9318. // Decode in chunks to avoid "call stack size exceeded".
  9319. var res = ''
  9320. var i = 0
  9321. while (i < len) {
  9322. res += String.fromCharCode.apply(
  9323. String,
  9324. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  9325. )
  9326. }
  9327. return res
  9328. }
  9329. function asciiSlice (buf, start, end) {
  9330. var ret = ''
  9331. end = Math.min(buf.length, end)
  9332. for (var i = start; i < end; ++i) {
  9333. ret += String.fromCharCode(buf[i] & 0x7F)
  9334. }
  9335. return ret
  9336. }
  9337. function latin1Slice (buf, start, end) {
  9338. var ret = ''
  9339. end = Math.min(buf.length, end)
  9340. for (var i = start; i < end; ++i) {
  9341. ret += String.fromCharCode(buf[i])
  9342. }
  9343. return ret
  9344. }
  9345. function hexSlice (buf, start, end) {
  9346. var len = buf.length
  9347. if (!start || start < 0) start = 0
  9348. if (!end || end < 0 || end > len) end = len
  9349. var out = ''
  9350. for (var i = start; i < end; ++i) {
  9351. out += toHex(buf[i])
  9352. }
  9353. return out
  9354. }
  9355. function utf16leSlice (buf, start, end) {
  9356. var bytes = buf.slice(start, end)
  9357. var res = ''
  9358. for (var i = 0; i < bytes.length; i += 2) {
  9359. res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
  9360. }
  9361. return res
  9362. }
  9363. Buffer.prototype.slice = function slice (start, end) {
  9364. var len = this.length
  9365. start = ~~start
  9366. end = end === undefined ? len : ~~end
  9367. if (start < 0) {
  9368. start += len
  9369. if (start < 0) start = 0
  9370. } else if (start > len) {
  9371. start = len
  9372. }
  9373. if (end < 0) {
  9374. end += len
  9375. if (end < 0) end = 0
  9376. } else if (end > len) {
  9377. end = len
  9378. }
  9379. if (end < start) end = start
  9380. var newBuf = this.subarray(start, end)
  9381. // Return an augmented `Uint8Array` instance
  9382. newBuf.__proto__ = Buffer.prototype
  9383. return newBuf
  9384. }
  9385. /*
  9386. * Need to make sure that buffer isn't trying to write out of bounds.
  9387. */
  9388. function checkOffset (offset, ext, length) {
  9389. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  9390. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  9391. }
  9392. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  9393. offset = offset >>> 0
  9394. byteLength = byteLength >>> 0
  9395. if (!noAssert) checkOffset(offset, byteLength, this.length)
  9396. var val = this[offset]
  9397. var mul = 1
  9398. var i = 0
  9399. while (++i < byteLength && (mul *= 0x100)) {
  9400. val += this[offset + i] * mul
  9401. }
  9402. return val
  9403. }
  9404. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  9405. offset = offset >>> 0
  9406. byteLength = byteLength >>> 0
  9407. if (!noAssert) {
  9408. checkOffset(offset, byteLength, this.length)
  9409. }
  9410. var val = this[offset + --byteLength]
  9411. var mul = 1
  9412. while (byteLength > 0 && (mul *= 0x100)) {
  9413. val += this[offset + --byteLength] * mul
  9414. }
  9415. return val
  9416. }
  9417. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  9418. offset = offset >>> 0
  9419. if (!noAssert) checkOffset(offset, 1, this.length)
  9420. return this[offset]
  9421. }
  9422. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  9423. offset = offset >>> 0
  9424. if (!noAssert) checkOffset(offset, 2, this.length)
  9425. return this[offset] | (this[offset + 1] << 8)
  9426. }
  9427. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  9428. offset = offset >>> 0
  9429. if (!noAssert) checkOffset(offset, 2, this.length)
  9430. return (this[offset] << 8) | this[offset + 1]
  9431. }
  9432. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  9433. offset = offset >>> 0
  9434. if (!noAssert) checkOffset(offset, 4, this.length)
  9435. return ((this[offset]) |
  9436. (this[offset + 1] << 8) |
  9437. (this[offset + 2] << 16)) +
  9438. (this[offset + 3] * 0x1000000)
  9439. }
  9440. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  9441. offset = offset >>> 0
  9442. if (!noAssert) checkOffset(offset, 4, this.length)
  9443. return (this[offset] * 0x1000000) +
  9444. ((this[offset + 1] << 16) |
  9445. (this[offset + 2] << 8) |
  9446. this[offset + 3])
  9447. }
  9448. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  9449. offset = offset >>> 0
  9450. byteLength = byteLength >>> 0
  9451. if (!noAssert) checkOffset(offset, byteLength, this.length)
  9452. var val = this[offset]
  9453. var mul = 1
  9454. var i = 0
  9455. while (++i < byteLength && (mul *= 0x100)) {
  9456. val += this[offset + i] * mul
  9457. }
  9458. mul *= 0x80
  9459. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  9460. return val
  9461. }
  9462. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  9463. offset = offset >>> 0
  9464. byteLength = byteLength >>> 0
  9465. if (!noAssert) checkOffset(offset, byteLength, this.length)
  9466. var i = byteLength
  9467. var mul = 1
  9468. var val = this[offset + --i]
  9469. while (i > 0 && (mul *= 0x100)) {
  9470. val += this[offset + --i] * mul
  9471. }
  9472. mul *= 0x80
  9473. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  9474. return val
  9475. }
  9476. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  9477. offset = offset >>> 0
  9478. if (!noAssert) checkOffset(offset, 1, this.length)
  9479. if (!(this[offset] & 0x80)) return (this[offset])
  9480. return ((0xff - this[offset] + 1) * -1)
  9481. }
  9482. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  9483. offset = offset >>> 0
  9484. if (!noAssert) checkOffset(offset, 2, this.length)
  9485. var val = this[offset] | (this[offset + 1] << 8)
  9486. return (val & 0x8000) ? val | 0xFFFF0000 : val
  9487. }
  9488. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  9489. offset = offset >>> 0
  9490. if (!noAssert) checkOffset(offset, 2, this.length)
  9491. var val = this[offset + 1] | (this[offset] << 8)
  9492. return (val & 0x8000) ? val | 0xFFFF0000 : val
  9493. }
  9494. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  9495. offset = offset >>> 0
  9496. if (!noAssert) checkOffset(offset, 4, this.length)
  9497. return (this[offset]) |
  9498. (this[offset + 1] << 8) |
  9499. (this[offset + 2] << 16) |
  9500. (this[offset + 3] << 24)
  9501. }
  9502. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  9503. offset = offset >>> 0
  9504. if (!noAssert) checkOffset(offset, 4, this.length)
  9505. return (this[offset] << 24) |
  9506. (this[offset + 1] << 16) |
  9507. (this[offset + 2] << 8) |
  9508. (this[offset + 3])
  9509. }
  9510. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  9511. offset = offset >>> 0
  9512. if (!noAssert) checkOffset(offset, 4, this.length)
  9513. return ieee754.read(this, offset, true, 23, 4)
  9514. }
  9515. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  9516. offset = offset >>> 0
  9517. if (!noAssert) checkOffset(offset, 4, this.length)
  9518. return ieee754.read(this, offset, false, 23, 4)
  9519. }
  9520. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  9521. offset = offset >>> 0
  9522. if (!noAssert) checkOffset(offset, 8, this.length)
  9523. return ieee754.read(this, offset, true, 52, 8)
  9524. }
  9525. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  9526. offset = offset >>> 0
  9527. if (!noAssert) checkOffset(offset, 8, this.length)
  9528. return ieee754.read(this, offset, false, 52, 8)
  9529. }
  9530. function checkInt (buf, value, offset, ext, max, min) {
  9531. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  9532. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  9533. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  9534. }
  9535. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  9536. value = +value
  9537. offset = offset >>> 0
  9538. byteLength = byteLength >>> 0
  9539. if (!noAssert) {
  9540. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  9541. checkInt(this, value, offset, byteLength, maxBytes, 0)
  9542. }
  9543. var mul = 1
  9544. var i = 0
  9545. this[offset] = value & 0xFF
  9546. while (++i < byteLength && (mul *= 0x100)) {
  9547. this[offset + i] = (value / mul) & 0xFF
  9548. }
  9549. return offset + byteLength
  9550. }
  9551. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  9552. value = +value
  9553. offset = offset >>> 0
  9554. byteLength = byteLength >>> 0
  9555. if (!noAssert) {
  9556. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  9557. checkInt(this, value, offset, byteLength, maxBytes, 0)
  9558. }
  9559. var i = byteLength - 1
  9560. var mul = 1
  9561. this[offset + i] = value & 0xFF
  9562. while (--i >= 0 && (mul *= 0x100)) {
  9563. this[offset + i] = (value / mul) & 0xFF
  9564. }
  9565. return offset + byteLength
  9566. }
  9567. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  9568. value = +value
  9569. offset = offset >>> 0
  9570. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  9571. this[offset] = (value & 0xff)
  9572. return offset + 1
  9573. }
  9574. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  9575. value = +value
  9576. offset = offset >>> 0
  9577. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  9578. this[offset] = (value & 0xff)
  9579. this[offset + 1] = (value >>> 8)
  9580. return offset + 2
  9581. }
  9582. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  9583. value = +value
  9584. offset = offset >>> 0
  9585. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  9586. this[offset] = (value >>> 8)
  9587. this[offset + 1] = (value & 0xff)
  9588. return offset + 2
  9589. }
  9590. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  9591. value = +value
  9592. offset = offset >>> 0
  9593. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  9594. this[offset + 3] = (value >>> 24)
  9595. this[offset + 2] = (value >>> 16)
  9596. this[offset + 1] = (value >>> 8)
  9597. this[offset] = (value & 0xff)
  9598. return offset + 4
  9599. }
  9600. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  9601. value = +value
  9602. offset = offset >>> 0
  9603. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  9604. this[offset] = (value >>> 24)
  9605. this[offset + 1] = (value >>> 16)
  9606. this[offset + 2] = (value >>> 8)
  9607. this[offset + 3] = (value & 0xff)
  9608. return offset + 4
  9609. }
  9610. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  9611. value = +value
  9612. offset = offset >>> 0
  9613. if (!noAssert) {
  9614. var limit = Math.pow(2, (8 * byteLength) - 1)
  9615. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  9616. }
  9617. var i = 0
  9618. var mul = 1
  9619. var sub = 0
  9620. this[offset] = value & 0xFF
  9621. while (++i < byteLength && (mul *= 0x100)) {
  9622. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  9623. sub = 1
  9624. }
  9625. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  9626. }
  9627. return offset + byteLength
  9628. }
  9629. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  9630. value = +value
  9631. offset = offset >>> 0
  9632. if (!noAssert) {
  9633. var limit = Math.pow(2, (8 * byteLength) - 1)
  9634. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  9635. }
  9636. var i = byteLength - 1
  9637. var mul = 1
  9638. var sub = 0
  9639. this[offset + i] = value & 0xFF
  9640. while (--i >= 0 && (mul *= 0x100)) {
  9641. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  9642. sub = 1
  9643. }
  9644. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  9645. }
  9646. return offset + byteLength
  9647. }
  9648. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  9649. value = +value
  9650. offset = offset >>> 0
  9651. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  9652. if (value < 0) value = 0xff + value + 1
  9653. this[offset] = (value & 0xff)
  9654. return offset + 1
  9655. }
  9656. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  9657. value = +value
  9658. offset = offset >>> 0
  9659. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  9660. this[offset] = (value & 0xff)
  9661. this[offset + 1] = (value >>> 8)
  9662. return offset + 2
  9663. }
  9664. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  9665. value = +value
  9666. offset = offset >>> 0
  9667. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  9668. this[offset] = (value >>> 8)
  9669. this[offset + 1] = (value & 0xff)
  9670. return offset + 2
  9671. }
  9672. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  9673. value = +value
  9674. offset = offset >>> 0
  9675. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  9676. this[offset] = (value & 0xff)
  9677. this[offset + 1] = (value >>> 8)
  9678. this[offset + 2] = (value >>> 16)
  9679. this[offset + 3] = (value >>> 24)
  9680. return offset + 4
  9681. }
  9682. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  9683. value = +value
  9684. offset = offset >>> 0
  9685. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  9686. if (value < 0) value = 0xffffffff + value + 1
  9687. this[offset] = (value >>> 24)
  9688. this[offset + 1] = (value >>> 16)
  9689. this[offset + 2] = (value >>> 8)
  9690. this[offset + 3] = (value & 0xff)
  9691. return offset + 4
  9692. }
  9693. function checkIEEE754 (buf, value, offset, ext, max, min) {
  9694. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  9695. if (offset < 0) throw new RangeError('Index out of range')
  9696. }
  9697. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  9698. value = +value
  9699. offset = offset >>> 0
  9700. if (!noAssert) {
  9701. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  9702. }
  9703. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  9704. return offset + 4
  9705. }
  9706. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  9707. return writeFloat(this, value, offset, true, noAssert)
  9708. }
  9709. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  9710. return writeFloat(this, value, offset, false, noAssert)
  9711. }
  9712. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  9713. value = +value
  9714. offset = offset >>> 0
  9715. if (!noAssert) {
  9716. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  9717. }
  9718. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  9719. return offset + 8
  9720. }
  9721. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  9722. return writeDouble(this, value, offset, true, noAssert)
  9723. }
  9724. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  9725. return writeDouble(this, value, offset, false, noAssert)
  9726. }
  9727. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  9728. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  9729. if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
  9730. if (!start) start = 0
  9731. if (!end && end !== 0) end = this.length
  9732. if (targetStart >= target.length) targetStart = target.length
  9733. if (!targetStart) targetStart = 0
  9734. if (end > 0 && end < start) end = start
  9735. // Copy 0 bytes; we're done
  9736. if (end === start) return 0
  9737. if (target.length === 0 || this.length === 0) return 0
  9738. // Fatal error conditions
  9739. if (targetStart < 0) {
  9740. throw new RangeError('targetStart out of bounds')
  9741. }
  9742. if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
  9743. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  9744. // Are we oob?
  9745. if (end > this.length) end = this.length
  9746. if (target.length - targetStart < end - start) {
  9747. end = target.length - targetStart + start
  9748. }
  9749. var len = end - start
  9750. if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
  9751. // Use built-in when available, missing from IE11
  9752. this.copyWithin(targetStart, start, end)
  9753. } else if (this === target && start < targetStart && targetStart < end) {
  9754. // descending copy from end
  9755. for (var i = len - 1; i >= 0; --i) {
  9756. target[i + targetStart] = this[i + start]
  9757. }
  9758. } else {
  9759. Uint8Array.prototype.set.call(
  9760. target,
  9761. this.subarray(start, end),
  9762. targetStart
  9763. )
  9764. }
  9765. return len
  9766. }
  9767. // Usage:
  9768. // buffer.fill(number[, offset[, end]])
  9769. // buffer.fill(buffer[, offset[, end]])
  9770. // buffer.fill(string[, offset[, end]][, encoding])
  9771. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  9772. // Handle string cases:
  9773. if (typeof val === 'string') {
  9774. if (typeof start === 'string') {
  9775. encoding = start
  9776. start = 0
  9777. end = this.length
  9778. } else if (typeof end === 'string') {
  9779. encoding = end
  9780. end = this.length
  9781. }
  9782. if (encoding !== undefined && typeof encoding !== 'string') {
  9783. throw new TypeError('encoding must be a string')
  9784. }
  9785. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  9786. throw new TypeError('Unknown encoding: ' + encoding)
  9787. }
  9788. if (val.length === 1) {
  9789. var code = val.charCodeAt(0)
  9790. if ((encoding === 'utf8' && code < 128) ||
  9791. encoding === 'latin1') {
  9792. // Fast path: If `val` fits into a single byte, use that numeric value.
  9793. val = code
  9794. }
  9795. }
  9796. } else if (typeof val === 'number') {
  9797. val = val & 255
  9798. }
  9799. // Invalid ranges are not set to a default, so can range check early.
  9800. if (start < 0 || this.length < start || this.length < end) {
  9801. throw new RangeError('Out of range index')
  9802. }
  9803. if (end <= start) {
  9804. return this
  9805. }
  9806. start = start >>> 0
  9807. end = end === undefined ? this.length : end >>> 0
  9808. if (!val) val = 0
  9809. var i
  9810. if (typeof val === 'number') {
  9811. for (i = start; i < end; ++i) {
  9812. this[i] = val
  9813. }
  9814. } else {
  9815. var bytes = Buffer.isBuffer(val)
  9816. ? val
  9817. : Buffer.from(val, encoding)
  9818. var len = bytes.length
  9819. if (len === 0) {
  9820. throw new TypeError('The value "' + val +
  9821. '" is invalid for argument "value"')
  9822. }
  9823. for (i = 0; i < end - start; ++i) {
  9824. this[i + start] = bytes[i % len]
  9825. }
  9826. }
  9827. return this
  9828. }
  9829. // HELPER FUNCTIONS
  9830. // ================
  9831. var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
  9832. function base64clean (str) {
  9833. // Node takes equal signs as end of the Base64 encoding
  9834. str = str.split('=')[0]
  9835. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  9836. str = str.trim().replace(INVALID_BASE64_RE, '')
  9837. // Node converts strings with length < 2 to ''
  9838. if (str.length < 2) return ''
  9839. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  9840. while (str.length % 4 !== 0) {
  9841. str = str + '='
  9842. }
  9843. return str
  9844. }
  9845. function toHex (n) {
  9846. if (n < 16) return '0' + n.toString(16)
  9847. return n.toString(16)
  9848. }
  9849. function utf8ToBytes (string, units) {
  9850. units = units || Infinity
  9851. var codePoint
  9852. var length = string.length
  9853. var leadSurrogate = null
  9854. var bytes = []
  9855. for (var i = 0; i < length; ++i) {
  9856. codePoint = string.charCodeAt(i)
  9857. // is surrogate component
  9858. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  9859. // last char was a lead
  9860. if (!leadSurrogate) {
  9861. // no lead yet
  9862. if (codePoint > 0xDBFF) {
  9863. // unexpected trail
  9864. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  9865. continue
  9866. } else if (i + 1 === length) {
  9867. // unpaired lead
  9868. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  9869. continue
  9870. }
  9871. // valid lead
  9872. leadSurrogate = codePoint
  9873. continue
  9874. }
  9875. // 2 leads in a row
  9876. if (codePoint < 0xDC00) {
  9877. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  9878. leadSurrogate = codePoint
  9879. continue
  9880. }
  9881. // valid surrogate pair
  9882. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  9883. } else if (leadSurrogate) {
  9884. // valid bmp char, but last char was a lead
  9885. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  9886. }
  9887. leadSurrogate = null
  9888. // encode utf8
  9889. if (codePoint < 0x80) {
  9890. if ((units -= 1) < 0) break
  9891. bytes.push(codePoint)
  9892. } else if (codePoint < 0x800) {
  9893. if ((units -= 2) < 0) break
  9894. bytes.push(
  9895. codePoint >> 0x6 | 0xC0,
  9896. codePoint & 0x3F | 0x80
  9897. )
  9898. } else if (codePoint < 0x10000) {
  9899. if ((units -= 3) < 0) break
  9900. bytes.push(
  9901. codePoint >> 0xC | 0xE0,
  9902. codePoint >> 0x6 & 0x3F | 0x80,
  9903. codePoint & 0x3F | 0x80
  9904. )
  9905. } else if (codePoint < 0x110000) {
  9906. if ((units -= 4) < 0) break
  9907. bytes.push(
  9908. codePoint >> 0x12 | 0xF0,
  9909. codePoint >> 0xC & 0x3F | 0x80,
  9910. codePoint >> 0x6 & 0x3F | 0x80,
  9911. codePoint & 0x3F | 0x80
  9912. )
  9913. } else {
  9914. throw new Error('Invalid code point')
  9915. }
  9916. }
  9917. return bytes
  9918. }
  9919. function asciiToBytes (str) {
  9920. var byteArray = []
  9921. for (var i = 0; i < str.length; ++i) {
  9922. // Node's code seems to be doing this and not & 0x7F..
  9923. byteArray.push(str.charCodeAt(i) & 0xFF)
  9924. }
  9925. return byteArray
  9926. }
  9927. function utf16leToBytes (str, units) {
  9928. var c, hi, lo
  9929. var byteArray = []
  9930. for (var i = 0; i < str.length; ++i) {
  9931. if ((units -= 2) < 0) break
  9932. c = str.charCodeAt(i)
  9933. hi = c >> 8
  9934. lo = c % 256
  9935. byteArray.push(lo)
  9936. byteArray.push(hi)
  9937. }
  9938. return byteArray
  9939. }
  9940. function base64ToBytes (str) {
  9941. return base64.toByteArray(base64clean(str))
  9942. }
  9943. function blitBuffer (src, dst, offset, length) {
  9944. for (var i = 0; i < length; ++i) {
  9945. if ((i + offset >= dst.length) || (i >= src.length)) break
  9946. dst[i + offset] = src[i]
  9947. }
  9948. return i
  9949. }
  9950. // ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
  9951. // the `instanceof` check but they should be treated as of that type.
  9952. // See: https://github.com/feross/buffer/issues/166
  9953. function isInstance (obj, type) {
  9954. return obj instanceof type ||
  9955. (obj != null && obj.constructor != null && obj.constructor.name != null &&
  9956. obj.constructor.name === type.name)
  9957. }
  9958. function numberIsNaN (obj) {
  9959. // For IE11 support
  9960. return obj !== obj // eslint-disable-line no-self-compare
  9961. }
  9962. }).call(this)}).call(this,require("buffer").Buffer)
  9963. },{"base64-js":87,"buffer":90,"ieee754":357}],91:[function(require,module,exports){
  9964. module.exports = {
  9965. "100": "Continue",
  9966. "101": "Switching Protocols",
  9967. "102": "Processing",
  9968. "200": "OK",
  9969. "201": "Created",
  9970. "202": "Accepted",
  9971. "203": "Non-Authoritative Information",
  9972. "204": "No Content",
  9973. "205": "Reset Content",
  9974. "206": "Partial Content",
  9975. "207": "Multi-Status",
  9976. "208": "Already Reported",
  9977. "226": "IM Used",
  9978. "300": "Multiple Choices",
  9979. "301": "Moved Permanently",
  9980. "302": "Found",
  9981. "303": "See Other",
  9982. "304": "Not Modified",
  9983. "305": "Use Proxy",
  9984. "307": "Temporary Redirect",
  9985. "308": "Permanent Redirect",
  9986. "400": "Bad Request",
  9987. "401": "Unauthorized",
  9988. "402": "Payment Required",
  9989. "403": "Forbidden",
  9990. "404": "Not Found",
  9991. "405": "Method Not Allowed",
  9992. "406": "Not Acceptable",
  9993. "407": "Proxy Authentication Required",
  9994. "408": "Request Timeout",
  9995. "409": "Conflict",
  9996. "410": "Gone",
  9997. "411": "Length Required",
  9998. "412": "Precondition Failed",
  9999. "413": "Payload Too Large",
  10000. "414": "URI Too Long",
  10001. "415": "Unsupported Media Type",
  10002. "416": "Range Not Satisfiable",
  10003. "417": "Expectation Failed",
  10004. "418": "I'm a teapot",
  10005. "421": "Misdirected Request",
  10006. "422": "Unprocessable Entity",
  10007. "423": "Locked",
  10008. "424": "Failed Dependency",
  10009. "425": "Unordered Collection",
  10010. "426": "Upgrade Required",
  10011. "428": "Precondition Required",
  10012. "429": "Too Many Requests",
  10013. "431": "Request Header Fields Too Large",
  10014. "451": "Unavailable For Legal Reasons",
  10015. "500": "Internal Server Error",
  10016. "501": "Not Implemented",
  10017. "502": "Bad Gateway",
  10018. "503": "Service Unavailable",
  10019. "504": "Gateway Timeout",
  10020. "505": "HTTP Version Not Supported",
  10021. "506": "Variant Also Negotiates",
  10022. "507": "Insufficient Storage",
  10023. "508": "Loop Detected",
  10024. "509": "Bandwidth Limit Exceeded",
  10025. "510": "Not Extended",
  10026. "511": "Network Authentication Required"
  10027. }
  10028. },{}],92:[function(require,module,exports){
  10029. 'use strict';
  10030. var GetIntrinsic = require('get-intrinsic');
  10031. var callBind = require('./');
  10032. var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
  10033. module.exports = function callBoundIntrinsic(name, allowMissing) {
  10034. var intrinsic = GetIntrinsic(name, !!allowMissing);
  10035. if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
  10036. return callBind(intrinsic);
  10037. }
  10038. return intrinsic;
  10039. };
  10040. },{"./":93,"get-intrinsic":348}],93:[function(require,module,exports){
  10041. 'use strict';
  10042. var bind = require('function-bind');
  10043. var GetIntrinsic = require('get-intrinsic');
  10044. var $apply = GetIntrinsic('%Function.prototype.apply%');
  10045. var $call = GetIntrinsic('%Function.prototype.call%');
  10046. var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
  10047. var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
  10048. var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
  10049. var $max = GetIntrinsic('%Math.max%');
  10050. if ($defineProperty) {
  10051. try {
  10052. $defineProperty({}, 'a', { value: 1 });
  10053. } catch (e) {
  10054. // IE 8 has a broken defineProperty
  10055. $defineProperty = null;
  10056. }
  10057. }
  10058. module.exports = function callBind(originalFunction) {
  10059. var func = $reflectApply(bind, $call, arguments);
  10060. if ($gOPD && $defineProperty) {
  10061. var desc = $gOPD(func, 'length');
  10062. if (desc.configurable) {
  10063. // original length, plus the receiver, minus any additional arguments (after the receiver)
  10064. $defineProperty(
  10065. func,
  10066. 'length',
  10067. { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
  10068. );
  10069. }
  10070. }
  10071. return func;
  10072. };
  10073. var applyBind = function applyBind() {
  10074. return $reflectApply(bind, $apply, arguments);
  10075. };
  10076. if ($defineProperty) {
  10077. $defineProperty(module.exports, 'apply', { value: applyBind });
  10078. } else {
  10079. module.exports.apply = applyBind;
  10080. }
  10081. },{"function-bind":347,"get-intrinsic":348}],94:[function(require,module,exports){
  10082. /*!
  10083. * copy-to - index.js
  10084. * Copyright(c) 2014 dead_horse <dead_horse@qq.com>
  10085. * MIT Licensed
  10086. */
  10087. 'use strict';
  10088. /**
  10089. * slice() reference.
  10090. */
  10091. var slice = Array.prototype.slice;
  10092. /**
  10093. * Expose copy
  10094. *
  10095. * ```
  10096. * copy({foo: 'nar', hello: 'copy'}).to({hello: 'world'});
  10097. * copy({foo: 'nar', hello: 'copy'}).toCover({hello: 'world'});
  10098. * ```
  10099. *
  10100. * @param {Object} src
  10101. * @return {Copy}
  10102. */
  10103. module.exports = Copy;
  10104. /**
  10105. * Copy
  10106. * @param {Object} src
  10107. * @param {Boolean} withAccess
  10108. */
  10109. function Copy(src, withAccess) {
  10110. if (!(this instanceof Copy)) return new Copy(src, withAccess);
  10111. this.src = src;
  10112. this._withAccess = withAccess;
  10113. }
  10114. /**
  10115. * copy properties include getter and setter
  10116. * @param {[type]} val [description]
  10117. * @return {[type]} [description]
  10118. */
  10119. Copy.prototype.withAccess = function (w) {
  10120. this._withAccess = w !== false;
  10121. return this;
  10122. };
  10123. /**
  10124. * pick keys in src
  10125. *
  10126. * @api: public
  10127. */
  10128. Copy.prototype.pick = function(keys) {
  10129. if (!Array.isArray(keys)) {
  10130. keys = slice.call(arguments);
  10131. }
  10132. if (keys.length) {
  10133. this.keys = keys;
  10134. }
  10135. return this;
  10136. };
  10137. /**
  10138. * copy src to target,
  10139. * do not cover any property target has
  10140. * @param {Object} to
  10141. *
  10142. * @api: public
  10143. */
  10144. Copy.prototype.to = function(to) {
  10145. to = to || {};
  10146. if (!this.src) return to;
  10147. var keys = this.keys || Object.keys(this.src);
  10148. if (!this._withAccess) {
  10149. for (var i = 0; i < keys.length; i++) {
  10150. key = keys[i];
  10151. if (to[key] !== undefined) continue;
  10152. to[key] = this.src[key];
  10153. }
  10154. return to;
  10155. }
  10156. for (var i = 0; i < keys.length; i++) {
  10157. var key = keys[i];
  10158. if (!notDefined(to, key)) continue;
  10159. var getter = this.src.__lookupGetter__(key);
  10160. var setter = this.src.__lookupSetter__(key);
  10161. if (getter) to.__defineGetter__(key, getter);
  10162. if (setter) to.__defineSetter__(key, setter);
  10163. if (!getter && !setter) {
  10164. to[key] = this.src[key];
  10165. }
  10166. }
  10167. return to;
  10168. };
  10169. /**
  10170. * copy src to target,
  10171. * override any property target has
  10172. * @param {Object} to
  10173. *
  10174. * @api: public
  10175. */
  10176. Copy.prototype.toCover = function(to) {
  10177. var keys = this.keys || Object.keys(this.src);
  10178. for (var i = 0; i < keys.length; i++) {
  10179. var key = keys[i];
  10180. delete to[key];
  10181. var getter = this.src.__lookupGetter__(key);
  10182. var setter = this.src.__lookupSetter__(key);
  10183. if (getter) to.__defineGetter__(key, getter);
  10184. if (setter) to.__defineSetter__(key, setter);
  10185. if (!getter && !setter) {
  10186. to[key] = this.src[key];
  10187. }
  10188. }
  10189. };
  10190. Copy.prototype.override = Copy.prototype.toCover;
  10191. /**
  10192. * append another object to src
  10193. * @param {Obj} obj
  10194. * @return {Copy}
  10195. */
  10196. Copy.prototype.and = function (obj) {
  10197. var src = {};
  10198. this.to(src);
  10199. this.src = obj;
  10200. this.to(src);
  10201. this.src = src;
  10202. return this;
  10203. };
  10204. /**
  10205. * check obj[key] if not defiend
  10206. * @param {Object} obj
  10207. * @param {String} key
  10208. * @return {Boolean}
  10209. */
  10210. function notDefined(obj, key) {
  10211. return obj[key] === undefined
  10212. && obj.__lookupGetter__(key) === undefined
  10213. && obj.__lookupSetter__(key) === undefined;
  10214. }
  10215. },{}],95:[function(require,module,exports){
  10216. var global = require('../internals/global');
  10217. var isCallable = require('../internals/is-callable');
  10218. var tryToString = require('../internals/try-to-string');
  10219. var TypeError = global.TypeError;
  10220. // `Assert: IsCallable(argument) is true`
  10221. module.exports = function (argument) {
  10222. if (isCallable(argument)) return argument;
  10223. throw TypeError(tryToString(argument) + ' is not a function');
  10224. };
  10225. },{"../internals/global":163,"../internals/is-callable":176,"../internals/try-to-string":257}],96:[function(require,module,exports){
  10226. var global = require('../internals/global');
  10227. var isConstructor = require('../internals/is-constructor');
  10228. var tryToString = require('../internals/try-to-string');
  10229. var TypeError = global.TypeError;
  10230. // `Assert: IsConstructor(argument) is true`
  10231. module.exports = function (argument) {
  10232. if (isConstructor(argument)) return argument;
  10233. throw TypeError(tryToString(argument) + ' is not a constructor');
  10234. };
  10235. },{"../internals/global":163,"../internals/is-constructor":177,"../internals/try-to-string":257}],97:[function(require,module,exports){
  10236. var global = require('../internals/global');
  10237. var isCallable = require('../internals/is-callable');
  10238. var String = global.String;
  10239. var TypeError = global.TypeError;
  10240. module.exports = function (argument) {
  10241. if (typeof argument == 'object' || isCallable(argument)) return argument;
  10242. throw TypeError("Can't set " + String(argument) + ' as a prototype');
  10243. };
  10244. },{"../internals/global":163,"../internals/is-callable":176}],98:[function(require,module,exports){
  10245. var wellKnownSymbol = require('../internals/well-known-symbol');
  10246. var create = require('../internals/object-create');
  10247. var definePropertyModule = require('../internals/object-define-property');
  10248. var UNSCOPABLES = wellKnownSymbol('unscopables');
  10249. var ArrayPrototype = Array.prototype;
  10250. // Array.prototype[@@unscopables]
  10251. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  10252. if (ArrayPrototype[UNSCOPABLES] == undefined) {
  10253. definePropertyModule.f(ArrayPrototype, UNSCOPABLES, {
  10254. configurable: true,
  10255. value: create(null)
  10256. });
  10257. }
  10258. // add a key to Array.prototype[@@unscopables]
  10259. module.exports = function (key) {
  10260. ArrayPrototype[UNSCOPABLES][key] = true;
  10261. };
  10262. },{"../internals/object-create":196,"../internals/object-define-property":198,"../internals/well-known-symbol":268}],99:[function(require,module,exports){
  10263. 'use strict';
  10264. var charAt = require('../internals/string-multibyte').charAt;
  10265. // `AdvanceStringIndex` abstract operation
  10266. // https://tc39.es/ecma262/#sec-advancestringindex
  10267. module.exports = function (S, index, unicode) {
  10268. return index + (unicode ? charAt(S, index).length : 1);
  10269. };
  10270. },{"../internals/string-multibyte":239}],100:[function(require,module,exports){
  10271. var global = require('../internals/global');
  10272. var isPrototypeOf = require('../internals/object-is-prototype-of');
  10273. var TypeError = global.TypeError;
  10274. module.exports = function (it, Prototype) {
  10275. if (isPrototypeOf(Prototype, it)) return it;
  10276. throw TypeError('Incorrect invocation');
  10277. };
  10278. },{"../internals/global":163,"../internals/object-is-prototype-of":204}],101:[function(require,module,exports){
  10279. var global = require('../internals/global');
  10280. var isObject = require('../internals/is-object');
  10281. var String = global.String;
  10282. var TypeError = global.TypeError;
  10283. // `Assert: Type(argument) is Object`
  10284. module.exports = function (argument) {
  10285. if (isObject(argument)) return argument;
  10286. throw TypeError(String(argument) + ' is not an object');
  10287. };
  10288. },{"../internals/global":163,"../internals/is-object":180}],102:[function(require,module,exports){
  10289. // eslint-disable-next-line es-x/no-typed-arrays -- safe
  10290. module.exports = typeof ArrayBuffer != 'undefined' && typeof DataView != 'undefined';
  10291. },{}],103:[function(require,module,exports){
  10292. 'use strict';
  10293. var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-native');
  10294. var DESCRIPTORS = require('../internals/descriptors');
  10295. var global = require('../internals/global');
  10296. var isCallable = require('../internals/is-callable');
  10297. var isObject = require('../internals/is-object');
  10298. var hasOwn = require('../internals/has-own-property');
  10299. var classof = require('../internals/classof');
  10300. var tryToString = require('../internals/try-to-string');
  10301. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  10302. var redefine = require('../internals/redefine');
  10303. var defineProperty = require('../internals/object-define-property').f;
  10304. var isPrototypeOf = require('../internals/object-is-prototype-of');
  10305. var getPrototypeOf = require('../internals/object-get-prototype-of');
  10306. var setPrototypeOf = require('../internals/object-set-prototype-of');
  10307. var wellKnownSymbol = require('../internals/well-known-symbol');
  10308. var uid = require('../internals/uid');
  10309. var Int8Array = global.Int8Array;
  10310. var Int8ArrayPrototype = Int8Array && Int8Array.prototype;
  10311. var Uint8ClampedArray = global.Uint8ClampedArray;
  10312. var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype;
  10313. var TypedArray = Int8Array && getPrototypeOf(Int8Array);
  10314. var TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype);
  10315. var ObjectPrototype = Object.prototype;
  10316. var TypeError = global.TypeError;
  10317. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  10318. var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG');
  10319. var TYPED_ARRAY_CONSTRUCTOR = uid('TYPED_ARRAY_CONSTRUCTOR');
  10320. // Fixing native typed arrays in Opera Presto crashes the browser, see #595
  10321. var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(global.opera) !== 'Opera';
  10322. var TYPED_ARRAY_TAG_REQUIRED = false;
  10323. var NAME, Constructor, Prototype;
  10324. var TypedArrayConstructorsList = {
  10325. Int8Array: 1,
  10326. Uint8Array: 1,
  10327. Uint8ClampedArray: 1,
  10328. Int16Array: 2,
  10329. Uint16Array: 2,
  10330. Int32Array: 4,
  10331. Uint32Array: 4,
  10332. Float32Array: 4,
  10333. Float64Array: 8
  10334. };
  10335. var BigIntArrayConstructorsList = {
  10336. BigInt64Array: 8,
  10337. BigUint64Array: 8
  10338. };
  10339. var isView = function isView(it) {
  10340. if (!isObject(it)) return false;
  10341. var klass = classof(it);
  10342. return klass === 'DataView'
  10343. || hasOwn(TypedArrayConstructorsList, klass)
  10344. || hasOwn(BigIntArrayConstructorsList, klass);
  10345. };
  10346. var isTypedArray = function (it) {
  10347. if (!isObject(it)) return false;
  10348. var klass = classof(it);
  10349. return hasOwn(TypedArrayConstructorsList, klass)
  10350. || hasOwn(BigIntArrayConstructorsList, klass);
  10351. };
  10352. var aTypedArray = function (it) {
  10353. if (isTypedArray(it)) return it;
  10354. throw TypeError('Target is not a typed array');
  10355. };
  10356. var aTypedArrayConstructor = function (C) {
  10357. if (isCallable(C) && (!setPrototypeOf || isPrototypeOf(TypedArray, C))) return C;
  10358. throw TypeError(tryToString(C) + ' is not a typed array constructor');
  10359. };
  10360. var exportTypedArrayMethod = function (KEY, property, forced, options) {
  10361. if (!DESCRIPTORS) return;
  10362. if (forced) for (var ARRAY in TypedArrayConstructorsList) {
  10363. var TypedArrayConstructor = global[ARRAY];
  10364. if (TypedArrayConstructor && hasOwn(TypedArrayConstructor.prototype, KEY)) try {
  10365. delete TypedArrayConstructor.prototype[KEY];
  10366. } catch (error) {
  10367. // old WebKit bug - some methods are non-configurable
  10368. try {
  10369. TypedArrayConstructor.prototype[KEY] = property;
  10370. } catch (error2) { /* empty */ }
  10371. }
  10372. }
  10373. if (!TypedArrayPrototype[KEY] || forced) {
  10374. redefine(TypedArrayPrototype, KEY, forced ? property
  10375. : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property, options);
  10376. }
  10377. };
  10378. var exportTypedArrayStaticMethod = function (KEY, property, forced) {
  10379. var ARRAY, TypedArrayConstructor;
  10380. if (!DESCRIPTORS) return;
  10381. if (setPrototypeOf) {
  10382. if (forced) for (ARRAY in TypedArrayConstructorsList) {
  10383. TypedArrayConstructor = global[ARRAY];
  10384. if (TypedArrayConstructor && hasOwn(TypedArrayConstructor, KEY)) try {
  10385. delete TypedArrayConstructor[KEY];
  10386. } catch (error) { /* empty */ }
  10387. }
  10388. if (!TypedArray[KEY] || forced) {
  10389. // V8 ~ Chrome 49-50 `%TypedArray%` methods are non-writable non-configurable
  10390. try {
  10391. return redefine(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && TypedArray[KEY] || property);
  10392. } catch (error) { /* empty */ }
  10393. } else return;
  10394. }
  10395. for (ARRAY in TypedArrayConstructorsList) {
  10396. TypedArrayConstructor = global[ARRAY];
  10397. if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) {
  10398. redefine(TypedArrayConstructor, KEY, property);
  10399. }
  10400. }
  10401. };
  10402. for (NAME in TypedArrayConstructorsList) {
  10403. Constructor = global[NAME];
  10404. Prototype = Constructor && Constructor.prototype;
  10405. if (Prototype) createNonEnumerableProperty(Prototype, TYPED_ARRAY_CONSTRUCTOR, Constructor);
  10406. else NATIVE_ARRAY_BUFFER_VIEWS = false;
  10407. }
  10408. for (NAME in BigIntArrayConstructorsList) {
  10409. Constructor = global[NAME];
  10410. Prototype = Constructor && Constructor.prototype;
  10411. if (Prototype) createNonEnumerableProperty(Prototype, TYPED_ARRAY_CONSTRUCTOR, Constructor);
  10412. }
  10413. // WebKit bug - typed arrays constructors prototype is Object.prototype
  10414. if (!NATIVE_ARRAY_BUFFER_VIEWS || !isCallable(TypedArray) || TypedArray === Function.prototype) {
  10415. // eslint-disable-next-line no-shadow -- safe
  10416. TypedArray = function TypedArray() {
  10417. throw TypeError('Incorrect invocation');
  10418. };
  10419. if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) {
  10420. if (global[NAME]) setPrototypeOf(global[NAME], TypedArray);
  10421. }
  10422. }
  10423. if (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) {
  10424. TypedArrayPrototype = TypedArray.prototype;
  10425. if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) {
  10426. if (global[NAME]) setPrototypeOf(global[NAME].prototype, TypedArrayPrototype);
  10427. }
  10428. }
  10429. // WebKit bug - one more object in Uint8ClampedArray prototype chain
  10430. if (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) {
  10431. setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype);
  10432. }
  10433. if (DESCRIPTORS && !hasOwn(TypedArrayPrototype, TO_STRING_TAG)) {
  10434. TYPED_ARRAY_TAG_REQUIRED = true;
  10435. defineProperty(TypedArrayPrototype, TO_STRING_TAG, { get: function () {
  10436. return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;
  10437. } });
  10438. for (NAME in TypedArrayConstructorsList) if (global[NAME]) {
  10439. createNonEnumerableProperty(global[NAME], TYPED_ARRAY_TAG, NAME);
  10440. }
  10441. }
  10442. module.exports = {
  10443. NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS,
  10444. TYPED_ARRAY_CONSTRUCTOR: TYPED_ARRAY_CONSTRUCTOR,
  10445. TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQUIRED && TYPED_ARRAY_TAG,
  10446. aTypedArray: aTypedArray,
  10447. aTypedArrayConstructor: aTypedArrayConstructor,
  10448. exportTypedArrayMethod: exportTypedArrayMethod,
  10449. exportTypedArrayStaticMethod: exportTypedArrayStaticMethod,
  10450. isView: isView,
  10451. isTypedArray: isTypedArray,
  10452. TypedArray: TypedArray,
  10453. TypedArrayPrototype: TypedArrayPrototype
  10454. };
  10455. },{"../internals/array-buffer-native":102,"../internals/classof":124,"../internals/create-non-enumerable-property":129,"../internals/descriptors":134,"../internals/global":163,"../internals/has-own-property":164,"../internals/is-callable":176,"../internals/is-object":180,"../internals/object-define-property":198,"../internals/object-get-prototype-of":203,"../internals/object-is-prototype-of":204,"../internals/object-set-prototype-of":208,"../internals/redefine":222,"../internals/try-to-string":257,"../internals/uid":263,"../internals/well-known-symbol":268}],104:[function(require,module,exports){
  10456. 'use strict';
  10457. var global = require('../internals/global');
  10458. var uncurryThis = require('../internals/function-uncurry-this');
  10459. var DESCRIPTORS = require('../internals/descriptors');
  10460. var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-native');
  10461. var FunctionName = require('../internals/function-name');
  10462. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  10463. var redefineAll = require('../internals/redefine-all');
  10464. var fails = require('../internals/fails');
  10465. var anInstance = require('../internals/an-instance');
  10466. var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
  10467. var toLength = require('../internals/to-length');
  10468. var toIndex = require('../internals/to-index');
  10469. var IEEE754 = require('../internals/ieee754');
  10470. var getPrototypeOf = require('../internals/object-get-prototype-of');
  10471. var setPrototypeOf = require('../internals/object-set-prototype-of');
  10472. var getOwnPropertyNames = require('../internals/object-get-own-property-names').f;
  10473. var defineProperty = require('../internals/object-define-property').f;
  10474. var arrayFill = require('../internals/array-fill');
  10475. var arraySlice = require('../internals/array-slice-simple');
  10476. var setToStringTag = require('../internals/set-to-string-tag');
  10477. var InternalStateModule = require('../internals/internal-state');
  10478. var PROPER_FUNCTION_NAME = FunctionName.PROPER;
  10479. var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
  10480. var getInternalState = InternalStateModule.get;
  10481. var setInternalState = InternalStateModule.set;
  10482. var ARRAY_BUFFER = 'ArrayBuffer';
  10483. var DATA_VIEW = 'DataView';
  10484. var PROTOTYPE = 'prototype';
  10485. var WRONG_LENGTH = 'Wrong length';
  10486. var WRONG_INDEX = 'Wrong index';
  10487. var NativeArrayBuffer = global[ARRAY_BUFFER];
  10488. var $ArrayBuffer = NativeArrayBuffer;
  10489. var ArrayBufferPrototype = $ArrayBuffer && $ArrayBuffer[PROTOTYPE];
  10490. var $DataView = global[DATA_VIEW];
  10491. var DataViewPrototype = $DataView && $DataView[PROTOTYPE];
  10492. var ObjectPrototype = Object.prototype;
  10493. var Array = global.Array;
  10494. var RangeError = global.RangeError;
  10495. var fill = uncurryThis(arrayFill);
  10496. var reverse = uncurryThis([].reverse);
  10497. var packIEEE754 = IEEE754.pack;
  10498. var unpackIEEE754 = IEEE754.unpack;
  10499. var packInt8 = function (number) {
  10500. return [number & 0xFF];
  10501. };
  10502. var packInt16 = function (number) {
  10503. return [number & 0xFF, number >> 8 & 0xFF];
  10504. };
  10505. var packInt32 = function (number) {
  10506. return [number & 0xFF, number >> 8 & 0xFF, number >> 16 & 0xFF, number >> 24 & 0xFF];
  10507. };
  10508. var unpackInt32 = function (buffer) {
  10509. return buffer[3] << 24 | buffer[2] << 16 | buffer[1] << 8 | buffer[0];
  10510. };
  10511. var packFloat32 = function (number) {
  10512. return packIEEE754(number, 23, 4);
  10513. };
  10514. var packFloat64 = function (number) {
  10515. return packIEEE754(number, 52, 8);
  10516. };
  10517. var addGetter = function (Constructor, key) {
  10518. defineProperty(Constructor[PROTOTYPE], key, { get: function () { return getInternalState(this)[key]; } });
  10519. };
  10520. var get = function (view, count, index, isLittleEndian) {
  10521. var intIndex = toIndex(index);
  10522. var store = getInternalState(view);
  10523. if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX);
  10524. var bytes = getInternalState(store.buffer).bytes;
  10525. var start = intIndex + store.byteOffset;
  10526. var pack = arraySlice(bytes, start, start + count);
  10527. return isLittleEndian ? pack : reverse(pack);
  10528. };
  10529. var set = function (view, count, index, conversion, value, isLittleEndian) {
  10530. var intIndex = toIndex(index);
  10531. var store = getInternalState(view);
  10532. if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX);
  10533. var bytes = getInternalState(store.buffer).bytes;
  10534. var start = intIndex + store.byteOffset;
  10535. var pack = conversion(+value);
  10536. for (var i = 0; i < count; i++) bytes[start + i] = pack[isLittleEndian ? i : count - i - 1];
  10537. };
  10538. if (!NATIVE_ARRAY_BUFFER) {
  10539. $ArrayBuffer = function ArrayBuffer(length) {
  10540. anInstance(this, ArrayBufferPrototype);
  10541. var byteLength = toIndex(length);
  10542. setInternalState(this, {
  10543. bytes: fill(Array(byteLength), 0),
  10544. byteLength: byteLength
  10545. });
  10546. if (!DESCRIPTORS) this.byteLength = byteLength;
  10547. };
  10548. ArrayBufferPrototype = $ArrayBuffer[PROTOTYPE];
  10549. $DataView = function DataView(buffer, byteOffset, byteLength) {
  10550. anInstance(this, DataViewPrototype);
  10551. anInstance(buffer, ArrayBufferPrototype);
  10552. var bufferLength = getInternalState(buffer).byteLength;
  10553. var offset = toIntegerOrInfinity(byteOffset);
  10554. if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset');
  10555. byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength);
  10556. if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH);
  10557. setInternalState(this, {
  10558. buffer: buffer,
  10559. byteLength: byteLength,
  10560. byteOffset: offset
  10561. });
  10562. if (!DESCRIPTORS) {
  10563. this.buffer = buffer;
  10564. this.byteLength = byteLength;
  10565. this.byteOffset = offset;
  10566. }
  10567. };
  10568. DataViewPrototype = $DataView[PROTOTYPE];
  10569. if (DESCRIPTORS) {
  10570. addGetter($ArrayBuffer, 'byteLength');
  10571. addGetter($DataView, 'buffer');
  10572. addGetter($DataView, 'byteLength');
  10573. addGetter($DataView, 'byteOffset');
  10574. }
  10575. redefineAll(DataViewPrototype, {
  10576. getInt8: function getInt8(byteOffset) {
  10577. return get(this, 1, byteOffset)[0] << 24 >> 24;
  10578. },
  10579. getUint8: function getUint8(byteOffset) {
  10580. return get(this, 1, byteOffset)[0];
  10581. },
  10582. getInt16: function getInt16(byteOffset /* , littleEndian */) {
  10583. var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : undefined);
  10584. return (bytes[1] << 8 | bytes[0]) << 16 >> 16;
  10585. },
  10586. getUint16: function getUint16(byteOffset /* , littleEndian */) {
  10587. var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : undefined);
  10588. return bytes[1] << 8 | bytes[0];
  10589. },
  10590. getInt32: function getInt32(byteOffset /* , littleEndian */) {
  10591. return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined));
  10592. },
  10593. getUint32: function getUint32(byteOffset /* , littleEndian */) {
  10594. return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined)) >>> 0;
  10595. },
  10596. getFloat32: function getFloat32(byteOffset /* , littleEndian */) {
  10597. return unpackIEEE754(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined), 23);
  10598. },
  10599. getFloat64: function getFloat64(byteOffset /* , littleEndian */) {
  10600. return unpackIEEE754(get(this, 8, byteOffset, arguments.length > 1 ? arguments[1] : undefined), 52);
  10601. },
  10602. setInt8: function setInt8(byteOffset, value) {
  10603. set(this, 1, byteOffset, packInt8, value);
  10604. },
  10605. setUint8: function setUint8(byteOffset, value) {
  10606. set(this, 1, byteOffset, packInt8, value);
  10607. },
  10608. setInt16: function setInt16(byteOffset, value /* , littleEndian */) {
  10609. set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : undefined);
  10610. },
  10611. setUint16: function setUint16(byteOffset, value /* , littleEndian */) {
  10612. set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : undefined);
  10613. },
  10614. setInt32: function setInt32(byteOffset, value /* , littleEndian */) {
  10615. set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : undefined);
  10616. },
  10617. setUint32: function setUint32(byteOffset, value /* , littleEndian */) {
  10618. set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : undefined);
  10619. },
  10620. setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) {
  10621. set(this, 4, byteOffset, packFloat32, value, arguments.length > 2 ? arguments[2] : undefined);
  10622. },
  10623. setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) {
  10624. set(this, 8, byteOffset, packFloat64, value, arguments.length > 2 ? arguments[2] : undefined);
  10625. }
  10626. });
  10627. } else {
  10628. var INCORRECT_ARRAY_BUFFER_NAME = PROPER_FUNCTION_NAME && NativeArrayBuffer.name !== ARRAY_BUFFER;
  10629. /* eslint-disable no-new -- required for testing */
  10630. if (!fails(function () {
  10631. NativeArrayBuffer(1);
  10632. }) || !fails(function () {
  10633. new NativeArrayBuffer(-1);
  10634. }) || fails(function () {
  10635. new NativeArrayBuffer();
  10636. new NativeArrayBuffer(1.5);
  10637. new NativeArrayBuffer(NaN);
  10638. return INCORRECT_ARRAY_BUFFER_NAME && !CONFIGURABLE_FUNCTION_NAME;
  10639. })) {
  10640. /* eslint-enable no-new -- required for testing */
  10641. $ArrayBuffer = function ArrayBuffer(length) {
  10642. anInstance(this, ArrayBufferPrototype);
  10643. return new NativeArrayBuffer(toIndex(length));
  10644. };
  10645. $ArrayBuffer[PROTOTYPE] = ArrayBufferPrototype;
  10646. for (var keys = getOwnPropertyNames(NativeArrayBuffer), j = 0, key; keys.length > j;) {
  10647. if (!((key = keys[j++]) in $ArrayBuffer)) {
  10648. createNonEnumerableProperty($ArrayBuffer, key, NativeArrayBuffer[key]);
  10649. }
  10650. }
  10651. ArrayBufferPrototype.constructor = $ArrayBuffer;
  10652. } else if (INCORRECT_ARRAY_BUFFER_NAME && CONFIGURABLE_FUNCTION_NAME) {
  10653. createNonEnumerableProperty(NativeArrayBuffer, 'name', ARRAY_BUFFER);
  10654. }
  10655. // WebKit bug - the same parent prototype for typed arrays and data view
  10656. if (setPrototypeOf && getPrototypeOf(DataViewPrototype) !== ObjectPrototype) {
  10657. setPrototypeOf(DataViewPrototype, ObjectPrototype);
  10658. }
  10659. // iOS Safari 7.x bug
  10660. var testView = new $DataView(new $ArrayBuffer(2));
  10661. var $setInt8 = uncurryThis(DataViewPrototype.setInt8);
  10662. testView.setInt8(0, 2147483648);
  10663. testView.setInt8(1, 2147483649);
  10664. if (testView.getInt8(0) || !testView.getInt8(1)) redefineAll(DataViewPrototype, {
  10665. setInt8: function setInt8(byteOffset, value) {
  10666. $setInt8(this, byteOffset, value << 24 >> 24);
  10667. },
  10668. setUint8: function setUint8(byteOffset, value) {
  10669. $setInt8(this, byteOffset, value << 24 >> 24);
  10670. }
  10671. }, { unsafe: true });
  10672. }
  10673. setToStringTag($ArrayBuffer, ARRAY_BUFFER);
  10674. setToStringTag($DataView, DATA_VIEW);
  10675. module.exports = {
  10676. ArrayBuffer: $ArrayBuffer,
  10677. DataView: $DataView
  10678. };
  10679. },{"../internals/an-instance":100,"../internals/array-buffer-native":102,"../internals/array-fill":106,"../internals/array-slice-simple":116,"../internals/create-non-enumerable-property":129,"../internals/descriptors":134,"../internals/fails":150,"../internals/function-name":156,"../internals/function-uncurry-this":157,"../internals/global":163,"../internals/ieee754":169,"../internals/internal-state":173,"../internals/object-define-property":198,"../internals/object-get-own-property-names":201,"../internals/object-get-prototype-of":203,"../internals/object-set-prototype-of":208,"../internals/redefine-all":221,"../internals/set-to-string-tag":234,"../internals/to-index":246,"../internals/to-integer-or-infinity":248,"../internals/to-length":249}],105:[function(require,module,exports){
  10680. 'use strict';
  10681. var toObject = require('../internals/to-object');
  10682. var toAbsoluteIndex = require('../internals/to-absolute-index');
  10683. var lengthOfArrayLike = require('../internals/length-of-array-like');
  10684. var min = Math.min;
  10685. // `Array.prototype.copyWithin` method implementation
  10686. // https://tc39.es/ecma262/#sec-array.prototype.copywithin
  10687. // eslint-disable-next-line es-x/no-array-prototype-copywithin -- safe
  10688. module.exports = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) {
  10689. var O = toObject(this);
  10690. var len = lengthOfArrayLike(O);
  10691. var to = toAbsoluteIndex(target, len);
  10692. var from = toAbsoluteIndex(start, len);
  10693. var end = arguments.length > 2 ? arguments[2] : undefined;
  10694. var count = min((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to);
  10695. var inc = 1;
  10696. if (from < to && to < from + count) {
  10697. inc = -1;
  10698. from += count - 1;
  10699. to += count - 1;
  10700. }
  10701. while (count-- > 0) {
  10702. if (from in O) O[to] = O[from];
  10703. else delete O[to];
  10704. to += inc;
  10705. from += inc;
  10706. } return O;
  10707. };
  10708. },{"../internals/length-of-array-like":188,"../internals/to-absolute-index":245,"../internals/to-object":250}],106:[function(require,module,exports){
  10709. 'use strict';
  10710. var toObject = require('../internals/to-object');
  10711. var toAbsoluteIndex = require('../internals/to-absolute-index');
  10712. var lengthOfArrayLike = require('../internals/length-of-array-like');
  10713. // `Array.prototype.fill` method implementation
  10714. // https://tc39.es/ecma262/#sec-array.prototype.fill
  10715. module.exports = function fill(value /* , start = 0, end = @length */) {
  10716. var O = toObject(this);
  10717. var length = lengthOfArrayLike(O);
  10718. var argumentsLength = arguments.length;
  10719. var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length);
  10720. var end = argumentsLength > 2 ? arguments[2] : undefined;
  10721. var endPos = end === undefined ? length : toAbsoluteIndex(end, length);
  10722. while (endPos > index) O[index++] = value;
  10723. return O;
  10724. };
  10725. },{"../internals/length-of-array-like":188,"../internals/to-absolute-index":245,"../internals/to-object":250}],107:[function(require,module,exports){
  10726. 'use strict';
  10727. var $forEach = require('../internals/array-iteration').forEach;
  10728. var arrayMethodIsStrict = require('../internals/array-method-is-strict');
  10729. var STRICT_METHOD = arrayMethodIsStrict('forEach');
  10730. // `Array.prototype.forEach` method implementation
  10731. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  10732. module.exports = !STRICT_METHOD ? function forEach(callbackfn /* , thisArg */) {
  10733. return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  10734. // eslint-disable-next-line es-x/no-array-prototype-foreach -- safe
  10735. } : [].forEach;
  10736. },{"../internals/array-iteration":111,"../internals/array-method-is-strict":114}],108:[function(require,module,exports){
  10737. var lengthOfArrayLike = require('../internals/length-of-array-like');
  10738. module.exports = function (Constructor, list) {
  10739. var index = 0;
  10740. var length = lengthOfArrayLike(list);
  10741. var result = new Constructor(length);
  10742. while (length > index) result[index] = list[index++];
  10743. return result;
  10744. };
  10745. },{"../internals/length-of-array-like":188}],109:[function(require,module,exports){
  10746. 'use strict';
  10747. var global = require('../internals/global');
  10748. var bind = require('../internals/function-bind-context');
  10749. var call = require('../internals/function-call');
  10750. var toObject = require('../internals/to-object');
  10751. var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');
  10752. var isArrayIteratorMethod = require('../internals/is-array-iterator-method');
  10753. var isConstructor = require('../internals/is-constructor');
  10754. var lengthOfArrayLike = require('../internals/length-of-array-like');
  10755. var createProperty = require('../internals/create-property');
  10756. var getIterator = require('../internals/get-iterator');
  10757. var getIteratorMethod = require('../internals/get-iterator-method');
  10758. var Array = global.Array;
  10759. // `Array.from` method implementation
  10760. // https://tc39.es/ecma262/#sec-array.from
  10761. module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
  10762. var O = toObject(arrayLike);
  10763. var IS_CONSTRUCTOR = isConstructor(this);
  10764. var argumentsLength = arguments.length;
  10765. var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
  10766. var mapping = mapfn !== undefined;
  10767. if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined);
  10768. var iteratorMethod = getIteratorMethod(O);
  10769. var index = 0;
  10770. var length, result, step, iterator, next, value;
  10771. // if the target is not iterable or it's an array with the default iterator - use a simple case
  10772. if (iteratorMethod && !(this == Array && isArrayIteratorMethod(iteratorMethod))) {
  10773. iterator = getIterator(O, iteratorMethod);
  10774. next = iterator.next;
  10775. result = IS_CONSTRUCTOR ? new this() : [];
  10776. for (;!(step = call(next, iterator)).done; index++) {
  10777. value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
  10778. createProperty(result, index, value);
  10779. }
  10780. } else {
  10781. length = lengthOfArrayLike(O);
  10782. result = IS_CONSTRUCTOR ? new this(length) : Array(length);
  10783. for (;length > index; index++) {
  10784. value = mapping ? mapfn(O[index], index) : O[index];
  10785. createProperty(result, index, value);
  10786. }
  10787. }
  10788. result.length = index;
  10789. return result;
  10790. };
  10791. },{"../internals/call-with-safe-iteration-closing":121,"../internals/create-property":131,"../internals/function-bind-context":153,"../internals/function-call":155,"../internals/get-iterator":160,"../internals/get-iterator-method":159,"../internals/global":163,"../internals/is-array-iterator-method":174,"../internals/is-constructor":177,"../internals/length-of-array-like":188,"../internals/to-object":250}],110:[function(require,module,exports){
  10792. var toIndexedObject = require('../internals/to-indexed-object');
  10793. var toAbsoluteIndex = require('../internals/to-absolute-index');
  10794. var lengthOfArrayLike = require('../internals/length-of-array-like');
  10795. // `Array.prototype.{ indexOf, includes }` methods implementation
  10796. var createMethod = function (IS_INCLUDES) {
  10797. return function ($this, el, fromIndex) {
  10798. var O = toIndexedObject($this);
  10799. var length = lengthOfArrayLike(O);
  10800. var index = toAbsoluteIndex(fromIndex, length);
  10801. var value;
  10802. // Array#includes uses SameValueZero equality algorithm
  10803. // eslint-disable-next-line no-self-compare -- NaN check
  10804. if (IS_INCLUDES && el != el) while (length > index) {
  10805. value = O[index++];
  10806. // eslint-disable-next-line no-self-compare -- NaN check
  10807. if (value != value) return true;
  10808. // Array#indexOf ignores holes, Array#includes - not
  10809. } else for (;length > index; index++) {
  10810. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  10811. } return !IS_INCLUDES && -1;
  10812. };
  10813. };
  10814. module.exports = {
  10815. // `Array.prototype.includes` method
  10816. // https://tc39.es/ecma262/#sec-array.prototype.includes
  10817. includes: createMethod(true),
  10818. // `Array.prototype.indexOf` method
  10819. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  10820. indexOf: createMethod(false)
  10821. };
  10822. },{"../internals/length-of-array-like":188,"../internals/to-absolute-index":245,"../internals/to-indexed-object":247}],111:[function(require,module,exports){
  10823. var bind = require('../internals/function-bind-context');
  10824. var uncurryThis = require('../internals/function-uncurry-this');
  10825. var IndexedObject = require('../internals/indexed-object');
  10826. var toObject = require('../internals/to-object');
  10827. var lengthOfArrayLike = require('../internals/length-of-array-like');
  10828. var arraySpeciesCreate = require('../internals/array-species-create');
  10829. var push = uncurryThis([].push);
  10830. // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
  10831. var createMethod = function (TYPE) {
  10832. var IS_MAP = TYPE == 1;
  10833. var IS_FILTER = TYPE == 2;
  10834. var IS_SOME = TYPE == 3;
  10835. var IS_EVERY = TYPE == 4;
  10836. var IS_FIND_INDEX = TYPE == 6;
  10837. var IS_FILTER_REJECT = TYPE == 7;
  10838. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  10839. return function ($this, callbackfn, that, specificCreate) {
  10840. var O = toObject($this);
  10841. var self = IndexedObject(O);
  10842. var boundFunction = bind(callbackfn, that);
  10843. var length = lengthOfArrayLike(self);
  10844. var index = 0;
  10845. var create = specificCreate || arraySpeciesCreate;
  10846. var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
  10847. var value, result;
  10848. for (;length > index; index++) if (NO_HOLES || index in self) {
  10849. value = self[index];
  10850. result = boundFunction(value, index, O);
  10851. if (TYPE) {
  10852. if (IS_MAP) target[index] = result; // map
  10853. else if (result) switch (TYPE) {
  10854. case 3: return true; // some
  10855. case 5: return value; // find
  10856. case 6: return index; // findIndex
  10857. case 2: push(target, value); // filter
  10858. } else switch (TYPE) {
  10859. case 4: return false; // every
  10860. case 7: push(target, value); // filterReject
  10861. }
  10862. }
  10863. }
  10864. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
  10865. };
  10866. };
  10867. module.exports = {
  10868. // `Array.prototype.forEach` method
  10869. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  10870. forEach: createMethod(0),
  10871. // `Array.prototype.map` method
  10872. // https://tc39.es/ecma262/#sec-array.prototype.map
  10873. map: createMethod(1),
  10874. // `Array.prototype.filter` method
  10875. // https://tc39.es/ecma262/#sec-array.prototype.filter
  10876. filter: createMethod(2),
  10877. // `Array.prototype.some` method
  10878. // https://tc39.es/ecma262/#sec-array.prototype.some
  10879. some: createMethod(3),
  10880. // `Array.prototype.every` method
  10881. // https://tc39.es/ecma262/#sec-array.prototype.every
  10882. every: createMethod(4),
  10883. // `Array.prototype.find` method
  10884. // https://tc39.es/ecma262/#sec-array.prototype.find
  10885. find: createMethod(5),
  10886. // `Array.prototype.findIndex` method
  10887. // https://tc39.es/ecma262/#sec-array.prototype.findIndex
  10888. findIndex: createMethod(6),
  10889. // `Array.prototype.filterReject` method
  10890. // https://github.com/tc39/proposal-array-filtering
  10891. filterReject: createMethod(7)
  10892. };
  10893. },{"../internals/array-species-create":120,"../internals/function-bind-context":153,"../internals/function-uncurry-this":157,"../internals/indexed-object":170,"../internals/length-of-array-like":188,"../internals/to-object":250}],112:[function(require,module,exports){
  10894. 'use strict';
  10895. /* eslint-disable es-x/no-array-prototype-lastindexof -- safe */
  10896. var apply = require('../internals/function-apply');
  10897. var toIndexedObject = require('../internals/to-indexed-object');
  10898. var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
  10899. var lengthOfArrayLike = require('../internals/length-of-array-like');
  10900. var arrayMethodIsStrict = require('../internals/array-method-is-strict');
  10901. var min = Math.min;
  10902. var $lastIndexOf = [].lastIndexOf;
  10903. var NEGATIVE_ZERO = !!$lastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0;
  10904. var STRICT_METHOD = arrayMethodIsStrict('lastIndexOf');
  10905. var FORCED = NEGATIVE_ZERO || !STRICT_METHOD;
  10906. // `Array.prototype.lastIndexOf` method implementation
  10907. // https://tc39.es/ecma262/#sec-array.prototype.lastindexof
  10908. module.exports = FORCED ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) {
  10909. // convert -0 to +0
  10910. if (NEGATIVE_ZERO) return apply($lastIndexOf, this, arguments) || 0;
  10911. var O = toIndexedObject(this);
  10912. var length = lengthOfArrayLike(O);
  10913. var index = length - 1;
  10914. if (arguments.length > 1) index = min(index, toIntegerOrInfinity(arguments[1]));
  10915. if (index < 0) index = length + index;
  10916. for (;index >= 0; index--) if (index in O && O[index] === searchElement) return index || 0;
  10917. return -1;
  10918. } : $lastIndexOf;
  10919. },{"../internals/array-method-is-strict":114,"../internals/function-apply":152,"../internals/length-of-array-like":188,"../internals/to-indexed-object":247,"../internals/to-integer-or-infinity":248}],113:[function(require,module,exports){
  10920. var fails = require('../internals/fails');
  10921. var wellKnownSymbol = require('../internals/well-known-symbol');
  10922. var V8_VERSION = require('../internals/engine-v8-version');
  10923. var SPECIES = wellKnownSymbol('species');
  10924. module.exports = function (METHOD_NAME) {
  10925. // We can't use this feature detection in V8 since it causes
  10926. // deoptimization and serious performance degradation
  10927. // https://github.com/zloirock/core-js/issues/677
  10928. return V8_VERSION >= 51 || !fails(function () {
  10929. var array = [];
  10930. var constructor = array.constructor = {};
  10931. constructor[SPECIES] = function () {
  10932. return { foo: 1 };
  10933. };
  10934. return array[METHOD_NAME](Boolean).foo !== 1;
  10935. });
  10936. };
  10937. },{"../internals/engine-v8-version":146,"../internals/fails":150,"../internals/well-known-symbol":268}],114:[function(require,module,exports){
  10938. 'use strict';
  10939. var fails = require('../internals/fails');
  10940. module.exports = function (METHOD_NAME, argument) {
  10941. var method = [][METHOD_NAME];
  10942. return !!method && fails(function () {
  10943. // eslint-disable-next-line no-useless-call -- required for testing
  10944. method.call(null, argument || function () { return 1; }, 1);
  10945. });
  10946. };
  10947. },{"../internals/fails":150}],115:[function(require,module,exports){
  10948. var global = require('../internals/global');
  10949. var aCallable = require('../internals/a-callable');
  10950. var toObject = require('../internals/to-object');
  10951. var IndexedObject = require('../internals/indexed-object');
  10952. var lengthOfArrayLike = require('../internals/length-of-array-like');
  10953. var TypeError = global.TypeError;
  10954. // `Array.prototype.{ reduce, reduceRight }` methods implementation
  10955. var createMethod = function (IS_RIGHT) {
  10956. return function (that, callbackfn, argumentsLength, memo) {
  10957. aCallable(callbackfn);
  10958. var O = toObject(that);
  10959. var self = IndexedObject(O);
  10960. var length = lengthOfArrayLike(O);
  10961. var index = IS_RIGHT ? length - 1 : 0;
  10962. var i = IS_RIGHT ? -1 : 1;
  10963. if (argumentsLength < 2) while (true) {
  10964. if (index in self) {
  10965. memo = self[index];
  10966. index += i;
  10967. break;
  10968. }
  10969. index += i;
  10970. if (IS_RIGHT ? index < 0 : length <= index) {
  10971. throw TypeError('Reduce of empty array with no initial value');
  10972. }
  10973. }
  10974. for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
  10975. memo = callbackfn(memo, self[index], index, O);
  10976. }
  10977. return memo;
  10978. };
  10979. };
  10980. module.exports = {
  10981. // `Array.prototype.reduce` method
  10982. // https://tc39.es/ecma262/#sec-array.prototype.reduce
  10983. left: createMethod(false),
  10984. // `Array.prototype.reduceRight` method
  10985. // https://tc39.es/ecma262/#sec-array.prototype.reduceright
  10986. right: createMethod(true)
  10987. };
  10988. },{"../internals/a-callable":95,"../internals/global":163,"../internals/indexed-object":170,"../internals/length-of-array-like":188,"../internals/to-object":250}],116:[function(require,module,exports){
  10989. var global = require('../internals/global');
  10990. var toAbsoluteIndex = require('../internals/to-absolute-index');
  10991. var lengthOfArrayLike = require('../internals/length-of-array-like');
  10992. var createProperty = require('../internals/create-property');
  10993. var Array = global.Array;
  10994. var max = Math.max;
  10995. module.exports = function (O, start, end) {
  10996. var length = lengthOfArrayLike(O);
  10997. var k = toAbsoluteIndex(start, length);
  10998. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  10999. var result = Array(max(fin - k, 0));
  11000. for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);
  11001. result.length = n;
  11002. return result;
  11003. };
  11004. },{"../internals/create-property":131,"../internals/global":163,"../internals/length-of-array-like":188,"../internals/to-absolute-index":245}],117:[function(require,module,exports){
  11005. var uncurryThis = require('../internals/function-uncurry-this');
  11006. module.exports = uncurryThis([].slice);
  11007. },{"../internals/function-uncurry-this":157}],118:[function(require,module,exports){
  11008. var arraySlice = require('../internals/array-slice-simple');
  11009. var floor = Math.floor;
  11010. var mergeSort = function (array, comparefn) {
  11011. var length = array.length;
  11012. var middle = floor(length / 2);
  11013. return length < 8 ? insertionSort(array, comparefn) : merge(
  11014. array,
  11015. mergeSort(arraySlice(array, 0, middle), comparefn),
  11016. mergeSort(arraySlice(array, middle), comparefn),
  11017. comparefn
  11018. );
  11019. };
  11020. var insertionSort = function (array, comparefn) {
  11021. var length = array.length;
  11022. var i = 1;
  11023. var element, j;
  11024. while (i < length) {
  11025. j = i;
  11026. element = array[i];
  11027. while (j && comparefn(array[j - 1], element) > 0) {
  11028. array[j] = array[--j];
  11029. }
  11030. if (j !== i++) array[j] = element;
  11031. } return array;
  11032. };
  11033. var merge = function (array, left, right, comparefn) {
  11034. var llength = left.length;
  11035. var rlength = right.length;
  11036. var lindex = 0;
  11037. var rindex = 0;
  11038. while (lindex < llength || rindex < rlength) {
  11039. array[lindex + rindex] = (lindex < llength && rindex < rlength)
  11040. ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
  11041. : lindex < llength ? left[lindex++] : right[rindex++];
  11042. } return array;
  11043. };
  11044. module.exports = mergeSort;
  11045. },{"../internals/array-slice-simple":116}],119:[function(require,module,exports){
  11046. var global = require('../internals/global');
  11047. var isArray = require('../internals/is-array');
  11048. var isConstructor = require('../internals/is-constructor');
  11049. var isObject = require('../internals/is-object');
  11050. var wellKnownSymbol = require('../internals/well-known-symbol');
  11051. var SPECIES = wellKnownSymbol('species');
  11052. var Array = global.Array;
  11053. // a part of `ArraySpeciesCreate` abstract operation
  11054. // https://tc39.es/ecma262/#sec-arrayspeciescreate
  11055. module.exports = function (originalArray) {
  11056. var C;
  11057. if (isArray(originalArray)) {
  11058. C = originalArray.constructor;
  11059. // cross-realm fallback
  11060. if (isConstructor(C) && (C === Array || isArray(C.prototype))) C = undefined;
  11061. else if (isObject(C)) {
  11062. C = C[SPECIES];
  11063. if (C === null) C = undefined;
  11064. }
  11065. } return C === undefined ? Array : C;
  11066. };
  11067. },{"../internals/global":163,"../internals/is-array":175,"../internals/is-constructor":177,"../internals/is-object":180,"../internals/well-known-symbol":268}],120:[function(require,module,exports){
  11068. var arraySpeciesConstructor = require('../internals/array-species-constructor');
  11069. // `ArraySpeciesCreate` abstract operation
  11070. // https://tc39.es/ecma262/#sec-arrayspeciescreate
  11071. module.exports = function (originalArray, length) {
  11072. return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
  11073. };
  11074. },{"../internals/array-species-constructor":119}],121:[function(require,module,exports){
  11075. var anObject = require('../internals/an-object');
  11076. var iteratorClose = require('../internals/iterator-close');
  11077. // call something on iterator step with safe closing on error
  11078. module.exports = function (iterator, fn, value, ENTRIES) {
  11079. try {
  11080. return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
  11081. } catch (error) {
  11082. iteratorClose(iterator, 'throw', error);
  11083. }
  11084. };
  11085. },{"../internals/an-object":101,"../internals/iterator-close":185}],122:[function(require,module,exports){
  11086. var wellKnownSymbol = require('../internals/well-known-symbol');
  11087. var ITERATOR = wellKnownSymbol('iterator');
  11088. var SAFE_CLOSING = false;
  11089. try {
  11090. var called = 0;
  11091. var iteratorWithReturn = {
  11092. next: function () {
  11093. return { done: !!called++ };
  11094. },
  11095. 'return': function () {
  11096. SAFE_CLOSING = true;
  11097. }
  11098. };
  11099. iteratorWithReturn[ITERATOR] = function () {
  11100. return this;
  11101. };
  11102. // eslint-disable-next-line es-x/no-array-from, no-throw-literal -- required for testing
  11103. Array.from(iteratorWithReturn, function () { throw 2; });
  11104. } catch (error) { /* empty */ }
  11105. module.exports = function (exec, SKIP_CLOSING) {
  11106. if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
  11107. var ITERATION_SUPPORT = false;
  11108. try {
  11109. var object = {};
  11110. object[ITERATOR] = function () {
  11111. return {
  11112. next: function () {
  11113. return { done: ITERATION_SUPPORT = true };
  11114. }
  11115. };
  11116. };
  11117. exec(object);
  11118. } catch (error) { /* empty */ }
  11119. return ITERATION_SUPPORT;
  11120. };
  11121. },{"../internals/well-known-symbol":268}],123:[function(require,module,exports){
  11122. var uncurryThis = require('../internals/function-uncurry-this');
  11123. var toString = uncurryThis({}.toString);
  11124. var stringSlice = uncurryThis(''.slice);
  11125. module.exports = function (it) {
  11126. return stringSlice(toString(it), 8, -1);
  11127. };
  11128. },{"../internals/function-uncurry-this":157}],124:[function(require,module,exports){
  11129. var global = require('../internals/global');
  11130. var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');
  11131. var isCallable = require('../internals/is-callable');
  11132. var classofRaw = require('../internals/classof-raw');
  11133. var wellKnownSymbol = require('../internals/well-known-symbol');
  11134. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  11135. var Object = global.Object;
  11136. // ES3 wrong here
  11137. var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
  11138. // fallback for IE11 Script Access Denied error
  11139. var tryGet = function (it, key) {
  11140. try {
  11141. return it[key];
  11142. } catch (error) { /* empty */ }
  11143. };
  11144. // getting tag from ES6+ `Object.prototype.toString`
  11145. module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
  11146. var O, tag, result;
  11147. return it === undefined ? 'Undefined' : it === null ? 'Null'
  11148. // @@toStringTag case
  11149. : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
  11150. // builtinTag case
  11151. : CORRECT_ARGUMENTS ? classofRaw(O)
  11152. // ES3 arguments fallback
  11153. : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
  11154. };
  11155. },{"../internals/classof-raw":123,"../internals/global":163,"../internals/is-callable":176,"../internals/to-string-tag-support":255,"../internals/well-known-symbol":268}],125:[function(require,module,exports){
  11156. var hasOwn = require('../internals/has-own-property');
  11157. var ownKeys = require('../internals/own-keys');
  11158. var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');
  11159. var definePropertyModule = require('../internals/object-define-property');
  11160. module.exports = function (target, source, exceptions) {
  11161. var keys = ownKeys(source);
  11162. var defineProperty = definePropertyModule.f;
  11163. var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  11164. for (var i = 0; i < keys.length; i++) {
  11165. var key = keys[i];
  11166. if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
  11167. defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  11168. }
  11169. }
  11170. };
  11171. },{"../internals/has-own-property":164,"../internals/object-define-property":198,"../internals/object-get-own-property-descriptor":199,"../internals/own-keys":212}],126:[function(require,module,exports){
  11172. var wellKnownSymbol = require('../internals/well-known-symbol');
  11173. var MATCH = wellKnownSymbol('match');
  11174. module.exports = function (METHOD_NAME) {
  11175. var regexp = /./;
  11176. try {
  11177. '/./'[METHOD_NAME](regexp);
  11178. } catch (error1) {
  11179. try {
  11180. regexp[MATCH] = false;
  11181. return '/./'[METHOD_NAME](regexp);
  11182. } catch (error2) { /* empty */ }
  11183. } return false;
  11184. };
  11185. },{"../internals/well-known-symbol":268}],127:[function(require,module,exports){
  11186. var fails = require('../internals/fails');
  11187. module.exports = !fails(function () {
  11188. function F() { /* empty */ }
  11189. F.prototype.constructor = null;
  11190. // eslint-disable-next-line es-x/no-object-getprototypeof -- required for testing
  11191. return Object.getPrototypeOf(new F()) !== F.prototype;
  11192. });
  11193. },{"../internals/fails":150}],128:[function(require,module,exports){
  11194. 'use strict';
  11195. var IteratorPrototype = require('../internals/iterators-core').IteratorPrototype;
  11196. var create = require('../internals/object-create');
  11197. var createPropertyDescriptor = require('../internals/create-property-descriptor');
  11198. var setToStringTag = require('../internals/set-to-string-tag');
  11199. var Iterators = require('../internals/iterators');
  11200. var returnThis = function () { return this; };
  11201. module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
  11202. var TO_STRING_TAG = NAME + ' Iterator';
  11203. IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
  11204. setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
  11205. Iterators[TO_STRING_TAG] = returnThis;
  11206. return IteratorConstructor;
  11207. };
  11208. },{"../internals/create-property-descriptor":130,"../internals/iterators":187,"../internals/iterators-core":186,"../internals/object-create":196,"../internals/set-to-string-tag":234}],129:[function(require,module,exports){
  11209. var DESCRIPTORS = require('../internals/descriptors');
  11210. var definePropertyModule = require('../internals/object-define-property');
  11211. var createPropertyDescriptor = require('../internals/create-property-descriptor');
  11212. module.exports = DESCRIPTORS ? function (object, key, value) {
  11213. return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
  11214. } : function (object, key, value) {
  11215. object[key] = value;
  11216. return object;
  11217. };
  11218. },{"../internals/create-property-descriptor":130,"../internals/descriptors":134,"../internals/object-define-property":198}],130:[function(require,module,exports){
  11219. module.exports = function (bitmap, value) {
  11220. return {
  11221. enumerable: !(bitmap & 1),
  11222. configurable: !(bitmap & 2),
  11223. writable: !(bitmap & 4),
  11224. value: value
  11225. };
  11226. };
  11227. },{}],131:[function(require,module,exports){
  11228. 'use strict';
  11229. var toPropertyKey = require('../internals/to-property-key');
  11230. var definePropertyModule = require('../internals/object-define-property');
  11231. var createPropertyDescriptor = require('../internals/create-property-descriptor');
  11232. module.exports = function (object, key, value) {
  11233. var propertyKey = toPropertyKey(key);
  11234. if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
  11235. else object[propertyKey] = value;
  11236. };
  11237. },{"../internals/create-property-descriptor":130,"../internals/object-define-property":198,"../internals/to-property-key":254}],132:[function(require,module,exports){
  11238. 'use strict';
  11239. var $ = require('../internals/export');
  11240. var call = require('../internals/function-call');
  11241. var IS_PURE = require('../internals/is-pure');
  11242. var FunctionName = require('../internals/function-name');
  11243. var isCallable = require('../internals/is-callable');
  11244. var createIteratorConstructor = require('../internals/create-iterator-constructor');
  11245. var getPrototypeOf = require('../internals/object-get-prototype-of');
  11246. var setPrototypeOf = require('../internals/object-set-prototype-of');
  11247. var setToStringTag = require('../internals/set-to-string-tag');
  11248. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  11249. var redefine = require('../internals/redefine');
  11250. var wellKnownSymbol = require('../internals/well-known-symbol');
  11251. var Iterators = require('../internals/iterators');
  11252. var IteratorsCore = require('../internals/iterators-core');
  11253. var PROPER_FUNCTION_NAME = FunctionName.PROPER;
  11254. var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
  11255. var IteratorPrototype = IteratorsCore.IteratorPrototype;
  11256. var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
  11257. var ITERATOR = wellKnownSymbol('iterator');
  11258. var KEYS = 'keys';
  11259. var VALUES = 'values';
  11260. var ENTRIES = 'entries';
  11261. var returnThis = function () { return this; };
  11262. module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
  11263. createIteratorConstructor(IteratorConstructor, NAME, next);
  11264. var getIterationMethod = function (KIND) {
  11265. if (KIND === DEFAULT && defaultIterator) return defaultIterator;
  11266. if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
  11267. switch (KIND) {
  11268. case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
  11269. case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
  11270. case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
  11271. } return function () { return new IteratorConstructor(this); };
  11272. };
  11273. var TO_STRING_TAG = NAME + ' Iterator';
  11274. var INCORRECT_VALUES_NAME = false;
  11275. var IterablePrototype = Iterable.prototype;
  11276. var nativeIterator = IterablePrototype[ITERATOR]
  11277. || IterablePrototype['@@iterator']
  11278. || DEFAULT && IterablePrototype[DEFAULT];
  11279. var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
  11280. var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
  11281. var CurrentIteratorPrototype, methods, KEY;
  11282. // fix native
  11283. if (anyNativeIterator) {
  11284. CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
  11285. if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
  11286. if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
  11287. if (setPrototypeOf) {
  11288. setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
  11289. } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {
  11290. redefine(CurrentIteratorPrototype, ITERATOR, returnThis);
  11291. }
  11292. }
  11293. // Set @@toStringTag to native iterators
  11294. setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
  11295. if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
  11296. }
  11297. }
  11298. // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
  11299. if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
  11300. if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {
  11301. createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
  11302. } else {
  11303. INCORRECT_VALUES_NAME = true;
  11304. defaultIterator = function values() { return call(nativeIterator, this); };
  11305. }
  11306. }
  11307. // export additional methods
  11308. if (DEFAULT) {
  11309. methods = {
  11310. values: getIterationMethod(VALUES),
  11311. keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
  11312. entries: getIterationMethod(ENTRIES)
  11313. };
  11314. if (FORCED) for (KEY in methods) {
  11315. if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
  11316. redefine(IterablePrototype, KEY, methods[KEY]);
  11317. }
  11318. } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
  11319. }
  11320. // define iterator
  11321. if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
  11322. redefine(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });
  11323. }
  11324. Iterators[NAME] = defaultIterator;
  11325. return methods;
  11326. };
  11327. },{"../internals/create-iterator-constructor":128,"../internals/create-non-enumerable-property":129,"../internals/export":149,"../internals/function-call":155,"../internals/function-name":156,"../internals/is-callable":176,"../internals/is-pure":181,"../internals/iterators":187,"../internals/iterators-core":186,"../internals/object-get-prototype-of":203,"../internals/object-set-prototype-of":208,"../internals/redefine":222,"../internals/set-to-string-tag":234,"../internals/well-known-symbol":268}],133:[function(require,module,exports){
  11328. var path = require('../internals/path');
  11329. var hasOwn = require('../internals/has-own-property');
  11330. var wrappedWellKnownSymbolModule = require('../internals/well-known-symbol-wrapped');
  11331. var defineProperty = require('../internals/object-define-property').f;
  11332. module.exports = function (NAME) {
  11333. var Symbol = path.Symbol || (path.Symbol = {});
  11334. if (!hasOwn(Symbol, NAME)) defineProperty(Symbol, NAME, {
  11335. value: wrappedWellKnownSymbolModule.f(NAME)
  11336. });
  11337. };
  11338. },{"../internals/has-own-property":164,"../internals/object-define-property":198,"../internals/path":213,"../internals/well-known-symbol-wrapped":267}],134:[function(require,module,exports){
  11339. var fails = require('../internals/fails');
  11340. // Detect IE8's incomplete defineProperty implementation
  11341. module.exports = !fails(function () {
  11342. // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
  11343. return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
  11344. });
  11345. },{"../internals/fails":150}],135:[function(require,module,exports){
  11346. var global = require('../internals/global');
  11347. var isObject = require('../internals/is-object');
  11348. var document = global.document;
  11349. // typeof document.createElement is 'object' in old IE
  11350. var EXISTS = isObject(document) && isObject(document.createElement);
  11351. module.exports = function (it) {
  11352. return EXISTS ? document.createElement(it) : {};
  11353. };
  11354. },{"../internals/global":163,"../internals/is-object":180}],136:[function(require,module,exports){
  11355. // iterable DOM collections
  11356. // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
  11357. module.exports = {
  11358. CSSRuleList: 0,
  11359. CSSStyleDeclaration: 0,
  11360. CSSValueList: 0,
  11361. ClientRectList: 0,
  11362. DOMRectList: 0,
  11363. DOMStringList: 0,
  11364. DOMTokenList: 1,
  11365. DataTransferItemList: 0,
  11366. FileList: 0,
  11367. HTMLAllCollection: 0,
  11368. HTMLCollection: 0,
  11369. HTMLFormElement: 0,
  11370. HTMLSelectElement: 0,
  11371. MediaList: 0,
  11372. MimeTypeArray: 0,
  11373. NamedNodeMap: 0,
  11374. NodeList: 1,
  11375. PaintRequestList: 0,
  11376. Plugin: 0,
  11377. PluginArray: 0,
  11378. SVGLengthList: 0,
  11379. SVGNumberList: 0,
  11380. SVGPathSegList: 0,
  11381. SVGPointList: 0,
  11382. SVGStringList: 0,
  11383. SVGTransformList: 0,
  11384. SourceBufferList: 0,
  11385. StyleSheetList: 0,
  11386. TextTrackCueList: 0,
  11387. TextTrackList: 0,
  11388. TouchList: 0
  11389. };
  11390. },{}],137:[function(require,module,exports){
  11391. // in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
  11392. var documentCreateElement = require('../internals/document-create-element');
  11393. var classList = documentCreateElement('span').classList;
  11394. var DOMTokenListPrototype = classList && classList.constructor && classList.constructor.prototype;
  11395. module.exports = DOMTokenListPrototype === Object.prototype ? undefined : DOMTokenListPrototype;
  11396. },{"../internals/document-create-element":135}],138:[function(require,module,exports){
  11397. var userAgent = require('../internals/engine-user-agent');
  11398. var firefox = userAgent.match(/firefox\/(\d+)/i);
  11399. module.exports = !!firefox && +firefox[1];
  11400. },{"../internals/engine-user-agent":145}],139:[function(require,module,exports){
  11401. module.exports = typeof window == 'object' && typeof Deno != 'object';
  11402. },{}],140:[function(require,module,exports){
  11403. var UA = require('../internals/engine-user-agent');
  11404. module.exports = /MSIE|Trident/.test(UA);
  11405. },{"../internals/engine-user-agent":145}],141:[function(require,module,exports){
  11406. var userAgent = require('../internals/engine-user-agent');
  11407. var global = require('../internals/global');
  11408. module.exports = /ipad|iphone|ipod/i.test(userAgent) && global.Pebble !== undefined;
  11409. },{"../internals/engine-user-agent":145,"../internals/global":163}],142:[function(require,module,exports){
  11410. var userAgent = require('../internals/engine-user-agent');
  11411. module.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent);
  11412. },{"../internals/engine-user-agent":145}],143:[function(require,module,exports){
  11413. var classof = require('../internals/classof-raw');
  11414. var global = require('../internals/global');
  11415. module.exports = classof(global.process) == 'process';
  11416. },{"../internals/classof-raw":123,"../internals/global":163}],144:[function(require,module,exports){
  11417. var userAgent = require('../internals/engine-user-agent');
  11418. module.exports = /web0s(?!.*chrome)/i.test(userAgent);
  11419. },{"../internals/engine-user-agent":145}],145:[function(require,module,exports){
  11420. var getBuiltIn = require('../internals/get-built-in');
  11421. module.exports = getBuiltIn('navigator', 'userAgent') || '';
  11422. },{"../internals/get-built-in":158}],146:[function(require,module,exports){
  11423. var global = require('../internals/global');
  11424. var userAgent = require('../internals/engine-user-agent');
  11425. var process = global.process;
  11426. var Deno = global.Deno;
  11427. var versions = process && process.versions || Deno && Deno.version;
  11428. var v8 = versions && versions.v8;
  11429. var match, version;
  11430. if (v8) {
  11431. match = v8.split('.');
  11432. // in old Chrome, versions of V8 isn't V8 = Chrome / 10
  11433. // but their correct versions are not interesting for us
  11434. version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
  11435. }
  11436. // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
  11437. // so check `userAgent` even if `.v8` exists, but 0
  11438. if (!version && userAgent) {
  11439. match = userAgent.match(/Edge\/(\d+)/);
  11440. if (!match || match[1] >= 74) {
  11441. match = userAgent.match(/Chrome\/(\d+)/);
  11442. if (match) version = +match[1];
  11443. }
  11444. }
  11445. module.exports = version;
  11446. },{"../internals/engine-user-agent":145,"../internals/global":163}],147:[function(require,module,exports){
  11447. var userAgent = require('../internals/engine-user-agent');
  11448. var webkit = userAgent.match(/AppleWebKit\/(\d+)\./);
  11449. module.exports = !!webkit && +webkit[1];
  11450. },{"../internals/engine-user-agent":145}],148:[function(require,module,exports){
  11451. // IE8- don't enum bug keys
  11452. module.exports = [
  11453. 'constructor',
  11454. 'hasOwnProperty',
  11455. 'isPrototypeOf',
  11456. 'propertyIsEnumerable',
  11457. 'toLocaleString',
  11458. 'toString',
  11459. 'valueOf'
  11460. ];
  11461. },{}],149:[function(require,module,exports){
  11462. var global = require('../internals/global');
  11463. var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
  11464. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  11465. var redefine = require('../internals/redefine');
  11466. var setGlobal = require('../internals/set-global');
  11467. var copyConstructorProperties = require('../internals/copy-constructor-properties');
  11468. var isForced = require('../internals/is-forced');
  11469. /*
  11470. options.target - name of the target object
  11471. options.global - target is the global object
  11472. options.stat - export as static methods of target
  11473. options.proto - export as prototype methods of target
  11474. options.real - real prototype method for the `pure` version
  11475. options.forced - export even if the native feature is available
  11476. options.bind - bind methods to the target, required for the `pure` version
  11477. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  11478. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  11479. options.sham - add a flag to not completely full polyfills
  11480. options.enumerable - export as enumerable property
  11481. options.noTargetGet - prevent calling a getter on target
  11482. options.name - the .name of the function if it does not match the key
  11483. */
  11484. module.exports = function (options, source) {
  11485. var TARGET = options.target;
  11486. var GLOBAL = options.global;
  11487. var STATIC = options.stat;
  11488. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  11489. if (GLOBAL) {
  11490. target = global;
  11491. } else if (STATIC) {
  11492. target = global[TARGET] || setGlobal(TARGET, {});
  11493. } else {
  11494. target = (global[TARGET] || {}).prototype;
  11495. }
  11496. if (target) for (key in source) {
  11497. sourceProperty = source[key];
  11498. if (options.noTargetGet) {
  11499. descriptor = getOwnPropertyDescriptor(target, key);
  11500. targetProperty = descriptor && descriptor.value;
  11501. } else targetProperty = target[key];
  11502. FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  11503. // contained in target
  11504. if (!FORCED && targetProperty !== undefined) {
  11505. if (typeof sourceProperty == typeof targetProperty) continue;
  11506. copyConstructorProperties(sourceProperty, targetProperty);
  11507. }
  11508. // add a flag to not completely full polyfills
  11509. if (options.sham || (targetProperty && targetProperty.sham)) {
  11510. createNonEnumerableProperty(sourceProperty, 'sham', true);
  11511. }
  11512. // extend global
  11513. redefine(target, key, sourceProperty, options);
  11514. }
  11515. };
  11516. },{"../internals/copy-constructor-properties":125,"../internals/create-non-enumerable-property":129,"../internals/global":163,"../internals/is-forced":178,"../internals/object-get-own-property-descriptor":199,"../internals/redefine":222,"../internals/set-global":232}],150:[function(require,module,exports){
  11517. module.exports = function (exec) {
  11518. try {
  11519. return !!exec();
  11520. } catch (error) {
  11521. return true;
  11522. }
  11523. };
  11524. },{}],151:[function(require,module,exports){
  11525. 'use strict';
  11526. // TODO: Remove from `core-js@4` since it's moved to entry points
  11527. require('../modules/es.regexp.exec');
  11528. var uncurryThis = require('../internals/function-uncurry-this');
  11529. var redefine = require('../internals/redefine');
  11530. var regexpExec = require('../internals/regexp-exec');
  11531. var fails = require('../internals/fails');
  11532. var wellKnownSymbol = require('../internals/well-known-symbol');
  11533. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  11534. var SPECIES = wellKnownSymbol('species');
  11535. var RegExpPrototype = RegExp.prototype;
  11536. module.exports = function (KEY, exec, FORCED, SHAM) {
  11537. var SYMBOL = wellKnownSymbol(KEY);
  11538. var DELEGATES_TO_SYMBOL = !fails(function () {
  11539. // String methods call symbol-named RegEp methods
  11540. var O = {};
  11541. O[SYMBOL] = function () { return 7; };
  11542. return ''[KEY](O) != 7;
  11543. });
  11544. var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
  11545. // Symbol-named RegExp methods call .exec
  11546. var execCalled = false;
  11547. var re = /a/;
  11548. if (KEY === 'split') {
  11549. // We can't use real regex here since it causes deoptimization
  11550. // and serious performance degradation in V8
  11551. // https://github.com/zloirock/core-js/issues/306
  11552. re = {};
  11553. // RegExp[@@split] doesn't call the regex's exec method, but first creates
  11554. // a new one. We need to return the patched regex when creating the new one.
  11555. re.constructor = {};
  11556. re.constructor[SPECIES] = function () { return re; };
  11557. re.flags = '';
  11558. re[SYMBOL] = /./[SYMBOL];
  11559. }
  11560. re.exec = function () { execCalled = true; return null; };
  11561. re[SYMBOL]('');
  11562. return !execCalled;
  11563. });
  11564. if (
  11565. !DELEGATES_TO_SYMBOL ||
  11566. !DELEGATES_TO_EXEC ||
  11567. FORCED
  11568. ) {
  11569. var uncurriedNativeRegExpMethod = uncurryThis(/./[SYMBOL]);
  11570. var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
  11571. var uncurriedNativeMethod = uncurryThis(nativeMethod);
  11572. var $exec = regexp.exec;
  11573. if ($exec === regexpExec || $exec === RegExpPrototype.exec) {
  11574. if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
  11575. // The native String method already delegates to @@method (this
  11576. // polyfilled function), leasing to infinite recursion.
  11577. // We avoid it by directly calling the native @@method method.
  11578. return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) };
  11579. }
  11580. return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) };
  11581. }
  11582. return { done: false };
  11583. });
  11584. redefine(String.prototype, KEY, methods[0]);
  11585. redefine(RegExpPrototype, SYMBOL, methods[1]);
  11586. }
  11587. if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);
  11588. };
  11589. },{"../internals/create-non-enumerable-property":129,"../internals/fails":150,"../internals/function-uncurry-this":157,"../internals/redefine":222,"../internals/regexp-exec":224,"../internals/well-known-symbol":268,"../modules/es.regexp.exec":300}],152:[function(require,module,exports){
  11590. var NATIVE_BIND = require('../internals/function-bind-native');
  11591. var FunctionPrototype = Function.prototype;
  11592. var apply = FunctionPrototype.apply;
  11593. var call = FunctionPrototype.call;
  11594. // eslint-disable-next-line es-x/no-reflect -- safe
  11595. module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () {
  11596. return call.apply(apply, arguments);
  11597. });
  11598. },{"../internals/function-bind-native":154}],153:[function(require,module,exports){
  11599. var uncurryThis = require('../internals/function-uncurry-this');
  11600. var aCallable = require('../internals/a-callable');
  11601. var NATIVE_BIND = require('../internals/function-bind-native');
  11602. var bind = uncurryThis(uncurryThis.bind);
  11603. // optional / simple context binding
  11604. module.exports = function (fn, that) {
  11605. aCallable(fn);
  11606. return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) {
  11607. return fn.apply(that, arguments);
  11608. };
  11609. };
  11610. },{"../internals/a-callable":95,"../internals/function-bind-native":154,"../internals/function-uncurry-this":157}],154:[function(require,module,exports){
  11611. var fails = require('../internals/fails');
  11612. module.exports = !fails(function () {
  11613. // eslint-disable-next-line es-x/no-function-prototype-bind -- safe
  11614. var test = (function () { /* empty */ }).bind();
  11615. // eslint-disable-next-line no-prototype-builtins -- safe
  11616. return typeof test != 'function' || test.hasOwnProperty('prototype');
  11617. });
  11618. },{"../internals/fails":150}],155:[function(require,module,exports){
  11619. var NATIVE_BIND = require('../internals/function-bind-native');
  11620. var call = Function.prototype.call;
  11621. module.exports = NATIVE_BIND ? call.bind(call) : function () {
  11622. return call.apply(call, arguments);
  11623. };
  11624. },{"../internals/function-bind-native":154}],156:[function(require,module,exports){
  11625. var DESCRIPTORS = require('../internals/descriptors');
  11626. var hasOwn = require('../internals/has-own-property');
  11627. var FunctionPrototype = Function.prototype;
  11628. // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
  11629. var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
  11630. var EXISTS = hasOwn(FunctionPrototype, 'name');
  11631. // additional protection from minified / mangled / dropped function names
  11632. var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
  11633. var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
  11634. module.exports = {
  11635. EXISTS: EXISTS,
  11636. PROPER: PROPER,
  11637. CONFIGURABLE: CONFIGURABLE
  11638. };
  11639. },{"../internals/descriptors":134,"../internals/has-own-property":164}],157:[function(require,module,exports){
  11640. var NATIVE_BIND = require('../internals/function-bind-native');
  11641. var FunctionPrototype = Function.prototype;
  11642. var bind = FunctionPrototype.bind;
  11643. var call = FunctionPrototype.call;
  11644. var uncurryThis = NATIVE_BIND && bind.bind(call, call);
  11645. module.exports = NATIVE_BIND ? function (fn) {
  11646. return fn && uncurryThis(fn);
  11647. } : function (fn) {
  11648. return fn && function () {
  11649. return call.apply(fn, arguments);
  11650. };
  11651. };
  11652. },{"../internals/function-bind-native":154}],158:[function(require,module,exports){
  11653. var global = require('../internals/global');
  11654. var isCallable = require('../internals/is-callable');
  11655. var aFunction = function (argument) {
  11656. return isCallable(argument) ? argument : undefined;
  11657. };
  11658. module.exports = function (namespace, method) {
  11659. return arguments.length < 2 ? aFunction(global[namespace]) : global[namespace] && global[namespace][method];
  11660. };
  11661. },{"../internals/global":163,"../internals/is-callable":176}],159:[function(require,module,exports){
  11662. var classof = require('../internals/classof');
  11663. var getMethod = require('../internals/get-method');
  11664. var Iterators = require('../internals/iterators');
  11665. var wellKnownSymbol = require('../internals/well-known-symbol');
  11666. var ITERATOR = wellKnownSymbol('iterator');
  11667. module.exports = function (it) {
  11668. if (it != undefined) return getMethod(it, ITERATOR)
  11669. || getMethod(it, '@@iterator')
  11670. || Iterators[classof(it)];
  11671. };
  11672. },{"../internals/classof":124,"../internals/get-method":161,"../internals/iterators":187,"../internals/well-known-symbol":268}],160:[function(require,module,exports){
  11673. var global = require('../internals/global');
  11674. var call = require('../internals/function-call');
  11675. var aCallable = require('../internals/a-callable');
  11676. var anObject = require('../internals/an-object');
  11677. var tryToString = require('../internals/try-to-string');
  11678. var getIteratorMethod = require('../internals/get-iterator-method');
  11679. var TypeError = global.TypeError;
  11680. module.exports = function (argument, usingIterator) {
  11681. var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
  11682. if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));
  11683. throw TypeError(tryToString(argument) + ' is not iterable');
  11684. };
  11685. },{"../internals/a-callable":95,"../internals/an-object":101,"../internals/function-call":155,"../internals/get-iterator-method":159,"../internals/global":163,"../internals/try-to-string":257}],161:[function(require,module,exports){
  11686. var aCallable = require('../internals/a-callable');
  11687. // `GetMethod` abstract operation
  11688. // https://tc39.es/ecma262/#sec-getmethod
  11689. module.exports = function (V, P) {
  11690. var func = V[P];
  11691. return func == null ? undefined : aCallable(func);
  11692. };
  11693. },{"../internals/a-callable":95}],162:[function(require,module,exports){
  11694. var uncurryThis = require('../internals/function-uncurry-this');
  11695. var toObject = require('../internals/to-object');
  11696. var floor = Math.floor;
  11697. var charAt = uncurryThis(''.charAt);
  11698. var replace = uncurryThis(''.replace);
  11699. var stringSlice = uncurryThis(''.slice);
  11700. var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
  11701. var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
  11702. // `GetSubstitution` abstract operation
  11703. // https://tc39.es/ecma262/#sec-getsubstitution
  11704. module.exports = function (matched, str, position, captures, namedCaptures, replacement) {
  11705. var tailPos = position + matched.length;
  11706. var m = captures.length;
  11707. var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
  11708. if (namedCaptures !== undefined) {
  11709. namedCaptures = toObject(namedCaptures);
  11710. symbols = SUBSTITUTION_SYMBOLS;
  11711. }
  11712. return replace(replacement, symbols, function (match, ch) {
  11713. var capture;
  11714. switch (charAt(ch, 0)) {
  11715. case '$': return '$';
  11716. case '&': return matched;
  11717. case '`': return stringSlice(str, 0, position);
  11718. case "'": return stringSlice(str, tailPos);
  11719. case '<':
  11720. capture = namedCaptures[stringSlice(ch, 1, -1)];
  11721. break;
  11722. default: // \d\d?
  11723. var n = +ch;
  11724. if (n === 0) return match;
  11725. if (n > m) {
  11726. var f = floor(n / 10);
  11727. if (f === 0) return match;
  11728. if (f <= m) return captures[f - 1] === undefined ? charAt(ch, 1) : captures[f - 1] + charAt(ch, 1);
  11729. return match;
  11730. }
  11731. capture = captures[n - 1];
  11732. }
  11733. return capture === undefined ? '' : capture;
  11734. });
  11735. };
  11736. },{"../internals/function-uncurry-this":157,"../internals/to-object":250}],163:[function(require,module,exports){
  11737. (function (global){(function (){
  11738. var check = function (it) {
  11739. return it && it.Math == Math && it;
  11740. };
  11741. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  11742. module.exports =
  11743. // eslint-disable-next-line es-x/no-global-this -- safe
  11744. check(typeof globalThis == 'object' && globalThis) ||
  11745. check(typeof window == 'object' && window) ||
  11746. // eslint-disable-next-line no-restricted-globals -- safe
  11747. check(typeof self == 'object' && self) ||
  11748. check(typeof global == 'object' && global) ||
  11749. // eslint-disable-next-line no-new-func -- fallback
  11750. (function () { return this; })() || Function('return this')();
  11751. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  11752. },{}],164:[function(require,module,exports){
  11753. var uncurryThis = require('../internals/function-uncurry-this');
  11754. var toObject = require('../internals/to-object');
  11755. var hasOwnProperty = uncurryThis({}.hasOwnProperty);
  11756. // `HasOwnProperty` abstract operation
  11757. // https://tc39.es/ecma262/#sec-hasownproperty
  11758. // eslint-disable-next-line es-x/no-object-hasown -- safe
  11759. module.exports = Object.hasOwn || function hasOwn(it, key) {
  11760. return hasOwnProperty(toObject(it), key);
  11761. };
  11762. },{"../internals/function-uncurry-this":157,"../internals/to-object":250}],165:[function(require,module,exports){
  11763. module.exports = {};
  11764. },{}],166:[function(require,module,exports){
  11765. var global = require('../internals/global');
  11766. module.exports = function (a, b) {
  11767. var console = global.console;
  11768. if (console && console.error) {
  11769. arguments.length == 1 ? console.error(a) : console.error(a, b);
  11770. }
  11771. };
  11772. },{"../internals/global":163}],167:[function(require,module,exports){
  11773. var getBuiltIn = require('../internals/get-built-in');
  11774. module.exports = getBuiltIn('document', 'documentElement');
  11775. },{"../internals/get-built-in":158}],168:[function(require,module,exports){
  11776. var DESCRIPTORS = require('../internals/descriptors');
  11777. var fails = require('../internals/fails');
  11778. var createElement = require('../internals/document-create-element');
  11779. // Thanks to IE8 for its funny defineProperty
  11780. module.exports = !DESCRIPTORS && !fails(function () {
  11781. // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
  11782. return Object.defineProperty(createElement('div'), 'a', {
  11783. get: function () { return 7; }
  11784. }).a != 7;
  11785. });
  11786. },{"../internals/descriptors":134,"../internals/document-create-element":135,"../internals/fails":150}],169:[function(require,module,exports){
  11787. // IEEE754 conversions based on https://github.com/feross/ieee754
  11788. var global = require('../internals/global');
  11789. var Array = global.Array;
  11790. var abs = Math.abs;
  11791. var pow = Math.pow;
  11792. var floor = Math.floor;
  11793. var log = Math.log;
  11794. var LN2 = Math.LN2;
  11795. var pack = function (number, mantissaLength, bytes) {
  11796. var buffer = Array(bytes);
  11797. var exponentLength = bytes * 8 - mantissaLength - 1;
  11798. var eMax = (1 << exponentLength) - 1;
  11799. var eBias = eMax >> 1;
  11800. var rt = mantissaLength === 23 ? pow(2, -24) - pow(2, -77) : 0;
  11801. var sign = number < 0 || number === 0 && 1 / number < 0 ? 1 : 0;
  11802. var index = 0;
  11803. var exponent, mantissa, c;
  11804. number = abs(number);
  11805. // eslint-disable-next-line no-self-compare -- NaN check
  11806. if (number != number || number === Infinity) {
  11807. // eslint-disable-next-line no-self-compare -- NaN check
  11808. mantissa = number != number ? 1 : 0;
  11809. exponent = eMax;
  11810. } else {
  11811. exponent = floor(log(number) / LN2);
  11812. c = pow(2, -exponent);
  11813. if (number * c < 1) {
  11814. exponent--;
  11815. c *= 2;
  11816. }
  11817. if (exponent + eBias >= 1) {
  11818. number += rt / c;
  11819. } else {
  11820. number += rt * pow(2, 1 - eBias);
  11821. }
  11822. if (number * c >= 2) {
  11823. exponent++;
  11824. c /= 2;
  11825. }
  11826. if (exponent + eBias >= eMax) {
  11827. mantissa = 0;
  11828. exponent = eMax;
  11829. } else if (exponent + eBias >= 1) {
  11830. mantissa = (number * c - 1) * pow(2, mantissaLength);
  11831. exponent = exponent + eBias;
  11832. } else {
  11833. mantissa = number * pow(2, eBias - 1) * pow(2, mantissaLength);
  11834. exponent = 0;
  11835. }
  11836. }
  11837. while (mantissaLength >= 8) {
  11838. buffer[index++] = mantissa & 255;
  11839. mantissa /= 256;
  11840. mantissaLength -= 8;
  11841. }
  11842. exponent = exponent << mantissaLength | mantissa;
  11843. exponentLength += mantissaLength;
  11844. while (exponentLength > 0) {
  11845. buffer[index++] = exponent & 255;
  11846. exponent /= 256;
  11847. exponentLength -= 8;
  11848. }
  11849. buffer[--index] |= sign * 128;
  11850. return buffer;
  11851. };
  11852. var unpack = function (buffer, mantissaLength) {
  11853. var bytes = buffer.length;
  11854. var exponentLength = bytes * 8 - mantissaLength - 1;
  11855. var eMax = (1 << exponentLength) - 1;
  11856. var eBias = eMax >> 1;
  11857. var nBits = exponentLength - 7;
  11858. var index = bytes - 1;
  11859. var sign = buffer[index--];
  11860. var exponent = sign & 127;
  11861. var mantissa;
  11862. sign >>= 7;
  11863. while (nBits > 0) {
  11864. exponent = exponent * 256 + buffer[index--];
  11865. nBits -= 8;
  11866. }
  11867. mantissa = exponent & (1 << -nBits) - 1;
  11868. exponent >>= -nBits;
  11869. nBits += mantissaLength;
  11870. while (nBits > 0) {
  11871. mantissa = mantissa * 256 + buffer[index--];
  11872. nBits -= 8;
  11873. }
  11874. if (exponent === 0) {
  11875. exponent = 1 - eBias;
  11876. } else if (exponent === eMax) {
  11877. return mantissa ? NaN : sign ? -Infinity : Infinity;
  11878. } else {
  11879. mantissa = mantissa + pow(2, mantissaLength);
  11880. exponent = exponent - eBias;
  11881. } return (sign ? -1 : 1) * mantissa * pow(2, exponent - mantissaLength);
  11882. };
  11883. module.exports = {
  11884. pack: pack,
  11885. unpack: unpack
  11886. };
  11887. },{"../internals/global":163}],170:[function(require,module,exports){
  11888. var global = require('../internals/global');
  11889. var uncurryThis = require('../internals/function-uncurry-this');
  11890. var fails = require('../internals/fails');
  11891. var classof = require('../internals/classof-raw');
  11892. var Object = global.Object;
  11893. var split = uncurryThis(''.split);
  11894. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  11895. module.exports = fails(function () {
  11896. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  11897. // eslint-disable-next-line no-prototype-builtins -- safe
  11898. return !Object('z').propertyIsEnumerable(0);
  11899. }) ? function (it) {
  11900. return classof(it) == 'String' ? split(it, '') : Object(it);
  11901. } : Object;
  11902. },{"../internals/classof-raw":123,"../internals/fails":150,"../internals/function-uncurry-this":157,"../internals/global":163}],171:[function(require,module,exports){
  11903. var isCallable = require('../internals/is-callable');
  11904. var isObject = require('../internals/is-object');
  11905. var setPrototypeOf = require('../internals/object-set-prototype-of');
  11906. // makes subclassing work correct for wrapped built-ins
  11907. module.exports = function ($this, dummy, Wrapper) {
  11908. var NewTarget, NewTargetPrototype;
  11909. if (
  11910. // it can work only with native `setPrototypeOf`
  11911. setPrototypeOf &&
  11912. // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
  11913. isCallable(NewTarget = dummy.constructor) &&
  11914. NewTarget !== Wrapper &&
  11915. isObject(NewTargetPrototype = NewTarget.prototype) &&
  11916. NewTargetPrototype !== Wrapper.prototype
  11917. ) setPrototypeOf($this, NewTargetPrototype);
  11918. return $this;
  11919. };
  11920. },{"../internals/is-callable":176,"../internals/is-object":180,"../internals/object-set-prototype-of":208}],172:[function(require,module,exports){
  11921. var uncurryThis = require('../internals/function-uncurry-this');
  11922. var isCallable = require('../internals/is-callable');
  11923. var store = require('../internals/shared-store');
  11924. var functionToString = uncurryThis(Function.toString);
  11925. // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
  11926. if (!isCallable(store.inspectSource)) {
  11927. store.inspectSource = function (it) {
  11928. return functionToString(it);
  11929. };
  11930. }
  11931. module.exports = store.inspectSource;
  11932. },{"../internals/function-uncurry-this":157,"../internals/is-callable":176,"../internals/shared-store":236}],173:[function(require,module,exports){
  11933. var NATIVE_WEAK_MAP = require('../internals/native-weak-map');
  11934. var global = require('../internals/global');
  11935. var uncurryThis = require('../internals/function-uncurry-this');
  11936. var isObject = require('../internals/is-object');
  11937. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  11938. var hasOwn = require('../internals/has-own-property');
  11939. var shared = require('../internals/shared-store');
  11940. var sharedKey = require('../internals/shared-key');
  11941. var hiddenKeys = require('../internals/hidden-keys');
  11942. var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
  11943. var TypeError = global.TypeError;
  11944. var WeakMap = global.WeakMap;
  11945. var set, get, has;
  11946. var enforce = function (it) {
  11947. return has(it) ? get(it) : set(it, {});
  11948. };
  11949. var getterFor = function (TYPE) {
  11950. return function (it) {
  11951. var state;
  11952. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  11953. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  11954. } return state;
  11955. };
  11956. };
  11957. if (NATIVE_WEAK_MAP || shared.state) {
  11958. var store = shared.state || (shared.state = new WeakMap());
  11959. var wmget = uncurryThis(store.get);
  11960. var wmhas = uncurryThis(store.has);
  11961. var wmset = uncurryThis(store.set);
  11962. set = function (it, metadata) {
  11963. if (wmhas(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
  11964. metadata.facade = it;
  11965. wmset(store, it, metadata);
  11966. return metadata;
  11967. };
  11968. get = function (it) {
  11969. return wmget(store, it) || {};
  11970. };
  11971. has = function (it) {
  11972. return wmhas(store, it);
  11973. };
  11974. } else {
  11975. var STATE = sharedKey('state');
  11976. hiddenKeys[STATE] = true;
  11977. set = function (it, metadata) {
  11978. if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
  11979. metadata.facade = it;
  11980. createNonEnumerableProperty(it, STATE, metadata);
  11981. return metadata;
  11982. };
  11983. get = function (it) {
  11984. return hasOwn(it, STATE) ? it[STATE] : {};
  11985. };
  11986. has = function (it) {
  11987. return hasOwn(it, STATE);
  11988. };
  11989. }
  11990. module.exports = {
  11991. set: set,
  11992. get: get,
  11993. has: has,
  11994. enforce: enforce,
  11995. getterFor: getterFor
  11996. };
  11997. },{"../internals/create-non-enumerable-property":129,"../internals/function-uncurry-this":157,"../internals/global":163,"../internals/has-own-property":164,"../internals/hidden-keys":165,"../internals/is-object":180,"../internals/native-weak-map":192,"../internals/shared-key":235,"../internals/shared-store":236}],174:[function(require,module,exports){
  11998. var wellKnownSymbol = require('../internals/well-known-symbol');
  11999. var Iterators = require('../internals/iterators');
  12000. var ITERATOR = wellKnownSymbol('iterator');
  12001. var ArrayPrototype = Array.prototype;
  12002. // check on default Array iterator
  12003. module.exports = function (it) {
  12004. return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
  12005. };
  12006. },{"../internals/iterators":187,"../internals/well-known-symbol":268}],175:[function(require,module,exports){
  12007. var classof = require('../internals/classof-raw');
  12008. // `IsArray` abstract operation
  12009. // https://tc39.es/ecma262/#sec-isarray
  12010. // eslint-disable-next-line es-x/no-array-isarray -- safe
  12011. module.exports = Array.isArray || function isArray(argument) {
  12012. return classof(argument) == 'Array';
  12013. };
  12014. },{"../internals/classof-raw":123}],176:[function(require,module,exports){
  12015. // `IsCallable` abstract operation
  12016. // https://tc39.es/ecma262/#sec-iscallable
  12017. module.exports = function (argument) {
  12018. return typeof argument == 'function';
  12019. };
  12020. },{}],177:[function(require,module,exports){
  12021. var uncurryThis = require('../internals/function-uncurry-this');
  12022. var fails = require('../internals/fails');
  12023. var isCallable = require('../internals/is-callable');
  12024. var classof = require('../internals/classof');
  12025. var getBuiltIn = require('../internals/get-built-in');
  12026. var inspectSource = require('../internals/inspect-source');
  12027. var noop = function () { /* empty */ };
  12028. var empty = [];
  12029. var construct = getBuiltIn('Reflect', 'construct');
  12030. var constructorRegExp = /^\s*(?:class|function)\b/;
  12031. var exec = uncurryThis(constructorRegExp.exec);
  12032. var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
  12033. var isConstructorModern = function isConstructor(argument) {
  12034. if (!isCallable(argument)) return false;
  12035. try {
  12036. construct(noop, empty, argument);
  12037. return true;
  12038. } catch (error) {
  12039. return false;
  12040. }
  12041. };
  12042. var isConstructorLegacy = function isConstructor(argument) {
  12043. if (!isCallable(argument)) return false;
  12044. switch (classof(argument)) {
  12045. case 'AsyncFunction':
  12046. case 'GeneratorFunction':
  12047. case 'AsyncGeneratorFunction': return false;
  12048. }
  12049. try {
  12050. // we can't check .prototype since constructors produced by .bind haven't it
  12051. // `Function#toString` throws on some built-it function in some legacy engines
  12052. // (for example, `DOMQuad` and similar in FF41-)
  12053. return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
  12054. } catch (error) {
  12055. return true;
  12056. }
  12057. };
  12058. isConstructorLegacy.sham = true;
  12059. // `IsConstructor` abstract operation
  12060. // https://tc39.es/ecma262/#sec-isconstructor
  12061. module.exports = !construct || fails(function () {
  12062. var called;
  12063. return isConstructorModern(isConstructorModern.call)
  12064. || !isConstructorModern(Object)
  12065. || !isConstructorModern(function () { called = true; })
  12066. || called;
  12067. }) ? isConstructorLegacy : isConstructorModern;
  12068. },{"../internals/classof":124,"../internals/fails":150,"../internals/function-uncurry-this":157,"../internals/get-built-in":158,"../internals/inspect-source":172,"../internals/is-callable":176}],178:[function(require,module,exports){
  12069. var fails = require('../internals/fails');
  12070. var isCallable = require('../internals/is-callable');
  12071. var replacement = /#|\.prototype\./;
  12072. var isForced = function (feature, detection) {
  12073. var value = data[normalize(feature)];
  12074. return value == POLYFILL ? true
  12075. : value == NATIVE ? false
  12076. : isCallable(detection) ? fails(detection)
  12077. : !!detection;
  12078. };
  12079. var normalize = isForced.normalize = function (string) {
  12080. return String(string).replace(replacement, '.').toLowerCase();
  12081. };
  12082. var data = isForced.data = {};
  12083. var NATIVE = isForced.NATIVE = 'N';
  12084. var POLYFILL = isForced.POLYFILL = 'P';
  12085. module.exports = isForced;
  12086. },{"../internals/fails":150,"../internals/is-callable":176}],179:[function(require,module,exports){
  12087. var isObject = require('../internals/is-object');
  12088. var floor = Math.floor;
  12089. // `IsIntegralNumber` abstract operation
  12090. // https://tc39.es/ecma262/#sec-isintegralnumber
  12091. // eslint-disable-next-line es-x/no-number-isinteger -- safe
  12092. module.exports = Number.isInteger || function isInteger(it) {
  12093. return !isObject(it) && isFinite(it) && floor(it) === it;
  12094. };
  12095. },{"../internals/is-object":180}],180:[function(require,module,exports){
  12096. var isCallable = require('../internals/is-callable');
  12097. module.exports = function (it) {
  12098. return typeof it == 'object' ? it !== null : isCallable(it);
  12099. };
  12100. },{"../internals/is-callable":176}],181:[function(require,module,exports){
  12101. module.exports = false;
  12102. },{}],182:[function(require,module,exports){
  12103. var isObject = require('../internals/is-object');
  12104. var classof = require('../internals/classof-raw');
  12105. var wellKnownSymbol = require('../internals/well-known-symbol');
  12106. var MATCH = wellKnownSymbol('match');
  12107. // `IsRegExp` abstract operation
  12108. // https://tc39.es/ecma262/#sec-isregexp
  12109. module.exports = function (it) {
  12110. var isRegExp;
  12111. return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp');
  12112. };
  12113. },{"../internals/classof-raw":123,"../internals/is-object":180,"../internals/well-known-symbol":268}],183:[function(require,module,exports){
  12114. var global = require('../internals/global');
  12115. var getBuiltIn = require('../internals/get-built-in');
  12116. var isCallable = require('../internals/is-callable');
  12117. var isPrototypeOf = require('../internals/object-is-prototype-of');
  12118. var USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');
  12119. var Object = global.Object;
  12120. module.exports = USE_SYMBOL_AS_UID ? function (it) {
  12121. return typeof it == 'symbol';
  12122. } : function (it) {
  12123. var $Symbol = getBuiltIn('Symbol');
  12124. return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, Object(it));
  12125. };
  12126. },{"../internals/get-built-in":158,"../internals/global":163,"../internals/is-callable":176,"../internals/object-is-prototype-of":204,"../internals/use-symbol-as-uid":264}],184:[function(require,module,exports){
  12127. var global = require('../internals/global');
  12128. var bind = require('../internals/function-bind-context');
  12129. var call = require('../internals/function-call');
  12130. var anObject = require('../internals/an-object');
  12131. var tryToString = require('../internals/try-to-string');
  12132. var isArrayIteratorMethod = require('../internals/is-array-iterator-method');
  12133. var lengthOfArrayLike = require('../internals/length-of-array-like');
  12134. var isPrototypeOf = require('../internals/object-is-prototype-of');
  12135. var getIterator = require('../internals/get-iterator');
  12136. var getIteratorMethod = require('../internals/get-iterator-method');
  12137. var iteratorClose = require('../internals/iterator-close');
  12138. var TypeError = global.TypeError;
  12139. var Result = function (stopped, result) {
  12140. this.stopped = stopped;
  12141. this.result = result;
  12142. };
  12143. var ResultPrototype = Result.prototype;
  12144. module.exports = function (iterable, unboundFunction, options) {
  12145. var that = options && options.that;
  12146. var AS_ENTRIES = !!(options && options.AS_ENTRIES);
  12147. var IS_ITERATOR = !!(options && options.IS_ITERATOR);
  12148. var INTERRUPTED = !!(options && options.INTERRUPTED);
  12149. var fn = bind(unboundFunction, that);
  12150. var iterator, iterFn, index, length, result, next, step;
  12151. var stop = function (condition) {
  12152. if (iterator) iteratorClose(iterator, 'normal', condition);
  12153. return new Result(true, condition);
  12154. };
  12155. var callFn = function (value) {
  12156. if (AS_ENTRIES) {
  12157. anObject(value);
  12158. return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
  12159. } return INTERRUPTED ? fn(value, stop) : fn(value);
  12160. };
  12161. if (IS_ITERATOR) {
  12162. iterator = iterable;
  12163. } else {
  12164. iterFn = getIteratorMethod(iterable);
  12165. if (!iterFn) throw TypeError(tryToString(iterable) + ' is not iterable');
  12166. // optimisation for array iterators
  12167. if (isArrayIteratorMethod(iterFn)) {
  12168. for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
  12169. result = callFn(iterable[index]);
  12170. if (result && isPrototypeOf(ResultPrototype, result)) return result;
  12171. } return new Result(false);
  12172. }
  12173. iterator = getIterator(iterable, iterFn);
  12174. }
  12175. next = iterator.next;
  12176. while (!(step = call(next, iterator)).done) {
  12177. try {
  12178. result = callFn(step.value);
  12179. } catch (error) {
  12180. iteratorClose(iterator, 'throw', error);
  12181. }
  12182. if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
  12183. } return new Result(false);
  12184. };
  12185. },{"../internals/an-object":101,"../internals/function-bind-context":153,"../internals/function-call":155,"../internals/get-iterator":160,"../internals/get-iterator-method":159,"../internals/global":163,"../internals/is-array-iterator-method":174,"../internals/iterator-close":185,"../internals/length-of-array-like":188,"../internals/object-is-prototype-of":204,"../internals/try-to-string":257}],185:[function(require,module,exports){
  12186. var call = require('../internals/function-call');
  12187. var anObject = require('../internals/an-object');
  12188. var getMethod = require('../internals/get-method');
  12189. module.exports = function (iterator, kind, value) {
  12190. var innerResult, innerError;
  12191. anObject(iterator);
  12192. try {
  12193. innerResult = getMethod(iterator, 'return');
  12194. if (!innerResult) {
  12195. if (kind === 'throw') throw value;
  12196. return value;
  12197. }
  12198. innerResult = call(innerResult, iterator);
  12199. } catch (error) {
  12200. innerError = true;
  12201. innerResult = error;
  12202. }
  12203. if (kind === 'throw') throw value;
  12204. if (innerError) throw innerResult;
  12205. anObject(innerResult);
  12206. return value;
  12207. };
  12208. },{"../internals/an-object":101,"../internals/function-call":155,"../internals/get-method":161}],186:[function(require,module,exports){
  12209. 'use strict';
  12210. var fails = require('../internals/fails');
  12211. var isCallable = require('../internals/is-callable');
  12212. var create = require('../internals/object-create');
  12213. var getPrototypeOf = require('../internals/object-get-prototype-of');
  12214. var redefine = require('../internals/redefine');
  12215. var wellKnownSymbol = require('../internals/well-known-symbol');
  12216. var IS_PURE = require('../internals/is-pure');
  12217. var ITERATOR = wellKnownSymbol('iterator');
  12218. var BUGGY_SAFARI_ITERATORS = false;
  12219. // `%IteratorPrototype%` object
  12220. // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
  12221. var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
  12222. /* eslint-disable es-x/no-array-prototype-keys -- safe */
  12223. if ([].keys) {
  12224. arrayIterator = [].keys();
  12225. // Safari 8 has buggy iterators w/o `next`
  12226. if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
  12227. else {
  12228. PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
  12229. if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
  12230. }
  12231. }
  12232. var NEW_ITERATOR_PROTOTYPE = IteratorPrototype == undefined || fails(function () {
  12233. var test = {};
  12234. // FF44- legacy iterators case
  12235. return IteratorPrototype[ITERATOR].call(test) !== test;
  12236. });
  12237. if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};
  12238. else if (IS_PURE) IteratorPrototype = create(IteratorPrototype);
  12239. // `%IteratorPrototype%[@@iterator]()` method
  12240. // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
  12241. if (!isCallable(IteratorPrototype[ITERATOR])) {
  12242. redefine(IteratorPrototype, ITERATOR, function () {
  12243. return this;
  12244. });
  12245. }
  12246. module.exports = {
  12247. IteratorPrototype: IteratorPrototype,
  12248. BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
  12249. };
  12250. },{"../internals/fails":150,"../internals/is-callable":176,"../internals/is-pure":181,"../internals/object-create":196,"../internals/object-get-prototype-of":203,"../internals/redefine":222,"../internals/well-known-symbol":268}],187:[function(require,module,exports){
  12251. arguments[4][165][0].apply(exports,arguments)
  12252. },{"dup":165}],188:[function(require,module,exports){
  12253. var toLength = require('../internals/to-length');
  12254. // `LengthOfArrayLike` abstract operation
  12255. // https://tc39.es/ecma262/#sec-lengthofarraylike
  12256. module.exports = function (obj) {
  12257. return toLength(obj.length);
  12258. };
  12259. },{"../internals/to-length":249}],189:[function(require,module,exports){
  12260. var global = require('../internals/global');
  12261. var bind = require('../internals/function-bind-context');
  12262. var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
  12263. var macrotask = require('../internals/task').set;
  12264. var IS_IOS = require('../internals/engine-is-ios');
  12265. var IS_IOS_PEBBLE = require('../internals/engine-is-ios-pebble');
  12266. var IS_WEBOS_WEBKIT = require('../internals/engine-is-webos-webkit');
  12267. var IS_NODE = require('../internals/engine-is-node');
  12268. var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
  12269. var document = global.document;
  12270. var process = global.process;
  12271. var Promise = global.Promise;
  12272. // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
  12273. var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
  12274. var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
  12275. var flush, head, last, notify, toggle, node, promise, then;
  12276. // modern engines have queueMicrotask method
  12277. if (!queueMicrotask) {
  12278. flush = function () {
  12279. var parent, fn;
  12280. if (IS_NODE && (parent = process.domain)) parent.exit();
  12281. while (head) {
  12282. fn = head.fn;
  12283. head = head.next;
  12284. try {
  12285. fn();
  12286. } catch (error) {
  12287. if (head) notify();
  12288. else last = undefined;
  12289. throw error;
  12290. }
  12291. } last = undefined;
  12292. if (parent) parent.enter();
  12293. };
  12294. // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
  12295. // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
  12296. if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) {
  12297. toggle = true;
  12298. node = document.createTextNode('');
  12299. new MutationObserver(flush).observe(node, { characterData: true });
  12300. notify = function () {
  12301. node.data = toggle = !toggle;
  12302. };
  12303. // environments with maybe non-completely correct, but existent Promise
  12304. } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) {
  12305. // Promise.resolve without an argument throws an error in LG WebOS 2
  12306. promise = Promise.resolve(undefined);
  12307. // workaround of WebKit ~ iOS Safari 10.1 bug
  12308. promise.constructor = Promise;
  12309. then = bind(promise.then, promise);
  12310. notify = function () {
  12311. then(flush);
  12312. };
  12313. // Node.js without promises
  12314. } else if (IS_NODE) {
  12315. notify = function () {
  12316. process.nextTick(flush);
  12317. };
  12318. // for other environments - macrotask based on:
  12319. // - setImmediate
  12320. // - MessageChannel
  12321. // - window.postMessage
  12322. // - onreadystatechange
  12323. // - setTimeout
  12324. } else {
  12325. // strange IE + webpack dev server bug - use .bind(global)
  12326. macrotask = bind(macrotask, global);
  12327. notify = function () {
  12328. macrotask(flush);
  12329. };
  12330. }
  12331. }
  12332. module.exports = queueMicrotask || function (fn) {
  12333. var task = { fn: fn, next: undefined };
  12334. if (last) last.next = task;
  12335. if (!head) {
  12336. head = task;
  12337. notify();
  12338. } last = task;
  12339. };
  12340. },{"../internals/engine-is-ios":142,"../internals/engine-is-ios-pebble":141,"../internals/engine-is-node":143,"../internals/engine-is-webos-webkit":144,"../internals/function-bind-context":153,"../internals/global":163,"../internals/object-get-own-property-descriptor":199,"../internals/task":243}],190:[function(require,module,exports){
  12341. var NATIVE_SYMBOL = require('../internals/native-symbol');
  12342. /* eslint-disable es-x/no-symbol -- safe */
  12343. module.exports = NATIVE_SYMBOL && !!Symbol['for'] && !!Symbol.keyFor;
  12344. },{"../internals/native-symbol":191}],191:[function(require,module,exports){
  12345. /* eslint-disable es-x/no-symbol -- required for testing */
  12346. var V8_VERSION = require('../internals/engine-v8-version');
  12347. var fails = require('../internals/fails');
  12348. // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
  12349. module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
  12350. var symbol = Symbol();
  12351. // Chrome 38 Symbol has incorrect toString conversion
  12352. // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
  12353. return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
  12354. // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
  12355. !Symbol.sham && V8_VERSION && V8_VERSION < 41;
  12356. });
  12357. },{"../internals/engine-v8-version":146,"../internals/fails":150}],192:[function(require,module,exports){
  12358. var global = require('../internals/global');
  12359. var isCallable = require('../internals/is-callable');
  12360. var inspectSource = require('../internals/inspect-source');
  12361. var WeakMap = global.WeakMap;
  12362. module.exports = isCallable(WeakMap) && /native code/.test(inspectSource(WeakMap));
  12363. },{"../internals/global":163,"../internals/inspect-source":172,"../internals/is-callable":176}],193:[function(require,module,exports){
  12364. 'use strict';
  12365. var aCallable = require('../internals/a-callable');
  12366. var PromiseCapability = function (C) {
  12367. var resolve, reject;
  12368. this.promise = new C(function ($$resolve, $$reject) {
  12369. if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
  12370. resolve = $$resolve;
  12371. reject = $$reject;
  12372. });
  12373. this.resolve = aCallable(resolve);
  12374. this.reject = aCallable(reject);
  12375. };
  12376. // `NewPromiseCapability` abstract operation
  12377. // https://tc39.es/ecma262/#sec-newpromisecapability
  12378. module.exports.f = function (C) {
  12379. return new PromiseCapability(C);
  12380. };
  12381. },{"../internals/a-callable":95}],194:[function(require,module,exports){
  12382. var global = require('../internals/global');
  12383. var isRegExp = require('../internals/is-regexp');
  12384. var TypeError = global.TypeError;
  12385. module.exports = function (it) {
  12386. if (isRegExp(it)) {
  12387. throw TypeError("The method doesn't accept regular expressions");
  12388. } return it;
  12389. };
  12390. },{"../internals/global":163,"../internals/is-regexp":182}],195:[function(require,module,exports){
  12391. 'use strict';
  12392. var DESCRIPTORS = require('../internals/descriptors');
  12393. var uncurryThis = require('../internals/function-uncurry-this');
  12394. var call = require('../internals/function-call');
  12395. var fails = require('../internals/fails');
  12396. var objectKeys = require('../internals/object-keys');
  12397. var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');
  12398. var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
  12399. var toObject = require('../internals/to-object');
  12400. var IndexedObject = require('../internals/indexed-object');
  12401. // eslint-disable-next-line es-x/no-object-assign -- safe
  12402. var $assign = Object.assign;
  12403. // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
  12404. var defineProperty = Object.defineProperty;
  12405. var concat = uncurryThis([].concat);
  12406. // `Object.assign` method
  12407. // https://tc39.es/ecma262/#sec-object.assign
  12408. module.exports = !$assign || fails(function () {
  12409. // should have correct order of operations (Edge bug)
  12410. if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
  12411. enumerable: true,
  12412. get: function () {
  12413. defineProperty(this, 'b', {
  12414. value: 3,
  12415. enumerable: false
  12416. });
  12417. }
  12418. }), { b: 2 })).b !== 1) return true;
  12419. // should work with symbols and should have deterministic property order (V8 bug)
  12420. var A = {};
  12421. var B = {};
  12422. // eslint-disable-next-line es-x/no-symbol -- safe
  12423. var symbol = Symbol();
  12424. var alphabet = 'abcdefghijklmnopqrst';
  12425. A[symbol] = 7;
  12426. alphabet.split('').forEach(function (chr) { B[chr] = chr; });
  12427. return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
  12428. }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
  12429. var T = toObject(target);
  12430. var argumentsLength = arguments.length;
  12431. var index = 1;
  12432. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  12433. var propertyIsEnumerable = propertyIsEnumerableModule.f;
  12434. while (argumentsLength > index) {
  12435. var S = IndexedObject(arguments[index++]);
  12436. var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
  12437. var length = keys.length;
  12438. var j = 0;
  12439. var key;
  12440. while (length > j) {
  12441. key = keys[j++];
  12442. if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key];
  12443. }
  12444. } return T;
  12445. } : $assign;
  12446. },{"../internals/descriptors":134,"../internals/fails":150,"../internals/function-call":155,"../internals/function-uncurry-this":157,"../internals/indexed-object":170,"../internals/object-get-own-property-symbols":202,"../internals/object-keys":206,"../internals/object-property-is-enumerable":207,"../internals/to-object":250}],196:[function(require,module,exports){
  12447. /* global ActiveXObject -- old IE, WSH */
  12448. var anObject = require('../internals/an-object');
  12449. var definePropertiesModule = require('../internals/object-define-properties');
  12450. var enumBugKeys = require('../internals/enum-bug-keys');
  12451. var hiddenKeys = require('../internals/hidden-keys');
  12452. var html = require('../internals/html');
  12453. var documentCreateElement = require('../internals/document-create-element');
  12454. var sharedKey = require('../internals/shared-key');
  12455. var GT = '>';
  12456. var LT = '<';
  12457. var PROTOTYPE = 'prototype';
  12458. var SCRIPT = 'script';
  12459. var IE_PROTO = sharedKey('IE_PROTO');
  12460. var EmptyConstructor = function () { /* empty */ };
  12461. var scriptTag = function (content) {
  12462. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  12463. };
  12464. // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
  12465. var NullProtoObjectViaActiveX = function (activeXDocument) {
  12466. activeXDocument.write(scriptTag(''));
  12467. activeXDocument.close();
  12468. var temp = activeXDocument.parentWindow.Object;
  12469. activeXDocument = null; // avoid memory leak
  12470. return temp;
  12471. };
  12472. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  12473. var NullProtoObjectViaIFrame = function () {
  12474. // Thrash, waste and sodomy: IE GC bug
  12475. var iframe = documentCreateElement('iframe');
  12476. var JS = 'java' + SCRIPT + ':';
  12477. var iframeDocument;
  12478. iframe.style.display = 'none';
  12479. html.appendChild(iframe);
  12480. // https://github.com/zloirock/core-js/issues/475
  12481. iframe.src = String(JS);
  12482. iframeDocument = iframe.contentWindow.document;
  12483. iframeDocument.open();
  12484. iframeDocument.write(scriptTag('document.F=Object'));
  12485. iframeDocument.close();
  12486. return iframeDocument.F;
  12487. };
  12488. // Check for document.domain and active x support
  12489. // No need to use active x approach when document.domain is not set
  12490. // see https://github.com/es-shims/es5-shim/issues/150
  12491. // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
  12492. // avoid IE GC bug
  12493. var activeXDocument;
  12494. var NullProtoObject = function () {
  12495. try {
  12496. activeXDocument = new ActiveXObject('htmlfile');
  12497. } catch (error) { /* ignore */ }
  12498. NullProtoObject = typeof document != 'undefined'
  12499. ? document.domain && activeXDocument
  12500. ? NullProtoObjectViaActiveX(activeXDocument) // old IE
  12501. : NullProtoObjectViaIFrame()
  12502. : NullProtoObjectViaActiveX(activeXDocument); // WSH
  12503. var length = enumBugKeys.length;
  12504. while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  12505. return NullProtoObject();
  12506. };
  12507. hiddenKeys[IE_PROTO] = true;
  12508. // `Object.create` method
  12509. // https://tc39.es/ecma262/#sec-object.create
  12510. // eslint-disable-next-line es-x/no-object-create -- safe
  12511. module.exports = Object.create || function create(O, Properties) {
  12512. var result;
  12513. if (O !== null) {
  12514. EmptyConstructor[PROTOTYPE] = anObject(O);
  12515. result = new EmptyConstructor();
  12516. EmptyConstructor[PROTOTYPE] = null;
  12517. // add "__proto__" for Object.getPrototypeOf polyfill
  12518. result[IE_PROTO] = O;
  12519. } else result = NullProtoObject();
  12520. return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
  12521. };
  12522. },{"../internals/an-object":101,"../internals/document-create-element":135,"../internals/enum-bug-keys":148,"../internals/hidden-keys":165,"../internals/html":167,"../internals/object-define-properties":197,"../internals/shared-key":235}],197:[function(require,module,exports){
  12523. var DESCRIPTORS = require('../internals/descriptors');
  12524. var V8_PROTOTYPE_DEFINE_BUG = require('../internals/v8-prototype-define-bug');
  12525. var definePropertyModule = require('../internals/object-define-property');
  12526. var anObject = require('../internals/an-object');
  12527. var toIndexedObject = require('../internals/to-indexed-object');
  12528. var objectKeys = require('../internals/object-keys');
  12529. // `Object.defineProperties` method
  12530. // https://tc39.es/ecma262/#sec-object.defineproperties
  12531. // eslint-disable-next-line es-x/no-object-defineproperties -- safe
  12532. exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
  12533. anObject(O);
  12534. var props = toIndexedObject(Properties);
  12535. var keys = objectKeys(Properties);
  12536. var length = keys.length;
  12537. var index = 0;
  12538. var key;
  12539. while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
  12540. return O;
  12541. };
  12542. },{"../internals/an-object":101,"../internals/descriptors":134,"../internals/object-define-property":198,"../internals/object-keys":206,"../internals/to-indexed-object":247,"../internals/v8-prototype-define-bug":265}],198:[function(require,module,exports){
  12543. var global = require('../internals/global');
  12544. var DESCRIPTORS = require('../internals/descriptors');
  12545. var IE8_DOM_DEFINE = require('../internals/ie8-dom-define');
  12546. var V8_PROTOTYPE_DEFINE_BUG = require('../internals/v8-prototype-define-bug');
  12547. var anObject = require('../internals/an-object');
  12548. var toPropertyKey = require('../internals/to-property-key');
  12549. var TypeError = global.TypeError;
  12550. // eslint-disable-next-line es-x/no-object-defineproperty -- safe
  12551. var $defineProperty = Object.defineProperty;
  12552. // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
  12553. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  12554. var ENUMERABLE = 'enumerable';
  12555. var CONFIGURABLE = 'configurable';
  12556. var WRITABLE = 'writable';
  12557. // `Object.defineProperty` method
  12558. // https://tc39.es/ecma262/#sec-object.defineproperty
  12559. exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
  12560. anObject(O);
  12561. P = toPropertyKey(P);
  12562. anObject(Attributes);
  12563. if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
  12564. var current = $getOwnPropertyDescriptor(O, P);
  12565. if (current && current[WRITABLE]) {
  12566. O[P] = Attributes.value;
  12567. Attributes = {
  12568. configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
  12569. enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
  12570. writable: false
  12571. };
  12572. }
  12573. } return $defineProperty(O, P, Attributes);
  12574. } : $defineProperty : function defineProperty(O, P, Attributes) {
  12575. anObject(O);
  12576. P = toPropertyKey(P);
  12577. anObject(Attributes);
  12578. if (IE8_DOM_DEFINE) try {
  12579. return $defineProperty(O, P, Attributes);
  12580. } catch (error) { /* empty */ }
  12581. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
  12582. if ('value' in Attributes) O[P] = Attributes.value;
  12583. return O;
  12584. };
  12585. },{"../internals/an-object":101,"../internals/descriptors":134,"../internals/global":163,"../internals/ie8-dom-define":168,"../internals/to-property-key":254,"../internals/v8-prototype-define-bug":265}],199:[function(require,module,exports){
  12586. var DESCRIPTORS = require('../internals/descriptors');
  12587. var call = require('../internals/function-call');
  12588. var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
  12589. var createPropertyDescriptor = require('../internals/create-property-descriptor');
  12590. var toIndexedObject = require('../internals/to-indexed-object');
  12591. var toPropertyKey = require('../internals/to-property-key');
  12592. var hasOwn = require('../internals/has-own-property');
  12593. var IE8_DOM_DEFINE = require('../internals/ie8-dom-define');
  12594. // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
  12595. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  12596. // `Object.getOwnPropertyDescriptor` method
  12597. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
  12598. exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  12599. O = toIndexedObject(O);
  12600. P = toPropertyKey(P);
  12601. if (IE8_DOM_DEFINE) try {
  12602. return $getOwnPropertyDescriptor(O, P);
  12603. } catch (error) { /* empty */ }
  12604. if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
  12605. };
  12606. },{"../internals/create-property-descriptor":130,"../internals/descriptors":134,"../internals/function-call":155,"../internals/has-own-property":164,"../internals/ie8-dom-define":168,"../internals/object-property-is-enumerable":207,"../internals/to-indexed-object":247,"../internals/to-property-key":254}],200:[function(require,module,exports){
  12607. /* eslint-disable es-x/no-object-getownpropertynames -- safe */
  12608. var classof = require('../internals/classof-raw');
  12609. var toIndexedObject = require('../internals/to-indexed-object');
  12610. var $getOwnPropertyNames = require('../internals/object-get-own-property-names').f;
  12611. var arraySlice = require('../internals/array-slice-simple');
  12612. var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
  12613. ? Object.getOwnPropertyNames(window) : [];
  12614. var getWindowNames = function (it) {
  12615. try {
  12616. return $getOwnPropertyNames(it);
  12617. } catch (error) {
  12618. return arraySlice(windowNames);
  12619. }
  12620. };
  12621. // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
  12622. module.exports.f = function getOwnPropertyNames(it) {
  12623. return windowNames && classof(it) == 'Window'
  12624. ? getWindowNames(it)
  12625. : $getOwnPropertyNames(toIndexedObject(it));
  12626. };
  12627. },{"../internals/array-slice-simple":116,"../internals/classof-raw":123,"../internals/object-get-own-property-names":201,"../internals/to-indexed-object":247}],201:[function(require,module,exports){
  12628. var internalObjectKeys = require('../internals/object-keys-internal');
  12629. var enumBugKeys = require('../internals/enum-bug-keys');
  12630. var hiddenKeys = enumBugKeys.concat('length', 'prototype');
  12631. // `Object.getOwnPropertyNames` method
  12632. // https://tc39.es/ecma262/#sec-object.getownpropertynames
  12633. // eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
  12634. exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  12635. return internalObjectKeys(O, hiddenKeys);
  12636. };
  12637. },{"../internals/enum-bug-keys":148,"../internals/object-keys-internal":205}],202:[function(require,module,exports){
  12638. // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
  12639. exports.f = Object.getOwnPropertySymbols;
  12640. },{}],203:[function(require,module,exports){
  12641. var global = require('../internals/global');
  12642. var hasOwn = require('../internals/has-own-property');
  12643. var isCallable = require('../internals/is-callable');
  12644. var toObject = require('../internals/to-object');
  12645. var sharedKey = require('../internals/shared-key');
  12646. var CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter');
  12647. var IE_PROTO = sharedKey('IE_PROTO');
  12648. var Object = global.Object;
  12649. var ObjectPrototype = Object.prototype;
  12650. // `Object.getPrototypeOf` method
  12651. // https://tc39.es/ecma262/#sec-object.getprototypeof
  12652. module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {
  12653. var object = toObject(O);
  12654. if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];
  12655. var constructor = object.constructor;
  12656. if (isCallable(constructor) && object instanceof constructor) {
  12657. return constructor.prototype;
  12658. } return object instanceof Object ? ObjectPrototype : null;
  12659. };
  12660. },{"../internals/correct-prototype-getter":127,"../internals/global":163,"../internals/has-own-property":164,"../internals/is-callable":176,"../internals/shared-key":235,"../internals/to-object":250}],204:[function(require,module,exports){
  12661. var uncurryThis = require('../internals/function-uncurry-this');
  12662. module.exports = uncurryThis({}.isPrototypeOf);
  12663. },{"../internals/function-uncurry-this":157}],205:[function(require,module,exports){
  12664. var uncurryThis = require('../internals/function-uncurry-this');
  12665. var hasOwn = require('../internals/has-own-property');
  12666. var toIndexedObject = require('../internals/to-indexed-object');
  12667. var indexOf = require('../internals/array-includes').indexOf;
  12668. var hiddenKeys = require('../internals/hidden-keys');
  12669. var push = uncurryThis([].push);
  12670. module.exports = function (object, names) {
  12671. var O = toIndexedObject(object);
  12672. var i = 0;
  12673. var result = [];
  12674. var key;
  12675. for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
  12676. // Don't enum bug & hidden keys
  12677. while (names.length > i) if (hasOwn(O, key = names[i++])) {
  12678. ~indexOf(result, key) || push(result, key);
  12679. }
  12680. return result;
  12681. };
  12682. },{"../internals/array-includes":110,"../internals/function-uncurry-this":157,"../internals/has-own-property":164,"../internals/hidden-keys":165,"../internals/to-indexed-object":247}],206:[function(require,module,exports){
  12683. var internalObjectKeys = require('../internals/object-keys-internal');
  12684. var enumBugKeys = require('../internals/enum-bug-keys');
  12685. // `Object.keys` method
  12686. // https://tc39.es/ecma262/#sec-object.keys
  12687. // eslint-disable-next-line es-x/no-object-keys -- safe
  12688. module.exports = Object.keys || function keys(O) {
  12689. return internalObjectKeys(O, enumBugKeys);
  12690. };
  12691. },{"../internals/enum-bug-keys":148,"../internals/object-keys-internal":205}],207:[function(require,module,exports){
  12692. 'use strict';
  12693. var $propertyIsEnumerable = {}.propertyIsEnumerable;
  12694. // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
  12695. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  12696. // Nashorn ~ JDK8 bug
  12697. var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
  12698. // `Object.prototype.propertyIsEnumerable` method implementation
  12699. // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
  12700. exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  12701. var descriptor = getOwnPropertyDescriptor(this, V);
  12702. return !!descriptor && descriptor.enumerable;
  12703. } : $propertyIsEnumerable;
  12704. },{}],208:[function(require,module,exports){
  12705. /* eslint-disable no-proto -- safe */
  12706. var uncurryThis = require('../internals/function-uncurry-this');
  12707. var anObject = require('../internals/an-object');
  12708. var aPossiblePrototype = require('../internals/a-possible-prototype');
  12709. // `Object.setPrototypeOf` method
  12710. // https://tc39.es/ecma262/#sec-object.setprototypeof
  12711. // Works with __proto__ only. Old v8 can't work with null proto objects.
  12712. // eslint-disable-next-line es-x/no-object-setprototypeof -- safe
  12713. module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
  12714. var CORRECT_SETTER = false;
  12715. var test = {};
  12716. var setter;
  12717. try {
  12718. // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
  12719. setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
  12720. setter(test, []);
  12721. CORRECT_SETTER = test instanceof Array;
  12722. } catch (error) { /* empty */ }
  12723. return function setPrototypeOf(O, proto) {
  12724. anObject(O);
  12725. aPossiblePrototype(proto);
  12726. if (CORRECT_SETTER) setter(O, proto);
  12727. else O.__proto__ = proto;
  12728. return O;
  12729. };
  12730. }() : undefined);
  12731. },{"../internals/a-possible-prototype":97,"../internals/an-object":101,"../internals/function-uncurry-this":157}],209:[function(require,module,exports){
  12732. var DESCRIPTORS = require('../internals/descriptors');
  12733. var uncurryThis = require('../internals/function-uncurry-this');
  12734. var objectKeys = require('../internals/object-keys');
  12735. var toIndexedObject = require('../internals/to-indexed-object');
  12736. var $propertyIsEnumerable = require('../internals/object-property-is-enumerable').f;
  12737. var propertyIsEnumerable = uncurryThis($propertyIsEnumerable);
  12738. var push = uncurryThis([].push);
  12739. // `Object.{ entries, values }` methods implementation
  12740. var createMethod = function (TO_ENTRIES) {
  12741. return function (it) {
  12742. var O = toIndexedObject(it);
  12743. var keys = objectKeys(O);
  12744. var length = keys.length;
  12745. var i = 0;
  12746. var result = [];
  12747. var key;
  12748. while (length > i) {
  12749. key = keys[i++];
  12750. if (!DESCRIPTORS || propertyIsEnumerable(O, key)) {
  12751. push(result, TO_ENTRIES ? [key, O[key]] : O[key]);
  12752. }
  12753. }
  12754. return result;
  12755. };
  12756. };
  12757. module.exports = {
  12758. // `Object.entries` method
  12759. // https://tc39.es/ecma262/#sec-object.entries
  12760. entries: createMethod(true),
  12761. // `Object.values` method
  12762. // https://tc39.es/ecma262/#sec-object.values
  12763. values: createMethod(false)
  12764. };
  12765. },{"../internals/descriptors":134,"../internals/function-uncurry-this":157,"../internals/object-keys":206,"../internals/object-property-is-enumerable":207,"../internals/to-indexed-object":247}],210:[function(require,module,exports){
  12766. 'use strict';
  12767. var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');
  12768. var classof = require('../internals/classof');
  12769. // `Object.prototype.toString` method implementation
  12770. // https://tc39.es/ecma262/#sec-object.prototype.tostring
  12771. module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
  12772. return '[object ' + classof(this) + ']';
  12773. };
  12774. },{"../internals/classof":124,"../internals/to-string-tag-support":255}],211:[function(require,module,exports){
  12775. var global = require('../internals/global');
  12776. var call = require('../internals/function-call');
  12777. var isCallable = require('../internals/is-callable');
  12778. var isObject = require('../internals/is-object');
  12779. var TypeError = global.TypeError;
  12780. // `OrdinaryToPrimitive` abstract operation
  12781. // https://tc39.es/ecma262/#sec-ordinarytoprimitive
  12782. module.exports = function (input, pref) {
  12783. var fn, val;
  12784. if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
  12785. if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;
  12786. if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
  12787. throw TypeError("Can't convert object to primitive value");
  12788. };
  12789. },{"../internals/function-call":155,"../internals/global":163,"../internals/is-callable":176,"../internals/is-object":180}],212:[function(require,module,exports){
  12790. var getBuiltIn = require('../internals/get-built-in');
  12791. var uncurryThis = require('../internals/function-uncurry-this');
  12792. var getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');
  12793. var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');
  12794. var anObject = require('../internals/an-object');
  12795. var concat = uncurryThis([].concat);
  12796. // all object keys, includes non-enumerable and symbols
  12797. module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  12798. var keys = getOwnPropertyNamesModule.f(anObject(it));
  12799. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  12800. return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
  12801. };
  12802. },{"../internals/an-object":101,"../internals/function-uncurry-this":157,"../internals/get-built-in":158,"../internals/object-get-own-property-names":201,"../internals/object-get-own-property-symbols":202}],213:[function(require,module,exports){
  12803. var global = require('../internals/global');
  12804. module.exports = global;
  12805. },{"../internals/global":163}],214:[function(require,module,exports){
  12806. module.exports = function (exec) {
  12807. try {
  12808. return { error: false, value: exec() };
  12809. } catch (error) {
  12810. return { error: true, value: error };
  12811. }
  12812. };
  12813. },{}],215:[function(require,module,exports){
  12814. var global = require('../internals/global');
  12815. var NativePromiseConstructor = require('../internals/promise-native-constructor');
  12816. var isCallable = require('../internals/is-callable');
  12817. var isForced = require('../internals/is-forced');
  12818. var inspectSource = require('../internals/inspect-source');
  12819. var wellKnownSymbol = require('../internals/well-known-symbol');
  12820. var IS_BROWSER = require('../internals/engine-is-browser');
  12821. var IS_PURE = require('../internals/is-pure');
  12822. var V8_VERSION = require('../internals/engine-v8-version');
  12823. var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
  12824. var SPECIES = wellKnownSymbol('species');
  12825. var SUBCLASSING = false;
  12826. var NATIVE_PROMISE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent);
  12827. var FORCED_PROMISE_CONSTRUCTOR = isForced('Promise', function () {
  12828. var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor);
  12829. var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor);
  12830. // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
  12831. // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
  12832. // We can't detect it synchronously, so just check versions
  12833. if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
  12834. // We need Promise#{ catch, finally } in the pure version for preventing prototype pollution
  12835. if (IS_PURE && !(NativePromisePrototype['catch'] && NativePromisePrototype['finally'])) return true;
  12836. // We can't use @@species feature detection in V8 since it causes
  12837. // deoptimization and performance degradation
  12838. // https://github.com/zloirock/core-js/issues/679
  12839. if (V8_VERSION >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
  12840. // Detect correctness of subclassing with @@species support
  12841. var promise = new NativePromiseConstructor(function (resolve) { resolve(1); });
  12842. var FakePromise = function (exec) {
  12843. exec(function () { /* empty */ }, function () { /* empty */ });
  12844. };
  12845. var constructor = promise.constructor = {};
  12846. constructor[SPECIES] = FakePromise;
  12847. SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
  12848. if (!SUBCLASSING) return true;
  12849. // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
  12850. return !GLOBAL_CORE_JS_PROMISE && IS_BROWSER && !NATIVE_PROMISE_REJECTION_EVENT;
  12851. });
  12852. module.exports = {
  12853. CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR,
  12854. REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT,
  12855. SUBCLASSING: SUBCLASSING
  12856. };
  12857. },{"../internals/engine-is-browser":139,"../internals/engine-v8-version":146,"../internals/global":163,"../internals/inspect-source":172,"../internals/is-callable":176,"../internals/is-forced":178,"../internals/is-pure":181,"../internals/promise-native-constructor":216,"../internals/well-known-symbol":268}],216:[function(require,module,exports){
  12858. var global = require('../internals/global');
  12859. module.exports = global.Promise;
  12860. },{"../internals/global":163}],217:[function(require,module,exports){
  12861. var anObject = require('../internals/an-object');
  12862. var isObject = require('../internals/is-object');
  12863. var newPromiseCapability = require('../internals/new-promise-capability');
  12864. module.exports = function (C, x) {
  12865. anObject(C);
  12866. if (isObject(x) && x.constructor === C) return x;
  12867. var promiseCapability = newPromiseCapability.f(C);
  12868. var resolve = promiseCapability.resolve;
  12869. resolve(x);
  12870. return promiseCapability.promise;
  12871. };
  12872. },{"../internals/an-object":101,"../internals/is-object":180,"../internals/new-promise-capability":193}],218:[function(require,module,exports){
  12873. var NativePromiseConstructor = require('../internals/promise-native-constructor');
  12874. var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');
  12875. var FORCED_PROMISE_CONSTRUCTOR = require('../internals/promise-constructor-detection').CONSTRUCTOR;
  12876. module.exports = FORCED_PROMISE_CONSTRUCTOR || !checkCorrectnessOfIteration(function (iterable) {
  12877. NativePromiseConstructor.all(iterable).then(undefined, function () { /* empty */ });
  12878. });
  12879. },{"../internals/check-correctness-of-iteration":122,"../internals/promise-constructor-detection":215,"../internals/promise-native-constructor":216}],219:[function(require,module,exports){
  12880. var defineProperty = require('../internals/object-define-property').f;
  12881. module.exports = function (Target, Source, key) {
  12882. key in Target || defineProperty(Target, key, {
  12883. configurable: true,
  12884. get: function () { return Source[key]; },
  12885. set: function (it) { Source[key] = it; }
  12886. });
  12887. };
  12888. },{"../internals/object-define-property":198}],220:[function(require,module,exports){
  12889. var Queue = function () {
  12890. this.head = null;
  12891. this.tail = null;
  12892. };
  12893. Queue.prototype = {
  12894. add: function (item) {
  12895. var entry = { item: item, next: null };
  12896. if (this.head) this.tail.next = entry;
  12897. else this.head = entry;
  12898. this.tail = entry;
  12899. },
  12900. get: function () {
  12901. var entry = this.head;
  12902. if (entry) {
  12903. this.head = entry.next;
  12904. if (this.tail === entry) this.tail = null;
  12905. return entry.item;
  12906. }
  12907. }
  12908. };
  12909. module.exports = Queue;
  12910. },{}],221:[function(require,module,exports){
  12911. var redefine = require('../internals/redefine');
  12912. module.exports = function (target, src, options) {
  12913. for (var key in src) redefine(target, key, src[key], options);
  12914. return target;
  12915. };
  12916. },{"../internals/redefine":222}],222:[function(require,module,exports){
  12917. var global = require('../internals/global');
  12918. var isCallable = require('../internals/is-callable');
  12919. var hasOwn = require('../internals/has-own-property');
  12920. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  12921. var setGlobal = require('../internals/set-global');
  12922. var inspectSource = require('../internals/inspect-source');
  12923. var InternalStateModule = require('../internals/internal-state');
  12924. var CONFIGURABLE_FUNCTION_NAME = require('../internals/function-name').CONFIGURABLE;
  12925. var getInternalState = InternalStateModule.get;
  12926. var enforceInternalState = InternalStateModule.enforce;
  12927. var TEMPLATE = String(String).split('String');
  12928. (module.exports = function (O, key, value, options) {
  12929. var unsafe = options ? !!options.unsafe : false;
  12930. var simple = options ? !!options.enumerable : false;
  12931. var noTargetGet = options ? !!options.noTargetGet : false;
  12932. var name = options && options.name !== undefined ? options.name : key;
  12933. var state;
  12934. if (isCallable(value)) {
  12935. if (String(name).slice(0, 7) === 'Symbol(') {
  12936. name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
  12937. }
  12938. if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
  12939. createNonEnumerableProperty(value, 'name', name);
  12940. }
  12941. state = enforceInternalState(value);
  12942. if (!state.source) {
  12943. state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
  12944. }
  12945. }
  12946. if (O === global) {
  12947. if (simple) O[key] = value;
  12948. else setGlobal(key, value);
  12949. return;
  12950. } else if (!unsafe) {
  12951. delete O[key];
  12952. } else if (!noTargetGet && O[key]) {
  12953. simple = true;
  12954. }
  12955. if (simple) O[key] = value;
  12956. else createNonEnumerableProperty(O, key, value);
  12957. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  12958. })(Function.prototype, 'toString', function toString() {
  12959. return isCallable(this) && getInternalState(this).source || inspectSource(this);
  12960. });
  12961. },{"../internals/create-non-enumerable-property":129,"../internals/function-name":156,"../internals/global":163,"../internals/has-own-property":164,"../internals/inspect-source":172,"../internals/internal-state":173,"../internals/is-callable":176,"../internals/set-global":232}],223:[function(require,module,exports){
  12962. var global = require('../internals/global');
  12963. var call = require('../internals/function-call');
  12964. var anObject = require('../internals/an-object');
  12965. var isCallable = require('../internals/is-callable');
  12966. var classof = require('../internals/classof-raw');
  12967. var regexpExec = require('../internals/regexp-exec');
  12968. var TypeError = global.TypeError;
  12969. // `RegExpExec` abstract operation
  12970. // https://tc39.es/ecma262/#sec-regexpexec
  12971. module.exports = function (R, S) {
  12972. var exec = R.exec;
  12973. if (isCallable(exec)) {
  12974. var result = call(exec, R, S);
  12975. if (result !== null) anObject(result);
  12976. return result;
  12977. }
  12978. if (classof(R) === 'RegExp') return call(regexpExec, R, S);
  12979. throw TypeError('RegExp#exec called on incompatible receiver');
  12980. };
  12981. },{"../internals/an-object":101,"../internals/classof-raw":123,"../internals/function-call":155,"../internals/global":163,"../internals/is-callable":176,"../internals/regexp-exec":224}],224:[function(require,module,exports){
  12982. 'use strict';
  12983. /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
  12984. /* eslint-disable regexp/no-useless-quantifier -- testing */
  12985. var call = require('../internals/function-call');
  12986. var uncurryThis = require('../internals/function-uncurry-this');
  12987. var toString = require('../internals/to-string');
  12988. var regexpFlags = require('../internals/regexp-flags');
  12989. var stickyHelpers = require('../internals/regexp-sticky-helpers');
  12990. var shared = require('../internals/shared');
  12991. var create = require('../internals/object-create');
  12992. var getInternalState = require('../internals/internal-state').get;
  12993. var UNSUPPORTED_DOT_ALL = require('../internals/regexp-unsupported-dot-all');
  12994. var UNSUPPORTED_NCG = require('../internals/regexp-unsupported-ncg');
  12995. var nativeReplace = shared('native-string-replace', String.prototype.replace);
  12996. var nativeExec = RegExp.prototype.exec;
  12997. var patchedExec = nativeExec;
  12998. var charAt = uncurryThis(''.charAt);
  12999. var indexOf = uncurryThis(''.indexOf);
  13000. var replace = uncurryThis(''.replace);
  13001. var stringSlice = uncurryThis(''.slice);
  13002. var UPDATES_LAST_INDEX_WRONG = (function () {
  13003. var re1 = /a/;
  13004. var re2 = /b*/g;
  13005. call(nativeExec, re1, 'a');
  13006. call(nativeExec, re2, 'a');
  13007. return re1.lastIndex !== 0 || re2.lastIndex !== 0;
  13008. })();
  13009. var UNSUPPORTED_Y = stickyHelpers.BROKEN_CARET;
  13010. // nonparticipating capturing group, copied from es5-shim's String#split patch.
  13011. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
  13012. var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG;
  13013. if (PATCH) {
  13014. patchedExec = function exec(string) {
  13015. var re = this;
  13016. var state = getInternalState(re);
  13017. var str = toString(string);
  13018. var raw = state.raw;
  13019. var result, reCopy, lastIndex, match, i, object, group;
  13020. if (raw) {
  13021. raw.lastIndex = re.lastIndex;
  13022. result = call(patchedExec, raw, str);
  13023. re.lastIndex = raw.lastIndex;
  13024. return result;
  13025. }
  13026. var groups = state.groups;
  13027. var sticky = UNSUPPORTED_Y && re.sticky;
  13028. var flags = call(regexpFlags, re);
  13029. var source = re.source;
  13030. var charsAdded = 0;
  13031. var strCopy = str;
  13032. if (sticky) {
  13033. flags = replace(flags, 'y', '');
  13034. if (indexOf(flags, 'g') === -1) {
  13035. flags += 'g';
  13036. }
  13037. strCopy = stringSlice(str, re.lastIndex);
  13038. // Support anchored sticky behavior.
  13039. if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt(str, re.lastIndex - 1) !== '\n')) {
  13040. source = '(?: ' + source + ')';
  13041. strCopy = ' ' + strCopy;
  13042. charsAdded++;
  13043. }
  13044. // ^(? + rx + ) is needed, in combination with some str slicing, to
  13045. // simulate the 'y' flag.
  13046. reCopy = new RegExp('^(?:' + source + ')', flags);
  13047. }
  13048. if (NPCG_INCLUDED) {
  13049. reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
  13050. }
  13051. if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
  13052. match = call(nativeExec, sticky ? reCopy : re, strCopy);
  13053. if (sticky) {
  13054. if (match) {
  13055. match.input = stringSlice(match.input, charsAdded);
  13056. match[0] = stringSlice(match[0], charsAdded);
  13057. match.index = re.lastIndex;
  13058. re.lastIndex += match[0].length;
  13059. } else re.lastIndex = 0;
  13060. } else if (UPDATES_LAST_INDEX_WRONG && match) {
  13061. re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
  13062. }
  13063. if (NPCG_INCLUDED && match && match.length > 1) {
  13064. // Fix browsers whose `exec` methods don't consistently return `undefined`
  13065. // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
  13066. call(nativeReplace, match[0], reCopy, function () {
  13067. for (i = 1; i < arguments.length - 2; i++) {
  13068. if (arguments[i] === undefined) match[i] = undefined;
  13069. }
  13070. });
  13071. }
  13072. if (match && groups) {
  13073. match.groups = object = create(null);
  13074. for (i = 0; i < groups.length; i++) {
  13075. group = groups[i];
  13076. object[group[0]] = match[group[1]];
  13077. }
  13078. }
  13079. return match;
  13080. };
  13081. }
  13082. module.exports = patchedExec;
  13083. },{"../internals/function-call":155,"../internals/function-uncurry-this":157,"../internals/internal-state":173,"../internals/object-create":196,"../internals/regexp-flags":225,"../internals/regexp-sticky-helpers":227,"../internals/regexp-unsupported-dot-all":228,"../internals/regexp-unsupported-ncg":229,"../internals/shared":237,"../internals/to-string":256}],225:[function(require,module,exports){
  13084. 'use strict';
  13085. var anObject = require('../internals/an-object');
  13086. // `RegExp.prototype.flags` getter implementation
  13087. // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
  13088. module.exports = function () {
  13089. var that = anObject(this);
  13090. var result = '';
  13091. if (that.hasIndices) result += 'd';
  13092. if (that.global) result += 'g';
  13093. if (that.ignoreCase) result += 'i';
  13094. if (that.multiline) result += 'm';
  13095. if (that.dotAll) result += 's';
  13096. if (that.unicode) result += 'u';
  13097. if (that.sticky) result += 'y';
  13098. return result;
  13099. };
  13100. },{"../internals/an-object":101}],226:[function(require,module,exports){
  13101. var call = require('../internals/function-call');
  13102. var hasOwn = require('../internals/has-own-property');
  13103. var isPrototypeOf = require('../internals/object-is-prototype-of');
  13104. var regExpFlags = require('../internals/regexp-flags');
  13105. var RegExpPrototype = RegExp.prototype;
  13106. module.exports = function (R) {
  13107. var flags = R.flags;
  13108. return flags === undefined && !('flags' in RegExpPrototype) && !hasOwn(R, 'flags') && isPrototypeOf(RegExpPrototype, R)
  13109. ? call(regExpFlags, R) : flags;
  13110. };
  13111. },{"../internals/function-call":155,"../internals/has-own-property":164,"../internals/object-is-prototype-of":204,"../internals/regexp-flags":225}],227:[function(require,module,exports){
  13112. var fails = require('../internals/fails');
  13113. var global = require('../internals/global');
  13114. // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
  13115. var $RegExp = global.RegExp;
  13116. var UNSUPPORTED_Y = fails(function () {
  13117. var re = $RegExp('a', 'y');
  13118. re.lastIndex = 2;
  13119. return re.exec('abcd') != null;
  13120. });
  13121. // UC Browser bug
  13122. // https://github.com/zloirock/core-js/issues/1008
  13123. var MISSED_STICKY = UNSUPPORTED_Y || fails(function () {
  13124. return !$RegExp('a', 'y').sticky;
  13125. });
  13126. var BROKEN_CARET = UNSUPPORTED_Y || fails(function () {
  13127. // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
  13128. var re = $RegExp('^r', 'gy');
  13129. re.lastIndex = 2;
  13130. return re.exec('str') != null;
  13131. });
  13132. module.exports = {
  13133. BROKEN_CARET: BROKEN_CARET,
  13134. MISSED_STICKY: MISSED_STICKY,
  13135. UNSUPPORTED_Y: UNSUPPORTED_Y
  13136. };
  13137. },{"../internals/fails":150,"../internals/global":163}],228:[function(require,module,exports){
  13138. var fails = require('../internals/fails');
  13139. var global = require('../internals/global');
  13140. // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
  13141. var $RegExp = global.RegExp;
  13142. module.exports = fails(function () {
  13143. var re = $RegExp('.', 's');
  13144. return !(re.dotAll && re.exec('\n') && re.flags === 's');
  13145. });
  13146. },{"../internals/fails":150,"../internals/global":163}],229:[function(require,module,exports){
  13147. var fails = require('../internals/fails');
  13148. var global = require('../internals/global');
  13149. // babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
  13150. var $RegExp = global.RegExp;
  13151. module.exports = fails(function () {
  13152. var re = $RegExp('(?<a>b)', 'g');
  13153. return re.exec('b').groups.a !== 'b' ||
  13154. 'b'.replace(re, '$<a>c') !== 'bc';
  13155. });
  13156. },{"../internals/fails":150,"../internals/global":163}],230:[function(require,module,exports){
  13157. var global = require('../internals/global');
  13158. var TypeError = global.TypeError;
  13159. // `RequireObjectCoercible` abstract operation
  13160. // https://tc39.es/ecma262/#sec-requireobjectcoercible
  13161. module.exports = function (it) {
  13162. if (it == undefined) throw TypeError("Can't call method on " + it);
  13163. return it;
  13164. };
  13165. },{"../internals/global":163}],231:[function(require,module,exports){
  13166. // `SameValue` abstract operation
  13167. // https://tc39.es/ecma262/#sec-samevalue
  13168. // eslint-disable-next-line es-x/no-object-is -- safe
  13169. module.exports = Object.is || function is(x, y) {
  13170. // eslint-disable-next-line no-self-compare -- NaN check
  13171. return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
  13172. };
  13173. },{}],232:[function(require,module,exports){
  13174. var global = require('../internals/global');
  13175. // eslint-disable-next-line es-x/no-object-defineproperty -- safe
  13176. var defineProperty = Object.defineProperty;
  13177. module.exports = function (key, value) {
  13178. try {
  13179. defineProperty(global, key, { value: value, configurable: true, writable: true });
  13180. } catch (error) {
  13181. global[key] = value;
  13182. } return value;
  13183. };
  13184. },{"../internals/global":163}],233:[function(require,module,exports){
  13185. 'use strict';
  13186. var getBuiltIn = require('../internals/get-built-in');
  13187. var definePropertyModule = require('../internals/object-define-property');
  13188. var wellKnownSymbol = require('../internals/well-known-symbol');
  13189. var DESCRIPTORS = require('../internals/descriptors');
  13190. var SPECIES = wellKnownSymbol('species');
  13191. module.exports = function (CONSTRUCTOR_NAME) {
  13192. var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
  13193. var defineProperty = definePropertyModule.f;
  13194. if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
  13195. defineProperty(Constructor, SPECIES, {
  13196. configurable: true,
  13197. get: function () { return this; }
  13198. });
  13199. }
  13200. };
  13201. },{"../internals/descriptors":134,"../internals/get-built-in":158,"../internals/object-define-property":198,"../internals/well-known-symbol":268}],234:[function(require,module,exports){
  13202. var defineProperty = require('../internals/object-define-property').f;
  13203. var hasOwn = require('../internals/has-own-property');
  13204. var wellKnownSymbol = require('../internals/well-known-symbol');
  13205. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  13206. module.exports = function (target, TAG, STATIC) {
  13207. if (target && !STATIC) target = target.prototype;
  13208. if (target && !hasOwn(target, TO_STRING_TAG)) {
  13209. defineProperty(target, TO_STRING_TAG, { configurable: true, value: TAG });
  13210. }
  13211. };
  13212. },{"../internals/has-own-property":164,"../internals/object-define-property":198,"../internals/well-known-symbol":268}],235:[function(require,module,exports){
  13213. var shared = require('../internals/shared');
  13214. var uid = require('../internals/uid');
  13215. var keys = shared('keys');
  13216. module.exports = function (key) {
  13217. return keys[key] || (keys[key] = uid(key));
  13218. };
  13219. },{"../internals/shared":237,"../internals/uid":263}],236:[function(require,module,exports){
  13220. var global = require('../internals/global');
  13221. var setGlobal = require('../internals/set-global');
  13222. var SHARED = '__core-js_shared__';
  13223. var store = global[SHARED] || setGlobal(SHARED, {});
  13224. module.exports = store;
  13225. },{"../internals/global":163,"../internals/set-global":232}],237:[function(require,module,exports){
  13226. var IS_PURE = require('../internals/is-pure');
  13227. var store = require('../internals/shared-store');
  13228. (module.exports = function (key, value) {
  13229. return store[key] || (store[key] = value !== undefined ? value : {});
  13230. })('versions', []).push({
  13231. version: '3.22.1',
  13232. mode: IS_PURE ? 'pure' : 'global',
  13233. copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
  13234. license: 'https://github.com/zloirock/core-js/blob/v3.22.1/LICENSE',
  13235. source: 'https://github.com/zloirock/core-js'
  13236. });
  13237. },{"../internals/is-pure":181,"../internals/shared-store":236}],238:[function(require,module,exports){
  13238. var anObject = require('../internals/an-object');
  13239. var aConstructor = require('../internals/a-constructor');
  13240. var wellKnownSymbol = require('../internals/well-known-symbol');
  13241. var SPECIES = wellKnownSymbol('species');
  13242. // `SpeciesConstructor` abstract operation
  13243. // https://tc39.es/ecma262/#sec-speciesconstructor
  13244. module.exports = function (O, defaultConstructor) {
  13245. var C = anObject(O).constructor;
  13246. var S;
  13247. return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aConstructor(S);
  13248. };
  13249. },{"../internals/a-constructor":96,"../internals/an-object":101,"../internals/well-known-symbol":268}],239:[function(require,module,exports){
  13250. var uncurryThis = require('../internals/function-uncurry-this');
  13251. var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
  13252. var toString = require('../internals/to-string');
  13253. var requireObjectCoercible = require('../internals/require-object-coercible');
  13254. var charAt = uncurryThis(''.charAt);
  13255. var charCodeAt = uncurryThis(''.charCodeAt);
  13256. var stringSlice = uncurryThis(''.slice);
  13257. var createMethod = function (CONVERT_TO_STRING) {
  13258. return function ($this, pos) {
  13259. var S = toString(requireObjectCoercible($this));
  13260. var position = toIntegerOrInfinity(pos);
  13261. var size = S.length;
  13262. var first, second;
  13263. if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
  13264. first = charCodeAt(S, position);
  13265. return first < 0xD800 || first > 0xDBFF || position + 1 === size
  13266. || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
  13267. ? CONVERT_TO_STRING
  13268. ? charAt(S, position)
  13269. : first
  13270. : CONVERT_TO_STRING
  13271. ? stringSlice(S, position, position + 2)
  13272. : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
  13273. };
  13274. };
  13275. module.exports = {
  13276. // `String.prototype.codePointAt` method
  13277. // https://tc39.es/ecma262/#sec-string.prototype.codepointat
  13278. codeAt: createMethod(false),
  13279. // `String.prototype.at` method
  13280. // https://github.com/mathiasbynens/String.prototype.at
  13281. charAt: createMethod(true)
  13282. };
  13283. },{"../internals/function-uncurry-this":157,"../internals/require-object-coercible":230,"../internals/to-integer-or-infinity":248,"../internals/to-string":256}],240:[function(require,module,exports){
  13284. var PROPER_FUNCTION_NAME = require('../internals/function-name').PROPER;
  13285. var fails = require('../internals/fails');
  13286. var whitespaces = require('../internals/whitespaces');
  13287. var non = '\u200B\u0085\u180E';
  13288. // check that a method works with the correct list
  13289. // of whitespaces and has a correct name
  13290. module.exports = function (METHOD_NAME) {
  13291. return fails(function () {
  13292. return !!whitespaces[METHOD_NAME]()
  13293. || non[METHOD_NAME]() !== non
  13294. || (PROPER_FUNCTION_NAME && whitespaces[METHOD_NAME].name !== METHOD_NAME);
  13295. });
  13296. };
  13297. },{"../internals/fails":150,"../internals/function-name":156,"../internals/whitespaces":269}],241:[function(require,module,exports){
  13298. var uncurryThis = require('../internals/function-uncurry-this');
  13299. var requireObjectCoercible = require('../internals/require-object-coercible');
  13300. var toString = require('../internals/to-string');
  13301. var whitespaces = require('../internals/whitespaces');
  13302. var replace = uncurryThis(''.replace);
  13303. var whitespace = '[' + whitespaces + ']';
  13304. var ltrim = RegExp('^' + whitespace + whitespace + '*');
  13305. var rtrim = RegExp(whitespace + whitespace + '*$');
  13306. // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
  13307. var createMethod = function (TYPE) {
  13308. return function ($this) {
  13309. var string = toString(requireObjectCoercible($this));
  13310. if (TYPE & 1) string = replace(string, ltrim, '');
  13311. if (TYPE & 2) string = replace(string, rtrim, '');
  13312. return string;
  13313. };
  13314. };
  13315. module.exports = {
  13316. // `String.prototype.{ trimLeft, trimStart }` methods
  13317. // https://tc39.es/ecma262/#sec-string.prototype.trimstart
  13318. start: createMethod(1),
  13319. // `String.prototype.{ trimRight, trimEnd }` methods
  13320. // https://tc39.es/ecma262/#sec-string.prototype.trimend
  13321. end: createMethod(2),
  13322. // `String.prototype.trim` method
  13323. // https://tc39.es/ecma262/#sec-string.prototype.trim
  13324. trim: createMethod(3)
  13325. };
  13326. },{"../internals/function-uncurry-this":157,"../internals/require-object-coercible":230,"../internals/to-string":256,"../internals/whitespaces":269}],242:[function(require,module,exports){
  13327. var call = require('../internals/function-call');
  13328. var getBuiltIn = require('../internals/get-built-in');
  13329. var wellKnownSymbol = require('../internals/well-known-symbol');
  13330. var redefine = require('../internals/redefine');
  13331. module.exports = function () {
  13332. var Symbol = getBuiltIn('Symbol');
  13333. var SymbolPrototype = Symbol && Symbol.prototype;
  13334. var valueOf = SymbolPrototype && SymbolPrototype.valueOf;
  13335. var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
  13336. if (SymbolPrototype && !SymbolPrototype[TO_PRIMITIVE]) {
  13337. // `Symbol.prototype[@@toPrimitive]` method
  13338. // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
  13339. // eslint-disable-next-line no-unused-vars -- required for .length
  13340. redefine(SymbolPrototype, TO_PRIMITIVE, function (hint) {
  13341. return call(valueOf, this);
  13342. });
  13343. }
  13344. };
  13345. },{"../internals/function-call":155,"../internals/get-built-in":158,"../internals/redefine":222,"../internals/well-known-symbol":268}],243:[function(require,module,exports){
  13346. var global = require('../internals/global');
  13347. var apply = require('../internals/function-apply');
  13348. var bind = require('../internals/function-bind-context');
  13349. var isCallable = require('../internals/is-callable');
  13350. var hasOwn = require('../internals/has-own-property');
  13351. var fails = require('../internals/fails');
  13352. var html = require('../internals/html');
  13353. var arraySlice = require('../internals/array-slice');
  13354. var createElement = require('../internals/document-create-element');
  13355. var validateArgumentsLength = require('../internals/validate-arguments-length');
  13356. var IS_IOS = require('../internals/engine-is-ios');
  13357. var IS_NODE = require('../internals/engine-is-node');
  13358. var set = global.setImmediate;
  13359. var clear = global.clearImmediate;
  13360. var process = global.process;
  13361. var Dispatch = global.Dispatch;
  13362. var Function = global.Function;
  13363. var MessageChannel = global.MessageChannel;
  13364. var String = global.String;
  13365. var counter = 0;
  13366. var queue = {};
  13367. var ONREADYSTATECHANGE = 'onreadystatechange';
  13368. var location, defer, channel, port;
  13369. try {
  13370. // Deno throws a ReferenceError on `location` access without `--location` flag
  13371. location = global.location;
  13372. } catch (error) { /* empty */ }
  13373. var run = function (id) {
  13374. if (hasOwn(queue, id)) {
  13375. var fn = queue[id];
  13376. delete queue[id];
  13377. fn();
  13378. }
  13379. };
  13380. var runner = function (id) {
  13381. return function () {
  13382. run(id);
  13383. };
  13384. };
  13385. var listener = function (event) {
  13386. run(event.data);
  13387. };
  13388. var post = function (id) {
  13389. // old engines have not location.origin
  13390. global.postMessage(String(id), location.protocol + '//' + location.host);
  13391. };
  13392. // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
  13393. if (!set || !clear) {
  13394. set = function setImmediate(handler) {
  13395. validateArgumentsLength(arguments.length, 1);
  13396. var fn = isCallable(handler) ? handler : Function(handler);
  13397. var args = arraySlice(arguments, 1);
  13398. queue[++counter] = function () {
  13399. apply(fn, undefined, args);
  13400. };
  13401. defer(counter);
  13402. return counter;
  13403. };
  13404. clear = function clearImmediate(id) {
  13405. delete queue[id];
  13406. };
  13407. // Node.js 0.8-
  13408. if (IS_NODE) {
  13409. defer = function (id) {
  13410. process.nextTick(runner(id));
  13411. };
  13412. // Sphere (JS game engine) Dispatch API
  13413. } else if (Dispatch && Dispatch.now) {
  13414. defer = function (id) {
  13415. Dispatch.now(runner(id));
  13416. };
  13417. // Browsers with MessageChannel, includes WebWorkers
  13418. // except iOS - https://github.com/zloirock/core-js/issues/624
  13419. } else if (MessageChannel && !IS_IOS) {
  13420. channel = new MessageChannel();
  13421. port = channel.port2;
  13422. channel.port1.onmessage = listener;
  13423. defer = bind(port.postMessage, port);
  13424. // Browsers with postMessage, skip WebWorkers
  13425. // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
  13426. } else if (
  13427. global.addEventListener &&
  13428. isCallable(global.postMessage) &&
  13429. !global.importScripts &&
  13430. location && location.protocol !== 'file:' &&
  13431. !fails(post)
  13432. ) {
  13433. defer = post;
  13434. global.addEventListener('message', listener, false);
  13435. // IE8-
  13436. } else if (ONREADYSTATECHANGE in createElement('script')) {
  13437. defer = function (id) {
  13438. html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
  13439. html.removeChild(this);
  13440. run(id);
  13441. };
  13442. };
  13443. // Rest old browsers
  13444. } else {
  13445. defer = function (id) {
  13446. setTimeout(runner(id), 0);
  13447. };
  13448. }
  13449. }
  13450. module.exports = {
  13451. set: set,
  13452. clear: clear
  13453. };
  13454. },{"../internals/array-slice":117,"../internals/document-create-element":135,"../internals/engine-is-ios":142,"../internals/engine-is-node":143,"../internals/fails":150,"../internals/function-apply":152,"../internals/function-bind-context":153,"../internals/global":163,"../internals/has-own-property":164,"../internals/html":167,"../internals/is-callable":176,"../internals/validate-arguments-length":266}],244:[function(require,module,exports){
  13455. var uncurryThis = require('../internals/function-uncurry-this');
  13456. // `thisNumberValue` abstract operation
  13457. // https://tc39.es/ecma262/#sec-thisnumbervalue
  13458. module.exports = uncurryThis(1.0.valueOf);
  13459. },{"../internals/function-uncurry-this":157}],245:[function(require,module,exports){
  13460. var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
  13461. var max = Math.max;
  13462. var min = Math.min;
  13463. // Helper for a popular repeating case of the spec:
  13464. // Let integer be ? ToInteger(index).
  13465. // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
  13466. module.exports = function (index, length) {
  13467. var integer = toIntegerOrInfinity(index);
  13468. return integer < 0 ? max(integer + length, 0) : min(integer, length);
  13469. };
  13470. },{"../internals/to-integer-or-infinity":248}],246:[function(require,module,exports){
  13471. var global = require('../internals/global');
  13472. var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
  13473. var toLength = require('../internals/to-length');
  13474. var RangeError = global.RangeError;
  13475. // `ToIndex` abstract operation
  13476. // https://tc39.es/ecma262/#sec-toindex
  13477. module.exports = function (it) {
  13478. if (it === undefined) return 0;
  13479. var number = toIntegerOrInfinity(it);
  13480. var length = toLength(number);
  13481. if (number !== length) throw RangeError('Wrong length or index');
  13482. return length;
  13483. };
  13484. },{"../internals/global":163,"../internals/to-integer-or-infinity":248,"../internals/to-length":249}],247:[function(require,module,exports){
  13485. // toObject with fallback for non-array-like ES3 strings
  13486. var IndexedObject = require('../internals/indexed-object');
  13487. var requireObjectCoercible = require('../internals/require-object-coercible');
  13488. module.exports = function (it) {
  13489. return IndexedObject(requireObjectCoercible(it));
  13490. };
  13491. },{"../internals/indexed-object":170,"../internals/require-object-coercible":230}],248:[function(require,module,exports){
  13492. var ceil = Math.ceil;
  13493. var floor = Math.floor;
  13494. // `ToIntegerOrInfinity` abstract operation
  13495. // https://tc39.es/ecma262/#sec-tointegerorinfinity
  13496. module.exports = function (argument) {
  13497. var number = +argument;
  13498. // eslint-disable-next-line no-self-compare -- safe
  13499. return number !== number || number === 0 ? 0 : (number > 0 ? floor : ceil)(number);
  13500. };
  13501. },{}],249:[function(require,module,exports){
  13502. var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
  13503. var min = Math.min;
  13504. // `ToLength` abstract operation
  13505. // https://tc39.es/ecma262/#sec-tolength
  13506. module.exports = function (argument) {
  13507. return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  13508. };
  13509. },{"../internals/to-integer-or-infinity":248}],250:[function(require,module,exports){
  13510. var global = require('../internals/global');
  13511. var requireObjectCoercible = require('../internals/require-object-coercible');
  13512. var Object = global.Object;
  13513. // `ToObject` abstract operation
  13514. // https://tc39.es/ecma262/#sec-toobject
  13515. module.exports = function (argument) {
  13516. return Object(requireObjectCoercible(argument));
  13517. };
  13518. },{"../internals/global":163,"../internals/require-object-coercible":230}],251:[function(require,module,exports){
  13519. var global = require('../internals/global');
  13520. var toPositiveInteger = require('../internals/to-positive-integer');
  13521. var RangeError = global.RangeError;
  13522. module.exports = function (it, BYTES) {
  13523. var offset = toPositiveInteger(it);
  13524. if (offset % BYTES) throw RangeError('Wrong offset');
  13525. return offset;
  13526. };
  13527. },{"../internals/global":163,"../internals/to-positive-integer":252}],252:[function(require,module,exports){
  13528. var global = require('../internals/global');
  13529. var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
  13530. var RangeError = global.RangeError;
  13531. module.exports = function (it) {
  13532. var result = toIntegerOrInfinity(it);
  13533. if (result < 0) throw RangeError("The argument can't be less than 0");
  13534. return result;
  13535. };
  13536. },{"../internals/global":163,"../internals/to-integer-or-infinity":248}],253:[function(require,module,exports){
  13537. var global = require('../internals/global');
  13538. var call = require('../internals/function-call');
  13539. var isObject = require('../internals/is-object');
  13540. var isSymbol = require('../internals/is-symbol');
  13541. var getMethod = require('../internals/get-method');
  13542. var ordinaryToPrimitive = require('../internals/ordinary-to-primitive');
  13543. var wellKnownSymbol = require('../internals/well-known-symbol');
  13544. var TypeError = global.TypeError;
  13545. var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
  13546. // `ToPrimitive` abstract operation
  13547. // https://tc39.es/ecma262/#sec-toprimitive
  13548. module.exports = function (input, pref) {
  13549. if (!isObject(input) || isSymbol(input)) return input;
  13550. var exoticToPrim = getMethod(input, TO_PRIMITIVE);
  13551. var result;
  13552. if (exoticToPrim) {
  13553. if (pref === undefined) pref = 'default';
  13554. result = call(exoticToPrim, input, pref);
  13555. if (!isObject(result) || isSymbol(result)) return result;
  13556. throw TypeError("Can't convert object to primitive value");
  13557. }
  13558. if (pref === undefined) pref = 'number';
  13559. return ordinaryToPrimitive(input, pref);
  13560. };
  13561. },{"../internals/function-call":155,"../internals/get-method":161,"../internals/global":163,"../internals/is-object":180,"../internals/is-symbol":183,"../internals/ordinary-to-primitive":211,"../internals/well-known-symbol":268}],254:[function(require,module,exports){
  13562. var toPrimitive = require('../internals/to-primitive');
  13563. var isSymbol = require('../internals/is-symbol');
  13564. // `ToPropertyKey` abstract operation
  13565. // https://tc39.es/ecma262/#sec-topropertykey
  13566. module.exports = function (argument) {
  13567. var key = toPrimitive(argument, 'string');
  13568. return isSymbol(key) ? key : key + '';
  13569. };
  13570. },{"../internals/is-symbol":183,"../internals/to-primitive":253}],255:[function(require,module,exports){
  13571. var wellKnownSymbol = require('../internals/well-known-symbol');
  13572. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  13573. var test = {};
  13574. test[TO_STRING_TAG] = 'z';
  13575. module.exports = String(test) === '[object z]';
  13576. },{"../internals/well-known-symbol":268}],256:[function(require,module,exports){
  13577. var global = require('../internals/global');
  13578. var classof = require('../internals/classof');
  13579. var String = global.String;
  13580. module.exports = function (argument) {
  13581. if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
  13582. return String(argument);
  13583. };
  13584. },{"../internals/classof":124,"../internals/global":163}],257:[function(require,module,exports){
  13585. var global = require('../internals/global');
  13586. var String = global.String;
  13587. module.exports = function (argument) {
  13588. try {
  13589. return String(argument);
  13590. } catch (error) {
  13591. return 'Object';
  13592. }
  13593. };
  13594. },{"../internals/global":163}],258:[function(require,module,exports){
  13595. 'use strict';
  13596. var $ = require('../internals/export');
  13597. var global = require('../internals/global');
  13598. var call = require('../internals/function-call');
  13599. var DESCRIPTORS = require('../internals/descriptors');
  13600. var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = require('../internals/typed-array-constructors-require-wrappers');
  13601. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  13602. var ArrayBufferModule = require('../internals/array-buffer');
  13603. var anInstance = require('../internals/an-instance');
  13604. var createPropertyDescriptor = require('../internals/create-property-descriptor');
  13605. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  13606. var isIntegralNumber = require('../internals/is-integral-number');
  13607. var toLength = require('../internals/to-length');
  13608. var toIndex = require('../internals/to-index');
  13609. var toOffset = require('../internals/to-offset');
  13610. var toPropertyKey = require('../internals/to-property-key');
  13611. var hasOwn = require('../internals/has-own-property');
  13612. var classof = require('../internals/classof');
  13613. var isObject = require('../internals/is-object');
  13614. var isSymbol = require('../internals/is-symbol');
  13615. var create = require('../internals/object-create');
  13616. var isPrototypeOf = require('../internals/object-is-prototype-of');
  13617. var setPrototypeOf = require('../internals/object-set-prototype-of');
  13618. var getOwnPropertyNames = require('../internals/object-get-own-property-names').f;
  13619. var typedArrayFrom = require('../internals/typed-array-from');
  13620. var forEach = require('../internals/array-iteration').forEach;
  13621. var setSpecies = require('../internals/set-species');
  13622. var definePropertyModule = require('../internals/object-define-property');
  13623. var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');
  13624. var InternalStateModule = require('../internals/internal-state');
  13625. var inheritIfRequired = require('../internals/inherit-if-required');
  13626. var getInternalState = InternalStateModule.get;
  13627. var setInternalState = InternalStateModule.set;
  13628. var nativeDefineProperty = definePropertyModule.f;
  13629. var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  13630. var round = Math.round;
  13631. var RangeError = global.RangeError;
  13632. var ArrayBuffer = ArrayBufferModule.ArrayBuffer;
  13633. var ArrayBufferPrototype = ArrayBuffer.prototype;
  13634. var DataView = ArrayBufferModule.DataView;
  13635. var NATIVE_ARRAY_BUFFER_VIEWS = ArrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS;
  13636. var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR;
  13637. var TYPED_ARRAY_TAG = ArrayBufferViewCore.TYPED_ARRAY_TAG;
  13638. var TypedArray = ArrayBufferViewCore.TypedArray;
  13639. var TypedArrayPrototype = ArrayBufferViewCore.TypedArrayPrototype;
  13640. var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
  13641. var isTypedArray = ArrayBufferViewCore.isTypedArray;
  13642. var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT';
  13643. var WRONG_LENGTH = 'Wrong length';
  13644. var fromList = function (C, list) {
  13645. aTypedArrayConstructor(C);
  13646. var index = 0;
  13647. var length = list.length;
  13648. var result = new C(length);
  13649. while (length > index) result[index] = list[index++];
  13650. return result;
  13651. };
  13652. var addGetter = function (it, key) {
  13653. nativeDefineProperty(it, key, { get: function () {
  13654. return getInternalState(this)[key];
  13655. } });
  13656. };
  13657. var isArrayBuffer = function (it) {
  13658. var klass;
  13659. return isPrototypeOf(ArrayBufferPrototype, it) || (klass = classof(it)) == 'ArrayBuffer' || klass == 'SharedArrayBuffer';
  13660. };
  13661. var isTypedArrayIndex = function (target, key) {
  13662. return isTypedArray(target)
  13663. && !isSymbol(key)
  13664. && key in target
  13665. && isIntegralNumber(+key)
  13666. && key >= 0;
  13667. };
  13668. var wrappedGetOwnPropertyDescriptor = function getOwnPropertyDescriptor(target, key) {
  13669. key = toPropertyKey(key);
  13670. return isTypedArrayIndex(target, key)
  13671. ? createPropertyDescriptor(2, target[key])
  13672. : nativeGetOwnPropertyDescriptor(target, key);
  13673. };
  13674. var wrappedDefineProperty = function defineProperty(target, key, descriptor) {
  13675. key = toPropertyKey(key);
  13676. if (isTypedArrayIndex(target, key)
  13677. && isObject(descriptor)
  13678. && hasOwn(descriptor, 'value')
  13679. && !hasOwn(descriptor, 'get')
  13680. && !hasOwn(descriptor, 'set')
  13681. // TODO: add validation descriptor w/o calling accessors
  13682. && !descriptor.configurable
  13683. && (!hasOwn(descriptor, 'writable') || descriptor.writable)
  13684. && (!hasOwn(descriptor, 'enumerable') || descriptor.enumerable)
  13685. ) {
  13686. target[key] = descriptor.value;
  13687. return target;
  13688. } return nativeDefineProperty(target, key, descriptor);
  13689. };
  13690. if (DESCRIPTORS) {
  13691. if (!NATIVE_ARRAY_BUFFER_VIEWS) {
  13692. getOwnPropertyDescriptorModule.f = wrappedGetOwnPropertyDescriptor;
  13693. definePropertyModule.f = wrappedDefineProperty;
  13694. addGetter(TypedArrayPrototype, 'buffer');
  13695. addGetter(TypedArrayPrototype, 'byteOffset');
  13696. addGetter(TypedArrayPrototype, 'byteLength');
  13697. addGetter(TypedArrayPrototype, 'length');
  13698. }
  13699. $({ target: 'Object', stat: true, forced: !NATIVE_ARRAY_BUFFER_VIEWS }, {
  13700. getOwnPropertyDescriptor: wrappedGetOwnPropertyDescriptor,
  13701. defineProperty: wrappedDefineProperty
  13702. });
  13703. module.exports = function (TYPE, wrapper, CLAMPED) {
  13704. var BYTES = TYPE.match(/\d+$/)[0] / 8;
  13705. var CONSTRUCTOR_NAME = TYPE + (CLAMPED ? 'Clamped' : '') + 'Array';
  13706. var GETTER = 'get' + TYPE;
  13707. var SETTER = 'set' + TYPE;
  13708. var NativeTypedArrayConstructor = global[CONSTRUCTOR_NAME];
  13709. var TypedArrayConstructor = NativeTypedArrayConstructor;
  13710. var TypedArrayConstructorPrototype = TypedArrayConstructor && TypedArrayConstructor.prototype;
  13711. var exported = {};
  13712. var getter = function (that, index) {
  13713. var data = getInternalState(that);
  13714. return data.view[GETTER](index * BYTES + data.byteOffset, true);
  13715. };
  13716. var setter = function (that, index, value) {
  13717. var data = getInternalState(that);
  13718. if (CLAMPED) value = (value = round(value)) < 0 ? 0 : value > 0xFF ? 0xFF : value & 0xFF;
  13719. data.view[SETTER](index * BYTES + data.byteOffset, value, true);
  13720. };
  13721. var addElement = function (that, index) {
  13722. nativeDefineProperty(that, index, {
  13723. get: function () {
  13724. return getter(this, index);
  13725. },
  13726. set: function (value) {
  13727. return setter(this, index, value);
  13728. },
  13729. enumerable: true
  13730. });
  13731. };
  13732. if (!NATIVE_ARRAY_BUFFER_VIEWS) {
  13733. TypedArrayConstructor = wrapper(function (that, data, offset, $length) {
  13734. anInstance(that, TypedArrayConstructorPrototype);
  13735. var index = 0;
  13736. var byteOffset = 0;
  13737. var buffer, byteLength, length;
  13738. if (!isObject(data)) {
  13739. length = toIndex(data);
  13740. byteLength = length * BYTES;
  13741. buffer = new ArrayBuffer(byteLength);
  13742. } else if (isArrayBuffer(data)) {
  13743. buffer = data;
  13744. byteOffset = toOffset(offset, BYTES);
  13745. var $len = data.byteLength;
  13746. if ($length === undefined) {
  13747. if ($len % BYTES) throw RangeError(WRONG_LENGTH);
  13748. byteLength = $len - byteOffset;
  13749. if (byteLength < 0) throw RangeError(WRONG_LENGTH);
  13750. } else {
  13751. byteLength = toLength($length) * BYTES;
  13752. if (byteLength + byteOffset > $len) throw RangeError(WRONG_LENGTH);
  13753. }
  13754. length = byteLength / BYTES;
  13755. } else if (isTypedArray(data)) {
  13756. return fromList(TypedArrayConstructor, data);
  13757. } else {
  13758. return call(typedArrayFrom, TypedArrayConstructor, data);
  13759. }
  13760. setInternalState(that, {
  13761. buffer: buffer,
  13762. byteOffset: byteOffset,
  13763. byteLength: byteLength,
  13764. length: length,
  13765. view: new DataView(buffer)
  13766. });
  13767. while (index < length) addElement(that, index++);
  13768. });
  13769. if (setPrototypeOf) setPrototypeOf(TypedArrayConstructor, TypedArray);
  13770. TypedArrayConstructorPrototype = TypedArrayConstructor.prototype = create(TypedArrayPrototype);
  13771. } else if (TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS) {
  13772. TypedArrayConstructor = wrapper(function (dummy, data, typedArrayOffset, $length) {
  13773. anInstance(dummy, TypedArrayConstructorPrototype);
  13774. return inheritIfRequired(function () {
  13775. if (!isObject(data)) return new NativeTypedArrayConstructor(toIndex(data));
  13776. if (isArrayBuffer(data)) return $length !== undefined
  13777. ? new NativeTypedArrayConstructor(data, toOffset(typedArrayOffset, BYTES), $length)
  13778. : typedArrayOffset !== undefined
  13779. ? new NativeTypedArrayConstructor(data, toOffset(typedArrayOffset, BYTES))
  13780. : new NativeTypedArrayConstructor(data);
  13781. if (isTypedArray(data)) return fromList(TypedArrayConstructor, data);
  13782. return call(typedArrayFrom, TypedArrayConstructor, data);
  13783. }(), dummy, TypedArrayConstructor);
  13784. });
  13785. if (setPrototypeOf) setPrototypeOf(TypedArrayConstructor, TypedArray);
  13786. forEach(getOwnPropertyNames(NativeTypedArrayConstructor), function (key) {
  13787. if (!(key in TypedArrayConstructor)) {
  13788. createNonEnumerableProperty(TypedArrayConstructor, key, NativeTypedArrayConstructor[key]);
  13789. }
  13790. });
  13791. TypedArrayConstructor.prototype = TypedArrayConstructorPrototype;
  13792. }
  13793. if (TypedArrayConstructorPrototype.constructor !== TypedArrayConstructor) {
  13794. createNonEnumerableProperty(TypedArrayConstructorPrototype, 'constructor', TypedArrayConstructor);
  13795. }
  13796. createNonEnumerableProperty(TypedArrayConstructorPrototype, TYPED_ARRAY_CONSTRUCTOR, TypedArrayConstructor);
  13797. if (TYPED_ARRAY_TAG) {
  13798. createNonEnumerableProperty(TypedArrayConstructorPrototype, TYPED_ARRAY_TAG, CONSTRUCTOR_NAME);
  13799. }
  13800. exported[CONSTRUCTOR_NAME] = TypedArrayConstructor;
  13801. $({
  13802. global: true, forced: TypedArrayConstructor != NativeTypedArrayConstructor, sham: !NATIVE_ARRAY_BUFFER_VIEWS
  13803. }, exported);
  13804. if (!(BYTES_PER_ELEMENT in TypedArrayConstructor)) {
  13805. createNonEnumerableProperty(TypedArrayConstructor, BYTES_PER_ELEMENT, BYTES);
  13806. }
  13807. if (!(BYTES_PER_ELEMENT in TypedArrayConstructorPrototype)) {
  13808. createNonEnumerableProperty(TypedArrayConstructorPrototype, BYTES_PER_ELEMENT, BYTES);
  13809. }
  13810. setSpecies(CONSTRUCTOR_NAME);
  13811. };
  13812. } else module.exports = function () { /* empty */ };
  13813. },{"../internals/an-instance":100,"../internals/array-buffer":104,"../internals/array-buffer-view-core":103,"../internals/array-iteration":111,"../internals/classof":124,"../internals/create-non-enumerable-property":129,"../internals/create-property-descriptor":130,"../internals/descriptors":134,"../internals/export":149,"../internals/function-call":155,"../internals/global":163,"../internals/has-own-property":164,"../internals/inherit-if-required":171,"../internals/internal-state":173,"../internals/is-integral-number":179,"../internals/is-object":180,"../internals/is-symbol":183,"../internals/object-create":196,"../internals/object-define-property":198,"../internals/object-get-own-property-descriptor":199,"../internals/object-get-own-property-names":201,"../internals/object-is-prototype-of":204,"../internals/object-set-prototype-of":208,"../internals/set-species":233,"../internals/to-index":246,"../internals/to-length":249,"../internals/to-offset":251,"../internals/to-property-key":254,"../internals/typed-array-constructors-require-wrappers":259,"../internals/typed-array-from":261}],259:[function(require,module,exports){
  13814. /* eslint-disable no-new -- required for testing */
  13815. var global = require('../internals/global');
  13816. var fails = require('../internals/fails');
  13817. var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');
  13818. var NATIVE_ARRAY_BUFFER_VIEWS = require('../internals/array-buffer-view-core').NATIVE_ARRAY_BUFFER_VIEWS;
  13819. var ArrayBuffer = global.ArrayBuffer;
  13820. var Int8Array = global.Int8Array;
  13821. module.exports = !NATIVE_ARRAY_BUFFER_VIEWS || !fails(function () {
  13822. Int8Array(1);
  13823. }) || !fails(function () {
  13824. new Int8Array(-1);
  13825. }) || !checkCorrectnessOfIteration(function (iterable) {
  13826. new Int8Array();
  13827. new Int8Array(null);
  13828. new Int8Array(1.5);
  13829. new Int8Array(iterable);
  13830. }, true) || fails(function () {
  13831. // Safari (11+) bug - a reason why even Safari 13 should load a typed array polyfill
  13832. return new Int8Array(new ArrayBuffer(2), 1, undefined).length !== 1;
  13833. });
  13834. },{"../internals/array-buffer-view-core":103,"../internals/check-correctness-of-iteration":122,"../internals/fails":150,"../internals/global":163}],260:[function(require,module,exports){
  13835. var arrayFromConstructorAndList = require('../internals/array-from-constructor-and-list');
  13836. var typedArraySpeciesConstructor = require('../internals/typed-array-species-constructor');
  13837. module.exports = function (instance, list) {
  13838. return arrayFromConstructorAndList(typedArraySpeciesConstructor(instance), list);
  13839. };
  13840. },{"../internals/array-from-constructor-and-list":108,"../internals/typed-array-species-constructor":262}],261:[function(require,module,exports){
  13841. var bind = require('../internals/function-bind-context');
  13842. var call = require('../internals/function-call');
  13843. var aConstructor = require('../internals/a-constructor');
  13844. var toObject = require('../internals/to-object');
  13845. var lengthOfArrayLike = require('../internals/length-of-array-like');
  13846. var getIterator = require('../internals/get-iterator');
  13847. var getIteratorMethod = require('../internals/get-iterator-method');
  13848. var isArrayIteratorMethod = require('../internals/is-array-iterator-method');
  13849. var aTypedArrayConstructor = require('../internals/array-buffer-view-core').aTypedArrayConstructor;
  13850. module.exports = function from(source /* , mapfn, thisArg */) {
  13851. var C = aConstructor(this);
  13852. var O = toObject(source);
  13853. var argumentsLength = arguments.length;
  13854. var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
  13855. var mapping = mapfn !== undefined;
  13856. var iteratorMethod = getIteratorMethod(O);
  13857. var i, length, result, step, iterator, next;
  13858. if (iteratorMethod && !isArrayIteratorMethod(iteratorMethod)) {
  13859. iterator = getIterator(O, iteratorMethod);
  13860. next = iterator.next;
  13861. O = [];
  13862. while (!(step = call(next, iterator)).done) {
  13863. O.push(step.value);
  13864. }
  13865. }
  13866. if (mapping && argumentsLength > 2) {
  13867. mapfn = bind(mapfn, arguments[2]);
  13868. }
  13869. length = lengthOfArrayLike(O);
  13870. result = new (aTypedArrayConstructor(C))(length);
  13871. for (i = 0; length > i; i++) {
  13872. result[i] = mapping ? mapfn(O[i], i) : O[i];
  13873. }
  13874. return result;
  13875. };
  13876. },{"../internals/a-constructor":96,"../internals/array-buffer-view-core":103,"../internals/function-bind-context":153,"../internals/function-call":155,"../internals/get-iterator":160,"../internals/get-iterator-method":159,"../internals/is-array-iterator-method":174,"../internals/length-of-array-like":188,"../internals/to-object":250}],262:[function(require,module,exports){
  13877. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  13878. var speciesConstructor = require('../internals/species-constructor');
  13879. var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR;
  13880. var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
  13881. // a part of `TypedArraySpeciesCreate` abstract operation
  13882. // https://tc39.es/ecma262/#typedarray-species-create
  13883. module.exports = function (originalArray) {
  13884. return aTypedArrayConstructor(speciesConstructor(originalArray, originalArray[TYPED_ARRAY_CONSTRUCTOR]));
  13885. };
  13886. },{"../internals/array-buffer-view-core":103,"../internals/species-constructor":238}],263:[function(require,module,exports){
  13887. var uncurryThis = require('../internals/function-uncurry-this');
  13888. var id = 0;
  13889. var postfix = Math.random();
  13890. var toString = uncurryThis(1.0.toString);
  13891. module.exports = function (key) {
  13892. return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
  13893. };
  13894. },{"../internals/function-uncurry-this":157}],264:[function(require,module,exports){
  13895. /* eslint-disable es-x/no-symbol -- required for testing */
  13896. var NATIVE_SYMBOL = require('../internals/native-symbol');
  13897. module.exports = NATIVE_SYMBOL
  13898. && !Symbol.sham
  13899. && typeof Symbol.iterator == 'symbol';
  13900. },{"../internals/native-symbol":191}],265:[function(require,module,exports){
  13901. var DESCRIPTORS = require('../internals/descriptors');
  13902. var fails = require('../internals/fails');
  13903. // V8 ~ Chrome 36-
  13904. // https://bugs.chromium.org/p/v8/issues/detail?id=3334
  13905. module.exports = DESCRIPTORS && fails(function () {
  13906. // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
  13907. return Object.defineProperty(function () { /* empty */ }, 'prototype', {
  13908. value: 42,
  13909. writable: false
  13910. }).prototype != 42;
  13911. });
  13912. },{"../internals/descriptors":134,"../internals/fails":150}],266:[function(require,module,exports){
  13913. var global = require('../internals/global');
  13914. var TypeError = global.TypeError;
  13915. module.exports = function (passed, required) {
  13916. if (passed < required) throw TypeError('Not enough arguments');
  13917. return passed;
  13918. };
  13919. },{"../internals/global":163}],267:[function(require,module,exports){
  13920. var wellKnownSymbol = require('../internals/well-known-symbol');
  13921. exports.f = wellKnownSymbol;
  13922. },{"../internals/well-known-symbol":268}],268:[function(require,module,exports){
  13923. var global = require('../internals/global');
  13924. var shared = require('../internals/shared');
  13925. var hasOwn = require('../internals/has-own-property');
  13926. var uid = require('../internals/uid');
  13927. var NATIVE_SYMBOL = require('../internals/native-symbol');
  13928. var USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');
  13929. var WellKnownSymbolsStore = shared('wks');
  13930. var Symbol = global.Symbol;
  13931. var symbolFor = Symbol && Symbol['for'];
  13932. var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
  13933. module.exports = function (name) {
  13934. if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
  13935. var description = 'Symbol.' + name;
  13936. if (NATIVE_SYMBOL && hasOwn(Symbol, name)) {
  13937. WellKnownSymbolsStore[name] = Symbol[name];
  13938. } else if (USE_SYMBOL_AS_UID && symbolFor) {
  13939. WellKnownSymbolsStore[name] = symbolFor(description);
  13940. } else {
  13941. WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
  13942. }
  13943. } return WellKnownSymbolsStore[name];
  13944. };
  13945. },{"../internals/global":163,"../internals/has-own-property":164,"../internals/native-symbol":191,"../internals/shared":237,"../internals/uid":263,"../internals/use-symbol-as-uid":264}],269:[function(require,module,exports){
  13946. // a string of all valid unicode whitespaces
  13947. module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
  13948. '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
  13949. },{}],270:[function(require,module,exports){
  13950. 'use strict';
  13951. var $ = require('../internals/export');
  13952. var global = require('../internals/global');
  13953. var arrayBufferModule = require('../internals/array-buffer');
  13954. var setSpecies = require('../internals/set-species');
  13955. var ARRAY_BUFFER = 'ArrayBuffer';
  13956. var ArrayBuffer = arrayBufferModule[ARRAY_BUFFER];
  13957. var NativeArrayBuffer = global[ARRAY_BUFFER];
  13958. // `ArrayBuffer` constructor
  13959. // https://tc39.es/ecma262/#sec-arraybuffer-constructor
  13960. $({ global: true, forced: NativeArrayBuffer !== ArrayBuffer }, {
  13961. ArrayBuffer: ArrayBuffer
  13962. });
  13963. setSpecies(ARRAY_BUFFER);
  13964. },{"../internals/array-buffer":104,"../internals/export":149,"../internals/global":163,"../internals/set-species":233}],271:[function(require,module,exports){
  13965. 'use strict';
  13966. var $ = require('../internals/export');
  13967. var uncurryThis = require('../internals/function-uncurry-this');
  13968. var fails = require('../internals/fails');
  13969. var ArrayBufferModule = require('../internals/array-buffer');
  13970. var anObject = require('../internals/an-object');
  13971. var toAbsoluteIndex = require('../internals/to-absolute-index');
  13972. var toLength = require('../internals/to-length');
  13973. var speciesConstructor = require('../internals/species-constructor');
  13974. var ArrayBuffer = ArrayBufferModule.ArrayBuffer;
  13975. var DataView = ArrayBufferModule.DataView;
  13976. var DataViewPrototype = DataView.prototype;
  13977. var un$ArrayBufferSlice = uncurryThis(ArrayBuffer.prototype.slice);
  13978. var getUint8 = uncurryThis(DataViewPrototype.getUint8);
  13979. var setUint8 = uncurryThis(DataViewPrototype.setUint8);
  13980. var INCORRECT_SLICE = fails(function () {
  13981. return !new ArrayBuffer(2).slice(1, undefined).byteLength;
  13982. });
  13983. // `ArrayBuffer.prototype.slice` method
  13984. // https://tc39.es/ecma262/#sec-arraybuffer.prototype.slice
  13985. $({ target: 'ArrayBuffer', proto: true, unsafe: true, forced: INCORRECT_SLICE }, {
  13986. slice: function slice(start, end) {
  13987. if (un$ArrayBufferSlice && end === undefined) {
  13988. return un$ArrayBufferSlice(anObject(this), start); // FF fix
  13989. }
  13990. var length = anObject(this).byteLength;
  13991. var first = toAbsoluteIndex(start, length);
  13992. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  13993. var result = new (speciesConstructor(this, ArrayBuffer))(toLength(fin - first));
  13994. var viewSource = new DataView(this);
  13995. var viewTarget = new DataView(result);
  13996. var index = 0;
  13997. while (first < fin) {
  13998. setUint8(viewTarget, index++, getUint8(viewSource, first++));
  13999. } return result;
  14000. }
  14001. });
  14002. },{"../internals/an-object":101,"../internals/array-buffer":104,"../internals/export":149,"../internals/fails":150,"../internals/function-uncurry-this":157,"../internals/species-constructor":238,"../internals/to-absolute-index":245,"../internals/to-length":249}],272:[function(require,module,exports){
  14003. 'use strict';
  14004. var $ = require('../internals/export');
  14005. var global = require('../internals/global');
  14006. var fails = require('../internals/fails');
  14007. var isArray = require('../internals/is-array');
  14008. var isObject = require('../internals/is-object');
  14009. var toObject = require('../internals/to-object');
  14010. var lengthOfArrayLike = require('../internals/length-of-array-like');
  14011. var createProperty = require('../internals/create-property');
  14012. var arraySpeciesCreate = require('../internals/array-species-create');
  14013. var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
  14014. var wellKnownSymbol = require('../internals/well-known-symbol');
  14015. var V8_VERSION = require('../internals/engine-v8-version');
  14016. var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
  14017. var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
  14018. var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
  14019. var TypeError = global.TypeError;
  14020. // We can't use this feature detection in V8 since it causes
  14021. // deoptimization and serious performance degradation
  14022. // https://github.com/zloirock/core-js/issues/679
  14023. var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
  14024. var array = [];
  14025. array[IS_CONCAT_SPREADABLE] = false;
  14026. return array.concat()[0] !== array;
  14027. });
  14028. var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
  14029. var isConcatSpreadable = function (O) {
  14030. if (!isObject(O)) return false;
  14031. var spreadable = O[IS_CONCAT_SPREADABLE];
  14032. return spreadable !== undefined ? !!spreadable : isArray(O);
  14033. };
  14034. var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
  14035. // `Array.prototype.concat` method
  14036. // https://tc39.es/ecma262/#sec-array.prototype.concat
  14037. // with adding support of @@isConcatSpreadable and @@species
  14038. $({ target: 'Array', proto: true, forced: FORCED }, {
  14039. // eslint-disable-next-line no-unused-vars -- required for `.length`
  14040. concat: function concat(arg) {
  14041. var O = toObject(this);
  14042. var A = arraySpeciesCreate(O, 0);
  14043. var n = 0;
  14044. var i, k, length, len, E;
  14045. for (i = -1, length = arguments.length; i < length; i++) {
  14046. E = i === -1 ? O : arguments[i];
  14047. if (isConcatSpreadable(E)) {
  14048. len = lengthOfArrayLike(E);
  14049. if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  14050. for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
  14051. } else {
  14052. if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  14053. createProperty(A, n++, E);
  14054. }
  14055. }
  14056. A.length = n;
  14057. return A;
  14058. }
  14059. });
  14060. },{"../internals/array-method-has-species-support":113,"../internals/array-species-create":120,"../internals/create-property":131,"../internals/engine-v8-version":146,"../internals/export":149,"../internals/fails":150,"../internals/global":163,"../internals/is-array":175,"../internals/is-object":180,"../internals/length-of-array-like":188,"../internals/to-object":250,"../internals/well-known-symbol":268}],273:[function(require,module,exports){
  14061. var $ = require('../internals/export');
  14062. var fill = require('../internals/array-fill');
  14063. var addToUnscopables = require('../internals/add-to-unscopables');
  14064. // `Array.prototype.fill` method
  14065. // https://tc39.es/ecma262/#sec-array.prototype.fill
  14066. $({ target: 'Array', proto: true }, {
  14067. fill: fill
  14068. });
  14069. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  14070. addToUnscopables('fill');
  14071. },{"../internals/add-to-unscopables":98,"../internals/array-fill":106,"../internals/export":149}],274:[function(require,module,exports){
  14072. 'use strict';
  14073. var $ = require('../internals/export');
  14074. var $filter = require('../internals/array-iteration').filter;
  14075. var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
  14076. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
  14077. // `Array.prototype.filter` method
  14078. // https://tc39.es/ecma262/#sec-array.prototype.filter
  14079. // with adding support of @@species
  14080. $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  14081. filter: function filter(callbackfn /* , thisArg */) {
  14082. return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  14083. }
  14084. });
  14085. },{"../internals/array-iteration":111,"../internals/array-method-has-species-support":113,"../internals/export":149}],275:[function(require,module,exports){
  14086. 'use strict';
  14087. var $ = require('../internals/export');
  14088. var $find = require('../internals/array-iteration').find;
  14089. var addToUnscopables = require('../internals/add-to-unscopables');
  14090. var FIND = 'find';
  14091. var SKIPS_HOLES = true;
  14092. // Shouldn't skip holes
  14093. if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
  14094. // `Array.prototype.find` method
  14095. // https://tc39.es/ecma262/#sec-array.prototype.find
  14096. $({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
  14097. find: function find(callbackfn /* , that = undefined */) {
  14098. return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  14099. }
  14100. });
  14101. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  14102. addToUnscopables(FIND);
  14103. },{"../internals/add-to-unscopables":98,"../internals/array-iteration":111,"../internals/export":149}],276:[function(require,module,exports){
  14104. var $ = require('../internals/export');
  14105. var from = require('../internals/array-from');
  14106. var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');
  14107. var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
  14108. // eslint-disable-next-line es-x/no-array-from -- required for testing
  14109. Array.from(iterable);
  14110. });
  14111. // `Array.from` method
  14112. // https://tc39.es/ecma262/#sec-array.from
  14113. $({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
  14114. from: from
  14115. });
  14116. },{"../internals/array-from":109,"../internals/check-correctness-of-iteration":122,"../internals/export":149}],277:[function(require,module,exports){
  14117. 'use strict';
  14118. var $ = require('../internals/export');
  14119. var $includes = require('../internals/array-includes').includes;
  14120. var addToUnscopables = require('../internals/add-to-unscopables');
  14121. // `Array.prototype.includes` method
  14122. // https://tc39.es/ecma262/#sec-array.prototype.includes
  14123. $({ target: 'Array', proto: true }, {
  14124. includes: function includes(el /* , fromIndex = 0 */) {
  14125. return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
  14126. }
  14127. });
  14128. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  14129. addToUnscopables('includes');
  14130. },{"../internals/add-to-unscopables":98,"../internals/array-includes":110,"../internals/export":149}],278:[function(require,module,exports){
  14131. 'use strict';
  14132. var toIndexedObject = require('../internals/to-indexed-object');
  14133. var addToUnscopables = require('../internals/add-to-unscopables');
  14134. var Iterators = require('../internals/iterators');
  14135. var InternalStateModule = require('../internals/internal-state');
  14136. var defineProperty = require('../internals/object-define-property').f;
  14137. var defineIterator = require('../internals/define-iterator');
  14138. var IS_PURE = require('../internals/is-pure');
  14139. var DESCRIPTORS = require('../internals/descriptors');
  14140. var ARRAY_ITERATOR = 'Array Iterator';
  14141. var setInternalState = InternalStateModule.set;
  14142. var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
  14143. // `Array.prototype.entries` method
  14144. // https://tc39.es/ecma262/#sec-array.prototype.entries
  14145. // `Array.prototype.keys` method
  14146. // https://tc39.es/ecma262/#sec-array.prototype.keys
  14147. // `Array.prototype.values` method
  14148. // https://tc39.es/ecma262/#sec-array.prototype.values
  14149. // `Array.prototype[@@iterator]` method
  14150. // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
  14151. // `CreateArrayIterator` internal method
  14152. // https://tc39.es/ecma262/#sec-createarrayiterator
  14153. module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
  14154. setInternalState(this, {
  14155. type: ARRAY_ITERATOR,
  14156. target: toIndexedObject(iterated), // target
  14157. index: 0, // next index
  14158. kind: kind // kind
  14159. });
  14160. // `%ArrayIteratorPrototype%.next` method
  14161. // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
  14162. }, function () {
  14163. var state = getInternalState(this);
  14164. var target = state.target;
  14165. var kind = state.kind;
  14166. var index = state.index++;
  14167. if (!target || index >= target.length) {
  14168. state.target = undefined;
  14169. return { value: undefined, done: true };
  14170. }
  14171. if (kind == 'keys') return { value: index, done: false };
  14172. if (kind == 'values') return { value: target[index], done: false };
  14173. return { value: [index, target[index]], done: false };
  14174. }, 'values');
  14175. // argumentsList[@@iterator] is %ArrayProto_values%
  14176. // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
  14177. // https://tc39.es/ecma262/#sec-createmappedargumentsobject
  14178. var values = Iterators.Arguments = Iterators.Array;
  14179. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  14180. addToUnscopables('keys');
  14181. addToUnscopables('values');
  14182. addToUnscopables('entries');
  14183. // V8 ~ Chrome 45- bug
  14184. if (!IS_PURE && DESCRIPTORS && values.name !== 'values') try {
  14185. defineProperty(values, 'name', { value: 'values' });
  14186. } catch (error) { /* empty */ }
  14187. },{"../internals/add-to-unscopables":98,"../internals/define-iterator":132,"../internals/descriptors":134,"../internals/internal-state":173,"../internals/is-pure":181,"../internals/iterators":187,"../internals/object-define-property":198,"../internals/to-indexed-object":247}],279:[function(require,module,exports){
  14188. 'use strict';
  14189. var $ = require('../internals/export');
  14190. var uncurryThis = require('../internals/function-uncurry-this');
  14191. var IndexedObject = require('../internals/indexed-object');
  14192. var toIndexedObject = require('../internals/to-indexed-object');
  14193. var arrayMethodIsStrict = require('../internals/array-method-is-strict');
  14194. var un$Join = uncurryThis([].join);
  14195. var ES3_STRINGS = IndexedObject != Object;
  14196. var STRICT_METHOD = arrayMethodIsStrict('join', ',');
  14197. // `Array.prototype.join` method
  14198. // https://tc39.es/ecma262/#sec-array.prototype.join
  14199. $({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD }, {
  14200. join: function join(separator) {
  14201. return un$Join(toIndexedObject(this), separator === undefined ? ',' : separator);
  14202. }
  14203. });
  14204. },{"../internals/array-method-is-strict":114,"../internals/export":149,"../internals/function-uncurry-this":157,"../internals/indexed-object":170,"../internals/to-indexed-object":247}],280:[function(require,module,exports){
  14205. 'use strict';
  14206. var $ = require('../internals/export');
  14207. var $map = require('../internals/array-iteration').map;
  14208. var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
  14209. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');
  14210. // `Array.prototype.map` method
  14211. // https://tc39.es/ecma262/#sec-array.prototype.map
  14212. // with adding support of @@species
  14213. $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  14214. map: function map(callbackfn /* , thisArg */) {
  14215. return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  14216. }
  14217. });
  14218. },{"../internals/array-iteration":111,"../internals/array-method-has-species-support":113,"../internals/export":149}],281:[function(require,module,exports){
  14219. 'use strict';
  14220. var $ = require('../internals/export');
  14221. var global = require('../internals/global');
  14222. var isArray = require('../internals/is-array');
  14223. var isConstructor = require('../internals/is-constructor');
  14224. var isObject = require('../internals/is-object');
  14225. var toAbsoluteIndex = require('../internals/to-absolute-index');
  14226. var lengthOfArrayLike = require('../internals/length-of-array-like');
  14227. var toIndexedObject = require('../internals/to-indexed-object');
  14228. var createProperty = require('../internals/create-property');
  14229. var wellKnownSymbol = require('../internals/well-known-symbol');
  14230. var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
  14231. var un$Slice = require('../internals/array-slice');
  14232. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');
  14233. var SPECIES = wellKnownSymbol('species');
  14234. var Array = global.Array;
  14235. var max = Math.max;
  14236. // `Array.prototype.slice` method
  14237. // https://tc39.es/ecma262/#sec-array.prototype.slice
  14238. // fallback for not array-like ES3 strings and DOM objects
  14239. $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  14240. slice: function slice(start, end) {
  14241. var O = toIndexedObject(this);
  14242. var length = lengthOfArrayLike(O);
  14243. var k = toAbsoluteIndex(start, length);
  14244. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  14245. // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
  14246. var Constructor, result, n;
  14247. if (isArray(O)) {
  14248. Constructor = O.constructor;
  14249. // cross-realm fallback
  14250. if (isConstructor(Constructor) && (Constructor === Array || isArray(Constructor.prototype))) {
  14251. Constructor = undefined;
  14252. } else if (isObject(Constructor)) {
  14253. Constructor = Constructor[SPECIES];
  14254. if (Constructor === null) Constructor = undefined;
  14255. }
  14256. if (Constructor === Array || Constructor === undefined) {
  14257. return un$Slice(O, k, fin);
  14258. }
  14259. }
  14260. result = new (Constructor === undefined ? Array : Constructor)(max(fin - k, 0));
  14261. for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
  14262. result.length = n;
  14263. return result;
  14264. }
  14265. });
  14266. },{"../internals/array-method-has-species-support":113,"../internals/array-slice":117,"../internals/create-property":131,"../internals/export":149,"../internals/global":163,"../internals/is-array":175,"../internals/is-constructor":177,"../internals/is-object":180,"../internals/length-of-array-like":188,"../internals/to-absolute-index":245,"../internals/to-indexed-object":247,"../internals/well-known-symbol":268}],282:[function(require,module,exports){
  14267. 'use strict';
  14268. var $ = require('../internals/export');
  14269. var uncurryThis = require('../internals/function-uncurry-this');
  14270. var aCallable = require('../internals/a-callable');
  14271. var toObject = require('../internals/to-object');
  14272. var lengthOfArrayLike = require('../internals/length-of-array-like');
  14273. var toString = require('../internals/to-string');
  14274. var fails = require('../internals/fails');
  14275. var internalSort = require('../internals/array-sort');
  14276. var arrayMethodIsStrict = require('../internals/array-method-is-strict');
  14277. var FF = require('../internals/engine-ff-version');
  14278. var IE_OR_EDGE = require('../internals/engine-is-ie-or-edge');
  14279. var V8 = require('../internals/engine-v8-version');
  14280. var WEBKIT = require('../internals/engine-webkit-version');
  14281. var test = [];
  14282. var un$Sort = uncurryThis(test.sort);
  14283. var push = uncurryThis(test.push);
  14284. // IE8-
  14285. var FAILS_ON_UNDEFINED = fails(function () {
  14286. test.sort(undefined);
  14287. });
  14288. // V8 bug
  14289. var FAILS_ON_NULL = fails(function () {
  14290. test.sort(null);
  14291. });
  14292. // Old WebKit
  14293. var STRICT_METHOD = arrayMethodIsStrict('sort');
  14294. var STABLE_SORT = !fails(function () {
  14295. // feature detection can be too slow, so check engines versions
  14296. if (V8) return V8 < 70;
  14297. if (FF && FF > 3) return;
  14298. if (IE_OR_EDGE) return true;
  14299. if (WEBKIT) return WEBKIT < 603;
  14300. var result = '';
  14301. var code, chr, value, index;
  14302. // generate an array with more 512 elements (Chakra and old V8 fails only in this case)
  14303. for (code = 65; code < 76; code++) {
  14304. chr = String.fromCharCode(code);
  14305. switch (code) {
  14306. case 66: case 69: case 70: case 72: value = 3; break;
  14307. case 68: case 71: value = 4; break;
  14308. default: value = 2;
  14309. }
  14310. for (index = 0; index < 47; index++) {
  14311. test.push({ k: chr + index, v: value });
  14312. }
  14313. }
  14314. test.sort(function (a, b) { return b.v - a.v; });
  14315. for (index = 0; index < test.length; index++) {
  14316. chr = test[index].k.charAt(0);
  14317. if (result.charAt(result.length - 1) !== chr) result += chr;
  14318. }
  14319. return result !== 'DGBEFHACIJK';
  14320. });
  14321. var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
  14322. var getSortCompare = function (comparefn) {
  14323. return function (x, y) {
  14324. if (y === undefined) return -1;
  14325. if (x === undefined) return 1;
  14326. if (comparefn !== undefined) return +comparefn(x, y) || 0;
  14327. return toString(x) > toString(y) ? 1 : -1;
  14328. };
  14329. };
  14330. // `Array.prototype.sort` method
  14331. // https://tc39.es/ecma262/#sec-array.prototype.sort
  14332. $({ target: 'Array', proto: true, forced: FORCED }, {
  14333. sort: function sort(comparefn) {
  14334. if (comparefn !== undefined) aCallable(comparefn);
  14335. var array = toObject(this);
  14336. if (STABLE_SORT) return comparefn === undefined ? un$Sort(array) : un$Sort(array, comparefn);
  14337. var items = [];
  14338. var arrayLength = lengthOfArrayLike(array);
  14339. var itemsLength, index;
  14340. for (index = 0; index < arrayLength; index++) {
  14341. if (index in array) push(items, array[index]);
  14342. }
  14343. internalSort(items, getSortCompare(comparefn));
  14344. itemsLength = items.length;
  14345. index = 0;
  14346. while (index < itemsLength) array[index] = items[index++];
  14347. while (index < arrayLength) delete array[index++];
  14348. return array;
  14349. }
  14350. });
  14351. },{"../internals/a-callable":95,"../internals/array-method-is-strict":114,"../internals/array-sort":118,"../internals/engine-ff-version":138,"../internals/engine-is-ie-or-edge":140,"../internals/engine-v8-version":146,"../internals/engine-webkit-version":147,"../internals/export":149,"../internals/fails":150,"../internals/function-uncurry-this":157,"../internals/length-of-array-like":188,"../internals/to-object":250,"../internals/to-string":256}],283:[function(require,module,exports){
  14352. 'use strict';
  14353. var $ = require('../internals/export');
  14354. var global = require('../internals/global');
  14355. var toAbsoluteIndex = require('../internals/to-absolute-index');
  14356. var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
  14357. var lengthOfArrayLike = require('../internals/length-of-array-like');
  14358. var toObject = require('../internals/to-object');
  14359. var arraySpeciesCreate = require('../internals/array-species-create');
  14360. var createProperty = require('../internals/create-property');
  14361. var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
  14362. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');
  14363. var TypeError = global.TypeError;
  14364. var max = Math.max;
  14365. var min = Math.min;
  14366. var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
  14367. var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
  14368. // `Array.prototype.splice` method
  14369. // https://tc39.es/ecma262/#sec-array.prototype.splice
  14370. // with adding support of @@species
  14371. $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  14372. splice: function splice(start, deleteCount /* , ...items */) {
  14373. var O = toObject(this);
  14374. var len = lengthOfArrayLike(O);
  14375. var actualStart = toAbsoluteIndex(start, len);
  14376. var argumentsLength = arguments.length;
  14377. var insertCount, actualDeleteCount, A, k, from, to;
  14378. if (argumentsLength === 0) {
  14379. insertCount = actualDeleteCount = 0;
  14380. } else if (argumentsLength === 1) {
  14381. insertCount = 0;
  14382. actualDeleteCount = len - actualStart;
  14383. } else {
  14384. insertCount = argumentsLength - 2;
  14385. actualDeleteCount = min(max(toIntegerOrInfinity(deleteCount), 0), len - actualStart);
  14386. }
  14387. if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
  14388. throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
  14389. }
  14390. A = arraySpeciesCreate(O, actualDeleteCount);
  14391. for (k = 0; k < actualDeleteCount; k++) {
  14392. from = actualStart + k;
  14393. if (from in O) createProperty(A, k, O[from]);
  14394. }
  14395. A.length = actualDeleteCount;
  14396. if (insertCount < actualDeleteCount) {
  14397. for (k = actualStart; k < len - actualDeleteCount; k++) {
  14398. from = k + actualDeleteCount;
  14399. to = k + insertCount;
  14400. if (from in O) O[to] = O[from];
  14401. else delete O[to];
  14402. }
  14403. for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
  14404. } else if (insertCount > actualDeleteCount) {
  14405. for (k = len - actualDeleteCount; k > actualStart; k--) {
  14406. from = k + actualDeleteCount - 1;
  14407. to = k + insertCount - 1;
  14408. if (from in O) O[to] = O[from];
  14409. else delete O[to];
  14410. }
  14411. }
  14412. for (k = 0; k < insertCount; k++) {
  14413. O[k + actualStart] = arguments[k + 2];
  14414. }
  14415. O.length = len - actualDeleteCount + insertCount;
  14416. return A;
  14417. }
  14418. });
  14419. },{"../internals/array-method-has-species-support":113,"../internals/array-species-create":120,"../internals/create-property":131,"../internals/export":149,"../internals/global":163,"../internals/length-of-array-like":188,"../internals/to-absolute-index":245,"../internals/to-integer-or-infinity":248,"../internals/to-object":250}],284:[function(require,module,exports){
  14420. var DESCRIPTORS = require('../internals/descriptors');
  14421. var FUNCTION_NAME_EXISTS = require('../internals/function-name').EXISTS;
  14422. var uncurryThis = require('../internals/function-uncurry-this');
  14423. var defineProperty = require('../internals/object-define-property').f;
  14424. var FunctionPrototype = Function.prototype;
  14425. var functionToString = uncurryThis(FunctionPrototype.toString);
  14426. var nameRE = /function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/;
  14427. var regExpExec = uncurryThis(nameRE.exec);
  14428. var NAME = 'name';
  14429. // Function instances `.name` property
  14430. // https://tc39.es/ecma262/#sec-function-instances-name
  14431. if (DESCRIPTORS && !FUNCTION_NAME_EXISTS) {
  14432. defineProperty(FunctionPrototype, NAME, {
  14433. configurable: true,
  14434. get: function () {
  14435. try {
  14436. return regExpExec(nameRE, functionToString(this))[1];
  14437. } catch (error) {
  14438. return '';
  14439. }
  14440. }
  14441. });
  14442. }
  14443. },{"../internals/descriptors":134,"../internals/function-name":156,"../internals/function-uncurry-this":157,"../internals/object-define-property":198}],285:[function(require,module,exports){
  14444. var $ = require('../internals/export');
  14445. var getBuiltIn = require('../internals/get-built-in');
  14446. var apply = require('../internals/function-apply');
  14447. var call = require('../internals/function-call');
  14448. var uncurryThis = require('../internals/function-uncurry-this');
  14449. var fails = require('../internals/fails');
  14450. var isArray = require('../internals/is-array');
  14451. var isCallable = require('../internals/is-callable');
  14452. var isObject = require('../internals/is-object');
  14453. var isSymbol = require('../internals/is-symbol');
  14454. var arraySlice = require('../internals/array-slice');
  14455. var NATIVE_SYMBOL = require('../internals/native-symbol');
  14456. var $stringify = getBuiltIn('JSON', 'stringify');
  14457. var exec = uncurryThis(/./.exec);
  14458. var charAt = uncurryThis(''.charAt);
  14459. var charCodeAt = uncurryThis(''.charCodeAt);
  14460. var replace = uncurryThis(''.replace);
  14461. var numberToString = uncurryThis(1.0.toString);
  14462. var tester = /[\uD800-\uDFFF]/g;
  14463. var low = /^[\uD800-\uDBFF]$/;
  14464. var hi = /^[\uDC00-\uDFFF]$/;
  14465. var WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails(function () {
  14466. var symbol = getBuiltIn('Symbol')();
  14467. // MS Edge converts symbol values to JSON as {}
  14468. return $stringify([symbol]) != '[null]'
  14469. // WebKit converts symbol values to JSON as null
  14470. || $stringify({ a: symbol }) != '{}'
  14471. // V8 throws on boxed symbols
  14472. || $stringify(Object(symbol)) != '{}';
  14473. });
  14474. // https://github.com/tc39/proposal-well-formed-stringify
  14475. var ILL_FORMED_UNICODE = fails(function () {
  14476. return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"'
  14477. || $stringify('\uDEAD') !== '"\\udead"';
  14478. });
  14479. var stringifyWithSymbolsFix = function (it, replacer) {
  14480. var args = arraySlice(arguments);
  14481. var $replacer = replacer;
  14482. if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
  14483. if (!isArray(replacer)) replacer = function (key, value) {
  14484. if (isCallable($replacer)) value = call($replacer, this, key, value);
  14485. if (!isSymbol(value)) return value;
  14486. };
  14487. args[1] = replacer;
  14488. return apply($stringify, null, args);
  14489. };
  14490. var fixIllFormed = function (match, offset, string) {
  14491. var prev = charAt(string, offset - 1);
  14492. var next = charAt(string, offset + 1);
  14493. if ((exec(low, match) && !exec(hi, next)) || (exec(hi, match) && !exec(low, prev))) {
  14494. return '\\u' + numberToString(charCodeAt(match, 0), 16);
  14495. } return match;
  14496. };
  14497. if ($stringify) {
  14498. // `JSON.stringify` method
  14499. // https://tc39.es/ecma262/#sec-json.stringify
  14500. $({ target: 'JSON', stat: true, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, {
  14501. // eslint-disable-next-line no-unused-vars -- required for `.length`
  14502. stringify: function stringify(it, replacer, space) {
  14503. var args = arraySlice(arguments);
  14504. var result = apply(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args);
  14505. return ILL_FORMED_UNICODE && typeof result == 'string' ? replace(result, tester, fixIllFormed) : result;
  14506. }
  14507. });
  14508. }
  14509. },{"../internals/array-slice":117,"../internals/export":149,"../internals/fails":150,"../internals/function-apply":152,"../internals/function-call":155,"../internals/function-uncurry-this":157,"../internals/get-built-in":158,"../internals/is-array":175,"../internals/is-callable":176,"../internals/is-object":180,"../internals/is-symbol":183,"../internals/native-symbol":191}],286:[function(require,module,exports){
  14510. 'use strict';
  14511. var DESCRIPTORS = require('../internals/descriptors');
  14512. var global = require('../internals/global');
  14513. var uncurryThis = require('../internals/function-uncurry-this');
  14514. var isForced = require('../internals/is-forced');
  14515. var redefine = require('../internals/redefine');
  14516. var hasOwn = require('../internals/has-own-property');
  14517. var inheritIfRequired = require('../internals/inherit-if-required');
  14518. var isPrototypeOf = require('../internals/object-is-prototype-of');
  14519. var isSymbol = require('../internals/is-symbol');
  14520. var toPrimitive = require('../internals/to-primitive');
  14521. var fails = require('../internals/fails');
  14522. var getOwnPropertyNames = require('../internals/object-get-own-property-names').f;
  14523. var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
  14524. var defineProperty = require('../internals/object-define-property').f;
  14525. var thisNumberValue = require('../internals/this-number-value');
  14526. var trim = require('../internals/string-trim').trim;
  14527. var NUMBER = 'Number';
  14528. var NativeNumber = global[NUMBER];
  14529. var NumberPrototype = NativeNumber.prototype;
  14530. var TypeError = global.TypeError;
  14531. var arraySlice = uncurryThis(''.slice);
  14532. var charCodeAt = uncurryThis(''.charCodeAt);
  14533. // `ToNumeric` abstract operation
  14534. // https://tc39.es/ecma262/#sec-tonumeric
  14535. var toNumeric = function (value) {
  14536. var primValue = toPrimitive(value, 'number');
  14537. return typeof primValue == 'bigint' ? primValue : toNumber(primValue);
  14538. };
  14539. // `ToNumber` abstract operation
  14540. // https://tc39.es/ecma262/#sec-tonumber
  14541. var toNumber = function (argument) {
  14542. var it = toPrimitive(argument, 'number');
  14543. var first, third, radix, maxCode, digits, length, index, code;
  14544. if (isSymbol(it)) throw TypeError('Cannot convert a Symbol value to a number');
  14545. if (typeof it == 'string' && it.length > 2) {
  14546. it = trim(it);
  14547. first = charCodeAt(it, 0);
  14548. if (first === 43 || first === 45) {
  14549. third = charCodeAt(it, 2);
  14550. if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
  14551. } else if (first === 48) {
  14552. switch (charCodeAt(it, 1)) {
  14553. case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i
  14554. case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i
  14555. default: return +it;
  14556. }
  14557. digits = arraySlice(it, 2);
  14558. length = digits.length;
  14559. for (index = 0; index < length; index++) {
  14560. code = charCodeAt(digits, index);
  14561. // parseInt parses a string to a first unavailable symbol
  14562. // but ToNumber should return NaN if a string contains unavailable symbols
  14563. if (code < 48 || code > maxCode) return NaN;
  14564. } return parseInt(digits, radix);
  14565. }
  14566. } return +it;
  14567. };
  14568. // `Number` constructor
  14569. // https://tc39.es/ecma262/#sec-number-constructor
  14570. if (isForced(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
  14571. var NumberWrapper = function Number(value) {
  14572. var n = arguments.length < 1 ? 0 : NativeNumber(toNumeric(value));
  14573. var dummy = this;
  14574. // check on 1..constructor(foo) case
  14575. return isPrototypeOf(NumberPrototype, dummy) && fails(function () { thisNumberValue(dummy); })
  14576. ? inheritIfRequired(Object(n), dummy, NumberWrapper) : n;
  14577. };
  14578. for (var keys = DESCRIPTORS ? getOwnPropertyNames(NativeNumber) : (
  14579. // ES3:
  14580. 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
  14581. // ES2015 (in case, if modules with ES2015 Number statics required before):
  14582. 'EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,' +
  14583. // ESNext
  14584. 'fromString,range'
  14585. ).split(','), j = 0, key; keys.length > j; j++) {
  14586. if (hasOwn(NativeNumber, key = keys[j]) && !hasOwn(NumberWrapper, key)) {
  14587. defineProperty(NumberWrapper, key, getOwnPropertyDescriptor(NativeNumber, key));
  14588. }
  14589. }
  14590. NumberWrapper.prototype = NumberPrototype;
  14591. NumberPrototype.constructor = NumberWrapper;
  14592. redefine(global, NUMBER, NumberWrapper);
  14593. }
  14594. },{"../internals/descriptors":134,"../internals/fails":150,"../internals/function-uncurry-this":157,"../internals/global":163,"../internals/has-own-property":164,"../internals/inherit-if-required":171,"../internals/is-forced":178,"../internals/is-symbol":183,"../internals/object-define-property":198,"../internals/object-get-own-property-descriptor":199,"../internals/object-get-own-property-names":201,"../internals/object-is-prototype-of":204,"../internals/redefine":222,"../internals/string-trim":241,"../internals/this-number-value":244,"../internals/to-primitive":253}],287:[function(require,module,exports){
  14595. var $ = require('../internals/export');
  14596. var assign = require('../internals/object-assign');
  14597. // `Object.assign` method
  14598. // https://tc39.es/ecma262/#sec-object.assign
  14599. // eslint-disable-next-line es-x/no-object-assign -- required for testing
  14600. $({ target: 'Object', stat: true, forced: Object.assign !== assign }, {
  14601. assign: assign
  14602. });
  14603. },{"../internals/export":149,"../internals/object-assign":195}],288:[function(require,module,exports){
  14604. var $ = require('../internals/export');
  14605. var $entries = require('../internals/object-to-array').entries;
  14606. // `Object.entries` method
  14607. // https://tc39.es/ecma262/#sec-object.entries
  14608. $({ target: 'Object', stat: true }, {
  14609. entries: function entries(O) {
  14610. return $entries(O);
  14611. }
  14612. });
  14613. },{"../internals/export":149,"../internals/object-to-array":209}],289:[function(require,module,exports){
  14614. var $ = require('../internals/export');
  14615. var NATIVE_SYMBOL = require('../internals/native-symbol');
  14616. var fails = require('../internals/fails');
  14617. var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');
  14618. var toObject = require('../internals/to-object');
  14619. // V8 ~ Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
  14620. // https://bugs.chromium.org/p/v8/issues/detail?id=3443
  14621. var FORCED = !NATIVE_SYMBOL || fails(function () { getOwnPropertySymbolsModule.f(1); });
  14622. // `Object.getOwnPropertySymbols` method
  14623. // https://tc39.es/ecma262/#sec-object.getownpropertysymbols
  14624. $({ target: 'Object', stat: true, forced: FORCED }, {
  14625. getOwnPropertySymbols: function getOwnPropertySymbols(it) {
  14626. var $getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  14627. return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject(it)) : [];
  14628. }
  14629. });
  14630. },{"../internals/export":149,"../internals/fails":150,"../internals/native-symbol":191,"../internals/object-get-own-property-symbols":202,"../internals/to-object":250}],290:[function(require,module,exports){
  14631. var $ = require('../internals/export');
  14632. var toObject = require('../internals/to-object');
  14633. var nativeKeys = require('../internals/object-keys');
  14634. var fails = require('../internals/fails');
  14635. var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); });
  14636. // `Object.keys` method
  14637. // https://tc39.es/ecma262/#sec-object.keys
  14638. $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
  14639. keys: function keys(it) {
  14640. return nativeKeys(toObject(it));
  14641. }
  14642. });
  14643. },{"../internals/export":149,"../internals/fails":150,"../internals/object-keys":206,"../internals/to-object":250}],291:[function(require,module,exports){
  14644. var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');
  14645. var redefine = require('../internals/redefine');
  14646. var toString = require('../internals/object-to-string');
  14647. // `Object.prototype.toString` method
  14648. // https://tc39.es/ecma262/#sec-object.prototype.tostring
  14649. if (!TO_STRING_TAG_SUPPORT) {
  14650. redefine(Object.prototype, 'toString', toString, { unsafe: true });
  14651. }
  14652. },{"../internals/object-to-string":210,"../internals/redefine":222,"../internals/to-string-tag-support":255}],292:[function(require,module,exports){
  14653. 'use strict';
  14654. var $ = require('../internals/export');
  14655. var call = require('../internals/function-call');
  14656. var aCallable = require('../internals/a-callable');
  14657. var newPromiseCapabilityModule = require('../internals/new-promise-capability');
  14658. var perform = require('../internals/perform');
  14659. var iterate = require('../internals/iterate');
  14660. var PROMISE_STATICS_INCORRECT_ITERATION = require('../internals/promise-statics-incorrect-iteration');
  14661. // `Promise.all` method
  14662. // https://tc39.es/ecma262/#sec-promise.all
  14663. $({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
  14664. all: function all(iterable) {
  14665. var C = this;
  14666. var capability = newPromiseCapabilityModule.f(C);
  14667. var resolve = capability.resolve;
  14668. var reject = capability.reject;
  14669. var result = perform(function () {
  14670. var $promiseResolve = aCallable(C.resolve);
  14671. var values = [];
  14672. var counter = 0;
  14673. var remaining = 1;
  14674. iterate(iterable, function (promise) {
  14675. var index = counter++;
  14676. var alreadyCalled = false;
  14677. remaining++;
  14678. call($promiseResolve, C, promise).then(function (value) {
  14679. if (alreadyCalled) return;
  14680. alreadyCalled = true;
  14681. values[index] = value;
  14682. --remaining || resolve(values);
  14683. }, reject);
  14684. });
  14685. --remaining || resolve(values);
  14686. });
  14687. if (result.error) reject(result.value);
  14688. return capability.promise;
  14689. }
  14690. });
  14691. },{"../internals/a-callable":95,"../internals/export":149,"../internals/function-call":155,"../internals/iterate":184,"../internals/new-promise-capability":193,"../internals/perform":214,"../internals/promise-statics-incorrect-iteration":218}],293:[function(require,module,exports){
  14692. 'use strict';
  14693. var $ = require('../internals/export');
  14694. var IS_PURE = require('../internals/is-pure');
  14695. var FORCED_PROMISE_CONSTRUCTOR = require('../internals/promise-constructor-detection').CONSTRUCTOR;
  14696. var NativePromiseConstructor = require('../internals/promise-native-constructor');
  14697. var getBuiltIn = require('../internals/get-built-in');
  14698. var isCallable = require('../internals/is-callable');
  14699. var redefine = require('../internals/redefine');
  14700. var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
  14701. // `Promise.prototype.catch` method
  14702. // https://tc39.es/ecma262/#sec-promise.prototype.catch
  14703. $({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR, real: true }, {
  14704. 'catch': function (onRejected) {
  14705. return this.then(undefined, onRejected);
  14706. }
  14707. });
  14708. // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
  14709. if (!IS_PURE && isCallable(NativePromiseConstructor)) {
  14710. var method = getBuiltIn('Promise').prototype['catch'];
  14711. if (NativePromisePrototype['catch'] !== method) {
  14712. redefine(NativePromisePrototype, 'catch', method, { unsafe: true });
  14713. }
  14714. }
  14715. },{"../internals/export":149,"../internals/get-built-in":158,"../internals/is-callable":176,"../internals/is-pure":181,"../internals/promise-constructor-detection":215,"../internals/promise-native-constructor":216,"../internals/redefine":222}],294:[function(require,module,exports){
  14716. 'use strict';
  14717. var $ = require('../internals/export');
  14718. var IS_PURE = require('../internals/is-pure');
  14719. var IS_NODE = require('../internals/engine-is-node');
  14720. var global = require('../internals/global');
  14721. var call = require('../internals/function-call');
  14722. var redefine = require('../internals/redefine');
  14723. var redefineAll = require('../internals/redefine-all');
  14724. var setPrototypeOf = require('../internals/object-set-prototype-of');
  14725. var setToStringTag = require('../internals/set-to-string-tag');
  14726. var setSpecies = require('../internals/set-species');
  14727. var aCallable = require('../internals/a-callable');
  14728. var isCallable = require('../internals/is-callable');
  14729. var isObject = require('../internals/is-object');
  14730. var anInstance = require('../internals/an-instance');
  14731. var speciesConstructor = require('../internals/species-constructor');
  14732. var task = require('../internals/task').set;
  14733. var microtask = require('../internals/microtask');
  14734. var hostReportErrors = require('../internals/host-report-errors');
  14735. var perform = require('../internals/perform');
  14736. var Queue = require('../internals/queue');
  14737. var InternalStateModule = require('../internals/internal-state');
  14738. var NativePromiseConstructor = require('../internals/promise-native-constructor');
  14739. var PromiseConstructorDetection = require('../internals/promise-constructor-detection');
  14740. var newPromiseCapabilityModule = require('../internals/new-promise-capability');
  14741. var PROMISE = 'Promise';
  14742. var FORCED_PROMISE_CONSTRUCTOR = PromiseConstructorDetection.CONSTRUCTOR;
  14743. var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT;
  14744. var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING;
  14745. var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
  14746. var setInternalState = InternalStateModule.set;
  14747. var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
  14748. var PromiseConstructor = NativePromiseConstructor;
  14749. var PromisePrototype = NativePromisePrototype;
  14750. var TypeError = global.TypeError;
  14751. var document = global.document;
  14752. var process = global.process;
  14753. var newPromiseCapability = newPromiseCapabilityModule.f;
  14754. var newGenericPromiseCapability = newPromiseCapability;
  14755. var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
  14756. var UNHANDLED_REJECTION = 'unhandledrejection';
  14757. var REJECTION_HANDLED = 'rejectionhandled';
  14758. var PENDING = 0;
  14759. var FULFILLED = 1;
  14760. var REJECTED = 2;
  14761. var HANDLED = 1;
  14762. var UNHANDLED = 2;
  14763. var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
  14764. // helpers
  14765. var isThenable = function (it) {
  14766. var then;
  14767. return isObject(it) && isCallable(then = it.then) ? then : false;
  14768. };
  14769. var callReaction = function (reaction, state) {
  14770. var value = state.value;
  14771. var ok = state.state == FULFILLED;
  14772. var handler = ok ? reaction.ok : reaction.fail;
  14773. var resolve = reaction.resolve;
  14774. var reject = reaction.reject;
  14775. var domain = reaction.domain;
  14776. var result, then, exited;
  14777. try {
  14778. if (handler) {
  14779. if (!ok) {
  14780. if (state.rejection === UNHANDLED) onHandleUnhandled(state);
  14781. state.rejection = HANDLED;
  14782. }
  14783. if (handler === true) result = value;
  14784. else {
  14785. if (domain) domain.enter();
  14786. result = handler(value); // can throw
  14787. if (domain) {
  14788. domain.exit();
  14789. exited = true;
  14790. }
  14791. }
  14792. if (result === reaction.promise) {
  14793. reject(TypeError('Promise-chain cycle'));
  14794. } else if (then = isThenable(result)) {
  14795. call(then, result, resolve, reject);
  14796. } else resolve(result);
  14797. } else reject(value);
  14798. } catch (error) {
  14799. if (domain && !exited) domain.exit();
  14800. reject(error);
  14801. }
  14802. };
  14803. var notify = function (state, isReject) {
  14804. if (state.notified) return;
  14805. state.notified = true;
  14806. microtask(function () {
  14807. var reactions = state.reactions;
  14808. var reaction;
  14809. while (reaction = reactions.get()) {
  14810. callReaction(reaction, state);
  14811. }
  14812. state.notified = false;
  14813. if (isReject && !state.rejection) onUnhandled(state);
  14814. });
  14815. };
  14816. var dispatchEvent = function (name, promise, reason) {
  14817. var event, handler;
  14818. if (DISPATCH_EVENT) {
  14819. event = document.createEvent('Event');
  14820. event.promise = promise;
  14821. event.reason = reason;
  14822. event.initEvent(name, false, true);
  14823. global.dispatchEvent(event);
  14824. } else event = { promise: promise, reason: reason };
  14825. if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global['on' + name])) handler(event);
  14826. else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
  14827. };
  14828. var onUnhandled = function (state) {
  14829. call(task, global, function () {
  14830. var promise = state.facade;
  14831. var value = state.value;
  14832. var IS_UNHANDLED = isUnhandled(state);
  14833. var result;
  14834. if (IS_UNHANDLED) {
  14835. result = perform(function () {
  14836. if (IS_NODE) {
  14837. process.emit('unhandledRejection', value, promise);
  14838. } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
  14839. });
  14840. // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
  14841. state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
  14842. if (result.error) throw result.value;
  14843. }
  14844. });
  14845. };
  14846. var isUnhandled = function (state) {
  14847. return state.rejection !== HANDLED && !state.parent;
  14848. };
  14849. var onHandleUnhandled = function (state) {
  14850. call(task, global, function () {
  14851. var promise = state.facade;
  14852. if (IS_NODE) {
  14853. process.emit('rejectionHandled', promise);
  14854. } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
  14855. });
  14856. };
  14857. var bind = function (fn, state, unwrap) {
  14858. return function (value) {
  14859. fn(state, value, unwrap);
  14860. };
  14861. };
  14862. var internalReject = function (state, value, unwrap) {
  14863. if (state.done) return;
  14864. state.done = true;
  14865. if (unwrap) state = unwrap;
  14866. state.value = value;
  14867. state.state = REJECTED;
  14868. notify(state, true);
  14869. };
  14870. var internalResolve = function (state, value, unwrap) {
  14871. if (state.done) return;
  14872. state.done = true;
  14873. if (unwrap) state = unwrap;
  14874. try {
  14875. if (state.facade === value) throw TypeError("Promise can't be resolved itself");
  14876. var then = isThenable(value);
  14877. if (then) {
  14878. microtask(function () {
  14879. var wrapper = { done: false };
  14880. try {
  14881. call(then, value,
  14882. bind(internalResolve, wrapper, state),
  14883. bind(internalReject, wrapper, state)
  14884. );
  14885. } catch (error) {
  14886. internalReject(wrapper, error, state);
  14887. }
  14888. });
  14889. } else {
  14890. state.value = value;
  14891. state.state = FULFILLED;
  14892. notify(state, false);
  14893. }
  14894. } catch (error) {
  14895. internalReject({ done: false }, error, state);
  14896. }
  14897. };
  14898. // constructor polyfill
  14899. if (FORCED_PROMISE_CONSTRUCTOR) {
  14900. // 25.4.3.1 Promise(executor)
  14901. PromiseConstructor = function Promise(executor) {
  14902. anInstance(this, PromisePrototype);
  14903. aCallable(executor);
  14904. call(Internal, this);
  14905. var state = getInternalPromiseState(this);
  14906. try {
  14907. executor(bind(internalResolve, state), bind(internalReject, state));
  14908. } catch (error) {
  14909. internalReject(state, error);
  14910. }
  14911. };
  14912. PromisePrototype = PromiseConstructor.prototype;
  14913. // eslint-disable-next-line no-unused-vars -- required for `.length`
  14914. Internal = function Promise(executor) {
  14915. setInternalState(this, {
  14916. type: PROMISE,
  14917. done: false,
  14918. notified: false,
  14919. parent: false,
  14920. reactions: new Queue(),
  14921. rejection: false,
  14922. state: PENDING,
  14923. value: undefined
  14924. });
  14925. };
  14926. Internal.prototype = redefineAll(PromisePrototype, {
  14927. // `Promise.prototype.then` method
  14928. // https://tc39.es/ecma262/#sec-promise.prototype.then
  14929. // eslint-disable-next-line unicorn/no-thenable -- safe
  14930. then: function then(onFulfilled, onRejected) {
  14931. var state = getInternalPromiseState(this);
  14932. var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
  14933. state.parent = true;
  14934. reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
  14935. reaction.fail = isCallable(onRejected) && onRejected;
  14936. reaction.domain = IS_NODE ? process.domain : undefined;
  14937. if (state.state == PENDING) state.reactions.add(reaction);
  14938. else microtask(function () {
  14939. callReaction(reaction, state);
  14940. });
  14941. return reaction.promise;
  14942. }
  14943. });
  14944. OwnPromiseCapability = function () {
  14945. var promise = new Internal();
  14946. var state = getInternalPromiseState(promise);
  14947. this.promise = promise;
  14948. this.resolve = bind(internalResolve, state);
  14949. this.reject = bind(internalReject, state);
  14950. };
  14951. newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
  14952. return C === PromiseConstructor || C === PromiseWrapper
  14953. ? new OwnPromiseCapability(C)
  14954. : newGenericPromiseCapability(C);
  14955. };
  14956. if (!IS_PURE && isCallable(NativePromiseConstructor) && NativePromisePrototype !== Object.prototype) {
  14957. nativeThen = NativePromisePrototype.then;
  14958. if (!NATIVE_PROMISE_SUBCLASSING) {
  14959. // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
  14960. redefine(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
  14961. var that = this;
  14962. return new PromiseConstructor(function (resolve, reject) {
  14963. call(nativeThen, that, resolve, reject);
  14964. }).then(onFulfilled, onRejected);
  14965. // https://github.com/zloirock/core-js/issues/640
  14966. }, { unsafe: true });
  14967. }
  14968. // make `.constructor === Promise` work for native promise-based APIs
  14969. try {
  14970. delete NativePromisePrototype.constructor;
  14971. } catch (error) { /* empty */ }
  14972. // make `instanceof Promise` work for native promise-based APIs
  14973. if (setPrototypeOf) {
  14974. setPrototypeOf(NativePromisePrototype, PromisePrototype);
  14975. }
  14976. }
  14977. }
  14978. $({ global: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
  14979. Promise: PromiseConstructor
  14980. });
  14981. setToStringTag(PromiseConstructor, PROMISE, false, true);
  14982. setSpecies(PROMISE);
  14983. },{"../internals/a-callable":95,"../internals/an-instance":100,"../internals/engine-is-node":143,"../internals/export":149,"../internals/function-call":155,"../internals/global":163,"../internals/host-report-errors":166,"../internals/internal-state":173,"../internals/is-callable":176,"../internals/is-object":180,"../internals/is-pure":181,"../internals/microtask":189,"../internals/new-promise-capability":193,"../internals/object-set-prototype-of":208,"../internals/perform":214,"../internals/promise-constructor-detection":215,"../internals/promise-native-constructor":216,"../internals/queue":220,"../internals/redefine":222,"../internals/redefine-all":221,"../internals/set-species":233,"../internals/set-to-string-tag":234,"../internals/species-constructor":238,"../internals/task":243}],295:[function(require,module,exports){
  14984. // TODO: Remove this module from `core-js@4` since it's split to modules listed below
  14985. require('../modules/es.promise.constructor');
  14986. require('../modules/es.promise.all');
  14987. require('../modules/es.promise.catch');
  14988. require('../modules/es.promise.race');
  14989. require('../modules/es.promise.reject');
  14990. require('../modules/es.promise.resolve');
  14991. },{"../modules/es.promise.all":292,"../modules/es.promise.catch":293,"../modules/es.promise.constructor":294,"../modules/es.promise.race":296,"../modules/es.promise.reject":297,"../modules/es.promise.resolve":298}],296:[function(require,module,exports){
  14992. 'use strict';
  14993. var $ = require('../internals/export');
  14994. var call = require('../internals/function-call');
  14995. var aCallable = require('../internals/a-callable');
  14996. var newPromiseCapabilityModule = require('../internals/new-promise-capability');
  14997. var perform = require('../internals/perform');
  14998. var iterate = require('../internals/iterate');
  14999. var PROMISE_STATICS_INCORRECT_ITERATION = require('../internals/promise-statics-incorrect-iteration');
  15000. // `Promise.race` method
  15001. // https://tc39.es/ecma262/#sec-promise.race
  15002. $({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
  15003. race: function race(iterable) {
  15004. var C = this;
  15005. var capability = newPromiseCapabilityModule.f(C);
  15006. var reject = capability.reject;
  15007. var result = perform(function () {
  15008. var $promiseResolve = aCallable(C.resolve);
  15009. iterate(iterable, function (promise) {
  15010. call($promiseResolve, C, promise).then(capability.resolve, reject);
  15011. });
  15012. });
  15013. if (result.error) reject(result.value);
  15014. return capability.promise;
  15015. }
  15016. });
  15017. },{"../internals/a-callable":95,"../internals/export":149,"../internals/function-call":155,"../internals/iterate":184,"../internals/new-promise-capability":193,"../internals/perform":214,"../internals/promise-statics-incorrect-iteration":218}],297:[function(require,module,exports){
  15018. 'use strict';
  15019. var $ = require('../internals/export');
  15020. var call = require('../internals/function-call');
  15021. var newPromiseCapabilityModule = require('../internals/new-promise-capability');
  15022. var FORCED_PROMISE_CONSTRUCTOR = require('../internals/promise-constructor-detection').CONSTRUCTOR;
  15023. // `Promise.reject` method
  15024. // https://tc39.es/ecma262/#sec-promise.reject
  15025. $({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
  15026. reject: function reject(r) {
  15027. var capability = newPromiseCapabilityModule.f(this);
  15028. call(capability.reject, undefined, r);
  15029. return capability.promise;
  15030. }
  15031. });
  15032. },{"../internals/export":149,"../internals/function-call":155,"../internals/new-promise-capability":193,"../internals/promise-constructor-detection":215}],298:[function(require,module,exports){
  15033. 'use strict';
  15034. var $ = require('../internals/export');
  15035. var getBuiltIn = require('../internals/get-built-in');
  15036. var IS_PURE = require('../internals/is-pure');
  15037. var NativePromiseConstructor = require('../internals/promise-native-constructor');
  15038. var FORCED_PROMISE_CONSTRUCTOR = require('../internals/promise-constructor-detection').CONSTRUCTOR;
  15039. var promiseResolve = require('../internals/promise-resolve');
  15040. var PromiseConstructorWrapper = getBuiltIn('Promise');
  15041. var CHECK_WRAPPER = IS_PURE && !FORCED_PROMISE_CONSTRUCTOR;
  15042. // `Promise.resolve` method
  15043. // https://tc39.es/ecma262/#sec-promise.resolve
  15044. $({ target: 'Promise', stat: true, forced: IS_PURE || FORCED_PROMISE_CONSTRUCTOR }, {
  15045. resolve: function resolve(x) {
  15046. return promiseResolve(CHECK_WRAPPER && this === PromiseConstructorWrapper ? NativePromiseConstructor : this, x);
  15047. }
  15048. });
  15049. },{"../internals/export":149,"../internals/get-built-in":158,"../internals/is-pure":181,"../internals/promise-constructor-detection":215,"../internals/promise-native-constructor":216,"../internals/promise-resolve":217}],299:[function(require,module,exports){
  15050. var DESCRIPTORS = require('../internals/descriptors');
  15051. var global = require('../internals/global');
  15052. var uncurryThis = require('../internals/function-uncurry-this');
  15053. var isForced = require('../internals/is-forced');
  15054. var inheritIfRequired = require('../internals/inherit-if-required');
  15055. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  15056. var getOwnPropertyNames = require('../internals/object-get-own-property-names').f;
  15057. var isPrototypeOf = require('../internals/object-is-prototype-of');
  15058. var isRegExp = require('../internals/is-regexp');
  15059. var toString = require('../internals/to-string');
  15060. var getRegExpFlags = require('../internals/regexp-get-flags');
  15061. var stickyHelpers = require('../internals/regexp-sticky-helpers');
  15062. var proxyAccessor = require('../internals/proxy-accessor');
  15063. var redefine = require('../internals/redefine');
  15064. var fails = require('../internals/fails');
  15065. var hasOwn = require('../internals/has-own-property');
  15066. var enforceInternalState = require('../internals/internal-state').enforce;
  15067. var setSpecies = require('../internals/set-species');
  15068. var wellKnownSymbol = require('../internals/well-known-symbol');
  15069. var UNSUPPORTED_DOT_ALL = require('../internals/regexp-unsupported-dot-all');
  15070. var UNSUPPORTED_NCG = require('../internals/regexp-unsupported-ncg');
  15071. var MATCH = wellKnownSymbol('match');
  15072. var NativeRegExp = global.RegExp;
  15073. var RegExpPrototype = NativeRegExp.prototype;
  15074. var SyntaxError = global.SyntaxError;
  15075. var exec = uncurryThis(RegExpPrototype.exec);
  15076. var charAt = uncurryThis(''.charAt);
  15077. var replace = uncurryThis(''.replace);
  15078. var stringIndexOf = uncurryThis(''.indexOf);
  15079. var stringSlice = uncurryThis(''.slice);
  15080. // TODO: Use only propper RegExpIdentifierName
  15081. var IS_NCG = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/;
  15082. var re1 = /a/g;
  15083. var re2 = /a/g;
  15084. // "new" should create a new object, old webkit bug
  15085. var CORRECT_NEW = new NativeRegExp(re1) !== re1;
  15086. var MISSED_STICKY = stickyHelpers.MISSED_STICKY;
  15087. var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y;
  15088. var BASE_FORCED = DESCRIPTORS &&
  15089. (!CORRECT_NEW || MISSED_STICKY || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG || fails(function () {
  15090. re2[MATCH] = false;
  15091. // RegExp constructor can alter flags and IsRegExp works correct with @@match
  15092. return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';
  15093. }));
  15094. var handleDotAll = function (string) {
  15095. var length = string.length;
  15096. var index = 0;
  15097. var result = '';
  15098. var brackets = false;
  15099. var chr;
  15100. for (; index <= length; index++) {
  15101. chr = charAt(string, index);
  15102. if (chr === '\\') {
  15103. result += chr + charAt(string, ++index);
  15104. continue;
  15105. }
  15106. if (!brackets && chr === '.') {
  15107. result += '[\\s\\S]';
  15108. } else {
  15109. if (chr === '[') {
  15110. brackets = true;
  15111. } else if (chr === ']') {
  15112. brackets = false;
  15113. } result += chr;
  15114. }
  15115. } return result;
  15116. };
  15117. var handleNCG = function (string) {
  15118. var length = string.length;
  15119. var index = 0;
  15120. var result = '';
  15121. var named = [];
  15122. var names = {};
  15123. var brackets = false;
  15124. var ncg = false;
  15125. var groupid = 0;
  15126. var groupname = '';
  15127. var chr;
  15128. for (; index <= length; index++) {
  15129. chr = charAt(string, index);
  15130. if (chr === '\\') {
  15131. chr = chr + charAt(string, ++index);
  15132. } else if (chr === ']') {
  15133. brackets = false;
  15134. } else if (!brackets) switch (true) {
  15135. case chr === '[':
  15136. brackets = true;
  15137. break;
  15138. case chr === '(':
  15139. if (exec(IS_NCG, stringSlice(string, index + 1))) {
  15140. index += 2;
  15141. ncg = true;
  15142. }
  15143. result += chr;
  15144. groupid++;
  15145. continue;
  15146. case chr === '>' && ncg:
  15147. if (groupname === '' || hasOwn(names, groupname)) {
  15148. throw new SyntaxError('Invalid capture group name');
  15149. }
  15150. names[groupname] = true;
  15151. named[named.length] = [groupname, groupid];
  15152. ncg = false;
  15153. groupname = '';
  15154. continue;
  15155. }
  15156. if (ncg) groupname += chr;
  15157. else result += chr;
  15158. } return [result, named];
  15159. };
  15160. // `RegExp` constructor
  15161. // https://tc39.es/ecma262/#sec-regexp-constructor
  15162. if (isForced('RegExp', BASE_FORCED)) {
  15163. var RegExpWrapper = function RegExp(pattern, flags) {
  15164. var thisIsRegExp = isPrototypeOf(RegExpPrototype, this);
  15165. var patternIsRegExp = isRegExp(pattern);
  15166. var flagsAreUndefined = flags === undefined;
  15167. var groups = [];
  15168. var rawPattern = pattern;
  15169. var rawFlags, dotAll, sticky, handled, result, state;
  15170. if (!thisIsRegExp && patternIsRegExp && flagsAreUndefined && pattern.constructor === RegExpWrapper) {
  15171. return pattern;
  15172. }
  15173. if (patternIsRegExp || isPrototypeOf(RegExpPrototype, pattern)) {
  15174. pattern = pattern.source;
  15175. if (flagsAreUndefined) flags = getRegExpFlags(rawPattern);
  15176. }
  15177. pattern = pattern === undefined ? '' : toString(pattern);
  15178. flags = flags === undefined ? '' : toString(flags);
  15179. rawPattern = pattern;
  15180. if (UNSUPPORTED_DOT_ALL && 'dotAll' in re1) {
  15181. dotAll = !!flags && stringIndexOf(flags, 's') > -1;
  15182. if (dotAll) flags = replace(flags, /s/g, '');
  15183. }
  15184. rawFlags = flags;
  15185. if (MISSED_STICKY && 'sticky' in re1) {
  15186. sticky = !!flags && stringIndexOf(flags, 'y') > -1;
  15187. if (sticky && UNSUPPORTED_Y) flags = replace(flags, /y/g, '');
  15188. }
  15189. if (UNSUPPORTED_NCG) {
  15190. handled = handleNCG(pattern);
  15191. pattern = handled[0];
  15192. groups = handled[1];
  15193. }
  15194. result = inheritIfRequired(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype, RegExpWrapper);
  15195. if (dotAll || sticky || groups.length) {
  15196. state = enforceInternalState(result);
  15197. if (dotAll) {
  15198. state.dotAll = true;
  15199. state.raw = RegExpWrapper(handleDotAll(pattern), rawFlags);
  15200. }
  15201. if (sticky) state.sticky = true;
  15202. if (groups.length) state.groups = groups;
  15203. }
  15204. if (pattern !== rawPattern) try {
  15205. // fails in old engines, but we have no alternatives for unsupported regex syntax
  15206. createNonEnumerableProperty(result, 'source', rawPattern === '' ? '(?:)' : rawPattern);
  15207. } catch (error) { /* empty */ }
  15208. return result;
  15209. };
  15210. for (var keys = getOwnPropertyNames(NativeRegExp), index = 0; keys.length > index;) {
  15211. proxyAccessor(RegExpWrapper, NativeRegExp, keys[index++]);
  15212. }
  15213. RegExpPrototype.constructor = RegExpWrapper;
  15214. RegExpWrapper.prototype = RegExpPrototype;
  15215. redefine(global, 'RegExp', RegExpWrapper);
  15216. }
  15217. // https://tc39.es/ecma262/#sec-get-regexp-@@species
  15218. setSpecies('RegExp');
  15219. },{"../internals/create-non-enumerable-property":129,"../internals/descriptors":134,"../internals/fails":150,"../internals/function-uncurry-this":157,"../internals/global":163,"../internals/has-own-property":164,"../internals/inherit-if-required":171,"../internals/internal-state":173,"../internals/is-forced":178,"../internals/is-regexp":182,"../internals/object-get-own-property-names":201,"../internals/object-is-prototype-of":204,"../internals/proxy-accessor":219,"../internals/redefine":222,"../internals/regexp-get-flags":226,"../internals/regexp-sticky-helpers":227,"../internals/regexp-unsupported-dot-all":228,"../internals/regexp-unsupported-ncg":229,"../internals/set-species":233,"../internals/to-string":256,"../internals/well-known-symbol":268}],300:[function(require,module,exports){
  15220. 'use strict';
  15221. var $ = require('../internals/export');
  15222. var exec = require('../internals/regexp-exec');
  15223. // `RegExp.prototype.exec` method
  15224. // https://tc39.es/ecma262/#sec-regexp.prototype.exec
  15225. $({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
  15226. exec: exec
  15227. });
  15228. },{"../internals/export":149,"../internals/regexp-exec":224}],301:[function(require,module,exports){
  15229. 'use strict';
  15230. var PROPER_FUNCTION_NAME = require('../internals/function-name').PROPER;
  15231. var redefine = require('../internals/redefine');
  15232. var anObject = require('../internals/an-object');
  15233. var $toString = require('../internals/to-string');
  15234. var fails = require('../internals/fails');
  15235. var getRegExpFlags = require('../internals/regexp-get-flags');
  15236. var TO_STRING = 'toString';
  15237. var RegExpPrototype = RegExp.prototype;
  15238. var n$ToString = RegExpPrototype[TO_STRING];
  15239. var NOT_GENERIC = fails(function () { return n$ToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
  15240. // FF44- RegExp#toString has a wrong name
  15241. var INCORRECT_NAME = PROPER_FUNCTION_NAME && n$ToString.name != TO_STRING;
  15242. // `RegExp.prototype.toString` method
  15243. // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
  15244. if (NOT_GENERIC || INCORRECT_NAME) {
  15245. redefine(RegExp.prototype, TO_STRING, function toString() {
  15246. var R = anObject(this);
  15247. var pattern = $toString(R.source);
  15248. var flags = $toString(getRegExpFlags(R));
  15249. return '/' + pattern + '/' + flags;
  15250. }, { unsafe: true });
  15251. }
  15252. },{"../internals/an-object":101,"../internals/fails":150,"../internals/function-name":156,"../internals/redefine":222,"../internals/regexp-get-flags":226,"../internals/to-string":256}],302:[function(require,module,exports){
  15253. 'use strict';
  15254. var $ = require('../internals/export');
  15255. var uncurryThis = require('../internals/function-uncurry-this');
  15256. var notARegExp = require('../internals/not-a-regexp');
  15257. var requireObjectCoercible = require('../internals/require-object-coercible');
  15258. var toString = require('../internals/to-string');
  15259. var correctIsRegExpLogic = require('../internals/correct-is-regexp-logic');
  15260. var stringIndexOf = uncurryThis(''.indexOf);
  15261. // `String.prototype.includes` method
  15262. // https://tc39.es/ecma262/#sec-string.prototype.includes
  15263. $({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
  15264. includes: function includes(searchString /* , position = 0 */) {
  15265. return !!~stringIndexOf(
  15266. toString(requireObjectCoercible(this)),
  15267. toString(notARegExp(searchString)),
  15268. arguments.length > 1 ? arguments[1] : undefined
  15269. );
  15270. }
  15271. });
  15272. },{"../internals/correct-is-regexp-logic":126,"../internals/export":149,"../internals/function-uncurry-this":157,"../internals/not-a-regexp":194,"../internals/require-object-coercible":230,"../internals/to-string":256}],303:[function(require,module,exports){
  15273. 'use strict';
  15274. var charAt = require('../internals/string-multibyte').charAt;
  15275. var toString = require('../internals/to-string');
  15276. var InternalStateModule = require('../internals/internal-state');
  15277. var defineIterator = require('../internals/define-iterator');
  15278. var STRING_ITERATOR = 'String Iterator';
  15279. var setInternalState = InternalStateModule.set;
  15280. var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
  15281. // `String.prototype[@@iterator]` method
  15282. // https://tc39.es/ecma262/#sec-string.prototype-@@iterator
  15283. defineIterator(String, 'String', function (iterated) {
  15284. setInternalState(this, {
  15285. type: STRING_ITERATOR,
  15286. string: toString(iterated),
  15287. index: 0
  15288. });
  15289. // `%StringIteratorPrototype%.next` method
  15290. // https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
  15291. }, function next() {
  15292. var state = getInternalState(this);
  15293. var string = state.string;
  15294. var index = state.index;
  15295. var point;
  15296. if (index >= string.length) return { value: undefined, done: true };
  15297. point = charAt(string, index);
  15298. state.index += point.length;
  15299. return { value: point, done: false };
  15300. });
  15301. },{"../internals/define-iterator":132,"../internals/internal-state":173,"../internals/string-multibyte":239,"../internals/to-string":256}],304:[function(require,module,exports){
  15302. 'use strict';
  15303. var call = require('../internals/function-call');
  15304. var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
  15305. var anObject = require('../internals/an-object');
  15306. var toLength = require('../internals/to-length');
  15307. var toString = require('../internals/to-string');
  15308. var requireObjectCoercible = require('../internals/require-object-coercible');
  15309. var getMethod = require('../internals/get-method');
  15310. var advanceStringIndex = require('../internals/advance-string-index');
  15311. var regExpExec = require('../internals/regexp-exec-abstract');
  15312. // @@match logic
  15313. fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {
  15314. return [
  15315. // `String.prototype.match` method
  15316. // https://tc39.es/ecma262/#sec-string.prototype.match
  15317. function match(regexp) {
  15318. var O = requireObjectCoercible(this);
  15319. var matcher = regexp == undefined ? undefined : getMethod(regexp, MATCH);
  15320. return matcher ? call(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString(O));
  15321. },
  15322. // `RegExp.prototype[@@match]` method
  15323. // https://tc39.es/ecma262/#sec-regexp.prototype-@@match
  15324. function (string) {
  15325. var rx = anObject(this);
  15326. var S = toString(string);
  15327. var res = maybeCallNative(nativeMatch, rx, S);
  15328. if (res.done) return res.value;
  15329. if (!rx.global) return regExpExec(rx, S);
  15330. var fullUnicode = rx.unicode;
  15331. rx.lastIndex = 0;
  15332. var A = [];
  15333. var n = 0;
  15334. var result;
  15335. while ((result = regExpExec(rx, S)) !== null) {
  15336. var matchStr = toString(result[0]);
  15337. A[n] = matchStr;
  15338. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  15339. n++;
  15340. }
  15341. return n === 0 ? null : A;
  15342. }
  15343. ];
  15344. });
  15345. },{"../internals/advance-string-index":99,"../internals/an-object":101,"../internals/fix-regexp-well-known-symbol-logic":151,"../internals/function-call":155,"../internals/get-method":161,"../internals/regexp-exec-abstract":223,"../internals/require-object-coercible":230,"../internals/to-length":249,"../internals/to-string":256}],305:[function(require,module,exports){
  15346. 'use strict';
  15347. var apply = require('../internals/function-apply');
  15348. var call = require('../internals/function-call');
  15349. var uncurryThis = require('../internals/function-uncurry-this');
  15350. var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
  15351. var fails = require('../internals/fails');
  15352. var anObject = require('../internals/an-object');
  15353. var isCallable = require('../internals/is-callable');
  15354. var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
  15355. var toLength = require('../internals/to-length');
  15356. var toString = require('../internals/to-string');
  15357. var requireObjectCoercible = require('../internals/require-object-coercible');
  15358. var advanceStringIndex = require('../internals/advance-string-index');
  15359. var getMethod = require('../internals/get-method');
  15360. var getSubstitution = require('../internals/get-substitution');
  15361. var regExpExec = require('../internals/regexp-exec-abstract');
  15362. var wellKnownSymbol = require('../internals/well-known-symbol');
  15363. var REPLACE = wellKnownSymbol('replace');
  15364. var max = Math.max;
  15365. var min = Math.min;
  15366. var concat = uncurryThis([].concat);
  15367. var push = uncurryThis([].push);
  15368. var stringIndexOf = uncurryThis(''.indexOf);
  15369. var stringSlice = uncurryThis(''.slice);
  15370. var maybeToString = function (it) {
  15371. return it === undefined ? it : String(it);
  15372. };
  15373. // IE <= 11 replaces $0 with the whole match, as if it was $&
  15374. // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
  15375. var REPLACE_KEEPS_$0 = (function () {
  15376. // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
  15377. return 'a'.replace(/./, '$0') === '$0';
  15378. })();
  15379. // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
  15380. var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
  15381. if (/./[REPLACE]) {
  15382. return /./[REPLACE]('a', '$0') === '';
  15383. }
  15384. return false;
  15385. })();
  15386. var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
  15387. var re = /./;
  15388. re.exec = function () {
  15389. var result = [];
  15390. result.groups = { a: '7' };
  15391. return result;
  15392. };
  15393. // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
  15394. return ''.replace(re, '$<a>') !== '7';
  15395. });
  15396. // @@replace logic
  15397. fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
  15398. var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
  15399. return [
  15400. // `String.prototype.replace` method
  15401. // https://tc39.es/ecma262/#sec-string.prototype.replace
  15402. function replace(searchValue, replaceValue) {
  15403. var O = requireObjectCoercible(this);
  15404. var replacer = searchValue == undefined ? undefined : getMethod(searchValue, REPLACE);
  15405. return replacer
  15406. ? call(replacer, searchValue, O, replaceValue)
  15407. : call(nativeReplace, toString(O), searchValue, replaceValue);
  15408. },
  15409. // `RegExp.prototype[@@replace]` method
  15410. // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
  15411. function (string, replaceValue) {
  15412. var rx = anObject(this);
  15413. var S = toString(string);
  15414. if (
  15415. typeof replaceValue == 'string' &&
  15416. stringIndexOf(replaceValue, UNSAFE_SUBSTITUTE) === -1 &&
  15417. stringIndexOf(replaceValue, '$<') === -1
  15418. ) {
  15419. var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
  15420. if (res.done) return res.value;
  15421. }
  15422. var functionalReplace = isCallable(replaceValue);
  15423. if (!functionalReplace) replaceValue = toString(replaceValue);
  15424. var global = rx.global;
  15425. if (global) {
  15426. var fullUnicode = rx.unicode;
  15427. rx.lastIndex = 0;
  15428. }
  15429. var results = [];
  15430. while (true) {
  15431. var result = regExpExec(rx, S);
  15432. if (result === null) break;
  15433. push(results, result);
  15434. if (!global) break;
  15435. var matchStr = toString(result[0]);
  15436. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  15437. }
  15438. var accumulatedResult = '';
  15439. var nextSourcePosition = 0;
  15440. for (var i = 0; i < results.length; i++) {
  15441. result = results[i];
  15442. var matched = toString(result[0]);
  15443. var position = max(min(toIntegerOrInfinity(result.index), S.length), 0);
  15444. var captures = [];
  15445. // NOTE: This is equivalent to
  15446. // captures = result.slice(1).map(maybeToString)
  15447. // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
  15448. // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
  15449. // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
  15450. for (var j = 1; j < result.length; j++) push(captures, maybeToString(result[j]));
  15451. var namedCaptures = result.groups;
  15452. if (functionalReplace) {
  15453. var replacerArgs = concat([matched], captures, position, S);
  15454. if (namedCaptures !== undefined) push(replacerArgs, namedCaptures);
  15455. var replacement = toString(apply(replaceValue, undefined, replacerArgs));
  15456. } else {
  15457. replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
  15458. }
  15459. if (position >= nextSourcePosition) {
  15460. accumulatedResult += stringSlice(S, nextSourcePosition, position) + replacement;
  15461. nextSourcePosition = position + matched.length;
  15462. }
  15463. }
  15464. return accumulatedResult + stringSlice(S, nextSourcePosition);
  15465. }
  15466. ];
  15467. }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
  15468. },{"../internals/advance-string-index":99,"../internals/an-object":101,"../internals/fails":150,"../internals/fix-regexp-well-known-symbol-logic":151,"../internals/function-apply":152,"../internals/function-call":155,"../internals/function-uncurry-this":157,"../internals/get-method":161,"../internals/get-substitution":162,"../internals/is-callable":176,"../internals/regexp-exec-abstract":223,"../internals/require-object-coercible":230,"../internals/to-integer-or-infinity":248,"../internals/to-length":249,"../internals/to-string":256,"../internals/well-known-symbol":268}],306:[function(require,module,exports){
  15469. 'use strict';
  15470. var call = require('../internals/function-call');
  15471. var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
  15472. var anObject = require('../internals/an-object');
  15473. var requireObjectCoercible = require('../internals/require-object-coercible');
  15474. var sameValue = require('../internals/same-value');
  15475. var toString = require('../internals/to-string');
  15476. var getMethod = require('../internals/get-method');
  15477. var regExpExec = require('../internals/regexp-exec-abstract');
  15478. // @@search logic
  15479. fixRegExpWellKnownSymbolLogic('search', function (SEARCH, nativeSearch, maybeCallNative) {
  15480. return [
  15481. // `String.prototype.search` method
  15482. // https://tc39.es/ecma262/#sec-string.prototype.search
  15483. function search(regexp) {
  15484. var O = requireObjectCoercible(this);
  15485. var searcher = regexp == undefined ? undefined : getMethod(regexp, SEARCH);
  15486. return searcher ? call(searcher, regexp, O) : new RegExp(regexp)[SEARCH](toString(O));
  15487. },
  15488. // `RegExp.prototype[@@search]` method
  15489. // https://tc39.es/ecma262/#sec-regexp.prototype-@@search
  15490. function (string) {
  15491. var rx = anObject(this);
  15492. var S = toString(string);
  15493. var res = maybeCallNative(nativeSearch, rx, S);
  15494. if (res.done) return res.value;
  15495. var previousLastIndex = rx.lastIndex;
  15496. if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
  15497. var result = regExpExec(rx, S);
  15498. if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
  15499. return result === null ? -1 : result.index;
  15500. }
  15501. ];
  15502. });
  15503. },{"../internals/an-object":101,"../internals/fix-regexp-well-known-symbol-logic":151,"../internals/function-call":155,"../internals/get-method":161,"../internals/regexp-exec-abstract":223,"../internals/require-object-coercible":230,"../internals/same-value":231,"../internals/to-string":256}],307:[function(require,module,exports){
  15504. 'use strict';
  15505. var apply = require('../internals/function-apply');
  15506. var call = require('../internals/function-call');
  15507. var uncurryThis = require('../internals/function-uncurry-this');
  15508. var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
  15509. var isRegExp = require('../internals/is-regexp');
  15510. var anObject = require('../internals/an-object');
  15511. var requireObjectCoercible = require('../internals/require-object-coercible');
  15512. var speciesConstructor = require('../internals/species-constructor');
  15513. var advanceStringIndex = require('../internals/advance-string-index');
  15514. var toLength = require('../internals/to-length');
  15515. var toString = require('../internals/to-string');
  15516. var getMethod = require('../internals/get-method');
  15517. var arraySlice = require('../internals/array-slice-simple');
  15518. var callRegExpExec = require('../internals/regexp-exec-abstract');
  15519. var regexpExec = require('../internals/regexp-exec');
  15520. var stickyHelpers = require('../internals/regexp-sticky-helpers');
  15521. var fails = require('../internals/fails');
  15522. var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y;
  15523. var MAX_UINT32 = 0xFFFFFFFF;
  15524. var min = Math.min;
  15525. var $push = [].push;
  15526. var exec = uncurryThis(/./.exec);
  15527. var push = uncurryThis($push);
  15528. var stringSlice = uncurryThis(''.slice);
  15529. // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
  15530. // Weex JS has frozen built-in prototypes, so use try / catch wrapper
  15531. var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
  15532. // eslint-disable-next-line regexp/no-empty-group -- required for testing
  15533. var re = /(?:)/;
  15534. var originalExec = re.exec;
  15535. re.exec = function () { return originalExec.apply(this, arguments); };
  15536. var result = 'ab'.split(re);
  15537. return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
  15538. });
  15539. // @@split logic
  15540. fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNative) {
  15541. var internalSplit;
  15542. if (
  15543. 'abbc'.split(/(b)*/)[1] == 'c' ||
  15544. // eslint-disable-next-line regexp/no-empty-group -- required for testing
  15545. 'test'.split(/(?:)/, -1).length != 4 ||
  15546. 'ab'.split(/(?:ab)*/).length != 2 ||
  15547. '.'.split(/(.?)(.?)/).length != 4 ||
  15548. // eslint-disable-next-line regexp/no-empty-capturing-group, regexp/no-empty-group -- required for testing
  15549. '.'.split(/()()/).length > 1 ||
  15550. ''.split(/.?/).length
  15551. ) {
  15552. // based on es5-shim implementation, need to rework it
  15553. internalSplit = function (separator, limit) {
  15554. var string = toString(requireObjectCoercible(this));
  15555. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  15556. if (lim === 0) return [];
  15557. if (separator === undefined) return [string];
  15558. // If `separator` is not a regex, use native split
  15559. if (!isRegExp(separator)) {
  15560. return call(nativeSplit, string, separator, lim);
  15561. }
  15562. var output = [];
  15563. var flags = (separator.ignoreCase ? 'i' : '') +
  15564. (separator.multiline ? 'm' : '') +
  15565. (separator.unicode ? 'u' : '') +
  15566. (separator.sticky ? 'y' : '');
  15567. var lastLastIndex = 0;
  15568. // Make `global` and avoid `lastIndex` issues by working with a copy
  15569. var separatorCopy = new RegExp(separator.source, flags + 'g');
  15570. var match, lastIndex, lastLength;
  15571. while (match = call(regexpExec, separatorCopy, string)) {
  15572. lastIndex = separatorCopy.lastIndex;
  15573. if (lastIndex > lastLastIndex) {
  15574. push(output, stringSlice(string, lastLastIndex, match.index));
  15575. if (match.length > 1 && match.index < string.length) apply($push, output, arraySlice(match, 1));
  15576. lastLength = match[0].length;
  15577. lastLastIndex = lastIndex;
  15578. if (output.length >= lim) break;
  15579. }
  15580. if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
  15581. }
  15582. if (lastLastIndex === string.length) {
  15583. if (lastLength || !exec(separatorCopy, '')) push(output, '');
  15584. } else push(output, stringSlice(string, lastLastIndex));
  15585. return output.length > lim ? arraySlice(output, 0, lim) : output;
  15586. };
  15587. // Chakra, V8
  15588. } else if ('0'.split(undefined, 0).length) {
  15589. internalSplit = function (separator, limit) {
  15590. return separator === undefined && limit === 0 ? [] : call(nativeSplit, this, separator, limit);
  15591. };
  15592. } else internalSplit = nativeSplit;
  15593. return [
  15594. // `String.prototype.split` method
  15595. // https://tc39.es/ecma262/#sec-string.prototype.split
  15596. function split(separator, limit) {
  15597. var O = requireObjectCoercible(this);
  15598. var splitter = separator == undefined ? undefined : getMethod(separator, SPLIT);
  15599. return splitter
  15600. ? call(splitter, separator, O, limit)
  15601. : call(internalSplit, toString(O), separator, limit);
  15602. },
  15603. // `RegExp.prototype[@@split]` method
  15604. // https://tc39.es/ecma262/#sec-regexp.prototype-@@split
  15605. //
  15606. // NOTE: This cannot be properly polyfilled in engines that don't support
  15607. // the 'y' flag.
  15608. function (string, limit) {
  15609. var rx = anObject(this);
  15610. var S = toString(string);
  15611. var res = maybeCallNative(internalSplit, rx, S, limit, internalSplit !== nativeSplit);
  15612. if (res.done) return res.value;
  15613. var C = speciesConstructor(rx, RegExp);
  15614. var unicodeMatching = rx.unicode;
  15615. var flags = (rx.ignoreCase ? 'i' : '') +
  15616. (rx.multiline ? 'm' : '') +
  15617. (rx.unicode ? 'u' : '') +
  15618. (UNSUPPORTED_Y ? 'g' : 'y');
  15619. // ^(? + rx + ) is needed, in combination with some S slicing, to
  15620. // simulate the 'y' flag.
  15621. var splitter = new C(UNSUPPORTED_Y ? '^(?:' + rx.source + ')' : rx, flags);
  15622. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  15623. if (lim === 0) return [];
  15624. if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : [];
  15625. var p = 0;
  15626. var q = 0;
  15627. var A = [];
  15628. while (q < S.length) {
  15629. splitter.lastIndex = UNSUPPORTED_Y ? 0 : q;
  15630. var z = callRegExpExec(splitter, UNSUPPORTED_Y ? stringSlice(S, q) : S);
  15631. var e;
  15632. if (
  15633. z === null ||
  15634. (e = min(toLength(splitter.lastIndex + (UNSUPPORTED_Y ? q : 0)), S.length)) === p
  15635. ) {
  15636. q = advanceStringIndex(S, q, unicodeMatching);
  15637. } else {
  15638. push(A, stringSlice(S, p, q));
  15639. if (A.length === lim) return A;
  15640. for (var i = 1; i <= z.length - 1; i++) {
  15641. push(A, z[i]);
  15642. if (A.length === lim) return A;
  15643. }
  15644. q = p = e;
  15645. }
  15646. }
  15647. push(A, stringSlice(S, p));
  15648. return A;
  15649. }
  15650. ];
  15651. }, !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y);
  15652. },{"../internals/advance-string-index":99,"../internals/an-object":101,"../internals/array-slice-simple":116,"../internals/fails":150,"../internals/fix-regexp-well-known-symbol-logic":151,"../internals/function-apply":152,"../internals/function-call":155,"../internals/function-uncurry-this":157,"../internals/get-method":161,"../internals/is-regexp":182,"../internals/regexp-exec":224,"../internals/regexp-exec-abstract":223,"../internals/regexp-sticky-helpers":227,"../internals/require-object-coercible":230,"../internals/species-constructor":238,"../internals/to-length":249,"../internals/to-string":256}],308:[function(require,module,exports){
  15653. 'use strict';
  15654. var $ = require('../internals/export');
  15655. var $trim = require('../internals/string-trim').trim;
  15656. var forcedStringTrimMethod = require('../internals/string-trim-forced');
  15657. // `String.prototype.trim` method
  15658. // https://tc39.es/ecma262/#sec-string.prototype.trim
  15659. $({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
  15660. trim: function trim() {
  15661. return $trim(this);
  15662. }
  15663. });
  15664. },{"../internals/export":149,"../internals/string-trim":241,"../internals/string-trim-forced":240}],309:[function(require,module,exports){
  15665. 'use strict';
  15666. var $ = require('../internals/export');
  15667. var global = require('../internals/global');
  15668. var call = require('../internals/function-call');
  15669. var uncurryThis = require('../internals/function-uncurry-this');
  15670. var IS_PURE = require('../internals/is-pure');
  15671. var DESCRIPTORS = require('../internals/descriptors');
  15672. var NATIVE_SYMBOL = require('../internals/native-symbol');
  15673. var fails = require('../internals/fails');
  15674. var hasOwn = require('../internals/has-own-property');
  15675. var isPrototypeOf = require('../internals/object-is-prototype-of');
  15676. var anObject = require('../internals/an-object');
  15677. var toIndexedObject = require('../internals/to-indexed-object');
  15678. var toPropertyKey = require('../internals/to-property-key');
  15679. var $toString = require('../internals/to-string');
  15680. var createPropertyDescriptor = require('../internals/create-property-descriptor');
  15681. var nativeObjectCreate = require('../internals/object-create');
  15682. var objectKeys = require('../internals/object-keys');
  15683. var getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');
  15684. var getOwnPropertyNamesExternal = require('../internals/object-get-own-property-names-external');
  15685. var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');
  15686. var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');
  15687. var definePropertyModule = require('../internals/object-define-property');
  15688. var definePropertiesModule = require('../internals/object-define-properties');
  15689. var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
  15690. var redefine = require('../internals/redefine');
  15691. var shared = require('../internals/shared');
  15692. var sharedKey = require('../internals/shared-key');
  15693. var hiddenKeys = require('../internals/hidden-keys');
  15694. var uid = require('../internals/uid');
  15695. var wellKnownSymbol = require('../internals/well-known-symbol');
  15696. var wrappedWellKnownSymbolModule = require('../internals/well-known-symbol-wrapped');
  15697. var defineWellKnownSymbol = require('../internals/define-well-known-symbol');
  15698. var defineSymbolToPrimitive = require('../internals/symbol-define-to-primitive');
  15699. var setToStringTag = require('../internals/set-to-string-tag');
  15700. var InternalStateModule = require('../internals/internal-state');
  15701. var $forEach = require('../internals/array-iteration').forEach;
  15702. var HIDDEN = sharedKey('hidden');
  15703. var SYMBOL = 'Symbol';
  15704. var PROTOTYPE = 'prototype';
  15705. var setInternalState = InternalStateModule.set;
  15706. var getInternalState = InternalStateModule.getterFor(SYMBOL);
  15707. var ObjectPrototype = Object[PROTOTYPE];
  15708. var $Symbol = global.Symbol;
  15709. var SymbolPrototype = $Symbol && $Symbol[PROTOTYPE];
  15710. var TypeError = global.TypeError;
  15711. var QObject = global.QObject;
  15712. var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  15713. var nativeDefineProperty = definePropertyModule.f;
  15714. var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
  15715. var nativePropertyIsEnumerable = propertyIsEnumerableModule.f;
  15716. var push = uncurryThis([].push);
  15717. var AllSymbols = shared('symbols');
  15718. var ObjectPrototypeSymbols = shared('op-symbols');
  15719. var WellKnownSymbolsStore = shared('wks');
  15720. // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
  15721. var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
  15722. // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
  15723. var setSymbolDescriptor = DESCRIPTORS && fails(function () {
  15724. return nativeObjectCreate(nativeDefineProperty({}, 'a', {
  15725. get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; }
  15726. })).a != 7;
  15727. }) ? function (O, P, Attributes) {
  15728. var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);
  15729. if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
  15730. nativeDefineProperty(O, P, Attributes);
  15731. if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
  15732. nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);
  15733. }
  15734. } : nativeDefineProperty;
  15735. var wrap = function (tag, description) {
  15736. var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype);
  15737. setInternalState(symbol, {
  15738. type: SYMBOL,
  15739. tag: tag,
  15740. description: description
  15741. });
  15742. if (!DESCRIPTORS) symbol.description = description;
  15743. return symbol;
  15744. };
  15745. var $defineProperty = function defineProperty(O, P, Attributes) {
  15746. if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
  15747. anObject(O);
  15748. var key = toPropertyKey(P);
  15749. anObject(Attributes);
  15750. if (hasOwn(AllSymbols, key)) {
  15751. if (!Attributes.enumerable) {
  15752. if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));
  15753. O[HIDDEN][key] = true;
  15754. } else {
  15755. if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
  15756. Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
  15757. } return setSymbolDescriptor(O, key, Attributes);
  15758. } return nativeDefineProperty(O, key, Attributes);
  15759. };
  15760. var $defineProperties = function defineProperties(O, Properties) {
  15761. anObject(O);
  15762. var properties = toIndexedObject(Properties);
  15763. var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
  15764. $forEach(keys, function (key) {
  15765. if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]);
  15766. });
  15767. return O;
  15768. };
  15769. var $create = function create(O, Properties) {
  15770. return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);
  15771. };
  15772. var $propertyIsEnumerable = function propertyIsEnumerable(V) {
  15773. var P = toPropertyKey(V);
  15774. var enumerable = call(nativePropertyIsEnumerable, this, P);
  15775. if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false;
  15776. return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P]
  15777. ? enumerable : true;
  15778. };
  15779. var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
  15780. var it = toIndexedObject(O);
  15781. var key = toPropertyKey(P);
  15782. if (it === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return;
  15783. var descriptor = nativeGetOwnPropertyDescriptor(it, key);
  15784. if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it, HIDDEN) && it[HIDDEN][key])) {
  15785. descriptor.enumerable = true;
  15786. }
  15787. return descriptor;
  15788. };
  15789. var $getOwnPropertyNames = function getOwnPropertyNames(O) {
  15790. var names = nativeGetOwnPropertyNames(toIndexedObject(O));
  15791. var result = [];
  15792. $forEach(names, function (key) {
  15793. if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) push(result, key);
  15794. });
  15795. return result;
  15796. };
  15797. var $getOwnPropertySymbols = function (O) {
  15798. var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
  15799. var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
  15800. var result = [];
  15801. $forEach(names, function (key) {
  15802. if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) {
  15803. push(result, AllSymbols[key]);
  15804. }
  15805. });
  15806. return result;
  15807. };
  15808. // `Symbol` constructor
  15809. // https://tc39.es/ecma262/#sec-symbol-constructor
  15810. if (!NATIVE_SYMBOL) {
  15811. $Symbol = function Symbol() {
  15812. if (isPrototypeOf(SymbolPrototype, this)) throw TypeError('Symbol is not a constructor');
  15813. var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]);
  15814. var tag = uid(description);
  15815. var setter = function (value) {
  15816. if (this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value);
  15817. if (hasOwn(this, HIDDEN) && hasOwn(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
  15818. setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
  15819. };
  15820. if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
  15821. return wrap(tag, description);
  15822. };
  15823. SymbolPrototype = $Symbol[PROTOTYPE];
  15824. redefine(SymbolPrototype, 'toString', function toString() {
  15825. return getInternalState(this).tag;
  15826. });
  15827. redefine($Symbol, 'withoutSetter', function (description) {
  15828. return wrap(uid(description), description);
  15829. });
  15830. propertyIsEnumerableModule.f = $propertyIsEnumerable;
  15831. definePropertyModule.f = $defineProperty;
  15832. definePropertiesModule.f = $defineProperties;
  15833. getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;
  15834. getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;
  15835. getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;
  15836. wrappedWellKnownSymbolModule.f = function (name) {
  15837. return wrap(wellKnownSymbol(name), name);
  15838. };
  15839. if (DESCRIPTORS) {
  15840. // https://github.com/tc39/proposal-Symbol-description
  15841. nativeDefineProperty(SymbolPrototype, 'description', {
  15842. configurable: true,
  15843. get: function description() {
  15844. return getInternalState(this).description;
  15845. }
  15846. });
  15847. if (!IS_PURE) {
  15848. redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
  15849. }
  15850. }
  15851. }
  15852. $({ global: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, {
  15853. Symbol: $Symbol
  15854. });
  15855. $forEach(objectKeys(WellKnownSymbolsStore), function (name) {
  15856. defineWellKnownSymbol(name);
  15857. });
  15858. $({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, {
  15859. useSetter: function () { USE_SETTER = true; },
  15860. useSimple: function () { USE_SETTER = false; }
  15861. });
  15862. $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, {
  15863. // `Object.create` method
  15864. // https://tc39.es/ecma262/#sec-object.create
  15865. create: $create,
  15866. // `Object.defineProperty` method
  15867. // https://tc39.es/ecma262/#sec-object.defineproperty
  15868. defineProperty: $defineProperty,
  15869. // `Object.defineProperties` method
  15870. // https://tc39.es/ecma262/#sec-object.defineproperties
  15871. defineProperties: $defineProperties,
  15872. // `Object.getOwnPropertyDescriptor` method
  15873. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
  15874. getOwnPropertyDescriptor: $getOwnPropertyDescriptor
  15875. });
  15876. $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, {
  15877. // `Object.getOwnPropertyNames` method
  15878. // https://tc39.es/ecma262/#sec-object.getownpropertynames
  15879. getOwnPropertyNames: $getOwnPropertyNames
  15880. });
  15881. // `Symbol.prototype[@@toPrimitive]` method
  15882. // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
  15883. defineSymbolToPrimitive();
  15884. // `Symbol.prototype[@@toStringTag]` property
  15885. // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
  15886. setToStringTag($Symbol, SYMBOL);
  15887. hiddenKeys[HIDDEN] = true;
  15888. },{"../internals/an-object":101,"../internals/array-iteration":111,"../internals/create-property-descriptor":130,"../internals/define-well-known-symbol":133,"../internals/descriptors":134,"../internals/export":149,"../internals/fails":150,"../internals/function-call":155,"../internals/function-uncurry-this":157,"../internals/global":163,"../internals/has-own-property":164,"../internals/hidden-keys":165,"../internals/internal-state":173,"../internals/is-pure":181,"../internals/native-symbol":191,"../internals/object-create":196,"../internals/object-define-properties":197,"../internals/object-define-property":198,"../internals/object-get-own-property-descriptor":199,"../internals/object-get-own-property-names":201,"../internals/object-get-own-property-names-external":200,"../internals/object-get-own-property-symbols":202,"../internals/object-is-prototype-of":204,"../internals/object-keys":206,"../internals/object-property-is-enumerable":207,"../internals/redefine":222,"../internals/set-to-string-tag":234,"../internals/shared":237,"../internals/shared-key":235,"../internals/symbol-define-to-primitive":242,"../internals/to-indexed-object":247,"../internals/to-property-key":254,"../internals/to-string":256,"../internals/uid":263,"../internals/well-known-symbol":268,"../internals/well-known-symbol-wrapped":267}],310:[function(require,module,exports){
  15889. // `Symbol.prototype.description` getter
  15890. // https://tc39.es/ecma262/#sec-symbol.prototype.description
  15891. 'use strict';
  15892. var $ = require('../internals/export');
  15893. var DESCRIPTORS = require('../internals/descriptors');
  15894. var global = require('../internals/global');
  15895. var uncurryThis = require('../internals/function-uncurry-this');
  15896. var hasOwn = require('../internals/has-own-property');
  15897. var isCallable = require('../internals/is-callable');
  15898. var isPrototypeOf = require('../internals/object-is-prototype-of');
  15899. var toString = require('../internals/to-string');
  15900. var defineProperty = require('../internals/object-define-property').f;
  15901. var copyConstructorProperties = require('../internals/copy-constructor-properties');
  15902. var NativeSymbol = global.Symbol;
  15903. var SymbolPrototype = NativeSymbol && NativeSymbol.prototype;
  15904. if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in SymbolPrototype) ||
  15905. // Safari 12 bug
  15906. NativeSymbol().description !== undefined
  15907. )) {
  15908. var EmptyStringDescriptionStore = {};
  15909. // wrap Symbol constructor for correct work with undefined description
  15910. var SymbolWrapper = function Symbol() {
  15911. var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString(arguments[0]);
  15912. var result = isPrototypeOf(SymbolPrototype, this)
  15913. ? new NativeSymbol(description)
  15914. // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
  15915. : description === undefined ? NativeSymbol() : NativeSymbol(description);
  15916. if (description === '') EmptyStringDescriptionStore[result] = true;
  15917. return result;
  15918. };
  15919. copyConstructorProperties(SymbolWrapper, NativeSymbol);
  15920. SymbolWrapper.prototype = SymbolPrototype;
  15921. SymbolPrototype.constructor = SymbolWrapper;
  15922. var NATIVE_SYMBOL = String(NativeSymbol('test')) == 'Symbol(test)';
  15923. var symbolToString = uncurryThis(SymbolPrototype.toString);
  15924. var symbolValueOf = uncurryThis(SymbolPrototype.valueOf);
  15925. var regexp = /^Symbol\((.*)\)[^)]+$/;
  15926. var replace = uncurryThis(''.replace);
  15927. var stringSlice = uncurryThis(''.slice);
  15928. defineProperty(SymbolPrototype, 'description', {
  15929. configurable: true,
  15930. get: function description() {
  15931. var symbol = symbolValueOf(this);
  15932. var string = symbolToString(symbol);
  15933. if (hasOwn(EmptyStringDescriptionStore, symbol)) return '';
  15934. var desc = NATIVE_SYMBOL ? stringSlice(string, 7, -1) : replace(string, regexp, '$1');
  15935. return desc === '' ? undefined : desc;
  15936. }
  15937. });
  15938. $({ global: true, forced: true }, {
  15939. Symbol: SymbolWrapper
  15940. });
  15941. }
  15942. },{"../internals/copy-constructor-properties":125,"../internals/descriptors":134,"../internals/export":149,"../internals/function-uncurry-this":157,"../internals/global":163,"../internals/has-own-property":164,"../internals/is-callable":176,"../internals/object-define-property":198,"../internals/object-is-prototype-of":204,"../internals/to-string":256}],311:[function(require,module,exports){
  15943. var $ = require('../internals/export');
  15944. var getBuiltIn = require('../internals/get-built-in');
  15945. var hasOwn = require('../internals/has-own-property');
  15946. var toString = require('../internals/to-string');
  15947. var shared = require('../internals/shared');
  15948. var NATIVE_SYMBOL_REGISTRY = require('../internals/native-symbol-registry');
  15949. var StringToSymbolRegistry = shared('string-to-symbol-registry');
  15950. var SymbolToStringRegistry = shared('symbol-to-string-registry');
  15951. // `Symbol.for` method
  15952. // https://tc39.es/ecma262/#sec-symbol.for
  15953. $({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
  15954. 'for': function (key) {
  15955. var string = toString(key);
  15956. if (hasOwn(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
  15957. var symbol = getBuiltIn('Symbol')(string);
  15958. StringToSymbolRegistry[string] = symbol;
  15959. SymbolToStringRegistry[symbol] = string;
  15960. return symbol;
  15961. }
  15962. });
  15963. },{"../internals/export":149,"../internals/get-built-in":158,"../internals/has-own-property":164,"../internals/native-symbol-registry":190,"../internals/shared":237,"../internals/to-string":256}],312:[function(require,module,exports){
  15964. var defineWellKnownSymbol = require('../internals/define-well-known-symbol');
  15965. // `Symbol.iterator` well-known symbol
  15966. // https://tc39.es/ecma262/#sec-symbol.iterator
  15967. defineWellKnownSymbol('iterator');
  15968. },{"../internals/define-well-known-symbol":133}],313:[function(require,module,exports){
  15969. // TODO: Remove this module from `core-js@4` since it's split to modules listed below
  15970. require('../modules/es.symbol.constructor');
  15971. require('../modules/es.symbol.for');
  15972. require('../modules/es.symbol.key-for');
  15973. require('../modules/es.json.stringify');
  15974. require('../modules/es.object.get-own-property-symbols');
  15975. },{"../modules/es.json.stringify":285,"../modules/es.object.get-own-property-symbols":289,"../modules/es.symbol.constructor":309,"../modules/es.symbol.for":311,"../modules/es.symbol.key-for":314}],314:[function(require,module,exports){
  15976. var $ = require('../internals/export');
  15977. var hasOwn = require('../internals/has-own-property');
  15978. var isSymbol = require('../internals/is-symbol');
  15979. var tryToString = require('../internals/try-to-string');
  15980. var shared = require('../internals/shared');
  15981. var NATIVE_SYMBOL_REGISTRY = require('../internals/native-symbol-registry');
  15982. var SymbolToStringRegistry = shared('symbol-to-string-registry');
  15983. // `Symbol.keyFor` method
  15984. // https://tc39.es/ecma262/#sec-symbol.keyfor
  15985. $({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
  15986. keyFor: function keyFor(sym) {
  15987. if (!isSymbol(sym)) throw TypeError(tryToString(sym) + ' is not a symbol');
  15988. if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
  15989. }
  15990. });
  15991. },{"../internals/export":149,"../internals/has-own-property":164,"../internals/is-symbol":183,"../internals/native-symbol-registry":190,"../internals/shared":237,"../internals/try-to-string":257}],315:[function(require,module,exports){
  15992. 'use strict';
  15993. var uncurryThis = require('../internals/function-uncurry-this');
  15994. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15995. var $ArrayCopyWithin = require('../internals/array-copy-within');
  15996. var u$ArrayCopyWithin = uncurryThis($ArrayCopyWithin);
  15997. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15998. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15999. // `%TypedArray%.prototype.copyWithin` method
  16000. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.copywithin
  16001. exportTypedArrayMethod('copyWithin', function copyWithin(target, start /* , end */) {
  16002. return u$ArrayCopyWithin(aTypedArray(this), target, start, arguments.length > 2 ? arguments[2] : undefined);
  16003. });
  16004. },{"../internals/array-buffer-view-core":103,"../internals/array-copy-within":105,"../internals/function-uncurry-this":157}],316:[function(require,module,exports){
  16005. 'use strict';
  16006. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  16007. var $every = require('../internals/array-iteration').every;
  16008. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  16009. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  16010. // `%TypedArray%.prototype.every` method
  16011. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.every
  16012. exportTypedArrayMethod('every', function every(callbackfn /* , thisArg */) {
  16013. return $every(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  16014. });
  16015. },{"../internals/array-buffer-view-core":103,"../internals/array-iteration":111}],317:[function(require,module,exports){
  16016. 'use strict';
  16017. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  16018. var call = require('../internals/function-call');
  16019. var $fill = require('../internals/array-fill');
  16020. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  16021. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  16022. // `%TypedArray%.prototype.fill` method
  16023. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.fill
  16024. exportTypedArrayMethod('fill', function fill(value /* , start, end */) {
  16025. var length = arguments.length;
  16026. return call(
  16027. $fill,
  16028. aTypedArray(this),
  16029. value,
  16030. length > 1 ? arguments[1] : undefined,
  16031. length > 2 ? arguments[2] : undefined
  16032. );
  16033. });
  16034. },{"../internals/array-buffer-view-core":103,"../internals/array-fill":106,"../internals/function-call":155}],318:[function(require,module,exports){
  16035. 'use strict';
  16036. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  16037. var $filter = require('../internals/array-iteration').filter;
  16038. var fromSpeciesAndList = require('../internals/typed-array-from-species-and-list');
  16039. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  16040. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  16041. // `%TypedArray%.prototype.filter` method
  16042. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.filter
  16043. exportTypedArrayMethod('filter', function filter(callbackfn /* , thisArg */) {
  16044. var list = $filter(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  16045. return fromSpeciesAndList(this, list);
  16046. });
  16047. },{"../internals/array-buffer-view-core":103,"../internals/array-iteration":111,"../internals/typed-array-from-species-and-list":260}],319:[function(require,module,exports){
  16048. 'use strict';
  16049. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  16050. var $findIndex = require('../internals/array-iteration').findIndex;
  16051. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  16052. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  16053. // `%TypedArray%.prototype.findIndex` method
  16054. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.findindex
  16055. exportTypedArrayMethod('findIndex', function findIndex(predicate /* , thisArg */) {
  16056. return $findIndex(aTypedArray(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
  16057. });
  16058. },{"../internals/array-buffer-view-core":103,"../internals/array-iteration":111}],320:[function(require,module,exports){
  16059. 'use strict';
  16060. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  16061. var $find = require('../internals/array-iteration').find;
  16062. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  16063. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  16064. // `%TypedArray%.prototype.find` method
  16065. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.find
  16066. exportTypedArrayMethod('find', function find(predicate /* , thisArg */) {
  16067. return $find(aTypedArray(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
  16068. });
  16069. },{"../internals/array-buffer-view-core":103,"../internals/array-iteration":111}],321:[function(require,module,exports){
  16070. 'use strict';
  16071. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  16072. var $forEach = require('../internals/array-iteration').forEach;
  16073. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  16074. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  16075. // `%TypedArray%.prototype.forEach` method
  16076. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.foreach
  16077. exportTypedArrayMethod('forEach', function forEach(callbackfn /* , thisArg */) {
  16078. $forEach(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  16079. });
  16080. },{"../internals/array-buffer-view-core":103,"../internals/array-iteration":111}],322:[function(require,module,exports){
  16081. 'use strict';
  16082. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  16083. var $includes = require('../internals/array-includes').includes;
  16084. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  16085. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  16086. // `%TypedArray%.prototype.includes` method
  16087. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.includes
  16088. exportTypedArrayMethod('includes', function includes(searchElement /* , fromIndex */) {
  16089. return $includes(aTypedArray(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
  16090. });
  16091. },{"../internals/array-buffer-view-core":103,"../internals/array-includes":110}],323:[function(require,module,exports){
  16092. 'use strict';
  16093. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  16094. var $indexOf = require('../internals/array-includes').indexOf;
  16095. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  16096. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  16097. // `%TypedArray%.prototype.indexOf` method
  16098. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.indexof
  16099. exportTypedArrayMethod('indexOf', function indexOf(searchElement /* , fromIndex */) {
  16100. return $indexOf(aTypedArray(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
  16101. });
  16102. },{"../internals/array-buffer-view-core":103,"../internals/array-includes":110}],324:[function(require,module,exports){
  16103. 'use strict';
  16104. var global = require('../internals/global');
  16105. var fails = require('../internals/fails');
  16106. var uncurryThis = require('../internals/function-uncurry-this');
  16107. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  16108. var ArrayIterators = require('../modules/es.array.iterator');
  16109. var wellKnownSymbol = require('../internals/well-known-symbol');
  16110. var ITERATOR = wellKnownSymbol('iterator');
  16111. var Uint8Array = global.Uint8Array;
  16112. var arrayValues = uncurryThis(ArrayIterators.values);
  16113. var arrayKeys = uncurryThis(ArrayIterators.keys);
  16114. var arrayEntries = uncurryThis(ArrayIterators.entries);
  16115. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  16116. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  16117. var TypedArrayPrototype = Uint8Array && Uint8Array.prototype;
  16118. var GENERIC = !fails(function () {
  16119. TypedArrayPrototype[ITERATOR].call([1]);
  16120. });
  16121. var ITERATOR_IS_VALUES = !!TypedArrayPrototype
  16122. && TypedArrayPrototype.values
  16123. && TypedArrayPrototype[ITERATOR] === TypedArrayPrototype.values
  16124. && TypedArrayPrototype.values.name === 'values';
  16125. var typedArrayValues = function values() {
  16126. return arrayValues(aTypedArray(this));
  16127. };
  16128. // `%TypedArray%.prototype.entries` method
  16129. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.entries
  16130. exportTypedArrayMethod('entries', function entries() {
  16131. return arrayEntries(aTypedArray(this));
  16132. }, GENERIC);
  16133. // `%TypedArray%.prototype.keys` method
  16134. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.keys
  16135. exportTypedArrayMethod('keys', function keys() {
  16136. return arrayKeys(aTypedArray(this));
  16137. }, GENERIC);
  16138. // `%TypedArray%.prototype.values` method
  16139. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.values
  16140. exportTypedArrayMethod('values', typedArrayValues, GENERIC || !ITERATOR_IS_VALUES, { name: 'values' });
  16141. // `%TypedArray%.prototype[@@iterator]` method
  16142. // https://tc39.es/ecma262/#sec-%typedarray%.prototype-@@iterator
  16143. exportTypedArrayMethod(ITERATOR, typedArrayValues, GENERIC || !ITERATOR_IS_VALUES, { name: 'values' });
  16144. },{"../internals/array-buffer-view-core":103,"../internals/fails":150,"../internals/function-uncurry-this":157,"../internals/global":163,"../internals/well-known-symbol":268,"../modules/es.array.iterator":278}],325:[function(require,module,exports){
  16145. 'use strict';
  16146. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  16147. var uncurryThis = require('../internals/function-uncurry-this');
  16148. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  16149. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  16150. var $join = uncurryThis([].join);
  16151. // `%TypedArray%.prototype.join` method
  16152. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.join
  16153. exportTypedArrayMethod('join', function join(separator) {
  16154. return $join(aTypedArray(this), separator);
  16155. });
  16156. },{"../internals/array-buffer-view-core":103,"../internals/function-uncurry-this":157}],326:[function(require,module,exports){
  16157. 'use strict';
  16158. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  16159. var apply = require('../internals/function-apply');
  16160. var $lastIndexOf = require('../internals/array-last-index-of');
  16161. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  16162. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  16163. // `%TypedArray%.prototype.lastIndexOf` method
  16164. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.lastindexof
  16165. exportTypedArrayMethod('lastIndexOf', function lastIndexOf(searchElement /* , fromIndex */) {
  16166. var length = arguments.length;
  16167. return apply($lastIndexOf, aTypedArray(this), length > 1 ? [searchElement, arguments[1]] : [searchElement]);
  16168. });
  16169. },{"../internals/array-buffer-view-core":103,"../internals/array-last-index-of":112,"../internals/function-apply":152}],327:[function(require,module,exports){
  16170. 'use strict';
  16171. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  16172. var $map = require('../internals/array-iteration').map;
  16173. var typedArraySpeciesConstructor = require('../internals/typed-array-species-constructor');
  16174. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  16175. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  16176. // `%TypedArray%.prototype.map` method
  16177. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.map
  16178. exportTypedArrayMethod('map', function map(mapfn /* , thisArg */) {
  16179. return $map(aTypedArray(this), mapfn, arguments.length > 1 ? arguments[1] : undefined, function (O, length) {
  16180. return new (typedArraySpeciesConstructor(O))(length);
  16181. });
  16182. });
  16183. },{"../internals/array-buffer-view-core":103,"../internals/array-iteration":111,"../internals/typed-array-species-constructor":262}],328:[function(require,module,exports){
  16184. 'use strict';
  16185. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  16186. var $reduceRight = require('../internals/array-reduce').right;
  16187. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  16188. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  16189. // `%TypedArray%.prototype.reduceRicht` method
  16190. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduceright
  16191. exportTypedArrayMethod('reduceRight', function reduceRight(callbackfn /* , initialValue */) {
  16192. var length = arguments.length;
  16193. return $reduceRight(aTypedArray(this), callbackfn, length, length > 1 ? arguments[1] : undefined);
  16194. });
  16195. },{"../internals/array-buffer-view-core":103,"../internals/array-reduce":115}],329:[function(require,module,exports){
  16196. 'use strict';
  16197. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  16198. var $reduce = require('../internals/array-reduce').left;
  16199. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  16200. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  16201. // `%TypedArray%.prototype.reduce` method
  16202. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduce
  16203. exportTypedArrayMethod('reduce', function reduce(callbackfn /* , initialValue */) {
  16204. var length = arguments.length;
  16205. return $reduce(aTypedArray(this), callbackfn, length, length > 1 ? arguments[1] : undefined);
  16206. });
  16207. },{"../internals/array-buffer-view-core":103,"../internals/array-reduce":115}],330:[function(require,module,exports){
  16208. 'use strict';
  16209. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  16210. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  16211. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  16212. var floor = Math.floor;
  16213. // `%TypedArray%.prototype.reverse` method
  16214. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.reverse
  16215. exportTypedArrayMethod('reverse', function reverse() {
  16216. var that = this;
  16217. var length = aTypedArray(that).length;
  16218. var middle = floor(length / 2);
  16219. var index = 0;
  16220. var value;
  16221. while (index < middle) {
  16222. value = that[index];
  16223. that[index++] = that[--length];
  16224. that[length] = value;
  16225. } return that;
  16226. });
  16227. },{"../internals/array-buffer-view-core":103}],331:[function(require,module,exports){
  16228. 'use strict';
  16229. var global = require('../internals/global');
  16230. var call = require('../internals/function-call');
  16231. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  16232. var lengthOfArrayLike = require('../internals/length-of-array-like');
  16233. var toOffset = require('../internals/to-offset');
  16234. var toIndexedObject = require('../internals/to-object');
  16235. var fails = require('../internals/fails');
  16236. var RangeError = global.RangeError;
  16237. var Int8Array = global.Int8Array;
  16238. var Int8ArrayPrototype = Int8Array && Int8Array.prototype;
  16239. var $set = Int8ArrayPrototype && Int8ArrayPrototype.set;
  16240. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  16241. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  16242. var WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS = !fails(function () {
  16243. // eslint-disable-next-line es-x/no-typed-arrays -- required for testing
  16244. var array = new Uint8ClampedArray(2);
  16245. call($set, array, { length: 1, 0: 3 }, 1);
  16246. return array[1] !== 3;
  16247. });
  16248. // https://bugs.chromium.org/p/v8/issues/detail?id=11294 and other
  16249. var TO_OBJECT_BUG = WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS && ArrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS && fails(function () {
  16250. var array = new Int8Array(2);
  16251. array.set(1);
  16252. array.set('2', 1);
  16253. return array[0] !== 0 || array[1] !== 2;
  16254. });
  16255. // `%TypedArray%.prototype.set` method
  16256. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.set
  16257. exportTypedArrayMethod('set', function set(arrayLike /* , offset */) {
  16258. aTypedArray(this);
  16259. var offset = toOffset(arguments.length > 1 ? arguments[1] : undefined, 1);
  16260. var src = toIndexedObject(arrayLike);
  16261. if (WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS) return call($set, this, src, offset);
  16262. var length = this.length;
  16263. var len = lengthOfArrayLike(src);
  16264. var index = 0;
  16265. if (len + offset > length) throw RangeError('Wrong length');
  16266. while (index < len) this[offset + index] = src[index++];
  16267. }, !WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS || TO_OBJECT_BUG);
  16268. },{"../internals/array-buffer-view-core":103,"../internals/fails":150,"../internals/function-call":155,"../internals/global":163,"../internals/length-of-array-like":188,"../internals/to-object":250,"../internals/to-offset":251}],332:[function(require,module,exports){
  16269. 'use strict';
  16270. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  16271. var typedArraySpeciesConstructor = require('../internals/typed-array-species-constructor');
  16272. var fails = require('../internals/fails');
  16273. var arraySlice = require('../internals/array-slice');
  16274. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  16275. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  16276. var FORCED = fails(function () {
  16277. // eslint-disable-next-line es-x/no-typed-arrays -- required for testing
  16278. new Int8Array(1).slice();
  16279. });
  16280. // `%TypedArray%.prototype.slice` method
  16281. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.slice
  16282. exportTypedArrayMethod('slice', function slice(start, end) {
  16283. var list = arraySlice(aTypedArray(this), start, end);
  16284. var C = typedArraySpeciesConstructor(this);
  16285. var index = 0;
  16286. var length = list.length;
  16287. var result = new C(length);
  16288. while (length > index) result[index] = list[index++];
  16289. return result;
  16290. }, FORCED);
  16291. },{"../internals/array-buffer-view-core":103,"../internals/array-slice":117,"../internals/fails":150,"../internals/typed-array-species-constructor":262}],333:[function(require,module,exports){
  16292. 'use strict';
  16293. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  16294. var $some = require('../internals/array-iteration').some;
  16295. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  16296. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  16297. // `%TypedArray%.prototype.some` method
  16298. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.some
  16299. exportTypedArrayMethod('some', function some(callbackfn /* , thisArg */) {
  16300. return $some(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  16301. });
  16302. },{"../internals/array-buffer-view-core":103,"../internals/array-iteration":111}],334:[function(require,module,exports){
  16303. 'use strict';
  16304. var global = require('../internals/global');
  16305. var uncurryThis = require('../internals/function-uncurry-this');
  16306. var fails = require('../internals/fails');
  16307. var aCallable = require('../internals/a-callable');
  16308. var internalSort = require('../internals/array-sort');
  16309. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  16310. var FF = require('../internals/engine-ff-version');
  16311. var IE_OR_EDGE = require('../internals/engine-is-ie-or-edge');
  16312. var V8 = require('../internals/engine-v8-version');
  16313. var WEBKIT = require('../internals/engine-webkit-version');
  16314. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  16315. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  16316. var Uint16Array = global.Uint16Array;
  16317. var un$Sort = Uint16Array && uncurryThis(Uint16Array.prototype.sort);
  16318. // WebKit
  16319. var ACCEPT_INCORRECT_ARGUMENTS = !!un$Sort && !(fails(function () {
  16320. un$Sort(new Uint16Array(2), null);
  16321. }) && fails(function () {
  16322. un$Sort(new Uint16Array(2), {});
  16323. }));
  16324. var STABLE_SORT = !!un$Sort && !fails(function () {
  16325. // feature detection can be too slow, so check engines versions
  16326. if (V8) return V8 < 74;
  16327. if (FF) return FF < 67;
  16328. if (IE_OR_EDGE) return true;
  16329. if (WEBKIT) return WEBKIT < 602;
  16330. var array = new Uint16Array(516);
  16331. var expected = Array(516);
  16332. var index, mod;
  16333. for (index = 0; index < 516; index++) {
  16334. mod = index % 4;
  16335. array[index] = 515 - index;
  16336. expected[index] = index - 2 * mod + 3;
  16337. }
  16338. un$Sort(array, function (a, b) {
  16339. return (a / 4 | 0) - (b / 4 | 0);
  16340. });
  16341. for (index = 0; index < 516; index++) {
  16342. if (array[index] !== expected[index]) return true;
  16343. }
  16344. });
  16345. var getSortCompare = function (comparefn) {
  16346. return function (x, y) {
  16347. if (comparefn !== undefined) return +comparefn(x, y) || 0;
  16348. // eslint-disable-next-line no-self-compare -- NaN check
  16349. if (y !== y) return -1;
  16350. // eslint-disable-next-line no-self-compare -- NaN check
  16351. if (x !== x) return 1;
  16352. if (x === 0 && y === 0) return 1 / x > 0 && 1 / y < 0 ? 1 : -1;
  16353. return x > y;
  16354. };
  16355. };
  16356. // `%TypedArray%.prototype.sort` method
  16357. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.sort
  16358. exportTypedArrayMethod('sort', function sort(comparefn) {
  16359. if (comparefn !== undefined) aCallable(comparefn);
  16360. if (STABLE_SORT) return un$Sort(this, comparefn);
  16361. return internalSort(aTypedArray(this), getSortCompare(comparefn));
  16362. }, !STABLE_SORT || ACCEPT_INCORRECT_ARGUMENTS);
  16363. },{"../internals/a-callable":95,"../internals/array-buffer-view-core":103,"../internals/array-sort":118,"../internals/engine-ff-version":138,"../internals/engine-is-ie-or-edge":140,"../internals/engine-v8-version":146,"../internals/engine-webkit-version":147,"../internals/fails":150,"../internals/function-uncurry-this":157,"../internals/global":163}],335:[function(require,module,exports){
  16364. 'use strict';
  16365. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  16366. var toLength = require('../internals/to-length');
  16367. var toAbsoluteIndex = require('../internals/to-absolute-index');
  16368. var typedArraySpeciesConstructor = require('../internals/typed-array-species-constructor');
  16369. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  16370. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  16371. // `%TypedArray%.prototype.subarray` method
  16372. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.subarray
  16373. exportTypedArrayMethod('subarray', function subarray(begin, end) {
  16374. var O = aTypedArray(this);
  16375. var length = O.length;
  16376. var beginIndex = toAbsoluteIndex(begin, length);
  16377. var C = typedArraySpeciesConstructor(O);
  16378. return new C(
  16379. O.buffer,
  16380. O.byteOffset + beginIndex * O.BYTES_PER_ELEMENT,
  16381. toLength((end === undefined ? length : toAbsoluteIndex(end, length)) - beginIndex)
  16382. );
  16383. });
  16384. },{"../internals/array-buffer-view-core":103,"../internals/to-absolute-index":245,"../internals/to-length":249,"../internals/typed-array-species-constructor":262}],336:[function(require,module,exports){
  16385. 'use strict';
  16386. var global = require('../internals/global');
  16387. var apply = require('../internals/function-apply');
  16388. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  16389. var fails = require('../internals/fails');
  16390. var arraySlice = require('../internals/array-slice');
  16391. var Int8Array = global.Int8Array;
  16392. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  16393. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  16394. var $toLocaleString = [].toLocaleString;
  16395. // iOS Safari 6.x fails here
  16396. var TO_LOCALE_STRING_BUG = !!Int8Array && fails(function () {
  16397. $toLocaleString.call(new Int8Array(1));
  16398. });
  16399. var FORCED = fails(function () {
  16400. return [1, 2].toLocaleString() != new Int8Array([1, 2]).toLocaleString();
  16401. }) || !fails(function () {
  16402. Int8Array.prototype.toLocaleString.call([1, 2]);
  16403. });
  16404. // `%TypedArray%.prototype.toLocaleString` method
  16405. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.tolocalestring
  16406. exportTypedArrayMethod('toLocaleString', function toLocaleString() {
  16407. return apply(
  16408. $toLocaleString,
  16409. TO_LOCALE_STRING_BUG ? arraySlice(aTypedArray(this)) : aTypedArray(this),
  16410. arraySlice(arguments)
  16411. );
  16412. }, FORCED);
  16413. },{"../internals/array-buffer-view-core":103,"../internals/array-slice":117,"../internals/fails":150,"../internals/function-apply":152,"../internals/global":163}],337:[function(require,module,exports){
  16414. 'use strict';
  16415. var exportTypedArrayMethod = require('../internals/array-buffer-view-core').exportTypedArrayMethod;
  16416. var fails = require('../internals/fails');
  16417. var global = require('../internals/global');
  16418. var uncurryThis = require('../internals/function-uncurry-this');
  16419. var Uint8Array = global.Uint8Array;
  16420. var Uint8ArrayPrototype = Uint8Array && Uint8Array.prototype || {};
  16421. var arrayToString = [].toString;
  16422. var join = uncurryThis([].join);
  16423. if (fails(function () { arrayToString.call({}); })) {
  16424. arrayToString = function toString() {
  16425. return join(this);
  16426. };
  16427. }
  16428. var IS_NOT_ARRAY_METHOD = Uint8ArrayPrototype.toString != arrayToString;
  16429. // `%TypedArray%.prototype.toString` method
  16430. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.tostring
  16431. exportTypedArrayMethod('toString', arrayToString, IS_NOT_ARRAY_METHOD);
  16432. },{"../internals/array-buffer-view-core":103,"../internals/fails":150,"../internals/function-uncurry-this":157,"../internals/global":163}],338:[function(require,module,exports){
  16433. var createTypedArrayConstructor = require('../internals/typed-array-constructor');
  16434. // `Uint8Array` constructor
  16435. // https://tc39.es/ecma262/#sec-typedarray-objects
  16436. createTypedArrayConstructor('Uint8', function (init) {
  16437. return function Uint8Array(data, byteOffset, length) {
  16438. return init(this, data, byteOffset, length);
  16439. };
  16440. });
  16441. },{"../internals/typed-array-constructor":258}],339:[function(require,module,exports){
  16442. var global = require('../internals/global');
  16443. var DOMIterables = require('../internals/dom-iterables');
  16444. var DOMTokenListPrototype = require('../internals/dom-token-list-prototype');
  16445. var forEach = require('../internals/array-for-each');
  16446. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  16447. var handlePrototype = function (CollectionPrototype) {
  16448. // some Chrome versions have non-configurable methods on DOMTokenList
  16449. if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try {
  16450. createNonEnumerableProperty(CollectionPrototype, 'forEach', forEach);
  16451. } catch (error) {
  16452. CollectionPrototype.forEach = forEach;
  16453. }
  16454. };
  16455. for (var COLLECTION_NAME in DOMIterables) {
  16456. if (DOMIterables[COLLECTION_NAME]) {
  16457. handlePrototype(global[COLLECTION_NAME] && global[COLLECTION_NAME].prototype);
  16458. }
  16459. }
  16460. handlePrototype(DOMTokenListPrototype);
  16461. },{"../internals/array-for-each":107,"../internals/create-non-enumerable-property":129,"../internals/dom-iterables":136,"../internals/dom-token-list-prototype":137,"../internals/global":163}],340:[function(require,module,exports){
  16462. var global = require('../internals/global');
  16463. var DOMIterables = require('../internals/dom-iterables');
  16464. var DOMTokenListPrototype = require('../internals/dom-token-list-prototype');
  16465. var ArrayIteratorMethods = require('../modules/es.array.iterator');
  16466. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  16467. var wellKnownSymbol = require('../internals/well-known-symbol');
  16468. var ITERATOR = wellKnownSymbol('iterator');
  16469. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  16470. var ArrayValues = ArrayIteratorMethods.values;
  16471. var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
  16472. if (CollectionPrototype) {
  16473. // some Chrome versions have non-configurable methods on DOMTokenList
  16474. if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
  16475. createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
  16476. } catch (error) {
  16477. CollectionPrototype[ITERATOR] = ArrayValues;
  16478. }
  16479. if (!CollectionPrototype[TO_STRING_TAG]) {
  16480. createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
  16481. }
  16482. if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
  16483. // some Chrome versions have non-configurable methods on DOMTokenList
  16484. if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
  16485. createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
  16486. } catch (error) {
  16487. CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
  16488. }
  16489. }
  16490. }
  16491. };
  16492. for (var COLLECTION_NAME in DOMIterables) {
  16493. handlePrototype(global[COLLECTION_NAME] && global[COLLECTION_NAME].prototype, COLLECTION_NAME);
  16494. }
  16495. handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
  16496. },{"../internals/create-non-enumerable-property":129,"../internals/dom-iterables":136,"../internals/dom-token-list-prototype":137,"../internals/global":163,"../internals/well-known-symbol":268,"../modules/es.array.iterator":278}],341:[function(require,module,exports){
  16497. // Copyright Joyent, Inc. and other Node contributors.
  16498. //
  16499. // Permission is hereby granted, free of charge, to any person obtaining a
  16500. // copy of this software and associated documentation files (the
  16501. // "Software"), to deal in the Software without restriction, including
  16502. // without limitation the rights to use, copy, modify, merge, publish,
  16503. // distribute, sublicense, and/or sell copies of the Software, and to permit
  16504. // persons to whom the Software is furnished to do so, subject to the
  16505. // following conditions:
  16506. //
  16507. // The above copyright notice and this permission notice shall be included
  16508. // in all copies or substantial portions of the Software.
  16509. //
  16510. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  16511. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  16512. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  16513. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  16514. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  16515. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  16516. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  16517. // NOTE: These type checking functions intentionally don't use `instanceof`
  16518. // because it is fragile and can be easily faked with `Object.create()`.
  16519. function isArray(arg) {
  16520. if (Array.isArray) {
  16521. return Array.isArray(arg);
  16522. }
  16523. return objectToString(arg) === '[object Array]';
  16524. }
  16525. exports.isArray = isArray;
  16526. function isBoolean(arg) {
  16527. return typeof arg === 'boolean';
  16528. }
  16529. exports.isBoolean = isBoolean;
  16530. function isNull(arg) {
  16531. return arg === null;
  16532. }
  16533. exports.isNull = isNull;
  16534. function isNullOrUndefined(arg) {
  16535. return arg == null;
  16536. }
  16537. exports.isNullOrUndefined = isNullOrUndefined;
  16538. function isNumber(arg) {
  16539. return typeof arg === 'number';
  16540. }
  16541. exports.isNumber = isNumber;
  16542. function isString(arg) {
  16543. return typeof arg === 'string';
  16544. }
  16545. exports.isString = isString;
  16546. function isSymbol(arg) {
  16547. return typeof arg === 'symbol';
  16548. }
  16549. exports.isSymbol = isSymbol;
  16550. function isUndefined(arg) {
  16551. return arg === void 0;
  16552. }
  16553. exports.isUndefined = isUndefined;
  16554. function isRegExp(re) {
  16555. return objectToString(re) === '[object RegExp]';
  16556. }
  16557. exports.isRegExp = isRegExp;
  16558. function isObject(arg) {
  16559. return typeof arg === 'object' && arg !== null;
  16560. }
  16561. exports.isObject = isObject;
  16562. function isDate(d) {
  16563. return objectToString(d) === '[object Date]';
  16564. }
  16565. exports.isDate = isDate;
  16566. function isError(e) {
  16567. return (objectToString(e) === '[object Error]' || e instanceof Error);
  16568. }
  16569. exports.isError = isError;
  16570. function isFunction(arg) {
  16571. return typeof arg === 'function';
  16572. }
  16573. exports.isFunction = isFunction;
  16574. function isPrimitive(arg) {
  16575. return arg === null ||
  16576. typeof arg === 'boolean' ||
  16577. typeof arg === 'number' ||
  16578. typeof arg === 'string' ||
  16579. typeof arg === 'symbol' || // ES6 symbol
  16580. typeof arg === 'undefined';
  16581. }
  16582. exports.isPrimitive = isPrimitive;
  16583. exports.isBuffer = require('buffer').Buffer.isBuffer;
  16584. function objectToString(o) {
  16585. return Object.prototype.toString.call(o);
  16586. }
  16587. },{"buffer":90}],342:[function(require,module,exports){
  16588. /*
  16589. * Date Format 1.2.3
  16590. * (c) 2007-2009 Steven Levithan <stevenlevithan.com>
  16591. * MIT license
  16592. *
  16593. * Includes enhancements by Scott Trenda <scott.trenda.net>
  16594. * and Kris Kowal <cixar.com/~kris.kowal/>
  16595. *
  16596. * Accepts a date, a mask, or a date and a mask.
  16597. * Returns a formatted version of the given date.
  16598. * The date defaults to the current date/time.
  16599. * The mask defaults to dateFormat.masks.default.
  16600. */
  16601. (function(global) {
  16602. 'use strict';
  16603. var dateFormat = (function() {
  16604. var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZWN]|'[^']*'|'[^']*'/g;
  16605. var timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g;
  16606. var timezoneClip = /[^-+\dA-Z]/g;
  16607. // Regexes and supporting functions are cached through closure
  16608. return function (date, mask, utc, gmt) {
  16609. // You can't provide utc if you skip other args (use the 'UTC:' mask prefix)
  16610. if (arguments.length === 1 && kindOf(date) === 'string' && !/\d/.test(date)) {
  16611. mask = date;
  16612. date = undefined;
  16613. }
  16614. date = date || new Date;
  16615. if(!(date instanceof Date)) {
  16616. date = new Date(date);
  16617. }
  16618. if (isNaN(date)) {
  16619. throw TypeError('Invalid date');
  16620. }
  16621. mask = String(dateFormat.masks[mask] || mask || dateFormat.masks['default']);
  16622. // Allow setting the utc/gmt argument via the mask
  16623. var maskSlice = mask.slice(0, 4);
  16624. if (maskSlice === 'UTC:' || maskSlice === 'GMT:') {
  16625. mask = mask.slice(4);
  16626. utc = true;
  16627. if (maskSlice === 'GMT:') {
  16628. gmt = true;
  16629. }
  16630. }
  16631. var _ = utc ? 'getUTC' : 'get';
  16632. var d = date[_ + 'Date']();
  16633. var D = date[_ + 'Day']();
  16634. var m = date[_ + 'Month']();
  16635. var y = date[_ + 'FullYear']();
  16636. var H = date[_ + 'Hours']();
  16637. var M = date[_ + 'Minutes']();
  16638. var s = date[_ + 'Seconds']();
  16639. var L = date[_ + 'Milliseconds']();
  16640. var o = utc ? 0 : date.getTimezoneOffset();
  16641. var W = getWeek(date);
  16642. var N = getDayOfWeek(date);
  16643. var flags = {
  16644. d: d,
  16645. dd: pad(d),
  16646. ddd: dateFormat.i18n.dayNames[D],
  16647. dddd: dateFormat.i18n.dayNames[D + 7],
  16648. m: m + 1,
  16649. mm: pad(m + 1),
  16650. mmm: dateFormat.i18n.monthNames[m],
  16651. mmmm: dateFormat.i18n.monthNames[m + 12],
  16652. yy: String(y).slice(2),
  16653. yyyy: y,
  16654. h: H % 12 || 12,
  16655. hh: pad(H % 12 || 12),
  16656. H: H,
  16657. HH: pad(H),
  16658. M: M,
  16659. MM: pad(M),
  16660. s: s,
  16661. ss: pad(s),
  16662. l: pad(L, 3),
  16663. L: pad(Math.round(L / 10)),
  16664. t: H < 12 ? 'a' : 'p',
  16665. tt: H < 12 ? 'am' : 'pm',
  16666. T: H < 12 ? 'A' : 'P',
  16667. TT: H < 12 ? 'AM' : 'PM',
  16668. Z: gmt ? 'GMT' : utc ? 'UTC' : (String(date).match(timezone) || ['']).pop().replace(timezoneClip, ''),
  16669. o: (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
  16670. S: ['th', 'st', 'nd', 'rd'][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10],
  16671. W: W,
  16672. N: N
  16673. };
  16674. return mask.replace(token, function (match) {
  16675. if (match in flags) {
  16676. return flags[match];
  16677. }
  16678. return match.slice(1, match.length - 1);
  16679. });
  16680. };
  16681. })();
  16682. dateFormat.masks = {
  16683. 'default': 'ddd mmm dd yyyy HH:MM:ss',
  16684. 'shortDate': 'm/d/yy',
  16685. 'mediumDate': 'mmm d, yyyy',
  16686. 'longDate': 'mmmm d, yyyy',
  16687. 'fullDate': 'dddd, mmmm d, yyyy',
  16688. 'shortTime': 'h:MM TT',
  16689. 'mediumTime': 'h:MM:ss TT',
  16690. 'longTime': 'h:MM:ss TT Z',
  16691. 'isoDate': 'yyyy-mm-dd',
  16692. 'isoTime': 'HH:MM:ss',
  16693. 'isoDateTime': 'yyyy-mm-dd\'T\'HH:MM:sso',
  16694. 'isoUtcDateTime': 'UTC:yyyy-mm-dd\'T\'HH:MM:ss\'Z\'',
  16695. 'expiresHeaderFormat': 'ddd, dd mmm yyyy HH:MM:ss Z'
  16696. };
  16697. // Internationalization strings
  16698. dateFormat.i18n = {
  16699. dayNames: [
  16700. 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat',
  16701. 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
  16702. ],
  16703. monthNames: [
  16704. 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
  16705. 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'
  16706. ]
  16707. };
  16708. function pad(val, len) {
  16709. val = String(val);
  16710. len = len || 2;
  16711. while (val.length < len) {
  16712. val = '0' + val;
  16713. }
  16714. return val;
  16715. }
  16716. /**
  16717. * Get the ISO 8601 week number
  16718. * Based on comments from
  16719. * http://techblog.procurios.nl/k/n618/news/view/33796/14863/Calculate-ISO-8601-week-and-year-in-javascript.html
  16720. *
  16721. * @param {Object} `date`
  16722. * @return {Number}
  16723. */
  16724. function getWeek(date) {
  16725. // Remove time components of date
  16726. var targetThursday = new Date(date.getFullYear(), date.getMonth(), date.getDate());
  16727. // Change date to Thursday same week
  16728. targetThursday.setDate(targetThursday.getDate() - ((targetThursday.getDay() + 6) % 7) + 3);
  16729. // Take January 4th as it is always in week 1 (see ISO 8601)
  16730. var firstThursday = new Date(targetThursday.getFullYear(), 0, 4);
  16731. // Change date to Thursday same week
  16732. firstThursday.setDate(firstThursday.getDate() - ((firstThursday.getDay() + 6) % 7) + 3);
  16733. // Check if daylight-saving-time-switch occurred and correct for it
  16734. var ds = targetThursday.getTimezoneOffset() - firstThursday.getTimezoneOffset();
  16735. targetThursday.setHours(targetThursday.getHours() - ds);
  16736. // Number of weeks between target Thursday and first Thursday
  16737. var weekDiff = (targetThursday - firstThursday) / (86400000*7);
  16738. return 1 + Math.floor(weekDiff);
  16739. }
  16740. /**
  16741. * Get ISO-8601 numeric representation of the day of the week
  16742. * 1 (for Monday) through 7 (for Sunday)
  16743. *
  16744. * @param {Object} `date`
  16745. * @return {Number}
  16746. */
  16747. function getDayOfWeek(date) {
  16748. var dow = date.getDay();
  16749. if(dow === 0) {
  16750. dow = 7;
  16751. }
  16752. return dow;
  16753. }
  16754. /**
  16755. * kind-of shortcut
  16756. * @param {*} val
  16757. * @return {String}
  16758. */
  16759. function kindOf(val) {
  16760. if (val === null) {
  16761. return 'null';
  16762. }
  16763. if (val === undefined) {
  16764. return 'undefined';
  16765. }
  16766. if (typeof val !== 'object') {
  16767. return typeof val;
  16768. }
  16769. if (Array.isArray(val)) {
  16770. return 'array';
  16771. }
  16772. return {}.toString.call(val)
  16773. .slice(8, -1).toLowerCase();
  16774. };
  16775. if (typeof define === 'function' && define.amd) {
  16776. define(function () {
  16777. return dateFormat;
  16778. });
  16779. } else if (typeof exports === 'object') {
  16780. module.exports = dateFormat;
  16781. } else {
  16782. global.dateFormat = dateFormat;
  16783. }
  16784. })(this);
  16785. },{}],343:[function(require,module,exports){
  16786. /*!
  16787. * escape-html
  16788. * Copyright(c) 2012-2013 TJ Holowaychuk
  16789. * Copyright(c) 2015 Andreas Lubbe
  16790. * Copyright(c) 2015 Tiancheng "Timothy" Gu
  16791. * MIT Licensed
  16792. */
  16793. 'use strict';
  16794. /**
  16795. * Module variables.
  16796. * @private
  16797. */
  16798. var matchHtmlRegExp = /["'&<>]/;
  16799. /**
  16800. * Module exports.
  16801. * @public
  16802. */
  16803. module.exports = escapeHtml;
  16804. /**
  16805. * Escape special characters in the given string of html.
  16806. *
  16807. * @param {string} string The string to escape for inserting into HTML
  16808. * @return {string}
  16809. * @public
  16810. */
  16811. function escapeHtml(string) {
  16812. var str = '' + string;
  16813. var match = matchHtmlRegExp.exec(str);
  16814. if (!match) {
  16815. return str;
  16816. }
  16817. var escape;
  16818. var html = '';
  16819. var index = 0;
  16820. var lastIndex = 0;
  16821. for (index = match.index; index < str.length; index++) {
  16822. switch (str.charCodeAt(index)) {
  16823. case 34: // "
  16824. escape = '&quot;';
  16825. break;
  16826. case 38: // &
  16827. escape = '&amp;';
  16828. break;
  16829. case 39: // '
  16830. escape = '&#39;';
  16831. break;
  16832. case 60: // <
  16833. escape = '&lt;';
  16834. break;
  16835. case 62: // >
  16836. escape = '&gt;';
  16837. break;
  16838. default:
  16839. continue;
  16840. }
  16841. if (lastIndex !== index) {
  16842. html += str.substring(lastIndex, index);
  16843. }
  16844. lastIndex = index + 1;
  16845. html += escape;
  16846. }
  16847. return lastIndex !== index
  16848. ? html + str.substring(lastIndex, index)
  16849. : html;
  16850. }
  16851. },{}],344:[function(require,module,exports){
  16852. // Copyright Joyent, Inc. and other Node contributors.
  16853. //
  16854. // Permission is hereby granted, free of charge, to any person obtaining a
  16855. // copy of this software and associated documentation files (the
  16856. // "Software"), to deal in the Software without restriction, including
  16857. // without limitation the rights to use, copy, modify, merge, publish,
  16858. // distribute, sublicense, and/or sell copies of the Software, and to permit
  16859. // persons to whom the Software is furnished to do so, subject to the
  16860. // following conditions:
  16861. //
  16862. // The above copyright notice and this permission notice shall be included
  16863. // in all copies or substantial portions of the Software.
  16864. //
  16865. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  16866. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  16867. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  16868. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  16869. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  16870. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  16871. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  16872. 'use strict';
  16873. var R = typeof Reflect === 'object' ? Reflect : null
  16874. var ReflectApply = R && typeof R.apply === 'function'
  16875. ? R.apply
  16876. : function ReflectApply(target, receiver, args) {
  16877. return Function.prototype.apply.call(target, receiver, args);
  16878. }
  16879. var ReflectOwnKeys
  16880. if (R && typeof R.ownKeys === 'function') {
  16881. ReflectOwnKeys = R.ownKeys
  16882. } else if (Object.getOwnPropertySymbols) {
  16883. ReflectOwnKeys = function ReflectOwnKeys(target) {
  16884. return Object.getOwnPropertyNames(target)
  16885. .concat(Object.getOwnPropertySymbols(target));
  16886. };
  16887. } else {
  16888. ReflectOwnKeys = function ReflectOwnKeys(target) {
  16889. return Object.getOwnPropertyNames(target);
  16890. };
  16891. }
  16892. function ProcessEmitWarning(warning) {
  16893. if (console && console.warn) console.warn(warning);
  16894. }
  16895. var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
  16896. return value !== value;
  16897. }
  16898. function EventEmitter() {
  16899. EventEmitter.init.call(this);
  16900. }
  16901. module.exports = EventEmitter;
  16902. module.exports.once = once;
  16903. // Backwards-compat with node 0.10.x
  16904. EventEmitter.EventEmitter = EventEmitter;
  16905. EventEmitter.prototype._events = undefined;
  16906. EventEmitter.prototype._eventsCount = 0;
  16907. EventEmitter.prototype._maxListeners = undefined;
  16908. // By default EventEmitters will print a warning if more than 10 listeners are
  16909. // added to it. This is a useful default which helps finding memory leaks.
  16910. var defaultMaxListeners = 10;
  16911. function checkListener(listener) {
  16912. if (typeof listener !== 'function') {
  16913. throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
  16914. }
  16915. }
  16916. Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
  16917. enumerable: true,
  16918. get: function() {
  16919. return defaultMaxListeners;
  16920. },
  16921. set: function(arg) {
  16922. if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
  16923. throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
  16924. }
  16925. defaultMaxListeners = arg;
  16926. }
  16927. });
  16928. EventEmitter.init = function() {
  16929. if (this._events === undefined ||
  16930. this._events === Object.getPrototypeOf(this)._events) {
  16931. this._events = Object.create(null);
  16932. this._eventsCount = 0;
  16933. }
  16934. this._maxListeners = this._maxListeners || undefined;
  16935. };
  16936. // Obviously not all Emitters should be limited to 10. This function allows
  16937. // that to be increased. Set to zero for unlimited.
  16938. EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
  16939. if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
  16940. throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
  16941. }
  16942. this._maxListeners = n;
  16943. return this;
  16944. };
  16945. function _getMaxListeners(that) {
  16946. if (that._maxListeners === undefined)
  16947. return EventEmitter.defaultMaxListeners;
  16948. return that._maxListeners;
  16949. }
  16950. EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
  16951. return _getMaxListeners(this);
  16952. };
  16953. EventEmitter.prototype.emit = function emit(type) {
  16954. var args = [];
  16955. for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
  16956. var doError = (type === 'error');
  16957. var events = this._events;
  16958. if (events !== undefined)
  16959. doError = (doError && events.error === undefined);
  16960. else if (!doError)
  16961. return false;
  16962. // If there is no 'error' event listener then throw.
  16963. if (doError) {
  16964. var er;
  16965. if (args.length > 0)
  16966. er = args[0];
  16967. if (er instanceof Error) {
  16968. // Note: The comments on the `throw` lines are intentional, they show
  16969. // up in Node's output if this results in an unhandled exception.
  16970. throw er; // Unhandled 'error' event
  16971. }
  16972. // At least give some kind of context to the user
  16973. var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
  16974. err.context = er;
  16975. throw err; // Unhandled 'error' event
  16976. }
  16977. var handler = events[type];
  16978. if (handler === undefined)
  16979. return false;
  16980. if (typeof handler === 'function') {
  16981. ReflectApply(handler, this, args);
  16982. } else {
  16983. var len = handler.length;
  16984. var listeners = arrayClone(handler, len);
  16985. for (var i = 0; i < len; ++i)
  16986. ReflectApply(listeners[i], this, args);
  16987. }
  16988. return true;
  16989. };
  16990. function _addListener(target, type, listener, prepend) {
  16991. var m;
  16992. var events;
  16993. var existing;
  16994. checkListener(listener);
  16995. events = target._events;
  16996. if (events === undefined) {
  16997. events = target._events = Object.create(null);
  16998. target._eventsCount = 0;
  16999. } else {
  17000. // To avoid recursion in the case that type === "newListener"! Before
  17001. // adding it to the listeners, first emit "newListener".
  17002. if (events.newListener !== undefined) {
  17003. target.emit('newListener', type,
  17004. listener.listener ? listener.listener : listener);
  17005. // Re-assign `events` because a newListener handler could have caused the
  17006. // this._events to be assigned to a new object
  17007. events = target._events;
  17008. }
  17009. existing = events[type];
  17010. }
  17011. if (existing === undefined) {
  17012. // Optimize the case of one listener. Don't need the extra array object.
  17013. existing = events[type] = listener;
  17014. ++target._eventsCount;
  17015. } else {
  17016. if (typeof existing === 'function') {
  17017. // Adding the second element, need to change to array.
  17018. existing = events[type] =
  17019. prepend ? [listener, existing] : [existing, listener];
  17020. // If we've already got an array, just append.
  17021. } else if (prepend) {
  17022. existing.unshift(listener);
  17023. } else {
  17024. existing.push(listener);
  17025. }
  17026. // Check for listener leak
  17027. m = _getMaxListeners(target);
  17028. if (m > 0 && existing.length > m && !existing.warned) {
  17029. existing.warned = true;
  17030. // No error code for this since it is a Warning
  17031. // eslint-disable-next-line no-restricted-syntax
  17032. var w = new Error('Possible EventEmitter memory leak detected. ' +
  17033. existing.length + ' ' + String(type) + ' listeners ' +
  17034. 'added. Use emitter.setMaxListeners() to ' +
  17035. 'increase limit');
  17036. w.name = 'MaxListenersExceededWarning';
  17037. w.emitter = target;
  17038. w.type = type;
  17039. w.count = existing.length;
  17040. ProcessEmitWarning(w);
  17041. }
  17042. }
  17043. return target;
  17044. }
  17045. EventEmitter.prototype.addListener = function addListener(type, listener) {
  17046. return _addListener(this, type, listener, false);
  17047. };
  17048. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  17049. EventEmitter.prototype.prependListener =
  17050. function prependListener(type, listener) {
  17051. return _addListener(this, type, listener, true);
  17052. };
  17053. function onceWrapper() {
  17054. if (!this.fired) {
  17055. this.target.removeListener(this.type, this.wrapFn);
  17056. this.fired = true;
  17057. if (arguments.length === 0)
  17058. return this.listener.call(this.target);
  17059. return this.listener.apply(this.target, arguments);
  17060. }
  17061. }
  17062. function _onceWrap(target, type, listener) {
  17063. var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
  17064. var wrapped = onceWrapper.bind(state);
  17065. wrapped.listener = listener;
  17066. state.wrapFn = wrapped;
  17067. return wrapped;
  17068. }
  17069. EventEmitter.prototype.once = function once(type, listener) {
  17070. checkListener(listener);
  17071. this.on(type, _onceWrap(this, type, listener));
  17072. return this;
  17073. };
  17074. EventEmitter.prototype.prependOnceListener =
  17075. function prependOnceListener(type, listener) {
  17076. checkListener(listener);
  17077. this.prependListener(type, _onceWrap(this, type, listener));
  17078. return this;
  17079. };
  17080. // Emits a 'removeListener' event if and only if the listener was removed.
  17081. EventEmitter.prototype.removeListener =
  17082. function removeListener(type, listener) {
  17083. var list, events, position, i, originalListener;
  17084. checkListener(listener);
  17085. events = this._events;
  17086. if (events === undefined)
  17087. return this;
  17088. list = events[type];
  17089. if (list === undefined)
  17090. return this;
  17091. if (list === listener || list.listener === listener) {
  17092. if (--this._eventsCount === 0)
  17093. this._events = Object.create(null);
  17094. else {
  17095. delete events[type];
  17096. if (events.removeListener)
  17097. this.emit('removeListener', type, list.listener || listener);
  17098. }
  17099. } else if (typeof list !== 'function') {
  17100. position = -1;
  17101. for (i = list.length - 1; i >= 0; i--) {
  17102. if (list[i] === listener || list[i].listener === listener) {
  17103. originalListener = list[i].listener;
  17104. position = i;
  17105. break;
  17106. }
  17107. }
  17108. if (position < 0)
  17109. return this;
  17110. if (position === 0)
  17111. list.shift();
  17112. else {
  17113. spliceOne(list, position);
  17114. }
  17115. if (list.length === 1)
  17116. events[type] = list[0];
  17117. if (events.removeListener !== undefined)
  17118. this.emit('removeListener', type, originalListener || listener);
  17119. }
  17120. return this;
  17121. };
  17122. EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
  17123. EventEmitter.prototype.removeAllListeners =
  17124. function removeAllListeners(type) {
  17125. var listeners, events, i;
  17126. events = this._events;
  17127. if (events === undefined)
  17128. return this;
  17129. // not listening for removeListener, no need to emit
  17130. if (events.removeListener === undefined) {
  17131. if (arguments.length === 0) {
  17132. this._events = Object.create(null);
  17133. this._eventsCount = 0;
  17134. } else if (events[type] !== undefined) {
  17135. if (--this._eventsCount === 0)
  17136. this._events = Object.create(null);
  17137. else
  17138. delete events[type];
  17139. }
  17140. return this;
  17141. }
  17142. // emit removeListener for all listeners on all events
  17143. if (arguments.length === 0) {
  17144. var keys = Object.keys(events);
  17145. var key;
  17146. for (i = 0; i < keys.length; ++i) {
  17147. key = keys[i];
  17148. if (key === 'removeListener') continue;
  17149. this.removeAllListeners(key);
  17150. }
  17151. this.removeAllListeners('removeListener');
  17152. this._events = Object.create(null);
  17153. this._eventsCount = 0;
  17154. return this;
  17155. }
  17156. listeners = events[type];
  17157. if (typeof listeners === 'function') {
  17158. this.removeListener(type, listeners);
  17159. } else if (listeners !== undefined) {
  17160. // LIFO order
  17161. for (i = listeners.length - 1; i >= 0; i--) {
  17162. this.removeListener(type, listeners[i]);
  17163. }
  17164. }
  17165. return this;
  17166. };
  17167. function _listeners(target, type, unwrap) {
  17168. var events = target._events;
  17169. if (events === undefined)
  17170. return [];
  17171. var evlistener = events[type];
  17172. if (evlistener === undefined)
  17173. return [];
  17174. if (typeof evlistener === 'function')
  17175. return unwrap ? [evlistener.listener || evlistener] : [evlistener];
  17176. return unwrap ?
  17177. unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
  17178. }
  17179. EventEmitter.prototype.listeners = function listeners(type) {
  17180. return _listeners(this, type, true);
  17181. };
  17182. EventEmitter.prototype.rawListeners = function rawListeners(type) {
  17183. return _listeners(this, type, false);
  17184. };
  17185. EventEmitter.listenerCount = function(emitter, type) {
  17186. if (typeof emitter.listenerCount === 'function') {
  17187. return emitter.listenerCount(type);
  17188. } else {
  17189. return listenerCount.call(emitter, type);
  17190. }
  17191. };
  17192. EventEmitter.prototype.listenerCount = listenerCount;
  17193. function listenerCount(type) {
  17194. var events = this._events;
  17195. if (events !== undefined) {
  17196. var evlistener = events[type];
  17197. if (typeof evlistener === 'function') {
  17198. return 1;
  17199. } else if (evlistener !== undefined) {
  17200. return evlistener.length;
  17201. }
  17202. }
  17203. return 0;
  17204. }
  17205. EventEmitter.prototype.eventNames = function eventNames() {
  17206. return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
  17207. };
  17208. function arrayClone(arr, n) {
  17209. var copy = new Array(n);
  17210. for (var i = 0; i < n; ++i)
  17211. copy[i] = arr[i];
  17212. return copy;
  17213. }
  17214. function spliceOne(list, index) {
  17215. for (; index + 1 < list.length; index++)
  17216. list[index] = list[index + 1];
  17217. list.pop();
  17218. }
  17219. function unwrapListeners(arr) {
  17220. var ret = new Array(arr.length);
  17221. for (var i = 0; i < ret.length; ++i) {
  17222. ret[i] = arr[i].listener || arr[i];
  17223. }
  17224. return ret;
  17225. }
  17226. function once(emitter, name) {
  17227. return new Promise(function (resolve, reject) {
  17228. function errorListener(err) {
  17229. emitter.removeListener(name, resolver);
  17230. reject(err);
  17231. }
  17232. function resolver() {
  17233. if (typeof emitter.removeListener === 'function') {
  17234. emitter.removeListener('error', errorListener);
  17235. }
  17236. resolve([].slice.call(arguments));
  17237. };
  17238. eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
  17239. if (name !== 'error') {
  17240. addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
  17241. }
  17242. });
  17243. }
  17244. function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
  17245. if (typeof emitter.on === 'function') {
  17246. eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
  17247. }
  17248. }
  17249. function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
  17250. if (typeof emitter.on === 'function') {
  17251. if (flags.once) {
  17252. emitter.once(name, listener);
  17253. } else {
  17254. emitter.on(name, listener);
  17255. }
  17256. } else if (typeof emitter.addEventListener === 'function') {
  17257. // EventTarget does not have `error` event semantics like Node
  17258. // EventEmitters, we do not listen for `error` events here.
  17259. emitter.addEventListener(name, function wrapListener(arg) {
  17260. // IE does not have builtin `{ once: true }` support so we
  17261. // have to do it manually.
  17262. if (flags.once) {
  17263. emitter.removeEventListener(name, wrapListener);
  17264. }
  17265. listener(arg);
  17266. });
  17267. } else {
  17268. throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
  17269. }
  17270. }
  17271. },{}],345:[function(require,module,exports){
  17272. 'use strict';
  17273. var isCallable = require('is-callable');
  17274. var toStr = Object.prototype.toString;
  17275. var hasOwnProperty = Object.prototype.hasOwnProperty;
  17276. var forEachArray = function forEachArray(array, iterator, receiver) {
  17277. for (var i = 0, len = array.length; i < len; i++) {
  17278. if (hasOwnProperty.call(array, i)) {
  17279. if (receiver == null) {
  17280. iterator(array[i], i, array);
  17281. } else {
  17282. iterator.call(receiver, array[i], i, array);
  17283. }
  17284. }
  17285. }
  17286. };
  17287. var forEachString = function forEachString(string, iterator, receiver) {
  17288. for (var i = 0, len = string.length; i < len; i++) {
  17289. // no such thing as a sparse string.
  17290. if (receiver == null) {
  17291. iterator(string.charAt(i), i, string);
  17292. } else {
  17293. iterator.call(receiver, string.charAt(i), i, string);
  17294. }
  17295. }
  17296. };
  17297. var forEachObject = function forEachObject(object, iterator, receiver) {
  17298. for (var k in object) {
  17299. if (hasOwnProperty.call(object, k)) {
  17300. if (receiver == null) {
  17301. iterator(object[k], k, object);
  17302. } else {
  17303. iterator.call(receiver, object[k], k, object);
  17304. }
  17305. }
  17306. }
  17307. };
  17308. var forEach = function forEach(list, iterator, thisArg) {
  17309. if (!isCallable(iterator)) {
  17310. throw new TypeError('iterator must be a function');
  17311. }
  17312. var receiver;
  17313. if (arguments.length >= 3) {
  17314. receiver = thisArg;
  17315. }
  17316. if (toStr.call(list) === '[object Array]') {
  17317. forEachArray(list, iterator, receiver);
  17318. } else if (typeof list === 'string') {
  17319. forEachString(list, iterator, receiver);
  17320. } else {
  17321. forEachObject(list, iterator, receiver);
  17322. }
  17323. };
  17324. module.exports = forEach;
  17325. },{"is-callable":367}],346:[function(require,module,exports){
  17326. 'use strict';
  17327. /* eslint no-invalid-this: 1 */
  17328. var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
  17329. var slice = Array.prototype.slice;
  17330. var toStr = Object.prototype.toString;
  17331. var funcType = '[object Function]';
  17332. module.exports = function bind(that) {
  17333. var target = this;
  17334. if (typeof target !== 'function' || toStr.call(target) !== funcType) {
  17335. throw new TypeError(ERROR_MESSAGE + target);
  17336. }
  17337. var args = slice.call(arguments, 1);
  17338. var bound;
  17339. var binder = function () {
  17340. if (this instanceof bound) {
  17341. var result = target.apply(
  17342. this,
  17343. args.concat(slice.call(arguments))
  17344. );
  17345. if (Object(result) === result) {
  17346. return result;
  17347. }
  17348. return this;
  17349. } else {
  17350. return target.apply(
  17351. that,
  17352. args.concat(slice.call(arguments))
  17353. );
  17354. }
  17355. };
  17356. var boundLength = Math.max(0, target.length - args.length);
  17357. var boundArgs = [];
  17358. for (var i = 0; i < boundLength; i++) {
  17359. boundArgs.push('$' + i);
  17360. }
  17361. bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
  17362. if (target.prototype) {
  17363. var Empty = function Empty() {};
  17364. Empty.prototype = target.prototype;
  17365. bound.prototype = new Empty();
  17366. Empty.prototype = null;
  17367. }
  17368. return bound;
  17369. };
  17370. },{}],347:[function(require,module,exports){
  17371. 'use strict';
  17372. var implementation = require('./implementation');
  17373. module.exports = Function.prototype.bind || implementation;
  17374. },{"./implementation":346}],348:[function(require,module,exports){
  17375. 'use strict';
  17376. var undefined;
  17377. var $SyntaxError = SyntaxError;
  17378. var $Function = Function;
  17379. var $TypeError = TypeError;
  17380. // eslint-disable-next-line consistent-return
  17381. var getEvalledConstructor = function (expressionSyntax) {
  17382. try {
  17383. return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
  17384. } catch (e) {}
  17385. };
  17386. var $gOPD = Object.getOwnPropertyDescriptor;
  17387. if ($gOPD) {
  17388. try {
  17389. $gOPD({}, '');
  17390. } catch (e) {
  17391. $gOPD = null; // this is IE 8, which has a broken gOPD
  17392. }
  17393. }
  17394. var throwTypeError = function () {
  17395. throw new $TypeError();
  17396. };
  17397. var ThrowTypeError = $gOPD
  17398. ? (function () {
  17399. try {
  17400. // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
  17401. arguments.callee; // IE 8 does not throw here
  17402. return throwTypeError;
  17403. } catch (calleeThrows) {
  17404. try {
  17405. // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
  17406. return $gOPD(arguments, 'callee').get;
  17407. } catch (gOPDthrows) {
  17408. return throwTypeError;
  17409. }
  17410. }
  17411. }())
  17412. : throwTypeError;
  17413. var hasSymbols = require('has-symbols')();
  17414. var hasProto = require('has-proto')();
  17415. var getProto = Object.getPrototypeOf || (
  17416. hasProto
  17417. ? function (x) { return x.__proto__; } // eslint-disable-line no-proto
  17418. : null
  17419. );
  17420. var needsEval = {};
  17421. var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array);
  17422. var INTRINSICS = {
  17423. '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
  17424. '%Array%': Array,
  17425. '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
  17426. '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined,
  17427. '%AsyncFromSyncIteratorPrototype%': undefined,
  17428. '%AsyncFunction%': needsEval,
  17429. '%AsyncGenerator%': needsEval,
  17430. '%AsyncGeneratorFunction%': needsEval,
  17431. '%AsyncIteratorPrototype%': needsEval,
  17432. '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
  17433. '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
  17434. '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array,
  17435. '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array,
  17436. '%Boolean%': Boolean,
  17437. '%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
  17438. '%Date%': Date,
  17439. '%decodeURI%': decodeURI,
  17440. '%decodeURIComponent%': decodeURIComponent,
  17441. '%encodeURI%': encodeURI,
  17442. '%encodeURIComponent%': encodeURIComponent,
  17443. '%Error%': Error,
  17444. '%eval%': eval, // eslint-disable-line no-eval
  17445. '%EvalError%': EvalError,
  17446. '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
  17447. '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
  17448. '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
  17449. '%Function%': $Function,
  17450. '%GeneratorFunction%': needsEval,
  17451. '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
  17452. '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
  17453. '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
  17454. '%isFinite%': isFinite,
  17455. '%isNaN%': isNaN,
  17456. '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined,
  17457. '%JSON%': typeof JSON === 'object' ? JSON : undefined,
  17458. '%Map%': typeof Map === 'undefined' ? undefined : Map,
  17459. '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()),
  17460. '%Math%': Math,
  17461. '%Number%': Number,
  17462. '%Object%': Object,
  17463. '%parseFloat%': parseFloat,
  17464. '%parseInt%': parseInt,
  17465. '%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
  17466. '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
  17467. '%RangeError%': RangeError,
  17468. '%ReferenceError%': ReferenceError,
  17469. '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
  17470. '%RegExp%': RegExp,
  17471. '%Set%': typeof Set === 'undefined' ? undefined : Set,
  17472. '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()),
  17473. '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
  17474. '%String%': String,
  17475. '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined,
  17476. '%Symbol%': hasSymbols ? Symbol : undefined,
  17477. '%SyntaxError%': $SyntaxError,
  17478. '%ThrowTypeError%': ThrowTypeError,
  17479. '%TypedArray%': TypedArray,
  17480. '%TypeError%': $TypeError,
  17481. '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
  17482. '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
  17483. '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
  17484. '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
  17485. '%URIError%': URIError,
  17486. '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
  17487. '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
  17488. '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
  17489. };
  17490. if (getProto) {
  17491. try {
  17492. null.error; // eslint-disable-line no-unused-expressions
  17493. } catch (e) {
  17494. // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
  17495. var errorProto = getProto(getProto(e));
  17496. INTRINSICS['%Error.prototype%'] = errorProto;
  17497. }
  17498. }
  17499. var doEval = function doEval(name) {
  17500. var value;
  17501. if (name === '%AsyncFunction%') {
  17502. value = getEvalledConstructor('async function () {}');
  17503. } else if (name === '%GeneratorFunction%') {
  17504. value = getEvalledConstructor('function* () {}');
  17505. } else if (name === '%AsyncGeneratorFunction%') {
  17506. value = getEvalledConstructor('async function* () {}');
  17507. } else if (name === '%AsyncGenerator%') {
  17508. var fn = doEval('%AsyncGeneratorFunction%');
  17509. if (fn) {
  17510. value = fn.prototype;
  17511. }
  17512. } else if (name === '%AsyncIteratorPrototype%') {
  17513. var gen = doEval('%AsyncGenerator%');
  17514. if (gen && getProto) {
  17515. value = getProto(gen.prototype);
  17516. }
  17517. }
  17518. INTRINSICS[name] = value;
  17519. return value;
  17520. };
  17521. var LEGACY_ALIASES = {
  17522. '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
  17523. '%ArrayPrototype%': ['Array', 'prototype'],
  17524. '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
  17525. '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
  17526. '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
  17527. '%ArrayProto_values%': ['Array', 'prototype', 'values'],
  17528. '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
  17529. '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
  17530. '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
  17531. '%BooleanPrototype%': ['Boolean', 'prototype'],
  17532. '%DataViewPrototype%': ['DataView', 'prototype'],
  17533. '%DatePrototype%': ['Date', 'prototype'],
  17534. '%ErrorPrototype%': ['Error', 'prototype'],
  17535. '%EvalErrorPrototype%': ['EvalError', 'prototype'],
  17536. '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
  17537. '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
  17538. '%FunctionPrototype%': ['Function', 'prototype'],
  17539. '%Generator%': ['GeneratorFunction', 'prototype'],
  17540. '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
  17541. '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
  17542. '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
  17543. '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
  17544. '%JSONParse%': ['JSON', 'parse'],
  17545. '%JSONStringify%': ['JSON', 'stringify'],
  17546. '%MapPrototype%': ['Map', 'prototype'],
  17547. '%NumberPrototype%': ['Number', 'prototype'],
  17548. '%ObjectPrototype%': ['Object', 'prototype'],
  17549. '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
  17550. '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
  17551. '%PromisePrototype%': ['Promise', 'prototype'],
  17552. '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
  17553. '%Promise_all%': ['Promise', 'all'],
  17554. '%Promise_reject%': ['Promise', 'reject'],
  17555. '%Promise_resolve%': ['Promise', 'resolve'],
  17556. '%RangeErrorPrototype%': ['RangeError', 'prototype'],
  17557. '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
  17558. '%RegExpPrototype%': ['RegExp', 'prototype'],
  17559. '%SetPrototype%': ['Set', 'prototype'],
  17560. '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
  17561. '%StringPrototype%': ['String', 'prototype'],
  17562. '%SymbolPrototype%': ['Symbol', 'prototype'],
  17563. '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
  17564. '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
  17565. '%TypeErrorPrototype%': ['TypeError', 'prototype'],
  17566. '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
  17567. '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
  17568. '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
  17569. '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
  17570. '%URIErrorPrototype%': ['URIError', 'prototype'],
  17571. '%WeakMapPrototype%': ['WeakMap', 'prototype'],
  17572. '%WeakSetPrototype%': ['WeakSet', 'prototype']
  17573. };
  17574. var bind = require('function-bind');
  17575. var hasOwn = require('has');
  17576. var $concat = bind.call(Function.call, Array.prototype.concat);
  17577. var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
  17578. var $replace = bind.call(Function.call, String.prototype.replace);
  17579. var $strSlice = bind.call(Function.call, String.prototype.slice);
  17580. var $exec = bind.call(Function.call, RegExp.prototype.exec);
  17581. /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
  17582. var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
  17583. var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
  17584. var stringToPath = function stringToPath(string) {
  17585. var first = $strSlice(string, 0, 1);
  17586. var last = $strSlice(string, -1);
  17587. if (first === '%' && last !== '%') {
  17588. throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
  17589. } else if (last === '%' && first !== '%') {
  17590. throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
  17591. }
  17592. var result = [];
  17593. $replace(string, rePropName, function (match, number, quote, subString) {
  17594. result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
  17595. });
  17596. return result;
  17597. };
  17598. /* end adaptation */
  17599. var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
  17600. var intrinsicName = name;
  17601. var alias;
  17602. if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
  17603. alias = LEGACY_ALIASES[intrinsicName];
  17604. intrinsicName = '%' + alias[0] + '%';
  17605. }
  17606. if (hasOwn(INTRINSICS, intrinsicName)) {
  17607. var value = INTRINSICS[intrinsicName];
  17608. if (value === needsEval) {
  17609. value = doEval(intrinsicName);
  17610. }
  17611. if (typeof value === 'undefined' && !allowMissing) {
  17612. throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
  17613. }
  17614. return {
  17615. alias: alias,
  17616. name: intrinsicName,
  17617. value: value
  17618. };
  17619. }
  17620. throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
  17621. };
  17622. module.exports = function GetIntrinsic(name, allowMissing) {
  17623. if (typeof name !== 'string' || name.length === 0) {
  17624. throw new $TypeError('intrinsic name must be a non-empty string');
  17625. }
  17626. if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
  17627. throw new $TypeError('"allowMissing" argument must be a boolean');
  17628. }
  17629. if ($exec(/^%?[^%]*%?$/, name) === null) {
  17630. throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
  17631. }
  17632. var parts = stringToPath(name);
  17633. var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
  17634. var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
  17635. var intrinsicRealName = intrinsic.name;
  17636. var value = intrinsic.value;
  17637. var skipFurtherCaching = false;
  17638. var alias = intrinsic.alias;
  17639. if (alias) {
  17640. intrinsicBaseName = alias[0];
  17641. $spliceApply(parts, $concat([0, 1], alias));
  17642. }
  17643. for (var i = 1, isOwn = true; i < parts.length; i += 1) {
  17644. var part = parts[i];
  17645. var first = $strSlice(part, 0, 1);
  17646. var last = $strSlice(part, -1);
  17647. if (
  17648. (
  17649. (first === '"' || first === "'" || first === '`')
  17650. || (last === '"' || last === "'" || last === '`')
  17651. )
  17652. && first !== last
  17653. ) {
  17654. throw new $SyntaxError('property names with quotes must have matching quotes');
  17655. }
  17656. if (part === 'constructor' || !isOwn) {
  17657. skipFurtherCaching = true;
  17658. }
  17659. intrinsicBaseName += '.' + part;
  17660. intrinsicRealName = '%' + intrinsicBaseName + '%';
  17661. if (hasOwn(INTRINSICS, intrinsicRealName)) {
  17662. value = INTRINSICS[intrinsicRealName];
  17663. } else if (value != null) {
  17664. if (!(part in value)) {
  17665. if (!allowMissing) {
  17666. throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
  17667. }
  17668. return void undefined;
  17669. }
  17670. if ($gOPD && (i + 1) >= parts.length) {
  17671. var desc = $gOPD(value, part);
  17672. isOwn = !!desc;
  17673. // By convention, when a data property is converted to an accessor
  17674. // property to emulate a data property that does not suffer from
  17675. // the override mistake, that accessor's getter is marked with
  17676. // an `originalValue` property. Here, when we detect this, we
  17677. // uphold the illusion by pretending to see that original data
  17678. // property, i.e., returning the value rather than the getter
  17679. // itself.
  17680. if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
  17681. value = desc.get;
  17682. } else {
  17683. value = value[part];
  17684. }
  17685. } else {
  17686. isOwn = hasOwn(value, part);
  17687. value = value[part];
  17688. }
  17689. if (isOwn && !skipFurtherCaching) {
  17690. INTRINSICS[intrinsicRealName] = value;
  17691. }
  17692. }
  17693. }
  17694. return value;
  17695. };
  17696. },{"function-bind":347,"has":354,"has-proto":350,"has-symbols":351}],349:[function(require,module,exports){
  17697. 'use strict';
  17698. var GetIntrinsic = require('get-intrinsic');
  17699. var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
  17700. if ($gOPD) {
  17701. try {
  17702. $gOPD([], 'length');
  17703. } catch (e) {
  17704. // IE 8 has a broken gOPD
  17705. $gOPD = null;
  17706. }
  17707. }
  17708. module.exports = $gOPD;
  17709. },{"get-intrinsic":348}],350:[function(require,module,exports){
  17710. 'use strict';
  17711. var test = {
  17712. foo: {}
  17713. };
  17714. var $Object = Object;
  17715. module.exports = function hasProto() {
  17716. return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object);
  17717. };
  17718. },{}],351:[function(require,module,exports){
  17719. 'use strict';
  17720. var origSymbol = typeof Symbol !== 'undefined' && Symbol;
  17721. var hasSymbolSham = require('./shams');
  17722. module.exports = function hasNativeSymbols() {
  17723. if (typeof origSymbol !== 'function') { return false; }
  17724. if (typeof Symbol !== 'function') { return false; }
  17725. if (typeof origSymbol('foo') !== 'symbol') { return false; }
  17726. if (typeof Symbol('bar') !== 'symbol') { return false; }
  17727. return hasSymbolSham();
  17728. };
  17729. },{"./shams":352}],352:[function(require,module,exports){
  17730. 'use strict';
  17731. /* eslint complexity: [2, 18], max-statements: [2, 33] */
  17732. module.exports = function hasSymbols() {
  17733. if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
  17734. if (typeof Symbol.iterator === 'symbol') { return true; }
  17735. var obj = {};
  17736. var sym = Symbol('test');
  17737. var symObj = Object(sym);
  17738. if (typeof sym === 'string') { return false; }
  17739. if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
  17740. if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
  17741. // temp disabled per https://github.com/ljharb/object.assign/issues/17
  17742. // if (sym instanceof Symbol) { return false; }
  17743. // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
  17744. // if (!(symObj instanceof Symbol)) { return false; }
  17745. // if (typeof Symbol.prototype.toString !== 'function') { return false; }
  17746. // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
  17747. var symVal = 42;
  17748. obj[sym] = symVal;
  17749. for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
  17750. if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
  17751. if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
  17752. var syms = Object.getOwnPropertySymbols(obj);
  17753. if (syms.length !== 1 || syms[0] !== sym) { return false; }
  17754. if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
  17755. if (typeof Object.getOwnPropertyDescriptor === 'function') {
  17756. var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
  17757. if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
  17758. }
  17759. return true;
  17760. };
  17761. },{}],353:[function(require,module,exports){
  17762. 'use strict';
  17763. var hasSymbols = require('has-symbols/shams');
  17764. module.exports = function hasToStringTagShams() {
  17765. return hasSymbols() && !!Symbol.toStringTag;
  17766. };
  17767. },{"has-symbols/shams":352}],354:[function(require,module,exports){
  17768. 'use strict';
  17769. var bind = require('function-bind');
  17770. module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
  17771. },{"function-bind":347}],355:[function(require,module,exports){
  17772. var http = require('http')
  17773. var url = require('url')
  17774. var https = module.exports
  17775. for (var key in http) {
  17776. if (http.hasOwnProperty(key)) https[key] = http[key]
  17777. }
  17778. https.request = function (params, cb) {
  17779. params = validateParams(params)
  17780. return http.request.call(this, params, cb)
  17781. }
  17782. https.get = function (params, cb) {
  17783. params = validateParams(params)
  17784. return http.get.call(this, params, cb)
  17785. }
  17786. function validateParams (params) {
  17787. if (typeof params === 'string') {
  17788. params = url.parse(params)
  17789. }
  17790. if (!params.protocol) {
  17791. params.protocol = 'https:'
  17792. }
  17793. if (params.protocol !== 'https:') {
  17794. throw new Error('Protocol "' + params.protocol + '" not supported. Expected "https:"')
  17795. }
  17796. return params
  17797. }
  17798. },{"http":468,"url":472}],356:[function(require,module,exports){
  17799. /*!
  17800. * humanize-ms - index.js
  17801. * Copyright(c) 2014 dead_horse <dead_horse@qq.com>
  17802. * MIT Licensed
  17803. */
  17804. 'use strict';
  17805. /**
  17806. * Module dependencies.
  17807. */
  17808. var util = require('util');
  17809. var ms = require('ms');
  17810. module.exports = function (t) {
  17811. if (typeof t === 'number') return t;
  17812. var r = ms(t);
  17813. if (r === undefined) {
  17814. var err = new Error(util.format('humanize-ms(%j) result undefined', t));
  17815. console.warn(err.stack);
  17816. }
  17817. return r;
  17818. };
  17819. },{"ms":376,"util":419}],357:[function(require,module,exports){
  17820. /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
  17821. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  17822. var e, m
  17823. var eLen = (nBytes * 8) - mLen - 1
  17824. var eMax = (1 << eLen) - 1
  17825. var eBias = eMax >> 1
  17826. var nBits = -7
  17827. var i = isLE ? (nBytes - 1) : 0
  17828. var d = isLE ? -1 : 1
  17829. var s = buffer[offset + i]
  17830. i += d
  17831. e = s & ((1 << (-nBits)) - 1)
  17832. s >>= (-nBits)
  17833. nBits += eLen
  17834. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  17835. m = e & ((1 << (-nBits)) - 1)
  17836. e >>= (-nBits)
  17837. nBits += mLen
  17838. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  17839. if (e === 0) {
  17840. e = 1 - eBias
  17841. } else if (e === eMax) {
  17842. return m ? NaN : ((s ? -1 : 1) * Infinity)
  17843. } else {
  17844. m = m + Math.pow(2, mLen)
  17845. e = e - eBias
  17846. }
  17847. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  17848. }
  17849. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  17850. var e, m, c
  17851. var eLen = (nBytes * 8) - mLen - 1
  17852. var eMax = (1 << eLen) - 1
  17853. var eBias = eMax >> 1
  17854. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  17855. var i = isLE ? 0 : (nBytes - 1)
  17856. var d = isLE ? 1 : -1
  17857. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  17858. value = Math.abs(value)
  17859. if (isNaN(value) || value === Infinity) {
  17860. m = isNaN(value) ? 1 : 0
  17861. e = eMax
  17862. } else {
  17863. e = Math.floor(Math.log(value) / Math.LN2)
  17864. if (value * (c = Math.pow(2, -e)) < 1) {
  17865. e--
  17866. c *= 2
  17867. }
  17868. if (e + eBias >= 1) {
  17869. value += rt / c
  17870. } else {
  17871. value += rt * Math.pow(2, 1 - eBias)
  17872. }
  17873. if (value * c >= 2) {
  17874. e++
  17875. c /= 2
  17876. }
  17877. if (e + eBias >= eMax) {
  17878. m = 0
  17879. e = eMax
  17880. } else if (e + eBias >= 1) {
  17881. m = ((value * c) - 1) * Math.pow(2, mLen)
  17882. e = e + eBias
  17883. } else {
  17884. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  17885. e = 0
  17886. }
  17887. }
  17888. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  17889. e = (e << mLen) | m
  17890. eLen += mLen
  17891. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  17892. buffer[offset + i - d] |= s * 128
  17893. }
  17894. },{}],358:[function(require,module,exports){
  17895. 'use strict';
  17896. var types = [
  17897. require('./nextTick'),
  17898. require('./queueMicrotask'),
  17899. require('./mutation.js'),
  17900. require('./messageChannel'),
  17901. require('./stateChange'),
  17902. require('./timeout')
  17903. ];
  17904. var draining;
  17905. var currentQueue;
  17906. var queueIndex = -1;
  17907. var queue = [];
  17908. var scheduled = false;
  17909. function cleanUpNextTick() {
  17910. if (!draining || !currentQueue) {
  17911. return;
  17912. }
  17913. draining = false;
  17914. if (currentQueue.length) {
  17915. queue = currentQueue.concat(queue);
  17916. } else {
  17917. queueIndex = -1;
  17918. }
  17919. if (queue.length) {
  17920. nextTick();
  17921. }
  17922. }
  17923. //named nextTick for less confusing stack traces
  17924. function nextTick() {
  17925. if (draining) {
  17926. return;
  17927. }
  17928. scheduled = false;
  17929. draining = true;
  17930. var len = queue.length;
  17931. var timeout = setTimeout(cleanUpNextTick);
  17932. while (len) {
  17933. currentQueue = queue;
  17934. queue = [];
  17935. while (currentQueue && ++queueIndex < len) {
  17936. currentQueue[queueIndex].run();
  17937. }
  17938. queueIndex = -1;
  17939. len = queue.length;
  17940. }
  17941. currentQueue = null;
  17942. queueIndex = -1;
  17943. draining = false;
  17944. clearTimeout(timeout);
  17945. }
  17946. var scheduleDrain;
  17947. var i = -1;
  17948. var len = types.length;
  17949. while (++i < len) {
  17950. if (types[i] && types[i].test && types[i].test()) {
  17951. scheduleDrain = types[i].install(nextTick);
  17952. break;
  17953. }
  17954. }
  17955. // v8 likes predictible objects
  17956. function Item(fun, array) {
  17957. this.fun = fun;
  17958. this.array = array;
  17959. }
  17960. Item.prototype.run = function () {
  17961. var fun = this.fun;
  17962. var array = this.array;
  17963. switch (array.length) {
  17964. case 0:
  17965. return fun();
  17966. case 1:
  17967. return fun(array[0]);
  17968. case 2:
  17969. return fun(array[0], array[1]);
  17970. case 3:
  17971. return fun(array[0], array[1], array[2]);
  17972. default:
  17973. return fun.apply(null, array);
  17974. }
  17975. };
  17976. module.exports = immediate;
  17977. function immediate(task) {
  17978. var args = new Array(arguments.length - 1);
  17979. if (arguments.length > 1) {
  17980. for (var i = 1; i < arguments.length; i++) {
  17981. args[i - 1] = arguments[i];
  17982. }
  17983. }
  17984. queue.push(new Item(task, args));
  17985. if (!scheduled && !draining) {
  17986. scheduled = true;
  17987. scheduleDrain();
  17988. }
  17989. }
  17990. },{"./messageChannel":359,"./mutation.js":360,"./nextTick":89,"./queueMicrotask":361,"./stateChange":362,"./timeout":363}],359:[function(require,module,exports){
  17991. (function (global){(function (){
  17992. 'use strict';
  17993. exports.test = function () {
  17994. if (global.setImmediate) {
  17995. // we can only get here in IE10
  17996. // which doesn't handel postMessage well
  17997. return false;
  17998. }
  17999. return typeof global.MessageChannel !== 'undefined';
  18000. };
  18001. exports.install = function (func) {
  18002. var channel = new global.MessageChannel();
  18003. channel.port1.onmessage = func;
  18004. return function () {
  18005. channel.port2.postMessage(0);
  18006. };
  18007. };
  18008. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  18009. },{}],360:[function(require,module,exports){
  18010. (function (global){(function (){
  18011. 'use strict';
  18012. //based off rsvp https://github.com/tildeio/rsvp.js
  18013. //license https://github.com/tildeio/rsvp.js/blob/master/LICENSE
  18014. //https://github.com/tildeio/rsvp.js/blob/master/lib/rsvp/asap.js
  18015. var Mutation = global.MutationObserver || global.WebKitMutationObserver;
  18016. exports.test = function () {
  18017. return Mutation;
  18018. };
  18019. exports.install = function (handle) {
  18020. var called = 0;
  18021. var observer = new Mutation(handle);
  18022. var element = global.document.createTextNode('');
  18023. observer.observe(element, {
  18024. characterData: true
  18025. });
  18026. return function () {
  18027. element.data = (called = ++called % 2);
  18028. };
  18029. };
  18030. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  18031. },{}],361:[function(require,module,exports){
  18032. (function (global){(function (){
  18033. 'use strict';
  18034. exports.test = function () {
  18035. return typeof global.queueMicrotask === 'function';
  18036. };
  18037. exports.install = function (func) {
  18038. return function () {
  18039. global.queueMicrotask(func);
  18040. };
  18041. };
  18042. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  18043. },{}],362:[function(require,module,exports){
  18044. (function (global){(function (){
  18045. 'use strict';
  18046. exports.test = function () {
  18047. return 'document' in global && 'onreadystatechange' in global.document.createElement('script');
  18048. };
  18049. exports.install = function (handle) {
  18050. return function () {
  18051. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  18052. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  18053. var scriptEl = global.document.createElement('script');
  18054. scriptEl.onreadystatechange = function () {
  18055. handle();
  18056. scriptEl.onreadystatechange = null;
  18057. scriptEl.parentNode.removeChild(scriptEl);
  18058. scriptEl = null;
  18059. };
  18060. global.document.documentElement.appendChild(scriptEl);
  18061. return handle;
  18062. };
  18063. };
  18064. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  18065. },{}],363:[function(require,module,exports){
  18066. 'use strict';
  18067. exports.test = function () {
  18068. return true;
  18069. };
  18070. exports.install = function (t) {
  18071. return function () {
  18072. setTimeout(t, 0);
  18073. };
  18074. };
  18075. },{}],364:[function(require,module,exports){
  18076. if (typeof Object.create === 'function') {
  18077. // implementation from standard node.js 'util' module
  18078. module.exports = function inherits(ctor, superCtor) {
  18079. if (superCtor) {
  18080. ctor.super_ = superCtor
  18081. ctor.prototype = Object.create(superCtor.prototype, {
  18082. constructor: {
  18083. value: ctor,
  18084. enumerable: false,
  18085. writable: true,
  18086. configurable: true
  18087. }
  18088. })
  18089. }
  18090. };
  18091. } else {
  18092. // old school shim for old browsers
  18093. module.exports = function inherits(ctor, superCtor) {
  18094. if (superCtor) {
  18095. ctor.super_ = superCtor
  18096. var TempCtor = function () {}
  18097. TempCtor.prototype = superCtor.prototype
  18098. ctor.prototype = new TempCtor()
  18099. ctor.prototype.constructor = ctor
  18100. }
  18101. }
  18102. }
  18103. },{}],365:[function(require,module,exports){
  18104. 'use strict';
  18105. var hasToStringTag = require('has-tostringtag/shams')();
  18106. var callBound = require('call-bind/callBound');
  18107. var $toString = callBound('Object.prototype.toString');
  18108. var isStandardArguments = function isArguments(value) {
  18109. if (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) {
  18110. return false;
  18111. }
  18112. return $toString(value) === '[object Arguments]';
  18113. };
  18114. var isLegacyArguments = function isArguments(value) {
  18115. if (isStandardArguments(value)) {
  18116. return true;
  18117. }
  18118. return value !== null &&
  18119. typeof value === 'object' &&
  18120. typeof value.length === 'number' &&
  18121. value.length >= 0 &&
  18122. $toString(value) !== '[object Array]' &&
  18123. $toString(value.callee) === '[object Function]';
  18124. };
  18125. var supportsStandardArguments = (function () {
  18126. return isStandardArguments(arguments);
  18127. }());
  18128. isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests
  18129. module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;
  18130. },{"call-bind/callBound":92,"has-tostringtag/shams":353}],366:[function(require,module,exports){
  18131. /*!
  18132. * Determine if an object is a Buffer
  18133. *
  18134. * @author Feross Aboukhadijeh <https://feross.org>
  18135. * @license MIT
  18136. */
  18137. // The _isBuffer check is for Safari 5-7 support, because it's missing
  18138. // Object.prototype.constructor. Remove this eventually
  18139. module.exports = function (obj) {
  18140. return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
  18141. }
  18142. function isBuffer (obj) {
  18143. return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
  18144. }
  18145. // For Node v0.10 support. Remove this eventually.
  18146. function isSlowBuffer (obj) {
  18147. return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
  18148. }
  18149. },{}],367:[function(require,module,exports){
  18150. 'use strict';
  18151. var fnToStr = Function.prototype.toString;
  18152. var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;
  18153. var badArrayLike;
  18154. var isCallableMarker;
  18155. if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
  18156. try {
  18157. badArrayLike = Object.defineProperty({}, 'length', {
  18158. get: function () {
  18159. throw isCallableMarker;
  18160. }
  18161. });
  18162. isCallableMarker = {};
  18163. // eslint-disable-next-line no-throw-literal
  18164. reflectApply(function () { throw 42; }, null, badArrayLike);
  18165. } catch (_) {
  18166. if (_ !== isCallableMarker) {
  18167. reflectApply = null;
  18168. }
  18169. }
  18170. } else {
  18171. reflectApply = null;
  18172. }
  18173. var constructorRegex = /^\s*class\b/;
  18174. var isES6ClassFn = function isES6ClassFunction(value) {
  18175. try {
  18176. var fnStr = fnToStr.call(value);
  18177. return constructorRegex.test(fnStr);
  18178. } catch (e) {
  18179. return false; // not a function
  18180. }
  18181. };
  18182. var tryFunctionObject = function tryFunctionToStr(value) {
  18183. try {
  18184. if (isES6ClassFn(value)) { return false; }
  18185. fnToStr.call(value);
  18186. return true;
  18187. } catch (e) {
  18188. return false;
  18189. }
  18190. };
  18191. var toStr = Object.prototype.toString;
  18192. var objectClass = '[object Object]';
  18193. var fnClass = '[object Function]';
  18194. var genClass = '[object GeneratorFunction]';
  18195. var ddaClass = '[object HTMLAllCollection]'; // IE 11
  18196. var ddaClass2 = '[object HTML document.all class]';
  18197. var ddaClass3 = '[object HTMLCollection]'; // IE 9-10
  18198. var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag`
  18199. var isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing
  18200. var isDDA = function isDocumentDotAll() { return false; };
  18201. if (typeof document === 'object') {
  18202. // Firefox 3 canonicalizes DDA to undefined when it's not accessed directly
  18203. var all = document.all;
  18204. if (toStr.call(all) === toStr.call(document.all)) {
  18205. isDDA = function isDocumentDotAll(value) {
  18206. /* globals document: false */
  18207. // in IE 6-8, typeof document.all is "object" and it's truthy
  18208. if ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) {
  18209. try {
  18210. var str = toStr.call(value);
  18211. return (
  18212. str === ddaClass
  18213. || str === ddaClass2
  18214. || str === ddaClass3 // opera 12.16
  18215. || str === objectClass // IE 6-8
  18216. ) && value('') == null; // eslint-disable-line eqeqeq
  18217. } catch (e) { /**/ }
  18218. }
  18219. return false;
  18220. };
  18221. }
  18222. }
  18223. module.exports = reflectApply
  18224. ? function isCallable(value) {
  18225. if (isDDA(value)) { return true; }
  18226. if (!value) { return false; }
  18227. if (typeof value !== 'function' && typeof value !== 'object') { return false; }
  18228. try {
  18229. reflectApply(value, null, badArrayLike);
  18230. } catch (e) {
  18231. if (e !== isCallableMarker) { return false; }
  18232. }
  18233. return !isES6ClassFn(value) && tryFunctionObject(value);
  18234. }
  18235. : function isCallable(value) {
  18236. if (isDDA(value)) { return true; }
  18237. if (!value) { return false; }
  18238. if (typeof value !== 'function' && typeof value !== 'object') { return false; }
  18239. if (hasToStringTag) { return tryFunctionObject(value); }
  18240. if (isES6ClassFn(value)) { return false; }
  18241. var strClass = toStr.call(value);
  18242. if (strClass !== fnClass && strClass !== genClass && !(/^\[object HTML/).test(strClass)) { return false; }
  18243. return tryFunctionObject(value);
  18244. };
  18245. },{}],368:[function(require,module,exports){
  18246. 'use strict';
  18247. var toStr = Object.prototype.toString;
  18248. var fnToStr = Function.prototype.toString;
  18249. var isFnRegex = /^\s*(?:function)?\*/;
  18250. var hasToStringTag = require('has-tostringtag/shams')();
  18251. var getProto = Object.getPrototypeOf;
  18252. var getGeneratorFunc = function () { // eslint-disable-line consistent-return
  18253. if (!hasToStringTag) {
  18254. return false;
  18255. }
  18256. try {
  18257. return Function('return function*() {}')();
  18258. } catch (e) {
  18259. }
  18260. };
  18261. var GeneratorFunction;
  18262. module.exports = function isGeneratorFunction(fn) {
  18263. if (typeof fn !== 'function') {
  18264. return false;
  18265. }
  18266. if (isFnRegex.test(fnToStr.call(fn))) {
  18267. return true;
  18268. }
  18269. if (!hasToStringTag) {
  18270. var str = toStr.call(fn);
  18271. return str === '[object GeneratorFunction]';
  18272. }
  18273. if (!getProto) {
  18274. return false;
  18275. }
  18276. if (typeof GeneratorFunction === 'undefined') {
  18277. var generatorFunc = getGeneratorFunc();
  18278. GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false;
  18279. }
  18280. return getProto(fn) === GeneratorFunction;
  18281. };
  18282. },{"has-tostringtag/shams":353}],369:[function(require,module,exports){
  18283. 'use strict';
  18284. var whichTypedArray = require('which-typed-array');
  18285. module.exports = function isTypedArray(value) {
  18286. return !!whichTypedArray(value);
  18287. };
  18288. },{"which-typed-array":420}],370:[function(require,module,exports){
  18289. var toString = {}.toString;
  18290. module.exports = Array.isArray || function (arr) {
  18291. return toString.call(arr) == '[object Array]';
  18292. };
  18293. },{}],371:[function(require,module,exports){
  18294. (function (global){(function (){
  18295. /*
  18296. * base64.js
  18297. *
  18298. * Licensed under the BSD 3-Clause License.
  18299. * http://opensource.org/licenses/BSD-3-Clause
  18300. *
  18301. * References:
  18302. * http://en.wikipedia.org/wiki/Base64
  18303. */
  18304. ;(function (global, factory) {
  18305. typeof exports === 'object' && typeof module !== 'undefined'
  18306. ? module.exports = factory(global)
  18307. : typeof define === 'function' && define.amd
  18308. ? define(factory) : factory(global)
  18309. }((
  18310. typeof self !== 'undefined' ? self
  18311. : typeof window !== 'undefined' ? window
  18312. : typeof global !== 'undefined' ? global
  18313. : this
  18314. ), function(global) {
  18315. 'use strict';
  18316. // existing version for noConflict()
  18317. global = global || {};
  18318. var _Base64 = global.Base64;
  18319. var version = "2.6.4";
  18320. // constants
  18321. var b64chars
  18322. = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  18323. var b64tab = function(bin) {
  18324. var t = {};
  18325. for (var i = 0, l = bin.length; i < l; i++) t[bin.charAt(i)] = i;
  18326. return t;
  18327. }(b64chars);
  18328. var fromCharCode = String.fromCharCode;
  18329. // encoder stuff
  18330. var cb_utob = function(c) {
  18331. if (c.length < 2) {
  18332. var cc = c.charCodeAt(0);
  18333. return cc < 0x80 ? c
  18334. : cc < 0x800 ? (fromCharCode(0xc0 | (cc >>> 6))
  18335. + fromCharCode(0x80 | (cc & 0x3f)))
  18336. : (fromCharCode(0xe0 | ((cc >>> 12) & 0x0f))
  18337. + fromCharCode(0x80 | ((cc >>> 6) & 0x3f))
  18338. + fromCharCode(0x80 | ( cc & 0x3f)));
  18339. } else {
  18340. var cc = 0x10000
  18341. + (c.charCodeAt(0) - 0xD800) * 0x400
  18342. + (c.charCodeAt(1) - 0xDC00);
  18343. return (fromCharCode(0xf0 | ((cc >>> 18) & 0x07))
  18344. + fromCharCode(0x80 | ((cc >>> 12) & 0x3f))
  18345. + fromCharCode(0x80 | ((cc >>> 6) & 0x3f))
  18346. + fromCharCode(0x80 | ( cc & 0x3f)));
  18347. }
  18348. };
  18349. var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
  18350. var utob = function(u) {
  18351. return u.replace(re_utob, cb_utob);
  18352. };
  18353. var cb_encode = function(ccc) {
  18354. var padlen = [0, 2, 1][ccc.length % 3],
  18355. ord = ccc.charCodeAt(0) << 16
  18356. | ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8)
  18357. | ((ccc.length > 2 ? ccc.charCodeAt(2) : 0)),
  18358. chars = [
  18359. b64chars.charAt( ord >>> 18),
  18360. b64chars.charAt((ord >>> 12) & 63),
  18361. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  18362. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  18363. ];
  18364. return chars.join('');
  18365. };
  18366. var btoa = global.btoa && typeof global.btoa == 'function'
  18367. ? function(b){ return global.btoa(b) } : function(b) {
  18368. if (b.match(/[^\x00-\xFF]/)) throw new RangeError(
  18369. 'The string contains invalid characters.'
  18370. );
  18371. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  18372. };
  18373. var _encode = function(u) {
  18374. return btoa(utob(String(u)));
  18375. };
  18376. var mkUriSafe = function (b64) {
  18377. return b64.replace(/[+\/]/g, function(m0) {
  18378. return m0 == '+' ? '-' : '_';
  18379. }).replace(/=/g, '');
  18380. };
  18381. var encode = function(u, urisafe) {
  18382. return urisafe ? mkUriSafe(_encode(u)) : _encode(u);
  18383. };
  18384. var encodeURI = function(u) { return encode(u, true) };
  18385. var fromUint8Array;
  18386. if (global.Uint8Array) fromUint8Array = function(a, urisafe) {
  18387. // return btoa(fromCharCode.apply(null, a));
  18388. var b64 = '';
  18389. for (var i = 0, l = a.length; i < l; i += 3) {
  18390. var a0 = a[i], a1 = a[i+1], a2 = a[i+2];
  18391. var ord = a0 << 16 | a1 << 8 | a2;
  18392. b64 += b64chars.charAt( ord >>> 18)
  18393. + b64chars.charAt((ord >>> 12) & 63)
  18394. + ( typeof a1 != 'undefined'
  18395. ? b64chars.charAt((ord >>> 6) & 63) : '=')
  18396. + ( typeof a2 != 'undefined'
  18397. ? b64chars.charAt( ord & 63) : '=');
  18398. }
  18399. return urisafe ? mkUriSafe(b64) : b64;
  18400. };
  18401. // decoder stuff
  18402. var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
  18403. var cb_btou = function(cccc) {
  18404. switch(cccc.length) {
  18405. case 4:
  18406. var cp = ((0x07 & cccc.charCodeAt(0)) << 18)
  18407. | ((0x3f & cccc.charCodeAt(1)) << 12)
  18408. | ((0x3f & cccc.charCodeAt(2)) << 6)
  18409. | (0x3f & cccc.charCodeAt(3)),
  18410. offset = cp - 0x10000;
  18411. return (fromCharCode((offset >>> 10) + 0xD800)
  18412. + fromCharCode((offset & 0x3FF) + 0xDC00));
  18413. case 3:
  18414. return fromCharCode(
  18415. ((0x0f & cccc.charCodeAt(0)) << 12)
  18416. | ((0x3f & cccc.charCodeAt(1)) << 6)
  18417. | (0x3f & cccc.charCodeAt(2))
  18418. );
  18419. default:
  18420. return fromCharCode(
  18421. ((0x1f & cccc.charCodeAt(0)) << 6)
  18422. | (0x3f & cccc.charCodeAt(1))
  18423. );
  18424. }
  18425. };
  18426. var btou = function(b) {
  18427. return b.replace(re_btou, cb_btou);
  18428. };
  18429. var cb_decode = function(cccc) {
  18430. var len = cccc.length,
  18431. padlen = len % 4,
  18432. n = (len > 0 ? b64tab[cccc.charAt(0)] << 18 : 0)
  18433. | (len > 1 ? b64tab[cccc.charAt(1)] << 12 : 0)
  18434. | (len > 2 ? b64tab[cccc.charAt(2)] << 6 : 0)
  18435. | (len > 3 ? b64tab[cccc.charAt(3)] : 0),
  18436. chars = [
  18437. fromCharCode( n >>> 16),
  18438. fromCharCode((n >>> 8) & 0xff),
  18439. fromCharCode( n & 0xff)
  18440. ];
  18441. chars.length -= [0, 0, 2, 1][padlen];
  18442. return chars.join('');
  18443. };
  18444. var _atob = global.atob && typeof global.atob == 'function'
  18445. ? function(a){ return global.atob(a) } : function(a){
  18446. return a.replace(/\S{1,4}/g, cb_decode);
  18447. };
  18448. var atob = function(a) {
  18449. return _atob(String(a).replace(/[^A-Za-z0-9\+\/]/g, ''));
  18450. };
  18451. var _decode = function(a) { return btou(_atob(a)) };
  18452. var _fromURI = function(a) {
  18453. return String(a).replace(/[-_]/g, function(m0) {
  18454. return m0 == '-' ? '+' : '/'
  18455. }).replace(/[^A-Za-z0-9\+\/]/g, '');
  18456. };
  18457. var decode = function(a){
  18458. return _decode(_fromURI(a));
  18459. };
  18460. var toUint8Array;
  18461. if (global.Uint8Array) toUint8Array = function(a) {
  18462. return Uint8Array.from(atob(_fromURI(a)), function(c) {
  18463. return c.charCodeAt(0);
  18464. });
  18465. };
  18466. var noConflict = function() {
  18467. var Base64 = global.Base64;
  18468. global.Base64 = _Base64;
  18469. return Base64;
  18470. };
  18471. // export Base64
  18472. global.Base64 = {
  18473. VERSION: version,
  18474. atob: atob,
  18475. btoa: btoa,
  18476. fromBase64: decode,
  18477. toBase64: encode,
  18478. utob: utob,
  18479. encode: encode,
  18480. encodeURI: encodeURI,
  18481. btou: btou,
  18482. decode: decode,
  18483. noConflict: noConflict,
  18484. fromUint8Array: fromUint8Array,
  18485. toUint8Array: toUint8Array
  18486. };
  18487. // if ES5 is available, make Base64.extendString() available
  18488. if (typeof Object.defineProperty === 'function') {
  18489. var noEnum = function(v){
  18490. return {value:v,enumerable:false,writable:true,configurable:true};
  18491. };
  18492. global.Base64.extendString = function () {
  18493. Object.defineProperty(
  18494. String.prototype, 'fromBase64', noEnum(function () {
  18495. return decode(this)
  18496. }));
  18497. Object.defineProperty(
  18498. String.prototype, 'toBase64', noEnum(function (urisafe) {
  18499. return encode(this, urisafe)
  18500. }));
  18501. Object.defineProperty(
  18502. String.prototype, 'toBase64URI', noEnum(function () {
  18503. return encode(this, true)
  18504. }));
  18505. };
  18506. }
  18507. //
  18508. // export Base64 to the namespace
  18509. //
  18510. if (global['Meteor']) { // Meteor.js
  18511. Base64 = global.Base64;
  18512. }
  18513. // module.exports and AMD are mutually exclusive.
  18514. // module.exports has precedence.
  18515. if (typeof module !== 'undefined' && module.exports) {
  18516. module.exports.Base64 = global.Base64;
  18517. }
  18518. else if (typeof define === 'function' && define.amd) {
  18519. // AMD. Register as an anonymous module.
  18520. define([], function(){ return global.Base64 });
  18521. }
  18522. // that's it!
  18523. return {Base64: global.Base64}
  18524. }));
  18525. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  18526. },{}],372:[function(require,module,exports){
  18527. /*!
  18528. * merge-descriptors
  18529. * Copyright(c) 2014 Jonathan Ong
  18530. * Copyright(c) 2015 Douglas Christopher Wilson
  18531. * MIT Licensed
  18532. */
  18533. 'use strict'
  18534. /**
  18535. * Module exports.
  18536. * @public
  18537. */
  18538. module.exports = merge
  18539. /**
  18540. * Module variables.
  18541. * @private
  18542. */
  18543. var hasOwnProperty = Object.prototype.hasOwnProperty
  18544. /**
  18545. * Merge the property descriptors of `src` into `dest`
  18546. *
  18547. * @param {object} dest Object to add descriptors to
  18548. * @param {object} src Object to clone descriptors from
  18549. * @param {boolean} [redefine=true] Redefine `dest` properties with `src` properties
  18550. * @returns {object} Reference to dest
  18551. * @public
  18552. */
  18553. function merge(dest, src, redefine) {
  18554. if (!dest) {
  18555. throw new TypeError('argument dest is required')
  18556. }
  18557. if (!src) {
  18558. throw new TypeError('argument src is required')
  18559. }
  18560. if (redefine === undefined) {
  18561. // Default to true
  18562. redefine = true
  18563. }
  18564. Object.getOwnPropertyNames(src).forEach(function forEachOwnPropertyName(name) {
  18565. if (!redefine && hasOwnProperty.call(dest, name)) {
  18566. // Skip desriptor
  18567. return
  18568. }
  18569. // Copy descriptor
  18570. var descriptor = Object.getOwnPropertyDescriptor(src, name)
  18571. Object.defineProperty(dest, name, descriptor)
  18572. })
  18573. return dest
  18574. }
  18575. },{}],373:[function(require,module,exports){
  18576. 'use strict';
  18577. /**
  18578. * @param typeMap [Object] Map of MIME type -> Array[extensions]
  18579. * @param ...
  18580. */
  18581. require("core-js/modules/es.array.map.js");
  18582. require("core-js/modules/es.regexp.exec.js");
  18583. require("core-js/modules/es.string.replace.js");
  18584. require("core-js/modules/es.regexp.constructor.js");
  18585. require("core-js/modules/es.regexp.to-string.js");
  18586. function Mime() {
  18587. this._types = Object.create(null);
  18588. this._extensions = Object.create(null);
  18589. for (var i = 0; i < arguments.length; i++) {
  18590. this.define(arguments[i]);
  18591. }
  18592. this.define = this.define.bind(this);
  18593. this.getType = this.getType.bind(this);
  18594. this.getExtension = this.getExtension.bind(this);
  18595. }
  18596. /**
  18597. * Define mimetype -> extension mappings. Each key is a mime-type that maps
  18598. * to an array of extensions associated with the type. The first extension is
  18599. * used as the default extension for the type.
  18600. *
  18601. * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']});
  18602. *
  18603. * If a type declares an extension that has already been defined, an error will
  18604. * be thrown. To suppress this error and force the extension to be associated
  18605. * with the new type, pass `force`=true. Alternatively, you may prefix the
  18606. * extension with "*" to map the type to extension, without mapping the
  18607. * extension to the type.
  18608. *
  18609. * e.g. mime.define({'audio/wav', ['wav']}, {'audio/x-wav', ['*wav']});
  18610. *
  18611. *
  18612. * @param map (Object) type definitions
  18613. * @param force (Boolean) if true, force overriding of existing definitions
  18614. */
  18615. Mime.prototype.define = function (typeMap, force) {
  18616. for (var type in typeMap) {
  18617. var extensions = typeMap[type].map(function (t) {
  18618. return t.toLowerCase();
  18619. });
  18620. type = type.toLowerCase();
  18621. for (var i = 0; i < extensions.length; i++) {
  18622. var ext = extensions[i]; // '*' prefix = not the preferred type for this extension. So fixup the
  18623. // extension, and skip it.
  18624. if (ext[0] === '*') {
  18625. continue;
  18626. }
  18627. if (!force && ext in this._types) {
  18628. throw new Error('Attempt to change mapping for "' + ext + '" extension from "' + this._types[ext] + '" to "' + type + '". Pass `force=true` to allow this, otherwise remove "' + ext + '" from the list of extensions for "' + type + '".');
  18629. }
  18630. this._types[ext] = type;
  18631. } // Use first extension as default
  18632. if (force || !this._extensions[type]) {
  18633. var _ext = extensions[0];
  18634. this._extensions[type] = _ext[0] !== '*' ? _ext : _ext.substr(1);
  18635. }
  18636. }
  18637. };
  18638. /**
  18639. * Lookup a mime type based on extension
  18640. */
  18641. Mime.prototype.getType = function (path) {
  18642. path = String(path);
  18643. var last = path.replace(/^.*[/\\]/, '').toLowerCase();
  18644. var ext = last.replace(/^.*\./, '').toLowerCase();
  18645. var hasPath = last.length < path.length;
  18646. var hasDot = ext.length < last.length - 1;
  18647. return (hasDot || !hasPath) && this._types[ext] || null;
  18648. };
  18649. /**
  18650. * Return file extension associated with a mime type
  18651. */
  18652. Mime.prototype.getExtension = function (type) {
  18653. type = /^\s*([^;\s]*)/.test(type) && RegExp.$1;
  18654. return type && this._extensions[type.toLowerCase()] || null;
  18655. };
  18656. module.exports = Mime;
  18657. },{"core-js/modules/es.array.map.js":280,"core-js/modules/es.regexp.constructor.js":299,"core-js/modules/es.regexp.exec.js":300,"core-js/modules/es.regexp.to-string.js":301,"core-js/modules/es.string.replace.js":305}],374:[function(require,module,exports){
  18658. 'use strict';
  18659. var Mime = require('./Mime');
  18660. module.exports = new Mime(require('./types/standard'));
  18661. },{"./Mime":373,"./types/standard":375}],375:[function(require,module,exports){
  18662. "use strict";
  18663. module.exports = {
  18664. "application/andrew-inset": ["ez"],
  18665. "application/applixware": ["aw"],
  18666. "application/atom+xml": ["atom"],
  18667. "application/atomcat+xml": ["atomcat"],
  18668. "application/atomdeleted+xml": ["atomdeleted"],
  18669. "application/atomsvc+xml": ["atomsvc"],
  18670. "application/atsc-dwd+xml": ["dwd"],
  18671. "application/atsc-held+xml": ["held"],
  18672. "application/atsc-rsat+xml": ["rsat"],
  18673. "application/bdoc": ["bdoc"],
  18674. "application/calendar+xml": ["xcs"],
  18675. "application/ccxml+xml": ["ccxml"],
  18676. "application/cdfx+xml": ["cdfx"],
  18677. "application/cdmi-capability": ["cdmia"],
  18678. "application/cdmi-container": ["cdmic"],
  18679. "application/cdmi-domain": ["cdmid"],
  18680. "application/cdmi-object": ["cdmio"],
  18681. "application/cdmi-queue": ["cdmiq"],
  18682. "application/cu-seeme": ["cu"],
  18683. "application/dash+xml": ["mpd"],
  18684. "application/davmount+xml": ["davmount"],
  18685. "application/docbook+xml": ["dbk"],
  18686. "application/dssc+der": ["dssc"],
  18687. "application/dssc+xml": ["xdssc"],
  18688. "application/ecmascript": ["es", "ecma"],
  18689. "application/emma+xml": ["emma"],
  18690. "application/emotionml+xml": ["emotionml"],
  18691. "application/epub+zip": ["epub"],
  18692. "application/exi": ["exi"],
  18693. "application/express": ["exp"],
  18694. "application/fdt+xml": ["fdt"],
  18695. "application/font-tdpfr": ["pfr"],
  18696. "application/geo+json": ["geojson"],
  18697. "application/gml+xml": ["gml"],
  18698. "application/gpx+xml": ["gpx"],
  18699. "application/gxf": ["gxf"],
  18700. "application/gzip": ["gz"],
  18701. "application/hjson": ["hjson"],
  18702. "application/hyperstudio": ["stk"],
  18703. "application/inkml+xml": ["ink", "inkml"],
  18704. "application/ipfix": ["ipfix"],
  18705. "application/its+xml": ["its"],
  18706. "application/java-archive": ["jar", "war", "ear"],
  18707. "application/java-serialized-object": ["ser"],
  18708. "application/java-vm": ["class"],
  18709. "application/javascript": ["js", "mjs"],
  18710. "application/json": ["json", "map"],
  18711. "application/json5": ["json5"],
  18712. "application/jsonml+json": ["jsonml"],
  18713. "application/ld+json": ["jsonld"],
  18714. "application/lgr+xml": ["lgr"],
  18715. "application/lost+xml": ["lostxml"],
  18716. "application/mac-binhex40": ["hqx"],
  18717. "application/mac-compactpro": ["cpt"],
  18718. "application/mads+xml": ["mads"],
  18719. "application/manifest+json": ["webmanifest"],
  18720. "application/marc": ["mrc"],
  18721. "application/marcxml+xml": ["mrcx"],
  18722. "application/mathematica": ["ma", "nb", "mb"],
  18723. "application/mathml+xml": ["mathml"],
  18724. "application/mbox": ["mbox"],
  18725. "application/mediaservercontrol+xml": ["mscml"],
  18726. "application/metalink+xml": ["metalink"],
  18727. "application/metalink4+xml": ["meta4"],
  18728. "application/mets+xml": ["mets"],
  18729. "application/mmt-aei+xml": ["maei"],
  18730. "application/mmt-usd+xml": ["musd"],
  18731. "application/mods+xml": ["mods"],
  18732. "application/mp21": ["m21", "mp21"],
  18733. "application/mp4": ["mp4s", "m4p"],
  18734. "application/msword": ["doc", "dot"],
  18735. "application/mxf": ["mxf"],
  18736. "application/n-quads": ["nq"],
  18737. "application/n-triples": ["nt"],
  18738. "application/node": ["cjs"],
  18739. "application/octet-stream": ["bin", "dms", "lrf", "mar", "so", "dist", "distz", "pkg", "bpk", "dump", "elc", "deploy", "exe", "dll", "deb", "dmg", "iso", "img", "msi", "msp", "msm", "buffer"],
  18740. "application/oda": ["oda"],
  18741. "application/oebps-package+xml": ["opf"],
  18742. "application/ogg": ["ogx"],
  18743. "application/omdoc+xml": ["omdoc"],
  18744. "application/onenote": ["onetoc", "onetoc2", "onetmp", "onepkg"],
  18745. "application/oxps": ["oxps"],
  18746. "application/p2p-overlay+xml": ["relo"],
  18747. "application/patch-ops-error+xml": ["xer"],
  18748. "application/pdf": ["pdf"],
  18749. "application/pgp-encrypted": ["pgp"],
  18750. "application/pgp-signature": ["asc", "sig"],
  18751. "application/pics-rules": ["prf"],
  18752. "application/pkcs10": ["p10"],
  18753. "application/pkcs7-mime": ["p7m", "p7c"],
  18754. "application/pkcs7-signature": ["p7s"],
  18755. "application/pkcs8": ["p8"],
  18756. "application/pkix-attr-cert": ["ac"],
  18757. "application/pkix-cert": ["cer"],
  18758. "application/pkix-crl": ["crl"],
  18759. "application/pkix-pkipath": ["pkipath"],
  18760. "application/pkixcmp": ["pki"],
  18761. "application/pls+xml": ["pls"],
  18762. "application/postscript": ["ai", "eps", "ps"],
  18763. "application/provenance+xml": ["provx"],
  18764. "application/pskc+xml": ["pskcxml"],
  18765. "application/raml+yaml": ["raml"],
  18766. "application/rdf+xml": ["rdf", "owl"],
  18767. "application/reginfo+xml": ["rif"],
  18768. "application/relax-ng-compact-syntax": ["rnc"],
  18769. "application/resource-lists+xml": ["rl"],
  18770. "application/resource-lists-diff+xml": ["rld"],
  18771. "application/rls-services+xml": ["rs"],
  18772. "application/route-apd+xml": ["rapd"],
  18773. "application/route-s-tsid+xml": ["sls"],
  18774. "application/route-usd+xml": ["rusd"],
  18775. "application/rpki-ghostbusters": ["gbr"],
  18776. "application/rpki-manifest": ["mft"],
  18777. "application/rpki-roa": ["roa"],
  18778. "application/rsd+xml": ["rsd"],
  18779. "application/rss+xml": ["rss"],
  18780. "application/rtf": ["rtf"],
  18781. "application/sbml+xml": ["sbml"],
  18782. "application/scvp-cv-request": ["scq"],
  18783. "application/scvp-cv-response": ["scs"],
  18784. "application/scvp-vp-request": ["spq"],
  18785. "application/scvp-vp-response": ["spp"],
  18786. "application/sdp": ["sdp"],
  18787. "application/senml+xml": ["senmlx"],
  18788. "application/sensml+xml": ["sensmlx"],
  18789. "application/set-payment-initiation": ["setpay"],
  18790. "application/set-registration-initiation": ["setreg"],
  18791. "application/shf+xml": ["shf"],
  18792. "application/sieve": ["siv", "sieve"],
  18793. "application/smil+xml": ["smi", "smil"],
  18794. "application/sparql-query": ["rq"],
  18795. "application/sparql-results+xml": ["srx"],
  18796. "application/srgs": ["gram"],
  18797. "application/srgs+xml": ["grxml"],
  18798. "application/sru+xml": ["sru"],
  18799. "application/ssdl+xml": ["ssdl"],
  18800. "application/ssml+xml": ["ssml"],
  18801. "application/swid+xml": ["swidtag"],
  18802. "application/tei+xml": ["tei", "teicorpus"],
  18803. "application/thraud+xml": ["tfi"],
  18804. "application/timestamped-data": ["tsd"],
  18805. "application/toml": ["toml"],
  18806. "application/trig": ["trig"],
  18807. "application/ttml+xml": ["ttml"],
  18808. "application/ubjson": ["ubj"],
  18809. "application/urc-ressheet+xml": ["rsheet"],
  18810. "application/urc-targetdesc+xml": ["td"],
  18811. "application/voicexml+xml": ["vxml"],
  18812. "application/wasm": ["wasm"],
  18813. "application/widget": ["wgt"],
  18814. "application/winhlp": ["hlp"],
  18815. "application/wsdl+xml": ["wsdl"],
  18816. "application/wspolicy+xml": ["wspolicy"],
  18817. "application/xaml+xml": ["xaml"],
  18818. "application/xcap-att+xml": ["xav"],
  18819. "application/xcap-caps+xml": ["xca"],
  18820. "application/xcap-diff+xml": ["xdf"],
  18821. "application/xcap-el+xml": ["xel"],
  18822. "application/xcap-ns+xml": ["xns"],
  18823. "application/xenc+xml": ["xenc"],
  18824. "application/xhtml+xml": ["xhtml", "xht"],
  18825. "application/xliff+xml": ["xlf"],
  18826. "application/xml": ["xml", "xsl", "xsd", "rng"],
  18827. "application/xml-dtd": ["dtd"],
  18828. "application/xop+xml": ["xop"],
  18829. "application/xproc+xml": ["xpl"],
  18830. "application/xslt+xml": ["*xsl", "xslt"],
  18831. "application/xspf+xml": ["xspf"],
  18832. "application/xv+xml": ["mxml", "xhvml", "xvml", "xvm"],
  18833. "application/yang": ["yang"],
  18834. "application/yin+xml": ["yin"],
  18835. "application/zip": ["zip"],
  18836. "audio/3gpp": ["*3gpp"],
  18837. "audio/adpcm": ["adp"],
  18838. "audio/amr": ["amr"],
  18839. "audio/basic": ["au", "snd"],
  18840. "audio/midi": ["mid", "midi", "kar", "rmi"],
  18841. "audio/mobile-xmf": ["mxmf"],
  18842. "audio/mp3": ["*mp3"],
  18843. "audio/mp4": ["m4a", "mp4a"],
  18844. "audio/mpeg": ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"],
  18845. "audio/ogg": ["oga", "ogg", "spx", "opus"],
  18846. "audio/s3m": ["s3m"],
  18847. "audio/silk": ["sil"],
  18848. "audio/wav": ["wav"],
  18849. "audio/wave": ["*wav"],
  18850. "audio/webm": ["weba"],
  18851. "audio/xm": ["xm"],
  18852. "font/collection": ["ttc"],
  18853. "font/otf": ["otf"],
  18854. "font/ttf": ["ttf"],
  18855. "font/woff": ["woff"],
  18856. "font/woff2": ["woff2"],
  18857. "image/aces": ["exr"],
  18858. "image/apng": ["apng"],
  18859. "image/avif": ["avif"],
  18860. "image/bmp": ["bmp"],
  18861. "image/cgm": ["cgm"],
  18862. "image/dicom-rle": ["drle"],
  18863. "image/emf": ["emf"],
  18864. "image/fits": ["fits"],
  18865. "image/g3fax": ["g3"],
  18866. "image/gif": ["gif"],
  18867. "image/heic": ["heic"],
  18868. "image/heic-sequence": ["heics"],
  18869. "image/heif": ["heif"],
  18870. "image/heif-sequence": ["heifs"],
  18871. "image/hej2k": ["hej2"],
  18872. "image/hsj2": ["hsj2"],
  18873. "image/ief": ["ief"],
  18874. "image/jls": ["jls"],
  18875. "image/jp2": ["jp2", "jpg2"],
  18876. "image/jpeg": ["jpeg", "jpg", "jpe"],
  18877. "image/jph": ["jph"],
  18878. "image/jphc": ["jhc"],
  18879. "image/jpm": ["jpm"],
  18880. "image/jpx": ["jpx", "jpf"],
  18881. "image/jxr": ["jxr"],
  18882. "image/jxra": ["jxra"],
  18883. "image/jxrs": ["jxrs"],
  18884. "image/jxs": ["jxs"],
  18885. "image/jxsc": ["jxsc"],
  18886. "image/jxsi": ["jxsi"],
  18887. "image/jxss": ["jxss"],
  18888. "image/ktx": ["ktx"],
  18889. "image/ktx2": ["ktx2"],
  18890. "image/png": ["png"],
  18891. "image/sgi": ["sgi"],
  18892. "image/svg+xml": ["svg", "svgz"],
  18893. "image/t38": ["t38"],
  18894. "image/tiff": ["tif", "tiff"],
  18895. "image/tiff-fx": ["tfx"],
  18896. "image/webp": ["webp"],
  18897. "image/wmf": ["wmf"],
  18898. "message/disposition-notification": ["disposition-notification"],
  18899. "message/global": ["u8msg"],
  18900. "message/global-delivery-status": ["u8dsn"],
  18901. "message/global-disposition-notification": ["u8mdn"],
  18902. "message/global-headers": ["u8hdr"],
  18903. "message/rfc822": ["eml", "mime"],
  18904. "model/3mf": ["3mf"],
  18905. "model/gltf+json": ["gltf"],
  18906. "model/gltf-binary": ["glb"],
  18907. "model/iges": ["igs", "iges"],
  18908. "model/mesh": ["msh", "mesh", "silo"],
  18909. "model/mtl": ["mtl"],
  18910. "model/obj": ["obj"],
  18911. "model/step+xml": ["stpx"],
  18912. "model/step+zip": ["stpz"],
  18913. "model/step-xml+zip": ["stpxz"],
  18914. "model/stl": ["stl"],
  18915. "model/vrml": ["wrl", "vrml"],
  18916. "model/x3d+binary": ["*x3db", "x3dbz"],
  18917. "model/x3d+fastinfoset": ["x3db"],
  18918. "model/x3d+vrml": ["*x3dv", "x3dvz"],
  18919. "model/x3d+xml": ["x3d", "x3dz"],
  18920. "model/x3d-vrml": ["x3dv"],
  18921. "text/cache-manifest": ["appcache", "manifest"],
  18922. "text/calendar": ["ics", "ifb"],
  18923. "text/coffeescript": ["coffee", "litcoffee"],
  18924. "text/css": ["css"],
  18925. "text/csv": ["csv"],
  18926. "text/html": ["html", "htm", "shtml"],
  18927. "text/jade": ["jade"],
  18928. "text/jsx": ["jsx"],
  18929. "text/less": ["less"],
  18930. "text/markdown": ["markdown", "md"],
  18931. "text/mathml": ["mml"],
  18932. "text/mdx": ["mdx"],
  18933. "text/n3": ["n3"],
  18934. "text/plain": ["txt", "text", "conf", "def", "list", "log", "in", "ini"],
  18935. "text/richtext": ["rtx"],
  18936. "text/rtf": ["*rtf"],
  18937. "text/sgml": ["sgml", "sgm"],
  18938. "text/shex": ["shex"],
  18939. "text/slim": ["slim", "slm"],
  18940. "text/spdx": ["spdx"],
  18941. "text/stylus": ["stylus", "styl"],
  18942. "text/tab-separated-values": ["tsv"],
  18943. "text/troff": ["t", "tr", "roff", "man", "me", "ms"],
  18944. "text/turtle": ["ttl"],
  18945. "text/uri-list": ["uri", "uris", "urls"],
  18946. "text/vcard": ["vcard"],
  18947. "text/vtt": ["vtt"],
  18948. "text/xml": ["*xml"],
  18949. "text/yaml": ["yaml", "yml"],
  18950. "video/3gpp": ["3gp", "3gpp"],
  18951. "video/3gpp2": ["3g2"],
  18952. "video/h261": ["h261"],
  18953. "video/h263": ["h263"],
  18954. "video/h264": ["h264"],
  18955. "video/iso.segment": ["m4s"],
  18956. "video/jpeg": ["jpgv"],
  18957. "video/jpm": ["*jpm", "jpgm"],
  18958. "video/mj2": ["mj2", "mjp2"],
  18959. "video/mp2t": ["ts"],
  18960. "video/mp4": ["mp4", "mp4v", "mpg4"],
  18961. "video/mpeg": ["mpeg", "mpg", "mpe", "m1v", "m2v"],
  18962. "video/ogg": ["ogv"],
  18963. "video/quicktime": ["qt", "mov"],
  18964. "video/webm": ["webm"]
  18965. };
  18966. },{}],376:[function(require,module,exports){
  18967. /**
  18968. * Helpers.
  18969. */
  18970. var s = 1000;
  18971. var m = s * 60;
  18972. var h = m * 60;
  18973. var d = h * 24;
  18974. var w = d * 7;
  18975. var y = d * 365.25;
  18976. /**
  18977. * Parse or format the given `val`.
  18978. *
  18979. * Options:
  18980. *
  18981. * - `long` verbose formatting [false]
  18982. *
  18983. * @param {String|Number} val
  18984. * @param {Object} [options]
  18985. * @throws {Error} throw an error if val is not a non-empty string or a number
  18986. * @return {String|Number}
  18987. * @api public
  18988. */
  18989. module.exports = function (val, options) {
  18990. options = options || {};
  18991. var type = typeof val;
  18992. if (type === 'string' && val.length > 0) {
  18993. return parse(val);
  18994. } else if (type === 'number' && isFinite(val)) {
  18995. return options.long ? fmtLong(val) : fmtShort(val);
  18996. }
  18997. throw new Error(
  18998. 'val is not a non-empty string or a valid number. val=' +
  18999. JSON.stringify(val)
  19000. );
  19001. };
  19002. /**
  19003. * Parse the given `str` and return milliseconds.
  19004. *
  19005. * @param {String} str
  19006. * @return {Number}
  19007. * @api private
  19008. */
  19009. function parse(str) {
  19010. str = String(str);
  19011. if (str.length > 100) {
  19012. return;
  19013. }
  19014. var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
  19015. str
  19016. );
  19017. if (!match) {
  19018. return;
  19019. }
  19020. var n = parseFloat(match[1]);
  19021. var type = (match[2] || 'ms').toLowerCase();
  19022. switch (type) {
  19023. case 'years':
  19024. case 'year':
  19025. case 'yrs':
  19026. case 'yr':
  19027. case 'y':
  19028. return n * y;
  19029. case 'weeks':
  19030. case 'week':
  19031. case 'w':
  19032. return n * w;
  19033. case 'days':
  19034. case 'day':
  19035. case 'd':
  19036. return n * d;
  19037. case 'hours':
  19038. case 'hour':
  19039. case 'hrs':
  19040. case 'hr':
  19041. case 'h':
  19042. return n * h;
  19043. case 'minutes':
  19044. case 'minute':
  19045. case 'mins':
  19046. case 'min':
  19047. case 'm':
  19048. return n * m;
  19049. case 'seconds':
  19050. case 'second':
  19051. case 'secs':
  19052. case 'sec':
  19053. case 's':
  19054. return n * s;
  19055. case 'milliseconds':
  19056. case 'millisecond':
  19057. case 'msecs':
  19058. case 'msec':
  19059. case 'ms':
  19060. return n;
  19061. default:
  19062. return undefined;
  19063. }
  19064. }
  19065. /**
  19066. * Short format for `ms`.
  19067. *
  19068. * @param {Number} ms
  19069. * @return {String}
  19070. * @api private
  19071. */
  19072. function fmtShort(ms) {
  19073. var msAbs = Math.abs(ms);
  19074. if (msAbs >= d) {
  19075. return Math.round(ms / d) + 'd';
  19076. }
  19077. if (msAbs >= h) {
  19078. return Math.round(ms / h) + 'h';
  19079. }
  19080. if (msAbs >= m) {
  19081. return Math.round(ms / m) + 'm';
  19082. }
  19083. if (msAbs >= s) {
  19084. return Math.round(ms / s) + 's';
  19085. }
  19086. return ms + 'ms';
  19087. }
  19088. /**
  19089. * Long format for `ms`.
  19090. *
  19091. * @param {Number} ms
  19092. * @return {String}
  19093. * @api private
  19094. */
  19095. function fmtLong(ms) {
  19096. var msAbs = Math.abs(ms);
  19097. if (msAbs >= d) {
  19098. return plural(ms, msAbs, d, 'day');
  19099. }
  19100. if (msAbs >= h) {
  19101. return plural(ms, msAbs, h, 'hour');
  19102. }
  19103. if (msAbs >= m) {
  19104. return plural(ms, msAbs, m, 'minute');
  19105. }
  19106. if (msAbs >= s) {
  19107. return plural(ms, msAbs, s, 'second');
  19108. }
  19109. return ms + ' ms';
  19110. }
  19111. /**
  19112. * Pluralization helper.
  19113. */
  19114. function plural(ms, msAbs, n, name) {
  19115. var isPlural = msAbs >= n * 1.5;
  19116. return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
  19117. }
  19118. },{}],377:[function(require,module,exports){
  19119. /*
  19120. object-assign
  19121. (c) Sindre Sorhus
  19122. @license MIT
  19123. */
  19124. 'use strict';
  19125. /* eslint-disable no-unused-vars */
  19126. var getOwnPropertySymbols = Object.getOwnPropertySymbols;
  19127. var hasOwnProperty = Object.prototype.hasOwnProperty;
  19128. var propIsEnumerable = Object.prototype.propertyIsEnumerable;
  19129. function toObject(val) {
  19130. if (val === null || val === undefined) {
  19131. throw new TypeError('Object.assign cannot be called with null or undefined');
  19132. }
  19133. return Object(val);
  19134. }
  19135. function shouldUseNative() {
  19136. try {
  19137. if (!Object.assign) {
  19138. return false;
  19139. }
  19140. // Detect buggy property enumeration order in older V8 versions.
  19141. // https://bugs.chromium.org/p/v8/issues/detail?id=4118
  19142. var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
  19143. test1[5] = 'de';
  19144. if (Object.getOwnPropertyNames(test1)[0] === '5') {
  19145. return false;
  19146. }
  19147. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  19148. var test2 = {};
  19149. for (var i = 0; i < 10; i++) {
  19150. test2['_' + String.fromCharCode(i)] = i;
  19151. }
  19152. var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
  19153. return test2[n];
  19154. });
  19155. if (order2.join('') !== '0123456789') {
  19156. return false;
  19157. }
  19158. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  19159. var test3 = {};
  19160. 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
  19161. test3[letter] = letter;
  19162. });
  19163. if (Object.keys(Object.assign({}, test3)).join('') !==
  19164. 'abcdefghijklmnopqrst') {
  19165. return false;
  19166. }
  19167. return true;
  19168. } catch (err) {
  19169. // We don't expect any of the above to throw, but better to be safe.
  19170. return false;
  19171. }
  19172. }
  19173. module.exports = shouldUseNative() ? Object.assign : function (target, source) {
  19174. var from;
  19175. var to = toObject(target);
  19176. var symbols;
  19177. for (var s = 1; s < arguments.length; s++) {
  19178. from = Object(arguments[s]);
  19179. for (var key in from) {
  19180. if (hasOwnProperty.call(from, key)) {
  19181. to[key] = from[key];
  19182. }
  19183. }
  19184. if (getOwnPropertySymbols) {
  19185. symbols = getOwnPropertySymbols(from);
  19186. for (var i = 0; i < symbols.length; i++) {
  19187. if (propIsEnumerable.call(from, symbols[i])) {
  19188. to[symbols[i]] = from[symbols[i]];
  19189. }
  19190. }
  19191. }
  19192. }
  19193. return to;
  19194. };
  19195. },{}],378:[function(require,module,exports){
  19196. (function (process){(function (){
  19197. // 'path' module extracted from Node.js v8.11.1 (only the posix part)
  19198. // transplited with Babel
  19199. // Copyright Joyent, Inc. and other Node contributors.
  19200. //
  19201. // Permission is hereby granted, free of charge, to any person obtaining a
  19202. // copy of this software and associated documentation files (the
  19203. // "Software"), to deal in the Software without restriction, including
  19204. // without limitation the rights to use, copy, modify, merge, publish,
  19205. // distribute, sublicense, and/or sell copies of the Software, and to permit
  19206. // persons to whom the Software is furnished to do so, subject to the
  19207. // following conditions:
  19208. //
  19209. // The above copyright notice and this permission notice shall be included
  19210. // in all copies or substantial portions of the Software.
  19211. //
  19212. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  19213. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19214. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  19215. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  19216. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  19217. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  19218. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  19219. 'use strict';
  19220. function assertPath(path) {
  19221. if (typeof path !== 'string') {
  19222. throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));
  19223. }
  19224. }
  19225. // Resolves . and .. elements in a path with directory names
  19226. function normalizeStringPosix(path, allowAboveRoot) {
  19227. var res = '';
  19228. var lastSegmentLength = 0;
  19229. var lastSlash = -1;
  19230. var dots = 0;
  19231. var code;
  19232. for (var i = 0; i <= path.length; ++i) {
  19233. if (i < path.length)
  19234. code = path.charCodeAt(i);
  19235. else if (code === 47 /*/*/)
  19236. break;
  19237. else
  19238. code = 47 /*/*/;
  19239. if (code === 47 /*/*/) {
  19240. if (lastSlash === i - 1 || dots === 1) {
  19241. // NOOP
  19242. } else if (lastSlash !== i - 1 && dots === 2) {
  19243. if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) {
  19244. if (res.length > 2) {
  19245. var lastSlashIndex = res.lastIndexOf('/');
  19246. if (lastSlashIndex !== res.length - 1) {
  19247. if (lastSlashIndex === -1) {
  19248. res = '';
  19249. lastSegmentLength = 0;
  19250. } else {
  19251. res = res.slice(0, lastSlashIndex);
  19252. lastSegmentLength = res.length - 1 - res.lastIndexOf('/');
  19253. }
  19254. lastSlash = i;
  19255. dots = 0;
  19256. continue;
  19257. }
  19258. } else if (res.length === 2 || res.length === 1) {
  19259. res = '';
  19260. lastSegmentLength = 0;
  19261. lastSlash = i;
  19262. dots = 0;
  19263. continue;
  19264. }
  19265. }
  19266. if (allowAboveRoot) {
  19267. if (res.length > 0)
  19268. res += '/..';
  19269. else
  19270. res = '..';
  19271. lastSegmentLength = 2;
  19272. }
  19273. } else {
  19274. if (res.length > 0)
  19275. res += '/' + path.slice(lastSlash + 1, i);
  19276. else
  19277. res = path.slice(lastSlash + 1, i);
  19278. lastSegmentLength = i - lastSlash - 1;
  19279. }
  19280. lastSlash = i;
  19281. dots = 0;
  19282. } else if (code === 46 /*.*/ && dots !== -1) {
  19283. ++dots;
  19284. } else {
  19285. dots = -1;
  19286. }
  19287. }
  19288. return res;
  19289. }
  19290. function _format(sep, pathObject) {
  19291. var dir = pathObject.dir || pathObject.root;
  19292. var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');
  19293. if (!dir) {
  19294. return base;
  19295. }
  19296. if (dir === pathObject.root) {
  19297. return dir + base;
  19298. }
  19299. return dir + sep + base;
  19300. }
  19301. var posix = {
  19302. // path.resolve([from ...], to)
  19303. resolve: function resolve() {
  19304. var resolvedPath = '';
  19305. var resolvedAbsolute = false;
  19306. var cwd;
  19307. for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
  19308. var path;
  19309. if (i >= 0)
  19310. path = arguments[i];
  19311. else {
  19312. if (cwd === undefined)
  19313. cwd = process.cwd();
  19314. path = cwd;
  19315. }
  19316. assertPath(path);
  19317. // Skip empty entries
  19318. if (path.length === 0) {
  19319. continue;
  19320. }
  19321. resolvedPath = path + '/' + resolvedPath;
  19322. resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;
  19323. }
  19324. // At this point the path should be resolved to a full absolute path, but
  19325. // handle relative paths to be safe (might happen when process.cwd() fails)
  19326. // Normalize the path
  19327. resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
  19328. if (resolvedAbsolute) {
  19329. if (resolvedPath.length > 0)
  19330. return '/' + resolvedPath;
  19331. else
  19332. return '/';
  19333. } else if (resolvedPath.length > 0) {
  19334. return resolvedPath;
  19335. } else {
  19336. return '.';
  19337. }
  19338. },
  19339. normalize: function normalize(path) {
  19340. assertPath(path);
  19341. if (path.length === 0) return '.';
  19342. var isAbsolute = path.charCodeAt(0) === 47 /*/*/;
  19343. var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;
  19344. // Normalize the path
  19345. path = normalizeStringPosix(path, !isAbsolute);
  19346. if (path.length === 0 && !isAbsolute) path = '.';
  19347. if (path.length > 0 && trailingSeparator) path += '/';
  19348. if (isAbsolute) return '/' + path;
  19349. return path;
  19350. },
  19351. isAbsolute: function isAbsolute(path) {
  19352. assertPath(path);
  19353. return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;
  19354. },
  19355. join: function join() {
  19356. if (arguments.length === 0)
  19357. return '.';
  19358. var joined;
  19359. for (var i = 0; i < arguments.length; ++i) {
  19360. var arg = arguments[i];
  19361. assertPath(arg);
  19362. if (arg.length > 0) {
  19363. if (joined === undefined)
  19364. joined = arg;
  19365. else
  19366. joined += '/' + arg;
  19367. }
  19368. }
  19369. if (joined === undefined)
  19370. return '.';
  19371. return posix.normalize(joined);
  19372. },
  19373. relative: function relative(from, to) {
  19374. assertPath(from);
  19375. assertPath(to);
  19376. if (from === to) return '';
  19377. from = posix.resolve(from);
  19378. to = posix.resolve(to);
  19379. if (from === to) return '';
  19380. // Trim any leading backslashes
  19381. var fromStart = 1;
  19382. for (; fromStart < from.length; ++fromStart) {
  19383. if (from.charCodeAt(fromStart) !== 47 /*/*/)
  19384. break;
  19385. }
  19386. var fromEnd = from.length;
  19387. var fromLen = fromEnd - fromStart;
  19388. // Trim any leading backslashes
  19389. var toStart = 1;
  19390. for (; toStart < to.length; ++toStart) {
  19391. if (to.charCodeAt(toStart) !== 47 /*/*/)
  19392. break;
  19393. }
  19394. var toEnd = to.length;
  19395. var toLen = toEnd - toStart;
  19396. // Compare paths to find the longest common path from root
  19397. var length = fromLen < toLen ? fromLen : toLen;
  19398. var lastCommonSep = -1;
  19399. var i = 0;
  19400. for (; i <= length; ++i) {
  19401. if (i === length) {
  19402. if (toLen > length) {
  19403. if (to.charCodeAt(toStart + i) === 47 /*/*/) {
  19404. // We get here if `from` is the exact base path for `to`.
  19405. // For example: from='/foo/bar'; to='/foo/bar/baz'
  19406. return to.slice(toStart + i + 1);
  19407. } else if (i === 0) {
  19408. // We get here if `from` is the root
  19409. // For example: from='/'; to='/foo'
  19410. return to.slice(toStart + i);
  19411. }
  19412. } else if (fromLen > length) {
  19413. if (from.charCodeAt(fromStart + i) === 47 /*/*/) {
  19414. // We get here if `to` is the exact base path for `from`.
  19415. // For example: from='/foo/bar/baz'; to='/foo/bar'
  19416. lastCommonSep = i;
  19417. } else if (i === 0) {
  19418. // We get here if `to` is the root.
  19419. // For example: from='/foo'; to='/'
  19420. lastCommonSep = 0;
  19421. }
  19422. }
  19423. break;
  19424. }
  19425. var fromCode = from.charCodeAt(fromStart + i);
  19426. var toCode = to.charCodeAt(toStart + i);
  19427. if (fromCode !== toCode)
  19428. break;
  19429. else if (fromCode === 47 /*/*/)
  19430. lastCommonSep = i;
  19431. }
  19432. var out = '';
  19433. // Generate the relative path based on the path difference between `to`
  19434. // and `from`
  19435. for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
  19436. if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {
  19437. if (out.length === 0)
  19438. out += '..';
  19439. else
  19440. out += '/..';
  19441. }
  19442. }
  19443. // Lastly, append the rest of the destination (`to`) path that comes after
  19444. // the common path parts
  19445. if (out.length > 0)
  19446. return out + to.slice(toStart + lastCommonSep);
  19447. else {
  19448. toStart += lastCommonSep;
  19449. if (to.charCodeAt(toStart) === 47 /*/*/)
  19450. ++toStart;
  19451. return to.slice(toStart);
  19452. }
  19453. },
  19454. _makeLong: function _makeLong(path) {
  19455. return path;
  19456. },
  19457. dirname: function dirname(path) {
  19458. assertPath(path);
  19459. if (path.length === 0) return '.';
  19460. var code = path.charCodeAt(0);
  19461. var hasRoot = code === 47 /*/*/;
  19462. var end = -1;
  19463. var matchedSlash = true;
  19464. for (var i = path.length - 1; i >= 1; --i) {
  19465. code = path.charCodeAt(i);
  19466. if (code === 47 /*/*/) {
  19467. if (!matchedSlash) {
  19468. end = i;
  19469. break;
  19470. }
  19471. } else {
  19472. // We saw the first non-path separator
  19473. matchedSlash = false;
  19474. }
  19475. }
  19476. if (end === -1) return hasRoot ? '/' : '.';
  19477. if (hasRoot && end === 1) return '//';
  19478. return path.slice(0, end);
  19479. },
  19480. basename: function basename(path, ext) {
  19481. if (ext !== undefined && typeof ext !== 'string') throw new TypeError('"ext" argument must be a string');
  19482. assertPath(path);
  19483. var start = 0;
  19484. var end = -1;
  19485. var matchedSlash = true;
  19486. var i;
  19487. if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
  19488. if (ext.length === path.length && ext === path) return '';
  19489. var extIdx = ext.length - 1;
  19490. var firstNonSlashEnd = -1;
  19491. for (i = path.length - 1; i >= 0; --i) {
  19492. var code = path.charCodeAt(i);
  19493. if (code === 47 /*/*/) {
  19494. // If we reached a path separator that was not part of a set of path
  19495. // separators at the end of the string, stop now
  19496. if (!matchedSlash) {
  19497. start = i + 1;
  19498. break;
  19499. }
  19500. } else {
  19501. if (firstNonSlashEnd === -1) {
  19502. // We saw the first non-path separator, remember this index in case
  19503. // we need it if the extension ends up not matching
  19504. matchedSlash = false;
  19505. firstNonSlashEnd = i + 1;
  19506. }
  19507. if (extIdx >= 0) {
  19508. // Try to match the explicit extension
  19509. if (code === ext.charCodeAt(extIdx)) {
  19510. if (--extIdx === -1) {
  19511. // We matched the extension, so mark this as the end of our path
  19512. // component
  19513. end = i;
  19514. }
  19515. } else {
  19516. // Extension does not match, so our result is the entire path
  19517. // component
  19518. extIdx = -1;
  19519. end = firstNonSlashEnd;
  19520. }
  19521. }
  19522. }
  19523. }
  19524. if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;
  19525. return path.slice(start, end);
  19526. } else {
  19527. for (i = path.length - 1; i >= 0; --i) {
  19528. if (path.charCodeAt(i) === 47 /*/*/) {
  19529. // If we reached a path separator that was not part of a set of path
  19530. // separators at the end of the string, stop now
  19531. if (!matchedSlash) {
  19532. start = i + 1;
  19533. break;
  19534. }
  19535. } else if (end === -1) {
  19536. // We saw the first non-path separator, mark this as the end of our
  19537. // path component
  19538. matchedSlash = false;
  19539. end = i + 1;
  19540. }
  19541. }
  19542. if (end === -1) return '';
  19543. return path.slice(start, end);
  19544. }
  19545. },
  19546. extname: function extname(path) {
  19547. assertPath(path);
  19548. var startDot = -1;
  19549. var startPart = 0;
  19550. var end = -1;
  19551. var matchedSlash = true;
  19552. // Track the state of characters (if any) we see before our first dot and
  19553. // after any path separator we find
  19554. var preDotState = 0;
  19555. for (var i = path.length - 1; i >= 0; --i) {
  19556. var code = path.charCodeAt(i);
  19557. if (code === 47 /*/*/) {
  19558. // If we reached a path separator that was not part of a set of path
  19559. // separators at the end of the string, stop now
  19560. if (!matchedSlash) {
  19561. startPart = i + 1;
  19562. break;
  19563. }
  19564. continue;
  19565. }
  19566. if (end === -1) {
  19567. // We saw the first non-path separator, mark this as the end of our
  19568. // extension
  19569. matchedSlash = false;
  19570. end = i + 1;
  19571. }
  19572. if (code === 46 /*.*/) {
  19573. // If this is our first dot, mark it as the start of our extension
  19574. if (startDot === -1)
  19575. startDot = i;
  19576. else if (preDotState !== 1)
  19577. preDotState = 1;
  19578. } else if (startDot !== -1) {
  19579. // We saw a non-dot and non-path separator before our dot, so we should
  19580. // have a good chance at having a non-empty extension
  19581. preDotState = -1;
  19582. }
  19583. }
  19584. if (startDot === -1 || end === -1 ||
  19585. // We saw a non-dot character immediately before the dot
  19586. preDotState === 0 ||
  19587. // The (right-most) trimmed path component is exactly '..'
  19588. preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
  19589. return '';
  19590. }
  19591. return path.slice(startDot, end);
  19592. },
  19593. format: function format(pathObject) {
  19594. if (pathObject === null || typeof pathObject !== 'object') {
  19595. throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
  19596. }
  19597. return _format('/', pathObject);
  19598. },
  19599. parse: function parse(path) {
  19600. assertPath(path);
  19601. var ret = { root: '', dir: '', base: '', ext: '', name: '' };
  19602. if (path.length === 0) return ret;
  19603. var code = path.charCodeAt(0);
  19604. var isAbsolute = code === 47 /*/*/;
  19605. var start;
  19606. if (isAbsolute) {
  19607. ret.root = '/';
  19608. start = 1;
  19609. } else {
  19610. start = 0;
  19611. }
  19612. var startDot = -1;
  19613. var startPart = 0;
  19614. var end = -1;
  19615. var matchedSlash = true;
  19616. var i = path.length - 1;
  19617. // Track the state of characters (if any) we see before our first dot and
  19618. // after any path separator we find
  19619. var preDotState = 0;
  19620. // Get non-dir info
  19621. for (; i >= start; --i) {
  19622. code = path.charCodeAt(i);
  19623. if (code === 47 /*/*/) {
  19624. // If we reached a path separator that was not part of a set of path
  19625. // separators at the end of the string, stop now
  19626. if (!matchedSlash) {
  19627. startPart = i + 1;
  19628. break;
  19629. }
  19630. continue;
  19631. }
  19632. if (end === -1) {
  19633. // We saw the first non-path separator, mark this as the end of our
  19634. // extension
  19635. matchedSlash = false;
  19636. end = i + 1;
  19637. }
  19638. if (code === 46 /*.*/) {
  19639. // If this is our first dot, mark it as the start of our extension
  19640. if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;
  19641. } else if (startDot !== -1) {
  19642. // We saw a non-dot and non-path separator before our dot, so we should
  19643. // have a good chance at having a non-empty extension
  19644. preDotState = -1;
  19645. }
  19646. }
  19647. if (startDot === -1 || end === -1 ||
  19648. // We saw a non-dot character immediately before the dot
  19649. preDotState === 0 ||
  19650. // The (right-most) trimmed path component is exactly '..'
  19651. preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
  19652. if (end !== -1) {
  19653. if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);
  19654. }
  19655. } else {
  19656. if (startPart === 0 && isAbsolute) {
  19657. ret.name = path.slice(1, startDot);
  19658. ret.base = path.slice(1, end);
  19659. } else {
  19660. ret.name = path.slice(startPart, startDot);
  19661. ret.base = path.slice(startPart, end);
  19662. }
  19663. ret.ext = path.slice(startDot, end);
  19664. }
  19665. if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';
  19666. return ret;
  19667. },
  19668. sep: '/',
  19669. delimiter: ':',
  19670. win32: null,
  19671. posix: null
  19672. };
  19673. posix.posix = posix;
  19674. module.exports = posix;
  19675. }).call(this)}).call(this,require('_process'))
  19676. },{"_process":467}],379:[function(require,module,exports){
  19677. (function (global){(function (){
  19678. /*!
  19679. * Platform.js v1.3.6
  19680. * Copyright 2014-2020 Benjamin Tan
  19681. * Copyright 2011-2013 John-David Dalton
  19682. * Available under MIT license
  19683. */
  19684. ;(function() {
  19685. 'use strict';
  19686. /** Used to determine if values are of the language type `Object`. */
  19687. var objectTypes = {
  19688. 'function': true,
  19689. 'object': true
  19690. };
  19691. /** Used as a reference to the global object. */
  19692. var root = (objectTypes[typeof window] && window) || this;
  19693. /** Backup possible global object. */
  19694. var oldRoot = root;
  19695. /** Detect free variable `exports`. */
  19696. var freeExports = objectTypes[typeof exports] && exports;
  19697. /** Detect free variable `module`. */
  19698. var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
  19699. /** Detect free variable `global` from Node.js or Browserified code and use it as `root`. */
  19700. var freeGlobal = freeExports && freeModule && typeof global == 'object' && global;
  19701. if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
  19702. root = freeGlobal;
  19703. }
  19704. /**
  19705. * Used as the maximum length of an array-like object.
  19706. * See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength)
  19707. * for more details.
  19708. */
  19709. var maxSafeInteger = Math.pow(2, 53) - 1;
  19710. /** Regular expression to detect Opera. */
  19711. var reOpera = /\bOpera/;
  19712. /** Possible global object. */
  19713. var thisBinding = this;
  19714. /** Used for native method references. */
  19715. var objectProto = Object.prototype;
  19716. /** Used to check for own properties of an object. */
  19717. var hasOwnProperty = objectProto.hasOwnProperty;
  19718. /** Used to resolve the internal `[[Class]]` of values. */
  19719. var toString = objectProto.toString;
  19720. /*--------------------------------------------------------------------------*/
  19721. /**
  19722. * Capitalizes a string value.
  19723. *
  19724. * @private
  19725. * @param {string} string The string to capitalize.
  19726. * @returns {string} The capitalized string.
  19727. */
  19728. function capitalize(string) {
  19729. string = String(string);
  19730. return string.charAt(0).toUpperCase() + string.slice(1);
  19731. }
  19732. /**
  19733. * A utility function to clean up the OS name.
  19734. *
  19735. * @private
  19736. * @param {string} os The OS name to clean up.
  19737. * @param {string} [pattern] A `RegExp` pattern matching the OS name.
  19738. * @param {string} [label] A label for the OS.
  19739. */
  19740. function cleanupOS(os, pattern, label) {
  19741. // Platform tokens are defined at:
  19742. // http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx
  19743. // http://web.archive.org/web/20081122053950/http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx
  19744. var data = {
  19745. '10.0': '10',
  19746. '6.4': '10 Technical Preview',
  19747. '6.3': '8.1',
  19748. '6.2': '8',
  19749. '6.1': 'Server 2008 R2 / 7',
  19750. '6.0': 'Server 2008 / Vista',
  19751. '5.2': 'Server 2003 / XP 64-bit',
  19752. '5.1': 'XP',
  19753. '5.01': '2000 SP1',
  19754. '5.0': '2000',
  19755. '4.0': 'NT',
  19756. '4.90': 'ME'
  19757. };
  19758. // Detect Windows version from platform tokens.
  19759. if (pattern && label && /^Win/i.test(os) && !/^Windows Phone /i.test(os) &&
  19760. (data = data[/[\d.]+$/.exec(os)])) {
  19761. os = 'Windows ' + data;
  19762. }
  19763. // Correct character case and cleanup string.
  19764. os = String(os);
  19765. if (pattern && label) {
  19766. os = os.replace(RegExp(pattern, 'i'), label);
  19767. }
  19768. os = format(
  19769. os.replace(/ ce$/i, ' CE')
  19770. .replace(/\bhpw/i, 'web')
  19771. .replace(/\bMacintosh\b/, 'Mac OS')
  19772. .replace(/_PowerPC\b/i, ' OS')
  19773. .replace(/\b(OS X) [^ \d]+/i, '$1')
  19774. .replace(/\bMac (OS X)\b/, '$1')
  19775. .replace(/\/(\d)/, ' $1')
  19776. .replace(/_/g, '.')
  19777. .replace(/(?: BePC|[ .]*fc[ \d.]+)$/i, '')
  19778. .replace(/\bx86\.64\b/gi, 'x86_64')
  19779. .replace(/\b(Windows Phone) OS\b/, '$1')
  19780. .replace(/\b(Chrome OS \w+) [\d.]+\b/, '$1')
  19781. .split(' on ')[0]
  19782. );
  19783. return os;
  19784. }
  19785. /**
  19786. * An iteration utility for arrays and objects.
  19787. *
  19788. * @private
  19789. * @param {Array|Object} object The object to iterate over.
  19790. * @param {Function} callback The function called per iteration.
  19791. */
  19792. function each(object, callback) {
  19793. var index = -1,
  19794. length = object ? object.length : 0;
  19795. if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
  19796. while (++index < length) {
  19797. callback(object[index], index, object);
  19798. }
  19799. } else {
  19800. forOwn(object, callback);
  19801. }
  19802. }
  19803. /**
  19804. * Trim and conditionally capitalize string values.
  19805. *
  19806. * @private
  19807. * @param {string} string The string to format.
  19808. * @returns {string} The formatted string.
  19809. */
  19810. function format(string) {
  19811. string = trim(string);
  19812. return /^(?:webOS|i(?:OS|P))/.test(string)
  19813. ? string
  19814. : capitalize(string);
  19815. }
  19816. /**
  19817. * Iterates over an object's own properties, executing the `callback` for each.
  19818. *
  19819. * @private
  19820. * @param {Object} object The object to iterate over.
  19821. * @param {Function} callback The function executed per own property.
  19822. */
  19823. function forOwn(object, callback) {
  19824. for (var key in object) {
  19825. if (hasOwnProperty.call(object, key)) {
  19826. callback(object[key], key, object);
  19827. }
  19828. }
  19829. }
  19830. /**
  19831. * Gets the internal `[[Class]]` of a value.
  19832. *
  19833. * @private
  19834. * @param {*} value The value.
  19835. * @returns {string} The `[[Class]]`.
  19836. */
  19837. function getClassOf(value) {
  19838. return value == null
  19839. ? capitalize(value)
  19840. : toString.call(value).slice(8, -1);
  19841. }
  19842. /**
  19843. * Host objects can return type values that are different from their actual
  19844. * data type. The objects we are concerned with usually return non-primitive
  19845. * types of "object", "function", or "unknown".
  19846. *
  19847. * @private
  19848. * @param {*} object The owner of the property.
  19849. * @param {string} property The property to check.
  19850. * @returns {boolean} Returns `true` if the property value is a non-primitive, else `false`.
  19851. */
  19852. function isHostType(object, property) {
  19853. var type = object != null ? typeof object[property] : 'number';
  19854. return !/^(?:boolean|number|string|undefined)$/.test(type) &&
  19855. (type == 'object' ? !!object[property] : true);
  19856. }
  19857. /**
  19858. * Prepares a string for use in a `RegExp` by making hyphens and spaces optional.
  19859. *
  19860. * @private
  19861. * @param {string} string The string to qualify.
  19862. * @returns {string} The qualified string.
  19863. */
  19864. function qualify(string) {
  19865. return String(string).replace(/([ -])(?!$)/g, '$1?');
  19866. }
  19867. /**
  19868. * A bare-bones `Array#reduce` like utility function.
  19869. *
  19870. * @private
  19871. * @param {Array} array The array to iterate over.
  19872. * @param {Function} callback The function called per iteration.
  19873. * @returns {*} The accumulated result.
  19874. */
  19875. function reduce(array, callback) {
  19876. var accumulator = null;
  19877. each(array, function(value, index) {
  19878. accumulator = callback(accumulator, value, index, array);
  19879. });
  19880. return accumulator;
  19881. }
  19882. /**
  19883. * Removes leading and trailing whitespace from a string.
  19884. *
  19885. * @private
  19886. * @param {string} string The string to trim.
  19887. * @returns {string} The trimmed string.
  19888. */
  19889. function trim(string) {
  19890. return String(string).replace(/^ +| +$/g, '');
  19891. }
  19892. /*--------------------------------------------------------------------------*/
  19893. /**
  19894. * Creates a new platform object.
  19895. *
  19896. * @memberOf platform
  19897. * @param {Object|string} [ua=navigator.userAgent] The user agent string or
  19898. * context object.
  19899. * @returns {Object} A platform object.
  19900. */
  19901. function parse(ua) {
  19902. /** The environment context object. */
  19903. var context = root;
  19904. /** Used to flag when a custom context is provided. */
  19905. var isCustomContext = ua && typeof ua == 'object' && getClassOf(ua) != 'String';
  19906. // Juggle arguments.
  19907. if (isCustomContext) {
  19908. context = ua;
  19909. ua = null;
  19910. }
  19911. /** Browser navigator object. */
  19912. var nav = context.navigator || {};
  19913. /** Browser user agent string. */
  19914. var userAgent = nav.userAgent || '';
  19915. ua || (ua = userAgent);
  19916. /** Used to flag when `thisBinding` is the [ModuleScope]. */
  19917. var isModuleScope = isCustomContext || thisBinding == oldRoot;
  19918. /** Used to detect if browser is like Chrome. */
  19919. var likeChrome = isCustomContext
  19920. ? !!nav.likeChrome
  19921. : /\bChrome\b/.test(ua) && !/internal|\n/i.test(toString.toString());
  19922. /** Internal `[[Class]]` value shortcuts. */
  19923. var objectClass = 'Object',
  19924. airRuntimeClass = isCustomContext ? objectClass : 'ScriptBridgingProxyObject',
  19925. enviroClass = isCustomContext ? objectClass : 'Environment',
  19926. javaClass = (isCustomContext && context.java) ? 'JavaPackage' : getClassOf(context.java),
  19927. phantomClass = isCustomContext ? objectClass : 'RuntimeObject';
  19928. /** Detect Java environments. */
  19929. var java = /\bJava/.test(javaClass) && context.java;
  19930. /** Detect Rhino. */
  19931. var rhino = java && getClassOf(context.environment) == enviroClass;
  19932. /** A character to represent alpha. */
  19933. var alpha = java ? 'a' : '\u03b1';
  19934. /** A character to represent beta. */
  19935. var beta = java ? 'b' : '\u03b2';
  19936. /** Browser document object. */
  19937. var doc = context.document || {};
  19938. /**
  19939. * Detect Opera browser (Presto-based).
  19940. * http://www.howtocreate.co.uk/operaStuff/operaObject.html
  19941. * http://dev.opera.com/articles/view/opera-mini-web-content-authoring-guidelines/#operamini
  19942. */
  19943. var opera = context.operamini || context.opera;
  19944. /** Opera `[[Class]]`. */
  19945. var operaClass = reOpera.test(operaClass = (isCustomContext && opera) ? opera['[[Class]]'] : getClassOf(opera))
  19946. ? operaClass
  19947. : (opera = null);
  19948. /*------------------------------------------------------------------------*/
  19949. /** Temporary variable used over the script's lifetime. */
  19950. var data;
  19951. /** The CPU architecture. */
  19952. var arch = ua;
  19953. /** Platform description array. */
  19954. var description = [];
  19955. /** Platform alpha/beta indicator. */
  19956. var prerelease = null;
  19957. /** A flag to indicate that environment features should be used to resolve the platform. */
  19958. var useFeatures = ua == userAgent;
  19959. /** The browser/environment version. */
  19960. var version = useFeatures && opera && typeof opera.version == 'function' && opera.version();
  19961. /** A flag to indicate if the OS ends with "/ Version" */
  19962. var isSpecialCasedOS;
  19963. /* Detectable layout engines (order is important). */
  19964. var layout = getLayout([
  19965. { 'label': 'EdgeHTML', 'pattern': 'Edge' },
  19966. 'Trident',
  19967. { 'label': 'WebKit', 'pattern': 'AppleWebKit' },
  19968. 'iCab',
  19969. 'Presto',
  19970. 'NetFront',
  19971. 'Tasman',
  19972. 'KHTML',
  19973. 'Gecko'
  19974. ]);
  19975. /* Detectable browser names (order is important). */
  19976. var name = getName([
  19977. 'Adobe AIR',
  19978. 'Arora',
  19979. 'Avant Browser',
  19980. 'Breach',
  19981. 'Camino',
  19982. 'Electron',
  19983. 'Epiphany',
  19984. 'Fennec',
  19985. 'Flock',
  19986. 'Galeon',
  19987. 'GreenBrowser',
  19988. 'iCab',
  19989. 'Iceweasel',
  19990. 'K-Meleon',
  19991. 'Konqueror',
  19992. 'Lunascape',
  19993. 'Maxthon',
  19994. { 'label': 'Microsoft Edge', 'pattern': '(?:Edge|Edg|EdgA|EdgiOS)' },
  19995. 'Midori',
  19996. 'Nook Browser',
  19997. 'PaleMoon',
  19998. 'PhantomJS',
  19999. 'Raven',
  20000. 'Rekonq',
  20001. 'RockMelt',
  20002. { 'label': 'Samsung Internet', 'pattern': 'SamsungBrowser' },
  20003. 'SeaMonkey',
  20004. { 'label': 'Silk', 'pattern': '(?:Cloud9|Silk-Accelerated)' },
  20005. 'Sleipnir',
  20006. 'SlimBrowser',
  20007. { 'label': 'SRWare Iron', 'pattern': 'Iron' },
  20008. 'Sunrise',
  20009. 'Swiftfox',
  20010. 'Vivaldi',
  20011. 'Waterfox',
  20012. 'WebPositive',
  20013. { 'label': 'Yandex Browser', 'pattern': 'YaBrowser' },
  20014. { 'label': 'UC Browser', 'pattern': 'UCBrowser' },
  20015. 'Opera Mini',
  20016. { 'label': 'Opera Mini', 'pattern': 'OPiOS' },
  20017. 'Opera',
  20018. { 'label': 'Opera', 'pattern': 'OPR' },
  20019. 'Chromium',
  20020. 'Chrome',
  20021. { 'label': 'Chrome', 'pattern': '(?:HeadlessChrome)' },
  20022. { 'label': 'Chrome Mobile', 'pattern': '(?:CriOS|CrMo)' },
  20023. { 'label': 'Firefox', 'pattern': '(?:Firefox|Minefield)' },
  20024. { 'label': 'Firefox for iOS', 'pattern': 'FxiOS' },
  20025. { 'label': 'IE', 'pattern': 'IEMobile' },
  20026. { 'label': 'IE', 'pattern': 'MSIE' },
  20027. 'Safari'
  20028. ]);
  20029. /* Detectable products (order is important). */
  20030. var product = getProduct([
  20031. { 'label': 'BlackBerry', 'pattern': 'BB10' },
  20032. 'BlackBerry',
  20033. { 'label': 'Galaxy S', 'pattern': 'GT-I9000' },
  20034. { 'label': 'Galaxy S2', 'pattern': 'GT-I9100' },
  20035. { 'label': 'Galaxy S3', 'pattern': 'GT-I9300' },
  20036. { 'label': 'Galaxy S4', 'pattern': 'GT-I9500' },
  20037. { 'label': 'Galaxy S5', 'pattern': 'SM-G900' },
  20038. { 'label': 'Galaxy S6', 'pattern': 'SM-G920' },
  20039. { 'label': 'Galaxy S6 Edge', 'pattern': 'SM-G925' },
  20040. { 'label': 'Galaxy S7', 'pattern': 'SM-G930' },
  20041. { 'label': 'Galaxy S7 Edge', 'pattern': 'SM-G935' },
  20042. 'Google TV',
  20043. 'Lumia',
  20044. 'iPad',
  20045. 'iPod',
  20046. 'iPhone',
  20047. 'Kindle',
  20048. { 'label': 'Kindle Fire', 'pattern': '(?:Cloud9|Silk-Accelerated)' },
  20049. 'Nexus',
  20050. 'Nook',
  20051. 'PlayBook',
  20052. 'PlayStation Vita',
  20053. 'PlayStation',
  20054. 'TouchPad',
  20055. 'Transformer',
  20056. { 'label': 'Wii U', 'pattern': 'WiiU' },
  20057. 'Wii',
  20058. 'Xbox One',
  20059. { 'label': 'Xbox 360', 'pattern': 'Xbox' },
  20060. 'Xoom'
  20061. ]);
  20062. /* Detectable manufacturers. */
  20063. var manufacturer = getManufacturer({
  20064. 'Apple': { 'iPad': 1, 'iPhone': 1, 'iPod': 1 },
  20065. 'Alcatel': {},
  20066. 'Archos': {},
  20067. 'Amazon': { 'Kindle': 1, 'Kindle Fire': 1 },
  20068. 'Asus': { 'Transformer': 1 },
  20069. 'Barnes & Noble': { 'Nook': 1 },
  20070. 'BlackBerry': { 'PlayBook': 1 },
  20071. 'Google': { 'Google TV': 1, 'Nexus': 1 },
  20072. 'HP': { 'TouchPad': 1 },
  20073. 'HTC': {},
  20074. 'Huawei': {},
  20075. 'Lenovo': {},
  20076. 'LG': {},
  20077. 'Microsoft': { 'Xbox': 1, 'Xbox One': 1 },
  20078. 'Motorola': { 'Xoom': 1 },
  20079. 'Nintendo': { 'Wii U': 1, 'Wii': 1 },
  20080. 'Nokia': { 'Lumia': 1 },
  20081. 'Oppo': {},
  20082. 'Samsung': { 'Galaxy S': 1, 'Galaxy S2': 1, 'Galaxy S3': 1, 'Galaxy S4': 1 },
  20083. 'Sony': { 'PlayStation': 1, 'PlayStation Vita': 1 },
  20084. 'Xiaomi': { 'Mi': 1, 'Redmi': 1 }
  20085. });
  20086. /* Detectable operating systems (order is important). */
  20087. var os = getOS([
  20088. 'Windows Phone',
  20089. 'KaiOS',
  20090. 'Android',
  20091. 'CentOS',
  20092. { 'label': 'Chrome OS', 'pattern': 'CrOS' },
  20093. 'Debian',
  20094. { 'label': 'DragonFly BSD', 'pattern': 'DragonFly' },
  20095. 'Fedora',
  20096. 'FreeBSD',
  20097. 'Gentoo',
  20098. 'Haiku',
  20099. 'Kubuntu',
  20100. 'Linux Mint',
  20101. 'OpenBSD',
  20102. 'Red Hat',
  20103. 'SuSE',
  20104. 'Ubuntu',
  20105. 'Xubuntu',
  20106. 'Cygwin',
  20107. 'Symbian OS',
  20108. 'hpwOS',
  20109. 'webOS ',
  20110. 'webOS',
  20111. 'Tablet OS',
  20112. 'Tizen',
  20113. 'Linux',
  20114. 'Mac OS X',
  20115. 'Macintosh',
  20116. 'Mac',
  20117. 'Windows 98;',
  20118. 'Windows '
  20119. ]);
  20120. /*------------------------------------------------------------------------*/
  20121. /**
  20122. * Picks the layout engine from an array of guesses.
  20123. *
  20124. * @private
  20125. * @param {Array} guesses An array of guesses.
  20126. * @returns {null|string} The detected layout engine.
  20127. */
  20128. function getLayout(guesses) {
  20129. return reduce(guesses, function(result, guess) {
  20130. return result || RegExp('\\b' + (
  20131. guess.pattern || qualify(guess)
  20132. ) + '\\b', 'i').exec(ua) && (guess.label || guess);
  20133. });
  20134. }
  20135. /**
  20136. * Picks the manufacturer from an array of guesses.
  20137. *
  20138. * @private
  20139. * @param {Array} guesses An object of guesses.
  20140. * @returns {null|string} The detected manufacturer.
  20141. */
  20142. function getManufacturer(guesses) {
  20143. return reduce(guesses, function(result, value, key) {
  20144. // Lookup the manufacturer by product or scan the UA for the manufacturer.
  20145. return result || (
  20146. value[product] ||
  20147. value[/^[a-z]+(?: +[a-z]+\b)*/i.exec(product)] ||
  20148. RegExp('\\b' + qualify(key) + '(?:\\b|\\w*\\d)', 'i').exec(ua)
  20149. ) && key;
  20150. });
  20151. }
  20152. /**
  20153. * Picks the browser name from an array of guesses.
  20154. *
  20155. * @private
  20156. * @param {Array} guesses An array of guesses.
  20157. * @returns {null|string} The detected browser name.
  20158. */
  20159. function getName(guesses) {
  20160. return reduce(guesses, function(result, guess) {
  20161. return result || RegExp('\\b' + (
  20162. guess.pattern || qualify(guess)
  20163. ) + '\\b', 'i').exec(ua) && (guess.label || guess);
  20164. });
  20165. }
  20166. /**
  20167. * Picks the OS name from an array of guesses.
  20168. *
  20169. * @private
  20170. * @param {Array} guesses An array of guesses.
  20171. * @returns {null|string} The detected OS name.
  20172. */
  20173. function getOS(guesses) {
  20174. return reduce(guesses, function(result, guess) {
  20175. var pattern = guess.pattern || qualify(guess);
  20176. if (!result && (result =
  20177. RegExp('\\b' + pattern + '(?:/[\\d.]+|[ \\w.]*)', 'i').exec(ua)
  20178. )) {
  20179. result = cleanupOS(result, pattern, guess.label || guess);
  20180. }
  20181. return result;
  20182. });
  20183. }
  20184. /**
  20185. * Picks the product name from an array of guesses.
  20186. *
  20187. * @private
  20188. * @param {Array} guesses An array of guesses.
  20189. * @returns {null|string} The detected product name.
  20190. */
  20191. function getProduct(guesses) {
  20192. return reduce(guesses, function(result, guess) {
  20193. var pattern = guess.pattern || qualify(guess);
  20194. if (!result && (result =
  20195. RegExp('\\b' + pattern + ' *\\d+[.\\w_]*', 'i').exec(ua) ||
  20196. RegExp('\\b' + pattern + ' *\\w+-[\\w]*', 'i').exec(ua) ||
  20197. RegExp('\\b' + pattern + '(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)', 'i').exec(ua)
  20198. )) {
  20199. // Split by forward slash and append product version if needed.
  20200. if ((result = String((guess.label && !RegExp(pattern, 'i').test(guess.label)) ? guess.label : result).split('/'))[1] && !/[\d.]+/.test(result[0])) {
  20201. result[0] += ' ' + result[1];
  20202. }
  20203. // Correct character case and cleanup string.
  20204. guess = guess.label || guess;
  20205. result = format(result[0]
  20206. .replace(RegExp(pattern, 'i'), guess)
  20207. .replace(RegExp('; *(?:' + guess + '[_-])?', 'i'), ' ')
  20208. .replace(RegExp('(' + guess + ')[-_.]?(\\w)', 'i'), '$1 $2'));
  20209. }
  20210. return result;
  20211. });
  20212. }
  20213. /**
  20214. * Resolves the version using an array of UA patterns.
  20215. *
  20216. * @private
  20217. * @param {Array} patterns An array of UA patterns.
  20218. * @returns {null|string} The detected version.
  20219. */
  20220. function getVersion(patterns) {
  20221. return reduce(patterns, function(result, pattern) {
  20222. return result || (RegExp(pattern +
  20223. '(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)', 'i').exec(ua) || 0)[1] || null;
  20224. });
  20225. }
  20226. /**
  20227. * Returns `platform.description` when the platform object is coerced to a string.
  20228. *
  20229. * @name toString
  20230. * @memberOf platform
  20231. * @returns {string} Returns `platform.description` if available, else an empty string.
  20232. */
  20233. function toStringPlatform() {
  20234. return this.description || '';
  20235. }
  20236. /*------------------------------------------------------------------------*/
  20237. // Convert layout to an array so we can add extra details.
  20238. layout && (layout = [layout]);
  20239. // Detect Android products.
  20240. // Browsers on Android devices typically provide their product IDS after "Android;"
  20241. // up to "Build" or ") AppleWebKit".
  20242. // Example:
  20243. // "Mozilla/5.0 (Linux; Android 8.1.0; Moto G (5) Plus) AppleWebKit/537.36
  20244. // (KHTML, like Gecko) Chrome/70.0.3538.80 Mobile Safari/537.36"
  20245. if (/\bAndroid\b/.test(os) && !product &&
  20246. (data = /\bAndroid[^;]*;(.*?)(?:Build|\) AppleWebKit)\b/i.exec(ua))) {
  20247. product = trim(data[1])
  20248. // Replace any language codes (eg. "en-US").
  20249. .replace(/^[a-z]{2}-[a-z]{2};\s*/i, '')
  20250. || null;
  20251. }
  20252. // Detect product names that contain their manufacturer's name.
  20253. if (manufacturer && !product) {
  20254. product = getProduct([manufacturer]);
  20255. } else if (manufacturer && product) {
  20256. product = product
  20257. .replace(RegExp('^(' + qualify(manufacturer) + ')[-_.\\s]', 'i'), manufacturer + ' ')
  20258. .replace(RegExp('^(' + qualify(manufacturer) + ')[-_.]?(\\w)', 'i'), manufacturer + ' $2');
  20259. }
  20260. // Clean up Google TV.
  20261. if ((data = /\bGoogle TV\b/.exec(product))) {
  20262. product = data[0];
  20263. }
  20264. // Detect simulators.
  20265. if (/\bSimulator\b/i.test(ua)) {
  20266. product = (product ? product + ' ' : '') + 'Simulator';
  20267. }
  20268. // Detect Opera Mini 8+ running in Turbo/Uncompressed mode on iOS.
  20269. if (name == 'Opera Mini' && /\bOPiOS\b/.test(ua)) {
  20270. description.push('running in Turbo/Uncompressed mode');
  20271. }
  20272. // Detect IE Mobile 11.
  20273. if (name == 'IE' && /\blike iPhone OS\b/.test(ua)) {
  20274. data = parse(ua.replace(/like iPhone OS/, ''));
  20275. manufacturer = data.manufacturer;
  20276. product = data.product;
  20277. }
  20278. // Detect iOS.
  20279. else if (/^iP/.test(product)) {
  20280. name || (name = 'Safari');
  20281. os = 'iOS' + ((data = / OS ([\d_]+)/i.exec(ua))
  20282. ? ' ' + data[1].replace(/_/g, '.')
  20283. : '');
  20284. }
  20285. // Detect Kubuntu.
  20286. else if (name == 'Konqueror' && /^Linux\b/i.test(os)) {
  20287. os = 'Kubuntu';
  20288. }
  20289. // Detect Android browsers.
  20290. else if ((manufacturer && manufacturer != 'Google' &&
  20291. ((/Chrome/.test(name) && !/\bMobile Safari\b/i.test(ua)) || /\bVita\b/.test(product))) ||
  20292. (/\bAndroid\b/.test(os) && /^Chrome/.test(name) && /\bVersion\//i.test(ua))) {
  20293. name = 'Android Browser';
  20294. os = /\bAndroid\b/.test(os) ? os : 'Android';
  20295. }
  20296. // Detect Silk desktop/accelerated modes.
  20297. else if (name == 'Silk') {
  20298. if (!/\bMobi/i.test(ua)) {
  20299. os = 'Android';
  20300. description.unshift('desktop mode');
  20301. }
  20302. if (/Accelerated *= *true/i.test(ua)) {
  20303. description.unshift('accelerated');
  20304. }
  20305. }
  20306. // Detect UC Browser speed mode.
  20307. else if (name == 'UC Browser' && /\bUCWEB\b/.test(ua)) {
  20308. description.push('speed mode');
  20309. }
  20310. // Detect PaleMoon identifying as Firefox.
  20311. else if (name == 'PaleMoon' && (data = /\bFirefox\/([\d.]+)\b/.exec(ua))) {
  20312. description.push('identifying as Firefox ' + data[1]);
  20313. }
  20314. // Detect Firefox OS and products running Firefox.
  20315. else if (name == 'Firefox' && (data = /\b(Mobile|Tablet|TV)\b/i.exec(ua))) {
  20316. os || (os = 'Firefox OS');
  20317. product || (product = data[1]);
  20318. }
  20319. // Detect false positives for Firefox/Safari.
  20320. else if (!name || (data = !/\bMinefield\b/i.test(ua) && /\b(?:Firefox|Safari)\b/.exec(name))) {
  20321. // Escape the `/` for Firefox 1.
  20322. if (name && !product && /[\/,]|^[^(]+?\)/.test(ua.slice(ua.indexOf(data + '/') + 8))) {
  20323. // Clear name of false positives.
  20324. name = null;
  20325. }
  20326. // Reassign a generic name.
  20327. if ((data = product || manufacturer || os) &&
  20328. (product || manufacturer || /\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(os))) {
  20329. name = /[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(os) ? os : data) + ' Browser';
  20330. }
  20331. }
  20332. // Add Chrome version to description for Electron.
  20333. else if (name == 'Electron' && (data = (/\bChrome\/([\d.]+)\b/.exec(ua) || 0)[1])) {
  20334. description.push('Chromium ' + data);
  20335. }
  20336. // Detect non-Opera (Presto-based) versions (order is important).
  20337. if (!version) {
  20338. version = getVersion([
  20339. '(?:Cloud9|CriOS|CrMo|Edge|Edg|EdgA|EdgiOS|FxiOS|HeadlessChrome|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$)|UCBrowser|YaBrowser)',
  20340. 'Version',
  20341. qualify(name),
  20342. '(?:Firefox|Minefield|NetFront)'
  20343. ]);
  20344. }
  20345. // Detect stubborn layout engines.
  20346. if ((data =
  20347. layout == 'iCab' && parseFloat(version) > 3 && 'WebKit' ||
  20348. /\bOpera\b/.test(name) && (/\bOPR\b/.test(ua) ? 'Blink' : 'Presto') ||
  20349. /\b(?:Midori|Nook|Safari)\b/i.test(ua) && !/^(?:Trident|EdgeHTML)$/.test(layout) && 'WebKit' ||
  20350. !layout && /\bMSIE\b/i.test(ua) && (os == 'Mac OS' ? 'Tasman' : 'Trident') ||
  20351. layout == 'WebKit' && /\bPlayStation\b(?! Vita\b)/i.test(name) && 'NetFront'
  20352. )) {
  20353. layout = [data];
  20354. }
  20355. // Detect Windows Phone 7 desktop mode.
  20356. if (name == 'IE' && (data = (/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(ua) || 0)[1])) {
  20357. name += ' Mobile';
  20358. os = 'Windows Phone ' + (/\+$/.test(data) ? data : data + '.x');
  20359. description.unshift('desktop mode');
  20360. }
  20361. // Detect Windows Phone 8.x desktop mode.
  20362. else if (/\bWPDesktop\b/i.test(ua)) {
  20363. name = 'IE Mobile';
  20364. os = 'Windows Phone 8.x';
  20365. description.unshift('desktop mode');
  20366. version || (version = (/\brv:([\d.]+)/.exec(ua) || 0)[1]);
  20367. }
  20368. // Detect IE 11 identifying as other browsers.
  20369. else if (name != 'IE' && layout == 'Trident' && (data = /\brv:([\d.]+)/.exec(ua))) {
  20370. if (name) {
  20371. description.push('identifying as ' + name + (version ? ' ' + version : ''));
  20372. }
  20373. name = 'IE';
  20374. version = data[1];
  20375. }
  20376. // Leverage environment features.
  20377. if (useFeatures) {
  20378. // Detect server-side environments.
  20379. // Rhino has a global function while others have a global object.
  20380. if (isHostType(context, 'global')) {
  20381. if (java) {
  20382. data = java.lang.System;
  20383. arch = data.getProperty('os.arch');
  20384. os = os || data.getProperty('os.name') + ' ' + data.getProperty('os.version');
  20385. }
  20386. if (rhino) {
  20387. try {
  20388. version = context.require('ringo/engine').version.join('.');
  20389. name = 'RingoJS';
  20390. } catch(e) {
  20391. if ((data = context.system) && data.global.system == context.system) {
  20392. name = 'Narwhal';
  20393. os || (os = data[0].os || null);
  20394. }
  20395. }
  20396. if (!name) {
  20397. name = 'Rhino';
  20398. }
  20399. }
  20400. else if (
  20401. typeof context.process == 'object' && !context.process.browser &&
  20402. (data = context.process)
  20403. ) {
  20404. if (typeof data.versions == 'object') {
  20405. if (typeof data.versions.electron == 'string') {
  20406. description.push('Node ' + data.versions.node);
  20407. name = 'Electron';
  20408. version = data.versions.electron;
  20409. } else if (typeof data.versions.nw == 'string') {
  20410. description.push('Chromium ' + version, 'Node ' + data.versions.node);
  20411. name = 'NW.js';
  20412. version = data.versions.nw;
  20413. }
  20414. }
  20415. if (!name) {
  20416. name = 'Node.js';
  20417. arch = data.arch;
  20418. os = data.platform;
  20419. version = /[\d.]+/.exec(data.version);
  20420. version = version ? version[0] : null;
  20421. }
  20422. }
  20423. }
  20424. // Detect Adobe AIR.
  20425. else if (getClassOf((data = context.runtime)) == airRuntimeClass) {
  20426. name = 'Adobe AIR';
  20427. os = data.flash.system.Capabilities.os;
  20428. }
  20429. // Detect PhantomJS.
  20430. else if (getClassOf((data = context.phantom)) == phantomClass) {
  20431. name = 'PhantomJS';
  20432. version = (data = data.version || null) && (data.major + '.' + data.minor + '.' + data.patch);
  20433. }
  20434. // Detect IE compatibility modes.
  20435. else if (typeof doc.documentMode == 'number' && (data = /\bTrident\/(\d+)/i.exec(ua))) {
  20436. // We're in compatibility mode when the Trident version + 4 doesn't
  20437. // equal the document mode.
  20438. version = [version, doc.documentMode];
  20439. if ((data = +data[1] + 4) != version[1]) {
  20440. description.push('IE ' + version[1] + ' mode');
  20441. layout && (layout[1] = '');
  20442. version[1] = data;
  20443. }
  20444. version = name == 'IE' ? String(version[1].toFixed(1)) : version[0];
  20445. }
  20446. // Detect IE 11 masking as other browsers.
  20447. else if (typeof doc.documentMode == 'number' && /^(?:Chrome|Firefox)\b/.test(name)) {
  20448. description.push('masking as ' + name + ' ' + version);
  20449. name = 'IE';
  20450. version = '11.0';
  20451. layout = ['Trident'];
  20452. os = 'Windows';
  20453. }
  20454. os = os && format(os);
  20455. }
  20456. // Detect prerelease phases.
  20457. if (version && (data =
  20458. /(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(version) ||
  20459. /(?:alpha|beta)(?: ?\d)?/i.exec(ua + ';' + (useFeatures && nav.appMinorVersion)) ||
  20460. /\bMinefield\b/i.test(ua) && 'a'
  20461. )) {
  20462. prerelease = /b/i.test(data) ? 'beta' : 'alpha';
  20463. version = version.replace(RegExp(data + '\\+?$'), '') +
  20464. (prerelease == 'beta' ? beta : alpha) + (/\d+\+?/.exec(data) || '');
  20465. }
  20466. // Detect Firefox Mobile.
  20467. if (name == 'Fennec' || name == 'Firefox' && /\b(?:Android|Firefox OS|KaiOS)\b/.test(os)) {
  20468. name = 'Firefox Mobile';
  20469. }
  20470. // Obscure Maxthon's unreliable version.
  20471. else if (name == 'Maxthon' && version) {
  20472. version = version.replace(/\.[\d.]+/, '.x');
  20473. }
  20474. // Detect Xbox 360 and Xbox One.
  20475. else if (/\bXbox\b/i.test(product)) {
  20476. if (product == 'Xbox 360') {
  20477. os = null;
  20478. }
  20479. if (product == 'Xbox 360' && /\bIEMobile\b/.test(ua)) {
  20480. description.unshift('mobile mode');
  20481. }
  20482. }
  20483. // Add mobile postfix.
  20484. else if ((/^(?:Chrome|IE|Opera)$/.test(name) || name && !product && !/Browser|Mobi/.test(name)) &&
  20485. (os == 'Windows CE' || /Mobi/i.test(ua))) {
  20486. name += ' Mobile';
  20487. }
  20488. // Detect IE platform preview.
  20489. else if (name == 'IE' && useFeatures) {
  20490. try {
  20491. if (context.external === null) {
  20492. description.unshift('platform preview');
  20493. }
  20494. } catch(e) {
  20495. description.unshift('embedded');
  20496. }
  20497. }
  20498. // Detect BlackBerry OS version.
  20499. // http://docs.blackberry.com/en/developers/deliverables/18169/HTTP_headers_sent_by_BB_Browser_1234911_11.jsp
  20500. else if ((/\bBlackBerry\b/.test(product) || /\bBB10\b/.test(ua)) && (data =
  20501. (RegExp(product.replace(/ +/g, ' *') + '/([.\\d]+)', 'i').exec(ua) || 0)[1] ||
  20502. version
  20503. )) {
  20504. data = [data, /BB10/.test(ua)];
  20505. os = (data[1] ? (product = null, manufacturer = 'BlackBerry') : 'Device Software') + ' ' + data[0];
  20506. version = null;
  20507. }
  20508. // Detect Opera identifying/masking itself as another browser.
  20509. // http://www.opera.com/support/kb/view/843/
  20510. else if (this != forOwn && product != 'Wii' && (
  20511. (useFeatures && opera) ||
  20512. (/Opera/.test(name) && /\b(?:MSIE|Firefox)\b/i.test(ua)) ||
  20513. (name == 'Firefox' && /\bOS X (?:\d+\.){2,}/.test(os)) ||
  20514. (name == 'IE' && (
  20515. (os && !/^Win/.test(os) && version > 5.5) ||
  20516. /\bWindows XP\b/.test(os) && version > 8 ||
  20517. version == 8 && !/\bTrident\b/.test(ua)
  20518. ))
  20519. ) && !reOpera.test((data = parse.call(forOwn, ua.replace(reOpera, '') + ';'))) && data.name) {
  20520. // When "identifying", the UA contains both Opera and the other browser's name.
  20521. data = 'ing as ' + data.name + ((data = data.version) ? ' ' + data : '');
  20522. if (reOpera.test(name)) {
  20523. if (/\bIE\b/.test(data) && os == 'Mac OS') {
  20524. os = null;
  20525. }
  20526. data = 'identify' + data;
  20527. }
  20528. // When "masking", the UA contains only the other browser's name.
  20529. else {
  20530. data = 'mask' + data;
  20531. if (operaClass) {
  20532. name = format(operaClass.replace(/([a-z])([A-Z])/g, '$1 $2'));
  20533. } else {
  20534. name = 'Opera';
  20535. }
  20536. if (/\bIE\b/.test(data)) {
  20537. os = null;
  20538. }
  20539. if (!useFeatures) {
  20540. version = null;
  20541. }
  20542. }
  20543. layout = ['Presto'];
  20544. description.push(data);
  20545. }
  20546. // Detect WebKit Nightly and approximate Chrome/Safari versions.
  20547. if ((data = (/\bAppleWebKit\/([\d.]+\+?)/i.exec(ua) || 0)[1])) {
  20548. // Correct build number for numeric comparison.
  20549. // (e.g. "532.5" becomes "532.05")
  20550. data = [parseFloat(data.replace(/\.(\d)$/, '.0$1')), data];
  20551. // Nightly builds are postfixed with a "+".
  20552. if (name == 'Safari' && data[1].slice(-1) == '+') {
  20553. name = 'WebKit Nightly';
  20554. prerelease = 'alpha';
  20555. version = data[1].slice(0, -1);
  20556. }
  20557. // Clear incorrect browser versions.
  20558. else if (version == data[1] ||
  20559. version == (data[2] = (/\bSafari\/([\d.]+\+?)/i.exec(ua) || 0)[1])) {
  20560. version = null;
  20561. }
  20562. // Use the full Chrome version when available.
  20563. data[1] = (/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(ua) || 0)[1];
  20564. // Detect Blink layout engine.
  20565. if (data[0] == 537.36 && data[2] == 537.36 && parseFloat(data[1]) >= 28 && layout == 'WebKit') {
  20566. layout = ['Blink'];
  20567. }
  20568. // Detect JavaScriptCore.
  20569. // http://stackoverflow.com/questions/6768474/how-can-i-detect-which-javascript-engine-v8-or-jsc-is-used-at-runtime-in-androi
  20570. if (!useFeatures || (!likeChrome && !data[1])) {
  20571. layout && (layout[1] = 'like Safari');
  20572. data = (data = data[0], data < 400 ? 1 : data < 500 ? 2 : data < 526 ? 3 : data < 533 ? 4 : data < 534 ? '4+' : data < 535 ? 5 : data < 537 ? 6 : data < 538 ? 7 : data < 601 ? 8 : data < 602 ? 9 : data < 604 ? 10 : data < 606 ? 11 : data < 608 ? 12 : '12');
  20573. } else {
  20574. layout && (layout[1] = 'like Chrome');
  20575. data = data[1] || (data = data[0], data < 530 ? 1 : data < 532 ? 2 : data < 532.05 ? 3 : data < 533 ? 4 : data < 534.03 ? 5 : data < 534.07 ? 6 : data < 534.10 ? 7 : data < 534.13 ? 8 : data < 534.16 ? 9 : data < 534.24 ? 10 : data < 534.30 ? 11 : data < 535.01 ? 12 : data < 535.02 ? '13+' : data < 535.07 ? 15 : data < 535.11 ? 16 : data < 535.19 ? 17 : data < 536.05 ? 18 : data < 536.10 ? 19 : data < 537.01 ? 20 : data < 537.11 ? '21+' : data < 537.13 ? 23 : data < 537.18 ? 24 : data < 537.24 ? 25 : data < 537.36 ? 26 : layout != 'Blink' ? '27' : '28');
  20576. }
  20577. // Add the postfix of ".x" or "+" for approximate versions.
  20578. layout && (layout[1] += ' ' + (data += typeof data == 'number' ? '.x' : /[.+]/.test(data) ? '' : '+'));
  20579. // Obscure version for some Safari 1-2 releases.
  20580. if (name == 'Safari' && (!version || parseInt(version) > 45)) {
  20581. version = data;
  20582. } else if (name == 'Chrome' && /\bHeadlessChrome/i.test(ua)) {
  20583. description.unshift('headless');
  20584. }
  20585. }
  20586. // Detect Opera desktop modes.
  20587. if (name == 'Opera' && (data = /\bzbov|zvav$/.exec(os))) {
  20588. name += ' ';
  20589. description.unshift('desktop mode');
  20590. if (data == 'zvav') {
  20591. name += 'Mini';
  20592. version = null;
  20593. } else {
  20594. name += 'Mobile';
  20595. }
  20596. os = os.replace(RegExp(' *' + data + '$'), '');
  20597. }
  20598. // Detect Chrome desktop mode.
  20599. else if (name == 'Safari' && /\bChrome\b/.exec(layout && layout[1])) {
  20600. description.unshift('desktop mode');
  20601. name = 'Chrome Mobile';
  20602. version = null;
  20603. if (/\bOS X\b/.test(os)) {
  20604. manufacturer = 'Apple';
  20605. os = 'iOS 4.3+';
  20606. } else {
  20607. os = null;
  20608. }
  20609. }
  20610. // Newer versions of SRWare Iron uses the Chrome tag to indicate its version number.
  20611. else if (/\bSRWare Iron\b/.test(name) && !version) {
  20612. version = getVersion('Chrome');
  20613. }
  20614. // Strip incorrect OS versions.
  20615. if (version && version.indexOf((data = /[\d.]+$/.exec(os))) == 0 &&
  20616. ua.indexOf('/' + data + '-') > -1) {
  20617. os = trim(os.replace(data, ''));
  20618. }
  20619. // Ensure OS does not include the browser name.
  20620. if (os && os.indexOf(name) != -1 && !RegExp(name + ' OS').test(os)) {
  20621. os = os.replace(RegExp(' *' + qualify(name) + ' *'), '');
  20622. }
  20623. // Add layout engine.
  20624. if (layout && !/\b(?:Avant|Nook)\b/.test(name) && (
  20625. /Browser|Lunascape|Maxthon/.test(name) ||
  20626. name != 'Safari' && /^iOS/.test(os) && /\bSafari\b/.test(layout[1]) ||
  20627. /^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(name) && layout[1])) {
  20628. // Don't add layout details to description if they are falsey.
  20629. (data = layout[layout.length - 1]) && description.push(data);
  20630. }
  20631. // Combine contextual information.
  20632. if (description.length) {
  20633. description = ['(' + description.join('; ') + ')'];
  20634. }
  20635. // Append manufacturer to description.
  20636. if (manufacturer && product && product.indexOf(manufacturer) < 0) {
  20637. description.push('on ' + manufacturer);
  20638. }
  20639. // Append product to description.
  20640. if (product) {
  20641. description.push((/^on /.test(description[description.length - 1]) ? '' : 'on ') + product);
  20642. }
  20643. // Parse the OS into an object.
  20644. if (os) {
  20645. data = / ([\d.+]+)$/.exec(os);
  20646. isSpecialCasedOS = data && os.charAt(os.length - data[0].length - 1) == '/';
  20647. os = {
  20648. 'architecture': 32,
  20649. 'family': (data && !isSpecialCasedOS) ? os.replace(data[0], '') : os,
  20650. 'version': data ? data[1] : null,
  20651. 'toString': function() {
  20652. var version = this.version;
  20653. return this.family + ((version && !isSpecialCasedOS) ? ' ' + version : '') + (this.architecture == 64 ? ' 64-bit' : '');
  20654. }
  20655. };
  20656. }
  20657. // Add browser/OS architecture.
  20658. if ((data = /\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(arch)) && !/\bi686\b/i.test(arch)) {
  20659. if (os) {
  20660. os.architecture = 64;
  20661. os.family = os.family.replace(RegExp(' *' + data), '');
  20662. }
  20663. if (
  20664. name && (/\bWOW64\b/i.test(ua) ||
  20665. (useFeatures && /\w(?:86|32)$/.test(nav.cpuClass || nav.platform) && !/\bWin64; x64\b/i.test(ua)))
  20666. ) {
  20667. description.unshift('32-bit');
  20668. }
  20669. }
  20670. // Chrome 39 and above on OS X is always 64-bit.
  20671. else if (
  20672. os && /^OS X/.test(os.family) &&
  20673. name == 'Chrome' && parseFloat(version) >= 39
  20674. ) {
  20675. os.architecture = 64;
  20676. }
  20677. ua || (ua = null);
  20678. /*------------------------------------------------------------------------*/
  20679. /**
  20680. * The platform object.
  20681. *
  20682. * @name platform
  20683. * @type Object
  20684. */
  20685. var platform = {};
  20686. /**
  20687. * The platform description.
  20688. *
  20689. * @memberOf platform
  20690. * @type string|null
  20691. */
  20692. platform.description = ua;
  20693. /**
  20694. * The name of the browser's layout engine.
  20695. *
  20696. * The list of common layout engines include:
  20697. * "Blink", "EdgeHTML", "Gecko", "Trident" and "WebKit"
  20698. *
  20699. * @memberOf platform
  20700. * @type string|null
  20701. */
  20702. platform.layout = layout && layout[0];
  20703. /**
  20704. * The name of the product's manufacturer.
  20705. *
  20706. * The list of manufacturers include:
  20707. * "Apple", "Archos", "Amazon", "Asus", "Barnes & Noble", "BlackBerry",
  20708. * "Google", "HP", "HTC", "LG", "Microsoft", "Motorola", "Nintendo",
  20709. * "Nokia", "Samsung" and "Sony"
  20710. *
  20711. * @memberOf platform
  20712. * @type string|null
  20713. */
  20714. platform.manufacturer = manufacturer;
  20715. /**
  20716. * The name of the browser/environment.
  20717. *
  20718. * The list of common browser names include:
  20719. * "Chrome", "Electron", "Firefox", "Firefox for iOS", "IE",
  20720. * "Microsoft Edge", "PhantomJS", "Safari", "SeaMonkey", "Silk",
  20721. * "Opera Mini" and "Opera"
  20722. *
  20723. * Mobile versions of some browsers have "Mobile" appended to their name:
  20724. * eg. "Chrome Mobile", "Firefox Mobile", "IE Mobile" and "Opera Mobile"
  20725. *
  20726. * @memberOf platform
  20727. * @type string|null
  20728. */
  20729. platform.name = name;
  20730. /**
  20731. * The alpha/beta release indicator.
  20732. *
  20733. * @memberOf platform
  20734. * @type string|null
  20735. */
  20736. platform.prerelease = prerelease;
  20737. /**
  20738. * The name of the product hosting the browser.
  20739. *
  20740. * The list of common products include:
  20741. *
  20742. * "BlackBerry", "Galaxy S4", "Lumia", "iPad", "iPod", "iPhone", "Kindle",
  20743. * "Kindle Fire", "Nexus", "Nook", "PlayBook", "TouchPad" and "Transformer"
  20744. *
  20745. * @memberOf platform
  20746. * @type string|null
  20747. */
  20748. platform.product = product;
  20749. /**
  20750. * The browser's user agent string.
  20751. *
  20752. * @memberOf platform
  20753. * @type string|null
  20754. */
  20755. platform.ua = ua;
  20756. /**
  20757. * The browser/environment version.
  20758. *
  20759. * @memberOf platform
  20760. * @type string|null
  20761. */
  20762. platform.version = name && version;
  20763. /**
  20764. * The name of the operating system.
  20765. *
  20766. * @memberOf platform
  20767. * @type Object
  20768. */
  20769. platform.os = os || {
  20770. /**
  20771. * The CPU architecture the OS is built for.
  20772. *
  20773. * @memberOf platform.os
  20774. * @type number|null
  20775. */
  20776. 'architecture': null,
  20777. /**
  20778. * The family of the OS.
  20779. *
  20780. * Common values include:
  20781. * "Windows", "Windows Server 2008 R2 / 7", "Windows Server 2008 / Vista",
  20782. * "Windows XP", "OS X", "Linux", "Ubuntu", "Debian", "Fedora", "Red Hat",
  20783. * "SuSE", "Android", "iOS" and "Windows Phone"
  20784. *
  20785. * @memberOf platform.os
  20786. * @type string|null
  20787. */
  20788. 'family': null,
  20789. /**
  20790. * The version of the OS.
  20791. *
  20792. * @memberOf platform.os
  20793. * @type string|null
  20794. */
  20795. 'version': null,
  20796. /**
  20797. * Returns the OS string.
  20798. *
  20799. * @memberOf platform.os
  20800. * @returns {string} The OS string.
  20801. */
  20802. 'toString': function() { return 'null'; }
  20803. };
  20804. platform.parse = parse;
  20805. platform.toString = toStringPlatform;
  20806. if (platform.version) {
  20807. description.unshift(version);
  20808. }
  20809. if (platform.name) {
  20810. description.unshift(name);
  20811. }
  20812. if (os && name && !(os == String(os).split(' ')[0] && (os == name.split(' ')[0] || product))) {
  20813. description.push(product ? '(' + os + ')' : 'on ' + os);
  20814. }
  20815. if (description.length) {
  20816. platform.description = description.join(' ');
  20817. }
  20818. return platform;
  20819. }
  20820. /*--------------------------------------------------------------------------*/
  20821. // Export platform.
  20822. var platform = parse();
  20823. // Some AMD build optimizers, like r.js, check for condition patterns like the following:
  20824. if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
  20825. // Expose platform on the global object to prevent errors when platform is
  20826. // loaded by a script tag in the presence of an AMD loader.
  20827. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  20828. root.platform = platform;
  20829. // Define as an anonymous module so platform can be aliased through path mapping.
  20830. define(function() {
  20831. return platform;
  20832. });
  20833. }
  20834. // Check for `exports` after `define` in case a build optimizer adds an `exports` object.
  20835. else if (freeExports && freeModule) {
  20836. // Export for CommonJS support.
  20837. forOwn(platform, function(value, key) {
  20838. freeExports[key] = value;
  20839. });
  20840. }
  20841. else {
  20842. // Export to the global object.
  20843. root.platform = platform;
  20844. }
  20845. }.call(this));
  20846. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  20847. },{}],380:[function(require,module,exports){
  20848. (function (process){(function (){
  20849. 'use strict';
  20850. if (typeof process === 'undefined' ||
  20851. !process.version ||
  20852. process.version.indexOf('v0.') === 0 ||
  20853. process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
  20854. module.exports = { nextTick: nextTick };
  20855. } else {
  20856. module.exports = process
  20857. }
  20858. function nextTick(fn, arg1, arg2, arg3) {
  20859. if (typeof fn !== 'function') {
  20860. throw new TypeError('"callback" argument must be a function');
  20861. }
  20862. var len = arguments.length;
  20863. var args, i;
  20864. switch (len) {
  20865. case 0:
  20866. case 1:
  20867. return process.nextTick(fn);
  20868. case 2:
  20869. return process.nextTick(function afterTickOne() {
  20870. fn.call(null, arg1);
  20871. });
  20872. case 3:
  20873. return process.nextTick(function afterTickTwo() {
  20874. fn.call(null, arg1, arg2);
  20875. });
  20876. case 4:
  20877. return process.nextTick(function afterTickThree() {
  20878. fn.call(null, arg1, arg2, arg3);
  20879. });
  20880. default:
  20881. args = new Array(len - 1);
  20882. i = 0;
  20883. while (i < args.length) {
  20884. args[i++] = arguments[i];
  20885. }
  20886. return process.nextTick(function afterTick() {
  20887. fn.apply(null, args);
  20888. });
  20889. }
  20890. }
  20891. }).call(this)}).call(this,require('_process'))
  20892. },{"_process":467}],381:[function(require,module,exports){
  20893. // shim for using process in browser
  20894. var process = module.exports = {};
  20895. // cached from whatever global is present so that test runners that stub it
  20896. // don't break things. But we need to wrap it in a try catch in case it is
  20897. // wrapped in strict mode code which doesn't define any globals. It's inside a
  20898. // function because try/catches deoptimize in certain engines.
  20899. var cachedSetTimeout;
  20900. var cachedClearTimeout;
  20901. function defaultSetTimout() {
  20902. throw new Error('setTimeout has not been defined');
  20903. }
  20904. function defaultClearTimeout () {
  20905. throw new Error('clearTimeout has not been defined');
  20906. }
  20907. (function () {
  20908. try {
  20909. if (typeof setTimeout === 'function') {
  20910. cachedSetTimeout = setTimeout;
  20911. } else {
  20912. cachedSetTimeout = defaultSetTimout;
  20913. }
  20914. } catch (e) {
  20915. cachedSetTimeout = defaultSetTimout;
  20916. }
  20917. try {
  20918. if (typeof clearTimeout === 'function') {
  20919. cachedClearTimeout = clearTimeout;
  20920. } else {
  20921. cachedClearTimeout = defaultClearTimeout;
  20922. }
  20923. } catch (e) {
  20924. cachedClearTimeout = defaultClearTimeout;
  20925. }
  20926. } ())
  20927. function runTimeout(fun) {
  20928. if (cachedSetTimeout === setTimeout) {
  20929. //normal enviroments in sane situations
  20930. return setTimeout(fun, 0);
  20931. }
  20932. // if setTimeout wasn't available but was latter defined
  20933. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  20934. cachedSetTimeout = setTimeout;
  20935. return setTimeout(fun, 0);
  20936. }
  20937. try {
  20938. // when when somebody has screwed with setTimeout but no I.E. maddness
  20939. return cachedSetTimeout(fun, 0);
  20940. } catch(e){
  20941. try {
  20942. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  20943. return cachedSetTimeout.call(null, fun, 0);
  20944. } catch(e){
  20945. // 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
  20946. return cachedSetTimeout.call(this, fun, 0);
  20947. }
  20948. }
  20949. }
  20950. function runClearTimeout(marker) {
  20951. if (cachedClearTimeout === clearTimeout) {
  20952. //normal enviroments in sane situations
  20953. return clearTimeout(marker);
  20954. }
  20955. // if clearTimeout wasn't available but was latter defined
  20956. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  20957. cachedClearTimeout = clearTimeout;
  20958. return clearTimeout(marker);
  20959. }
  20960. try {
  20961. // when when somebody has screwed with setTimeout but no I.E. maddness
  20962. return cachedClearTimeout(marker);
  20963. } catch (e){
  20964. try {
  20965. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  20966. return cachedClearTimeout.call(null, marker);
  20967. } catch (e){
  20968. // 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.
  20969. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  20970. return cachedClearTimeout.call(this, marker);
  20971. }
  20972. }
  20973. }
  20974. var queue = [];
  20975. var draining = false;
  20976. var currentQueue;
  20977. var queueIndex = -1;
  20978. function cleanUpNextTick() {
  20979. if (!draining || !currentQueue) {
  20980. return;
  20981. }
  20982. draining = false;
  20983. if (currentQueue.length) {
  20984. queue = currentQueue.concat(queue);
  20985. } else {
  20986. queueIndex = -1;
  20987. }
  20988. if (queue.length) {
  20989. drainQueue();
  20990. }
  20991. }
  20992. function drainQueue() {
  20993. if (draining) {
  20994. return;
  20995. }
  20996. var timeout = runTimeout(cleanUpNextTick);
  20997. draining = true;
  20998. var len = queue.length;
  20999. while(len) {
  21000. currentQueue = queue;
  21001. queue = [];
  21002. while (++queueIndex < len) {
  21003. if (currentQueue) {
  21004. currentQueue[queueIndex].run();
  21005. }
  21006. }
  21007. queueIndex = -1;
  21008. len = queue.length;
  21009. }
  21010. currentQueue = null;
  21011. draining = false;
  21012. runClearTimeout(timeout);
  21013. }
  21014. process.nextTick = function (fun) {
  21015. var args = new Array(arguments.length - 1);
  21016. if (arguments.length > 1) {
  21017. for (var i = 1; i < arguments.length; i++) {
  21018. args[i - 1] = arguments[i];
  21019. }
  21020. }
  21021. queue.push(new Item(fun, args));
  21022. if (queue.length === 1 && !draining) {
  21023. runTimeout(drainQueue);
  21024. }
  21025. };
  21026. // v8 likes predictible objects
  21027. function Item(fun, array) {
  21028. this.fun = fun;
  21029. this.array = array;
  21030. }
  21031. Item.prototype.run = function () {
  21032. this.fun.apply(null, this.array);
  21033. };
  21034. process.title = 'browser';
  21035. process.browser = true;
  21036. process.env = {};
  21037. process.argv = [];
  21038. process.version = ''; // empty string to avoid regexp issues
  21039. process.versions = {};
  21040. function noop() {}
  21041. process.on = noop;
  21042. process.addListener = noop;
  21043. process.once = noop;
  21044. process.off = noop;
  21045. process.removeListener = noop;
  21046. process.removeAllListeners = noop;
  21047. process.emit = noop;
  21048. process.prependListener = noop;
  21049. process.prependOnceListener = noop;
  21050. process.listeners = function (name) { return [] }
  21051. process.binding = function (name) {
  21052. throw new Error('process.binding is not supported');
  21053. };
  21054. process.cwd = function () { return '/' };
  21055. process.chdir = function (dir) {
  21056. throw new Error('process.chdir is not supported');
  21057. };
  21058. process.umask = function() { return 0; };
  21059. },{}],382:[function(require,module,exports){
  21060. (function (global){(function (){
  21061. /*! https://mths.be/punycode v1.4.1 by @mathias */
  21062. ;(function(root) {
  21063. /** Detect free variables */
  21064. var freeExports = typeof exports == 'object' && exports &&
  21065. !exports.nodeType && exports;
  21066. var freeModule = typeof module == 'object' && module &&
  21067. !module.nodeType && module;
  21068. var freeGlobal = typeof global == 'object' && global;
  21069. if (
  21070. freeGlobal.global === freeGlobal ||
  21071. freeGlobal.window === freeGlobal ||
  21072. freeGlobal.self === freeGlobal
  21073. ) {
  21074. root = freeGlobal;
  21075. }
  21076. /**
  21077. * The `punycode` object.
  21078. * @name punycode
  21079. * @type Object
  21080. */
  21081. var punycode,
  21082. /** Highest positive signed 32-bit float value */
  21083. maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
  21084. /** Bootstring parameters */
  21085. base = 36,
  21086. tMin = 1,
  21087. tMax = 26,
  21088. skew = 38,
  21089. damp = 700,
  21090. initialBias = 72,
  21091. initialN = 128, // 0x80
  21092. delimiter = '-', // '\x2D'
  21093. /** Regular expressions */
  21094. regexPunycode = /^xn--/,
  21095. regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
  21096. regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
  21097. /** Error messages */
  21098. errors = {
  21099. 'overflow': 'Overflow: input needs wider integers to process',
  21100. 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
  21101. 'invalid-input': 'Invalid input'
  21102. },
  21103. /** Convenience shortcuts */
  21104. baseMinusTMin = base - tMin,
  21105. floor = Math.floor,
  21106. stringFromCharCode = String.fromCharCode,
  21107. /** Temporary variable */
  21108. key;
  21109. /*--------------------------------------------------------------------------*/
  21110. /**
  21111. * A generic error utility function.
  21112. * @private
  21113. * @param {String} type The error type.
  21114. * @returns {Error} Throws a `RangeError` with the applicable error message.
  21115. */
  21116. function error(type) {
  21117. throw new RangeError(errors[type]);
  21118. }
  21119. /**
  21120. * A generic `Array#map` utility function.
  21121. * @private
  21122. * @param {Array} array The array to iterate over.
  21123. * @param {Function} callback The function that gets called for every array
  21124. * item.
  21125. * @returns {Array} A new array of values returned by the callback function.
  21126. */
  21127. function map(array, fn) {
  21128. var length = array.length;
  21129. var result = [];
  21130. while (length--) {
  21131. result[length] = fn(array[length]);
  21132. }
  21133. return result;
  21134. }
  21135. /**
  21136. * A simple `Array#map`-like wrapper to work with domain name strings or email
  21137. * addresses.
  21138. * @private
  21139. * @param {String} domain The domain name or email address.
  21140. * @param {Function} callback The function that gets called for every
  21141. * character.
  21142. * @returns {Array} A new string of characters returned by the callback
  21143. * function.
  21144. */
  21145. function mapDomain(string, fn) {
  21146. var parts = string.split('@');
  21147. var result = '';
  21148. if (parts.length > 1) {
  21149. // In email addresses, only the domain name should be punycoded. Leave
  21150. // the local part (i.e. everything up to `@`) intact.
  21151. result = parts[0] + '@';
  21152. string = parts[1];
  21153. }
  21154. // Avoid `split(regex)` for IE8 compatibility. See #17.
  21155. string = string.replace(regexSeparators, '\x2E');
  21156. var labels = string.split('.');
  21157. var encoded = map(labels, fn).join('.');
  21158. return result + encoded;
  21159. }
  21160. /**
  21161. * Creates an array containing the numeric code points of each Unicode
  21162. * character in the string. While JavaScript uses UCS-2 internally,
  21163. * this function will convert a pair of surrogate halves (each of which
  21164. * UCS-2 exposes as separate characters) into a single code point,
  21165. * matching UTF-16.
  21166. * @see `punycode.ucs2.encode`
  21167. * @see <https://mathiasbynens.be/notes/javascript-encoding>
  21168. * @memberOf punycode.ucs2
  21169. * @name decode
  21170. * @param {String} string The Unicode input string (UCS-2).
  21171. * @returns {Array} The new array of code points.
  21172. */
  21173. function ucs2decode(string) {
  21174. var output = [],
  21175. counter = 0,
  21176. length = string.length,
  21177. value,
  21178. extra;
  21179. while (counter < length) {
  21180. value = string.charCodeAt(counter++);
  21181. if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
  21182. // high surrogate, and there is a next character
  21183. extra = string.charCodeAt(counter++);
  21184. if ((extra & 0xFC00) == 0xDC00) { // low surrogate
  21185. output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
  21186. } else {
  21187. // unmatched surrogate; only append this code unit, in case the next
  21188. // code unit is the high surrogate of a surrogate pair
  21189. output.push(value);
  21190. counter--;
  21191. }
  21192. } else {
  21193. output.push(value);
  21194. }
  21195. }
  21196. return output;
  21197. }
  21198. /**
  21199. * Creates a string based on an array of numeric code points.
  21200. * @see `punycode.ucs2.decode`
  21201. * @memberOf punycode.ucs2
  21202. * @name encode
  21203. * @param {Array} codePoints The array of numeric code points.
  21204. * @returns {String} The new Unicode string (UCS-2).
  21205. */
  21206. function ucs2encode(array) {
  21207. return map(array, function(value) {
  21208. var output = '';
  21209. if (value > 0xFFFF) {
  21210. value -= 0x10000;
  21211. output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
  21212. value = 0xDC00 | value & 0x3FF;
  21213. }
  21214. output += stringFromCharCode(value);
  21215. return output;
  21216. }).join('');
  21217. }
  21218. /**
  21219. * Converts a basic code point into a digit/integer.
  21220. * @see `digitToBasic()`
  21221. * @private
  21222. * @param {Number} codePoint The basic numeric code point value.
  21223. * @returns {Number} The numeric value of a basic code point (for use in
  21224. * representing integers) in the range `0` to `base - 1`, or `base` if
  21225. * the code point does not represent a value.
  21226. */
  21227. function basicToDigit(codePoint) {
  21228. if (codePoint - 48 < 10) {
  21229. return codePoint - 22;
  21230. }
  21231. if (codePoint - 65 < 26) {
  21232. return codePoint - 65;
  21233. }
  21234. if (codePoint - 97 < 26) {
  21235. return codePoint - 97;
  21236. }
  21237. return base;
  21238. }
  21239. /**
  21240. * Converts a digit/integer into a basic code point.
  21241. * @see `basicToDigit()`
  21242. * @private
  21243. * @param {Number} digit The numeric value of a basic code point.
  21244. * @returns {Number} The basic code point whose value (when used for
  21245. * representing integers) is `digit`, which needs to be in the range
  21246. * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
  21247. * used; else, the lowercase form is used. The behavior is undefined
  21248. * if `flag` is non-zero and `digit` has no uppercase form.
  21249. */
  21250. function digitToBasic(digit, flag) {
  21251. // 0..25 map to ASCII a..z or A..Z
  21252. // 26..35 map to ASCII 0..9
  21253. return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
  21254. }
  21255. /**
  21256. * Bias adaptation function as per section 3.4 of RFC 3492.
  21257. * https://tools.ietf.org/html/rfc3492#section-3.4
  21258. * @private
  21259. */
  21260. function adapt(delta, numPoints, firstTime) {
  21261. var k = 0;
  21262. delta = firstTime ? floor(delta / damp) : delta >> 1;
  21263. delta += floor(delta / numPoints);
  21264. for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
  21265. delta = floor(delta / baseMinusTMin);
  21266. }
  21267. return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
  21268. }
  21269. /**
  21270. * Converts a Punycode string of ASCII-only symbols to a string of Unicode
  21271. * symbols.
  21272. * @memberOf punycode
  21273. * @param {String} input The Punycode string of ASCII-only symbols.
  21274. * @returns {String} The resulting string of Unicode symbols.
  21275. */
  21276. function decode(input) {
  21277. // Don't use UCS-2
  21278. var output = [],
  21279. inputLength = input.length,
  21280. out,
  21281. i = 0,
  21282. n = initialN,
  21283. bias = initialBias,
  21284. basic,
  21285. j,
  21286. index,
  21287. oldi,
  21288. w,
  21289. k,
  21290. digit,
  21291. t,
  21292. /** Cached calculation results */
  21293. baseMinusT;
  21294. // Handle the basic code points: let `basic` be the number of input code
  21295. // points before the last delimiter, or `0` if there is none, then copy
  21296. // the first basic code points to the output.
  21297. basic = input.lastIndexOf(delimiter);
  21298. if (basic < 0) {
  21299. basic = 0;
  21300. }
  21301. for (j = 0; j < basic; ++j) {
  21302. // if it's not a basic code point
  21303. if (input.charCodeAt(j) >= 0x80) {
  21304. error('not-basic');
  21305. }
  21306. output.push(input.charCodeAt(j));
  21307. }
  21308. // Main decoding loop: start just after the last delimiter if any basic code
  21309. // points were copied; start at the beginning otherwise.
  21310. for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
  21311. // `index` is the index of the next character to be consumed.
  21312. // Decode a generalized variable-length integer into `delta`,
  21313. // which gets added to `i`. The overflow checking is easier
  21314. // if we increase `i` as we go, then subtract off its starting
  21315. // value at the end to obtain `delta`.
  21316. for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
  21317. if (index >= inputLength) {
  21318. error('invalid-input');
  21319. }
  21320. digit = basicToDigit(input.charCodeAt(index++));
  21321. if (digit >= base || digit > floor((maxInt - i) / w)) {
  21322. error('overflow');
  21323. }
  21324. i += digit * w;
  21325. t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
  21326. if (digit < t) {
  21327. break;
  21328. }
  21329. baseMinusT = base - t;
  21330. if (w > floor(maxInt / baseMinusT)) {
  21331. error('overflow');
  21332. }
  21333. w *= baseMinusT;
  21334. }
  21335. out = output.length + 1;
  21336. bias = adapt(i - oldi, out, oldi == 0);
  21337. // `i` was supposed to wrap around from `out` to `0`,
  21338. // incrementing `n` each time, so we'll fix that now:
  21339. if (floor(i / out) > maxInt - n) {
  21340. error('overflow');
  21341. }
  21342. n += floor(i / out);
  21343. i %= out;
  21344. // Insert `n` at position `i` of the output
  21345. output.splice(i++, 0, n);
  21346. }
  21347. return ucs2encode(output);
  21348. }
  21349. /**
  21350. * Converts a string of Unicode symbols (e.g. a domain name label) to a
  21351. * Punycode string of ASCII-only symbols.
  21352. * @memberOf punycode
  21353. * @param {String} input The string of Unicode symbols.
  21354. * @returns {String} The resulting Punycode string of ASCII-only symbols.
  21355. */
  21356. function encode(input) {
  21357. var n,
  21358. delta,
  21359. handledCPCount,
  21360. basicLength,
  21361. bias,
  21362. j,
  21363. m,
  21364. q,
  21365. k,
  21366. t,
  21367. currentValue,
  21368. output = [],
  21369. /** `inputLength` will hold the number of code points in `input`. */
  21370. inputLength,
  21371. /** Cached calculation results */
  21372. handledCPCountPlusOne,
  21373. baseMinusT,
  21374. qMinusT;
  21375. // Convert the input in UCS-2 to Unicode
  21376. input = ucs2decode(input);
  21377. // Cache the length
  21378. inputLength = input.length;
  21379. // Initialize the state
  21380. n = initialN;
  21381. delta = 0;
  21382. bias = initialBias;
  21383. // Handle the basic code points
  21384. for (j = 0; j < inputLength; ++j) {
  21385. currentValue = input[j];
  21386. if (currentValue < 0x80) {
  21387. output.push(stringFromCharCode(currentValue));
  21388. }
  21389. }
  21390. handledCPCount = basicLength = output.length;
  21391. // `handledCPCount` is the number of code points that have been handled;
  21392. // `basicLength` is the number of basic code points.
  21393. // Finish the basic string - if it is not empty - with a delimiter
  21394. if (basicLength) {
  21395. output.push(delimiter);
  21396. }
  21397. // Main encoding loop:
  21398. while (handledCPCount < inputLength) {
  21399. // All non-basic code points < n have been handled already. Find the next
  21400. // larger one:
  21401. for (m = maxInt, j = 0; j < inputLength; ++j) {
  21402. currentValue = input[j];
  21403. if (currentValue >= n && currentValue < m) {
  21404. m = currentValue;
  21405. }
  21406. }
  21407. // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
  21408. // but guard against overflow
  21409. handledCPCountPlusOne = handledCPCount + 1;
  21410. if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
  21411. error('overflow');
  21412. }
  21413. delta += (m - n) * handledCPCountPlusOne;
  21414. n = m;
  21415. for (j = 0; j < inputLength; ++j) {
  21416. currentValue = input[j];
  21417. if (currentValue < n && ++delta > maxInt) {
  21418. error('overflow');
  21419. }
  21420. if (currentValue == n) {
  21421. // Represent delta as a generalized variable-length integer
  21422. for (q = delta, k = base; /* no condition */; k += base) {
  21423. t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
  21424. if (q < t) {
  21425. break;
  21426. }
  21427. qMinusT = q - t;
  21428. baseMinusT = base - t;
  21429. output.push(
  21430. stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
  21431. );
  21432. q = floor(qMinusT / baseMinusT);
  21433. }
  21434. output.push(stringFromCharCode(digitToBasic(q, 0)));
  21435. bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
  21436. delta = 0;
  21437. ++handledCPCount;
  21438. }
  21439. }
  21440. ++delta;
  21441. ++n;
  21442. }
  21443. return output.join('');
  21444. }
  21445. /**
  21446. * Converts a Punycode string representing a domain name or an email address
  21447. * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
  21448. * it doesn't matter if you call it on a string that has already been
  21449. * converted to Unicode.
  21450. * @memberOf punycode
  21451. * @param {String} input The Punycoded domain name or email address to
  21452. * convert to Unicode.
  21453. * @returns {String} The Unicode representation of the given Punycode
  21454. * string.
  21455. */
  21456. function toUnicode(input) {
  21457. return mapDomain(input, function(string) {
  21458. return regexPunycode.test(string)
  21459. ? decode(string.slice(4).toLowerCase())
  21460. : string;
  21461. });
  21462. }
  21463. /**
  21464. * Converts a Unicode string representing a domain name or an email address to
  21465. * Punycode. Only the non-ASCII parts of the domain name will be converted,
  21466. * i.e. it doesn't matter if you call it with a domain that's already in
  21467. * ASCII.
  21468. * @memberOf punycode
  21469. * @param {String} input The domain name or email address to convert, as a
  21470. * Unicode string.
  21471. * @returns {String} The Punycode representation of the given domain name or
  21472. * email address.
  21473. */
  21474. function toASCII(input) {
  21475. return mapDomain(input, function(string) {
  21476. return regexNonASCII.test(string)
  21477. ? 'xn--' + encode(string)
  21478. : string;
  21479. });
  21480. }
  21481. /*--------------------------------------------------------------------------*/
  21482. /** Define the public API */
  21483. punycode = {
  21484. /**
  21485. * A string representing the current Punycode.js version number.
  21486. * @memberOf punycode
  21487. * @type String
  21488. */
  21489. 'version': '1.4.1',
  21490. /**
  21491. * An object of methods to convert from JavaScript's internal character
  21492. * representation (UCS-2) to Unicode code points, and back.
  21493. * @see <https://mathiasbynens.be/notes/javascript-encoding>
  21494. * @memberOf punycode
  21495. * @type Object
  21496. */
  21497. 'ucs2': {
  21498. 'decode': ucs2decode,
  21499. 'encode': ucs2encode
  21500. },
  21501. 'decode': decode,
  21502. 'encode': encode,
  21503. 'toASCII': toASCII,
  21504. 'toUnicode': toUnicode
  21505. };
  21506. /** Expose `punycode` */
  21507. // Some AMD build optimizers, like r.js, check for specific condition patterns
  21508. // like the following:
  21509. if (
  21510. typeof define == 'function' &&
  21511. typeof define.amd == 'object' &&
  21512. define.amd
  21513. ) {
  21514. define('punycode', function() {
  21515. return punycode;
  21516. });
  21517. } else if (freeExports && freeModule) {
  21518. if (module.exports == freeExports) {
  21519. // in Node.js, io.js, or RingoJS v0.8.0+
  21520. freeModule.exports = punycode;
  21521. } else {
  21522. // in Narwhal or RingoJS v0.7.0-
  21523. for (key in punycode) {
  21524. punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
  21525. }
  21526. }
  21527. } else {
  21528. // in Rhino or a web browser
  21529. root.punycode = punycode;
  21530. }
  21531. }(this));
  21532. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  21533. },{}],383:[function(require,module,exports){
  21534. // Copyright Joyent, Inc. and other Node contributors.
  21535. //
  21536. // Permission is hereby granted, free of charge, to any person obtaining a
  21537. // copy of this software and associated documentation files (the
  21538. // "Software"), to deal in the Software without restriction, including
  21539. // without limitation the rights to use, copy, modify, merge, publish,
  21540. // distribute, sublicense, and/or sell copies of the Software, and to permit
  21541. // persons to whom the Software is furnished to do so, subject to the
  21542. // following conditions:
  21543. //
  21544. // The above copyright notice and this permission notice shall be included
  21545. // in all copies or substantial portions of the Software.
  21546. //
  21547. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  21548. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  21549. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  21550. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  21551. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  21552. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  21553. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  21554. 'use strict';
  21555. // If obj.hasOwnProperty has been overridden, then calling
  21556. // obj.hasOwnProperty(prop) will break.
  21557. // See: https://github.com/joyent/node/issues/1707
  21558. function hasOwnProperty(obj, prop) {
  21559. return Object.prototype.hasOwnProperty.call(obj, prop);
  21560. }
  21561. module.exports = function(qs, sep, eq, options) {
  21562. sep = sep || '&';
  21563. eq = eq || '=';
  21564. var obj = {};
  21565. if (typeof qs !== 'string' || qs.length === 0) {
  21566. return obj;
  21567. }
  21568. var regexp = /\+/g;
  21569. qs = qs.split(sep);
  21570. var maxKeys = 1000;
  21571. if (options && typeof options.maxKeys === 'number') {
  21572. maxKeys = options.maxKeys;
  21573. }
  21574. var len = qs.length;
  21575. // maxKeys <= 0 means that we should not limit keys count
  21576. if (maxKeys > 0 && len > maxKeys) {
  21577. len = maxKeys;
  21578. }
  21579. for (var i = 0; i < len; ++i) {
  21580. var x = qs[i].replace(regexp, '%20'),
  21581. idx = x.indexOf(eq),
  21582. kstr, vstr, k, v;
  21583. if (idx >= 0) {
  21584. kstr = x.substr(0, idx);
  21585. vstr = x.substr(idx + 1);
  21586. } else {
  21587. kstr = x;
  21588. vstr = '';
  21589. }
  21590. k = decodeURIComponent(kstr);
  21591. v = decodeURIComponent(vstr);
  21592. if (!hasOwnProperty(obj, k)) {
  21593. obj[k] = v;
  21594. } else if (isArray(obj[k])) {
  21595. obj[k].push(v);
  21596. } else {
  21597. obj[k] = [obj[k], v];
  21598. }
  21599. }
  21600. return obj;
  21601. };
  21602. var isArray = Array.isArray || function (xs) {
  21603. return Object.prototype.toString.call(xs) === '[object Array]';
  21604. };
  21605. },{}],384:[function(require,module,exports){
  21606. // Copyright Joyent, Inc. and other Node contributors.
  21607. //
  21608. // Permission is hereby granted, free of charge, to any person obtaining a
  21609. // copy of this software and associated documentation files (the
  21610. // "Software"), to deal in the Software without restriction, including
  21611. // without limitation the rights to use, copy, modify, merge, publish,
  21612. // distribute, sublicense, and/or sell copies of the Software, and to permit
  21613. // persons to whom the Software is furnished to do so, subject to the
  21614. // following conditions:
  21615. //
  21616. // The above copyright notice and this permission notice shall be included
  21617. // in all copies or substantial portions of the Software.
  21618. //
  21619. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  21620. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  21621. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  21622. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  21623. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  21624. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  21625. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  21626. 'use strict';
  21627. var stringifyPrimitive = function(v) {
  21628. switch (typeof v) {
  21629. case 'string':
  21630. return v;
  21631. case 'boolean':
  21632. return v ? 'true' : 'false';
  21633. case 'number':
  21634. return isFinite(v) ? v : '';
  21635. default:
  21636. return '';
  21637. }
  21638. };
  21639. module.exports = function(obj, sep, eq, name) {
  21640. sep = sep || '&';
  21641. eq = eq || '=';
  21642. if (obj === null) {
  21643. obj = undefined;
  21644. }
  21645. if (typeof obj === 'object') {
  21646. return map(objectKeys(obj), function(k) {
  21647. var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
  21648. if (isArray(obj[k])) {
  21649. return map(obj[k], function(v) {
  21650. return ks + encodeURIComponent(stringifyPrimitive(v));
  21651. }).join(sep);
  21652. } else {
  21653. return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
  21654. }
  21655. }).join(sep);
  21656. }
  21657. if (!name) return '';
  21658. return encodeURIComponent(stringifyPrimitive(name)) + eq +
  21659. encodeURIComponent(stringifyPrimitive(obj));
  21660. };
  21661. var isArray = Array.isArray || function (xs) {
  21662. return Object.prototype.toString.call(xs) === '[object Array]';
  21663. };
  21664. function map (xs, f) {
  21665. if (xs.map) return xs.map(f);
  21666. var res = [];
  21667. for (var i = 0; i < xs.length; i++) {
  21668. res.push(f(xs[i], i));
  21669. }
  21670. return res;
  21671. }
  21672. var objectKeys = Object.keys || function (obj) {
  21673. var res = [];
  21674. for (var key in obj) {
  21675. if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
  21676. }
  21677. return res;
  21678. };
  21679. },{}],385:[function(require,module,exports){
  21680. 'use strict';
  21681. exports.decode = exports.parse = require('./decode');
  21682. exports.encode = exports.stringify = require('./encode');
  21683. },{"./decode":383,"./encode":384}],386:[function(require,module,exports){
  21684. // Copyright Joyent, Inc. and other Node contributors.
  21685. //
  21686. // Permission is hereby granted, free of charge, to any person obtaining a
  21687. // copy of this software and associated documentation files (the
  21688. // "Software"), to deal in the Software without restriction, including
  21689. // without limitation the rights to use, copy, modify, merge, publish,
  21690. // distribute, sublicense, and/or sell copies of the Software, and to permit
  21691. // persons to whom the Software is furnished to do so, subject to the
  21692. // following conditions:
  21693. //
  21694. // The above copyright notice and this permission notice shall be included
  21695. // in all copies or substantial portions of the Software.
  21696. //
  21697. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  21698. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  21699. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  21700. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  21701. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  21702. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  21703. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  21704. // a duplex stream is just a stream that is both readable and writable.
  21705. // Since JS doesn't have multiple prototypal inheritance, this class
  21706. // prototypally inherits from Readable, and then parasitically from
  21707. // Writable.
  21708. 'use strict';
  21709. /*<replacement>*/
  21710. var pna = require('process-nextick-args');
  21711. /*</replacement>*/
  21712. /*<replacement>*/
  21713. var objectKeys = Object.keys || function (obj) {
  21714. var keys = [];
  21715. for (var key in obj) {
  21716. keys.push(key);
  21717. }return keys;
  21718. };
  21719. /*</replacement>*/
  21720. module.exports = Duplex;
  21721. /*<replacement>*/
  21722. var util = Object.create(require('core-util-is'));
  21723. util.inherits = require('inherits');
  21724. /*</replacement>*/
  21725. var Readable = require('./_stream_readable');
  21726. var Writable = require('./_stream_writable');
  21727. util.inherits(Duplex, Readable);
  21728. {
  21729. // avoid scope creep, the keys array can then be collected
  21730. var keys = objectKeys(Writable.prototype);
  21731. for (var v = 0; v < keys.length; v++) {
  21732. var method = keys[v];
  21733. if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
  21734. }
  21735. }
  21736. function Duplex(options) {
  21737. if (!(this instanceof Duplex)) return new Duplex(options);
  21738. Readable.call(this, options);
  21739. Writable.call(this, options);
  21740. if (options && options.readable === false) this.readable = false;
  21741. if (options && options.writable === false) this.writable = false;
  21742. this.allowHalfOpen = true;
  21743. if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
  21744. this.once('end', onend);
  21745. }
  21746. Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
  21747. // making it explicit this property is not enumerable
  21748. // because otherwise some prototype manipulation in
  21749. // userland will fail
  21750. enumerable: false,
  21751. get: function () {
  21752. return this._writableState.highWaterMark;
  21753. }
  21754. });
  21755. // the no-half-open enforcer
  21756. function onend() {
  21757. // if we allow half-open state, or if the writable side ended,
  21758. // then we're ok.
  21759. if (this.allowHalfOpen || this._writableState.ended) return;
  21760. // no more data can be written.
  21761. // But allow more writes to happen in this tick.
  21762. pna.nextTick(onEndNT, this);
  21763. }
  21764. function onEndNT(self) {
  21765. self.end();
  21766. }
  21767. Object.defineProperty(Duplex.prototype, 'destroyed', {
  21768. get: function () {
  21769. if (this._readableState === undefined || this._writableState === undefined) {
  21770. return false;
  21771. }
  21772. return this._readableState.destroyed && this._writableState.destroyed;
  21773. },
  21774. set: function (value) {
  21775. // we ignore the value if the stream
  21776. // has not been initialized yet
  21777. if (this._readableState === undefined || this._writableState === undefined) {
  21778. return;
  21779. }
  21780. // backward compatibility, the user is explicitly
  21781. // managing destroyed
  21782. this._readableState.destroyed = value;
  21783. this._writableState.destroyed = value;
  21784. }
  21785. });
  21786. Duplex.prototype._destroy = function (err, cb) {
  21787. this.push(null);
  21788. this.end();
  21789. pna.nextTick(cb, err);
  21790. };
  21791. },{"./_stream_readable":388,"./_stream_writable":390,"core-util-is":341,"inherits":364,"process-nextick-args":380}],387:[function(require,module,exports){
  21792. // Copyright Joyent, Inc. and other Node contributors.
  21793. //
  21794. // Permission is hereby granted, free of charge, to any person obtaining a
  21795. // copy of this software and associated documentation files (the
  21796. // "Software"), to deal in the Software without restriction, including
  21797. // without limitation the rights to use, copy, modify, merge, publish,
  21798. // distribute, sublicense, and/or sell copies of the Software, and to permit
  21799. // persons to whom the Software is furnished to do so, subject to the
  21800. // following conditions:
  21801. //
  21802. // The above copyright notice and this permission notice shall be included
  21803. // in all copies or substantial portions of the Software.
  21804. //
  21805. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  21806. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  21807. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  21808. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  21809. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  21810. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  21811. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  21812. // a passthrough stream.
  21813. // basically just the most minimal sort of Transform stream.
  21814. // Every written chunk gets output as-is.
  21815. 'use strict';
  21816. module.exports = PassThrough;
  21817. var Transform = require('./_stream_transform');
  21818. /*<replacement>*/
  21819. var util = Object.create(require('core-util-is'));
  21820. util.inherits = require('inherits');
  21821. /*</replacement>*/
  21822. util.inherits(PassThrough, Transform);
  21823. function PassThrough(options) {
  21824. if (!(this instanceof PassThrough)) return new PassThrough(options);
  21825. Transform.call(this, options);
  21826. }
  21827. PassThrough.prototype._transform = function (chunk, encoding, cb) {
  21828. cb(null, chunk);
  21829. };
  21830. },{"./_stream_transform":389,"core-util-is":341,"inherits":364}],388:[function(require,module,exports){
  21831. (function (process,global){(function (){
  21832. // Copyright Joyent, Inc. and other Node contributors.
  21833. //
  21834. // Permission is hereby granted, free of charge, to any person obtaining a
  21835. // copy of this software and associated documentation files (the
  21836. // "Software"), to deal in the Software without restriction, including
  21837. // without limitation the rights to use, copy, modify, merge, publish,
  21838. // distribute, sublicense, and/or sell copies of the Software, and to permit
  21839. // persons to whom the Software is furnished to do so, subject to the
  21840. // following conditions:
  21841. //
  21842. // The above copyright notice and this permission notice shall be included
  21843. // in all copies or substantial portions of the Software.
  21844. //
  21845. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  21846. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  21847. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  21848. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  21849. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  21850. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  21851. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  21852. 'use strict';
  21853. /*<replacement>*/
  21854. var pna = require('process-nextick-args');
  21855. /*</replacement>*/
  21856. module.exports = Readable;
  21857. /*<replacement>*/
  21858. var isArray = require('isarray');
  21859. /*</replacement>*/
  21860. /*<replacement>*/
  21861. var Duplex;
  21862. /*</replacement>*/
  21863. Readable.ReadableState = ReadableState;
  21864. /*<replacement>*/
  21865. var EE = require('events').EventEmitter;
  21866. var EElistenerCount = function (emitter, type) {
  21867. return emitter.listeners(type).length;
  21868. };
  21869. /*</replacement>*/
  21870. /*<replacement>*/
  21871. var Stream = require('./internal/streams/stream');
  21872. /*</replacement>*/
  21873. /*<replacement>*/
  21874. var Buffer = require('safe-buffer').Buffer;
  21875. var OurUint8Array = global.Uint8Array || function () {};
  21876. function _uint8ArrayToBuffer(chunk) {
  21877. return Buffer.from(chunk);
  21878. }
  21879. function _isUint8Array(obj) {
  21880. return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
  21881. }
  21882. /*</replacement>*/
  21883. /*<replacement>*/
  21884. var util = Object.create(require('core-util-is'));
  21885. util.inherits = require('inherits');
  21886. /*</replacement>*/
  21887. /*<replacement>*/
  21888. var debugUtil = require('util');
  21889. var debug = void 0;
  21890. if (debugUtil && debugUtil.debuglog) {
  21891. debug = debugUtil.debuglog('stream');
  21892. } else {
  21893. debug = function () {};
  21894. }
  21895. /*</replacement>*/
  21896. var BufferList = require('./internal/streams/BufferList');
  21897. var destroyImpl = require('./internal/streams/destroy');
  21898. var StringDecoder;
  21899. util.inherits(Readable, Stream);
  21900. var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
  21901. function prependListener(emitter, event, fn) {
  21902. // Sadly this is not cacheable as some libraries bundle their own
  21903. // event emitter implementation with them.
  21904. if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
  21905. // This is a hack to make sure that our error handler is attached before any
  21906. // userland ones. NEVER DO THIS. This is here only because this code needs
  21907. // to continue to work with older versions of Node.js that do not include
  21908. // the prependListener() method. The goal is to eventually remove this hack.
  21909. if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
  21910. }
  21911. function ReadableState(options, stream) {
  21912. Duplex = Duplex || require('./_stream_duplex');
  21913. options = options || {};
  21914. // Duplex streams are both readable and writable, but share
  21915. // the same options object.
  21916. // However, some cases require setting options to different
  21917. // values for the readable and the writable sides of the duplex stream.
  21918. // These options can be provided separately as readableXXX and writableXXX.
  21919. var isDuplex = stream instanceof Duplex;
  21920. // object stream flag. Used to make read(n) ignore n and to
  21921. // make all the buffer merging and length checks go away
  21922. this.objectMode = !!options.objectMode;
  21923. if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
  21924. // the point at which it stops calling _read() to fill the buffer
  21925. // Note: 0 is a valid value, means "don't call _read preemptively ever"
  21926. var hwm = options.highWaterMark;
  21927. var readableHwm = options.readableHighWaterMark;
  21928. var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  21929. if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
  21930. // cast to ints.
  21931. this.highWaterMark = Math.floor(this.highWaterMark);
  21932. // A linked list is used to store data chunks instead of an array because the
  21933. // linked list can remove elements from the beginning faster than
  21934. // array.shift()
  21935. this.buffer = new BufferList();
  21936. this.length = 0;
  21937. this.pipes = null;
  21938. this.pipesCount = 0;
  21939. this.flowing = null;
  21940. this.ended = false;
  21941. this.endEmitted = false;
  21942. this.reading = false;
  21943. // a flag to be able to tell if the event 'readable'/'data' is emitted
  21944. // immediately, or on a later tick. We set this to true at first, because
  21945. // any actions that shouldn't happen until "later" should generally also
  21946. // not happen before the first read call.
  21947. this.sync = true;
  21948. // whenever we return null, then we set a flag to say
  21949. // that we're awaiting a 'readable' event emission.
  21950. this.needReadable = false;
  21951. this.emittedReadable = false;
  21952. this.readableListening = false;
  21953. this.resumeScheduled = false;
  21954. // has it been destroyed
  21955. this.destroyed = false;
  21956. // Crypto is kind of old and crusty. Historically, its default string
  21957. // encoding is 'binary' so we have to make this configurable.
  21958. // Everything else in the universe uses 'utf8', though.
  21959. this.defaultEncoding = options.defaultEncoding || 'utf8';
  21960. // the number of writers that are awaiting a drain event in .pipe()s
  21961. this.awaitDrain = 0;
  21962. // if true, a maybeReadMore has been scheduled
  21963. this.readingMore = false;
  21964. this.decoder = null;
  21965. this.encoding = null;
  21966. if (options.encoding) {
  21967. if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
  21968. this.decoder = new StringDecoder(options.encoding);
  21969. this.encoding = options.encoding;
  21970. }
  21971. }
  21972. function Readable(options) {
  21973. Duplex = Duplex || require('./_stream_duplex');
  21974. if (!(this instanceof Readable)) return new Readable(options);
  21975. this._readableState = new ReadableState(options, this);
  21976. // legacy
  21977. this.readable = true;
  21978. if (options) {
  21979. if (typeof options.read === 'function') this._read = options.read;
  21980. if (typeof options.destroy === 'function') this._destroy = options.destroy;
  21981. }
  21982. Stream.call(this);
  21983. }
  21984. Object.defineProperty(Readable.prototype, 'destroyed', {
  21985. get: function () {
  21986. if (this._readableState === undefined) {
  21987. return false;
  21988. }
  21989. return this._readableState.destroyed;
  21990. },
  21991. set: function (value) {
  21992. // we ignore the value if the stream
  21993. // has not been initialized yet
  21994. if (!this._readableState) {
  21995. return;
  21996. }
  21997. // backward compatibility, the user is explicitly
  21998. // managing destroyed
  21999. this._readableState.destroyed = value;
  22000. }
  22001. });
  22002. Readable.prototype.destroy = destroyImpl.destroy;
  22003. Readable.prototype._undestroy = destroyImpl.undestroy;
  22004. Readable.prototype._destroy = function (err, cb) {
  22005. this.push(null);
  22006. cb(err);
  22007. };
  22008. // Manually shove something into the read() buffer.
  22009. // This returns true if the highWaterMark has not been hit yet,
  22010. // similar to how Writable.write() returns true if you should
  22011. // write() some more.
  22012. Readable.prototype.push = function (chunk, encoding) {
  22013. var state = this._readableState;
  22014. var skipChunkCheck;
  22015. if (!state.objectMode) {
  22016. if (typeof chunk === 'string') {
  22017. encoding = encoding || state.defaultEncoding;
  22018. if (encoding !== state.encoding) {
  22019. chunk = Buffer.from(chunk, encoding);
  22020. encoding = '';
  22021. }
  22022. skipChunkCheck = true;
  22023. }
  22024. } else {
  22025. skipChunkCheck = true;
  22026. }
  22027. return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
  22028. };
  22029. // Unshift should *always* be something directly out of read()
  22030. Readable.prototype.unshift = function (chunk) {
  22031. return readableAddChunk(this, chunk, null, true, false);
  22032. };
  22033. function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
  22034. var state = stream._readableState;
  22035. if (chunk === null) {
  22036. state.reading = false;
  22037. onEofChunk(stream, state);
  22038. } else {
  22039. var er;
  22040. if (!skipChunkCheck) er = chunkInvalid(state, chunk);
  22041. if (er) {
  22042. stream.emit('error', er);
  22043. } else if (state.objectMode || chunk && chunk.length > 0) {
  22044. if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
  22045. chunk = _uint8ArrayToBuffer(chunk);
  22046. }
  22047. if (addToFront) {
  22048. if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
  22049. } else if (state.ended) {
  22050. stream.emit('error', new Error('stream.push() after EOF'));
  22051. } else {
  22052. state.reading = false;
  22053. if (state.decoder && !encoding) {
  22054. chunk = state.decoder.write(chunk);
  22055. if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
  22056. } else {
  22057. addChunk(stream, state, chunk, false);
  22058. }
  22059. }
  22060. } else if (!addToFront) {
  22061. state.reading = false;
  22062. }
  22063. }
  22064. return needMoreData(state);
  22065. }
  22066. function addChunk(stream, state, chunk, addToFront) {
  22067. if (state.flowing && state.length === 0 && !state.sync) {
  22068. stream.emit('data', chunk);
  22069. stream.read(0);
  22070. } else {
  22071. // update the buffer info.
  22072. state.length += state.objectMode ? 1 : chunk.length;
  22073. if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
  22074. if (state.needReadable) emitReadable(stream);
  22075. }
  22076. maybeReadMore(stream, state);
  22077. }
  22078. function chunkInvalid(state, chunk) {
  22079. var er;
  22080. if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
  22081. er = new TypeError('Invalid non-string/buffer chunk');
  22082. }
  22083. return er;
  22084. }
  22085. // if it's past the high water mark, we can push in some more.
  22086. // Also, if we have no data yet, we can stand some
  22087. // more bytes. This is to work around cases where hwm=0,
  22088. // such as the repl. Also, if the push() triggered a
  22089. // readable event, and the user called read(largeNumber) such that
  22090. // needReadable was set, then we ought to push more, so that another
  22091. // 'readable' event will be triggered.
  22092. function needMoreData(state) {
  22093. return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
  22094. }
  22095. Readable.prototype.isPaused = function () {
  22096. return this._readableState.flowing === false;
  22097. };
  22098. // backwards compatibility.
  22099. Readable.prototype.setEncoding = function (enc) {
  22100. if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
  22101. this._readableState.decoder = new StringDecoder(enc);
  22102. this._readableState.encoding = enc;
  22103. return this;
  22104. };
  22105. // Don't raise the hwm > 8MB
  22106. var MAX_HWM = 0x800000;
  22107. function computeNewHighWaterMark(n) {
  22108. if (n >= MAX_HWM) {
  22109. n = MAX_HWM;
  22110. } else {
  22111. // Get the next highest power of 2 to prevent increasing hwm excessively in
  22112. // tiny amounts
  22113. n--;
  22114. n |= n >>> 1;
  22115. n |= n >>> 2;
  22116. n |= n >>> 4;
  22117. n |= n >>> 8;
  22118. n |= n >>> 16;
  22119. n++;
  22120. }
  22121. return n;
  22122. }
  22123. // This function is designed to be inlinable, so please take care when making
  22124. // changes to the function body.
  22125. function howMuchToRead(n, state) {
  22126. if (n <= 0 || state.length === 0 && state.ended) return 0;
  22127. if (state.objectMode) return 1;
  22128. if (n !== n) {
  22129. // Only flow one buffer at a time
  22130. if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
  22131. }
  22132. // If we're asking for more than the current hwm, then raise the hwm.
  22133. if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
  22134. if (n <= state.length) return n;
  22135. // Don't have enough
  22136. if (!state.ended) {
  22137. state.needReadable = true;
  22138. return 0;
  22139. }
  22140. return state.length;
  22141. }
  22142. // you can override either this method, or the async _read(n) below.
  22143. Readable.prototype.read = function (n) {
  22144. debug('read', n);
  22145. n = parseInt(n, 10);
  22146. var state = this._readableState;
  22147. var nOrig = n;
  22148. if (n !== 0) state.emittedReadable = false;
  22149. // if we're doing read(0) to trigger a readable event, but we
  22150. // already have a bunch of data in the buffer, then just trigger
  22151. // the 'readable' event and move on.
  22152. if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
  22153. debug('read: emitReadable', state.length, state.ended);
  22154. if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
  22155. return null;
  22156. }
  22157. n = howMuchToRead(n, state);
  22158. // if we've ended, and we're now clear, then finish it up.
  22159. if (n === 0 && state.ended) {
  22160. if (state.length === 0) endReadable(this);
  22161. return null;
  22162. }
  22163. // All the actual chunk generation logic needs to be
  22164. // *below* the call to _read. The reason is that in certain
  22165. // synthetic stream cases, such as passthrough streams, _read
  22166. // may be a completely synchronous operation which may change
  22167. // the state of the read buffer, providing enough data when
  22168. // before there was *not* enough.
  22169. //
  22170. // So, the steps are:
  22171. // 1. Figure out what the state of things will be after we do
  22172. // a read from the buffer.
  22173. //
  22174. // 2. If that resulting state will trigger a _read, then call _read.
  22175. // Note that this may be asynchronous, or synchronous. Yes, it is
  22176. // deeply ugly to write APIs this way, but that still doesn't mean
  22177. // that the Readable class should behave improperly, as streams are
  22178. // designed to be sync/async agnostic.
  22179. // Take note if the _read call is sync or async (ie, if the read call
  22180. // has returned yet), so that we know whether or not it's safe to emit
  22181. // 'readable' etc.
  22182. //
  22183. // 3. Actually pull the requested chunks out of the buffer and return.
  22184. // if we need a readable event, then we need to do some reading.
  22185. var doRead = state.needReadable;
  22186. debug('need readable', doRead);
  22187. // if we currently have less than the highWaterMark, then also read some
  22188. if (state.length === 0 || state.length - n < state.highWaterMark) {
  22189. doRead = true;
  22190. debug('length less than watermark', doRead);
  22191. }
  22192. // however, if we've ended, then there's no point, and if we're already
  22193. // reading, then it's unnecessary.
  22194. if (state.ended || state.reading) {
  22195. doRead = false;
  22196. debug('reading or ended', doRead);
  22197. } else if (doRead) {
  22198. debug('do read');
  22199. state.reading = true;
  22200. state.sync = true;
  22201. // if the length is currently zero, then we *need* a readable event.
  22202. if (state.length === 0) state.needReadable = true;
  22203. // call internal read method
  22204. this._read(state.highWaterMark);
  22205. state.sync = false;
  22206. // If _read pushed data synchronously, then `reading` will be false,
  22207. // and we need to re-evaluate how much data we can return to the user.
  22208. if (!state.reading) n = howMuchToRead(nOrig, state);
  22209. }
  22210. var ret;
  22211. if (n > 0) ret = fromList(n, state);else ret = null;
  22212. if (ret === null) {
  22213. state.needReadable = true;
  22214. n = 0;
  22215. } else {
  22216. state.length -= n;
  22217. }
  22218. if (state.length === 0) {
  22219. // If we have nothing in the buffer, then we want to know
  22220. // as soon as we *do* get something into the buffer.
  22221. if (!state.ended) state.needReadable = true;
  22222. // If we tried to read() past the EOF, then emit end on the next tick.
  22223. if (nOrig !== n && state.ended) endReadable(this);
  22224. }
  22225. if (ret !== null) this.emit('data', ret);
  22226. return ret;
  22227. };
  22228. function onEofChunk(stream, state) {
  22229. if (state.ended) return;
  22230. if (state.decoder) {
  22231. var chunk = state.decoder.end();
  22232. if (chunk && chunk.length) {
  22233. state.buffer.push(chunk);
  22234. state.length += state.objectMode ? 1 : chunk.length;
  22235. }
  22236. }
  22237. state.ended = true;
  22238. // emit 'readable' now to make sure it gets picked up.
  22239. emitReadable(stream);
  22240. }
  22241. // Don't emit readable right away in sync mode, because this can trigger
  22242. // another read() call => stack overflow. This way, it might trigger
  22243. // a nextTick recursion warning, but that's not so bad.
  22244. function emitReadable(stream) {
  22245. var state = stream._readableState;
  22246. state.needReadable = false;
  22247. if (!state.emittedReadable) {
  22248. debug('emitReadable', state.flowing);
  22249. state.emittedReadable = true;
  22250. if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
  22251. }
  22252. }
  22253. function emitReadable_(stream) {
  22254. debug('emit readable');
  22255. stream.emit('readable');
  22256. flow(stream);
  22257. }
  22258. // at this point, the user has presumably seen the 'readable' event,
  22259. // and called read() to consume some data. that may have triggered
  22260. // in turn another _read(n) call, in which case reading = true if
  22261. // it's in progress.
  22262. // However, if we're not ended, or reading, and the length < hwm,
  22263. // then go ahead and try to read some more preemptively.
  22264. function maybeReadMore(stream, state) {
  22265. if (!state.readingMore) {
  22266. state.readingMore = true;
  22267. pna.nextTick(maybeReadMore_, stream, state);
  22268. }
  22269. }
  22270. function maybeReadMore_(stream, state) {
  22271. var len = state.length;
  22272. while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
  22273. debug('maybeReadMore read 0');
  22274. stream.read(0);
  22275. if (len === state.length)
  22276. // didn't get any data, stop spinning.
  22277. break;else len = state.length;
  22278. }
  22279. state.readingMore = false;
  22280. }
  22281. // abstract method. to be overridden in specific implementation classes.
  22282. // call cb(er, data) where data is <= n in length.
  22283. // for virtual (non-string, non-buffer) streams, "length" is somewhat
  22284. // arbitrary, and perhaps not very meaningful.
  22285. Readable.prototype._read = function (n) {
  22286. this.emit('error', new Error('_read() is not implemented'));
  22287. };
  22288. Readable.prototype.pipe = function (dest, pipeOpts) {
  22289. var src = this;
  22290. var state = this._readableState;
  22291. switch (state.pipesCount) {
  22292. case 0:
  22293. state.pipes = dest;
  22294. break;
  22295. case 1:
  22296. state.pipes = [state.pipes, dest];
  22297. break;
  22298. default:
  22299. state.pipes.push(dest);
  22300. break;
  22301. }
  22302. state.pipesCount += 1;
  22303. debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
  22304. var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
  22305. var endFn = doEnd ? onend : unpipe;
  22306. if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
  22307. dest.on('unpipe', onunpipe);
  22308. function onunpipe(readable, unpipeInfo) {
  22309. debug('onunpipe');
  22310. if (readable === src) {
  22311. if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
  22312. unpipeInfo.hasUnpiped = true;
  22313. cleanup();
  22314. }
  22315. }
  22316. }
  22317. function onend() {
  22318. debug('onend');
  22319. dest.end();
  22320. }
  22321. // when the dest drains, it reduces the awaitDrain counter
  22322. // on the source. This would be more elegant with a .once()
  22323. // handler in flow(), but adding and removing repeatedly is
  22324. // too slow.
  22325. var ondrain = pipeOnDrain(src);
  22326. dest.on('drain', ondrain);
  22327. var cleanedUp = false;
  22328. function cleanup() {
  22329. debug('cleanup');
  22330. // cleanup event handlers once the pipe is broken
  22331. dest.removeListener('close', onclose);
  22332. dest.removeListener('finish', onfinish);
  22333. dest.removeListener('drain', ondrain);
  22334. dest.removeListener('error', onerror);
  22335. dest.removeListener('unpipe', onunpipe);
  22336. src.removeListener('end', onend);
  22337. src.removeListener('end', unpipe);
  22338. src.removeListener('data', ondata);
  22339. cleanedUp = true;
  22340. // if the reader is waiting for a drain event from this
  22341. // specific writer, then it would cause it to never start
  22342. // flowing again.
  22343. // So, if this is awaiting a drain, then we just call it now.
  22344. // If we don't know, then assume that we are waiting for one.
  22345. if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
  22346. }
  22347. // If the user pushes more data while we're writing to dest then we'll end up
  22348. // in ondata again. However, we only want to increase awaitDrain once because
  22349. // dest will only emit one 'drain' event for the multiple writes.
  22350. // => Introduce a guard on increasing awaitDrain.
  22351. var increasedAwaitDrain = false;
  22352. src.on('data', ondata);
  22353. function ondata(chunk) {
  22354. debug('ondata');
  22355. increasedAwaitDrain = false;
  22356. var ret = dest.write(chunk);
  22357. if (false === ret && !increasedAwaitDrain) {
  22358. // If the user unpiped during `dest.write()`, it is possible
  22359. // to get stuck in a permanently paused state if that write
  22360. // also returned false.
  22361. // => Check whether `dest` is still a piping destination.
  22362. if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
  22363. debug('false write response, pause', src._readableState.awaitDrain);
  22364. src._readableState.awaitDrain++;
  22365. increasedAwaitDrain = true;
  22366. }
  22367. src.pause();
  22368. }
  22369. }
  22370. // if the dest has an error, then stop piping into it.
  22371. // however, don't suppress the throwing behavior for this.
  22372. function onerror(er) {
  22373. debug('onerror', er);
  22374. unpipe();
  22375. dest.removeListener('error', onerror);
  22376. if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
  22377. }
  22378. // Make sure our error handler is attached before userland ones.
  22379. prependListener(dest, 'error', onerror);
  22380. // Both close and finish should trigger unpipe, but only once.
  22381. function onclose() {
  22382. dest.removeListener('finish', onfinish);
  22383. unpipe();
  22384. }
  22385. dest.once('close', onclose);
  22386. function onfinish() {
  22387. debug('onfinish');
  22388. dest.removeListener('close', onclose);
  22389. unpipe();
  22390. }
  22391. dest.once('finish', onfinish);
  22392. function unpipe() {
  22393. debug('unpipe');
  22394. src.unpipe(dest);
  22395. }
  22396. // tell the dest that it's being piped to
  22397. dest.emit('pipe', src);
  22398. // start the flow if it hasn't been started already.
  22399. if (!state.flowing) {
  22400. debug('pipe resume');
  22401. src.resume();
  22402. }
  22403. return dest;
  22404. };
  22405. function pipeOnDrain(src) {
  22406. return function () {
  22407. var state = src._readableState;
  22408. debug('pipeOnDrain', state.awaitDrain);
  22409. if (state.awaitDrain) state.awaitDrain--;
  22410. if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
  22411. state.flowing = true;
  22412. flow(src);
  22413. }
  22414. };
  22415. }
  22416. Readable.prototype.unpipe = function (dest) {
  22417. var state = this._readableState;
  22418. var unpipeInfo = { hasUnpiped: false };
  22419. // if we're not piping anywhere, then do nothing.
  22420. if (state.pipesCount === 0) return this;
  22421. // just one destination. most common case.
  22422. if (state.pipesCount === 1) {
  22423. // passed in one, but it's not the right one.
  22424. if (dest && dest !== state.pipes) return this;
  22425. if (!dest) dest = state.pipes;
  22426. // got a match.
  22427. state.pipes = null;
  22428. state.pipesCount = 0;
  22429. state.flowing = false;
  22430. if (dest) dest.emit('unpipe', this, unpipeInfo);
  22431. return this;
  22432. }
  22433. // slow case. multiple pipe destinations.
  22434. if (!dest) {
  22435. // remove all.
  22436. var dests = state.pipes;
  22437. var len = state.pipesCount;
  22438. state.pipes = null;
  22439. state.pipesCount = 0;
  22440. state.flowing = false;
  22441. for (var i = 0; i < len; i++) {
  22442. dests[i].emit('unpipe', this, unpipeInfo);
  22443. }return this;
  22444. }
  22445. // try to find the right one.
  22446. var index = indexOf(state.pipes, dest);
  22447. if (index === -1) return this;
  22448. state.pipes.splice(index, 1);
  22449. state.pipesCount -= 1;
  22450. if (state.pipesCount === 1) state.pipes = state.pipes[0];
  22451. dest.emit('unpipe', this, unpipeInfo);
  22452. return this;
  22453. };
  22454. // set up data events if they are asked for
  22455. // Ensure readable listeners eventually get something
  22456. Readable.prototype.on = function (ev, fn) {
  22457. var res = Stream.prototype.on.call(this, ev, fn);
  22458. if (ev === 'data') {
  22459. // Start flowing on next tick if stream isn't explicitly paused
  22460. if (this._readableState.flowing !== false) this.resume();
  22461. } else if (ev === 'readable') {
  22462. var state = this._readableState;
  22463. if (!state.endEmitted && !state.readableListening) {
  22464. state.readableListening = state.needReadable = true;
  22465. state.emittedReadable = false;
  22466. if (!state.reading) {
  22467. pna.nextTick(nReadingNextTick, this);
  22468. } else if (state.length) {
  22469. emitReadable(this);
  22470. }
  22471. }
  22472. }
  22473. return res;
  22474. };
  22475. Readable.prototype.addListener = Readable.prototype.on;
  22476. function nReadingNextTick(self) {
  22477. debug('readable nexttick read 0');
  22478. self.read(0);
  22479. }
  22480. // pause() and resume() are remnants of the legacy readable stream API
  22481. // If the user uses them, then switch into old mode.
  22482. Readable.prototype.resume = function () {
  22483. var state = this._readableState;
  22484. if (!state.flowing) {
  22485. debug('resume');
  22486. state.flowing = true;
  22487. resume(this, state);
  22488. }
  22489. return this;
  22490. };
  22491. function resume(stream, state) {
  22492. if (!state.resumeScheduled) {
  22493. state.resumeScheduled = true;
  22494. pna.nextTick(resume_, stream, state);
  22495. }
  22496. }
  22497. function resume_(stream, state) {
  22498. if (!state.reading) {
  22499. debug('resume read 0');
  22500. stream.read(0);
  22501. }
  22502. state.resumeScheduled = false;
  22503. state.awaitDrain = 0;
  22504. stream.emit('resume');
  22505. flow(stream);
  22506. if (state.flowing && !state.reading) stream.read(0);
  22507. }
  22508. Readable.prototype.pause = function () {
  22509. debug('call pause flowing=%j', this._readableState.flowing);
  22510. if (false !== this._readableState.flowing) {
  22511. debug('pause');
  22512. this._readableState.flowing = false;
  22513. this.emit('pause');
  22514. }
  22515. return this;
  22516. };
  22517. function flow(stream) {
  22518. var state = stream._readableState;
  22519. debug('flow', state.flowing);
  22520. while (state.flowing && stream.read() !== null) {}
  22521. }
  22522. // wrap an old-style stream as the async data source.
  22523. // This is *not* part of the readable stream interface.
  22524. // It is an ugly unfortunate mess of history.
  22525. Readable.prototype.wrap = function (stream) {
  22526. var _this = this;
  22527. var state = this._readableState;
  22528. var paused = false;
  22529. stream.on('end', function () {
  22530. debug('wrapped end');
  22531. if (state.decoder && !state.ended) {
  22532. var chunk = state.decoder.end();
  22533. if (chunk && chunk.length) _this.push(chunk);
  22534. }
  22535. _this.push(null);
  22536. });
  22537. stream.on('data', function (chunk) {
  22538. debug('wrapped data');
  22539. if (state.decoder) chunk = state.decoder.write(chunk);
  22540. // don't skip over falsy values in objectMode
  22541. if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
  22542. var ret = _this.push(chunk);
  22543. if (!ret) {
  22544. paused = true;
  22545. stream.pause();
  22546. }
  22547. });
  22548. // proxy all the other methods.
  22549. // important when wrapping filters and duplexes.
  22550. for (var i in stream) {
  22551. if (this[i] === undefined && typeof stream[i] === 'function') {
  22552. this[i] = function (method) {
  22553. return function () {
  22554. return stream[method].apply(stream, arguments);
  22555. };
  22556. }(i);
  22557. }
  22558. }
  22559. // proxy certain important events.
  22560. for (var n = 0; n < kProxyEvents.length; n++) {
  22561. stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
  22562. }
  22563. // when we try to consume some more bytes, simply unpause the
  22564. // underlying stream.
  22565. this._read = function (n) {
  22566. debug('wrapped _read', n);
  22567. if (paused) {
  22568. paused = false;
  22569. stream.resume();
  22570. }
  22571. };
  22572. return this;
  22573. };
  22574. Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
  22575. // making it explicit this property is not enumerable
  22576. // because otherwise some prototype manipulation in
  22577. // userland will fail
  22578. enumerable: false,
  22579. get: function () {
  22580. return this._readableState.highWaterMark;
  22581. }
  22582. });
  22583. // exposed for testing purposes only.
  22584. Readable._fromList = fromList;
  22585. // Pluck off n bytes from an array of buffers.
  22586. // Length is the combined lengths of all the buffers in the list.
  22587. // This function is designed to be inlinable, so please take care when making
  22588. // changes to the function body.
  22589. function fromList(n, state) {
  22590. // nothing buffered
  22591. if (state.length === 0) return null;
  22592. var ret;
  22593. if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
  22594. // read it all, truncate the list
  22595. if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
  22596. state.buffer.clear();
  22597. } else {
  22598. // read part of list
  22599. ret = fromListPartial(n, state.buffer, state.decoder);
  22600. }
  22601. return ret;
  22602. }
  22603. // Extracts only enough buffered data to satisfy the amount requested.
  22604. // This function is designed to be inlinable, so please take care when making
  22605. // changes to the function body.
  22606. function fromListPartial(n, list, hasStrings) {
  22607. var ret;
  22608. if (n < list.head.data.length) {
  22609. // slice is the same for buffers and strings
  22610. ret = list.head.data.slice(0, n);
  22611. list.head.data = list.head.data.slice(n);
  22612. } else if (n === list.head.data.length) {
  22613. // first chunk is a perfect match
  22614. ret = list.shift();
  22615. } else {
  22616. // result spans more than one buffer
  22617. ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
  22618. }
  22619. return ret;
  22620. }
  22621. // Copies a specified amount of characters from the list of buffered data
  22622. // chunks.
  22623. // This function is designed to be inlinable, so please take care when making
  22624. // changes to the function body.
  22625. function copyFromBufferString(n, list) {
  22626. var p = list.head;
  22627. var c = 1;
  22628. var ret = p.data;
  22629. n -= ret.length;
  22630. while (p = p.next) {
  22631. var str = p.data;
  22632. var nb = n > str.length ? str.length : n;
  22633. if (nb === str.length) ret += str;else ret += str.slice(0, n);
  22634. n -= nb;
  22635. if (n === 0) {
  22636. if (nb === str.length) {
  22637. ++c;
  22638. if (p.next) list.head = p.next;else list.head = list.tail = null;
  22639. } else {
  22640. list.head = p;
  22641. p.data = str.slice(nb);
  22642. }
  22643. break;
  22644. }
  22645. ++c;
  22646. }
  22647. list.length -= c;
  22648. return ret;
  22649. }
  22650. // Copies a specified amount of bytes from the list of buffered data chunks.
  22651. // This function is designed to be inlinable, so please take care when making
  22652. // changes to the function body.
  22653. function copyFromBuffer(n, list) {
  22654. var ret = Buffer.allocUnsafe(n);
  22655. var p = list.head;
  22656. var c = 1;
  22657. p.data.copy(ret);
  22658. n -= p.data.length;
  22659. while (p = p.next) {
  22660. var buf = p.data;
  22661. var nb = n > buf.length ? buf.length : n;
  22662. buf.copy(ret, ret.length - n, 0, nb);
  22663. n -= nb;
  22664. if (n === 0) {
  22665. if (nb === buf.length) {
  22666. ++c;
  22667. if (p.next) list.head = p.next;else list.head = list.tail = null;
  22668. } else {
  22669. list.head = p;
  22670. p.data = buf.slice(nb);
  22671. }
  22672. break;
  22673. }
  22674. ++c;
  22675. }
  22676. list.length -= c;
  22677. return ret;
  22678. }
  22679. function endReadable(stream) {
  22680. var state = stream._readableState;
  22681. // If we get here before consuming all the bytes, then that is a
  22682. // bug in node. Should never happen.
  22683. if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
  22684. if (!state.endEmitted) {
  22685. state.ended = true;
  22686. pna.nextTick(endReadableNT, state, stream);
  22687. }
  22688. }
  22689. function endReadableNT(state, stream) {
  22690. // Check that we didn't get one last unshift.
  22691. if (!state.endEmitted && state.length === 0) {
  22692. state.endEmitted = true;
  22693. stream.readable = false;
  22694. stream.emit('end');
  22695. }
  22696. }
  22697. function indexOf(xs, x) {
  22698. for (var i = 0, l = xs.length; i < l; i++) {
  22699. if (xs[i] === x) return i;
  22700. }
  22701. return -1;
  22702. }
  22703. }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  22704. },{"./_stream_duplex":386,"./internal/streams/BufferList":391,"./internal/streams/destroy":392,"./internal/streams/stream":393,"_process":467,"core-util-is":341,"events":344,"inherits":364,"isarray":370,"process-nextick-args":380,"safe-buffer":396,"string_decoder/":413,"util":89}],389:[function(require,module,exports){
  22705. // Copyright Joyent, Inc. and other Node contributors.
  22706. //
  22707. // Permission is hereby granted, free of charge, to any person obtaining a
  22708. // copy of this software and associated documentation files (the
  22709. // "Software"), to deal in the Software without restriction, including
  22710. // without limitation the rights to use, copy, modify, merge, publish,
  22711. // distribute, sublicense, and/or sell copies of the Software, and to permit
  22712. // persons to whom the Software is furnished to do so, subject to the
  22713. // following conditions:
  22714. //
  22715. // The above copyright notice and this permission notice shall be included
  22716. // in all copies or substantial portions of the Software.
  22717. //
  22718. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  22719. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  22720. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  22721. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  22722. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  22723. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  22724. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  22725. // a transform stream is a readable/writable stream where you do
  22726. // something with the data. Sometimes it's called a "filter",
  22727. // but that's not a great name for it, since that implies a thing where
  22728. // some bits pass through, and others are simply ignored. (That would
  22729. // be a valid example of a transform, of course.)
  22730. //
  22731. // While the output is causally related to the input, it's not a
  22732. // necessarily symmetric or synchronous transformation. For example,
  22733. // a zlib stream might take multiple plain-text writes(), and then
  22734. // emit a single compressed chunk some time in the future.
  22735. //
  22736. // Here's how this works:
  22737. //
  22738. // The Transform stream has all the aspects of the readable and writable
  22739. // stream classes. When you write(chunk), that calls _write(chunk,cb)
  22740. // internally, and returns false if there's a lot of pending writes
  22741. // buffered up. When you call read(), that calls _read(n) until
  22742. // there's enough pending readable data buffered up.
  22743. //
  22744. // In a transform stream, the written data is placed in a buffer. When
  22745. // _read(n) is called, it transforms the queued up data, calling the
  22746. // buffered _write cb's as it consumes chunks. If consuming a single
  22747. // written chunk would result in multiple output chunks, then the first
  22748. // outputted bit calls the readcb, and subsequent chunks just go into
  22749. // the read buffer, and will cause it to emit 'readable' if necessary.
  22750. //
  22751. // This way, back-pressure is actually determined by the reading side,
  22752. // since _read has to be called to start processing a new chunk. However,
  22753. // a pathological inflate type of transform can cause excessive buffering
  22754. // here. For example, imagine a stream where every byte of input is
  22755. // interpreted as an integer from 0-255, and then results in that many
  22756. // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
  22757. // 1kb of data being output. In this case, you could write a very small
  22758. // amount of input, and end up with a very large amount of output. In
  22759. // such a pathological inflating mechanism, there'd be no way to tell
  22760. // the system to stop doing the transform. A single 4MB write could
  22761. // cause the system to run out of memory.
  22762. //
  22763. // However, even in such a pathological case, only a single written chunk
  22764. // would be consumed, and then the rest would wait (un-transformed) until
  22765. // the results of the previous transformed chunk were consumed.
  22766. 'use strict';
  22767. module.exports = Transform;
  22768. var Duplex = require('./_stream_duplex');
  22769. /*<replacement>*/
  22770. var util = Object.create(require('core-util-is'));
  22771. util.inherits = require('inherits');
  22772. /*</replacement>*/
  22773. util.inherits(Transform, Duplex);
  22774. function afterTransform(er, data) {
  22775. var ts = this._transformState;
  22776. ts.transforming = false;
  22777. var cb = ts.writecb;
  22778. if (!cb) {
  22779. return this.emit('error', new Error('write callback called multiple times'));
  22780. }
  22781. ts.writechunk = null;
  22782. ts.writecb = null;
  22783. if (data != null) // single equals check for both `null` and `undefined`
  22784. this.push(data);
  22785. cb(er);
  22786. var rs = this._readableState;
  22787. rs.reading = false;
  22788. if (rs.needReadable || rs.length < rs.highWaterMark) {
  22789. this._read(rs.highWaterMark);
  22790. }
  22791. }
  22792. function Transform(options) {
  22793. if (!(this instanceof Transform)) return new Transform(options);
  22794. Duplex.call(this, options);
  22795. this._transformState = {
  22796. afterTransform: afterTransform.bind(this),
  22797. needTransform: false,
  22798. transforming: false,
  22799. writecb: null,
  22800. writechunk: null,
  22801. writeencoding: null
  22802. };
  22803. // start out asking for a readable event once data is transformed.
  22804. this._readableState.needReadable = true;
  22805. // we have implemented the _read method, and done the other things
  22806. // that Readable wants before the first _read call, so unset the
  22807. // sync guard flag.
  22808. this._readableState.sync = false;
  22809. if (options) {
  22810. if (typeof options.transform === 'function') this._transform = options.transform;
  22811. if (typeof options.flush === 'function') this._flush = options.flush;
  22812. }
  22813. // When the writable side finishes, then flush out anything remaining.
  22814. this.on('prefinish', prefinish);
  22815. }
  22816. function prefinish() {
  22817. var _this = this;
  22818. if (typeof this._flush === 'function') {
  22819. this._flush(function (er, data) {
  22820. done(_this, er, data);
  22821. });
  22822. } else {
  22823. done(this, null, null);
  22824. }
  22825. }
  22826. Transform.prototype.push = function (chunk, encoding) {
  22827. this._transformState.needTransform = false;
  22828. return Duplex.prototype.push.call(this, chunk, encoding);
  22829. };
  22830. // This is the part where you do stuff!
  22831. // override this function in implementation classes.
  22832. // 'chunk' is an input chunk.
  22833. //
  22834. // Call `push(newChunk)` to pass along transformed output
  22835. // to the readable side. You may call 'push' zero or more times.
  22836. //
  22837. // Call `cb(err)` when you are done with this chunk. If you pass
  22838. // an error, then that'll put the hurt on the whole operation. If you
  22839. // never call cb(), then you'll never get another chunk.
  22840. Transform.prototype._transform = function (chunk, encoding, cb) {
  22841. throw new Error('_transform() is not implemented');
  22842. };
  22843. Transform.prototype._write = function (chunk, encoding, cb) {
  22844. var ts = this._transformState;
  22845. ts.writecb = cb;
  22846. ts.writechunk = chunk;
  22847. ts.writeencoding = encoding;
  22848. if (!ts.transforming) {
  22849. var rs = this._readableState;
  22850. if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
  22851. }
  22852. };
  22853. // Doesn't matter what the args are here.
  22854. // _transform does all the work.
  22855. // That we got here means that the readable side wants more data.
  22856. Transform.prototype._read = function (n) {
  22857. var ts = this._transformState;
  22858. if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
  22859. ts.transforming = true;
  22860. this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
  22861. } else {
  22862. // mark that we need a transform, so that any data that comes in
  22863. // will get processed, now that we've asked for it.
  22864. ts.needTransform = true;
  22865. }
  22866. };
  22867. Transform.prototype._destroy = function (err, cb) {
  22868. var _this2 = this;
  22869. Duplex.prototype._destroy.call(this, err, function (err2) {
  22870. cb(err2);
  22871. _this2.emit('close');
  22872. });
  22873. };
  22874. function done(stream, er, data) {
  22875. if (er) return stream.emit('error', er);
  22876. if (data != null) // single equals check for both `null` and `undefined`
  22877. stream.push(data);
  22878. // if there's nothing in the write buffer, then that means
  22879. // that nothing more will ever be provided
  22880. if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
  22881. if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
  22882. return stream.push(null);
  22883. }
  22884. },{"./_stream_duplex":386,"core-util-is":341,"inherits":364}],390:[function(require,module,exports){
  22885. (function (process,global,setImmediate){(function (){
  22886. // Copyright Joyent, Inc. and other Node contributors.
  22887. //
  22888. // Permission is hereby granted, free of charge, to any person obtaining a
  22889. // copy of this software and associated documentation files (the
  22890. // "Software"), to deal in the Software without restriction, including
  22891. // without limitation the rights to use, copy, modify, merge, publish,
  22892. // distribute, sublicense, and/or sell copies of the Software, and to permit
  22893. // persons to whom the Software is furnished to do so, subject to the
  22894. // following conditions:
  22895. //
  22896. // The above copyright notice and this permission notice shall be included
  22897. // in all copies or substantial portions of the Software.
  22898. //
  22899. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  22900. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  22901. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  22902. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  22903. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  22904. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  22905. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  22906. // A bit simpler than readable streams.
  22907. // Implement an async ._write(chunk, encoding, cb), and it'll handle all
  22908. // the drain event emission and buffering.
  22909. 'use strict';
  22910. /*<replacement>*/
  22911. var pna = require('process-nextick-args');
  22912. /*</replacement>*/
  22913. module.exports = Writable;
  22914. /* <replacement> */
  22915. function WriteReq(chunk, encoding, cb) {
  22916. this.chunk = chunk;
  22917. this.encoding = encoding;
  22918. this.callback = cb;
  22919. this.next = null;
  22920. }
  22921. // It seems a linked list but it is not
  22922. // there will be only 2 of these for each stream
  22923. function CorkedRequest(state) {
  22924. var _this = this;
  22925. this.next = null;
  22926. this.entry = null;
  22927. this.finish = function () {
  22928. onCorkedFinish(_this, state);
  22929. };
  22930. }
  22931. /* </replacement> */
  22932. /*<replacement>*/
  22933. var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
  22934. /*</replacement>*/
  22935. /*<replacement>*/
  22936. var Duplex;
  22937. /*</replacement>*/
  22938. Writable.WritableState = WritableState;
  22939. /*<replacement>*/
  22940. var util = Object.create(require('core-util-is'));
  22941. util.inherits = require('inherits');
  22942. /*</replacement>*/
  22943. /*<replacement>*/
  22944. var internalUtil = {
  22945. deprecate: require('util-deprecate')
  22946. };
  22947. /*</replacement>*/
  22948. /*<replacement>*/
  22949. var Stream = require('./internal/streams/stream');
  22950. /*</replacement>*/
  22951. /*<replacement>*/
  22952. var Buffer = require('safe-buffer').Buffer;
  22953. var OurUint8Array = global.Uint8Array || function () {};
  22954. function _uint8ArrayToBuffer(chunk) {
  22955. return Buffer.from(chunk);
  22956. }
  22957. function _isUint8Array(obj) {
  22958. return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
  22959. }
  22960. /*</replacement>*/
  22961. var destroyImpl = require('./internal/streams/destroy');
  22962. util.inherits(Writable, Stream);
  22963. function nop() {}
  22964. function WritableState(options, stream) {
  22965. Duplex = Duplex || require('./_stream_duplex');
  22966. options = options || {};
  22967. // Duplex streams are both readable and writable, but share
  22968. // the same options object.
  22969. // However, some cases require setting options to different
  22970. // values for the readable and the writable sides of the duplex stream.
  22971. // These options can be provided separately as readableXXX and writableXXX.
  22972. var isDuplex = stream instanceof Duplex;
  22973. // object stream flag to indicate whether or not this stream
  22974. // contains buffers or objects.
  22975. this.objectMode = !!options.objectMode;
  22976. if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
  22977. // the point at which write() starts returning false
  22978. // Note: 0 is a valid value, means that we always return false if
  22979. // the entire buffer is not flushed immediately on write()
  22980. var hwm = options.highWaterMark;
  22981. var writableHwm = options.writableHighWaterMark;
  22982. var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  22983. if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
  22984. // cast to ints.
  22985. this.highWaterMark = Math.floor(this.highWaterMark);
  22986. // if _final has been called
  22987. this.finalCalled = false;
  22988. // drain event flag.
  22989. this.needDrain = false;
  22990. // at the start of calling end()
  22991. this.ending = false;
  22992. // when end() has been called, and returned
  22993. this.ended = false;
  22994. // when 'finish' is emitted
  22995. this.finished = false;
  22996. // has it been destroyed
  22997. this.destroyed = false;
  22998. // should we decode strings into buffers before passing to _write?
  22999. // this is here so that some node-core streams can optimize string
  23000. // handling at a lower level.
  23001. var noDecode = options.decodeStrings === false;
  23002. this.decodeStrings = !noDecode;
  23003. // Crypto is kind of old and crusty. Historically, its default string
  23004. // encoding is 'binary' so we have to make this configurable.
  23005. // Everything else in the universe uses 'utf8', though.
  23006. this.defaultEncoding = options.defaultEncoding || 'utf8';
  23007. // not an actual buffer we keep track of, but a measurement
  23008. // of how much we're waiting to get pushed to some underlying
  23009. // socket or file.
  23010. this.length = 0;
  23011. // a flag to see when we're in the middle of a write.
  23012. this.writing = false;
  23013. // when true all writes will be buffered until .uncork() call
  23014. this.corked = 0;
  23015. // a flag to be able to tell if the onwrite cb is called immediately,
  23016. // or on a later tick. We set this to true at first, because any
  23017. // actions that shouldn't happen until "later" should generally also
  23018. // not happen before the first write call.
  23019. this.sync = true;
  23020. // a flag to know if we're processing previously buffered items, which
  23021. // may call the _write() callback in the same tick, so that we don't
  23022. // end up in an overlapped onwrite situation.
  23023. this.bufferProcessing = false;
  23024. // the callback that's passed to _write(chunk,cb)
  23025. this.onwrite = function (er) {
  23026. onwrite(stream, er);
  23027. };
  23028. // the callback that the user supplies to write(chunk,encoding,cb)
  23029. this.writecb = null;
  23030. // the amount that is being written when _write is called.
  23031. this.writelen = 0;
  23032. this.bufferedRequest = null;
  23033. this.lastBufferedRequest = null;
  23034. // number of pending user-supplied write callbacks
  23035. // this must be 0 before 'finish' can be emitted
  23036. this.pendingcb = 0;
  23037. // emit prefinish if the only thing we're waiting for is _write cbs
  23038. // This is relevant for synchronous Transform streams
  23039. this.prefinished = false;
  23040. // True if the error was already emitted and should not be thrown again
  23041. this.errorEmitted = false;
  23042. // count buffered requests
  23043. this.bufferedRequestCount = 0;
  23044. // allocate the first CorkedRequest, there is always
  23045. // one allocated and free to use, and we maintain at most two
  23046. this.corkedRequestsFree = new CorkedRequest(this);
  23047. }
  23048. WritableState.prototype.getBuffer = function getBuffer() {
  23049. var current = this.bufferedRequest;
  23050. var out = [];
  23051. while (current) {
  23052. out.push(current);
  23053. current = current.next;
  23054. }
  23055. return out;
  23056. };
  23057. (function () {
  23058. try {
  23059. Object.defineProperty(WritableState.prototype, 'buffer', {
  23060. get: internalUtil.deprecate(function () {
  23061. return this.getBuffer();
  23062. }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
  23063. });
  23064. } catch (_) {}
  23065. })();
  23066. // Test _writableState for inheritance to account for Duplex streams,
  23067. // whose prototype chain only points to Readable.
  23068. var realHasInstance;
  23069. if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
  23070. realHasInstance = Function.prototype[Symbol.hasInstance];
  23071. Object.defineProperty(Writable, Symbol.hasInstance, {
  23072. value: function (object) {
  23073. if (realHasInstance.call(this, object)) return true;
  23074. if (this !== Writable) return false;
  23075. return object && object._writableState instanceof WritableState;
  23076. }
  23077. });
  23078. } else {
  23079. realHasInstance = function (object) {
  23080. return object instanceof this;
  23081. };
  23082. }
  23083. function Writable(options) {
  23084. Duplex = Duplex || require('./_stream_duplex');
  23085. // Writable ctor is applied to Duplexes, too.
  23086. // `realHasInstance` is necessary because using plain `instanceof`
  23087. // would return false, as no `_writableState` property is attached.
  23088. // Trying to use the custom `instanceof` for Writable here will also break the
  23089. // Node.js LazyTransform implementation, which has a non-trivial getter for
  23090. // `_writableState` that would lead to infinite recursion.
  23091. if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
  23092. return new Writable(options);
  23093. }
  23094. this._writableState = new WritableState(options, this);
  23095. // legacy.
  23096. this.writable = true;
  23097. if (options) {
  23098. if (typeof options.write === 'function') this._write = options.write;
  23099. if (typeof options.writev === 'function') this._writev = options.writev;
  23100. if (typeof options.destroy === 'function') this._destroy = options.destroy;
  23101. if (typeof options.final === 'function') this._final = options.final;
  23102. }
  23103. Stream.call(this);
  23104. }
  23105. // Otherwise people can pipe Writable streams, which is just wrong.
  23106. Writable.prototype.pipe = function () {
  23107. this.emit('error', new Error('Cannot pipe, not readable'));
  23108. };
  23109. function writeAfterEnd(stream, cb) {
  23110. var er = new Error('write after end');
  23111. // TODO: defer error events consistently everywhere, not just the cb
  23112. stream.emit('error', er);
  23113. pna.nextTick(cb, er);
  23114. }
  23115. // Checks that a user-supplied chunk is valid, especially for the particular
  23116. // mode the stream is in. Currently this means that `null` is never accepted
  23117. // and undefined/non-string values are only allowed in object mode.
  23118. function validChunk(stream, state, chunk, cb) {
  23119. var valid = true;
  23120. var er = false;
  23121. if (chunk === null) {
  23122. er = new TypeError('May not write null values to stream');
  23123. } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
  23124. er = new TypeError('Invalid non-string/buffer chunk');
  23125. }
  23126. if (er) {
  23127. stream.emit('error', er);
  23128. pna.nextTick(cb, er);
  23129. valid = false;
  23130. }
  23131. return valid;
  23132. }
  23133. Writable.prototype.write = function (chunk, encoding, cb) {
  23134. var state = this._writableState;
  23135. var ret = false;
  23136. var isBuf = !state.objectMode && _isUint8Array(chunk);
  23137. if (isBuf && !Buffer.isBuffer(chunk)) {
  23138. chunk = _uint8ArrayToBuffer(chunk);
  23139. }
  23140. if (typeof encoding === 'function') {
  23141. cb = encoding;
  23142. encoding = null;
  23143. }
  23144. if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
  23145. if (typeof cb !== 'function') cb = nop;
  23146. if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
  23147. state.pendingcb++;
  23148. ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
  23149. }
  23150. return ret;
  23151. };
  23152. Writable.prototype.cork = function () {
  23153. var state = this._writableState;
  23154. state.corked++;
  23155. };
  23156. Writable.prototype.uncork = function () {
  23157. var state = this._writableState;
  23158. if (state.corked) {
  23159. state.corked--;
  23160. if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
  23161. }
  23162. };
  23163. Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
  23164. // node::ParseEncoding() requires lower case.
  23165. if (typeof encoding === 'string') encoding = encoding.toLowerCase();
  23166. if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
  23167. this._writableState.defaultEncoding = encoding;
  23168. return this;
  23169. };
  23170. function decodeChunk(state, chunk, encoding) {
  23171. if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
  23172. chunk = Buffer.from(chunk, encoding);
  23173. }
  23174. return chunk;
  23175. }
  23176. Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
  23177. // making it explicit this property is not enumerable
  23178. // because otherwise some prototype manipulation in
  23179. // userland will fail
  23180. enumerable: false,
  23181. get: function () {
  23182. return this._writableState.highWaterMark;
  23183. }
  23184. });
  23185. // if we're already writing something, then just put this
  23186. // in the queue, and wait our turn. Otherwise, call _write
  23187. // If we return false, then we need a drain event, so set that flag.
  23188. function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
  23189. if (!isBuf) {
  23190. var newChunk = decodeChunk(state, chunk, encoding);
  23191. if (chunk !== newChunk) {
  23192. isBuf = true;
  23193. encoding = 'buffer';
  23194. chunk = newChunk;
  23195. }
  23196. }
  23197. var len = state.objectMode ? 1 : chunk.length;
  23198. state.length += len;
  23199. var ret = state.length < state.highWaterMark;
  23200. // we must ensure that previous needDrain will not be reset to false.
  23201. if (!ret) state.needDrain = true;
  23202. if (state.writing || state.corked) {
  23203. var last = state.lastBufferedRequest;
  23204. state.lastBufferedRequest = {
  23205. chunk: chunk,
  23206. encoding: encoding,
  23207. isBuf: isBuf,
  23208. callback: cb,
  23209. next: null
  23210. };
  23211. if (last) {
  23212. last.next = state.lastBufferedRequest;
  23213. } else {
  23214. state.bufferedRequest = state.lastBufferedRequest;
  23215. }
  23216. state.bufferedRequestCount += 1;
  23217. } else {
  23218. doWrite(stream, state, false, len, chunk, encoding, cb);
  23219. }
  23220. return ret;
  23221. }
  23222. function doWrite(stream, state, writev, len, chunk, encoding, cb) {
  23223. state.writelen = len;
  23224. state.writecb = cb;
  23225. state.writing = true;
  23226. state.sync = true;
  23227. if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
  23228. state.sync = false;
  23229. }
  23230. function onwriteError(stream, state, sync, er, cb) {
  23231. --state.pendingcb;
  23232. if (sync) {
  23233. // defer the callback if we are being called synchronously
  23234. // to avoid piling up things on the stack
  23235. pna.nextTick(cb, er);
  23236. // this can emit finish, and it will always happen
  23237. // after error
  23238. pna.nextTick(finishMaybe, stream, state);
  23239. stream._writableState.errorEmitted = true;
  23240. stream.emit('error', er);
  23241. } else {
  23242. // the caller expect this to happen before if
  23243. // it is async
  23244. cb(er);
  23245. stream._writableState.errorEmitted = true;
  23246. stream.emit('error', er);
  23247. // this can emit finish, but finish must
  23248. // always follow error
  23249. finishMaybe(stream, state);
  23250. }
  23251. }
  23252. function onwriteStateUpdate(state) {
  23253. state.writing = false;
  23254. state.writecb = null;
  23255. state.length -= state.writelen;
  23256. state.writelen = 0;
  23257. }
  23258. function onwrite(stream, er) {
  23259. var state = stream._writableState;
  23260. var sync = state.sync;
  23261. var cb = state.writecb;
  23262. onwriteStateUpdate(state);
  23263. if (er) onwriteError(stream, state, sync, er, cb);else {
  23264. // Check if we're actually ready to finish, but don't emit yet
  23265. var finished = needFinish(state);
  23266. if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
  23267. clearBuffer(stream, state);
  23268. }
  23269. if (sync) {
  23270. /*<replacement>*/
  23271. asyncWrite(afterWrite, stream, state, finished, cb);
  23272. /*</replacement>*/
  23273. } else {
  23274. afterWrite(stream, state, finished, cb);
  23275. }
  23276. }
  23277. }
  23278. function afterWrite(stream, state, finished, cb) {
  23279. if (!finished) onwriteDrain(stream, state);
  23280. state.pendingcb--;
  23281. cb();
  23282. finishMaybe(stream, state);
  23283. }
  23284. // Must force callback to be called on nextTick, so that we don't
  23285. // emit 'drain' before the write() consumer gets the 'false' return
  23286. // value, and has a chance to attach a 'drain' listener.
  23287. function onwriteDrain(stream, state) {
  23288. if (state.length === 0 && state.needDrain) {
  23289. state.needDrain = false;
  23290. stream.emit('drain');
  23291. }
  23292. }
  23293. // if there's something in the buffer waiting, then process it
  23294. function clearBuffer(stream, state) {
  23295. state.bufferProcessing = true;
  23296. var entry = state.bufferedRequest;
  23297. if (stream._writev && entry && entry.next) {
  23298. // Fast case, write everything using _writev()
  23299. var l = state.bufferedRequestCount;
  23300. var buffer = new Array(l);
  23301. var holder = state.corkedRequestsFree;
  23302. holder.entry = entry;
  23303. var count = 0;
  23304. var allBuffers = true;
  23305. while (entry) {
  23306. buffer[count] = entry;
  23307. if (!entry.isBuf) allBuffers = false;
  23308. entry = entry.next;
  23309. count += 1;
  23310. }
  23311. buffer.allBuffers = allBuffers;
  23312. doWrite(stream, state, true, state.length, buffer, '', holder.finish);
  23313. // doWrite is almost always async, defer these to save a bit of time
  23314. // as the hot path ends with doWrite
  23315. state.pendingcb++;
  23316. state.lastBufferedRequest = null;
  23317. if (holder.next) {
  23318. state.corkedRequestsFree = holder.next;
  23319. holder.next = null;
  23320. } else {
  23321. state.corkedRequestsFree = new CorkedRequest(state);
  23322. }
  23323. state.bufferedRequestCount = 0;
  23324. } else {
  23325. // Slow case, write chunks one-by-one
  23326. while (entry) {
  23327. var chunk = entry.chunk;
  23328. var encoding = entry.encoding;
  23329. var cb = entry.callback;
  23330. var len = state.objectMode ? 1 : chunk.length;
  23331. doWrite(stream, state, false, len, chunk, encoding, cb);
  23332. entry = entry.next;
  23333. state.bufferedRequestCount--;
  23334. // if we didn't call the onwrite immediately, then
  23335. // it means that we need to wait until it does.
  23336. // also, that means that the chunk and cb are currently
  23337. // being processed, so move the buffer counter past them.
  23338. if (state.writing) {
  23339. break;
  23340. }
  23341. }
  23342. if (entry === null) state.lastBufferedRequest = null;
  23343. }
  23344. state.bufferedRequest = entry;
  23345. state.bufferProcessing = false;
  23346. }
  23347. Writable.prototype._write = function (chunk, encoding, cb) {
  23348. cb(new Error('_write() is not implemented'));
  23349. };
  23350. Writable.prototype._writev = null;
  23351. Writable.prototype.end = function (chunk, encoding, cb) {
  23352. var state = this._writableState;
  23353. if (typeof chunk === 'function') {
  23354. cb = chunk;
  23355. chunk = null;
  23356. encoding = null;
  23357. } else if (typeof encoding === 'function') {
  23358. cb = encoding;
  23359. encoding = null;
  23360. }
  23361. if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
  23362. // .end() fully uncorks
  23363. if (state.corked) {
  23364. state.corked = 1;
  23365. this.uncork();
  23366. }
  23367. // ignore unnecessary end() calls.
  23368. if (!state.ending && !state.finished) endWritable(this, state, cb);
  23369. };
  23370. function needFinish(state) {
  23371. return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
  23372. }
  23373. function callFinal(stream, state) {
  23374. stream._final(function (err) {
  23375. state.pendingcb--;
  23376. if (err) {
  23377. stream.emit('error', err);
  23378. }
  23379. state.prefinished = true;
  23380. stream.emit('prefinish');
  23381. finishMaybe(stream, state);
  23382. });
  23383. }
  23384. function prefinish(stream, state) {
  23385. if (!state.prefinished && !state.finalCalled) {
  23386. if (typeof stream._final === 'function') {
  23387. state.pendingcb++;
  23388. state.finalCalled = true;
  23389. pna.nextTick(callFinal, stream, state);
  23390. } else {
  23391. state.prefinished = true;
  23392. stream.emit('prefinish');
  23393. }
  23394. }
  23395. }
  23396. function finishMaybe(stream, state) {
  23397. var need = needFinish(state);
  23398. if (need) {
  23399. prefinish(stream, state);
  23400. if (state.pendingcb === 0) {
  23401. state.finished = true;
  23402. stream.emit('finish');
  23403. }
  23404. }
  23405. return need;
  23406. }
  23407. function endWritable(stream, state, cb) {
  23408. state.ending = true;
  23409. finishMaybe(stream, state);
  23410. if (cb) {
  23411. if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
  23412. }
  23413. state.ended = true;
  23414. stream.writable = false;
  23415. }
  23416. function onCorkedFinish(corkReq, state, err) {
  23417. var entry = corkReq.entry;
  23418. corkReq.entry = null;
  23419. while (entry) {
  23420. var cb = entry.callback;
  23421. state.pendingcb--;
  23422. cb(err);
  23423. entry = entry.next;
  23424. }
  23425. if (state.corkedRequestsFree) {
  23426. state.corkedRequestsFree.next = corkReq;
  23427. } else {
  23428. state.corkedRequestsFree = corkReq;
  23429. }
  23430. }
  23431. Object.defineProperty(Writable.prototype, 'destroyed', {
  23432. get: function () {
  23433. if (this._writableState === undefined) {
  23434. return false;
  23435. }
  23436. return this._writableState.destroyed;
  23437. },
  23438. set: function (value) {
  23439. // we ignore the value if the stream
  23440. // has not been initialized yet
  23441. if (!this._writableState) {
  23442. return;
  23443. }
  23444. // backward compatibility, the user is explicitly
  23445. // managing destroyed
  23446. this._writableState.destroyed = value;
  23447. }
  23448. });
  23449. Writable.prototype.destroy = destroyImpl.destroy;
  23450. Writable.prototype._undestroy = destroyImpl.undestroy;
  23451. Writable.prototype._destroy = function (err, cb) {
  23452. this.end();
  23453. cb(err);
  23454. };
  23455. }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate)
  23456. },{"./_stream_duplex":386,"./internal/streams/destroy":392,"./internal/streams/stream":393,"_process":467,"core-util-is":341,"inherits":364,"process-nextick-args":380,"safe-buffer":396,"timers":414,"util-deprecate":416}],391:[function(require,module,exports){
  23457. 'use strict';
  23458. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  23459. var Buffer = require('safe-buffer').Buffer;
  23460. var util = require('util');
  23461. function copyBuffer(src, target, offset) {
  23462. src.copy(target, offset);
  23463. }
  23464. module.exports = function () {
  23465. function BufferList() {
  23466. _classCallCheck(this, BufferList);
  23467. this.head = null;
  23468. this.tail = null;
  23469. this.length = 0;
  23470. }
  23471. BufferList.prototype.push = function push(v) {
  23472. var entry = { data: v, next: null };
  23473. if (this.length > 0) this.tail.next = entry;else this.head = entry;
  23474. this.tail = entry;
  23475. ++this.length;
  23476. };
  23477. BufferList.prototype.unshift = function unshift(v) {
  23478. var entry = { data: v, next: this.head };
  23479. if (this.length === 0) this.tail = entry;
  23480. this.head = entry;
  23481. ++this.length;
  23482. };
  23483. BufferList.prototype.shift = function shift() {
  23484. if (this.length === 0) return;
  23485. var ret = this.head.data;
  23486. if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
  23487. --this.length;
  23488. return ret;
  23489. };
  23490. BufferList.prototype.clear = function clear() {
  23491. this.head = this.tail = null;
  23492. this.length = 0;
  23493. };
  23494. BufferList.prototype.join = function join(s) {
  23495. if (this.length === 0) return '';
  23496. var p = this.head;
  23497. var ret = '' + p.data;
  23498. while (p = p.next) {
  23499. ret += s + p.data;
  23500. }return ret;
  23501. };
  23502. BufferList.prototype.concat = function concat(n) {
  23503. if (this.length === 0) return Buffer.alloc(0);
  23504. if (this.length === 1) return this.head.data;
  23505. var ret = Buffer.allocUnsafe(n >>> 0);
  23506. var p = this.head;
  23507. var i = 0;
  23508. while (p) {
  23509. copyBuffer(p.data, ret, i);
  23510. i += p.data.length;
  23511. p = p.next;
  23512. }
  23513. return ret;
  23514. };
  23515. return BufferList;
  23516. }();
  23517. if (util && util.inspect && util.inspect.custom) {
  23518. module.exports.prototype[util.inspect.custom] = function () {
  23519. var obj = util.inspect({ length: this.length });
  23520. return this.constructor.name + ' ' + obj;
  23521. };
  23522. }
  23523. },{"safe-buffer":396,"util":89}],392:[function(require,module,exports){
  23524. 'use strict';
  23525. /*<replacement>*/
  23526. var pna = require('process-nextick-args');
  23527. /*</replacement>*/
  23528. // undocumented cb() API, needed for core, not for public API
  23529. function destroy(err, cb) {
  23530. var _this = this;
  23531. var readableDestroyed = this._readableState && this._readableState.destroyed;
  23532. var writableDestroyed = this._writableState && this._writableState.destroyed;
  23533. if (readableDestroyed || writableDestroyed) {
  23534. if (cb) {
  23535. cb(err);
  23536. } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
  23537. pna.nextTick(emitErrorNT, this, err);
  23538. }
  23539. return this;
  23540. }
  23541. // we set destroyed to true before firing error callbacks in order
  23542. // to make it re-entrance safe in case destroy() is called within callbacks
  23543. if (this._readableState) {
  23544. this._readableState.destroyed = true;
  23545. }
  23546. // if this is a duplex stream mark the writable part as destroyed as well
  23547. if (this._writableState) {
  23548. this._writableState.destroyed = true;
  23549. }
  23550. this._destroy(err || null, function (err) {
  23551. if (!cb && err) {
  23552. pna.nextTick(emitErrorNT, _this, err);
  23553. if (_this._writableState) {
  23554. _this._writableState.errorEmitted = true;
  23555. }
  23556. } else if (cb) {
  23557. cb(err);
  23558. }
  23559. });
  23560. return this;
  23561. }
  23562. function undestroy() {
  23563. if (this._readableState) {
  23564. this._readableState.destroyed = false;
  23565. this._readableState.reading = false;
  23566. this._readableState.ended = false;
  23567. this._readableState.endEmitted = false;
  23568. }
  23569. if (this._writableState) {
  23570. this._writableState.destroyed = false;
  23571. this._writableState.ended = false;
  23572. this._writableState.ending = false;
  23573. this._writableState.finished = false;
  23574. this._writableState.errorEmitted = false;
  23575. }
  23576. }
  23577. function emitErrorNT(self, err) {
  23578. self.emit('error', err);
  23579. }
  23580. module.exports = {
  23581. destroy: destroy,
  23582. undestroy: undestroy
  23583. };
  23584. },{"process-nextick-args":380}],393:[function(require,module,exports){
  23585. module.exports = require('events').EventEmitter;
  23586. },{"events":344}],394:[function(require,module,exports){
  23587. exports = module.exports = require('./lib/_stream_readable.js');
  23588. exports.Stream = exports;
  23589. exports.Readable = exports;
  23590. exports.Writable = require('./lib/_stream_writable.js');
  23591. exports.Duplex = require('./lib/_stream_duplex.js');
  23592. exports.Transform = require('./lib/_stream_transform.js');
  23593. exports.PassThrough = require('./lib/_stream_passthrough.js');
  23594. },{"./lib/_stream_duplex.js":386,"./lib/_stream_passthrough.js":387,"./lib/_stream_readable.js":388,"./lib/_stream_transform.js":389,"./lib/_stream_writable.js":390}],395:[function(require,module,exports){
  23595. /**
  23596. * Copyright (c) 2014-present, Facebook, Inc.
  23597. *
  23598. * This source code is licensed under the MIT license found in the
  23599. * LICENSE file in the root directory of this source tree.
  23600. */
  23601. var runtime = (function (exports) {
  23602. "use strict";
  23603. var Op = Object.prototype;
  23604. var hasOwn = Op.hasOwnProperty;
  23605. var undefined; // More compressible than void 0.
  23606. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  23607. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  23608. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  23609. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  23610. function define(obj, key, value) {
  23611. Object.defineProperty(obj, key, {
  23612. value: value,
  23613. enumerable: true,
  23614. configurable: true,
  23615. writable: true
  23616. });
  23617. return obj[key];
  23618. }
  23619. try {
  23620. // IE 8 has a broken Object.defineProperty that only works on DOM objects.
  23621. define({}, "");
  23622. } catch (err) {
  23623. define = function(obj, key, value) {
  23624. return obj[key] = value;
  23625. };
  23626. }
  23627. function wrap(innerFn, outerFn, self, tryLocsList) {
  23628. // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
  23629. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  23630. var generator = Object.create(protoGenerator.prototype);
  23631. var context = new Context(tryLocsList || []);
  23632. // The ._invoke method unifies the implementations of the .next,
  23633. // .throw, and .return methods.
  23634. generator._invoke = makeInvokeMethod(innerFn, self, context);
  23635. return generator;
  23636. }
  23637. exports.wrap = wrap;
  23638. // Try/catch helper to minimize deoptimizations. Returns a completion
  23639. // record like context.tryEntries[i].completion. This interface could
  23640. // have been (and was previously) designed to take a closure to be
  23641. // invoked without arguments, but in all the cases we care about we
  23642. // already have an existing method we want to call, so there's no need
  23643. // to create a new function object. We can even get away with assuming
  23644. // the method takes exactly one argument, since that happens to be true
  23645. // in every case, so we don't have to touch the arguments object. The
  23646. // only additional allocation required is the completion record, which
  23647. // has a stable shape and so hopefully should be cheap to allocate.
  23648. function tryCatch(fn, obj, arg) {
  23649. try {
  23650. return { type: "normal", arg: fn.call(obj, arg) };
  23651. } catch (err) {
  23652. return { type: "throw", arg: err };
  23653. }
  23654. }
  23655. var GenStateSuspendedStart = "suspendedStart";
  23656. var GenStateSuspendedYield = "suspendedYield";
  23657. var GenStateExecuting = "executing";
  23658. var GenStateCompleted = "completed";
  23659. // Returning this object from the innerFn has the same effect as
  23660. // breaking out of the dispatch switch statement.
  23661. var ContinueSentinel = {};
  23662. // Dummy constructor functions that we use as the .constructor and
  23663. // .constructor.prototype properties for functions that return Generator
  23664. // objects. For full spec compliance, you may wish to configure your
  23665. // minifier not to mangle the names of these two functions.
  23666. function Generator() {}
  23667. function GeneratorFunction() {}
  23668. function GeneratorFunctionPrototype() {}
  23669. // This is a polyfill for %IteratorPrototype% for environments that
  23670. // don't natively support it.
  23671. var IteratorPrototype = {};
  23672. define(IteratorPrototype, iteratorSymbol, function () {
  23673. return this;
  23674. });
  23675. var getProto = Object.getPrototypeOf;
  23676. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  23677. if (NativeIteratorPrototype &&
  23678. NativeIteratorPrototype !== Op &&
  23679. hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  23680. // This environment has a native %IteratorPrototype%; use it instead
  23681. // of the polyfill.
  23682. IteratorPrototype = NativeIteratorPrototype;
  23683. }
  23684. var Gp = GeneratorFunctionPrototype.prototype =
  23685. Generator.prototype = Object.create(IteratorPrototype);
  23686. GeneratorFunction.prototype = GeneratorFunctionPrototype;
  23687. define(Gp, "constructor", GeneratorFunctionPrototype);
  23688. define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
  23689. GeneratorFunction.displayName = define(
  23690. GeneratorFunctionPrototype,
  23691. toStringTagSymbol,
  23692. "GeneratorFunction"
  23693. );
  23694. // Helper for defining the .next, .throw, and .return methods of the
  23695. // Iterator interface in terms of a single ._invoke method.
  23696. function defineIteratorMethods(prototype) {
  23697. ["next", "throw", "return"].forEach(function(method) {
  23698. define(prototype, method, function(arg) {
  23699. return this._invoke(method, arg);
  23700. });
  23701. });
  23702. }
  23703. exports.isGeneratorFunction = function(genFun) {
  23704. var ctor = typeof genFun === "function" && genFun.constructor;
  23705. return ctor
  23706. ? ctor === GeneratorFunction ||
  23707. // For the native GeneratorFunction constructor, the best we can
  23708. // do is to check its .name property.
  23709. (ctor.displayName || ctor.name) === "GeneratorFunction"
  23710. : false;
  23711. };
  23712. exports.mark = function(genFun) {
  23713. if (Object.setPrototypeOf) {
  23714. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  23715. } else {
  23716. genFun.__proto__ = GeneratorFunctionPrototype;
  23717. define(genFun, toStringTagSymbol, "GeneratorFunction");
  23718. }
  23719. genFun.prototype = Object.create(Gp);
  23720. return genFun;
  23721. };
  23722. // Within the body of any async function, `await x` is transformed to
  23723. // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  23724. // `hasOwn.call(value, "__await")` to determine if the yielded value is
  23725. // meant to be awaited.
  23726. exports.awrap = function(arg) {
  23727. return { __await: arg };
  23728. };
  23729. function AsyncIterator(generator, PromiseImpl) {
  23730. function invoke(method, arg, resolve, reject) {
  23731. var record = tryCatch(generator[method], generator, arg);
  23732. if (record.type === "throw") {
  23733. reject(record.arg);
  23734. } else {
  23735. var result = record.arg;
  23736. var value = result.value;
  23737. if (value &&
  23738. typeof value === "object" &&
  23739. hasOwn.call(value, "__await")) {
  23740. return PromiseImpl.resolve(value.__await).then(function(value) {
  23741. invoke("next", value, resolve, reject);
  23742. }, function(err) {
  23743. invoke("throw", err, resolve, reject);
  23744. });
  23745. }
  23746. return PromiseImpl.resolve(value).then(function(unwrapped) {
  23747. // When a yielded Promise is resolved, its final value becomes
  23748. // the .value of the Promise<{value,done}> result for the
  23749. // current iteration.
  23750. result.value = unwrapped;
  23751. resolve(result);
  23752. }, function(error) {
  23753. // If a rejected Promise was yielded, throw the rejection back
  23754. // into the async generator function so it can be handled there.
  23755. return invoke("throw", error, resolve, reject);
  23756. });
  23757. }
  23758. }
  23759. var previousPromise;
  23760. function enqueue(method, arg) {
  23761. function callInvokeWithMethodAndArg() {
  23762. return new PromiseImpl(function(resolve, reject) {
  23763. invoke(method, arg, resolve, reject);
  23764. });
  23765. }
  23766. return previousPromise =
  23767. // If enqueue has been called before, then we want to wait until
  23768. // all previous Promises have been resolved before calling invoke,
  23769. // so that results are always delivered in the correct order. If
  23770. // enqueue has not been called before, then it is important to
  23771. // call invoke immediately, without waiting on a callback to fire,
  23772. // so that the async generator function has the opportunity to do
  23773. // any necessary setup in a predictable way. This predictability
  23774. // is why the Promise constructor synchronously invokes its
  23775. // executor callback, and why async functions synchronously
  23776. // execute code before the first await. Since we implement simple
  23777. // async functions in terms of async generators, it is especially
  23778. // important to get this right, even though it requires care.
  23779. previousPromise ? previousPromise.then(
  23780. callInvokeWithMethodAndArg,
  23781. // Avoid propagating failures to Promises returned by later
  23782. // invocations of the iterator.
  23783. callInvokeWithMethodAndArg
  23784. ) : callInvokeWithMethodAndArg();
  23785. }
  23786. // Define the unified helper method that is used to implement .next,
  23787. // .throw, and .return (see defineIteratorMethods).
  23788. this._invoke = enqueue;
  23789. }
  23790. defineIteratorMethods(AsyncIterator.prototype);
  23791. define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
  23792. return this;
  23793. });
  23794. exports.AsyncIterator = AsyncIterator;
  23795. // Note that simple async functions are implemented on top of
  23796. // AsyncIterator objects; they just return a Promise for the value of
  23797. // the final result produced by the iterator.
  23798. exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
  23799. if (PromiseImpl === void 0) PromiseImpl = Promise;
  23800. var iter = new AsyncIterator(
  23801. wrap(innerFn, outerFn, self, tryLocsList),
  23802. PromiseImpl
  23803. );
  23804. return exports.isGeneratorFunction(outerFn)
  23805. ? iter // If outerFn is a generator, return the full iterator.
  23806. : iter.next().then(function(result) {
  23807. return result.done ? result.value : iter.next();
  23808. });
  23809. };
  23810. function makeInvokeMethod(innerFn, self, context) {
  23811. var state = GenStateSuspendedStart;
  23812. return function invoke(method, arg) {
  23813. if (state === GenStateExecuting) {
  23814. throw new Error("Generator is already running");
  23815. }
  23816. if (state === GenStateCompleted) {
  23817. if (method === "throw") {
  23818. throw arg;
  23819. }
  23820. // Be forgiving, per 25.3.3.3.3 of the spec:
  23821. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
  23822. return doneResult();
  23823. }
  23824. context.method = method;
  23825. context.arg = arg;
  23826. while (true) {
  23827. var delegate = context.delegate;
  23828. if (delegate) {
  23829. var delegateResult = maybeInvokeDelegate(delegate, context);
  23830. if (delegateResult) {
  23831. if (delegateResult === ContinueSentinel) continue;
  23832. return delegateResult;
  23833. }
  23834. }
  23835. if (context.method === "next") {
  23836. // Setting context._sent for legacy support of Babel's
  23837. // function.sent implementation.
  23838. context.sent = context._sent = context.arg;
  23839. } else if (context.method === "throw") {
  23840. if (state === GenStateSuspendedStart) {
  23841. state = GenStateCompleted;
  23842. throw context.arg;
  23843. }
  23844. context.dispatchException(context.arg);
  23845. } else if (context.method === "return") {
  23846. context.abrupt("return", context.arg);
  23847. }
  23848. state = GenStateExecuting;
  23849. var record = tryCatch(innerFn, self, context);
  23850. if (record.type === "normal") {
  23851. // If an exception is thrown from innerFn, we leave state ===
  23852. // GenStateExecuting and loop back for another invocation.
  23853. state = context.done
  23854. ? GenStateCompleted
  23855. : GenStateSuspendedYield;
  23856. if (record.arg === ContinueSentinel) {
  23857. continue;
  23858. }
  23859. return {
  23860. value: record.arg,
  23861. done: context.done
  23862. };
  23863. } else if (record.type === "throw") {
  23864. state = GenStateCompleted;
  23865. // Dispatch the exception by looping back around to the
  23866. // context.dispatchException(context.arg) call above.
  23867. context.method = "throw";
  23868. context.arg = record.arg;
  23869. }
  23870. }
  23871. };
  23872. }
  23873. // Call delegate.iterator[context.method](context.arg) and handle the
  23874. // result, either by returning a { value, done } result from the
  23875. // delegate iterator, or by modifying context.method and context.arg,
  23876. // setting context.delegate to null, and returning the ContinueSentinel.
  23877. function maybeInvokeDelegate(delegate, context) {
  23878. var method = delegate.iterator[context.method];
  23879. if (method === undefined) {
  23880. // A .throw or .return when the delegate iterator has no .throw
  23881. // method always terminates the yield* loop.
  23882. context.delegate = null;
  23883. if (context.method === "throw") {
  23884. // Note: ["return"] must be used for ES3 parsing compatibility.
  23885. if (delegate.iterator["return"]) {
  23886. // If the delegate iterator has a return method, give it a
  23887. // chance to clean up.
  23888. context.method = "return";
  23889. context.arg = undefined;
  23890. maybeInvokeDelegate(delegate, context);
  23891. if (context.method === "throw") {
  23892. // If maybeInvokeDelegate(context) changed context.method from
  23893. // "return" to "throw", let that override the TypeError below.
  23894. return ContinueSentinel;
  23895. }
  23896. }
  23897. context.method = "throw";
  23898. context.arg = new TypeError(
  23899. "The iterator does not provide a 'throw' method");
  23900. }
  23901. return ContinueSentinel;
  23902. }
  23903. var record = tryCatch(method, delegate.iterator, context.arg);
  23904. if (record.type === "throw") {
  23905. context.method = "throw";
  23906. context.arg = record.arg;
  23907. context.delegate = null;
  23908. return ContinueSentinel;
  23909. }
  23910. var info = record.arg;
  23911. if (! info) {
  23912. context.method = "throw";
  23913. context.arg = new TypeError("iterator result is not an object");
  23914. context.delegate = null;
  23915. return ContinueSentinel;
  23916. }
  23917. if (info.done) {
  23918. // Assign the result of the finished delegate to the temporary
  23919. // variable specified by delegate.resultName (see delegateYield).
  23920. context[delegate.resultName] = info.value;
  23921. // Resume execution at the desired location (see delegateYield).
  23922. context.next = delegate.nextLoc;
  23923. // If context.method was "throw" but the delegate handled the
  23924. // exception, let the outer generator proceed normally. If
  23925. // context.method was "next", forget context.arg since it has been
  23926. // "consumed" by the delegate iterator. If context.method was
  23927. // "return", allow the original .return call to continue in the
  23928. // outer generator.
  23929. if (context.method !== "return") {
  23930. context.method = "next";
  23931. context.arg = undefined;
  23932. }
  23933. } else {
  23934. // Re-yield the result returned by the delegate method.
  23935. return info;
  23936. }
  23937. // The delegate iterator is finished, so forget it and continue with
  23938. // the outer generator.
  23939. context.delegate = null;
  23940. return ContinueSentinel;
  23941. }
  23942. // Define Generator.prototype.{next,throw,return} in terms of the
  23943. // unified ._invoke helper method.
  23944. defineIteratorMethods(Gp);
  23945. define(Gp, toStringTagSymbol, "Generator");
  23946. // A Generator should always return itself as the iterator object when the
  23947. // @@iterator function is called on it. Some browsers' implementations of the
  23948. // iterator prototype chain incorrectly implement this, causing the Generator
  23949. // object to not be returned from this call. This ensures that doesn't happen.
  23950. // See https://github.com/facebook/regenerator/issues/274 for more details.
  23951. define(Gp, iteratorSymbol, function() {
  23952. return this;
  23953. });
  23954. define(Gp, "toString", function() {
  23955. return "[object Generator]";
  23956. });
  23957. function pushTryEntry(locs) {
  23958. var entry = { tryLoc: locs[0] };
  23959. if (1 in locs) {
  23960. entry.catchLoc = locs[1];
  23961. }
  23962. if (2 in locs) {
  23963. entry.finallyLoc = locs[2];
  23964. entry.afterLoc = locs[3];
  23965. }
  23966. this.tryEntries.push(entry);
  23967. }
  23968. function resetTryEntry(entry) {
  23969. var record = entry.completion || {};
  23970. record.type = "normal";
  23971. delete record.arg;
  23972. entry.completion = record;
  23973. }
  23974. function Context(tryLocsList) {
  23975. // The root entry object (effectively a try statement without a catch
  23976. // or a finally block) gives us a place to store values thrown from
  23977. // locations where there is no enclosing try statement.
  23978. this.tryEntries = [{ tryLoc: "root" }];
  23979. tryLocsList.forEach(pushTryEntry, this);
  23980. this.reset(true);
  23981. }
  23982. exports.keys = function(object) {
  23983. var keys = [];
  23984. for (var key in object) {
  23985. keys.push(key);
  23986. }
  23987. keys.reverse();
  23988. // Rather than returning an object with a next method, we keep
  23989. // things simple and return the next function itself.
  23990. return function next() {
  23991. while (keys.length) {
  23992. var key = keys.pop();
  23993. if (key in object) {
  23994. next.value = key;
  23995. next.done = false;
  23996. return next;
  23997. }
  23998. }
  23999. // To avoid creating an additional object, we just hang the .value
  24000. // and .done properties off the next function object itself. This
  24001. // also ensures that the minifier will not anonymize the function.
  24002. next.done = true;
  24003. return next;
  24004. };
  24005. };
  24006. function values(iterable) {
  24007. if (iterable) {
  24008. var iteratorMethod = iterable[iteratorSymbol];
  24009. if (iteratorMethod) {
  24010. return iteratorMethod.call(iterable);
  24011. }
  24012. if (typeof iterable.next === "function") {
  24013. return iterable;
  24014. }
  24015. if (!isNaN(iterable.length)) {
  24016. var i = -1, next = function next() {
  24017. while (++i < iterable.length) {
  24018. if (hasOwn.call(iterable, i)) {
  24019. next.value = iterable[i];
  24020. next.done = false;
  24021. return next;
  24022. }
  24023. }
  24024. next.value = undefined;
  24025. next.done = true;
  24026. return next;
  24027. };
  24028. return next.next = next;
  24029. }
  24030. }
  24031. // Return an iterator with no values.
  24032. return { next: doneResult };
  24033. }
  24034. exports.values = values;
  24035. function doneResult() {
  24036. return { value: undefined, done: true };
  24037. }
  24038. Context.prototype = {
  24039. constructor: Context,
  24040. reset: function(skipTempReset) {
  24041. this.prev = 0;
  24042. this.next = 0;
  24043. // Resetting context._sent for legacy support of Babel's
  24044. // function.sent implementation.
  24045. this.sent = this._sent = undefined;
  24046. this.done = false;
  24047. this.delegate = null;
  24048. this.method = "next";
  24049. this.arg = undefined;
  24050. this.tryEntries.forEach(resetTryEntry);
  24051. if (!skipTempReset) {
  24052. for (var name in this) {
  24053. // Not sure about the optimal order of these conditions:
  24054. if (name.charAt(0) === "t" &&
  24055. hasOwn.call(this, name) &&
  24056. !isNaN(+name.slice(1))) {
  24057. this[name] = undefined;
  24058. }
  24059. }
  24060. }
  24061. },
  24062. stop: function() {
  24063. this.done = true;
  24064. var rootEntry = this.tryEntries[0];
  24065. var rootRecord = rootEntry.completion;
  24066. if (rootRecord.type === "throw") {
  24067. throw rootRecord.arg;
  24068. }
  24069. return this.rval;
  24070. },
  24071. dispatchException: function(exception) {
  24072. if (this.done) {
  24073. throw exception;
  24074. }
  24075. var context = this;
  24076. function handle(loc, caught) {
  24077. record.type = "throw";
  24078. record.arg = exception;
  24079. context.next = loc;
  24080. if (caught) {
  24081. // If the dispatched exception was caught by a catch block,
  24082. // then let that catch block handle the exception normally.
  24083. context.method = "next";
  24084. context.arg = undefined;
  24085. }
  24086. return !! caught;
  24087. }
  24088. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  24089. var entry = this.tryEntries[i];
  24090. var record = entry.completion;
  24091. if (entry.tryLoc === "root") {
  24092. // Exception thrown outside of any try block that could handle
  24093. // it, so set the completion value of the entire function to
  24094. // throw the exception.
  24095. return handle("end");
  24096. }
  24097. if (entry.tryLoc <= this.prev) {
  24098. var hasCatch = hasOwn.call(entry, "catchLoc");
  24099. var hasFinally = hasOwn.call(entry, "finallyLoc");
  24100. if (hasCatch && hasFinally) {
  24101. if (this.prev < entry.catchLoc) {
  24102. return handle(entry.catchLoc, true);
  24103. } else if (this.prev < entry.finallyLoc) {
  24104. return handle(entry.finallyLoc);
  24105. }
  24106. } else if (hasCatch) {
  24107. if (this.prev < entry.catchLoc) {
  24108. return handle(entry.catchLoc, true);
  24109. }
  24110. } else if (hasFinally) {
  24111. if (this.prev < entry.finallyLoc) {
  24112. return handle(entry.finallyLoc);
  24113. }
  24114. } else {
  24115. throw new Error("try statement without catch or finally");
  24116. }
  24117. }
  24118. }
  24119. },
  24120. abrupt: function(type, arg) {
  24121. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  24122. var entry = this.tryEntries[i];
  24123. if (entry.tryLoc <= this.prev &&
  24124. hasOwn.call(entry, "finallyLoc") &&
  24125. this.prev < entry.finallyLoc) {
  24126. var finallyEntry = entry;
  24127. break;
  24128. }
  24129. }
  24130. if (finallyEntry &&
  24131. (type === "break" ||
  24132. type === "continue") &&
  24133. finallyEntry.tryLoc <= arg &&
  24134. arg <= finallyEntry.finallyLoc) {
  24135. // Ignore the finally entry if control is not jumping to a
  24136. // location outside the try/catch block.
  24137. finallyEntry = null;
  24138. }
  24139. var record = finallyEntry ? finallyEntry.completion : {};
  24140. record.type = type;
  24141. record.arg = arg;
  24142. if (finallyEntry) {
  24143. this.method = "next";
  24144. this.next = finallyEntry.finallyLoc;
  24145. return ContinueSentinel;
  24146. }
  24147. return this.complete(record);
  24148. },
  24149. complete: function(record, afterLoc) {
  24150. if (record.type === "throw") {
  24151. throw record.arg;
  24152. }
  24153. if (record.type === "break" ||
  24154. record.type === "continue") {
  24155. this.next = record.arg;
  24156. } else if (record.type === "return") {
  24157. this.rval = this.arg = record.arg;
  24158. this.method = "return";
  24159. this.next = "end";
  24160. } else if (record.type === "normal" && afterLoc) {
  24161. this.next = afterLoc;
  24162. }
  24163. return ContinueSentinel;
  24164. },
  24165. finish: function(finallyLoc) {
  24166. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  24167. var entry = this.tryEntries[i];
  24168. if (entry.finallyLoc === finallyLoc) {
  24169. this.complete(entry.completion, entry.afterLoc);
  24170. resetTryEntry(entry);
  24171. return ContinueSentinel;
  24172. }
  24173. }
  24174. },
  24175. "catch": function(tryLoc) {
  24176. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  24177. var entry = this.tryEntries[i];
  24178. if (entry.tryLoc === tryLoc) {
  24179. var record = entry.completion;
  24180. if (record.type === "throw") {
  24181. var thrown = record.arg;
  24182. resetTryEntry(entry);
  24183. }
  24184. return thrown;
  24185. }
  24186. }
  24187. // The context.catch method must only be called with a location
  24188. // argument that corresponds to a known catch block.
  24189. throw new Error("illegal catch attempt");
  24190. },
  24191. delegateYield: function(iterable, resultName, nextLoc) {
  24192. this.delegate = {
  24193. iterator: values(iterable),
  24194. resultName: resultName,
  24195. nextLoc: nextLoc
  24196. };
  24197. if (this.method === "next") {
  24198. // Deliberately forget the last sent value so that we don't
  24199. // accidentally pass it on to the delegate.
  24200. this.arg = undefined;
  24201. }
  24202. return ContinueSentinel;
  24203. }
  24204. };
  24205. // Regardless of whether this script is executing as a CommonJS module
  24206. // or not, return the runtime object so that we can declare the variable
  24207. // regeneratorRuntime in the outer scope, which allows this module to be
  24208. // injected easily by `bin/regenerator --include-runtime script.js`.
  24209. return exports;
  24210. }(
  24211. // If this script is executing as a CommonJS module, use module.exports
  24212. // as the regeneratorRuntime namespace. Otherwise create a new empty
  24213. // object. Either way, the resulting object will be used to initialize
  24214. // the regeneratorRuntime variable at the top of this file.
  24215. typeof module === "object" ? module.exports : {}
  24216. ));
  24217. try {
  24218. regeneratorRuntime = runtime;
  24219. } catch (accidentalStrictMode) {
  24220. // This module should not be running in strict mode, so the above
  24221. // assignment should always work unless something is misconfigured. Just
  24222. // in case runtime.js accidentally runs in strict mode, in modern engines
  24223. // we can explicitly access globalThis. In older engines we can escape
  24224. // strict mode using a global Function call. This could conceivably fail
  24225. // if a Content Security Policy forbids using Function, but in that case
  24226. // the proper solution is to fix the accidental strict mode problem. If
  24227. // you've misconfigured your bundler to force strict mode and applied a
  24228. // CSP to forbid Function, and you're not willing to fix either of those
  24229. // problems, please detail your unique predicament in a GitHub issue.
  24230. if (typeof globalThis === "object") {
  24231. globalThis.regeneratorRuntime = runtime;
  24232. } else {
  24233. Function("r", "regeneratorRuntime = r")(runtime);
  24234. }
  24235. }
  24236. },{}],396:[function(require,module,exports){
  24237. /* eslint-disable node/no-deprecated-api */
  24238. var buffer = require('buffer')
  24239. var Buffer = buffer.Buffer
  24240. // alternative to using Object.keys for old browsers
  24241. function copyProps (src, dst) {
  24242. for (var key in src) {
  24243. dst[key] = src[key]
  24244. }
  24245. }
  24246. if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
  24247. module.exports = buffer
  24248. } else {
  24249. // Copy properties from require('buffer')
  24250. copyProps(buffer, exports)
  24251. exports.Buffer = SafeBuffer
  24252. }
  24253. function SafeBuffer (arg, encodingOrOffset, length) {
  24254. return Buffer(arg, encodingOrOffset, length)
  24255. }
  24256. // Copy static methods from Buffer
  24257. copyProps(Buffer, SafeBuffer)
  24258. SafeBuffer.from = function (arg, encodingOrOffset, length) {
  24259. if (typeof arg === 'number') {
  24260. throw new TypeError('Argument must not be a number')
  24261. }
  24262. return Buffer(arg, encodingOrOffset, length)
  24263. }
  24264. SafeBuffer.alloc = function (size, fill, encoding) {
  24265. if (typeof size !== 'number') {
  24266. throw new TypeError('Argument must be a number')
  24267. }
  24268. var buf = Buffer(size)
  24269. if (fill !== undefined) {
  24270. if (typeof encoding === 'string') {
  24271. buf.fill(fill, encoding)
  24272. } else {
  24273. buf.fill(fill)
  24274. }
  24275. } else {
  24276. buf.fill(0)
  24277. }
  24278. return buf
  24279. }
  24280. SafeBuffer.allocUnsafe = function (size) {
  24281. if (typeof size !== 'number') {
  24282. throw new TypeError('Argument must be a number')
  24283. }
  24284. return Buffer(size)
  24285. }
  24286. SafeBuffer.allocUnsafeSlow = function (size) {
  24287. if (typeof size !== 'number') {
  24288. throw new TypeError('Argument must be a number')
  24289. }
  24290. return buffer.SlowBuffer(size)
  24291. }
  24292. },{"buffer":90}],397:[function(require,module,exports){
  24293. (function (Buffer){(function (){
  24294. ;(function (sax) { // wrapper for non-node envs
  24295. sax.parser = function (strict, opt) { return new SAXParser(strict, opt) }
  24296. sax.SAXParser = SAXParser
  24297. sax.SAXStream = SAXStream
  24298. sax.createStream = createStream
  24299. // When we pass the MAX_BUFFER_LENGTH position, start checking for buffer overruns.
  24300. // When we check, schedule the next check for MAX_BUFFER_LENGTH - (max(buffer lengths)),
  24301. // since that's the earliest that a buffer overrun could occur. This way, checks are
  24302. // as rare as required, but as often as necessary to ensure never crossing this bound.
  24303. // Furthermore, buffers are only tested at most once per write(), so passing a very
  24304. // large string into write() might have undesirable effects, but this is manageable by
  24305. // the caller, so it is assumed to be safe. Thus, a call to write() may, in the extreme
  24306. // edge case, result in creating at most one complete copy of the string passed in.
  24307. // Set to Infinity to have unlimited buffers.
  24308. sax.MAX_BUFFER_LENGTH = 64 * 1024
  24309. var buffers = [
  24310. 'comment', 'sgmlDecl', 'textNode', 'tagName', 'doctype',
  24311. 'procInstName', 'procInstBody', 'entity', 'attribName',
  24312. 'attribValue', 'cdata', 'script'
  24313. ]
  24314. sax.EVENTS = [
  24315. 'text',
  24316. 'processinginstruction',
  24317. 'sgmldeclaration',
  24318. 'doctype',
  24319. 'comment',
  24320. 'opentagstart',
  24321. 'attribute',
  24322. 'opentag',
  24323. 'closetag',
  24324. 'opencdata',
  24325. 'cdata',
  24326. 'closecdata',
  24327. 'error',
  24328. 'end',
  24329. 'ready',
  24330. 'script',
  24331. 'opennamespace',
  24332. 'closenamespace'
  24333. ]
  24334. function SAXParser (strict, opt) {
  24335. if (!(this instanceof SAXParser)) {
  24336. return new SAXParser(strict, opt)
  24337. }
  24338. var parser = this
  24339. clearBuffers(parser)
  24340. parser.q = parser.c = ''
  24341. parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH
  24342. parser.opt = opt || {}
  24343. parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags
  24344. parser.looseCase = parser.opt.lowercase ? 'toLowerCase' : 'toUpperCase'
  24345. parser.tags = []
  24346. parser.closed = parser.closedRoot = parser.sawRoot = false
  24347. parser.tag = parser.error = null
  24348. parser.strict = !!strict
  24349. parser.noscript = !!(strict || parser.opt.noscript)
  24350. parser.state = S.BEGIN
  24351. parser.strictEntities = parser.opt.strictEntities
  24352. parser.ENTITIES = parser.strictEntities ? Object.create(sax.XML_ENTITIES) : Object.create(sax.ENTITIES)
  24353. parser.attribList = []
  24354. // namespaces form a prototype chain.
  24355. // it always points at the current tag,
  24356. // which protos to its parent tag.
  24357. if (parser.opt.xmlns) {
  24358. parser.ns = Object.create(rootNS)
  24359. }
  24360. // mostly just for error reporting
  24361. parser.trackPosition = parser.opt.position !== false
  24362. if (parser.trackPosition) {
  24363. parser.position = parser.line = parser.column = 0
  24364. }
  24365. emit(parser, 'onready')
  24366. }
  24367. if (!Object.create) {
  24368. Object.create = function (o) {
  24369. function F () {}
  24370. F.prototype = o
  24371. var newf = new F()
  24372. return newf
  24373. }
  24374. }
  24375. if (!Object.keys) {
  24376. Object.keys = function (o) {
  24377. var a = []
  24378. for (var i in o) if (o.hasOwnProperty(i)) a.push(i)
  24379. return a
  24380. }
  24381. }
  24382. function checkBufferLength (parser) {
  24383. var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10)
  24384. var maxActual = 0
  24385. for (var i = 0, l = buffers.length; i < l; i++) {
  24386. var len = parser[buffers[i]].length
  24387. if (len > maxAllowed) {
  24388. // Text/cdata nodes can get big, and since they're buffered,
  24389. // we can get here under normal conditions.
  24390. // Avoid issues by emitting the text node now,
  24391. // so at least it won't get any bigger.
  24392. switch (buffers[i]) {
  24393. case 'textNode':
  24394. closeText(parser)
  24395. break
  24396. case 'cdata':
  24397. emitNode(parser, 'oncdata', parser.cdata)
  24398. parser.cdata = ''
  24399. break
  24400. case 'script':
  24401. emitNode(parser, 'onscript', parser.script)
  24402. parser.script = ''
  24403. break
  24404. default:
  24405. error(parser, 'Max buffer length exceeded: ' + buffers[i])
  24406. }
  24407. }
  24408. maxActual = Math.max(maxActual, len)
  24409. }
  24410. // schedule the next check for the earliest possible buffer overrun.
  24411. var m = sax.MAX_BUFFER_LENGTH - maxActual
  24412. parser.bufferCheckPosition = m + parser.position
  24413. }
  24414. function clearBuffers (parser) {
  24415. for (var i = 0, l = buffers.length; i < l; i++) {
  24416. parser[buffers[i]] = ''
  24417. }
  24418. }
  24419. function flushBuffers (parser) {
  24420. closeText(parser)
  24421. if (parser.cdata !== '') {
  24422. emitNode(parser, 'oncdata', parser.cdata)
  24423. parser.cdata = ''
  24424. }
  24425. if (parser.script !== '') {
  24426. emitNode(parser, 'onscript', parser.script)
  24427. parser.script = ''
  24428. }
  24429. }
  24430. SAXParser.prototype = {
  24431. end: function () { end(this) },
  24432. write: write,
  24433. resume: function () { this.error = null; return this },
  24434. close: function () { return this.write(null) },
  24435. flush: function () { flushBuffers(this) }
  24436. }
  24437. var Stream
  24438. try {
  24439. Stream = require('stream').Stream
  24440. } catch (ex) {
  24441. Stream = function () {}
  24442. }
  24443. var streamWraps = sax.EVENTS.filter(function (ev) {
  24444. return ev !== 'error' && ev !== 'end'
  24445. })
  24446. function createStream (strict, opt) {
  24447. return new SAXStream(strict, opt)
  24448. }
  24449. function SAXStream (strict, opt) {
  24450. if (!(this instanceof SAXStream)) {
  24451. return new SAXStream(strict, opt)
  24452. }
  24453. Stream.apply(this)
  24454. this._parser = new SAXParser(strict, opt)
  24455. this.writable = true
  24456. this.readable = true
  24457. var me = this
  24458. this._parser.onend = function () {
  24459. me.emit('end')
  24460. }
  24461. this._parser.onerror = function (er) {
  24462. me.emit('error', er)
  24463. // if didn't throw, then means error was handled.
  24464. // go ahead and clear error, so we can write again.
  24465. me._parser.error = null
  24466. }
  24467. this._decoder = null
  24468. streamWraps.forEach(function (ev) {
  24469. Object.defineProperty(me, 'on' + ev, {
  24470. get: function () {
  24471. return me._parser['on' + ev]
  24472. },
  24473. set: function (h) {
  24474. if (!h) {
  24475. me.removeAllListeners(ev)
  24476. me._parser['on' + ev] = h
  24477. return h
  24478. }
  24479. me.on(ev, h)
  24480. },
  24481. enumerable: true,
  24482. configurable: false
  24483. })
  24484. })
  24485. }
  24486. SAXStream.prototype = Object.create(Stream.prototype, {
  24487. constructor: {
  24488. value: SAXStream
  24489. }
  24490. })
  24491. SAXStream.prototype.write = function (data) {
  24492. if (typeof Buffer === 'function' &&
  24493. typeof Buffer.isBuffer === 'function' &&
  24494. Buffer.isBuffer(data)) {
  24495. if (!this._decoder) {
  24496. var SD = require('string_decoder').StringDecoder
  24497. this._decoder = new SD('utf8')
  24498. }
  24499. data = this._decoder.write(data)
  24500. }
  24501. this._parser.write(data.toString())
  24502. this.emit('data', data)
  24503. return true
  24504. }
  24505. SAXStream.prototype.end = function (chunk) {
  24506. if (chunk && chunk.length) {
  24507. this.write(chunk)
  24508. }
  24509. this._parser.end()
  24510. return true
  24511. }
  24512. SAXStream.prototype.on = function (ev, handler) {
  24513. var me = this
  24514. if (!me._parser['on' + ev] && streamWraps.indexOf(ev) !== -1) {
  24515. me._parser['on' + ev] = function () {
  24516. var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments)
  24517. args.splice(0, 0, ev)
  24518. me.emit.apply(me, args)
  24519. }
  24520. }
  24521. return Stream.prototype.on.call(me, ev, handler)
  24522. }
  24523. // this really needs to be replaced with character classes.
  24524. // XML allows all manner of ridiculous numbers and digits.
  24525. var CDATA = '[CDATA['
  24526. var DOCTYPE = 'DOCTYPE'
  24527. var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace'
  24528. var XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/'
  24529. var rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE }
  24530. // http://www.w3.org/TR/REC-xml/#NT-NameStartChar
  24531. // This implementation works on strings, a single character at a time
  24532. // as such, it cannot ever support astral-plane characters (10000-EFFFF)
  24533. // without a significant breaking change to either this parser, or the
  24534. // JavaScript language. Implementation of an emoji-capable xml parser
  24535. // is left as an exercise for the reader.
  24536. var nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/
  24537. var nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/
  24538. var entityStart = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/
  24539. var entityBody = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/
  24540. function isWhitespace (c) {
  24541. return c === ' ' || c === '\n' || c === '\r' || c === '\t'
  24542. }
  24543. function isQuote (c) {
  24544. return c === '"' || c === '\''
  24545. }
  24546. function isAttribEnd (c) {
  24547. return c === '>' || isWhitespace(c)
  24548. }
  24549. function isMatch (regex, c) {
  24550. return regex.test(c)
  24551. }
  24552. function notMatch (regex, c) {
  24553. return !isMatch(regex, c)
  24554. }
  24555. var S = 0
  24556. sax.STATE = {
  24557. BEGIN: S++, // leading byte order mark or whitespace
  24558. BEGIN_WHITESPACE: S++, // leading whitespace
  24559. TEXT: S++, // general stuff
  24560. TEXT_ENTITY: S++, // &amp and such.
  24561. OPEN_WAKA: S++, // <
  24562. SGML_DECL: S++, // <!BLARG
  24563. SGML_DECL_QUOTED: S++, // <!BLARG foo "bar
  24564. DOCTYPE: S++, // <!DOCTYPE
  24565. DOCTYPE_QUOTED: S++, // <!DOCTYPE "//blah
  24566. DOCTYPE_DTD: S++, // <!DOCTYPE "//blah" [ ...
  24567. DOCTYPE_DTD_QUOTED: S++, // <!DOCTYPE "//blah" [ "foo
  24568. COMMENT_STARTING: S++, // <!-
  24569. COMMENT: S++, // <!--
  24570. COMMENT_ENDING: S++, // <!-- blah -
  24571. COMMENT_ENDED: S++, // <!-- blah --
  24572. CDATA: S++, // <![CDATA[ something
  24573. CDATA_ENDING: S++, // ]
  24574. CDATA_ENDING_2: S++, // ]]
  24575. PROC_INST: S++, // <?hi
  24576. PROC_INST_BODY: S++, // <?hi there
  24577. PROC_INST_ENDING: S++, // <?hi "there" ?
  24578. OPEN_TAG: S++, // <strong
  24579. OPEN_TAG_SLASH: S++, // <strong /
  24580. ATTRIB: S++, // <a
  24581. ATTRIB_NAME: S++, // <a foo
  24582. ATTRIB_NAME_SAW_WHITE: S++, // <a foo _
  24583. ATTRIB_VALUE: S++, // <a foo=
  24584. ATTRIB_VALUE_QUOTED: S++, // <a foo="bar
  24585. ATTRIB_VALUE_CLOSED: S++, // <a foo="bar"
  24586. ATTRIB_VALUE_UNQUOTED: S++, // <a foo=bar
  24587. ATTRIB_VALUE_ENTITY_Q: S++, // <foo bar="&quot;"
  24588. ATTRIB_VALUE_ENTITY_U: S++, // <foo bar=&quot
  24589. CLOSE_TAG: S++, // </a
  24590. CLOSE_TAG_SAW_WHITE: S++, // </a >
  24591. SCRIPT: S++, // <script> ...
  24592. SCRIPT_ENDING: S++ // <script> ... <
  24593. }
  24594. sax.XML_ENTITIES = {
  24595. 'amp': '&',
  24596. 'gt': '>',
  24597. 'lt': '<',
  24598. 'quot': '"',
  24599. 'apos': "'"
  24600. }
  24601. sax.ENTITIES = {
  24602. 'amp': '&',
  24603. 'gt': '>',
  24604. 'lt': '<',
  24605. 'quot': '"',
  24606. 'apos': "'",
  24607. 'AElig': 198,
  24608. 'Aacute': 193,
  24609. 'Acirc': 194,
  24610. 'Agrave': 192,
  24611. 'Aring': 197,
  24612. 'Atilde': 195,
  24613. 'Auml': 196,
  24614. 'Ccedil': 199,
  24615. 'ETH': 208,
  24616. 'Eacute': 201,
  24617. 'Ecirc': 202,
  24618. 'Egrave': 200,
  24619. 'Euml': 203,
  24620. 'Iacute': 205,
  24621. 'Icirc': 206,
  24622. 'Igrave': 204,
  24623. 'Iuml': 207,
  24624. 'Ntilde': 209,
  24625. 'Oacute': 211,
  24626. 'Ocirc': 212,
  24627. 'Ograve': 210,
  24628. 'Oslash': 216,
  24629. 'Otilde': 213,
  24630. 'Ouml': 214,
  24631. 'THORN': 222,
  24632. 'Uacute': 218,
  24633. 'Ucirc': 219,
  24634. 'Ugrave': 217,
  24635. 'Uuml': 220,
  24636. 'Yacute': 221,
  24637. 'aacute': 225,
  24638. 'acirc': 226,
  24639. 'aelig': 230,
  24640. 'agrave': 224,
  24641. 'aring': 229,
  24642. 'atilde': 227,
  24643. 'auml': 228,
  24644. 'ccedil': 231,
  24645. 'eacute': 233,
  24646. 'ecirc': 234,
  24647. 'egrave': 232,
  24648. 'eth': 240,
  24649. 'euml': 235,
  24650. 'iacute': 237,
  24651. 'icirc': 238,
  24652. 'igrave': 236,
  24653. 'iuml': 239,
  24654. 'ntilde': 241,
  24655. 'oacute': 243,
  24656. 'ocirc': 244,
  24657. 'ograve': 242,
  24658. 'oslash': 248,
  24659. 'otilde': 245,
  24660. 'ouml': 246,
  24661. 'szlig': 223,
  24662. 'thorn': 254,
  24663. 'uacute': 250,
  24664. 'ucirc': 251,
  24665. 'ugrave': 249,
  24666. 'uuml': 252,
  24667. 'yacute': 253,
  24668. 'yuml': 255,
  24669. 'copy': 169,
  24670. 'reg': 174,
  24671. 'nbsp': 160,
  24672. 'iexcl': 161,
  24673. 'cent': 162,
  24674. 'pound': 163,
  24675. 'curren': 164,
  24676. 'yen': 165,
  24677. 'brvbar': 166,
  24678. 'sect': 167,
  24679. 'uml': 168,
  24680. 'ordf': 170,
  24681. 'laquo': 171,
  24682. 'not': 172,
  24683. 'shy': 173,
  24684. 'macr': 175,
  24685. 'deg': 176,
  24686. 'plusmn': 177,
  24687. 'sup1': 185,
  24688. 'sup2': 178,
  24689. 'sup3': 179,
  24690. 'acute': 180,
  24691. 'micro': 181,
  24692. 'para': 182,
  24693. 'middot': 183,
  24694. 'cedil': 184,
  24695. 'ordm': 186,
  24696. 'raquo': 187,
  24697. 'frac14': 188,
  24698. 'frac12': 189,
  24699. 'frac34': 190,
  24700. 'iquest': 191,
  24701. 'times': 215,
  24702. 'divide': 247,
  24703. 'OElig': 338,
  24704. 'oelig': 339,
  24705. 'Scaron': 352,
  24706. 'scaron': 353,
  24707. 'Yuml': 376,
  24708. 'fnof': 402,
  24709. 'circ': 710,
  24710. 'tilde': 732,
  24711. 'Alpha': 913,
  24712. 'Beta': 914,
  24713. 'Gamma': 915,
  24714. 'Delta': 916,
  24715. 'Epsilon': 917,
  24716. 'Zeta': 918,
  24717. 'Eta': 919,
  24718. 'Theta': 920,
  24719. 'Iota': 921,
  24720. 'Kappa': 922,
  24721. 'Lambda': 923,
  24722. 'Mu': 924,
  24723. 'Nu': 925,
  24724. 'Xi': 926,
  24725. 'Omicron': 927,
  24726. 'Pi': 928,
  24727. 'Rho': 929,
  24728. 'Sigma': 931,
  24729. 'Tau': 932,
  24730. 'Upsilon': 933,
  24731. 'Phi': 934,
  24732. 'Chi': 935,
  24733. 'Psi': 936,
  24734. 'Omega': 937,
  24735. 'alpha': 945,
  24736. 'beta': 946,
  24737. 'gamma': 947,
  24738. 'delta': 948,
  24739. 'epsilon': 949,
  24740. 'zeta': 950,
  24741. 'eta': 951,
  24742. 'theta': 952,
  24743. 'iota': 953,
  24744. 'kappa': 954,
  24745. 'lambda': 955,
  24746. 'mu': 956,
  24747. 'nu': 957,
  24748. 'xi': 958,
  24749. 'omicron': 959,
  24750. 'pi': 960,
  24751. 'rho': 961,
  24752. 'sigmaf': 962,
  24753. 'sigma': 963,
  24754. 'tau': 964,
  24755. 'upsilon': 965,
  24756. 'phi': 966,
  24757. 'chi': 967,
  24758. 'psi': 968,
  24759. 'omega': 969,
  24760. 'thetasym': 977,
  24761. 'upsih': 978,
  24762. 'piv': 982,
  24763. 'ensp': 8194,
  24764. 'emsp': 8195,
  24765. 'thinsp': 8201,
  24766. 'zwnj': 8204,
  24767. 'zwj': 8205,
  24768. 'lrm': 8206,
  24769. 'rlm': 8207,
  24770. 'ndash': 8211,
  24771. 'mdash': 8212,
  24772. 'lsquo': 8216,
  24773. 'rsquo': 8217,
  24774. 'sbquo': 8218,
  24775. 'ldquo': 8220,
  24776. 'rdquo': 8221,
  24777. 'bdquo': 8222,
  24778. 'dagger': 8224,
  24779. 'Dagger': 8225,
  24780. 'bull': 8226,
  24781. 'hellip': 8230,
  24782. 'permil': 8240,
  24783. 'prime': 8242,
  24784. 'Prime': 8243,
  24785. 'lsaquo': 8249,
  24786. 'rsaquo': 8250,
  24787. 'oline': 8254,
  24788. 'frasl': 8260,
  24789. 'euro': 8364,
  24790. 'image': 8465,
  24791. 'weierp': 8472,
  24792. 'real': 8476,
  24793. 'trade': 8482,
  24794. 'alefsym': 8501,
  24795. 'larr': 8592,
  24796. 'uarr': 8593,
  24797. 'rarr': 8594,
  24798. 'darr': 8595,
  24799. 'harr': 8596,
  24800. 'crarr': 8629,
  24801. 'lArr': 8656,
  24802. 'uArr': 8657,
  24803. 'rArr': 8658,
  24804. 'dArr': 8659,
  24805. 'hArr': 8660,
  24806. 'forall': 8704,
  24807. 'part': 8706,
  24808. 'exist': 8707,
  24809. 'empty': 8709,
  24810. 'nabla': 8711,
  24811. 'isin': 8712,
  24812. 'notin': 8713,
  24813. 'ni': 8715,
  24814. 'prod': 8719,
  24815. 'sum': 8721,
  24816. 'minus': 8722,
  24817. 'lowast': 8727,
  24818. 'radic': 8730,
  24819. 'prop': 8733,
  24820. 'infin': 8734,
  24821. 'ang': 8736,
  24822. 'and': 8743,
  24823. 'or': 8744,
  24824. 'cap': 8745,
  24825. 'cup': 8746,
  24826. 'int': 8747,
  24827. 'there4': 8756,
  24828. 'sim': 8764,
  24829. 'cong': 8773,
  24830. 'asymp': 8776,
  24831. 'ne': 8800,
  24832. 'equiv': 8801,
  24833. 'le': 8804,
  24834. 'ge': 8805,
  24835. 'sub': 8834,
  24836. 'sup': 8835,
  24837. 'nsub': 8836,
  24838. 'sube': 8838,
  24839. 'supe': 8839,
  24840. 'oplus': 8853,
  24841. 'otimes': 8855,
  24842. 'perp': 8869,
  24843. 'sdot': 8901,
  24844. 'lceil': 8968,
  24845. 'rceil': 8969,
  24846. 'lfloor': 8970,
  24847. 'rfloor': 8971,
  24848. 'lang': 9001,
  24849. 'rang': 9002,
  24850. 'loz': 9674,
  24851. 'spades': 9824,
  24852. 'clubs': 9827,
  24853. 'hearts': 9829,
  24854. 'diams': 9830
  24855. }
  24856. Object.keys(sax.ENTITIES).forEach(function (key) {
  24857. var e = sax.ENTITIES[key]
  24858. var s = typeof e === 'number' ? String.fromCharCode(e) : e
  24859. sax.ENTITIES[key] = s
  24860. })
  24861. for (var s in sax.STATE) {
  24862. sax.STATE[sax.STATE[s]] = s
  24863. }
  24864. // shorthand
  24865. S = sax.STATE
  24866. function emit (parser, event, data) {
  24867. parser[event] && parser[event](data)
  24868. }
  24869. function emitNode (parser, nodeType, data) {
  24870. if (parser.textNode) closeText(parser)
  24871. emit(parser, nodeType, data)
  24872. }
  24873. function closeText (parser) {
  24874. parser.textNode = textopts(parser.opt, parser.textNode)
  24875. if (parser.textNode) emit(parser, 'ontext', parser.textNode)
  24876. parser.textNode = ''
  24877. }
  24878. function textopts (opt, text) {
  24879. if (opt.trim) text = text.trim()
  24880. if (opt.normalize) text = text.replace(/\s+/g, ' ')
  24881. return text
  24882. }
  24883. function error (parser, er) {
  24884. closeText(parser)
  24885. if (parser.trackPosition) {
  24886. er += '\nLine: ' + parser.line +
  24887. '\nColumn: ' + parser.column +
  24888. '\nChar: ' + parser.c
  24889. }
  24890. er = new Error(er)
  24891. parser.error = er
  24892. emit(parser, 'onerror', er)
  24893. return parser
  24894. }
  24895. function end (parser) {
  24896. if (parser.sawRoot && !parser.closedRoot) strictFail(parser, 'Unclosed root tag')
  24897. if ((parser.state !== S.BEGIN) &&
  24898. (parser.state !== S.BEGIN_WHITESPACE) &&
  24899. (parser.state !== S.TEXT)) {
  24900. error(parser, 'Unexpected end')
  24901. }
  24902. closeText(parser)
  24903. parser.c = ''
  24904. parser.closed = true
  24905. emit(parser, 'onend')
  24906. SAXParser.call(parser, parser.strict, parser.opt)
  24907. return parser
  24908. }
  24909. function strictFail (parser, message) {
  24910. if (typeof parser !== 'object' || !(parser instanceof SAXParser)) {
  24911. throw new Error('bad call to strictFail')
  24912. }
  24913. if (parser.strict) {
  24914. error(parser, message)
  24915. }
  24916. }
  24917. function newTag (parser) {
  24918. if (!parser.strict) parser.tagName = parser.tagName[parser.looseCase]()
  24919. var parent = parser.tags[parser.tags.length - 1] || parser
  24920. var tag = parser.tag = { name: parser.tagName, attributes: {} }
  24921. // will be overridden if tag contails an xmlns="foo" or xmlns:foo="bar"
  24922. if (parser.opt.xmlns) {
  24923. tag.ns = parent.ns
  24924. }
  24925. parser.attribList.length = 0
  24926. emitNode(parser, 'onopentagstart', tag)
  24927. }
  24928. function qname (name, attribute) {
  24929. var i = name.indexOf(':')
  24930. var qualName = i < 0 ? [ '', name ] : name.split(':')
  24931. var prefix = qualName[0]
  24932. var local = qualName[1]
  24933. // <x "xmlns"="http://foo">
  24934. if (attribute && name === 'xmlns') {
  24935. prefix = 'xmlns'
  24936. local = ''
  24937. }
  24938. return { prefix: prefix, local: local }
  24939. }
  24940. function attrib (parser) {
  24941. if (!parser.strict) {
  24942. parser.attribName = parser.attribName[parser.looseCase]()
  24943. }
  24944. if (parser.attribList.indexOf(parser.attribName) !== -1 ||
  24945. parser.tag.attributes.hasOwnProperty(parser.attribName)) {
  24946. parser.attribName = parser.attribValue = ''
  24947. return
  24948. }
  24949. if (parser.opt.xmlns) {
  24950. var qn = qname(parser.attribName, true)
  24951. var prefix = qn.prefix
  24952. var local = qn.local
  24953. if (prefix === 'xmlns') {
  24954. // namespace binding attribute. push the binding into scope
  24955. if (local === 'xml' && parser.attribValue !== XML_NAMESPACE) {
  24956. strictFail(parser,
  24957. 'xml: prefix must be bound to ' + XML_NAMESPACE + '\n' +
  24958. 'Actual: ' + parser.attribValue)
  24959. } else if (local === 'xmlns' && parser.attribValue !== XMLNS_NAMESPACE) {
  24960. strictFail(parser,
  24961. 'xmlns: prefix must be bound to ' + XMLNS_NAMESPACE + '\n' +
  24962. 'Actual: ' + parser.attribValue)
  24963. } else {
  24964. var tag = parser.tag
  24965. var parent = parser.tags[parser.tags.length - 1] || parser
  24966. if (tag.ns === parent.ns) {
  24967. tag.ns = Object.create(parent.ns)
  24968. }
  24969. tag.ns[local] = parser.attribValue
  24970. }
  24971. }
  24972. // defer onattribute events until all attributes have been seen
  24973. // so any new bindings can take effect. preserve attribute order
  24974. // so deferred events can be emitted in document order
  24975. parser.attribList.push([parser.attribName, parser.attribValue])
  24976. } else {
  24977. // in non-xmlns mode, we can emit the event right away
  24978. parser.tag.attributes[parser.attribName] = parser.attribValue
  24979. emitNode(parser, 'onattribute', {
  24980. name: parser.attribName,
  24981. value: parser.attribValue
  24982. })
  24983. }
  24984. parser.attribName = parser.attribValue = ''
  24985. }
  24986. function openTag (parser, selfClosing) {
  24987. if (parser.opt.xmlns) {
  24988. // emit namespace binding events
  24989. var tag = parser.tag
  24990. // add namespace info to tag
  24991. var qn = qname(parser.tagName)
  24992. tag.prefix = qn.prefix
  24993. tag.local = qn.local
  24994. tag.uri = tag.ns[qn.prefix] || ''
  24995. if (tag.prefix && !tag.uri) {
  24996. strictFail(parser, 'Unbound namespace prefix: ' +
  24997. JSON.stringify(parser.tagName))
  24998. tag.uri = qn.prefix
  24999. }
  25000. var parent = parser.tags[parser.tags.length - 1] || parser
  25001. if (tag.ns && parent.ns !== tag.ns) {
  25002. Object.keys(tag.ns).forEach(function (p) {
  25003. emitNode(parser, 'onopennamespace', {
  25004. prefix: p,
  25005. uri: tag.ns[p]
  25006. })
  25007. })
  25008. }
  25009. // handle deferred onattribute events
  25010. // Note: do not apply default ns to attributes:
  25011. // http://www.w3.org/TR/REC-xml-names/#defaulting
  25012. for (var i = 0, l = parser.attribList.length; i < l; i++) {
  25013. var nv = parser.attribList[i]
  25014. var name = nv[0]
  25015. var value = nv[1]
  25016. var qualName = qname(name, true)
  25017. var prefix = qualName.prefix
  25018. var local = qualName.local
  25019. var uri = prefix === '' ? '' : (tag.ns[prefix] || '')
  25020. var a = {
  25021. name: name,
  25022. value: value,
  25023. prefix: prefix,
  25024. local: local,
  25025. uri: uri
  25026. }
  25027. // if there's any attributes with an undefined namespace,
  25028. // then fail on them now.
  25029. if (prefix && prefix !== 'xmlns' && !uri) {
  25030. strictFail(parser, 'Unbound namespace prefix: ' +
  25031. JSON.stringify(prefix))
  25032. a.uri = prefix
  25033. }
  25034. parser.tag.attributes[name] = a
  25035. emitNode(parser, 'onattribute', a)
  25036. }
  25037. parser.attribList.length = 0
  25038. }
  25039. parser.tag.isSelfClosing = !!selfClosing
  25040. // process the tag
  25041. parser.sawRoot = true
  25042. parser.tags.push(parser.tag)
  25043. emitNode(parser, 'onopentag', parser.tag)
  25044. if (!selfClosing) {
  25045. // special case for <script> in non-strict mode.
  25046. if (!parser.noscript && parser.tagName.toLowerCase() === 'script') {
  25047. parser.state = S.SCRIPT
  25048. } else {
  25049. parser.state = S.TEXT
  25050. }
  25051. parser.tag = null
  25052. parser.tagName = ''
  25053. }
  25054. parser.attribName = parser.attribValue = ''
  25055. parser.attribList.length = 0
  25056. }
  25057. function closeTag (parser) {
  25058. if (!parser.tagName) {
  25059. strictFail(parser, 'Weird empty close tag.')
  25060. parser.textNode += '</>'
  25061. parser.state = S.TEXT
  25062. return
  25063. }
  25064. if (parser.script) {
  25065. if (parser.tagName !== 'script') {
  25066. parser.script += '</' + parser.tagName + '>'
  25067. parser.tagName = ''
  25068. parser.state = S.SCRIPT
  25069. return
  25070. }
  25071. emitNode(parser, 'onscript', parser.script)
  25072. parser.script = ''
  25073. }
  25074. // first make sure that the closing tag actually exists.
  25075. // <a><b></c></b></a> will close everything, otherwise.
  25076. var t = parser.tags.length
  25077. var tagName = parser.tagName
  25078. if (!parser.strict) {
  25079. tagName = tagName[parser.looseCase]()
  25080. }
  25081. var closeTo = tagName
  25082. while (t--) {
  25083. var close = parser.tags[t]
  25084. if (close.name !== closeTo) {
  25085. // fail the first time in strict mode
  25086. strictFail(parser, 'Unexpected close tag')
  25087. } else {
  25088. break
  25089. }
  25090. }
  25091. // didn't find it. we already failed for strict, so just abort.
  25092. if (t < 0) {
  25093. strictFail(parser, 'Unmatched closing tag: ' + parser.tagName)
  25094. parser.textNode += '</' + parser.tagName + '>'
  25095. parser.state = S.TEXT
  25096. return
  25097. }
  25098. parser.tagName = tagName
  25099. var s = parser.tags.length
  25100. while (s-- > t) {
  25101. var tag = parser.tag = parser.tags.pop()
  25102. parser.tagName = parser.tag.name
  25103. emitNode(parser, 'onclosetag', parser.tagName)
  25104. var x = {}
  25105. for (var i in tag.ns) {
  25106. x[i] = tag.ns[i]
  25107. }
  25108. var parent = parser.tags[parser.tags.length - 1] || parser
  25109. if (parser.opt.xmlns && tag.ns !== parent.ns) {
  25110. // remove namespace bindings introduced by tag
  25111. Object.keys(tag.ns).forEach(function (p) {
  25112. var n = tag.ns[p]
  25113. emitNode(parser, 'onclosenamespace', { prefix: p, uri: n })
  25114. })
  25115. }
  25116. }
  25117. if (t === 0) parser.closedRoot = true
  25118. parser.tagName = parser.attribValue = parser.attribName = ''
  25119. parser.attribList.length = 0
  25120. parser.state = S.TEXT
  25121. }
  25122. function parseEntity (parser) {
  25123. var entity = parser.entity
  25124. var entityLC = entity.toLowerCase()
  25125. var num
  25126. var numStr = ''
  25127. if (parser.ENTITIES[entity]) {
  25128. return parser.ENTITIES[entity]
  25129. }
  25130. if (parser.ENTITIES[entityLC]) {
  25131. return parser.ENTITIES[entityLC]
  25132. }
  25133. entity = entityLC
  25134. if (entity.charAt(0) === '#') {
  25135. if (entity.charAt(1) === 'x') {
  25136. entity = entity.slice(2)
  25137. num = parseInt(entity, 16)
  25138. numStr = num.toString(16)
  25139. } else {
  25140. entity = entity.slice(1)
  25141. num = parseInt(entity, 10)
  25142. numStr = num.toString(10)
  25143. }
  25144. }
  25145. entity = entity.replace(/^0+/, '')
  25146. if (isNaN(num) || numStr.toLowerCase() !== entity) {
  25147. strictFail(parser, 'Invalid character entity')
  25148. return '&' + parser.entity + ';'
  25149. }
  25150. return String.fromCodePoint(num)
  25151. }
  25152. function beginWhiteSpace (parser, c) {
  25153. if (c === '<') {
  25154. parser.state = S.OPEN_WAKA
  25155. parser.startTagPosition = parser.position
  25156. } else if (!isWhitespace(c)) {
  25157. // have to process this as a text node.
  25158. // weird, but happens.
  25159. strictFail(parser, 'Non-whitespace before first tag.')
  25160. parser.textNode = c
  25161. parser.state = S.TEXT
  25162. }
  25163. }
  25164. function charAt (chunk, i) {
  25165. var result = ''
  25166. if (i < chunk.length) {
  25167. result = chunk.charAt(i)
  25168. }
  25169. return result
  25170. }
  25171. function write (chunk) {
  25172. var parser = this
  25173. if (this.error) {
  25174. throw this.error
  25175. }
  25176. if (parser.closed) {
  25177. return error(parser,
  25178. 'Cannot write after close. Assign an onready handler.')
  25179. }
  25180. if (chunk === null) {
  25181. return end(parser)
  25182. }
  25183. if (typeof chunk === 'object') {
  25184. chunk = chunk.toString()
  25185. }
  25186. var i = 0
  25187. var c = ''
  25188. while (true) {
  25189. c = charAt(chunk, i++)
  25190. parser.c = c
  25191. if (!c) {
  25192. break
  25193. }
  25194. if (parser.trackPosition) {
  25195. parser.position++
  25196. if (c === '\n') {
  25197. parser.line++
  25198. parser.column = 0
  25199. } else {
  25200. parser.column++
  25201. }
  25202. }
  25203. switch (parser.state) {
  25204. case S.BEGIN:
  25205. parser.state = S.BEGIN_WHITESPACE
  25206. if (c === '\uFEFF') {
  25207. continue
  25208. }
  25209. beginWhiteSpace(parser, c)
  25210. continue
  25211. case S.BEGIN_WHITESPACE:
  25212. beginWhiteSpace(parser, c)
  25213. continue
  25214. case S.TEXT:
  25215. if (parser.sawRoot && !parser.closedRoot) {
  25216. var starti = i - 1
  25217. while (c && c !== '<' && c !== '&') {
  25218. c = charAt(chunk, i++)
  25219. if (c && parser.trackPosition) {
  25220. parser.position++
  25221. if (c === '\n') {
  25222. parser.line++
  25223. parser.column = 0
  25224. } else {
  25225. parser.column++
  25226. }
  25227. }
  25228. }
  25229. parser.textNode += chunk.substring(starti, i - 1)
  25230. }
  25231. if (c === '<' && !(parser.sawRoot && parser.closedRoot && !parser.strict)) {
  25232. parser.state = S.OPEN_WAKA
  25233. parser.startTagPosition = parser.position
  25234. } else {
  25235. if (!isWhitespace(c) && (!parser.sawRoot || parser.closedRoot)) {
  25236. strictFail(parser, 'Text data outside of root node.')
  25237. }
  25238. if (c === '&') {
  25239. parser.state = S.TEXT_ENTITY
  25240. } else {
  25241. parser.textNode += c
  25242. }
  25243. }
  25244. continue
  25245. case S.SCRIPT:
  25246. // only non-strict
  25247. if (c === '<') {
  25248. parser.state = S.SCRIPT_ENDING
  25249. } else {
  25250. parser.script += c
  25251. }
  25252. continue
  25253. case S.SCRIPT_ENDING:
  25254. if (c === '/') {
  25255. parser.state = S.CLOSE_TAG
  25256. } else {
  25257. parser.script += '<' + c
  25258. parser.state = S.SCRIPT
  25259. }
  25260. continue
  25261. case S.OPEN_WAKA:
  25262. // either a /, ?, !, or text is coming next.
  25263. if (c === '!') {
  25264. parser.state = S.SGML_DECL
  25265. parser.sgmlDecl = ''
  25266. } else if (isWhitespace(c)) {
  25267. // wait for it...
  25268. } else if (isMatch(nameStart, c)) {
  25269. parser.state = S.OPEN_TAG
  25270. parser.tagName = c
  25271. } else if (c === '/') {
  25272. parser.state = S.CLOSE_TAG
  25273. parser.tagName = ''
  25274. } else if (c === '?') {
  25275. parser.state = S.PROC_INST
  25276. parser.procInstName = parser.procInstBody = ''
  25277. } else {
  25278. strictFail(parser, 'Unencoded <')
  25279. // if there was some whitespace, then add that in.
  25280. if (parser.startTagPosition + 1 < parser.position) {
  25281. var pad = parser.position - parser.startTagPosition
  25282. c = new Array(pad).join(' ') + c
  25283. }
  25284. parser.textNode += '<' + c
  25285. parser.state = S.TEXT
  25286. }
  25287. continue
  25288. case S.SGML_DECL:
  25289. if ((parser.sgmlDecl + c).toUpperCase() === CDATA) {
  25290. emitNode(parser, 'onopencdata')
  25291. parser.state = S.CDATA
  25292. parser.sgmlDecl = ''
  25293. parser.cdata = ''
  25294. } else if (parser.sgmlDecl + c === '--') {
  25295. parser.state = S.COMMENT
  25296. parser.comment = ''
  25297. parser.sgmlDecl = ''
  25298. } else if ((parser.sgmlDecl + c).toUpperCase() === DOCTYPE) {
  25299. parser.state = S.DOCTYPE
  25300. if (parser.doctype || parser.sawRoot) {
  25301. strictFail(parser,
  25302. 'Inappropriately located doctype declaration')
  25303. }
  25304. parser.doctype = ''
  25305. parser.sgmlDecl = ''
  25306. } else if (c === '>') {
  25307. emitNode(parser, 'onsgmldeclaration', parser.sgmlDecl)
  25308. parser.sgmlDecl = ''
  25309. parser.state = S.TEXT
  25310. } else if (isQuote(c)) {
  25311. parser.state = S.SGML_DECL_QUOTED
  25312. parser.sgmlDecl += c
  25313. } else {
  25314. parser.sgmlDecl += c
  25315. }
  25316. continue
  25317. case S.SGML_DECL_QUOTED:
  25318. if (c === parser.q) {
  25319. parser.state = S.SGML_DECL
  25320. parser.q = ''
  25321. }
  25322. parser.sgmlDecl += c
  25323. continue
  25324. case S.DOCTYPE:
  25325. if (c === '>') {
  25326. parser.state = S.TEXT
  25327. emitNode(parser, 'ondoctype', parser.doctype)
  25328. parser.doctype = true // just remember that we saw it.
  25329. } else {
  25330. parser.doctype += c
  25331. if (c === '[') {
  25332. parser.state = S.DOCTYPE_DTD
  25333. } else if (isQuote(c)) {
  25334. parser.state = S.DOCTYPE_QUOTED
  25335. parser.q = c
  25336. }
  25337. }
  25338. continue
  25339. case S.DOCTYPE_QUOTED:
  25340. parser.doctype += c
  25341. if (c === parser.q) {
  25342. parser.q = ''
  25343. parser.state = S.DOCTYPE
  25344. }
  25345. continue
  25346. case S.DOCTYPE_DTD:
  25347. parser.doctype += c
  25348. if (c === ']') {
  25349. parser.state = S.DOCTYPE
  25350. } else if (isQuote(c)) {
  25351. parser.state = S.DOCTYPE_DTD_QUOTED
  25352. parser.q = c
  25353. }
  25354. continue
  25355. case S.DOCTYPE_DTD_QUOTED:
  25356. parser.doctype += c
  25357. if (c === parser.q) {
  25358. parser.state = S.DOCTYPE_DTD
  25359. parser.q = ''
  25360. }
  25361. continue
  25362. case S.COMMENT:
  25363. if (c === '-') {
  25364. parser.state = S.COMMENT_ENDING
  25365. } else {
  25366. parser.comment += c
  25367. }
  25368. continue
  25369. case S.COMMENT_ENDING:
  25370. if (c === '-') {
  25371. parser.state = S.COMMENT_ENDED
  25372. parser.comment = textopts(parser.opt, parser.comment)
  25373. if (parser.comment) {
  25374. emitNode(parser, 'oncomment', parser.comment)
  25375. }
  25376. parser.comment = ''
  25377. } else {
  25378. parser.comment += '-' + c
  25379. parser.state = S.COMMENT
  25380. }
  25381. continue
  25382. case S.COMMENT_ENDED:
  25383. if (c !== '>') {
  25384. strictFail(parser, 'Malformed comment')
  25385. // allow <!-- blah -- bloo --> in non-strict mode,
  25386. // which is a comment of " blah -- bloo "
  25387. parser.comment += '--' + c
  25388. parser.state = S.COMMENT
  25389. } else {
  25390. parser.state = S.TEXT
  25391. }
  25392. continue
  25393. case S.CDATA:
  25394. if (c === ']') {
  25395. parser.state = S.CDATA_ENDING
  25396. } else {
  25397. parser.cdata += c
  25398. }
  25399. continue
  25400. case S.CDATA_ENDING:
  25401. if (c === ']') {
  25402. parser.state = S.CDATA_ENDING_2
  25403. } else {
  25404. parser.cdata += ']' + c
  25405. parser.state = S.CDATA
  25406. }
  25407. continue
  25408. case S.CDATA_ENDING_2:
  25409. if (c === '>') {
  25410. if (parser.cdata) {
  25411. emitNode(parser, 'oncdata', parser.cdata)
  25412. }
  25413. emitNode(parser, 'onclosecdata')
  25414. parser.cdata = ''
  25415. parser.state = S.TEXT
  25416. } else if (c === ']') {
  25417. parser.cdata += ']'
  25418. } else {
  25419. parser.cdata += ']]' + c
  25420. parser.state = S.CDATA
  25421. }
  25422. continue
  25423. case S.PROC_INST:
  25424. if (c === '?') {
  25425. parser.state = S.PROC_INST_ENDING
  25426. } else if (isWhitespace(c)) {
  25427. parser.state = S.PROC_INST_BODY
  25428. } else {
  25429. parser.procInstName += c
  25430. }
  25431. continue
  25432. case S.PROC_INST_BODY:
  25433. if (!parser.procInstBody && isWhitespace(c)) {
  25434. continue
  25435. } else if (c === '?') {
  25436. parser.state = S.PROC_INST_ENDING
  25437. } else {
  25438. parser.procInstBody += c
  25439. }
  25440. continue
  25441. case S.PROC_INST_ENDING:
  25442. if (c === '>') {
  25443. emitNode(parser, 'onprocessinginstruction', {
  25444. name: parser.procInstName,
  25445. body: parser.procInstBody
  25446. })
  25447. parser.procInstName = parser.procInstBody = ''
  25448. parser.state = S.TEXT
  25449. } else {
  25450. parser.procInstBody += '?' + c
  25451. parser.state = S.PROC_INST_BODY
  25452. }
  25453. continue
  25454. case S.OPEN_TAG:
  25455. if (isMatch(nameBody, c)) {
  25456. parser.tagName += c
  25457. } else {
  25458. newTag(parser)
  25459. if (c === '>') {
  25460. openTag(parser)
  25461. } else if (c === '/') {
  25462. parser.state = S.OPEN_TAG_SLASH
  25463. } else {
  25464. if (!isWhitespace(c)) {
  25465. strictFail(parser, 'Invalid character in tag name')
  25466. }
  25467. parser.state = S.ATTRIB
  25468. }
  25469. }
  25470. continue
  25471. case S.OPEN_TAG_SLASH:
  25472. if (c === '>') {
  25473. openTag(parser, true)
  25474. closeTag(parser)
  25475. } else {
  25476. strictFail(parser, 'Forward-slash in opening tag not followed by >')
  25477. parser.state = S.ATTRIB
  25478. }
  25479. continue
  25480. case S.ATTRIB:
  25481. // haven't read the attribute name yet.
  25482. if (isWhitespace(c)) {
  25483. continue
  25484. } else if (c === '>') {
  25485. openTag(parser)
  25486. } else if (c === '/') {
  25487. parser.state = S.OPEN_TAG_SLASH
  25488. } else if (isMatch(nameStart, c)) {
  25489. parser.attribName = c
  25490. parser.attribValue = ''
  25491. parser.state = S.ATTRIB_NAME
  25492. } else {
  25493. strictFail(parser, 'Invalid attribute name')
  25494. }
  25495. continue
  25496. case S.ATTRIB_NAME:
  25497. if (c === '=') {
  25498. parser.state = S.ATTRIB_VALUE
  25499. } else if (c === '>') {
  25500. strictFail(parser, 'Attribute without value')
  25501. parser.attribValue = parser.attribName
  25502. attrib(parser)
  25503. openTag(parser)
  25504. } else if (isWhitespace(c)) {
  25505. parser.state = S.ATTRIB_NAME_SAW_WHITE
  25506. } else if (isMatch(nameBody, c)) {
  25507. parser.attribName += c
  25508. } else {
  25509. strictFail(parser, 'Invalid attribute name')
  25510. }
  25511. continue
  25512. case S.ATTRIB_NAME_SAW_WHITE:
  25513. if (c === '=') {
  25514. parser.state = S.ATTRIB_VALUE
  25515. } else if (isWhitespace(c)) {
  25516. continue
  25517. } else {
  25518. strictFail(parser, 'Attribute without value')
  25519. parser.tag.attributes[parser.attribName] = ''
  25520. parser.attribValue = ''
  25521. emitNode(parser, 'onattribute', {
  25522. name: parser.attribName,
  25523. value: ''
  25524. })
  25525. parser.attribName = ''
  25526. if (c === '>') {
  25527. openTag(parser)
  25528. } else if (isMatch(nameStart, c)) {
  25529. parser.attribName = c
  25530. parser.state = S.ATTRIB_NAME
  25531. } else {
  25532. strictFail(parser, 'Invalid attribute name')
  25533. parser.state = S.ATTRIB
  25534. }
  25535. }
  25536. continue
  25537. case S.ATTRIB_VALUE:
  25538. if (isWhitespace(c)) {
  25539. continue
  25540. } else if (isQuote(c)) {
  25541. parser.q = c
  25542. parser.state = S.ATTRIB_VALUE_QUOTED
  25543. } else {
  25544. strictFail(parser, 'Unquoted attribute value')
  25545. parser.state = S.ATTRIB_VALUE_UNQUOTED
  25546. parser.attribValue = c
  25547. }
  25548. continue
  25549. case S.ATTRIB_VALUE_QUOTED:
  25550. if (c !== parser.q) {
  25551. if (c === '&') {
  25552. parser.state = S.ATTRIB_VALUE_ENTITY_Q
  25553. } else {
  25554. parser.attribValue += c
  25555. }
  25556. continue
  25557. }
  25558. attrib(parser)
  25559. parser.q = ''
  25560. parser.state = S.ATTRIB_VALUE_CLOSED
  25561. continue
  25562. case S.ATTRIB_VALUE_CLOSED:
  25563. if (isWhitespace(c)) {
  25564. parser.state = S.ATTRIB
  25565. } else if (c === '>') {
  25566. openTag(parser)
  25567. } else if (c === '/') {
  25568. parser.state = S.OPEN_TAG_SLASH
  25569. } else if (isMatch(nameStart, c)) {
  25570. strictFail(parser, 'No whitespace between attributes')
  25571. parser.attribName = c
  25572. parser.attribValue = ''
  25573. parser.state = S.ATTRIB_NAME
  25574. } else {
  25575. strictFail(parser, 'Invalid attribute name')
  25576. }
  25577. continue
  25578. case S.ATTRIB_VALUE_UNQUOTED:
  25579. if (!isAttribEnd(c)) {
  25580. if (c === '&') {
  25581. parser.state = S.ATTRIB_VALUE_ENTITY_U
  25582. } else {
  25583. parser.attribValue += c
  25584. }
  25585. continue
  25586. }
  25587. attrib(parser)
  25588. if (c === '>') {
  25589. openTag(parser)
  25590. } else {
  25591. parser.state = S.ATTRIB
  25592. }
  25593. continue
  25594. case S.CLOSE_TAG:
  25595. if (!parser.tagName) {
  25596. if (isWhitespace(c)) {
  25597. continue
  25598. } else if (notMatch(nameStart, c)) {
  25599. if (parser.script) {
  25600. parser.script += '</' + c
  25601. parser.state = S.SCRIPT
  25602. } else {
  25603. strictFail(parser, 'Invalid tagname in closing tag.')
  25604. }
  25605. } else {
  25606. parser.tagName = c
  25607. }
  25608. } else if (c === '>') {
  25609. closeTag(parser)
  25610. } else if (isMatch(nameBody, c)) {
  25611. parser.tagName += c
  25612. } else if (parser.script) {
  25613. parser.script += '</' + parser.tagName
  25614. parser.tagName = ''
  25615. parser.state = S.SCRIPT
  25616. } else {
  25617. if (!isWhitespace(c)) {
  25618. strictFail(parser, 'Invalid tagname in closing tag')
  25619. }
  25620. parser.state = S.CLOSE_TAG_SAW_WHITE
  25621. }
  25622. continue
  25623. case S.CLOSE_TAG_SAW_WHITE:
  25624. if (isWhitespace(c)) {
  25625. continue
  25626. }
  25627. if (c === '>') {
  25628. closeTag(parser)
  25629. } else {
  25630. strictFail(parser, 'Invalid characters in closing tag')
  25631. }
  25632. continue
  25633. case S.TEXT_ENTITY:
  25634. case S.ATTRIB_VALUE_ENTITY_Q:
  25635. case S.ATTRIB_VALUE_ENTITY_U:
  25636. var returnState
  25637. var buffer
  25638. switch (parser.state) {
  25639. case S.TEXT_ENTITY:
  25640. returnState = S.TEXT
  25641. buffer = 'textNode'
  25642. break
  25643. case S.ATTRIB_VALUE_ENTITY_Q:
  25644. returnState = S.ATTRIB_VALUE_QUOTED
  25645. buffer = 'attribValue'
  25646. break
  25647. case S.ATTRIB_VALUE_ENTITY_U:
  25648. returnState = S.ATTRIB_VALUE_UNQUOTED
  25649. buffer = 'attribValue'
  25650. break
  25651. }
  25652. if (c === ';') {
  25653. parser[buffer] += parseEntity(parser)
  25654. parser.entity = ''
  25655. parser.state = returnState
  25656. } else if (isMatch(parser.entity.length ? entityBody : entityStart, c)) {
  25657. parser.entity += c
  25658. } else {
  25659. strictFail(parser, 'Invalid character in entity name')
  25660. parser[buffer] += '&' + parser.entity + c
  25661. parser.entity = ''
  25662. parser.state = returnState
  25663. }
  25664. continue
  25665. default:
  25666. throw new Error(parser, 'Unknown state: ' + parser.state)
  25667. }
  25668. } // while
  25669. if (parser.position >= parser.bufferCheckPosition) {
  25670. checkBufferLength(parser)
  25671. }
  25672. return parser
  25673. }
  25674. /*! http://mths.be/fromcodepoint v0.1.0 by @mathias */
  25675. /* istanbul ignore next */
  25676. if (!String.fromCodePoint) {
  25677. (function () {
  25678. var stringFromCharCode = String.fromCharCode
  25679. var floor = Math.floor
  25680. var fromCodePoint = function () {
  25681. var MAX_SIZE = 0x4000
  25682. var codeUnits = []
  25683. var highSurrogate
  25684. var lowSurrogate
  25685. var index = -1
  25686. var length = arguments.length
  25687. if (!length) {
  25688. return ''
  25689. }
  25690. var result = ''
  25691. while (++index < length) {
  25692. var codePoint = Number(arguments[index])
  25693. if (
  25694. !isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
  25695. codePoint < 0 || // not a valid Unicode code point
  25696. codePoint > 0x10FFFF || // not a valid Unicode code point
  25697. floor(codePoint) !== codePoint // not an integer
  25698. ) {
  25699. throw RangeError('Invalid code point: ' + codePoint)
  25700. }
  25701. if (codePoint <= 0xFFFF) { // BMP code point
  25702. codeUnits.push(codePoint)
  25703. } else { // Astral code point; split in surrogate halves
  25704. // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  25705. codePoint -= 0x10000
  25706. highSurrogate = (codePoint >> 10) + 0xD800
  25707. lowSurrogate = (codePoint % 0x400) + 0xDC00
  25708. codeUnits.push(highSurrogate, lowSurrogate)
  25709. }
  25710. if (index + 1 === length || codeUnits.length > MAX_SIZE) {
  25711. result += stringFromCharCode.apply(null, codeUnits)
  25712. codeUnits.length = 0
  25713. }
  25714. }
  25715. return result
  25716. }
  25717. /* istanbul ignore next */
  25718. if (Object.defineProperty) {
  25719. Object.defineProperty(String, 'fromCodePoint', {
  25720. value: fromCodePoint,
  25721. configurable: true,
  25722. writable: true
  25723. })
  25724. } else {
  25725. String.fromCodePoint = fromCodePoint
  25726. }
  25727. }())
  25728. }
  25729. })(typeof exports === 'undefined' ? this.sax = {} : exports)
  25730. }).call(this)}).call(this,require("buffer").Buffer)
  25731. },{"buffer":90,"stream":398,"string_decoder":413}],398:[function(require,module,exports){
  25732. // Copyright Joyent, Inc. and other Node contributors.
  25733. //
  25734. // Permission is hereby granted, free of charge, to any person obtaining a
  25735. // copy of this software and associated documentation files (the
  25736. // "Software"), to deal in the Software without restriction, including
  25737. // without limitation the rights to use, copy, modify, merge, publish,
  25738. // distribute, sublicense, and/or sell copies of the Software, and to permit
  25739. // persons to whom the Software is furnished to do so, subject to the
  25740. // following conditions:
  25741. //
  25742. // The above copyright notice and this permission notice shall be included
  25743. // in all copies or substantial portions of the Software.
  25744. //
  25745. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  25746. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25747. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  25748. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  25749. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  25750. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  25751. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  25752. module.exports = Stream;
  25753. var EE = require('events').EventEmitter;
  25754. var inherits = require('inherits');
  25755. inherits(Stream, EE);
  25756. Stream.Readable = require('readable-stream/lib/_stream_readable.js');
  25757. Stream.Writable = require('readable-stream/lib/_stream_writable.js');
  25758. Stream.Duplex = require('readable-stream/lib/_stream_duplex.js');
  25759. Stream.Transform = require('readable-stream/lib/_stream_transform.js');
  25760. Stream.PassThrough = require('readable-stream/lib/_stream_passthrough.js');
  25761. Stream.finished = require('readable-stream/lib/internal/streams/end-of-stream.js')
  25762. Stream.pipeline = require('readable-stream/lib/internal/streams/pipeline.js')
  25763. // Backwards-compat with node 0.4.x
  25764. Stream.Stream = Stream;
  25765. // old-style streams. Note that the pipe method (the only relevant
  25766. // part of this class) is overridden in the Readable class.
  25767. function Stream() {
  25768. EE.call(this);
  25769. }
  25770. Stream.prototype.pipe = function(dest, options) {
  25771. var source = this;
  25772. function ondata(chunk) {
  25773. if (dest.writable) {
  25774. if (false === dest.write(chunk) && source.pause) {
  25775. source.pause();
  25776. }
  25777. }
  25778. }
  25779. source.on('data', ondata);
  25780. function ondrain() {
  25781. if (source.readable && source.resume) {
  25782. source.resume();
  25783. }
  25784. }
  25785. dest.on('drain', ondrain);
  25786. // If the 'end' option is not supplied, dest.end() will be called when
  25787. // source gets the 'end' or 'close' events. Only dest.end() once.
  25788. if (!dest._isStdio && (!options || options.end !== false)) {
  25789. source.on('end', onend);
  25790. source.on('close', onclose);
  25791. }
  25792. var didOnEnd = false;
  25793. function onend() {
  25794. if (didOnEnd) return;
  25795. didOnEnd = true;
  25796. dest.end();
  25797. }
  25798. function onclose() {
  25799. if (didOnEnd) return;
  25800. didOnEnd = true;
  25801. if (typeof dest.destroy === 'function') dest.destroy();
  25802. }
  25803. // don't leave dangling pipes when there are errors.
  25804. function onerror(er) {
  25805. cleanup();
  25806. if (EE.listenerCount(this, 'error') === 0) {
  25807. throw er; // Unhandled stream error in pipe.
  25808. }
  25809. }
  25810. source.on('error', onerror);
  25811. dest.on('error', onerror);
  25812. // remove all the event listeners that were added.
  25813. function cleanup() {
  25814. source.removeListener('data', ondata);
  25815. dest.removeListener('drain', ondrain);
  25816. source.removeListener('end', onend);
  25817. source.removeListener('close', onclose);
  25818. source.removeListener('error', onerror);
  25819. dest.removeListener('error', onerror);
  25820. source.removeListener('end', cleanup);
  25821. source.removeListener('close', cleanup);
  25822. dest.removeListener('close', cleanup);
  25823. }
  25824. source.on('end', cleanup);
  25825. source.on('close', cleanup);
  25826. dest.on('close', cleanup);
  25827. dest.emit('pipe', source);
  25828. // Allow for unix-like usage: A.pipe(B).pipe(C)
  25829. return dest;
  25830. };
  25831. },{"events":344,"inherits":364,"readable-stream/lib/_stream_duplex.js":400,"readable-stream/lib/_stream_passthrough.js":401,"readable-stream/lib/_stream_readable.js":402,"readable-stream/lib/_stream_transform.js":403,"readable-stream/lib/_stream_writable.js":404,"readable-stream/lib/internal/streams/end-of-stream.js":408,"readable-stream/lib/internal/streams/pipeline.js":410}],399:[function(require,module,exports){
  25832. 'use strict';
  25833. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
  25834. var codes = {};
  25835. function createErrorType(code, message, Base) {
  25836. if (!Base) {
  25837. Base = Error;
  25838. }
  25839. function getMessage(arg1, arg2, arg3) {
  25840. if (typeof message === 'string') {
  25841. return message;
  25842. } else {
  25843. return message(arg1, arg2, arg3);
  25844. }
  25845. }
  25846. var NodeError =
  25847. /*#__PURE__*/
  25848. function (_Base) {
  25849. _inheritsLoose(NodeError, _Base);
  25850. function NodeError(arg1, arg2, arg3) {
  25851. return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;
  25852. }
  25853. return NodeError;
  25854. }(Base);
  25855. NodeError.prototype.name = Base.name;
  25856. NodeError.prototype.code = code;
  25857. codes[code] = NodeError;
  25858. } // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
  25859. function oneOf(expected, thing) {
  25860. if (Array.isArray(expected)) {
  25861. var len = expected.length;
  25862. expected = expected.map(function (i) {
  25863. return String(i);
  25864. });
  25865. if (len > 2) {
  25866. return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1];
  25867. } else if (len === 2) {
  25868. return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]);
  25869. } else {
  25870. return "of ".concat(thing, " ").concat(expected[0]);
  25871. }
  25872. } else {
  25873. return "of ".concat(thing, " ").concat(String(expected));
  25874. }
  25875. } // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
  25876. function startsWith(str, search, pos) {
  25877. return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
  25878. } // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
  25879. function endsWith(str, search, this_len) {
  25880. if (this_len === undefined || this_len > str.length) {
  25881. this_len = str.length;
  25882. }
  25883. return str.substring(this_len - search.length, this_len) === search;
  25884. } // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
  25885. function includes(str, search, start) {
  25886. if (typeof start !== 'number') {
  25887. start = 0;
  25888. }
  25889. if (start + search.length > str.length) {
  25890. return false;
  25891. } else {
  25892. return str.indexOf(search, start) !== -1;
  25893. }
  25894. }
  25895. createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {
  25896. return 'The value "' + value + '" is invalid for option "' + name + '"';
  25897. }, TypeError);
  25898. createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
  25899. // determiner: 'must be' or 'must not be'
  25900. var determiner;
  25901. if (typeof expected === 'string' && startsWith(expected, 'not ')) {
  25902. determiner = 'must not be';
  25903. expected = expected.replace(/^not /, '');
  25904. } else {
  25905. determiner = 'must be';
  25906. }
  25907. var msg;
  25908. if (endsWith(name, ' argument')) {
  25909. // For cases like 'first argument'
  25910. msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
  25911. } else {
  25912. var type = includes(name, '.') ? 'property' : 'argument';
  25913. msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
  25914. }
  25915. msg += ". Received type ".concat(typeof actual);
  25916. return msg;
  25917. }, TypeError);
  25918. createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');
  25919. createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {
  25920. return 'The ' + name + ' method is not implemented';
  25921. });
  25922. createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');
  25923. createErrorType('ERR_STREAM_DESTROYED', function (name) {
  25924. return 'Cannot call ' + name + ' after a stream was destroyed';
  25925. });
  25926. createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');
  25927. createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');
  25928. createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');
  25929. createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);
  25930. createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
  25931. return 'Unknown encoding: ' + arg;
  25932. }, TypeError);
  25933. createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
  25934. module.exports.codes = codes;
  25935. },{}],400:[function(require,module,exports){
  25936. (function (process){(function (){
  25937. // Copyright Joyent, Inc. and other Node contributors.
  25938. //
  25939. // Permission is hereby granted, free of charge, to any person obtaining a
  25940. // copy of this software and associated documentation files (the
  25941. // "Software"), to deal in the Software without restriction, including
  25942. // without limitation the rights to use, copy, modify, merge, publish,
  25943. // distribute, sublicense, and/or sell copies of the Software, and to permit
  25944. // persons to whom the Software is furnished to do so, subject to the
  25945. // following conditions:
  25946. //
  25947. // The above copyright notice and this permission notice shall be included
  25948. // in all copies or substantial portions of the Software.
  25949. //
  25950. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  25951. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25952. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  25953. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  25954. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  25955. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  25956. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  25957. // a duplex stream is just a stream that is both readable and writable.
  25958. // Since JS doesn't have multiple prototypal inheritance, this class
  25959. // prototypally inherits from Readable, and then parasitically from
  25960. // Writable.
  25961. 'use strict';
  25962. /*<replacement>*/
  25963. var objectKeys = Object.keys || function (obj) {
  25964. var keys = [];
  25965. for (var key in obj) keys.push(key);
  25966. return keys;
  25967. };
  25968. /*</replacement>*/
  25969. module.exports = Duplex;
  25970. var Readable = require('./_stream_readable');
  25971. var Writable = require('./_stream_writable');
  25972. require('inherits')(Duplex, Readable);
  25973. {
  25974. // Allow the keys array to be GC'ed.
  25975. var keys = objectKeys(Writable.prototype);
  25976. for (var v = 0; v < keys.length; v++) {
  25977. var method = keys[v];
  25978. if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
  25979. }
  25980. }
  25981. function Duplex(options) {
  25982. if (!(this instanceof Duplex)) return new Duplex(options);
  25983. Readable.call(this, options);
  25984. Writable.call(this, options);
  25985. this.allowHalfOpen = true;
  25986. if (options) {
  25987. if (options.readable === false) this.readable = false;
  25988. if (options.writable === false) this.writable = false;
  25989. if (options.allowHalfOpen === false) {
  25990. this.allowHalfOpen = false;
  25991. this.once('end', onend);
  25992. }
  25993. }
  25994. }
  25995. Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
  25996. // making it explicit this property is not enumerable
  25997. // because otherwise some prototype manipulation in
  25998. // userland will fail
  25999. enumerable: false,
  26000. get: function get() {
  26001. return this._writableState.highWaterMark;
  26002. }
  26003. });
  26004. Object.defineProperty(Duplex.prototype, 'writableBuffer', {
  26005. // making it explicit this property is not enumerable
  26006. // because otherwise some prototype manipulation in
  26007. // userland will fail
  26008. enumerable: false,
  26009. get: function get() {
  26010. return this._writableState && this._writableState.getBuffer();
  26011. }
  26012. });
  26013. Object.defineProperty(Duplex.prototype, 'writableLength', {
  26014. // making it explicit this property is not enumerable
  26015. // because otherwise some prototype manipulation in
  26016. // userland will fail
  26017. enumerable: false,
  26018. get: function get() {
  26019. return this._writableState.length;
  26020. }
  26021. });
  26022. // the no-half-open enforcer
  26023. function onend() {
  26024. // If the writable side ended, then we're ok.
  26025. if (this._writableState.ended) return;
  26026. // no more data can be written.
  26027. // But allow more writes to happen in this tick.
  26028. process.nextTick(onEndNT, this);
  26029. }
  26030. function onEndNT(self) {
  26031. self.end();
  26032. }
  26033. Object.defineProperty(Duplex.prototype, 'destroyed', {
  26034. // making it explicit this property is not enumerable
  26035. // because otherwise some prototype manipulation in
  26036. // userland will fail
  26037. enumerable: false,
  26038. get: function get() {
  26039. if (this._readableState === undefined || this._writableState === undefined) {
  26040. return false;
  26041. }
  26042. return this._readableState.destroyed && this._writableState.destroyed;
  26043. },
  26044. set: function set(value) {
  26045. // we ignore the value if the stream
  26046. // has not been initialized yet
  26047. if (this._readableState === undefined || this._writableState === undefined) {
  26048. return;
  26049. }
  26050. // backward compatibility, the user is explicitly
  26051. // managing destroyed
  26052. this._readableState.destroyed = value;
  26053. this._writableState.destroyed = value;
  26054. }
  26055. });
  26056. }).call(this)}).call(this,require('_process'))
  26057. },{"./_stream_readable":402,"./_stream_writable":404,"_process":467,"inherits":364}],401:[function(require,module,exports){
  26058. // Copyright Joyent, Inc. and other Node contributors.
  26059. //
  26060. // Permission is hereby granted, free of charge, to any person obtaining a
  26061. // copy of this software and associated documentation files (the
  26062. // "Software"), to deal in the Software without restriction, including
  26063. // without limitation the rights to use, copy, modify, merge, publish,
  26064. // distribute, sublicense, and/or sell copies of the Software, and to permit
  26065. // persons to whom the Software is furnished to do so, subject to the
  26066. // following conditions:
  26067. //
  26068. // The above copyright notice and this permission notice shall be included
  26069. // in all copies or substantial portions of the Software.
  26070. //
  26071. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  26072. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  26073. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  26074. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  26075. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  26076. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  26077. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  26078. // a passthrough stream.
  26079. // basically just the most minimal sort of Transform stream.
  26080. // Every written chunk gets output as-is.
  26081. 'use strict';
  26082. module.exports = PassThrough;
  26083. var Transform = require('./_stream_transform');
  26084. require('inherits')(PassThrough, Transform);
  26085. function PassThrough(options) {
  26086. if (!(this instanceof PassThrough)) return new PassThrough(options);
  26087. Transform.call(this, options);
  26088. }
  26089. PassThrough.prototype._transform = function (chunk, encoding, cb) {
  26090. cb(null, chunk);
  26091. };
  26092. },{"./_stream_transform":403,"inherits":364}],402:[function(require,module,exports){
  26093. (function (process,global){(function (){
  26094. // Copyright Joyent, Inc. and other Node contributors.
  26095. //
  26096. // Permission is hereby granted, free of charge, to any person obtaining a
  26097. // copy of this software and associated documentation files (the
  26098. // "Software"), to deal in the Software without restriction, including
  26099. // without limitation the rights to use, copy, modify, merge, publish,
  26100. // distribute, sublicense, and/or sell copies of the Software, and to permit
  26101. // persons to whom the Software is furnished to do so, subject to the
  26102. // following conditions:
  26103. //
  26104. // The above copyright notice and this permission notice shall be included
  26105. // in all copies or substantial portions of the Software.
  26106. //
  26107. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  26108. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  26109. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  26110. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  26111. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  26112. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  26113. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  26114. 'use strict';
  26115. module.exports = Readable;
  26116. /*<replacement>*/
  26117. var Duplex;
  26118. /*</replacement>*/
  26119. Readable.ReadableState = ReadableState;
  26120. /*<replacement>*/
  26121. var EE = require('events').EventEmitter;
  26122. var EElistenerCount = function EElistenerCount(emitter, type) {
  26123. return emitter.listeners(type).length;
  26124. };
  26125. /*</replacement>*/
  26126. /*<replacement>*/
  26127. var Stream = require('./internal/streams/stream');
  26128. /*</replacement>*/
  26129. var Buffer = require('buffer').Buffer;
  26130. var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};
  26131. function _uint8ArrayToBuffer(chunk) {
  26132. return Buffer.from(chunk);
  26133. }
  26134. function _isUint8Array(obj) {
  26135. return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
  26136. }
  26137. /*<replacement>*/
  26138. var debugUtil = require('util');
  26139. var debug;
  26140. if (debugUtil && debugUtil.debuglog) {
  26141. debug = debugUtil.debuglog('stream');
  26142. } else {
  26143. debug = function debug() {};
  26144. }
  26145. /*</replacement>*/
  26146. var BufferList = require('./internal/streams/buffer_list');
  26147. var destroyImpl = require('./internal/streams/destroy');
  26148. var _require = require('./internal/streams/state'),
  26149. getHighWaterMark = _require.getHighWaterMark;
  26150. var _require$codes = require('../errors').codes,
  26151. ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
  26152. ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,
  26153. ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
  26154. ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
  26155. // Lazy loaded to improve the startup performance.
  26156. var StringDecoder;
  26157. var createReadableStreamAsyncIterator;
  26158. var from;
  26159. require('inherits')(Readable, Stream);
  26160. var errorOrDestroy = destroyImpl.errorOrDestroy;
  26161. var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
  26162. function prependListener(emitter, event, fn) {
  26163. // Sadly this is not cacheable as some libraries bundle their own
  26164. // event emitter implementation with them.
  26165. if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
  26166. // This is a hack to make sure that our error handler is attached before any
  26167. // userland ones. NEVER DO THIS. This is here only because this code needs
  26168. // to continue to work with older versions of Node.js that do not include
  26169. // the prependListener() method. The goal is to eventually remove this hack.
  26170. if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
  26171. }
  26172. function ReadableState(options, stream, isDuplex) {
  26173. Duplex = Duplex || require('./_stream_duplex');
  26174. options = options || {};
  26175. // Duplex streams are both readable and writable, but share
  26176. // the same options object.
  26177. // However, some cases require setting options to different
  26178. // values for the readable and the writable sides of the duplex stream.
  26179. // These options can be provided separately as readableXXX and writableXXX.
  26180. if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;
  26181. // object stream flag. Used to make read(n) ignore n and to
  26182. // make all the buffer merging and length checks go away
  26183. this.objectMode = !!options.objectMode;
  26184. if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
  26185. // the point at which it stops calling _read() to fill the buffer
  26186. // Note: 0 is a valid value, means "don't call _read preemptively ever"
  26187. this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex);
  26188. // A linked list is used to store data chunks instead of an array because the
  26189. // linked list can remove elements from the beginning faster than
  26190. // array.shift()
  26191. this.buffer = new BufferList();
  26192. this.length = 0;
  26193. this.pipes = null;
  26194. this.pipesCount = 0;
  26195. this.flowing = null;
  26196. this.ended = false;
  26197. this.endEmitted = false;
  26198. this.reading = false;
  26199. // a flag to be able to tell if the event 'readable'/'data' is emitted
  26200. // immediately, or on a later tick. We set this to true at first, because
  26201. // any actions that shouldn't happen until "later" should generally also
  26202. // not happen before the first read call.
  26203. this.sync = true;
  26204. // whenever we return null, then we set a flag to say
  26205. // that we're awaiting a 'readable' event emission.
  26206. this.needReadable = false;
  26207. this.emittedReadable = false;
  26208. this.readableListening = false;
  26209. this.resumeScheduled = false;
  26210. this.paused = true;
  26211. // Should close be emitted on destroy. Defaults to true.
  26212. this.emitClose = options.emitClose !== false;
  26213. // Should .destroy() be called after 'end' (and potentially 'finish')
  26214. this.autoDestroy = !!options.autoDestroy;
  26215. // has it been destroyed
  26216. this.destroyed = false;
  26217. // Crypto is kind of old and crusty. Historically, its default string
  26218. // encoding is 'binary' so we have to make this configurable.
  26219. // Everything else in the universe uses 'utf8', though.
  26220. this.defaultEncoding = options.defaultEncoding || 'utf8';
  26221. // the number of writers that are awaiting a drain event in .pipe()s
  26222. this.awaitDrain = 0;
  26223. // if true, a maybeReadMore has been scheduled
  26224. this.readingMore = false;
  26225. this.decoder = null;
  26226. this.encoding = null;
  26227. if (options.encoding) {
  26228. if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
  26229. this.decoder = new StringDecoder(options.encoding);
  26230. this.encoding = options.encoding;
  26231. }
  26232. }
  26233. function Readable(options) {
  26234. Duplex = Duplex || require('./_stream_duplex');
  26235. if (!(this instanceof Readable)) return new Readable(options);
  26236. // Checking for a Stream.Duplex instance is faster here instead of inside
  26237. // the ReadableState constructor, at least with V8 6.5
  26238. var isDuplex = this instanceof Duplex;
  26239. this._readableState = new ReadableState(options, this, isDuplex);
  26240. // legacy
  26241. this.readable = true;
  26242. if (options) {
  26243. if (typeof options.read === 'function') this._read = options.read;
  26244. if (typeof options.destroy === 'function') this._destroy = options.destroy;
  26245. }
  26246. Stream.call(this);
  26247. }
  26248. Object.defineProperty(Readable.prototype, 'destroyed', {
  26249. // making it explicit this property is not enumerable
  26250. // because otherwise some prototype manipulation in
  26251. // userland will fail
  26252. enumerable: false,
  26253. get: function get() {
  26254. if (this._readableState === undefined) {
  26255. return false;
  26256. }
  26257. return this._readableState.destroyed;
  26258. },
  26259. set: function set(value) {
  26260. // we ignore the value if the stream
  26261. // has not been initialized yet
  26262. if (!this._readableState) {
  26263. return;
  26264. }
  26265. // backward compatibility, the user is explicitly
  26266. // managing destroyed
  26267. this._readableState.destroyed = value;
  26268. }
  26269. });
  26270. Readable.prototype.destroy = destroyImpl.destroy;
  26271. Readable.prototype._undestroy = destroyImpl.undestroy;
  26272. Readable.prototype._destroy = function (err, cb) {
  26273. cb(err);
  26274. };
  26275. // Manually shove something into the read() buffer.
  26276. // This returns true if the highWaterMark has not been hit yet,
  26277. // similar to how Writable.write() returns true if you should
  26278. // write() some more.
  26279. Readable.prototype.push = function (chunk, encoding) {
  26280. var state = this._readableState;
  26281. var skipChunkCheck;
  26282. if (!state.objectMode) {
  26283. if (typeof chunk === 'string') {
  26284. encoding = encoding || state.defaultEncoding;
  26285. if (encoding !== state.encoding) {
  26286. chunk = Buffer.from(chunk, encoding);
  26287. encoding = '';
  26288. }
  26289. skipChunkCheck = true;
  26290. }
  26291. } else {
  26292. skipChunkCheck = true;
  26293. }
  26294. return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
  26295. };
  26296. // Unshift should *always* be something directly out of read()
  26297. Readable.prototype.unshift = function (chunk) {
  26298. return readableAddChunk(this, chunk, null, true, false);
  26299. };
  26300. function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
  26301. debug('readableAddChunk', chunk);
  26302. var state = stream._readableState;
  26303. if (chunk === null) {
  26304. state.reading = false;
  26305. onEofChunk(stream, state);
  26306. } else {
  26307. var er;
  26308. if (!skipChunkCheck) er = chunkInvalid(state, chunk);
  26309. if (er) {
  26310. errorOrDestroy(stream, er);
  26311. } else if (state.objectMode || chunk && chunk.length > 0) {
  26312. if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
  26313. chunk = _uint8ArrayToBuffer(chunk);
  26314. }
  26315. if (addToFront) {
  26316. if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true);
  26317. } else if (state.ended) {
  26318. errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());
  26319. } else if (state.destroyed) {
  26320. return false;
  26321. } else {
  26322. state.reading = false;
  26323. if (state.decoder && !encoding) {
  26324. chunk = state.decoder.write(chunk);
  26325. if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
  26326. } else {
  26327. addChunk(stream, state, chunk, false);
  26328. }
  26329. }
  26330. } else if (!addToFront) {
  26331. state.reading = false;
  26332. maybeReadMore(stream, state);
  26333. }
  26334. }
  26335. // We can push more data if we are below the highWaterMark.
  26336. // Also, if we have no data yet, we can stand some more bytes.
  26337. // This is to work around cases where hwm=0, such as the repl.
  26338. return !state.ended && (state.length < state.highWaterMark || state.length === 0);
  26339. }
  26340. function addChunk(stream, state, chunk, addToFront) {
  26341. if (state.flowing && state.length === 0 && !state.sync) {
  26342. state.awaitDrain = 0;
  26343. stream.emit('data', chunk);
  26344. } else {
  26345. // update the buffer info.
  26346. state.length += state.objectMode ? 1 : chunk.length;
  26347. if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
  26348. if (state.needReadable) emitReadable(stream);
  26349. }
  26350. maybeReadMore(stream, state);
  26351. }
  26352. function chunkInvalid(state, chunk) {
  26353. var er;
  26354. if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
  26355. er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk);
  26356. }
  26357. return er;
  26358. }
  26359. Readable.prototype.isPaused = function () {
  26360. return this._readableState.flowing === false;
  26361. };
  26362. // backwards compatibility.
  26363. Readable.prototype.setEncoding = function (enc) {
  26364. if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
  26365. var decoder = new StringDecoder(enc);
  26366. this._readableState.decoder = decoder;
  26367. // If setEncoding(null), decoder.encoding equals utf8
  26368. this._readableState.encoding = this._readableState.decoder.encoding;
  26369. // Iterate over current buffer to convert already stored Buffers:
  26370. var p = this._readableState.buffer.head;
  26371. var content = '';
  26372. while (p !== null) {
  26373. content += decoder.write(p.data);
  26374. p = p.next;
  26375. }
  26376. this._readableState.buffer.clear();
  26377. if (content !== '') this._readableState.buffer.push(content);
  26378. this._readableState.length = content.length;
  26379. return this;
  26380. };
  26381. // Don't raise the hwm > 1GB
  26382. var MAX_HWM = 0x40000000;
  26383. function computeNewHighWaterMark(n) {
  26384. if (n >= MAX_HWM) {
  26385. // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE.
  26386. n = MAX_HWM;
  26387. } else {
  26388. // Get the next highest power of 2 to prevent increasing hwm excessively in
  26389. // tiny amounts
  26390. n--;
  26391. n |= n >>> 1;
  26392. n |= n >>> 2;
  26393. n |= n >>> 4;
  26394. n |= n >>> 8;
  26395. n |= n >>> 16;
  26396. n++;
  26397. }
  26398. return n;
  26399. }
  26400. // This function is designed to be inlinable, so please take care when making
  26401. // changes to the function body.
  26402. function howMuchToRead(n, state) {
  26403. if (n <= 0 || state.length === 0 && state.ended) return 0;
  26404. if (state.objectMode) return 1;
  26405. if (n !== n) {
  26406. // Only flow one buffer at a time
  26407. if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
  26408. }
  26409. // If we're asking for more than the current hwm, then raise the hwm.
  26410. if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
  26411. if (n <= state.length) return n;
  26412. // Don't have enough
  26413. if (!state.ended) {
  26414. state.needReadable = true;
  26415. return 0;
  26416. }
  26417. return state.length;
  26418. }
  26419. // you can override either this method, or the async _read(n) below.
  26420. Readable.prototype.read = function (n) {
  26421. debug('read', n);
  26422. n = parseInt(n, 10);
  26423. var state = this._readableState;
  26424. var nOrig = n;
  26425. if (n !== 0) state.emittedReadable = false;
  26426. // if we're doing read(0) to trigger a readable event, but we
  26427. // already have a bunch of data in the buffer, then just trigger
  26428. // the 'readable' event and move on.
  26429. if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {
  26430. debug('read: emitReadable', state.length, state.ended);
  26431. if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
  26432. return null;
  26433. }
  26434. n = howMuchToRead(n, state);
  26435. // if we've ended, and we're now clear, then finish it up.
  26436. if (n === 0 && state.ended) {
  26437. if (state.length === 0) endReadable(this);
  26438. return null;
  26439. }
  26440. // All the actual chunk generation logic needs to be
  26441. // *below* the call to _read. The reason is that in certain
  26442. // synthetic stream cases, such as passthrough streams, _read
  26443. // may be a completely synchronous operation which may change
  26444. // the state of the read buffer, providing enough data when
  26445. // before there was *not* enough.
  26446. //
  26447. // So, the steps are:
  26448. // 1. Figure out what the state of things will be after we do
  26449. // a read from the buffer.
  26450. //
  26451. // 2. If that resulting state will trigger a _read, then call _read.
  26452. // Note that this may be asynchronous, or synchronous. Yes, it is
  26453. // deeply ugly to write APIs this way, but that still doesn't mean
  26454. // that the Readable class should behave improperly, as streams are
  26455. // designed to be sync/async agnostic.
  26456. // Take note if the _read call is sync or async (ie, if the read call
  26457. // has returned yet), so that we know whether or not it's safe to emit
  26458. // 'readable' etc.
  26459. //
  26460. // 3. Actually pull the requested chunks out of the buffer and return.
  26461. // if we need a readable event, then we need to do some reading.
  26462. var doRead = state.needReadable;
  26463. debug('need readable', doRead);
  26464. // if we currently have less than the highWaterMark, then also read some
  26465. if (state.length === 0 || state.length - n < state.highWaterMark) {
  26466. doRead = true;
  26467. debug('length less than watermark', doRead);
  26468. }
  26469. // however, if we've ended, then there's no point, and if we're already
  26470. // reading, then it's unnecessary.
  26471. if (state.ended || state.reading) {
  26472. doRead = false;
  26473. debug('reading or ended', doRead);
  26474. } else if (doRead) {
  26475. debug('do read');
  26476. state.reading = true;
  26477. state.sync = true;
  26478. // if the length is currently zero, then we *need* a readable event.
  26479. if (state.length === 0) state.needReadable = true;
  26480. // call internal read method
  26481. this._read(state.highWaterMark);
  26482. state.sync = false;
  26483. // If _read pushed data synchronously, then `reading` will be false,
  26484. // and we need to re-evaluate how much data we can return to the user.
  26485. if (!state.reading) n = howMuchToRead(nOrig, state);
  26486. }
  26487. var ret;
  26488. if (n > 0) ret = fromList(n, state);else ret = null;
  26489. if (ret === null) {
  26490. state.needReadable = state.length <= state.highWaterMark;
  26491. n = 0;
  26492. } else {
  26493. state.length -= n;
  26494. state.awaitDrain = 0;
  26495. }
  26496. if (state.length === 0) {
  26497. // If we have nothing in the buffer, then we want to know
  26498. // as soon as we *do* get something into the buffer.
  26499. if (!state.ended) state.needReadable = true;
  26500. // If we tried to read() past the EOF, then emit end on the next tick.
  26501. if (nOrig !== n && state.ended) endReadable(this);
  26502. }
  26503. if (ret !== null) this.emit('data', ret);
  26504. return ret;
  26505. };
  26506. function onEofChunk(stream, state) {
  26507. debug('onEofChunk');
  26508. if (state.ended) return;
  26509. if (state.decoder) {
  26510. var chunk = state.decoder.end();
  26511. if (chunk && chunk.length) {
  26512. state.buffer.push(chunk);
  26513. state.length += state.objectMode ? 1 : chunk.length;
  26514. }
  26515. }
  26516. state.ended = true;
  26517. if (state.sync) {
  26518. // if we are sync, wait until next tick to emit the data.
  26519. // Otherwise we risk emitting data in the flow()
  26520. // the readable code triggers during a read() call
  26521. emitReadable(stream);
  26522. } else {
  26523. // emit 'readable' now to make sure it gets picked up.
  26524. state.needReadable = false;
  26525. if (!state.emittedReadable) {
  26526. state.emittedReadable = true;
  26527. emitReadable_(stream);
  26528. }
  26529. }
  26530. }
  26531. // Don't emit readable right away in sync mode, because this can trigger
  26532. // another read() call => stack overflow. This way, it might trigger
  26533. // a nextTick recursion warning, but that's not so bad.
  26534. function emitReadable(stream) {
  26535. var state = stream._readableState;
  26536. debug('emitReadable', state.needReadable, state.emittedReadable);
  26537. state.needReadable = false;
  26538. if (!state.emittedReadable) {
  26539. debug('emitReadable', state.flowing);
  26540. state.emittedReadable = true;
  26541. process.nextTick(emitReadable_, stream);
  26542. }
  26543. }
  26544. function emitReadable_(stream) {
  26545. var state = stream._readableState;
  26546. debug('emitReadable_', state.destroyed, state.length, state.ended);
  26547. if (!state.destroyed && (state.length || state.ended)) {
  26548. stream.emit('readable');
  26549. state.emittedReadable = false;
  26550. }
  26551. // The stream needs another readable event if
  26552. // 1. It is not flowing, as the flow mechanism will take
  26553. // care of it.
  26554. // 2. It is not ended.
  26555. // 3. It is below the highWaterMark, so we can schedule
  26556. // another readable later.
  26557. state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;
  26558. flow(stream);
  26559. }
  26560. // at this point, the user has presumably seen the 'readable' event,
  26561. // and called read() to consume some data. that may have triggered
  26562. // in turn another _read(n) call, in which case reading = true if
  26563. // it's in progress.
  26564. // However, if we're not ended, or reading, and the length < hwm,
  26565. // then go ahead and try to read some more preemptively.
  26566. function maybeReadMore(stream, state) {
  26567. if (!state.readingMore) {
  26568. state.readingMore = true;
  26569. process.nextTick(maybeReadMore_, stream, state);
  26570. }
  26571. }
  26572. function maybeReadMore_(stream, state) {
  26573. // Attempt to read more data if we should.
  26574. //
  26575. // The conditions for reading more data are (one of):
  26576. // - Not enough data buffered (state.length < state.highWaterMark). The loop
  26577. // is responsible for filling the buffer with enough data if such data
  26578. // is available. If highWaterMark is 0 and we are not in the flowing mode
  26579. // we should _not_ attempt to buffer any extra data. We'll get more data
  26580. // when the stream consumer calls read() instead.
  26581. // - No data in the buffer, and the stream is in flowing mode. In this mode
  26582. // the loop below is responsible for ensuring read() is called. Failing to
  26583. // call read here would abort the flow and there's no other mechanism for
  26584. // continuing the flow if the stream consumer has just subscribed to the
  26585. // 'data' event.
  26586. //
  26587. // In addition to the above conditions to keep reading data, the following
  26588. // conditions prevent the data from being read:
  26589. // - The stream has ended (state.ended).
  26590. // - There is already a pending 'read' operation (state.reading). This is a
  26591. // case where the the stream has called the implementation defined _read()
  26592. // method, but they are processing the call asynchronously and have _not_
  26593. // called push() with new data. In this case we skip performing more
  26594. // read()s. The execution ends in this method again after the _read() ends
  26595. // up calling push() with more data.
  26596. while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {
  26597. var len = state.length;
  26598. debug('maybeReadMore read 0');
  26599. stream.read(0);
  26600. if (len === state.length)
  26601. // didn't get any data, stop spinning.
  26602. break;
  26603. }
  26604. state.readingMore = false;
  26605. }
  26606. // abstract method. to be overridden in specific implementation classes.
  26607. // call cb(er, data) where data is <= n in length.
  26608. // for virtual (non-string, non-buffer) streams, "length" is somewhat
  26609. // arbitrary, and perhaps not very meaningful.
  26610. Readable.prototype._read = function (n) {
  26611. errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()'));
  26612. };
  26613. Readable.prototype.pipe = function (dest, pipeOpts) {
  26614. var src = this;
  26615. var state = this._readableState;
  26616. switch (state.pipesCount) {
  26617. case 0:
  26618. state.pipes = dest;
  26619. break;
  26620. case 1:
  26621. state.pipes = [state.pipes, dest];
  26622. break;
  26623. default:
  26624. state.pipes.push(dest);
  26625. break;
  26626. }
  26627. state.pipesCount += 1;
  26628. debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
  26629. var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
  26630. var endFn = doEnd ? onend : unpipe;
  26631. if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn);
  26632. dest.on('unpipe', onunpipe);
  26633. function onunpipe(readable, unpipeInfo) {
  26634. debug('onunpipe');
  26635. if (readable === src) {
  26636. if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
  26637. unpipeInfo.hasUnpiped = true;
  26638. cleanup();
  26639. }
  26640. }
  26641. }
  26642. function onend() {
  26643. debug('onend');
  26644. dest.end();
  26645. }
  26646. // when the dest drains, it reduces the awaitDrain counter
  26647. // on the source. This would be more elegant with a .once()
  26648. // handler in flow(), but adding and removing repeatedly is
  26649. // too slow.
  26650. var ondrain = pipeOnDrain(src);
  26651. dest.on('drain', ondrain);
  26652. var cleanedUp = false;
  26653. function cleanup() {
  26654. debug('cleanup');
  26655. // cleanup event handlers once the pipe is broken
  26656. dest.removeListener('close', onclose);
  26657. dest.removeListener('finish', onfinish);
  26658. dest.removeListener('drain', ondrain);
  26659. dest.removeListener('error', onerror);
  26660. dest.removeListener('unpipe', onunpipe);
  26661. src.removeListener('end', onend);
  26662. src.removeListener('end', unpipe);
  26663. src.removeListener('data', ondata);
  26664. cleanedUp = true;
  26665. // if the reader is waiting for a drain event from this
  26666. // specific writer, then it would cause it to never start
  26667. // flowing again.
  26668. // So, if this is awaiting a drain, then we just call it now.
  26669. // If we don't know, then assume that we are waiting for one.
  26670. if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
  26671. }
  26672. src.on('data', ondata);
  26673. function ondata(chunk) {
  26674. debug('ondata');
  26675. var ret = dest.write(chunk);
  26676. debug('dest.write', ret);
  26677. if (ret === false) {
  26678. // If the user unpiped during `dest.write()`, it is possible
  26679. // to get stuck in a permanently paused state if that write
  26680. // also returned false.
  26681. // => Check whether `dest` is still a piping destination.
  26682. if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
  26683. debug('false write response, pause', state.awaitDrain);
  26684. state.awaitDrain++;
  26685. }
  26686. src.pause();
  26687. }
  26688. }
  26689. // if the dest has an error, then stop piping into it.
  26690. // however, don't suppress the throwing behavior for this.
  26691. function onerror(er) {
  26692. debug('onerror', er);
  26693. unpipe();
  26694. dest.removeListener('error', onerror);
  26695. if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er);
  26696. }
  26697. // Make sure our error handler is attached before userland ones.
  26698. prependListener(dest, 'error', onerror);
  26699. // Both close and finish should trigger unpipe, but only once.
  26700. function onclose() {
  26701. dest.removeListener('finish', onfinish);
  26702. unpipe();
  26703. }
  26704. dest.once('close', onclose);
  26705. function onfinish() {
  26706. debug('onfinish');
  26707. dest.removeListener('close', onclose);
  26708. unpipe();
  26709. }
  26710. dest.once('finish', onfinish);
  26711. function unpipe() {
  26712. debug('unpipe');
  26713. src.unpipe(dest);
  26714. }
  26715. // tell the dest that it's being piped to
  26716. dest.emit('pipe', src);
  26717. // start the flow if it hasn't been started already.
  26718. if (!state.flowing) {
  26719. debug('pipe resume');
  26720. src.resume();
  26721. }
  26722. return dest;
  26723. };
  26724. function pipeOnDrain(src) {
  26725. return function pipeOnDrainFunctionResult() {
  26726. var state = src._readableState;
  26727. debug('pipeOnDrain', state.awaitDrain);
  26728. if (state.awaitDrain) state.awaitDrain--;
  26729. if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
  26730. state.flowing = true;
  26731. flow(src);
  26732. }
  26733. };
  26734. }
  26735. Readable.prototype.unpipe = function (dest) {
  26736. var state = this._readableState;
  26737. var unpipeInfo = {
  26738. hasUnpiped: false
  26739. };
  26740. // if we're not piping anywhere, then do nothing.
  26741. if (state.pipesCount === 0) return this;
  26742. // just one destination. most common case.
  26743. if (state.pipesCount === 1) {
  26744. // passed in one, but it's not the right one.
  26745. if (dest && dest !== state.pipes) return this;
  26746. if (!dest) dest = state.pipes;
  26747. // got a match.
  26748. state.pipes = null;
  26749. state.pipesCount = 0;
  26750. state.flowing = false;
  26751. if (dest) dest.emit('unpipe', this, unpipeInfo);
  26752. return this;
  26753. }
  26754. // slow case. multiple pipe destinations.
  26755. if (!dest) {
  26756. // remove all.
  26757. var dests = state.pipes;
  26758. var len = state.pipesCount;
  26759. state.pipes = null;
  26760. state.pipesCount = 0;
  26761. state.flowing = false;
  26762. for (var i = 0; i < len; i++) dests[i].emit('unpipe', this, {
  26763. hasUnpiped: false
  26764. });
  26765. return this;
  26766. }
  26767. // try to find the right one.
  26768. var index = indexOf(state.pipes, dest);
  26769. if (index === -1) return this;
  26770. state.pipes.splice(index, 1);
  26771. state.pipesCount -= 1;
  26772. if (state.pipesCount === 1) state.pipes = state.pipes[0];
  26773. dest.emit('unpipe', this, unpipeInfo);
  26774. return this;
  26775. };
  26776. // set up data events if they are asked for
  26777. // Ensure readable listeners eventually get something
  26778. Readable.prototype.on = function (ev, fn) {
  26779. var res = Stream.prototype.on.call(this, ev, fn);
  26780. var state = this._readableState;
  26781. if (ev === 'data') {
  26782. // update readableListening so that resume() may be a no-op
  26783. // a few lines down. This is needed to support once('readable').
  26784. state.readableListening = this.listenerCount('readable') > 0;
  26785. // Try start flowing on next tick if stream isn't explicitly paused
  26786. if (state.flowing !== false) this.resume();
  26787. } else if (ev === 'readable') {
  26788. if (!state.endEmitted && !state.readableListening) {
  26789. state.readableListening = state.needReadable = true;
  26790. state.flowing = false;
  26791. state.emittedReadable = false;
  26792. debug('on readable', state.length, state.reading);
  26793. if (state.length) {
  26794. emitReadable(this);
  26795. } else if (!state.reading) {
  26796. process.nextTick(nReadingNextTick, this);
  26797. }
  26798. }
  26799. }
  26800. return res;
  26801. };
  26802. Readable.prototype.addListener = Readable.prototype.on;
  26803. Readable.prototype.removeListener = function (ev, fn) {
  26804. var res = Stream.prototype.removeListener.call(this, ev, fn);
  26805. if (ev === 'readable') {
  26806. // We need to check if there is someone still listening to
  26807. // readable and reset the state. However this needs to happen
  26808. // after readable has been emitted but before I/O (nextTick) to
  26809. // support once('readable', fn) cycles. This means that calling
  26810. // resume within the same tick will have no
  26811. // effect.
  26812. process.nextTick(updateReadableListening, this);
  26813. }
  26814. return res;
  26815. };
  26816. Readable.prototype.removeAllListeners = function (ev) {
  26817. var res = Stream.prototype.removeAllListeners.apply(this, arguments);
  26818. if (ev === 'readable' || ev === undefined) {
  26819. // We need to check if there is someone still listening to
  26820. // readable and reset the state. However this needs to happen
  26821. // after readable has been emitted but before I/O (nextTick) to
  26822. // support once('readable', fn) cycles. This means that calling
  26823. // resume within the same tick will have no
  26824. // effect.
  26825. process.nextTick(updateReadableListening, this);
  26826. }
  26827. return res;
  26828. };
  26829. function updateReadableListening(self) {
  26830. var state = self._readableState;
  26831. state.readableListening = self.listenerCount('readable') > 0;
  26832. if (state.resumeScheduled && !state.paused) {
  26833. // flowing needs to be set to true now, otherwise
  26834. // the upcoming resume will not flow.
  26835. state.flowing = true;
  26836. // crude way to check if we should resume
  26837. } else if (self.listenerCount('data') > 0) {
  26838. self.resume();
  26839. }
  26840. }
  26841. function nReadingNextTick(self) {
  26842. debug('readable nexttick read 0');
  26843. self.read(0);
  26844. }
  26845. // pause() and resume() are remnants of the legacy readable stream API
  26846. // If the user uses them, then switch into old mode.
  26847. Readable.prototype.resume = function () {
  26848. var state = this._readableState;
  26849. if (!state.flowing) {
  26850. debug('resume');
  26851. // we flow only if there is no one listening
  26852. // for readable, but we still have to call
  26853. // resume()
  26854. state.flowing = !state.readableListening;
  26855. resume(this, state);
  26856. }
  26857. state.paused = false;
  26858. return this;
  26859. };
  26860. function resume(stream, state) {
  26861. if (!state.resumeScheduled) {
  26862. state.resumeScheduled = true;
  26863. process.nextTick(resume_, stream, state);
  26864. }
  26865. }
  26866. function resume_(stream, state) {
  26867. debug('resume', state.reading);
  26868. if (!state.reading) {
  26869. stream.read(0);
  26870. }
  26871. state.resumeScheduled = false;
  26872. stream.emit('resume');
  26873. flow(stream);
  26874. if (state.flowing && !state.reading) stream.read(0);
  26875. }
  26876. Readable.prototype.pause = function () {
  26877. debug('call pause flowing=%j', this._readableState.flowing);
  26878. if (this._readableState.flowing !== false) {
  26879. debug('pause');
  26880. this._readableState.flowing = false;
  26881. this.emit('pause');
  26882. }
  26883. this._readableState.paused = true;
  26884. return this;
  26885. };
  26886. function flow(stream) {
  26887. var state = stream._readableState;
  26888. debug('flow', state.flowing);
  26889. while (state.flowing && stream.read() !== null);
  26890. }
  26891. // wrap an old-style stream as the async data source.
  26892. // This is *not* part of the readable stream interface.
  26893. // It is an ugly unfortunate mess of history.
  26894. Readable.prototype.wrap = function (stream) {
  26895. var _this = this;
  26896. var state = this._readableState;
  26897. var paused = false;
  26898. stream.on('end', function () {
  26899. debug('wrapped end');
  26900. if (state.decoder && !state.ended) {
  26901. var chunk = state.decoder.end();
  26902. if (chunk && chunk.length) _this.push(chunk);
  26903. }
  26904. _this.push(null);
  26905. });
  26906. stream.on('data', function (chunk) {
  26907. debug('wrapped data');
  26908. if (state.decoder) chunk = state.decoder.write(chunk);
  26909. // don't skip over falsy values in objectMode
  26910. if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
  26911. var ret = _this.push(chunk);
  26912. if (!ret) {
  26913. paused = true;
  26914. stream.pause();
  26915. }
  26916. });
  26917. // proxy all the other methods.
  26918. // important when wrapping filters and duplexes.
  26919. for (var i in stream) {
  26920. if (this[i] === undefined && typeof stream[i] === 'function') {
  26921. this[i] = function methodWrap(method) {
  26922. return function methodWrapReturnFunction() {
  26923. return stream[method].apply(stream, arguments);
  26924. };
  26925. }(i);
  26926. }
  26927. }
  26928. // proxy certain important events.
  26929. for (var n = 0; n < kProxyEvents.length; n++) {
  26930. stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
  26931. }
  26932. // when we try to consume some more bytes, simply unpause the
  26933. // underlying stream.
  26934. this._read = function (n) {
  26935. debug('wrapped _read', n);
  26936. if (paused) {
  26937. paused = false;
  26938. stream.resume();
  26939. }
  26940. };
  26941. return this;
  26942. };
  26943. if (typeof Symbol === 'function') {
  26944. Readable.prototype[Symbol.asyncIterator] = function () {
  26945. if (createReadableStreamAsyncIterator === undefined) {
  26946. createReadableStreamAsyncIterator = require('./internal/streams/async_iterator');
  26947. }
  26948. return createReadableStreamAsyncIterator(this);
  26949. };
  26950. }
  26951. Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
  26952. // making it explicit this property is not enumerable
  26953. // because otherwise some prototype manipulation in
  26954. // userland will fail
  26955. enumerable: false,
  26956. get: function get() {
  26957. return this._readableState.highWaterMark;
  26958. }
  26959. });
  26960. Object.defineProperty(Readable.prototype, 'readableBuffer', {
  26961. // making it explicit this property is not enumerable
  26962. // because otherwise some prototype manipulation in
  26963. // userland will fail
  26964. enumerable: false,
  26965. get: function get() {
  26966. return this._readableState && this._readableState.buffer;
  26967. }
  26968. });
  26969. Object.defineProperty(Readable.prototype, 'readableFlowing', {
  26970. // making it explicit this property is not enumerable
  26971. // because otherwise some prototype manipulation in
  26972. // userland will fail
  26973. enumerable: false,
  26974. get: function get() {
  26975. return this._readableState.flowing;
  26976. },
  26977. set: function set(state) {
  26978. if (this._readableState) {
  26979. this._readableState.flowing = state;
  26980. }
  26981. }
  26982. });
  26983. // exposed for testing purposes only.
  26984. Readable._fromList = fromList;
  26985. Object.defineProperty(Readable.prototype, 'readableLength', {
  26986. // making it explicit this property is not enumerable
  26987. // because otherwise some prototype manipulation in
  26988. // userland will fail
  26989. enumerable: false,
  26990. get: function get() {
  26991. return this._readableState.length;
  26992. }
  26993. });
  26994. // Pluck off n bytes from an array of buffers.
  26995. // Length is the combined lengths of all the buffers in the list.
  26996. // This function is designed to be inlinable, so please take care when making
  26997. // changes to the function body.
  26998. function fromList(n, state) {
  26999. // nothing buffered
  27000. if (state.length === 0) return null;
  27001. var ret;
  27002. if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
  27003. // read it all, truncate the list
  27004. if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length);
  27005. state.buffer.clear();
  27006. } else {
  27007. // read part of list
  27008. ret = state.buffer.consume(n, state.decoder);
  27009. }
  27010. return ret;
  27011. }
  27012. function endReadable(stream) {
  27013. var state = stream._readableState;
  27014. debug('endReadable', state.endEmitted);
  27015. if (!state.endEmitted) {
  27016. state.ended = true;
  27017. process.nextTick(endReadableNT, state, stream);
  27018. }
  27019. }
  27020. function endReadableNT(state, stream) {
  27021. debug('endReadableNT', state.endEmitted, state.length);
  27022. // Check that we didn't get one last unshift.
  27023. if (!state.endEmitted && state.length === 0) {
  27024. state.endEmitted = true;
  27025. stream.readable = false;
  27026. stream.emit('end');
  27027. if (state.autoDestroy) {
  27028. // In case of duplex streams we need a way to detect
  27029. // if the writable side is ready for autoDestroy as well
  27030. var wState = stream._writableState;
  27031. if (!wState || wState.autoDestroy && wState.finished) {
  27032. stream.destroy();
  27033. }
  27034. }
  27035. }
  27036. }
  27037. if (typeof Symbol === 'function') {
  27038. Readable.from = function (iterable, opts) {
  27039. if (from === undefined) {
  27040. from = require('./internal/streams/from');
  27041. }
  27042. return from(Readable, iterable, opts);
  27043. };
  27044. }
  27045. function indexOf(xs, x) {
  27046. for (var i = 0, l = xs.length; i < l; i++) {
  27047. if (xs[i] === x) return i;
  27048. }
  27049. return -1;
  27050. }
  27051. }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  27052. },{"../errors":399,"./_stream_duplex":400,"./internal/streams/async_iterator":405,"./internal/streams/buffer_list":406,"./internal/streams/destroy":407,"./internal/streams/from":409,"./internal/streams/state":411,"./internal/streams/stream":412,"_process":467,"buffer":90,"events":344,"inherits":364,"string_decoder/":413,"util":89}],403:[function(require,module,exports){
  27053. // Copyright Joyent, Inc. and other Node contributors.
  27054. //
  27055. // Permission is hereby granted, free of charge, to any person obtaining a
  27056. // copy of this software and associated documentation files (the
  27057. // "Software"), to deal in the Software without restriction, including
  27058. // without limitation the rights to use, copy, modify, merge, publish,
  27059. // distribute, sublicense, and/or sell copies of the Software, and to permit
  27060. // persons to whom the Software is furnished to do so, subject to the
  27061. // following conditions:
  27062. //
  27063. // The above copyright notice and this permission notice shall be included
  27064. // in all copies or substantial portions of the Software.
  27065. //
  27066. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  27067. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27068. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  27069. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  27070. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  27071. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  27072. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  27073. // a transform stream is a readable/writable stream where you do
  27074. // something with the data. Sometimes it's called a "filter",
  27075. // but that's not a great name for it, since that implies a thing where
  27076. // some bits pass through, and others are simply ignored. (That would
  27077. // be a valid example of a transform, of course.)
  27078. //
  27079. // While the output is causally related to the input, it's not a
  27080. // necessarily symmetric or synchronous transformation. For example,
  27081. // a zlib stream might take multiple plain-text writes(), and then
  27082. // emit a single compressed chunk some time in the future.
  27083. //
  27084. // Here's how this works:
  27085. //
  27086. // The Transform stream has all the aspects of the readable and writable
  27087. // stream classes. When you write(chunk), that calls _write(chunk,cb)
  27088. // internally, and returns false if there's a lot of pending writes
  27089. // buffered up. When you call read(), that calls _read(n) until
  27090. // there's enough pending readable data buffered up.
  27091. //
  27092. // In a transform stream, the written data is placed in a buffer. When
  27093. // _read(n) is called, it transforms the queued up data, calling the
  27094. // buffered _write cb's as it consumes chunks. If consuming a single
  27095. // written chunk would result in multiple output chunks, then the first
  27096. // outputted bit calls the readcb, and subsequent chunks just go into
  27097. // the read buffer, and will cause it to emit 'readable' if necessary.
  27098. //
  27099. // This way, back-pressure is actually determined by the reading side,
  27100. // since _read has to be called to start processing a new chunk. However,
  27101. // a pathological inflate type of transform can cause excessive buffering
  27102. // here. For example, imagine a stream where every byte of input is
  27103. // interpreted as an integer from 0-255, and then results in that many
  27104. // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
  27105. // 1kb of data being output. In this case, you could write a very small
  27106. // amount of input, and end up with a very large amount of output. In
  27107. // such a pathological inflating mechanism, there'd be no way to tell
  27108. // the system to stop doing the transform. A single 4MB write could
  27109. // cause the system to run out of memory.
  27110. //
  27111. // However, even in such a pathological case, only a single written chunk
  27112. // would be consumed, and then the rest would wait (un-transformed) until
  27113. // the results of the previous transformed chunk were consumed.
  27114. 'use strict';
  27115. module.exports = Transform;
  27116. var _require$codes = require('../errors').codes,
  27117. ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
  27118. ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
  27119. ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,
  27120. ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
  27121. var Duplex = require('./_stream_duplex');
  27122. require('inherits')(Transform, Duplex);
  27123. function afterTransform(er, data) {
  27124. var ts = this._transformState;
  27125. ts.transforming = false;
  27126. var cb = ts.writecb;
  27127. if (cb === null) {
  27128. return this.emit('error', new ERR_MULTIPLE_CALLBACK());
  27129. }
  27130. ts.writechunk = null;
  27131. ts.writecb = null;
  27132. if (data != null)
  27133. // single equals check for both `null` and `undefined`
  27134. this.push(data);
  27135. cb(er);
  27136. var rs = this._readableState;
  27137. rs.reading = false;
  27138. if (rs.needReadable || rs.length < rs.highWaterMark) {
  27139. this._read(rs.highWaterMark);
  27140. }
  27141. }
  27142. function Transform(options) {
  27143. if (!(this instanceof Transform)) return new Transform(options);
  27144. Duplex.call(this, options);
  27145. this._transformState = {
  27146. afterTransform: afterTransform.bind(this),
  27147. needTransform: false,
  27148. transforming: false,
  27149. writecb: null,
  27150. writechunk: null,
  27151. writeencoding: null
  27152. };
  27153. // start out asking for a readable event once data is transformed.
  27154. this._readableState.needReadable = true;
  27155. // we have implemented the _read method, and done the other things
  27156. // that Readable wants before the first _read call, so unset the
  27157. // sync guard flag.
  27158. this._readableState.sync = false;
  27159. if (options) {
  27160. if (typeof options.transform === 'function') this._transform = options.transform;
  27161. if (typeof options.flush === 'function') this._flush = options.flush;
  27162. }
  27163. // When the writable side finishes, then flush out anything remaining.
  27164. this.on('prefinish', prefinish);
  27165. }
  27166. function prefinish() {
  27167. var _this = this;
  27168. if (typeof this._flush === 'function' && !this._readableState.destroyed) {
  27169. this._flush(function (er, data) {
  27170. done(_this, er, data);
  27171. });
  27172. } else {
  27173. done(this, null, null);
  27174. }
  27175. }
  27176. Transform.prototype.push = function (chunk, encoding) {
  27177. this._transformState.needTransform = false;
  27178. return Duplex.prototype.push.call(this, chunk, encoding);
  27179. };
  27180. // This is the part where you do stuff!
  27181. // override this function in implementation classes.
  27182. // 'chunk' is an input chunk.
  27183. //
  27184. // Call `push(newChunk)` to pass along transformed output
  27185. // to the readable side. You may call 'push' zero or more times.
  27186. //
  27187. // Call `cb(err)` when you are done with this chunk. If you pass
  27188. // an error, then that'll put the hurt on the whole operation. If you
  27189. // never call cb(), then you'll never get another chunk.
  27190. Transform.prototype._transform = function (chunk, encoding, cb) {
  27191. cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));
  27192. };
  27193. Transform.prototype._write = function (chunk, encoding, cb) {
  27194. var ts = this._transformState;
  27195. ts.writecb = cb;
  27196. ts.writechunk = chunk;
  27197. ts.writeencoding = encoding;
  27198. if (!ts.transforming) {
  27199. var rs = this._readableState;
  27200. if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
  27201. }
  27202. };
  27203. // Doesn't matter what the args are here.
  27204. // _transform does all the work.
  27205. // That we got here means that the readable side wants more data.
  27206. Transform.prototype._read = function (n) {
  27207. var ts = this._transformState;
  27208. if (ts.writechunk !== null && !ts.transforming) {
  27209. ts.transforming = true;
  27210. this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
  27211. } else {
  27212. // mark that we need a transform, so that any data that comes in
  27213. // will get processed, now that we've asked for it.
  27214. ts.needTransform = true;
  27215. }
  27216. };
  27217. Transform.prototype._destroy = function (err, cb) {
  27218. Duplex.prototype._destroy.call(this, err, function (err2) {
  27219. cb(err2);
  27220. });
  27221. };
  27222. function done(stream, er, data) {
  27223. if (er) return stream.emit('error', er);
  27224. if (data != null)
  27225. // single equals check for both `null` and `undefined`
  27226. stream.push(data);
  27227. // TODO(BridgeAR): Write a test for these two error cases
  27228. // if there's nothing in the write buffer, then that means
  27229. // that nothing more will ever be provided
  27230. if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();
  27231. if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();
  27232. return stream.push(null);
  27233. }
  27234. },{"../errors":399,"./_stream_duplex":400,"inherits":364}],404:[function(require,module,exports){
  27235. (function (process,global){(function (){
  27236. // Copyright Joyent, Inc. and other Node contributors.
  27237. //
  27238. // Permission is hereby granted, free of charge, to any person obtaining a
  27239. // copy of this software and associated documentation files (the
  27240. // "Software"), to deal in the Software without restriction, including
  27241. // without limitation the rights to use, copy, modify, merge, publish,
  27242. // distribute, sublicense, and/or sell copies of the Software, and to permit
  27243. // persons to whom the Software is furnished to do so, subject to the
  27244. // following conditions:
  27245. //
  27246. // The above copyright notice and this permission notice shall be included
  27247. // in all copies or substantial portions of the Software.
  27248. //
  27249. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  27250. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27251. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  27252. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  27253. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  27254. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  27255. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  27256. // A bit simpler than readable streams.
  27257. // Implement an async ._write(chunk, encoding, cb), and it'll handle all
  27258. // the drain event emission and buffering.
  27259. 'use strict';
  27260. module.exports = Writable;
  27261. /* <replacement> */
  27262. function WriteReq(chunk, encoding, cb) {
  27263. this.chunk = chunk;
  27264. this.encoding = encoding;
  27265. this.callback = cb;
  27266. this.next = null;
  27267. }
  27268. // It seems a linked list but it is not
  27269. // there will be only 2 of these for each stream
  27270. function CorkedRequest(state) {
  27271. var _this = this;
  27272. this.next = null;
  27273. this.entry = null;
  27274. this.finish = function () {
  27275. onCorkedFinish(_this, state);
  27276. };
  27277. }
  27278. /* </replacement> */
  27279. /*<replacement>*/
  27280. var Duplex;
  27281. /*</replacement>*/
  27282. Writable.WritableState = WritableState;
  27283. /*<replacement>*/
  27284. var internalUtil = {
  27285. deprecate: require('util-deprecate')
  27286. };
  27287. /*</replacement>*/
  27288. /*<replacement>*/
  27289. var Stream = require('./internal/streams/stream');
  27290. /*</replacement>*/
  27291. var Buffer = require('buffer').Buffer;
  27292. var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};
  27293. function _uint8ArrayToBuffer(chunk) {
  27294. return Buffer.from(chunk);
  27295. }
  27296. function _isUint8Array(obj) {
  27297. return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
  27298. }
  27299. var destroyImpl = require('./internal/streams/destroy');
  27300. var _require = require('./internal/streams/state'),
  27301. getHighWaterMark = _require.getHighWaterMark;
  27302. var _require$codes = require('../errors').codes,
  27303. ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
  27304. ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
  27305. ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
  27306. ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,
  27307. ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,
  27308. ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,
  27309. ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,
  27310. ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
  27311. var errorOrDestroy = destroyImpl.errorOrDestroy;
  27312. require('inherits')(Writable, Stream);
  27313. function nop() {}
  27314. function WritableState(options, stream, isDuplex) {
  27315. Duplex = Duplex || require('./_stream_duplex');
  27316. options = options || {};
  27317. // Duplex streams are both readable and writable, but share
  27318. // the same options object.
  27319. // However, some cases require setting options to different
  27320. // values for the readable and the writable sides of the duplex stream,
  27321. // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.
  27322. if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;
  27323. // object stream flag to indicate whether or not this stream
  27324. // contains buffers or objects.
  27325. this.objectMode = !!options.objectMode;
  27326. if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
  27327. // the point at which write() starts returning false
  27328. // Note: 0 is a valid value, means that we always return false if
  27329. // the entire buffer is not flushed immediately on write()
  27330. this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex);
  27331. // if _final has been called
  27332. this.finalCalled = false;
  27333. // drain event flag.
  27334. this.needDrain = false;
  27335. // at the start of calling end()
  27336. this.ending = false;
  27337. // when end() has been called, and returned
  27338. this.ended = false;
  27339. // when 'finish' is emitted
  27340. this.finished = false;
  27341. // has it been destroyed
  27342. this.destroyed = false;
  27343. // should we decode strings into buffers before passing to _write?
  27344. // this is here so that some node-core streams can optimize string
  27345. // handling at a lower level.
  27346. var noDecode = options.decodeStrings === false;
  27347. this.decodeStrings = !noDecode;
  27348. // Crypto is kind of old and crusty. Historically, its default string
  27349. // encoding is 'binary' so we have to make this configurable.
  27350. // Everything else in the universe uses 'utf8', though.
  27351. this.defaultEncoding = options.defaultEncoding || 'utf8';
  27352. // not an actual buffer we keep track of, but a measurement
  27353. // of how much we're waiting to get pushed to some underlying
  27354. // socket or file.
  27355. this.length = 0;
  27356. // a flag to see when we're in the middle of a write.
  27357. this.writing = false;
  27358. // when true all writes will be buffered until .uncork() call
  27359. this.corked = 0;
  27360. // a flag to be able to tell if the onwrite cb is called immediately,
  27361. // or on a later tick. We set this to true at first, because any
  27362. // actions that shouldn't happen until "later" should generally also
  27363. // not happen before the first write call.
  27364. this.sync = true;
  27365. // a flag to know if we're processing previously buffered items, which
  27366. // may call the _write() callback in the same tick, so that we don't
  27367. // end up in an overlapped onwrite situation.
  27368. this.bufferProcessing = false;
  27369. // the callback that's passed to _write(chunk,cb)
  27370. this.onwrite = function (er) {
  27371. onwrite(stream, er);
  27372. };
  27373. // the callback that the user supplies to write(chunk,encoding,cb)
  27374. this.writecb = null;
  27375. // the amount that is being written when _write is called.
  27376. this.writelen = 0;
  27377. this.bufferedRequest = null;
  27378. this.lastBufferedRequest = null;
  27379. // number of pending user-supplied write callbacks
  27380. // this must be 0 before 'finish' can be emitted
  27381. this.pendingcb = 0;
  27382. // emit prefinish if the only thing we're waiting for is _write cbs
  27383. // This is relevant for synchronous Transform streams
  27384. this.prefinished = false;
  27385. // True if the error was already emitted and should not be thrown again
  27386. this.errorEmitted = false;
  27387. // Should close be emitted on destroy. Defaults to true.
  27388. this.emitClose = options.emitClose !== false;
  27389. // Should .destroy() be called after 'finish' (and potentially 'end')
  27390. this.autoDestroy = !!options.autoDestroy;
  27391. // count buffered requests
  27392. this.bufferedRequestCount = 0;
  27393. // allocate the first CorkedRequest, there is always
  27394. // one allocated and free to use, and we maintain at most two
  27395. this.corkedRequestsFree = new CorkedRequest(this);
  27396. }
  27397. WritableState.prototype.getBuffer = function getBuffer() {
  27398. var current = this.bufferedRequest;
  27399. var out = [];
  27400. while (current) {
  27401. out.push(current);
  27402. current = current.next;
  27403. }
  27404. return out;
  27405. };
  27406. (function () {
  27407. try {
  27408. Object.defineProperty(WritableState.prototype, 'buffer', {
  27409. get: internalUtil.deprecate(function writableStateBufferGetter() {
  27410. return this.getBuffer();
  27411. }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
  27412. });
  27413. } catch (_) {}
  27414. })();
  27415. // Test _writableState for inheritance to account for Duplex streams,
  27416. // whose prototype chain only points to Readable.
  27417. var realHasInstance;
  27418. if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
  27419. realHasInstance = Function.prototype[Symbol.hasInstance];
  27420. Object.defineProperty(Writable, Symbol.hasInstance, {
  27421. value: function value(object) {
  27422. if (realHasInstance.call(this, object)) return true;
  27423. if (this !== Writable) return false;
  27424. return object && object._writableState instanceof WritableState;
  27425. }
  27426. });
  27427. } else {
  27428. realHasInstance = function realHasInstance(object) {
  27429. return object instanceof this;
  27430. };
  27431. }
  27432. function Writable(options) {
  27433. Duplex = Duplex || require('./_stream_duplex');
  27434. // Writable ctor is applied to Duplexes, too.
  27435. // `realHasInstance` is necessary because using plain `instanceof`
  27436. // would return false, as no `_writableState` property is attached.
  27437. // Trying to use the custom `instanceof` for Writable here will also break the
  27438. // Node.js LazyTransform implementation, which has a non-trivial getter for
  27439. // `_writableState` that would lead to infinite recursion.
  27440. // Checking for a Stream.Duplex instance is faster here instead of inside
  27441. // the WritableState constructor, at least with V8 6.5
  27442. var isDuplex = this instanceof Duplex;
  27443. if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);
  27444. this._writableState = new WritableState(options, this, isDuplex);
  27445. // legacy.
  27446. this.writable = true;
  27447. if (options) {
  27448. if (typeof options.write === 'function') this._write = options.write;
  27449. if (typeof options.writev === 'function') this._writev = options.writev;
  27450. if (typeof options.destroy === 'function') this._destroy = options.destroy;
  27451. if (typeof options.final === 'function') this._final = options.final;
  27452. }
  27453. Stream.call(this);
  27454. }
  27455. // Otherwise people can pipe Writable streams, which is just wrong.
  27456. Writable.prototype.pipe = function () {
  27457. errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
  27458. };
  27459. function writeAfterEnd(stream, cb) {
  27460. var er = new ERR_STREAM_WRITE_AFTER_END();
  27461. // TODO: defer error events consistently everywhere, not just the cb
  27462. errorOrDestroy(stream, er);
  27463. process.nextTick(cb, er);
  27464. }
  27465. // Checks that a user-supplied chunk is valid, especially for the particular
  27466. // mode the stream is in. Currently this means that `null` is never accepted
  27467. // and undefined/non-string values are only allowed in object mode.
  27468. function validChunk(stream, state, chunk, cb) {
  27469. var er;
  27470. if (chunk === null) {
  27471. er = new ERR_STREAM_NULL_VALUES();
  27472. } else if (typeof chunk !== 'string' && !state.objectMode) {
  27473. er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);
  27474. }
  27475. if (er) {
  27476. errorOrDestroy(stream, er);
  27477. process.nextTick(cb, er);
  27478. return false;
  27479. }
  27480. return true;
  27481. }
  27482. Writable.prototype.write = function (chunk, encoding, cb) {
  27483. var state = this._writableState;
  27484. var ret = false;
  27485. var isBuf = !state.objectMode && _isUint8Array(chunk);
  27486. if (isBuf && !Buffer.isBuffer(chunk)) {
  27487. chunk = _uint8ArrayToBuffer(chunk);
  27488. }
  27489. if (typeof encoding === 'function') {
  27490. cb = encoding;
  27491. encoding = null;
  27492. }
  27493. if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
  27494. if (typeof cb !== 'function') cb = nop;
  27495. if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
  27496. state.pendingcb++;
  27497. ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
  27498. }
  27499. return ret;
  27500. };
  27501. Writable.prototype.cork = function () {
  27502. this._writableState.corked++;
  27503. };
  27504. Writable.prototype.uncork = function () {
  27505. var state = this._writableState;
  27506. if (state.corked) {
  27507. state.corked--;
  27508. if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
  27509. }
  27510. };
  27511. Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
  27512. // node::ParseEncoding() requires lower case.
  27513. if (typeof encoding === 'string') encoding = encoding.toLowerCase();
  27514. if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);
  27515. this._writableState.defaultEncoding = encoding;
  27516. return this;
  27517. };
  27518. Object.defineProperty(Writable.prototype, 'writableBuffer', {
  27519. // making it explicit this property is not enumerable
  27520. // because otherwise some prototype manipulation in
  27521. // userland will fail
  27522. enumerable: false,
  27523. get: function get() {
  27524. return this._writableState && this._writableState.getBuffer();
  27525. }
  27526. });
  27527. function decodeChunk(state, chunk, encoding) {
  27528. if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
  27529. chunk = Buffer.from(chunk, encoding);
  27530. }
  27531. return chunk;
  27532. }
  27533. Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
  27534. // making it explicit this property is not enumerable
  27535. // because otherwise some prototype manipulation in
  27536. // userland will fail
  27537. enumerable: false,
  27538. get: function get() {
  27539. return this._writableState.highWaterMark;
  27540. }
  27541. });
  27542. // if we're already writing something, then just put this
  27543. // in the queue, and wait our turn. Otherwise, call _write
  27544. // If we return false, then we need a drain event, so set that flag.
  27545. function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
  27546. if (!isBuf) {
  27547. var newChunk = decodeChunk(state, chunk, encoding);
  27548. if (chunk !== newChunk) {
  27549. isBuf = true;
  27550. encoding = 'buffer';
  27551. chunk = newChunk;
  27552. }
  27553. }
  27554. var len = state.objectMode ? 1 : chunk.length;
  27555. state.length += len;
  27556. var ret = state.length < state.highWaterMark;
  27557. // we must ensure that previous needDrain will not be reset to false.
  27558. if (!ret) state.needDrain = true;
  27559. if (state.writing || state.corked) {
  27560. var last = state.lastBufferedRequest;
  27561. state.lastBufferedRequest = {
  27562. chunk: chunk,
  27563. encoding: encoding,
  27564. isBuf: isBuf,
  27565. callback: cb,
  27566. next: null
  27567. };
  27568. if (last) {
  27569. last.next = state.lastBufferedRequest;
  27570. } else {
  27571. state.bufferedRequest = state.lastBufferedRequest;
  27572. }
  27573. state.bufferedRequestCount += 1;
  27574. } else {
  27575. doWrite(stream, state, false, len, chunk, encoding, cb);
  27576. }
  27577. return ret;
  27578. }
  27579. function doWrite(stream, state, writev, len, chunk, encoding, cb) {
  27580. state.writelen = len;
  27581. state.writecb = cb;
  27582. state.writing = true;
  27583. state.sync = true;
  27584. if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
  27585. state.sync = false;
  27586. }
  27587. function onwriteError(stream, state, sync, er, cb) {
  27588. --state.pendingcb;
  27589. if (sync) {
  27590. // defer the callback if we are being called synchronously
  27591. // to avoid piling up things on the stack
  27592. process.nextTick(cb, er);
  27593. // this can emit finish, and it will always happen
  27594. // after error
  27595. process.nextTick(finishMaybe, stream, state);
  27596. stream._writableState.errorEmitted = true;
  27597. errorOrDestroy(stream, er);
  27598. } else {
  27599. // the caller expect this to happen before if
  27600. // it is async
  27601. cb(er);
  27602. stream._writableState.errorEmitted = true;
  27603. errorOrDestroy(stream, er);
  27604. // this can emit finish, but finish must
  27605. // always follow error
  27606. finishMaybe(stream, state);
  27607. }
  27608. }
  27609. function onwriteStateUpdate(state) {
  27610. state.writing = false;
  27611. state.writecb = null;
  27612. state.length -= state.writelen;
  27613. state.writelen = 0;
  27614. }
  27615. function onwrite(stream, er) {
  27616. var state = stream._writableState;
  27617. var sync = state.sync;
  27618. var cb = state.writecb;
  27619. if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK();
  27620. onwriteStateUpdate(state);
  27621. if (er) onwriteError(stream, state, sync, er, cb);else {
  27622. // Check if we're actually ready to finish, but don't emit yet
  27623. var finished = needFinish(state) || stream.destroyed;
  27624. if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
  27625. clearBuffer(stream, state);
  27626. }
  27627. if (sync) {
  27628. process.nextTick(afterWrite, stream, state, finished, cb);
  27629. } else {
  27630. afterWrite(stream, state, finished, cb);
  27631. }
  27632. }
  27633. }
  27634. function afterWrite(stream, state, finished, cb) {
  27635. if (!finished) onwriteDrain(stream, state);
  27636. state.pendingcb--;
  27637. cb();
  27638. finishMaybe(stream, state);
  27639. }
  27640. // Must force callback to be called on nextTick, so that we don't
  27641. // emit 'drain' before the write() consumer gets the 'false' return
  27642. // value, and has a chance to attach a 'drain' listener.
  27643. function onwriteDrain(stream, state) {
  27644. if (state.length === 0 && state.needDrain) {
  27645. state.needDrain = false;
  27646. stream.emit('drain');
  27647. }
  27648. }
  27649. // if there's something in the buffer waiting, then process it
  27650. function clearBuffer(stream, state) {
  27651. state.bufferProcessing = true;
  27652. var entry = state.bufferedRequest;
  27653. if (stream._writev && entry && entry.next) {
  27654. // Fast case, write everything using _writev()
  27655. var l = state.bufferedRequestCount;
  27656. var buffer = new Array(l);
  27657. var holder = state.corkedRequestsFree;
  27658. holder.entry = entry;
  27659. var count = 0;
  27660. var allBuffers = true;
  27661. while (entry) {
  27662. buffer[count] = entry;
  27663. if (!entry.isBuf) allBuffers = false;
  27664. entry = entry.next;
  27665. count += 1;
  27666. }
  27667. buffer.allBuffers = allBuffers;
  27668. doWrite(stream, state, true, state.length, buffer, '', holder.finish);
  27669. // doWrite is almost always async, defer these to save a bit of time
  27670. // as the hot path ends with doWrite
  27671. state.pendingcb++;
  27672. state.lastBufferedRequest = null;
  27673. if (holder.next) {
  27674. state.corkedRequestsFree = holder.next;
  27675. holder.next = null;
  27676. } else {
  27677. state.corkedRequestsFree = new CorkedRequest(state);
  27678. }
  27679. state.bufferedRequestCount = 0;
  27680. } else {
  27681. // Slow case, write chunks one-by-one
  27682. while (entry) {
  27683. var chunk = entry.chunk;
  27684. var encoding = entry.encoding;
  27685. var cb = entry.callback;
  27686. var len = state.objectMode ? 1 : chunk.length;
  27687. doWrite(stream, state, false, len, chunk, encoding, cb);
  27688. entry = entry.next;
  27689. state.bufferedRequestCount--;
  27690. // if we didn't call the onwrite immediately, then
  27691. // it means that we need to wait until it does.
  27692. // also, that means that the chunk and cb are currently
  27693. // being processed, so move the buffer counter past them.
  27694. if (state.writing) {
  27695. break;
  27696. }
  27697. }
  27698. if (entry === null) state.lastBufferedRequest = null;
  27699. }
  27700. state.bufferedRequest = entry;
  27701. state.bufferProcessing = false;
  27702. }
  27703. Writable.prototype._write = function (chunk, encoding, cb) {
  27704. cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));
  27705. };
  27706. Writable.prototype._writev = null;
  27707. Writable.prototype.end = function (chunk, encoding, cb) {
  27708. var state = this._writableState;
  27709. if (typeof chunk === 'function') {
  27710. cb = chunk;
  27711. chunk = null;
  27712. encoding = null;
  27713. } else if (typeof encoding === 'function') {
  27714. cb = encoding;
  27715. encoding = null;
  27716. }
  27717. if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
  27718. // .end() fully uncorks
  27719. if (state.corked) {
  27720. state.corked = 1;
  27721. this.uncork();
  27722. }
  27723. // ignore unnecessary end() calls.
  27724. if (!state.ending) endWritable(this, state, cb);
  27725. return this;
  27726. };
  27727. Object.defineProperty(Writable.prototype, 'writableLength', {
  27728. // making it explicit this property is not enumerable
  27729. // because otherwise some prototype manipulation in
  27730. // userland will fail
  27731. enumerable: false,
  27732. get: function get() {
  27733. return this._writableState.length;
  27734. }
  27735. });
  27736. function needFinish(state) {
  27737. return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
  27738. }
  27739. function callFinal(stream, state) {
  27740. stream._final(function (err) {
  27741. state.pendingcb--;
  27742. if (err) {
  27743. errorOrDestroy(stream, err);
  27744. }
  27745. state.prefinished = true;
  27746. stream.emit('prefinish');
  27747. finishMaybe(stream, state);
  27748. });
  27749. }
  27750. function prefinish(stream, state) {
  27751. if (!state.prefinished && !state.finalCalled) {
  27752. if (typeof stream._final === 'function' && !state.destroyed) {
  27753. state.pendingcb++;
  27754. state.finalCalled = true;
  27755. process.nextTick(callFinal, stream, state);
  27756. } else {
  27757. state.prefinished = true;
  27758. stream.emit('prefinish');
  27759. }
  27760. }
  27761. }
  27762. function finishMaybe(stream, state) {
  27763. var need = needFinish(state);
  27764. if (need) {
  27765. prefinish(stream, state);
  27766. if (state.pendingcb === 0) {
  27767. state.finished = true;
  27768. stream.emit('finish');
  27769. if (state.autoDestroy) {
  27770. // In case of duplex streams we need a way to detect
  27771. // if the readable side is ready for autoDestroy as well
  27772. var rState = stream._readableState;
  27773. if (!rState || rState.autoDestroy && rState.endEmitted) {
  27774. stream.destroy();
  27775. }
  27776. }
  27777. }
  27778. }
  27779. return need;
  27780. }
  27781. function endWritable(stream, state, cb) {
  27782. state.ending = true;
  27783. finishMaybe(stream, state);
  27784. if (cb) {
  27785. if (state.finished) process.nextTick(cb);else stream.once('finish', cb);
  27786. }
  27787. state.ended = true;
  27788. stream.writable = false;
  27789. }
  27790. function onCorkedFinish(corkReq, state, err) {
  27791. var entry = corkReq.entry;
  27792. corkReq.entry = null;
  27793. while (entry) {
  27794. var cb = entry.callback;
  27795. state.pendingcb--;
  27796. cb(err);
  27797. entry = entry.next;
  27798. }
  27799. // reuse the free corkReq.
  27800. state.corkedRequestsFree.next = corkReq;
  27801. }
  27802. Object.defineProperty(Writable.prototype, 'destroyed', {
  27803. // making it explicit this property is not enumerable
  27804. // because otherwise some prototype manipulation in
  27805. // userland will fail
  27806. enumerable: false,
  27807. get: function get() {
  27808. if (this._writableState === undefined) {
  27809. return false;
  27810. }
  27811. return this._writableState.destroyed;
  27812. },
  27813. set: function set(value) {
  27814. // we ignore the value if the stream
  27815. // has not been initialized yet
  27816. if (!this._writableState) {
  27817. return;
  27818. }
  27819. // backward compatibility, the user is explicitly
  27820. // managing destroyed
  27821. this._writableState.destroyed = value;
  27822. }
  27823. });
  27824. Writable.prototype.destroy = destroyImpl.destroy;
  27825. Writable.prototype._undestroy = destroyImpl.undestroy;
  27826. Writable.prototype._destroy = function (err, cb) {
  27827. cb(err);
  27828. };
  27829. }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  27830. },{"../errors":399,"./_stream_duplex":400,"./internal/streams/destroy":407,"./internal/streams/state":411,"./internal/streams/stream":412,"_process":467,"buffer":90,"inherits":364,"util-deprecate":416}],405:[function(require,module,exports){
  27831. (function (process){(function (){
  27832. 'use strict';
  27833. var _Object$setPrototypeO;
  27834. function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  27835. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
  27836. function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  27837. var finished = require('./end-of-stream');
  27838. var kLastResolve = Symbol('lastResolve');
  27839. var kLastReject = Symbol('lastReject');
  27840. var kError = Symbol('error');
  27841. var kEnded = Symbol('ended');
  27842. var kLastPromise = Symbol('lastPromise');
  27843. var kHandlePromise = Symbol('handlePromise');
  27844. var kStream = Symbol('stream');
  27845. function createIterResult(value, done) {
  27846. return {
  27847. value: value,
  27848. done: done
  27849. };
  27850. }
  27851. function readAndResolve(iter) {
  27852. var resolve = iter[kLastResolve];
  27853. if (resolve !== null) {
  27854. var data = iter[kStream].read();
  27855. // we defer if data is null
  27856. // we can be expecting either 'end' or
  27857. // 'error'
  27858. if (data !== null) {
  27859. iter[kLastPromise] = null;
  27860. iter[kLastResolve] = null;
  27861. iter[kLastReject] = null;
  27862. resolve(createIterResult(data, false));
  27863. }
  27864. }
  27865. }
  27866. function onReadable(iter) {
  27867. // we wait for the next tick, because it might
  27868. // emit an error with process.nextTick
  27869. process.nextTick(readAndResolve, iter);
  27870. }
  27871. function wrapForNext(lastPromise, iter) {
  27872. return function (resolve, reject) {
  27873. lastPromise.then(function () {
  27874. if (iter[kEnded]) {
  27875. resolve(createIterResult(undefined, true));
  27876. return;
  27877. }
  27878. iter[kHandlePromise](resolve, reject);
  27879. }, reject);
  27880. };
  27881. }
  27882. var AsyncIteratorPrototype = Object.getPrototypeOf(function () {});
  27883. var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {
  27884. get stream() {
  27885. return this[kStream];
  27886. },
  27887. next: function next() {
  27888. var _this = this;
  27889. // if we have detected an error in the meanwhile
  27890. // reject straight away
  27891. var error = this[kError];
  27892. if (error !== null) {
  27893. return Promise.reject(error);
  27894. }
  27895. if (this[kEnded]) {
  27896. return Promise.resolve(createIterResult(undefined, true));
  27897. }
  27898. if (this[kStream].destroyed) {
  27899. // We need to defer via nextTick because if .destroy(err) is
  27900. // called, the error will be emitted via nextTick, and
  27901. // we cannot guarantee that there is no error lingering around
  27902. // waiting to be emitted.
  27903. return new Promise(function (resolve, reject) {
  27904. process.nextTick(function () {
  27905. if (_this[kError]) {
  27906. reject(_this[kError]);
  27907. } else {
  27908. resolve(createIterResult(undefined, true));
  27909. }
  27910. });
  27911. });
  27912. }
  27913. // if we have multiple next() calls
  27914. // we will wait for the previous Promise to finish
  27915. // this logic is optimized to support for await loops,
  27916. // where next() is only called once at a time
  27917. var lastPromise = this[kLastPromise];
  27918. var promise;
  27919. if (lastPromise) {
  27920. promise = new Promise(wrapForNext(lastPromise, this));
  27921. } else {
  27922. // fast path needed to support multiple this.push()
  27923. // without triggering the next() queue
  27924. var data = this[kStream].read();
  27925. if (data !== null) {
  27926. return Promise.resolve(createIterResult(data, false));
  27927. }
  27928. promise = new Promise(this[kHandlePromise]);
  27929. }
  27930. this[kLastPromise] = promise;
  27931. return promise;
  27932. }
  27933. }, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () {
  27934. return this;
  27935. }), _defineProperty(_Object$setPrototypeO, "return", function _return() {
  27936. var _this2 = this;
  27937. // destroy(err, cb) is a private API
  27938. // we can guarantee we have that here, because we control the
  27939. // Readable class this is attached to
  27940. return new Promise(function (resolve, reject) {
  27941. _this2[kStream].destroy(null, function (err) {
  27942. if (err) {
  27943. reject(err);
  27944. return;
  27945. }
  27946. resolve(createIterResult(undefined, true));
  27947. });
  27948. });
  27949. }), _Object$setPrototypeO), AsyncIteratorPrototype);
  27950. var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {
  27951. var _Object$create;
  27952. var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {
  27953. value: stream,
  27954. writable: true
  27955. }), _defineProperty(_Object$create, kLastResolve, {
  27956. value: null,
  27957. writable: true
  27958. }), _defineProperty(_Object$create, kLastReject, {
  27959. value: null,
  27960. writable: true
  27961. }), _defineProperty(_Object$create, kError, {
  27962. value: null,
  27963. writable: true
  27964. }), _defineProperty(_Object$create, kEnded, {
  27965. value: stream._readableState.endEmitted,
  27966. writable: true
  27967. }), _defineProperty(_Object$create, kHandlePromise, {
  27968. value: function value(resolve, reject) {
  27969. var data = iterator[kStream].read();
  27970. if (data) {
  27971. iterator[kLastPromise] = null;
  27972. iterator[kLastResolve] = null;
  27973. iterator[kLastReject] = null;
  27974. resolve(createIterResult(data, false));
  27975. } else {
  27976. iterator[kLastResolve] = resolve;
  27977. iterator[kLastReject] = reject;
  27978. }
  27979. },
  27980. writable: true
  27981. }), _Object$create));
  27982. iterator[kLastPromise] = null;
  27983. finished(stream, function (err) {
  27984. if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {
  27985. var reject = iterator[kLastReject];
  27986. // reject if we are waiting for data in the Promise
  27987. // returned by next() and store the error
  27988. if (reject !== null) {
  27989. iterator[kLastPromise] = null;
  27990. iterator[kLastResolve] = null;
  27991. iterator[kLastReject] = null;
  27992. reject(err);
  27993. }
  27994. iterator[kError] = err;
  27995. return;
  27996. }
  27997. var resolve = iterator[kLastResolve];
  27998. if (resolve !== null) {
  27999. iterator[kLastPromise] = null;
  28000. iterator[kLastResolve] = null;
  28001. iterator[kLastReject] = null;
  28002. resolve(createIterResult(undefined, true));
  28003. }
  28004. iterator[kEnded] = true;
  28005. });
  28006. stream.on('readable', onReadable.bind(null, iterator));
  28007. return iterator;
  28008. };
  28009. module.exports = createReadableStreamAsyncIterator;
  28010. }).call(this)}).call(this,require('_process'))
  28011. },{"./end-of-stream":408,"_process":467}],406:[function(require,module,exports){
  28012. 'use strict';
  28013. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  28014. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  28015. function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  28016. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  28017. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
  28018. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  28019. function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
  28020. function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
  28021. var _require = require('buffer'),
  28022. Buffer = _require.Buffer;
  28023. var _require2 = require('util'),
  28024. inspect = _require2.inspect;
  28025. var custom = inspect && inspect.custom || 'inspect';
  28026. function copyBuffer(src, target, offset) {
  28027. Buffer.prototype.copy.call(src, target, offset);
  28028. }
  28029. module.exports = /*#__PURE__*/function () {
  28030. function BufferList() {
  28031. _classCallCheck(this, BufferList);
  28032. this.head = null;
  28033. this.tail = null;
  28034. this.length = 0;
  28035. }
  28036. _createClass(BufferList, [{
  28037. key: "push",
  28038. value: function push(v) {
  28039. var entry = {
  28040. data: v,
  28041. next: null
  28042. };
  28043. if (this.length > 0) this.tail.next = entry;else this.head = entry;
  28044. this.tail = entry;
  28045. ++this.length;
  28046. }
  28047. }, {
  28048. key: "unshift",
  28049. value: function unshift(v) {
  28050. var entry = {
  28051. data: v,
  28052. next: this.head
  28053. };
  28054. if (this.length === 0) this.tail = entry;
  28055. this.head = entry;
  28056. ++this.length;
  28057. }
  28058. }, {
  28059. key: "shift",
  28060. value: function shift() {
  28061. if (this.length === 0) return;
  28062. var ret = this.head.data;
  28063. if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
  28064. --this.length;
  28065. return ret;
  28066. }
  28067. }, {
  28068. key: "clear",
  28069. value: function clear() {
  28070. this.head = this.tail = null;
  28071. this.length = 0;
  28072. }
  28073. }, {
  28074. key: "join",
  28075. value: function join(s) {
  28076. if (this.length === 0) return '';
  28077. var p = this.head;
  28078. var ret = '' + p.data;
  28079. while (p = p.next) ret += s + p.data;
  28080. return ret;
  28081. }
  28082. }, {
  28083. key: "concat",
  28084. value: function concat(n) {
  28085. if (this.length === 0) return Buffer.alloc(0);
  28086. var ret = Buffer.allocUnsafe(n >>> 0);
  28087. var p = this.head;
  28088. var i = 0;
  28089. while (p) {
  28090. copyBuffer(p.data, ret, i);
  28091. i += p.data.length;
  28092. p = p.next;
  28093. }
  28094. return ret;
  28095. }
  28096. // Consumes a specified amount of bytes or characters from the buffered data.
  28097. }, {
  28098. key: "consume",
  28099. value: function consume(n, hasStrings) {
  28100. var ret;
  28101. if (n < this.head.data.length) {
  28102. // `slice` is the same for buffers and strings.
  28103. ret = this.head.data.slice(0, n);
  28104. this.head.data = this.head.data.slice(n);
  28105. } else if (n === this.head.data.length) {
  28106. // First chunk is a perfect match.
  28107. ret = this.shift();
  28108. } else {
  28109. // Result spans more than one buffer.
  28110. ret = hasStrings ? this._getString(n) : this._getBuffer(n);
  28111. }
  28112. return ret;
  28113. }
  28114. }, {
  28115. key: "first",
  28116. value: function first() {
  28117. return this.head.data;
  28118. }
  28119. // Consumes a specified amount of characters from the buffered data.
  28120. }, {
  28121. key: "_getString",
  28122. value: function _getString(n) {
  28123. var p = this.head;
  28124. var c = 1;
  28125. var ret = p.data;
  28126. n -= ret.length;
  28127. while (p = p.next) {
  28128. var str = p.data;
  28129. var nb = n > str.length ? str.length : n;
  28130. if (nb === str.length) ret += str;else ret += str.slice(0, n);
  28131. n -= nb;
  28132. if (n === 0) {
  28133. if (nb === str.length) {
  28134. ++c;
  28135. if (p.next) this.head = p.next;else this.head = this.tail = null;
  28136. } else {
  28137. this.head = p;
  28138. p.data = str.slice(nb);
  28139. }
  28140. break;
  28141. }
  28142. ++c;
  28143. }
  28144. this.length -= c;
  28145. return ret;
  28146. }
  28147. // Consumes a specified amount of bytes from the buffered data.
  28148. }, {
  28149. key: "_getBuffer",
  28150. value: function _getBuffer(n) {
  28151. var ret = Buffer.allocUnsafe(n);
  28152. var p = this.head;
  28153. var c = 1;
  28154. p.data.copy(ret);
  28155. n -= p.data.length;
  28156. while (p = p.next) {
  28157. var buf = p.data;
  28158. var nb = n > buf.length ? buf.length : n;
  28159. buf.copy(ret, ret.length - n, 0, nb);
  28160. n -= nb;
  28161. if (n === 0) {
  28162. if (nb === buf.length) {
  28163. ++c;
  28164. if (p.next) this.head = p.next;else this.head = this.tail = null;
  28165. } else {
  28166. this.head = p;
  28167. p.data = buf.slice(nb);
  28168. }
  28169. break;
  28170. }
  28171. ++c;
  28172. }
  28173. this.length -= c;
  28174. return ret;
  28175. }
  28176. // Make sure the linked list only shows the minimal necessary information.
  28177. }, {
  28178. key: custom,
  28179. value: function value(_, options) {
  28180. return inspect(this, _objectSpread(_objectSpread({}, options), {}, {
  28181. // Only inspect one level.
  28182. depth: 0,
  28183. // It should not recurse.
  28184. customInspect: false
  28185. }));
  28186. }
  28187. }]);
  28188. return BufferList;
  28189. }();
  28190. },{"buffer":90,"util":89}],407:[function(require,module,exports){
  28191. (function (process){(function (){
  28192. 'use strict';
  28193. // undocumented cb() API, needed for core, not for public API
  28194. function destroy(err, cb) {
  28195. var _this = this;
  28196. var readableDestroyed = this._readableState && this._readableState.destroyed;
  28197. var writableDestroyed = this._writableState && this._writableState.destroyed;
  28198. if (readableDestroyed || writableDestroyed) {
  28199. if (cb) {
  28200. cb(err);
  28201. } else if (err) {
  28202. if (!this._writableState) {
  28203. process.nextTick(emitErrorNT, this, err);
  28204. } else if (!this._writableState.errorEmitted) {
  28205. this._writableState.errorEmitted = true;
  28206. process.nextTick(emitErrorNT, this, err);
  28207. }
  28208. }
  28209. return this;
  28210. }
  28211. // we set destroyed to true before firing error callbacks in order
  28212. // to make it re-entrance safe in case destroy() is called within callbacks
  28213. if (this._readableState) {
  28214. this._readableState.destroyed = true;
  28215. }
  28216. // if this is a duplex stream mark the writable part as destroyed as well
  28217. if (this._writableState) {
  28218. this._writableState.destroyed = true;
  28219. }
  28220. this._destroy(err || null, function (err) {
  28221. if (!cb && err) {
  28222. if (!_this._writableState) {
  28223. process.nextTick(emitErrorAndCloseNT, _this, err);
  28224. } else if (!_this._writableState.errorEmitted) {
  28225. _this._writableState.errorEmitted = true;
  28226. process.nextTick(emitErrorAndCloseNT, _this, err);
  28227. } else {
  28228. process.nextTick(emitCloseNT, _this);
  28229. }
  28230. } else if (cb) {
  28231. process.nextTick(emitCloseNT, _this);
  28232. cb(err);
  28233. } else {
  28234. process.nextTick(emitCloseNT, _this);
  28235. }
  28236. });
  28237. return this;
  28238. }
  28239. function emitErrorAndCloseNT(self, err) {
  28240. emitErrorNT(self, err);
  28241. emitCloseNT(self);
  28242. }
  28243. function emitCloseNT(self) {
  28244. if (self._writableState && !self._writableState.emitClose) return;
  28245. if (self._readableState && !self._readableState.emitClose) return;
  28246. self.emit('close');
  28247. }
  28248. function undestroy() {
  28249. if (this._readableState) {
  28250. this._readableState.destroyed = false;
  28251. this._readableState.reading = false;
  28252. this._readableState.ended = false;
  28253. this._readableState.endEmitted = false;
  28254. }
  28255. if (this._writableState) {
  28256. this._writableState.destroyed = false;
  28257. this._writableState.ended = false;
  28258. this._writableState.ending = false;
  28259. this._writableState.finalCalled = false;
  28260. this._writableState.prefinished = false;
  28261. this._writableState.finished = false;
  28262. this._writableState.errorEmitted = false;
  28263. }
  28264. }
  28265. function emitErrorNT(self, err) {
  28266. self.emit('error', err);
  28267. }
  28268. function errorOrDestroy(stream, err) {
  28269. // We have tests that rely on errors being emitted
  28270. // in the same tick, so changing this is semver major.
  28271. // For now when you opt-in to autoDestroy we allow
  28272. // the error to be emitted nextTick. In a future
  28273. // semver major update we should change the default to this.
  28274. var rState = stream._readableState;
  28275. var wState = stream._writableState;
  28276. if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
  28277. }
  28278. module.exports = {
  28279. destroy: destroy,
  28280. undestroy: undestroy,
  28281. errorOrDestroy: errorOrDestroy
  28282. };
  28283. }).call(this)}).call(this,require('_process'))
  28284. },{"_process":467}],408:[function(require,module,exports){
  28285. // Ported from https://github.com/mafintosh/end-of-stream with
  28286. // permission from the author, Mathias Buus (@mafintosh).
  28287. 'use strict';
  28288. var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;
  28289. function once(callback) {
  28290. var called = false;
  28291. return function () {
  28292. if (called) return;
  28293. called = true;
  28294. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  28295. args[_key] = arguments[_key];
  28296. }
  28297. callback.apply(this, args);
  28298. };
  28299. }
  28300. function noop() {}
  28301. function isRequest(stream) {
  28302. return stream.setHeader && typeof stream.abort === 'function';
  28303. }
  28304. function eos(stream, opts, callback) {
  28305. if (typeof opts === 'function') return eos(stream, null, opts);
  28306. if (!opts) opts = {};
  28307. callback = once(callback || noop);
  28308. var readable = opts.readable || opts.readable !== false && stream.readable;
  28309. var writable = opts.writable || opts.writable !== false && stream.writable;
  28310. var onlegacyfinish = function onlegacyfinish() {
  28311. if (!stream.writable) onfinish();
  28312. };
  28313. var writableEnded = stream._writableState && stream._writableState.finished;
  28314. var onfinish = function onfinish() {
  28315. writable = false;
  28316. writableEnded = true;
  28317. if (!readable) callback.call(stream);
  28318. };
  28319. var readableEnded = stream._readableState && stream._readableState.endEmitted;
  28320. var onend = function onend() {
  28321. readable = false;
  28322. readableEnded = true;
  28323. if (!writable) callback.call(stream);
  28324. };
  28325. var onerror = function onerror(err) {
  28326. callback.call(stream, err);
  28327. };
  28328. var onclose = function onclose() {
  28329. var err;
  28330. if (readable && !readableEnded) {
  28331. if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
  28332. return callback.call(stream, err);
  28333. }
  28334. if (writable && !writableEnded) {
  28335. if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
  28336. return callback.call(stream, err);
  28337. }
  28338. };
  28339. var onrequest = function onrequest() {
  28340. stream.req.on('finish', onfinish);
  28341. };
  28342. if (isRequest(stream)) {
  28343. stream.on('complete', onfinish);
  28344. stream.on('abort', onclose);
  28345. if (stream.req) onrequest();else stream.on('request', onrequest);
  28346. } else if (writable && !stream._writableState) {
  28347. // legacy streams
  28348. stream.on('end', onlegacyfinish);
  28349. stream.on('close', onlegacyfinish);
  28350. }
  28351. stream.on('end', onend);
  28352. stream.on('finish', onfinish);
  28353. if (opts.error !== false) stream.on('error', onerror);
  28354. stream.on('close', onclose);
  28355. return function () {
  28356. stream.removeListener('complete', onfinish);
  28357. stream.removeListener('abort', onclose);
  28358. stream.removeListener('request', onrequest);
  28359. if (stream.req) stream.req.removeListener('finish', onfinish);
  28360. stream.removeListener('end', onlegacyfinish);
  28361. stream.removeListener('close', onlegacyfinish);
  28362. stream.removeListener('finish', onfinish);
  28363. stream.removeListener('end', onend);
  28364. stream.removeListener('error', onerror);
  28365. stream.removeListener('close', onclose);
  28366. };
  28367. }
  28368. module.exports = eos;
  28369. },{"../../../errors":399}],409:[function(require,module,exports){
  28370. module.exports = function () {
  28371. throw new Error('Readable.from is not available in the browser')
  28372. };
  28373. },{}],410:[function(require,module,exports){
  28374. // Ported from https://github.com/mafintosh/pump with
  28375. // permission from the author, Mathias Buus (@mafintosh).
  28376. 'use strict';
  28377. var eos;
  28378. function once(callback) {
  28379. var called = false;
  28380. return function () {
  28381. if (called) return;
  28382. called = true;
  28383. callback.apply(void 0, arguments);
  28384. };
  28385. }
  28386. var _require$codes = require('../../../errors').codes,
  28387. ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,
  28388. ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
  28389. function noop(err) {
  28390. // Rethrow the error if it exists to avoid swallowing it
  28391. if (err) throw err;
  28392. }
  28393. function isRequest(stream) {
  28394. return stream.setHeader && typeof stream.abort === 'function';
  28395. }
  28396. function destroyer(stream, reading, writing, callback) {
  28397. callback = once(callback);
  28398. var closed = false;
  28399. stream.on('close', function () {
  28400. closed = true;
  28401. });
  28402. if (eos === undefined) eos = require('./end-of-stream');
  28403. eos(stream, {
  28404. readable: reading,
  28405. writable: writing
  28406. }, function (err) {
  28407. if (err) return callback(err);
  28408. closed = true;
  28409. callback();
  28410. });
  28411. var destroyed = false;
  28412. return function (err) {
  28413. if (closed) return;
  28414. if (destroyed) return;
  28415. destroyed = true;
  28416. // request.destroy just do .end - .abort is what we want
  28417. if (isRequest(stream)) return stream.abort();
  28418. if (typeof stream.destroy === 'function') return stream.destroy();
  28419. callback(err || new ERR_STREAM_DESTROYED('pipe'));
  28420. };
  28421. }
  28422. function call(fn) {
  28423. fn();
  28424. }
  28425. function pipe(from, to) {
  28426. return from.pipe(to);
  28427. }
  28428. function popCallback(streams) {
  28429. if (!streams.length) return noop;
  28430. if (typeof streams[streams.length - 1] !== 'function') return noop;
  28431. return streams.pop();
  28432. }
  28433. function pipeline() {
  28434. for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {
  28435. streams[_key] = arguments[_key];
  28436. }
  28437. var callback = popCallback(streams);
  28438. if (Array.isArray(streams[0])) streams = streams[0];
  28439. if (streams.length < 2) {
  28440. throw new ERR_MISSING_ARGS('streams');
  28441. }
  28442. var error;
  28443. var destroys = streams.map(function (stream, i) {
  28444. var reading = i < streams.length - 1;
  28445. var writing = i > 0;
  28446. return destroyer(stream, reading, writing, function (err) {
  28447. if (!error) error = err;
  28448. if (err) destroys.forEach(call);
  28449. if (reading) return;
  28450. destroys.forEach(call);
  28451. callback(error);
  28452. });
  28453. });
  28454. return streams.reduce(pipe);
  28455. }
  28456. module.exports = pipeline;
  28457. },{"../../../errors":399,"./end-of-stream":408}],411:[function(require,module,exports){
  28458. 'use strict';
  28459. var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE;
  28460. function highWaterMarkFrom(options, isDuplex, duplexKey) {
  28461. return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
  28462. }
  28463. function getHighWaterMark(state, options, duplexKey, isDuplex) {
  28464. var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
  28465. if (hwm != null) {
  28466. if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
  28467. var name = isDuplex ? duplexKey : 'highWaterMark';
  28468. throw new ERR_INVALID_OPT_VALUE(name, hwm);
  28469. }
  28470. return Math.floor(hwm);
  28471. }
  28472. // Default value
  28473. return state.objectMode ? 16 : 16 * 1024;
  28474. }
  28475. module.exports = {
  28476. getHighWaterMark: getHighWaterMark
  28477. };
  28478. },{"../../../errors":399}],412:[function(require,module,exports){
  28479. arguments[4][393][0].apply(exports,arguments)
  28480. },{"dup":393,"events":344}],413:[function(require,module,exports){
  28481. // Copyright Joyent, Inc. and other Node contributors.
  28482. //
  28483. // Permission is hereby granted, free of charge, to any person obtaining a
  28484. // copy of this software and associated documentation files (the
  28485. // "Software"), to deal in the Software without restriction, including
  28486. // without limitation the rights to use, copy, modify, merge, publish,
  28487. // distribute, sublicense, and/or sell copies of the Software, and to permit
  28488. // persons to whom the Software is furnished to do so, subject to the
  28489. // following conditions:
  28490. //
  28491. // The above copyright notice and this permission notice shall be included
  28492. // in all copies or substantial portions of the Software.
  28493. //
  28494. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  28495. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  28496. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  28497. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  28498. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  28499. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  28500. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  28501. 'use strict';
  28502. /*<replacement>*/
  28503. var Buffer = require('safe-buffer').Buffer;
  28504. /*</replacement>*/
  28505. var isEncoding = Buffer.isEncoding || function (encoding) {
  28506. encoding = '' + encoding;
  28507. switch (encoding && encoding.toLowerCase()) {
  28508. case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
  28509. return true;
  28510. default:
  28511. return false;
  28512. }
  28513. };
  28514. function _normalizeEncoding(enc) {
  28515. if (!enc) return 'utf8';
  28516. var retried;
  28517. while (true) {
  28518. switch (enc) {
  28519. case 'utf8':
  28520. case 'utf-8':
  28521. return 'utf8';
  28522. case 'ucs2':
  28523. case 'ucs-2':
  28524. case 'utf16le':
  28525. case 'utf-16le':
  28526. return 'utf16le';
  28527. case 'latin1':
  28528. case 'binary':
  28529. return 'latin1';
  28530. case 'base64':
  28531. case 'ascii':
  28532. case 'hex':
  28533. return enc;
  28534. default:
  28535. if (retried) return; // undefined
  28536. enc = ('' + enc).toLowerCase();
  28537. retried = true;
  28538. }
  28539. }
  28540. };
  28541. // Do not cache `Buffer.isEncoding` when checking encoding names as some
  28542. // modules monkey-patch it to support additional encodings
  28543. function normalizeEncoding(enc) {
  28544. var nenc = _normalizeEncoding(enc);
  28545. if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
  28546. return nenc || enc;
  28547. }
  28548. // StringDecoder provides an interface for efficiently splitting a series of
  28549. // buffers into a series of JS strings without breaking apart multi-byte
  28550. // characters.
  28551. exports.StringDecoder = StringDecoder;
  28552. function StringDecoder(encoding) {
  28553. this.encoding = normalizeEncoding(encoding);
  28554. var nb;
  28555. switch (this.encoding) {
  28556. case 'utf16le':
  28557. this.text = utf16Text;
  28558. this.end = utf16End;
  28559. nb = 4;
  28560. break;
  28561. case 'utf8':
  28562. this.fillLast = utf8FillLast;
  28563. nb = 4;
  28564. break;
  28565. case 'base64':
  28566. this.text = base64Text;
  28567. this.end = base64End;
  28568. nb = 3;
  28569. break;
  28570. default:
  28571. this.write = simpleWrite;
  28572. this.end = simpleEnd;
  28573. return;
  28574. }
  28575. this.lastNeed = 0;
  28576. this.lastTotal = 0;
  28577. this.lastChar = Buffer.allocUnsafe(nb);
  28578. }
  28579. StringDecoder.prototype.write = function (buf) {
  28580. if (buf.length === 0) return '';
  28581. var r;
  28582. var i;
  28583. if (this.lastNeed) {
  28584. r = this.fillLast(buf);
  28585. if (r === undefined) return '';
  28586. i = this.lastNeed;
  28587. this.lastNeed = 0;
  28588. } else {
  28589. i = 0;
  28590. }
  28591. if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
  28592. return r || '';
  28593. };
  28594. StringDecoder.prototype.end = utf8End;
  28595. // Returns only complete characters in a Buffer
  28596. StringDecoder.prototype.text = utf8Text;
  28597. // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
  28598. StringDecoder.prototype.fillLast = function (buf) {
  28599. if (this.lastNeed <= buf.length) {
  28600. buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
  28601. return this.lastChar.toString(this.encoding, 0, this.lastTotal);
  28602. }
  28603. buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
  28604. this.lastNeed -= buf.length;
  28605. };
  28606. // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
  28607. // continuation byte. If an invalid byte is detected, -2 is returned.
  28608. function utf8CheckByte(byte) {
  28609. if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
  28610. return byte >> 6 === 0x02 ? -1 : -2;
  28611. }
  28612. // Checks at most 3 bytes at the end of a Buffer in order to detect an
  28613. // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
  28614. // needed to complete the UTF-8 character (if applicable) are returned.
  28615. function utf8CheckIncomplete(self, buf, i) {
  28616. var j = buf.length - 1;
  28617. if (j < i) return 0;
  28618. var nb = utf8CheckByte(buf[j]);
  28619. if (nb >= 0) {
  28620. if (nb > 0) self.lastNeed = nb - 1;
  28621. return nb;
  28622. }
  28623. if (--j < i || nb === -2) return 0;
  28624. nb = utf8CheckByte(buf[j]);
  28625. if (nb >= 0) {
  28626. if (nb > 0) self.lastNeed = nb - 2;
  28627. return nb;
  28628. }
  28629. if (--j < i || nb === -2) return 0;
  28630. nb = utf8CheckByte(buf[j]);
  28631. if (nb >= 0) {
  28632. if (nb > 0) {
  28633. if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
  28634. }
  28635. return nb;
  28636. }
  28637. return 0;
  28638. }
  28639. // Validates as many continuation bytes for a multi-byte UTF-8 character as
  28640. // needed or are available. If we see a non-continuation byte where we expect
  28641. // one, we "replace" the validated continuation bytes we've seen so far with
  28642. // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
  28643. // behavior. The continuation byte check is included three times in the case
  28644. // where all of the continuation bytes for a character exist in the same buffer.
  28645. // It is also done this way as a slight performance increase instead of using a
  28646. // loop.
  28647. function utf8CheckExtraBytes(self, buf, p) {
  28648. if ((buf[0] & 0xC0) !== 0x80) {
  28649. self.lastNeed = 0;
  28650. return '\ufffd';
  28651. }
  28652. if (self.lastNeed > 1 && buf.length > 1) {
  28653. if ((buf[1] & 0xC0) !== 0x80) {
  28654. self.lastNeed = 1;
  28655. return '\ufffd';
  28656. }
  28657. if (self.lastNeed > 2 && buf.length > 2) {
  28658. if ((buf[2] & 0xC0) !== 0x80) {
  28659. self.lastNeed = 2;
  28660. return '\ufffd';
  28661. }
  28662. }
  28663. }
  28664. }
  28665. // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
  28666. function utf8FillLast(buf) {
  28667. var p = this.lastTotal - this.lastNeed;
  28668. var r = utf8CheckExtraBytes(this, buf, p);
  28669. if (r !== undefined) return r;
  28670. if (this.lastNeed <= buf.length) {
  28671. buf.copy(this.lastChar, p, 0, this.lastNeed);
  28672. return this.lastChar.toString(this.encoding, 0, this.lastTotal);
  28673. }
  28674. buf.copy(this.lastChar, p, 0, buf.length);
  28675. this.lastNeed -= buf.length;
  28676. }
  28677. // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
  28678. // partial character, the character's bytes are buffered until the required
  28679. // number of bytes are available.
  28680. function utf8Text(buf, i) {
  28681. var total = utf8CheckIncomplete(this, buf, i);
  28682. if (!this.lastNeed) return buf.toString('utf8', i);
  28683. this.lastTotal = total;
  28684. var end = buf.length - (total - this.lastNeed);
  28685. buf.copy(this.lastChar, 0, end);
  28686. return buf.toString('utf8', i, end);
  28687. }
  28688. // For UTF-8, a replacement character is added when ending on a partial
  28689. // character.
  28690. function utf8End(buf) {
  28691. var r = buf && buf.length ? this.write(buf) : '';
  28692. if (this.lastNeed) return r + '\ufffd';
  28693. return r;
  28694. }
  28695. // UTF-16LE typically needs two bytes per character, but even if we have an even
  28696. // number of bytes available, we need to check if we end on a leading/high
  28697. // surrogate. In that case, we need to wait for the next two bytes in order to
  28698. // decode the last character properly.
  28699. function utf16Text(buf, i) {
  28700. if ((buf.length - i) % 2 === 0) {
  28701. var r = buf.toString('utf16le', i);
  28702. if (r) {
  28703. var c = r.charCodeAt(r.length - 1);
  28704. if (c >= 0xD800 && c <= 0xDBFF) {
  28705. this.lastNeed = 2;
  28706. this.lastTotal = 4;
  28707. this.lastChar[0] = buf[buf.length - 2];
  28708. this.lastChar[1] = buf[buf.length - 1];
  28709. return r.slice(0, -1);
  28710. }
  28711. }
  28712. return r;
  28713. }
  28714. this.lastNeed = 1;
  28715. this.lastTotal = 2;
  28716. this.lastChar[0] = buf[buf.length - 1];
  28717. return buf.toString('utf16le', i, buf.length - 1);
  28718. }
  28719. // For UTF-16LE we do not explicitly append special replacement characters if we
  28720. // end on a partial character, we simply let v8 handle that.
  28721. function utf16End(buf) {
  28722. var r = buf && buf.length ? this.write(buf) : '';
  28723. if (this.lastNeed) {
  28724. var end = this.lastTotal - this.lastNeed;
  28725. return r + this.lastChar.toString('utf16le', 0, end);
  28726. }
  28727. return r;
  28728. }
  28729. function base64Text(buf, i) {
  28730. var n = (buf.length - i) % 3;
  28731. if (n === 0) return buf.toString('base64', i);
  28732. this.lastNeed = 3 - n;
  28733. this.lastTotal = 3;
  28734. if (n === 1) {
  28735. this.lastChar[0] = buf[buf.length - 1];
  28736. } else {
  28737. this.lastChar[0] = buf[buf.length - 2];
  28738. this.lastChar[1] = buf[buf.length - 1];
  28739. }
  28740. return buf.toString('base64', i, buf.length - n);
  28741. }
  28742. function base64End(buf) {
  28743. var r = buf && buf.length ? this.write(buf) : '';
  28744. if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
  28745. return r;
  28746. }
  28747. // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
  28748. function simpleWrite(buf) {
  28749. return buf.toString(this.encoding);
  28750. }
  28751. function simpleEnd(buf) {
  28752. return buf && buf.length ? this.write(buf) : '';
  28753. }
  28754. },{"safe-buffer":396}],414:[function(require,module,exports){
  28755. (function (setImmediate,clearImmediate){(function (){
  28756. var nextTick = require('process/browser.js').nextTick;
  28757. var apply = Function.prototype.apply;
  28758. var slice = Array.prototype.slice;
  28759. var immediateIds = {};
  28760. var nextImmediateId = 0;
  28761. // DOM APIs, for completeness
  28762. exports.setTimeout = function() {
  28763. return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
  28764. };
  28765. exports.setInterval = function() {
  28766. return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
  28767. };
  28768. exports.clearTimeout =
  28769. exports.clearInterval = function(timeout) { timeout.close(); };
  28770. function Timeout(id, clearFn) {
  28771. this._id = id;
  28772. this._clearFn = clearFn;
  28773. }
  28774. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  28775. Timeout.prototype.close = function() {
  28776. this._clearFn.call(window, this._id);
  28777. };
  28778. // Does not start the time, just sets up the members needed.
  28779. exports.enroll = function(item, msecs) {
  28780. clearTimeout(item._idleTimeoutId);
  28781. item._idleTimeout = msecs;
  28782. };
  28783. exports.unenroll = function(item) {
  28784. clearTimeout(item._idleTimeoutId);
  28785. item._idleTimeout = -1;
  28786. };
  28787. exports._unrefActive = exports.active = function(item) {
  28788. clearTimeout(item._idleTimeoutId);
  28789. var msecs = item._idleTimeout;
  28790. if (msecs >= 0) {
  28791. item._idleTimeoutId = setTimeout(function onTimeout() {
  28792. if (item._onTimeout)
  28793. item._onTimeout();
  28794. }, msecs);
  28795. }
  28796. };
  28797. // That's not how node.js implements it but the exposed api is the same.
  28798. exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
  28799. var id = nextImmediateId++;
  28800. var args = arguments.length < 2 ? false : slice.call(arguments, 1);
  28801. immediateIds[id] = true;
  28802. nextTick(function onNextTick() {
  28803. if (immediateIds[id]) {
  28804. // fn.call() is faster so we optimize for the common use-case
  28805. // @see http://jsperf.com/call-apply-segu
  28806. if (args) {
  28807. fn.apply(null, args);
  28808. } else {
  28809. fn.call(null);
  28810. }
  28811. // Prevent ids from leaking
  28812. exports.clearImmediate(id);
  28813. }
  28814. });
  28815. return id;
  28816. };
  28817. exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
  28818. delete immediateIds[id];
  28819. };
  28820. }).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate)
  28821. },{"process/browser.js":381,"timers":414}],415:[function(require,module,exports){
  28822. var Buffer = require('buffer').Buffer
  28823. module.exports = function (buf) {
  28824. // If the buffer is backed by a Uint8Array, a faster version will work
  28825. if (buf instanceof Uint8Array) {
  28826. // If the buffer isn't a subarray, return the underlying ArrayBuffer
  28827. if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
  28828. return buf.buffer
  28829. } else if (typeof buf.buffer.slice === 'function') {
  28830. // Otherwise we need to get a proper copy
  28831. return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength)
  28832. }
  28833. }
  28834. if (Buffer.isBuffer(buf)) {
  28835. // This is the slow version that will work with any Buffer
  28836. // implementation (even in old browsers)
  28837. var arrayCopy = new Uint8Array(buf.length)
  28838. var len = buf.length
  28839. for (var i = 0; i < len; i++) {
  28840. arrayCopy[i] = buf[i]
  28841. }
  28842. return arrayCopy.buffer
  28843. } else {
  28844. throw new Error('Argument must be a Buffer')
  28845. }
  28846. }
  28847. },{"buffer":90}],416:[function(require,module,exports){
  28848. (function (global){(function (){
  28849. /**
  28850. * Module exports.
  28851. */
  28852. module.exports = deprecate;
  28853. /**
  28854. * Mark that a method should not be used.
  28855. * Returns a modified function which warns once by default.
  28856. *
  28857. * If `localStorage.noDeprecation = true` is set, then it is a no-op.
  28858. *
  28859. * If `localStorage.throwDeprecation = true` is set, then deprecated functions
  28860. * will throw an Error when invoked.
  28861. *
  28862. * If `localStorage.traceDeprecation = true` is set, then deprecated functions
  28863. * will invoke `console.trace()` instead of `console.error()`.
  28864. *
  28865. * @param {Function} fn - the function to deprecate
  28866. * @param {String} msg - the string to print to the console when `fn` is invoked
  28867. * @returns {Function} a new "deprecated" version of `fn`
  28868. * @api public
  28869. */
  28870. function deprecate (fn, msg) {
  28871. if (config('noDeprecation')) {
  28872. return fn;
  28873. }
  28874. var warned = false;
  28875. function deprecated() {
  28876. if (!warned) {
  28877. if (config('throwDeprecation')) {
  28878. throw new Error(msg);
  28879. } else if (config('traceDeprecation')) {
  28880. console.trace(msg);
  28881. } else {
  28882. console.warn(msg);
  28883. }
  28884. warned = true;
  28885. }
  28886. return fn.apply(this, arguments);
  28887. }
  28888. return deprecated;
  28889. }
  28890. /**
  28891. * Checks `localStorage` for boolean values for the given `name`.
  28892. *
  28893. * @param {String} name
  28894. * @returns {Boolean}
  28895. * @api private
  28896. */
  28897. function config (name) {
  28898. // accessing global.localStorage can trigger a DOMException in sandboxed iframes
  28899. try {
  28900. if (!global.localStorage) return false;
  28901. } catch (_) {
  28902. return false;
  28903. }
  28904. var val = global.localStorage[name];
  28905. if (null == val) return false;
  28906. return String(val).toLowerCase() === 'true';
  28907. }
  28908. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  28909. },{}],417:[function(require,module,exports){
  28910. arguments[4][84][0].apply(exports,arguments)
  28911. },{"dup":84}],418:[function(require,module,exports){
  28912. // Currently in sync with Node.js lib/internal/util/types.js
  28913. // https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9
  28914. 'use strict';
  28915. var isArgumentsObject = require('is-arguments');
  28916. var isGeneratorFunction = require('is-generator-function');
  28917. var whichTypedArray = require('which-typed-array');
  28918. var isTypedArray = require('is-typed-array');
  28919. function uncurryThis(f) {
  28920. return f.call.bind(f);
  28921. }
  28922. var BigIntSupported = typeof BigInt !== 'undefined';
  28923. var SymbolSupported = typeof Symbol !== 'undefined';
  28924. var ObjectToString = uncurryThis(Object.prototype.toString);
  28925. var numberValue = uncurryThis(Number.prototype.valueOf);
  28926. var stringValue = uncurryThis(String.prototype.valueOf);
  28927. var booleanValue = uncurryThis(Boolean.prototype.valueOf);
  28928. if (BigIntSupported) {
  28929. var bigIntValue = uncurryThis(BigInt.prototype.valueOf);
  28930. }
  28931. if (SymbolSupported) {
  28932. var symbolValue = uncurryThis(Symbol.prototype.valueOf);
  28933. }
  28934. function checkBoxedPrimitive(value, prototypeValueOf) {
  28935. if (typeof value !== 'object') {
  28936. return false;
  28937. }
  28938. try {
  28939. prototypeValueOf(value);
  28940. return true;
  28941. } catch(e) {
  28942. return false;
  28943. }
  28944. }
  28945. exports.isArgumentsObject = isArgumentsObject;
  28946. exports.isGeneratorFunction = isGeneratorFunction;
  28947. exports.isTypedArray = isTypedArray;
  28948. // Taken from here and modified for better browser support
  28949. // https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js
  28950. function isPromise(input) {
  28951. return (
  28952. (
  28953. typeof Promise !== 'undefined' &&
  28954. input instanceof Promise
  28955. ) ||
  28956. (
  28957. input !== null &&
  28958. typeof input === 'object' &&
  28959. typeof input.then === 'function' &&
  28960. typeof input.catch === 'function'
  28961. )
  28962. );
  28963. }
  28964. exports.isPromise = isPromise;
  28965. function isArrayBufferView(value) {
  28966. if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
  28967. return ArrayBuffer.isView(value);
  28968. }
  28969. return (
  28970. isTypedArray(value) ||
  28971. isDataView(value)
  28972. );
  28973. }
  28974. exports.isArrayBufferView = isArrayBufferView;
  28975. function isUint8Array(value) {
  28976. return whichTypedArray(value) === 'Uint8Array';
  28977. }
  28978. exports.isUint8Array = isUint8Array;
  28979. function isUint8ClampedArray(value) {
  28980. return whichTypedArray(value) === 'Uint8ClampedArray';
  28981. }
  28982. exports.isUint8ClampedArray = isUint8ClampedArray;
  28983. function isUint16Array(value) {
  28984. return whichTypedArray(value) === 'Uint16Array';
  28985. }
  28986. exports.isUint16Array = isUint16Array;
  28987. function isUint32Array(value) {
  28988. return whichTypedArray(value) === 'Uint32Array';
  28989. }
  28990. exports.isUint32Array = isUint32Array;
  28991. function isInt8Array(value) {
  28992. return whichTypedArray(value) === 'Int8Array';
  28993. }
  28994. exports.isInt8Array = isInt8Array;
  28995. function isInt16Array(value) {
  28996. return whichTypedArray(value) === 'Int16Array';
  28997. }
  28998. exports.isInt16Array = isInt16Array;
  28999. function isInt32Array(value) {
  29000. return whichTypedArray(value) === 'Int32Array';
  29001. }
  29002. exports.isInt32Array = isInt32Array;
  29003. function isFloat32Array(value) {
  29004. return whichTypedArray(value) === 'Float32Array';
  29005. }
  29006. exports.isFloat32Array = isFloat32Array;
  29007. function isFloat64Array(value) {
  29008. return whichTypedArray(value) === 'Float64Array';
  29009. }
  29010. exports.isFloat64Array = isFloat64Array;
  29011. function isBigInt64Array(value) {
  29012. return whichTypedArray(value) === 'BigInt64Array';
  29013. }
  29014. exports.isBigInt64Array = isBigInt64Array;
  29015. function isBigUint64Array(value) {
  29016. return whichTypedArray(value) === 'BigUint64Array';
  29017. }
  29018. exports.isBigUint64Array = isBigUint64Array;
  29019. function isMapToString(value) {
  29020. return ObjectToString(value) === '[object Map]';
  29021. }
  29022. isMapToString.working = (
  29023. typeof Map !== 'undefined' &&
  29024. isMapToString(new Map())
  29025. );
  29026. function isMap(value) {
  29027. if (typeof Map === 'undefined') {
  29028. return false;
  29029. }
  29030. return isMapToString.working
  29031. ? isMapToString(value)
  29032. : value instanceof Map;
  29033. }
  29034. exports.isMap = isMap;
  29035. function isSetToString(value) {
  29036. return ObjectToString(value) === '[object Set]';
  29037. }
  29038. isSetToString.working = (
  29039. typeof Set !== 'undefined' &&
  29040. isSetToString(new Set())
  29041. );
  29042. function isSet(value) {
  29043. if (typeof Set === 'undefined') {
  29044. return false;
  29045. }
  29046. return isSetToString.working
  29047. ? isSetToString(value)
  29048. : value instanceof Set;
  29049. }
  29050. exports.isSet = isSet;
  29051. function isWeakMapToString(value) {
  29052. return ObjectToString(value) === '[object WeakMap]';
  29053. }
  29054. isWeakMapToString.working = (
  29055. typeof WeakMap !== 'undefined' &&
  29056. isWeakMapToString(new WeakMap())
  29057. );
  29058. function isWeakMap(value) {
  29059. if (typeof WeakMap === 'undefined') {
  29060. return false;
  29061. }
  29062. return isWeakMapToString.working
  29063. ? isWeakMapToString(value)
  29064. : value instanceof WeakMap;
  29065. }
  29066. exports.isWeakMap = isWeakMap;
  29067. function isWeakSetToString(value) {
  29068. return ObjectToString(value) === '[object WeakSet]';
  29069. }
  29070. isWeakSetToString.working = (
  29071. typeof WeakSet !== 'undefined' &&
  29072. isWeakSetToString(new WeakSet())
  29073. );
  29074. function isWeakSet(value) {
  29075. return isWeakSetToString(value);
  29076. }
  29077. exports.isWeakSet = isWeakSet;
  29078. function isArrayBufferToString(value) {
  29079. return ObjectToString(value) === '[object ArrayBuffer]';
  29080. }
  29081. isArrayBufferToString.working = (
  29082. typeof ArrayBuffer !== 'undefined' &&
  29083. isArrayBufferToString(new ArrayBuffer())
  29084. );
  29085. function isArrayBuffer(value) {
  29086. if (typeof ArrayBuffer === 'undefined') {
  29087. return false;
  29088. }
  29089. return isArrayBufferToString.working
  29090. ? isArrayBufferToString(value)
  29091. : value instanceof ArrayBuffer;
  29092. }
  29093. exports.isArrayBuffer = isArrayBuffer;
  29094. function isDataViewToString(value) {
  29095. return ObjectToString(value) === '[object DataView]';
  29096. }
  29097. isDataViewToString.working = (
  29098. typeof ArrayBuffer !== 'undefined' &&
  29099. typeof DataView !== 'undefined' &&
  29100. isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1))
  29101. );
  29102. function isDataView(value) {
  29103. if (typeof DataView === 'undefined') {
  29104. return false;
  29105. }
  29106. return isDataViewToString.working
  29107. ? isDataViewToString(value)
  29108. : value instanceof DataView;
  29109. }
  29110. exports.isDataView = isDataView;
  29111. // Store a copy of SharedArrayBuffer in case it's deleted elsewhere
  29112. var SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined;
  29113. function isSharedArrayBufferToString(value) {
  29114. return ObjectToString(value) === '[object SharedArrayBuffer]';
  29115. }
  29116. function isSharedArrayBuffer(value) {
  29117. if (typeof SharedArrayBufferCopy === 'undefined') {
  29118. return false;
  29119. }
  29120. if (typeof isSharedArrayBufferToString.working === 'undefined') {
  29121. isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy());
  29122. }
  29123. return isSharedArrayBufferToString.working
  29124. ? isSharedArrayBufferToString(value)
  29125. : value instanceof SharedArrayBufferCopy;
  29126. }
  29127. exports.isSharedArrayBuffer = isSharedArrayBuffer;
  29128. function isAsyncFunction(value) {
  29129. return ObjectToString(value) === '[object AsyncFunction]';
  29130. }
  29131. exports.isAsyncFunction = isAsyncFunction;
  29132. function isMapIterator(value) {
  29133. return ObjectToString(value) === '[object Map Iterator]';
  29134. }
  29135. exports.isMapIterator = isMapIterator;
  29136. function isSetIterator(value) {
  29137. return ObjectToString(value) === '[object Set Iterator]';
  29138. }
  29139. exports.isSetIterator = isSetIterator;
  29140. function isGeneratorObject(value) {
  29141. return ObjectToString(value) === '[object Generator]';
  29142. }
  29143. exports.isGeneratorObject = isGeneratorObject;
  29144. function isWebAssemblyCompiledModule(value) {
  29145. return ObjectToString(value) === '[object WebAssembly.Module]';
  29146. }
  29147. exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;
  29148. function isNumberObject(value) {
  29149. return checkBoxedPrimitive(value, numberValue);
  29150. }
  29151. exports.isNumberObject = isNumberObject;
  29152. function isStringObject(value) {
  29153. return checkBoxedPrimitive(value, stringValue);
  29154. }
  29155. exports.isStringObject = isStringObject;
  29156. function isBooleanObject(value) {
  29157. return checkBoxedPrimitive(value, booleanValue);
  29158. }
  29159. exports.isBooleanObject = isBooleanObject;
  29160. function isBigIntObject(value) {
  29161. return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);
  29162. }
  29163. exports.isBigIntObject = isBigIntObject;
  29164. function isSymbolObject(value) {
  29165. return SymbolSupported && checkBoxedPrimitive(value, symbolValue);
  29166. }
  29167. exports.isSymbolObject = isSymbolObject;
  29168. function isBoxedPrimitive(value) {
  29169. return (
  29170. isNumberObject(value) ||
  29171. isStringObject(value) ||
  29172. isBooleanObject(value) ||
  29173. isBigIntObject(value) ||
  29174. isSymbolObject(value)
  29175. );
  29176. }
  29177. exports.isBoxedPrimitive = isBoxedPrimitive;
  29178. function isAnyArrayBuffer(value) {
  29179. return typeof Uint8Array !== 'undefined' && (
  29180. isArrayBuffer(value) ||
  29181. isSharedArrayBuffer(value)
  29182. );
  29183. }
  29184. exports.isAnyArrayBuffer = isAnyArrayBuffer;
  29185. ['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) {
  29186. Object.defineProperty(exports, method, {
  29187. enumerable: false,
  29188. value: function() {
  29189. throw new Error(method + ' is not supported in userland');
  29190. }
  29191. });
  29192. });
  29193. },{"is-arguments":365,"is-generator-function":368,"is-typed-array":369,"which-typed-array":420}],419:[function(require,module,exports){
  29194. (function (process){(function (){
  29195. // Copyright Joyent, Inc. and other Node contributors.
  29196. //
  29197. // Permission is hereby granted, free of charge, to any person obtaining a
  29198. // copy of this software and associated documentation files (the
  29199. // "Software"), to deal in the Software without restriction, including
  29200. // without limitation the rights to use, copy, modify, merge, publish,
  29201. // distribute, sublicense, and/or sell copies of the Software, and to permit
  29202. // persons to whom the Software is furnished to do so, subject to the
  29203. // following conditions:
  29204. //
  29205. // The above copyright notice and this permission notice shall be included
  29206. // in all copies or substantial portions of the Software.
  29207. //
  29208. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  29209. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  29210. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  29211. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  29212. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  29213. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  29214. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  29215. var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||
  29216. function getOwnPropertyDescriptors(obj) {
  29217. var keys = Object.keys(obj);
  29218. var descriptors = {};
  29219. for (var i = 0; i < keys.length; i++) {
  29220. descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);
  29221. }
  29222. return descriptors;
  29223. };
  29224. var formatRegExp = /%[sdj%]/g;
  29225. exports.format = function(f) {
  29226. if (!isString(f)) {
  29227. var objects = [];
  29228. for (var i = 0; i < arguments.length; i++) {
  29229. objects.push(inspect(arguments[i]));
  29230. }
  29231. return objects.join(' ');
  29232. }
  29233. var i = 1;
  29234. var args = arguments;
  29235. var len = args.length;
  29236. var str = String(f).replace(formatRegExp, function(x) {
  29237. if (x === '%%') return '%';
  29238. if (i >= len) return x;
  29239. switch (x) {
  29240. case '%s': return String(args[i++]);
  29241. case '%d': return Number(args[i++]);
  29242. case '%j':
  29243. try {
  29244. return JSON.stringify(args[i++]);
  29245. } catch (_) {
  29246. return '[Circular]';
  29247. }
  29248. default:
  29249. return x;
  29250. }
  29251. });
  29252. for (var x = args[i]; i < len; x = args[++i]) {
  29253. if (isNull(x) || !isObject(x)) {
  29254. str += ' ' + x;
  29255. } else {
  29256. str += ' ' + inspect(x);
  29257. }
  29258. }
  29259. return str;
  29260. };
  29261. // Mark that a method should not be used.
  29262. // Returns a modified function which warns once by default.
  29263. // If --no-deprecation is set, then it is a no-op.
  29264. exports.deprecate = function(fn, msg) {
  29265. if (typeof process !== 'undefined' && process.noDeprecation === true) {
  29266. return fn;
  29267. }
  29268. // Allow for deprecating things in the process of starting up.
  29269. if (typeof process === 'undefined') {
  29270. return function() {
  29271. return exports.deprecate(fn, msg).apply(this, arguments);
  29272. };
  29273. }
  29274. var warned = false;
  29275. function deprecated() {
  29276. if (!warned) {
  29277. if (process.throwDeprecation) {
  29278. throw new Error(msg);
  29279. } else if (process.traceDeprecation) {
  29280. console.trace(msg);
  29281. } else {
  29282. console.error(msg);
  29283. }
  29284. warned = true;
  29285. }
  29286. return fn.apply(this, arguments);
  29287. }
  29288. return deprecated;
  29289. };
  29290. var debugs = {};
  29291. var debugEnvRegex = /^$/;
  29292. if (process.env.NODE_DEBUG) {
  29293. var debugEnv = process.env.NODE_DEBUG;
  29294. debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, '\\$&')
  29295. .replace(/\*/g, '.*')
  29296. .replace(/,/g, '$|^')
  29297. .toUpperCase();
  29298. debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i');
  29299. }
  29300. exports.debuglog = function(set) {
  29301. set = set.toUpperCase();
  29302. if (!debugs[set]) {
  29303. if (debugEnvRegex.test(set)) {
  29304. var pid = process.pid;
  29305. debugs[set] = function() {
  29306. var msg = exports.format.apply(exports, arguments);
  29307. console.error('%s %d: %s', set, pid, msg);
  29308. };
  29309. } else {
  29310. debugs[set] = function() {};
  29311. }
  29312. }
  29313. return debugs[set];
  29314. };
  29315. /**
  29316. * Echos the value of a value. Trys to print the value out
  29317. * in the best way possible given the different types.
  29318. *
  29319. * @param {Object} obj The object to print out.
  29320. * @param {Object} opts Optional options object that alters the output.
  29321. */
  29322. /* legacy: obj, showHidden, depth, colors*/
  29323. function inspect(obj, opts) {
  29324. // default options
  29325. var ctx = {
  29326. seen: [],
  29327. stylize: stylizeNoColor
  29328. };
  29329. // legacy...
  29330. if (arguments.length >= 3) ctx.depth = arguments[2];
  29331. if (arguments.length >= 4) ctx.colors = arguments[3];
  29332. if (isBoolean(opts)) {
  29333. // legacy...
  29334. ctx.showHidden = opts;
  29335. } else if (opts) {
  29336. // got an "options" object
  29337. exports._extend(ctx, opts);
  29338. }
  29339. // set default options
  29340. if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
  29341. if (isUndefined(ctx.depth)) ctx.depth = 2;
  29342. if (isUndefined(ctx.colors)) ctx.colors = false;
  29343. if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
  29344. if (ctx.colors) ctx.stylize = stylizeWithColor;
  29345. return formatValue(ctx, obj, ctx.depth);
  29346. }
  29347. exports.inspect = inspect;
  29348. // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
  29349. inspect.colors = {
  29350. 'bold' : [1, 22],
  29351. 'italic' : [3, 23],
  29352. 'underline' : [4, 24],
  29353. 'inverse' : [7, 27],
  29354. 'white' : [37, 39],
  29355. 'grey' : [90, 39],
  29356. 'black' : [30, 39],
  29357. 'blue' : [34, 39],
  29358. 'cyan' : [36, 39],
  29359. 'green' : [32, 39],
  29360. 'magenta' : [35, 39],
  29361. 'red' : [31, 39],
  29362. 'yellow' : [33, 39]
  29363. };
  29364. // Don't use 'blue' not visible on cmd.exe
  29365. inspect.styles = {
  29366. 'special': 'cyan',
  29367. 'number': 'yellow',
  29368. 'boolean': 'yellow',
  29369. 'undefined': 'grey',
  29370. 'null': 'bold',
  29371. 'string': 'green',
  29372. 'date': 'magenta',
  29373. // "name": intentionally not styling
  29374. 'regexp': 'red'
  29375. };
  29376. function stylizeWithColor(str, styleType) {
  29377. var style = inspect.styles[styleType];
  29378. if (style) {
  29379. return '\u001b[' + inspect.colors[style][0] + 'm' + str +
  29380. '\u001b[' + inspect.colors[style][1] + 'm';
  29381. } else {
  29382. return str;
  29383. }
  29384. }
  29385. function stylizeNoColor(str, styleType) {
  29386. return str;
  29387. }
  29388. function arrayToHash(array) {
  29389. var hash = {};
  29390. array.forEach(function(val, idx) {
  29391. hash[val] = true;
  29392. });
  29393. return hash;
  29394. }
  29395. function formatValue(ctx, value, recurseTimes) {
  29396. // Provide a hook for user-specified inspect functions.
  29397. // Check that value is an object with an inspect function on it
  29398. if (ctx.customInspect &&
  29399. value &&
  29400. isFunction(value.inspect) &&
  29401. // Filter out the util module, it's inspect function is special
  29402. value.inspect !== exports.inspect &&
  29403. // Also filter out any prototype objects using the circular check.
  29404. !(value.constructor && value.constructor.prototype === value)) {
  29405. var ret = value.inspect(recurseTimes, ctx);
  29406. if (!isString(ret)) {
  29407. ret = formatValue(ctx, ret, recurseTimes);
  29408. }
  29409. return ret;
  29410. }
  29411. // Primitive types cannot have properties
  29412. var primitive = formatPrimitive(ctx, value);
  29413. if (primitive) {
  29414. return primitive;
  29415. }
  29416. // Look up the keys of the object.
  29417. var keys = Object.keys(value);
  29418. var visibleKeys = arrayToHash(keys);
  29419. if (ctx.showHidden) {
  29420. keys = Object.getOwnPropertyNames(value);
  29421. }
  29422. // IE doesn't make error fields non-enumerable
  29423. // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
  29424. if (isError(value)
  29425. && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
  29426. return formatError(value);
  29427. }
  29428. // Some type of object without properties can be shortcutted.
  29429. if (keys.length === 0) {
  29430. if (isFunction(value)) {
  29431. var name = value.name ? ': ' + value.name : '';
  29432. return ctx.stylize('[Function' + name + ']', 'special');
  29433. }
  29434. if (isRegExp(value)) {
  29435. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  29436. }
  29437. if (isDate(value)) {
  29438. return ctx.stylize(Date.prototype.toString.call(value), 'date');
  29439. }
  29440. if (isError(value)) {
  29441. return formatError(value);
  29442. }
  29443. }
  29444. var base = '', array = false, braces = ['{', '}'];
  29445. // Make Array say that they are Array
  29446. if (isArray(value)) {
  29447. array = true;
  29448. braces = ['[', ']'];
  29449. }
  29450. // Make functions say that they are functions
  29451. if (isFunction(value)) {
  29452. var n = value.name ? ': ' + value.name : '';
  29453. base = ' [Function' + n + ']';
  29454. }
  29455. // Make RegExps say that they are RegExps
  29456. if (isRegExp(value)) {
  29457. base = ' ' + RegExp.prototype.toString.call(value);
  29458. }
  29459. // Make dates with properties first say the date
  29460. if (isDate(value)) {
  29461. base = ' ' + Date.prototype.toUTCString.call(value);
  29462. }
  29463. // Make error with message first say the error
  29464. if (isError(value)) {
  29465. base = ' ' + formatError(value);
  29466. }
  29467. if (keys.length === 0 && (!array || value.length == 0)) {
  29468. return braces[0] + base + braces[1];
  29469. }
  29470. if (recurseTimes < 0) {
  29471. if (isRegExp(value)) {
  29472. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  29473. } else {
  29474. return ctx.stylize('[Object]', 'special');
  29475. }
  29476. }
  29477. ctx.seen.push(value);
  29478. var output;
  29479. if (array) {
  29480. output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
  29481. } else {
  29482. output = keys.map(function(key) {
  29483. return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
  29484. });
  29485. }
  29486. ctx.seen.pop();
  29487. return reduceToSingleString(output, base, braces);
  29488. }
  29489. function formatPrimitive(ctx, value) {
  29490. if (isUndefined(value))
  29491. return ctx.stylize('undefined', 'undefined');
  29492. if (isString(value)) {
  29493. var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
  29494. .replace(/'/g, "\\'")
  29495. .replace(/\\"/g, '"') + '\'';
  29496. return ctx.stylize(simple, 'string');
  29497. }
  29498. if (isNumber(value))
  29499. return ctx.stylize('' + value, 'number');
  29500. if (isBoolean(value))
  29501. return ctx.stylize('' + value, 'boolean');
  29502. // For some reason typeof null is "object", so special case here.
  29503. if (isNull(value))
  29504. return ctx.stylize('null', 'null');
  29505. }
  29506. function formatError(value) {
  29507. return '[' + Error.prototype.toString.call(value) + ']';
  29508. }
  29509. function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
  29510. var output = [];
  29511. for (var i = 0, l = value.length; i < l; ++i) {
  29512. if (hasOwnProperty(value, String(i))) {
  29513. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  29514. String(i), true));
  29515. } else {
  29516. output.push('');
  29517. }
  29518. }
  29519. keys.forEach(function(key) {
  29520. if (!key.match(/^\d+$/)) {
  29521. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  29522. key, true));
  29523. }
  29524. });
  29525. return output;
  29526. }
  29527. function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
  29528. var name, str, desc;
  29529. desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
  29530. if (desc.get) {
  29531. if (desc.set) {
  29532. str = ctx.stylize('[Getter/Setter]', 'special');
  29533. } else {
  29534. str = ctx.stylize('[Getter]', 'special');
  29535. }
  29536. } else {
  29537. if (desc.set) {
  29538. str = ctx.stylize('[Setter]', 'special');
  29539. }
  29540. }
  29541. if (!hasOwnProperty(visibleKeys, key)) {
  29542. name = '[' + key + ']';
  29543. }
  29544. if (!str) {
  29545. if (ctx.seen.indexOf(desc.value) < 0) {
  29546. if (isNull(recurseTimes)) {
  29547. str = formatValue(ctx, desc.value, null);
  29548. } else {
  29549. str = formatValue(ctx, desc.value, recurseTimes - 1);
  29550. }
  29551. if (str.indexOf('\n') > -1) {
  29552. if (array) {
  29553. str = str.split('\n').map(function(line) {
  29554. return ' ' + line;
  29555. }).join('\n').slice(2);
  29556. } else {
  29557. str = '\n' + str.split('\n').map(function(line) {
  29558. return ' ' + line;
  29559. }).join('\n');
  29560. }
  29561. }
  29562. } else {
  29563. str = ctx.stylize('[Circular]', 'special');
  29564. }
  29565. }
  29566. if (isUndefined(name)) {
  29567. if (array && key.match(/^\d+$/)) {
  29568. return str;
  29569. }
  29570. name = JSON.stringify('' + key);
  29571. if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
  29572. name = name.slice(1, -1);
  29573. name = ctx.stylize(name, 'name');
  29574. } else {
  29575. name = name.replace(/'/g, "\\'")
  29576. .replace(/\\"/g, '"')
  29577. .replace(/(^"|"$)/g, "'");
  29578. name = ctx.stylize(name, 'string');
  29579. }
  29580. }
  29581. return name + ': ' + str;
  29582. }
  29583. function reduceToSingleString(output, base, braces) {
  29584. var numLinesEst = 0;
  29585. var length = output.reduce(function(prev, cur) {
  29586. numLinesEst++;
  29587. if (cur.indexOf('\n') >= 0) numLinesEst++;
  29588. return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
  29589. }, 0);
  29590. if (length > 60) {
  29591. return braces[0] +
  29592. (base === '' ? '' : base + '\n ') +
  29593. ' ' +
  29594. output.join(',\n ') +
  29595. ' ' +
  29596. braces[1];
  29597. }
  29598. return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
  29599. }
  29600. // NOTE: These type checking functions intentionally don't use `instanceof`
  29601. // because it is fragile and can be easily faked with `Object.create()`.
  29602. exports.types = require('./support/types');
  29603. function isArray(ar) {
  29604. return Array.isArray(ar);
  29605. }
  29606. exports.isArray = isArray;
  29607. function isBoolean(arg) {
  29608. return typeof arg === 'boolean';
  29609. }
  29610. exports.isBoolean = isBoolean;
  29611. function isNull(arg) {
  29612. return arg === null;
  29613. }
  29614. exports.isNull = isNull;
  29615. function isNullOrUndefined(arg) {
  29616. return arg == null;
  29617. }
  29618. exports.isNullOrUndefined = isNullOrUndefined;
  29619. function isNumber(arg) {
  29620. return typeof arg === 'number';
  29621. }
  29622. exports.isNumber = isNumber;
  29623. function isString(arg) {
  29624. return typeof arg === 'string';
  29625. }
  29626. exports.isString = isString;
  29627. function isSymbol(arg) {
  29628. return typeof arg === 'symbol';
  29629. }
  29630. exports.isSymbol = isSymbol;
  29631. function isUndefined(arg) {
  29632. return arg === void 0;
  29633. }
  29634. exports.isUndefined = isUndefined;
  29635. function isRegExp(re) {
  29636. return isObject(re) && objectToString(re) === '[object RegExp]';
  29637. }
  29638. exports.isRegExp = isRegExp;
  29639. exports.types.isRegExp = isRegExp;
  29640. function isObject(arg) {
  29641. return typeof arg === 'object' && arg !== null;
  29642. }
  29643. exports.isObject = isObject;
  29644. function isDate(d) {
  29645. return isObject(d) && objectToString(d) === '[object Date]';
  29646. }
  29647. exports.isDate = isDate;
  29648. exports.types.isDate = isDate;
  29649. function isError(e) {
  29650. return isObject(e) &&
  29651. (objectToString(e) === '[object Error]' || e instanceof Error);
  29652. }
  29653. exports.isError = isError;
  29654. exports.types.isNativeError = isError;
  29655. function isFunction(arg) {
  29656. return typeof arg === 'function';
  29657. }
  29658. exports.isFunction = isFunction;
  29659. function isPrimitive(arg) {
  29660. return arg === null ||
  29661. typeof arg === 'boolean' ||
  29662. typeof arg === 'number' ||
  29663. typeof arg === 'string' ||
  29664. typeof arg === 'symbol' || // ES6 symbol
  29665. typeof arg === 'undefined';
  29666. }
  29667. exports.isPrimitive = isPrimitive;
  29668. exports.isBuffer = require('./support/isBuffer');
  29669. function objectToString(o) {
  29670. return Object.prototype.toString.call(o);
  29671. }
  29672. function pad(n) {
  29673. return n < 10 ? '0' + n.toString(10) : n.toString(10);
  29674. }
  29675. var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
  29676. 'Oct', 'Nov', 'Dec'];
  29677. // 26 Feb 16:19:34
  29678. function timestamp() {
  29679. var d = new Date();
  29680. var time = [pad(d.getHours()),
  29681. pad(d.getMinutes()),
  29682. pad(d.getSeconds())].join(':');
  29683. return [d.getDate(), months[d.getMonth()], time].join(' ');
  29684. }
  29685. // log is just a thin wrapper to console.log that prepends a timestamp
  29686. exports.log = function() {
  29687. console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
  29688. };
  29689. /**
  29690. * Inherit the prototype methods from one constructor into another.
  29691. *
  29692. * The Function.prototype.inherits from lang.js rewritten as a standalone
  29693. * function (not on Function.prototype). NOTE: If this file is to be loaded
  29694. * during bootstrapping this function needs to be rewritten using some native
  29695. * functions as prototype setup using normal JavaScript does not work as
  29696. * expected during bootstrapping (see mirror.js in r114903).
  29697. *
  29698. * @param {function} ctor Constructor function which needs to inherit the
  29699. * prototype.
  29700. * @param {function} superCtor Constructor function to inherit prototype from.
  29701. */
  29702. exports.inherits = require('inherits');
  29703. exports._extend = function(origin, add) {
  29704. // Don't do anything if add isn't an object
  29705. if (!add || !isObject(add)) return origin;
  29706. var keys = Object.keys(add);
  29707. var i = keys.length;
  29708. while (i--) {
  29709. origin[keys[i]] = add[keys[i]];
  29710. }
  29711. return origin;
  29712. };
  29713. function hasOwnProperty(obj, prop) {
  29714. return Object.prototype.hasOwnProperty.call(obj, prop);
  29715. }
  29716. var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;
  29717. exports.promisify = function promisify(original) {
  29718. if (typeof original !== 'function')
  29719. throw new TypeError('The "original" argument must be of type Function');
  29720. if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
  29721. var fn = original[kCustomPromisifiedSymbol];
  29722. if (typeof fn !== 'function') {
  29723. throw new TypeError('The "util.promisify.custom" argument must be of type Function');
  29724. }
  29725. Object.defineProperty(fn, kCustomPromisifiedSymbol, {
  29726. value: fn, enumerable: false, writable: false, configurable: true
  29727. });
  29728. return fn;
  29729. }
  29730. function fn() {
  29731. var promiseResolve, promiseReject;
  29732. var promise = new Promise(function (resolve, reject) {
  29733. promiseResolve = resolve;
  29734. promiseReject = reject;
  29735. });
  29736. var args = [];
  29737. for (var i = 0; i < arguments.length; i++) {
  29738. args.push(arguments[i]);
  29739. }
  29740. args.push(function (err, value) {
  29741. if (err) {
  29742. promiseReject(err);
  29743. } else {
  29744. promiseResolve(value);
  29745. }
  29746. });
  29747. try {
  29748. original.apply(this, args);
  29749. } catch (err) {
  29750. promiseReject(err);
  29751. }
  29752. return promise;
  29753. }
  29754. Object.setPrototypeOf(fn, Object.getPrototypeOf(original));
  29755. if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {
  29756. value: fn, enumerable: false, writable: false, configurable: true
  29757. });
  29758. return Object.defineProperties(
  29759. fn,
  29760. getOwnPropertyDescriptors(original)
  29761. );
  29762. }
  29763. exports.promisify.custom = kCustomPromisifiedSymbol
  29764. function callbackifyOnRejected(reason, cb) {
  29765. // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).
  29766. // Because `null` is a special error value in callbacks which means "no error
  29767. // occurred", we error-wrap so the callback consumer can distinguish between
  29768. // "the promise rejected with null" or "the promise fulfilled with undefined".
  29769. if (!reason) {
  29770. var newReason = new Error('Promise was rejected with a falsy value');
  29771. newReason.reason = reason;
  29772. reason = newReason;
  29773. }
  29774. return cb(reason);
  29775. }
  29776. function callbackify(original) {
  29777. if (typeof original !== 'function') {
  29778. throw new TypeError('The "original" argument must be of type Function');
  29779. }
  29780. // We DO NOT return the promise as it gives the user a false sense that
  29781. // the promise is actually somehow related to the callback's execution
  29782. // and that the callback throwing will reject the promise.
  29783. function callbackified() {
  29784. var args = [];
  29785. for (var i = 0; i < arguments.length; i++) {
  29786. args.push(arguments[i]);
  29787. }
  29788. var maybeCb = args.pop();
  29789. if (typeof maybeCb !== 'function') {
  29790. throw new TypeError('The last argument must be of type Function');
  29791. }
  29792. var self = this;
  29793. var cb = function() {
  29794. return maybeCb.apply(self, arguments);
  29795. };
  29796. // In true node style we process the callback on `nextTick` with all the
  29797. // implications (stack, `uncaughtException`, `async_hooks`)
  29798. original.apply(this, args)
  29799. .then(function(ret) { process.nextTick(cb.bind(null, null, ret)) },
  29800. function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)) });
  29801. }
  29802. Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));
  29803. Object.defineProperties(callbackified,
  29804. getOwnPropertyDescriptors(original));
  29805. return callbackified;
  29806. }
  29807. exports.callbackify = callbackify;
  29808. }).call(this)}).call(this,require('_process'))
  29809. },{"./support/isBuffer":417,"./support/types":418,"_process":467,"inherits":364}],420:[function(require,module,exports){
  29810. (function (global){(function (){
  29811. 'use strict';
  29812. var forEach = require('for-each');
  29813. var availableTypedArrays = require('available-typed-arrays');
  29814. var callBind = require('call-bind');
  29815. var callBound = require('call-bind/callBound');
  29816. var gOPD = require('gopd');
  29817. var $toString = callBound('Object.prototype.toString');
  29818. var hasToStringTag = require('has-tostringtag/shams')();
  29819. var g = typeof globalThis === 'undefined' ? global : globalThis;
  29820. var typedArrays = availableTypedArrays();
  29821. var $slice = callBound('String.prototype.slice');
  29822. var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');
  29823. var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {
  29824. for (var i = 0; i < array.length; i += 1) {
  29825. if (array[i] === value) {
  29826. return i;
  29827. }
  29828. }
  29829. return -1;
  29830. };
  29831. var cache = { __proto__: null };
  29832. if (hasToStringTag && gOPD && getPrototypeOf) {
  29833. forEach(typedArrays, function (typedArray) {
  29834. var arr = new g[typedArray]();
  29835. if (Symbol.toStringTag in arr) {
  29836. var proto = getPrototypeOf(arr);
  29837. var descriptor = gOPD(proto, Symbol.toStringTag);
  29838. if (!descriptor) {
  29839. var superProto = getPrototypeOf(proto);
  29840. descriptor = gOPD(superProto, Symbol.toStringTag);
  29841. }
  29842. cache['$' + typedArray] = callBind(descriptor.get);
  29843. }
  29844. });
  29845. } else {
  29846. forEach(typedArrays, function (typedArray) {
  29847. var arr = new g[typedArray]();
  29848. cache['$' + typedArray] = callBind(arr.slice);
  29849. });
  29850. }
  29851. var tryTypedArrays = function tryAllTypedArrays(value) {
  29852. var found = false;
  29853. forEach(cache, function (getter, typedArray) {
  29854. if (!found) {
  29855. try {
  29856. if ('$' + getter(value) === typedArray) {
  29857. found = $slice(typedArray, 1);
  29858. }
  29859. } catch (e) { /**/ }
  29860. }
  29861. });
  29862. return found;
  29863. };
  29864. var trySlices = function tryAllSlices(value) {
  29865. var found = false;
  29866. forEach(cache, function (getter, name) {
  29867. if (!found) {
  29868. try {
  29869. getter(value);
  29870. found = $slice(name, 1);
  29871. } catch (e) { /**/ }
  29872. }
  29873. });
  29874. return found;
  29875. };
  29876. module.exports = function whichTypedArray(value) {
  29877. if (!value || typeof value !== 'object') { return false; }
  29878. if (!hasToStringTag) {
  29879. var tag = $slice($toString(value), 8, -1);
  29880. if ($indexOf(typedArrays, tag) > -1) {
  29881. return tag;
  29882. }
  29883. if (tag !== 'Object') {
  29884. return false;
  29885. }
  29886. // node < 0.6 hits here on real Typed Arrays
  29887. return trySlices(value);
  29888. }
  29889. if (!gOPD) { return null; } // unknown engine
  29890. return tryTypedArrays(value);
  29891. };
  29892. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  29893. },{"available-typed-arrays":86,"call-bind":93,"call-bind/callBound":92,"for-each":345,"gopd":349,"has-tostringtag/shams":353}],421:[function(require,module,exports){
  29894. // Generated by CoffeeScript 1.12.7
  29895. (function() {
  29896. "use strict";
  29897. exports.stripBOM = function(str) {
  29898. if (str[0] === '\uFEFF') {
  29899. return str.substring(1);
  29900. } else {
  29901. return str;
  29902. }
  29903. };
  29904. }).call(this);
  29905. },{}],422:[function(require,module,exports){
  29906. // Generated by CoffeeScript 1.12.7
  29907. (function() {
  29908. "use strict";
  29909. var builder, defaults, escapeCDATA, requiresCDATA, wrapCDATA,
  29910. hasProp = {}.hasOwnProperty;
  29911. builder = require('xmlbuilder');
  29912. defaults = require('./defaults').defaults;
  29913. requiresCDATA = function(entry) {
  29914. return typeof entry === "string" && (entry.indexOf('&') >= 0 || entry.indexOf('>') >= 0 || entry.indexOf('<') >= 0);
  29915. };
  29916. wrapCDATA = function(entry) {
  29917. return "<![CDATA[" + (escapeCDATA(entry)) + "]]>";
  29918. };
  29919. escapeCDATA = function(entry) {
  29920. return entry.replace(']]>', ']]]]><![CDATA[>');
  29921. };
  29922. exports.Builder = (function() {
  29923. function Builder(opts) {
  29924. var key, ref, value;
  29925. this.options = {};
  29926. ref = defaults["0.2"];
  29927. for (key in ref) {
  29928. if (!hasProp.call(ref, key)) continue;
  29929. value = ref[key];
  29930. this.options[key] = value;
  29931. }
  29932. for (key in opts) {
  29933. if (!hasProp.call(opts, key)) continue;
  29934. value = opts[key];
  29935. this.options[key] = value;
  29936. }
  29937. }
  29938. Builder.prototype.buildObject = function(rootObj) {
  29939. var attrkey, charkey, render, rootElement, rootName;
  29940. attrkey = this.options.attrkey;
  29941. charkey = this.options.charkey;
  29942. if ((Object.keys(rootObj).length === 1) && (this.options.rootName === defaults['0.2'].rootName)) {
  29943. rootName = Object.keys(rootObj)[0];
  29944. rootObj = rootObj[rootName];
  29945. } else {
  29946. rootName = this.options.rootName;
  29947. }
  29948. render = (function(_this) {
  29949. return function(element, obj) {
  29950. var attr, child, entry, index, key, value;
  29951. if (typeof obj !== 'object') {
  29952. if (_this.options.cdata && requiresCDATA(obj)) {
  29953. element.raw(wrapCDATA(obj));
  29954. } else {
  29955. element.txt(obj);
  29956. }
  29957. } else if (Array.isArray(obj)) {
  29958. for (index in obj) {
  29959. if (!hasProp.call(obj, index)) continue;
  29960. child = obj[index];
  29961. for (key in child) {
  29962. entry = child[key];
  29963. element = render(element.ele(key), entry).up();
  29964. }
  29965. }
  29966. } else {
  29967. for (key in obj) {
  29968. if (!hasProp.call(obj, key)) continue;
  29969. child = obj[key];
  29970. if (key === attrkey) {
  29971. if (typeof child === "object") {
  29972. for (attr in child) {
  29973. value = child[attr];
  29974. element = element.att(attr, value);
  29975. }
  29976. }
  29977. } else if (key === charkey) {
  29978. if (_this.options.cdata && requiresCDATA(child)) {
  29979. element = element.raw(wrapCDATA(child));
  29980. } else {
  29981. element = element.txt(child);
  29982. }
  29983. } else if (Array.isArray(child)) {
  29984. for (index in child) {
  29985. if (!hasProp.call(child, index)) continue;
  29986. entry = child[index];
  29987. if (typeof entry === 'string') {
  29988. if (_this.options.cdata && requiresCDATA(entry)) {
  29989. element = element.ele(key).raw(wrapCDATA(entry)).up();
  29990. } else {
  29991. element = element.ele(key, entry).up();
  29992. }
  29993. } else {
  29994. element = render(element.ele(key), entry).up();
  29995. }
  29996. }
  29997. } else if (typeof child === "object") {
  29998. element = render(element.ele(key), child).up();
  29999. } else {
  30000. if (typeof child === 'string' && _this.options.cdata && requiresCDATA(child)) {
  30001. element = element.ele(key).raw(wrapCDATA(child)).up();
  30002. } else {
  30003. if (child == null) {
  30004. child = '';
  30005. }
  30006. element = element.ele(key, child.toString()).up();
  30007. }
  30008. }
  30009. }
  30010. }
  30011. return element;
  30012. };
  30013. })(this);
  30014. rootElement = builder.create(rootName, this.options.xmldec, this.options.doctype, {
  30015. headless: this.options.headless,
  30016. allowSurrogateChars: this.options.allowSurrogateChars
  30017. });
  30018. return render(rootElement, rootObj).end(this.options.renderOpts);
  30019. };
  30020. return Builder;
  30021. })();
  30022. }).call(this);
  30023. },{"./defaults":423,"xmlbuilder":459}],423:[function(require,module,exports){
  30024. // Generated by CoffeeScript 1.12.7
  30025. (function() {
  30026. exports.defaults = {
  30027. "0.1": {
  30028. explicitCharkey: false,
  30029. trim: true,
  30030. normalize: true,
  30031. normalizeTags: false,
  30032. attrkey: "@",
  30033. charkey: "#",
  30034. explicitArray: false,
  30035. ignoreAttrs: false,
  30036. mergeAttrs: false,
  30037. explicitRoot: false,
  30038. validator: null,
  30039. xmlns: false,
  30040. explicitChildren: false,
  30041. childkey: '@@',
  30042. charsAsChildren: false,
  30043. includeWhiteChars: false,
  30044. async: false,
  30045. strict: true,
  30046. attrNameProcessors: null,
  30047. attrValueProcessors: null,
  30048. tagNameProcessors: null,
  30049. valueProcessors: null,
  30050. emptyTag: ''
  30051. },
  30052. "0.2": {
  30053. explicitCharkey: false,
  30054. trim: false,
  30055. normalize: false,
  30056. normalizeTags: false,
  30057. attrkey: "$",
  30058. charkey: "_",
  30059. explicitArray: true,
  30060. ignoreAttrs: false,
  30061. mergeAttrs: false,
  30062. explicitRoot: true,
  30063. validator: null,
  30064. xmlns: false,
  30065. explicitChildren: false,
  30066. preserveChildrenOrder: false,
  30067. childkey: '$$',
  30068. charsAsChildren: false,
  30069. includeWhiteChars: false,
  30070. async: false,
  30071. strict: true,
  30072. attrNameProcessors: null,
  30073. attrValueProcessors: null,
  30074. tagNameProcessors: null,
  30075. valueProcessors: null,
  30076. rootName: 'root',
  30077. xmldec: {
  30078. 'version': '1.0',
  30079. 'encoding': 'UTF-8',
  30080. 'standalone': true
  30081. },
  30082. doctype: null,
  30083. renderOpts: {
  30084. 'pretty': true,
  30085. 'indent': ' ',
  30086. 'newline': '\n'
  30087. },
  30088. headless: false,
  30089. chunkSize: 10000,
  30090. emptyTag: '',
  30091. cdata: false
  30092. }
  30093. };
  30094. }).call(this);
  30095. },{}],424:[function(require,module,exports){
  30096. // Generated by CoffeeScript 1.12.7
  30097. (function() {
  30098. "use strict";
  30099. var bom, defaults, defineProperty, events, isEmpty, processItem, processors, sax, setImmediate,
  30100. bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
  30101. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  30102. hasProp = {}.hasOwnProperty;
  30103. sax = require('sax');
  30104. events = require('events');
  30105. bom = require('./bom');
  30106. processors = require('./processors');
  30107. setImmediate = require('timers').setImmediate;
  30108. defaults = require('./defaults').defaults;
  30109. isEmpty = function(thing) {
  30110. return typeof thing === "object" && (thing != null) && Object.keys(thing).length === 0;
  30111. };
  30112. processItem = function(processors, item, key) {
  30113. var i, len, process;
  30114. for (i = 0, len = processors.length; i < len; i++) {
  30115. process = processors[i];
  30116. item = process(item, key);
  30117. }
  30118. return item;
  30119. };
  30120. defineProperty = function(obj, key, value) {
  30121. var descriptor;
  30122. descriptor = Object.create(null);
  30123. descriptor.value = value;
  30124. descriptor.writable = true;
  30125. descriptor.enumerable = true;
  30126. descriptor.configurable = true;
  30127. return Object.defineProperty(obj, key, descriptor);
  30128. };
  30129. exports.Parser = (function(superClass) {
  30130. extend(Parser, superClass);
  30131. function Parser(opts) {
  30132. this.parseStringPromise = bind(this.parseStringPromise, this);
  30133. this.parseString = bind(this.parseString, this);
  30134. this.reset = bind(this.reset, this);
  30135. this.assignOrPush = bind(this.assignOrPush, this);
  30136. this.processAsync = bind(this.processAsync, this);
  30137. var key, ref, value;
  30138. if (!(this instanceof exports.Parser)) {
  30139. return new exports.Parser(opts);
  30140. }
  30141. this.options = {};
  30142. ref = defaults["0.2"];
  30143. for (key in ref) {
  30144. if (!hasProp.call(ref, key)) continue;
  30145. value = ref[key];
  30146. this.options[key] = value;
  30147. }
  30148. for (key in opts) {
  30149. if (!hasProp.call(opts, key)) continue;
  30150. value = opts[key];
  30151. this.options[key] = value;
  30152. }
  30153. if (this.options.xmlns) {
  30154. this.options.xmlnskey = this.options.attrkey + "ns";
  30155. }
  30156. if (this.options.normalizeTags) {
  30157. if (!this.options.tagNameProcessors) {
  30158. this.options.tagNameProcessors = [];
  30159. }
  30160. this.options.tagNameProcessors.unshift(processors.normalize);
  30161. }
  30162. this.reset();
  30163. }
  30164. Parser.prototype.processAsync = function() {
  30165. var chunk, err;
  30166. try {
  30167. if (this.remaining.length <= this.options.chunkSize) {
  30168. chunk = this.remaining;
  30169. this.remaining = '';
  30170. this.saxParser = this.saxParser.write(chunk);
  30171. return this.saxParser.close();
  30172. } else {
  30173. chunk = this.remaining.substr(0, this.options.chunkSize);
  30174. this.remaining = this.remaining.substr(this.options.chunkSize, this.remaining.length);
  30175. this.saxParser = this.saxParser.write(chunk);
  30176. return setImmediate(this.processAsync);
  30177. }
  30178. } catch (error1) {
  30179. err = error1;
  30180. if (!this.saxParser.errThrown) {
  30181. this.saxParser.errThrown = true;
  30182. return this.emit(err);
  30183. }
  30184. }
  30185. };
  30186. Parser.prototype.assignOrPush = function(obj, key, newValue) {
  30187. if (!(key in obj)) {
  30188. if (!this.options.explicitArray) {
  30189. return defineProperty(obj, key, newValue);
  30190. } else {
  30191. return defineProperty(obj, key, [newValue]);
  30192. }
  30193. } else {
  30194. if (!(obj[key] instanceof Array)) {
  30195. defineProperty(obj, key, [obj[key]]);
  30196. }
  30197. return obj[key].push(newValue);
  30198. }
  30199. };
  30200. Parser.prototype.reset = function() {
  30201. var attrkey, charkey, ontext, stack;
  30202. this.removeAllListeners();
  30203. this.saxParser = sax.parser(this.options.strict, {
  30204. trim: false,
  30205. normalize: false,
  30206. xmlns: this.options.xmlns
  30207. });
  30208. this.saxParser.errThrown = false;
  30209. this.saxParser.onerror = (function(_this) {
  30210. return function(error) {
  30211. _this.saxParser.resume();
  30212. if (!_this.saxParser.errThrown) {
  30213. _this.saxParser.errThrown = true;
  30214. return _this.emit("error", error);
  30215. }
  30216. };
  30217. })(this);
  30218. this.saxParser.onend = (function(_this) {
  30219. return function() {
  30220. if (!_this.saxParser.ended) {
  30221. _this.saxParser.ended = true;
  30222. return _this.emit("end", _this.resultObject);
  30223. }
  30224. };
  30225. })(this);
  30226. this.saxParser.ended = false;
  30227. this.EXPLICIT_CHARKEY = this.options.explicitCharkey;
  30228. this.resultObject = null;
  30229. stack = [];
  30230. attrkey = this.options.attrkey;
  30231. charkey = this.options.charkey;
  30232. this.saxParser.onopentag = (function(_this) {
  30233. return function(node) {
  30234. var key, newValue, obj, processedKey, ref;
  30235. obj = {};
  30236. obj[charkey] = "";
  30237. if (!_this.options.ignoreAttrs) {
  30238. ref = node.attributes;
  30239. for (key in ref) {
  30240. if (!hasProp.call(ref, key)) continue;
  30241. if (!(attrkey in obj) && !_this.options.mergeAttrs) {
  30242. obj[attrkey] = {};
  30243. }
  30244. newValue = _this.options.attrValueProcessors ? processItem(_this.options.attrValueProcessors, node.attributes[key], key) : node.attributes[key];
  30245. processedKey = _this.options.attrNameProcessors ? processItem(_this.options.attrNameProcessors, key) : key;
  30246. if (_this.options.mergeAttrs) {
  30247. _this.assignOrPush(obj, processedKey, newValue);
  30248. } else {
  30249. defineProperty(obj[attrkey], processedKey, newValue);
  30250. }
  30251. }
  30252. }
  30253. obj["#name"] = _this.options.tagNameProcessors ? processItem(_this.options.tagNameProcessors, node.name) : node.name;
  30254. if (_this.options.xmlns) {
  30255. obj[_this.options.xmlnskey] = {
  30256. uri: node.uri,
  30257. local: node.local
  30258. };
  30259. }
  30260. return stack.push(obj);
  30261. };
  30262. })(this);
  30263. this.saxParser.onclosetag = (function(_this) {
  30264. return function() {
  30265. var cdata, emptyStr, key, node, nodeName, obj, objClone, old, s, xpath;
  30266. obj = stack.pop();
  30267. nodeName = obj["#name"];
  30268. if (!_this.options.explicitChildren || !_this.options.preserveChildrenOrder) {
  30269. delete obj["#name"];
  30270. }
  30271. if (obj.cdata === true) {
  30272. cdata = obj.cdata;
  30273. delete obj.cdata;
  30274. }
  30275. s = stack[stack.length - 1];
  30276. if (obj[charkey].match(/^\s*$/) && !cdata) {
  30277. emptyStr = obj[charkey];
  30278. delete obj[charkey];
  30279. } else {
  30280. if (_this.options.trim) {
  30281. obj[charkey] = obj[charkey].trim();
  30282. }
  30283. if (_this.options.normalize) {
  30284. obj[charkey] = obj[charkey].replace(/\s{2,}/g, " ").trim();
  30285. }
  30286. obj[charkey] = _this.options.valueProcessors ? processItem(_this.options.valueProcessors, obj[charkey], nodeName) : obj[charkey];
  30287. if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) {
  30288. obj = obj[charkey];
  30289. }
  30290. }
  30291. if (isEmpty(obj)) {
  30292. if (typeof _this.options.emptyTag === 'function') {
  30293. obj = _this.options.emptyTag();
  30294. } else {
  30295. obj = _this.options.emptyTag !== '' ? _this.options.emptyTag : emptyStr;
  30296. }
  30297. }
  30298. if (_this.options.validator != null) {
  30299. xpath = "/" + ((function() {
  30300. var i, len, results;
  30301. results = [];
  30302. for (i = 0, len = stack.length; i < len; i++) {
  30303. node = stack[i];
  30304. results.push(node["#name"]);
  30305. }
  30306. return results;
  30307. })()).concat(nodeName).join("/");
  30308. (function() {
  30309. var err;
  30310. try {
  30311. return obj = _this.options.validator(xpath, s && s[nodeName], obj);
  30312. } catch (error1) {
  30313. err = error1;
  30314. return _this.emit("error", err);
  30315. }
  30316. })();
  30317. }
  30318. if (_this.options.explicitChildren && !_this.options.mergeAttrs && typeof obj === 'object') {
  30319. if (!_this.options.preserveChildrenOrder) {
  30320. node = {};
  30321. if (_this.options.attrkey in obj) {
  30322. node[_this.options.attrkey] = obj[_this.options.attrkey];
  30323. delete obj[_this.options.attrkey];
  30324. }
  30325. if (!_this.options.charsAsChildren && _this.options.charkey in obj) {
  30326. node[_this.options.charkey] = obj[_this.options.charkey];
  30327. delete obj[_this.options.charkey];
  30328. }
  30329. if (Object.getOwnPropertyNames(obj).length > 0) {
  30330. node[_this.options.childkey] = obj;
  30331. }
  30332. obj = node;
  30333. } else if (s) {
  30334. s[_this.options.childkey] = s[_this.options.childkey] || [];
  30335. objClone = {};
  30336. for (key in obj) {
  30337. if (!hasProp.call(obj, key)) continue;
  30338. defineProperty(objClone, key, obj[key]);
  30339. }
  30340. s[_this.options.childkey].push(objClone);
  30341. delete obj["#name"];
  30342. if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) {
  30343. obj = obj[charkey];
  30344. }
  30345. }
  30346. }
  30347. if (stack.length > 0) {
  30348. return _this.assignOrPush(s, nodeName, obj);
  30349. } else {
  30350. if (_this.options.explicitRoot) {
  30351. old = obj;
  30352. obj = {};
  30353. defineProperty(obj, nodeName, old);
  30354. }
  30355. _this.resultObject = obj;
  30356. _this.saxParser.ended = true;
  30357. return _this.emit("end", _this.resultObject);
  30358. }
  30359. };
  30360. })(this);
  30361. ontext = (function(_this) {
  30362. return function(text) {
  30363. var charChild, s;
  30364. s = stack[stack.length - 1];
  30365. if (s) {
  30366. s[charkey] += text;
  30367. if (_this.options.explicitChildren && _this.options.preserveChildrenOrder && _this.options.charsAsChildren && (_this.options.includeWhiteChars || text.replace(/\\n/g, '').trim() !== '')) {
  30368. s[_this.options.childkey] = s[_this.options.childkey] || [];
  30369. charChild = {
  30370. '#name': '__text__'
  30371. };
  30372. charChild[charkey] = text;
  30373. if (_this.options.normalize) {
  30374. charChild[charkey] = charChild[charkey].replace(/\s{2,}/g, " ").trim();
  30375. }
  30376. s[_this.options.childkey].push(charChild);
  30377. }
  30378. return s;
  30379. }
  30380. };
  30381. })(this);
  30382. this.saxParser.ontext = ontext;
  30383. return this.saxParser.oncdata = (function(_this) {
  30384. return function(text) {
  30385. var s;
  30386. s = ontext(text);
  30387. if (s) {
  30388. return s.cdata = true;
  30389. }
  30390. };
  30391. })(this);
  30392. };
  30393. Parser.prototype.parseString = function(str, cb) {
  30394. var err;
  30395. if ((cb != null) && typeof cb === "function") {
  30396. this.on("end", function(result) {
  30397. this.reset();
  30398. return cb(null, result);
  30399. });
  30400. this.on("error", function(err) {
  30401. this.reset();
  30402. return cb(err);
  30403. });
  30404. }
  30405. try {
  30406. str = str.toString();
  30407. if (str.trim() === '') {
  30408. this.emit("end", null);
  30409. return true;
  30410. }
  30411. str = bom.stripBOM(str);
  30412. if (this.options.async) {
  30413. this.remaining = str;
  30414. setImmediate(this.processAsync);
  30415. return this.saxParser;
  30416. }
  30417. return this.saxParser.write(str).close();
  30418. } catch (error1) {
  30419. err = error1;
  30420. if (!(this.saxParser.errThrown || this.saxParser.ended)) {
  30421. this.emit('error', err);
  30422. return this.saxParser.errThrown = true;
  30423. } else if (this.saxParser.ended) {
  30424. throw err;
  30425. }
  30426. }
  30427. };
  30428. Parser.prototype.parseStringPromise = function(str) {
  30429. return new Promise((function(_this) {
  30430. return function(resolve, reject) {
  30431. return _this.parseString(str, function(err, value) {
  30432. if (err) {
  30433. return reject(err);
  30434. } else {
  30435. return resolve(value);
  30436. }
  30437. });
  30438. };
  30439. })(this));
  30440. };
  30441. return Parser;
  30442. })(events);
  30443. exports.parseString = function(str, a, b) {
  30444. var cb, options, parser;
  30445. if (b != null) {
  30446. if (typeof b === 'function') {
  30447. cb = b;
  30448. }
  30449. if (typeof a === 'object') {
  30450. options = a;
  30451. }
  30452. } else {
  30453. if (typeof a === 'function') {
  30454. cb = a;
  30455. }
  30456. options = {};
  30457. }
  30458. parser = new exports.Parser(options);
  30459. return parser.parseString(str, cb);
  30460. };
  30461. exports.parseStringPromise = function(str, a) {
  30462. var options, parser;
  30463. if (typeof a === 'object') {
  30464. options = a;
  30465. }
  30466. parser = new exports.Parser(options);
  30467. return parser.parseStringPromise(str);
  30468. };
  30469. }).call(this);
  30470. },{"./bom":421,"./defaults":423,"./processors":425,"events":344,"sax":397,"timers":414}],425:[function(require,module,exports){
  30471. // Generated by CoffeeScript 1.12.7
  30472. (function() {
  30473. "use strict";
  30474. var prefixMatch;
  30475. prefixMatch = new RegExp(/(?!xmlns)^.*:/);
  30476. exports.normalize = function(str) {
  30477. return str.toLowerCase();
  30478. };
  30479. exports.firstCharLowerCase = function(str) {
  30480. return str.charAt(0).toLowerCase() + str.slice(1);
  30481. };
  30482. exports.stripPrefix = function(str) {
  30483. return str.replace(prefixMatch, '');
  30484. };
  30485. exports.parseNumbers = function(str) {
  30486. if (!isNaN(str)) {
  30487. str = str % 1 === 0 ? parseInt(str, 10) : parseFloat(str);
  30488. }
  30489. return str;
  30490. };
  30491. exports.parseBooleans = function(str) {
  30492. if (/^(?:true|false)$/i.test(str)) {
  30493. str = str.toLowerCase() === 'true';
  30494. }
  30495. return str;
  30496. };
  30497. }).call(this);
  30498. },{}],426:[function(require,module,exports){
  30499. // Generated by CoffeeScript 1.12.7
  30500. (function() {
  30501. "use strict";
  30502. var builder, defaults, parser, processors,
  30503. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  30504. hasProp = {}.hasOwnProperty;
  30505. defaults = require('./defaults');
  30506. builder = require('./builder');
  30507. parser = require('./parser');
  30508. processors = require('./processors');
  30509. exports.defaults = defaults.defaults;
  30510. exports.processors = processors;
  30511. exports.ValidationError = (function(superClass) {
  30512. extend(ValidationError, superClass);
  30513. function ValidationError(message) {
  30514. this.message = message;
  30515. }
  30516. return ValidationError;
  30517. })(Error);
  30518. exports.Builder = builder.Builder;
  30519. exports.Parser = parser.Parser;
  30520. exports.parseString = parser.parseString;
  30521. exports.parseStringPromise = parser.parseStringPromise;
  30522. }).call(this);
  30523. },{"./builder":422,"./defaults":423,"./parser":424,"./processors":425}],427:[function(require,module,exports){
  30524. // Generated by CoffeeScript 1.12.7
  30525. (function() {
  30526. module.exports = {
  30527. Disconnected: 1,
  30528. Preceding: 2,
  30529. Following: 4,
  30530. Contains: 8,
  30531. ContainedBy: 16,
  30532. ImplementationSpecific: 32
  30533. };
  30534. }).call(this);
  30535. },{}],428:[function(require,module,exports){
  30536. // Generated by CoffeeScript 1.12.7
  30537. (function() {
  30538. module.exports = {
  30539. Element: 1,
  30540. Attribute: 2,
  30541. Text: 3,
  30542. CData: 4,
  30543. EntityReference: 5,
  30544. EntityDeclaration: 6,
  30545. ProcessingInstruction: 7,
  30546. Comment: 8,
  30547. Document: 9,
  30548. DocType: 10,
  30549. DocumentFragment: 11,
  30550. NotationDeclaration: 12,
  30551. Declaration: 201,
  30552. Raw: 202,
  30553. AttributeDeclaration: 203,
  30554. ElementDeclaration: 204,
  30555. Dummy: 205
  30556. };
  30557. }).call(this);
  30558. },{}],429:[function(require,module,exports){
  30559. // Generated by CoffeeScript 1.12.7
  30560. (function() {
  30561. var assign, getValue, isArray, isEmpty, isFunction, isObject, isPlainObject,
  30562. slice = [].slice,
  30563. hasProp = {}.hasOwnProperty;
  30564. assign = function() {
  30565. var i, key, len, source, sources, target;
  30566. target = arguments[0], sources = 2 <= arguments.length ? slice.call(arguments, 1) : [];
  30567. if (isFunction(Object.assign)) {
  30568. Object.assign.apply(null, arguments);
  30569. } else {
  30570. for (i = 0, len = sources.length; i < len; i++) {
  30571. source = sources[i];
  30572. if (source != null) {
  30573. for (key in source) {
  30574. if (!hasProp.call(source, key)) continue;
  30575. target[key] = source[key];
  30576. }
  30577. }
  30578. }
  30579. }
  30580. return target;
  30581. };
  30582. isFunction = function(val) {
  30583. return !!val && Object.prototype.toString.call(val) === '[object Function]';
  30584. };
  30585. isObject = function(val) {
  30586. var ref;
  30587. return !!val && ((ref = typeof val) === 'function' || ref === 'object');
  30588. };
  30589. isArray = function(val) {
  30590. if (isFunction(Array.isArray)) {
  30591. return Array.isArray(val);
  30592. } else {
  30593. return Object.prototype.toString.call(val) === '[object Array]';
  30594. }
  30595. };
  30596. isEmpty = function(val) {
  30597. var key;
  30598. if (isArray(val)) {
  30599. return !val.length;
  30600. } else {
  30601. for (key in val) {
  30602. if (!hasProp.call(val, key)) continue;
  30603. return false;
  30604. }
  30605. return true;
  30606. }
  30607. };
  30608. isPlainObject = function(val) {
  30609. var ctor, proto;
  30610. return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object));
  30611. };
  30612. getValue = function(obj) {
  30613. if (isFunction(obj.valueOf)) {
  30614. return obj.valueOf();
  30615. } else {
  30616. return obj;
  30617. }
  30618. };
  30619. module.exports.assign = assign;
  30620. module.exports.isFunction = isFunction;
  30621. module.exports.isObject = isObject;
  30622. module.exports.isArray = isArray;
  30623. module.exports.isEmpty = isEmpty;
  30624. module.exports.isPlainObject = isPlainObject;
  30625. module.exports.getValue = getValue;
  30626. }).call(this);
  30627. },{}],430:[function(require,module,exports){
  30628. // Generated by CoffeeScript 1.12.7
  30629. (function() {
  30630. module.exports = {
  30631. None: 0,
  30632. OpenTag: 1,
  30633. InsideTag: 2,
  30634. CloseTag: 3
  30635. };
  30636. }).call(this);
  30637. },{}],431:[function(require,module,exports){
  30638. // Generated by CoffeeScript 1.12.7
  30639. (function() {
  30640. var NodeType, XMLAttribute, XMLNode;
  30641. NodeType = require('./NodeType');
  30642. XMLNode = require('./XMLNode');
  30643. module.exports = XMLAttribute = (function() {
  30644. function XMLAttribute(parent, name, value) {
  30645. this.parent = parent;
  30646. if (this.parent) {
  30647. this.options = this.parent.options;
  30648. this.stringify = this.parent.stringify;
  30649. }
  30650. if (name == null) {
  30651. throw new Error("Missing attribute name. " + this.debugInfo(name));
  30652. }
  30653. this.name = this.stringify.name(name);
  30654. this.value = this.stringify.attValue(value);
  30655. this.type = NodeType.Attribute;
  30656. this.isId = false;
  30657. this.schemaTypeInfo = null;
  30658. }
  30659. Object.defineProperty(XMLAttribute.prototype, 'nodeType', {
  30660. get: function() {
  30661. return this.type;
  30662. }
  30663. });
  30664. Object.defineProperty(XMLAttribute.prototype, 'ownerElement', {
  30665. get: function() {
  30666. return this.parent;
  30667. }
  30668. });
  30669. Object.defineProperty(XMLAttribute.prototype, 'textContent', {
  30670. get: function() {
  30671. return this.value;
  30672. },
  30673. set: function(value) {
  30674. return this.value = value || '';
  30675. }
  30676. });
  30677. Object.defineProperty(XMLAttribute.prototype, 'namespaceURI', {
  30678. get: function() {
  30679. return '';
  30680. }
  30681. });
  30682. Object.defineProperty(XMLAttribute.prototype, 'prefix', {
  30683. get: function() {
  30684. return '';
  30685. }
  30686. });
  30687. Object.defineProperty(XMLAttribute.prototype, 'localName', {
  30688. get: function() {
  30689. return this.name;
  30690. }
  30691. });
  30692. Object.defineProperty(XMLAttribute.prototype, 'specified', {
  30693. get: function() {
  30694. return true;
  30695. }
  30696. });
  30697. XMLAttribute.prototype.clone = function() {
  30698. return Object.create(this);
  30699. };
  30700. XMLAttribute.prototype.toString = function(options) {
  30701. return this.options.writer.attribute(this, this.options.writer.filterOptions(options));
  30702. };
  30703. XMLAttribute.prototype.debugInfo = function(name) {
  30704. name = name || this.name;
  30705. if (name == null) {
  30706. return "parent: <" + this.parent.name + ">";
  30707. } else {
  30708. return "attribute: {" + name + "}, parent: <" + this.parent.name + ">";
  30709. }
  30710. };
  30711. XMLAttribute.prototype.isEqualNode = function(node) {
  30712. if (node.namespaceURI !== this.namespaceURI) {
  30713. return false;
  30714. }
  30715. if (node.prefix !== this.prefix) {
  30716. return false;
  30717. }
  30718. if (node.localName !== this.localName) {
  30719. return false;
  30720. }
  30721. if (node.value !== this.value) {
  30722. return false;
  30723. }
  30724. return true;
  30725. };
  30726. return XMLAttribute;
  30727. })();
  30728. }).call(this);
  30729. },{"./NodeType":428,"./XMLNode":450}],432:[function(require,module,exports){
  30730. // Generated by CoffeeScript 1.12.7
  30731. (function() {
  30732. var NodeType, XMLCData, XMLCharacterData,
  30733. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  30734. hasProp = {}.hasOwnProperty;
  30735. NodeType = require('./NodeType');
  30736. XMLCharacterData = require('./XMLCharacterData');
  30737. module.exports = XMLCData = (function(superClass) {
  30738. extend(XMLCData, superClass);
  30739. function XMLCData(parent, text) {
  30740. XMLCData.__super__.constructor.call(this, parent);
  30741. if (text == null) {
  30742. throw new Error("Missing CDATA text. " + this.debugInfo());
  30743. }
  30744. this.name = "#cdata-section";
  30745. this.type = NodeType.CData;
  30746. this.value = this.stringify.cdata(text);
  30747. }
  30748. XMLCData.prototype.clone = function() {
  30749. return Object.create(this);
  30750. };
  30751. XMLCData.prototype.toString = function(options) {
  30752. return this.options.writer.cdata(this, this.options.writer.filterOptions(options));
  30753. };
  30754. return XMLCData;
  30755. })(XMLCharacterData);
  30756. }).call(this);
  30757. },{"./NodeType":428,"./XMLCharacterData":433}],433:[function(require,module,exports){
  30758. // Generated by CoffeeScript 1.12.7
  30759. (function() {
  30760. var XMLCharacterData, XMLNode,
  30761. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  30762. hasProp = {}.hasOwnProperty;
  30763. XMLNode = require('./XMLNode');
  30764. module.exports = XMLCharacterData = (function(superClass) {
  30765. extend(XMLCharacterData, superClass);
  30766. function XMLCharacterData(parent) {
  30767. XMLCharacterData.__super__.constructor.call(this, parent);
  30768. this.value = '';
  30769. }
  30770. Object.defineProperty(XMLCharacterData.prototype, 'data', {
  30771. get: function() {
  30772. return this.value;
  30773. },
  30774. set: function(value) {
  30775. return this.value = value || '';
  30776. }
  30777. });
  30778. Object.defineProperty(XMLCharacterData.prototype, 'length', {
  30779. get: function() {
  30780. return this.value.length;
  30781. }
  30782. });
  30783. Object.defineProperty(XMLCharacterData.prototype, 'textContent', {
  30784. get: function() {
  30785. return this.value;
  30786. },
  30787. set: function(value) {
  30788. return this.value = value || '';
  30789. }
  30790. });
  30791. XMLCharacterData.prototype.clone = function() {
  30792. return Object.create(this);
  30793. };
  30794. XMLCharacterData.prototype.substringData = function(offset, count) {
  30795. throw new Error("This DOM method is not implemented." + this.debugInfo());
  30796. };
  30797. XMLCharacterData.prototype.appendData = function(arg) {
  30798. throw new Error("This DOM method is not implemented." + this.debugInfo());
  30799. };
  30800. XMLCharacterData.prototype.insertData = function(offset, arg) {
  30801. throw new Error("This DOM method is not implemented." + this.debugInfo());
  30802. };
  30803. XMLCharacterData.prototype.deleteData = function(offset, count) {
  30804. throw new Error("This DOM method is not implemented." + this.debugInfo());
  30805. };
  30806. XMLCharacterData.prototype.replaceData = function(offset, count, arg) {
  30807. throw new Error("This DOM method is not implemented." + this.debugInfo());
  30808. };
  30809. XMLCharacterData.prototype.isEqualNode = function(node) {
  30810. if (!XMLCharacterData.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
  30811. return false;
  30812. }
  30813. if (node.data !== this.data) {
  30814. return false;
  30815. }
  30816. return true;
  30817. };
  30818. return XMLCharacterData;
  30819. })(XMLNode);
  30820. }).call(this);
  30821. },{"./XMLNode":450}],434:[function(require,module,exports){
  30822. // Generated by CoffeeScript 1.12.7
  30823. (function() {
  30824. var NodeType, XMLCharacterData, XMLComment,
  30825. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  30826. hasProp = {}.hasOwnProperty;
  30827. NodeType = require('./NodeType');
  30828. XMLCharacterData = require('./XMLCharacterData');
  30829. module.exports = XMLComment = (function(superClass) {
  30830. extend(XMLComment, superClass);
  30831. function XMLComment(parent, text) {
  30832. XMLComment.__super__.constructor.call(this, parent);
  30833. if (text == null) {
  30834. throw new Error("Missing comment text. " + this.debugInfo());
  30835. }
  30836. this.name = "#comment";
  30837. this.type = NodeType.Comment;
  30838. this.value = this.stringify.comment(text);
  30839. }
  30840. XMLComment.prototype.clone = function() {
  30841. return Object.create(this);
  30842. };
  30843. XMLComment.prototype.toString = function(options) {
  30844. return this.options.writer.comment(this, this.options.writer.filterOptions(options));
  30845. };
  30846. return XMLComment;
  30847. })(XMLCharacterData);
  30848. }).call(this);
  30849. },{"./NodeType":428,"./XMLCharacterData":433}],435:[function(require,module,exports){
  30850. // Generated by CoffeeScript 1.12.7
  30851. (function() {
  30852. var XMLDOMConfiguration, XMLDOMErrorHandler, XMLDOMStringList;
  30853. XMLDOMErrorHandler = require('./XMLDOMErrorHandler');
  30854. XMLDOMStringList = require('./XMLDOMStringList');
  30855. module.exports = XMLDOMConfiguration = (function() {
  30856. function XMLDOMConfiguration() {
  30857. var clonedSelf;
  30858. this.defaultParams = {
  30859. "canonical-form": false,
  30860. "cdata-sections": false,
  30861. "comments": false,
  30862. "datatype-normalization": false,
  30863. "element-content-whitespace": true,
  30864. "entities": true,
  30865. "error-handler": new XMLDOMErrorHandler(),
  30866. "infoset": true,
  30867. "validate-if-schema": false,
  30868. "namespaces": true,
  30869. "namespace-declarations": true,
  30870. "normalize-characters": false,
  30871. "schema-location": '',
  30872. "schema-type": '',
  30873. "split-cdata-sections": true,
  30874. "validate": false,
  30875. "well-formed": true
  30876. };
  30877. this.params = clonedSelf = Object.create(this.defaultParams);
  30878. }
  30879. Object.defineProperty(XMLDOMConfiguration.prototype, 'parameterNames', {
  30880. get: function() {
  30881. return new XMLDOMStringList(Object.keys(this.defaultParams));
  30882. }
  30883. });
  30884. XMLDOMConfiguration.prototype.getParameter = function(name) {
  30885. if (this.params.hasOwnProperty(name)) {
  30886. return this.params[name];
  30887. } else {
  30888. return null;
  30889. }
  30890. };
  30891. XMLDOMConfiguration.prototype.canSetParameter = function(name, value) {
  30892. return true;
  30893. };
  30894. XMLDOMConfiguration.prototype.setParameter = function(name, value) {
  30895. if (value != null) {
  30896. return this.params[name] = value;
  30897. } else {
  30898. return delete this.params[name];
  30899. }
  30900. };
  30901. return XMLDOMConfiguration;
  30902. })();
  30903. }).call(this);
  30904. },{"./XMLDOMErrorHandler":436,"./XMLDOMStringList":438}],436:[function(require,module,exports){
  30905. // Generated by CoffeeScript 1.12.7
  30906. (function() {
  30907. var XMLDOMErrorHandler;
  30908. module.exports = XMLDOMErrorHandler = (function() {
  30909. function XMLDOMErrorHandler() {}
  30910. XMLDOMErrorHandler.prototype.handleError = function(error) {
  30911. throw new Error(error);
  30912. };
  30913. return XMLDOMErrorHandler;
  30914. })();
  30915. }).call(this);
  30916. },{}],437:[function(require,module,exports){
  30917. // Generated by CoffeeScript 1.12.7
  30918. (function() {
  30919. var XMLDOMImplementation;
  30920. module.exports = XMLDOMImplementation = (function() {
  30921. function XMLDOMImplementation() {}
  30922. XMLDOMImplementation.prototype.hasFeature = function(feature, version) {
  30923. return true;
  30924. };
  30925. XMLDOMImplementation.prototype.createDocumentType = function(qualifiedName, publicId, systemId) {
  30926. throw new Error("This DOM method is not implemented.");
  30927. };
  30928. XMLDOMImplementation.prototype.createDocument = function(namespaceURI, qualifiedName, doctype) {
  30929. throw new Error("This DOM method is not implemented.");
  30930. };
  30931. XMLDOMImplementation.prototype.createHTMLDocument = function(title) {
  30932. throw new Error("This DOM method is not implemented.");
  30933. };
  30934. XMLDOMImplementation.prototype.getFeature = function(feature, version) {
  30935. throw new Error("This DOM method is not implemented.");
  30936. };
  30937. return XMLDOMImplementation;
  30938. })();
  30939. }).call(this);
  30940. },{}],438:[function(require,module,exports){
  30941. // Generated by CoffeeScript 1.12.7
  30942. (function() {
  30943. var XMLDOMStringList;
  30944. module.exports = XMLDOMStringList = (function() {
  30945. function XMLDOMStringList(arr) {
  30946. this.arr = arr || [];
  30947. }
  30948. Object.defineProperty(XMLDOMStringList.prototype, 'length', {
  30949. get: function() {
  30950. return this.arr.length;
  30951. }
  30952. });
  30953. XMLDOMStringList.prototype.item = function(index) {
  30954. return this.arr[index] || null;
  30955. };
  30956. XMLDOMStringList.prototype.contains = function(str) {
  30957. return this.arr.indexOf(str) !== -1;
  30958. };
  30959. return XMLDOMStringList;
  30960. })();
  30961. }).call(this);
  30962. },{}],439:[function(require,module,exports){
  30963. // Generated by CoffeeScript 1.12.7
  30964. (function() {
  30965. var NodeType, XMLDTDAttList, XMLNode,
  30966. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  30967. hasProp = {}.hasOwnProperty;
  30968. XMLNode = require('./XMLNode');
  30969. NodeType = require('./NodeType');
  30970. module.exports = XMLDTDAttList = (function(superClass) {
  30971. extend(XMLDTDAttList, superClass);
  30972. function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) {
  30973. XMLDTDAttList.__super__.constructor.call(this, parent);
  30974. if (elementName == null) {
  30975. throw new Error("Missing DTD element name. " + this.debugInfo());
  30976. }
  30977. if (attributeName == null) {
  30978. throw new Error("Missing DTD attribute name. " + this.debugInfo(elementName));
  30979. }
  30980. if (!attributeType) {
  30981. throw new Error("Missing DTD attribute type. " + this.debugInfo(elementName));
  30982. }
  30983. if (!defaultValueType) {
  30984. throw new Error("Missing DTD attribute default. " + this.debugInfo(elementName));
  30985. }
  30986. if (defaultValueType.indexOf('#') !== 0) {
  30987. defaultValueType = '#' + defaultValueType;
  30988. }
  30989. if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) {
  30990. throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. " + this.debugInfo(elementName));
  30991. }
  30992. if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) {
  30993. throw new Error("Default value only applies to #FIXED or #DEFAULT. " + this.debugInfo(elementName));
  30994. }
  30995. this.elementName = this.stringify.name(elementName);
  30996. this.type = NodeType.AttributeDeclaration;
  30997. this.attributeName = this.stringify.name(attributeName);
  30998. this.attributeType = this.stringify.dtdAttType(attributeType);
  30999. if (defaultValue) {
  31000. this.defaultValue = this.stringify.dtdAttDefault(defaultValue);
  31001. }
  31002. this.defaultValueType = defaultValueType;
  31003. }
  31004. XMLDTDAttList.prototype.toString = function(options) {
  31005. return this.options.writer.dtdAttList(this, this.options.writer.filterOptions(options));
  31006. };
  31007. return XMLDTDAttList;
  31008. })(XMLNode);
  31009. }).call(this);
  31010. },{"./NodeType":428,"./XMLNode":450}],440:[function(require,module,exports){
  31011. // Generated by CoffeeScript 1.12.7
  31012. (function() {
  31013. var NodeType, XMLDTDElement, XMLNode,
  31014. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  31015. hasProp = {}.hasOwnProperty;
  31016. XMLNode = require('./XMLNode');
  31017. NodeType = require('./NodeType');
  31018. module.exports = XMLDTDElement = (function(superClass) {
  31019. extend(XMLDTDElement, superClass);
  31020. function XMLDTDElement(parent, name, value) {
  31021. XMLDTDElement.__super__.constructor.call(this, parent);
  31022. if (name == null) {
  31023. throw new Error("Missing DTD element name. " + this.debugInfo());
  31024. }
  31025. if (!value) {
  31026. value = '(#PCDATA)';
  31027. }
  31028. if (Array.isArray(value)) {
  31029. value = '(' + value.join(',') + ')';
  31030. }
  31031. this.name = this.stringify.name(name);
  31032. this.type = NodeType.ElementDeclaration;
  31033. this.value = this.stringify.dtdElementValue(value);
  31034. }
  31035. XMLDTDElement.prototype.toString = function(options) {
  31036. return this.options.writer.dtdElement(this, this.options.writer.filterOptions(options));
  31037. };
  31038. return XMLDTDElement;
  31039. })(XMLNode);
  31040. }).call(this);
  31041. },{"./NodeType":428,"./XMLNode":450}],441:[function(require,module,exports){
  31042. // Generated by CoffeeScript 1.12.7
  31043. (function() {
  31044. var NodeType, XMLDTDEntity, XMLNode, isObject,
  31045. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  31046. hasProp = {}.hasOwnProperty;
  31047. isObject = require('./Utility').isObject;
  31048. XMLNode = require('./XMLNode');
  31049. NodeType = require('./NodeType');
  31050. module.exports = XMLDTDEntity = (function(superClass) {
  31051. extend(XMLDTDEntity, superClass);
  31052. function XMLDTDEntity(parent, pe, name, value) {
  31053. XMLDTDEntity.__super__.constructor.call(this, parent);
  31054. if (name == null) {
  31055. throw new Error("Missing DTD entity name. " + this.debugInfo(name));
  31056. }
  31057. if (value == null) {
  31058. throw new Error("Missing DTD entity value. " + this.debugInfo(name));
  31059. }
  31060. this.pe = !!pe;
  31061. this.name = this.stringify.name(name);
  31062. this.type = NodeType.EntityDeclaration;
  31063. if (!isObject(value)) {
  31064. this.value = this.stringify.dtdEntityValue(value);
  31065. this.internal = true;
  31066. } else {
  31067. if (!value.pubID && !value.sysID) {
  31068. throw new Error("Public and/or system identifiers are required for an external entity. " + this.debugInfo(name));
  31069. }
  31070. if (value.pubID && !value.sysID) {
  31071. throw new Error("System identifier is required for a public external entity. " + this.debugInfo(name));
  31072. }
  31073. this.internal = false;
  31074. if (value.pubID != null) {
  31075. this.pubID = this.stringify.dtdPubID(value.pubID);
  31076. }
  31077. if (value.sysID != null) {
  31078. this.sysID = this.stringify.dtdSysID(value.sysID);
  31079. }
  31080. if (value.nData != null) {
  31081. this.nData = this.stringify.dtdNData(value.nData);
  31082. }
  31083. if (this.pe && this.nData) {
  31084. throw new Error("Notation declaration is not allowed in a parameter entity. " + this.debugInfo(name));
  31085. }
  31086. }
  31087. }
  31088. Object.defineProperty(XMLDTDEntity.prototype, 'publicId', {
  31089. get: function() {
  31090. return this.pubID;
  31091. }
  31092. });
  31093. Object.defineProperty(XMLDTDEntity.prototype, 'systemId', {
  31094. get: function() {
  31095. return this.sysID;
  31096. }
  31097. });
  31098. Object.defineProperty(XMLDTDEntity.prototype, 'notationName', {
  31099. get: function() {
  31100. return this.nData || null;
  31101. }
  31102. });
  31103. Object.defineProperty(XMLDTDEntity.prototype, 'inputEncoding', {
  31104. get: function() {
  31105. return null;
  31106. }
  31107. });
  31108. Object.defineProperty(XMLDTDEntity.prototype, 'xmlEncoding', {
  31109. get: function() {
  31110. return null;
  31111. }
  31112. });
  31113. Object.defineProperty(XMLDTDEntity.prototype, 'xmlVersion', {
  31114. get: function() {
  31115. return null;
  31116. }
  31117. });
  31118. XMLDTDEntity.prototype.toString = function(options) {
  31119. return this.options.writer.dtdEntity(this, this.options.writer.filterOptions(options));
  31120. };
  31121. return XMLDTDEntity;
  31122. })(XMLNode);
  31123. }).call(this);
  31124. },{"./NodeType":428,"./Utility":429,"./XMLNode":450}],442:[function(require,module,exports){
  31125. // Generated by CoffeeScript 1.12.7
  31126. (function() {
  31127. var NodeType, XMLDTDNotation, XMLNode,
  31128. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  31129. hasProp = {}.hasOwnProperty;
  31130. XMLNode = require('./XMLNode');
  31131. NodeType = require('./NodeType');
  31132. module.exports = XMLDTDNotation = (function(superClass) {
  31133. extend(XMLDTDNotation, superClass);
  31134. function XMLDTDNotation(parent, name, value) {
  31135. XMLDTDNotation.__super__.constructor.call(this, parent);
  31136. if (name == null) {
  31137. throw new Error("Missing DTD notation name. " + this.debugInfo(name));
  31138. }
  31139. if (!value.pubID && !value.sysID) {
  31140. throw new Error("Public or system identifiers are required for an external entity. " + this.debugInfo(name));
  31141. }
  31142. this.name = this.stringify.name(name);
  31143. this.type = NodeType.NotationDeclaration;
  31144. if (value.pubID != null) {
  31145. this.pubID = this.stringify.dtdPubID(value.pubID);
  31146. }
  31147. if (value.sysID != null) {
  31148. this.sysID = this.stringify.dtdSysID(value.sysID);
  31149. }
  31150. }
  31151. Object.defineProperty(XMLDTDNotation.prototype, 'publicId', {
  31152. get: function() {
  31153. return this.pubID;
  31154. }
  31155. });
  31156. Object.defineProperty(XMLDTDNotation.prototype, 'systemId', {
  31157. get: function() {
  31158. return this.sysID;
  31159. }
  31160. });
  31161. XMLDTDNotation.prototype.toString = function(options) {
  31162. return this.options.writer.dtdNotation(this, this.options.writer.filterOptions(options));
  31163. };
  31164. return XMLDTDNotation;
  31165. })(XMLNode);
  31166. }).call(this);
  31167. },{"./NodeType":428,"./XMLNode":450}],443:[function(require,module,exports){
  31168. // Generated by CoffeeScript 1.12.7
  31169. (function() {
  31170. var NodeType, XMLDeclaration, XMLNode, isObject,
  31171. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  31172. hasProp = {}.hasOwnProperty;
  31173. isObject = require('./Utility').isObject;
  31174. XMLNode = require('./XMLNode');
  31175. NodeType = require('./NodeType');
  31176. module.exports = XMLDeclaration = (function(superClass) {
  31177. extend(XMLDeclaration, superClass);
  31178. function XMLDeclaration(parent, version, encoding, standalone) {
  31179. var ref;
  31180. XMLDeclaration.__super__.constructor.call(this, parent);
  31181. if (isObject(version)) {
  31182. ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone;
  31183. }
  31184. if (!version) {
  31185. version = '1.0';
  31186. }
  31187. this.type = NodeType.Declaration;
  31188. this.version = this.stringify.xmlVersion(version);
  31189. if (encoding != null) {
  31190. this.encoding = this.stringify.xmlEncoding(encoding);
  31191. }
  31192. if (standalone != null) {
  31193. this.standalone = this.stringify.xmlStandalone(standalone);
  31194. }
  31195. }
  31196. XMLDeclaration.prototype.toString = function(options) {
  31197. return this.options.writer.declaration(this, this.options.writer.filterOptions(options));
  31198. };
  31199. return XMLDeclaration;
  31200. })(XMLNode);
  31201. }).call(this);
  31202. },{"./NodeType":428,"./Utility":429,"./XMLNode":450}],444:[function(require,module,exports){
  31203. // Generated by CoffeeScript 1.12.7
  31204. (function() {
  31205. var NodeType, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLNamedNodeMap, XMLNode, isObject,
  31206. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  31207. hasProp = {}.hasOwnProperty;
  31208. isObject = require('./Utility').isObject;
  31209. XMLNode = require('./XMLNode');
  31210. NodeType = require('./NodeType');
  31211. XMLDTDAttList = require('./XMLDTDAttList');
  31212. XMLDTDEntity = require('./XMLDTDEntity');
  31213. XMLDTDElement = require('./XMLDTDElement');
  31214. XMLDTDNotation = require('./XMLDTDNotation');
  31215. XMLNamedNodeMap = require('./XMLNamedNodeMap');
  31216. module.exports = XMLDocType = (function(superClass) {
  31217. extend(XMLDocType, superClass);
  31218. function XMLDocType(parent, pubID, sysID) {
  31219. var child, i, len, ref, ref1, ref2;
  31220. XMLDocType.__super__.constructor.call(this, parent);
  31221. this.type = NodeType.DocType;
  31222. if (parent.children) {
  31223. ref = parent.children;
  31224. for (i = 0, len = ref.length; i < len; i++) {
  31225. child = ref[i];
  31226. if (child.type === NodeType.Element) {
  31227. this.name = child.name;
  31228. break;
  31229. }
  31230. }
  31231. }
  31232. this.documentObject = parent;
  31233. if (isObject(pubID)) {
  31234. ref1 = pubID, pubID = ref1.pubID, sysID = ref1.sysID;
  31235. }
  31236. if (sysID == null) {
  31237. ref2 = [pubID, sysID], sysID = ref2[0], pubID = ref2[1];
  31238. }
  31239. if (pubID != null) {
  31240. this.pubID = this.stringify.dtdPubID(pubID);
  31241. }
  31242. if (sysID != null) {
  31243. this.sysID = this.stringify.dtdSysID(sysID);
  31244. }
  31245. }
  31246. Object.defineProperty(XMLDocType.prototype, 'entities', {
  31247. get: function() {
  31248. var child, i, len, nodes, ref;
  31249. nodes = {};
  31250. ref = this.children;
  31251. for (i = 0, len = ref.length; i < len; i++) {
  31252. child = ref[i];
  31253. if ((child.type === NodeType.EntityDeclaration) && !child.pe) {
  31254. nodes[child.name] = child;
  31255. }
  31256. }
  31257. return new XMLNamedNodeMap(nodes);
  31258. }
  31259. });
  31260. Object.defineProperty(XMLDocType.prototype, 'notations', {
  31261. get: function() {
  31262. var child, i, len, nodes, ref;
  31263. nodes = {};
  31264. ref = this.children;
  31265. for (i = 0, len = ref.length; i < len; i++) {
  31266. child = ref[i];
  31267. if (child.type === NodeType.NotationDeclaration) {
  31268. nodes[child.name] = child;
  31269. }
  31270. }
  31271. return new XMLNamedNodeMap(nodes);
  31272. }
  31273. });
  31274. Object.defineProperty(XMLDocType.prototype, 'publicId', {
  31275. get: function() {
  31276. return this.pubID;
  31277. }
  31278. });
  31279. Object.defineProperty(XMLDocType.prototype, 'systemId', {
  31280. get: function() {
  31281. return this.sysID;
  31282. }
  31283. });
  31284. Object.defineProperty(XMLDocType.prototype, 'internalSubset', {
  31285. get: function() {
  31286. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31287. }
  31288. });
  31289. XMLDocType.prototype.element = function(name, value) {
  31290. var child;
  31291. child = new XMLDTDElement(this, name, value);
  31292. this.children.push(child);
  31293. return this;
  31294. };
  31295. XMLDocType.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
  31296. var child;
  31297. child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
  31298. this.children.push(child);
  31299. return this;
  31300. };
  31301. XMLDocType.prototype.entity = function(name, value) {
  31302. var child;
  31303. child = new XMLDTDEntity(this, false, name, value);
  31304. this.children.push(child);
  31305. return this;
  31306. };
  31307. XMLDocType.prototype.pEntity = function(name, value) {
  31308. var child;
  31309. child = new XMLDTDEntity(this, true, name, value);
  31310. this.children.push(child);
  31311. return this;
  31312. };
  31313. XMLDocType.prototype.notation = function(name, value) {
  31314. var child;
  31315. child = new XMLDTDNotation(this, name, value);
  31316. this.children.push(child);
  31317. return this;
  31318. };
  31319. XMLDocType.prototype.toString = function(options) {
  31320. return this.options.writer.docType(this, this.options.writer.filterOptions(options));
  31321. };
  31322. XMLDocType.prototype.ele = function(name, value) {
  31323. return this.element(name, value);
  31324. };
  31325. XMLDocType.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
  31326. return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);
  31327. };
  31328. XMLDocType.prototype.ent = function(name, value) {
  31329. return this.entity(name, value);
  31330. };
  31331. XMLDocType.prototype.pent = function(name, value) {
  31332. return this.pEntity(name, value);
  31333. };
  31334. XMLDocType.prototype.not = function(name, value) {
  31335. return this.notation(name, value);
  31336. };
  31337. XMLDocType.prototype.up = function() {
  31338. return this.root() || this.documentObject;
  31339. };
  31340. XMLDocType.prototype.isEqualNode = function(node) {
  31341. if (!XMLDocType.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
  31342. return false;
  31343. }
  31344. if (node.name !== this.name) {
  31345. return false;
  31346. }
  31347. if (node.publicId !== this.publicId) {
  31348. return false;
  31349. }
  31350. if (node.systemId !== this.systemId) {
  31351. return false;
  31352. }
  31353. return true;
  31354. };
  31355. return XMLDocType;
  31356. })(XMLNode);
  31357. }).call(this);
  31358. },{"./NodeType":428,"./Utility":429,"./XMLDTDAttList":439,"./XMLDTDElement":440,"./XMLDTDEntity":441,"./XMLDTDNotation":442,"./XMLNamedNodeMap":449,"./XMLNode":450}],445:[function(require,module,exports){
  31359. // Generated by CoffeeScript 1.12.7
  31360. (function() {
  31361. var NodeType, XMLDOMConfiguration, XMLDOMImplementation, XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject,
  31362. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  31363. hasProp = {}.hasOwnProperty;
  31364. isPlainObject = require('./Utility').isPlainObject;
  31365. XMLDOMImplementation = require('./XMLDOMImplementation');
  31366. XMLDOMConfiguration = require('./XMLDOMConfiguration');
  31367. XMLNode = require('./XMLNode');
  31368. NodeType = require('./NodeType');
  31369. XMLStringifier = require('./XMLStringifier');
  31370. XMLStringWriter = require('./XMLStringWriter');
  31371. module.exports = XMLDocument = (function(superClass) {
  31372. extend(XMLDocument, superClass);
  31373. function XMLDocument(options) {
  31374. XMLDocument.__super__.constructor.call(this, null);
  31375. this.name = "#document";
  31376. this.type = NodeType.Document;
  31377. this.documentURI = null;
  31378. this.domConfig = new XMLDOMConfiguration();
  31379. options || (options = {});
  31380. if (!options.writer) {
  31381. options.writer = new XMLStringWriter();
  31382. }
  31383. this.options = options;
  31384. this.stringify = new XMLStringifier(options);
  31385. }
  31386. Object.defineProperty(XMLDocument.prototype, 'implementation', {
  31387. value: new XMLDOMImplementation()
  31388. });
  31389. Object.defineProperty(XMLDocument.prototype, 'doctype', {
  31390. get: function() {
  31391. var child, i, len, ref;
  31392. ref = this.children;
  31393. for (i = 0, len = ref.length; i < len; i++) {
  31394. child = ref[i];
  31395. if (child.type === NodeType.DocType) {
  31396. return child;
  31397. }
  31398. }
  31399. return null;
  31400. }
  31401. });
  31402. Object.defineProperty(XMLDocument.prototype, 'documentElement', {
  31403. get: function() {
  31404. return this.rootObject || null;
  31405. }
  31406. });
  31407. Object.defineProperty(XMLDocument.prototype, 'inputEncoding', {
  31408. get: function() {
  31409. return null;
  31410. }
  31411. });
  31412. Object.defineProperty(XMLDocument.prototype, 'strictErrorChecking', {
  31413. get: function() {
  31414. return false;
  31415. }
  31416. });
  31417. Object.defineProperty(XMLDocument.prototype, 'xmlEncoding', {
  31418. get: function() {
  31419. if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
  31420. return this.children[0].encoding;
  31421. } else {
  31422. return null;
  31423. }
  31424. }
  31425. });
  31426. Object.defineProperty(XMLDocument.prototype, 'xmlStandalone', {
  31427. get: function() {
  31428. if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
  31429. return this.children[0].standalone === 'yes';
  31430. } else {
  31431. return false;
  31432. }
  31433. }
  31434. });
  31435. Object.defineProperty(XMLDocument.prototype, 'xmlVersion', {
  31436. get: function() {
  31437. if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
  31438. return this.children[0].version;
  31439. } else {
  31440. return "1.0";
  31441. }
  31442. }
  31443. });
  31444. Object.defineProperty(XMLDocument.prototype, 'URL', {
  31445. get: function() {
  31446. return this.documentURI;
  31447. }
  31448. });
  31449. Object.defineProperty(XMLDocument.prototype, 'origin', {
  31450. get: function() {
  31451. return null;
  31452. }
  31453. });
  31454. Object.defineProperty(XMLDocument.prototype, 'compatMode', {
  31455. get: function() {
  31456. return null;
  31457. }
  31458. });
  31459. Object.defineProperty(XMLDocument.prototype, 'characterSet', {
  31460. get: function() {
  31461. return null;
  31462. }
  31463. });
  31464. Object.defineProperty(XMLDocument.prototype, 'contentType', {
  31465. get: function() {
  31466. return null;
  31467. }
  31468. });
  31469. XMLDocument.prototype.end = function(writer) {
  31470. var writerOptions;
  31471. writerOptions = {};
  31472. if (!writer) {
  31473. writer = this.options.writer;
  31474. } else if (isPlainObject(writer)) {
  31475. writerOptions = writer;
  31476. writer = this.options.writer;
  31477. }
  31478. return writer.document(this, writer.filterOptions(writerOptions));
  31479. };
  31480. XMLDocument.prototype.toString = function(options) {
  31481. return this.options.writer.document(this, this.options.writer.filterOptions(options));
  31482. };
  31483. XMLDocument.prototype.createElement = function(tagName) {
  31484. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31485. };
  31486. XMLDocument.prototype.createDocumentFragment = function() {
  31487. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31488. };
  31489. XMLDocument.prototype.createTextNode = function(data) {
  31490. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31491. };
  31492. XMLDocument.prototype.createComment = function(data) {
  31493. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31494. };
  31495. XMLDocument.prototype.createCDATASection = function(data) {
  31496. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31497. };
  31498. XMLDocument.prototype.createProcessingInstruction = function(target, data) {
  31499. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31500. };
  31501. XMLDocument.prototype.createAttribute = function(name) {
  31502. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31503. };
  31504. XMLDocument.prototype.createEntityReference = function(name) {
  31505. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31506. };
  31507. XMLDocument.prototype.getElementsByTagName = function(tagname) {
  31508. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31509. };
  31510. XMLDocument.prototype.importNode = function(importedNode, deep) {
  31511. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31512. };
  31513. XMLDocument.prototype.createElementNS = function(namespaceURI, qualifiedName) {
  31514. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31515. };
  31516. XMLDocument.prototype.createAttributeNS = function(namespaceURI, qualifiedName) {
  31517. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31518. };
  31519. XMLDocument.prototype.getElementsByTagNameNS = function(namespaceURI, localName) {
  31520. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31521. };
  31522. XMLDocument.prototype.getElementById = function(elementId) {
  31523. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31524. };
  31525. XMLDocument.prototype.adoptNode = function(source) {
  31526. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31527. };
  31528. XMLDocument.prototype.normalizeDocument = function() {
  31529. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31530. };
  31531. XMLDocument.prototype.renameNode = function(node, namespaceURI, qualifiedName) {
  31532. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31533. };
  31534. XMLDocument.prototype.getElementsByClassName = function(classNames) {
  31535. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31536. };
  31537. XMLDocument.prototype.createEvent = function(eventInterface) {
  31538. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31539. };
  31540. XMLDocument.prototype.createRange = function() {
  31541. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31542. };
  31543. XMLDocument.prototype.createNodeIterator = function(root, whatToShow, filter) {
  31544. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31545. };
  31546. XMLDocument.prototype.createTreeWalker = function(root, whatToShow, filter) {
  31547. throw new Error("This DOM method is not implemented." + this.debugInfo());
  31548. };
  31549. return XMLDocument;
  31550. })(XMLNode);
  31551. }).call(this);
  31552. },{"./NodeType":428,"./Utility":429,"./XMLDOMConfiguration":435,"./XMLDOMImplementation":437,"./XMLNode":450,"./XMLStringWriter":455,"./XMLStringifier":456}],446:[function(require,module,exports){
  31553. // Generated by CoffeeScript 1.12.7
  31554. (function() {
  31555. var NodeType, WriterState, XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocument, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, getValue, isFunction, isObject, isPlainObject, ref,
  31556. hasProp = {}.hasOwnProperty;
  31557. ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction, isPlainObject = ref.isPlainObject, getValue = ref.getValue;
  31558. NodeType = require('./NodeType');
  31559. XMLDocument = require('./XMLDocument');
  31560. XMLElement = require('./XMLElement');
  31561. XMLCData = require('./XMLCData');
  31562. XMLComment = require('./XMLComment');
  31563. XMLRaw = require('./XMLRaw');
  31564. XMLText = require('./XMLText');
  31565. XMLProcessingInstruction = require('./XMLProcessingInstruction');
  31566. XMLDeclaration = require('./XMLDeclaration');
  31567. XMLDocType = require('./XMLDocType');
  31568. XMLDTDAttList = require('./XMLDTDAttList');
  31569. XMLDTDEntity = require('./XMLDTDEntity');
  31570. XMLDTDElement = require('./XMLDTDElement');
  31571. XMLDTDNotation = require('./XMLDTDNotation');
  31572. XMLAttribute = require('./XMLAttribute');
  31573. XMLStringifier = require('./XMLStringifier');
  31574. XMLStringWriter = require('./XMLStringWriter');
  31575. WriterState = require('./WriterState');
  31576. module.exports = XMLDocumentCB = (function() {
  31577. function XMLDocumentCB(options, onData, onEnd) {
  31578. var writerOptions;
  31579. this.name = "?xml";
  31580. this.type = NodeType.Document;
  31581. options || (options = {});
  31582. writerOptions = {};
  31583. if (!options.writer) {
  31584. options.writer = new XMLStringWriter();
  31585. } else if (isPlainObject(options.writer)) {
  31586. writerOptions = options.writer;
  31587. options.writer = new XMLStringWriter();
  31588. }
  31589. this.options = options;
  31590. this.writer = options.writer;
  31591. this.writerOptions = this.writer.filterOptions(writerOptions);
  31592. this.stringify = new XMLStringifier(options);
  31593. this.onDataCallback = onData || function() {};
  31594. this.onEndCallback = onEnd || function() {};
  31595. this.currentNode = null;
  31596. this.currentLevel = -1;
  31597. this.openTags = {};
  31598. this.documentStarted = false;
  31599. this.documentCompleted = false;
  31600. this.root = null;
  31601. }
  31602. XMLDocumentCB.prototype.createChildNode = function(node) {
  31603. var att, attName, attributes, child, i, len, ref1, ref2;
  31604. switch (node.type) {
  31605. case NodeType.CData:
  31606. this.cdata(node.value);
  31607. break;
  31608. case NodeType.Comment:
  31609. this.comment(node.value);
  31610. break;
  31611. case NodeType.Element:
  31612. attributes = {};
  31613. ref1 = node.attribs;
  31614. for (attName in ref1) {
  31615. if (!hasProp.call(ref1, attName)) continue;
  31616. att = ref1[attName];
  31617. attributes[attName] = att.value;
  31618. }
  31619. this.node(node.name, attributes);
  31620. break;
  31621. case NodeType.Dummy:
  31622. this.dummy();
  31623. break;
  31624. case NodeType.Raw:
  31625. this.raw(node.value);
  31626. break;
  31627. case NodeType.Text:
  31628. this.text(node.value);
  31629. break;
  31630. case NodeType.ProcessingInstruction:
  31631. this.instruction(node.target, node.value);
  31632. break;
  31633. default:
  31634. throw new Error("This XML node type is not supported in a JS object: " + node.constructor.name);
  31635. }
  31636. ref2 = node.children;
  31637. for (i = 0, len = ref2.length; i < len; i++) {
  31638. child = ref2[i];
  31639. this.createChildNode(child);
  31640. if (child.type === NodeType.Element) {
  31641. this.up();
  31642. }
  31643. }
  31644. return this;
  31645. };
  31646. XMLDocumentCB.prototype.dummy = function() {
  31647. return this;
  31648. };
  31649. XMLDocumentCB.prototype.node = function(name, attributes, text) {
  31650. var ref1;
  31651. if (name == null) {
  31652. throw new Error("Missing node name.");
  31653. }
  31654. if (this.root && this.currentLevel === -1) {
  31655. throw new Error("Document can only have one root node. " + this.debugInfo(name));
  31656. }
  31657. this.openCurrent();
  31658. name = getValue(name);
  31659. if (attributes == null) {
  31660. attributes = {};
  31661. }
  31662. attributes = getValue(attributes);
  31663. if (!isObject(attributes)) {
  31664. ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];
  31665. }
  31666. this.currentNode = new XMLElement(this, name, attributes);
  31667. this.currentNode.children = false;
  31668. this.currentLevel++;
  31669. this.openTags[this.currentLevel] = this.currentNode;
  31670. if (text != null) {
  31671. this.text(text);
  31672. }
  31673. return this;
  31674. };
  31675. XMLDocumentCB.prototype.element = function(name, attributes, text) {
  31676. var child, i, len, oldValidationFlag, ref1, root;
  31677. if (this.currentNode && this.currentNode.type === NodeType.DocType) {
  31678. this.dtdElement.apply(this, arguments);
  31679. } else {
  31680. if (Array.isArray(name) || isObject(name) || isFunction(name)) {
  31681. oldValidationFlag = this.options.noValidation;
  31682. this.options.noValidation = true;
  31683. root = new XMLDocument(this.options).element('TEMP_ROOT');
  31684. root.element(name);
  31685. this.options.noValidation = oldValidationFlag;
  31686. ref1 = root.children;
  31687. for (i = 0, len = ref1.length; i < len; i++) {
  31688. child = ref1[i];
  31689. this.createChildNode(child);
  31690. if (child.type === NodeType.Element) {
  31691. this.up();
  31692. }
  31693. }
  31694. } else {
  31695. this.node(name, attributes, text);
  31696. }
  31697. }
  31698. return this;
  31699. };
  31700. XMLDocumentCB.prototype.attribute = function(name, value) {
  31701. var attName, attValue;
  31702. if (!this.currentNode || this.currentNode.children) {
  31703. throw new Error("att() can only be used immediately after an ele() call in callback mode. " + this.debugInfo(name));
  31704. }
  31705. if (name != null) {
  31706. name = getValue(name);
  31707. }
  31708. if (isObject(name)) {
  31709. for (attName in name) {
  31710. if (!hasProp.call(name, attName)) continue;
  31711. attValue = name[attName];
  31712. this.attribute(attName, attValue);
  31713. }
  31714. } else {
  31715. if (isFunction(value)) {
  31716. value = value.apply();
  31717. }
  31718. if (this.options.keepNullAttributes && (value == null)) {
  31719. this.currentNode.attribs[name] = new XMLAttribute(this, name, "");
  31720. } else if (value != null) {
  31721. this.currentNode.attribs[name] = new XMLAttribute(this, name, value);
  31722. }
  31723. }
  31724. return this;
  31725. };
  31726. XMLDocumentCB.prototype.text = function(value) {
  31727. var node;
  31728. this.openCurrent();
  31729. node = new XMLText(this, value);
  31730. this.onData(this.writer.text(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
  31731. return this;
  31732. };
  31733. XMLDocumentCB.prototype.cdata = function(value) {
  31734. var node;
  31735. this.openCurrent();
  31736. node = new XMLCData(this, value);
  31737. this.onData(this.writer.cdata(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
  31738. return this;
  31739. };
  31740. XMLDocumentCB.prototype.comment = function(value) {
  31741. var node;
  31742. this.openCurrent();
  31743. node = new XMLComment(this, value);
  31744. this.onData(this.writer.comment(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
  31745. return this;
  31746. };
  31747. XMLDocumentCB.prototype.raw = function(value) {
  31748. var node;
  31749. this.openCurrent();
  31750. node = new XMLRaw(this, value);
  31751. this.onData(this.writer.raw(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
  31752. return this;
  31753. };
  31754. XMLDocumentCB.prototype.instruction = function(target, value) {
  31755. var i, insTarget, insValue, len, node;
  31756. this.openCurrent();
  31757. if (target != null) {
  31758. target = getValue(target);
  31759. }
  31760. if (value != null) {
  31761. value = getValue(value);
  31762. }
  31763. if (Array.isArray(target)) {
  31764. for (i = 0, len = target.length; i < len; i++) {
  31765. insTarget = target[i];
  31766. this.instruction(insTarget);
  31767. }
  31768. } else if (isObject(target)) {
  31769. for (insTarget in target) {
  31770. if (!hasProp.call(target, insTarget)) continue;
  31771. insValue = target[insTarget];
  31772. this.instruction(insTarget, insValue);
  31773. }
  31774. } else {
  31775. if (isFunction(value)) {
  31776. value = value.apply();
  31777. }
  31778. node = new XMLProcessingInstruction(this, target, value);
  31779. this.onData(this.writer.processingInstruction(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
  31780. }
  31781. return this;
  31782. };
  31783. XMLDocumentCB.prototype.declaration = function(version, encoding, standalone) {
  31784. var node;
  31785. this.openCurrent();
  31786. if (this.documentStarted) {
  31787. throw new Error("declaration() must be the first node.");
  31788. }
  31789. node = new XMLDeclaration(this, version, encoding, standalone);
  31790. this.onData(this.writer.declaration(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
  31791. return this;
  31792. };
  31793. XMLDocumentCB.prototype.doctype = function(root, pubID, sysID) {
  31794. this.openCurrent();
  31795. if (root == null) {
  31796. throw new Error("Missing root node name.");
  31797. }
  31798. if (this.root) {
  31799. throw new Error("dtd() must come before the root node.");
  31800. }
  31801. this.currentNode = new XMLDocType(this, pubID, sysID);
  31802. this.currentNode.rootNodeName = root;
  31803. this.currentNode.children = false;
  31804. this.currentLevel++;
  31805. this.openTags[this.currentLevel] = this.currentNode;
  31806. return this;
  31807. };
  31808. XMLDocumentCB.prototype.dtdElement = function(name, value) {
  31809. var node;
  31810. this.openCurrent();
  31811. node = new XMLDTDElement(this, name, value);
  31812. this.onData(this.writer.dtdElement(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
  31813. return this;
  31814. };
  31815. XMLDocumentCB.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
  31816. var node;
  31817. this.openCurrent();
  31818. node = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
  31819. this.onData(this.writer.dtdAttList(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
  31820. return this;
  31821. };
  31822. XMLDocumentCB.prototype.entity = function(name, value) {
  31823. var node;
  31824. this.openCurrent();
  31825. node = new XMLDTDEntity(this, false, name, value);
  31826. this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
  31827. return this;
  31828. };
  31829. XMLDocumentCB.prototype.pEntity = function(name, value) {
  31830. var node;
  31831. this.openCurrent();
  31832. node = new XMLDTDEntity(this, true, name, value);
  31833. this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
  31834. return this;
  31835. };
  31836. XMLDocumentCB.prototype.notation = function(name, value) {
  31837. var node;
  31838. this.openCurrent();
  31839. node = new XMLDTDNotation(this, name, value);
  31840. this.onData(this.writer.dtdNotation(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
  31841. return this;
  31842. };
  31843. XMLDocumentCB.prototype.up = function() {
  31844. if (this.currentLevel < 0) {
  31845. throw new Error("The document node has no parent.");
  31846. }
  31847. if (this.currentNode) {
  31848. if (this.currentNode.children) {
  31849. this.closeNode(this.currentNode);
  31850. } else {
  31851. this.openNode(this.currentNode);
  31852. }
  31853. this.currentNode = null;
  31854. } else {
  31855. this.closeNode(this.openTags[this.currentLevel]);
  31856. }
  31857. delete this.openTags[this.currentLevel];
  31858. this.currentLevel--;
  31859. return this;
  31860. };
  31861. XMLDocumentCB.prototype.end = function() {
  31862. while (this.currentLevel >= 0) {
  31863. this.up();
  31864. }
  31865. return this.onEnd();
  31866. };
  31867. XMLDocumentCB.prototype.openCurrent = function() {
  31868. if (this.currentNode) {
  31869. this.currentNode.children = true;
  31870. return this.openNode(this.currentNode);
  31871. }
  31872. };
  31873. XMLDocumentCB.prototype.openNode = function(node) {
  31874. var att, chunk, name, ref1;
  31875. if (!node.isOpen) {
  31876. if (!this.root && this.currentLevel === 0 && node.type === NodeType.Element) {
  31877. this.root = node;
  31878. }
  31879. chunk = '';
  31880. if (node.type === NodeType.Element) {
  31881. this.writerOptions.state = WriterState.OpenTag;
  31882. chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '<' + node.name;
  31883. ref1 = node.attribs;
  31884. for (name in ref1) {
  31885. if (!hasProp.call(ref1, name)) continue;
  31886. att = ref1[name];
  31887. chunk += this.writer.attribute(att, this.writerOptions, this.currentLevel);
  31888. }
  31889. chunk += (node.children ? '>' : '/>') + this.writer.endline(node, this.writerOptions, this.currentLevel);
  31890. this.writerOptions.state = WriterState.InsideTag;
  31891. } else {
  31892. this.writerOptions.state = WriterState.OpenTag;
  31893. chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '<!DOCTYPE ' + node.rootNodeName;
  31894. if (node.pubID && node.sysID) {
  31895. chunk += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
  31896. } else if (node.sysID) {
  31897. chunk += ' SYSTEM "' + node.sysID + '"';
  31898. }
  31899. if (node.children) {
  31900. chunk += ' [';
  31901. this.writerOptions.state = WriterState.InsideTag;
  31902. } else {
  31903. this.writerOptions.state = WriterState.CloseTag;
  31904. chunk += '>';
  31905. }
  31906. chunk += this.writer.endline(node, this.writerOptions, this.currentLevel);
  31907. }
  31908. this.onData(chunk, this.currentLevel);
  31909. return node.isOpen = true;
  31910. }
  31911. };
  31912. XMLDocumentCB.prototype.closeNode = function(node) {
  31913. var chunk;
  31914. if (!node.isClosed) {
  31915. chunk = '';
  31916. this.writerOptions.state = WriterState.CloseTag;
  31917. if (node.type === NodeType.Element) {
  31918. chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '</' + node.name + '>' + this.writer.endline(node, this.writerOptions, this.currentLevel);
  31919. } else {
  31920. chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + ']>' + this.writer.endline(node, this.writerOptions, this.currentLevel);
  31921. }
  31922. this.writerOptions.state = WriterState.None;
  31923. this.onData(chunk, this.currentLevel);
  31924. return node.isClosed = true;
  31925. }
  31926. };
  31927. XMLDocumentCB.prototype.onData = function(chunk, level) {
  31928. this.documentStarted = true;
  31929. return this.onDataCallback(chunk, level + 1);
  31930. };
  31931. XMLDocumentCB.prototype.onEnd = function() {
  31932. this.documentCompleted = true;
  31933. return this.onEndCallback();
  31934. };
  31935. XMLDocumentCB.prototype.debugInfo = function(name) {
  31936. if (name == null) {
  31937. return "";
  31938. } else {
  31939. return "node: <" + name + ">";
  31940. }
  31941. };
  31942. XMLDocumentCB.prototype.ele = function() {
  31943. return this.element.apply(this, arguments);
  31944. };
  31945. XMLDocumentCB.prototype.nod = function(name, attributes, text) {
  31946. return this.node(name, attributes, text);
  31947. };
  31948. XMLDocumentCB.prototype.txt = function(value) {
  31949. return this.text(value);
  31950. };
  31951. XMLDocumentCB.prototype.dat = function(value) {
  31952. return this.cdata(value);
  31953. };
  31954. XMLDocumentCB.prototype.com = function(value) {
  31955. return this.comment(value);
  31956. };
  31957. XMLDocumentCB.prototype.ins = function(target, value) {
  31958. return this.instruction(target, value);
  31959. };
  31960. XMLDocumentCB.prototype.dec = function(version, encoding, standalone) {
  31961. return this.declaration(version, encoding, standalone);
  31962. };
  31963. XMLDocumentCB.prototype.dtd = function(root, pubID, sysID) {
  31964. return this.doctype(root, pubID, sysID);
  31965. };
  31966. XMLDocumentCB.prototype.e = function(name, attributes, text) {
  31967. return this.element(name, attributes, text);
  31968. };
  31969. XMLDocumentCB.prototype.n = function(name, attributes, text) {
  31970. return this.node(name, attributes, text);
  31971. };
  31972. XMLDocumentCB.prototype.t = function(value) {
  31973. return this.text(value);
  31974. };
  31975. XMLDocumentCB.prototype.d = function(value) {
  31976. return this.cdata(value);
  31977. };
  31978. XMLDocumentCB.prototype.c = function(value) {
  31979. return this.comment(value);
  31980. };
  31981. XMLDocumentCB.prototype.r = function(value) {
  31982. return this.raw(value);
  31983. };
  31984. XMLDocumentCB.prototype.i = function(target, value) {
  31985. return this.instruction(target, value);
  31986. };
  31987. XMLDocumentCB.prototype.att = function() {
  31988. if (this.currentNode && this.currentNode.type === NodeType.DocType) {
  31989. return this.attList.apply(this, arguments);
  31990. } else {
  31991. return this.attribute.apply(this, arguments);
  31992. }
  31993. };
  31994. XMLDocumentCB.prototype.a = function() {
  31995. if (this.currentNode && this.currentNode.type === NodeType.DocType) {
  31996. return this.attList.apply(this, arguments);
  31997. } else {
  31998. return this.attribute.apply(this, arguments);
  31999. }
  32000. };
  32001. XMLDocumentCB.prototype.ent = function(name, value) {
  32002. return this.entity(name, value);
  32003. };
  32004. XMLDocumentCB.prototype.pent = function(name, value) {
  32005. return this.pEntity(name, value);
  32006. };
  32007. XMLDocumentCB.prototype.not = function(name, value) {
  32008. return this.notation(name, value);
  32009. };
  32010. return XMLDocumentCB;
  32011. })();
  32012. }).call(this);
  32013. },{"./NodeType":428,"./Utility":429,"./WriterState":430,"./XMLAttribute":431,"./XMLCData":432,"./XMLComment":434,"./XMLDTDAttList":439,"./XMLDTDElement":440,"./XMLDTDEntity":441,"./XMLDTDNotation":442,"./XMLDeclaration":443,"./XMLDocType":444,"./XMLDocument":445,"./XMLElement":448,"./XMLProcessingInstruction":452,"./XMLRaw":453,"./XMLStringWriter":455,"./XMLStringifier":456,"./XMLText":457}],447:[function(require,module,exports){
  32014. // Generated by CoffeeScript 1.12.7
  32015. (function() {
  32016. var NodeType, XMLDummy, XMLNode,
  32017. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  32018. hasProp = {}.hasOwnProperty;
  32019. XMLNode = require('./XMLNode');
  32020. NodeType = require('./NodeType');
  32021. module.exports = XMLDummy = (function(superClass) {
  32022. extend(XMLDummy, superClass);
  32023. function XMLDummy(parent) {
  32024. XMLDummy.__super__.constructor.call(this, parent);
  32025. this.type = NodeType.Dummy;
  32026. }
  32027. XMLDummy.prototype.clone = function() {
  32028. return Object.create(this);
  32029. };
  32030. XMLDummy.prototype.toString = function(options) {
  32031. return '';
  32032. };
  32033. return XMLDummy;
  32034. })(XMLNode);
  32035. }).call(this);
  32036. },{"./NodeType":428,"./XMLNode":450}],448:[function(require,module,exports){
  32037. // Generated by CoffeeScript 1.12.7
  32038. (function() {
  32039. var NodeType, XMLAttribute, XMLElement, XMLNamedNodeMap, XMLNode, getValue, isFunction, isObject, ref,
  32040. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  32041. hasProp = {}.hasOwnProperty;
  32042. ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction, getValue = ref.getValue;
  32043. XMLNode = require('./XMLNode');
  32044. NodeType = require('./NodeType');
  32045. XMLAttribute = require('./XMLAttribute');
  32046. XMLNamedNodeMap = require('./XMLNamedNodeMap');
  32047. module.exports = XMLElement = (function(superClass) {
  32048. extend(XMLElement, superClass);
  32049. function XMLElement(parent, name, attributes) {
  32050. var child, j, len, ref1;
  32051. XMLElement.__super__.constructor.call(this, parent);
  32052. if (name == null) {
  32053. throw new Error("Missing element name. " + this.debugInfo());
  32054. }
  32055. this.name = this.stringify.name(name);
  32056. this.type = NodeType.Element;
  32057. this.attribs = {};
  32058. this.schemaTypeInfo = null;
  32059. if (attributes != null) {
  32060. this.attribute(attributes);
  32061. }
  32062. if (parent.type === NodeType.Document) {
  32063. this.isRoot = true;
  32064. this.documentObject = parent;
  32065. parent.rootObject = this;
  32066. if (parent.children) {
  32067. ref1 = parent.children;
  32068. for (j = 0, len = ref1.length; j < len; j++) {
  32069. child = ref1[j];
  32070. if (child.type === NodeType.DocType) {
  32071. child.name = this.name;
  32072. break;
  32073. }
  32074. }
  32075. }
  32076. }
  32077. }
  32078. Object.defineProperty(XMLElement.prototype, 'tagName', {
  32079. get: function() {
  32080. return this.name;
  32081. }
  32082. });
  32083. Object.defineProperty(XMLElement.prototype, 'namespaceURI', {
  32084. get: function() {
  32085. return '';
  32086. }
  32087. });
  32088. Object.defineProperty(XMLElement.prototype, 'prefix', {
  32089. get: function() {
  32090. return '';
  32091. }
  32092. });
  32093. Object.defineProperty(XMLElement.prototype, 'localName', {
  32094. get: function() {
  32095. return this.name;
  32096. }
  32097. });
  32098. Object.defineProperty(XMLElement.prototype, 'id', {
  32099. get: function() {
  32100. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32101. }
  32102. });
  32103. Object.defineProperty(XMLElement.prototype, 'className', {
  32104. get: function() {
  32105. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32106. }
  32107. });
  32108. Object.defineProperty(XMLElement.prototype, 'classList', {
  32109. get: function() {
  32110. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32111. }
  32112. });
  32113. Object.defineProperty(XMLElement.prototype, 'attributes', {
  32114. get: function() {
  32115. if (!this.attributeMap || !this.attributeMap.nodes) {
  32116. this.attributeMap = new XMLNamedNodeMap(this.attribs);
  32117. }
  32118. return this.attributeMap;
  32119. }
  32120. });
  32121. XMLElement.prototype.clone = function() {
  32122. var att, attName, clonedSelf, ref1;
  32123. clonedSelf = Object.create(this);
  32124. if (clonedSelf.isRoot) {
  32125. clonedSelf.documentObject = null;
  32126. }
  32127. clonedSelf.attribs = {};
  32128. ref1 = this.attribs;
  32129. for (attName in ref1) {
  32130. if (!hasProp.call(ref1, attName)) continue;
  32131. att = ref1[attName];
  32132. clonedSelf.attribs[attName] = att.clone();
  32133. }
  32134. clonedSelf.children = [];
  32135. this.children.forEach(function(child) {
  32136. var clonedChild;
  32137. clonedChild = child.clone();
  32138. clonedChild.parent = clonedSelf;
  32139. return clonedSelf.children.push(clonedChild);
  32140. });
  32141. return clonedSelf;
  32142. };
  32143. XMLElement.prototype.attribute = function(name, value) {
  32144. var attName, attValue;
  32145. if (name != null) {
  32146. name = getValue(name);
  32147. }
  32148. if (isObject(name)) {
  32149. for (attName in name) {
  32150. if (!hasProp.call(name, attName)) continue;
  32151. attValue = name[attName];
  32152. this.attribute(attName, attValue);
  32153. }
  32154. } else {
  32155. if (isFunction(value)) {
  32156. value = value.apply();
  32157. }
  32158. if (this.options.keepNullAttributes && (value == null)) {
  32159. this.attribs[name] = new XMLAttribute(this, name, "");
  32160. } else if (value != null) {
  32161. this.attribs[name] = new XMLAttribute(this, name, value);
  32162. }
  32163. }
  32164. return this;
  32165. };
  32166. XMLElement.prototype.removeAttribute = function(name) {
  32167. var attName, j, len;
  32168. if (name == null) {
  32169. throw new Error("Missing attribute name. " + this.debugInfo());
  32170. }
  32171. name = getValue(name);
  32172. if (Array.isArray(name)) {
  32173. for (j = 0, len = name.length; j < len; j++) {
  32174. attName = name[j];
  32175. delete this.attribs[attName];
  32176. }
  32177. } else {
  32178. delete this.attribs[name];
  32179. }
  32180. return this;
  32181. };
  32182. XMLElement.prototype.toString = function(options) {
  32183. return this.options.writer.element(this, this.options.writer.filterOptions(options));
  32184. };
  32185. XMLElement.prototype.att = function(name, value) {
  32186. return this.attribute(name, value);
  32187. };
  32188. XMLElement.prototype.a = function(name, value) {
  32189. return this.attribute(name, value);
  32190. };
  32191. XMLElement.prototype.getAttribute = function(name) {
  32192. if (this.attribs.hasOwnProperty(name)) {
  32193. return this.attribs[name].value;
  32194. } else {
  32195. return null;
  32196. }
  32197. };
  32198. XMLElement.prototype.setAttribute = function(name, value) {
  32199. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32200. };
  32201. XMLElement.prototype.getAttributeNode = function(name) {
  32202. if (this.attribs.hasOwnProperty(name)) {
  32203. return this.attribs[name];
  32204. } else {
  32205. return null;
  32206. }
  32207. };
  32208. XMLElement.prototype.setAttributeNode = function(newAttr) {
  32209. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32210. };
  32211. XMLElement.prototype.removeAttributeNode = function(oldAttr) {
  32212. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32213. };
  32214. XMLElement.prototype.getElementsByTagName = function(name) {
  32215. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32216. };
  32217. XMLElement.prototype.getAttributeNS = function(namespaceURI, localName) {
  32218. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32219. };
  32220. XMLElement.prototype.setAttributeNS = function(namespaceURI, qualifiedName, value) {
  32221. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32222. };
  32223. XMLElement.prototype.removeAttributeNS = function(namespaceURI, localName) {
  32224. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32225. };
  32226. XMLElement.prototype.getAttributeNodeNS = function(namespaceURI, localName) {
  32227. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32228. };
  32229. XMLElement.prototype.setAttributeNodeNS = function(newAttr) {
  32230. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32231. };
  32232. XMLElement.prototype.getElementsByTagNameNS = function(namespaceURI, localName) {
  32233. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32234. };
  32235. XMLElement.prototype.hasAttribute = function(name) {
  32236. return this.attribs.hasOwnProperty(name);
  32237. };
  32238. XMLElement.prototype.hasAttributeNS = function(namespaceURI, localName) {
  32239. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32240. };
  32241. XMLElement.prototype.setIdAttribute = function(name, isId) {
  32242. if (this.attribs.hasOwnProperty(name)) {
  32243. return this.attribs[name].isId;
  32244. } else {
  32245. return isId;
  32246. }
  32247. };
  32248. XMLElement.prototype.setIdAttributeNS = function(namespaceURI, localName, isId) {
  32249. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32250. };
  32251. XMLElement.prototype.setIdAttributeNode = function(idAttr, isId) {
  32252. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32253. };
  32254. XMLElement.prototype.getElementsByTagName = function(tagname) {
  32255. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32256. };
  32257. XMLElement.prototype.getElementsByTagNameNS = function(namespaceURI, localName) {
  32258. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32259. };
  32260. XMLElement.prototype.getElementsByClassName = function(classNames) {
  32261. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32262. };
  32263. XMLElement.prototype.isEqualNode = function(node) {
  32264. var i, j, ref1;
  32265. if (!XMLElement.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
  32266. return false;
  32267. }
  32268. if (node.namespaceURI !== this.namespaceURI) {
  32269. return false;
  32270. }
  32271. if (node.prefix !== this.prefix) {
  32272. return false;
  32273. }
  32274. if (node.localName !== this.localName) {
  32275. return false;
  32276. }
  32277. if (node.attribs.length !== this.attribs.length) {
  32278. return false;
  32279. }
  32280. for (i = j = 0, ref1 = this.attribs.length - 1; 0 <= ref1 ? j <= ref1 : j >= ref1; i = 0 <= ref1 ? ++j : --j) {
  32281. if (!this.attribs[i].isEqualNode(node.attribs[i])) {
  32282. return false;
  32283. }
  32284. }
  32285. return true;
  32286. };
  32287. return XMLElement;
  32288. })(XMLNode);
  32289. }).call(this);
  32290. },{"./NodeType":428,"./Utility":429,"./XMLAttribute":431,"./XMLNamedNodeMap":449,"./XMLNode":450}],449:[function(require,module,exports){
  32291. // Generated by CoffeeScript 1.12.7
  32292. (function() {
  32293. var XMLNamedNodeMap;
  32294. module.exports = XMLNamedNodeMap = (function() {
  32295. function XMLNamedNodeMap(nodes) {
  32296. this.nodes = nodes;
  32297. }
  32298. Object.defineProperty(XMLNamedNodeMap.prototype, 'length', {
  32299. get: function() {
  32300. return Object.keys(this.nodes).length || 0;
  32301. }
  32302. });
  32303. XMLNamedNodeMap.prototype.clone = function() {
  32304. return this.nodes = null;
  32305. };
  32306. XMLNamedNodeMap.prototype.getNamedItem = function(name) {
  32307. return this.nodes[name];
  32308. };
  32309. XMLNamedNodeMap.prototype.setNamedItem = function(node) {
  32310. var oldNode;
  32311. oldNode = this.nodes[node.nodeName];
  32312. this.nodes[node.nodeName] = node;
  32313. return oldNode || null;
  32314. };
  32315. XMLNamedNodeMap.prototype.removeNamedItem = function(name) {
  32316. var oldNode;
  32317. oldNode = this.nodes[name];
  32318. delete this.nodes[name];
  32319. return oldNode || null;
  32320. };
  32321. XMLNamedNodeMap.prototype.item = function(index) {
  32322. return this.nodes[Object.keys(this.nodes)[index]] || null;
  32323. };
  32324. XMLNamedNodeMap.prototype.getNamedItemNS = function(namespaceURI, localName) {
  32325. throw new Error("This DOM method is not implemented.");
  32326. };
  32327. XMLNamedNodeMap.prototype.setNamedItemNS = function(node) {
  32328. throw new Error("This DOM method is not implemented.");
  32329. };
  32330. XMLNamedNodeMap.prototype.removeNamedItemNS = function(namespaceURI, localName) {
  32331. throw new Error("This DOM method is not implemented.");
  32332. };
  32333. return XMLNamedNodeMap;
  32334. })();
  32335. }).call(this);
  32336. },{}],450:[function(require,module,exports){
  32337. // Generated by CoffeeScript 1.12.7
  32338. (function() {
  32339. var DocumentPosition, NodeType, XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLNamedNodeMap, XMLNode, XMLNodeList, XMLProcessingInstruction, XMLRaw, XMLText, getValue, isEmpty, isFunction, isObject, ref1,
  32340. hasProp = {}.hasOwnProperty;
  32341. ref1 = require('./Utility'), isObject = ref1.isObject, isFunction = ref1.isFunction, isEmpty = ref1.isEmpty, getValue = ref1.getValue;
  32342. XMLElement = null;
  32343. XMLCData = null;
  32344. XMLComment = null;
  32345. XMLDeclaration = null;
  32346. XMLDocType = null;
  32347. XMLRaw = null;
  32348. XMLText = null;
  32349. XMLProcessingInstruction = null;
  32350. XMLDummy = null;
  32351. NodeType = null;
  32352. XMLNodeList = null;
  32353. XMLNamedNodeMap = null;
  32354. DocumentPosition = null;
  32355. module.exports = XMLNode = (function() {
  32356. function XMLNode(parent1) {
  32357. this.parent = parent1;
  32358. if (this.parent) {
  32359. this.options = this.parent.options;
  32360. this.stringify = this.parent.stringify;
  32361. }
  32362. this.value = null;
  32363. this.children = [];
  32364. this.baseURI = null;
  32365. if (!XMLElement) {
  32366. XMLElement = require('./XMLElement');
  32367. XMLCData = require('./XMLCData');
  32368. XMLComment = require('./XMLComment');
  32369. XMLDeclaration = require('./XMLDeclaration');
  32370. XMLDocType = require('./XMLDocType');
  32371. XMLRaw = require('./XMLRaw');
  32372. XMLText = require('./XMLText');
  32373. XMLProcessingInstruction = require('./XMLProcessingInstruction');
  32374. XMLDummy = require('./XMLDummy');
  32375. NodeType = require('./NodeType');
  32376. XMLNodeList = require('./XMLNodeList');
  32377. XMLNamedNodeMap = require('./XMLNamedNodeMap');
  32378. DocumentPosition = require('./DocumentPosition');
  32379. }
  32380. }
  32381. Object.defineProperty(XMLNode.prototype, 'nodeName', {
  32382. get: function() {
  32383. return this.name;
  32384. }
  32385. });
  32386. Object.defineProperty(XMLNode.prototype, 'nodeType', {
  32387. get: function() {
  32388. return this.type;
  32389. }
  32390. });
  32391. Object.defineProperty(XMLNode.prototype, 'nodeValue', {
  32392. get: function() {
  32393. return this.value;
  32394. }
  32395. });
  32396. Object.defineProperty(XMLNode.prototype, 'parentNode', {
  32397. get: function() {
  32398. return this.parent;
  32399. }
  32400. });
  32401. Object.defineProperty(XMLNode.prototype, 'childNodes', {
  32402. get: function() {
  32403. if (!this.childNodeList || !this.childNodeList.nodes) {
  32404. this.childNodeList = new XMLNodeList(this.children);
  32405. }
  32406. return this.childNodeList;
  32407. }
  32408. });
  32409. Object.defineProperty(XMLNode.prototype, 'firstChild', {
  32410. get: function() {
  32411. return this.children[0] || null;
  32412. }
  32413. });
  32414. Object.defineProperty(XMLNode.prototype, 'lastChild', {
  32415. get: function() {
  32416. return this.children[this.children.length - 1] || null;
  32417. }
  32418. });
  32419. Object.defineProperty(XMLNode.prototype, 'previousSibling', {
  32420. get: function() {
  32421. var i;
  32422. i = this.parent.children.indexOf(this);
  32423. return this.parent.children[i - 1] || null;
  32424. }
  32425. });
  32426. Object.defineProperty(XMLNode.prototype, 'nextSibling', {
  32427. get: function() {
  32428. var i;
  32429. i = this.parent.children.indexOf(this);
  32430. return this.parent.children[i + 1] || null;
  32431. }
  32432. });
  32433. Object.defineProperty(XMLNode.prototype, 'ownerDocument', {
  32434. get: function() {
  32435. return this.document() || null;
  32436. }
  32437. });
  32438. Object.defineProperty(XMLNode.prototype, 'textContent', {
  32439. get: function() {
  32440. var child, j, len, ref2, str;
  32441. if (this.nodeType === NodeType.Element || this.nodeType === NodeType.DocumentFragment) {
  32442. str = '';
  32443. ref2 = this.children;
  32444. for (j = 0, len = ref2.length; j < len; j++) {
  32445. child = ref2[j];
  32446. if (child.textContent) {
  32447. str += child.textContent;
  32448. }
  32449. }
  32450. return str;
  32451. } else {
  32452. return null;
  32453. }
  32454. },
  32455. set: function(value) {
  32456. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32457. }
  32458. });
  32459. XMLNode.prototype.setParent = function(parent) {
  32460. var child, j, len, ref2, results;
  32461. this.parent = parent;
  32462. if (parent) {
  32463. this.options = parent.options;
  32464. this.stringify = parent.stringify;
  32465. }
  32466. ref2 = this.children;
  32467. results = [];
  32468. for (j = 0, len = ref2.length; j < len; j++) {
  32469. child = ref2[j];
  32470. results.push(child.setParent(this));
  32471. }
  32472. return results;
  32473. };
  32474. XMLNode.prototype.element = function(name, attributes, text) {
  32475. var childNode, item, j, k, key, lastChild, len, len1, ref2, ref3, val;
  32476. lastChild = null;
  32477. if (attributes === null && (text == null)) {
  32478. ref2 = [{}, null], attributes = ref2[0], text = ref2[1];
  32479. }
  32480. if (attributes == null) {
  32481. attributes = {};
  32482. }
  32483. attributes = getValue(attributes);
  32484. if (!isObject(attributes)) {
  32485. ref3 = [attributes, text], text = ref3[0], attributes = ref3[1];
  32486. }
  32487. if (name != null) {
  32488. name = getValue(name);
  32489. }
  32490. if (Array.isArray(name)) {
  32491. for (j = 0, len = name.length; j < len; j++) {
  32492. item = name[j];
  32493. lastChild = this.element(item);
  32494. }
  32495. } else if (isFunction(name)) {
  32496. lastChild = this.element(name.apply());
  32497. } else if (isObject(name)) {
  32498. for (key in name) {
  32499. if (!hasProp.call(name, key)) continue;
  32500. val = name[key];
  32501. if (isFunction(val)) {
  32502. val = val.apply();
  32503. }
  32504. if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) {
  32505. lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val);
  32506. } else if (!this.options.separateArrayItems && Array.isArray(val) && isEmpty(val)) {
  32507. lastChild = this.dummy();
  32508. } else if (isObject(val) && isEmpty(val)) {
  32509. lastChild = this.element(key);
  32510. } else if (!this.options.keepNullNodes && (val == null)) {
  32511. lastChild = this.dummy();
  32512. } else if (!this.options.separateArrayItems && Array.isArray(val)) {
  32513. for (k = 0, len1 = val.length; k < len1; k++) {
  32514. item = val[k];
  32515. childNode = {};
  32516. childNode[key] = item;
  32517. lastChild = this.element(childNode);
  32518. }
  32519. } else if (isObject(val)) {
  32520. if (!this.options.ignoreDecorators && this.stringify.convertTextKey && key.indexOf(this.stringify.convertTextKey) === 0) {
  32521. lastChild = this.element(val);
  32522. } else {
  32523. lastChild = this.element(key);
  32524. lastChild.element(val);
  32525. }
  32526. } else {
  32527. lastChild = this.element(key, val);
  32528. }
  32529. }
  32530. } else if (!this.options.keepNullNodes && text === null) {
  32531. lastChild = this.dummy();
  32532. } else {
  32533. if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) {
  32534. lastChild = this.text(text);
  32535. } else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) {
  32536. lastChild = this.cdata(text);
  32537. } else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) {
  32538. lastChild = this.comment(text);
  32539. } else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) {
  32540. lastChild = this.raw(text);
  32541. } else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) {
  32542. lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text);
  32543. } else {
  32544. lastChild = this.node(name, attributes, text);
  32545. }
  32546. }
  32547. if (lastChild == null) {
  32548. throw new Error("Could not create any elements with: " + name + ". " + this.debugInfo());
  32549. }
  32550. return lastChild;
  32551. };
  32552. XMLNode.prototype.insertBefore = function(name, attributes, text) {
  32553. var child, i, newChild, refChild, removed;
  32554. if (name != null ? name.type : void 0) {
  32555. newChild = name;
  32556. refChild = attributes;
  32557. newChild.setParent(this);
  32558. if (refChild) {
  32559. i = children.indexOf(refChild);
  32560. removed = children.splice(i);
  32561. children.push(newChild);
  32562. Array.prototype.push.apply(children, removed);
  32563. } else {
  32564. children.push(newChild);
  32565. }
  32566. return newChild;
  32567. } else {
  32568. if (this.isRoot) {
  32569. throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
  32570. }
  32571. i = this.parent.children.indexOf(this);
  32572. removed = this.parent.children.splice(i);
  32573. child = this.parent.element(name, attributes, text);
  32574. Array.prototype.push.apply(this.parent.children, removed);
  32575. return child;
  32576. }
  32577. };
  32578. XMLNode.prototype.insertAfter = function(name, attributes, text) {
  32579. var child, i, removed;
  32580. if (this.isRoot) {
  32581. throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
  32582. }
  32583. i = this.parent.children.indexOf(this);
  32584. removed = this.parent.children.splice(i + 1);
  32585. child = this.parent.element(name, attributes, text);
  32586. Array.prototype.push.apply(this.parent.children, removed);
  32587. return child;
  32588. };
  32589. XMLNode.prototype.remove = function() {
  32590. var i, ref2;
  32591. if (this.isRoot) {
  32592. throw new Error("Cannot remove the root element. " + this.debugInfo());
  32593. }
  32594. i = this.parent.children.indexOf(this);
  32595. [].splice.apply(this.parent.children, [i, i - i + 1].concat(ref2 = [])), ref2;
  32596. return this.parent;
  32597. };
  32598. XMLNode.prototype.node = function(name, attributes, text) {
  32599. var child, ref2;
  32600. if (name != null) {
  32601. name = getValue(name);
  32602. }
  32603. attributes || (attributes = {});
  32604. attributes = getValue(attributes);
  32605. if (!isObject(attributes)) {
  32606. ref2 = [attributes, text], text = ref2[0], attributes = ref2[1];
  32607. }
  32608. child = new XMLElement(this, name, attributes);
  32609. if (text != null) {
  32610. child.text(text);
  32611. }
  32612. this.children.push(child);
  32613. return child;
  32614. };
  32615. XMLNode.prototype.text = function(value) {
  32616. var child;
  32617. if (isObject(value)) {
  32618. this.element(value);
  32619. }
  32620. child = new XMLText(this, value);
  32621. this.children.push(child);
  32622. return this;
  32623. };
  32624. XMLNode.prototype.cdata = function(value) {
  32625. var child;
  32626. child = new XMLCData(this, value);
  32627. this.children.push(child);
  32628. return this;
  32629. };
  32630. XMLNode.prototype.comment = function(value) {
  32631. var child;
  32632. child = new XMLComment(this, value);
  32633. this.children.push(child);
  32634. return this;
  32635. };
  32636. XMLNode.prototype.commentBefore = function(value) {
  32637. var child, i, removed;
  32638. i = this.parent.children.indexOf(this);
  32639. removed = this.parent.children.splice(i);
  32640. child = this.parent.comment(value);
  32641. Array.prototype.push.apply(this.parent.children, removed);
  32642. return this;
  32643. };
  32644. XMLNode.prototype.commentAfter = function(value) {
  32645. var child, i, removed;
  32646. i = this.parent.children.indexOf(this);
  32647. removed = this.parent.children.splice(i + 1);
  32648. child = this.parent.comment(value);
  32649. Array.prototype.push.apply(this.parent.children, removed);
  32650. return this;
  32651. };
  32652. XMLNode.prototype.raw = function(value) {
  32653. var child;
  32654. child = new XMLRaw(this, value);
  32655. this.children.push(child);
  32656. return this;
  32657. };
  32658. XMLNode.prototype.dummy = function() {
  32659. var child;
  32660. child = new XMLDummy(this);
  32661. return child;
  32662. };
  32663. XMLNode.prototype.instruction = function(target, value) {
  32664. var insTarget, insValue, instruction, j, len;
  32665. if (target != null) {
  32666. target = getValue(target);
  32667. }
  32668. if (value != null) {
  32669. value = getValue(value);
  32670. }
  32671. if (Array.isArray(target)) {
  32672. for (j = 0, len = target.length; j < len; j++) {
  32673. insTarget = target[j];
  32674. this.instruction(insTarget);
  32675. }
  32676. } else if (isObject(target)) {
  32677. for (insTarget in target) {
  32678. if (!hasProp.call(target, insTarget)) continue;
  32679. insValue = target[insTarget];
  32680. this.instruction(insTarget, insValue);
  32681. }
  32682. } else {
  32683. if (isFunction(value)) {
  32684. value = value.apply();
  32685. }
  32686. instruction = new XMLProcessingInstruction(this, target, value);
  32687. this.children.push(instruction);
  32688. }
  32689. return this;
  32690. };
  32691. XMLNode.prototype.instructionBefore = function(target, value) {
  32692. var child, i, removed;
  32693. i = this.parent.children.indexOf(this);
  32694. removed = this.parent.children.splice(i);
  32695. child = this.parent.instruction(target, value);
  32696. Array.prototype.push.apply(this.parent.children, removed);
  32697. return this;
  32698. };
  32699. XMLNode.prototype.instructionAfter = function(target, value) {
  32700. var child, i, removed;
  32701. i = this.parent.children.indexOf(this);
  32702. removed = this.parent.children.splice(i + 1);
  32703. child = this.parent.instruction(target, value);
  32704. Array.prototype.push.apply(this.parent.children, removed);
  32705. return this;
  32706. };
  32707. XMLNode.prototype.declaration = function(version, encoding, standalone) {
  32708. var doc, xmldec;
  32709. doc = this.document();
  32710. xmldec = new XMLDeclaration(doc, version, encoding, standalone);
  32711. if (doc.children.length === 0) {
  32712. doc.children.unshift(xmldec);
  32713. } else if (doc.children[0].type === NodeType.Declaration) {
  32714. doc.children[0] = xmldec;
  32715. } else {
  32716. doc.children.unshift(xmldec);
  32717. }
  32718. return doc.root() || doc;
  32719. };
  32720. XMLNode.prototype.dtd = function(pubID, sysID) {
  32721. var child, doc, doctype, i, j, k, len, len1, ref2, ref3;
  32722. doc = this.document();
  32723. doctype = new XMLDocType(doc, pubID, sysID);
  32724. ref2 = doc.children;
  32725. for (i = j = 0, len = ref2.length; j < len; i = ++j) {
  32726. child = ref2[i];
  32727. if (child.type === NodeType.DocType) {
  32728. doc.children[i] = doctype;
  32729. return doctype;
  32730. }
  32731. }
  32732. ref3 = doc.children;
  32733. for (i = k = 0, len1 = ref3.length; k < len1; i = ++k) {
  32734. child = ref3[i];
  32735. if (child.isRoot) {
  32736. doc.children.splice(i, 0, doctype);
  32737. return doctype;
  32738. }
  32739. }
  32740. doc.children.push(doctype);
  32741. return doctype;
  32742. };
  32743. XMLNode.prototype.up = function() {
  32744. if (this.isRoot) {
  32745. throw new Error("The root node has no parent. Use doc() if you need to get the document object.");
  32746. }
  32747. return this.parent;
  32748. };
  32749. XMLNode.prototype.root = function() {
  32750. var node;
  32751. node = this;
  32752. while (node) {
  32753. if (node.type === NodeType.Document) {
  32754. return node.rootObject;
  32755. } else if (node.isRoot) {
  32756. return node;
  32757. } else {
  32758. node = node.parent;
  32759. }
  32760. }
  32761. };
  32762. XMLNode.prototype.document = function() {
  32763. var node;
  32764. node = this;
  32765. while (node) {
  32766. if (node.type === NodeType.Document) {
  32767. return node;
  32768. } else {
  32769. node = node.parent;
  32770. }
  32771. }
  32772. };
  32773. XMLNode.prototype.end = function(options) {
  32774. return this.document().end(options);
  32775. };
  32776. XMLNode.prototype.prev = function() {
  32777. var i;
  32778. i = this.parent.children.indexOf(this);
  32779. if (i < 1) {
  32780. throw new Error("Already at the first node. " + this.debugInfo());
  32781. }
  32782. return this.parent.children[i - 1];
  32783. };
  32784. XMLNode.prototype.next = function() {
  32785. var i;
  32786. i = this.parent.children.indexOf(this);
  32787. if (i === -1 || i === this.parent.children.length - 1) {
  32788. throw new Error("Already at the last node. " + this.debugInfo());
  32789. }
  32790. return this.parent.children[i + 1];
  32791. };
  32792. XMLNode.prototype.importDocument = function(doc) {
  32793. var clonedRoot;
  32794. clonedRoot = doc.root().clone();
  32795. clonedRoot.parent = this;
  32796. clonedRoot.isRoot = false;
  32797. this.children.push(clonedRoot);
  32798. return this;
  32799. };
  32800. XMLNode.prototype.debugInfo = function(name) {
  32801. var ref2, ref3;
  32802. name = name || this.name;
  32803. if ((name == null) && !((ref2 = this.parent) != null ? ref2.name : void 0)) {
  32804. return "";
  32805. } else if (name == null) {
  32806. return "parent: <" + this.parent.name + ">";
  32807. } else if (!((ref3 = this.parent) != null ? ref3.name : void 0)) {
  32808. return "node: <" + name + ">";
  32809. } else {
  32810. return "node: <" + name + ">, parent: <" + this.parent.name + ">";
  32811. }
  32812. };
  32813. XMLNode.prototype.ele = function(name, attributes, text) {
  32814. return this.element(name, attributes, text);
  32815. };
  32816. XMLNode.prototype.nod = function(name, attributes, text) {
  32817. return this.node(name, attributes, text);
  32818. };
  32819. XMLNode.prototype.txt = function(value) {
  32820. return this.text(value);
  32821. };
  32822. XMLNode.prototype.dat = function(value) {
  32823. return this.cdata(value);
  32824. };
  32825. XMLNode.prototype.com = function(value) {
  32826. return this.comment(value);
  32827. };
  32828. XMLNode.prototype.ins = function(target, value) {
  32829. return this.instruction(target, value);
  32830. };
  32831. XMLNode.prototype.doc = function() {
  32832. return this.document();
  32833. };
  32834. XMLNode.prototype.dec = function(version, encoding, standalone) {
  32835. return this.declaration(version, encoding, standalone);
  32836. };
  32837. XMLNode.prototype.e = function(name, attributes, text) {
  32838. return this.element(name, attributes, text);
  32839. };
  32840. XMLNode.prototype.n = function(name, attributes, text) {
  32841. return this.node(name, attributes, text);
  32842. };
  32843. XMLNode.prototype.t = function(value) {
  32844. return this.text(value);
  32845. };
  32846. XMLNode.prototype.d = function(value) {
  32847. return this.cdata(value);
  32848. };
  32849. XMLNode.prototype.c = function(value) {
  32850. return this.comment(value);
  32851. };
  32852. XMLNode.prototype.r = function(value) {
  32853. return this.raw(value);
  32854. };
  32855. XMLNode.prototype.i = function(target, value) {
  32856. return this.instruction(target, value);
  32857. };
  32858. XMLNode.prototype.u = function() {
  32859. return this.up();
  32860. };
  32861. XMLNode.prototype.importXMLBuilder = function(doc) {
  32862. return this.importDocument(doc);
  32863. };
  32864. XMLNode.prototype.replaceChild = function(newChild, oldChild) {
  32865. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32866. };
  32867. XMLNode.prototype.removeChild = function(oldChild) {
  32868. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32869. };
  32870. XMLNode.prototype.appendChild = function(newChild) {
  32871. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32872. };
  32873. XMLNode.prototype.hasChildNodes = function() {
  32874. return this.children.length !== 0;
  32875. };
  32876. XMLNode.prototype.cloneNode = function(deep) {
  32877. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32878. };
  32879. XMLNode.prototype.normalize = function() {
  32880. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32881. };
  32882. XMLNode.prototype.isSupported = function(feature, version) {
  32883. return true;
  32884. };
  32885. XMLNode.prototype.hasAttributes = function() {
  32886. return this.attribs.length !== 0;
  32887. };
  32888. XMLNode.prototype.compareDocumentPosition = function(other) {
  32889. var ref, res;
  32890. ref = this;
  32891. if (ref === other) {
  32892. return 0;
  32893. } else if (this.document() !== other.document()) {
  32894. res = DocumentPosition.Disconnected | DocumentPosition.ImplementationSpecific;
  32895. if (Math.random() < 0.5) {
  32896. res |= DocumentPosition.Preceding;
  32897. } else {
  32898. res |= DocumentPosition.Following;
  32899. }
  32900. return res;
  32901. } else if (ref.isAncestor(other)) {
  32902. return DocumentPosition.Contains | DocumentPosition.Preceding;
  32903. } else if (ref.isDescendant(other)) {
  32904. return DocumentPosition.Contains | DocumentPosition.Following;
  32905. } else if (ref.isPreceding(other)) {
  32906. return DocumentPosition.Preceding;
  32907. } else {
  32908. return DocumentPosition.Following;
  32909. }
  32910. };
  32911. XMLNode.prototype.isSameNode = function(other) {
  32912. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32913. };
  32914. XMLNode.prototype.lookupPrefix = function(namespaceURI) {
  32915. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32916. };
  32917. XMLNode.prototype.isDefaultNamespace = function(namespaceURI) {
  32918. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32919. };
  32920. XMLNode.prototype.lookupNamespaceURI = function(prefix) {
  32921. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32922. };
  32923. XMLNode.prototype.isEqualNode = function(node) {
  32924. var i, j, ref2;
  32925. if (node.nodeType !== this.nodeType) {
  32926. return false;
  32927. }
  32928. if (node.children.length !== this.children.length) {
  32929. return false;
  32930. }
  32931. for (i = j = 0, ref2 = this.children.length - 1; 0 <= ref2 ? j <= ref2 : j >= ref2; i = 0 <= ref2 ? ++j : --j) {
  32932. if (!this.children[i].isEqualNode(node.children[i])) {
  32933. return false;
  32934. }
  32935. }
  32936. return true;
  32937. };
  32938. XMLNode.prototype.getFeature = function(feature, version) {
  32939. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32940. };
  32941. XMLNode.prototype.setUserData = function(key, data, handler) {
  32942. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32943. };
  32944. XMLNode.prototype.getUserData = function(key) {
  32945. throw new Error("This DOM method is not implemented." + this.debugInfo());
  32946. };
  32947. XMLNode.prototype.contains = function(other) {
  32948. if (!other) {
  32949. return false;
  32950. }
  32951. return other === this || this.isDescendant(other);
  32952. };
  32953. XMLNode.prototype.isDescendant = function(node) {
  32954. var child, isDescendantChild, j, len, ref2;
  32955. ref2 = this.children;
  32956. for (j = 0, len = ref2.length; j < len; j++) {
  32957. child = ref2[j];
  32958. if (node === child) {
  32959. return true;
  32960. }
  32961. isDescendantChild = child.isDescendant(node);
  32962. if (isDescendantChild) {
  32963. return true;
  32964. }
  32965. }
  32966. return false;
  32967. };
  32968. XMLNode.prototype.isAncestor = function(node) {
  32969. return node.isDescendant(this);
  32970. };
  32971. XMLNode.prototype.isPreceding = function(node) {
  32972. var nodePos, thisPos;
  32973. nodePos = this.treePosition(node);
  32974. thisPos = this.treePosition(this);
  32975. if (nodePos === -1 || thisPos === -1) {
  32976. return false;
  32977. } else {
  32978. return nodePos < thisPos;
  32979. }
  32980. };
  32981. XMLNode.prototype.isFollowing = function(node) {
  32982. var nodePos, thisPos;
  32983. nodePos = this.treePosition(node);
  32984. thisPos = this.treePosition(this);
  32985. if (nodePos === -1 || thisPos === -1) {
  32986. return false;
  32987. } else {
  32988. return nodePos > thisPos;
  32989. }
  32990. };
  32991. XMLNode.prototype.treePosition = function(node) {
  32992. var found, pos;
  32993. pos = 0;
  32994. found = false;
  32995. this.foreachTreeNode(this.document(), function(childNode) {
  32996. pos++;
  32997. if (!found && childNode === node) {
  32998. return found = true;
  32999. }
  33000. });
  33001. if (found) {
  33002. return pos;
  33003. } else {
  33004. return -1;
  33005. }
  33006. };
  33007. XMLNode.prototype.foreachTreeNode = function(node, func) {
  33008. var child, j, len, ref2, res;
  33009. node || (node = this.document());
  33010. ref2 = node.children;
  33011. for (j = 0, len = ref2.length; j < len; j++) {
  33012. child = ref2[j];
  33013. if (res = func(child)) {
  33014. return res;
  33015. } else {
  33016. res = this.foreachTreeNode(child, func);
  33017. if (res) {
  33018. return res;
  33019. }
  33020. }
  33021. }
  33022. };
  33023. return XMLNode;
  33024. })();
  33025. }).call(this);
  33026. },{"./DocumentPosition":427,"./NodeType":428,"./Utility":429,"./XMLCData":432,"./XMLComment":434,"./XMLDeclaration":443,"./XMLDocType":444,"./XMLDummy":447,"./XMLElement":448,"./XMLNamedNodeMap":449,"./XMLNodeList":451,"./XMLProcessingInstruction":452,"./XMLRaw":453,"./XMLText":457}],451:[function(require,module,exports){
  33027. // Generated by CoffeeScript 1.12.7
  33028. (function() {
  33029. var XMLNodeList;
  33030. module.exports = XMLNodeList = (function() {
  33031. function XMLNodeList(nodes) {
  33032. this.nodes = nodes;
  33033. }
  33034. Object.defineProperty(XMLNodeList.prototype, 'length', {
  33035. get: function() {
  33036. return this.nodes.length || 0;
  33037. }
  33038. });
  33039. XMLNodeList.prototype.clone = function() {
  33040. return this.nodes = null;
  33041. };
  33042. XMLNodeList.prototype.item = function(index) {
  33043. return this.nodes[index] || null;
  33044. };
  33045. return XMLNodeList;
  33046. })();
  33047. }).call(this);
  33048. },{}],452:[function(require,module,exports){
  33049. // Generated by CoffeeScript 1.12.7
  33050. (function() {
  33051. var NodeType, XMLCharacterData, XMLProcessingInstruction,
  33052. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  33053. hasProp = {}.hasOwnProperty;
  33054. NodeType = require('./NodeType');
  33055. XMLCharacterData = require('./XMLCharacterData');
  33056. module.exports = XMLProcessingInstruction = (function(superClass) {
  33057. extend(XMLProcessingInstruction, superClass);
  33058. function XMLProcessingInstruction(parent, target, value) {
  33059. XMLProcessingInstruction.__super__.constructor.call(this, parent);
  33060. if (target == null) {
  33061. throw new Error("Missing instruction target. " + this.debugInfo());
  33062. }
  33063. this.type = NodeType.ProcessingInstruction;
  33064. this.target = this.stringify.insTarget(target);
  33065. this.name = this.target;
  33066. if (value) {
  33067. this.value = this.stringify.insValue(value);
  33068. }
  33069. }
  33070. XMLProcessingInstruction.prototype.clone = function() {
  33071. return Object.create(this);
  33072. };
  33073. XMLProcessingInstruction.prototype.toString = function(options) {
  33074. return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));
  33075. };
  33076. XMLProcessingInstruction.prototype.isEqualNode = function(node) {
  33077. if (!XMLProcessingInstruction.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
  33078. return false;
  33079. }
  33080. if (node.target !== this.target) {
  33081. return false;
  33082. }
  33083. return true;
  33084. };
  33085. return XMLProcessingInstruction;
  33086. })(XMLCharacterData);
  33087. }).call(this);
  33088. },{"./NodeType":428,"./XMLCharacterData":433}],453:[function(require,module,exports){
  33089. // Generated by CoffeeScript 1.12.7
  33090. (function() {
  33091. var NodeType, XMLNode, XMLRaw,
  33092. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  33093. hasProp = {}.hasOwnProperty;
  33094. NodeType = require('./NodeType');
  33095. XMLNode = require('./XMLNode');
  33096. module.exports = XMLRaw = (function(superClass) {
  33097. extend(XMLRaw, superClass);
  33098. function XMLRaw(parent, text) {
  33099. XMLRaw.__super__.constructor.call(this, parent);
  33100. if (text == null) {
  33101. throw new Error("Missing raw text. " + this.debugInfo());
  33102. }
  33103. this.type = NodeType.Raw;
  33104. this.value = this.stringify.raw(text);
  33105. }
  33106. XMLRaw.prototype.clone = function() {
  33107. return Object.create(this);
  33108. };
  33109. XMLRaw.prototype.toString = function(options) {
  33110. return this.options.writer.raw(this, this.options.writer.filterOptions(options));
  33111. };
  33112. return XMLRaw;
  33113. })(XMLNode);
  33114. }).call(this);
  33115. },{"./NodeType":428,"./XMLNode":450}],454:[function(require,module,exports){
  33116. // Generated by CoffeeScript 1.12.7
  33117. (function() {
  33118. var NodeType, WriterState, XMLStreamWriter, XMLWriterBase,
  33119. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  33120. hasProp = {}.hasOwnProperty;
  33121. NodeType = require('./NodeType');
  33122. XMLWriterBase = require('./XMLWriterBase');
  33123. WriterState = require('./WriterState');
  33124. module.exports = XMLStreamWriter = (function(superClass) {
  33125. extend(XMLStreamWriter, superClass);
  33126. function XMLStreamWriter(stream, options) {
  33127. this.stream = stream;
  33128. XMLStreamWriter.__super__.constructor.call(this, options);
  33129. }
  33130. XMLStreamWriter.prototype.endline = function(node, options, level) {
  33131. if (node.isLastRootNode && options.state === WriterState.CloseTag) {
  33132. return '';
  33133. } else {
  33134. return XMLStreamWriter.__super__.endline.call(this, node, options, level);
  33135. }
  33136. };
  33137. XMLStreamWriter.prototype.document = function(doc, options) {
  33138. var child, i, j, k, len, len1, ref, ref1, results;
  33139. ref = doc.children;
  33140. for (i = j = 0, len = ref.length; j < len; i = ++j) {
  33141. child = ref[i];
  33142. child.isLastRootNode = i === doc.children.length - 1;
  33143. }
  33144. options = this.filterOptions(options);
  33145. ref1 = doc.children;
  33146. results = [];
  33147. for (k = 0, len1 = ref1.length; k < len1; k++) {
  33148. child = ref1[k];
  33149. results.push(this.writeChildNode(child, options, 0));
  33150. }
  33151. return results;
  33152. };
  33153. XMLStreamWriter.prototype.attribute = function(att, options, level) {
  33154. return this.stream.write(XMLStreamWriter.__super__.attribute.call(this, att, options, level));
  33155. };
  33156. XMLStreamWriter.prototype.cdata = function(node, options, level) {
  33157. return this.stream.write(XMLStreamWriter.__super__.cdata.call(this, node, options, level));
  33158. };
  33159. XMLStreamWriter.prototype.comment = function(node, options, level) {
  33160. return this.stream.write(XMLStreamWriter.__super__.comment.call(this, node, options, level));
  33161. };
  33162. XMLStreamWriter.prototype.declaration = function(node, options, level) {
  33163. return this.stream.write(XMLStreamWriter.__super__.declaration.call(this, node, options, level));
  33164. };
  33165. XMLStreamWriter.prototype.docType = function(node, options, level) {
  33166. var child, j, len, ref;
  33167. level || (level = 0);
  33168. this.openNode(node, options, level);
  33169. options.state = WriterState.OpenTag;
  33170. this.stream.write(this.indent(node, options, level));
  33171. this.stream.write('<!DOCTYPE ' + node.root().name);
  33172. if (node.pubID && node.sysID) {
  33173. this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"');
  33174. } else if (node.sysID) {
  33175. this.stream.write(' SYSTEM "' + node.sysID + '"');
  33176. }
  33177. if (node.children.length > 0) {
  33178. this.stream.write(' [');
  33179. this.stream.write(this.endline(node, options, level));
  33180. options.state = WriterState.InsideTag;
  33181. ref = node.children;
  33182. for (j = 0, len = ref.length; j < len; j++) {
  33183. child = ref[j];
  33184. this.writeChildNode(child, options, level + 1);
  33185. }
  33186. options.state = WriterState.CloseTag;
  33187. this.stream.write(']');
  33188. }
  33189. options.state = WriterState.CloseTag;
  33190. this.stream.write(options.spaceBeforeSlash + '>');
  33191. this.stream.write(this.endline(node, options, level));
  33192. options.state = WriterState.None;
  33193. return this.closeNode(node, options, level);
  33194. };
  33195. XMLStreamWriter.prototype.element = function(node, options, level) {
  33196. var att, child, childNodeCount, firstChildNode, j, len, name, prettySuppressed, ref, ref1;
  33197. level || (level = 0);
  33198. this.openNode(node, options, level);
  33199. options.state = WriterState.OpenTag;
  33200. this.stream.write(this.indent(node, options, level) + '<' + node.name);
  33201. ref = node.attribs;
  33202. for (name in ref) {
  33203. if (!hasProp.call(ref, name)) continue;
  33204. att = ref[name];
  33205. this.attribute(att, options, level);
  33206. }
  33207. childNodeCount = node.children.length;
  33208. firstChildNode = childNodeCount === 0 ? null : node.children[0];
  33209. if (childNodeCount === 0 || node.children.every(function(e) {
  33210. return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === '';
  33211. })) {
  33212. if (options.allowEmpty) {
  33213. this.stream.write('>');
  33214. options.state = WriterState.CloseTag;
  33215. this.stream.write('</' + node.name + '>');
  33216. } else {
  33217. options.state = WriterState.CloseTag;
  33218. this.stream.write(options.spaceBeforeSlash + '/>');
  33219. }
  33220. } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && (firstChildNode.value != null)) {
  33221. this.stream.write('>');
  33222. options.state = WriterState.InsideTag;
  33223. options.suppressPrettyCount++;
  33224. prettySuppressed = true;
  33225. this.writeChildNode(firstChildNode, options, level + 1);
  33226. options.suppressPrettyCount--;
  33227. prettySuppressed = false;
  33228. options.state = WriterState.CloseTag;
  33229. this.stream.write('</' + node.name + '>');
  33230. } else {
  33231. this.stream.write('>' + this.endline(node, options, level));
  33232. options.state = WriterState.InsideTag;
  33233. ref1 = node.children;
  33234. for (j = 0, len = ref1.length; j < len; j++) {
  33235. child = ref1[j];
  33236. this.writeChildNode(child, options, level + 1);
  33237. }
  33238. options.state = WriterState.CloseTag;
  33239. this.stream.write(this.indent(node, options, level) + '</' + node.name + '>');
  33240. }
  33241. this.stream.write(this.endline(node, options, level));
  33242. options.state = WriterState.None;
  33243. return this.closeNode(node, options, level);
  33244. };
  33245. XMLStreamWriter.prototype.processingInstruction = function(node, options, level) {
  33246. return this.stream.write(XMLStreamWriter.__super__.processingInstruction.call(this, node, options, level));
  33247. };
  33248. XMLStreamWriter.prototype.raw = function(node, options, level) {
  33249. return this.stream.write(XMLStreamWriter.__super__.raw.call(this, node, options, level));
  33250. };
  33251. XMLStreamWriter.prototype.text = function(node, options, level) {
  33252. return this.stream.write(XMLStreamWriter.__super__.text.call(this, node, options, level));
  33253. };
  33254. XMLStreamWriter.prototype.dtdAttList = function(node, options, level) {
  33255. return this.stream.write(XMLStreamWriter.__super__.dtdAttList.call(this, node, options, level));
  33256. };
  33257. XMLStreamWriter.prototype.dtdElement = function(node, options, level) {
  33258. return this.stream.write(XMLStreamWriter.__super__.dtdElement.call(this, node, options, level));
  33259. };
  33260. XMLStreamWriter.prototype.dtdEntity = function(node, options, level) {
  33261. return this.stream.write(XMLStreamWriter.__super__.dtdEntity.call(this, node, options, level));
  33262. };
  33263. XMLStreamWriter.prototype.dtdNotation = function(node, options, level) {
  33264. return this.stream.write(XMLStreamWriter.__super__.dtdNotation.call(this, node, options, level));
  33265. };
  33266. return XMLStreamWriter;
  33267. })(XMLWriterBase);
  33268. }).call(this);
  33269. },{"./NodeType":428,"./WriterState":430,"./XMLWriterBase":458}],455:[function(require,module,exports){
  33270. // Generated by CoffeeScript 1.12.7
  33271. (function() {
  33272. var XMLStringWriter, XMLWriterBase,
  33273. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  33274. hasProp = {}.hasOwnProperty;
  33275. XMLWriterBase = require('./XMLWriterBase');
  33276. module.exports = XMLStringWriter = (function(superClass) {
  33277. extend(XMLStringWriter, superClass);
  33278. function XMLStringWriter(options) {
  33279. XMLStringWriter.__super__.constructor.call(this, options);
  33280. }
  33281. XMLStringWriter.prototype.document = function(doc, options) {
  33282. var child, i, len, r, ref;
  33283. options = this.filterOptions(options);
  33284. r = '';
  33285. ref = doc.children;
  33286. for (i = 0, len = ref.length; i < len; i++) {
  33287. child = ref[i];
  33288. r += this.writeChildNode(child, options, 0);
  33289. }
  33290. if (options.pretty && r.slice(-options.newline.length) === options.newline) {
  33291. r = r.slice(0, -options.newline.length);
  33292. }
  33293. return r;
  33294. };
  33295. return XMLStringWriter;
  33296. })(XMLWriterBase);
  33297. }).call(this);
  33298. },{"./XMLWriterBase":458}],456:[function(require,module,exports){
  33299. // Generated by CoffeeScript 1.12.7
  33300. (function() {
  33301. var XMLStringifier,
  33302. bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
  33303. hasProp = {}.hasOwnProperty;
  33304. module.exports = XMLStringifier = (function() {
  33305. function XMLStringifier(options) {
  33306. this.assertLegalName = bind(this.assertLegalName, this);
  33307. this.assertLegalChar = bind(this.assertLegalChar, this);
  33308. var key, ref, value;
  33309. options || (options = {});
  33310. this.options = options;
  33311. if (!this.options.version) {
  33312. this.options.version = '1.0';
  33313. }
  33314. ref = options.stringify || {};
  33315. for (key in ref) {
  33316. if (!hasProp.call(ref, key)) continue;
  33317. value = ref[key];
  33318. this[key] = value;
  33319. }
  33320. }
  33321. XMLStringifier.prototype.name = function(val) {
  33322. if (this.options.noValidation) {
  33323. return val;
  33324. }
  33325. return this.assertLegalName('' + val || '');
  33326. };
  33327. XMLStringifier.prototype.text = function(val) {
  33328. if (this.options.noValidation) {
  33329. return val;
  33330. }
  33331. return this.assertLegalChar(this.textEscape('' + val || ''));
  33332. };
  33333. XMLStringifier.prototype.cdata = function(val) {
  33334. if (this.options.noValidation) {
  33335. return val;
  33336. }
  33337. val = '' + val || '';
  33338. val = val.replace(']]>', ']]]]><![CDATA[>');
  33339. return this.assertLegalChar(val);
  33340. };
  33341. XMLStringifier.prototype.comment = function(val) {
  33342. if (this.options.noValidation) {
  33343. return val;
  33344. }
  33345. val = '' + val || '';
  33346. if (val.match(/--/)) {
  33347. throw new Error("Comment text cannot contain double-hypen: " + val);
  33348. }
  33349. return this.assertLegalChar(val);
  33350. };
  33351. XMLStringifier.prototype.raw = function(val) {
  33352. if (this.options.noValidation) {
  33353. return val;
  33354. }
  33355. return '' + val || '';
  33356. };
  33357. XMLStringifier.prototype.attValue = function(val) {
  33358. if (this.options.noValidation) {
  33359. return val;
  33360. }
  33361. return this.assertLegalChar(this.attEscape(val = '' + val || ''));
  33362. };
  33363. XMLStringifier.prototype.insTarget = function(val) {
  33364. if (this.options.noValidation) {
  33365. return val;
  33366. }
  33367. return this.assertLegalChar('' + val || '');
  33368. };
  33369. XMLStringifier.prototype.insValue = function(val) {
  33370. if (this.options.noValidation) {
  33371. return val;
  33372. }
  33373. val = '' + val || '';
  33374. if (val.match(/\?>/)) {
  33375. throw new Error("Invalid processing instruction value: " + val);
  33376. }
  33377. return this.assertLegalChar(val);
  33378. };
  33379. XMLStringifier.prototype.xmlVersion = function(val) {
  33380. if (this.options.noValidation) {
  33381. return val;
  33382. }
  33383. val = '' + val || '';
  33384. if (!val.match(/1\.[0-9]+/)) {
  33385. throw new Error("Invalid version number: " + val);
  33386. }
  33387. return val;
  33388. };
  33389. XMLStringifier.prototype.xmlEncoding = function(val) {
  33390. if (this.options.noValidation) {
  33391. return val;
  33392. }
  33393. val = '' + val || '';
  33394. if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)) {
  33395. throw new Error("Invalid encoding: " + val);
  33396. }
  33397. return this.assertLegalChar(val);
  33398. };
  33399. XMLStringifier.prototype.xmlStandalone = function(val) {
  33400. if (this.options.noValidation) {
  33401. return val;
  33402. }
  33403. if (val) {
  33404. return "yes";
  33405. } else {
  33406. return "no";
  33407. }
  33408. };
  33409. XMLStringifier.prototype.dtdPubID = function(val) {
  33410. if (this.options.noValidation) {
  33411. return val;
  33412. }
  33413. return this.assertLegalChar('' + val || '');
  33414. };
  33415. XMLStringifier.prototype.dtdSysID = function(val) {
  33416. if (this.options.noValidation) {
  33417. return val;
  33418. }
  33419. return this.assertLegalChar('' + val || '');
  33420. };
  33421. XMLStringifier.prototype.dtdElementValue = function(val) {
  33422. if (this.options.noValidation) {
  33423. return val;
  33424. }
  33425. return this.assertLegalChar('' + val || '');
  33426. };
  33427. XMLStringifier.prototype.dtdAttType = function(val) {
  33428. if (this.options.noValidation) {
  33429. return val;
  33430. }
  33431. return this.assertLegalChar('' + val || '');
  33432. };
  33433. XMLStringifier.prototype.dtdAttDefault = function(val) {
  33434. if (this.options.noValidation) {
  33435. return val;
  33436. }
  33437. return this.assertLegalChar('' + val || '');
  33438. };
  33439. XMLStringifier.prototype.dtdEntityValue = function(val) {
  33440. if (this.options.noValidation) {
  33441. return val;
  33442. }
  33443. return this.assertLegalChar('' + val || '');
  33444. };
  33445. XMLStringifier.prototype.dtdNData = function(val) {
  33446. if (this.options.noValidation) {
  33447. return val;
  33448. }
  33449. return this.assertLegalChar('' + val || '');
  33450. };
  33451. XMLStringifier.prototype.convertAttKey = '@';
  33452. XMLStringifier.prototype.convertPIKey = '?';
  33453. XMLStringifier.prototype.convertTextKey = '#text';
  33454. XMLStringifier.prototype.convertCDataKey = '#cdata';
  33455. XMLStringifier.prototype.convertCommentKey = '#comment';
  33456. XMLStringifier.prototype.convertRawKey = '#raw';
  33457. XMLStringifier.prototype.assertLegalChar = function(str) {
  33458. var regex, res;
  33459. if (this.options.noValidation) {
  33460. return str;
  33461. }
  33462. regex = '';
  33463. if (this.options.version === '1.0') {
  33464. regex = /[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
  33465. if (res = str.match(regex)) {
  33466. throw new Error("Invalid character in string: " + str + " at index " + res.index);
  33467. }
  33468. } else if (this.options.version === '1.1') {
  33469. regex = /[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
  33470. if (res = str.match(regex)) {
  33471. throw new Error("Invalid character in string: " + str + " at index " + res.index);
  33472. }
  33473. }
  33474. return str;
  33475. };
  33476. XMLStringifier.prototype.assertLegalName = function(str) {
  33477. var regex;
  33478. if (this.options.noValidation) {
  33479. return str;
  33480. }
  33481. this.assertLegalChar(str);
  33482. regex = /^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/;
  33483. if (!str.match(regex)) {
  33484. throw new Error("Invalid character in name");
  33485. }
  33486. return str;
  33487. };
  33488. XMLStringifier.prototype.textEscape = function(str) {
  33489. var ampregex;
  33490. if (this.options.noValidation) {
  33491. return str;
  33492. }
  33493. ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g;
  33494. return str.replace(ampregex, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\r/g, '&#xD;');
  33495. };
  33496. XMLStringifier.prototype.attEscape = function(str) {
  33497. var ampregex;
  33498. if (this.options.noValidation) {
  33499. return str;
  33500. }
  33501. ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g;
  33502. return str.replace(ampregex, '&amp;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/\t/g, '&#x9;').replace(/\n/g, '&#xA;').replace(/\r/g, '&#xD;');
  33503. };
  33504. return XMLStringifier;
  33505. })();
  33506. }).call(this);
  33507. },{}],457:[function(require,module,exports){
  33508. // Generated by CoffeeScript 1.12.7
  33509. (function() {
  33510. var NodeType, XMLCharacterData, XMLText,
  33511. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  33512. hasProp = {}.hasOwnProperty;
  33513. NodeType = require('./NodeType');
  33514. XMLCharacterData = require('./XMLCharacterData');
  33515. module.exports = XMLText = (function(superClass) {
  33516. extend(XMLText, superClass);
  33517. function XMLText(parent, text) {
  33518. XMLText.__super__.constructor.call(this, parent);
  33519. if (text == null) {
  33520. throw new Error("Missing element text. " + this.debugInfo());
  33521. }
  33522. this.name = "#text";
  33523. this.type = NodeType.Text;
  33524. this.value = this.stringify.text(text);
  33525. }
  33526. Object.defineProperty(XMLText.prototype, 'isElementContentWhitespace', {
  33527. get: function() {
  33528. throw new Error("This DOM method is not implemented." + this.debugInfo());
  33529. }
  33530. });
  33531. Object.defineProperty(XMLText.prototype, 'wholeText', {
  33532. get: function() {
  33533. var next, prev, str;
  33534. str = '';
  33535. prev = this.previousSibling;
  33536. while (prev) {
  33537. str = prev.data + str;
  33538. prev = prev.previousSibling;
  33539. }
  33540. str += this.data;
  33541. next = this.nextSibling;
  33542. while (next) {
  33543. str = str + next.data;
  33544. next = next.nextSibling;
  33545. }
  33546. return str;
  33547. }
  33548. });
  33549. XMLText.prototype.clone = function() {
  33550. return Object.create(this);
  33551. };
  33552. XMLText.prototype.toString = function(options) {
  33553. return this.options.writer.text(this, this.options.writer.filterOptions(options));
  33554. };
  33555. XMLText.prototype.splitText = function(offset) {
  33556. throw new Error("This DOM method is not implemented." + this.debugInfo());
  33557. };
  33558. XMLText.prototype.replaceWholeText = function(content) {
  33559. throw new Error("This DOM method is not implemented." + this.debugInfo());
  33560. };
  33561. return XMLText;
  33562. })(XMLCharacterData);
  33563. }).call(this);
  33564. },{"./NodeType":428,"./XMLCharacterData":433}],458:[function(require,module,exports){
  33565. // Generated by CoffeeScript 1.12.7
  33566. (function() {
  33567. var NodeType, WriterState, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLProcessingInstruction, XMLRaw, XMLText, XMLWriterBase, assign,
  33568. hasProp = {}.hasOwnProperty;
  33569. assign = require('./Utility').assign;
  33570. NodeType = require('./NodeType');
  33571. XMLDeclaration = require('./XMLDeclaration');
  33572. XMLDocType = require('./XMLDocType');
  33573. XMLCData = require('./XMLCData');
  33574. XMLComment = require('./XMLComment');
  33575. XMLElement = require('./XMLElement');
  33576. XMLRaw = require('./XMLRaw');
  33577. XMLText = require('./XMLText');
  33578. XMLProcessingInstruction = require('./XMLProcessingInstruction');
  33579. XMLDummy = require('./XMLDummy');
  33580. XMLDTDAttList = require('./XMLDTDAttList');
  33581. XMLDTDElement = require('./XMLDTDElement');
  33582. XMLDTDEntity = require('./XMLDTDEntity');
  33583. XMLDTDNotation = require('./XMLDTDNotation');
  33584. WriterState = require('./WriterState');
  33585. module.exports = XMLWriterBase = (function() {
  33586. function XMLWriterBase(options) {
  33587. var key, ref, value;
  33588. options || (options = {});
  33589. this.options = options;
  33590. ref = options.writer || {};
  33591. for (key in ref) {
  33592. if (!hasProp.call(ref, key)) continue;
  33593. value = ref[key];
  33594. this["_" + key] = this[key];
  33595. this[key] = value;
  33596. }
  33597. }
  33598. XMLWriterBase.prototype.filterOptions = function(options) {
  33599. var filteredOptions, ref, ref1, ref2, ref3, ref4, ref5, ref6;
  33600. options || (options = {});
  33601. options = assign({}, this.options, options);
  33602. filteredOptions = {
  33603. writer: this
  33604. };
  33605. filteredOptions.pretty = options.pretty || false;
  33606. filteredOptions.allowEmpty = options.allowEmpty || false;
  33607. filteredOptions.indent = (ref = options.indent) != null ? ref : ' ';
  33608. filteredOptions.newline = (ref1 = options.newline) != null ? ref1 : '\n';
  33609. filteredOptions.offset = (ref2 = options.offset) != null ? ref2 : 0;
  33610. filteredOptions.dontPrettyTextNodes = (ref3 = (ref4 = options.dontPrettyTextNodes) != null ? ref4 : options.dontprettytextnodes) != null ? ref3 : 0;
  33611. filteredOptions.spaceBeforeSlash = (ref5 = (ref6 = options.spaceBeforeSlash) != null ? ref6 : options.spacebeforeslash) != null ? ref5 : '';
  33612. if (filteredOptions.spaceBeforeSlash === true) {
  33613. filteredOptions.spaceBeforeSlash = ' ';
  33614. }
  33615. filteredOptions.suppressPrettyCount = 0;
  33616. filteredOptions.user = {};
  33617. filteredOptions.state = WriterState.None;
  33618. return filteredOptions;
  33619. };
  33620. XMLWriterBase.prototype.indent = function(node, options, level) {
  33621. var indentLevel;
  33622. if (!options.pretty || options.suppressPrettyCount) {
  33623. return '';
  33624. } else if (options.pretty) {
  33625. indentLevel = (level || 0) + options.offset + 1;
  33626. if (indentLevel > 0) {
  33627. return new Array(indentLevel).join(options.indent);
  33628. }
  33629. }
  33630. return '';
  33631. };
  33632. XMLWriterBase.prototype.endline = function(node, options, level) {
  33633. if (!options.pretty || options.suppressPrettyCount) {
  33634. return '';
  33635. } else {
  33636. return options.newline;
  33637. }
  33638. };
  33639. XMLWriterBase.prototype.attribute = function(att, options, level) {
  33640. var r;
  33641. this.openAttribute(att, options, level);
  33642. r = ' ' + att.name + '="' + att.value + '"';
  33643. this.closeAttribute(att, options, level);
  33644. return r;
  33645. };
  33646. XMLWriterBase.prototype.cdata = function(node, options, level) {
  33647. var r;
  33648. this.openNode(node, options, level);
  33649. options.state = WriterState.OpenTag;
  33650. r = this.indent(node, options, level) + '<![CDATA[';
  33651. options.state = WriterState.InsideTag;
  33652. r += node.value;
  33653. options.state = WriterState.CloseTag;
  33654. r += ']]>' + this.endline(node, options, level);
  33655. options.state = WriterState.None;
  33656. this.closeNode(node, options, level);
  33657. return r;
  33658. };
  33659. XMLWriterBase.prototype.comment = function(node, options, level) {
  33660. var r;
  33661. this.openNode(node, options, level);
  33662. options.state = WriterState.OpenTag;
  33663. r = this.indent(node, options, level) + '<!-- ';
  33664. options.state = WriterState.InsideTag;
  33665. r += node.value;
  33666. options.state = WriterState.CloseTag;
  33667. r += ' -->' + this.endline(node, options, level);
  33668. options.state = WriterState.None;
  33669. this.closeNode(node, options, level);
  33670. return r;
  33671. };
  33672. XMLWriterBase.prototype.declaration = function(node, options, level) {
  33673. var r;
  33674. this.openNode(node, options, level);
  33675. options.state = WriterState.OpenTag;
  33676. r = this.indent(node, options, level) + '<?xml';
  33677. options.state = WriterState.InsideTag;
  33678. r += ' version="' + node.version + '"';
  33679. if (node.encoding != null) {
  33680. r += ' encoding="' + node.encoding + '"';
  33681. }
  33682. if (node.standalone != null) {
  33683. r += ' standalone="' + node.standalone + '"';
  33684. }
  33685. options.state = WriterState.CloseTag;
  33686. r += options.spaceBeforeSlash + '?>';
  33687. r += this.endline(node, options, level);
  33688. options.state = WriterState.None;
  33689. this.closeNode(node, options, level);
  33690. return r;
  33691. };
  33692. XMLWriterBase.prototype.docType = function(node, options, level) {
  33693. var child, i, len, r, ref;
  33694. level || (level = 0);
  33695. this.openNode(node, options, level);
  33696. options.state = WriterState.OpenTag;
  33697. r = this.indent(node, options, level);
  33698. r += '<!DOCTYPE ' + node.root().name;
  33699. if (node.pubID && node.sysID) {
  33700. r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
  33701. } else if (node.sysID) {
  33702. r += ' SYSTEM "' + node.sysID + '"';
  33703. }
  33704. if (node.children.length > 0) {
  33705. r += ' [';
  33706. r += this.endline(node, options, level);
  33707. options.state = WriterState.InsideTag;
  33708. ref = node.children;
  33709. for (i = 0, len = ref.length; i < len; i++) {
  33710. child = ref[i];
  33711. r += this.writeChildNode(child, options, level + 1);
  33712. }
  33713. options.state = WriterState.CloseTag;
  33714. r += ']';
  33715. }
  33716. options.state = WriterState.CloseTag;
  33717. r += options.spaceBeforeSlash + '>';
  33718. r += this.endline(node, options, level);
  33719. options.state = WriterState.None;
  33720. this.closeNode(node, options, level);
  33721. return r;
  33722. };
  33723. XMLWriterBase.prototype.element = function(node, options, level) {
  33724. var att, child, childNodeCount, firstChildNode, i, j, len, len1, name, prettySuppressed, r, ref, ref1, ref2;
  33725. level || (level = 0);
  33726. prettySuppressed = false;
  33727. r = '';
  33728. this.openNode(node, options, level);
  33729. options.state = WriterState.OpenTag;
  33730. r += this.indent(node, options, level) + '<' + node.name;
  33731. ref = node.attribs;
  33732. for (name in ref) {
  33733. if (!hasProp.call(ref, name)) continue;
  33734. att = ref[name];
  33735. r += this.attribute(att, options, level);
  33736. }
  33737. childNodeCount = node.children.length;
  33738. firstChildNode = childNodeCount === 0 ? null : node.children[0];
  33739. if (childNodeCount === 0 || node.children.every(function(e) {
  33740. return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === '';
  33741. })) {
  33742. if (options.allowEmpty) {
  33743. r += '>';
  33744. options.state = WriterState.CloseTag;
  33745. r += '</' + node.name + '>' + this.endline(node, options, level);
  33746. } else {
  33747. options.state = WriterState.CloseTag;
  33748. r += options.spaceBeforeSlash + '/>' + this.endline(node, options, level);
  33749. }
  33750. } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && (firstChildNode.value != null)) {
  33751. r += '>';
  33752. options.state = WriterState.InsideTag;
  33753. options.suppressPrettyCount++;
  33754. prettySuppressed = true;
  33755. r += this.writeChildNode(firstChildNode, options, level + 1);
  33756. options.suppressPrettyCount--;
  33757. prettySuppressed = false;
  33758. options.state = WriterState.CloseTag;
  33759. r += '</' + node.name + '>' + this.endline(node, options, level);
  33760. } else {
  33761. if (options.dontPrettyTextNodes) {
  33762. ref1 = node.children;
  33763. for (i = 0, len = ref1.length; i < len; i++) {
  33764. child = ref1[i];
  33765. if ((child.type === NodeType.Text || child.type === NodeType.Raw) && (child.value != null)) {
  33766. options.suppressPrettyCount++;
  33767. prettySuppressed = true;
  33768. break;
  33769. }
  33770. }
  33771. }
  33772. r += '>' + this.endline(node, options, level);
  33773. options.state = WriterState.InsideTag;
  33774. ref2 = node.children;
  33775. for (j = 0, len1 = ref2.length; j < len1; j++) {
  33776. child = ref2[j];
  33777. r += this.writeChildNode(child, options, level + 1);
  33778. }
  33779. options.state = WriterState.CloseTag;
  33780. r += this.indent(node, options, level) + '</' + node.name + '>';
  33781. if (prettySuppressed) {
  33782. options.suppressPrettyCount--;
  33783. }
  33784. r += this.endline(node, options, level);
  33785. options.state = WriterState.None;
  33786. }
  33787. this.closeNode(node, options, level);
  33788. return r;
  33789. };
  33790. XMLWriterBase.prototype.writeChildNode = function(node, options, level) {
  33791. switch (node.type) {
  33792. case NodeType.CData:
  33793. return this.cdata(node, options, level);
  33794. case NodeType.Comment:
  33795. return this.comment(node, options, level);
  33796. case NodeType.Element:
  33797. return this.element(node, options, level);
  33798. case NodeType.Raw:
  33799. return this.raw(node, options, level);
  33800. case NodeType.Text:
  33801. return this.text(node, options, level);
  33802. case NodeType.ProcessingInstruction:
  33803. return this.processingInstruction(node, options, level);
  33804. case NodeType.Dummy:
  33805. return '';
  33806. case NodeType.Declaration:
  33807. return this.declaration(node, options, level);
  33808. case NodeType.DocType:
  33809. return this.docType(node, options, level);
  33810. case NodeType.AttributeDeclaration:
  33811. return this.dtdAttList(node, options, level);
  33812. case NodeType.ElementDeclaration:
  33813. return this.dtdElement(node, options, level);
  33814. case NodeType.EntityDeclaration:
  33815. return this.dtdEntity(node, options, level);
  33816. case NodeType.NotationDeclaration:
  33817. return this.dtdNotation(node, options, level);
  33818. default:
  33819. throw new Error("Unknown XML node type: " + node.constructor.name);
  33820. }
  33821. };
  33822. XMLWriterBase.prototype.processingInstruction = function(node, options, level) {
  33823. var r;
  33824. this.openNode(node, options, level);
  33825. options.state = WriterState.OpenTag;
  33826. r = this.indent(node, options, level) + '<?';
  33827. options.state = WriterState.InsideTag;
  33828. r += node.target;
  33829. if (node.value) {
  33830. r += ' ' + node.value;
  33831. }
  33832. options.state = WriterState.CloseTag;
  33833. r += options.spaceBeforeSlash + '?>';
  33834. r += this.endline(node, options, level);
  33835. options.state = WriterState.None;
  33836. this.closeNode(node, options, level);
  33837. return r;
  33838. };
  33839. XMLWriterBase.prototype.raw = function(node, options, level) {
  33840. var r;
  33841. this.openNode(node, options, level);
  33842. options.state = WriterState.OpenTag;
  33843. r = this.indent(node, options, level);
  33844. options.state = WriterState.InsideTag;
  33845. r += node.value;
  33846. options.state = WriterState.CloseTag;
  33847. r += this.endline(node, options, level);
  33848. options.state = WriterState.None;
  33849. this.closeNode(node, options, level);
  33850. return r;
  33851. };
  33852. XMLWriterBase.prototype.text = function(node, options, level) {
  33853. var r;
  33854. this.openNode(node, options, level);
  33855. options.state = WriterState.OpenTag;
  33856. r = this.indent(node, options, level);
  33857. options.state = WriterState.InsideTag;
  33858. r += node.value;
  33859. options.state = WriterState.CloseTag;
  33860. r += this.endline(node, options, level);
  33861. options.state = WriterState.None;
  33862. this.closeNode(node, options, level);
  33863. return r;
  33864. };
  33865. XMLWriterBase.prototype.dtdAttList = function(node, options, level) {
  33866. var r;
  33867. this.openNode(node, options, level);
  33868. options.state = WriterState.OpenTag;
  33869. r = this.indent(node, options, level) + '<!ATTLIST';
  33870. options.state = WriterState.InsideTag;
  33871. r += ' ' + node.elementName + ' ' + node.attributeName + ' ' + node.attributeType;
  33872. if (node.defaultValueType !== '#DEFAULT') {
  33873. r += ' ' + node.defaultValueType;
  33874. }
  33875. if (node.defaultValue) {
  33876. r += ' "' + node.defaultValue + '"';
  33877. }
  33878. options.state = WriterState.CloseTag;
  33879. r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
  33880. options.state = WriterState.None;
  33881. this.closeNode(node, options, level);
  33882. return r;
  33883. };
  33884. XMLWriterBase.prototype.dtdElement = function(node, options, level) {
  33885. var r;
  33886. this.openNode(node, options, level);
  33887. options.state = WriterState.OpenTag;
  33888. r = this.indent(node, options, level) + '<!ELEMENT';
  33889. options.state = WriterState.InsideTag;
  33890. r += ' ' + node.name + ' ' + node.value;
  33891. options.state = WriterState.CloseTag;
  33892. r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
  33893. options.state = WriterState.None;
  33894. this.closeNode(node, options, level);
  33895. return r;
  33896. };
  33897. XMLWriterBase.prototype.dtdEntity = function(node, options, level) {
  33898. var r;
  33899. this.openNode(node, options, level);
  33900. options.state = WriterState.OpenTag;
  33901. r = this.indent(node, options, level) + '<!ENTITY';
  33902. options.state = WriterState.InsideTag;
  33903. if (node.pe) {
  33904. r += ' %';
  33905. }
  33906. r += ' ' + node.name;
  33907. if (node.value) {
  33908. r += ' "' + node.value + '"';
  33909. } else {
  33910. if (node.pubID && node.sysID) {
  33911. r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
  33912. } else if (node.sysID) {
  33913. r += ' SYSTEM "' + node.sysID + '"';
  33914. }
  33915. if (node.nData) {
  33916. r += ' NDATA ' + node.nData;
  33917. }
  33918. }
  33919. options.state = WriterState.CloseTag;
  33920. r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
  33921. options.state = WriterState.None;
  33922. this.closeNode(node, options, level);
  33923. return r;
  33924. };
  33925. XMLWriterBase.prototype.dtdNotation = function(node, options, level) {
  33926. var r;
  33927. this.openNode(node, options, level);
  33928. options.state = WriterState.OpenTag;
  33929. r = this.indent(node, options, level) + '<!NOTATION';
  33930. options.state = WriterState.InsideTag;
  33931. r += ' ' + node.name;
  33932. if (node.pubID && node.sysID) {
  33933. r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
  33934. } else if (node.pubID) {
  33935. r += ' PUBLIC "' + node.pubID + '"';
  33936. } else if (node.sysID) {
  33937. r += ' SYSTEM "' + node.sysID + '"';
  33938. }
  33939. options.state = WriterState.CloseTag;
  33940. r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
  33941. options.state = WriterState.None;
  33942. this.closeNode(node, options, level);
  33943. return r;
  33944. };
  33945. XMLWriterBase.prototype.openNode = function(node, options, level) {};
  33946. XMLWriterBase.prototype.closeNode = function(node, options, level) {};
  33947. XMLWriterBase.prototype.openAttribute = function(att, options, level) {};
  33948. XMLWriterBase.prototype.closeAttribute = function(att, options, level) {};
  33949. return XMLWriterBase;
  33950. })();
  33951. }).call(this);
  33952. },{"./NodeType":428,"./Utility":429,"./WriterState":430,"./XMLCData":432,"./XMLComment":434,"./XMLDTDAttList":439,"./XMLDTDElement":440,"./XMLDTDEntity":441,"./XMLDTDNotation":442,"./XMLDeclaration":443,"./XMLDocType":444,"./XMLDummy":447,"./XMLElement":448,"./XMLProcessingInstruction":452,"./XMLRaw":453,"./XMLText":457}],459:[function(require,module,exports){
  33953. // Generated by CoffeeScript 1.12.7
  33954. (function() {
  33955. var NodeType, WriterState, XMLDOMImplementation, XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction, ref;
  33956. ref = require('./Utility'), assign = ref.assign, isFunction = ref.isFunction;
  33957. XMLDOMImplementation = require('./XMLDOMImplementation');
  33958. XMLDocument = require('./XMLDocument');
  33959. XMLDocumentCB = require('./XMLDocumentCB');
  33960. XMLStringWriter = require('./XMLStringWriter');
  33961. XMLStreamWriter = require('./XMLStreamWriter');
  33962. NodeType = require('./NodeType');
  33963. WriterState = require('./WriterState');
  33964. module.exports.create = function(name, xmldec, doctype, options) {
  33965. var doc, root;
  33966. if (name == null) {
  33967. throw new Error("Root element needs a name.");
  33968. }
  33969. options = assign({}, xmldec, doctype, options);
  33970. doc = new XMLDocument(options);
  33971. root = doc.element(name);
  33972. if (!options.headless) {
  33973. doc.declaration(options);
  33974. if ((options.pubID != null) || (options.sysID != null)) {
  33975. doc.dtd(options);
  33976. }
  33977. }
  33978. return root;
  33979. };
  33980. module.exports.begin = function(options, onData, onEnd) {
  33981. var ref1;
  33982. if (isFunction(options)) {
  33983. ref1 = [options, onData], onData = ref1[0], onEnd = ref1[1];
  33984. options = {};
  33985. }
  33986. if (onData) {
  33987. return new XMLDocumentCB(options, onData, onEnd);
  33988. } else {
  33989. return new XMLDocument(options);
  33990. }
  33991. };
  33992. module.exports.stringWriter = function(options) {
  33993. return new XMLStringWriter(options);
  33994. };
  33995. module.exports.streamWriter = function(stream, options) {
  33996. return new XMLStreamWriter(stream, options);
  33997. };
  33998. module.exports.implementation = new XMLDOMImplementation();
  33999. module.exports.nodeType = NodeType;
  34000. module.exports.writerState = WriterState;
  34001. }).call(this);
  34002. },{"./NodeType":428,"./Utility":429,"./WriterState":430,"./XMLDOMImplementation":437,"./XMLDocument":445,"./XMLDocumentCB":446,"./XMLStreamWriter":454,"./XMLStringWriter":455}],460:[function(require,module,exports){
  34003. module.exports = extend
  34004. var hasOwnProperty = Object.prototype.hasOwnProperty;
  34005. function extend() {
  34006. var target = {}
  34007. for (var i = 0; i < arguments.length; i++) {
  34008. var source = arguments[i]
  34009. for (var key in source) {
  34010. if (hasOwnProperty.call(source, key)) {
  34011. target[key] = source[key]
  34012. }
  34013. }
  34014. }
  34015. return target
  34016. }
  34017. },{}],461:[function(require,module,exports){
  34018. "use strict";
  34019. require("core-js/modules/es.array.fill.js");
  34020. require("core-js/modules/es.array.concat.js");
  34021. require("core-js/modules/es.object.to-string.js");
  34022. require("core-js/modules/es.regexp.to-string.js");
  34023. require("core-js/modules/es.array.join.js");
  34024. require("core-js/modules/es.array.slice.js");
  34025. var Buffer = require('buffer').Buffer;
  34026. var sha = require('./sha');
  34027. var md5 = require('./md5');
  34028. var algorithms = {
  34029. sha1: sha,
  34030. md5: md5
  34031. };
  34032. var blocksize = 64;
  34033. var zeroBuffer = Buffer.alloc(blocksize);
  34034. zeroBuffer.fill(0);
  34035. function hmac(fn, key, data) {
  34036. if (!Buffer.isBuffer(key)) key = Buffer.from(key);
  34037. if (!Buffer.isBuffer(data)) data = Buffer.from(data);
  34038. if (key.length > blocksize) {
  34039. key = fn(key);
  34040. } else if (key.length < blocksize) {
  34041. key = Buffer.concat([key, zeroBuffer], blocksize);
  34042. }
  34043. var ipad = Buffer.alloc(blocksize),
  34044. opad = Buffer.alloc(blocksize);
  34045. for (var i = 0; i < blocksize; i++) {
  34046. ipad[i] = key[i] ^ 0x36;
  34047. opad[i] = key[i] ^ 0x5c;
  34048. }
  34049. var hash = fn(Buffer.concat([ipad, data]));
  34050. return fn(Buffer.concat([opad, hash]));
  34051. }
  34052. function hash(alg, key) {
  34053. alg = alg || 'sha1';
  34054. var fn = algorithms[alg];
  34055. var bufs = [];
  34056. var length = 0;
  34057. if (!fn) error('algorithm:', alg, 'is not yet supported');
  34058. return {
  34059. update: function update(data) {
  34060. if (!Buffer.isBuffer(data)) data = Buffer.from(data);
  34061. bufs.push(data);
  34062. length += data.length;
  34063. return this;
  34064. },
  34065. digest: function digest(enc) {
  34066. var buf = Buffer.concat(bufs);
  34067. var r = key ? hmac(fn, key, buf) : fn(buf);
  34068. bufs = null;
  34069. return enc ? r.toString(enc) : r;
  34070. }
  34071. };
  34072. }
  34073. function error() {
  34074. var m = [].slice.call(arguments).join(' ');
  34075. throw new Error([m, 'we accept pull requests', 'http://github.com/dominictarr/crypto-browserify'].join('\n'));
  34076. }
  34077. exports.createHash = function (alg) {
  34078. return hash(alg);
  34079. };
  34080. exports.createHmac = function (alg, key) {
  34081. return hash(alg, key);
  34082. };
  34083. exports.createCredentials = function () {
  34084. error('sorry,createCredentials is not implemented yet');
  34085. };
  34086. exports.createCipher = function () {
  34087. error('sorry,createCipher is not implemented yet');
  34088. };
  34089. exports.createCipheriv = function () {
  34090. error('sorry,createCipheriv is not implemented yet');
  34091. };
  34092. exports.createDecipher = function () {
  34093. error('sorry,createDecipher is not implemented yet');
  34094. };
  34095. exports.createDecipheriv = function () {
  34096. error('sorry,createDecipheriv is not implemented yet');
  34097. };
  34098. exports.createSign = function () {
  34099. error('sorry,createSign is not implemented yet');
  34100. };
  34101. exports.createVerify = function () {
  34102. error('sorry,createVerify is not implemented yet');
  34103. };
  34104. exports.createDiffieHellman = function () {
  34105. error('sorry,createDiffieHellman is not implemented yet');
  34106. };
  34107. exports.pbkdf2 = function () {
  34108. error('sorry,pbkdf2 is not implemented yet');
  34109. };
  34110. },{"./md5":463,"./sha":464,"buffer":90,"core-js/modules/es.array.concat.js":272,"core-js/modules/es.array.fill.js":273,"core-js/modules/es.array.join.js":279,"core-js/modules/es.array.slice.js":281,"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.regexp.to-string.js":301}],462:[function(require,module,exports){
  34111. "use strict";
  34112. require("core-js/modules/es.array.fill.js");
  34113. require("core-js/modules/es.array.concat.js");
  34114. var Buffer = require('buffer').Buffer;
  34115. var intSize = 4;
  34116. var zeroBuffer = Buffer.alloc(intSize);
  34117. zeroBuffer.fill(0);
  34118. var chrsz = 8;
  34119. function toArray(buf, bigEndian) {
  34120. if (buf.length % intSize !== 0) {
  34121. var len = buf.length + (intSize - buf.length % intSize);
  34122. buf = Buffer.concat([buf, zeroBuffer], len);
  34123. }
  34124. var arr = [];
  34125. var fn = bigEndian ? buf.readInt32BE : buf.readInt32LE;
  34126. for (var i = 0; i < buf.length; i += intSize) {
  34127. arr.push(fn.call(buf, i));
  34128. }
  34129. return arr;
  34130. }
  34131. function toBuffer(arr, size, bigEndian) {
  34132. var buf = Buffer.alloc(size);
  34133. var fn = bigEndian ? buf.writeInt32BE : buf.writeInt32LE;
  34134. for (var i = 0; i < arr.length; i++) {
  34135. fn.call(buf, arr[i], i * 4, true);
  34136. }
  34137. return buf;
  34138. }
  34139. function hash(buf, fn, hashSize, bigEndian) {
  34140. if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf);
  34141. var arr = fn(toArray(buf, bigEndian), buf.length * chrsz);
  34142. return toBuffer(arr, hashSize, bigEndian);
  34143. }
  34144. module.exports = {
  34145. hash: hash
  34146. };
  34147. },{"buffer":90,"core-js/modules/es.array.concat.js":272,"core-js/modules/es.array.fill.js":273}],463:[function(require,module,exports){
  34148. "use strict";
  34149. /*
  34150. * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
  34151. * Digest Algorithm, as defined in RFC 1321.
  34152. * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
  34153. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  34154. * Distributed under the BSD License
  34155. * See http://pajhome.org.uk/crypt/md5 for more info.
  34156. */
  34157. var helpers = require('./helpers');
  34158. /*
  34159. * Perform a simple self-test to see if the VM is working
  34160. */
  34161. function md5_vm_test() {
  34162. return hex_md5('abc') == '900150983cd24fb0d6963f7d28e17f72';
  34163. }
  34164. /*
  34165. * Calculate the MD5 of an array of little-endian words, and a bit length
  34166. */
  34167. function core_md5(x, len) {
  34168. /* append padding */
  34169. x[len >> 5] |= 0x80 << len % 32;
  34170. x[(len + 64 >>> 9 << 4) + 14] = len;
  34171. var a = 1732584193;
  34172. var b = -271733879;
  34173. var c = -1732584194;
  34174. var d = 271733878;
  34175. for (var i = 0; i < x.length; i += 16) {
  34176. var olda = a;
  34177. var oldb = b;
  34178. var oldc = c;
  34179. var oldd = d;
  34180. a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936);
  34181. d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
  34182. c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
  34183. b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
  34184. a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
  34185. d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
  34186. c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
  34187. b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
  34188. a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
  34189. d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
  34190. c = md5_ff(c, d, a, b, x[i + 10], 17, -42063);
  34191. b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
  34192. a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
  34193. d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
  34194. c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
  34195. b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
  34196. a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
  34197. d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
  34198. c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
  34199. b = md5_gg(b, c, d, a, x[i + 0], 20, -373897302);
  34200. a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
  34201. d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
  34202. c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
  34203. b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
  34204. a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
  34205. d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
  34206. c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
  34207. b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
  34208. a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
  34209. d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
  34210. c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
  34211. b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
  34212. a = md5_hh(a, b, c, d, x[i + 5], 4, -378558);
  34213. d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
  34214. c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
  34215. b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
  34216. a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
  34217. d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
  34218. c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
  34219. b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
  34220. a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
  34221. d = md5_hh(d, a, b, c, x[i + 0], 11, -358537222);
  34222. c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
  34223. b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
  34224. a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
  34225. d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
  34226. c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
  34227. b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
  34228. a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844);
  34229. d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
  34230. c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
  34231. b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
  34232. a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
  34233. d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
  34234. c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
  34235. b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
  34236. a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
  34237. d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
  34238. c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
  34239. b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
  34240. a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
  34241. d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
  34242. c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
  34243. b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
  34244. a = safe_add(a, olda);
  34245. b = safe_add(b, oldb);
  34246. c = safe_add(c, oldc);
  34247. d = safe_add(d, oldd);
  34248. }
  34249. return Array(a, b, c, d);
  34250. }
  34251. /*
  34252. * These functions implement the four basic operations the algorithm uses.
  34253. */
  34254. function md5_cmn(q, a, b, x, s, t) {
  34255. return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b);
  34256. }
  34257. function md5_ff(a, b, c, d, x, s, t) {
  34258. return md5_cmn(b & c | ~b & d, a, b, x, s, t);
  34259. }
  34260. function md5_gg(a, b, c, d, x, s, t) {
  34261. return md5_cmn(b & d | c & ~d, a, b, x, s, t);
  34262. }
  34263. function md5_hh(a, b, c, d, x, s, t) {
  34264. return md5_cmn(b ^ c ^ d, a, b, x, s, t);
  34265. }
  34266. function md5_ii(a, b, c, d, x, s, t) {
  34267. return md5_cmn(c ^ (b | ~d), a, b, x, s, t);
  34268. }
  34269. /*
  34270. * Add integers, wrapping at 2^32. This uses 16-bit operations internally
  34271. * to work around bugs in some JS interpreters.
  34272. */
  34273. function safe_add(x, y) {
  34274. var lsw = (x & 0xffff) + (y & 0xffff);
  34275. var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  34276. return msw << 16 | lsw & 0xffff;
  34277. }
  34278. /*
  34279. * Bitwise rotate a 32-bit number to the left.
  34280. */
  34281. function bit_rol(num, cnt) {
  34282. return num << cnt | num >>> 32 - cnt;
  34283. }
  34284. module.exports = function md5(buf) {
  34285. return helpers.hash(buf, core_md5, 16);
  34286. };
  34287. },{"./helpers":462}],464:[function(require,module,exports){
  34288. "use strict";
  34289. /*
  34290. * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
  34291. * in FIPS PUB 180-1
  34292. * Version 2.1a Copyright Paul Johnston 2000 - 2002.
  34293. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  34294. * Distributed under the BSD License
  34295. * See http://pajhome.org.uk/crypt/md5 for details.
  34296. */
  34297. var helpers = require('./helpers');
  34298. /*
  34299. * Calculate the SHA-1 of an array of big-endian words, and a bit length
  34300. */
  34301. function core_sha1(x, len) {
  34302. /* append padding */
  34303. x[len >> 5] |= 0x80 << 24 - len % 32;
  34304. x[(len + 64 >> 9 << 4) + 15] = len;
  34305. var w = Array(80);
  34306. var a = 1732584193;
  34307. var b = -271733879;
  34308. var c = -1732584194;
  34309. var d = 271733878;
  34310. var e = -1009589776;
  34311. for (var i = 0; i < x.length; i += 16) {
  34312. var olda = a;
  34313. var oldb = b;
  34314. var oldc = c;
  34315. var oldd = d;
  34316. var olde = e;
  34317. for (var j = 0; j < 80; j++) {
  34318. if (j < 16) w[j] = x[i + j];else w[j] = rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
  34319. var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)), safe_add(safe_add(e, w[j]), sha1_kt(j)));
  34320. e = d;
  34321. d = c;
  34322. c = rol(b, 30);
  34323. b = a;
  34324. a = t;
  34325. }
  34326. a = safe_add(a, olda);
  34327. b = safe_add(b, oldb);
  34328. c = safe_add(c, oldc);
  34329. d = safe_add(d, oldd);
  34330. e = safe_add(e, olde);
  34331. }
  34332. return Array(a, b, c, d, e);
  34333. }
  34334. /*
  34335. * Perform the appropriate triplet combination function for the current
  34336. * iteration
  34337. */
  34338. function sha1_ft(t, b, c, d) {
  34339. if (t < 20) return b & c | ~b & d;
  34340. if (t < 40) return b ^ c ^ d;
  34341. if (t < 60) return b & c | b & d | c & d;
  34342. return b ^ c ^ d;
  34343. }
  34344. /*
  34345. * Determine the appropriate additive constant for the current iteration
  34346. */
  34347. function sha1_kt(t) {
  34348. return t < 20 ? 1518500249 : t < 40 ? 1859775393 : t < 60 ? -1894007588 : -899497514;
  34349. }
  34350. /*
  34351. * Add integers, wrapping at 2^32. This uses 16-bit operations internally
  34352. * to work around bugs in some JS interpreters.
  34353. */
  34354. function safe_add(x, y) {
  34355. var lsw = (x & 0xffff) + (y & 0xffff);
  34356. var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  34357. return msw << 16 | lsw & 0xffff;
  34358. }
  34359. /*
  34360. * Bitwise rotate a 32-bit number to the left.
  34361. */
  34362. function rol(num, cnt) {
  34363. return num << cnt | num >>> 32 - cnt;
  34364. }
  34365. module.exports = function sha1(buf) {
  34366. return helpers.hash(buf, core_sha1, 20, true);
  34367. };
  34368. },{"./helpers":462}],465:[function(require,module,exports){
  34369. "use strict";
  34370. module.exports = function () {
  34371. return function () {};
  34372. };
  34373. },{}],466:[function(require,module,exports){
  34374. (function (Buffer){(function (){
  34375. "use strict";
  34376. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  34377. var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
  34378. var _require = require('stream'),
  34379. Stream = _require.Stream;
  34380. var _require2 = require('../lib/common/utils/isArray'),
  34381. isArray = _require2.isArray;
  34382. module.exports.string = function isString(obj) {
  34383. return typeof obj === 'string';
  34384. };
  34385. module.exports.array = isArray;
  34386. module.exports.buffer = Buffer.isBuffer;
  34387. function isStream(obj) {
  34388. return obj instanceof Stream;
  34389. }
  34390. module.exports.writableStream = function isWritableStream(obj) {
  34391. return isStream(obj) && typeof obj._write === 'function' && (0, _typeof2.default)(obj._writableState) === 'object';
  34392. };
  34393. }).call(this)}).call(this,{"isBuffer":require("../node_modules/is-buffer/index.js")})
  34394. },{"../lib/common/utils/isArray":63,"../node_modules/is-buffer/index.js":366,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/helpers/typeof":79,"stream":398}],467:[function(require,module,exports){
  34395. "use strict";
  34396. var immediate = require('immediate');
  34397. var process = module.exports = {};
  34398. process.nextTick = immediate;
  34399. process.title = 'browser';
  34400. process.browser = true;
  34401. process.env = {};
  34402. process.argv = [];
  34403. process.version = ''; // empty string to avoid regexp issues
  34404. process.versions = {};
  34405. function noop() {}
  34406. process.on = noop;
  34407. process.addListener = noop;
  34408. process.once = noop;
  34409. process.off = noop;
  34410. process.removeListener = noop;
  34411. process.removeAllListeners = noop;
  34412. process.emit = noop;
  34413. process.prependListener = noop;
  34414. process.prependOnceListener = noop;
  34415. process.listeners = function (name) {
  34416. return [];
  34417. };
  34418. process.binding = function (name) {
  34419. throw new Error('process.binding is not supported');
  34420. };
  34421. process.cwd = function () {
  34422. return '/';
  34423. };
  34424. process.chdir = function (dir) {
  34425. throw new Error('process.chdir is not supported');
  34426. };
  34427. process.umask = function () {
  34428. return 0;
  34429. };
  34430. },{"immediate":358}],468:[function(require,module,exports){
  34431. (function (global){(function (){
  34432. "use strict";
  34433. require("core-js/modules/es.regexp.exec.js");
  34434. require("core-js/modules/es.string.search.js");
  34435. //"version": "2.8.2",
  34436. var ClientRequest = require('./lib/request');
  34437. var response = require('./lib/response');
  34438. var extend = require('xtend');
  34439. var statusCodes = require('builtin-status-codes');
  34440. var url = require('url');
  34441. var http = exports;
  34442. http.request = function (opts, cb) {
  34443. if (typeof opts === 'string') opts = url.parse(opts);else opts = extend(opts); // Normally, the page is loaded from http or https, so not specifying a protocol
  34444. // will result in a (valid) protocol-relative url. However, this won't work if
  34445. // the protocol is something else, like 'file:'
  34446. var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : '';
  34447. var protocol = opts.protocol || defaultProtocol;
  34448. var host = opts.hostname || opts.host;
  34449. var port = opts.port;
  34450. var path = opts.path || '/'; // Necessary for IPv6 addresses
  34451. if (host && host.indexOf(':') !== -1) host = '[' + host + ']'; // This may be a relative url. The browser should always be able to interpret it correctly.
  34452. opts.url = (host ? protocol + '//' + host : '') + (port ? ':' + port : '') + path;
  34453. opts.method = (opts.method || 'GET').toUpperCase();
  34454. opts.headers = opts.headers || {}; // Also valid opts.auth, opts.mode
  34455. var req = new ClientRequest(opts);
  34456. if (cb) req.on('response', cb);
  34457. return req;
  34458. };
  34459. http.get = function get(opts, cb) {
  34460. var req = http.request(opts, cb);
  34461. req.end();
  34462. return req;
  34463. };
  34464. http.ClientRequest = ClientRequest;
  34465. http.IncomingMessage = response.IncomingMessage;
  34466. http.Agent = function () {};
  34467. http.Agent.defaultMaxSockets = 4;
  34468. http.globalAgent = new http.Agent();
  34469. http.STATUS_CODES = statusCodes;
  34470. http.METHODS = ['CHECKOUT', 'CONNECT', 'COPY', 'DELETE', 'GET', 'HEAD', 'LOCK', 'M-SEARCH', 'MERGE', 'MKACTIVITY', 'MKCOL', 'MOVE', 'NOTIFY', 'OPTIONS', 'PATCH', 'POST', 'PROPFIND', 'PROPPATCH', 'PURGE', 'PUT', 'REPORT', 'SEARCH', 'SUBSCRIBE', 'TRACE', 'UNLOCK', 'UNSUBSCRIBE'];
  34471. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  34472. },{"./lib/request":470,"./lib/response":471,"builtin-status-codes":91,"core-js/modules/es.regexp.exec.js":300,"core-js/modules/es.string.search.js":306,"url":472,"xtend":460}],469:[function(require,module,exports){
  34473. (function (global){(function (){
  34474. "use strict";
  34475. require("core-js/modules/es.object.to-string.js");
  34476. require("core-js/modules/es.promise.js");
  34477. require("core-js/modules/es.array-buffer.constructor.js");
  34478. require("core-js/modules/es.array-buffer.slice.js");
  34479. require("core-js/modules/es.array.slice.js");
  34480. exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream);
  34481. exports.writableStream = isFunction(global.WritableStream);
  34482. exports.abortController = isFunction(global.AbortController);
  34483. exports.blobConstructor = false;
  34484. try {
  34485. new Blob([new ArrayBuffer(1)]);
  34486. exports.blobConstructor = true;
  34487. } catch (e) {} // The xhr request to example.com may violate some restrictive CSP configurations,
  34488. // so if we're running in a browser that supports `fetch`, avoid calling getXHR()
  34489. // and assume support for certain features below.
  34490. var xhr;
  34491. function getXHR() {
  34492. // Cache the xhr value
  34493. if (xhr !== undefined) return xhr;
  34494. if (global.XMLHttpRequest) {
  34495. xhr = new global.XMLHttpRequest(); // If XDomainRequest is available (ie only, where xhr might not work
  34496. // cross domain), use the page location. Otherwise use example.com
  34497. // Note: this doesn't actually make an http request.
  34498. try {
  34499. xhr.open('GET', global.XDomainRequest ? '/' : 'https://example.com');
  34500. } catch (e) {
  34501. xhr = null;
  34502. }
  34503. } else {
  34504. // Service workers don't have XHR
  34505. xhr = null;
  34506. }
  34507. return xhr;
  34508. }
  34509. function checkTypeSupport(type) {
  34510. var xhr = getXHR();
  34511. if (!xhr) return false;
  34512. try {
  34513. xhr.responseType = type;
  34514. return xhr.responseType === type;
  34515. } catch (e) {}
  34516. return false;
  34517. } // For some strange reason, Safari 7.0 reports typeof global.ArrayBuffer === 'object'.
  34518. // Safari 7.1 appears to have fixed this bug.
  34519. var haveArrayBuffer = typeof global.ArrayBuffer !== 'undefined';
  34520. var haveSlice = haveArrayBuffer && isFunction(global.ArrayBuffer.prototype.slice); // If fetch is supported, then arraybuffer will be supported too. Skip calling
  34521. // checkTypeSupport(), since that calls getXHR().
  34522. exports.arraybuffer = exports.fetch || haveArrayBuffer && checkTypeSupport('arraybuffer'); // These next two tests unavoidably show warnings in Chrome. Since fetch will always
  34523. // be used if it's available, just return false for these to avoid the warnings.
  34524. exports.msstream = !exports.fetch && haveSlice && checkTypeSupport('ms-stream');
  34525. exports.mozchunkedarraybuffer = !exports.fetch && haveArrayBuffer && checkTypeSupport('moz-chunked-arraybuffer'); // If fetch is supported, then overrideMimeType will be supported too. Skip calling
  34526. // getXHR().
  34527. exports.overrideMimeType = exports.fetch || (getXHR() ? isFunction(getXHR().overrideMimeType) : false);
  34528. exports.vbArray = isFunction(global.VBArray);
  34529. function isFunction(value) {
  34530. return typeof value === 'function';
  34531. }
  34532. xhr = null; // Help gc
  34533. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  34534. },{"core-js/modules/es.array-buffer.constructor.js":270,"core-js/modules/es.array-buffer.slice.js":271,"core-js/modules/es.array.slice.js":281,"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.promise.js":295}],470:[function(require,module,exports){
  34535. (function (process,global,Buffer){(function (){
  34536. "use strict";
  34537. require("core-js/modules/es.object.to-string.js");
  34538. require("core-js/modules/es.regexp.to-string.js");
  34539. require("core-js/modules/web.dom-collections.for-each.js");
  34540. require("core-js/modules/es.object.keys.js");
  34541. require("core-js/modules/es.array.concat.js");
  34542. require("core-js/modules/es.array.map.js");
  34543. require("core-js/modules/es.function.name.js");
  34544. require("core-js/modules/es.promise.js");
  34545. require("core-js/modules/es.regexp.exec.js");
  34546. require("core-js/modules/es.string.split.js");
  34547. var capability = require('./capability');
  34548. var inherits = require('inherits');
  34549. var response = require('./response');
  34550. var stream = require('readable-stream');
  34551. var toArrayBuffer = require('to-arraybuffer');
  34552. var IncomingMessage = response.IncomingMessage;
  34553. var rStates = response.readyStates;
  34554. function decideMode(preferBinary, useFetch) {
  34555. if (capability.fetch && useFetch) {
  34556. return 'fetch';
  34557. } else if (capability.mozchunkedarraybuffer) {
  34558. return 'moz-chunked-arraybuffer';
  34559. } else if (capability.msstream) {
  34560. return 'ms-stream';
  34561. } else if (capability.arraybuffer && preferBinary) {
  34562. return 'arraybuffer';
  34563. } else if (capability.vbArray && preferBinary) {
  34564. return 'text:vbarray';
  34565. } else {
  34566. return 'text';
  34567. }
  34568. }
  34569. var ClientRequest = module.exports = function (opts) {
  34570. var self = this;
  34571. stream.Writable.call(self);
  34572. self._opts = opts;
  34573. self._body = [];
  34574. self._headers = {};
  34575. if (opts.auth) self.setHeader('Authorization', 'Basic ' + new Buffer(opts.auth).toString('base64'));
  34576. Object.keys(opts.headers).forEach(function (name) {
  34577. self.setHeader(name, opts.headers[name]);
  34578. });
  34579. var preferBinary;
  34580. var useFetch = true;
  34581. if (opts.mode === 'disable-fetch' || 'requestTimeout' in opts && !capability.abortController) {
  34582. // If the use of XHR should be preferred. Not typically needed.
  34583. useFetch = false;
  34584. preferBinary = true;
  34585. } else if (opts.mode === 'prefer-streaming') {
  34586. // If streaming is a high priority but binary compatibility and
  34587. // the accuracy of the 'content-type' header aren't
  34588. preferBinary = false;
  34589. } else if (opts.mode === 'allow-wrong-content-type') {
  34590. // If streaming is more important than preserving the 'content-type' header
  34591. preferBinary = !capability.overrideMimeType;
  34592. } else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') {
  34593. // Use binary if text streaming may corrupt data or the content-type header, or for speed
  34594. preferBinary = true;
  34595. } else {
  34596. throw new Error('Invalid value for opts.mode');
  34597. }
  34598. self._mode = decideMode(preferBinary, useFetch);
  34599. self._fetchTimer = null;
  34600. self.on('finish', function () {
  34601. self._onFinish();
  34602. });
  34603. };
  34604. inherits(ClientRequest, stream.Writable);
  34605. ClientRequest.prototype.setHeader = function (name, value) {
  34606. var self = this;
  34607. var lowerName = name.toLowerCase(); // This check is not necessary, but it prevents warnings from browsers about setting unsafe
  34608. // headers. To be honest I'm not entirely sure hiding these warnings is a good thing, but
  34609. // http-browserify did it, so I will too.
  34610. if (unsafeHeaders.indexOf(lowerName) !== -1) return;
  34611. self._headers[lowerName] = {
  34612. name: name,
  34613. value: value
  34614. };
  34615. };
  34616. ClientRequest.prototype.getHeader = function (name) {
  34617. var header = this._headers[name.toLowerCase()];
  34618. if (header) return header.value;
  34619. return null;
  34620. };
  34621. ClientRequest.prototype.removeHeader = function (name) {
  34622. var self = this;
  34623. delete self._headers[name.toLowerCase()];
  34624. };
  34625. ClientRequest.prototype._onFinish = function () {
  34626. var self = this;
  34627. if (self._destroyed) return;
  34628. var opts = self._opts;
  34629. var headersObj = self._headers;
  34630. var body = null;
  34631. if (opts.method !== 'GET' && opts.method !== 'HEAD') {
  34632. if (capability.arraybuffer) {
  34633. body = toArrayBuffer(Buffer.concat(self._body));
  34634. } else if (capability.blobConstructor) {
  34635. body = new global.Blob(self._body.map(function (buffer) {
  34636. return toArrayBuffer(buffer);
  34637. }), {
  34638. type: (headersObj['content-type'] || {}).value || ''
  34639. });
  34640. } else {
  34641. // get utf8 string
  34642. body = Buffer.concat(self._body).toString();
  34643. }
  34644. } // create flattened list of headers
  34645. var headersList = [];
  34646. Object.keys(headersObj).forEach(function (keyName) {
  34647. var name = headersObj[keyName].name;
  34648. var value = headersObj[keyName].value;
  34649. if (Array.isArray(value)) {
  34650. value.forEach(function (v) {
  34651. headersList.push([name, v]);
  34652. });
  34653. } else {
  34654. headersList.push([name, value]);
  34655. }
  34656. });
  34657. if (self._mode === 'fetch') {
  34658. var signal = null;
  34659. var fetchTimer = null;
  34660. if (capability.abortController) {
  34661. var controller = new AbortController();
  34662. signal = controller.signal;
  34663. self._fetchAbortController = controller;
  34664. if ('requestTimeout' in opts && opts.requestTimeout !== 0) {
  34665. self._fetchTimer = global.setTimeout(function () {
  34666. self.emit('requestTimeout');
  34667. if (self._fetchAbortController) self._fetchAbortController.abort();
  34668. }, opts.requestTimeout);
  34669. }
  34670. }
  34671. global.fetch(self._opts.url, {
  34672. method: self._opts.method,
  34673. headers: headersList,
  34674. body: body || undefined,
  34675. mode: 'cors',
  34676. credentials: opts.withCredentials ? 'include' : 'same-origin',
  34677. signal: signal
  34678. }).then(function (response) {
  34679. self._fetchResponse = response;
  34680. self._connect();
  34681. }, function (reason) {
  34682. global.clearTimeout(self._fetchTimer);
  34683. if (!self._destroyed) self.emit('error', reason);
  34684. });
  34685. } else {
  34686. var xhr = self._xhr = new global.XMLHttpRequest();
  34687. try {
  34688. xhr.open(self._opts.method, self._opts.url, true);
  34689. } catch (err) {
  34690. process.nextTick(function () {
  34691. self.emit('error', err);
  34692. });
  34693. return;
  34694. } // Can't set responseType on really old browsers
  34695. if ('responseType' in xhr) xhr.responseType = self._mode.split(':')[0];
  34696. if ('withCredentials' in xhr) xhr.withCredentials = !!opts.withCredentials;
  34697. if (self._mode === 'text' && 'overrideMimeType' in xhr) xhr.overrideMimeType('text/plain; charset=x-user-defined');
  34698. if ('requestTimeout' in opts) {
  34699. xhr.timeout = opts.requestTimeout;
  34700. xhr.ontimeout = function () {
  34701. self.emit('requestTimeout');
  34702. };
  34703. }
  34704. headersList.forEach(function (header) {
  34705. xhr.setRequestHeader(header[0], header[1]);
  34706. });
  34707. self._response = null;
  34708. xhr.onreadystatechange = function () {
  34709. switch (xhr.readyState) {
  34710. case rStates.LOADING:
  34711. case rStates.DONE:
  34712. self._onXHRProgress();
  34713. break;
  34714. }
  34715. }; // Necessary for streaming in Firefox, since xhr.response is ONLY defined
  34716. // in onprogress, not in onreadystatechange with xhr.readyState = 3
  34717. if (self._mode === 'moz-chunked-arraybuffer') {
  34718. xhr.onprogress = function () {
  34719. self._onXHRProgress();
  34720. };
  34721. }
  34722. xhr.onerror = function () {
  34723. if (self._destroyed) return;
  34724. self.emit('error', new Error('XHR error'));
  34725. };
  34726. try {
  34727. xhr.send(body);
  34728. } catch (err) {
  34729. process.nextTick(function () {
  34730. self.emit('error', err);
  34731. });
  34732. return;
  34733. }
  34734. }
  34735. };
  34736. /**
  34737. * Checks if xhr.status is readable and non-zero, indicating no error.
  34738. * Even though the spec says it should be available in readyState 3,
  34739. * accessing it throws an exception in IE8
  34740. */
  34741. function statusValid(xhr) {
  34742. try {
  34743. var status = xhr.status;
  34744. return status !== null && status !== 0;
  34745. } catch (e) {
  34746. return false;
  34747. }
  34748. }
  34749. ClientRequest.prototype._onXHRProgress = function () {
  34750. var self = this;
  34751. if (!statusValid(self._xhr) || self._destroyed) return;
  34752. if (!self._response) self._connect();
  34753. self._response._onXHRProgress();
  34754. };
  34755. ClientRequest.prototype._connect = function () {
  34756. var self = this;
  34757. if (self._destroyed) return;
  34758. self._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode, self._fetchTimer);
  34759. self._response.on('error', function (err) {
  34760. self.emit('error', err);
  34761. });
  34762. self.emit('response', self._response);
  34763. };
  34764. ClientRequest.prototype._write = function (chunk, encoding, cb) {
  34765. var self = this;
  34766. self._body.push(chunk);
  34767. cb();
  34768. };
  34769. ClientRequest.prototype.abort = ClientRequest.prototype.destroy = function () {
  34770. var self = this;
  34771. self._destroyed = true;
  34772. global.clearTimeout(self._fetchTimer);
  34773. if (self._response) self._response._destroyed = true;
  34774. if (self._xhr) self._xhr.abort();else if (self._fetchAbortController) self._fetchAbortController.abort();
  34775. };
  34776. ClientRequest.prototype.end = function (data, encoding, cb) {
  34777. var self = this;
  34778. if (typeof data === 'function') {
  34779. cb = data;
  34780. data = undefined;
  34781. }
  34782. stream.Writable.prototype.end.call(self, data, encoding, cb);
  34783. };
  34784. ClientRequest.prototype.flushHeaders = function () {};
  34785. ClientRequest.prototype.setTimeout = function () {};
  34786. ClientRequest.prototype.setNoDelay = function () {};
  34787. ClientRequest.prototype.setSocketKeepAlive = function () {}; // Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method
  34788. var unsafeHeaders = ['accept-charset', 'accept-encoding', 'access-control-request-headers', 'access-control-request-method', 'connection', 'content-length', 'cookie', 'cookie2', 'date', 'dnt', 'expect', 'host', 'keep-alive', 'origin', 'referer', 'te', 'trailer', 'transfer-encoding', 'upgrade', 'user-agent', 'via'];
  34789. }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer)
  34790. },{"./capability":469,"./response":471,"_process":467,"buffer":90,"core-js/modules/es.array.concat.js":272,"core-js/modules/es.array.map.js":280,"core-js/modules/es.function.name.js":284,"core-js/modules/es.object.keys.js":290,"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.promise.js":295,"core-js/modules/es.regexp.exec.js":300,"core-js/modules/es.regexp.to-string.js":301,"core-js/modules/es.string.split.js":307,"core-js/modules/web.dom-collections.for-each.js":339,"inherits":364,"readable-stream":394,"to-arraybuffer":415}],471:[function(require,module,exports){
  34791. (function (process,global,Buffer){(function (){
  34792. "use strict";
  34793. require("core-js/modules/es.object.to-string.js");
  34794. require("core-js/modules/web.dom-collections.for-each.js");
  34795. require("core-js/modules/es.promise.js");
  34796. require("core-js/modules/es.regexp.exec.js");
  34797. require("core-js/modules/es.string.split.js");
  34798. require("core-js/modules/es.string.match.js");
  34799. require("core-js/modules/es.array.iterator.js");
  34800. require("core-js/modules/es.array-buffer.slice.js");
  34801. require("core-js/modules/es.typed-array.uint8-array.js");
  34802. require("core-js/modules/es.typed-array.copy-within.js");
  34803. require("core-js/modules/es.typed-array.every.js");
  34804. require("core-js/modules/es.typed-array.fill.js");
  34805. require("core-js/modules/es.typed-array.filter.js");
  34806. require("core-js/modules/es.typed-array.find.js");
  34807. require("core-js/modules/es.typed-array.find-index.js");
  34808. require("core-js/modules/es.typed-array.for-each.js");
  34809. require("core-js/modules/es.typed-array.includes.js");
  34810. require("core-js/modules/es.typed-array.index-of.js");
  34811. require("core-js/modules/es.typed-array.iterator.js");
  34812. require("core-js/modules/es.typed-array.join.js");
  34813. require("core-js/modules/es.typed-array.last-index-of.js");
  34814. require("core-js/modules/es.typed-array.map.js");
  34815. require("core-js/modules/es.typed-array.reduce.js");
  34816. require("core-js/modules/es.typed-array.reduce-right.js");
  34817. require("core-js/modules/es.typed-array.reverse.js");
  34818. require("core-js/modules/es.typed-array.set.js");
  34819. require("core-js/modules/es.typed-array.slice.js");
  34820. require("core-js/modules/es.typed-array.some.js");
  34821. require("core-js/modules/es.typed-array.sort.js");
  34822. require("core-js/modules/es.typed-array.subarray.js");
  34823. require("core-js/modules/es.typed-array.to-locale-string.js");
  34824. require("core-js/modules/es.typed-array.to-string.js");
  34825. require("core-js/modules/es.array.slice.js");
  34826. var capability = require('./capability');
  34827. var inherits = require('inherits');
  34828. var stream = require('readable-stream');
  34829. var rStates = exports.readyStates = {
  34830. UNSENT: 0,
  34831. OPENED: 1,
  34832. HEADERS_RECEIVED: 2,
  34833. LOADING: 3,
  34834. DONE: 4
  34835. };
  34836. var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode, fetchTimer) {
  34837. var self = this;
  34838. stream.Readable.call(self);
  34839. self._mode = mode;
  34840. self.headers = {};
  34841. self.rawHeaders = [];
  34842. self.trailers = {};
  34843. self.rawTrailers = []; // Fake the 'close' event, but only once 'end' fires
  34844. self.on('end', function () {
  34845. // The nextTick is necessary to prevent the 'request' module from causing an infinite loop
  34846. process.nextTick(function () {
  34847. self.emit('close');
  34848. });
  34849. });
  34850. if (mode === 'fetch') {
  34851. var read = function read() {
  34852. reader.read().then(function (result) {
  34853. if (self._destroyed) return;
  34854. if (result.done) {
  34855. global.clearTimeout(fetchTimer);
  34856. self.push(null);
  34857. return;
  34858. }
  34859. self.push(new Buffer(result.value));
  34860. read();
  34861. }).catch(function (err) {
  34862. global.clearTimeout(fetchTimer);
  34863. if (!self._destroyed) self.emit('error', err);
  34864. });
  34865. };
  34866. self._fetchResponse = response;
  34867. self.url = response.url;
  34868. self.statusCode = response.status;
  34869. self.statusMessage = response.statusText;
  34870. response.headers.forEach(function (header, key) {
  34871. self.headers[key.toLowerCase()] = header;
  34872. self.rawHeaders.push(key, header);
  34873. });
  34874. if (capability.writableStream) {
  34875. var writable = new WritableStream({
  34876. write: function write(chunk) {
  34877. return new Promise(function (resolve, reject) {
  34878. if (self._destroyed) {
  34879. reject();
  34880. } else if (self.push(new Buffer(chunk))) {
  34881. resolve();
  34882. } else {
  34883. self._resumeFetch = resolve;
  34884. }
  34885. });
  34886. },
  34887. close: function close() {
  34888. global.clearTimeout(fetchTimer);
  34889. if (!self._destroyed) self.push(null);
  34890. },
  34891. abort: function abort(err) {
  34892. if (!self._destroyed) self.emit('error', err);
  34893. }
  34894. });
  34895. try {
  34896. response.body.pipeTo(writable).catch(function (err) {
  34897. global.clearTimeout(fetchTimer);
  34898. if (!self._destroyed) self.emit('error', err);
  34899. });
  34900. return;
  34901. } catch (e) {} // pipeTo method isn't defined. Can't find a better way to feature test this
  34902. } // fallback for when writableStream or pipeTo aren't available
  34903. var reader = response.body.getReader();
  34904. read();
  34905. } else {
  34906. self._xhr = xhr;
  34907. self._pos = 0;
  34908. self.url = xhr.responseURL;
  34909. self.statusCode = xhr.status;
  34910. self.statusMessage = xhr.statusText;
  34911. var headers = xhr.getAllResponseHeaders().split(/\r?\n/);
  34912. headers.forEach(function (header) {
  34913. var matches = header.match(/^([^:]+):\s*(.*)/);
  34914. if (matches) {
  34915. var key = matches[1].toLowerCase();
  34916. if (key === 'set-cookie') {
  34917. if (self.headers[key] === undefined) {
  34918. self.headers[key] = [];
  34919. }
  34920. self.headers[key].push(matches[2]);
  34921. } else if (self.headers[key] !== undefined) {
  34922. self.headers[key] += ', ' + matches[2];
  34923. } else {
  34924. self.headers[key] = matches[2];
  34925. }
  34926. self.rawHeaders.push(matches[1], matches[2]);
  34927. }
  34928. });
  34929. self._charset = 'x-user-defined';
  34930. if (!capability.overrideMimeType) {
  34931. var mimeType = self.rawHeaders['mime-type'];
  34932. if (mimeType) {
  34933. var charsetMatch = mimeType.match(/;\s*charset=([^;])(;|$)/);
  34934. if (charsetMatch) {
  34935. self._charset = charsetMatch[1].toLowerCase();
  34936. }
  34937. }
  34938. if (!self._charset) self._charset = 'utf-8'; // best guess
  34939. }
  34940. }
  34941. };
  34942. inherits(IncomingMessage, stream.Readable);
  34943. IncomingMessage.prototype._read = function () {
  34944. var self = this;
  34945. var resolve = self._resumeFetch;
  34946. if (resolve) {
  34947. self._resumeFetch = null;
  34948. resolve();
  34949. }
  34950. };
  34951. IncomingMessage.prototype._onXHRProgress = function () {
  34952. var self = this;
  34953. var xhr = self._xhr;
  34954. var response = null;
  34955. switch (self._mode) {
  34956. case 'text:vbarray':
  34957. // For IE9
  34958. if (xhr.readyState !== rStates.DONE) break;
  34959. try {
  34960. // This fails in IE8
  34961. response = new global.VBArray(xhr.responseBody).toArray();
  34962. } catch (e) {}
  34963. if (response !== null) {
  34964. self.push(new Buffer(response));
  34965. break;
  34966. }
  34967. // Falls through in IE8
  34968. case 'text':
  34969. try {
  34970. // This will fail when readyState = 3 in IE9. Switch mode and wait for readyState = 4
  34971. response = xhr.responseText;
  34972. } catch (e) {
  34973. self._mode = 'text:vbarray';
  34974. break;
  34975. }
  34976. if (response.length > self._pos) {
  34977. var newData = response.substr(self._pos);
  34978. if (self._charset === 'x-user-defined') {
  34979. var buffer = new Buffer(newData.length);
  34980. for (var i = 0; i < newData.length; i++) {
  34981. buffer[i] = newData.charCodeAt(i) & 0xff;
  34982. }
  34983. self.push(buffer);
  34984. } else {
  34985. self.push(newData, self._charset);
  34986. }
  34987. self._pos = response.length;
  34988. }
  34989. break;
  34990. case 'arraybuffer':
  34991. if (xhr.readyState !== rStates.DONE || !xhr.response) break;
  34992. response = xhr.response;
  34993. self.push(new Buffer(new Uint8Array(response)));
  34994. break;
  34995. case 'moz-chunked-arraybuffer':
  34996. // take whole
  34997. response = xhr.response;
  34998. if (xhr.readyState !== rStates.LOADING || !response) break;
  34999. self.push(new Buffer(new Uint8Array(response)));
  35000. break;
  35001. case 'ms-stream':
  35002. response = xhr.response;
  35003. if (xhr.readyState !== rStates.LOADING) break;
  35004. var reader = new global.MSStreamReader();
  35005. reader.onprogress = function () {
  35006. if (reader.result.byteLength > self._pos) {
  35007. self.push(new Buffer(new Uint8Array(reader.result.slice(self._pos))));
  35008. self._pos = reader.result.byteLength;
  35009. }
  35010. };
  35011. reader.onload = function () {
  35012. self.push(null);
  35013. }; // reader.onerror = ??? // TODO: this
  35014. reader.readAsArrayBuffer(response);
  35015. break;
  35016. } // The ms-stream case handles end separately in reader.onload()
  35017. if (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') {
  35018. self.push(null);
  35019. }
  35020. };
  35021. }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer)
  35022. },{"./capability":469,"_process":467,"buffer":90,"core-js/modules/es.array-buffer.slice.js":271,"core-js/modules/es.array.iterator.js":278,"core-js/modules/es.array.slice.js":281,"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.promise.js":295,"core-js/modules/es.regexp.exec.js":300,"core-js/modules/es.string.match.js":304,"core-js/modules/es.string.split.js":307,"core-js/modules/es.typed-array.copy-within.js":315,"core-js/modules/es.typed-array.every.js":316,"core-js/modules/es.typed-array.fill.js":317,"core-js/modules/es.typed-array.filter.js":318,"core-js/modules/es.typed-array.find-index.js":319,"core-js/modules/es.typed-array.find.js":320,"core-js/modules/es.typed-array.for-each.js":321,"core-js/modules/es.typed-array.includes.js":322,"core-js/modules/es.typed-array.index-of.js":323,"core-js/modules/es.typed-array.iterator.js":324,"core-js/modules/es.typed-array.join.js":325,"core-js/modules/es.typed-array.last-index-of.js":326,"core-js/modules/es.typed-array.map.js":327,"core-js/modules/es.typed-array.reduce-right.js":328,"core-js/modules/es.typed-array.reduce.js":329,"core-js/modules/es.typed-array.reverse.js":330,"core-js/modules/es.typed-array.set.js":331,"core-js/modules/es.typed-array.slice.js":332,"core-js/modules/es.typed-array.some.js":333,"core-js/modules/es.typed-array.sort.js":334,"core-js/modules/es.typed-array.subarray.js":335,"core-js/modules/es.typed-array.to-locale-string.js":336,"core-js/modules/es.typed-array.to-string.js":337,"core-js/modules/es.typed-array.uint8-array.js":338,"core-js/modules/web.dom-collections.for-each.js":339,"inherits":364,"readable-stream":394}],472:[function(require,module,exports){
  35023. // Copyright Joyent, Inc. and other Node contributors.
  35024. //
  35025. // Permission is hereby granted, free of charge, to any person obtaining a
  35026. // copy of this software and associated documentation files (the
  35027. // "Software"), to deal in the Software without restriction, including
  35028. // without limitation the rights to use, copy, modify, merge, publish,
  35029. // distribute, sublicense, and/or sell copies of the Software, and to permit
  35030. // persons to whom the Software is furnished to do so, subject to the
  35031. // following conditions:
  35032. //
  35033. // The above copyright notice and this permission notice shall be included
  35034. // in all copies or substantial portions of the Software.
  35035. //
  35036. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  35037. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  35038. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  35039. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  35040. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  35041. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  35042. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  35043. 'use strict';
  35044. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  35045. var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
  35046. require("core-js/modules/es.regexp.exec.js");
  35047. require("core-js/modules/es.string.search.js");
  35048. require("core-js/modules/es.array.concat.js");
  35049. require("core-js/modules/es.string.split.js");
  35050. require("core-js/modules/es.string.replace.js");
  35051. require("core-js/modules/es.array.join.js");
  35052. require("core-js/modules/es.string.trim.js");
  35053. require("core-js/modules/es.string.match.js");
  35054. require("core-js/modules/es.array.slice.js");
  35055. require("core-js/modules/es.object.keys.js");
  35056. require("core-js/modules/es.array.splice.js");
  35057. var punycode = require('punycode');
  35058. var util = require('./util');
  35059. exports.parse = urlParse;
  35060. exports.resolve = urlResolve;
  35061. exports.resolveObject = urlResolveObject;
  35062. exports.format = urlFormat;
  35063. exports.Url = Url;
  35064. function Url() {
  35065. this.protocol = null;
  35066. this.slashes = null;
  35067. this.auth = null;
  35068. this.host = null;
  35069. this.port = null;
  35070. this.hostname = null;
  35071. this.hash = null;
  35072. this.search = null;
  35073. this.query = null;
  35074. this.pathname = null;
  35075. this.path = null;
  35076. this.href = null;
  35077. } // Reference: RFC 3986, RFC 1808, RFC 2396
  35078. // define these here so at least they only have to be
  35079. // compiled once on the first module load.
  35080. var protocolPattern = /^([a-z0-9.+-]+:)/i,
  35081. portPattern = /:[0-9]*$/,
  35082. // Special case for a simple path URL
  35083. simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
  35084. // RFC 2396: characters reserved for delimiting URLs.
  35085. // We actually just auto-escape these.
  35086. delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
  35087. // RFC 2396: characters not allowed for various reasons.
  35088. unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
  35089. // Allowed by RFCs, but cause of XSS attacks. Always escape these.
  35090. autoEscape = ["'"].concat(unwise),
  35091. // Characters that are never ever allowed in a hostname.
  35092. // Note that any invalid chars are also handled, but these
  35093. // are the ones that are *expected* to be seen, so we fast-path
  35094. // them.
  35095. nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
  35096. hostEndingChars = ['/', '?', '#'],
  35097. hostnameMaxLen = 255,
  35098. hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
  35099. hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
  35100. // protocols that can allow "unsafe" and "unwise" chars.
  35101. unsafeProtocol = {
  35102. javascript: true,
  35103. 'javascript:': true
  35104. },
  35105. // protocols that never have a hostname.
  35106. hostlessProtocol = {
  35107. javascript: true,
  35108. 'javascript:': true
  35109. },
  35110. // protocols that always contain a // bit.
  35111. slashedProtocol = {
  35112. http: true,
  35113. https: true,
  35114. ftp: true,
  35115. gopher: true,
  35116. file: true,
  35117. 'http:': true,
  35118. 'https:': true,
  35119. 'ftp:': true,
  35120. 'gopher:': true,
  35121. 'file:': true
  35122. },
  35123. querystring = require('querystring');
  35124. function urlParse(url, parseQueryString, slashesDenoteHost) {
  35125. if (url && util.isObject(url) && url instanceof Url) return url;
  35126. var u = new Url();
  35127. u.parse(url, parseQueryString, slashesDenoteHost);
  35128. return u;
  35129. }
  35130. Url.prototype.parse = function (url, parseQueryString, slashesDenoteHost) {
  35131. if (!util.isString(url)) {
  35132. throw new TypeError("Parameter 'url' must be a string, not " + (0, _typeof2.default)(url));
  35133. } // Copy chrome, IE, opera backslash-handling behavior.
  35134. // Back slashes before the query string get converted to forward slashes
  35135. // See: https://code.google.com/p/chromium/issues/detail?id=25916
  35136. var queryIndex = url.indexOf('?'),
  35137. splitter = queryIndex !== -1 && queryIndex < url.indexOf('#') ? '?' : '#',
  35138. uSplit = url.split(splitter),
  35139. slashRegex = /\\/g;
  35140. uSplit[0] = uSplit[0].replace(slashRegex, '/');
  35141. url = uSplit.join(splitter);
  35142. var rest = url; // trim before proceeding.
  35143. // This is to support parse stuff like " http://foo.com \n"
  35144. rest = rest.trim();
  35145. if (!slashesDenoteHost && url.split('#').length === 1) {
  35146. // Try fast path regexp
  35147. var simplePath = simplePathPattern.exec(rest);
  35148. if (simplePath) {
  35149. this.path = rest;
  35150. this.href = rest;
  35151. this.pathname = simplePath[1];
  35152. if (simplePath[2]) {
  35153. this.search = simplePath[2];
  35154. if (parseQueryString) {
  35155. this.query = querystring.parse(this.search.substr(1));
  35156. } else {
  35157. this.query = this.search.substr(1);
  35158. }
  35159. } else if (parseQueryString) {
  35160. this.search = '';
  35161. this.query = {};
  35162. }
  35163. return this;
  35164. }
  35165. }
  35166. var proto = protocolPattern.exec(rest);
  35167. if (proto) {
  35168. proto = proto[0];
  35169. var lowerProto = proto.toLowerCase();
  35170. this.protocol = lowerProto;
  35171. rest = rest.substr(proto.length);
  35172. } // figure out if it's got a host
  35173. // user@server is *always* interpreted as a hostname, and url
  35174. // resolution will treat //foo/bar as host=foo,path=bar because that's
  35175. // how the browser resolves relative URLs.
  35176. if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
  35177. var slashes = rest.substr(0, 2) === '//';
  35178. if (slashes && !(proto && hostlessProtocol[proto])) {
  35179. rest = rest.substr(2);
  35180. this.slashes = true;
  35181. }
  35182. }
  35183. if (!hostlessProtocol[proto] && (slashes || proto && !slashedProtocol[proto])) {
  35184. // there's a hostname.
  35185. // the first instance of /, ?, ;, or # ends the host.
  35186. //
  35187. // If there is an @ in the hostname, then non-host chars *are* allowed
  35188. // to the left of the last @ sign, unless some host-ending character
  35189. // comes *before* the @-sign.
  35190. // URLs are obnoxious.
  35191. //
  35192. // ex:
  35193. // http://a@b@c/ => user:a@b host:c
  35194. // http://a@b?@c => user:a host:c path:/?@c
  35195. // v0.12 TODO(isaacs): This is not quite how Chrome does things.
  35196. // Review our test case against browsers more comprehensively.
  35197. // find the first instance of any hostEndingChars
  35198. var hostEnd = -1;
  35199. for (var i = 0; i < hostEndingChars.length; i++) {
  35200. var hec = rest.indexOf(hostEndingChars[i]);
  35201. if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;
  35202. } // at this point, either we have an explicit point where the
  35203. // auth portion cannot go past, or the last @ char is the decider.
  35204. var auth, atSign;
  35205. if (hostEnd === -1) {
  35206. // atSign can be anywhere.
  35207. atSign = rest.lastIndexOf('@');
  35208. } else {
  35209. // atSign must be in auth portion.
  35210. // http://a@b/c@d => host:b auth:a path:/c@d
  35211. atSign = rest.lastIndexOf('@', hostEnd);
  35212. } // Now we have a portion which is definitely the auth.
  35213. // Pull that off.
  35214. if (atSign !== -1) {
  35215. auth = rest.slice(0, atSign);
  35216. rest = rest.slice(atSign + 1);
  35217. this.auth = decodeURIComponent(auth);
  35218. } // the host is the remaining to the left of the first non-host char
  35219. hostEnd = -1;
  35220. for (var i = 0; i < nonHostChars.length; i++) {
  35221. var hec = rest.indexOf(nonHostChars[i]);
  35222. if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;
  35223. } // if we still have not hit it, then the entire thing is a host.
  35224. if (hostEnd === -1) hostEnd = rest.length;
  35225. this.host = rest.slice(0, hostEnd);
  35226. rest = rest.slice(hostEnd); // pull out port.
  35227. this.parseHost(); // we've indicated that there is a hostname,
  35228. // so even if it's empty, it has to be present.
  35229. this.hostname = this.hostname || ''; // if hostname begins with [ and ends with ]
  35230. // assume that it's an IPv6 address.
  35231. var ipv6Hostname = this.hostname[0] === '[' && this.hostname[this.hostname.length - 1] === ']'; // validate a little.
  35232. if (!ipv6Hostname) {
  35233. var hostparts = this.hostname.split('.');
  35234. for (var i = 0, l = hostparts.length; i < l; i++) {
  35235. var part = hostparts[i];
  35236. if (!part) continue;
  35237. if (!part.match(hostnamePartPattern)) {
  35238. var newpart = '';
  35239. for (var j = 0, k = part.length; j < k; j++) {
  35240. if (part.charCodeAt(j) > 127) {
  35241. // we replace non-ASCII char with a temporary placeholder
  35242. // we need this to make sure size of hostname is not
  35243. // broken by replacing non-ASCII by nothing
  35244. newpart += 'x';
  35245. } else {
  35246. newpart += part[j];
  35247. }
  35248. } // we test again with ASCII char only
  35249. if (!newpart.match(hostnamePartPattern)) {
  35250. var validParts = hostparts.slice(0, i);
  35251. var notHost = hostparts.slice(i + 1);
  35252. var bit = part.match(hostnamePartStart);
  35253. if (bit) {
  35254. validParts.push(bit[1]);
  35255. notHost.unshift(bit[2]);
  35256. }
  35257. if (notHost.length) {
  35258. rest = '/' + notHost.join('.') + rest;
  35259. }
  35260. this.hostname = validParts.join('.');
  35261. break;
  35262. }
  35263. }
  35264. }
  35265. }
  35266. if (this.hostname.length > hostnameMaxLen) {
  35267. this.hostname = '';
  35268. } else {
  35269. // hostnames are always lower case.
  35270. this.hostname = this.hostname.toLowerCase();
  35271. }
  35272. if (!ipv6Hostname) {
  35273. // IDNA Support: Returns a punycoded representation of "domain".
  35274. // It only converts parts of the domain name that
  35275. // have non-ASCII characters, i.e. it doesn't matter if
  35276. // you call it with a domain that already is ASCII-only.
  35277. this.hostname = punycode.toASCII(this.hostname);
  35278. }
  35279. var p = this.port ? ':' + this.port : '';
  35280. var h = this.hostname || '';
  35281. this.host = h + p;
  35282. this.href += this.host; // strip [ and ] from the hostname
  35283. // the host field still retains them, though
  35284. if (ipv6Hostname) {
  35285. this.hostname = this.hostname.substr(1, this.hostname.length - 2);
  35286. if (rest[0] !== '/') {
  35287. rest = '/' + rest;
  35288. }
  35289. }
  35290. } // now rest is set to the post-host stuff.
  35291. // chop off any delim chars.
  35292. if (!unsafeProtocol[lowerProto]) {
  35293. // First, make 100% sure that any "autoEscape" chars get
  35294. // escaped, even if encodeURIComponent doesn't think they
  35295. // need to be.
  35296. for (var i = 0, l = autoEscape.length; i < l; i++) {
  35297. var ae = autoEscape[i];
  35298. if (rest.indexOf(ae) === -1) continue;
  35299. var esc = encodeURIComponent(ae);
  35300. if (esc === ae) {
  35301. esc = escape(ae);
  35302. }
  35303. rest = rest.split(ae).join(esc);
  35304. }
  35305. } // chop off from the tail first.
  35306. var hash = rest.indexOf('#');
  35307. if (hash !== -1) {
  35308. // got a fragment string.
  35309. this.hash = rest.substr(hash);
  35310. rest = rest.slice(0, hash);
  35311. }
  35312. var qm = rest.indexOf('?');
  35313. if (qm !== -1) {
  35314. this.search = rest.substr(qm);
  35315. this.query = rest.substr(qm + 1);
  35316. if (parseQueryString) {
  35317. this.query = querystring.parse(this.query);
  35318. }
  35319. rest = rest.slice(0, qm);
  35320. } else if (parseQueryString) {
  35321. // no query string, but parseQueryString still requested
  35322. this.search = '';
  35323. this.query = {};
  35324. }
  35325. if (rest) this.pathname = rest;
  35326. if (slashedProtocol[lowerProto] && this.hostname && !this.pathname) {
  35327. this.pathname = '/';
  35328. } //to support http.request
  35329. if (this.pathname || this.search) {
  35330. var p = this.pathname || '';
  35331. var s = this.search || '';
  35332. this.path = p + s;
  35333. } // finally, reconstruct the href based on what has been validated.
  35334. this.href = this.format();
  35335. return this;
  35336. }; // format a parsed object into a url string
  35337. function urlFormat(obj) {
  35338. // ensure it's an object, and not a string url.
  35339. // If it's an obj, this is a no-op.
  35340. // this way, you can call url_format() on strings
  35341. // to clean up potentially wonky urls.
  35342. if (util.isString(obj)) obj = urlParse(obj);
  35343. if (!(obj instanceof Url)) return Url.prototype.format.call(obj);
  35344. return obj.format();
  35345. }
  35346. Url.prototype.format = function () {
  35347. var auth = this.auth || '';
  35348. if (auth) {
  35349. auth = encodeURIComponent(auth);
  35350. auth = auth.replace(/%3A/i, ':');
  35351. auth += '@';
  35352. }
  35353. var protocol = this.protocol || '',
  35354. pathname = this.pathname || '',
  35355. hash = this.hash || '',
  35356. host = false,
  35357. query = '';
  35358. if (this.host) {
  35359. host = auth + this.host;
  35360. } else if (this.hostname) {
  35361. host = auth + (this.hostname.indexOf(':') === -1 ? this.hostname : '[' + this.hostname + ']');
  35362. if (this.port) {
  35363. host += ':' + this.port;
  35364. }
  35365. }
  35366. if (this.query && util.isObject(this.query) && Object.keys(this.query).length) {
  35367. query = querystring.stringify(this.query);
  35368. }
  35369. var search = this.search || query && '?' + query || '';
  35370. if (protocol && protocol.substr(-1) !== ':') protocol += ':'; // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
  35371. // unless they had them to begin with.
  35372. if (this.slashes || (!protocol || slashedProtocol[protocol]) && host !== false) {
  35373. host = '//' + (host || '');
  35374. if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
  35375. } else if (!host) {
  35376. host = '';
  35377. }
  35378. if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
  35379. if (search && search.charAt(0) !== '?') search = '?' + search;
  35380. pathname = pathname.replace(/[?#]/g, function (match) {
  35381. return encodeURIComponent(match);
  35382. });
  35383. search = search.replace('#', '%23');
  35384. return protocol + host + pathname + search + hash;
  35385. };
  35386. function urlResolve(source, relative) {
  35387. return urlParse(source, false, true).resolve(relative);
  35388. }
  35389. Url.prototype.resolve = function (relative) {
  35390. return this.resolveObject(urlParse(relative, false, true)).format();
  35391. };
  35392. function urlResolveObject(source, relative) {
  35393. if (!source) return relative;
  35394. return urlParse(source, false, true).resolveObject(relative);
  35395. }
  35396. Url.prototype.resolveObject = function (relative) {
  35397. if (util.isString(relative)) {
  35398. var rel = new Url();
  35399. rel.parse(relative, false, true);
  35400. relative = rel;
  35401. }
  35402. var result = new Url();
  35403. var tkeys = Object.keys(this);
  35404. for (var tk = 0; tk < tkeys.length; tk++) {
  35405. var tkey = tkeys[tk];
  35406. result[tkey] = this[tkey];
  35407. } // hash is always overridden, no matter what.
  35408. // even href="" will remove it.
  35409. result.hash = relative.hash; // if the relative url is empty, then there's nothing left to do here.
  35410. if (relative.href === '') {
  35411. result.href = result.format();
  35412. return result;
  35413. } // hrefs like //foo/bar always cut to the protocol.
  35414. if (relative.slashes && !relative.protocol) {
  35415. // take everything except the protocol from relative
  35416. var rkeys = Object.keys(relative);
  35417. for (var rk = 0; rk < rkeys.length; rk++) {
  35418. var rkey = rkeys[rk];
  35419. if (rkey !== 'protocol') result[rkey] = relative[rkey];
  35420. } //urlParse appends trailing / to urls like http://www.example.com
  35421. if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) {
  35422. result.path = result.pathname = '/';
  35423. }
  35424. result.href = result.format();
  35425. return result;
  35426. }
  35427. if (relative.protocol && relative.protocol !== result.protocol) {
  35428. // if it's a known url protocol, then changing
  35429. // the protocol does weird things
  35430. // first, if it's not file:, then we MUST have a host,
  35431. // and if there was a path
  35432. // to begin with, then we MUST have a path.
  35433. // if it is file:, then the host is dropped,
  35434. // because that's known to be hostless.
  35435. // anything else is assumed to be absolute.
  35436. if (!slashedProtocol[relative.protocol]) {
  35437. var keys = Object.keys(relative);
  35438. for (var v = 0; v < keys.length; v++) {
  35439. var k = keys[v];
  35440. result[k] = relative[k];
  35441. }
  35442. result.href = result.format();
  35443. return result;
  35444. }
  35445. result.protocol = relative.protocol;
  35446. if (!relative.host && !hostlessProtocol[relative.protocol]) {
  35447. var relPath = (relative.pathname || '').split('/');
  35448. while (relPath.length && !(relative.host = relPath.shift())) {
  35449. ;
  35450. }
  35451. if (!relative.host) relative.host = '';
  35452. if (!relative.hostname) relative.hostname = '';
  35453. if (relPath[0] !== '') relPath.unshift('');
  35454. if (relPath.length < 2) relPath.unshift('');
  35455. result.pathname = relPath.join('/');
  35456. } else {
  35457. result.pathname = relative.pathname;
  35458. }
  35459. result.search = relative.search;
  35460. result.query = relative.query;
  35461. result.host = relative.host || '';
  35462. result.auth = relative.auth;
  35463. result.hostname = relative.hostname || relative.host;
  35464. result.port = relative.port; // to support http.request
  35465. if (result.pathname || result.search) {
  35466. var p = result.pathname || '';
  35467. var s = result.search || '';
  35468. result.path = p + s;
  35469. }
  35470. result.slashes = result.slashes || relative.slashes;
  35471. result.href = result.format();
  35472. return result;
  35473. }
  35474. var isSourceAbs = result.pathname && result.pathname.charAt(0) === '/',
  35475. isRelAbs = relative.host || relative.pathname && relative.pathname.charAt(0) === '/',
  35476. mustEndAbs = isRelAbs || isSourceAbs || result.host && relative.pathname,
  35477. removeAllDots = mustEndAbs,
  35478. srcPath = result.pathname && result.pathname.split('/') || [],
  35479. relPath = relative.pathname && relative.pathname.split('/') || [],
  35480. psychotic = result.protocol && !slashedProtocol[result.protocol]; // if the url is a non-slashed url, then relative
  35481. // links like ../.. should be able
  35482. // to crawl up to the hostname, as well. This is strange.
  35483. // result.protocol has already been set by now.
  35484. // Later on, put the first path part into the host field.
  35485. if (psychotic) {
  35486. result.hostname = '';
  35487. result.port = null;
  35488. if (result.host) {
  35489. if (srcPath[0] === '') srcPath[0] = result.host;else srcPath.unshift(result.host);
  35490. }
  35491. result.host = '';
  35492. if (relative.protocol) {
  35493. relative.hostname = null;
  35494. relative.port = null;
  35495. if (relative.host) {
  35496. if (relPath[0] === '') relPath[0] = relative.host;else relPath.unshift(relative.host);
  35497. }
  35498. relative.host = null;
  35499. }
  35500. mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
  35501. }
  35502. if (isRelAbs) {
  35503. // it's absolute.
  35504. result.host = relative.host || relative.host === '' ? relative.host : result.host;
  35505. result.hostname = relative.hostname || relative.hostname === '' ? relative.hostname : result.hostname;
  35506. result.search = relative.search;
  35507. result.query = relative.query;
  35508. srcPath = relPath; // fall through to the dot-handling below.
  35509. } else if (relPath.length) {
  35510. // it's relative
  35511. // throw away the existing file, and take the new path instead.
  35512. if (!srcPath) srcPath = [];
  35513. srcPath.pop();
  35514. srcPath = srcPath.concat(relPath);
  35515. result.search = relative.search;
  35516. result.query = relative.query;
  35517. } else if (!util.isNullOrUndefined(relative.search)) {
  35518. // just pull out the search.
  35519. // like href='?foo'.
  35520. // Put this after the other two cases because it simplifies the booleans
  35521. if (psychotic) {
  35522. result.hostname = result.host = srcPath.shift(); //occationaly the auth can get stuck only in host
  35523. //this especially happens in cases like
  35524. //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
  35525. var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;
  35526. if (authInHost) {
  35527. result.auth = authInHost.shift();
  35528. result.host = result.hostname = authInHost.shift();
  35529. }
  35530. }
  35531. result.search = relative.search;
  35532. result.query = relative.query; //to support http.request
  35533. if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
  35534. result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');
  35535. }
  35536. result.href = result.format();
  35537. return result;
  35538. }
  35539. if (!srcPath.length) {
  35540. // no path at all. easy.
  35541. // we've already handled the other stuff above.
  35542. result.pathname = null; //to support http.request
  35543. if (result.search) {
  35544. result.path = '/' + result.search;
  35545. } else {
  35546. result.path = null;
  35547. }
  35548. result.href = result.format();
  35549. return result;
  35550. } // if a url ENDs in . or .., then it must get a trailing slash.
  35551. // however, if it ends in anything else non-slashy,
  35552. // then it must NOT get a trailing slash.
  35553. var last = srcPath.slice(-1)[0];
  35554. var hasTrailingSlash = (result.host || relative.host || srcPath.length > 1) && (last === '.' || last === '..') || last === ''; // strip single dots, resolve double dots to parent dir
  35555. // if the path tries to go above the root, `up` ends up > 0
  35556. var up = 0;
  35557. for (var i = srcPath.length; i >= 0; i--) {
  35558. last = srcPath[i];
  35559. if (last === '.') {
  35560. srcPath.splice(i, 1);
  35561. } else if (last === '..') {
  35562. srcPath.splice(i, 1);
  35563. up++;
  35564. } else if (up) {
  35565. srcPath.splice(i, 1);
  35566. up--;
  35567. }
  35568. } // if the path is allowed to go above the root, restore leading ..s
  35569. if (!mustEndAbs && !removeAllDots) {
  35570. for (; up--; up) {
  35571. srcPath.unshift('..');
  35572. }
  35573. }
  35574. if (mustEndAbs && srcPath[0] !== '' && (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
  35575. srcPath.unshift('');
  35576. }
  35577. if (hasTrailingSlash && srcPath.join('/').substr(-1) !== '/') {
  35578. srcPath.push('');
  35579. }
  35580. var isAbsolute = srcPath[0] === '' || srcPath[0] && srcPath[0].charAt(0) === '/'; // put the host back
  35581. if (psychotic) {
  35582. result.hostname = result.host = isAbsolute ? '' : srcPath.length ? srcPath.shift() : ''; //occationaly the auth can get stuck only in host
  35583. //this especially happens in cases like
  35584. //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
  35585. var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;
  35586. if (authInHost) {
  35587. result.auth = authInHost.shift();
  35588. result.host = result.hostname = authInHost.shift();
  35589. }
  35590. }
  35591. mustEndAbs = mustEndAbs || result.host && srcPath.length;
  35592. if (mustEndAbs && !isAbsolute) {
  35593. srcPath.unshift('');
  35594. }
  35595. if (!srcPath.length) {
  35596. result.pathname = null;
  35597. result.path = null;
  35598. } else {
  35599. result.pathname = srcPath.join('/');
  35600. } //to support request.http
  35601. if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
  35602. result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');
  35603. }
  35604. result.auth = relative.auth || result.auth;
  35605. result.slashes = result.slashes || relative.slashes;
  35606. result.href = result.format();
  35607. return result;
  35608. };
  35609. Url.prototype.parseHost = function () {
  35610. var host = this.host;
  35611. var port = portPattern.exec(host);
  35612. if (port) {
  35613. port = port[0];
  35614. if (port !== ':') {
  35615. this.port = port.substr(1);
  35616. }
  35617. host = host.substr(0, host.length - port.length);
  35618. }
  35619. if (host) this.hostname = host;
  35620. };
  35621. },{"./util":473,"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/helpers/typeof":79,"core-js/modules/es.array.concat.js":272,"core-js/modules/es.array.join.js":279,"core-js/modules/es.array.slice.js":281,"core-js/modules/es.array.splice.js":283,"core-js/modules/es.object.keys.js":290,"core-js/modules/es.regexp.exec.js":300,"core-js/modules/es.string.match.js":304,"core-js/modules/es.string.replace.js":305,"core-js/modules/es.string.search.js":306,"core-js/modules/es.string.split.js":307,"core-js/modules/es.string.trim.js":308,"punycode":382,"querystring":385}],473:[function(require,module,exports){
  35622. 'use strict';
  35623. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  35624. var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
  35625. module.exports = {
  35626. isString: function isString(arg) {
  35627. return typeof arg === 'string';
  35628. },
  35629. isObject: function isObject(arg) {
  35630. return (0, _typeof2.default)(arg) === 'object' && arg !== null;
  35631. },
  35632. isNull: function isNull(arg) {
  35633. return arg === null;
  35634. },
  35635. isNullOrUndefined: function isNullOrUndefined(arg) {
  35636. return arg == null;
  35637. }
  35638. };
  35639. },{"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/helpers/typeof":79}],474:[function(require,module,exports){
  35640. "use strict";
  35641. require("core-js/modules/es.number.constructor.js");
  35642. // copy from https://github.com/node-modules/utility for browser
  35643. exports.encodeURIComponent = function (text) {
  35644. try {
  35645. return encodeURIComponent(text);
  35646. } catch (e) {
  35647. return text;
  35648. }
  35649. };
  35650. exports.escape = require('escape-html');
  35651. exports.timestamp = function timestamp(t) {
  35652. if (t) {
  35653. var v = t;
  35654. if (typeof v === 'string') {
  35655. v = Number(v);
  35656. }
  35657. if (String(t).length === 10) {
  35658. v *= 1000;
  35659. }
  35660. return new Date(v);
  35661. }
  35662. return Math.round(Date.now() / 1000);
  35663. };
  35664. },{"core-js/modules/es.number.constructor.js":286,"escape-html":343}],475:[function(require,module,exports){
  35665. (function (process,Buffer){(function (){
  35666. 'use strict';
  35667. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  35668. var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
  35669. require("core-js/modules/es.string.trim.js");
  35670. require("core-js/modules/es.regexp.exec.js");
  35671. require("core-js/modules/es.string.split.js");
  35672. require("core-js/modules/es.object.to-string.js");
  35673. require("core-js/modules/es.promise.js");
  35674. require("core-js/modules/es.function.name.js");
  35675. require("core-js/modules/es.array.concat.js");
  35676. var util = require('util');
  35677. var urlutil = require('url');
  35678. var http = require('http');
  35679. var https = require('https');
  35680. var debug = require('debug')('urllib');
  35681. var ms = require('humanize-ms');
  35682. var REQUEST_ID = 0;
  35683. var MAX_VALUE = Math.pow(2, 31) - 10;
  35684. var PROTO_RE = /^https?:\/\//i;
  35685. function getAgent(agent, defaultAgent) {
  35686. return agent === undefined ? defaultAgent : agent;
  35687. }
  35688. function parseContentType(str) {
  35689. if (!str) {
  35690. return '';
  35691. }
  35692. return str.split(';')[0].trim().toLowerCase();
  35693. }
  35694. function makeCallback(resolve, reject) {
  35695. return function (err, data, res) {
  35696. if (err) {
  35697. return reject(err);
  35698. }
  35699. resolve({
  35700. data: data,
  35701. status: res.statusCode,
  35702. headers: res.headers,
  35703. res: res
  35704. });
  35705. };
  35706. } // exports.TIMEOUT = ms('5s');
  35707. exports.TIMEOUTS = [ms('300s'), ms('300s')];
  35708. var TEXT_DATA_TYPES = ['json', 'text'];
  35709. exports.request = function request(url, args, callback) {
  35710. // request(url, callback)
  35711. if (arguments.length === 2 && typeof args === 'function') {
  35712. callback = args;
  35713. args = null;
  35714. }
  35715. if (typeof callback === 'function') {
  35716. return exports.requestWithCallback(url, args, callback);
  35717. }
  35718. return new Promise(function (resolve, reject) {
  35719. exports.requestWithCallback(url, args, makeCallback(resolve, reject));
  35720. });
  35721. };
  35722. exports.requestWithCallback = function requestWithCallback(url, args, callback) {
  35723. if (!url || typeof url !== 'string' && (0, _typeof2.default)(url) !== 'object') {
  35724. var msg = util.format('expect request url to be a string or a http request options, but got' + ' %j', url);
  35725. throw new Error(msg);
  35726. }
  35727. if (arguments.length === 2 && typeof args === 'function') {
  35728. callback = args;
  35729. args = null;
  35730. }
  35731. args = args || {};
  35732. if (REQUEST_ID >= MAX_VALUE) {
  35733. REQUEST_ID = 0;
  35734. }
  35735. var reqId = ++REQUEST_ID;
  35736. args.requestUrls = args.requestUrls || [];
  35737. var reqMeta = {
  35738. requestId: reqId,
  35739. url: url,
  35740. args: args,
  35741. ctx: args.ctx
  35742. };
  35743. if (args.emitter) {
  35744. args.emitter.emit('request', reqMeta);
  35745. }
  35746. args.timeout = args.timeout || exports.TIMEOUTS;
  35747. args.maxRedirects = args.maxRedirects || 10;
  35748. args.streaming = args.streaming || args.customResponse;
  35749. var requestStartTime = Date.now();
  35750. var parsedUrl;
  35751. if (typeof url === 'string') {
  35752. if (!PROTO_RE.test(url)) {
  35753. // Support `request('www.server.com')`
  35754. url = 'https://' + url;
  35755. }
  35756. parsedUrl = urlutil.parse(url);
  35757. } else {
  35758. parsedUrl = url;
  35759. }
  35760. var method = (args.type || args.method || parsedUrl.method || 'GET').toUpperCase();
  35761. var port = parsedUrl.port || 80;
  35762. var httplib = http;
  35763. var agent = getAgent(args.agent, exports.agent);
  35764. var fixJSONCtlChars = args.fixJSONCtlChars;
  35765. if (parsedUrl.protocol === 'https:') {
  35766. httplib = https;
  35767. agent = getAgent(args.httpsAgent, exports.httpsAgent);
  35768. if (!parsedUrl.port) {
  35769. port = 443;
  35770. }
  35771. } // request through proxy tunnel
  35772. // var proxyTunnelAgent = detectProxyAgent(parsedUrl, args);
  35773. // if (proxyTunnelAgent) {
  35774. // agent = proxyTunnelAgent;
  35775. // }
  35776. var options = {
  35777. host: parsedUrl.hostname || parsedUrl.host || 'localhost',
  35778. path: parsedUrl.path || '/',
  35779. method: method,
  35780. port: port,
  35781. agent: agent,
  35782. headers: args.headers || {},
  35783. // default is dns.lookup
  35784. // https://github.com/nodejs/node/blob/master/lib/net.js#L986
  35785. // custom dnslookup require node >= 4.0.0
  35786. // https://github.com/nodejs/node/blob/archived-io.js-v0.12/lib/net.js#L952
  35787. lookup: args.lookup
  35788. };
  35789. if (Array.isArray(args.timeout)) {
  35790. options.requestTimeout = args.timeout[args.timeout.length - 1];
  35791. } else if (typeof args.timeout !== 'undefined') {
  35792. options.requestTimeout = args.timeout;
  35793. } // const sslNames = [
  35794. // 'pfx',
  35795. // 'key',
  35796. // 'passphrase',
  35797. // 'cert',
  35798. // 'ca',
  35799. // 'ciphers',
  35800. // 'rejectUnauthorized',
  35801. // 'secureProtocol',
  35802. // 'secureOptions',
  35803. // ];
  35804. // for (let i = 0; i < sslNames.length; i++) {
  35805. // const name = sslNames[i];
  35806. // if (args.hasOwnProperty(name)) {
  35807. // options[name] = args[name];
  35808. // }
  35809. // }
  35810. // don't check ssl
  35811. // if (options.rejectUnauthorized === false && !options.hasOwnProperty('secureOptions')) {
  35812. // options.secureOptions = require('constants').SSL_OP_NO_TLSv1_2;
  35813. // }
  35814. var auth = args.auth || parsedUrl.auth;
  35815. if (auth) {
  35816. options.auth = auth;
  35817. } // content undefined data 有值
  35818. var body = args.content || args.data;
  35819. var dataAsQueryString = method === 'GET' || method === 'HEAD' || args.dataAsQueryString;
  35820. if (!args.content) {
  35821. if (body && !(typeof body === 'string' || Buffer.isBuffer(body))) {
  35822. if (dataAsQueryString) {
  35823. // read: GET, HEAD, use query string
  35824. body = args.nestedQuerystring ? qs.stringify(body) : querystring.stringify(body);
  35825. } else {
  35826. var contentType = options.headers['Content-Type'] || options.headers['content-type']; // auto add application/x-www-form-urlencoded when using urlencode form request
  35827. if (!contentType) {
  35828. if (args.contentType === 'json') {
  35829. contentType = 'application/json';
  35830. } else {
  35831. contentType = 'application/x-www-form-urlencoded';
  35832. }
  35833. options.headers['Content-Type'] = contentType;
  35834. }
  35835. if (parseContentType(contentType) === 'application/json') {
  35836. body = JSON.stringify(body);
  35837. } else {
  35838. // 'application/x-www-form-urlencoded'
  35839. body = args.nestedQuerystring ? qs.stringify(body) : querystring.stringify(body);
  35840. }
  35841. }
  35842. }
  35843. } // if it's a GET or HEAD request, data should be sent as query string
  35844. if (dataAsQueryString && body) {
  35845. options.path += (parsedUrl.query ? '&' : '?') + body;
  35846. body = null;
  35847. }
  35848. var requestSize = 0;
  35849. if (body) {
  35850. var length = body.length;
  35851. if (!Buffer.isBuffer(body)) {
  35852. length = Buffer.byteLength(body);
  35853. }
  35854. requestSize = options.headers['Content-Length'] = length;
  35855. }
  35856. if (args.dataType === 'json') {
  35857. options.headers.Accept = 'application/json';
  35858. }
  35859. if (typeof args.beforeRequest === 'function') {
  35860. // you can use this hook to change every thing.
  35861. args.beforeRequest(options);
  35862. }
  35863. var connectTimer = null;
  35864. var responseTimer = null;
  35865. var __err = null;
  35866. var connected = false; // socket connected or not
  35867. var keepAliveSocket = false; // request with keepalive socket
  35868. var responseSize = 0;
  35869. var statusCode = -1;
  35870. var responseAborted = false;
  35871. var remoteAddress = '';
  35872. var remotePort = '';
  35873. var timing = null;
  35874. if (args.timing) {
  35875. timing = {
  35876. // socket assigned
  35877. queuing: 0,
  35878. // dns lookup time
  35879. dnslookup: 0,
  35880. // socket connected
  35881. connected: 0,
  35882. // request sent
  35883. requestSent: 0,
  35884. // Time to first byte (TTFB)
  35885. waiting: 0,
  35886. contentDownload: 0
  35887. };
  35888. }
  35889. function cancelConnectTimer() {
  35890. if (connectTimer) {
  35891. clearTimeout(connectTimer);
  35892. connectTimer = null;
  35893. }
  35894. }
  35895. function cancelResponseTimer() {
  35896. if (responseTimer) {
  35897. clearTimeout(responseTimer);
  35898. responseTimer = null;
  35899. }
  35900. }
  35901. function done(err, data, res) {
  35902. cancelResponseTimer();
  35903. if (!callback) {
  35904. console.warn('[urllib:warn] [%s] [%s] [worker:%s] %s %s callback twice!!!', Date(), reqId, process.pid, options.method, url); // https://github.com/node-modules/urllib/pull/30
  35905. if (err) {
  35906. console.warn('[urllib:warn] [%s] [%s] [worker:%s] %s: %s\nstack: %s', Date(), reqId, process.pid, err.name, err.message, err.stack);
  35907. }
  35908. return;
  35909. }
  35910. var cb = callback;
  35911. callback = null;
  35912. var headers = {};
  35913. if (res) {
  35914. statusCode = res.statusCode;
  35915. headers = res.headers;
  35916. } // handle digest auth
  35917. // if (statusCode === 401 && headers['www-authenticate']
  35918. // && (!args.headers || !args.headers.Authorization) && args.digestAuth) {
  35919. // const authenticate = headers['www-authenticate'];
  35920. // if (authenticate.indexOf('Digest ') >= 0) {
  35921. // debug('Request#%d %s: got digest auth header WWW-Authenticate: %s', reqId, url, authenticate);
  35922. // args.headers = args.headers || {};
  35923. // args.headers.Authorization = digestAuthHeader(options.method, options.path, authenticate, args.digestAuth);
  35924. // debug('Request#%d %s: auth with digest header: %s', reqId, url, args.headers.Authorization);
  35925. // if (res.headers['set-cookie']) {
  35926. // args.headers.Cookie = res.headers['set-cookie'].join(';');
  35927. // }
  35928. // return exports.requestWithCallback(url, args, cb);
  35929. // }
  35930. // }
  35931. var requestUseTime = Date.now() - requestStartTime;
  35932. if (timing) {
  35933. timing.contentDownload = requestUseTime;
  35934. }
  35935. debug('[%sms] done, %s bytes HTTP %s %s %s %s, keepAliveSocket: %s, timing: %j', requestUseTime, responseSize, statusCode, options.method, options.host, options.path, keepAliveSocket, timing);
  35936. var response = {
  35937. status: statusCode,
  35938. statusCode: statusCode,
  35939. headers: headers,
  35940. size: responseSize,
  35941. aborted: responseAborted,
  35942. rt: requestUseTime,
  35943. keepAliveSocket: keepAliveSocket,
  35944. data: data,
  35945. requestUrls: args.requestUrls,
  35946. timing: timing,
  35947. remoteAddress: remoteAddress,
  35948. remotePort: remotePort
  35949. };
  35950. if (err) {
  35951. var agentStatus = '';
  35952. if (agent && typeof agent.getCurrentStatus === 'function') {
  35953. // add current agent status to error message for logging and debug
  35954. agentStatus = ', agent status: ' + JSON.stringify(agent.getCurrentStatus());
  35955. }
  35956. err.message += ', ' + options.method + ' ' + url + ' ' + statusCode + ' (connected: ' + connected + ', keepalive socket: ' + keepAliveSocket + agentStatus + ')' + '\nheaders: ' + JSON.stringify(headers);
  35957. err.data = data;
  35958. err.path = options.path;
  35959. err.status = statusCode;
  35960. err.headers = headers;
  35961. err.res = response;
  35962. }
  35963. cb(err, data, args.streaming ? res : response);
  35964. if (args.emitter) {
  35965. // keep to use the same reqMeta object on request event before
  35966. reqMeta.url = url;
  35967. reqMeta.socket = req && req.connection;
  35968. reqMeta.options = options;
  35969. reqMeta.size = requestSize;
  35970. args.emitter.emit('response', {
  35971. requestId: reqId,
  35972. error: err,
  35973. ctx: args.ctx,
  35974. req: reqMeta,
  35975. res: response
  35976. });
  35977. }
  35978. }
  35979. function handleRedirect(res) {
  35980. var err = null;
  35981. if (args.followRedirect && statuses.redirect[res.statusCode]) {
  35982. // handle redirect
  35983. args._followRedirectCount = (args._followRedirectCount || 0) + 1;
  35984. var location = res.headers.location;
  35985. if (!location) {
  35986. err = new Error('Got statusCode ' + res.statusCode + ' but cannot resolve next location from headers');
  35987. err.name = 'FollowRedirectError';
  35988. } else if (args._followRedirectCount > args.maxRedirects) {
  35989. err = new Error('Exceeded maxRedirects. Probably stuck in a redirect loop ' + url);
  35990. err.name = 'MaxRedirectError';
  35991. } else {
  35992. var newUrl = args.formatRedirectUrl ? args.formatRedirectUrl(url, location) : urlutil.resolve(url, location);
  35993. debug('Request#%d %s: `redirected` from %s to %s', reqId, options.path, url, newUrl); // make sure timer stop
  35994. cancelResponseTimer(); // should clean up headers.Host on `location: http://other-domain/url`
  35995. if (args.headers && args.headers.Host && PROTO_RE.test(location)) {
  35996. args.headers.Host = null;
  35997. } // avoid done will be execute in the future change.
  35998. var cb = callback;
  35999. callback = null;
  36000. exports.requestWithCallback(newUrl, args, cb);
  36001. return {
  36002. redirect: true,
  36003. error: null
  36004. };
  36005. }
  36006. }
  36007. return {
  36008. redirect: false,
  36009. error: err
  36010. };
  36011. }
  36012. if (args.gzip) {
  36013. if (!options.headers['Accept-Encoding'] && !options.headers['accept-encoding']) {
  36014. options.headers['Accept-Encoding'] = 'gzip';
  36015. }
  36016. }
  36017. function decodeContent(res, body, cb) {
  36018. var encoding = res.headers['content-encoding']; // if (body.length === 0) {
  36019. // return cb(null, body, encoding);
  36020. // }
  36021. // if (!encoding || encoding.toLowerCase() !== 'gzip') {
  36022. return cb(null, body, encoding); // }
  36023. // debug('gunzip %d length body', body.length);
  36024. // zlib.gunzip(body, cb);
  36025. }
  36026. var writeStream = args.writeStream;
  36027. debug('Request#%d %s %s with headers %j, options.path: %s', reqId, method, url, options.headers, options.path);
  36028. args.requestUrls.push(url);
  36029. function onResponse(res) {
  36030. if (timing) {
  36031. timing.waiting = Date.now() - requestStartTime;
  36032. }
  36033. debug('Request#%d %s `req response` event emit: status %d, headers: %j', reqId, url, res.statusCode, res.headers);
  36034. if (args.streaming) {
  36035. var result = handleRedirect(res);
  36036. if (result.redirect) {
  36037. res.resume();
  36038. return;
  36039. }
  36040. if (result.error) {
  36041. res.resume();
  36042. return done(result.error, null, res);
  36043. }
  36044. return done(null, null, res);
  36045. }
  36046. res.on('close', function () {
  36047. debug('Request#%d %s: `res close` event emit, total size %d', reqId, url, responseSize);
  36048. });
  36049. res.on('error', function () {
  36050. debug('Request#%d %s: `res error` event emit, total size %d', reqId, url, responseSize);
  36051. });
  36052. res.on('aborted', function () {
  36053. responseAborted = true;
  36054. debug('Request#%d %s: `res aborted` event emit, total size %d', reqId, url, responseSize);
  36055. });
  36056. if (writeStream) {
  36057. // If there's a writable stream to recieve the response data, just pipe the
  36058. // response stream to that writable stream and call the callback when it has
  36059. // finished writing.
  36060. //
  36061. // NOTE that when the response stream `res` emits an 'end' event it just
  36062. // means that it has finished piping data to another stream. In the
  36063. // meanwhile that writable stream may still writing data to the disk until
  36064. // it emits a 'close' event.
  36065. //
  36066. // That means that we should not apply callback until the 'close' of the
  36067. // writable stream is emited.
  36068. //
  36069. // See also:
  36070. // - https://github.com/TBEDP/urllib/commit/959ac3365821e0e028c231a5e8efca6af410eabb
  36071. // - http://nodejs.org/api/stream.html#stream_event_end
  36072. // - http://nodejs.org/api/stream.html#stream_event_close_1
  36073. var _result = handleRedirect(res);
  36074. if (_result.redirect) {
  36075. res.resume();
  36076. return;
  36077. }
  36078. if (_result.error) {
  36079. res.resume(); // end ths stream first
  36080. writeStream.end();
  36081. return done(_result.error, null, res);
  36082. } // you can set consumeWriteStream false that only wait response end
  36083. if (args.consumeWriteStream === false) {
  36084. res.on('end', done.bind(null, null, null, res));
  36085. } else {
  36086. // node 0.10, 0.12: only emit res aborted, writeStream close not fired
  36087. // if (isNode010 || isNode012) {
  36088. // first([
  36089. // [ writeStream, 'close' ],
  36090. // [ res, 'aborted' ],
  36091. // ], function(_, stream, event) {
  36092. // debug('Request#%d %s: writeStream or res %s event emitted', reqId, url, event);
  36093. // done(__err || null, null, res);
  36094. // });
  36095. if (false) {} else {
  36096. writeStream.on('close', function () {
  36097. debug('Request#%d %s: writeStream close event emitted', reqId, url);
  36098. done(__err || null, null, res);
  36099. });
  36100. }
  36101. }
  36102. return res.pipe(writeStream);
  36103. } // Otherwise, just concat those buffers.
  36104. //
  36105. // NOTE that the `chunk` is not a String but a Buffer. It means that if
  36106. // you simply concat two chunk with `+` you're actually converting both
  36107. // Buffers into Strings before concating them. It'll cause problems when
  36108. // dealing with multi-byte characters.
  36109. //
  36110. // The solution is to store each chunk in an array and concat them with
  36111. // 'buffer-concat' when all chunks is recieved.
  36112. //
  36113. // See also:
  36114. // http://cnodejs.org/topic/4faf65852e8fb5bc65113403
  36115. var chunks = [];
  36116. res.on('data', function (chunk) {
  36117. debug('Request#%d %s: `res data` event emit, size %d', reqId, url, chunk.length);
  36118. responseSize += chunk.length;
  36119. chunks.push(chunk);
  36120. });
  36121. res.on('end', function () {
  36122. var body = Buffer.concat(chunks, responseSize);
  36123. debug('Request#%d %s: `res end` event emit, total size %d, _dumped: %s', reqId, url, responseSize, res._dumped);
  36124. if (__err) {
  36125. // req.abort() after `res data` event emit.
  36126. return done(__err, body, res);
  36127. }
  36128. var result = handleRedirect(res);
  36129. if (result.error) {
  36130. return done(result.error, body, res);
  36131. }
  36132. if (result.redirect) {
  36133. return;
  36134. }
  36135. decodeContent(res, body, function (err, data, encoding) {
  36136. if (err) {
  36137. return done(err, body, res);
  36138. } // if body not decode, dont touch it
  36139. if (!encoding && TEXT_DATA_TYPES.indexOf(args.dataType) >= 0) {
  36140. // try to decode charset
  36141. try {
  36142. data = decodeBodyByCharset(data, res);
  36143. } catch (e) {
  36144. debug('decodeBodyByCharset error: %s', e); // if error, dont touch it
  36145. return done(null, data, res);
  36146. }
  36147. if (args.dataType === 'json') {
  36148. if (responseSize === 0) {
  36149. data = null;
  36150. } else {
  36151. var r = parseJSON(data, fixJSONCtlChars);
  36152. if (r.error) {
  36153. err = r.error;
  36154. } else {
  36155. data = r.data;
  36156. }
  36157. }
  36158. }
  36159. }
  36160. if (responseAborted) {
  36161. // err = new Error('Remote socket was terminated before `response.end()` was called');
  36162. // err.name = 'RemoteSocketClosedError';
  36163. debug('Request#%d %s: Remote socket was terminated before `response.end()` was called', reqId, url);
  36164. }
  36165. done(err, data, res);
  36166. });
  36167. });
  36168. }
  36169. var connectTimeout, responseTimeout;
  36170. if (Array.isArray(args.timeout)) {
  36171. connectTimeout = ms(args.timeout[0]);
  36172. responseTimeout = ms(args.timeout[1]);
  36173. } else {
  36174. // set both timeout equal
  36175. connectTimeout = responseTimeout = ms(args.timeout);
  36176. }
  36177. debug('ConnectTimeout: %d, ResponseTimeout: %d', connectTimeout, responseTimeout);
  36178. function startConnectTimer() {
  36179. debug('Connect timer ticking, timeout: %d', connectTimeout);
  36180. connectTimer = setTimeout(function () {
  36181. connectTimer = null;
  36182. if (statusCode === -1) {
  36183. statusCode = -2;
  36184. }
  36185. var msg = 'Connect timeout for ' + connectTimeout + 'ms';
  36186. var errorName = 'ConnectionTimeoutError';
  36187. if (!req.socket) {
  36188. errorName = 'SocketAssignTimeoutError';
  36189. msg += ', working sockets is full';
  36190. }
  36191. __err = new Error(msg);
  36192. __err.name = errorName;
  36193. __err.requestId = reqId;
  36194. debug('ConnectTimeout: Request#%d %s %s: %s, connected: %s', reqId, url, __err.name, msg, connected);
  36195. abortRequest();
  36196. }, connectTimeout);
  36197. }
  36198. function startResposneTimer() {
  36199. debug('Response timer ticking, timeout: %d', responseTimeout);
  36200. responseTimer = setTimeout(function () {
  36201. responseTimer = null;
  36202. var msg = 'Response timeout for ' + responseTimeout + 'ms';
  36203. var errorName = 'ResponseTimeoutError';
  36204. __err = new Error(msg);
  36205. __err.name = errorName;
  36206. __err.requestId = reqId;
  36207. debug('ResponseTimeout: Request#%d %s %s: %s, connected: %s', reqId, url, __err.name, msg, connected);
  36208. abortRequest();
  36209. }, responseTimeout);
  36210. }
  36211. var req; // request headers checker will throw error
  36212. options.mode = args.mode ? args.mode : '';
  36213. try {
  36214. req = httplib.request(options, onResponse);
  36215. } catch (err) {
  36216. return done(err);
  36217. } // environment detection: browser or nodejs
  36218. if (typeof window === 'undefined') {
  36219. // start connect timer just after `request` return, and just in nodejs environment
  36220. startConnectTimer();
  36221. } else {
  36222. req.on('requestTimeout', function () {
  36223. if (statusCode === -1) {
  36224. statusCode = -2;
  36225. }
  36226. var msg = 'Connect timeout for ' + connectTimeout + 'ms';
  36227. var errorName = 'ConnectionTimeoutError';
  36228. __err = new Error(msg);
  36229. __err.name = errorName;
  36230. __err.requestId = reqId;
  36231. abortRequest();
  36232. });
  36233. }
  36234. function abortRequest() {
  36235. debug('Request#%d %s abort, connected: %s', reqId, url, connected); // it wont case error event when req haven't been assigned a socket yet.
  36236. if (!req.socket) {
  36237. __err.noSocket = true;
  36238. done(__err);
  36239. }
  36240. req.abort();
  36241. }
  36242. if (timing) {
  36243. // request sent
  36244. req.on('finish', function () {
  36245. timing.requestSent = Date.now() - requestStartTime;
  36246. });
  36247. }
  36248. req.once('socket', function (socket) {
  36249. if (timing) {
  36250. // socket queuing time
  36251. timing.queuing = Date.now() - requestStartTime;
  36252. } // https://github.com/nodejs/node/blob/master/lib/net.js#L377
  36253. // https://github.com/nodejs/node/blob/v0.10.40-release/lib/net.js#L352
  36254. // should use socket.socket on 0.10.x
  36255. // if (isNode010 && socket.socket) {
  36256. // socket = socket.socket;
  36257. // }
  36258. var readyState = socket.readyState;
  36259. if (readyState === 'opening') {
  36260. socket.once('lookup', function (err, ip, addressType) {
  36261. debug('Request#%d %s lookup: %s, %s, %s', reqId, url, err, ip, addressType);
  36262. if (timing) {
  36263. timing.dnslookup = Date.now() - requestStartTime;
  36264. }
  36265. if (ip) {
  36266. remoteAddress = ip;
  36267. }
  36268. });
  36269. socket.once('connect', function () {
  36270. if (timing) {
  36271. // socket connected
  36272. timing.connected = Date.now() - requestStartTime;
  36273. } // cancel socket timer at first and start tick for TTFB
  36274. cancelConnectTimer();
  36275. startResposneTimer();
  36276. debug('Request#%d %s new socket connected', reqId, url);
  36277. connected = true;
  36278. if (!remoteAddress) {
  36279. remoteAddress = socket.remoteAddress;
  36280. }
  36281. remotePort = socket.remotePort;
  36282. });
  36283. return;
  36284. }
  36285. debug('Request#%d %s reuse socket connected, readyState: %s', reqId, url, readyState);
  36286. connected = true;
  36287. keepAliveSocket = true;
  36288. if (!remoteAddress) {
  36289. remoteAddress = socket.remoteAddress;
  36290. }
  36291. remotePort = socket.remotePort; // reuse socket, timer should be canceled.
  36292. cancelConnectTimer();
  36293. startResposneTimer();
  36294. });
  36295. req.on('error', function (err) {
  36296. //TypeError for browser fetch api, Error for browser xmlhttprequest api
  36297. if (err.name === 'Error' || err.name === 'TypeError') {
  36298. err.name = connected ? 'ResponseError' : 'RequestError';
  36299. }
  36300. err.message += ' (req "error")';
  36301. debug('Request#%d %s `req error` event emit, %s: %s', reqId, url, err.name, err.message);
  36302. done(__err || err);
  36303. });
  36304. if (writeStream) {
  36305. writeStream.once('error', function (err) {
  36306. err.message += ' (writeStream "error")';
  36307. __err = err;
  36308. debug('Request#%d %s `writeStream error` event emit, %s: %s', reqId, url, err.name, err.message);
  36309. abortRequest();
  36310. });
  36311. }
  36312. if (args.stream) {
  36313. args.stream.pipe(req);
  36314. args.stream.once('error', function (err) {
  36315. err.message += ' (stream "error")';
  36316. __err = err;
  36317. debug('Request#%d %s `readStream error` event emit, %s: %s', reqId, url, err.name, err.message);
  36318. abortRequest();
  36319. });
  36320. } else {
  36321. req.end(body);
  36322. }
  36323. req.requestId = reqId;
  36324. return req;
  36325. };
  36326. }).call(this)}).call(this,require('_process'),require("buffer").Buffer)
  36327. },{"@babel/runtime/helpers/interopRequireDefault":78,"@babel/runtime/helpers/typeof":79,"_process":467,"buffer":90,"core-js/modules/es.array.concat.js":272,"core-js/modules/es.function.name.js":284,"core-js/modules/es.object.to-string.js":291,"core-js/modules/es.promise.js":295,"core-js/modules/es.regexp.exec.js":300,"core-js/modules/es.string.split.js":307,"core-js/modules/es.string.trim.js":308,"debug":465,"http":468,"https":355,"humanize-ms":356,"url":472,"util":419}]},{},[1])(1)
  36328. });
  36329. })(window)