| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319 |
- (function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (factory());
- }(this, (function () { 'use strict';
- function unwrapExports (x) {
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
- }
- function createCommonjsModule(fn, module) {
- return module = { exports: {} }, fn(module, module.exports), module.exports;
- }
- var _global = createCommonjsModule(function (module) {
- // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
- var global = module.exports = typeof window != 'undefined' && window.Math == Math
- ? window : typeof self != 'undefined' && self.Math == Math ? self
- // eslint-disable-next-line no-new-func
- : Function('return this')();
- if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
- });
- var _core = createCommonjsModule(function (module) {
- var core = module.exports = { version: '2.5.7' };
- if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
- });
- var _core_1 = _core.version;
- var _aFunction = function (it) {
- if (typeof it != 'function') throw TypeError(it + ' is not a function!');
- return it;
- };
- // optional / simple context binding
- var _ctx = function (fn, that, length) {
- _aFunction(fn);
- if (that === undefined) return fn;
- switch (length) {
- case 1: return function (a) {
- return fn.call(that, a);
- };
- case 2: return function (a, b) {
- return fn.call(that, a, b);
- };
- case 3: return function (a, b, c) {
- return fn.call(that, a, b, c);
- };
- }
- return function (/* ...args */) {
- return fn.apply(that, arguments);
- };
- };
- var _isObject = function (it) {
- return typeof it === 'object' ? it !== null : typeof it === 'function';
- };
- var _anObject = function (it) {
- if (!_isObject(it)) throw TypeError(it + ' is not an object!');
- return it;
- };
- var _fails = function (exec) {
- try {
- return !!exec();
- } catch (e) {
- return true;
- }
- };
- // Thank's IE8 for his funny defineProperty
- var _descriptors = !_fails(function () {
- return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
- });
- var document$1 = _global.document;
- // typeof document.createElement is 'object' in old IE
- var is = _isObject(document$1) && _isObject(document$1.createElement);
- var _domCreate = function (it) {
- return is ? document$1.createElement(it) : {};
- };
- var _ie8DomDefine = !_descriptors && !_fails(function () {
- return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;
- });
- // 7.1.1 ToPrimitive(input [, PreferredType])
- // instead of the ES6 spec version, we didn't implement @@toPrimitive case
- // and the second argument - flag - preferred type is a string
- var _toPrimitive = function (it, S) {
- if (!_isObject(it)) return it;
- var fn, val;
- if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
- if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val;
- if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
- throw TypeError("Can't convert object to primitive value");
- };
- var dP = Object.defineProperty;
- var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
- _anObject(O);
- P = _toPrimitive(P, true);
- _anObject(Attributes);
- if (_ie8DomDefine) try {
- return dP(O, P, Attributes);
- } catch (e) { /* empty */ }
- if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
- if ('value' in Attributes) O[P] = Attributes.value;
- return O;
- };
- var _objectDp = {
- f: f
- };
- var _propertyDesc = function (bitmap, value) {
- return {
- enumerable: !(bitmap & 1),
- configurable: !(bitmap & 2),
- writable: !(bitmap & 4),
- value: value
- };
- };
- var _hide = _descriptors ? function (object, key, value) {
- return _objectDp.f(object, key, _propertyDesc(1, value));
- } : function (object, key, value) {
- object[key] = value;
- return object;
- };
- var hasOwnProperty = {}.hasOwnProperty;
- var _has = function (it, key) {
- return hasOwnProperty.call(it, key);
- };
- var PROTOTYPE = 'prototype';
- var $export = function (type, name, source) {
- var IS_FORCED = type & $export.F;
- var IS_GLOBAL = type & $export.G;
- var IS_STATIC = type & $export.S;
- var IS_PROTO = type & $export.P;
- var IS_BIND = type & $export.B;
- var IS_WRAP = type & $export.W;
- var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
- var expProto = exports[PROTOTYPE];
- var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] : (_global[name] || {})[PROTOTYPE];
- var key, own, out;
- if (IS_GLOBAL) source = name;
- for (key in source) {
- // contains in native
- own = !IS_FORCED && target && target[key] !== undefined;
- if (own && _has(exports, key)) continue;
- // export native or passed
- out = own ? target[key] : source[key];
- // prevent global pollution for namespaces
- exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
- // bind timers to global for call from export context
- : IS_BIND && own ? _ctx(out, _global)
- // wrap global constructors for prevent change them in library
- : IS_WRAP && target[key] == out ? (function (C) {
- var F = function (a, b, c) {
- if (this instanceof C) {
- switch (arguments.length) {
- case 0: return new C();
- case 1: return new C(a);
- case 2: return new C(a, b);
- } return new C(a, b, c);
- } return C.apply(this, arguments);
- };
- F[PROTOTYPE] = C[PROTOTYPE];
- return F;
- // make static versions for prototype methods
- })(out) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
- // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
- if (IS_PROTO) {
- (exports.virtual || (exports.virtual = {}))[key] = out;
- // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
- if (type & $export.R && expProto && !expProto[key]) _hide(expProto, key, out);
- }
- }
- };
- // type bitmap
- $export.F = 1; // forced
- $export.G = 2; // global
- $export.S = 4; // static
- $export.P = 8; // proto
- $export.B = 16; // bind
- $export.W = 32; // wrap
- $export.U = 64; // safe
- $export.R = 128; // real proto method for `library`
- var _export = $export;
- var toString$1 = {}.toString;
- var _cof = function (it) {
- return toString$1.call(it).slice(8, -1);
- };
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
- // eslint-disable-next-line no-prototype-builtins
- var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
- return _cof(it) == 'String' ? it.split('') : Object(it);
- };
- // 7.2.1 RequireObjectCoercible(argument)
- var _defined = function (it) {
- if (it == undefined) throw TypeError("Can't call method on " + it);
- return it;
- };
- // to indexed object, toObject with fallback for non-array-like ES3 strings
- var _toIobject = function (it) {
- return _iobject(_defined(it));
- };
- // 7.1.4 ToInteger
- var ceil = Math.ceil;
- var floor = Math.floor;
- var _toInteger = function (it) {
- return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
- };
- // 7.1.15 ToLength
- var min = Math.min;
- var _toLength = function (it) {
- return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
- };
- var max = Math.max;
- var min$1 = Math.min;
- var _toAbsoluteIndex = function (index, length) {
- index = _toInteger(index);
- return index < 0 ? max(index + length, 0) : min$1(index, length);
- };
- // false -> Array#indexOf
- // true -> Array#includes
- var _arrayIncludes = function (IS_INCLUDES) {
- return function ($this, el, fromIndex) {
- var O = _toIobject($this);
- var length = _toLength(O.length);
- var index = _toAbsoluteIndex(fromIndex, length);
- var value;
- // Array#includes uses SameValueZero equality algorithm
- // eslint-disable-next-line no-self-compare
- if (IS_INCLUDES && el != el) while (length > index) {
- value = O[index++];
- // eslint-disable-next-line no-self-compare
- if (value != value) return true;
- // Array#indexOf ignores holes, Array#includes - not
- } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
- if (O[index] === el) return IS_INCLUDES || index || 0;
- } return !IS_INCLUDES && -1;
- };
- };
- var _library = true;
- var _shared = createCommonjsModule(function (module) {
- var SHARED = '__core-js_shared__';
- var store = _global[SHARED] || (_global[SHARED] = {});
- (module.exports = function (key, value) {
- return store[key] || (store[key] = value !== undefined ? value : {});
- })('versions', []).push({
- version: _core.version,
- mode: _library ? 'pure' : 'global',
- copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
- });
- });
- var id = 0;
- var px = Math.random();
- var _uid = function (key) {
- return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
- };
- var shared = _shared('keys');
- var _sharedKey = function (key) {
- return shared[key] || (shared[key] = _uid(key));
- };
- var arrayIndexOf = _arrayIncludes(false);
- var IE_PROTO = _sharedKey('IE_PROTO');
- var _objectKeysInternal = function (object, names) {
- var O = _toIobject(object);
- var i = 0;
- var result = [];
- var key;
- for (key in O) if (key != IE_PROTO) _has(O, key) && result.push(key);
- // Don't enum bug & hidden keys
- while (names.length > i) if (_has(O, key = names[i++])) {
- ~arrayIndexOf(result, key) || result.push(key);
- }
- return result;
- };
- // IE 8- don't enum bug keys
- var _enumBugKeys = (
- 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
- ).split(',');
- // 19.1.2.14 / 15.2.3.14 Object.keys(O)
- var _objectKeys = Object.keys || function keys(O) {
- return _objectKeysInternal(O, _enumBugKeys);
- };
- var f$1 = Object.getOwnPropertySymbols;
- var _objectGops = {
- f: f$1
- };
- var f$2 = {}.propertyIsEnumerable;
- var _objectPie = {
- f: f$2
- };
- // 7.1.13 ToObject(argument)
- var _toObject = function (it) {
- return Object(_defined(it));
- };
- // 19.1.2.1 Object.assign(target, source, ...)
- var $assign = Object.assign;
- // should work with symbols and should have deterministic property order (V8 bug)
- var _objectAssign = !$assign || _fails(function () {
- var A = {};
- var B = {};
- // eslint-disable-next-line no-undef
- var S = Symbol();
- var K = 'abcdefghijklmnopqrst';
- A[S] = 7;
- K.split('').forEach(function (k) { B[k] = k; });
- return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
- }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
- var T = _toObject(target);
- var aLen = arguments.length;
- var index = 1;
- var getSymbols = _objectGops.f;
- var isEnum = _objectPie.f;
- while (aLen > index) {
- var S = _iobject(arguments[index++]);
- var keys = getSymbols ? _objectKeys(S).concat(getSymbols(S)) : _objectKeys(S);
- var length = keys.length;
- var j = 0;
- var key;
- while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
- } return T;
- } : $assign;
- // 19.1.3.1 Object.assign(target, source)
- _export(_export.S + _export.F, 'Object', { assign: _objectAssign });
- var assign = _core.Object.assign;
- var assign$1 = createCommonjsModule(function (module) {
- module.exports = { "default": assign, __esModule: true };
- });
- var _Object$assign = unwrapExports(assign$1);
- // true -> String#at
- // false -> String#codePointAt
- var _stringAt = function (TO_STRING) {
- return function (that, pos) {
- var s = String(_defined(that));
- var i = _toInteger(pos);
- var l = s.length;
- var a, b;
- if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
- a = s.charCodeAt(i);
- return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
- ? TO_STRING ? s.charAt(i) : a
- : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
- };
- };
- var _redefine = _hide;
- var _iterators = {};
- var _objectDps = _descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
- _anObject(O);
- var keys = _objectKeys(Properties);
- var length = keys.length;
- var i = 0;
- var P;
- while (length > i) _objectDp.f(O, P = keys[i++], Properties[P]);
- return O;
- };
- var document$2 = _global.document;
- var _html = document$2 && document$2.documentElement;
- // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
- var IE_PROTO$1 = _sharedKey('IE_PROTO');
- var Empty = function () { /* empty */ };
- var PROTOTYPE$1 = 'prototype';
- // Create object with fake `null` prototype: use iframe Object with cleared prototype
- var createDict = function () {
- // Thrash, waste and sodomy: IE GC bug
- var iframe = _domCreate('iframe');
- var i = _enumBugKeys.length;
- var lt = '<';
- var gt = '>';
- var iframeDocument;
- iframe.style.display = 'none';
- _html.appendChild(iframe);
- iframe.src = 'javascript:'; // eslint-disable-line no-script-url
- // createDict = iframe.contentWindow.Object;
- // html.removeChild(iframe);
- iframeDocument = iframe.contentWindow.document;
- iframeDocument.open();
- iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
- iframeDocument.close();
- createDict = iframeDocument.F;
- while (i--) delete createDict[PROTOTYPE$1][_enumBugKeys[i]];
- return createDict();
- };
- var _objectCreate = Object.create || function create(O, Properties) {
- var result;
- if (O !== null) {
- Empty[PROTOTYPE$1] = _anObject(O);
- result = new Empty();
- Empty[PROTOTYPE$1] = null;
- // add "__proto__" for Object.getPrototypeOf polyfill
- result[IE_PROTO$1] = O;
- } else result = createDict();
- return Properties === undefined ? result : _objectDps(result, Properties);
- };
- var _wks = createCommonjsModule(function (module) {
- var store = _shared('wks');
- var Symbol = _global.Symbol;
- var USE_SYMBOL = typeof Symbol == 'function';
- var $exports = module.exports = function (name) {
- return store[name] || (store[name] =
- USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid)('Symbol.' + name));
- };
- $exports.store = store;
- });
- var def = _objectDp.f;
- var TAG = _wks('toStringTag');
- var _setToStringTag = function (it, tag, stat) {
- if (it && !_has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
- };
- var IteratorPrototype = {};
- // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
- _hide(IteratorPrototype, _wks('iterator'), function () { return this; });
- var _iterCreate = function (Constructor, NAME, next) {
- Constructor.prototype = _objectCreate(IteratorPrototype, { next: _propertyDesc(1, next) });
- _setToStringTag(Constructor, NAME + ' Iterator');
- };
- // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
- var IE_PROTO$2 = _sharedKey('IE_PROTO');
- var ObjectProto = Object.prototype;
- var _objectGpo = Object.getPrototypeOf || function (O) {
- O = _toObject(O);
- if (_has(O, IE_PROTO$2)) return O[IE_PROTO$2];
- if (typeof O.constructor == 'function' && O instanceof O.constructor) {
- return O.constructor.prototype;
- } return O instanceof Object ? ObjectProto : null;
- };
- var ITERATOR = _wks('iterator');
- var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
- var FF_ITERATOR = '@@iterator';
- var KEYS = 'keys';
- var VALUES = 'values';
- var returnThis = function () { return this; };
- var _iterDefine = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
- _iterCreate(Constructor, NAME, next);
- var getMethod = function (kind) {
- if (!BUGGY && kind in proto) return proto[kind];
- switch (kind) {
- case KEYS: return function keys() { return new Constructor(this, kind); };
- case VALUES: return function values() { return new Constructor(this, kind); };
- } return function entries() { return new Constructor(this, kind); };
- };
- var TAG = NAME + ' Iterator';
- var DEF_VALUES = DEFAULT == VALUES;
- var VALUES_BUG = false;
- var proto = Base.prototype;
- var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
- var $default = $native || getMethod(DEFAULT);
- var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
- var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
- var methods, key, IteratorPrototype;
- // Fix native
- if ($anyNative) {
- IteratorPrototype = _objectGpo($anyNative.call(new Base()));
- if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
- // Set @@toStringTag to native iterators
- _setToStringTag(IteratorPrototype, TAG, true);
- // fix for some old engines
- if (!_library && typeof IteratorPrototype[ITERATOR] != 'function') _hide(IteratorPrototype, ITERATOR, returnThis);
- }
- }
- // fix Array#{values, @@iterator}.name in V8 / FF
- if (DEF_VALUES && $native && $native.name !== VALUES) {
- VALUES_BUG = true;
- $default = function values() { return $native.call(this); };
- }
- // Define iterator
- if ((!_library || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
- _hide(proto, ITERATOR, $default);
- }
- // Plug for library
- _iterators[NAME] = $default;
- _iterators[TAG] = returnThis;
- if (DEFAULT) {
- methods = {
- values: DEF_VALUES ? $default : getMethod(VALUES),
- keys: IS_SET ? $default : getMethod(KEYS),
- entries: $entries
- };
- if (FORCED) for (key in methods) {
- if (!(key in proto)) _redefine(proto, key, methods[key]);
- } else _export(_export.P + _export.F * (BUGGY || VALUES_BUG), NAME, methods);
- }
- return methods;
- };
- var $at = _stringAt(true);
- // 21.1.3.27 String.prototype[@@iterator]()
- _iterDefine(String, 'String', function (iterated) {
- this._t = String(iterated); // target
- this._i = 0; // next index
- // 21.1.5.2.1 %StringIteratorPrototype%.next()
- }, function () {
- var O = this._t;
- var index = this._i;
- var point;
- if (index >= O.length) return { value: undefined, done: true };
- point = $at(O, index);
- this._i += point.length;
- return { value: point, done: false };
- });
- var _iterStep = function (done, value) {
- return { value: value, done: !!done };
- };
- // 22.1.3.4 Array.prototype.entries()
- // 22.1.3.13 Array.prototype.keys()
- // 22.1.3.29 Array.prototype.values()
- // 22.1.3.30 Array.prototype[@@iterator]()
- var es6_array_iterator = _iterDefine(Array, 'Array', function (iterated, kind) {
- this._t = _toIobject(iterated); // target
- this._i = 0; // next index
- this._k = kind; // kind
- // 22.1.5.2.1 %ArrayIteratorPrototype%.next()
- }, function () {
- var O = this._t;
- var kind = this._k;
- var index = this._i++;
- if (!O || index >= O.length) {
- this._t = undefined;
- return _iterStep(1);
- }
- if (kind == 'keys') return _iterStep(0, index);
- if (kind == 'values') return _iterStep(0, O[index]);
- return _iterStep(0, [index, O[index]]);
- }, 'values');
- // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
- _iterators.Arguments = _iterators.Array;
- var TO_STRING_TAG = _wks('toStringTag');
- var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
- 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
- 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
- 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
- 'TextTrackList,TouchList').split(',');
- for (var i = 0; i < DOMIterables.length; i++) {
- var NAME = DOMIterables[i];
- var Collection = _global[NAME];
- var proto = Collection && Collection.prototype;
- if (proto && !proto[TO_STRING_TAG]) _hide(proto, TO_STRING_TAG, NAME);
- _iterators[NAME] = _iterators.Array;
- }
- // getting tag from 19.1.3.6 Object.prototype.toString()
- var TAG$1 = _wks('toStringTag');
- // ES3 wrong here
- var ARG = _cof(function () { return arguments; }()) == 'Arguments';
- // fallback for IE11 Script Access Denied error
- var tryGet = function (it, key) {
- try {
- return it[key];
- } catch (e) { /* empty */ }
- };
- var _classof = function (it) {
- var O, T, B;
- return it === undefined ? 'Undefined' : it === null ? 'Null'
- // @@toStringTag case
- : typeof (T = tryGet(O = Object(it), TAG$1)) == 'string' ? T
- // builtinTag case
- : ARG ? _cof(O)
- // ES3 arguments fallback
- : (B = _cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
- };
- var _anInstance = function (it, Constructor, name, forbiddenField) {
- if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
- throw TypeError(name + ': incorrect invocation!');
- } return it;
- };
- // call something on iterator step with safe closing on error
- var _iterCall = function (iterator, fn, value, entries) {
- try {
- return entries ? fn(_anObject(value)[0], value[1]) : fn(value);
- // 7.4.6 IteratorClose(iterator, completion)
- } catch (e) {
- var ret = iterator['return'];
- if (ret !== undefined) _anObject(ret.call(iterator));
- throw e;
- }
- };
- // check on default Array iterator
- var ITERATOR$1 = _wks('iterator');
- var ArrayProto = Array.prototype;
- var _isArrayIter = function (it) {
- return it !== undefined && (_iterators.Array === it || ArrayProto[ITERATOR$1] === it);
- };
- var ITERATOR$2 = _wks('iterator');
- var core_getIteratorMethod = _core.getIteratorMethod = function (it) {
- if (it != undefined) return it[ITERATOR$2]
- || it['@@iterator']
- || _iterators[_classof(it)];
- };
- var _forOf = createCommonjsModule(function (module) {
- var BREAK = {};
- var RETURN = {};
- var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
- var iterFn = ITERATOR ? function () { return iterable; } : core_getIteratorMethod(iterable);
- var f = _ctx(fn, that, entries ? 2 : 1);
- var index = 0;
- var length, step, iterator, result;
- if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
- // fast case for arrays with default iterator
- if (_isArrayIter(iterFn)) for (length = _toLength(iterable.length); length > index; index++) {
- result = entries ? f(_anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
- if (result === BREAK || result === RETURN) return result;
- } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
- result = _iterCall(iterator, f, step.value, entries);
- if (result === BREAK || result === RETURN) return result;
- }
- };
- exports.BREAK = BREAK;
- exports.RETURN = RETURN;
- });
- // 7.3.20 SpeciesConstructor(O, defaultConstructor)
- var SPECIES = _wks('species');
- var _speciesConstructor = function (O, D) {
- var C = _anObject(O).constructor;
- var S;
- return C === undefined || (S = _anObject(C)[SPECIES]) == undefined ? D : _aFunction(S);
- };
- // fast apply, http://jsperf.lnkit.com/fast-apply/5
- var _invoke = function (fn, args, that) {
- var un = that === undefined;
- switch (args.length) {
- case 0: return un ? fn()
- : fn.call(that);
- case 1: return un ? fn(args[0])
- : fn.call(that, args[0]);
- case 2: return un ? fn(args[0], args[1])
- : fn.call(that, args[0], args[1]);
- case 3: return un ? fn(args[0], args[1], args[2])
- : fn.call(that, args[0], args[1], args[2]);
- case 4: return un ? fn(args[0], args[1], args[2], args[3])
- : fn.call(that, args[0], args[1], args[2], args[3]);
- } return fn.apply(that, args);
- };
- var process = _global.process;
- var setTask = _global.setImmediate;
- var clearTask = _global.clearImmediate;
- var MessageChannel = _global.MessageChannel;
- var Dispatch = _global.Dispatch;
- var counter = 0;
- var queue = {};
- var ONREADYSTATECHANGE = 'onreadystatechange';
- var defer, channel, port;
- var run = function () {
- var id = +this;
- // eslint-disable-next-line no-prototype-builtins
- if (queue.hasOwnProperty(id)) {
- var fn = queue[id];
- delete queue[id];
- fn();
- }
- };
- var listener = function (event) {
- run.call(event.data);
- };
- // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
- if (!setTask || !clearTask) {
- setTask = function setImmediate(fn) {
- var args = [];
- var i = 1;
- while (arguments.length > i) args.push(arguments[i++]);
- queue[++counter] = function () {
- // eslint-disable-next-line no-new-func
- _invoke(typeof fn == 'function' ? fn : Function(fn), args);
- };
- defer(counter);
- return counter;
- };
- clearTask = function clearImmediate(id) {
- delete queue[id];
- };
- // Node.js 0.8-
- if (_cof(process) == 'process') {
- defer = function (id) {
- process.nextTick(_ctx(run, id, 1));
- };
- // Sphere (JS game engine) Dispatch API
- } else if (Dispatch && Dispatch.now) {
- defer = function (id) {
- Dispatch.now(_ctx(run, id, 1));
- };
- // Browsers with MessageChannel, includes WebWorkers
- } else if (MessageChannel) {
- channel = new MessageChannel();
- port = channel.port2;
- channel.port1.onmessage = listener;
- defer = _ctx(port.postMessage, port, 1);
- // Browsers with postMessage, skip WebWorkers
- // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
- } else if (_global.addEventListener && typeof postMessage == 'function' && !_global.importScripts) {
- defer = function (id) {
- _global.postMessage(id + '', '*');
- };
- _global.addEventListener('message', listener, false);
- // IE8-
- } else if (ONREADYSTATECHANGE in _domCreate('script')) {
- defer = function (id) {
- _html.appendChild(_domCreate('script'))[ONREADYSTATECHANGE] = function () {
- _html.removeChild(this);
- run.call(id);
- };
- };
- // Rest old browsers
- } else {
- defer = function (id) {
- setTimeout(_ctx(run, id, 1), 0);
- };
- }
- }
- var _task = {
- set: setTask,
- clear: clearTask
- };
- var macrotask = _task.set;
- var Observer = _global.MutationObserver || _global.WebKitMutationObserver;
- var process$1 = _global.process;
- var Promise = _global.Promise;
- var isNode = _cof(process$1) == 'process';
- var _microtask = function () {
- var head, last, notify;
- var flush = function () {
- var parent, fn;
- if (isNode && (parent = process$1.domain)) parent.exit();
- while (head) {
- fn = head.fn;
- head = head.next;
- try {
- fn();
- } catch (e) {
- if (head) notify();
- else last = undefined;
- throw e;
- }
- } last = undefined;
- if (parent) parent.enter();
- };
- // Node.js
- if (isNode) {
- notify = function () {
- process$1.nextTick(flush);
- };
- // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339
- } else if (Observer && !(_global.navigator && _global.navigator.standalone)) {
- var toggle = true;
- var node = document.createTextNode('');
- new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
- notify = function () {
- node.data = toggle = !toggle;
- };
- // environments with maybe non-completely correct, but existent Promise
- } else if (Promise && Promise.resolve) {
- // Promise.resolve without an argument throws an error in LG WebOS 2
- var promise = Promise.resolve(undefined);
- notify = function () {
- promise.then(flush);
- };
- // for other environments - macrotask based on:
- // - setImmediate
- // - MessageChannel
- // - window.postMessag
- // - onreadystatechange
- // - setTimeout
- } else {
- notify = function () {
- // strange IE + webpack dev server bug - use .call(global)
- macrotask.call(_global, flush);
- };
- }
- return function (fn) {
- var task = { fn: fn, next: undefined };
- if (last) last.next = task;
- if (!head) {
- head = task;
- notify();
- } last = task;
- };
- };
- // 25.4.1.5 NewPromiseCapability(C)
- function PromiseCapability(C) {
- var resolve, reject;
- this.promise = new C(function ($$resolve, $$reject) {
- if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
- resolve = $$resolve;
- reject = $$reject;
- });
- this.resolve = _aFunction(resolve);
- this.reject = _aFunction(reject);
- }
- var f$3 = function (C) {
- return new PromiseCapability(C);
- };
- var _newPromiseCapability = {
- f: f$3
- };
- var _perform = function (exec) {
- try {
- return { e: false, v: exec() };
- } catch (e) {
- return { e: true, v: e };
- }
- };
- var navigator = _global.navigator;
- var _userAgent = navigator && navigator.userAgent || '';
- var _promiseResolve = function (C, x) {
- _anObject(C);
- if (_isObject(x) && x.constructor === C) return x;
- var promiseCapability = _newPromiseCapability.f(C);
- var resolve = promiseCapability.resolve;
- resolve(x);
- return promiseCapability.promise;
- };
- var _redefineAll = function (target, src, safe) {
- for (var key in src) {
- if (safe && target[key]) target[key] = src[key];
- else _hide(target, key, src[key]);
- } return target;
- };
- var SPECIES$1 = _wks('species');
- var _setSpecies = function (KEY) {
- var C = typeof _core[KEY] == 'function' ? _core[KEY] : _global[KEY];
- if (_descriptors && C && !C[SPECIES$1]) _objectDp.f(C, SPECIES$1, {
- configurable: true,
- get: function () { return this; }
- });
- };
- var ITERATOR$3 = _wks('iterator');
- var SAFE_CLOSING = false;
- try {
- var riter = [7][ITERATOR$3]();
- riter['return'] = function () { SAFE_CLOSING = true; };
- } catch (e) { /* empty */ }
- var _iterDetect = function (exec, skipClosing) {
- if (!skipClosing && !SAFE_CLOSING) return false;
- var safe = false;
- try {
- var arr = [7];
- var iter = arr[ITERATOR$3]();
- iter.next = function () { return { done: safe = true }; };
- arr[ITERATOR$3] = function () { return iter; };
- exec(arr);
- } catch (e) { /* empty */ }
- return safe;
- };
- var task = _task.set;
- var microtask = _microtask();
- var PROMISE = 'Promise';
- var TypeError$1 = _global.TypeError;
- var process$2 = _global.process;
- var versions = process$2 && process$2.versions;
- var v8 = versions && versions.v8 || '';
- var $Promise = _global[PROMISE];
- var isNode$1 = _classof(process$2) == 'process';
- var empty = function () { /* empty */ };
- var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;
- var newPromiseCapability = newGenericPromiseCapability = _newPromiseCapability.f;
- var USE_NATIVE = !!function () {
- try {
- // correct subclassing with @@species support
- var promise = $Promise.resolve(1);
- var FakePromise = (promise.constructor = {})[_wks('species')] = function (exec) {
- exec(empty, empty);
- };
- // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
- return (isNode$1 || typeof PromiseRejectionEvent == 'function')
- && promise.then(empty) instanceof FakePromise
- // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
- // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
- // we can't detect it synchronously, so just check versions
- && v8.indexOf('6.6') !== 0
- && _userAgent.indexOf('Chrome/66') === -1;
- } catch (e) { /* empty */ }
- }();
- // helpers
- var isThenable = function (it) {
- var then;
- return _isObject(it) && typeof (then = it.then) == 'function' ? then : false;
- };
- var notify = function (promise, isReject) {
- if (promise._n) return;
- promise._n = true;
- var chain = promise._c;
- microtask(function () {
- var value = promise._v;
- var ok = promise._s == 1;
- var i = 0;
- var run = function (reaction) {
- var handler = ok ? reaction.ok : reaction.fail;
- var resolve = reaction.resolve;
- var reject = reaction.reject;
- var domain = reaction.domain;
- var result, then, exited;
- try {
- if (handler) {
- if (!ok) {
- if (promise._h == 2) onHandleUnhandled(promise);
- promise._h = 1;
- }
- if (handler === true) result = value;
- else {
- if (domain) domain.enter();
- result = handler(value); // may throw
- if (domain) {
- domain.exit();
- exited = true;
- }
- }
- if (result === reaction.promise) {
- reject(TypeError$1('Promise-chain cycle'));
- } else if (then = isThenable(result)) {
- then.call(result, resolve, reject);
- } else resolve(result);
- } else reject(value);
- } catch (e) {
- if (domain && !exited) domain.exit();
- reject(e);
- }
- };
- while (chain.length > i) run(chain[i++]); // variable length - can't use forEach
- promise._c = [];
- promise._n = false;
- if (isReject && !promise._h) onUnhandled(promise);
- });
- };
- var onUnhandled = function (promise) {
- task.call(_global, function () {
- var value = promise._v;
- var unhandled = isUnhandled(promise);
- var result, handler, console;
- if (unhandled) {
- result = _perform(function () {
- if (isNode$1) {
- process$2.emit('unhandledRejection', value, promise);
- } else if (handler = _global.onunhandledrejection) {
- handler({ promise: promise, reason: value });
- } else if ((console = _global.console) && console.error) {
- console.error('Unhandled promise rejection', value);
- }
- });
- // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
- promise._h = isNode$1 || isUnhandled(promise) ? 2 : 1;
- } promise._a = undefined;
- if (unhandled && result.e) throw result.v;
- });
- };
- var isUnhandled = function (promise) {
- return promise._h !== 1 && (promise._a || promise._c).length === 0;
- };
- var onHandleUnhandled = function (promise) {
- task.call(_global, function () {
- var handler;
- if (isNode$1) {
- process$2.emit('rejectionHandled', promise);
- } else if (handler = _global.onrejectionhandled) {
- handler({ promise: promise, reason: promise._v });
- }
- });
- };
- var $reject = function (value) {
- var promise = this;
- if (promise._d) return;
- promise._d = true;
- promise = promise._w || promise; // unwrap
- promise._v = value;
- promise._s = 2;
- if (!promise._a) promise._a = promise._c.slice();
- notify(promise, true);
- };
- var $resolve = function (value) {
- var promise = this;
- var then;
- if (promise._d) return;
- promise._d = true;
- promise = promise._w || promise; // unwrap
- try {
- if (promise === value) throw TypeError$1("Promise can't be resolved itself");
- if (then = isThenable(value)) {
- microtask(function () {
- var wrapper = { _w: promise, _d: false }; // wrap
- try {
- then.call(value, _ctx($resolve, wrapper, 1), _ctx($reject, wrapper, 1));
- } catch (e) {
- $reject.call(wrapper, e);
- }
- });
- } else {
- promise._v = value;
- promise._s = 1;
- notify(promise, false);
- }
- } catch (e) {
- $reject.call({ _w: promise, _d: false }, e); // wrap
- }
- };
- // constructor polyfill
- if (!USE_NATIVE) {
- // 25.4.3.1 Promise(executor)
- $Promise = function Promise(executor) {
- _anInstance(this, $Promise, PROMISE, '_h');
- _aFunction(executor);
- Internal.call(this);
- try {
- executor(_ctx($resolve, this, 1), _ctx($reject, this, 1));
- } catch (err) {
- $reject.call(this, err);
- }
- };
- // eslint-disable-next-line no-unused-vars
- Internal = function Promise(executor) {
- this._c = []; // <- awaiting reactions
- this._a = undefined; // <- checked in isUnhandled reactions
- this._s = 0; // <- state
- this._d = false; // <- done
- this._v = undefined; // <- value
- this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
- this._n = false; // <- notify
- };
- Internal.prototype = _redefineAll($Promise.prototype, {
- // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
- then: function then(onFulfilled, onRejected) {
- var reaction = newPromiseCapability(_speciesConstructor(this, $Promise));
- reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
- reaction.fail = typeof onRejected == 'function' && onRejected;
- reaction.domain = isNode$1 ? process$2.domain : undefined;
- this._c.push(reaction);
- if (this._a) this._a.push(reaction);
- if (this._s) notify(this, false);
- return reaction.promise;
- },
- // 25.4.5.1 Promise.prototype.catch(onRejected)
- 'catch': function (onRejected) {
- return this.then(undefined, onRejected);
- }
- });
- OwnPromiseCapability = function () {
- var promise = new Internal();
- this.promise = promise;
- this.resolve = _ctx($resolve, promise, 1);
- this.reject = _ctx($reject, promise, 1);
- };
- _newPromiseCapability.f = newPromiseCapability = function (C) {
- return C === $Promise || C === Wrapper
- ? new OwnPromiseCapability(C)
- : newGenericPromiseCapability(C);
- };
- }
- _export(_export.G + _export.W + _export.F * !USE_NATIVE, { Promise: $Promise });
- _setToStringTag($Promise, PROMISE);
- _setSpecies(PROMISE);
- Wrapper = _core[PROMISE];
- // statics
- _export(_export.S + _export.F * !USE_NATIVE, PROMISE, {
- // 25.4.4.5 Promise.reject(r)
- reject: function reject(r) {
- var capability = newPromiseCapability(this);
- var $$reject = capability.reject;
- $$reject(r);
- return capability.promise;
- }
- });
- _export(_export.S + _export.F * (_library || !USE_NATIVE), PROMISE, {
- // 25.4.4.6 Promise.resolve(x)
- resolve: function resolve(x) {
- return _promiseResolve(_library && this === Wrapper ? $Promise : this, x);
- }
- });
- _export(_export.S + _export.F * !(USE_NATIVE && _iterDetect(function (iter) {
- $Promise.all(iter)['catch'](empty);
- })), PROMISE, {
- // 25.4.4.1 Promise.all(iterable)
- all: function all(iterable) {
- var C = this;
- var capability = newPromiseCapability(C);
- var resolve = capability.resolve;
- var reject = capability.reject;
- var result = _perform(function () {
- var values = [];
- var index = 0;
- var remaining = 1;
- _forOf(iterable, false, function (promise) {
- var $index = index++;
- var alreadyCalled = false;
- values.push(undefined);
- remaining++;
- C.resolve(promise).then(function (value) {
- if (alreadyCalled) return;
- alreadyCalled = true;
- values[$index] = value;
- --remaining || resolve(values);
- }, reject);
- });
- --remaining || resolve(values);
- });
- if (result.e) reject(result.v);
- return capability.promise;
- },
- // 25.4.4.4 Promise.race(iterable)
- race: function race(iterable) {
- var C = this;
- var capability = newPromiseCapability(C);
- var reject = capability.reject;
- var result = _perform(function () {
- _forOf(iterable, false, function (promise) {
- C.resolve(promise).then(capability.resolve, reject);
- });
- });
- if (result.e) reject(result.v);
- return capability.promise;
- }
- });
- _export(_export.P + _export.R, 'Promise', { 'finally': function (onFinally) {
- var C = _speciesConstructor(this, _core.Promise || _global.Promise);
- var isFunction = typeof onFinally == 'function';
- return this.then(
- isFunction ? function (x) {
- return _promiseResolve(C, onFinally()).then(function () { return x; });
- } : onFinally,
- isFunction ? function (e) {
- return _promiseResolve(C, onFinally()).then(function () { throw e; });
- } : onFinally
- );
- } });
- // https://github.com/tc39/proposal-promise-try
- _export(_export.S, 'Promise', { 'try': function (callbackfn) {
- var promiseCapability = _newPromiseCapability.f(this);
- var result = _perform(callbackfn);
- (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v);
- return promiseCapability.promise;
- } });
- var promise = _core.Promise;
- var promise$1 = createCommonjsModule(function (module) {
- module.exports = { "default": promise, __esModule: true };
- });
- var _Promise = unwrapExports(promise$1);
- // most Object methods by ES6 should accept primitives
- var _objectSap = function (KEY, exec) {
- var fn = (_core.Object || {})[KEY] || Object[KEY];
- var exp = {};
- exp[KEY] = exec(fn);
- _export(_export.S + _export.F * _fails(function () { fn(1); }), 'Object', exp);
- };
- // 19.1.2.14 Object.keys(O)
- _objectSap('keys', function () {
- return function keys(it) {
- return _objectKeys(_toObject(it));
- };
- });
- var keys = _core.Object.keys;
- var keys$1 = createCommonjsModule(function (module) {
- module.exports = { "default": keys, __esModule: true };
- });
- var _Object$keys = unwrapExports(keys$1);
- var f$4 = _wks;
- var _wksExt = {
- f: f$4
- };
- var iterator = _wksExt.f('iterator');
- var iterator$1 = createCommonjsModule(function (module) {
- module.exports = { "default": iterator, __esModule: true };
- });
- var _Symbol$iterator = unwrapExports(iterator$1);
- var _meta = createCommonjsModule(function (module) {
- var META = _uid('meta');
- var setDesc = _objectDp.f;
- var id = 0;
- var isExtensible = Object.isExtensible || function () {
- return true;
- };
- var FREEZE = !_fails(function () {
- return isExtensible(Object.preventExtensions({}));
- });
- var setMeta = function (it) {
- setDesc(it, META, { value: {
- i: 'O' + ++id, // object ID
- w: {} // weak collections IDs
- } });
- };
- var fastKey = function (it, create) {
- // return primitive with prefix
- if (!_isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
- if (!_has(it, META)) {
- // can't set metadata to uncaught frozen object
- if (!isExtensible(it)) return 'F';
- // not necessary to add metadata
- if (!create) return 'E';
- // add missing metadata
- setMeta(it);
- // return object ID
- } return it[META].i;
- };
- var getWeak = function (it, create) {
- if (!_has(it, META)) {
- // can't set metadata to uncaught frozen object
- if (!isExtensible(it)) return true;
- // not necessary to add metadata
- if (!create) return false;
- // add missing metadata
- setMeta(it);
- // return hash weak collections IDs
- } return it[META].w;
- };
- // add metadata on freeze-family methods calling
- var onFreeze = function (it) {
- if (FREEZE && meta.NEED && isExtensible(it) && !_has(it, META)) setMeta(it);
- return it;
- };
- var meta = module.exports = {
- KEY: META,
- NEED: false,
- fastKey: fastKey,
- getWeak: getWeak,
- onFreeze: onFreeze
- };
- });
- var _meta_1 = _meta.KEY;
- var _meta_2 = _meta.NEED;
- var _meta_3 = _meta.fastKey;
- var _meta_4 = _meta.getWeak;
- var _meta_5 = _meta.onFreeze;
- var defineProperty = _objectDp.f;
- var _wksDefine = function (name) {
- var $Symbol = _core.Symbol || (_core.Symbol = _library ? {} : _global.Symbol || {});
- if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: _wksExt.f(name) });
- };
- // all enumerable object keys, includes symbols
- var _enumKeys = function (it) {
- var result = _objectKeys(it);
- var getSymbols = _objectGops.f;
- if (getSymbols) {
- var symbols = getSymbols(it);
- var isEnum = _objectPie.f;
- var i = 0;
- var key;
- while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
- } return result;
- };
- // 7.2.2 IsArray(argument)
- var _isArray = Array.isArray || function isArray(arg) {
- return _cof(arg) == 'Array';
- };
- // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
- var hiddenKeys = _enumBugKeys.concat('length', 'prototype');
- var f$5 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
- return _objectKeysInternal(O, hiddenKeys);
- };
- var _objectGopn = {
- f: f$5
- };
- // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
- var gOPN = _objectGopn.f;
- var toString$2 = {}.toString;
- var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
- ? Object.getOwnPropertyNames(window) : [];
- var getWindowNames = function (it) {
- try {
- return gOPN(it);
- } catch (e) {
- return windowNames.slice();
- }
- };
- var f$6 = function getOwnPropertyNames(it) {
- return windowNames && toString$2.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(_toIobject(it));
- };
- var _objectGopnExt = {
- f: f$6
- };
- var gOPD = Object.getOwnPropertyDescriptor;
- var f$7 = _descriptors ? gOPD : function getOwnPropertyDescriptor(O, P) {
- O = _toIobject(O);
- P = _toPrimitive(P, true);
- if (_ie8DomDefine) try {
- return gOPD(O, P);
- } catch (e) { /* empty */ }
- if (_has(O, P)) return _propertyDesc(!_objectPie.f.call(O, P), O[P]);
- };
- var _objectGopd = {
- f: f$7
- };
- // ECMAScript 6 symbols shim
- var META = _meta.KEY;
- var gOPD$1 = _objectGopd.f;
- var dP$1 = _objectDp.f;
- var gOPN$1 = _objectGopnExt.f;
- var $Symbol = _global.Symbol;
- var $JSON = _global.JSON;
- var _stringify = $JSON && $JSON.stringify;
- var PROTOTYPE$2 = 'prototype';
- var HIDDEN = _wks('_hidden');
- var TO_PRIMITIVE = _wks('toPrimitive');
- var isEnum = {}.propertyIsEnumerable;
- var SymbolRegistry = _shared('symbol-registry');
- var AllSymbols = _shared('symbols');
- var OPSymbols = _shared('op-symbols');
- var ObjectProto$1 = Object[PROTOTYPE$2];
- var USE_NATIVE$1 = typeof $Symbol == 'function';
- var QObject = _global.QObject;
- // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
- var setter = !QObject || !QObject[PROTOTYPE$2] || !QObject[PROTOTYPE$2].findChild;
- // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
- var setSymbolDesc = _descriptors && _fails(function () {
- return _objectCreate(dP$1({}, 'a', {
- get: function () { return dP$1(this, 'a', { value: 7 }).a; }
- })).a != 7;
- }) ? function (it, key, D) {
- var protoDesc = gOPD$1(ObjectProto$1, key);
- if (protoDesc) delete ObjectProto$1[key];
- dP$1(it, key, D);
- if (protoDesc && it !== ObjectProto$1) dP$1(ObjectProto$1, key, protoDesc);
- } : dP$1;
- var wrap = function (tag) {
- var sym = AllSymbols[tag] = _objectCreate($Symbol[PROTOTYPE$2]);
- sym._k = tag;
- return sym;
- };
- var isSymbol = USE_NATIVE$1 && typeof $Symbol.iterator == 'symbol' ? function (it) {
- return typeof it == 'symbol';
- } : function (it) {
- return it instanceof $Symbol;
- };
- var $defineProperty = function defineProperty(it, key, D) {
- if (it === ObjectProto$1) $defineProperty(OPSymbols, key, D);
- _anObject(it);
- key = _toPrimitive(key, true);
- _anObject(D);
- if (_has(AllSymbols, key)) {
- if (!D.enumerable) {
- if (!_has(it, HIDDEN)) dP$1(it, HIDDEN, _propertyDesc(1, {}));
- it[HIDDEN][key] = true;
- } else {
- if (_has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
- D = _objectCreate(D, { enumerable: _propertyDesc(0, false) });
- } return setSymbolDesc(it, key, D);
- } return dP$1(it, key, D);
- };
- var $defineProperties = function defineProperties(it, P) {
- _anObject(it);
- var keys = _enumKeys(P = _toIobject(P));
- var i = 0;
- var l = keys.length;
- var key;
- while (l > i) $defineProperty(it, key = keys[i++], P[key]);
- return it;
- };
- var $create = function create(it, P) {
- return P === undefined ? _objectCreate(it) : $defineProperties(_objectCreate(it), P);
- };
- var $propertyIsEnumerable = function propertyIsEnumerable(key) {
- var E = isEnum.call(this, key = _toPrimitive(key, true));
- if (this === ObjectProto$1 && _has(AllSymbols, key) && !_has(OPSymbols, key)) return false;
- return E || !_has(this, key) || !_has(AllSymbols, key) || _has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
- };
- var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
- it = _toIobject(it);
- key = _toPrimitive(key, true);
- if (it === ObjectProto$1 && _has(AllSymbols, key) && !_has(OPSymbols, key)) return;
- var D = gOPD$1(it, key);
- if (D && _has(AllSymbols, key) && !(_has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
- return D;
- };
- var $getOwnPropertyNames = function getOwnPropertyNames(it) {
- var names = gOPN$1(_toIobject(it));
- var result = [];
- var i = 0;
- var key;
- while (names.length > i) {
- if (!_has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
- } return result;
- };
- var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
- var IS_OP = it === ObjectProto$1;
- var names = gOPN$1(IS_OP ? OPSymbols : _toIobject(it));
- var result = [];
- var i = 0;
- var key;
- while (names.length > i) {
- if (_has(AllSymbols, key = names[i++]) && (IS_OP ? _has(ObjectProto$1, key) : true)) result.push(AllSymbols[key]);
- } return result;
- };
- // 19.4.1.1 Symbol([description])
- if (!USE_NATIVE$1) {
- $Symbol = function Symbol() {
- if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
- var tag = _uid(arguments.length > 0 ? arguments[0] : undefined);
- var $set = function (value) {
- if (this === ObjectProto$1) $set.call(OPSymbols, value);
- if (_has(this, HIDDEN) && _has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
- setSymbolDesc(this, tag, _propertyDesc(1, value));
- };
- if (_descriptors && setter) setSymbolDesc(ObjectProto$1, tag, { configurable: true, set: $set });
- return wrap(tag);
- };
- _redefine($Symbol[PROTOTYPE$2], 'toString', function toString() {
- return this._k;
- });
- _objectGopd.f = $getOwnPropertyDescriptor;
- _objectDp.f = $defineProperty;
- _objectGopn.f = _objectGopnExt.f = $getOwnPropertyNames;
- _objectPie.f = $propertyIsEnumerable;
- _objectGops.f = $getOwnPropertySymbols;
- if (_descriptors && !_library) {
- _redefine(ObjectProto$1, 'propertyIsEnumerable', $propertyIsEnumerable, true);
- }
- _wksExt.f = function (name) {
- return wrap(_wks(name));
- };
- }
- _export(_export.G + _export.W + _export.F * !USE_NATIVE$1, { Symbol: $Symbol });
- for (var es6Symbols = (
- // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
- 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
- ).split(','), j = 0; es6Symbols.length > j;)_wks(es6Symbols[j++]);
- for (var wellKnownSymbols = _objectKeys(_wks.store), k = 0; wellKnownSymbols.length > k;) _wksDefine(wellKnownSymbols[k++]);
- _export(_export.S + _export.F * !USE_NATIVE$1, 'Symbol', {
- // 19.4.2.1 Symbol.for(key)
- 'for': function (key) {
- return _has(SymbolRegistry, key += '')
- ? SymbolRegistry[key]
- : SymbolRegistry[key] = $Symbol(key);
- },
- // 19.4.2.5 Symbol.keyFor(sym)
- keyFor: function keyFor(sym) {
- if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
- for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
- },
- useSetter: function () { setter = true; },
- useSimple: function () { setter = false; }
- });
- _export(_export.S + _export.F * !USE_NATIVE$1, 'Object', {
- // 19.1.2.2 Object.create(O [, Properties])
- create: $create,
- // 19.1.2.4 Object.defineProperty(O, P, Attributes)
- defineProperty: $defineProperty,
- // 19.1.2.3 Object.defineProperties(O, Properties)
- defineProperties: $defineProperties,
- // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
- getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
- // 19.1.2.7 Object.getOwnPropertyNames(O)
- getOwnPropertyNames: $getOwnPropertyNames,
- // 19.1.2.8 Object.getOwnPropertySymbols(O)
- getOwnPropertySymbols: $getOwnPropertySymbols
- });
- // 24.3.2 JSON.stringify(value [, replacer [, space]])
- $JSON && _export(_export.S + _export.F * (!USE_NATIVE$1 || _fails(function () {
- var S = $Symbol();
- // MS Edge converts symbol values to JSON as {}
- // WebKit converts symbol values to JSON as null
- // V8 throws on boxed symbols
- return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
- })), 'JSON', {
- stringify: function stringify(it) {
- var args = [it];
- var i = 1;
- var replacer, $replacer;
- while (arguments.length > i) args.push(arguments[i++]);
- $replacer = replacer = args[1];
- if (!_isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
- if (!_isArray(replacer)) replacer = function (key, value) {
- if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
- if (!isSymbol(value)) return value;
- };
- args[1] = replacer;
- return _stringify.apply($JSON, args);
- }
- });
- // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
- $Symbol[PROTOTYPE$2][TO_PRIMITIVE] || _hide($Symbol[PROTOTYPE$2], TO_PRIMITIVE, $Symbol[PROTOTYPE$2].valueOf);
- // 19.4.3.5 Symbol.prototype[@@toStringTag]
- _setToStringTag($Symbol, 'Symbol');
- // 20.2.1.9 Math[@@toStringTag]
- _setToStringTag(Math, 'Math', true);
- // 24.3.3 JSON[@@toStringTag]
- _setToStringTag(_global.JSON, 'JSON', true);
- _wksDefine('asyncIterator');
- _wksDefine('observable');
- var symbol = _core.Symbol;
- var symbol$1 = createCommonjsModule(function (module) {
- module.exports = { "default": symbol, __esModule: true };
- });
- var _Symbol = unwrapExports(symbol$1);
- var _typeof_1 = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- var _iterator2 = _interopRequireDefault(iterator$1);
- var _symbol2 = _interopRequireDefault(symbol$1);
- var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; };
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
- return typeof obj === "undefined" ? "undefined" : _typeof(obj);
- } : function (obj) {
- return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
- };
- });
- var _typeof = unwrapExports(_typeof_1);
- // 19.1.2.9 Object.getPrototypeOf(O)
- _objectSap('getPrototypeOf', function () {
- return function getPrototypeOf(it) {
- return _objectGpo(_toObject(it));
- };
- });
- var getPrototypeOf = _core.Object.getPrototypeOf;
- var getPrototypeOf$1 = createCommonjsModule(function (module) {
- module.exports = { "default": getPrototypeOf, __esModule: true };
- });
- var _Object$getPrototypeOf = unwrapExports(getPrototypeOf$1);
- var classCallCheck = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports.default = function (instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- };
- });
- var _classCallCheck = unwrapExports(classCallCheck);
- var possibleConstructorReturn = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- var _typeof3 = _interopRequireDefault(_typeof_1);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.default = function (self, call) {
- if (!self) {
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- }
- return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self;
- };
- });
- var _possibleConstructorReturn = unwrapExports(possibleConstructorReturn);
- // Works with __proto__ only. Old v8 can't work with null proto objects.
- /* eslint-disable no-proto */
- var check = function (O, proto) {
- _anObject(O);
- if (!_isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
- };
- var _setProto = {
- set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
- function (test, buggy, set) {
- try {
- set = _ctx(Function.call, _objectGopd.f(Object.prototype, '__proto__').set, 2);
- set(test, []);
- buggy = !(test instanceof Array);
- } catch (e) { buggy = true; }
- return function setPrototypeOf(O, proto) {
- check(O, proto);
- if (buggy) O.__proto__ = proto;
- else set(O, proto);
- return O;
- };
- }({}, false) : undefined),
- check: check
- };
- // 19.1.3.19 Object.setPrototypeOf(O, proto)
- _export(_export.S, 'Object', { setPrototypeOf: _setProto.set });
- var setPrototypeOf = _core.Object.setPrototypeOf;
- var setPrototypeOf$1 = createCommonjsModule(function (module) {
- module.exports = { "default": setPrototypeOf, __esModule: true };
- });
- unwrapExports(setPrototypeOf$1);
- // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
- _export(_export.S, 'Object', { create: _objectCreate });
- var $Object = _core.Object;
- var create = function create(P, D) {
- return $Object.create(P, D);
- };
- var create$1 = createCommonjsModule(function (module) {
- module.exports = { "default": create, __esModule: true };
- });
- var _Object$create = unwrapExports(create$1);
- var inherits = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- var _setPrototypeOf2 = _interopRequireDefault(setPrototypeOf$1);
- var _create2 = _interopRequireDefault(create$1);
- var _typeof3 = _interopRequireDefault(_typeof_1);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.default = function (subClass, superClass) {
- if (typeof superClass !== "function" && superClass !== null) {
- throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : (0, _typeof3.default)(superClass)));
- }
- subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, {
- constructor: {
- value: subClass,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass;
- };
- });
- var _inherits = unwrapExports(inherits);
- // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
- _export(_export.S + _export.F * !_descriptors, 'Object', { defineProperty: _objectDp.f });
- var $Object$1 = _core.Object;
- var defineProperty$1 = function defineProperty(it, key, desc) {
- return $Object$1.defineProperty(it, key, desc);
- };
- var defineProperty$2 = createCommonjsModule(function (module) {
- module.exports = { "default": defineProperty$1, __esModule: true };
- });
- var _Object$defineProperty = unwrapExports(defineProperty$2);
- var defineProperty$3 = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- var _defineProperty2 = _interopRequireDefault(defineProperty$2);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.default = function (obj, key, value) {
- if (key in obj) {
- (0, _defineProperty2.default)(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- };
- });
- var _defineProperty = unwrapExports(defineProperty$3);
- var core_getIterator = _core.getIterator = function (it) {
- var iterFn = core_getIteratorMethod(it);
- if (typeof iterFn != 'function') throw TypeError(it + ' is not iterable!');
- return _anObject(iterFn.call(it));
- };
- var getIterator = core_getIterator;
- var getIterator$1 = createCommonjsModule(function (module) {
- module.exports = { "default": getIterator, __esModule: true };
- });
- var _getIterator = unwrapExports(getIterator$1);
- var _validateCollection = function (it, TYPE) {
- if (!_isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');
- return it;
- };
- var dP$2 = _objectDp.f;
- var fastKey = _meta.fastKey;
- var SIZE = _descriptors ? '_s' : 'size';
- var getEntry = function (that, key) {
- // fast case
- var index = fastKey(key);
- var entry;
- if (index !== 'F') return that._i[index];
- // frozen object case
- for (entry = that._f; entry; entry = entry.n) {
- if (entry.k == key) return entry;
- }
- };
- var _collectionStrong = {
- getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {
- var C = wrapper(function (that, iterable) {
- _anInstance(that, C, NAME, '_i');
- that._t = NAME; // collection type
- that._i = _objectCreate(null); // index
- that._f = undefined; // first entry
- that._l = undefined; // last entry
- that[SIZE] = 0; // size
- if (iterable != undefined) _forOf(iterable, IS_MAP, that[ADDER], that);
- });
- _redefineAll(C.prototype, {
- // 23.1.3.1 Map.prototype.clear()
- // 23.2.3.2 Set.prototype.clear()
- clear: function clear() {
- for (var that = _validateCollection(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) {
- entry.r = true;
- if (entry.p) entry.p = entry.p.n = undefined;
- delete data[entry.i];
- }
- that._f = that._l = undefined;
- that[SIZE] = 0;
- },
- // 23.1.3.3 Map.prototype.delete(key)
- // 23.2.3.4 Set.prototype.delete(value)
- 'delete': function (key) {
- var that = _validateCollection(this, NAME);
- var entry = getEntry(that, key);
- if (entry) {
- var next = entry.n;
- var prev = entry.p;
- delete that._i[entry.i];
- entry.r = true;
- if (prev) prev.n = next;
- if (next) next.p = prev;
- if (that._f == entry) that._f = next;
- if (that._l == entry) that._l = prev;
- that[SIZE]--;
- } return !!entry;
- },
- // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
- // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
- forEach: function forEach(callbackfn /* , that = undefined */) {
- _validateCollection(this, NAME);
- var f = _ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
- var entry;
- while (entry = entry ? entry.n : this._f) {
- f(entry.v, entry.k, this);
- // revert to the last existing entry
- while (entry && entry.r) entry = entry.p;
- }
- },
- // 23.1.3.7 Map.prototype.has(key)
- // 23.2.3.7 Set.prototype.has(value)
- has: function has(key) {
- return !!getEntry(_validateCollection(this, NAME), key);
- }
- });
- if (_descriptors) dP$2(C.prototype, 'size', {
- get: function () {
- return _validateCollection(this, NAME)[SIZE];
- }
- });
- return C;
- },
- def: function (that, key, value) {
- var entry = getEntry(that, key);
- var prev, index;
- // change existing entry
- if (entry) {
- entry.v = value;
- // create new entry
- } else {
- that._l = entry = {
- i: index = fastKey(key, true), // <- index
- k: key, // <- key
- v: value, // <- value
- p: prev = that._l, // <- previous entry
- n: undefined, // <- next entry
- r: false // <- removed
- };
- if (!that._f) that._f = entry;
- if (prev) prev.n = entry;
- that[SIZE]++;
- // add to index
- if (index !== 'F') that._i[index] = entry;
- } return that;
- },
- getEntry: getEntry,
- setStrong: function (C, NAME, IS_MAP) {
- // add .keys, .values, .entries, [@@iterator]
- // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
- _iterDefine(C, NAME, function (iterated, kind) {
- this._t = _validateCollection(iterated, NAME); // target
- this._k = kind; // kind
- this._l = undefined; // previous
- }, function () {
- var that = this;
- var kind = that._k;
- var entry = that._l;
- // revert to the last existing entry
- while (entry && entry.r) entry = entry.p;
- // get next entry
- if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) {
- // or finish the iteration
- that._t = undefined;
- return _iterStep(1);
- }
- // return step by kind
- if (kind == 'keys') return _iterStep(0, entry.k);
- if (kind == 'values') return _iterStep(0, entry.v);
- return _iterStep(0, [entry.k, entry.v]);
- }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
- // add [@@species], 23.1.2.2, 23.2.2.2
- _setSpecies(NAME);
- }
- };
- var SPECIES$2 = _wks('species');
- var _arraySpeciesConstructor = function (original) {
- var C;
- if (_isArray(original)) {
- C = original.constructor;
- // cross-realm fallback
- if (typeof C == 'function' && (C === Array || _isArray(C.prototype))) C = undefined;
- if (_isObject(C)) {
- C = C[SPECIES$2];
- if (C === null) C = undefined;
- }
- } return C === undefined ? Array : C;
- };
- // 9.4.2.3 ArraySpeciesCreate(originalArray, length)
- var _arraySpeciesCreate = function (original, length) {
- return new (_arraySpeciesConstructor(original))(length);
- };
- // 0 -> Array#forEach
- // 1 -> Array#map
- // 2 -> Array#filter
- // 3 -> Array#some
- // 4 -> Array#every
- // 5 -> Array#find
- // 6 -> Array#findIndex
- var _arrayMethods = function (TYPE, $create) {
- var IS_MAP = TYPE == 1;
- var IS_FILTER = TYPE == 2;
- var IS_SOME = TYPE == 3;
- var IS_EVERY = TYPE == 4;
- var IS_FIND_INDEX = TYPE == 6;
- var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
- var create = $create || _arraySpeciesCreate;
- return function ($this, callbackfn, that) {
- var O = _toObject($this);
- var self = _iobject(O);
- var f = _ctx(callbackfn, that, 3);
- var length = _toLength(self.length);
- var index = 0;
- var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
- var val, res;
- for (;length > index; index++) if (NO_HOLES || index in self) {
- val = self[index];
- res = f(val, index, O);
- if (TYPE) {
- if (IS_MAP) result[index] = res; // map
- else if (res) switch (TYPE) {
- case 3: return true; // some
- case 5: return val; // find
- case 6: return index; // findIndex
- case 2: result.push(val); // filter
- } else if (IS_EVERY) return false; // every
- }
- }
- return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
- };
- };
- var dP$3 = _objectDp.f;
- var each = _arrayMethods(0);
- var _collection = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
- var Base = _global[NAME];
- var C = Base;
- var ADDER = IS_MAP ? 'set' : 'add';
- var proto = C && C.prototype;
- var O = {};
- if (!_descriptors || typeof C != 'function' || !(IS_WEAK || proto.forEach && !_fails(function () {
- new C().entries().next();
- }))) {
- // create collection constructor
- C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
- _redefineAll(C.prototype, methods);
- _meta.NEED = true;
- } else {
- C = wrapper(function (target, iterable) {
- _anInstance(target, C, NAME, '_c');
- target._c = new Base();
- if (iterable != undefined) _forOf(iterable, IS_MAP, target[ADDER], target);
- });
- each('add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON'.split(','), function (KEY) {
- var IS_ADDER = KEY == 'add' || KEY == 'set';
- if (KEY in proto && !(IS_WEAK && KEY == 'clear')) _hide(C.prototype, KEY, function (a, b) {
- _anInstance(this, C, KEY);
- if (!IS_ADDER && IS_WEAK && !_isObject(a)) return KEY == 'get' ? undefined : false;
- var result = this._c[KEY](a === 0 ? 0 : a, b);
- return IS_ADDER ? this : result;
- });
- });
- IS_WEAK || dP$3(C.prototype, 'size', {
- get: function () {
- return this._c.size;
- }
- });
- }
- _setToStringTag(C, NAME);
- O[NAME] = C;
- _export(_export.G + _export.W + _export.F, O);
- if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);
- return C;
- };
- var MAP = 'Map';
- // 23.1 Map Objects
- var es6_map = _collection(MAP, function (get) {
- return function Map() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
- }, {
- // 23.1.3.6 Map.prototype.get(key)
- get: function get(key) {
- var entry = _collectionStrong.getEntry(_validateCollection(this, MAP), key);
- return entry && entry.v;
- },
- // 23.1.3.9 Map.prototype.set(key, value)
- set: function set(key, value) {
- return _collectionStrong.def(_validateCollection(this, MAP), key === 0 ? 0 : key, value);
- }
- }, _collectionStrong, true);
- var _arrayFromIterable = function (iter, ITERATOR) {
- var result = [];
- _forOf(iter, false, result.push, result, ITERATOR);
- return result;
- };
- // https://github.com/DavidBruant/Map-Set.prototype.toJSON
- var _collectionToJson = function (NAME) {
- return function toJSON() {
- if (_classof(this) != NAME) throw TypeError(NAME + "#toJSON isn't generic");
- return _arrayFromIterable(this);
- };
- };
- // https://github.com/DavidBruant/Map-Set.prototype.toJSON
- _export(_export.P + _export.R, 'Map', { toJSON: _collectionToJson('Map') });
- // https://tc39.github.io/proposal-setmap-offrom/
- var _setCollectionOf = function (COLLECTION) {
- _export(_export.S, COLLECTION, { of: function of() {
- var length = arguments.length;
- var A = new Array(length);
- while (length--) A[length] = arguments[length];
- return new this(A);
- } });
- };
- // https://tc39.github.io/proposal-setmap-offrom/#sec-map.of
- _setCollectionOf('Map');
- // https://tc39.github.io/proposal-setmap-offrom/
- var _setCollectionFrom = function (COLLECTION) {
- _export(_export.S, COLLECTION, { from: function from(source /* , mapFn, thisArg */) {
- var mapFn = arguments[1];
- var mapping, A, n, cb;
- _aFunction(this);
- mapping = mapFn !== undefined;
- if (mapping) _aFunction(mapFn);
- if (source == undefined) return new this();
- A = [];
- if (mapping) {
- n = 0;
- cb = _ctx(mapFn, arguments[2], 2);
- _forOf(source, false, function (nextItem) {
- A.push(cb(nextItem, n++));
- });
- } else {
- _forOf(source, false, A.push, A);
- }
- return new this(A);
- } });
- };
- // https://tc39.github.io/proposal-setmap-offrom/#sec-map.from
- _setCollectionFrom('Map');
- var map = _core.Map;
- var map$1 = createCommonjsModule(function (module) {
- module.exports = { "default": map, __esModule: true };
- });
- var _Map = unwrapExports(map$1);
- var colorName = {
- "aliceblue": [240, 248, 255],
- "antiquewhite": [250, 235, 215],
- "aqua": [0, 255, 255],
- "aquamarine": [127, 255, 212],
- "azure": [240, 255, 255],
- "beige": [245, 245, 220],
- "bisque": [255, 228, 196],
- "black": [0, 0, 0],
- "blanchedalmond": [255, 235, 205],
- "blue": [0, 0, 255],
- "blueviolet": [138, 43, 226],
- "brown": [165, 42, 42],
- "burlywood": [222, 184, 135],
- "cadetblue": [95, 158, 160],
- "chartreuse": [127, 255, 0],
- "chocolate": [210, 105, 30],
- "coral": [255, 127, 80],
- "cornflowerblue": [100, 149, 237],
- "cornsilk": [255, 248, 220],
- "crimson": [220, 20, 60],
- "cyan": [0, 255, 255],
- "darkblue": [0, 0, 139],
- "darkcyan": [0, 139, 139],
- "darkgoldenrod": [184, 134, 11],
- "darkgray": [169, 169, 169],
- "darkgreen": [0, 100, 0],
- "darkgrey": [169, 169, 169],
- "darkkhaki": [189, 183, 107],
- "darkmagenta": [139, 0, 139],
- "darkolivegreen": [85, 107, 47],
- "darkorange": [255, 140, 0],
- "darkorchid": [153, 50, 204],
- "darkred": [139, 0, 0],
- "darksalmon": [233, 150, 122],
- "darkseagreen": [143, 188, 143],
- "darkslateblue": [72, 61, 139],
- "darkslategray": [47, 79, 79],
- "darkslategrey": [47, 79, 79],
- "darkturquoise": [0, 206, 209],
- "darkviolet": [148, 0, 211],
- "deeppink": [255, 20, 147],
- "deepskyblue": [0, 191, 255],
- "dimgray": [105, 105, 105],
- "dimgrey": [105, 105, 105],
- "dodgerblue": [30, 144, 255],
- "firebrick": [178, 34, 34],
- "floralwhite": [255, 250, 240],
- "forestgreen": [34, 139, 34],
- "fuchsia": [255, 0, 255],
- "gainsboro": [220, 220, 220],
- "ghostwhite": [248, 248, 255],
- "gold": [255, 215, 0],
- "goldenrod": [218, 165, 32],
- "gray": [128, 128, 128],
- "green": [0, 128, 0],
- "greenyellow": [173, 255, 47],
- "grey": [128, 128, 128],
- "honeydew": [240, 255, 240],
- "hotpink": [255, 105, 180],
- "indianred": [205, 92, 92],
- "indigo": [75, 0, 130],
- "ivory": [255, 255, 240],
- "khaki": [240, 230, 140],
- "lavender": [230, 230, 250],
- "lavenderblush": [255, 240, 245],
- "lawngreen": [124, 252, 0],
- "lemonchiffon": [255, 250, 205],
- "lightblue": [173, 216, 230],
- "lightcoral": [240, 128, 128],
- "lightcyan": [224, 255, 255],
- "lightgoldenrodyellow": [250, 250, 210],
- "lightgray": [211, 211, 211],
- "lightgreen": [144, 238, 144],
- "lightgrey": [211, 211, 211],
- "lightpink": [255, 182, 193],
- "lightsalmon": [255, 160, 122],
- "lightseagreen": [32, 178, 170],
- "lightskyblue": [135, 206, 250],
- "lightslategray": [119, 136, 153],
- "lightslategrey": [119, 136, 153],
- "lightsteelblue": [176, 196, 222],
- "lightyellow": [255, 255, 224],
- "lime": [0, 255, 0],
- "limegreen": [50, 205, 50],
- "linen": [250, 240, 230],
- "magenta": [255, 0, 255],
- "maroon": [128, 0, 0],
- "mediumaquamarine": [102, 205, 170],
- "mediumblue": [0, 0, 205],
- "mediumorchid": [186, 85, 211],
- "mediumpurple": [147, 112, 219],
- "mediumseagreen": [60, 179, 113],
- "mediumslateblue": [123, 104, 238],
- "mediumspringgreen": [0, 250, 154],
- "mediumturquoise": [72, 209, 204],
- "mediumvioletred": [199, 21, 133],
- "midnightblue": [25, 25, 112],
- "mintcream": [245, 255, 250],
- "mistyrose": [255, 228, 225],
- "moccasin": [255, 228, 181],
- "navajowhite": [255, 222, 173],
- "navy": [0, 0, 128],
- "oldlace": [253, 245, 230],
- "olive": [128, 128, 0],
- "olivedrab": [107, 142, 35],
- "orange": [255, 165, 0],
- "orangered": [255, 69, 0],
- "orchid": [218, 112, 214],
- "palegoldenrod": [238, 232, 170],
- "palegreen": [152, 251, 152],
- "paleturquoise": [175, 238, 238],
- "palevioletred": [219, 112, 147],
- "papayawhip": [255, 239, 213],
- "peachpuff": [255, 218, 185],
- "peru": [205, 133, 63],
- "pink": [255, 192, 203],
- "plum": [221, 160, 221],
- "powderblue": [176, 224, 230],
- "purple": [128, 0, 128],
- "rebeccapurple": [102, 51, 153],
- "red": [255, 0, 0],
- "rosybrown": [188, 143, 143],
- "royalblue": [65, 105, 225],
- "saddlebrown": [139, 69, 19],
- "salmon": [250, 128, 114],
- "sandybrown": [244, 164, 96],
- "seagreen": [46, 139, 87],
- "seashell": [255, 245, 238],
- "sienna": [160, 82, 45],
- "silver": [192, 192, 192],
- "skyblue": [135, 206, 235],
- "slateblue": [106, 90, 205],
- "slategray": [112, 128, 144],
- "slategrey": [112, 128, 144],
- "snow": [255, 250, 250],
- "springgreen": [0, 255, 127],
- "steelblue": [70, 130, 180],
- "tan": [210, 180, 140],
- "teal": [0, 128, 128],
- "thistle": [216, 191, 216],
- "tomato": [255, 99, 71],
- "turquoise": [64, 224, 208],
- "violet": [238, 130, 238],
- "wheat": [245, 222, 179],
- "white": [255, 255, 255],
- "whitesmoke": [245, 245, 245],
- "yellow": [255, 255, 0],
- "yellowgreen": [154, 205, 50]
- };
- var conversions = createCommonjsModule(function (module) {
- /* MIT license */
- // NOTE: conversions should only return primitive values (i.e. arrays, or
- // values that give correct `typeof` results).
- // do not use box values types (i.e. Number(), String(), etc.)
- var reverseKeywords = {};
- for (var key in colorName) {
- if (colorName.hasOwnProperty(key)) {
- reverseKeywords[colorName[key]] = key;
- }
- }
- var convert = module.exports = {
- rgb: {channels: 3, labels: 'rgb'},
- hsl: {channels: 3, labels: 'hsl'},
- hsv: {channels: 3, labels: 'hsv'},
- hwb: {channels: 3, labels: 'hwb'},
- cmyk: {channels: 4, labels: 'cmyk'},
- xyz: {channels: 3, labels: 'xyz'},
- lab: {channels: 3, labels: 'lab'},
- lch: {channels: 3, labels: 'lch'},
- hex: {channels: 1, labels: ['hex']},
- keyword: {channels: 1, labels: ['keyword']},
- ansi16: {channels: 1, labels: ['ansi16']},
- ansi256: {channels: 1, labels: ['ansi256']},
- hcg: {channels: 3, labels: ['h', 'c', 'g']},
- apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
- gray: {channels: 1, labels: ['gray']}
- };
- // hide .channels and .labels properties
- for (var model in convert) {
- if (convert.hasOwnProperty(model)) {
- if (!('channels' in convert[model])) {
- throw new Error('missing channels property: ' + model);
- }
- if (!('labels' in convert[model])) {
- throw new Error('missing channel labels property: ' + model);
- }
- if (convert[model].labels.length !== convert[model].channels) {
- throw new Error('channel and label counts mismatch: ' + model);
- }
- var channels = convert[model].channels;
- var labels = convert[model].labels;
- delete convert[model].channels;
- delete convert[model].labels;
- Object.defineProperty(convert[model], 'channels', {value: channels});
- Object.defineProperty(convert[model], 'labels', {value: labels});
- }
- }
- convert.rgb.hsl = function (rgb) {
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255;
- var min = Math.min(r, g, b);
- var max = Math.max(r, g, b);
- var delta = max - min;
- var h;
- var s;
- var l;
- if (max === min) {
- h = 0;
- } else if (r === max) {
- h = (g - b) / delta;
- } else if (g === max) {
- h = 2 + (b - r) / delta;
- } else if (b === max) {
- h = 4 + (r - g) / delta;
- }
- h = Math.min(h * 60, 360);
- if (h < 0) {
- h += 360;
- }
- l = (min + max) / 2;
- if (max === min) {
- s = 0;
- } else if (l <= 0.5) {
- s = delta / (max + min);
- } else {
- s = delta / (2 - max - min);
- }
- return [h, s * 100, l * 100];
- };
- convert.rgb.hsv = function (rgb) {
- var rdif;
- var gdif;
- var bdif;
- var h;
- var s;
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255;
- var v = Math.max(r, g, b);
- var diff = v - Math.min(r, g, b);
- var diffc = function (c) {
- return (v - c) / 6 / diff + 1 / 2;
- };
- if (diff === 0) {
- h = s = 0;
- } else {
- s = diff / v;
- rdif = diffc(r);
- gdif = diffc(g);
- bdif = diffc(b);
- if (r === v) {
- h = bdif - gdif;
- } else if (g === v) {
- h = (1 / 3) + rdif - bdif;
- } else if (b === v) {
- h = (2 / 3) + gdif - rdif;
- }
- if (h < 0) {
- h += 1;
- } else if (h > 1) {
- h -= 1;
- }
- }
- return [
- h * 360,
- s * 100,
- v * 100
- ];
- };
- convert.rgb.hwb = function (rgb) {
- var r = rgb[0];
- var g = rgb[1];
- var b = rgb[2];
- var h = convert.rgb.hsl(rgb)[0];
- var w = 1 / 255 * Math.min(r, Math.min(g, b));
- b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
- return [h, w * 100, b * 100];
- };
- convert.rgb.cmyk = function (rgb) {
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255;
- var c;
- var m;
- var y;
- var k;
- k = Math.min(1 - r, 1 - g, 1 - b);
- c = (1 - r - k) / (1 - k) || 0;
- m = (1 - g - k) / (1 - k) || 0;
- y = (1 - b - k) / (1 - k) || 0;
- return [c * 100, m * 100, y * 100, k * 100];
- };
- /**
- * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
- * */
- function comparativeDistance(x, y) {
- return (
- Math.pow(x[0] - y[0], 2) +
- Math.pow(x[1] - y[1], 2) +
- Math.pow(x[2] - y[2], 2)
- );
- }
- convert.rgb.keyword = function (rgb) {
- var reversed = reverseKeywords[rgb];
- if (reversed) {
- return reversed;
- }
- var currentClosestDistance = Infinity;
- var currentClosestKeyword;
- for (var keyword in colorName) {
- if (colorName.hasOwnProperty(keyword)) {
- var value = colorName[keyword];
- // Compute comparative distance
- var distance = comparativeDistance(rgb, value);
- // Check if its less, if so set as closest
- if (distance < currentClosestDistance) {
- currentClosestDistance = distance;
- currentClosestKeyword = keyword;
- }
- }
- }
- return currentClosestKeyword;
- };
- convert.keyword.rgb = function (keyword) {
- return colorName[keyword];
- };
- convert.rgb.xyz = function (rgb) {
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255;
- // assume sRGB
- r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
- g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
- b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
- var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
- var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
- var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
- return [x * 100, y * 100, z * 100];
- };
- convert.rgb.lab = function (rgb) {
- var xyz = convert.rgb.xyz(rgb);
- var x = xyz[0];
- var y = xyz[1];
- var z = xyz[2];
- var l;
- var a;
- var b;
- x /= 95.047;
- y /= 100;
- z /= 108.883;
- x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
- y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
- z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
- l = (116 * y) - 16;
- a = 500 * (x - y);
- b = 200 * (y - z);
- return [l, a, b];
- };
- convert.hsl.rgb = function (hsl) {
- var h = hsl[0] / 360;
- var s = hsl[1] / 100;
- var l = hsl[2] / 100;
- var t1;
- var t2;
- var t3;
- var rgb;
- var val;
- if (s === 0) {
- val = l * 255;
- return [val, val, val];
- }
- if (l < 0.5) {
- t2 = l * (1 + s);
- } else {
- t2 = l + s - l * s;
- }
- t1 = 2 * l - t2;
- rgb = [0, 0, 0];
- for (var i = 0; i < 3; i++) {
- t3 = h + 1 / 3 * -(i - 1);
- if (t3 < 0) {
- t3++;
- }
- if (t3 > 1) {
- t3--;
- }
- if (6 * t3 < 1) {
- val = t1 + (t2 - t1) * 6 * t3;
- } else if (2 * t3 < 1) {
- val = t2;
- } else if (3 * t3 < 2) {
- val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
- } else {
- val = t1;
- }
- rgb[i] = val * 255;
- }
- return rgb;
- };
- convert.hsl.hsv = function (hsl) {
- var h = hsl[0];
- var s = hsl[1] / 100;
- var l = hsl[2] / 100;
- var smin = s;
- var lmin = Math.max(l, 0.01);
- var sv;
- var v;
- l *= 2;
- s *= (l <= 1) ? l : 2 - l;
- smin *= lmin <= 1 ? lmin : 2 - lmin;
- v = (l + s) / 2;
- sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
- return [h, sv * 100, v * 100];
- };
- convert.hsv.rgb = function (hsv) {
- var h = hsv[0] / 60;
- var s = hsv[1] / 100;
- var v = hsv[2] / 100;
- var hi = Math.floor(h) % 6;
- var f = h - Math.floor(h);
- var p = 255 * v * (1 - s);
- var q = 255 * v * (1 - (s * f));
- var t = 255 * v * (1 - (s * (1 - f)));
- v *= 255;
- switch (hi) {
- case 0:
- return [v, t, p];
- case 1:
- return [q, v, p];
- case 2:
- return [p, v, t];
- case 3:
- return [p, q, v];
- case 4:
- return [t, p, v];
- case 5:
- return [v, p, q];
- }
- };
- convert.hsv.hsl = function (hsv) {
- var h = hsv[0];
- var s = hsv[1] / 100;
- var v = hsv[2] / 100;
- var vmin = Math.max(v, 0.01);
- var lmin;
- var sl;
- var l;
- l = (2 - s) * v;
- lmin = (2 - s) * vmin;
- sl = s * vmin;
- sl /= (lmin <= 1) ? lmin : 2 - lmin;
- sl = sl || 0;
- l /= 2;
- return [h, sl * 100, l * 100];
- };
- // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
- convert.hwb.rgb = function (hwb) {
- var h = hwb[0] / 360;
- var wh = hwb[1] / 100;
- var bl = hwb[2] / 100;
- var ratio = wh + bl;
- var i;
- var v;
- var f;
- var n;
- // wh + bl cant be > 1
- if (ratio > 1) {
- wh /= ratio;
- bl /= ratio;
- }
- i = Math.floor(6 * h);
- v = 1 - bl;
- f = 6 * h - i;
- if ((i & 0x01) !== 0) {
- f = 1 - f;
- }
- n = wh + f * (v - wh); // linear interpolation
- var r;
- var g;
- var b;
- switch (i) {
- default:
- case 6:
- case 0: r = v; g = n; b = wh; break;
- case 1: r = n; g = v; b = wh; break;
- case 2: r = wh; g = v; b = n; break;
- case 3: r = wh; g = n; b = v; break;
- case 4: r = n; g = wh; b = v; break;
- case 5: r = v; g = wh; b = n; break;
- }
- return [r * 255, g * 255, b * 255];
- };
- convert.cmyk.rgb = function (cmyk) {
- var c = cmyk[0] / 100;
- var m = cmyk[1] / 100;
- var y = cmyk[2] / 100;
- var k = cmyk[3] / 100;
- var r;
- var g;
- var b;
- r = 1 - Math.min(1, c * (1 - k) + k);
- g = 1 - Math.min(1, m * (1 - k) + k);
- b = 1 - Math.min(1, y * (1 - k) + k);
- return [r * 255, g * 255, b * 255];
- };
- convert.xyz.rgb = function (xyz) {
- var x = xyz[0] / 100;
- var y = xyz[1] / 100;
- var z = xyz[2] / 100;
- var r;
- var g;
- var b;
- r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
- g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
- b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
- // assume sRGB
- r = r > 0.0031308
- ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
- : r * 12.92;
- g = g > 0.0031308
- ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
- : g * 12.92;
- b = b > 0.0031308
- ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
- : b * 12.92;
- r = Math.min(Math.max(0, r), 1);
- g = Math.min(Math.max(0, g), 1);
- b = Math.min(Math.max(0, b), 1);
- return [r * 255, g * 255, b * 255];
- };
- convert.xyz.lab = function (xyz) {
- var x = xyz[0];
- var y = xyz[1];
- var z = xyz[2];
- var l;
- var a;
- var b;
- x /= 95.047;
- y /= 100;
- z /= 108.883;
- x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
- y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
- z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
- l = (116 * y) - 16;
- a = 500 * (x - y);
- b = 200 * (y - z);
- return [l, a, b];
- };
- convert.lab.xyz = function (lab) {
- var l = lab[0];
- var a = lab[1];
- var b = lab[2];
- var x;
- var y;
- var z;
- y = (l + 16) / 116;
- x = a / 500 + y;
- z = y - b / 200;
- var y2 = Math.pow(y, 3);
- var x2 = Math.pow(x, 3);
- var z2 = Math.pow(z, 3);
- y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
- x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
- z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
- x *= 95.047;
- y *= 100;
- z *= 108.883;
- return [x, y, z];
- };
- convert.lab.lch = function (lab) {
- var l = lab[0];
- var a = lab[1];
- var b = lab[2];
- var hr;
- var h;
- var c;
- hr = Math.atan2(b, a);
- h = hr * 360 / 2 / Math.PI;
- if (h < 0) {
- h += 360;
- }
- c = Math.sqrt(a * a + b * b);
- return [l, c, h];
- };
- convert.lch.lab = function (lch) {
- var l = lch[0];
- var c = lch[1];
- var h = lch[2];
- var a;
- var b;
- var hr;
- hr = h / 360 * 2 * Math.PI;
- a = c * Math.cos(hr);
- b = c * Math.sin(hr);
- return [l, a, b];
- };
- convert.rgb.ansi16 = function (args) {
- var r = args[0];
- var g = args[1];
- var b = args[2];
- var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
- value = Math.round(value / 50);
- if (value === 0) {
- return 30;
- }
- var ansi = 30
- + ((Math.round(b / 255) << 2)
- | (Math.round(g / 255) << 1)
- | Math.round(r / 255));
- if (value === 2) {
- ansi += 60;
- }
- return ansi;
- };
- convert.hsv.ansi16 = function (args) {
- // optimization here; we already know the value and don't need to get
- // it converted for us.
- return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
- };
- convert.rgb.ansi256 = function (args) {
- var r = args[0];
- var g = args[1];
- var b = args[2];
- // we use the extended greyscale palette here, with the exception of
- // black and white. normal palette only has 4 greyscale shades.
- if (r === g && g === b) {
- if (r < 8) {
- return 16;
- }
- if (r > 248) {
- return 231;
- }
- return Math.round(((r - 8) / 247) * 24) + 232;
- }
- var ansi = 16
- + (36 * Math.round(r / 255 * 5))
- + (6 * Math.round(g / 255 * 5))
- + Math.round(b / 255 * 5);
- return ansi;
- };
- convert.ansi16.rgb = function (args) {
- var color = args % 10;
- // handle greyscale
- if (color === 0 || color === 7) {
- if (args > 50) {
- color += 3.5;
- }
- color = color / 10.5 * 255;
- return [color, color, color];
- }
- var mult = (~~(args > 50) + 1) * 0.5;
- var r = ((color & 1) * mult) * 255;
- var g = (((color >> 1) & 1) * mult) * 255;
- var b = (((color >> 2) & 1) * mult) * 255;
- return [r, g, b];
- };
- convert.ansi256.rgb = function (args) {
- // handle greyscale
- if (args >= 232) {
- var c = (args - 232) * 10 + 8;
- return [c, c, c];
- }
- args -= 16;
- var rem;
- var r = Math.floor(args / 36) / 5 * 255;
- var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
- var b = (rem % 6) / 5 * 255;
- return [r, g, b];
- };
- convert.rgb.hex = function (args) {
- var integer = ((Math.round(args[0]) & 0xFF) << 16)
- + ((Math.round(args[1]) & 0xFF) << 8)
- + (Math.round(args[2]) & 0xFF);
- var string = integer.toString(16).toUpperCase();
- return '000000'.substring(string.length) + string;
- };
- convert.hex.rgb = function (args) {
- var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
- if (!match) {
- return [0, 0, 0];
- }
- var colorString = match[0];
- if (match[0].length === 3) {
- colorString = colorString.split('').map(function (char) {
- return char + char;
- }).join('');
- }
- var integer = parseInt(colorString, 16);
- var r = (integer >> 16) & 0xFF;
- var g = (integer >> 8) & 0xFF;
- var b = integer & 0xFF;
- return [r, g, b];
- };
- convert.rgb.hcg = function (rgb) {
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255;
- var max = Math.max(Math.max(r, g), b);
- var min = Math.min(Math.min(r, g), b);
- var chroma = (max - min);
- var grayscale;
- var hue;
- if (chroma < 1) {
- grayscale = min / (1 - chroma);
- } else {
- grayscale = 0;
- }
- if (chroma <= 0) {
- hue = 0;
- } else
- if (max === r) {
- hue = ((g - b) / chroma) % 6;
- } else
- if (max === g) {
- hue = 2 + (b - r) / chroma;
- } else {
- hue = 4 + (r - g) / chroma + 4;
- }
- hue /= 6;
- hue %= 1;
- return [hue * 360, chroma * 100, grayscale * 100];
- };
- convert.hsl.hcg = function (hsl) {
- var s = hsl[1] / 100;
- var l = hsl[2] / 100;
- var c = 1;
- var f = 0;
- if (l < 0.5) {
- c = 2.0 * s * l;
- } else {
- c = 2.0 * s * (1.0 - l);
- }
- if (c < 1.0) {
- f = (l - 0.5 * c) / (1.0 - c);
- }
- return [hsl[0], c * 100, f * 100];
- };
- convert.hsv.hcg = function (hsv) {
- var s = hsv[1] / 100;
- var v = hsv[2] / 100;
- var c = s * v;
- var f = 0;
- if (c < 1.0) {
- f = (v - c) / (1 - c);
- }
- return [hsv[0], c * 100, f * 100];
- };
- convert.hcg.rgb = function (hcg) {
- var h = hcg[0] / 360;
- var c = hcg[1] / 100;
- var g = hcg[2] / 100;
- if (c === 0.0) {
- return [g * 255, g * 255, g * 255];
- }
- var pure = [0, 0, 0];
- var hi = (h % 1) * 6;
- var v = hi % 1;
- var w = 1 - v;
- var mg = 0;
- switch (Math.floor(hi)) {
- case 0:
- pure[0] = 1; pure[1] = v; pure[2] = 0; break;
- case 1:
- pure[0] = w; pure[1] = 1; pure[2] = 0; break;
- case 2:
- pure[0] = 0; pure[1] = 1; pure[2] = v; break;
- case 3:
- pure[0] = 0; pure[1] = w; pure[2] = 1; break;
- case 4:
- pure[0] = v; pure[1] = 0; pure[2] = 1; break;
- default:
- pure[0] = 1; pure[1] = 0; pure[2] = w;
- }
- mg = (1.0 - c) * g;
- return [
- (c * pure[0] + mg) * 255,
- (c * pure[1] + mg) * 255,
- (c * pure[2] + mg) * 255
- ];
- };
- convert.hcg.hsv = function (hcg) {
- var c = hcg[1] / 100;
- var g = hcg[2] / 100;
- var v = c + g * (1.0 - c);
- var f = 0;
- if (v > 0.0) {
- f = c / v;
- }
- return [hcg[0], f * 100, v * 100];
- };
- convert.hcg.hsl = function (hcg) {
- var c = hcg[1] / 100;
- var g = hcg[2] / 100;
- var l = g * (1.0 - c) + 0.5 * c;
- var s = 0;
- if (l > 0.0 && l < 0.5) {
- s = c / (2 * l);
- } else
- if (l >= 0.5 && l < 1.0) {
- s = c / (2 * (1 - l));
- }
- return [hcg[0], s * 100, l * 100];
- };
- convert.hcg.hwb = function (hcg) {
- var c = hcg[1] / 100;
- var g = hcg[2] / 100;
- var v = c + g * (1.0 - c);
- return [hcg[0], (v - c) * 100, (1 - v) * 100];
- };
- convert.hwb.hcg = function (hwb) {
- var w = hwb[1] / 100;
- var b = hwb[2] / 100;
- var v = 1 - b;
- var c = v - w;
- var g = 0;
- if (c < 1) {
- g = (v - c) / (1 - c);
- }
- return [hwb[0], c * 100, g * 100];
- };
- convert.apple.rgb = function (apple) {
- return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
- };
- convert.rgb.apple = function (rgb) {
- return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
- };
- convert.gray.rgb = function (args) {
- return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
- };
- convert.gray.hsl = convert.gray.hsv = function (args) {
- return [0, 0, args[0]];
- };
- convert.gray.hwb = function (gray) {
- return [0, 100, gray[0]];
- };
- convert.gray.cmyk = function (gray) {
- return [0, 0, 0, gray[0]];
- };
- convert.gray.lab = function (gray) {
- return [gray[0], 0, 0];
- };
- convert.gray.hex = function (gray) {
- var val = Math.round(gray[0] / 100 * 255) & 0xFF;
- var integer = (val << 16) + (val << 8) + val;
- var string = integer.toString(16).toUpperCase();
- return '000000'.substring(string.length) + string;
- };
- convert.rgb.gray = function (rgb) {
- var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
- return [val / 255 * 100];
- };
- });
- var conversions_1 = conversions.rgb;
- var conversions_2 = conversions.hsl;
- var conversions_3 = conversions.hsv;
- var conversions_4 = conversions.hwb;
- var conversions_5 = conversions.cmyk;
- var conversions_6 = conversions.xyz;
- var conversions_7 = conversions.lab;
- var conversions_8 = conversions.lch;
- var conversions_9 = conversions.hex;
- var conversions_10 = conversions.keyword;
- var conversions_11 = conversions.ansi16;
- var conversions_12 = conversions.ansi256;
- var conversions_13 = conversions.hcg;
- var conversions_14 = conversions.apple;
- var conversions_15 = conversions.gray;
- /*
- this function routes a model to all other models.
- all functions that are routed have a property `.conversion` attached
- to the returned synthetic function. This property is an array
- of strings, each with the steps in between the 'from' and 'to'
- color models (inclusive).
- conversions that are not possible simply are not included.
- */
- function buildGraph() {
- var graph = {};
- // https://jsperf.com/object-keys-vs-for-in-with-closure/3
- var models = Object.keys(conversions);
- for (var len = models.length, i = 0; i < len; i++) {
- graph[models[i]] = {
- // http://jsperf.com/1-vs-infinity
- // micro-opt, but this is simple.
- distance: -1,
- parent: null
- };
- }
- return graph;
- }
- // https://en.wikipedia.org/wiki/Breadth-first_search
- function deriveBFS(fromModel) {
- var graph = buildGraph();
- var queue = [fromModel]; // unshift -> queue -> pop
- graph[fromModel].distance = 0;
- while (queue.length) {
- var current = queue.pop();
- var adjacents = Object.keys(conversions[current]);
- for (var len = adjacents.length, i = 0; i < len; i++) {
- var adjacent = adjacents[i];
- var node = graph[adjacent];
- if (node.distance === -1) {
- node.distance = graph[current].distance + 1;
- node.parent = current;
- queue.unshift(adjacent);
- }
- }
- }
- return graph;
- }
- function link(from, to) {
- return function (args) {
- return to(from(args));
- };
- }
- function wrapConversion(toModel, graph) {
- var path = [graph[toModel].parent, toModel];
- var fn = conversions[graph[toModel].parent][toModel];
- var cur = graph[toModel].parent;
- while (graph[cur].parent) {
- path.unshift(graph[cur].parent);
- fn = link(conversions[graph[cur].parent][cur], fn);
- cur = graph[cur].parent;
- }
- fn.conversion = path;
- return fn;
- }
- var route = function (fromModel) {
- var graph = deriveBFS(fromModel);
- var conversion = {};
- var models = Object.keys(graph);
- for (var len = models.length, i = 0; i < len; i++) {
- var toModel = models[i];
- var node = graph[toModel];
- if (node.parent === null) {
- // no possible conversion, or this node is the source model.
- continue;
- }
- conversion[toModel] = wrapConversion(toModel, graph);
- }
- return conversion;
- };
- var convert = {};
- var models = Object.keys(conversions);
- function wrapRaw(fn) {
- var wrappedFn = function (args) {
- if (args === undefined || args === null) {
- return args;
- }
- if (arguments.length > 1) {
- args = Array.prototype.slice.call(arguments);
- }
- return fn(args);
- };
- // preserve .conversion property if there is one
- if ('conversion' in fn) {
- wrappedFn.conversion = fn.conversion;
- }
- return wrappedFn;
- }
- function wrapRounded(fn) {
- var wrappedFn = function (args) {
- if (args === undefined || args === null) {
- return args;
- }
- if (arguments.length > 1) {
- args = Array.prototype.slice.call(arguments);
- }
- var result = fn(args);
- // we're assuming the result is an array here.
- // see notice in conversions.js; don't use box types
- // in conversion functions.
- if (typeof result === 'object') {
- for (var len = result.length, i = 0; i < len; i++) {
- result[i] = Math.round(result[i]);
- }
- }
- return result;
- };
- // preserve .conversion property if there is one
- if ('conversion' in fn) {
- wrappedFn.conversion = fn.conversion;
- }
- return wrappedFn;
- }
- models.forEach(function (fromModel) {
- convert[fromModel] = {};
- Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
- Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
- var routes = route(fromModel);
- var routeModels = Object.keys(routes);
- routeModels.forEach(function (toModel) {
- var fn = routes[toModel];
- convert[fromModel][toModel] = wrapRounded(fn);
- convert[fromModel][toModel].raw = wrapRaw(fn);
- });
- });
- var colorConvert = convert;
- var ansiStyles = createCommonjsModule(function (module) {
- var wrapAnsi16 = function wrapAnsi16(fn, offset) {
- return function () {
- var code = fn.apply(colorConvert, arguments);
- return '\x1B[' + (code + offset) + 'm';
- };
- };
- var wrapAnsi256 = function wrapAnsi256(fn, offset) {
- return function () {
- var code = fn.apply(colorConvert, arguments);
- return '\x1B[' + (38 + offset) + ';5;' + code + 'm';
- };
- };
- var wrapAnsi16m = function wrapAnsi16m(fn, offset) {
- return function () {
- var rgb = fn.apply(colorConvert, arguments);
- return '\x1B[' + (38 + offset) + ';2;' + rgb[0] + ';' + rgb[1] + ';' + rgb[2] + 'm';
- };
- };
- function assembleStyles() {
- var codes = new _Map();
- var styles = {
- modifier: {
- reset: [0, 0],
- // 21 isn't widely supported and 22 does the same thing
- bold: [1, 22],
- dim: [2, 22],
- italic: [3, 23],
- underline: [4, 24],
- inverse: [7, 27],
- hidden: [8, 28],
- strikethrough: [9, 29]
- },
- color: {
- black: [30, 39],
- red: [31, 39],
- green: [32, 39],
- yellow: [33, 39],
- blue: [34, 39],
- magenta: [35, 39],
- cyan: [36, 39],
- white: [37, 39],
- gray: [90, 39],
- // Bright color
- redBright: [91, 39],
- greenBright: [92, 39],
- yellowBright: [93, 39],
- blueBright: [94, 39],
- magentaBright: [95, 39],
- cyanBright: [96, 39],
- whiteBright: [97, 39]
- },
- bgColor: {
- bgBlack: [40, 49],
- bgRed: [41, 49],
- bgGreen: [42, 49],
- bgYellow: [43, 49],
- bgBlue: [44, 49],
- bgMagenta: [45, 49],
- bgCyan: [46, 49],
- bgWhite: [47, 49],
- // Bright color
- bgBlackBright: [100, 49],
- bgRedBright: [101, 49],
- bgGreenBright: [102, 49],
- bgYellowBright: [103, 49],
- bgBlueBright: [104, 49],
- bgMagentaBright: [105, 49],
- bgCyanBright: [106, 49],
- bgWhiteBright: [107, 49]
- }
- };
- // Fix humans
- styles.color.grey = styles.color.gray;
- var _iteratorNormalCompletion = true;
- var _didIteratorError = false;
- var _iteratorError = undefined;
- try {
- for (var _iterator = _getIterator(_Object$keys(styles)), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
- var groupName = _step.value;
- var group = styles[groupName];
- var _iteratorNormalCompletion3 = true;
- var _didIteratorError3 = false;
- var _iteratorError3 = undefined;
- try {
- for (var _iterator3 = _getIterator(_Object$keys(group)), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
- var styleName = _step3.value;
- var style = group[styleName];
- styles[styleName] = {
- open: '\x1B[' + style[0] + 'm',
- close: '\x1B[' + style[1] + 'm'
- };
- group[styleName] = styles[styleName];
- codes.set(style[0], style[1]);
- }
- } catch (err) {
- _didIteratorError3 = true;
- _iteratorError3 = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion3 && _iterator3.return) {
- _iterator3.return();
- }
- } finally {
- if (_didIteratorError3) {
- throw _iteratorError3;
- }
- }
- }
- _Object$defineProperty(styles, groupName, {
- value: group,
- enumerable: false
- });
- Object.defineProperty(styles, 'codes', {
- value: codes,
- enumerable: false
- });
- }
- } catch (err) {
- _didIteratorError = true;
- _iteratorError = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion && _iterator.return) {
- _iterator.return();
- }
- } finally {
- if (_didIteratorError) {
- throw _iteratorError;
- }
- }
- }
- var ansi2ansi = function ansi2ansi(n) {
- return n;
- };
- var rgb2rgb = function rgb2rgb(r, g, b) {
- return [r, g, b];
- };
- styles.color.close = '\x1B[39m';
- styles.bgColor.close = '\x1B[49m';
- styles.color.ansi = {
- ansi: wrapAnsi16(ansi2ansi, 0)
- };
- styles.color.ansi256 = {
- ansi256: wrapAnsi256(ansi2ansi, 0)
- };
- styles.color.ansi16m = {
- rgb: wrapAnsi16m(rgb2rgb, 0)
- };
- styles.bgColor.ansi = {
- ansi: wrapAnsi16(ansi2ansi, 10)
- };
- styles.bgColor.ansi256 = {
- ansi256: wrapAnsi256(ansi2ansi, 10)
- };
- styles.bgColor.ansi16m = {
- rgb: wrapAnsi16m(rgb2rgb, 10)
- };
- var _iteratorNormalCompletion2 = true;
- var _didIteratorError2 = false;
- var _iteratorError2 = undefined;
- try {
- for (var _iterator2 = _getIterator(_Object$keys(colorConvert)), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
- var key = _step2.value;
- if (_typeof(colorConvert[key]) !== 'object') {
- continue;
- }
- var suite = colorConvert[key];
- if (key === 'ansi16') {
- key = 'ansi';
- }
- if ('ansi16' in suite) {
- styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
- styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
- }
- if ('ansi256' in suite) {
- styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
- styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
- }
- if ('rgb' in suite) {
- styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
- styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
- }
- }
- } catch (err) {
- _didIteratorError2 = true;
- _iteratorError2 = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion2 && _iterator2.return) {
- _iterator2.return();
- }
- } finally {
- if (_didIteratorError2) {
- throw _iteratorError2;
- }
- }
- }
- return styles;
- }
- // Make the export immutable
- Object.defineProperty(module, 'exports', {
- enumerable: true,
- get: assembleStyles
- });
- });
- var fake_chalk = createCommonjsModule(function (module) {
- var _ansiStyles2 = _interopRequireDefault(ansiStyles);
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : { default: obj };
- }
- var returnInput = function returnInput(str) {
- return str;
- };
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
- var allColorsAsFunc = _Object$keys(_ansiStyles2.default).map(function (style) {
- return _defineProperty({}, style, returnInput);
- }).reduce(function (acc, cur) {
- return _Object$assign(acc, cur);
- });
- _Object$keys(allColorsAsFunc).map(function (color) {
- return allColorsAsFunc[color];
- }).forEach(function (style) {
- _Object$assign(style, allColorsAsFunc);
- _Object$assign(returnInput, style);
- });
- module.exports = allColorsAsFunc;
- });
- unwrapExports(fake_chalk);
- var SET = 'Set';
- // 23.2 Set Objects
- var es6_set = _collection(SET, function (get) {
- return function Set() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
- }, {
- // 23.2.3.1 Set.prototype.add(value)
- add: function add(value) {
- return _collectionStrong.def(_validateCollection(this, SET), value = value === 0 ? 0 : value, value);
- }
- }, _collectionStrong);
- // https://github.com/DavidBruant/Map-Set.prototype.toJSON
- _export(_export.P + _export.R, 'Set', { toJSON: _collectionToJson('Set') });
- // https://tc39.github.io/proposal-setmap-offrom/#sec-set.of
- _setCollectionOf('Set');
- // https://tc39.github.io/proposal-setmap-offrom/#sec-set.from
- _setCollectionFrom('Set');
- var set = _core.Set;
- var set$1 = createCommonjsModule(function (module) {
- module.exports = { "default": set, __esModule: true };
- });
- var _Set = unwrapExports(set$1);
- var build = createCommonjsModule(function (module) {
- // get the type of a value with handling the edge cases like `typeof []`
- // and `typeof null`
- var getType = function getType(value) {
- if (value === undefined) {
- return 'undefined';
- } else if (value === null) {
- return 'null';
- } else if (Array.isArray(value)) {
- return 'array';
- } else if (typeof value === 'boolean') {
- return 'boolean';
- } else if (typeof value === 'function') {
- return 'function';
- } else if (typeof value === 'number') {
- return 'number';
- } else if (typeof value === 'string') {
- return 'string';
- } else if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {
- if (value.constructor === RegExp) {
- return 'regexp';
- } else if (value.constructor === _Map) {
- return 'map';
- } else if (value.constructor === _Set) {
- return 'set';
- } else if (value.constructor === Date) {
- return 'date';
- }
- return 'object';
- // $FlowFixMe https://github.com/facebook/flow/issues/1015
- } else if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'symbol') {
- return 'symbol';
- }
- throw new Error('value of unknown type: ' + value);
- };
- module.exports = getType;
- });
- // 7.2.9 SameValue(x, y)
- var _sameValue = Object.is || function is(x, y) {
- // eslint-disable-next-line no-self-compare
- return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
- };
- // 19.1.3.10 Object.is(value1, value2)
- _export(_export.S, 'Object', { is: _sameValue });
- var is$1 = _core.Object.is;
- var is$2 = createCommonjsModule(function (module) {
- module.exports = { "default": is$1, __esModule: true };
- });
- var _Object$is = unwrapExports(is$2);
- var getOwnPropertySymbols = _core.Object.getOwnPropertySymbols;
- var getOwnPropertySymbols$1 = createCommonjsModule(function (module) {
- module.exports = { "default": getOwnPropertySymbols, __esModule: true };
- });
- var _Object$getOwnPropertySymbols = unwrapExports(getOwnPropertySymbols$1);
- var collections = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.printIteratorEntries = printIteratorEntries;
- exports.printIteratorValues = printIteratorValues;
- exports.printListItems = printListItems;
- exports.printObjectProperties = printObjectProperties;
- var getSymbols = _Object$getOwnPropertySymbols || function (obj) {
- return [];
- };
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var isSymbol = function isSymbol(key) {
- return (
- // $FlowFixMe string literal `symbol`. This value is not a valid `typeof` return value
- (typeof key === 'undefined' ? 'undefined' : _typeof(key)) === 'symbol' || toString.call(key) === '[object Symbol]'
- );
- };
- // Return entries (for example, of a map)
- // with spacing, indentation, and comma
- // without surrounding punctuation (for example, braces)
- function printIteratorEntries(
- // Flow 0.51.0: property `@@iterator` of $Iterator not found in Object
- iterator, config, indentation, depth, refs, printer) {
- var separator = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : ': ';
- var result = '';
- var current = iterator.next();
- if (!current.done) {
- result += config.spacingOuter;
- var indentationNext = indentation + config.indent;
- while (!current.done) {
- var name = printer(current.value[0], config, indentationNext, depth, refs);
- var value = printer(current.value[1], config, indentationNext, depth, refs);
- result += indentationNext + name + separator + value;
- current = iterator.next();
- if (!current.done) {
- result += ',' + config.spacingInner;
- } else if (!config.min) {
- result += ',';
- }
- }
- result += config.spacingOuter + indentation;
- }
- return result;
- }
- // Return values (for example, of a set)
- // with spacing, indentation, and comma
- // without surrounding punctuation (braces or brackets)
- function printIteratorValues(iterator, config, indentation, depth, refs, printer) {
- var result = '';
- var current = iterator.next();
- if (!current.done) {
- result += config.spacingOuter;
- var indentationNext = indentation + config.indent;
- while (!current.done) {
- result += indentationNext + printer(current.value, config, indentationNext, depth, refs);
- current = iterator.next();
- if (!current.done) {
- result += ',' + config.spacingInner;
- } else if (!config.min) {
- result += ',';
- }
- }
- result += config.spacingOuter + indentation;
- }
- return result;
- }
- // Return items (for example, of an array)
- // with spacing, indentation, and comma
- // without surrounding punctuation (for example, brackets)
- function printListItems(list, config, indentation, depth, refs, printer) {
- var result = '';
- if (list.length) {
- result += config.spacingOuter;
- var indentationNext = indentation + config.indent;
- for (var i = 0; i < list.length; i++) {
- result += indentationNext + printer(list[i], config, indentationNext, depth, refs);
- if (i < list.length - 1) {
- result += ',' + config.spacingInner;
- } else if (!config.min) {
- result += ',';
- }
- }
- result += config.spacingOuter + indentation;
- }
- return result;
- }
- // Return properties of an object
- // with spacing, indentation, and comma
- // without surrounding punctuation (for example, braces)
- function printObjectProperties(val, config, indentation, depth, refs, printer) {
- var result = '';
- var keys = _Object$keys(val).sort();
- var symbols = getSymbols(val);
- if (symbols.length) {
- keys = keys.filter(function (key) {
- return !isSymbol(key);
- }).concat(symbols);
- }
- if (keys.length) {
- result += config.spacingOuter;
- var indentationNext = indentation + config.indent;
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- var name = printer(key, config, indentationNext, depth, refs);
- var value = printer(val[key], config, indentationNext, depth, refs);
- result += indentationNext + name + ': ' + value;
- if (i < keys.length - 1) {
- result += ',' + config.spacingInner;
- } else if (!config.min) {
- result += ',';
- }
- }
- result += config.spacingOuter + indentation;
- }
- return result;
- }
- });
- unwrapExports(collections);
- var collections_1 = collections.printIteratorEntries;
- var collections_2 = collections.printIteratorValues;
- var collections_3 = collections.printListItems;
- var collections_4 = collections.printObjectProperties;
- var _for = _core.Symbol['for'];
- var _for$1 = createCommonjsModule(function (module) {
- module.exports = { "default": _for, __esModule: true };
- });
- var _Symbol$for = unwrapExports(_for$1);
- var asymmetric_matcher = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.test = exports.serialize = undefined;
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var asymmetricMatcher = _Symbol$for('jest.asymmetricMatcher');
- var SPACE = ' ';
- var serialize = exports.serialize = function (val, config, indentation, depth, refs, printer) {
- var stringedValue = val.toString();
- if (stringedValue === 'ArrayContaining' || stringedValue === 'ArrayNotContaining') {
- if (++depth > config.maxDepth) {
- return '[' + stringedValue + ']';
- }
- return stringedValue + SPACE + '[' + (0, collections.printListItems)(val.sample, config, indentation, depth, refs, printer) + ']';
- }
- if (stringedValue === 'ObjectContaining' || stringedValue === 'ObjectNotContaining') {
- if (++depth > config.maxDepth) {
- return '[' + stringedValue + ']';
- }
- return stringedValue + SPACE + '{' + (0, collections.printObjectProperties)(val.sample, config, indentation, depth, refs, printer) + '}';
- }
- if (stringedValue === 'StringMatching' || stringedValue === 'StringNotMatching') {
- return stringedValue + SPACE + printer(val.sample, config, indentation, depth, refs);
- }
- if (stringedValue === 'StringContaining' || stringedValue === 'StringNotContaining') {
- return stringedValue + SPACE + printer(val.sample, config, indentation, depth, refs);
- }
- return val.toAsymmetricMatcher();
- };
- var test = exports.test = function (val) {
- return val && val.$$typeof === asymmetricMatcher;
- };
- exports.default = { serialize: serialize, test: test };
- });
- unwrapExports(asymmetric_matcher);
- var asymmetric_matcher_1 = asymmetric_matcher.test;
- var asymmetric_matcher_2 = asymmetric_matcher.serialize;
- var ansiRegex = createCommonjsModule(function (module) {
- module.exports = function () {
- var pattern = ['[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)', '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))'].join('|');
- return new RegExp(pattern, 'g');
- };
- });
- var convert_ansi = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.serialize = exports.test = undefined;
- var _ansiRegex2 = _interopRequireDefault(ansiRegex);
- var _ansiStyles2 = _interopRequireDefault(ansiStyles);
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : { default: obj };
- }
- var toHumanReadableAnsi = function toHumanReadableAnsi(text) {
- return text.replace((0, _ansiRegex2.default)(), function (match, offset, string) {
- switch (match) {
- case _ansiStyles2.default.red.close:
- case _ansiStyles2.default.green.close:
- case _ansiStyles2.default.cyan.close:
- case _ansiStyles2.default.gray.close:
- case _ansiStyles2.default.white.close:
- case _ansiStyles2.default.yellow.close:
- case _ansiStyles2.default.bgRed.close:
- case _ansiStyles2.default.bgGreen.close:
- case _ansiStyles2.default.bgYellow.close:
- case _ansiStyles2.default.inverse.close:
- case _ansiStyles2.default.dim.close:
- case _ansiStyles2.default.bold.close:
- case _ansiStyles2.default.reset.open:
- case _ansiStyles2.default.reset.close:
- return '</>';
- case _ansiStyles2.default.red.open:
- return '<red>';
- case _ansiStyles2.default.green.open:
- return '<green>';
- case _ansiStyles2.default.cyan.open:
- return '<cyan>';
- case _ansiStyles2.default.gray.open:
- return '<gray>';
- case _ansiStyles2.default.white.open:
- return '<white>';
- case _ansiStyles2.default.yellow.open:
- return '<yellow>';
- case _ansiStyles2.default.bgRed.open:
- return '<bgRed>';
- case _ansiStyles2.default.bgGreen.open:
- return '<bgGreen>';
- case _ansiStyles2.default.bgYellow.open:
- return '<bgYellow>';
- case _ansiStyles2.default.inverse.open:
- return '<inverse>';
- case _ansiStyles2.default.dim.open:
- return '<dim>';
- case _ansiStyles2.default.bold.open:
- return '<bold>';
- default:
- return '';
- }
- });
- };
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var test = exports.test = function (val) {
- return typeof val === 'string' && val.match((0, _ansiRegex2.default)());
- };
- var serialize = exports.serialize = function (val, config, indentation, depth, refs, printer) {
- return printer(toHumanReadableAnsi(val), config, indentation, depth, refs);
- };
- exports.default = { serialize: serialize, test: test };
- });
- unwrapExports(convert_ansi);
- var convert_ansi_1 = convert_ansi.serialize;
- var convert_ansi_2 = convert_ansi.test;
- var dom_collection = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.serialize = exports.test = undefined;
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var SPACE = ' ';
- var COLLECTION_NAMES = ['DOMStringMap', 'NamedNodeMap'];
- var test = exports.test = function (val) {
- return val && val.constructor && COLLECTION_NAMES.indexOf(val.constructor.name) !== -1;
- };
- var convertCollectionToObject = function convertCollectionToObject(collection) {
- var result = {};
- if (collection.constructor.name === 'NamedNodeMap') {
- for (var i = 0; i < collection.length; i++) {
- result[collection[i].name] = collection[i].value;
- }
- } else {
- result = _Object$assign({}, collection);
- }
- return result;
- };
- var serialize = exports.serialize = function (collection, config, indentation, depth, refs, printer) {
- if (++depth > config.maxDepth) {
- return '[' + collection.constructor.name + ']';
- }
- return collection.constructor.name + SPACE + '{' + (0, collections.printObjectProperties)(convertCollectionToObject(collection), config, indentation, depth, refs, printer) + '}';
- };
- exports.default = { serialize: serialize, test: test };
- });
- unwrapExports(dom_collection);
- var dom_collection_1 = dom_collection.serialize;
- var dom_collection_2 = dom_collection.test;
- var escape_html = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.default = escapeHTML;
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- function escapeHTML(str) {
- return str.replace(/</g, '<').replace(/>/g, '>');
- }
- });
- unwrapExports(escape_html);
- var markup = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.printElementAsLeaf = exports.printElement = exports.printComment = exports.printText = exports.printChildren = exports.printProps = undefined;
- var _escape_html2 = _interopRequireDefault(escape_html);
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : { default: obj };
- }
- // Return empty string if keys is empty.
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var printProps = exports.printProps = function (keys, props, config, indentation, depth, refs, printer) {
- var indentationNext = indentation + config.indent;
- var colors = config.colors;
- return keys.map(function (key) {
- var value = props[key];
- var printed = printer(value, config, indentationNext, depth, refs);
- if (typeof value !== 'string') {
- if (printed.indexOf('\n') !== -1) {
- printed = config.spacingOuter + indentationNext + printed + config.spacingOuter + indentation;
- }
- printed = '{' + printed + '}';
- }
- return config.spacingInner + indentation + colors.prop.open + key + colors.prop.close + '=' + colors.value.open + printed + colors.value.close;
- }).join('');
- };
- // Return empty string if children is empty.
- var printChildren = exports.printChildren = function (children, config, indentation, depth, refs, printer) {
- return children.map(function (child) {
- return config.spacingOuter + indentation + (typeof child === 'string' ? printText(child, config) : printer(child, config, indentation, depth, refs));
- }).join('');
- };
- var printText = exports.printText = function (text, config) {
- var contentColor = config.colors.content;
- return contentColor.open + (0, _escape_html2.default)(text) + contentColor.close;
- };
- var printComment = exports.printComment = function (comment, config) {
- var commentColor = config.colors.comment;
- return commentColor.open + '<!--' + (0, _escape_html2.default)(comment) + '-->' + commentColor.close;
- };
- // Separate the functions to format props, children, and element,
- // so a plugin could override a particular function, if needed.
- // Too bad, so sad: the traditional (but unnecessary) space
- // in a self-closing tagColor requires a second test of printedProps.
- var printElement = exports.printElement = function (type, printedProps, printedChildren, config, indentation) {
- var tagColor = config.colors.tag;
- return tagColor.open + '<' + type + (printedProps && tagColor.close + printedProps + config.spacingOuter + indentation + tagColor.open) + (printedChildren ? '>' + tagColor.close + printedChildren + config.spacingOuter + indentation + tagColor.open + '</' + type : (printedProps && !config.min ? '' : ' ') + '/') + '>' + tagColor.close;
- };
- var printElementAsLeaf = exports.printElementAsLeaf = function (type, config) {
- var tagColor = config.colors.tag;
- return tagColor.open + '<' + type + tagColor.close + ' …' + tagColor.open + ' />' + tagColor.close;
- };
- });
- unwrapExports(markup);
- var markup_1 = markup.printElementAsLeaf;
- var markup_2 = markup.printElement;
- var markup_3 = markup.printComment;
- var markup_4 = markup.printText;
- var markup_5 = markup.printChildren;
- var markup_6 = markup.printProps;
- var dom_element = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.serialize = exports.test = undefined;
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var ELEMENT_NODE = 1;
- var TEXT_NODE = 3;
- var COMMENT_NODE = 8;
- var FRAGMENT_NODE = 11;
- var ELEMENT_REGEXP = /^((HTML|SVG)\w*)?Element$/;
- var testNode = function testNode(nodeType, name) {
- return nodeType === ELEMENT_NODE && ELEMENT_REGEXP.test(name) || nodeType === TEXT_NODE && name === 'Text' || nodeType === COMMENT_NODE && name === 'Comment' || nodeType === FRAGMENT_NODE && name === 'DocumentFragment';
- };
- var test = exports.test = function (val) {
- return val && val.constructor && val.constructor.name && testNode(val.nodeType, val.constructor.name);
- };
- // Convert array of attribute objects to keys array and props object.
- var keysMapper = function keysMapper(attribute) {
- return attribute.name;
- };
- var propsReducer = function propsReducer(props, attribute) {
- props[attribute.name] = attribute.value;
- return props;
- };
- var serialize = exports.serialize = function (node, config, indentation, depth, refs, printer) {
- if (node.nodeType === TEXT_NODE) {
- return (0, markup.printText)(node.data, config);
- }
- if (node.nodeType === COMMENT_NODE) {
- return (0, markup.printComment)(node.data, config);
- }
- var type = node.nodeType === FRAGMENT_NODE ? 'DocumentFragment' : node.tagName.toLowerCase();
- if (++depth > config.maxDepth) {
- return (0, markup.printElementAsLeaf)(type, config);
- }
- return (0, markup.printElement)(type, (0, markup.printProps)(Array.prototype.map.call(node.attributes || [], keysMapper).sort(), Array.prototype.reduce.call(node.attributes || [], propsReducer, {}), config, indentation + config.indent, depth, refs, printer), (0, markup.printChildren)(Array.prototype.slice.call(node.childNodes || node.children), config, indentation + config.indent, depth, refs, printer), config, indentation);
- };
- exports.default = { serialize: serialize, test: test };
- });
- unwrapExports(dom_element);
- var dom_element_1 = dom_element.serialize;
- var dom_element_2 = dom_element.test;
- var immutable = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.test = exports.serialize = undefined;
- // SENTINEL constants are from https://github.com/facebook/immutable-js
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';
- var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';
- var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
- var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';
- var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
- var IS_RECORD_SENTINEL = '@@__IMMUTABLE_RECORD__@@'; // immutable v4
- var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';
- var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
- var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';
- var getImmutableName = function getImmutableName(name) {
- return 'Immutable.' + name;
- };
- var printAsLeaf = function printAsLeaf(name) {
- return '[' + name + ']';
- };
- var SPACE = ' ';
- var LAZY = '…'; // Seq is lazy if it calls a method like filter
- var printImmutableEntries = function printImmutableEntries(val, config, indentation, depth, refs, printer, type) {
- return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : getImmutableName(type) + SPACE + '{' + (0, collections.printIteratorEntries)(val.entries(), config, indentation, depth, refs, printer) + '}';
- };
- // Record has an entries method because it is a collection in immutable v3.
- // Return an iterator for Immutable Record from version v3 or v4.
- var getRecordEntries = function getRecordEntries(val) {
- var i = 0;
- return {
- next: function next() {
- if (i < val._keys.length) {
- var key = val._keys[i++];
- return { done: false, value: [key, val.get(key)] };
- }
- return { done: true };
- }
- };
- };
- var printImmutableRecord = function printImmutableRecord(val, config, indentation, depth, refs, printer) {
- // _name property is defined only for an Immutable Record instance
- // which was constructed with a second optional descriptive name arg
- var name = getImmutableName(val._name || 'Record');
- return ++depth > config.maxDepth ? printAsLeaf(name) : name + SPACE + '{' + (0, collections.printIteratorEntries)(getRecordEntries(val), config, indentation, depth, refs, printer) + '}';
- };
- var printImmutableSeq = function printImmutableSeq(val, config, indentation, depth, refs, printer) {
- var name = getImmutableName('Seq');
- if (++depth > config.maxDepth) {
- return printAsLeaf(name);
- }
- if (val[IS_KEYED_SENTINEL]) {
- return name + SPACE + '{' + (
- // from Immutable collection of entries or from ECMAScript object
- val._iter || val._object ? (0, collections.printIteratorEntries)(val.entries(), config, indentation, depth, refs, printer) : LAZY) + '}';
- }
- return name + SPACE + '[' + (val._iter || // from Immutable collection of values
- val._array || // from ECMAScript array
- val._collection || // from ECMAScript collection in immutable v4
- val._iterable // from ECMAScript collection in immutable v3
- ? (0, collections.printIteratorValues)(val.values(), config, indentation, depth, refs, printer) : LAZY) + ']';
- };
- var printImmutableValues = function printImmutableValues(val, config, indentation, depth, refs, printer, type) {
- return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : getImmutableName(type) + SPACE + '[' + (0, collections.printIteratorValues)(val.values(), config, indentation, depth, refs, printer) + ']';
- };
- var serialize = exports.serialize = function (val, config, indentation, depth, refs, printer) {
- if (val[IS_MAP_SENTINEL]) {
- return printImmutableEntries(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? 'OrderedMap' : 'Map');
- }
- if (val[IS_LIST_SENTINEL]) {
- return printImmutableValues(val, config, indentation, depth, refs, printer, 'List');
- }
- if (val[IS_SET_SENTINEL]) {
- return printImmutableValues(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? 'OrderedSet' : 'Set');
- }
- if (val[IS_STACK_SENTINEL]) {
- return printImmutableValues(val, config, indentation, depth, refs, printer, 'Stack');
- }
- if (val[IS_SEQ_SENTINEL]) {
- return printImmutableSeq(val, config, indentation, depth, refs, printer);
- }
- // For compatibility with immutable v3 and v4, let record be the default.
- return printImmutableRecord(val, config, indentation, depth, refs, printer);
- };
- // Explicitly comparing sentinel properties to true avoids false positive
- // when mock identity-obj-proxy returns the key as the value for any key.
- var test = exports.test = function (val) {
- return val && (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
- };
- exports.default = { serialize: serialize, test: test };
- });
- unwrapExports(immutable);
- var immutable_1 = immutable.test;
- var immutable_2 = immutable.serialize;
- var react_element = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.test = exports.serialize = undefined;
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var elementSymbol = _Symbol$for('react.element');
- var fragmentSymbol = _Symbol$for('react.fragment');
- var forwardRefSymbol = _Symbol$for('react.forward_ref');
- var providerSymbol = _Symbol$for('react.provider');
- var contextSymbol = _Symbol$for('react.context');
- // Given element.props.children, or subtree during recursive traversal,
- // return flattened array of children.
- var getChildren = function getChildren(arg) {
- var children = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
- if (Array.isArray(arg)) {
- arg.forEach(function (item) {
- getChildren(item, children);
- });
- } else if (arg != null && arg !== false) {
- children.push(arg);
- }
- return children;
- };
- var getType = function getType(element) {
- var type = element.type;
- if (typeof type === 'string') {
- return type;
- }
- if (typeof type === 'function') {
- return type.displayName || type.name || 'Unknown';
- }
- if (type === fragmentSymbol) {
- return 'React.Fragment';
- }
- if ((typeof type === 'undefined' ? 'undefined' : _typeof(type)) === 'object' && type !== null) {
- if (type.$$typeof === providerSymbol) {
- return 'Context.Provider';
- }
- if (type.$$typeof === contextSymbol) {
- return 'Context.Consumer';
- }
- if (type.$$typeof === forwardRefSymbol) {
- var functionName = type.render.displayName || type.render.name || '';
- return functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';
- }
- }
- return 'UNDEFINED';
- };
- var getPropKeys = function getPropKeys(element) {
- var props = element.props;
- return _Object$keys(props).filter(function (key) {
- return key !== 'children' && props[key] !== undefined;
- }).sort();
- };
- var serialize = exports.serialize = function (element, config, indentation, depth, refs, printer) {
- return ++depth > config.maxDepth ? (0, markup.printElementAsLeaf)(getType(element), config) : (0, markup.printElement)(getType(element), (0, markup.printProps)(getPropKeys(element), element.props, config, indentation + config.indent, depth, refs, printer), (0, markup.printChildren)(getChildren(element.props.children), config, indentation + config.indent, depth, refs, printer), config, indentation);
- };
- var test = exports.test = function (val) {
- return val && val.$$typeof === elementSymbol;
- };
- exports.default = { serialize: serialize, test: test };
- });
- unwrapExports(react_element);
- var react_element_1 = react_element.test;
- var react_element_2 = react_element.serialize;
- var react_test_component = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.test = exports.serialize = undefined;
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var testSymbol = _Symbol$for('react.test.json');
- var getPropKeys = function getPropKeys(object) {
- var props = object.props;
- return props ? _Object$keys(props).filter(function (key) {
- return props[key] !== undefined;
- }).sort() : [];
- };
- var serialize = exports.serialize = function (object, config, indentation, depth, refs, printer) {
- return ++depth > config.maxDepth ? (0, markup.printElementAsLeaf)(object.type, config) : (0, markup.printElement)(object.type, object.props ? (0, markup.printProps)(getPropKeys(object),
- // Despite ternary expression, Flow 0.51.0 found incorrect error:
- // undefined is incompatible with the expected param type of Object
- // $FlowFixMe
- object.props, config, indentation + config.indent, depth, refs, printer) : '', object.children ? (0, markup.printChildren)(object.children, config, indentation + config.indent, depth, refs, printer) : '', config, indentation);
- };
- var test = exports.test = function (val) {
- return val && val.$$typeof === testSymbol;
- };
- exports.default = { serialize: serialize, test: test };
- });
- unwrapExports(react_test_component);
- var react_test_component_1 = react_test_component.test;
- var react_test_component_2 = react_test_component.serialize;
- var build$1 = createCommonjsModule(function (module) {
- var _ansiStyles2 = _interopRequireDefault(ansiStyles);
- var _asymmetric_matcher2 = _interopRequireDefault(asymmetric_matcher);
- var _convert_ansi2 = _interopRequireDefault(convert_ansi);
- var _dom_collection2 = _interopRequireDefault(dom_collection);
- var _dom_element2 = _interopRequireDefault(dom_element);
- var _immutable2 = _interopRequireDefault(immutable);
- var _react_element2 = _interopRequireDefault(react_element);
- var _react_test_component2 = _interopRequireDefault(react_test_component);
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : { default: obj };
- }
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var toString = Object.prototype.toString;
- var toISOString = Date.prototype.toISOString;
- var errorToString = Error.prototype.toString;
- var regExpToString = RegExp.prototype.toString;
- var symbolToString = _Symbol.prototype.toString;
- // Explicitly comparing typeof constructor to function avoids undefined as name
- // when mock identity-obj-proxy returns the key as the value for any key.
- var getConstructorName = function getConstructorName(val) {
- return typeof val.constructor === 'function' && val.constructor.name || 'Object';
- };
- // Is val is equal to global window object? Works even if it does not exist :)
- /* global window */
- var isWindow = function isWindow(val) {
- return typeof window !== 'undefined' && val === window;
- };
- var SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
- var NEWLINE_REGEXP = /\n/gi;
- var PrettyFormatPluginError = function (_Error) {
- _inherits(PrettyFormatPluginError, _Error);
- function PrettyFormatPluginError(message, stack) {
- _classCallCheck(this, PrettyFormatPluginError);
- var _this = _possibleConstructorReturn(this, (PrettyFormatPluginError.__proto__ || _Object$getPrototypeOf(PrettyFormatPluginError)).call(this, message));
- _this.stack = stack;
- _this.name = _this.constructor.name;
- return _this;
- }
- return PrettyFormatPluginError;
- }(Error);
- function isToStringedArrayType(toStringed) {
- return toStringed === '[object Array]' || toStringed === '[object ArrayBuffer]' || toStringed === '[object DataView]' || toStringed === '[object Float32Array]' || toStringed === '[object Float64Array]' || toStringed === '[object Int8Array]' || toStringed === '[object Int16Array]' || toStringed === '[object Int32Array]' || toStringed === '[object Uint8Array]' || toStringed === '[object Uint8ClampedArray]' || toStringed === '[object Uint16Array]' || toStringed === '[object Uint32Array]';
- }
- function printNumber(val) {
- return _Object$is(val, -0) ? '-0' : String(val);
- }
- function printFunction(val, printFunctionName) {
- if (!printFunctionName) {
- return '[Function]';
- }
- return '[Function ' + (val.name || 'anonymous') + ']';
- }
- function printSymbol(val) {
- return symbolToString.call(val).replace(SYMBOL_REGEXP, 'Symbol($1)');
- }
- function printError(val) {
- return '[' + errorToString.call(val) + ']';
- }
- function printBasicValue(val, printFunctionName, escapeRegex) {
- if (val === true || val === false) {
- return '' + val;
- }
- if (val === undefined) {
- return 'undefined';
- }
- if (val === null) {
- return 'null';
- }
- var typeOf = typeof val === 'undefined' ? 'undefined' : _typeof(val);
- if (typeOf === 'number') {
- return printNumber(val);
- }
- if (typeOf === 'string') {
- return '"' + val.replace(/"|\\/g, '\\$&') + '"';
- }
- if (typeOf === 'function') {
- return printFunction(val, printFunctionName);
- }
- if (typeOf === 'symbol') {
- return printSymbol(val);
- }
- var toStringed = toString.call(val);
- if (toStringed === '[object WeakMap]') {
- return 'WeakMap {}';
- }
- if (toStringed === '[object WeakSet]') {
- return 'WeakSet {}';
- }
- if (toStringed === '[object Function]' || toStringed === '[object GeneratorFunction]') {
- return printFunction(val, printFunctionName);
- }
- if (toStringed === '[object Symbol]') {
- return printSymbol(val);
- }
- if (toStringed === '[object Date]') {
- return isNaN(+val) ? 'Date { NaN }' : toISOString.call(val);
- }
- if (toStringed === '[object Error]') {
- return printError(val);
- }
- if (toStringed === '[object RegExp]') {
- if (escapeRegex) {
- // https://github.com/benjamingr/RegExp.escape/blob/master/polyfill.js
- return regExpToString.call(val).replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
- }
- return regExpToString.call(val);
- }
- if (val instanceof Error) {
- return printError(val);
- }
- return null;
- }
- function printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON) {
- if (refs.indexOf(val) !== -1) {
- return '[Circular]';
- }
- refs = refs.slice();
- refs.push(val);
- var hitMaxDepth = ++depth > config.maxDepth;
- var min = config.min;
- if (config.callToJSON && !hitMaxDepth && val.toJSON && typeof val.toJSON === 'function' && !hasCalledToJSON) {
- return printer(val.toJSON(), config, indentation, depth, refs, true);
- }
- var toStringed = toString.call(val);
- if (toStringed === '[object Arguments]') {
- return hitMaxDepth ? '[Arguments]' : (min ? '' : 'Arguments ') + '[' + (0, collections.printListItems)(val, config, indentation, depth, refs, printer) + ']';
- }
- if (isToStringedArrayType(toStringed)) {
- return hitMaxDepth ? '[' + val.constructor.name + ']' : (min ? '' : val.constructor.name + ' ') + '[' + (0, collections.printListItems)(val, config, indentation, depth, refs, printer) + ']';
- }
- if (toStringed === '[object Map]') {
- return hitMaxDepth ? '[Map]' : 'Map {' + (0, collections.printIteratorEntries)(val.entries(), config, indentation, depth, refs, printer, ' => ') + '}';
- }
- if (toStringed === '[object Set]') {
- return hitMaxDepth ? '[Set]' : 'Set {' + (0, collections.printIteratorValues)(val.values(), config, indentation, depth, refs, printer) + '}';
- }
- // Avoid failure to serialize global window object in jsdom test environment.
- // For example, not even relevant if window is prop of React element.
- return hitMaxDepth || isWindow(val) ? '[' + getConstructorName(val) + ']' : (min ? '' : getConstructorName(val) + ' ') + '{' + (0, collections.printObjectProperties)(val, config, indentation, depth, refs, printer) + '}';
- }
- function printPlugin(plugin, val, config, indentation, depth, refs) {
- var printed = void 0;
- try {
- printed = plugin.serialize ? plugin.serialize(val, config, indentation, depth, refs, printer) : plugin.print(val, function (valChild) {
- return printer(valChild, config, indentation, depth, refs);
- }, function (str) {
- var indentationNext = indentation + config.indent;
- return indentationNext + str.replace(NEWLINE_REGEXP, '\n' + indentationNext);
- }, {
- edgeSpacing: config.spacingOuter,
- min: config.min,
- spacing: config.spacingInner
- }, config.colors);
- } catch (error) {
- throw new PrettyFormatPluginError(error.message, error.stack);
- }
- if (typeof printed !== 'string') {
- throw new Error('pretty-format: Plugin must return type "string" but instead returned "' + (typeof printed === 'undefined' ? 'undefined' : _typeof(printed)) + '".');
- }
- return printed;
- }
- function findPlugin(plugins, val) {
- for (var p = 0; p < plugins.length; p++) {
- try {
- if (plugins[p].test(val)) {
- return plugins[p];
- }
- } catch (error) {
- throw new PrettyFormatPluginError(error.message, error.stack);
- }
- }
- return null;
- }
- function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
- var plugin = findPlugin(config.plugins, val);
- if (plugin !== null) {
- return printPlugin(plugin, val, config, indentation, depth, refs);
- }
- var basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex);
- if (basicResult !== null) {
- return basicResult;
- }
- return printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON);
- }
- var DEFAULT_THEME = {
- comment: 'gray',
- content: 'reset',
- prop: 'yellow',
- tag: 'cyan',
- value: 'green'
- };
- var DEFAULT_THEME_KEYS = _Object$keys(DEFAULT_THEME);
- var DEFAULT_OPTIONS = {
- callToJSON: true,
- escapeRegex: false,
- highlight: false,
- indent: 2,
- maxDepth: Infinity,
- min: false,
- plugins: [],
- printFunctionName: true,
- theme: DEFAULT_THEME
- };
- function validateOptions(options) {
- _Object$keys(options).forEach(function (key) {
- if (!DEFAULT_OPTIONS.hasOwnProperty(key)) {
- throw new Error('pretty-format: Unknown option "' + key + '".');
- }
- });
- if (options.min && options.indent !== undefined && options.indent !== 0) {
- throw new Error('pretty-format: Options "min" and "indent" cannot be used together.');
- }
- if (options.theme !== undefined) {
- if (options.theme === null) {
- throw new Error('pretty-format: Option "theme" must not be null.');
- }
- if (_typeof(options.theme) !== 'object') {
- throw new Error('pretty-format: Option "theme" must be of type "object" but instead received "' + _typeof(options.theme) + '".');
- }
- }
- }
- var getColorsHighlight = function getColorsHighlight(options
- // $FlowFixMe: Flow thinks keys from `Colors` are missing from `DEFAULT_THEME_KEYS`
- ) {
- return DEFAULT_THEME_KEYS.reduce(function (colors, key) {
- var value = options.theme && options.theme[key] !== undefined ? options.theme[key] : DEFAULT_THEME[key];
- var color = _ansiStyles2.default[value];
- if (color && typeof color.close === 'string' && typeof color.open === 'string') {
- colors[key] = color;
- } else {
- throw new Error('pretty-format: Option "theme" has a key "' + key + '" whose value "' + value + '" is undefined in ansi-styles.');
- }
- return colors;
- }, _Object$create(null));
- };
- var getColorsEmpty = function getColorsEmpty() {
- return (
- // $FlowFixMe: Flow thinks keys from `Colors` are missing from `DEFAULT_THEME_KEYS`
- DEFAULT_THEME_KEYS.reduce(function (colors, key) {
- colors[key] = { close: '', open: '' };
- return colors;
- }, _Object$create(null))
- );
- };
- var getPrintFunctionName = function getPrintFunctionName(options) {
- return options && options.printFunctionName !== undefined ? options.printFunctionName : DEFAULT_OPTIONS.printFunctionName;
- };
- var getEscapeRegex = function getEscapeRegex(options) {
- return options && options.escapeRegex !== undefined ? options.escapeRegex : DEFAULT_OPTIONS.escapeRegex;
- };
- var getConfig = function getConfig(options) {
- return {
- callToJSON: options && options.callToJSON !== undefined ? options.callToJSON : DEFAULT_OPTIONS.callToJSON,
- colors: options && options.highlight ? getColorsHighlight(options) : getColorsEmpty(),
- escapeRegex: getEscapeRegex(options),
- indent: options && options.min ? '' : createIndent(options && options.indent !== undefined ? options.indent : DEFAULT_OPTIONS.indent),
- maxDepth: options && options.maxDepth !== undefined ? options.maxDepth : DEFAULT_OPTIONS.maxDepth,
- min: options && options.min !== undefined ? options.min : DEFAULT_OPTIONS.min,
- plugins: options && options.plugins !== undefined ? options.plugins : DEFAULT_OPTIONS.plugins,
- printFunctionName: getPrintFunctionName(options),
- spacingInner: options && options.min ? ' ' : '\n',
- spacingOuter: options && options.min ? '' : '\n'
- };
- };
- function createIndent(indent) {
- return new Array(indent + 1).join(' ');
- }
- function prettyFormat(val, options) {
- if (options) {
- validateOptions(options);
- if (options.plugins) {
- var plugin = findPlugin(options.plugins, val);
- if (plugin !== null) {
- return printPlugin(plugin, val, getConfig(options), '', 0, []);
- }
- }
- }
- var basicResult = printBasicValue(val, getPrintFunctionName(options), getEscapeRegex(options));
- if (basicResult !== null) {
- return basicResult;
- }
- return printComplexValue(val, getConfig(options), '', 0, []);
- }
- prettyFormat.plugins = {
- AsymmetricMatcher: _asymmetric_matcher2.default,
- ConvertAnsi: _convert_ansi2.default,
- DOMCollection: _dom_collection2.default,
- DOMElement: _dom_element2.default,
- Immutable: _immutable2.default,
- ReactElement: _react_element2.default,
- ReactTestComponent: _react_test_component2.default
- };
- module.exports = prettyFormat;
- });
- unwrapExports(build$1);
- var build$2 = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.matcherHint = exports.pluralize = exports.ensureNumbers = exports.ensureExpectedIsNumber = exports.ensureActualIsNumber = exports.ensureNoExpected = exports.printWithType = exports.printExpected = exports.printReceived = exports.highlightTrailingWhitespace = exports.stringify = exports.SUGGEST_TO_CONTAIN_EQUAL = exports.SUGGEST_TO_EQUAL = exports.RECEIVED_COLOR = exports.EXPECTED_COLOR = undefined;
- var _chalk2 = _interopRequireDefault(fake_chalk);
- var _jestGetType2 = _interopRequireDefault(build);
- var _prettyFormat2 = _interopRequireDefault(build$1);
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : { default: obj };
- }
- var _prettyFormat$plugins = _prettyFormat2.default.plugins;
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var AsymmetricMatcher = _prettyFormat$plugins.AsymmetricMatcher,
- DOMCollection = _prettyFormat$plugins.DOMCollection,
- DOMElement = _prettyFormat$plugins.DOMElement,
- Immutable = _prettyFormat$plugins.Immutable,
- ReactElement = _prettyFormat$plugins.ReactElement,
- ReactTestComponent = _prettyFormat$plugins.ReactTestComponent;
- var PLUGINS = [ReactTestComponent, ReactElement, DOMElement, DOMCollection, Immutable, AsymmetricMatcher];
- var EXPECTED_COLOR = exports.EXPECTED_COLOR = _chalk2.default.green;
- var RECEIVED_COLOR = exports.RECEIVED_COLOR = _chalk2.default.red;
- var NUMBERS = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen'];
- var SUGGEST_TO_EQUAL = exports.SUGGEST_TO_EQUAL = _chalk2.default.dim('Note that you are testing for equality with the stricter `toBe` matcher using `Object.is`. For deep equality only, use `toEqual` instead.');
- var SUGGEST_TO_CONTAIN_EQUAL = exports.SUGGEST_TO_CONTAIN_EQUAL = _chalk2.default.dim('Looks like you wanted to test for object/array equality with the stricter `toContain` matcher. You probably need to use `toContainEqual` instead.');
- var stringify = exports.stringify = function (object) {
- var maxDepth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
- var MAX_LENGTH = 10000;
- var result = void 0;
- try {
- result = (0, _prettyFormat2.default)(object, {
- maxDepth: maxDepth,
- min: true,
- plugins: PLUGINS
- });
- } catch (e) {
- result = (0, _prettyFormat2.default)(object, {
- callToJSON: false,
- maxDepth: maxDepth,
- min: true,
- plugins: PLUGINS
- });
- }
- return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(maxDepth / 2)) : result;
- };
- var highlightTrailingWhitespace = exports.highlightTrailingWhitespace = function (text) {
- return text.replace(/\s+$/gm, _chalk2.default.inverse('$&'));
- };
- var printReceived = exports.printReceived = function (object) {
- return RECEIVED_COLOR(highlightTrailingWhitespace(stringify(object)));
- };
- var printExpected = exports.printExpected = function (value) {
- return EXPECTED_COLOR(highlightTrailingWhitespace(stringify(value)));
- };
- var printWithType = exports.printWithType = function (name, received, print) {
- var type = (0, _jestGetType2.default)(received);
- return name + ':' + (type !== 'null' && type !== 'undefined' ? '\n ' + type + ': ' : ' ') + print(received);
- };
- var ensureNoExpected = exports.ensureNoExpected = function (expected, matcherName) {
- matcherName || (matcherName = 'This');
- if (typeof expected !== 'undefined') {
- throw new Error(matcherHint('[.not]' + matcherName, undefined, '') + '\n\n' + 'Matcher does not accept any arguments.\n' + printWithType('Got', expected, printExpected));
- }
- };
- var ensureActualIsNumber = exports.ensureActualIsNumber = function (actual, matcherName) {
- matcherName || (matcherName = 'This matcher');
- if (typeof actual !== 'number') {
- throw new Error(matcherHint('[.not]' + matcherName) + '\n\n' + 'Received value must be a number.\n' + printWithType('Received', actual, printReceived));
- }
- };
- var ensureExpectedIsNumber = exports.ensureExpectedIsNumber = function (expected, matcherName) {
- matcherName || (matcherName = 'This matcher');
- if (typeof expected !== 'number') {
- throw new Error(matcherHint('[.not]' + matcherName) + '\n\n' + 'Expected value must be a number.\n' + printWithType('Got', expected, printExpected));
- }
- };
- var ensureNumbers = exports.ensureNumbers = function (actual, expected, matcherName) {
- ensureActualIsNumber(actual, matcherName);
- ensureExpectedIsNumber(expected, matcherName);
- };
- var pluralize = exports.pluralize = function (word, count) {
- return (NUMBERS[count] || count) + ' ' + word + (count === 1 ? '' : 's');
- };
- var matcherHint = exports.matcherHint = function (matcherName) {
- var received = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'received';
- var expected = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'expected';
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
- var comment = options.comment,
- isDirectExpectCall = options.isDirectExpectCall,
- isNot = options.isNot,
- secondArgument = options.secondArgument;
- return _chalk2.default.dim('expect' + (isDirectExpectCall ? '' : '(')) + RECEIVED_COLOR(received) + (isNot ? _chalk2.default.dim(').') + 'not' + _chalk2.default.dim(matcherName + '(') : _chalk2.default.dim((isDirectExpectCall ? '' : ')') + matcherName + '(')) + EXPECTED_COLOR(expected) + (secondArgument ? '' + _chalk2.default.dim(', ') + EXPECTED_COLOR(secondArgument) : '') + _chalk2.default.dim(')' + (comment ? ' // ' + comment : ''));
- };
- });
- var index$1 = unwrapExports(build$2);
- var build_1 = build$2.matcherHint;
- var build_2 = build$2.pluralize;
- var build_3 = build$2.ensureNumbers;
- var build_4 = build$2.ensureExpectedIsNumber;
- var build_5 = build$2.ensureActualIsNumber;
- var build_6 = build$2.ensureNoExpected;
- var build_7 = build$2.printWithType;
- var build_8 = build$2.printExpected;
- var build_9 = build$2.printReceived;
- var build_10 = build$2.highlightTrailingWhitespace;
- var build_11 = build$2.stringify;
- var build_12 = build$2.SUGGEST_TO_CONTAIN_EQUAL;
- var build_13 = build$2.SUGGEST_TO_EQUAL;
- var build_14 = build$2.RECEIVED_COLOR;
- var build_15 = build$2.EXPECTED_COLOR;
- var matcherUtils = Object.freeze({
- default: index$1,
- __moduleExports: build$2,
- matcherHint: build_1,
- pluralize: build_2,
- ensureNumbers: build_3,
- ensureExpectedIsNumber: build_4,
- ensureActualIsNumber: build_5,
- ensureNoExpected: build_6,
- printWithType: build_7,
- printExpected: build_8,
- printReceived: build_9,
- highlightTrailingWhitespace: build_10,
- stringify: build_11,
- SUGGEST_TO_CONTAIN_EQUAL: build_12,
- SUGGEST_TO_EQUAL: build_13,
- RECEIVED_COLOR: build_14,
- EXPECTED_COLOR: build_15
- });
- // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
- var $getOwnPropertyDescriptor$1 = _objectGopd.f;
- _objectSap('getOwnPropertyDescriptor', function () {
- return function getOwnPropertyDescriptor(it, key) {
- return $getOwnPropertyDescriptor$1(_toIobject(it), key);
- };
- });
- var $Object$2 = _core.Object;
- var getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
- return $Object$2.getOwnPropertyDescriptor(it, key);
- };
- var getOwnPropertyDescriptor$1 = createCommonjsModule(function (module) {
- module.exports = { "default": getOwnPropertyDescriptor, __esModule: true };
- });
- var _Object$getOwnPropertyDescriptor = unwrapExports(getOwnPropertyDescriptor$1);
- /*
- Copyright (c) 2008-2016 Pivotal Labs
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- */
- /* eslint-disable */
- // Extracted out of jasmine 2.5.2
- function equals(a, b, customTesters, strictCheck) {
- customTesters = customTesters || [];
- return eq(a, b, [], [], customTesters, strictCheck ? hasKey : hasDefinedKey);
- }
- function isAsymmetric(obj) {
- return obj && isA('Function', obj.asymmetricMatch);
- }
- function asymmetricMatch(a, b) {
- var asymmetricA = isAsymmetric(a),
- asymmetricB = isAsymmetric(b);
- if (asymmetricA && asymmetricB) {
- return undefined;
- }
- if (asymmetricA) {
- return a.asymmetricMatch(b);
- }
- if (asymmetricB) {
- return b.asymmetricMatch(a);
- }
- }
- // Equality function lovingly adapted from isEqual in
- // [Underscore](http://underscorejs.org)
- function eq(a, b, aStack, bStack, customTesters, hasKey) {
- var result = true;
- var asymmetricResult = asymmetricMatch(a, b);
- if (asymmetricResult !== undefined) {
- return asymmetricResult;
- }
- for (var i = 0; i < customTesters.length; i++) {
- var customTesterResult = customTesters[i](a, b);
- if (customTesterResult !== undefined) {
- return customTesterResult;
- }
- }
- if (a instanceof Error && b instanceof Error) {
- return a.message == b.message;
- }
- if (_Object$is(a, b)) {
- return true;
- }
- // A strict comparison is necessary because `null == undefined`.
- if (a === null || b === null) {
- return a === b;
- }
- var className = Object.prototype.toString.call(a);
- if (className != Object.prototype.toString.call(b)) {
- return false;
- }
- switch (className) {
- // Strings, numbers, dates, and booleans are compared by value.
- case '[object String]':
- // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
- // equivalent to `new String("5")`.
- return a == String(b);
- case '[object Number]':
- // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
- // other numeric values.
- return a != +a ? b != +b : a === 0 ? 1 / a == 1 / b : a == +b;
- case '[object Date]':
- case '[object Boolean]':
- // Coerce dates and booleans to numeric primitive values. Dates are compared by their
- // millisecond representations. Note that invalid dates with millisecond representations
- // of `NaN` are not equivalent.
- return +a == +b;
- // RegExps are compared by their source patterns and flags.
- case '[object RegExp]':
- return a.source == b.source && a.global == b.global && a.multiline == b.multiline && a.ignoreCase == b.ignoreCase;
- }
- if ((typeof a === 'undefined' ? 'undefined' : _typeof(a)) != 'object' || (typeof b === 'undefined' ? 'undefined' : _typeof(b)) != 'object') {
- return false;
- }
- var aIsDomNode = isDomNode(a);
- var bIsDomNode = isDomNode(b);
- if (aIsDomNode && bIsDomNode) {
- // At first try to use DOM3 method isEqualNode
- if (a.isEqualNode) {
- return a.isEqualNode(b);
- }
- // IE8 doesn't support isEqualNode, try to use outerHTML && innerText
- var aIsElement = a instanceof Element;
- var bIsElement = b instanceof Element;
- if (aIsElement && bIsElement) {
- return a.outerHTML == b.outerHTML;
- }
- if (aIsElement || bIsElement) {
- return false;
- }
- return a.innerText == b.innerText && a.textContent == b.textContent;
- }
- if (aIsDomNode || bIsDomNode) {
- return false;
- }
- // Assume equality for cyclic structures. The algorithm for detecting cyclic
- // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
- var length = aStack.length;
- while (length--) {
- // Linear search. Performance is inversely proportional to the number of
- // unique nested structures.
- if (aStack[length] == a) {
- return bStack[length] == b;
- }
- }
- // Add the first object to the stack of traversed objects.
- aStack.push(a);
- bStack.push(b);
- var size = 0;
- // Recursively compare objects and arrays.
- // Compare array lengths to determine if a deep comparison is necessary.
- if (className == '[object Array]') {
- size = a.length;
- if (size !== b.length) {
- return false;
- }
- while (size--) {
- result = eq(a[size], b[size], aStack, bStack, customTesters, hasKey);
- if (!result) {
- return false;
- }
- }
- }
- // Deep compare objects.
- var aKeys = keys$2(a, className == '[object Array]', hasKey),
- key;
- size = aKeys.length;
- // Ensure that both objects contain the same number of properties before comparing deep equality.
- if (keys$2(b, className == '[object Array]', hasKey).length !== size) {
- return false;
- }
- while (size--) {
- key = aKeys[size];
- // Deep compare each member
- result = hasKey(b, key) && eq(a[key], b[key], aStack, bStack, customTesters, hasKey);
- if (!result) {
- return false;
- }
- }
- // Remove the first object from the stack of traversed objects.
- aStack.pop();
- bStack.pop();
- return result;
- }
- function keys$2(obj, isArray, hasKey) {
- var allKeys = function (o) {
- var keys = [];
- for (var key in o) {
- if (hasKey(o, key)) {
- keys.push(key);
- }
- }
- return keys.concat(_Object$getOwnPropertySymbols(o).filter(
- //$FlowFixMe Jest complains about nullability, but we know for sure that property 'symbol' does exist.
- function (symbol) {
- return _Object$getOwnPropertyDescriptor(o, symbol).enumerable;
- }));
- }(obj);
- if (!isArray) {
- return allKeys;
- }
- var extraKeys = [];
- if (allKeys.length === 0) {
- return allKeys;
- }
- for (var x = 0; x < allKeys.length; x++) {
- //$FlowFixMe
- if (_typeof(allKeys[x]) === 'symbol' || !allKeys[x].match(/^[0-9]+$/)) {
- extraKeys.push(allKeys[x]);
- }
- }
- return extraKeys;
- }
- function hasDefinedKey(obj, key) {
- return hasKey(obj, key) && obj[key] !== undefined;
- }
- function hasKey(obj, key) {
- return Object.prototype.hasOwnProperty.call(obj, key);
- }
- function isA(typeName, value) {
- return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
- }
- function isDomNode(obj) {
- return obj !== null && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && typeof obj.nodeType === 'number' && typeof obj.nodeName === 'string';
- }
- function fnNameFor(func) {
- if (func.name) {
- return func.name;
- }
- var matches = func.toString().match(/^\s*function\s*(\w*)\s*\(/);
- return matches ? matches[1] : '<anonymous>';
- }
- function isUndefined(obj) {
- return obj === void 0;
- }
- function getPrototype(obj) {
- if (_Object$getPrototypeOf) {
- return _Object$getPrototypeOf(obj);
- }
- if (obj.constructor.prototype == obj) {
- return null;
- }
- return obj.constructor.prototype;
- }
- function hasProperty(obj, property) {
- if (!obj) {
- return false;
- }
- if (Object.prototype.hasOwnProperty.call(obj, property)) {
- return true;
- }
- return hasProperty(getPrototype(obj), property);
- }
- // SENTINEL constants are from https://github.com/facebook/immutable-js
- var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
- var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
- var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
- function isImmutableUnorderedKeyed(maybeKeyed) {
- return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL] && !maybeKeyed[IS_ORDERED_SENTINEL]);
- }
- function isImmutableUnorderedSet(maybeSet) {
- return !!(maybeSet && maybeSet[IS_SET_SENTINEL] && !maybeSet[IS_ORDERED_SENTINEL]);
- }
- var hasOwnProperty$1 = function hasOwnProperty(object, value) {
- return Object.prototype.hasOwnProperty.call(object, value) || Object.prototype.hasOwnProperty.call(object.constructor.prototype, value);
- };
- var getPath = function getPath(object, propertyPath) {
- if (!Array.isArray(propertyPath)) {
- propertyPath = propertyPath.split('.');
- }
- if (propertyPath.length) {
- var lastProp = propertyPath.length === 1;
- var prop = propertyPath[0];
- var newObject = object[prop];
- if (!lastProp && (newObject === null || newObject === undefined)) {
- // This is not the last prop in the chain. If we keep recursing it will
- // hit a `can't access property X of undefined | null`. At this point we
- // know that the chain has broken and we can return right away.
- return {
- hasEndProp: false,
- lastTraversedObject: object,
- traversedPath: []
- };
- }
- var result = getPath(newObject, propertyPath.slice(1));
- if (result.lastTraversedObject === null) {
- result.lastTraversedObject = object;
- }
- result.traversedPath.unshift(prop);
- if (lastProp) {
- result.hasEndProp = hasOwnProperty$1(object, prop);
- if (!result.hasEndProp) {
- result.traversedPath.shift();
- }
- }
- return result;
- }
- return {
- lastTraversedObject: null,
- traversedPath: [],
- value: object
- };
- };
- // Strip properties from object that are not present in the subset. Useful for
- // printing the diff for toMatchObject() without adding unrelated noise.
- var getObjectSubset = function getObjectSubset(object, subset) {
- if (Array.isArray(object)) {
- if (Array.isArray(subset) && subset.length === object.length) {
- return subset.map(function (sub, i) {
- return getObjectSubset(object[i], sub);
- });
- }
- } else if (object instanceof Date) {
- return object;
- } else if ((typeof object === 'undefined' ? 'undefined' : _typeof(object)) === 'object' && object !== null && (typeof subset === 'undefined' ? 'undefined' : _typeof(subset)) === 'object' && subset !== null) {
- var trimmed = {};
- _Object$keys(subset).filter(function (key) {
- return hasOwnProperty$1(object, key);
- }).forEach(function (key) {
- return trimmed[key] = getObjectSubset(object[key], subset[key]);
- });
- if (_Object$keys(trimmed).length > 0) {
- return trimmed;
- }
- }
- return object;
- };
- var IteratorSymbol = _Symbol$iterator;
- var hasIterator = function hasIterator(object) {
- return !!(object != null && object[IteratorSymbol]);
- };
- var iterableEquality = function iterableEquality(a, b) {
- if ((typeof a === 'undefined' ? 'undefined' : _typeof(a)) !== 'object' || (typeof b === 'undefined' ? 'undefined' : _typeof(b)) !== 'object' || Array.isArray(a) || Array.isArray(b) || !hasIterator(a) || !hasIterator(b)) {
- return undefined;
- }
- if (a.constructor !== b.constructor) {
- return false;
- }
- if (a.size !== undefined) {
- if (a.size !== b.size) {
- return false;
- } else if (isA('Set', a) || isImmutableUnorderedSet(a)) {
- var allFound = true;
- var _iteratorNormalCompletion = true;
- var _didIteratorError = false;
- var _iteratorError = undefined;
- try {
- for (var _iterator = _getIterator(a), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
- var aValue = _step.value;
- if (!b.has(aValue)) {
- var has = false;
- var _iteratorNormalCompletion2 = true;
- var _didIteratorError2 = false;
- var _iteratorError2 = undefined;
- try {
- for (var _iterator2 = _getIterator(b), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
- var bValue = _step2.value;
- var isEqual = equals(aValue, bValue, [iterableEquality]);
- if (isEqual === true) {
- has = true;
- }
- }
- } catch (err) {
- _didIteratorError2 = true;
- _iteratorError2 = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion2 && _iterator2.return) {
- _iterator2.return();
- }
- } finally {
- if (_didIteratorError2) {
- throw _iteratorError2;
- }
- }
- }
- if (has === false) {
- allFound = false;
- break;
- }
- }
- }
- } catch (err) {
- _didIteratorError = true;
- _iteratorError = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion && _iterator.return) {
- _iterator.return();
- }
- } finally {
- if (_didIteratorError) {
- throw _iteratorError;
- }
- }
- }
- if (allFound) {
- return true;
- }
- } else if (isA('Map', a) || isImmutableUnorderedKeyed(a)) {
- var _allFound = true;
- var _iteratorNormalCompletion3 = true;
- var _didIteratorError3 = false;
- var _iteratorError3 = undefined;
- try {
- for (var _iterator3 = _getIterator(a), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
- var aEntry = _step3.value;
- if (!b.has(aEntry[0]) || !equals(aEntry[1], b.get(aEntry[0]), [iterableEquality])) {
- var _has = false;
- var _iteratorNormalCompletion4 = true;
- var _didIteratorError4 = false;
- var _iteratorError4 = undefined;
- try {
- for (var _iterator4 = _getIterator(b), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
- var bEntry = _step4.value;
- var matchedKey = equals(aEntry[0], bEntry[0], [iterableEquality]);
- var matchedValue = false;
- if (matchedKey === true) {
- matchedValue = equals(aEntry[1], bEntry[1], [iterableEquality]);
- }
- if (matchedValue === true) {
- _has = true;
- }
- }
- } catch (err) {
- _didIteratorError4 = true;
- _iteratorError4 = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion4 && _iterator4.return) {
- _iterator4.return();
- }
- } finally {
- if (_didIteratorError4) {
- throw _iteratorError4;
- }
- }
- }
- if (_has === false) {
- _allFound = false;
- break;
- }
- }
- }
- } catch (err) {
- _didIteratorError3 = true;
- _iteratorError3 = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion3 && _iterator3.return) {
- _iterator3.return();
- }
- } finally {
- if (_didIteratorError3) {
- throw _iteratorError3;
- }
- }
- }
- if (_allFound) {
- return true;
- }
- }
- }
- var bIterator = b[IteratorSymbol]();
- var _iteratorNormalCompletion5 = true;
- var _didIteratorError5 = false;
- var _iteratorError5 = undefined;
- try {
- for (var _iterator5 = _getIterator(a), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
- var _aValue = _step5.value;
- var nextB = bIterator.next();
- if (nextB.done || !equals(_aValue, nextB.value, [iterableEquality])) {
- return false;
- }
- }
- } catch (err) {
- _didIteratorError5 = true;
- _iteratorError5 = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion5 && _iterator5.return) {
- _iterator5.return();
- }
- } finally {
- if (_didIteratorError5) {
- throw _iteratorError5;
- }
- }
- }
- if (!bIterator.next().done) {
- return false;
- }
- return true;
- };
- var isObjectWithKeys = function isObjectWithKeys(a) {
- return a !== null && (typeof a === 'undefined' ? 'undefined' : _typeof(a)) === 'object' && !(a instanceof Error) && !(a instanceof Array) && !(a instanceof Date);
- };
- var subsetEquality = function subsetEquality(object, subset) {
- if (!isObjectWithKeys(subset)) {
- return undefined;
- }
- return _Object$keys(subset).every(function (key) {
- return object != null && hasOwnProperty$1(object, key) && equals(object[key], subset[key], [iterableEquality, subsetEquality]);
- });
- };
- var typeEquality = function typeEquality(a, b) {
- if (a == null || b == null || a.constructor.name === b.constructor.name) {
- return undefined;
- }
- return false;
- };
- var partition = function partition(items, predicate) {
- var result = [[], []];
- items.forEach(function (item) {
- return result[predicate(item) ? 0 : 1].push(item);
- });
- return result;
- };
- // Copied from https://github.com/graingert/angular.js/blob/a43574052e9775cbc1d7dd8a086752c979b0f020/src/Angular.js#L685-L693
- var isError = function isError(value) {
- switch (Object.prototype.toString.call(value)) {
- case '[object Error]':
- return true;
- case '[object Exception]':
- return true;
- case '[object DOMException]':
- return true;
- default:
- return value instanceof Error;
- }
- };
- function emptyObject(obj) {
- return obj && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' ? !_Object$keys(obj).length : false;
- }
- var MULTILINE_REGEXP = /[\r\n]/;
- var isOneline = function isOneline(expected, received) {
- return typeof expected === 'string' && typeof received === 'string' && (!MULTILINE_REGEXP.test(expected) || !MULTILINE_REGEXP.test(received));
- };
- var _createProperty = function (object, index, value) {
- if (index in object) _objectDp.f(object, index, _propertyDesc(0, value));
- else object[index] = value;
- };
- _export(_export.S + _export.F * !_iterDetect(function (iter) { }), 'Array', {
- // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
- from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
- var O = _toObject(arrayLike);
- var C = typeof this == 'function' ? this : Array;
- var aLen = arguments.length;
- var mapfn = aLen > 1 ? arguments[1] : undefined;
- var mapping = mapfn !== undefined;
- var index = 0;
- var iterFn = core_getIteratorMethod(O);
- var length, result, step, iterator;
- if (mapping) mapfn = _ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
- // if object isn't iterable or it's array with default iterator - use simple case
- if (iterFn != undefined && !(C == Array && _isArrayIter(iterFn))) {
- for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {
- _createProperty(result, index, mapping ? _iterCall(iterator, mapfn, [step.value, index], true) : step.value);
- }
- } else {
- length = _toLength(O.length);
- for (result = new C(length); length > index; index++) {
- _createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
- }
- }
- result.length = index;
- return result;
- }
- });
- var from = _core.Array.from;
- var from$1 = createCommonjsModule(function (module) {
- module.exports = { "default": from, __esModule: true };
- });
- var _Array$from = unwrapExports(from$1);
- // 20.1.2.4 Number.isNaN(number)
- _export(_export.S, 'Number', {
- isNaN: function isNaN(number) {
- // eslint-disable-next-line no-self-compare
- return number != number;
- }
- });
- var isNan = _core.Number.isNaN;
- var isNan$1 = createCommonjsModule(function (module) {
- module.exports = { "default": isNan, __esModule: true };
- });
- var _Number$isNaN = unwrapExports(isNan$1);
- var base = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports['default'] = /*istanbul ignore end*/Diff;
- function Diff() {}
- Diff.prototype = {
- /*istanbul ignore start*/ /*istanbul ignore end*/diff: function diff(oldString, newString) {
- /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var callback = options.callback;
- if (typeof options === 'function') {
- callback = options;
- options = {};
- }
- this.options = options;
- var self = this;
- function done(value) {
- if (callback) {
- setTimeout(function () {
- callback(undefined, value);
- }, 0);
- return true;
- } else {
- return value;
- }
- }
- // Allow subclasses to massage the input prior to running
- oldString = this.castInput(oldString);
- newString = this.castInput(newString);
- oldString = this.removeEmpty(this.tokenize(oldString));
- newString = this.removeEmpty(this.tokenize(newString));
- var newLen = newString.length,
- oldLen = oldString.length;
- var editLength = 1;
- var maxEditLength = newLen + oldLen;
- var bestPath = [{ newPos: -1, components: [] }];
- // Seed editLength = 0, i.e. the content starts with the same values
- var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
- if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
- // Identity per the equality and tokenizer
- return done([{ value: this.join(newString), count: newString.length }]);
- }
- // Main worker method. checks all permutations of a given edit length for acceptance.
- function execEditLength() {
- for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
- var basePath = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
- var addPath = bestPath[diagonalPath - 1],
- removePath = bestPath[diagonalPath + 1],
- _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
- if (addPath) {
- // No one else is going to attempt to use this value, clear it
- bestPath[diagonalPath - 1] = undefined;
- }
- var canAdd = addPath && addPath.newPos + 1 < newLen,
- canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
- if (!canAdd && !canRemove) {
- // If this path is a terminal then prune
- bestPath[diagonalPath] = undefined;
- continue;
- }
- // Select the diagonal that we want to branch from. We select the prior
- // path whose position in the new string is the farthest from the origin
- // and does not pass the bounds of the diff graph
- if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
- basePath = clonePath(removePath);
- self.pushComponent(basePath.components, undefined, true);
- } else {
- basePath = addPath; // No need to clone, we've pulled it from the list
- basePath.newPos++;
- self.pushComponent(basePath.components, true, undefined);
- }
- _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
- // If we have hit the end of both strings, then we are done
- if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
- return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
- } else {
- // Otherwise track this path as a potential candidate and continue.
- bestPath[diagonalPath] = basePath;
- }
- }
- editLength++;
- }
- // Performs the length of edit iteration. Is a bit fugly as this has to support the
- // sync and async mode which is never fun. Loops over execEditLength until a value
- // is produced.
- if (callback) {
- (function exec() {
- setTimeout(function () {
- // This should not happen, but we want to be safe.
- /* istanbul ignore next */
- if (editLength > maxEditLength) {
- return callback();
- }
- if (!execEditLength()) {
- exec();
- }
- }, 0);
- })();
- } else {
- while (editLength <= maxEditLength) {
- var ret = execEditLength();
- if (ret) {
- return ret;
- }
- }
- }
- },
- /*istanbul ignore start*/ /*istanbul ignore end*/pushComponent: function pushComponent(components, added, removed) {
- var last = components[components.length - 1];
- if (last && last.added === added && last.removed === removed) {
- // We need to clone here as the component clone operation is just
- // as shallow array clone
- components[components.length - 1] = { count: last.count + 1, added: added, removed: removed };
- } else {
- components.push({ count: 1, added: added, removed: removed });
- }
- },
- /*istanbul ignore start*/ /*istanbul ignore end*/extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
- var newLen = newString.length,
- oldLen = oldString.length,
- newPos = basePath.newPos,
- oldPos = newPos - diagonalPath,
- commonCount = 0;
- while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
- newPos++;
- oldPos++;
- commonCount++;
- }
- if (commonCount) {
- basePath.components.push({ count: commonCount });
- }
- basePath.newPos = newPos;
- return oldPos;
- },
- /*istanbul ignore start*/ /*istanbul ignore end*/equals: function equals(left, right) {
- if (this.options.comparator) {
- return this.options.comparator(left, right);
- } else {
- return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
- }
- },
- /*istanbul ignore start*/ /*istanbul ignore end*/removeEmpty: function removeEmpty(array) {
- var ret = [];
- for (var i = 0; i < array.length; i++) {
- if (array[i]) {
- ret.push(array[i]);
- }
- }
- return ret;
- },
- /*istanbul ignore start*/ /*istanbul ignore end*/castInput: function castInput(value) {
- return value;
- },
- /*istanbul ignore start*/ /*istanbul ignore end*/tokenize: function tokenize(value) {
- return value.split('');
- },
- /*istanbul ignore start*/ /*istanbul ignore end*/join: function join(chars) {
- return chars.join('');
- }
- };
- function buildValues(diff, components, newString, oldString, useLongestToken) {
- var componentPos = 0,
- componentLen = components.length,
- newPos = 0,
- oldPos = 0;
- for (; componentPos < componentLen; componentPos++) {
- var component = components[componentPos];
- if (!component.removed) {
- if (!component.added && useLongestToken) {
- var value = newString.slice(newPos, newPos + component.count);
- value = value.map(function (value, i) {
- var oldValue = oldString[oldPos + i];
- return oldValue.length > value.length ? oldValue : value;
- });
- component.value = diff.join(value);
- } else {
- component.value = diff.join(newString.slice(newPos, newPos + component.count));
- }
- newPos += component.count;
- // Common case
- if (!component.added) {
- oldPos += component.count;
- }
- } else {
- component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
- oldPos += component.count;
- // Reverse add and remove so removes are output first to match common convention
- // The diffing algorithm is tied to add then remove output and this is the simplest
- // route to get the desired output with minimal overhead.
- if (componentPos && components[componentPos - 1].added) {
- var tmp = components[componentPos - 1];
- components[componentPos - 1] = components[componentPos];
- components[componentPos] = tmp;
- }
- }
- }
- // Special case handle for when one terminal is ignored (i.e. whitespace).
- // For this case we merge the terminal into the prior string and drop the change.
- // This is only available for string mode.
- var lastComponent = components[componentLen - 1];
- if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
- components[componentLen - 2].value += lastComponent.value;
- components.pop();
- }
- return components;
- }
- function clonePath(path) {
- return { newPos: path.newPos, components: path.components.slice(0) };
- }
- });
- unwrapExports(base);
- var character = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports.characterDiff = undefined;
- exports. /*istanbul ignore end*/diffChars = diffChars;
- /*istanbul ignore start*/var _base2 = _interopRequireDefault(base);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
- /*istanbul ignore end*/var characterDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/characterDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
- function diffChars(oldStr, newStr, options) {
- return characterDiff.diff(oldStr, newStr, options);
- }
- });
- unwrapExports(character);
- var character_1 = character.characterDiff;
- var character_2 = character.diffChars;
- var params = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports. /*istanbul ignore end*/generateOptions = generateOptions;
- function generateOptions(options, defaults) {
- if (typeof options === 'function') {
- defaults.callback = options;
- } else if (options) {
- for (var name in options) {
- /* istanbul ignore else */
- if (options.hasOwnProperty(name)) {
- defaults[name] = options[name];
- }
- }
- }
- return defaults;
- }
- });
- unwrapExports(params);
- var params_1 = params.generateOptions;
- var word = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports.wordDiff = undefined;
- exports. /*istanbul ignore end*/diffWords = diffWords;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = diffWordsWithSpace;
- /*istanbul ignore start*/var _base2 = _interopRequireDefault(base);
- /*istanbul ignore end*/
- /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
- /*istanbul ignore end*/ // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode
- //
- // Ranges and exceptions:
- // Latin-1 Supplement, 0080–00FF
- // - U+00D7 × Multiplication sign
- // - U+00F7 ÷ Division sign
- // Latin Extended-A, 0100–017F
- // Latin Extended-B, 0180–024F
- // IPA Extensions, 0250–02AF
- // Spacing Modifier Letters, 02B0–02FF
- // - U+02C7 ˇ ˇ Caron
- // - U+02D8 ˘ ˘ Breve
- // - U+02D9 ˙ ˙ Dot Above
- // - U+02DA ˚ ˚ Ring Above
- // - U+02DB ˛ ˛ Ogonek
- // - U+02DC ˜ ˜ Small Tilde
- // - U+02DD ˝ ˝ Double Acute Accent
- // Latin Extended Additional, 1E00–1EFF
- var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
- var reWhitespace = /\S/;
- var wordDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/wordDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
- wordDiff.equals = function (left, right) {
- if (this.options.ignoreCase) {
- left = left.toLowerCase();
- right = right.toLowerCase();
- }
- return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
- };
- wordDiff.tokenize = function (value) {
- var tokens = value.split(/(\s+|\b)/);
- // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
- for (var i = 0; i < tokens.length - 1; i++) {
- // If we have an empty string in the next field and we have only word chars before and after, merge
- if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
- tokens[i] += tokens[i + 2];
- tokens.splice(i + 1, 2);
- i--;
- }
- }
- return tokens;
- };
- function diffWords(oldStr, newStr, options) {
- options = /*istanbul ignore start*/(0, params.generateOptions) /*istanbul ignore end*/(options, { ignoreWhitespace: true });
- return wordDiff.diff(oldStr, newStr, options);
- }
- function diffWordsWithSpace(oldStr, newStr, options) {
- return wordDiff.diff(oldStr, newStr, options);
- }
- });
- unwrapExports(word);
- var word_1 = word.wordDiff;
- var word_2 = word.diffWords;
- var word_3 = word.diffWordsWithSpace;
- var line = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports.lineDiff = undefined;
- exports. /*istanbul ignore end*/diffLines = diffLines;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = diffTrimmedLines;
- /*istanbul ignore start*/var _base2 = _interopRequireDefault(base);
- /*istanbul ignore end*/
- /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
- /*istanbul ignore end*/var lineDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/lineDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
- lineDiff.tokenize = function (value) {
- var retLines = [],
- linesAndNewlines = value.split(/(\n|\r\n)/);
- // Ignore the final empty token that occurs if the string ends with a new line
- if (!linesAndNewlines[linesAndNewlines.length - 1]) {
- linesAndNewlines.pop();
- }
- // Merge the content and line separators into single tokens
- for (var i = 0; i < linesAndNewlines.length; i++) {
- var line = linesAndNewlines[i];
- if (i % 2 && !this.options.newlineIsToken) {
- retLines[retLines.length - 1] += line;
- } else {
- if (this.options.ignoreWhitespace) {
- line = line.trim();
- }
- retLines.push(line);
- }
- }
- return retLines;
- };
- function diffLines(oldStr, newStr, callback) {
- return lineDiff.diff(oldStr, newStr, callback);
- }
- function diffTrimmedLines(oldStr, newStr, callback) {
- var options = /*istanbul ignore start*/(0, params.generateOptions) /*istanbul ignore end*/(callback, { ignoreWhitespace: true });
- return lineDiff.diff(oldStr, newStr, options);
- }
- });
- unwrapExports(line);
- var line_1 = line.lineDiff;
- var line_2 = line.diffLines;
- var line_3 = line.diffTrimmedLines;
- var sentence = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports.sentenceDiff = undefined;
- exports. /*istanbul ignore end*/diffSentences = diffSentences;
- /*istanbul ignore start*/var _base2 = _interopRequireDefault(base);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
- /*istanbul ignore end*/var sentenceDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/sentenceDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
- sentenceDiff.tokenize = function (value) {
- return value.split(/(\S.+?[.!?])(?=\s+|$)/);
- };
- function diffSentences(oldStr, newStr, callback) {
- return sentenceDiff.diff(oldStr, newStr, callback);
- }
- });
- unwrapExports(sentence);
- var sentence_1 = sentence.sentenceDiff;
- var sentence_2 = sentence.diffSentences;
- var css = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports.cssDiff = undefined;
- exports. /*istanbul ignore end*/diffCss = diffCss;
- /*istanbul ignore start*/var _base2 = _interopRequireDefault(base);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
- /*istanbul ignore end*/var cssDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/cssDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
- cssDiff.tokenize = function (value) {
- return value.split(/([{}:;,]|\s+)/);
- };
- function diffCss(oldStr, newStr, callback) {
- return cssDiff.diff(oldStr, newStr, callback);
- }
- });
- unwrapExports(css);
- var css_1 = css.cssDiff;
- var css_2 = css.diffCss;
- var json = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports.jsonDiff = undefined;
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
- exports. /*istanbul ignore end*/diffJson = diffJson;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = canonicalize;
- /*istanbul ignore start*/var _base2 = _interopRequireDefault(base);
- /*istanbul ignore end*/
- /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
- /*istanbul ignore end*/var objectPrototypeToString = Object.prototype.toString;
- var jsonDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/jsonDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
- // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
- // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
- jsonDiff.useLongestToken = true;
- jsonDiff.tokenize = /*istanbul ignore start*/line.lineDiff /*istanbul ignore end*/.tokenize;
- jsonDiff.castInput = function (value) {
- /*istanbul ignore start*/var _options = /*istanbul ignore end*/this.options,
- undefinedReplacement = _options.undefinedReplacement,
- _options$stringifyRep = _options.stringifyReplacer,
- stringifyReplacer = _options$stringifyRep === undefined ? function (k, v) /*istanbul ignore start*/{
- return (/*istanbul ignore end*/typeof v === 'undefined' ? undefinedReplacement : v
- );
- } : _options$stringifyRep;
- return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' ');
- };
- jsonDiff.equals = function (left, right) {
- return (/*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'))
- );
- };
- function diffJson(oldObj, newObj, options) {
- return jsonDiff.diff(oldObj, newObj, options);
- }
- // This function handles the presence of circular references by bailing out when encountering an
- // object that is already on the "stack" of items being processed. Accepts an optional replacer
- function canonicalize(obj, stack, replacementStack, replacer, key) {
- stack = stack || [];
- replacementStack = replacementStack || [];
- if (replacer) {
- obj = replacer(key, obj);
- }
- var i = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
- for (i = 0; i < stack.length; i += 1) {
- if (stack[i] === obj) {
- return replacementStack[i];
- }
- }
- var canonicalizedObj = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
- if ('[object Array]' === objectPrototypeToString.call(obj)) {
- stack.push(obj);
- canonicalizedObj = new Array(obj.length);
- replacementStack.push(canonicalizedObj);
- for (i = 0; i < obj.length; i += 1) {
- canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
- }
- stack.pop();
- replacementStack.pop();
- return canonicalizedObj;
- }
- if (obj && obj.toJSON) {
- obj = obj.toJSON();
- }
- if ( /*istanbul ignore start*/(typeof /*istanbul ignore end*/obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null) {
- stack.push(obj);
- canonicalizedObj = {};
- replacementStack.push(canonicalizedObj);
- var sortedKeys = [],
- _key = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
- for (_key in obj) {
- /* istanbul ignore else */
- if (obj.hasOwnProperty(_key)) {
- sortedKeys.push(_key);
- }
- }
- sortedKeys.sort();
- for (i = 0; i < sortedKeys.length; i += 1) {
- _key = sortedKeys[i];
- canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
- }
- stack.pop();
- replacementStack.pop();
- } else {
- canonicalizedObj = obj;
- }
- return canonicalizedObj;
- }
- });
- unwrapExports(json);
- var json_1 = json.jsonDiff;
- var json_2 = json.diffJson;
- var json_3 = json.canonicalize;
- var array = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports.arrayDiff = undefined;
- exports. /*istanbul ignore end*/diffArrays = diffArrays;
- /*istanbul ignore start*/var _base2 = _interopRequireDefault(base);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
- /*istanbul ignore end*/var arrayDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
- arrayDiff.tokenize = function (value) {
- return value.slice();
- };
- arrayDiff.join = arrayDiff.removeEmpty = function (value) {
- return value;
- };
- function diffArrays(oldArr, newArr, callback) {
- return arrayDiff.diff(oldArr, newArr, callback);
- }
- });
- unwrapExports(array);
- var array_1 = array.arrayDiff;
- var array_2 = array.diffArrays;
- var parse = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports. /*istanbul ignore end*/parsePatch = parsePatch;
- function parsePatch(uniDiff) {
- /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/),
- delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [],
- list = [],
- i = 0;
- function parseIndex() {
- var index = {};
- list.push(index);
- // Parse diff metadata
- while (i < diffstr.length) {
- var line = diffstr[i];
- // File header found, end parsing diff metadata
- if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
- break;
- }
- // Diff index
- var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
- if (header) {
- index.index = header[1];
- }
- i++;
- }
- // Parse file headers if they are defined. Unified diff requires them, but
- // there's no technical issues to have an isolated hunk without file header
- parseFileHeader(index);
- parseFileHeader(index);
- // Parse hunks
- index.hunks = [];
- while (i < diffstr.length) {
- var _line = diffstr[i];
- if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) {
- break;
- } else if (/^@@/.test(_line)) {
- index.hunks.push(parseHunk());
- } else if (_line && options.strict) {
- // Ignore unexpected content unless in strict mode
- throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line));
- } else {
- i++;
- }
- }
- }
- // Parses the --- and +++ headers, if none are found, no lines
- // are consumed.
- function parseFileHeader(index) {
- var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]);
- if (fileHeader) {
- var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
- var data = fileHeader[2].split('\t', 2);
- var fileName = data[0].replace(/\\\\/g, '\\');
- if (/^".*"$/.test(fileName)) {
- fileName = fileName.substr(1, fileName.length - 2);
- }
- index[keyPrefix + 'FileName'] = fileName;
- index[keyPrefix + 'Header'] = (data[1] || '').trim();
- i++;
- }
- }
- // Parses a hunk
- // This assumes that we are at the start of a hunk.
- function parseHunk() {
- var chunkHeaderIndex = i,
- chunkHeaderLine = diffstr[i++],
- chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
- var hunk = {
- oldStart: +chunkHeader[1],
- oldLines: +chunkHeader[2] || 1,
- newStart: +chunkHeader[3],
- newLines: +chunkHeader[4] || 1,
- lines: [],
- linedelimiters: []
- };
- var addCount = 0,
- removeCount = 0;
- for (; i < diffstr.length; i++) {
- // Lines starting with '---' could be mistaken for the "remove line" operation
- // But they could be the header for the next file. Therefore prune such cases out.
- if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) {
- break;
- }
- var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0];
- if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
- hunk.lines.push(diffstr[i]);
- hunk.linedelimiters.push(delimiters[i] || '\n');
- if (operation === '+') {
- addCount++;
- } else if (operation === '-') {
- removeCount++;
- } else if (operation === ' ') {
- addCount++;
- removeCount++;
- }
- } else {
- break;
- }
- }
- // Handle the empty block count case
- if (!addCount && hunk.newLines === 1) {
- hunk.newLines = 0;
- }
- if (!removeCount && hunk.oldLines === 1) {
- hunk.oldLines = 0;
- }
- // Perform optional sanity checking
- if (options.strict) {
- if (addCount !== hunk.newLines) {
- throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
- }
- if (removeCount !== hunk.oldLines) {
- throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
- }
- }
- return hunk;
- }
- while (i < diffstr.length) {
- parseIndex();
- }
- return list;
- }
- });
- unwrapExports(parse);
- var parse_1 = parse.parsePatch;
- var distanceIterator = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = /*istanbul ignore end*/function (start, minLine, maxLine) {
- var wantForward = true,
- backwardExhausted = false,
- forwardExhausted = false,
- localOffset = 1;
- return function iterator() {
- if (wantForward && !forwardExhausted) {
- if (backwardExhausted) {
- localOffset++;
- } else {
- wantForward = false;
- }
- // Check if trying to fit beyond text length, and if not, check it fits
- // after offset location (or desired location on first iteration)
- if (start + localOffset <= maxLine) {
- return localOffset;
- }
- forwardExhausted = true;
- }
- if (!backwardExhausted) {
- if (!forwardExhausted) {
- wantForward = true;
- }
- // Check if trying to fit before text beginning, and if not, check it fits
- // before offset location
- if (minLine <= start - localOffset) {
- return -localOffset++;
- }
- backwardExhausted = true;
- return iterator();
- }
- // We tried to fit hunk before text beginning and beyond text length, then
- // hunk can't fit on the text. Return undefined
- };
- };
- });
- unwrapExports(distanceIterator);
- var apply = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports. /*istanbul ignore end*/applyPatch = applyPatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = applyPatches;
- /*istanbul ignore start*/var _distanceIterator2 = _interopRequireDefault(distanceIterator);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
- /*istanbul ignore end*/function applyPatch(source, uniDiff) {
- /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- if (typeof uniDiff === 'string') {
- uniDiff = /*istanbul ignore start*/(0, parse.parsePatch) /*istanbul ignore end*/(uniDiff);
- }
- if (Array.isArray(uniDiff)) {
- if (uniDiff.length > 1) {
- throw new Error('applyPatch only works with a single input.');
- }
- uniDiff = uniDiff[0];
- }
- // Apply the diff to the input
- var lines = source.split(/\r\n|[\n\v\f\r\x85]/),
- delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [],
- hunks = uniDiff.hunks,
- compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) /*istanbul ignore start*/{
- return (/*istanbul ignore end*/line === patchContent
- );
- },
- errorCount = 0,
- fuzzFactor = options.fuzzFactor || 0,
- minLine = 0,
- offset = 0,
- removeEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
- addEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
- /**
- * Checks if the hunk exactly fits on the provided location
- */
- function hunkFits(hunk, toPos) {
- for (var j = 0; j < hunk.lines.length; j++) {
- var line = hunk.lines[j],
- operation = line.length > 0 ? line[0] : ' ',
- content = line.length > 0 ? line.substr(1) : line;
- if (operation === ' ' || operation === '-') {
- // Context sanity check
- if (!compareLine(toPos + 1, lines[toPos], operation, content)) {
- errorCount++;
- if (errorCount > fuzzFactor) {
- return false;
- }
- }
- toPos++;
- }
- }
- return true;
- }
- // Search best fit offsets for each hunk based on the previous ones
- for (var i = 0; i < hunks.length; i++) {
- var hunk = hunks[i],
- maxLine = lines.length - hunk.oldLines,
- localOffset = 0,
- toPos = offset + hunk.oldStart - 1;
- var iterator = /*istanbul ignore start*/(0, _distanceIterator2['default']) /*istanbul ignore end*/(toPos, minLine, maxLine);
- for (; localOffset !== undefined; localOffset = iterator()) {
- if (hunkFits(hunk, toPos + localOffset)) {
- hunk.offset = offset += localOffset;
- break;
- }
- }
- if (localOffset === undefined) {
- return false;
- }
- // Set lower text limit to end of the current hunk, so next ones don't try
- // to fit over already patched text
- minLine = hunk.offset + hunk.oldStart + hunk.oldLines;
- }
- // Apply patch hunks
- var diffOffset = 0;
- for (var _i = 0; _i < hunks.length; _i++) {
- var _hunk = hunks[_i],
- _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1;
- diffOffset += _hunk.newLines - _hunk.oldLines;
- if (_toPos < 0) {
- // Creating a new file
- _toPos = 0;
- }
- for (var j = 0; j < _hunk.lines.length; j++) {
- var line = _hunk.lines[j],
- operation = line.length > 0 ? line[0] : ' ',
- content = line.length > 0 ? line.substr(1) : line,
- delimiter = _hunk.linedelimiters[j];
- if (operation === ' ') {
- _toPos++;
- } else if (operation === '-') {
- lines.splice(_toPos, 1);
- delimiters.splice(_toPos, 1);
- /* istanbul ignore else */
- } else if (operation === '+') {
- lines.splice(_toPos, 0, content);
- delimiters.splice(_toPos, 0, delimiter);
- _toPos++;
- } else if (operation === '\\') {
- var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null;
- if (previousOperation === '+') {
- removeEOFNL = true;
- } else if (previousOperation === '-') {
- addEOFNL = true;
- }
- }
- }
- }
- // Handle EOFNL insertion/removal
- if (removeEOFNL) {
- while (!lines[lines.length - 1]) {
- lines.pop();
- delimiters.pop();
- }
- } else if (addEOFNL) {
- lines.push('');
- delimiters.push('\n');
- }
- for (var _k = 0; _k < lines.length - 1; _k++) {
- lines[_k] = lines[_k] + delimiters[_k];
- }
- return lines.join('');
- }
- // Wrapper that supports multiple file patches via callbacks.
- function applyPatches(uniDiff, options) {
- if (typeof uniDiff === 'string') {
- uniDiff = /*istanbul ignore start*/(0, parse.parsePatch) /*istanbul ignore end*/(uniDiff);
- }
- var currentIndex = 0;
- function processIndex() {
- var index = uniDiff[currentIndex++];
- if (!index) {
- return options.complete();
- }
- options.loadFile(index, function (err, data) {
- if (err) {
- return options.complete(err);
- }
- var updatedContent = applyPatch(data, index, options);
- options.patched(index, updatedContent, function (err) {
- if (err) {
- return options.complete(err);
- }
- processIndex();
- });
- });
- }
- processIndex();
- }
- });
- unwrapExports(apply);
- var apply_1 = apply.applyPatch;
- var apply_2 = apply.applyPatches;
- var create$2 = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports. /*istanbul ignore end*/structuredPatch = structuredPatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = createTwoFilesPatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = createPatch;
- /*istanbul ignore start*/function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
- /*istanbul ignore end*/function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
- if (!options) {
- options = {};
- }
- if (typeof options.context === 'undefined') {
- options.context = 4;
- }
- var diff = /*istanbul ignore start*/(0, line.diffLines) /*istanbul ignore end*/(oldStr, newStr, options);
- diff.push({ value: '', lines: [] }); // Append an empty value to make cleanup easier
- function contextLines(lines) {
- return lines.map(function (entry) {
- return ' ' + entry;
- });
- }
- var hunks = [];
- var oldRangeStart = 0,
- newRangeStart = 0,
- curRange = [],
- oldLine = 1,
- newLine = 1;
- /*istanbul ignore start*/var _loop = function _loop( /*istanbul ignore end*/i) {
- var current = diff[i],
- lines = current.lines || current.value.replace(/\n$/, '').split('\n');
- current.lines = lines;
- if (current.added || current.removed) {
- /*istanbul ignore start*/var _curRange;
- /*istanbul ignore end*/ // If we have previous context, start with that
- if (!oldRangeStart) {
- var prev = diff[i - 1];
- oldRangeStart = oldLine;
- newRangeStart = newLine;
- if (prev) {
- curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
- oldRangeStart -= curRange.length;
- newRangeStart -= curRange.length;
- }
- }
- // Output our changes
- /*istanbul ignore start*/(_curRange = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/lines.map(function (entry) {
- return (current.added ? '+' : '-') + entry;
- })));
- // Track the updated file position
- if (current.added) {
- newLine += lines.length;
- } else {
- oldLine += lines.length;
- }
- } else {
- // Identical context lines. Track line changes
- if (oldRangeStart) {
- // Close out any changes that have been output (or join overlapping)
- if (lines.length <= options.context * 2 && i < diff.length - 2) {
- /*istanbul ignore start*/var _curRange2;
- /*istanbul ignore end*/ // Overlapping
- /*istanbul ignore start*/(_curRange2 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange2 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/contextLines(lines)));
- } else {
- /*istanbul ignore start*/var _curRange3;
- /*istanbul ignore end*/ // end the range and output
- var contextSize = Math.min(lines.length, options.context);
- /*istanbul ignore start*/(_curRange3 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange3 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/contextLines(lines.slice(0, contextSize))));
- var hunk = {
- oldStart: oldRangeStart,
- oldLines: oldLine - oldRangeStart + contextSize,
- newStart: newRangeStart,
- newLines: newLine - newRangeStart + contextSize,
- lines: curRange
- };
- if (i >= diff.length - 2 && lines.length <= options.context) {
- // EOF is inside this hunk
- var oldEOFNewline = /\n$/.test(oldStr);
- var newEOFNewline = /\n$/.test(newStr);
- if (lines.length == 0 && !oldEOFNewline) {
- // special case: old has no eol and no trailing context; no-nl can end up before adds
- curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file');
- } else if (!oldEOFNewline || !newEOFNewline) {
- curRange.push('\\ No newline at end of file');
- }
- }
- hunks.push(hunk);
- oldRangeStart = 0;
- newRangeStart = 0;
- curRange = [];
- }
- }
- oldLine += lines.length;
- newLine += lines.length;
- }
- };
- for (var i = 0; i < diff.length; i++) {
- /*istanbul ignore start*/_loop( /*istanbul ignore end*/i);
- }
- return {
- oldFileName: oldFileName, newFileName: newFileName,
- oldHeader: oldHeader, newHeader: newHeader,
- hunks: hunks
- };
- }
- function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
- var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
- var ret = [];
- if (oldFileName == newFileName) {
- ret.push('Index: ' + oldFileName);
- }
- ret.push('===================================================================');
- ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
- ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
- for (var i = 0; i < diff.hunks.length; i++) {
- var hunk = diff.hunks[i];
- ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
- ret.push.apply(ret, hunk.lines);
- }
- return ret.join('\n') + '\n';
- }
- function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
- return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
- }
- });
- unwrapExports(create$2);
- var create_1 = create$2.structuredPatch;
- var create_2 = create$2.createTwoFilesPatch;
- var create_3 = create$2.createPatch;
- var array$2 = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports. /*istanbul ignore end*/arrayEqual = arrayEqual;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayStartsWith = arrayStartsWith;
- function arrayEqual(a, b) {
- if (a.length !== b.length) {
- return false;
- }
- return arrayStartsWith(a, b);
- }
- function arrayStartsWith(array, start) {
- if (start.length > array.length) {
- return false;
- }
- for (var i = 0; i < start.length; i++) {
- if (start[i] !== array[i]) {
- return false;
- }
- }
- return true;
- }
- });
- unwrapExports(array$2);
- var array_1$1 = array$2.arrayEqual;
- var array_2$1 = array$2.arrayStartsWith;
- var merge_1 = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports. /*istanbul ignore end*/calcLineCount = calcLineCount;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = merge;
- /*istanbul ignore start*/function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
- /*istanbul ignore end*/function calcLineCount(hunk) {
- /*istanbul ignore start*/var _calcOldNewLineCount = /*istanbul ignore end*/calcOldNewLineCount(hunk.lines),
- oldLines = _calcOldNewLineCount.oldLines,
- newLines = _calcOldNewLineCount.newLines;
- if (oldLines !== undefined) {
- hunk.oldLines = oldLines;
- } else {
- delete hunk.oldLines;
- }
- if (newLines !== undefined) {
- hunk.newLines = newLines;
- } else {
- delete hunk.newLines;
- }
- }
- function merge(mine, theirs, base) {
- mine = loadPatch(mine, base);
- theirs = loadPatch(theirs, base);
- var ret = {};
- // For index we just let it pass through as it doesn't have any necessary meaning.
- // Leaving sanity checks on this to the API consumer that may know more about the
- // meaning in their own context.
- if (mine.index || theirs.index) {
- ret.index = mine.index || theirs.index;
- }
- if (mine.newFileName || theirs.newFileName) {
- if (!fileNameChanged(mine)) {
- // No header or no change in ours, use theirs (and ours if theirs does not exist)
- ret.oldFileName = theirs.oldFileName || mine.oldFileName;
- ret.newFileName = theirs.newFileName || mine.newFileName;
- ret.oldHeader = theirs.oldHeader || mine.oldHeader;
- ret.newHeader = theirs.newHeader || mine.newHeader;
- } else if (!fileNameChanged(theirs)) {
- // No header or no change in theirs, use ours
- ret.oldFileName = mine.oldFileName;
- ret.newFileName = mine.newFileName;
- ret.oldHeader = mine.oldHeader;
- ret.newHeader = mine.newHeader;
- } else {
- // Both changed... figure it out
- ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);
- ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);
- ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);
- ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);
- }
- }
- ret.hunks = [];
- var mineIndex = 0,
- theirsIndex = 0,
- mineOffset = 0,
- theirsOffset = 0;
- while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {
- var mineCurrent = mine.hunks[mineIndex] || { oldStart: Infinity },
- theirsCurrent = theirs.hunks[theirsIndex] || { oldStart: Infinity };
- if (hunkBefore(mineCurrent, theirsCurrent)) {
- // This patch does not overlap with any of the others, yay.
- ret.hunks.push(cloneHunk(mineCurrent, mineOffset));
- mineIndex++;
- theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;
- } else if (hunkBefore(theirsCurrent, mineCurrent)) {
- // This patch does not overlap with any of the others, yay.
- ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));
- theirsIndex++;
- mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;
- } else {
- // Overlap, merge as best we can
- var mergedHunk = {
- oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),
- oldLines: 0,
- newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),
- newLines: 0,
- lines: []
- };
- mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);
- theirsIndex++;
- mineIndex++;
- ret.hunks.push(mergedHunk);
- }
- }
- return ret;
- }
- function loadPatch(param, base) {
- if (typeof param === 'string') {
- if (/^@@/m.test(param) || /^Index:/m.test(param)) {
- return (/*istanbul ignore start*/(0, parse.parsePatch) /*istanbul ignore end*/(param)[0]
- );
- }
- if (!base) {
- throw new Error('Must provide a base reference or pass in a patch');
- }
- return (/*istanbul ignore start*/(0, create$2.structuredPatch) /*istanbul ignore end*/(undefined, undefined, base, param)
- );
- }
- return param;
- }
- function fileNameChanged(patch) {
- return patch.newFileName && patch.newFileName !== patch.oldFileName;
- }
- function selectField(index, mine, theirs) {
- if (mine === theirs) {
- return mine;
- } else {
- index.conflict = true;
- return { mine: mine, theirs: theirs };
- }
- }
- function hunkBefore(test, check) {
- return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart;
- }
- function cloneHunk(hunk, offset) {
- return {
- oldStart: hunk.oldStart, oldLines: hunk.oldLines,
- newStart: hunk.newStart + offset, newLines: hunk.newLines,
- lines: hunk.lines
- };
- }
- function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {
- // This will generally result in a conflicted hunk, but there are cases where the context
- // is the only overlap where we can successfully merge the content here.
- var mine = { offset: mineOffset, lines: mineLines, index: 0 },
- their = { offset: theirOffset, lines: theirLines, index: 0 };
- // Handle any leading content
- insertLeading(hunk, mine, their);
- insertLeading(hunk, their, mine);
- // Now in the overlap content. Scan through and select the best changes from each.
- while (mine.index < mine.lines.length && their.index < their.lines.length) {
- var mineCurrent = mine.lines[mine.index],
- theirCurrent = their.lines[their.index];
- if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) {
- // Both modified ...
- mutualChange(hunk, mine, their);
- } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') {
- /*istanbul ignore start*/var _hunk$lines;
- /*istanbul ignore end*/ // Mine inserted
- /*istanbul ignore start*/(_hunk$lines = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/collectChange(mine)));
- } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') {
- /*istanbul ignore start*/var _hunk$lines2;
- /*istanbul ignore end*/ // Theirs inserted
- /*istanbul ignore start*/(_hunk$lines2 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines2 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/collectChange(their)));
- } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') {
- // Mine removed or edited
- removal(hunk, mine, their);
- } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') {
- // Their removed or edited
- removal(hunk, their, mine, true);
- } else if (mineCurrent === theirCurrent) {
- // Context identity
- hunk.lines.push(mineCurrent);
- mine.index++;
- their.index++;
- } else {
- // Context mismatch
- conflict(hunk, collectChange(mine), collectChange(their));
- }
- }
- // Now push anything that may be remaining
- insertTrailing(hunk, mine);
- insertTrailing(hunk, their);
- calcLineCount(hunk);
- }
- function mutualChange(hunk, mine, their) {
- var myChanges = collectChange(mine),
- theirChanges = collectChange(their);
- if (allRemoves(myChanges) && allRemoves(theirChanges)) {
- // Special case for remove changes that are supersets of one another
- if ( /*istanbul ignore start*/(0, array$2.arrayStartsWith) /*istanbul ignore end*/(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) {
- /*istanbul ignore start*/var _hunk$lines3;
- /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines3 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines3 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/myChanges));
- return;
- } else if ( /*istanbul ignore start*/(0, array$2.arrayStartsWith) /*istanbul ignore end*/(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {
- /*istanbul ignore start*/var _hunk$lines4;
- /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines4 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines4 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/theirChanges));
- return;
- }
- } else if ( /*istanbul ignore start*/(0, array$2.arrayEqual) /*istanbul ignore end*/(myChanges, theirChanges)) {
- /*istanbul ignore start*/var _hunk$lines5;
- /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines5 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines5 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/myChanges));
- return;
- }
- conflict(hunk, myChanges, theirChanges);
- }
- function removal(hunk, mine, their, swap) {
- var myChanges = collectChange(mine),
- theirChanges = collectContext(their, myChanges);
- if (theirChanges.merged) {
- /*istanbul ignore start*/var _hunk$lines6;
- /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines6 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines6 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/theirChanges.merged));
- } else {
- conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);
- }
- }
- function conflict(hunk, mine, their) {
- hunk.conflict = true;
- hunk.lines.push({
- conflict: true,
- mine: mine,
- theirs: their
- });
- }
- function insertLeading(hunk, insert, their) {
- while (insert.offset < their.offset && insert.index < insert.lines.length) {
- var line = insert.lines[insert.index++];
- hunk.lines.push(line);
- insert.offset++;
- }
- }
- function insertTrailing(hunk, insert) {
- while (insert.index < insert.lines.length) {
- var line = insert.lines[insert.index++];
- hunk.lines.push(line);
- }
- }
- function collectChange(state) {
- var ret = [],
- operation = state.lines[state.index][0];
- while (state.index < state.lines.length) {
- var line = state.lines[state.index];
- // Group additions that are immediately after subtractions and treat them as one "atomic" modify change.
- if (operation === '-' && line[0] === '+') {
- operation = '+';
- }
- if (operation === line[0]) {
- ret.push(line);
- state.index++;
- } else {
- break;
- }
- }
- return ret;
- }
- function collectContext(state, matchChanges) {
- var changes = [],
- merged = [],
- matchIndex = 0,
- contextChanges = false,
- conflicted = false;
- while (matchIndex < matchChanges.length && state.index < state.lines.length) {
- var change = state.lines[state.index],
- match = matchChanges[matchIndex];
- // Once we've hit our add, then we are done
- if (match[0] === '+') {
- break;
- }
- contextChanges = contextChanges || change[0] !== ' ';
- merged.push(match);
- matchIndex++;
- // Consume any additions in the other block as a conflict to attempt
- // to pull in the remaining context after this
- if (change[0] === '+') {
- conflicted = true;
- while (change[0] === '+') {
- changes.push(change);
- change = state.lines[++state.index];
- }
- }
- if (match.substr(1) === change.substr(1)) {
- changes.push(change);
- state.index++;
- } else {
- conflicted = true;
- }
- }
- if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) {
- conflicted = true;
- }
- if (conflicted) {
- return changes;
- }
- while (matchIndex < matchChanges.length) {
- merged.push(matchChanges[matchIndex++]);
- }
- return {
- merged: merged,
- changes: changes
- };
- }
- function allRemoves(changes) {
- return changes.reduce(function (prev, change) {
- return prev && change[0] === '-';
- }, true);
- }
- function skipRemoveSuperset(state, removeChanges, delta) {
- for (var i = 0; i < delta; i++) {
- var changeContent = removeChanges[removeChanges.length - delta + i].substr(1);
- if (state.lines[state.index + i] !== ' ' + changeContent) {
- return false;
- }
- }
- state.index += delta;
- return true;
- }
- function calcOldNewLineCount(lines) {
- var oldLines = 0;
- var newLines = 0;
- lines.forEach(function (line) {
- if (typeof line !== 'string') {
- var myCount = calcOldNewLineCount(line.mine);
- var theirCount = calcOldNewLineCount(line.theirs);
- if (oldLines !== undefined) {
- if (myCount.oldLines === theirCount.oldLines) {
- oldLines += myCount.oldLines;
- } else {
- oldLines = undefined;
- }
- }
- if (newLines !== undefined) {
- if (myCount.newLines === theirCount.newLines) {
- newLines += myCount.newLines;
- } else {
- newLines = undefined;
- }
- }
- } else {
- if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) {
- newLines++;
- }
- if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) {
- oldLines++;
- }
- }
- });
- return { oldLines: oldLines, newLines: newLines };
- }
- });
- unwrapExports(merge_1);
- var merge_2 = merge_1.calcLineCount;
- var merge_3 = merge_1.merge;
- var dmp = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports. /*istanbul ignore end*/convertChangesToDMP = convertChangesToDMP;
- // See: http://code.google.com/p/google-diff-match-patch/wiki/API
- function convertChangesToDMP(changes) {
- var ret = [],
- change = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
- operation = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
- for (var i = 0; i < changes.length; i++) {
- change = changes[i];
- if (change.added) {
- operation = 1;
- } else if (change.removed) {
- operation = -1;
- } else {
- operation = 0;
- }
- ret.push([operation, change.value]);
- }
- return ret;
- }
- });
- unwrapExports(dmp);
- var dmp_1 = dmp.convertChangesToDMP;
- var xml = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports. /*istanbul ignore end*/convertChangesToXML = convertChangesToXML;
- function convertChangesToXML(changes) {
- var ret = [];
- for (var i = 0; i < changes.length; i++) {
- var change = changes[i];
- if (change.added) {
- ret.push('<ins>');
- } else if (change.removed) {
- ret.push('<del>');
- }
- ret.push(escapeHTML(change.value));
- if (change.added) {
- ret.push('</ins>');
- } else if (change.removed) {
- ret.push('</del>');
- }
- }
- return ret.join('');
- }
- function escapeHTML(s) {
- var n = s;
- n = n.replace(/&/g, '&');
- n = n.replace(/</g, '<');
- n = n.replace(/>/g, '>');
- n = n.replace(/"/g, '"');
- return n;
- }
- });
- unwrapExports(xml);
- var xml_1 = xml.convertChangesToXML;
- var lib = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports.canonicalize = exports.convertChangesToXML = exports.convertChangesToDMP = exports.merge = exports.parsePatch = exports.applyPatches = exports.applyPatch = exports.createPatch = exports.createTwoFilesPatch = exports.structuredPatch = exports.diffArrays = exports.diffJson = exports.diffCss = exports.diffSentences = exports.diffTrimmedLines = exports.diffLines = exports.diffWordsWithSpace = exports.diffWords = exports.diffChars = exports.Diff = undefined;
- /*istanbul ignore end*/
- /*istanbul ignore start*/var _base2 = _interopRequireDefault(base);
- /*istanbul ignore end*/
- /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
- /* See LICENSE file for terms of use */
- /*
- * Text diff implementation.
- *
- * This library supports the following APIS:
- * JsDiff.diffChars: Character by character diff
- * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
- * JsDiff.diffLines: Line based diff
- *
- * JsDiff.diffCss: Diff targeted at CSS content
- *
- * These methods are based on the implementation proposed in
- * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
- * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
- */
- exports. /*istanbul ignore end*/Diff = _base2['default'];
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffChars = character.diffChars;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWords = word.diffWords;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = word.diffWordsWithSpace;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffLines = line.diffLines;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = line.diffTrimmedLines;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffSentences = sentence.diffSentences;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffCss = css.diffCss;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffJson = json.diffJson;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffArrays = array.diffArrays;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/structuredPatch = create$2.structuredPatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = create$2.createTwoFilesPatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = create$2.createPatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatch = apply.applyPatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = apply.applyPatches;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/parsePatch = parse.parsePatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = merge_1.merge;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToDMP = dmp.convertChangesToDMP;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToXML = xml.convertChangesToXML;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = json.canonicalize;
- });
- unwrapExports(lib);
- var lib_1 = lib.canonicalize;
- var lib_2 = lib.convertChangesToXML;
- var lib_3 = lib.convertChangesToDMP;
- var lib_4 = lib.merge;
- var lib_5 = lib.parsePatch;
- var lib_6 = lib.applyPatches;
- var lib_7 = lib.applyPatch;
- var lib_8 = lib.createPatch;
- var lib_9 = lib.createTwoFilesPatch;
- var lib_10 = lib.structuredPatch;
- var lib_11 = lib.diffArrays;
- var lib_12 = lib.diffJson;
- var lib_13 = lib.diffCss;
- var lib_14 = lib.diffSentences;
- var lib_15 = lib.diffTrimmedLines;
- var lib_16 = lib.diffLines;
- var lib_17 = lib.diffWordsWithSpace;
- var lib_18 = lib.diffWords;
- var lib_19 = lib.diffChars;
- var lib_20 = lib.Diff;
- var constants = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.SIMILAR_MESSAGE = exports.NO_DIFF_MESSAGE = undefined;
- var _chalk2 = _interopRequireDefault(fake_chalk);
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : { default: obj };
- }
- var NO_DIFF_MESSAGE = exports.NO_DIFF_MESSAGE = _chalk2.default.dim('Compared values have no visual difference.');
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var SIMILAR_MESSAGE = exports.SIMILAR_MESSAGE = _chalk2.default.dim('Compared values serialize to the same structure.\n' + 'Printing internal object structure without calling `toJSON` instead.');
- });
- unwrapExports(constants);
- var constants_1 = constants.SIMILAR_MESSAGE;
- var constants_2 = constants.NO_DIFF_MESSAGE;
- var diff_strings = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.default = diffStrings;
- var _chalk2 = _interopRequireDefault(fake_chalk);
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : { default: obj };
- }
- var DIFF_CONTEXT_DEFAULT = 5; // removed | added | equal
- // Given diff digit, return array which consists of:
- // if compared line is removed or added: corresponding original line
- // if compared line is equal: original received and expected lines
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- // Given chunk, return diff character.
- var getDiffChar = function getDiffChar(chunk) {
- return chunk.removed ? '-' : chunk.added ? '+' : ' ';
- };
- // Given diff character in line of hunk or computed from properties of chunk.
- var getDiffDigit = function getDiffDigit(char) {
- return char === '-' ? -1 : char === '+' ? 1 : 0;
- };
- // Color for text of line.
- var getColor = function getColor(digit, onlyIndentationChanged) {
- if (digit === -1) {
- return _chalk2.default.green; // removed
- }
- if (digit === 1) {
- return _chalk2.default.red; // added
- }
- return onlyIndentationChanged ? _chalk2.default.cyan : _chalk2.default.dim;
- };
- // Do NOT color leading or trailing spaces if original lines are equal:
- // Background color for leading or trailing spaces.
- var getBgColor = function getBgColor(digit, onlyIndentationChanged) {
- return digit === 0 && !onlyIndentationChanged ? _chalk2.default.bgYellow : _chalk2.default.inverse;
- };
- // ONLY trailing if expected value is snapshot or multiline string.
- var highlightTrailingSpaces = function highlightTrailingSpaces(line, bgColor) {
- return line.replace(/\s+$/, bgColor('$&'));
- };
- // BOTH leading AND trailing if expected value is data structure.
- var highlightLeadingTrailingSpaces = function highlightLeadingTrailingSpaces(line, bgColor
- // If line consists of ALL spaces: highlight all of them.
- ) {
- return highlightTrailingSpaces(line, bgColor).replace(
- // If line has an ODD length of leading spaces: highlight only the LAST.
- /^(\s\s)*(\s)(?=[^\s])/, '$1' + bgColor('$2'));
- };
- var getAnnotation = function getAnnotation(options) {
- return _chalk2.default.green('- ' + (options && options.aAnnotation || 'Expected')) + '\n' + _chalk2.default.red('+ ' + (options && options.bAnnotation || 'Received')) + '\n\n';
- };
- // Given string, return array of its lines.
- var splitIntoLines = function splitIntoLines(string) {
- var lines = string.split('\n');
- if (lines.length !== 0 && lines[lines.length - 1] === '') {
- lines.pop();
- }
- return lines;
- };
- // Given diff character and compared line, return original line with colors.
- var formatLine = function formatLine(char, lineCompared, getOriginal) {
- var digit = getDiffDigit(char);
- if (getOriginal) {
- // Compared without indentation if expected value is data structure.
- var lineArray = getOriginal(digit);
- var lineOriginal = lineArray[0];
- var onlyIndentationChanged = digit === 0 && lineOriginal.length !== lineArray[1].length;
- return getColor(digit, onlyIndentationChanged)(char + ' ' +
- // Prepend indentation spaces from original to compared line.
- lineOriginal.slice(0, lineOriginal.length - lineCompared.length) + highlightLeadingTrailingSpaces(lineCompared, getBgColor(digit, onlyIndentationChanged)));
- }
- // Format compared line when expected is snapshot or multiline string.
- return getColor(digit)(char + ' ' + highlightTrailingSpaces(lineCompared, getBgColor(digit)));
- };
- // Given original lines, return callback function
- // which given diff digit, returns array.
- var getterForChunks = function getterForChunks(original) {
- var linesExpected = splitIntoLines(original.a);
- var linesReceived = splitIntoLines(original.b);
- var iExpected = 0;
- var iReceived = 0;
- return function (digit) {
- if (digit === -1) {
- return [linesExpected[iExpected++]];
- }
- if (digit === 1) {
- return [linesReceived[iReceived++]];
- }
- // Because compared line is equal: original received and expected lines.
- return [linesReceived[iReceived++], linesExpected[iExpected++]];
- };
- };
- // jest --expand
- var formatChunks = function formatChunks(a, b, original) {
- var chunks = (0, lib.diffLines)(a, b);
- if (chunks.every(function (chunk) {
- return !chunk.removed && !chunk.added;
- })) {
- return null;
- }
- var getOriginal = original && getterForChunks(original);
- return chunks.reduce(function (lines, chunk) {
- var char = getDiffChar(chunk);
- splitIntoLines(chunk.value).forEach(function (line) {
- lines.push(formatLine(char, line, getOriginal));
- });
- return lines;
- }, []).join('\n');
- };
- // Only show patch marks ("@@ ... @@") if the diff is big.
- // To determine this, we need to compare either the original string (a) to
- // `hunk.oldLines` or a new string to `hunk.newLines`.
- // If the `oldLinesCount` is greater than `hunk.oldLines`
- // we can be sure that at least 1 line has been "hidden".
- var shouldShowPatchMarks = function shouldShowPatchMarks(hunk, oldLinesCount) {
- return oldLinesCount > hunk.oldLines;
- };
- var createPatchMark = function createPatchMark(hunk) {
- var markOld = '-' + hunk.oldStart + ',' + hunk.oldLines;
- var markNew = '+' + hunk.newStart + ',' + hunk.newLines;
- return _chalk2.default.yellow('@@ ' + markOld + ' ' + markNew + ' @@');
- };
- // Given original lines, return callback function which given indexes for hunk,
- // returns another callback function which given diff digit, returns array.
- var getterForHunks = function getterForHunks(original) {
- var linesExpected = splitIntoLines(original.a);
- var linesReceived = splitIntoLines(original.b);
- return function (iExpected, iReceived) {
- return function (digit) {
- if (digit === -1) {
- return [linesExpected[iExpected++]];
- }
- if (digit === 1) {
- return [linesReceived[iReceived++]];
- }
- // Because compared line is equal: original received and expected lines.
- return [linesReceived[iReceived++], linesExpected[iExpected++]];
- };
- };
- };
- // jest --no-expand
- var formatHunks = function formatHunks(a, b, contextLines, original) {
- var options = {
- context: typeof contextLines === 'number' && contextLines >= 0 ? contextLines : DIFF_CONTEXT_DEFAULT
- };
- var _structuredPatch = (0, lib.structuredPatch)('', '', a, b, '', '', options);
- var hunks = _structuredPatch.hunks;
- if (hunks.length === 0) {
- return null;
- }
- var getter = original && getterForHunks(original);
- var oldLinesCount = (a.match(/\n/g) || []).length;
- return hunks.reduce(function (lines, hunk) {
- if (shouldShowPatchMarks(hunk, oldLinesCount)) {
- lines.push(createPatchMark(hunk));
- }
- // Hunk properties are one-based but index args are zero-based.
- var getOriginal = getter && getter(hunk.oldStart - 1, hunk.newStart - 1);
- hunk.lines.forEach(function (line) {
- lines.push(formatLine(line[0], line.slice(1), getOriginal));
- });
- return lines;
- }, []).join('\n');
- };
- function diffStrings(a, b, options, original) {
- // Because `formatHunks` and `formatChunks` ignore one trailing newline,
- // always append newline to strings:
- a += '\n';
- b += '\n';
- // `diff` uses the Myers LCS diff algorithm which runs in O(n+d^2) time
- // (where "d" is the edit distance) and can get very slow for large edit
- // distances. Mitigate the cost by switching to a lower-resolution diff
- // whenever linebreaks are involved.
- var result = options && options.expand === false ? formatHunks(a, b, options && options.contextLines, original) : formatChunks(a, b, original);
- return result === null ? constants.NO_DIFF_MESSAGE : getAnnotation(options) + result;
- }
- });
- unwrapExports(diff_strings);
- var build$3 = createCommonjsModule(function (module) {
- var _prettyFormat2 = _interopRequireDefault(build$1);
- var _chalk2 = _interopRequireDefault(fake_chalk);
- var _jestGetType2 = _interopRequireDefault(build);
- var _diff_strings2 = _interopRequireDefault(diff_strings);
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : { default: obj };
- }
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var _prettyFormat$plugins = _prettyFormat2.default.plugins;
- var AsymmetricMatcher = _prettyFormat$plugins.AsymmetricMatcher,
- DOMCollection = _prettyFormat$plugins.DOMCollection,
- DOMElement = _prettyFormat$plugins.DOMElement,
- Immutable = _prettyFormat$plugins.Immutable,
- ReactElement = _prettyFormat$plugins.ReactElement,
- ReactTestComponent = _prettyFormat$plugins.ReactTestComponent;
- var PLUGINS = [ReactTestComponent, ReactElement, DOMElement, DOMCollection, Immutable, AsymmetricMatcher];
- var FORMAT_OPTIONS = {
- plugins: PLUGINS
- };
- var FORMAT_OPTIONS_0 = _Object$assign({}, FORMAT_OPTIONS, {
- indent: 0
- });
- var FALLBACK_FORMAT_OPTIONS = {
- callToJSON: false,
- maxDepth: 10,
- plugins: PLUGINS
- };
- var FALLBACK_FORMAT_OPTIONS_0 = _Object$assign({}, FALLBACK_FORMAT_OPTIONS, {
- indent: 0
- });
- // Generate a string that will highlight the difference between two values
- // with green and red. (similar to how github does code diffing)
- function diff(a, b, options) {
- if (a === b) {
- return constants.NO_DIFF_MESSAGE;
- }
- var aType = (0, _jestGetType2.default)(a);
- var expectedType = aType;
- var omitDifference = false;
- if (aType === 'object' && typeof a.asymmetricMatch === 'function') {
- if (a.$$typeof !== _Symbol$for('jest.asymmetricMatcher')) {
- // Do not know expected type of user-defined asymmetric matcher.
- return null;
- }
- if (typeof a.getExpectedType !== 'function') {
- // For example, expect.anything() matches either null or undefined
- return null;
- }
- expectedType = a.getExpectedType();
- // Primitive types boolean and number omit difference below.
- // For example, omit difference for expect.stringMatching(regexp)
- omitDifference = expectedType === 'string';
- }
- if (expectedType !== (0, _jestGetType2.default)(b)) {
- return ' Comparing two different types of values.' + (' Expected ' + _chalk2.default.green(expectedType) + ' but ') + ('received ' + _chalk2.default.red((0, _jestGetType2.default)(b)) + '.');
- }
- if (omitDifference) {
- return null;
- }
- switch (aType) {
- case 'string':
- return (0, _diff_strings2.default)(a, b, options);
- case 'number':
- case 'boolean':
- return null;
- case 'map':
- return compareObjects(sortMap(a), sortMap(b), options);
- case 'set':
- return compareObjects(sortSet(a), sortSet(b), options);
- default:
- return compareObjects(a, b, options);
- }
- }
- function sortMap(map) {
- return new _Map(_Array$from(map.entries()).sort());
- }
- function sortSet(set) {
- return new _Set(_Array$from(set.values()).sort());
- }
- function compareObjects(a, b, options) {
- var diffMessage = void 0;
- var hasThrown = false;
- try {
- diffMessage = (0, _diff_strings2.default)((0, _prettyFormat2.default)(a, FORMAT_OPTIONS_0), (0, _prettyFormat2.default)(b, FORMAT_OPTIONS_0), options, {
- a: (0, _prettyFormat2.default)(a, FORMAT_OPTIONS),
- b: (0, _prettyFormat2.default)(b, FORMAT_OPTIONS)
- });
- } catch (e) {
- hasThrown = true;
- }
- // If the comparison yields no results, compare again but this time
- // without calling `toJSON`. It's also possible that toJSON might throw.
- if (!diffMessage || diffMessage === constants.NO_DIFF_MESSAGE) {
- diffMessage = (0, _diff_strings2.default)((0, _prettyFormat2.default)(a, FALLBACK_FORMAT_OPTIONS_0), (0, _prettyFormat2.default)(b, FALLBACK_FORMAT_OPTIONS_0), options, {
- a: (0, _prettyFormat2.default)(a, FALLBACK_FORMAT_OPTIONS),
- b: (0, _prettyFormat2.default)(b, FALLBACK_FORMAT_OPTIONS)
- });
- if (diffMessage !== constants.NO_DIFF_MESSAGE && !hasThrown) {
- diffMessage = constants.SIMILAR_MESSAGE + '\n\n' + diffMessage;
- }
- }
- return diffMessage;
- }
- module.exports = diff;
- });
- var diff = unwrapExports(build$3);
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- // resolves . and .. elements in a path array with directory names there
- // must be no slashes, empty elements, or device names (c:\) in the array
- // (so also no leading and trailing slashes - it does not distinguish
- // relative and absolute paths)
- function normalizeArray(parts, allowAboveRoot) {
- // if the path tries to go above the root, `up` ends up > 0
- var up = 0;
- for (var i = parts.length - 1; i >= 0; i--) {
- var last = parts[i];
- if (last === '.') {
- parts.splice(i, 1);
- } else if (last === '..') {
- parts.splice(i, 1);
- up++;
- } else if (up) {
- parts.splice(i, 1);
- up--;
- }
- }
- // if the path is allowed to go above the root, restore leading ..s
- if (allowAboveRoot) {
- for (; up--; up) {
- parts.unshift('..');
- }
- }
- return parts;
- }
- // Split a filename into [root, dir, basename, ext], unix version
- // 'root' is just a slash, or nothing.
- var splitPathRe =
- /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
- var splitPath = function(filename) {
- return splitPathRe.exec(filename).slice(1);
- };
- // path.resolve([from ...], to)
- // posix version
- function resolve() {
- var resolvedPath = '',
- resolvedAbsolute = false;
- for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
- var path = (i >= 0) ? arguments[i] : '/';
- // Skip empty and invalid entries
- if (typeof path !== 'string') {
- throw new TypeError('Arguments to path.resolve must be strings');
- } else if (!path) {
- continue;
- }
- resolvedPath = path + '/' + resolvedPath;
- resolvedAbsolute = path.charAt(0) === '/';
- }
- // At this point the path should be resolved to a full absolute path, but
- // handle relative paths to be safe (might happen when process.cwd() fails)
- // Normalize the path
- resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
- return !!p;
- }), !resolvedAbsolute).join('/');
- return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
- }
- // path.normalize(path)
- // posix version
- function normalize(path) {
- var isPathAbsolute = isAbsolute(path),
- trailingSlash = substr(path, -1) === '/';
- // Normalize the path
- path = normalizeArray(filter(path.split('/'), function(p) {
- return !!p;
- }), !isPathAbsolute).join('/');
- if (!path && !isPathAbsolute) {
- path = '.';
- }
- if (path && trailingSlash) {
- path += '/';
- }
- return (isPathAbsolute ? '/' : '') + path;
- }
- // posix version
- function isAbsolute(path) {
- return path.charAt(0) === '/';
- }
- // posix version
- function join() {
- var paths = Array.prototype.slice.call(arguments, 0);
- return normalize(filter(paths, function(p, index) {
- if (typeof p !== 'string') {
- throw new TypeError('Arguments to path.join must be strings');
- }
- return p;
- }).join('/'));
- }
- // path.relative(from, to)
- // posix version
- function relative(from, to) {
- from = resolve(from).substr(1);
- to = resolve(to).substr(1);
- function trim(arr) {
- var start = 0;
- for (; start < arr.length; start++) {
- if (arr[start] !== '') break;
- }
- var end = arr.length - 1;
- for (; end >= 0; end--) {
- if (arr[end] !== '') break;
- }
- if (start > end) return [];
- return arr.slice(start, end - start + 1);
- }
- var fromParts = trim(from.split('/'));
- var toParts = trim(to.split('/'));
- var length = Math.min(fromParts.length, toParts.length);
- var samePartsLength = length;
- for (var i = 0; i < length; i++) {
- if (fromParts[i] !== toParts[i]) {
- samePartsLength = i;
- break;
- }
- }
- var outputParts = [];
- for (var i = samePartsLength; i < fromParts.length; i++) {
- outputParts.push('..');
- }
- outputParts = outputParts.concat(toParts.slice(samePartsLength));
- return outputParts.join('/');
- }
- var sep = '/';
- var delimiter = ':';
- function dirname(path) {
- var result = splitPath(path),
- root = result[0],
- dir = result[1];
- if (!root && !dir) {
- // No dirname whatsoever
- return '.';
- }
- if (dir) {
- // It has a dirname, strip trailing slash
- dir = dir.substr(0, dir.length - 1);
- }
- return root + dir;
- }
- function basename(path, ext) {
- var f = splitPath(path)[2];
- // TODO: make this comparison case-insensitive on windows?
- if (ext && f.substr(-1 * ext.length) === ext) {
- f = f.substr(0, f.length - ext.length);
- }
- return f;
- }
- function extname(path) {
- return splitPath(path)[3];
- }
- var path = {
- extname: extname,
- basename: basename,
- dirname: dirname,
- sep: sep,
- delimiter: delimiter,
- relative: relative,
- join: join,
- isAbsolute: isAbsolute,
- normalize: normalize,
- resolve: resolve
- };
- function filter (xs, f) {
- if (xs.filter) return xs.filter(f);
- var res = [];
- for (var i = 0; i < xs.length; i++) {
- if (f(xs[i], i, xs)) res.push(xs[i]);
- }
- return res;
- }
- // String.prototype.substr - negative index don't work in IE8
- var substr = 'ab'.substr(-1) === 'b' ?
- function (str, start, len) { return str.substr(start, len) } :
- function (str, start, len) {
- if (start < 0) start = str.length + start;
- return str.substr(start, len);
- }
- ;
- var path$1 = Object.freeze({
- resolve: resolve,
- normalize: normalize,
- isAbsolute: isAbsolute,
- join: join,
- relative: relative,
- sep: sep,
- delimiter: delimiter,
- dirname: dirname,
- basename: basename,
- extname: extname,
- default: path
- });
- var path$2 = ( path$1 && path ) || path$1;
- var build$4 = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.replacePathSepForRegex = exports.escapeStrForRegex = exports.escapePathForRegex = undefined;
- var _path2 = _interopRequireDefault(path$2);
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : { default: obj };
- }
- var escapePathForRegex = exports.escapePathForRegex = function (dir) {
- if (_path2.default.sep === '\\') {
- // Replace "\" with "/" so it's not escaped by escapeStrForRegex.
- // replacePathSepForRegex will convert it back.
- dir = dir.replace(/\\/g, '/');
- }
- return replacePathSepForRegex(escapeStrForRegex(dir));
- };
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var escapeStrForRegex = exports.escapeStrForRegex = function (string) {
- return string.replace(/[[\]{}()*+?.\\^$|]/g, '\\$&');
- };
- var replacePathSepForRegex = exports.replacePathSepForRegex = function (string) {
- if (_path2.default.sep === '\\') {
- return string.replace(/(\/|(.)?\\(?![[\]{}()*+?.^$|\\]))/g, function (_match, p1, p2) {
- return p2 && p2 !== '\\' ? p2 + '\\\\' : '\\\\';
- });
- }
- return string;
- };
- });
- unwrapExports(build$4);
- var build_1$1 = build$4.replacePathSepForRegex;
- var build_2$1 = build$4.escapeStrForRegex;
- var build_3$1 = build$4.escapePathForRegex;
- var matchers = {
- toBe: function toBe(received, expected) {
- var _this = this;
- var comment = 'Object.is equality';
- var pass = _Object$is(received, expected);
- var message = pass ? function () {
- return build_1('.toBe', undefined, undefined, {
- comment: comment,
- isNot: true
- }) + '\n\n' + ('Expected: ' + build_8(expected) + '\n') + ('Received: ' + build_9(received));
- } : function () {
- var suggestToEqual = build(received) === build(expected) && (build(received) === 'object' || build(expected) === 'array') && equals(received, expected, [iterableEquality]);
- var oneline = isOneline(expected, received);
- var diffString = diff(expected, received, { expand: _this.expand });
- return build_1('.toBe', undefined, undefined, {
- comment: comment,
- isNot: false
- }) + '\n\n' + ('Expected: ' + build_8(expected) + '\n') + ('Received: ' + build_9(received)) + (diffString && !oneline ? '\n\nDifference:\n\n' + diffString : '') + (suggestToEqual ? ' ' + build_13 : '');
- };
- // Passing the the actual and expected objects so that a custom reporter
- // could access them, for example in order to display a custom visual diff,
- // or create a different error message
- return { actual: received, expected: expected, message: message, name: 'toBe', pass: pass };
- },
- toBeCloseTo: function toBeCloseTo(actual, expected) {
- var _this2 = this;
- var precision = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
- var secondArgument = arguments.length === 3 ? 'precision' : null;
- build_3(actual, expected, '.toBeCloseTo');
- var pass = Math.abs(expected - actual) < Math.pow(10, -precision) / 2;
- var message = function message() {
- return build_1('.toBeCloseTo', undefined, undefined, {
- isNot: _this2.isNot,
- secondArgument: secondArgument
- }) + '\n\n' + ('Precision: ' + build_8(precision) + '-digit\n') + ('Expected: ' + build_8(expected) + '\n') + ('Received: ' + build_9(actual));
- };
- return { message: message, pass: pass };
- },
- toBeDefined: function toBeDefined(actual, expected) {
- var _this3 = this;
- build_6(expected, '.toBeDefined');
- var pass = actual !== void 0;
- var message = function message() {
- return build_1('.toBeDefined', 'received', '', {
- isNot: _this3.isNot
- }) + '\n\n' + ('Received: ' + build_9(actual));
- };
- return { message: message, pass: pass };
- },
- toBeFalsy: function toBeFalsy(actual, expected) {
- var _this4 = this;
- build_6(expected, '.toBeFalsy');
- var pass = !actual;
- var message = function message() {
- return build_1('.toBeFalsy', 'received', '', {
- isNot: _this4.isNot
- }) + '\n\n' + ('Received: ' + build_9(actual));
- };
- return { message: message, pass: pass };
- },
- toBeGreaterThan: function toBeGreaterThan(actual, expected) {
- var _this5 = this;
- build_3(actual, expected, '.toBeGreaterThan');
- var pass = actual > expected;
- var message = function message() {
- return build_1('.toBeGreaterThan', undefined, undefined, {
- isNot: _this5.isNot
- }) + '\n\n' + ('Expected: ' + build_8(expected) + '\n') + ('Received: ' + build_9(actual));
- };
- return { message: message, pass: pass };
- },
- toBeGreaterThanOrEqual: function toBeGreaterThanOrEqual(actual, expected) {
- var _this6 = this;
- build_3(actual, expected, '.toBeGreaterThanOrEqual');
- var pass = actual >= expected;
- var message = function message() {
- return build_1('.toBeGreaterThanOrEqual', undefined, undefined, {
- isNot: _this6.isNot
- }) + '\n\n' + ('Expected: ' + build_8(expected) + '\n') + ('Received: ' + build_9(actual));
- };
- return { message: message, pass: pass };
- },
- toBeInstanceOf: function toBeInstanceOf(received, constructor) {
- var _this7 = this;
- var constType = build(constructor);
- if (constType !== 'function') {
- throw new Error(build_1('.toBeInstanceOf', 'value', 'constructor', {
- isNot: this.isNot
- }) + '\n\n' + 'Expected constructor to be a function. Instead got:\n' + (' ' + build_8(constType)));
- }
- var pass = received instanceof constructor;
- var message = pass ? function () {
- return build_1('.toBeInstanceOf', 'value', 'constructor', {
- isNot: _this7.isNot
- }) + '\n\n' + ('Expected constructor: ' + build_15(constructor.name || String(constructor)) + '\n') + ('Received value: ' + build_9(received));
- } : function () {
- return build_1('.toBeInstanceOf', 'value', 'constructor', {
- isNot: _this7.isNot
- }) + '\n\n' + ('Expected constructor: ' + build_15(constructor.name || String(constructor)) + '\n') + ('Received constructor: ' + build_14(received != null ? received.constructor && received.constructor.name : '') + '\n') + ('Received value: ' + build_9(received));
- };
- return { message: message, pass: pass };
- },
- toBeLessThan: function toBeLessThan(actual, expected) {
- var _this8 = this;
- build_3(actual, expected, '.toBeLessThan');
- var pass = actual < expected;
- var message = function message() {
- return build_1('.toBeLessThan', undefined, undefined, {
- isNot: _this8.isNot
- }) + '\n\n' + ('Expected: ' + build_8(expected) + '\n') + ('Received: ' + build_9(actual));
- };
- return { message: message, pass: pass };
- },
- toBeLessThanOrEqual: function toBeLessThanOrEqual(actual, expected) {
- var _this9 = this;
- build_3(actual, expected, '.toBeLessThanOrEqual');
- var pass = actual <= expected;
- var message = function message() {
- return build_1('.toBeLessThanOrEqual', undefined, undefined, {
- isNot: _this9.isNot
- }) + '\n\n' + ('Expected: ' + build_8(expected) + '\n') + ('Received: ' + build_9(actual));
- };
- return { message: message, pass: pass };
- },
- toBeNaN: function toBeNaN(actual, expected) {
- var _this10 = this;
- build_6(expected, '.toBeNaN');
- var pass = _Number$isNaN(actual);
- var message = function message() {
- return build_1('.toBeNaN', 'received', '', {
- isNot: _this10.isNot
- }) + '\n\n' + ('Received: ' + build_9(actual));
- };
- return { message: message, pass: pass };
- },
- toBeNull: function toBeNull(actual, expected) {
- var _this11 = this;
- build_6(expected, '.toBeNull');
- var pass = actual === null;
- var message = function message() {
- return build_1('.toBeNull', 'received', '', {
- isNot: _this11.isNot
- }) + '\n\n' + ('Received: ' + build_9(actual));
- };
- return { message: message, pass: pass };
- },
- toBeTruthy: function toBeTruthy(actual, expected) {
- var _this12 = this;
- build_6(expected, '.toBeTruthy');
- var pass = !!actual;
- var message = function message() {
- return build_1('.toBeTruthy', 'received', '', {
- isNot: _this12.isNot
- }) + '\n\n' + ('Received: ' + build_9(actual));
- };
- return { message: message, pass: pass };
- },
- toBeUndefined: function toBeUndefined(actual, expected) {
- var _this13 = this;
- build_6(expected, '.toBeUndefined');
- var pass = actual === void 0;
- var message = function message() {
- return build_1('.toBeUndefined', 'received', '', {
- isNot: _this13.isNot
- }) + '\n\n' + ('Received: ' + build_9(actual));
- };
- return { message: message, pass: pass };
- },
- toContain: function toContain(collection, value) {
- var collectionType = build(collection);
- var converted = null;
- if (Array.isArray(collection) || typeof collection === 'string') {
- // strings have `indexOf` so we don't need to convert
- // arrays have `indexOf` and we don't want to make a copy
- converted = collection;
- } else {
- try {
- converted = _Array$from(collection);
- } catch (e) {
- throw new Error(build_1('[.not].toContainEqual', 'collection', 'value') + '\n\n' + ('Expected ' + build_14('collection') + ' to be an array-like structure.\n') + build_7('Received', collection, build_9));
- }
- }
- // At this point, we're either a string or an Array,
- // which was converted from an array-like structure.
- var pass = converted.indexOf(value) != -1;
- var message = pass ? function () {
- return build_1('.not.toContain', collectionType, 'value') + '\n\n' + ('Expected ' + collectionType + ':\n') + (' ' + build_9(collection) + '\n') + 'Not to contain value:\n' + (' ' + build_8(value) + '\n');
- } : function () {
- var suggestToContainEqual = converted !== null && typeof converted !== 'string' && converted instanceof Array && converted.findIndex(function (item) {
- return equals(item, value, [iterableEquality]);
- }) !== -1;
- return build_1('.toContain', collectionType, 'value') + '\n\n' + ('Expected ' + collectionType + ':\n') + (' ' + build_9(collection) + '\n') + 'To contain value:\n' + (' ' + build_8(value)) + (suggestToContainEqual ? '\n\n' + build_12 : '');
- };
- return { message: message, pass: pass };
- },
- toContainEqual: function toContainEqual(collection, value) {
- var collectionType = build(collection);
- var converted = null;
- if (Array.isArray(collection)) {
- converted = collection;
- } else {
- try {
- converted = _Array$from(collection);
- } catch (e) {
- throw new Error(build_1('[.not].toContainEqual', 'collection', 'value') + '\n\n' + ('Expected ' + build_14('collection') + ' to be an array-like structure.\n') + build_7('Received', collection, build_9));
- }
- }
- var pass = converted.findIndex(function (item) {
- return equals(item, value, [iterableEquality]);
- }) !== -1;
- var message = pass ? function () {
- return build_1('.not.toContainEqual', collectionType, 'value') + '\n\n' + ('Expected ' + collectionType + ':\n') + (' ' + build_9(collection) + '\n') + 'Not to contain a value equal to:\n' + (' ' + build_8(value) + '\n');
- } : function () {
- return build_1('.toContainEqual', collectionType, 'value') + '\n\n' + ('Expected ' + collectionType + ':\n') + (' ' + build_9(collection) + '\n') + 'To contain a value equal to:\n' + (' ' + build_8(value));
- };
- return { message: message, pass: pass };
- },
- toEqual: function toEqual(received, expected) {
- var _this14 = this;
- var pass = equals(received, expected, [iterableEquality]);
- var message = pass ? function () {
- return build_1('.not.toEqual') + '\n\n' + 'Expected value to not equal:\n' + (' ' + build_8(expected) + '\n') + 'Received:\n' + (' ' + build_9(received));
- } : function () {
- var oneline = isOneline(expected, received);
- var diffString = diff(expected, received, { expand: _this14.expand });
- return build_1('.toEqual') + '\n\n' + 'Expected value to equal:\n' + (' ' + build_8(expected) + '\n') + 'Received:\n' + (' ' + build_9(received)) + (diffString && !oneline ? '\n\nDifference:\n\n' + diffString : '');
- };
- // Passing the the actual and expected objects so that a custom reporter
- // could access them, for example in order to display a custom visual diff,
- // or create a different error message
- return { actual: received, expected: expected, message: message, name: 'toEqual', pass: pass };
- },
- toHaveLength: function toHaveLength(received, length) {
- if (typeof received !== 'string' && (!received || typeof received.length !== 'number')) {
- throw new Error(build_1('[.not].toHaveLength', 'received', 'length') + '\n\n' + 'Expected value to have a \'length\' property that is a number. ' + 'Received:\n' + (' ' + build_9(received) + '\n') + (received ? 'received.length:\n ' + build_9(received.length) : ''));
- }
- var pass = received.length === length;
- var message = pass ? function () {
- return build_1('.not.toHaveLength', 'received', 'length') + '\n\n' + 'Expected value to not have length:\n' + (' ' + build_8(length) + '\n') + 'Received:\n' + (' ' + build_9(received) + '\n') + 'received.length:\n' + (' ' + build_9(received.length));
- } : function () {
- return build_1('.toHaveLength', 'received', 'length') + '\n\n' + 'Expected value to have length:\n' + (' ' + build_8(length) + '\n') + 'Received:\n' + (' ' + build_9(received) + '\n') + 'received.length:\n' + (' ' + build_9(received.length));
- };
- return { message: message, pass: pass };
- },
- toHaveProperty: function toHaveProperty(object, keyPath, value) {
- var _this15 = this;
- var valuePassed = arguments.length === 3;
- var secondArgument = valuePassed ? 'value' : null;
- if (!object && typeof object !== 'string' && typeof object !== 'number') {
- throw new Error(build_1('[.not].toHaveProperty', 'object', 'path', {
- secondArgument: secondArgument
- }) + '\n\n' + ('Expected ' + build_14('object') + ' to be an object. Received:\n') + (' ' + build(object) + ': ' + build_9(object)));
- }
- var keyPathType = build(keyPath);
- if (keyPathType !== 'string' && keyPathType !== 'array') {
- throw new Error(build_1('[.not].toHaveProperty', 'object', 'path', {
- secondArgument: secondArgument
- }) + '\n\n' + ('Expected ' + build_15('path') + ' to be a string or an array. Received:\n') + (' ' + build(keyPath) + ': ' + build_9(keyPath)));
- }
- var result = getPath(object, keyPath);
- var lastTraversedObject = result.lastTraversedObject,
- hasEndProp = result.hasEndProp;
- var pass = valuePassed ? equals(result.value, value, [iterableEquality]) : hasEndProp;
- var traversedPath = result.traversedPath.join('.');
- var message = pass ? function () {
- return build_1('.not.toHaveProperty', 'object', 'path', {
- secondArgument: secondArgument
- }) + '\n\n' + 'Expected the object:\n' + (' ' + build_9(object) + '\n') + 'Not to have a nested property:\n' + (' ' + build_8(keyPath) + '\n') + (valuePassed ? 'With a value of:\n ' + build_8(value) + '\n' : '');
- } : function () {
- var diffString = valuePassed && hasEndProp ? diff(value, result.value, { expand: _this15.expand }) : '';
- return build_1('.toHaveProperty', 'object', 'path', {
- secondArgument: secondArgument
- }) + '\n\n' + 'Expected the object:\n' + (' ' + build_9(object) + '\n') + 'To have a nested property:\n' + (' ' + build_8(keyPath) + '\n') + (valuePassed ? 'With a value of:\n ' + build_8(value) + '\n' : '') + (hasEndProp ? 'Received:\n' + (' ' + build_9(result.value)) + (diffString ? '\n\nDifference:\n\n' + diffString : '') : traversedPath ? 'Received:\n ' + build_14('object') + '.' + traversedPath + ': ' + build_9(lastTraversedObject) : '');
- };
- if (pass === undefined) {
- throw new Error('pass must be initialized');
- }
- return { message: message, pass: pass };
- },
- toMatch: function toMatch(received, expected) {
- if (typeof received !== 'string') {
- throw new Error(build_1('[.not].toMatch', 'string', 'expected') + '\n\n' + (build_14('string') + ' value must be a string.\n') + build_7('Received', received, build_9));
- }
- if (!(expected && typeof expected.test === 'function') && !(typeof expected === 'string')) {
- throw new Error(build_1('[.not].toMatch', 'string', 'expected') + '\n\n' + (build_15('expected') + ' value must be a string or a regular expression.\n') + build_7('Expected', expected, build_8));
- }
- var pass = new RegExp(typeof expected === 'string' ? build_2$1(expected) : expected).test(received);
- var message = pass ? function () {
- return build_1('.not.toMatch') + '\n\nExpected value not to match:\n' + (' ' + build_8(expected)) + '\nReceived:\n' + (' ' + build_9(received));
- } : function () {
- return build_1('.toMatch') + '\n\nExpected value to match:\n' + (' ' + build_8(expected)) + '\nReceived:\n' + (' ' + build_9(received));
- };
- return { message: message, pass: pass };
- },
- toMatchObject: function toMatchObject(receivedObject, expectedObject) {
- var _this16 = this;
- if ((typeof receivedObject === 'undefined' ? 'undefined' : _typeof(receivedObject)) !== 'object' || receivedObject === null) {
- throw new Error(build_1('[.not].toMatchObject', 'object', 'expected') + '\n\n' + (build_14('received') + ' value must be an object.\n') + build_7('Received', receivedObject, build_9));
- }
- if ((typeof expectedObject === 'undefined' ? 'undefined' : _typeof(expectedObject)) !== 'object' || expectedObject === null) {
- throw new Error(build_1('[.not].toMatchObject', 'object', 'expected') + '\n\n' + (build_15('expected') + ' value must be an object.\n') + build_7('Expected', expectedObject, build_8));
- }
- var pass = equals(receivedObject, expectedObject, [iterableEquality, subsetEquality]);
- var message = pass ? function () {
- return build_1('.not.toMatchObject') + '\n\nExpected value not to match object:\n' + (' ' + build_8(expectedObject)) + '\nReceived:\n' + (' ' + build_9(receivedObject));
- } : function () {
- var diffString = diff(expectedObject, getObjectSubset(receivedObject, expectedObject), {
- expand: _this16.expand
- });
- return build_1('.toMatchObject') + '\n\nExpected value to match object:\n' + (' ' + build_8(expectedObject)) + '\nReceived:\n' + (' ' + build_9(receivedObject)) + (diffString ? '\nDifference:\n' + diffString : '');
- };
- return { message: message, pass: pass };
- },
- toStrictEqual: function toStrictEqual(received, expected) {
- var _this17 = this;
- var pass = equals(received, expected, [iterableEquality, typeEquality], true);
- var message = pass ? function () {
- return build_1('.not.toStrictEqual') + '\n\n' + 'Expected value to not equal:\n' + (' ' + build_8(expected) + '\n') + 'Received:\n' + (' ' + build_9(received));
- } : function () {
- var diffString = diff(expected, received, {
- expand: _this17.expand
- });
- return build_1('.toStrictEqual') + '\n\n' + 'Expected value to equal:\n' + (' ' + build_8(expected) + '\n') + 'Received:\n' + (' ' + build_9(received)) + (diffString ? '\n\nDifference:\n\n' + diffString : '');
- };
- // Passing the the actual and expected objects so that a custom reporter
- // could access them, for example in order to display a custom visual diff,
- // or create a different error message
- return { actual: received, expected: expected, message: message, name: 'toStrictEqual', pass: pass };
- }
- };
- var ITERATOR$4 = _wks('iterator');
- var core_isIterable = _core.isIterable = function (it) {
- var O = Object(it);
- return O[ITERATOR$4] !== undefined
- || '@@iterator' in O
- // eslint-disable-next-line no-prototype-builtins
- || _iterators.hasOwnProperty(_classof(O));
- };
- var isIterable = core_isIterable;
- var isIterable$1 = createCommonjsModule(function (module) {
- module.exports = { "default": isIterable, __esModule: true };
- });
- unwrapExports(isIterable$1);
- var slicedToArray = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- var _isIterable3 = _interopRequireDefault(isIterable$1);
- var _getIterator3 = _interopRequireDefault(getIterator$1);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.default = function () {
- function sliceIterator(arr, i) {
- var _arr = [];
- var _n = true;
- var _d = false;
- var _e = undefined;
- try {
- for (var _i = (0, _getIterator3.default)(arr), _s; !(_n = (_s = _i.next()).done); _n = true) {
- _arr.push(_s.value);
- if (i && _arr.length === i) break;
- }
- } catch (err) {
- _d = true;
- _e = err;
- } finally {
- try {
- if (!_n && _i["return"]) _i["return"]();
- } finally {
- if (_d) throw _e;
- }
- }
- return _arr;
- }
- return function (arr, i) {
- if (Array.isArray(arr)) {
- return arr;
- } else if ((0, _isIterable3.default)(Object(arr))) {
- return sliceIterator(arr, i);
- } else {
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
- }
- };
- }();
- });
- var _slicedToArray = unwrapExports(slicedToArray);
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var CALL_PRINT_LIMIT = 3;
- var RETURN_PRINT_LIMIT = 5;
- var LAST_CALL_PRINT_LIMIT = 1;
- var createToBeCalledMatcher = function createToBeCalledMatcher(matcherName) {
- return function (received, expected) {
- build_6(expected, matcherName);
- ensureMock(received, matcherName);
- var receivedIsSpy = isSpy(received);
- var type = receivedIsSpy ? 'spy' : 'mock function';
- var receivedName = receivedIsSpy ? 'spy' : received.getMockName();
- var identifier = receivedIsSpy || receivedName === 'jest.fn()' ? type : type + ' "' + receivedName + '"';
- var count = receivedIsSpy ? received.calls.count() : received.mock.calls.length;
- var calls = receivedIsSpy ? received.calls.all().map(function (x) {
- return x.args;
- }) : received.mock.calls;
- var pass = count > 0;
- var message = pass ? function () {
- return build_1('.not' + matcherName, receivedName, '') + '\n\n' + ('Expected ' + identifier + ' not to be called ') + formatReceivedCalls(calls, CALL_PRINT_LIMIT, { sameSentence: true });
- } : function () {
- return build_1(matcherName, receivedName, '') + '\n\n' + ('Expected ' + identifier + ' to have been called, but it was not called.');
- };
- return { message: message, pass: pass };
- };
- };
- var createToReturnMatcher = function createToReturnMatcher(matcherName) {
- return function (received, expected) {
- build_6(expected, matcherName);
- ensureMock(received, matcherName);
- var receivedName = received.getMockName();
- var identifier = receivedName === 'jest.fn()' ? 'mock function' : 'mock function "' + receivedName + '"';
- // List of return values that correspond only to calls that did not throw
- // an error
- var returnValues = received.mock.results.filter(function (result) {
- return !result.isThrow;
- }).map(function (result) {
- return result.value;
- });
- var count = returnValues.length;
- var pass = count > 0;
- var message = pass ? function () {
- return build_1('.not' + matcherName, receivedName, '') + '\n\n' + ('Expected ' + identifier + ' not to have returned, but it returned:\n') + (' ' + getPrintedReturnValues(returnValues, RETURN_PRINT_LIMIT));
- } : function () {
- return build_1(matcherName, receivedName, '') + '\n\n' + ('Expected ' + identifier + ' to have returned.');
- };
- return { message: message, pass: pass };
- };
- };
- var createToBeCalledTimesMatcher = function createToBeCalledTimesMatcher(matcherName) {
- return function (received, expected) {
- build_4(expected, matcherName);
- ensureMock(received, matcherName);
- var receivedIsSpy = isSpy(received);
- var type = receivedIsSpy ? 'spy' : 'mock function';
- var receivedName = receivedIsSpy ? 'spy' : received.getMockName();
- var identifier = receivedIsSpy || receivedName === 'jest.fn()' ? type : type + ' "' + receivedName + '"';
- var count = receivedIsSpy ? received.calls.count() : received.mock.calls.length;
- var pass = count === expected;
- var message = pass ? function () {
- return build_1('.not' + matcherName, receivedName, String(expected)) + '\n\n' + ('Expected ' + identifier + ' not to be called ') + (build_15(build_2('time', expected)) + ', but it was') + (' called exactly ' + build_14(build_2('time', count)) + '.');
- } : function () {
- return build_1(matcherName, receivedName, String(expected)) + '\n\n' + ('Expected ' + identifier + ' to have been called ') + (build_15(build_2('time', expected)) + ',') + (' but it was called ' + build_14(build_2('time', count)) + '.');
- };
- return { message: message, pass: pass };
- };
- };
- var createToReturnTimesMatcher = function createToReturnTimesMatcher(matcherName) {
- return function (received, expected) {
- build_4(expected, matcherName);
- ensureMock(received, matcherName);
- var receivedName = received.getMockName();
- var identifier = receivedName === 'jest.fn()' ? 'mock function' : 'mock function "' + receivedName + '"';
- // List of return results that correspond only to calls that did not throw
- // an error
- var returnResults = received.mock.results.filter(function (result) {
- return !result.isThrow;
- });
- var count = returnResults.length;
- var pass = count === expected;
- var message = pass ? function () {
- return build_1('.not' + matcherName, receivedName, String(expected)) + '\n\n' + ('Expected ' + identifier + ' not to have returned ') + (build_15(build_2('time', expected)) + ', but it') + (' returned exactly ' + build_14(build_2('time', count)) + '.');
- } : function () {
- return build_1(matcherName, receivedName, String(expected)) + '\n\n' + ('Expected ' + identifier + ' to have returned ') + (build_15(build_2('time', expected)) + ',') + (' but it returned ' + build_14(build_2('time', count)) + '.');
- };
- return { message: message, pass: pass };
- };
- };
- var createToBeCalledWithMatcher = function createToBeCalledWithMatcher(matcherName) {
- return function (received) {
- for (var _len = arguments.length, expected = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- expected[_key - 1] = arguments[_key];
- }
- ensureMock(received, matcherName);
- var receivedIsSpy = isSpy(received);
- var type = receivedIsSpy ? 'spy' : 'mock function';
- var receivedName = receivedIsSpy ? 'spy' : received.getMockName();
- var identifier = receivedIsSpy || receivedName === 'jest.fn()' ? type : type + ' "' + receivedName + '"';
- var calls = receivedIsSpy ? received.calls.all().map(function (x) {
- return x.args;
- }) : received.mock.calls;
- var _partition = partition(calls, function (call) {
- return equals(call, expected, [iterableEquality]);
- }),
- _partition2 = _slicedToArray(_partition, 2),
- match = _partition2[0],
- fail = _partition2[1];
- var pass = match.length > 0;
- var message = pass ? function () {
- return build_1('.not' + matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' not to have been called with:\n') + (' ' + build_8(expected));
- } : function () {
- return build_1(matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' to have been called with:\n') + formatMismatchedCalls(fail, expected, CALL_PRINT_LIMIT);
- };
- return { message: message, pass: pass };
- };
- };
- var createToReturnWithMatcher = function createToReturnWithMatcher(matcherName) {
- return function (received, expected) {
- ensureMock(received, matcherName);
- var receivedName = received.getMockName();
- var identifier = receivedName === 'jest.fn()' ? 'mock function' : 'mock function "' + receivedName + '"';
- // List of return values that correspond only to calls that did not throw
- // an error
- var returnValues = received.mock.results.filter(function (result) {
- return !result.isThrow;
- }).map(function (result) {
- return result.value;
- });
- var _partition3 = partition(returnValues, function (value) {
- return equals(expected, value, [iterableEquality]);
- }),
- _partition4 = _slicedToArray(_partition3, 1),
- match = _partition4[0];
- var pass = match.length > 0;
- var message = pass ? function () {
- return build_1('.not' + matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' not to have returned:\n') + (' ' + build_8(expected) + '\n') + 'But it returned exactly:\n' + (' ' + build_9(expected));
- } : function () {
- return build_1(matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' to have returned:\n') + formatMismatchedReturnValues(returnValues, expected, RETURN_PRINT_LIMIT);
- };
- return { message: message, pass: pass };
- };
- };
- var createLastCalledWithMatcher = function createLastCalledWithMatcher(matcherName) {
- return function (received) {
- for (var _len2 = arguments.length, expected = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
- expected[_key2 - 1] = arguments[_key2];
- }
- ensureMock(received, matcherName);
- var receivedIsSpy = isSpy(received);
- var type = receivedIsSpy ? 'spy' : 'mock function';
- var receivedName = receivedIsSpy ? 'spy' : received.getMockName();
- var identifier = receivedIsSpy || receivedName === 'jest.fn()' ? type : type + ' "' + receivedName + '"';
- var calls = receivedIsSpy ? received.calls.all().map(function (x) {
- return x.args;
- }) : received.mock.calls;
- var pass = equals(calls[calls.length - 1], expected, [iterableEquality]);
- var message = pass ? function () {
- return build_1('.not' + matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' to not have been last called with:\n') + (' ' + build_8(expected));
- } : function () {
- return build_1(matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' to have been last called with:\n') + formatMismatchedCalls(calls, expected, LAST_CALL_PRINT_LIMIT);
- };
- return { message: message, pass: pass };
- };
- };
- var createLastReturnedMatcher = function createLastReturnedMatcher(matcherName) {
- return function (received, expected) {
- ensureMock(received, matcherName);
- var receivedName = received.getMockName();
- var identifier = receivedName === 'jest.fn()' ? 'mock function' : 'mock function "' + receivedName + '"';
- var results = received.mock.results;
- var lastResult = results[results.length - 1];
- var pass = !!lastResult && !lastResult.isThrow && equals(lastResult.value, expected, [iterableEquality]);
- var message = pass ? function () {
- return build_1('.not' + matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' to not have last returned:\n') + (' ' + build_8(expected) + '\n') + 'But it last returned exactly:\n' + (' ' + build_9(lastResult.value));
- } : function () {
- return build_1(matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' to have last returned:\n') + (' ' + build_8(expected) + '\n') + (!lastResult ? 'But it was ' + build_14('not called') : lastResult.isThrow ? 'But the last call ' + build_14('threw an error') : 'But the last call returned:\n ' + build_9(lastResult.value));
- };
- return { message: message, pass: pass };
- };
- };
- var createNthCalledWithMatcher = function createNthCalledWithMatcher(matcherName) {
- return function (received, nth) {
- for (var _len3 = arguments.length, expected = Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
- expected[_key3 - 2] = arguments[_key3];
- }
- ensureMock(received, matcherName);
- var receivedIsSpy = isSpy(received);
- var type = receivedIsSpy ? 'spy' : 'mock function';
- if (typeof nth !== 'number' || parseInt(nth, 10) !== nth || nth < 1) {
- var _message = function _message() {
- return 'nth value ' + build_9(nth) + ' must be a positive integer greater than ' + build_8(0);
- };
- var _pass = false;
- return { message: _message, pass: _pass };
- }
- var receivedName = receivedIsSpy ? 'spy' : received.getMockName();
- var identifier = receivedIsSpy || receivedName === 'jest.fn()' ? type : type + ' "' + receivedName + '"';
- var calls = receivedIsSpy ? received.calls.all().map(function (x) {
- return x.args;
- }) : received.mock.calls;
- var pass = equals(calls[nth - 1], expected, [iterableEquality]);
- var message = pass ? function () {
- return build_1('.not' + matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' ' + nthToString(nth) + ' call to not have been called with:\n') + (' ' + build_8(expected));
- } : function () {
- return build_1(matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' ' + nthToString(nth) + ' call to have been called with:\n') + formatMismatchedCalls(calls[nth - 1] ? [calls[nth - 1]] : [], expected, LAST_CALL_PRINT_LIMIT);
- };
- return { message: message, pass: pass };
- };
- };
- var createNthReturnedWithMatcher = function createNthReturnedWithMatcher(matcherName) {
- return function (received, nth, expected) {
- ensureMock(received, matcherName);
- if (typeof nth !== 'number' || parseInt(nth, 10) !== nth || nth < 1) {
- var _message2 = function _message2() {
- return 'nth value ' + build_9(nth) + ' must be a positive integer greater than ' + build_8(0);
- };
- var _pass2 = false;
- return { message: _message2, pass: _pass2 };
- }
- var receivedName = received.getMockName();
- var identifier = receivedName === 'jest.fn()' ? 'mock function' : 'mock function "' + receivedName + '"';
- var results = received.mock.results;
- var nthResult = results[nth - 1];
- var pass = !!nthResult && !nthResult.isThrow && equals(nthResult.value, expected, [iterableEquality]);
- var nthString = nthToString(nth);
- var message = pass ? function () {
- return build_1('.not' + matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' ' + nthString + ' call to not have returned with:\n') + (' ' + build_8(expected) + '\n') + ('But the ' + nthString + ' call returned exactly:\n') + (' ' + build_9(nthResult.value));
- } : function () {
- return build_1(matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' ' + nthString + ' call to have returned with:\n') + (' ' + build_8(expected) + '\n') + (results.length === 0 ? 'But it was ' + build_14('not called') : nth > results.length ? 'But it was only called ' + build_9(results.length) + ' times' : nthResult.isThrow ? 'But the ' + nthString + ' call ' + build_14('threw an error') : 'But the ' + nthString + ' call returned with:\n ' + build_9(nthResult.value));
- };
- return { message: message, pass: pass };
- };
- };
- var spyMatchers = {
- lastCalledWith: createLastCalledWithMatcher('.lastCalledWith'),
- lastReturnedWith: createLastReturnedMatcher('.lastReturnedWith'),
- nthCalledWith: createNthCalledWithMatcher('.nthCalledWith'),
- nthReturnedWith: createNthReturnedWithMatcher('.nthReturnedWith'),
- toBeCalled: createToBeCalledMatcher('.toBeCalled'),
- toBeCalledTimes: createToBeCalledTimesMatcher('.toBeCalledTimes'),
- toBeCalledWith: createToBeCalledWithMatcher('.toBeCalledWith'),
- toHaveBeenCalled: createToBeCalledMatcher('.toHaveBeenCalled'),
- toHaveBeenCalledTimes: createToBeCalledTimesMatcher('.toHaveBeenCalledTimes'),
- toHaveBeenCalledWith: createToBeCalledWithMatcher('.toHaveBeenCalledWith'),
- toHaveBeenLastCalledWith: createLastCalledWithMatcher('.toHaveBeenLastCalledWith'),
- toHaveBeenNthCalledWith: createNthCalledWithMatcher('.toHaveBeenNthCalledWith'),
- toHaveLastReturnedWith: createLastReturnedMatcher('.toHaveLastReturnedWith'),
- toHaveNthReturnedWith: createNthReturnedWithMatcher('.toHaveNthReturnedWith'),
- toHaveReturned: createToReturnMatcher('.toHaveReturned'),
- toHaveReturnedTimes: createToReturnTimesMatcher('.toHaveReturnedTimes'),
- toHaveReturnedWith: createToReturnWithMatcher('.toHaveReturnedWith'),
- toReturn: createToReturnMatcher('.toReturn'),
- toReturnTimes: createToReturnTimesMatcher('.toReturnTimes'),
- toReturnWith: createToReturnWithMatcher('.toReturnWith')
- };
- var isSpy = function isSpy(spy) {
- return spy.calls && typeof spy.calls.count === 'function';
- };
- var ensureMock = function ensureMock(mockOrSpy, matcherName) {
- if (!mockOrSpy || (mockOrSpy.calls === undefined || mockOrSpy.calls.all === undefined) && mockOrSpy._isMockFunction !== true) {
- throw new Error(build_1('[.not]' + matcherName, 'jest.fn()', '') + '\n\n' + (build_14('jest.fn()') + ' value must be a mock function ') + 'or spy.\n' + build_7('Received', mockOrSpy, build_9));
- }
- };
- var getPrintedCalls = function getPrintedCalls(calls, limit, sep, fn) {
- var result = [];
- var i = calls.length;
- while (--i >= 0 && --limit >= 0) {
- result.push(fn(calls[i]));
- }
- return result.join(sep);
- };
- var getPrintedReturnValues = function getPrintedReturnValues(calls, limit) {
- var result = [];
- for (var i = 0; i < calls.length && i < limit; i += 1) {
- result.push(build_9(calls[i]));
- }
- if (calls.length > limit) {
- result.push('...and ' + build_9(calls.length - limit) + ' more');
- }
- return result.join('\n\n ');
- };
- var formatReceivedCalls = function formatReceivedCalls(calls, limit, options) {
- if (calls.length) {
- var but = options && options.sameSentence ? 'but' : 'But';
- var count = calls.length - limit;
- var printedCalls = getPrintedCalls(calls, limit, ', ', build_9);
- return but + ' it was called ' + 'with:\n ' + printedCalls + (count > 0 ? '\nand ' + build_14(build_2('more call', count)) + '.' : '');
- } else {
- return 'But it was ' + build_14('not called') + '.';
- }
- };
- var formatMismatchedCalls = function formatMismatchedCalls(calls, expected, limit) {
- if (calls.length) {
- return getPrintedCalls(calls, limit, '\n\n', formatMismatchedArgs.bind(null, expected));
- } else {
- return ' ' + build_8(expected) + '\n' + ('But it was ' + build_14('not called') + '.');
- }
- };
- var formatMismatchedReturnValues = function formatMismatchedReturnValues(returnValues, expected, limit) {
- if (returnValues.length) {
- return ' ' + build_8(expected) + '\n' + 'But it returned:\n' + (' ' + getPrintedReturnValues(returnValues, limit));
- } else {
- return ' ' + build_8(expected) + '\n' + ('But it did ' + build_14('not return') + '.');
- }
- };
- var formatMismatchedArgs = function formatMismatchedArgs(expected, received) {
- var length = Math.max(expected.length, received.length);
- var printedArgs = [];
- for (var i = 0; i < length; i++) {
- if (!equals(expected[i], received[i], [iterableEquality])) {
- var oneline = isOneline(expected[i], received[i]);
- var diffString = diff(expected[i], received[i]);
- printedArgs.push(' ' + build_8(expected[i]) + '\n' + ('as argument ' + (i + 1) + ', but it was called with\n') + (' ' + build_9(received[i]) + '.') + (diffString && !oneline ? '\n\nDifference:\n\n' + diffString : ''));
- } else if (i >= expected.length) {
- printedArgs.push(' Did not expect argument ' + (i + 1) + ' ' + ('but it was called with ' + build_9(received[i]) + '.'));
- }
- }
- return printedArgs.join('\n');
- };
- var nthToString = function nthToString(nth) {
- switch (nth) {
- case 1:
- return 'first';
- case 2:
- return 'second';
- case 3:
- return 'third';
- }
- return nth + 'th';
- };
- var global$1 = (typeof global !== "undefined" ? global :
- typeof self !== "undefined" ? self :
- typeof window !== "undefined" ? window : {});
- // shim for using process in browser
- // based off https://github.com/defunctzombie/node-process/blob/master/browser.js
- function defaultSetTimout() {
- throw new Error('setTimeout has not been defined');
- }
- function defaultClearTimeout () {
- throw new Error('clearTimeout has not been defined');
- }
- var cachedSetTimeout = defaultSetTimout;
- var cachedClearTimeout = defaultClearTimeout;
- if (typeof global$1.setTimeout === 'function') {
- cachedSetTimeout = setTimeout;
- }
- if (typeof global$1.clearTimeout === 'function') {
- cachedClearTimeout = clearTimeout;
- }
- function runTimeout(fun) {
- if (cachedSetTimeout === setTimeout) {
- //normal enviroments in sane situations
- return setTimeout(fun, 0);
- }
- // if setTimeout wasn't available but was latter defined
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
- cachedSetTimeout = setTimeout;
- return setTimeout(fun, 0);
- }
- try {
- // when when somebody has screwed with setTimeout but no I.E. maddness
- return cachedSetTimeout(fun, 0);
- } catch(e){
- try {
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
- return cachedSetTimeout.call(null, fun, 0);
- } catch(e){
- // 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
- return cachedSetTimeout.call(this, fun, 0);
- }
- }
- }
- function runClearTimeout(marker) {
- if (cachedClearTimeout === clearTimeout) {
- //normal enviroments in sane situations
- return clearTimeout(marker);
- }
- // if clearTimeout wasn't available but was latter defined
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
- cachedClearTimeout = clearTimeout;
- return clearTimeout(marker);
- }
- try {
- // when when somebody has screwed with setTimeout but no I.E. maddness
- return cachedClearTimeout(marker);
- } catch (e){
- try {
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
- return cachedClearTimeout.call(null, marker);
- } catch (e){
- // 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.
- // Some versions of I.E. have different rules for clearTimeout vs setTimeout
- return cachedClearTimeout.call(this, marker);
- }
- }
- }
- var queue$1 = [];
- var draining = false;
- var currentQueue;
- var queueIndex = -1;
- function cleanUpNextTick() {
- if (!draining || !currentQueue) {
- return;
- }
- draining = false;
- if (currentQueue.length) {
- queue$1 = currentQueue.concat(queue$1);
- } else {
- queueIndex = -1;
- }
- if (queue$1.length) {
- drainQueue();
- }
- }
- function drainQueue() {
- if (draining) {
- return;
- }
- var timeout = runTimeout(cleanUpNextTick);
- draining = true;
- var len = queue$1.length;
- while(len) {
- currentQueue = queue$1;
- queue$1 = [];
- while (++queueIndex < len) {
- if (currentQueue) {
- currentQueue[queueIndex].run();
- }
- }
- queueIndex = -1;
- len = queue$1.length;
- }
- currentQueue = null;
- draining = false;
- runClearTimeout(timeout);
- }
- function nextTick(fun) {
- var args = new Array(arguments.length - 1);
- if (arguments.length > 1) {
- for (var i = 1; i < arguments.length; i++) {
- args[i - 1] = arguments[i];
- }
- }
- queue$1.push(new Item(fun, args));
- if (queue$1.length === 1 && !draining) {
- runTimeout(drainQueue);
- }
- }
- // v8 likes predictible objects
- function Item(fun, array) {
- this.fun = fun;
- this.array = array;
- }
- Item.prototype.run = function () {
- this.fun.apply(null, this.array);
- };
- var title = 'browser';
- var platform = 'browser';
- var browser = true;
- var env = {};
- var argv = [];
- var version = ''; // empty string to avoid regexp issues
- var versions$1 = {};
- var release = {};
- var config = {};
- function noop() {}
- var on = noop;
- var addListener = noop;
- var once = noop;
- var off = noop;
- var removeListener = noop;
- var removeAllListeners = noop;
- var emit = noop;
- function binding(name) {
- throw new Error('process.binding is not supported');
- }
- function cwd () { return '/' }
- function chdir (dir) {
- throw new Error('process.chdir is not supported');
- }function umask() { return 0; }
- // from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
- var performance = global$1.performance || {};
- var performanceNow =
- performance.now ||
- performance.mozNow ||
- performance.msNow ||
- performance.oNow ||
- performance.webkitNow ||
- function(){ return (new Date()).getTime() };
- // generate timestamp or delta
- // see http://nodejs.org/api/process.html#process_process_hrtime
- function hrtime(previousTimestamp){
- var clocktime = performanceNow.call(performance)*1e-3;
- var seconds = Math.floor(clocktime);
- var nanoseconds = Math.floor((clocktime%1)*1e9);
- if (previousTimestamp) {
- seconds = seconds - previousTimestamp[0];
- nanoseconds = nanoseconds - previousTimestamp[1];
- if (nanoseconds<0) {
- seconds--;
- nanoseconds += 1e9;
- }
- }
- return [seconds,nanoseconds]
- }
- var startTime = new Date();
- function uptime() {
- var currentTime = new Date();
- var dif = currentTime - startTime;
- return dif / 1000;
- }
- var process$3 = {
- nextTick: nextTick,
- title: title,
- browser: browser,
- env: env,
- argv: argv,
- version: version,
- versions: versions$1,
- on: on,
- addListener: addListener,
- once: once,
- off: off,
- removeListener: removeListener,
- removeAllListeners: removeAllListeners,
- emit: emit,
- binding: binding,
- cwd: cwd,
- chdir: chdir,
- umask: umask,
- hrtime: hrtime,
- platform: platform,
- release: release,
- config: config,
- uptime: uptime
- };
- var empty$1 = {};
- var empty$2 = Object.freeze({
- default: empty$1
- });
- /*!
- * filename-regex <https://github.com/regexps/filename-regex>
- *
- * Copyright (c) 2014-2015, Jon Schlinkert
- * Licensed under the MIT license.
- */
- var filenameRegex = function filenameRegex() {
- return /([^\\\/]+)$/;
- };
- /*!
- * arr-flatten <https://github.com/jonschlinkert/arr-flatten>
- *
- * Copyright (c) 2014-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var arrFlatten = function (arr) {
- return flat(arr, []);
- };
- function flat(arr, res) {
- var i = 0, cur;
- var len = arr.length;
- for (; i < len; i++) {
- cur = arr[i];
- Array.isArray(cur) ? flat(cur, res) : res.push(cur);
- }
- return res;
- }
- var slice = [].slice;
- /**
- * Return the difference between the first array and
- * additional arrays.
- *
- * ```js
- * var diff = require('{%= name %}');
- *
- * var a = ['a', 'b', 'c', 'd'];
- * var b = ['b', 'c'];
- *
- * console.log(diff(a, b))
- * //=> ['a', 'd']
- * ```
- *
- * @param {Array} `a`
- * @param {Array} `b`
- * @return {Array}
- * @api public
- */
- function diff$1(arr, arrays) {
- var argsLen = arguments.length;
- var len = arr.length, i = -1;
- var res = [], arrays;
- if (argsLen === 1) {
- return arr;
- }
- if (argsLen > 2) {
- arrays = arrFlatten(slice.call(arguments, 1));
- }
- while (++i < len) {
- if (!~arrays.indexOf(arr[i])) {
- res.push(arr[i]);
- }
- }
- return res;
- }
- /**
- * Expose `diff`
- */
- var arrDiff = diff$1;
- /*!
- * array-unique <https://github.com/jonschlinkert/array-unique>
- *
- * Copyright (c) 2014-2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- var arrayUnique = function unique(arr) {
- if (!Array.isArray(arr)) {
- throw new TypeError('array-unique expects an array.');
- }
- var len = arr.length;
- var i = -1;
- while (i++ < len) {
- var j = i + 1;
- for (; j < arr.length; ++j) {
- if (arr[i] === arr[j]) {
- arr.splice(j--, 1);
- }
- }
- }
- return arr;
- };
- var toString$3 = {}.toString;
- var isarray = Array.isArray || function (arr) {
- return toString$3.call(arr) == '[object Array]';
- };
- var isobject = function isObject(val) {
- return val != null && typeof val === 'object' && isarray(val) === false;
- };
- /*!
- * Determine if an object is a Buffer
- *
- * @author Feross Aboukhadijeh <https://feross.org>
- * @license MIT
- */
- // The _isBuffer check is for Safari 5-7 support, because it's missing
- // Object.prototype.constructor. Remove this eventually
- var isBuffer_1 = function (obj) {
- return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
- };
- function isBuffer (obj) {
- return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
- }
- // For Node v0.10 support. Remove this eventually.
- function isSlowBuffer (obj) {
- return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
- }
- var toString$4 = Object.prototype.toString;
- /**
- * Get the native `typeof` a value.
- *
- * @param {*} `val`
- * @return {*} Native javascript type
- */
- var kindOf = function kindOf(val) {
- // primitivies
- if (typeof val === 'undefined') {
- return 'undefined';
- }
- if (val === null) {
- return 'null';
- }
- if (val === true || val === false || val instanceof Boolean) {
- return 'boolean';
- }
- if (typeof val === 'string' || val instanceof String) {
- return 'string';
- }
- if (typeof val === 'number' || val instanceof Number) {
- return 'number';
- }
- // functions
- if (typeof val === 'function' || val instanceof Function) {
- return 'function';
- }
- // array
- if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
- return 'array';
- }
- // check for instances of RegExp and Date before calling `toString`
- if (val instanceof RegExp) {
- return 'regexp';
- }
- if (val instanceof Date) {
- return 'date';
- }
- // other objects
- var type = toString$4.call(val);
- if (type === '[object RegExp]') {
- return 'regexp';
- }
- if (type === '[object Date]') {
- return 'date';
- }
- if (type === '[object Arguments]') {
- return 'arguments';
- }
- if (type === '[object Error]') {
- return 'error';
- }
- // buffer
- if (isBuffer_1(val)) {
- return 'buffer';
- }
- // es6: Map, WeakMap, Set, WeakSet
- if (type === '[object Set]') {
- return 'set';
- }
- if (type === '[object WeakSet]') {
- return 'weakset';
- }
- if (type === '[object Map]') {
- return 'map';
- }
- if (type === '[object WeakMap]') {
- return 'weakmap';
- }
- if (type === '[object Symbol]') {
- return 'symbol';
- }
- // typed arrays
- if (type === '[object Int8Array]') {
- return 'int8array';
- }
- if (type === '[object Uint8Array]') {
- return 'uint8array';
- }
- if (type === '[object Uint8ClampedArray]') {
- return 'uint8clampedarray';
- }
- if (type === '[object Int16Array]') {
- return 'int16array';
- }
- if (type === '[object Uint16Array]') {
- return 'uint16array';
- }
- if (type === '[object Int32Array]') {
- return 'int32array';
- }
- if (type === '[object Uint32Array]') {
- return 'uint32array';
- }
- if (type === '[object Float32Array]') {
- return 'float32array';
- }
- if (type === '[object Float64Array]') {
- return 'float64array';
- }
- // must be a plain object
- return 'object';
- };
- var isNumber = function isNumber(num) {
- var type = kindOf(num);
- if (type !== 'number' && type !== 'string') {
- return false;
- }
- var n = +num;
- return (n - n + 1) >= 0 && num !== '';
- };
- /*!
- * is-number <https://github.com/jonschlinkert/is-number>
- *
- * Copyright (c) 2014-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var isNumber$1 = function isNumber(num) {
- var type = typeof num;
- if (type === 'string' || num instanceof String) {
- // an empty string would be coerced to true with the below logic
- if (!num.trim()) return false;
- } else if (type !== 'number' && !(num instanceof Number)) {
- return false;
- }
- return (num - num + 1) >= 0;
- };
- var toString$5 = Object.prototype.toString;
- var kindOf$1 = function kindOf(val) {
- if (val === void 0) return 'undefined';
- if (val === null) return 'null';
- var type = typeof val;
- if (type === 'boolean') return 'boolean';
- if (type === 'string') return 'string';
- if (type === 'number') return 'number';
- if (type === 'symbol') return 'symbol';
- if (type === 'function') {
- return isGeneratorFn(val) ? 'generatorfunction' : 'function';
- }
- if (isArray(val)) return 'array';
- if (isBuffer$1(val)) return 'buffer';
- if (isArguments(val)) return 'arguments';
- if (isDate(val)) return 'date';
- if (isError$1(val)) return 'error';
- if (isRegexp(val)) return 'regexp';
- switch (ctorName(val)) {
- case 'Symbol': return 'symbol';
- case 'Promise': return 'promise';
- // Set, Map, WeakSet, WeakMap
- case 'WeakMap': return 'weakmap';
- case 'WeakSet': return 'weakset';
- case 'Map': return 'map';
- case 'Set': return 'set';
- // 8-bit typed arrays
- case 'Int8Array': return 'int8array';
- case 'Uint8Array': return 'uint8array';
- case 'Uint8ClampedArray': return 'uint8clampedarray';
- // 16-bit typed arrays
- case 'Int16Array': return 'int16array';
- case 'Uint16Array': return 'uint16array';
- // 32-bit typed arrays
- case 'Int32Array': return 'int32array';
- case 'Uint32Array': return 'uint32array';
- case 'Float32Array': return 'float32array';
- case 'Float64Array': return 'float64array';
- }
- if (isGeneratorObj(val)) {
- return 'generator';
- }
- // Non-plain objects
- type = toString$5.call(val);
- switch (type) {
- case '[object Object]': return 'object';
- // iterators
- case '[object Map Iterator]': return 'mapiterator';
- case '[object Set Iterator]': return 'setiterator';
- case '[object String Iterator]': return 'stringiterator';
- case '[object Array Iterator]': return 'arrayiterator';
- }
- // other
- return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
- };
- function ctorName(val) {
- return val.constructor ? val.constructor.name : null;
- }
- function isArray(val) {
- if (Array.isArray) return Array.isArray(val);
- return val instanceof Array;
- }
- function isError$1(val) {
- return val instanceof Error || (typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number');
- }
- function isDate(val) {
- if (val instanceof Date) return true;
- return typeof val.toDateString === 'function'
- && typeof val.getDate === 'function'
- && typeof val.setDate === 'function';
- }
- function isRegexp(val) {
- if (val instanceof RegExp) return true;
- return typeof val.flags === 'string'
- && typeof val.ignoreCase === 'boolean'
- && typeof val.multiline === 'boolean'
- && typeof val.global === 'boolean';
- }
- function isGeneratorFn(name, val) {
- return ctorName(name) === 'GeneratorFunction';
- }
- function isGeneratorObj(val) {
- return typeof val.throw === 'function'
- && typeof val.return === 'function'
- && typeof val.next === 'function';
- }
- function isArguments(val) {
- try {
- if (typeof val.length === 'number' && typeof val.callee === 'function') {
- return true;
- }
- } catch (err) {
- if (err.message.indexOf('callee') !== -1) {
- return true;
- }
- }
- return false;
- }
- /**
- * If you need to support Safari 5-7 (8-10 yr-old browser),
- * take a look at https://github.com/feross/is-buffer
- */
- function isBuffer$1(val) {
- if (val.constructor && typeof val.constructor.isBuffer === 'function') {
- return val.constructor.isBuffer(val);
- }
- return false;
- }
- var crypto = ( empty$2 && empty$1 ) || empty$2;
- var max$1 = Math.pow(2, 32);
- var node = random;
- var cryptographic = true;
- function random () {
- var buf = crypto
- .randomBytes(4)
- .toString('hex');
- return parseInt(buf, 16) / max$1
- }
- node.cryptographic = cryptographic;
- /**
- * Expose `randomatic`
- */
- var randomatic_1 = randomatic;
- var isCrypto = !!node.cryptographic;
- /**
- * Available mask characters
- */
- var type = {
- lower: 'abcdefghijklmnopqrstuvwxyz',
- upper: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
- number: '0123456789',
- special: '~!@#$%^&()_+-={}[];\',.'
- };
- type.all = type.lower + type.upper + type.number + type.special;
- /**
- * Generate random character sequences of a specified `length`,
- * based on the given `pattern`.
- *
- * @param {String} `pattern` The pattern to use for generating the random string.
- * @param {String} `length` The length of the string to generate.
- * @param {String} `options`
- * @return {String}
- * @api public
- */
- function randomatic(pattern, length, options) {
- if (typeof pattern === 'undefined') {
- throw new Error('randomatic expects a string or number.');
- }
- var custom = false;
- if (arguments.length === 1) {
- if (typeof pattern === 'string') {
- length = pattern.length;
- } else if (isNumber$1(pattern)) {
- options = {};
- length = pattern;
- pattern = '*';
- }
- }
- if (kindOf$1(length) === 'object' && length.hasOwnProperty('chars')) {
- options = length;
- pattern = options.chars;
- length = pattern.length;
- custom = true;
- }
- var opts = options || {};
- var mask = '';
- var res = '';
- // Characters to be used
- if (pattern.indexOf('?') !== -1) mask += opts.chars;
- if (pattern.indexOf('a') !== -1) mask += type.lower;
- if (pattern.indexOf('A') !== -1) mask += type.upper;
- if (pattern.indexOf('0') !== -1) mask += type.number;
- if (pattern.indexOf('!') !== -1) mask += type.special;
- if (pattern.indexOf('*') !== -1) mask += type.all;
- if (custom) mask += pattern;
- while (length--) {
- res += mask.charAt(parseInt(node() * mask.length, 10));
- }
- return res;
- }randomatic_1.isCrypto = isCrypto;
- /*!
- * repeat-string <https://github.com/jonschlinkert/repeat-string>
- *
- * Copyright (c) 2014-2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- /**
- * Results cache
- */
- var res = '';
- var cache;
- /**
- * Expose `repeat`
- */
- var repeatString = repeat;
- /**
- * Repeat the given `string` the specified `number`
- * of times.
- *
- * **Example:**
- *
- * ```js
- * var repeat = require('repeat-string');
- * repeat('A', 5);
- * //=> AAAAA
- * ```
- *
- * @param {String} `string` The string to repeat
- * @param {Number} `number` The number of times to repeat the string
- * @return {String} Repeated string
- * @api public
- */
- function repeat(str, num) {
- if (typeof str !== 'string') {
- throw new TypeError('expected a string');
- }
- // cover common, quick use cases
- if (num === 1) return str;
- if (num === 2) return str + str;
- var max = str.length * num;
- if (cache !== str || typeof cache === 'undefined') {
- cache = str;
- res = '';
- } else if (res.length >= max) {
- return res.substr(0, max);
- }
- while (max > res.length && num > 1) {
- if (num & 1) {
- res += str;
- }
- num >>= 1;
- str += str;
- }
- res += str;
- res = res.substr(0, max);
- return res;
- }
- /*!
- * repeat-element <https://github.com/jonschlinkert/repeat-element>
- *
- * Copyright (c) 2015 Jon Schlinkert.
- * Licensed under the MIT license.
- */
- var repeatElement = function repeat(ele, num) {
- var arr = new Array(num);
- for (var i = 0; i < num; i++) {
- arr[i] = ele;
- }
- return arr;
- };
- /**
- * Expose `fillRange`
- */
- var fillRange_1 = fillRange;
- /**
- * Return a range of numbers or letters.
- *
- * @param {String} `a` Start of the range
- * @param {String} `b` End of the range
- * @param {String} `step` Increment or decrement to use.
- * @param {Function} `fn` Custom function to modify each element in the range.
- * @return {Array}
- */
- function fillRange(a, b, step, options, fn) {
- if (a == null || b == null) {
- throw new Error('fill-range expects the first and second args to be strings.');
- }
- if (typeof step === 'function') {
- fn = step; options = {}; step = null;
- }
- if (typeof options === 'function') {
- fn = options; options = {};
- }
- if (isobject(step)) {
- options = step; step = '';
- }
- var expand, regex = false, sep = '';
- var opts = options || {};
- if (typeof opts.silent === 'undefined') {
- opts.silent = true;
- }
- step = step || opts.step;
- // store a ref to unmodified arg
- var origA = a, origB = b;
- b = (b.toString() === '-0') ? 0 : b;
- if (opts.optimize || opts.makeRe) {
- step = step ? (step += '~') : step;
- expand = true;
- regex = true;
- sep = '~';
- }
- // handle special step characters
- if (typeof step === 'string') {
- var match = stepRe().exec(step);
- if (match) {
- var i = match.index;
- var m = match[0];
- // repeat string
- if (m === '+') {
- return repeatElement(a, b);
- // randomize a, `b` times
- } else if (m === '?') {
- return [randomatic_1(a, b)];
- // expand right, no regex reduction
- } else if (m === '>') {
- step = step.substr(0, i) + step.substr(i + 1);
- expand = true;
- // expand to an array, or if valid create a reduced
- // string for a regex logic `or`
- } else if (m === '|') {
- step = step.substr(0, i) + step.substr(i + 1);
- expand = true;
- regex = true;
- sep = m;
- // expand to an array, or if valid create a reduced
- // string for a regex range
- } else if (m === '~') {
- step = step.substr(0, i) + step.substr(i + 1);
- expand = true;
- regex = true;
- sep = m;
- }
- } else if (!isNumber(step)) {
- if (!opts.silent) {
- throw new TypeError('fill-range: invalid step.');
- }
- return null;
- }
- }
- if (/[.&*()[\]^%$#@!]/.test(a) || /[.&*()[\]^%$#@!]/.test(b)) {
- if (!opts.silent) {
- throw new RangeError('fill-range: invalid range arguments.');
- }
- return null;
- }
- // has neither a letter nor number, or has both letters and numbers
- // this needs to be after the step logic
- if (!noAlphaNum(a) || !noAlphaNum(b) || hasBoth(a) || hasBoth(b)) {
- if (!opts.silent) {
- throw new RangeError('fill-range: invalid range arguments.');
- }
- return null;
- }
- // validate arguments
- var isNumA = isNumber(zeros(a));
- var isNumB = isNumber(zeros(b));
- if ((!isNumA && isNumB) || (isNumA && !isNumB)) {
- if (!opts.silent) {
- throw new TypeError('fill-range: first range argument is incompatible with second.');
- }
- return null;
- }
- // by this point both are the same, so we
- // can use A to check going forward.
- var isNum = isNumA;
- var num = formatStep(step);
- // is the range alphabetical? or numeric?
- if (isNum) {
- // if numeric, coerce to an integer
- a = +a; b = +b;
- } else {
- // otherwise, get the charCode to expand alpha ranges
- a = a.charCodeAt(0);
- b = b.charCodeAt(0);
- }
- // is the pattern descending?
- var isDescending = a > b;
- // don't create a character class if the args are < 0
- if (a < 0 || b < 0) {
- expand = false;
- regex = false;
- }
- // detect padding
- var padding = isPadded(origA, origB);
- var res, pad, arr = [];
- var ii = 0;
- // character classes, ranges and logical `or`
- if (regex) {
- if (shouldExpand(a, b, num, isNum, padding, opts)) {
- // make sure the correct separator is used
- if (sep === '|' || sep === '~') {
- sep = detectSeparator(a, b, num, isNum, isDescending);
- }
- return wrap$1([origA, origB], sep, opts);
- }
- }
- while (isDescending ? (a >= b) : (a <= b)) {
- if (padding && isNum) {
- pad = padding(a);
- }
- // custom function
- if (typeof fn === 'function') {
- res = fn(a, isNum, pad, ii++);
- // letters
- } else if (!isNum) {
- if (regex && isInvalidChar(a)) {
- res = null;
- } else {
- res = String.fromCharCode(a);
- }
- // numbers
- } else {
- res = formatPadding(a, pad);
- }
- // add result to the array, filtering any nulled values
- if (res !== null) arr.push(res);
- // increment or decrement
- if (isDescending) {
- a -= num;
- } else {
- a += num;
- }
- }
- // now that the array is expanded, we need to handle regex
- // character classes, ranges or logical `or` that wasn't
- // already handled before the loop
- if ((regex || expand) && !opts.noexpand) {
- // make sure the correct separator is used
- if (sep === '|' || sep === '~') {
- sep = detectSeparator(a, b, num, isNum, isDescending);
- }
- if (arr.length === 1 || a < 0 || b < 0) { return arr; }
- return wrap$1(arr, sep, opts);
- }
- return arr;
- }
- /**
- * Wrap the string with the correct regex
- * syntax.
- */
- function wrap$1(arr, sep, opts) {
- if (sep === '~') { sep = '-'; }
- var str = arr.join(sep);
- var pre = opts && opts.regexPrefix;
- // regex logical `or`
- if (sep === '|') {
- str = pre ? pre + str : str;
- str = '(' + str + ')';
- }
- // regex character class
- if (sep === '-') {
- str = (pre && pre === '^')
- ? pre + str
- : str;
- str = '[' + str + ']';
- }
- return [str];
- }
- /**
- * Check for invalid characters
- */
- function isCharClass(a, b, step, isNum, isDescending) {
- if (isDescending) { return false; }
- if (isNum) { return a <= 9 && b <= 9; }
- if (a < b) { return step === 1; }
- return false;
- }
- /**
- * Detect the correct separator to use
- */
- function shouldExpand(a, b, num, isNum, padding, opts) {
- if (isNum && (a > 9 || b > 9)) { return false; }
- return !padding && num === 1 && a < b;
- }
- /**
- * Detect the correct separator to use
- */
- function detectSeparator(a, b, step, isNum, isDescending) {
- var isChar = isCharClass(a, b, step, isNum, isDescending);
- if (!isChar) {
- return '|';
- }
- return '~';
- }
- /**
- * Correctly format the step based on type
- */
- function formatStep(step) {
- return Math.abs(step >> 0) || 1;
- }
- /**
- * Format padding, taking leading `-` into account
- */
- function formatPadding(ch, pad) {
- var res = pad ? pad + ch : ch;
- if (pad && ch.toString().charAt(0) === '-') {
- res = '-' + pad + ch.toString().substr(1);
- }
- return res.toString();
- }
- /**
- * Check for invalid characters
- */
- function isInvalidChar(str) {
- var ch = toStr(str);
- return ch === '\\'
- || ch === '['
- || ch === ']'
- || ch === '^'
- || ch === '('
- || ch === ')'
- || ch === '`';
- }
- /**
- * Convert to a string from a charCode
- */
- function toStr(ch) {
- return String.fromCharCode(ch);
- }
- /**
- * Step regex
- */
- function stepRe() {
- return /\?|>|\||\+|\~/g;
- }
- /**
- * Return true if `val` has either a letter
- * or a number
- */
- function noAlphaNum(val) {
- return /[a-z0-9]/i.test(val);
- }
- /**
- * Return true if `val` has both a letter and
- * a number (invalid)
- */
- function hasBoth(val) {
- return /[a-z][0-9]|[0-9][a-z]/i.test(val);
- }
- /**
- * Normalize zeros for checks
- */
- function zeros(val) {
- if (/^-*0+$/.test(val.toString())) {
- return '0';
- }
- return val;
- }
- /**
- * Return true if `val` has leading zeros,
- * or a similar valid pattern.
- */
- function hasZeros(val) {
- return /[^.]\.|^-*0+[0-9]/.test(val);
- }
- /**
- * If the string is padded, returns a curried function with
- * the a cached padding string, or `false` if no padding.
- *
- * @param {*} `origA` String or number.
- * @return {String|Boolean}
- */
- function isPadded(origA, origB) {
- if (hasZeros(origA) || hasZeros(origB)) {
- var alen = length(origA);
- var blen = length(origB);
- var len = alen >= blen
- ? alen
- : blen;
- return function (a) {
- return repeatString('0', len - length(a));
- };
- }
- return false;
- }
- /**
- * Get the string length of `val`
- */
- function length(val) {
- return val.toString().length;
- }
- var expandRange = function expandRange(str, options, fn) {
- if (typeof str !== 'string') {
- throw new TypeError('expand-range expects a string.');
- }
- if (typeof options === 'function') {
- fn = options;
- options = {};
- }
- if (typeof options === 'boolean') {
- options = {};
- options.makeRe = true;
- }
- // create arguments to pass to fill-range
- var opts = options || {};
- var args = str.split('..');
- var len = args.length;
- if (len > 3) { return str; }
- // if only one argument, it can't expand so return it
- if (len === 1) { return args; }
- // if `true`, tell fill-range to regexify the string
- if (typeof fn === 'boolean' && fn === true) {
- opts.makeRe = true;
- }
- args.push(opts);
- return fillRange_1.apply(null, args.concat(fn));
- };
- /*!
- * preserve <https://github.com/jonschlinkert/preserve>
- *
- * Copyright (c) 2014-2015, Jon Schlinkert.
- * Licensed under the MIT license.
- */
- /**
- * Replace tokens in `str` with a temporary, heuristic placeholder.
- *
- * ```js
- * tokens.before('{a\\,b}');
- * //=> '{__ID1__}'
- * ```
- *
- * @param {String} `str`
- * @return {String} String with placeholders.
- * @api public
- */
- var before = function before(str, re) {
- return str.replace(re, function (match) {
- var id = randomize();
- cache$1[id] = match;
- return '__ID' + id + '__';
- });
- };
- /**
- * Replace placeholders in `str` with original tokens.
- *
- * ```js
- * tokens.after('{__ID1__}');
- * //=> '{a\\,b}'
- * ```
- *
- * @param {String} `str` String with placeholders
- * @return {String} `str` String with original tokens.
- * @api public
- */
- var after = function after(str) {
- return str.replace(/__ID(.{5})__/g, function (_, id) {
- return cache$1[id];
- });
- };
- function randomize() {
- return Math.random().toString().slice(2, 7);
- }
- var cache$1 = {};
- var preserve = {
- before: before,
- after: after
- };
- /**
- * Module dependencies
- */
- /**
- * Expose `braces`
- */
- var braces_1 = function(str, options) {
- if (typeof str !== 'string') {
- throw new Error('braces expects a string');
- }
- return braces(str, options);
- };
- /**
- * Expand `{foo,bar}` or `{1..5}` braces in the
- * given `string`.
- *
- * @param {String} `str`
- * @param {Array} `arr`
- * @param {Object} `options`
- * @return {Array}
- */
- function braces(str, arr, options) {
- if (str === '') {
- return [];
- }
- if (!Array.isArray(arr)) {
- options = arr;
- arr = [];
- }
- var opts = options || {};
- arr = arr || [];
- if (typeof opts.nodupes === 'undefined') {
- opts.nodupes = true;
- }
- var fn = opts.fn;
- var es6;
- if (typeof opts === 'function') {
- fn = opts;
- opts = {};
- }
- if (!(patternRe instanceof RegExp)) {
- patternRe = patternRegex();
- }
- var matches = str.match(patternRe) || [];
- var m = matches[0];
- switch(m) {
- case '\\,':
- return escapeCommas(str, arr, opts);
- case '\\.':
- return escapeDots(str, arr, opts);
- case '\/.':
- return escapePaths(str, arr, opts);
- case ' ':
- return splitWhitespace(str);
- case '{,}':
- return exponential(str, opts, braces);
- case '{}':
- return emptyBraces(str, arr, opts);
- case '\\{':
- case '\\}':
- return escapeBraces(str, arr, opts);
- case '${':
- if (!/\{[^{]+\{/.test(str)) {
- return arr.concat(str);
- } else {
- es6 = true;
- str = preserve.before(str, es6Regex());
- }
- }
- if (!(braceRe instanceof RegExp)) {
- braceRe = braceRegex();
- }
- var match = braceRe.exec(str);
- if (match == null) {
- return [str];
- }
- var outter = match[1];
- var inner = match[2];
- if (inner === '') { return [str]; }
- var segs, segsLength;
- if (inner.indexOf('..') !== -1) {
- segs = expandRange(inner, opts, fn) || inner.split(',');
- segsLength = segs.length;
- } else if (inner[0] === '"' || inner[0] === '\'') {
- return arr.concat(str.split(/['"]/).join(''));
- } else {
- segs = inner.split(',');
- if (opts.makeRe) {
- return braces(str.replace(outter, wrap$2(segs, '|')), opts);
- }
- segsLength = segs.length;
- if (segsLength === 1 && opts.bash) {
- segs[0] = wrap$2(segs[0], '\\');
- }
- }
- var len = segs.length;
- var i = 0, val;
- while (len--) {
- var path = segs[i++];
- if (/(\.[^.\/])/.test(path)) {
- if (segsLength > 1) {
- return segs;
- } else {
- return [str];
- }
- }
- val = splice(str, outter, path);
- if (/\{[^{}]+?\}/.test(val)) {
- arr = braces(val, arr, opts);
- } else if (val !== '') {
- if (opts.nodupes && arr.indexOf(val) !== -1) { continue; }
- arr.push(es6 ? preserve.after(val) : val);
- }
- }
- if (opts.strict) { return filter$1(arr, filterEmpty); }
- return arr;
- }
- /**
- * Expand exponential ranges
- *
- * `a{,}{,}` => ['a', 'a', 'a', 'a']
- */
- function exponential(str, options, fn) {
- if (typeof options === 'function') {
- fn = options;
- options = null;
- }
- var opts = options || {};
- var esc = '__ESC_EXP__';
- var exp = 0;
- var res;
- var parts = str.split('{,}');
- if (opts.nodupes) {
- return fn(parts.join(''), opts);
- }
- exp = parts.length - 1;
- res = fn(parts.join(esc), opts);
- var len = res.length;
- var arr = [];
- var i = 0;
- while (len--) {
- var ele = res[i++];
- var idx = ele.indexOf(esc);
- if (idx === -1) {
- arr.push(ele);
- } else {
- ele = ele.split('__ESC_EXP__').join('');
- if (!!ele && opts.nodupes !== false) {
- arr.push(ele);
- } else {
- var num = Math.pow(2, exp);
- arr.push.apply(arr, repeatElement(ele, num));
- }
- }
- }
- return arr;
- }
- /**
- * Wrap a value with parens, brackets or braces,
- * based on the given character/separator.
- *
- * @param {String|Array} `val`
- * @param {String} `ch`
- * @return {String}
- */
- function wrap$2(val, ch) {
- if (ch === '|') {
- return '(' + val.join(ch) + ')';
- }
- if (ch === ',') {
- return '{' + val.join(ch) + '}';
- }
- if (ch === '-') {
- return '[' + val.join(ch) + ']';
- }
- if (ch === '\\') {
- return '\\{' + val + '\\}';
- }
- }
- /**
- * Handle empty braces: `{}`
- */
- function emptyBraces(str, arr, opts) {
- return braces(str.split('{}').join('\\{\\}'), arr, opts);
- }
- /**
- * Filter out empty-ish values
- */
- function filterEmpty(ele) {
- return !!ele && ele !== '\\';
- }
- /**
- * Handle patterns with whitespace
- */
- function splitWhitespace(str) {
- var segs = str.split(' ');
- var len = segs.length;
- var res = [];
- var i = 0;
- while (len--) {
- res.push.apply(res, braces(segs[i++]));
- }
- return res;
- }
- /**
- * Handle escaped braces: `\\{foo,bar}`
- */
- function escapeBraces(str, arr, opts) {
- if (!/\{[^{]+\{/.test(str)) {
- return arr.concat(str.split('\\').join(''));
- } else {
- str = str.split('\\{').join('__LT_BRACE__');
- str = str.split('\\}').join('__RT_BRACE__');
- return map$2(braces(str, arr, opts), function(ele) {
- ele = ele.split('__LT_BRACE__').join('{');
- return ele.split('__RT_BRACE__').join('}');
- });
- }
- }
- /**
- * Handle escaped dots: `{1\\.2}`
- */
- function escapeDots(str, arr, opts) {
- if (!/[^\\]\..+\\\./.test(str)) {
- return arr.concat(str.split('\\').join(''));
- } else {
- str = str.split('\\.').join('__ESC_DOT__');
- return map$2(braces(str, arr, opts), function(ele) {
- return ele.split('__ESC_DOT__').join('.');
- });
- }
- }
- /**
- * Handle escaped dots: `{1\\.2}`
- */
- function escapePaths(str, arr, opts) {
- str = str.split('\/.').join('__ESC_PATH__');
- return map$2(braces(str, arr, opts), function(ele) {
- return ele.split('__ESC_PATH__').join('\/.');
- });
- }
- /**
- * Handle escaped commas: `{a\\,b}`
- */
- function escapeCommas(str, arr, opts) {
- if (!/\w,/.test(str)) {
- return arr.concat(str.split('\\').join(''));
- } else {
- str = str.split('\\,').join('__ESC_COMMA__');
- return map$2(braces(str, arr, opts), function(ele) {
- return ele.split('__ESC_COMMA__').join(',');
- });
- }
- }
- /**
- * Regex for common patterns
- */
- function patternRegex() {
- return /\${|( (?=[{,}])|(?=[{,}]) )|{}|{,}|\\,(?=.*[{}])|\/\.(?=.*[{}])|\\\.(?={)|\\{|\\}/;
- }
- /**
- * Braces regex.
- */
- function braceRegex() {
- return /.*(\\?\{([^}]+)\})/;
- }
- /**
- * es6 delimiter regex.
- */
- function es6Regex() {
- return /\$\{([^}]+)\}/;
- }
- var braceRe;
- var patternRe;
- /**
- * Faster alternative to `String.replace()` when the
- * index of the token to be replaces can't be supplied
- */
- function splice(str, token, replacement) {
- var i = str.indexOf(token);
- return str.substr(0, i) + replacement
- + str.substr(i + token.length);
- }
- /**
- * Fast array map
- */
- function map$2(arr, fn) {
- if (arr == null) {
- return [];
- }
- var len = arr.length;
- var res = new Array(len);
- var i = -1;
- while (++i < len) {
- res[i] = fn(arr[i], i, arr);
- }
- return res;
- }
- /**
- * Fast array filter
- */
- function filter$1(arr, cb) {
- if (arr == null) return [];
- if (typeof cb !== 'function') {
- throw new TypeError('braces: filter expects a callback function.');
- }
- var len = arr.length;
- var res = arr.slice();
- var i = 0;
- while (len--) {
- if (!cb(arr[len], i++)) {
- res.splice(len, 1);
- }
- }
- return res;
- }
- /*!
- * is-posix-bracket <https://github.com/jonschlinkert/is-posix-bracket>
- *
- * Copyright (c) 2015-2016, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- var isPosixBracket = function isPosixBracket(str) {
- return typeof str === 'string' && /\[([:.=+])(?:[^\[\]]|)+\1\]/.test(str);
- };
- /**
- * POSIX character classes
- */
- var POSIX = {
- alnum: 'a-zA-Z0-9',
- alpha: 'a-zA-Z',
- blank: ' \\t',
- cntrl: '\\x00-\\x1F\\x7F',
- digit: '0-9',
- graph: '\\x21-\\x7E',
- lower: 'a-z',
- print: '\\x20-\\x7E',
- punct: '-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
- space: ' \\t\\r\\n\\v\\f',
- upper: 'A-Z',
- word: 'A-Za-z0-9_',
- xdigit: 'A-Fa-f0-9',
- };
- /**
- * Expose `brackets`
- */
- var expandBrackets = brackets;
- function brackets(str) {
- if (!isPosixBracket(str)) {
- return str;
- }
- var negated = false;
- if (str.indexOf('[^') !== -1) {
- negated = true;
- str = str.split('[^').join('[');
- }
- if (str.indexOf('[!') !== -1) {
- negated = true;
- str = str.split('[!').join('[');
- }
- var a = str.split('[');
- var b = str.split(']');
- var imbalanced = a.length !== b.length;
- var parts = str.split(/(?::\]\[:|\[?\[:|:\]\]?)/);
- var len = parts.length, i = 0;
- var end = '', beg = '';
- var res = [];
- // start at the end (innermost) first
- while (len--) {
- var inner = parts[i++];
- if (inner === '^[!' || inner === '[!') {
- inner = '';
- negated = true;
- }
- var prefix = negated ? '^' : '';
- var ch = POSIX[inner];
- if (ch) {
- res.push('[' + prefix + ch + ']');
- } else if (inner) {
- if (/^\[?\w-\w\]?$/.test(inner)) {
- if (i === parts.length) {
- res.push('[' + prefix + inner);
- } else if (i === 1) {
- res.push(prefix + inner + ']');
- } else {
- res.push(prefix + inner);
- }
- } else {
- if (i === 1) {
- beg += inner;
- } else if (i === parts.length) {
- end += inner;
- } else {
- res.push('[' + prefix + inner + ']');
- }
- }
- }
- }
- var result = res.join('|');
- var rlen = res.length || 1;
- if (rlen > 1) {
- result = '(?:' + result + ')';
- rlen = 1;
- }
- if (beg) {
- rlen++;
- if (beg.charAt(0) === '[') {
- if (imbalanced) {
- beg = '\\[' + beg.slice(1);
- } else {
- beg += ']';
- }
- }
- result = beg + result;
- }
- if (end) {
- rlen++;
- if (end.slice(-1) === ']') {
- if (imbalanced) {
- end = end.slice(0, end.length - 1) + '\\]';
- } else {
- end = '[' + end;
- }
- }
- result += end;
- }
- if (rlen > 1) {
- result = result.split('][').join(']|[');
- if (result.indexOf('|') !== -1 && !/\(\?/.test(result)) {
- result = '(?:' + result + ')';
- }
- }
- result = result.replace(/\[+=|=\]+/g, '\\b');
- return result;
- }
- brackets.makeRe = function(pattern) {
- try {
- return new RegExp(brackets(pattern));
- } catch (err) {}
- };
- brackets.isMatch = function(str, pattern) {
- try {
- return brackets.makeRe(pattern).test(str);
- } catch (err) {
- return false;
- }
- };
- brackets.match = function(arr, pattern) {
- var len = arr.length, i = 0;
- var res = arr.slice();
- var re = brackets.makeRe(pattern);
- while (i < len) {
- var ele = arr[i++];
- if (!re.test(ele)) {
- continue;
- }
- res.splice(i, 1);
- }
- return res;
- };
- /*!
- * is-extglob <https://github.com/jonschlinkert/is-extglob>
- *
- * Copyright (c) 2014-2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- var isExtglob = function isExtglob(str) {
- return typeof str === 'string'
- && /[@?!+*]\(/.test(str);
- };
- /**
- * Module dependencies
- */
- var re, cache$2 = {};
- /**
- * Expose `extglob`
- */
- var extglob_1 = extglob;
- /**
- * Convert the given extglob `string` to a regex-compatible
- * string.
- *
- * ```js
- * var extglob = require('extglob');
- * extglob('!(a?(b))');
- * //=> '(?!a(?:b)?)[^/]*?'
- * ```
- *
- * @param {String} `str` The string to convert.
- * @param {Object} `options`
- * @option {Boolean} [options] `esc` If `false` special characters will not be escaped. Defaults to `true`.
- * @option {Boolean} [options] `regex` If `true` a regular expression is returned instead of a string.
- * @return {String}
- * @api public
- */
- function extglob(str, opts) {
- opts = opts || {};
- var o = {}, i = 0;
- // fix common character reversals
- // '*!(.js)' => '*.!(js)'
- str = str.replace(/!\(([^\w*()])/g, '$1!(');
- // support file extension negation
- str = str.replace(/([*\/])\.!\([*]\)/g, function (m, ch) {
- if (ch === '/') {
- return escape('\\/[^.]+');
- }
- return escape('[^.]+');
- });
- // create a unique key for caching by
- // combining the string and options
- var key = str
- + String(!!opts.regex)
- + String(!!opts.contains)
- + String(!!opts.escape);
- if (cache$2.hasOwnProperty(key)) {
- return cache$2[key];
- }
- if (!(re instanceof RegExp)) {
- re = regex();
- }
- opts.negate = false;
- var m;
- while (m = re.exec(str)) {
- var prefix = m[1];
- var inner = m[3];
- if (prefix === '!') {
- opts.negate = true;
- }
- var id = '__EXTGLOB_' + (i++) + '__';
- // use the prefix of the _last_ (outtermost) pattern
- o[id] = wrap$3(inner, prefix, opts.escape);
- str = str.split(m[0]).join(id);
- }
- var keys = Object.keys(o);
- var len = keys.length;
- // we have to loop again to allow us to convert
- // patterns in reverse order (starting with the
- // innermost/last pattern first)
- while (len--) {
- var prop = keys[len];
- str = str.split(prop).join(o[prop]);
- }
- var result = opts.regex
- ? toRegex(str, opts.contains, opts.negate)
- : str;
- result = result.split('.').join('\\.');
- // cache the result and return it
- return (cache$2[key] = result);
- }
- /**
- * Convert `string` to a regex string.
- *
- * @param {String} `str`
- * @param {String} `prefix` Character that determines how to wrap the string.
- * @param {Boolean} `esc` If `false` special characters will not be escaped. Defaults to `true`.
- * @return {String}
- */
- function wrap$3(inner, prefix, esc) {
- if (esc) inner = escape(inner);
- switch (prefix) {
- case '!':
- return '(?!' + inner + ')[^/]' + (esc ? '%%%~' : '*?');
- case '@':
- return '(?:' + inner + ')';
- case '+':
- return '(?:' + inner + ')+';
- case '*':
- return '(?:' + inner + ')' + (esc ? '%%' : '*')
- case '?':
- return '(?:' + inner + '|)';
- default:
- return inner;
- }
- }
- function escape(str) {
- str = str.split('*').join('[^/]%%%~');
- str = str.split('.').join('\\.');
- return str;
- }
- /**
- * extglob regex.
- */
- function regex() {
- return /(\\?[@?!+*$]\\?)(\(([^()]*?)\))/;
- }
- /**
- * Negation regex
- */
- function negate(str) {
- return '(?!^' + str + ').*$';
- }
- /**
- * Create the regex to do the matching. If
- * the leading character in the `pattern` is `!`
- * a negation regex is returned.
- *
- * @param {String} `pattern`
- * @param {Boolean} `contains` Allow loose matching.
- * @param {Boolean} `isNegated` True if the pattern is a negation pattern.
- */
- function toRegex(pattern, contains, isNegated) {
- var prefix = contains ? '^' : '';
- var after = contains ? '$' : '';
- pattern = ('(?:' + pattern + ')' + after);
- if (isNegated) {
- pattern = prefix + negate(pattern);
- }
- return new RegExp(prefix + pattern);
- }
- /*!
- * is-glob <https://github.com/jonschlinkert/is-glob>
- *
- * Copyright (c) 2014-2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- var isGlob = function isGlob(str) {
- return typeof str === 'string'
- && (/[*!?{}(|)[\]]/.test(str)
- || isExtglob(str));
- };
- var isWin = process$3.platform === 'win32';
- var removeTrailingSeparator = function (str) {
- var i = str.length - 1;
- if (i < 2) {
- return str;
- }
- while (isSeparator(str, i)) {
- i--;
- }
- return str.substr(0, i + 1);
- };
- function isSeparator(str, i) {
- var char = str[i];
- return i > 0 && (char === '/' || (isWin && char === '\\'));
- }
- /*!
- * normalize-path <https://github.com/jonschlinkert/normalize-path>
- *
- * Copyright (c) 2014-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var normalizePath = function normalizePath(str, stripTrailing) {
- if (typeof str !== 'string') {
- throw new TypeError('expected a string');
- }
- str = str.replace(/[\\\/]+/g, '/');
- if (stripTrailing !== false) {
- str = removeTrailingSeparator(str);
- }
- return str;
- };
- /*!
- * is-extendable <https://github.com/jonschlinkert/is-extendable>
- *
- * Copyright (c) 2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- var isExtendable = function isExtendable(val) {
- return typeof val !== 'undefined' && val !== null
- && (typeof val === 'object' || typeof val === 'function');
- };
- /*!
- * for-in <https://github.com/jonschlinkert/for-in>
- *
- * Copyright (c) 2014-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var forIn = function forIn(obj, fn, thisArg) {
- for (var key in obj) {
- if (fn.call(thisArg, obj[key], key, obj) === false) {
- break;
- }
- }
- };
- var hasOwn = Object.prototype.hasOwnProperty;
- var forOwn = function forOwn(obj, fn, thisArg) {
- forIn(obj, function(val, key) {
- if (hasOwn.call(obj, key)) {
- return fn.call(thisArg, obj[key], key, obj);
- }
- });
- };
- var object_omit = function omit(obj, keys) {
- if (!isExtendable(obj)) return {};
- keys = [].concat.apply([], [].slice.call(arguments, 1));
- var last = keys[keys.length - 1];
- var res = {}, fn;
- if (typeof last === 'function') {
- fn = keys.pop();
- }
- var isFunction = typeof fn === 'function';
- if (!keys.length && !isFunction) {
- return obj;
- }
- forOwn(obj, function(value, key) {
- if (keys.indexOf(key) === -1) {
- if (!isFunction) {
- res[key] = value;
- } else if (fn(value, key, obj)) {
- res[key] = value;
- }
- }
- });
- return res;
- };
- var globParent = function globParent(str) {
- str += 'a'; // preserves full path in case of trailing path separator
- do {str = path$2.dirname(str);} while (isGlob(str));
- return str;
- };
- var globBase = function globBase(pattern) {
- if (typeof pattern !== 'string') {
- throw new TypeError('glob-base expects a string.');
- }
- var res = {};
- res.base = globParent(pattern);
- res.isGlob = isGlob(pattern);
- if (res.base !== '.') {
- res.glob = pattern.substr(res.base.length);
- if (res.glob.charAt(0) === '/') {
- res.glob = res.glob.substr(1);
- }
- } else {
- res.glob = pattern;
- }
- if (!res.isGlob) {
- res.base = dirname$1(pattern);
- res.glob = res.base !== '.'
- ? pattern.substr(res.base.length)
- : pattern;
- }
- if (res.glob.substr(0, 2) === './') {
- res.glob = res.glob.substr(2);
- }
- if (res.glob.charAt(0) === '/') {
- res.glob = res.glob.substr(1);
- }
- return res;
- };
- function dirname$1(glob) {
- if (glob.slice(-1) === '/') return glob;
- return path$2.dirname(glob);
- }
- /*!
- * is-dotfile <https://github.com/jonschlinkert/is-dotfile>
- *
- * Copyright (c) 2015-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var isDotfile = function(str) {
- if (str.charCodeAt(0) === 46 /* . */ && str.indexOf('/', 1) === -1) {
- return true;
- }
- var slash = str.lastIndexOf('/');
- return slash !== -1 ? str.charCodeAt(slash + 1) === 46 /* . */ : false;
- };
- var parseGlob = createCommonjsModule(function (module) {
- /**
- * Expose `cache`
- */
- var cache = module.exports.cache = {};
- /**
- * Parse a glob pattern into tokens.
- *
- * When no paths or '**' are in the glob, we use a
- * different strategy for parsing the filename, since
- * file names can contain braces and other difficult
- * patterns. such as:
- *
- * - `*.{a,b}`
- * - `(**|*.js)`
- */
- module.exports = function parseGlob(glob) {
- if (cache.hasOwnProperty(glob)) {
- return cache[glob];
- }
- var tok = {};
- tok.orig = glob;
- tok.is = {};
- // unescape dots and slashes in braces/brackets
- glob = escape(glob);
- var parsed = globBase(glob);
- tok.is.glob = parsed.isGlob;
- tok.glob = parsed.glob;
- tok.base = parsed.base;
- var segs = /([^\/]*)$/.exec(glob);
- tok.path = {};
- tok.path.dirname = '';
- tok.path.basename = segs[1] || '';
- tok.path.dirname = glob.split(tok.path.basename).join('') || '';
- var basename = (tok.path.basename || '').split('.') || '';
- tok.path.filename = basename[0] || '';
- tok.path.extname = basename.slice(1).join('.') || '';
- tok.path.ext = '';
- if (isGlob(tok.path.dirname) && !tok.path.basename) {
- if (!/\/$/.test(tok.glob)) {
- tok.path.basename = tok.glob;
- }
- tok.path.dirname = tok.base;
- }
- if (glob.indexOf('/') === -1 && !tok.is.globstar) {
- tok.path.dirname = '';
- tok.path.basename = tok.orig;
- }
- var dot = tok.path.basename.indexOf('.');
- if (dot !== -1) {
- tok.path.filename = tok.path.basename.slice(0, dot);
- tok.path.extname = tok.path.basename.slice(dot);
- }
- if (tok.path.extname.charAt(0) === '.') {
- var exts = tok.path.extname.split('.');
- tok.path.ext = exts[exts.length - 1];
- }
- // unescape dots and slashes in braces/brackets
- tok.glob = unescape(tok.glob);
- tok.path.dirname = unescape(tok.path.dirname);
- tok.path.basename = unescape(tok.path.basename);
- tok.path.filename = unescape(tok.path.filename);
- tok.path.extname = unescape(tok.path.extname);
- // Booleans
- var is = (glob && tok.is.glob);
- tok.is.negated = glob && glob.charAt(0) === '!';
- tok.is.extglob = glob && isExtglob(glob);
- tok.is.braces = has(is, glob, '{');
- tok.is.brackets = has(is, glob, '[:');
- tok.is.globstar = has(is, glob, '**');
- tok.is.dotfile = isDotfile(tok.path.basename) || isDotfile(tok.path.filename);
- tok.is.dotdir = dotdir(tok.path.dirname);
- return (cache[glob] = tok);
- };
- /**
- * Returns true if the glob matches dot-directories.
- *
- * @param {Object} `tok` The tokens object
- * @param {Object} `path` The path object
- * @return {Object}
- */
- function dotdir(base) {
- if (base.indexOf('/.') !== -1) {
- return true;
- }
- if (base.charAt(0) === '.' && base.charAt(1) !== '/') {
- return true;
- }
- return false;
- }
- /**
- * Returns true if the pattern has the given `ch`aracter(s)
- *
- * @param {Object} `glob` The glob pattern.
- * @param {Object} `ch` The character to test for
- * @return {Object}
- */
- function has(is, glob, ch) {
- return is && glob.indexOf(ch) !== -1;
- }
- /**
- * Escape/unescape utils
- */
- function escape(str) {
- var re = /\{([^{}]*?)}|\(([^()]*?)\)|\[([^\[\]]*?)\]/g;
- return str.replace(re, function (outter, braces, parens, brackets) {
- var inner = braces || parens || brackets;
- if (!inner) { return outter; }
- return outter.split(inner).join(esc(inner));
- });
- }
- function esc(str) {
- str = str.split('/').join('__SLASH__');
- str = str.split('.').join('__DOT__');
- return str;
- }
- function unescape(str) {
- str = str.split('__SLASH__').join('/');
- str = str.split('__DOT__').join('.');
- return str;
- }
- });
- var parseGlob_1 = parseGlob.cache;
- /*!
- * is-primitive <https://github.com/jonschlinkert/is-primitive>
- *
- * Copyright (c) 2014-2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- // see http://jsperf.com/testing-value-is-primitive/7
- var isPrimitive = function isPrimitive(value) {
- return value == null || (typeof value !== 'function' && typeof value !== 'object');
- };
- var isEqualShallow = function isEqual(a, b) {
- if (!a && !b) { return true; }
- if (!a && b || a && !b) { return false; }
- var numKeysA = 0, numKeysB = 0, key;
- for (key in b) {
- numKeysB++;
- if (!isPrimitive(b[key]) || !a.hasOwnProperty(key) || (a[key] !== b[key])) {
- return false;
- }
- }
- for (key in a) {
- numKeysA++;
- }
- return numKeysA === numKeysB;
- };
- var basic = {};
- var cache$3 = {};
- /**
- * Expose `regexCache`
- */
- var regexCache_1 = regexCache;
- /**
- * Memoize the results of a call to the new RegExp constructor.
- *
- * @param {Function} fn [description]
- * @param {String} str [description]
- * @param {Options} options [description]
- * @param {Boolean} nocompare [description]
- * @return {RegExp}
- */
- function regexCache(fn, str, opts) {
- var key = '_default_', regex, cached;
- if (!str && !opts) {
- if (typeof fn !== 'function') {
- return fn;
- }
- return basic[key] || (basic[key] = fn(str));
- }
- var isString = typeof str === 'string';
- if (isString) {
- if (!opts) {
- return basic[str] || (basic[str] = fn(str));
- }
- key = str;
- } else {
- opts = str;
- }
- cached = cache$3[key];
- if (cached && isEqualShallow(cached.opts, opts)) {
- return cached.regex;
- }
- memo(key, opts, (regex = fn(str, opts)));
- return regex;
- }
- function memo(key, opts, regex) {
- cache$3[key] = {regex: regex, opts: opts};
- }
- /**
- * Expose `cache`
- */
- var cache_1 = cache$3;
- var basic_1 = basic;
- regexCache_1.cache = cache_1;
- regexCache_1.basic = basic_1;
- var utils_1 = createCommonjsModule(function (module) {
- var win32 = process$3 && process$3.platform === 'win32';
- var utils = module.exports;
- /**
- * Module dependencies
- */
- utils.diff = arrDiff;
- utils.unique = arrayUnique;
- utils.braces = braces_1;
- utils.brackets = expandBrackets;
- utils.extglob = extglob_1;
- utils.isExtglob = isExtglob;
- utils.isGlob = isGlob;
- utils.typeOf = kindOf;
- utils.normalize = normalizePath;
- utils.omit = object_omit;
- utils.parseGlob = parseGlob;
- utils.cache = regexCache_1;
- /**
- * Get the filename of a filepath
- *
- * @param {String} `string`
- * @return {String}
- */
- utils.filename = function filename(fp) {
- var seg = fp.match(filenameRegex());
- return seg && seg[0];
- };
- /**
- * Returns a function that returns true if the given
- * pattern is the same as a given `filepath`
- *
- * @param {String} `pattern`
- * @return {Function}
- */
- utils.isPath = function isPath(pattern, opts) {
- opts = opts || {};
- return function(fp) {
- var unixified = utils.unixify(fp, opts);
- if(opts.nocase){
- return pattern.toLowerCase() === unixified.toLowerCase();
- }
- return pattern === unixified;
- };
- };
- /**
- * Returns a function that returns true if the given
- * pattern contains a `filepath`
- *
- * @param {String} `pattern`
- * @return {Function}
- */
- utils.hasPath = function hasPath(pattern, opts) {
- return function(fp) {
- return utils.unixify(pattern, opts).indexOf(fp) !== -1;
- };
- };
- /**
- * Returns a function that returns true if the given
- * pattern matches or contains a `filepath`
- *
- * @param {String} `pattern`
- * @return {Function}
- */
- utils.matchPath = function matchPath(pattern, opts) {
- var fn = (opts && opts.contains)
- ? utils.hasPath(pattern, opts)
- : utils.isPath(pattern, opts);
- return fn;
- };
- /**
- * Returns a function that returns true if the given
- * regex matches the `filename` of a file path.
- *
- * @param {RegExp} `re`
- * @return {Boolean}
- */
- utils.hasFilename = function hasFilename(re) {
- return function(fp) {
- var name = utils.filename(fp);
- return name && re.test(name);
- };
- };
- /**
- * Coerce `val` to an array
- *
- * @param {*} val
- * @return {Array}
- */
- utils.arrayify = function arrayify(val) {
- return !Array.isArray(val)
- ? [val]
- : val;
- };
- /**
- * Normalize all slashes in a file path or glob pattern to
- * forward slashes.
- */
- utils.unixify = function unixify(fp, opts) {
- if (opts && opts.unixify === false) return fp;
- if (opts && opts.unixify === true || win32 || path$2.sep === '\\') {
- return utils.normalize(fp, false);
- }
- if (opts && opts.unescape === true) {
- return fp ? fp.toString().replace(/\\(\w)/g, '$1') : '';
- }
- return fp;
- };
- /**
- * Escape/unescape utils
- */
- utils.escapePath = function escapePath(fp) {
- return fp.replace(/[\\.]/g, '\\$&');
- };
- utils.unescapeGlob = function unescapeGlob(fp) {
- return fp.replace(/[\\"']/g, '');
- };
- utils.escapeRe = function escapeRe(str) {
- return str.replace(/[-[\\$*+?.#^\s{}(|)\]]/g, '\\$&');
- };
- /**
- * Expose `utils`
- */
- module.exports = utils;
- });
- var chars = {}, unesc, temp;
- function reverse(object, prepender) {
- return Object.keys(object).reduce(function(reversed, key) {
- var newKey = prepender ? prepender + key : key; // Optionally prepend a string to key.
- reversed[object[key]] = newKey; // Swap key and value.
- return reversed; // Return the result.
- }, {});
- }
- /**
- * Regex for common characters
- */
- chars.escapeRegex = {
- '?': /\?/g,
- '@': /\@/g,
- '!': /\!/g,
- '+': /\+/g,
- '*': /\*/g,
- '(': /\(/g,
- ')': /\)/g,
- '[': /\[/g,
- ']': /\]/g
- };
- /**
- * Escape characters
- */
- chars.ESC = {
- '?': '__UNESC_QMRK__',
- '@': '__UNESC_AMPE__',
- '!': '__UNESC_EXCL__',
- '+': '__UNESC_PLUS__',
- '*': '__UNESC_STAR__',
- ',': '__UNESC_COMMA__',
- '(': '__UNESC_LTPAREN__',
- ')': '__UNESC_RTPAREN__',
- '[': '__UNESC_LTBRACK__',
- ']': '__UNESC_RTBRACK__'
- };
- /**
- * Unescape characters
- */
- chars.UNESC = unesc || (unesc = reverse(chars.ESC, '\\'));
- chars.ESC_TEMP = {
- '?': '__TEMP_QMRK__',
- '@': '__TEMP_AMPE__',
- '!': '__TEMP_EXCL__',
- '*': '__TEMP_STAR__',
- '+': '__TEMP_PLUS__',
- ',': '__TEMP_COMMA__',
- '(': '__TEMP_LTPAREN__',
- ')': '__TEMP_RTPAREN__',
- '[': '__TEMP_LTBRACK__',
- ']': '__TEMP_RTBRACK__'
- };
- chars.TEMP = temp || (temp = reverse(chars.ESC_TEMP));
- var chars_1 = chars;
- var glob = createCommonjsModule(function (module) {
- /**
- * Expose `Glob`
- */
- var Glob = module.exports = function Glob(pattern, options) {
- if (!(this instanceof Glob)) {
- return new Glob(pattern, options);
- }
- this.options = options || {};
- this.pattern = pattern;
- this.history = [];
- this.tokens = {};
- this.init(pattern);
- };
- /**
- * Initialize defaults
- */
- Glob.prototype.init = function(pattern) {
- this.orig = pattern;
- this.negated = this.isNegated();
- this.options.track = this.options.track || false;
- this.options.makeRe = true;
- };
- /**
- * Push a change into `glob.history`. Useful
- * for debugging.
- */
- Glob.prototype.track = function(msg) {
- if (this.options.track) {
- this.history.push({msg: msg, pattern: this.pattern});
- }
- };
- /**
- * Return true if `glob.pattern` was negated
- * with `!`, also remove the `!` from the pattern.
- *
- * @return {Boolean}
- */
- Glob.prototype.isNegated = function() {
- if (this.pattern.charCodeAt(0) === 33 /* '!' */) {
- this.pattern = this.pattern.slice(1);
- return true;
- }
- return false;
- };
- /**
- * Expand braces in the given glob pattern.
- *
- * We only need to use the [braces] lib when
- * patterns are nested.
- */
- Glob.prototype.braces = function() {
- if (this.options.nobraces !== true && this.options.nobrace !== true) {
- // naive/fast check for imbalanced characters
- var a = this.pattern.match(/[\{\(\[]/g);
- var b = this.pattern.match(/[\}\)\]]/g);
- // if imbalanced, don't optimize the pattern
- if (a && b && (a.length !== b.length)) {
- this.options.makeRe = false;
- }
- // expand brace patterns and join the resulting array
- var expanded = utils_1.braces(this.pattern, this.options);
- this.pattern = expanded.join('|');
- }
- };
- /**
- * Expand bracket expressions in `glob.pattern`
- */
- Glob.prototype.brackets = function() {
- if (this.options.nobrackets !== true) {
- this.pattern = utils_1.brackets(this.pattern);
- }
- };
- /**
- * Expand bracket expressions in `glob.pattern`
- */
- Glob.prototype.extglob = function() {
- if (this.options.noextglob === true) return;
- if (utils_1.isExtglob(this.pattern)) {
- this.pattern = utils_1.extglob(this.pattern, {escape: true});
- }
- };
- /**
- * Parse the given pattern
- */
- Glob.prototype.parse = function(pattern) {
- this.tokens = utils_1.parseGlob(pattern || this.pattern, true);
- return this.tokens;
- };
- /**
- * Replace `a` with `b`. Also tracks the change before and
- * after each replacement. This is disabled by default, but
- * can be enabled by setting `options.track` to true.
- *
- * Also, when the pattern is a string, `.split()` is used,
- * because it's much faster than replace.
- *
- * @param {RegExp|String} `a`
- * @param {String} `b`
- * @param {Boolean} `escape` When `true`, escapes `*` and `?` in the replacement.
- * @return {String}
- */
- Glob.prototype._replace = function(a, b, escape) {
- this.track('before (find): "' + a + '" (replace with): "' + b + '"');
- if (escape) b = esc(b);
- if (a && b && typeof a === 'string') {
- this.pattern = this.pattern.split(a).join(b);
- } else {
- this.pattern = this.pattern.replace(a, b);
- }
- this.track('after');
- };
- /**
- * Escape special characters in the given string.
- *
- * @param {String} `str` Glob pattern
- * @return {String}
- */
- Glob.prototype.escape = function(str) {
- this.track('before escape: ');
- var re = /["\\](['"]?[^"'\\]['"]?)/g;
- this.pattern = str.replace(re, function($0, $1) {
- var o = chars_1.ESC;
- var ch = o && o[$1];
- if (ch) {
- return ch;
- }
- if (/[a-z]/i.test($0)) {
- return $0.split('\\').join('');
- }
- return $0;
- });
- this.track('after escape: ');
- };
- /**
- * Unescape special characters in the given string.
- *
- * @param {String} `str`
- * @return {String}
- */
- Glob.prototype.unescape = function(str) {
- var re = /__([A-Z]+)_([A-Z]+)__/g;
- this.pattern = str.replace(re, function($0, $1) {
- return chars_1[$1][$0];
- });
- this.pattern = unesc(this.pattern);
- };
- /**
- * Escape/unescape utils
- */
- function esc(str) {
- str = str.split('?').join('%~');
- str = str.split('*').join('%%');
- return str;
- }
- function unesc(str) {
- str = str.split('%~').join('?');
- str = str.split('%%').join('*');
- return str;
- }
- });
- /**
- * Expose `expand`
- */
- var expand_1 = expand;
- /**
- * Expand a glob pattern to resolve braces and
- * similar patterns before converting to regex.
- *
- * @param {String|Array} `pattern`
- * @param {Array} `files`
- * @param {Options} `opts`
- * @return {Array}
- */
- function expand(pattern, options) {
- if (typeof pattern !== 'string') {
- throw new TypeError('micromatch.expand(): argument should be a string.');
- }
- var glob$$1 = new glob(pattern, options || {});
- var opts = glob$$1.options;
- if (!utils_1.isGlob(pattern)) {
- glob$$1.pattern = glob$$1.pattern.replace(/([\/.])/g, '\\$1');
- return glob$$1;
- }
- glob$$1.pattern = glob$$1.pattern.replace(/(\+)(?!\()/g, '\\$1');
- glob$$1.pattern = glob$$1.pattern.split('$').join('\\$');
- if (typeof opts.braces !== 'boolean' && typeof opts.nobraces !== 'boolean') {
- opts.braces = true;
- }
- if (glob$$1.pattern === '.*') {
- return {
- pattern: '\\.' + star,
- tokens: tok,
- options: opts
- };
- }
- if (glob$$1.pattern === '*') {
- return {
- pattern: oneStar(opts.dot),
- tokens: tok,
- options: opts
- };
- }
- // parse the glob pattern into tokens
- glob$$1.parse();
- var tok = glob$$1.tokens;
- tok.is.negated = opts.negated;
- // dotfile handling
- if ((opts.dotfiles === true || tok.is.dotfile) && opts.dot !== false) {
- opts.dotfiles = true;
- opts.dot = true;
- }
- if ((opts.dotdirs === true || tok.is.dotdir) && opts.dot !== false) {
- opts.dotdirs = true;
- opts.dot = true;
- }
- // check for braces with a dotfile pattern
- if (/[{,]\./.test(glob$$1.pattern)) {
- opts.makeRe = false;
- opts.dot = true;
- }
- if (opts.nonegate !== true) {
- opts.negated = glob$$1.negated;
- }
- // if the leading character is a dot or a slash, escape it
- if (glob$$1.pattern.charAt(0) === '.' && glob$$1.pattern.charAt(1) !== '/') {
- glob$$1.pattern = '\\' + glob$$1.pattern;
- }
- /**
- * Extended globs
- */
- // expand braces, e.g `{1..5}`
- glob$$1.track('before braces');
- if (tok.is.braces) {
- glob$$1.braces();
- }
- glob$$1.track('after braces');
- // expand extglobs, e.g `foo/!(a|b)`
- glob$$1.track('before extglob');
- if (tok.is.extglob) {
- glob$$1.extglob();
- }
- glob$$1.track('after extglob');
- // expand brackets, e.g `[[:alpha:]]`
- glob$$1.track('before brackets');
- if (tok.is.brackets) {
- glob$$1.brackets();
- }
- glob$$1.track('after brackets');
- // special patterns
- glob$$1._replace('[!', '[^');
- glob$$1._replace('(?', '(%~');
- glob$$1._replace(/\[\]/, '\\[\\]');
- glob$$1._replace('/[', '/' + (opts.dot ? dotfiles : nodot) + '[', true);
- glob$$1._replace('/?', '/' + (opts.dot ? dotfiles : nodot) + '[^/]', true);
- glob$$1._replace('/.', '/(?=.)\\.', true);
- // windows drives
- glob$$1._replace(/^(\w):([\\\/]+?)/gi, '(?=.)$1:$2', true);
- // negate slashes in exclusion ranges
- if (glob$$1.pattern.indexOf('[^') !== -1) {
- glob$$1.pattern = negateSlash(glob$$1.pattern);
- }
- if (opts.globstar !== false && glob$$1.pattern === '**') {
- glob$$1.pattern = globstar(opts.dot);
- } else {
- glob$$1.pattern = balance(glob$$1.pattern, '[', ']');
- glob$$1.escape(glob$$1.pattern);
- // if the pattern has `**`
- if (tok.is.globstar) {
- glob$$1.pattern = collapse(glob$$1.pattern, '/**');
- glob$$1.pattern = collapse(glob$$1.pattern, '**/');
- glob$$1._replace('/**/', '(?:/' + globstar(opts.dot) + '/|/)', true);
- glob$$1._replace(/\*{2,}/g, '**');
- // 'foo/*'
- glob$$1._replace(/(\w+)\*(?!\/)/g, '$1[^/]*?', true);
- glob$$1._replace(/\*\*\/\*(\w)/g, globstar(opts.dot) + '\\/' + (opts.dot ? dotfiles : nodot) + '[^/]*?$1', true);
- if (opts.dot !== true) {
- glob$$1._replace(/\*\*\/(.)/g, '(?:**\\/|)$1');
- }
- // 'foo/**' or '{**,*}', but not 'foo**'
- if (tok.path.dirname !== '' || /,\*\*|\*\*,/.test(glob$$1.orig)) {
- glob$$1._replace('**', globstar(opts.dot), true);
- }
- }
- // ends with /*
- glob$$1._replace(/\/\*$/, '\\/' + oneStar(opts.dot), true);
- // ends with *, no slashes
- glob$$1._replace(/(?!\/)\*$/, star, true);
- // has 'n*.' (partial wildcard w/ file extension)
- glob$$1._replace(/([^\/]+)\*/, '$1' + oneStar(true), true);
- // has '*'
- glob$$1._replace('*', oneStar(opts.dot), true);
- glob$$1._replace('?.', '?\\.', true);
- glob$$1._replace('?:', '?:', true);
- glob$$1._replace(/\?+/g, function(match) {
- var len = match.length;
- if (len === 1) {
- return qmark;
- }
- return qmark + '{' + len + '}';
- });
- // escape '.abc' => '\\.abc'
- glob$$1._replace(/\.([*\w]+)/g, '\\.$1');
- // fix '[^\\\\/]'
- glob$$1._replace(/\[\^[\\\/]+\]/g, qmark);
- // '///' => '\/'
- glob$$1._replace(/\/+/g, '\\/');
- // '\\\\\\' => '\\'
- glob$$1._replace(/\\{2,}/g, '\\');
- }
- // unescape previously escaped patterns
- glob$$1.unescape(glob$$1.pattern);
- glob$$1._replace('__UNESC_STAR__', '*');
- // escape dots that follow qmarks
- glob$$1._replace('?.', '?\\.');
- // remove unnecessary slashes in character classes
- glob$$1._replace('[^\\/]', qmark);
- if (glob$$1.pattern.length > 1) {
- if (/^[\[?*]/.test(glob$$1.pattern)) {
- // only prepend the string if we don't want to match dotfiles
- glob$$1.pattern = (opts.dot ? dotfiles : nodot) + glob$$1.pattern;
- }
- }
- return glob$$1;
- }
- /**
- * Collapse repeated character sequences.
- *
- * ```js
- * collapse('a/../../../b', '../');
- * //=> 'a/../b'
- * ```
- *
- * @param {String} `str`
- * @param {String} `ch` Character sequence to collapse
- * @return {String}
- */
- function collapse(str, ch) {
- var res = str.split(ch);
- var isFirst = res[0] === '';
- var isLast = res[res.length - 1] === '';
- res = res.filter(Boolean);
- if (isFirst) res.unshift('');
- if (isLast) res.push('');
- return res.join(ch);
- }
- /**
- * Negate slashes in exclusion ranges, per glob spec:
- *
- * ```js
- * negateSlash('[^foo]');
- * //=> '[^\\/foo]'
- * ```
- *
- * @param {String} `str` glob pattern
- * @return {String}
- */
- function negateSlash(str) {
- return str.replace(/\[\^([^\]]*?)\]/g, function(match, inner) {
- if (inner.indexOf('/') === -1) {
- inner = '\\/' + inner;
- }
- return '[^' + inner + ']';
- });
- }
- /**
- * Escape imbalanced braces/bracket. This is a very
- * basic, naive implementation that only does enough
- * to serve the purpose.
- */
- function balance(str, a, b) {
- var aarr = str.split(a);
- var alen = aarr.join('').length;
- var blen = str.split(b).join('').length;
- if (alen !== blen) {
- str = aarr.join('\\' + a);
- return str.split(b).join('\\' + b);
- }
- return str;
- }
- /**
- * Special patterns to be converted to regex.
- * Heuristics are used to simplify patterns
- * and speed up processing.
- */
- /* eslint no-multi-spaces: 0 */
- var qmark = '[^/]';
- var star = qmark + '*?';
- var nodot = '(?!\\.)(?=.)';
- var dotfileGlob = '(?:\\/|^)\\.{1,2}($|\\/)';
- var dotfiles = '(?!' + dotfileGlob + ')(?=.)';
- var twoStarDot = '(?:(?!' + dotfileGlob + ').)*?';
- /**
- * Create a regex for `*`.
- *
- * If `dot` is true, or the pattern does not begin with
- * a leading star, then return the simpler regex.
- */
- function oneStar(dotfile) {
- return dotfile ? '(?!' + dotfileGlob + ')(?=.)' + star : (nodot + star);
- }
- function globstar(dotfile) {
- if (dotfile) { return twoStarDot; }
- return '(?:(?!(?:\\/|^)\\.).)*?';
- }
- /**
- * The main function. Pass an array of filepaths,
- * and a string or array of glob patterns
- *
- * @param {Array|String} `files`
- * @param {Array|String} `patterns`
- * @param {Object} `opts`
- * @return {Array} Array of matches
- */
- function micromatch(files, patterns, opts) {
- if (!files || !patterns) return [];
- opts = opts || {};
- if (typeof opts.cache === 'undefined') {
- opts.cache = true;
- }
- if (!Array.isArray(patterns)) {
- return match(files, patterns, opts);
- }
- var len = patterns.length, i = 0;
- var omit = [], keep = [];
- while (len--) {
- var glob = patterns[i++];
- if (typeof glob === 'string' && glob.charCodeAt(0) === 33 /* ! */) {
- omit.push.apply(omit, match(files, glob.slice(1), opts));
- } else {
- keep.push.apply(keep, match(files, glob, opts));
- }
- }
- return utils_1.diff(keep, omit);
- }
- /**
- * Return an array of files that match the given glob pattern.
- *
- * This function is called by the main `micromatch` function If you only
- * need to pass a single pattern you might get very minor speed improvements
- * using this function.
- *
- * @param {Array} `files`
- * @param {String} `pattern`
- * @param {Object} `options`
- * @return {Array}
- */
- function match(files, pattern, opts) {
- if (utils_1.typeOf(files) !== 'string' && !Array.isArray(files)) {
- throw new Error(msg('match', 'files', 'a string or array'));
- }
- files = utils_1.arrayify(files);
- opts = opts || {};
- var negate = opts.negate || false;
- var orig = pattern;
- if (typeof pattern === 'string') {
- negate = pattern.charAt(0) === '!';
- if (negate) {
- pattern = pattern.slice(1);
- }
- // we need to remove the character regardless,
- // so the above logic is still needed
- if (opts.nonegate === true) {
- negate = false;
- }
- }
- var _isMatch = matcher(pattern, opts);
- var len = files.length, i = 0;
- var res = [];
- while (i < len) {
- var file = files[i++];
- var fp = utils_1.unixify(file, opts);
- if (!_isMatch(fp)) { continue; }
- res.push(fp);
- }
- if (res.length === 0) {
- if (opts.failglob === true) {
- throw new Error('micromatch.match() found no matches for: "' + orig + '".');
- }
- if (opts.nonull || opts.nullglob) {
- res.push(utils_1.unescapeGlob(orig));
- }
- }
- // if `negate` was defined, diff negated files
- if (negate) { res = utils_1.diff(files, res); }
- // if `ignore` was defined, diff ignored filed
- if (opts.ignore && opts.ignore.length) {
- pattern = opts.ignore;
- opts = utils_1.omit(opts, ['ignore']);
- res = utils_1.diff(res, micromatch(res, pattern, opts));
- }
- if (opts.nodupes) {
- return utils_1.unique(res);
- }
- return res;
- }
- /**
- * Returns a function that takes a glob pattern or array of glob patterns
- * to be used with `Array#filter()`. (Internally this function generates
- * the matching function using the [matcher] method).
- *
- * ```js
- * var fn = mm.filter('[a-c]');
- * ['a', 'b', 'c', 'd', 'e'].filter(fn);
- * //=> ['a', 'b', 'c']
- * ```
- * @param {String|Array} `patterns` Can be a glob or array of globs.
- * @param {Options} `opts` Options to pass to the [matcher] method.
- * @return {Function} Filter function to be passed to `Array#filter()`.
- */
- function filter$2(patterns, opts) {
- if (!Array.isArray(patterns) && typeof patterns !== 'string') {
- throw new TypeError(msg('filter', 'patterns', 'a string or array'));
- }
- patterns = utils_1.arrayify(patterns);
- var len = patterns.length, i = 0;
- var patternMatchers = Array(len);
- while (i < len) {
- patternMatchers[i] = matcher(patterns[i++], opts);
- }
- return function(fp) {
- if (fp == null) return [];
- var len = patternMatchers.length, i = 0;
- var res = true;
- fp = utils_1.unixify(fp, opts);
- while (i < len) {
- var fn = patternMatchers[i++];
- if (!fn(fp)) {
- res = false;
- break;
- }
- }
- return res;
- };
- }
- /**
- * Returns true if the filepath contains the given
- * pattern. Can also return a function for matching.
- *
- * ```js
- * isMatch('foo.md', '*.md', {});
- * //=> true
- *
- * isMatch('*.md', {})('foo.md')
- * //=> true
- * ```
- * @param {String} `fp`
- * @param {String} `pattern`
- * @param {Object} `opts`
- * @return {Boolean}
- */
- function isMatch(fp, pattern, opts) {
- if (typeof fp !== 'string') {
- throw new TypeError(msg('isMatch', 'filepath', 'a string'));
- }
- fp = utils_1.unixify(fp, opts);
- if (utils_1.typeOf(pattern) === 'object') {
- return matcher(fp, pattern);
- }
- return matcher(pattern, opts)(fp);
- }
- /**
- * Returns true if the filepath matches the
- * given pattern.
- */
- function contains(fp, pattern, opts) {
- if (typeof fp !== 'string') {
- throw new TypeError(msg('contains', 'pattern', 'a string'));
- }
- opts = opts || {};
- opts.contains = (pattern !== '');
- fp = utils_1.unixify(fp, opts);
- if (opts.contains && !utils_1.isGlob(pattern)) {
- return fp.indexOf(pattern) !== -1;
- }
- return matcher(pattern, opts)(fp);
- }
- /**
- * Returns true if a file path matches any of the
- * given patterns.
- *
- * @param {String} `fp` The filepath to test.
- * @param {String|Array} `patterns` Glob patterns to use.
- * @param {Object} `opts` Options to pass to the `matcher()` function.
- * @return {String}
- */
- function any(fp, patterns, opts) {
- if (!Array.isArray(patterns) && typeof patterns !== 'string') {
- throw new TypeError(msg('any', 'patterns', 'a string or array'));
- }
- patterns = utils_1.arrayify(patterns);
- var len = patterns.length;
- fp = utils_1.unixify(fp, opts);
- while (len--) {
- var isMatch = matcher(patterns[len], opts);
- if (isMatch(fp)) {
- return true;
- }
- }
- return false;
- }
- /**
- * Filter the keys of an object with the given `glob` pattern
- * and `options`
- *
- * @param {Object} `object`
- * @param {Pattern} `object`
- * @return {Array}
- */
- function matchKeys(obj, glob, options) {
- if (utils_1.typeOf(obj) !== 'object') {
- throw new TypeError(msg('matchKeys', 'first argument', 'an object'));
- }
- var fn = matcher(glob, options);
- var res = {};
- for (var key in obj) {
- if (obj.hasOwnProperty(key) && fn(key)) {
- res[key] = obj[key];
- }
- }
- return res;
- }
- /**
- * Return a function for matching based on the
- * given `pattern` and `options`.
- *
- * @param {String} `pattern`
- * @param {Object} `options`
- * @return {Function}
- */
- function matcher(pattern, opts) {
- // pattern is a function
- if (typeof pattern === 'function') {
- return pattern;
- }
- // pattern is a regex
- if (pattern instanceof RegExp) {
- return function(fp) {
- return pattern.test(fp);
- };
- }
- if (typeof pattern !== 'string') {
- throw new TypeError(msg('matcher', 'pattern', 'a string, regex, or function'));
- }
- // strings, all the way down...
- pattern = utils_1.unixify(pattern, opts);
- // pattern is a non-glob string
- if (!utils_1.isGlob(pattern)) {
- return utils_1.matchPath(pattern, opts);
- }
- // pattern is a glob string
- var re = makeRe(pattern, opts);
- // `matchBase` is defined
- if (opts && opts.matchBase) {
- return utils_1.hasFilename(re, opts);
- }
- // `matchBase` is not defined
- return function(fp) {
- fp = utils_1.unixify(fp, opts);
- return re.test(fp);
- };
- }
- /**
- * Create and cache a regular expression for matching
- * file paths.
- *
- * If the leading character in the `glob` is `!`, a negation
- * regex is returned.
- *
- * @param {String} `glob`
- * @param {Object} `options`
- * @return {RegExp}
- */
- function toRegex$1(glob, options) {
- // clone options to prevent mutating the original object
- var opts = Object.create(options || {});
- var flags = opts.flags || '';
- if (opts.nocase && flags.indexOf('i') === -1) {
- flags += 'i';
- }
- var parsed = expand_1(glob, opts);
- // pass in tokens to avoid parsing more than once
- opts.negated = opts.negated || parsed.negated;
- opts.negate = opts.negated;
- glob = wrapGlob(parsed.pattern, opts);
- var re;
- try {
- re = new RegExp(glob, flags);
- return re;
- } catch (err) {
- err.reason = 'micromatch invalid regex: (' + re + ')';
- if (opts.strict) throw new SyntaxError(err);
- }
- // we're only here if a bad pattern was used and the user
- // passed `options.silent`, so match nothing
- return /$^/;
- }
- /**
- * Create the regex to do the matching. If the leading
- * character in the `glob` is `!` a negation regex is returned.
- *
- * @param {String} `glob`
- * @param {Boolean} `negate`
- */
- function wrapGlob(glob, opts) {
- var prefix = (opts && !opts.contains) ? '^' : '';
- var after = (opts && !opts.contains) ? '$' : '';
- glob = ('(?:' + glob + ')' + after);
- if (opts && opts.negate) {
- return prefix + ('(?!^' + glob + ').*$');
- }
- return prefix + glob;
- }
- /**
- * Create and cache a regular expression for matching file paths.
- * If the leading character in the `glob` is `!`, a negation
- * regex is returned.
- *
- * @param {String} `glob`
- * @param {Object} `options`
- * @return {RegExp}
- */
- function makeRe(glob, opts) {
- if (utils_1.typeOf(glob) !== 'string') {
- throw new Error(msg('makeRe', 'glob', 'a string'));
- }
- return utils_1.cache(toRegex$1, glob, opts);
- }
- /**
- * Make error messages consistent. Follows this format:
- *
- * ```js
- * msg(methodName, argNumber, nativeType);
- * // example:
- * msg('matchKeys', 'first', 'an object');
- * ```
- *
- * @param {String} `method`
- * @param {String} `num`
- * @param {String} `type`
- * @return {String}
- */
- function msg(method, what, type) {
- return 'micromatch.' + method + '(): ' + what + ' should be ' + type + '.';
- }
- /**
- * Public methods
- */
- /* eslint no-multi-spaces: 0 */
- micromatch.any = any;
- micromatch.braces = micromatch.braceExpand = utils_1.braces;
- micromatch.contains = contains;
- micromatch.expand = expand_1;
- micromatch.filter = filter$2;
- micromatch.isMatch = isMatch;
- micromatch.makeRe = makeRe;
- micromatch.match = match;
- micromatch.matcher = matcher;
- micromatch.matchKeys = matchKeys;
- /**
- * Expose `micromatch`
- */
- var micromatch_1 = micromatch;
- var slash = function (str) {
- var isExtendedLengthPath = /^\\\\\?\\/.test(str);
- var hasNonAscii = /[^\x00-\x80]+/.test(str);
- if (isExtendedLengthPath || hasNonAscii) {
- return str;
- }
- return str.replace(/\\/g, '/');
- };
- var jsTokens = createCommonjsModule(function (module, exports) {
- // Copyright 2014, 2015, 2016, 2017 Simon Lydell
- // License: MIT. (See LICENSE.)
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- // This regex comes from regex.coffee, and is inserted here by generate-index.js
- // (run `npm run build`).
- exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyu]{1,5}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;
- exports.matchToToken = function(match) {
- var token = {type: "invalid", value: match[0]};
- if (match[ 1]) token.type = "string", token.closed = !!(match[3] || match[4]);
- else if (match[ 5]) token.type = "comment";
- else if (match[ 6]) token.type = "comment", token.closed = !!match[7];
- else if (match[ 8]) token.type = "regex";
- else if (match[ 9]) token.type = "number";
- else if (match[10]) token.type = "name";
- else if (match[11]) token.type = "punctuator";
- else if (match[12]) token.type = "whitespace";
- return token
- };
- });
- unwrapExports(jsTokens);
- var jsTokens_1 = jsTokens.matchToToken;
- var ast = createCommonjsModule(function (module) {
- /*
- Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- (function () {
- function isExpression(node) {
- if (node == null) { return false; }
- switch (node.type) {
- case 'ArrayExpression':
- case 'AssignmentExpression':
- case 'BinaryExpression':
- case 'CallExpression':
- case 'ConditionalExpression':
- case 'FunctionExpression':
- case 'Identifier':
- case 'Literal':
- case 'LogicalExpression':
- case 'MemberExpression':
- case 'NewExpression':
- case 'ObjectExpression':
- case 'SequenceExpression':
- case 'ThisExpression':
- case 'UnaryExpression':
- case 'UpdateExpression':
- return true;
- }
- return false;
- }
- function isIterationStatement(node) {
- if (node == null) { return false; }
- switch (node.type) {
- case 'DoWhileStatement':
- case 'ForInStatement':
- case 'ForStatement':
- case 'WhileStatement':
- return true;
- }
- return false;
- }
- function isStatement(node) {
- if (node == null) { return false; }
- switch (node.type) {
- case 'BlockStatement':
- case 'BreakStatement':
- case 'ContinueStatement':
- case 'DebuggerStatement':
- case 'DoWhileStatement':
- case 'EmptyStatement':
- case 'ExpressionStatement':
- case 'ForInStatement':
- case 'ForStatement':
- case 'IfStatement':
- case 'LabeledStatement':
- case 'ReturnStatement':
- case 'SwitchStatement':
- case 'ThrowStatement':
- case 'TryStatement':
- case 'VariableDeclaration':
- case 'WhileStatement':
- case 'WithStatement':
- return true;
- }
- return false;
- }
- function isSourceElement(node) {
- return isStatement(node) || node != null && node.type === 'FunctionDeclaration';
- }
- function trailingStatement(node) {
- switch (node.type) {
- case 'IfStatement':
- if (node.alternate != null) {
- return node.alternate;
- }
- return node.consequent;
- case 'LabeledStatement':
- case 'ForStatement':
- case 'ForInStatement':
- case 'WhileStatement':
- case 'WithStatement':
- return node.body;
- }
- return null;
- }
- function isProblematicIfStatement(node) {
- var current;
- if (node.type !== 'IfStatement') {
- return false;
- }
- if (node.alternate == null) {
- return false;
- }
- current = node.consequent;
- do {
- if (current.type === 'IfStatement') {
- if (current.alternate == null) {
- return true;
- }
- }
- current = trailingStatement(current);
- } while (current);
- return false;
- }
- module.exports = {
- isExpression: isExpression,
- isStatement: isStatement,
- isIterationStatement: isIterationStatement,
- isSourceElement: isSourceElement,
- isProblematicIfStatement: isProblematicIfStatement,
- trailingStatement: trailingStatement
- };
- }());
- /* vim: set sw=4 ts=4 et tw=80 : */
- });
- var ast_1 = ast.isExpression;
- var ast_2 = ast.isStatement;
- var ast_3 = ast.isIterationStatement;
- var ast_4 = ast.isSourceElement;
- var ast_5 = ast.isProblematicIfStatement;
- var ast_6 = ast.trailingStatement;
- var code = createCommonjsModule(function (module) {
- /*
- Copyright (C) 2013-2014 Yusuke Suzuki <utatane.tea@gmail.com>
- Copyright (C) 2014 Ivan Nikulin <ifaaan@gmail.com>
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- (function () {
- var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch;
- // See `tools/generate-identifier-regex.js`.
- ES5Regex = {
- // ECMAScript 5.1/Unicode v7.0.0 NonAsciiIdentifierStart:
- NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
- // ECMAScript 5.1/Unicode v7.0.0 NonAsciiIdentifierPart:
- NonAsciiIdentifierPart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/
- };
- ES6Regex = {
- // ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierStart:
- NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDE00-\uDE11\uDE13-\uDE2B\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDE00-\uDE2F\uDE44\uDE80-\uDEAA]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]/,
- // ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierPart:
- NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDD0-\uDDDA\uDE00-\uDE11\uDE13-\uDE37\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF01-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/
- };
- function isDecimalDigit(ch) {
- return 0x30 <= ch && ch <= 0x39; // 0..9
- }
- function isHexDigit(ch) {
- return 0x30 <= ch && ch <= 0x39 || // 0..9
- 0x61 <= ch && ch <= 0x66 || // a..f
- 0x41 <= ch && ch <= 0x46; // A..F
- }
- function isOctalDigit(ch) {
- return ch >= 0x30 && ch <= 0x37; // 0..7
- }
- // 7.2 White Space
- NON_ASCII_WHITESPACES = [
- 0x1680, 0x180E,
- 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A,
- 0x202F, 0x205F,
- 0x3000,
- 0xFEFF
- ];
- function isWhiteSpace(ch) {
- return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 ||
- ch >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(ch) >= 0;
- }
- // 7.3 Line Terminators
- function isLineTerminator(ch) {
- return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029;
- }
- // 7.6 Identifier Names and Identifiers
- function fromCodePoint(cp) {
- if (cp <= 0xFFFF) { return String.fromCharCode(cp); }
- var cu1 = String.fromCharCode(Math.floor((cp - 0x10000) / 0x400) + 0xD800);
- var cu2 = String.fromCharCode(((cp - 0x10000) % 0x400) + 0xDC00);
- return cu1 + cu2;
- }
- IDENTIFIER_START = new Array(0x80);
- for(ch = 0; ch < 0x80; ++ch) {
- IDENTIFIER_START[ch] =
- ch >= 0x61 && ch <= 0x7A || // a..z
- ch >= 0x41 && ch <= 0x5A || // A..Z
- ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore)
- }
- IDENTIFIER_PART = new Array(0x80);
- for(ch = 0; ch < 0x80; ++ch) {
- IDENTIFIER_PART[ch] =
- ch >= 0x61 && ch <= 0x7A || // a..z
- ch >= 0x41 && ch <= 0x5A || // A..Z
- ch >= 0x30 && ch <= 0x39 || // 0..9
- ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore)
- }
- function isIdentifierStartES5(ch) {
- return ch < 0x80 ? IDENTIFIER_START[ch] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
- }
- function isIdentifierPartES5(ch) {
- return ch < 0x80 ? IDENTIFIER_PART[ch] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
- }
- function isIdentifierStartES6(ch) {
- return ch < 0x80 ? IDENTIFIER_START[ch] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
- }
- function isIdentifierPartES6(ch) {
- return ch < 0x80 ? IDENTIFIER_PART[ch] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
- }
- module.exports = {
- isDecimalDigit: isDecimalDigit,
- isHexDigit: isHexDigit,
- isOctalDigit: isOctalDigit,
- isWhiteSpace: isWhiteSpace,
- isLineTerminator: isLineTerminator,
- isIdentifierStartES5: isIdentifierStartES5,
- isIdentifierPartES5: isIdentifierPartES5,
- isIdentifierStartES6: isIdentifierStartES6,
- isIdentifierPartES6: isIdentifierPartES6
- };
- }());
- /* vim: set sw=4 ts=4 et tw=80 : */
- });
- var code_1 = code.isDecimalDigit;
- var code_2 = code.isHexDigit;
- var code_3 = code.isOctalDigit;
- var code_4 = code.isWhiteSpace;
- var code_5 = code.isLineTerminator;
- var code_6 = code.isIdentifierStartES5;
- var code_7 = code.isIdentifierPartES5;
- var code_8 = code.isIdentifierStartES6;
- var code_9 = code.isIdentifierPartES6;
- var keyword = createCommonjsModule(function (module) {
- /*
- Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- (function () {
- var code$$1 = code;
- function isStrictModeReservedWordES6(id) {
- switch (id) {
- case 'implements':
- case 'interface':
- case 'package':
- case 'private':
- case 'protected':
- case 'public':
- case 'static':
- case 'let':
- return true;
- default:
- return false;
- }
- }
- function isKeywordES5(id, strict) {
- // yield should not be treated as keyword under non-strict mode.
- if (!strict && id === 'yield') {
- return false;
- }
- return isKeywordES6(id, strict);
- }
- function isKeywordES6(id, strict) {
- if (strict && isStrictModeReservedWordES6(id)) {
- return true;
- }
- switch (id.length) {
- case 2:
- return (id === 'if') || (id === 'in') || (id === 'do');
- case 3:
- return (id === 'var') || (id === 'for') || (id === 'new') || (id === 'try');
- case 4:
- return (id === 'this') || (id === 'else') || (id === 'case') ||
- (id === 'void') || (id === 'with') || (id === 'enum');
- case 5:
- return (id === 'while') || (id === 'break') || (id === 'catch') ||
- (id === 'throw') || (id === 'const') || (id === 'yield') ||
- (id === 'class') || (id === 'super');
- case 6:
- return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
- (id === 'switch') || (id === 'export') || (id === 'import');
- case 7:
- return (id === 'default') || (id === 'finally') || (id === 'extends');
- case 8:
- return (id === 'function') || (id === 'continue') || (id === 'debugger');
- case 10:
- return (id === 'instanceof');
- default:
- return false;
- }
- }
- function isReservedWordES5(id, strict) {
- return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict);
- }
- function isReservedWordES6(id, strict) {
- return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict);
- }
- function isRestrictedWord(id) {
- return id === 'eval' || id === 'arguments';
- }
- function isIdentifierNameES5(id) {
- var i, iz, ch;
- if (id.length === 0) { return false; }
- ch = id.charCodeAt(0);
- if (!code$$1.isIdentifierStartES5(ch)) {
- return false;
- }
- for (i = 1, iz = id.length; i < iz; ++i) {
- ch = id.charCodeAt(i);
- if (!code$$1.isIdentifierPartES5(ch)) {
- return false;
- }
- }
- return true;
- }
- function decodeUtf16(lead, trail) {
- return (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
- }
- function isIdentifierNameES6(id) {
- var i, iz, ch, lowCh, check;
- if (id.length === 0) { return false; }
- check = code$$1.isIdentifierStartES6;
- for (i = 0, iz = id.length; i < iz; ++i) {
- ch = id.charCodeAt(i);
- if (0xD800 <= ch && ch <= 0xDBFF) {
- ++i;
- if (i >= iz) { return false; }
- lowCh = id.charCodeAt(i);
- if (!(0xDC00 <= lowCh && lowCh <= 0xDFFF)) {
- return false;
- }
- ch = decodeUtf16(ch, lowCh);
- }
- if (!check(ch)) {
- return false;
- }
- check = code$$1.isIdentifierPartES6;
- }
- return true;
- }
- function isIdentifierES5(id, strict) {
- return isIdentifierNameES5(id) && !isReservedWordES5(id, strict);
- }
- function isIdentifierES6(id, strict) {
- return isIdentifierNameES6(id) && !isReservedWordES6(id, strict);
- }
- module.exports = {
- isKeywordES5: isKeywordES5,
- isKeywordES6: isKeywordES6,
- isReservedWordES5: isReservedWordES5,
- isReservedWordES6: isReservedWordES6,
- isRestrictedWord: isRestrictedWord,
- isIdentifierNameES5: isIdentifierNameES5,
- isIdentifierNameES6: isIdentifierNameES6,
- isIdentifierES5: isIdentifierES5,
- isIdentifierES6: isIdentifierES6
- };
- }());
- /* vim: set sw=4 ts=4 et tw=80 : */
- });
- var keyword_1 = keyword.isKeywordES5;
- var keyword_2 = keyword.isKeywordES6;
- var keyword_3 = keyword.isReservedWordES5;
- var keyword_4 = keyword.isReservedWordES6;
- var keyword_5 = keyword.isRestrictedWord;
- var keyword_6 = keyword.isIdentifierNameES5;
- var keyword_7 = keyword.isIdentifierNameES6;
- var keyword_8 = keyword.isIdentifierES5;
- var keyword_9 = keyword.isIdentifierES6;
- var utils = createCommonjsModule(function (module, exports) {
- /*
- Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- (function () {
- exports.ast = ast;
- exports.code = code;
- exports.keyword = keyword;
- }());
- /* vim: set sw=4 ts=4 et tw=80 : */
- });
- var utils_1$1 = utils.ast;
- var utils_2 = utils.code;
- var utils_3 = utils.keyword;
- var lib$1 = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.shouldHighlight = shouldHighlight;
- exports.getChalk = getChalk;
- exports.default = highlight;
- function _jsTokens() {
- var data = _interopRequireWildcard(jsTokens);
- _jsTokens = function _jsTokens() {
- return data;
- };
- return data;
- }
- function _esutils() {
- var data = _interopRequireDefault(utils);
- _esutils = function _esutils() {
- return data;
- };
- return data;
- }
- function _chalk() {
- var data = _interopRequireDefault(fake_chalk);
- _chalk = function _chalk() {
- return data;
- };
- return data;
- }
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
- function getDefs(chalk) {
- return {
- keyword: chalk.cyan,
- capitalized: chalk.yellow,
- jsx_tag: chalk.yellow,
- punctuator: chalk.yellow,
- number: chalk.magenta,
- string: chalk.green,
- regex: chalk.magenta,
- comment: chalk.grey,
- invalid: chalk.white.bgRed.bold
- };
- }
- var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
- var JSX_TAG = /^[a-z][\w-]*$/i;
- var BRACKET = /^[()[\]{}]$/;
- function getTokenType(match) {
- var _match$slice = match.slice(-2),
- offset = _match$slice[0],
- text = _match$slice[1];
- var token = (0, _jsTokens().matchToToken)(match);
- if (token.type === "name") {
- if (_esutils().default.keyword.isReservedWordES6(token.value)) {
- return "keyword";
- }
- if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
- return "jsx_tag";
- }
- if (token.value[0] !== token.value[0].toLowerCase()) {
- return "capitalized";
- }
- }
- if (token.type === "punctuator" && BRACKET.test(token.value)) {
- return "bracket";
- }
- if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
- return "punctuator";
- }
- return token.type;
- }
- function highlightTokens(defs, text) {
- return text.replace(_jsTokens().default, function () {
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- var type = getTokenType(args);
- var colorize = defs[type];
- if (colorize) {
- return args[0].split(NEWLINE).map(function (str) {
- return colorize(str);
- }).join("\n");
- } else {
- return args[0];
- }
- });
- }
- function shouldHighlight(options) {
- return _chalk().default.supportsColor || options.forceColor;
- }
- function getChalk(options) {
- var chalk = _chalk().default;
- if (options.forceColor) {
- chalk = new (_chalk().default.constructor)({
- enabled: true,
- level: 1
- });
- }
- return chalk;
- }
- function highlight(code, options) {
- if (options === void 0) {
- options = {};
- }
- if (shouldHighlight(options)) {
- var chalk = getChalk(options);
- var defs = getDefs(chalk);
- return highlightTokens(defs, code);
- } else {
- return code;
- }
- }
- });
- unwrapExports(lib$1);
- var lib_1$1 = lib$1.shouldHighlight;
- var lib_2$1 = lib$1.getChalk;
- var lib$2 = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.codeFrameColumns = codeFrameColumns;
- exports.default = _default;
- function _highlight() {
- var data = _interopRequireWildcard(lib$1);
- _highlight = function _highlight() {
- return data;
- };
- return data;
- }
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
- var deprecationWarningShown = false;
- function getDefs(chalk) {
- return {
- gutter: chalk.grey,
- marker: chalk.red.bold,
- message: chalk.red.bold
- };
- }
- var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
- function getMarkerLines(loc, source, opts) {
- var startLoc = Object.assign({}, {
- column: 0,
- line: -1
- }, loc.start);
- var endLoc = Object.assign({}, startLoc, loc.end);
- var _ref = opts || {},
- _ref$linesAbove = _ref.linesAbove,
- linesAbove = _ref$linesAbove === void 0 ? 2 : _ref$linesAbove,
- _ref$linesBelow = _ref.linesBelow,
- linesBelow = _ref$linesBelow === void 0 ? 3 : _ref$linesBelow;
- var startLine = startLoc.line;
- var startColumn = startLoc.column;
- var endLine = endLoc.line;
- var endColumn = endLoc.column;
- var start = Math.max(startLine - (linesAbove + 1), 0);
- var end = Math.min(source.length, endLine + linesBelow);
- if (startLine === -1) {
- start = 0;
- }
- if (endLine === -1) {
- end = source.length;
- }
- var lineDiff = endLine - startLine;
- var markerLines = {};
- if (lineDiff) {
- for (var i = 0; i <= lineDiff; i++) {
- var lineNumber = i + startLine;
- if (!startColumn) {
- markerLines[lineNumber] = true;
- } else if (i === 0) {
- var sourceLength = source[lineNumber - 1].length;
- markerLines[lineNumber] = [startColumn, sourceLength - startColumn];
- } else if (i === lineDiff) {
- markerLines[lineNumber] = [0, endColumn];
- } else {
- var _sourceLength = source[lineNumber - i].length;
- markerLines[lineNumber] = [0, _sourceLength];
- }
- }
- } else {
- if (startColumn === endColumn) {
- if (startColumn) {
- markerLines[startLine] = [startColumn, 0];
- } else {
- markerLines[startLine] = true;
- }
- } else {
- markerLines[startLine] = [startColumn, endColumn - startColumn];
- }
- }
- return {
- start: start,
- end: end,
- markerLines: markerLines
- };
- }
- function codeFrameColumns(rawLines, loc, opts) {
- if (opts === void 0) {
- opts = {};
- }
- var highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight().shouldHighlight)(opts);
- var chalk = (0, _highlight().getChalk)(opts);
- var defs = getDefs(chalk);
- var maybeHighlight = function maybeHighlight(chalkFn, string) {
- return highlighted ? chalkFn(string) : string;
- };
- if (highlighted) rawLines = (0, _highlight().default)(rawLines, opts);
- var lines = rawLines.split(NEWLINE);
- var _getMarkerLines = getMarkerLines(loc, lines, opts),
- start = _getMarkerLines.start,
- end = _getMarkerLines.end,
- markerLines = _getMarkerLines.markerLines;
- var hasColumns = loc.start && typeof loc.start.column === "number";
- var numberMaxWidth = String(end).length;
- var frame = lines.slice(start, end).map(function (line, index) {
- var number = start + 1 + index;
- var paddedNumber = (" " + number).slice(-numberMaxWidth);
- var gutter = " " + paddedNumber + " | ";
- var hasMarker = markerLines[number];
- var lastMarkerLine = !markerLines[number + 1];
- if (hasMarker) {
- var markerLine = "";
- if (Array.isArray(hasMarker)) {
- var markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
- var numberOfMarkers = hasMarker[1] || 1;
- markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
- if (lastMarkerLine && opts.message) {
- markerLine += " " + maybeHighlight(defs.message, opts.message);
- }
- }
- return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
- } else {
- return " " + maybeHighlight(defs.gutter, gutter) + line;
- }
- }).join("\n");
- if (opts.message && !hasColumns) {
- frame = "" + " ".repeat(numberMaxWidth + 1) + opts.message + "\n" + frame;
- }
- if (highlighted) {
- return chalk.reset(frame);
- } else {
- return frame;
- }
- }
- function _default(rawLines, lineNumber, colNumber, opts) {
- if (opts === void 0) {
- opts = {};
- }
- if (!deprecationWarningShown) {
- deprecationWarningShown = true;
- var message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
- if (process$3.emitWarning) {
- process$3.emitWarning(message, "DeprecationWarning");
- } else {
- var deprecationError = new Error(message);
- deprecationError.name = "DeprecationWarning";
- console.warn(new Error(message));
- }
- }
- colNumber = Math.max(colNumber, 0);
- var location = {
- start: {
- column: colNumber,
- line: lineNumber
- }
- };
- return codeFrameColumns(rawLines, location, opts);
- }
- });
- unwrapExports(lib$2);
- var lib_1$2 = lib$2.codeFrameColumns;
- var stackUtils = createCommonjsModule(function (module) {
- module.exports = StackUtils;
- function StackUtils(opts) {
- if (!(this instanceof StackUtils)) {
- throw new Error('StackUtils constructor must be called with new');
- }
- opts = opts || {};
- this._cwd = (opts.cwd || process$3.cwd()).replace(/\\/g, '/');
- this._internals = opts.internals || [];
- this._wrapCallSite = opts.wrapCallSite || false;
- }
- module.exports.nodeInternals = nodeInternals;
- function nodeInternals() {
- if (!module.exports.natives) {
- module.exports.natives = Object.keys(process$3.binding('natives'));
- module.exports.natives.push('bootstrap_node', 'node');
- }
- return module.exports.natives.map(function (n) {
- return new RegExp('\\(' + n + '\\.js:\\d+:\\d+\\)$');
- }).concat([
- /\s*at (bootstrap_)?node\.js:\d+:\d+?$/,
- /\/\.node-spawn-wrap-\w+-\w+\/node:\d+:\d+\)?$/
- ]);
- }
- StackUtils.prototype.clean = function (stack) {
- if (!Array.isArray(stack)) {
- stack = stack.split('\n');
- }
- if (!(/^\s*at /.test(stack[0])) &&
- (/^\s*at /.test(stack[1]))) {
- stack = stack.slice(1);
- }
- var outdent = false;
- var lastNonAtLine = null;
- var result = [];
- stack.forEach(function (st) {
- st = st.replace(/\\/g, '/');
- var isInternal = this._internals.some(function (internal) {
- return internal.test(st);
- });
- if (isInternal) {
- return null;
- }
- var isAtLine = /^\s*at /.test(st);
- if (outdent) {
- st = st.replace(/\s+$/, '').replace(/^(\s+)at /, '$1');
- } else {
- st = st.trim();
- if (isAtLine) {
- st = st.substring(3);
- }
- }
- st = st.replace(this._cwd + '/', '');
- if (st) {
- if (isAtLine) {
- if (lastNonAtLine) {
- result.push(lastNonAtLine);
- lastNonAtLine = null;
- }
- result.push(st);
- } else {
- outdent = true;
- lastNonAtLine = st;
- }
- }
- }, this);
- stack = result.join('\n').trim();
- if (stack) {
- return stack + '\n';
- }
- return '';
- };
- StackUtils.prototype.captureString = function (limit, fn) {
- if (typeof limit === 'function') {
- fn = limit;
- limit = Infinity;
- }
- if (!fn) {
- fn = this.captureString;
- }
- var limitBefore = Error.stackTraceLimit;
- if (limit) {
- Error.stackTraceLimit = limit;
- }
- var obj = {};
- Error.captureStackTrace(obj, fn);
- var stack = obj.stack;
- Error.stackTraceLimit = limitBefore;
- return this.clean(stack);
- };
- StackUtils.prototype.capture = function (limit, fn) {
- if (typeof limit === 'function') {
- fn = limit;
- limit = Infinity;
- }
- if (!fn) {
- fn = this.capture;
- }
- var prepBefore = Error.prepareStackTrace;
- var limitBefore = Error.stackTraceLimit;
- var wrapCallSite = this._wrapCallSite;
- Error.prepareStackTrace = function (obj, site) {
- if (wrapCallSite) {
- return site.map(wrapCallSite);
- }
- return site;
- };
- if (limit) {
- Error.stackTraceLimit = limit;
- }
- var obj = {};
- Error.captureStackTrace(obj, fn);
- var stack = obj.stack;
- Error.prepareStackTrace = prepBefore;
- Error.stackTraceLimit = limitBefore;
- return stack;
- };
- StackUtils.prototype.at = function at(fn) {
- if (!fn) {
- fn = at;
- }
- var site = this.capture(1, fn)[0];
- if (!site) {
- return {};
- }
- var res = {
- line: site.getLineNumber(),
- column: site.getColumnNumber()
- };
- this._setFile(res, site.getFileName());
- if (site.isConstructor()) {
- res.constructor = true;
- }
- if (site.isEval()) {
- res.evalOrigin = site.getEvalOrigin();
- }
- if (site.isNative()) {
- res.native = true;
- }
- var typename = null;
- try {
- typename = site.getTypeName();
- } catch (er) {}
- if (typename &&
- typename !== 'Object' &&
- typename !== '[object Object]') {
- res.type = typename;
- }
- var fname = site.getFunctionName();
- if (fname) {
- res.function = fname;
- }
- var meth = site.getMethodName();
- if (meth && fname !== meth) {
- res.method = meth;
- }
- return res;
- };
- StackUtils.prototype._setFile = function (result, filename) {
- if (filename) {
- filename = filename.replace(/\\/g, '/');
- if ((filename.indexOf(this._cwd + '/') === 0)) {
- filename = filename.substr(this._cwd.length + 1);
- }
- result.file = filename;
- }
- };
- var re = new RegExp(
- '^' +
- // Sometimes we strip out the ' at' because it's noisy
- '(?:\\s*at )?' +
- // $1 = ctor if 'new'
- '(?:(new) )?' +
- // $2 = function name (can be literally anything)
- // May contain method at the end as [as xyz]
- '(?:(.*?) \\()?' +
- // (eval at <anonymous> (file.js:1:1),
- // $3 = eval origin
- // $4:$5:$6 are eval file/line/col, but not normally reported
- '(?:eval at ([^ ]+) \\((.+?):(\\d+):(\\d+)\\), )?' +
- // file:line:col
- // $7:$8:$9
- // $10 = 'native' if native
- '(?:(.+?):(\\d+):(\\d+)|(native))' +
- // maybe close the paren, then end
- // if $11 is ), then we only allow balanced parens in the filename
- // any imbalance is placed on the fname. This is a heuristic, and
- // bound to be incorrect in some edge cases. The bet is that
- // having weird characters in method names is more common than
- // having weird characters in filenames, which seems reasonable.
- '(\\)?)$'
- );
- var methodRe = /^(.*?) \[as (.*?)\]$/;
- StackUtils.prototype.parseLine = function parseLine(line) {
- var match = line && line.match(re);
- if (!match) {
- return null;
- }
- var ctor = match[1] === 'new';
- var fname = match[2];
- var evalOrigin = match[3];
- var evalFile = match[4];
- var evalLine = Number(match[5]);
- var evalCol = Number(match[6]);
- var file = match[7];
- var lnum = match[8];
- var col = match[9];
- var native = match[10] === 'native';
- var closeParen = match[11] === ')';
- var res = {};
- if (lnum) {
- res.line = Number(lnum);
- }
- if (col) {
- res.column = Number(col);
- }
- if (closeParen && file) {
- // make sure parens are balanced
- // if we have a file like "asdf) [as foo] (xyz.js", then odds are
- // that the fname should be += " (asdf) [as foo]" and the file
- // should be just "xyz.js"
- // walk backwards from the end to find the last unbalanced (
- var closes = 0;
- for (var i = file.length - 1; i > 0; i--) {
- if (file.charAt(i) === ')') {
- closes ++;
- } else if (file.charAt(i) === '(' && file.charAt(i - 1) === ' ') {
- closes --;
- if (closes === -1 && file.charAt(i - 1) === ' ') {
- var before = file.substr(0, i - 1);
- var after = file.substr(i + 1);
- file = after;
- fname += ' (' + before;
- break;
- }
- }
- }
- }
- if (fname) {
- var methodMatch = fname.match(methodRe);
- if (methodMatch) {
- fname = methodMatch[1];
- var meth = methodMatch[2];
- }
- }
- this._setFile(res, file);
- if (ctor) {
- res.constructor = true;
- }
- if (evalOrigin) {
- res.evalOrigin = evalOrigin;
- res.evalLine = evalLine;
- res.evalColumn = evalCol;
- res.evalFile = evalFile && evalFile.replace(/\\/g, '/');
- }
- if (native) {
- res.native = true;
- }
- if (fname) {
- res.function = fname;
- }
- if (meth && fname !== meth) {
- res.method = meth;
- }
- return res;
- };
- var bound = new StackUtils();
- Object.keys(StackUtils.prototype).forEach(function (key) {
- StackUtils[key] = bound[key].bind(bound);
- });
- });
- var stackUtils_1 = stackUtils.nodeInternals;
- var stackUtils_2 = stackUtils.natives;
- var build$5 = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.separateMessageFromStack = exports.formatResultsErrors = exports.formatStackTrace = exports.getTopFrame = exports.getStackTraceLines = exports.formatExecError = undefined;
- var _fs2 = _interopRequireDefault(crypto);
- var _path2 = _interopRequireDefault(path$2);
- var _chalk2 = _interopRequireDefault(fake_chalk);
- var _micromatch2 = _interopRequireDefault(micromatch_1);
- var _slash2 = _interopRequireDefault(slash);
- var _stackUtils2 = _interopRequireDefault(stackUtils);
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : { default: obj };
- }
- // stack utils tries to create pretty stack by making paths relative.
- var stackUtils$$1 = new _stackUtils2.default({
- cwd: 'something which does not exist'
- });
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var nodeInternals = [];
- try {
- nodeInternals = _stackUtils2.default.nodeInternals()
- // this is to have the tests be the same in node 4 and node 6.
- // TODO: Remove when we drop support for node 4
- .concat(new RegExp('internal/process/next_tick.js'));
- } catch (e) {
- // `StackUtils.nodeInternals()` fails in browsers. We don't need to remove
- // node internals in the browser though, so no issue.
- }
- var PATH_NODE_MODULES = _path2.default.sep + 'node_modules' + _path2.default.sep;
- var PATH_JEST_PACKAGES = _path2.default.sep + 'jest' + _path2.default.sep + 'packages' + _path2.default.sep;
- // filter for noisy stack trace lines
- var JASMINE_IGNORE = /^\s+at(?:(?:.jasmine\-)|\s+jasmine\.buildExpectationResult)/;
- var JEST_INTERNALS_IGNORE = /^\s+at.*?jest(-.*?)?(\/|\\)(build|node_modules|packages)(\/|\\)/;
- var ANONYMOUS_FN_IGNORE = /^\s+at <anonymous>.*$/;
- var ANONYMOUS_PROMISE_IGNORE = /^\s+at (new )?Promise \(<anonymous>\).*$/;
- var ANONYMOUS_GENERATOR_IGNORE = /^\s+at Generator.next \(<anonymous>\).*$/;
- var NATIVE_NEXT_IGNORE = /^\s+at next \(native\).*$/;
- var TITLE_INDENT = ' ';
- var MESSAGE_INDENT = ' ';
- var STACK_INDENT = ' ';
- var ANCESTRY_SEPARATOR = ' \u203A ';
- var TITLE_BULLET = _chalk2.default.bold('\u25CF ');
- var STACK_TRACE_COLOR = _chalk2.default.dim;
- var STACK_PATH_REGEXP = /\s*at.*\(?(\:\d*\:\d*|native)\)?/;
- var EXEC_ERROR_MESSAGE = 'Test suite failed to run';
- var ERROR_TEXT = 'Error: ';
- var indentAllLines = function indentAllLines(lines, indent) {
- return lines.split('\n').map(function (line) {
- return line ? indent + line : line;
- }).join('\n');
- };
- var trim = function trim(string) {
- return (string || '').trim();
- };
- // Some errors contain not only line numbers in stack traces
- // e.g. SyntaxErrors can contain snippets of code, and we don't
- // want to trim those, because they may have pointers to the column/character
- // which will get misaligned.
- var trimPaths = function trimPaths(string) {
- return string.match(STACK_PATH_REGEXP) ? trim(string) : string;
- };
- var getRenderedCallsite = function getRenderedCallsite(fileContent, line, column) {
- var renderedCallsite = (0, lib$2.codeFrameColumns)(fileContent, { start: { column: column, line: line } }, { highlightCode: true });
- renderedCallsite = indentAllLines(renderedCallsite, MESSAGE_INDENT);
- renderedCallsite = '\n' + renderedCallsite + '\n';
- return renderedCallsite;
- };
- // ExecError is an error thrown outside of the test suite (not inside an `it` or
- // `before/after each` hooks). If it's thrown, none of the tests in the file
- // are executed.
- var formatExecError = exports.formatExecError = function (error, config, options, testPath, reuseMessage) {
- if (!error || typeof error === 'number') {
- error = new Error('Expected an Error, but "' + String(error) + '" was thrown');
- error.stack = '';
- }
- var message = void 0,
- stack = void 0;
- if (typeof error === 'string' || !error) {
- error || (error = 'EMPTY ERROR');
- message = '';
- stack = error;
- } else {
- message = error.message;
- stack = error.stack;
- }
- var separated = separateMessageFromStack(stack || '');
- stack = separated.stack;
- if (separated.message.indexOf(trim(message)) !== -1) {
- // Often stack trace already contains the duplicate of the message
- message = separated.message;
- }
- message = indentAllLines(message, MESSAGE_INDENT);
- stack = stack && !options.noStackTrace ? '\n' + formatStackTrace(stack, config, options, testPath) : '';
- if (message.match(/^\s*$/) && stack.match(/^\s*$/)) {
- // this can happen if an empty object is thrown.
- message = MESSAGE_INDENT + 'Error: No message was provided';
- }
- var messageToUse = void 0;
- if (reuseMessage) {
- messageToUse = ' ' + message.trim();
- } else {
- messageToUse = EXEC_ERROR_MESSAGE + '\n\n' + message;
- }
- return TITLE_INDENT + TITLE_BULLET + messageToUse + stack + '\n';
- };
- var removeInternalStackEntries = function removeInternalStackEntries(lines, options) {
- var pathCounter = 0;
- return lines.filter(function (line) {
- if (ANONYMOUS_FN_IGNORE.test(line)) {
- return false;
- }
- if (ANONYMOUS_PROMISE_IGNORE.test(line)) {
- return false;
- }
- if (ANONYMOUS_GENERATOR_IGNORE.test(line)) {
- return false;
- }
- if (NATIVE_NEXT_IGNORE.test(line)) {
- return false;
- }
- if (nodeInternals.some(function (internal) {
- return internal.test(line);
- })) {
- return false;
- }
- if (!STACK_PATH_REGEXP.test(line)) {
- return true;
- }
- if (JASMINE_IGNORE.test(line)) {
- return false;
- }
- if (++pathCounter === 1) {
- return true; // always keep the first line even if it's from Jest
- }
- if (options.noStackTrace) {
- return false;
- }
- if (JEST_INTERNALS_IGNORE.test(line)) {
- return false;
- }
- return true;
- });
- };
- var formatPaths = function formatPaths(config, relativeTestPath, line) {
- // Extract the file path from the trace line.
- var match = line.match(/(^\s*at .*?\(?)([^()]+)(:[0-9]+:[0-9]+\)?.*$)/);
- if (!match) {
- return line;
- }
- var filePath = (0, _slash2.default)(_path2.default.relative(config.rootDir, match[2]));
- // highlight paths from the current test file
- if (config.testMatch && config.testMatch.length && (0, _micromatch2.default)(filePath, config.testMatch) || filePath === relativeTestPath) {
- filePath = _chalk2.default.reset.cyan(filePath);
- }
- return STACK_TRACE_COLOR(match[1]) + filePath + STACK_TRACE_COLOR(match[3]);
- };
- var getStackTraceLines = exports.getStackTraceLines = function (stack) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { noStackTrace: false };
- return removeInternalStackEntries(stack.split(/\n/), options);
- };
- var getTopFrame = exports.getTopFrame = function (lines) {
- var _iteratorNormalCompletion = true;
- var _didIteratorError = false;
- var _iteratorError = undefined;
- try {
- for (var _iterator = _getIterator(lines), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
- var line = _step.value;
- if (line.includes(PATH_NODE_MODULES) || line.includes(PATH_JEST_PACKAGES)) {
- continue;
- }
- var parsedFrame = stackUtils$$1.parseLine(line.trim());
- if (parsedFrame && parsedFrame.file) {
- return parsedFrame;
- }
- }
- } catch (err) {
- _didIteratorError = true;
- _iteratorError = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion && _iterator.return) {
- _iterator.return();
- }
- } finally {
- if (_didIteratorError) {
- throw _iteratorError;
- }
- }
- }
- return null;
- };
- var formatStackTrace = exports.formatStackTrace = function (stack, config, options, testPath) {
- var lines = getStackTraceLines(stack, options);
- var topFrame = getTopFrame(lines);
- var renderedCallsite = '';
- var relativeTestPath = testPath ? (0, _slash2.default)(_path2.default.relative(config.rootDir, testPath)) : null;
- if (topFrame) {
- var filename = topFrame.file;
- if (_path2.default.isAbsolute(filename)) {
- var fileContent = void 0;
- try {
- // TODO: check & read HasteFS instead of reading the filesystem:
- // see: https://github.com/facebook/jest/pull/5405#discussion_r164281696
- fileContent = _fs2.default.readFileSync(filename, 'utf8');
- renderedCallsite = getRenderedCallsite(fileContent, topFrame.line, topFrame.column);
- } catch (e) {
- // the file does not exist or is inaccessible, we ignore
- }
- }
- }
- var stacktrace = lines.filter(Boolean).map(function (line) {
- return STACK_INDENT + formatPaths(config, relativeTestPath, trimPaths(line));
- }).join('\n');
- return renderedCallsite + '\n' + stacktrace;
- };
- var formatResultsErrors = exports.formatResultsErrors = function (testResults, config, options, testPath) {
- var failedResults = testResults.reduce(function (errors, result) {
- result.failureMessages.forEach(function (content) {
- return errors.push({ content: content, result: result });
- });
- return errors;
- }, []);
- if (!failedResults.length) {
- return null;
- }
- return failedResults.map(function (_ref) {
- var result = _ref.result,
- content = _ref.content;
- var _separateMessageFromS = separateMessageFromStack(content);
- var message = _separateMessageFromS.message,
- stack = _separateMessageFromS.stack;
- stack = options.noStackTrace ? '' : STACK_TRACE_COLOR(formatStackTrace(stack, config, options, testPath)) + '\n';
- message = indentAllLines(message, MESSAGE_INDENT);
- var title = _chalk2.default.bold.red(TITLE_INDENT + TITLE_BULLET + result.ancestorTitles.join(ANCESTRY_SEPARATOR) + (result.ancestorTitles.length ? ANCESTRY_SEPARATOR : '') + result.title) + '\n';
- return title + '\n' + message + '\n' + stack;
- }).join('\n');
- };
- // jasmine and worker farm sometimes don't give us access to the actual
- // Error object, so we have to regexp out the message from the stack string
- // to format it.
- var separateMessageFromStack = exports.separateMessageFromStack = function (content) {
- if (!content) {
- return { message: '', stack: '' };
- }
- var messageMatch = content.match(/(^(.|\n)*?(?=\n\s*at\s.*\:\d*\:\d*))/);
- var message = messageMatch ? messageMatch[0] : 'Error';
- var stack = messageMatch ? content.slice(message.length) : content;
- // If the error is a plain error instead of a SyntaxError or TypeError
- // we remove it from the message because it is generally not useful.
- if (message.startsWith(ERROR_TEXT)) {
- message = message.substr(ERROR_TEXT.length);
- }
- return { message: message, stack: stack };
- };
- });
- unwrapExports(build$5);
- var build_1$2 = build$5.separateMessageFromStack;
- var build_2$2 = build$5.formatResultsErrors;
- var build_3$2 = build$5.formatStackTrace;
- var build_4$1 = build$5.getTopFrame;
- var build_5$1 = build$5.getStackTraceLines;
- var build_6$1 = build$5.formatExecError;
- var createMatcher = function createMatcher(matcherName, fromPromise) {
- return function (actual, expected) {
- var value = expected;
- var error = void 0;
- if (fromPromise && isError(actual)) {
- error = actual;
- } else {
- if (typeof actual !== 'function') {
- if (!fromPromise) {
- throw new Error(build_1(matcherName, 'function', build(value)) + '\n\n' + 'Received value must be a function, but instead ' + ('"' + build(actual) + '" was found'));
- }
- } else {
- try {
- actual();
- } catch (e) {
- error = e;
- }
- }
- }
- if (typeof expected === 'string') {
- expected = new RegExp(build_2$1(expected));
- }
- if (typeof expected === 'function') {
- return toThrowMatchingError(matcherName, error, expected);
- } else if (expected && typeof expected.test === 'function') {
- return toThrowMatchingStringOrRegexp(matcherName, error, expected, value);
- } else if (expected && (typeof expected === 'undefined' ? 'undefined' : _typeof(expected)) === 'object') {
- return toThrowMatchingErrorInstance(matcherName, error, expected);
- } else if (expected === undefined) {
- var pass = error !== undefined;
- return {
- message: pass ? function () {
- return build_1('.not' + matcherName, 'function', '') + '\n\n' + 'Expected the function not to throw an error.\n' + printActualErrorMessage(error);
- } : function () {
- return build_1(matcherName, 'function', build(value)) + '\n\n' + 'Expected the function to throw an error.\n' + printActualErrorMessage(error);
- },
- pass: pass
- };
- } else {
- throw new Error(build_1('.not' + matcherName, 'function', build(value)) + '\n\n' + 'Unexpected argument passed.\nExpected: ' + (build_8('string') + ', ' + build_8('Error (type)') + ' or ' + build_8('regexp') + '.\n') + build_7('Got', String(expected), build_8));
- }
- };
- };
- var matchers$1 = {
- toThrow: createMatcher('.toThrow'),
- toThrowError: createMatcher('.toThrowError')
- };
- var toThrowMatchingStringOrRegexp = function toThrowMatchingStringOrRegexp(name, error, pattern, value) {
- if (error && !error.message && !error.name) {
- error = new Error(error);
- }
- var pass = !!(error && error.message.match(pattern));
- var message = pass ? function () {
- return build_1('.not' + name, 'function', build(value)) + '\n\n' + 'Expected the function not to throw an error matching:\n' + (' ' + build_8(value) + '\n') + printActualErrorMessage(error);
- } : function () {
- return build_1(name, 'function', build(value)) + '\n\n' + 'Expected the function to throw an error matching:\n' + (' ' + build_8(value) + '\n') + printActualErrorMessage(error);
- };
- return { message: message, pass: pass };
- };
- var toThrowMatchingErrorInstance = function toThrowMatchingErrorInstance(name, error, expectedError) {
- if (error && !error.message && !error.name) {
- error = new Error(error);
- }
- var pass = equals(error, expectedError);
- var message = pass ? function () {
- return build_1('.not' + name, 'function', 'error') + '\n\n' + 'Expected the function not to throw an error matching:\n' + (' ' + build_8(expectedError) + '\n') + printActualErrorMessage(error);
- } : function () {
- return build_1(name, 'function', 'error') + '\n\n' + 'Expected the function to throw an error matching:\n' + (' ' + build_8(expectedError) + '\n') + printActualErrorMessage(error);
- };
- return { message: message, pass: pass };
- };
- var toThrowMatchingError = function toThrowMatchingError(name, error, ErrorClass) {
- var pass = !!(error && error instanceof ErrorClass);
- var message = pass ? function () {
- return build_1('.not' + name, 'function', 'type') + '\n\n' + 'Expected the function not to throw an error of type:\n' + (' ' + build_8(ErrorClass.name) + '\n') + printActualErrorMessage(error);
- } : function () {
- return build_1(name, 'function', 'type') + '\n\n' + 'Expected the function to throw an error of type:\n' + (' ' + build_8(ErrorClass.name) + '\n') + printActualErrorMessage(error);
- };
- return { message: message, pass: pass };
- };
- var printActualErrorMessage = function printActualErrorMessage(error) {
- if (error) {
- var _separateMessageFromS = build_1$2(error.stack),
- message = _separateMessageFromS.message,
- stack = _separateMessageFromS.stack;
- return 'Instead, it threw:\n' + build_14(' ' + build_10(message) + build_3$2(stack, {
- rootDir: process$3.cwd(),
- testMatch: []
- }, {
- noStackTrace: false
- }));
- }
- return 'But it didn\'t throw anything.';
- };
- var createClass = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- var _defineProperty2 = _interopRequireDefault(defineProperty$2);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.default = function () {
- 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;
- (0, _defineProperty2.default)(target, descriptor.key, descriptor);
- }
- }
- return function (Constructor, protoProps, staticProps) {
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
- if (staticProps) defineProperties(Constructor, staticProps);
- return Constructor;
- };
- }();
- });
- var _createClass = unwrapExports(createClass);
- var AsymmetricMatcher = function AsymmetricMatcher() {
- _classCallCheck(this, AsymmetricMatcher);
- this.$$typeof = _Symbol$for('jest.asymmetricMatcher');
- };
- var Any = function (_AsymmetricMatcher) {
- _inherits(Any, _AsymmetricMatcher);
- function Any(sample) {
- _classCallCheck(this, Any);
- var _this = _possibleConstructorReturn(this, (Any.__proto__ || _Object$getPrototypeOf(Any)).call(this));
- if (typeof sample === 'undefined') {
- throw new TypeError('any() expects to be passed a constructor function. ' + 'Please pass one or use anything() to match any object.');
- }
- _this.sample = sample;
- return _this;
- }
- _createClass(Any, [{
- key: 'asymmetricMatch',
- value: function asymmetricMatch(other) {
- if (this.sample == String) {
- return typeof other == 'string' || other instanceof String;
- }
- if (this.sample == Number) {
- return typeof other == 'number' || other instanceof Number;
- }
- if (this.sample == Function) {
- return typeof other == 'function' || other instanceof Function;
- }
- if (this.sample == Object) {
- return (typeof other === 'undefined' ? 'undefined' : _typeof(other)) == 'object';
- }
- if (this.sample == Boolean) {
- return typeof other == 'boolean';
- }
- return other instanceof this.sample;
- }
- }, {
- key: 'toString',
- value: function toString() {
- return 'Any';
- }
- }, {
- key: 'getExpectedType',
- value: function getExpectedType() {
- if (this.sample == String) {
- return 'string';
- }
- if (this.sample == Number) {
- return 'number';
- }
- if (this.sample == Function) {
- return 'function';
- }
- if (this.sample == Object) {
- return 'object';
- }
- if (this.sample == Boolean) {
- return 'boolean';
- }
- return fnNameFor(this.sample);
- }
- }, {
- key: 'toAsymmetricMatcher',
- value: function toAsymmetricMatcher() {
- return 'Any<' + fnNameFor(this.sample) + '>';
- }
- }]);
- return Any;
- }(AsymmetricMatcher);
- var Anything = function (_AsymmetricMatcher2) {
- _inherits(Anything, _AsymmetricMatcher2);
- function Anything() {
- _classCallCheck(this, Anything);
- return _possibleConstructorReturn(this, (Anything.__proto__ || _Object$getPrototypeOf(Anything)).apply(this, arguments));
- }
- _createClass(Anything, [{
- key: 'asymmetricMatch',
- value: function asymmetricMatch(other) {
- return !isUndefined(other) && other !== null;
- }
- }, {
- key: 'toString',
- value: function toString() {
- return 'Anything';
- }
- // No getExpectedType method, because it matches either null or undefined.
- }, {
- key: 'toAsymmetricMatcher',
- value: function toAsymmetricMatcher() {
- return 'Anything';
- }
- }]);
- return Anything;
- }(AsymmetricMatcher);
- var ArrayContaining = function (_AsymmetricMatcher3) {
- _inherits(ArrayContaining, _AsymmetricMatcher3);
- function ArrayContaining(sample) {
- var inverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- _classCallCheck(this, ArrayContaining);
- var _this3 = _possibleConstructorReturn(this, (ArrayContaining.__proto__ || _Object$getPrototypeOf(ArrayContaining)).call(this));
- _this3.sample = sample;
- _this3.inverse = inverse;
- return _this3;
- }
- _createClass(ArrayContaining, [{
- key: 'asymmetricMatch',
- value: function asymmetricMatch(other) {
- if (!Array.isArray(this.sample)) {
- throw new Error('You must provide an array to ' + this.toString() + ', not \'' + _typeof(this.sample) + "'.");
- }
- var result = this.sample.length === 0 || Array.isArray(other) && this.sample.every(function (item) {
- return other.some(function (another) {
- return equals(item, another);
- });
- });
- return this.inverse ? !result : result;
- }
- }, {
- key: 'toString',
- value: function toString() {
- return 'Array' + (this.inverse ? 'Not' : '') + 'Containing';
- }
- }, {
- key: 'getExpectedType',
- value: function getExpectedType() {
- return 'array';
- }
- }]);
- return ArrayContaining;
- }(AsymmetricMatcher);
- var ObjectContaining = function (_AsymmetricMatcher4) {
- _inherits(ObjectContaining, _AsymmetricMatcher4);
- function ObjectContaining(sample) {
- var inverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- _classCallCheck(this, ObjectContaining);
- var _this4 = _possibleConstructorReturn(this, (ObjectContaining.__proto__ || _Object$getPrototypeOf(ObjectContaining)).call(this));
- _this4.sample = sample;
- _this4.inverse = inverse;
- return _this4;
- }
- _createClass(ObjectContaining, [{
- key: 'asymmetricMatch',
- value: function asymmetricMatch(other) {
- if (_typeof(this.sample) !== 'object') {
- throw new Error('You must provide an object to ' + this.toString() + ', not \'' + _typeof(this.sample) + "'.");
- }
- if (this.inverse) {
- for (var property in this.sample) {
- if (hasProperty(other, property) && equals(this.sample[property], other[property]) && !emptyObject(this.sample[property]) && !emptyObject(other[property])) {
- return false;
- }
- }
- return true;
- } else {
- for (var _property in this.sample) {
- if (!hasProperty(other, _property) || !equals(this.sample[_property], other[_property])) {
- return false;
- }
- }
- return true;
- }
- }
- }, {
- key: 'toString',
- value: function toString() {
- return 'Object' + (this.inverse ? 'Not' : '') + 'Containing';
- }
- }, {
- key: 'getExpectedType',
- value: function getExpectedType() {
- return 'object';
- }
- }]);
- return ObjectContaining;
- }(AsymmetricMatcher);
- var StringContaining = function (_AsymmetricMatcher5) {
- _inherits(StringContaining, _AsymmetricMatcher5);
- function StringContaining(sample) {
- var inverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- _classCallCheck(this, StringContaining);
- var _this5 = _possibleConstructorReturn(this, (StringContaining.__proto__ || _Object$getPrototypeOf(StringContaining)).call(this));
- if (!isA('String', sample)) {
- throw new Error('Expected is not a string');
- }
- _this5.sample = sample;
- _this5.inverse = inverse;
- return _this5;
- }
- _createClass(StringContaining, [{
- key: 'asymmetricMatch',
- value: function asymmetricMatch(other) {
- if (!isA('String', other)) {
- throw new Error('Actual is not a string');
- }
- var result = other.includes(this.sample);
- return this.inverse ? !result : result;
- }
- }, {
- key: 'toString',
- value: function toString() {
- return 'String' + (this.inverse ? 'Not' : '') + 'Containing';
- }
- }, {
- key: 'getExpectedType',
- value: function getExpectedType() {
- return 'string';
- }
- }]);
- return StringContaining;
- }(AsymmetricMatcher);
- var StringMatching = function (_AsymmetricMatcher6) {
- _inherits(StringMatching, _AsymmetricMatcher6);
- function StringMatching(sample) {
- var inverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- _classCallCheck(this, StringMatching);
- var _this6 = _possibleConstructorReturn(this, (StringMatching.__proto__ || _Object$getPrototypeOf(StringMatching)).call(this));
- if (!isA('String', sample) && !isA('RegExp', sample)) {
- throw new Error('Expected is not a String or a RegExp');
- }
- _this6.sample = new RegExp(sample);
- _this6.inverse = inverse;
- return _this6;
- }
- _createClass(StringMatching, [{
- key: 'asymmetricMatch',
- value: function asymmetricMatch(other) {
- if (!isA('String', other)) {
- throw new Error('Actual is not a string');
- }
- var result = this.sample.test(other);
- return this.inverse ? !result : result;
- }
- }, {
- key: 'toString',
- value: function toString() {
- return 'String' + (this.inverse ? 'Not' : '') + 'Matching';
- }
- }, {
- key: 'getExpectedType',
- value: function getExpectedType() {
- return 'string';
- }
- }]);
- return StringMatching;
- }(AsymmetricMatcher);
- var any$1 = function any(expectedObject) {
- return new Any(expectedObject);
- };
- var anything = function anything() {
- return new Anything();
- };
- var arrayContaining = function arrayContaining(sample) {
- return new ArrayContaining(sample);
- };
- var arrayNotContaining = function arrayNotContaining(sample) {
- return new ArrayContaining(sample, true);
- };
- var objectContaining = function objectContaining(sample) {
- return new ObjectContaining(sample);
- };
- var objectNotContaining = function objectNotContaining(sample) {
- return new ObjectContaining(sample, true);
- };
- var stringContaining = function stringContaining(expected) {
- return new StringContaining(expected);
- };
- var stringNotContaining = function stringNotContaining(expected) {
- return new StringContaining(expected, true);
- };
- var stringMatching = function stringMatching(expected) {
- return new StringMatching(expected);
- };
- var stringNotMatching = function stringNotMatching(expected) {
- return new StringMatching(expected, true);
- };
- var toConsumableArray = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- var _from2 = _interopRequireDefault(from$1);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.default = function (arr) {
- if (Array.isArray(arr)) {
- for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- } else {
- return (0, _from2.default)(arr);
- }
- };
- });
- var _toConsumableArray = unwrapExports(toConsumableArray);
- // Global matchers object holds the list of available matchers and
- // the state, that can hold matcher specific values that change over time.
- var JEST_MATCHERS_OBJECT = _Symbol$for('$$jest-matchers-object');
- // Notes a built-in/internal Jest matcher.
- // Jest may override the stack trace of Errors thrown by internal matchers.
- var INTERNAL_MATCHER_FLAG = _Symbol$for('$$jest-internal-matcher');
- if (!global$1[JEST_MATCHERS_OBJECT]) {
- _Object$defineProperty(global$1, JEST_MATCHERS_OBJECT, {
- value: {
- matchers: _Object$create(null),
- state: {
- assertionCalls: 0,
- expectedAssertionsNumber: null,
- isExpectingAssertions: false,
- suppressedErrors: [] // errors that are not thrown immediately.
- }
- }
- });
- }
- var getState = function getState() {
- return global$1[JEST_MATCHERS_OBJECT].state;
- };
- var setState = function setState(state) {
- _Object$assign(global$1[JEST_MATCHERS_OBJECT].state, state);
- };
- var getMatchers = function getMatchers() {
- return global$1[JEST_MATCHERS_OBJECT].matchers;
- };
- var setMatchers = function setMatchers(matchers, isInternal, expect) {
- _Object$keys(matchers).forEach(function (key) {
- var matcher = matchers[key];
- _Object$defineProperty(matcher, INTERNAL_MATCHER_FLAG, {
- value: isInternal
- });
- if (!isInternal) {
- // expect is defined
- var CustomMatcher = function (_AsymmetricMatcher) {
- _inherits(CustomMatcher, _AsymmetricMatcher);
- function CustomMatcher() {
- var inverse = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- _classCallCheck(this, CustomMatcher);
- var _this = _possibleConstructorReturn(this, (CustomMatcher.__proto__ || _Object$getPrototypeOf(CustomMatcher)).call(this));
- _this.inverse = inverse;
- for (var _len = arguments.length, sample = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- sample[_key - 1] = arguments[_key];
- }
- _this.sample = sample;
- return _this;
- }
- _createClass(CustomMatcher, [{
- key: 'asymmetricMatch',
- value: function asymmetricMatch(other) {
- var _matcher = matcher.apply(undefined, [other].concat(_toConsumableArray(this.sample))),
- pass = _matcher.pass;
- return this.inverse ? !pass : pass;
- }
- }, {
- key: 'toString',
- value: function toString() {
- return '' + (this.inverse ? 'not.' : '') + key;
- }
- }, {
- key: 'getExpectedType',
- value: function getExpectedType() {
- return 'any';
- }
- }, {
- key: 'toAsymmetricMatcher',
- value: function toAsymmetricMatcher() {
- return this.toString() + '<' + this.sample.join(', ') + '>';
- }
- }]);
- return CustomMatcher;
- }(AsymmetricMatcher);
- expect[key] = function () {
- for (var _len2 = arguments.length, sample = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- sample[_key2] = arguments[_key2];
- }
- return new (Function.prototype.bind.apply(CustomMatcher, [null].concat([false], sample)))();
- };
- if (!expect.not) {
- expect.not = {};
- }
- expect.not[key] = function () {
- for (var _len3 = arguments.length, sample = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
- sample[_key3] = arguments[_key3];
- }
- return new (Function.prototype.bind.apply(CustomMatcher, [null].concat([true], sample)))();
- };
- }
- });
- _Object$assign(global$1[JEST_MATCHERS_OBJECT].matchers, matchers);
- };
- var resetAssertionsLocalState = function resetAssertionsLocalState() {
- setState({
- assertionCalls: 0,
- expectedAssertionsNumber: null,
- isExpectingAssertions: false
- });
- };
- // Create and format all errors related to the mismatched number of `expect`
- // calls and reset the matcher's state.
- var extractExpectedAssertionsErrors = function extractExpectedAssertionsErrors() {
- var result = [];
- var _getState = getState(),
- assertionCalls = _getState.assertionCalls,
- expectedAssertionsNumber = _getState.expectedAssertionsNumber,
- expectedAssertionsNumberError = _getState.expectedAssertionsNumberError,
- isExpectingAssertions = _getState.isExpectingAssertions,
- isExpectingAssertionsError = _getState.isExpectingAssertionsError;
- resetAssertionsLocalState();
- if (typeof expectedAssertionsNumber === 'number' && assertionCalls !== expectedAssertionsNumber) {
- var numOfAssertionsExpected = build_15(build_2('assertion', expectedAssertionsNumber));
- expectedAssertionsNumberError.message = build_1('.assertions', '', String(expectedAssertionsNumber), {
- isDirectExpectCall: true
- }) + '\n\n' + ('Expected ' + numOfAssertionsExpected + ' to be called but received ') + build_14(build_2('assertion call', assertionCalls || 0)) + '.';
- result.push({
- actual: assertionCalls,
- error: expectedAssertionsNumberError,
- expected: expectedAssertionsNumber
- });
- }
- if (isExpectingAssertions && assertionCalls === 0) {
- var expected = build_15('at least one assertion');
- var received = build_14('received none');
- isExpectingAssertionsError.message = build_1('.hasAssertions', '', '', {
- isDirectExpectCall: true
- }) + '\n\n' + ('Expected ' + expected + ' to be called but ' + received + '.');
- result.push({
- actual: 'none',
- error: isExpectingAssertionsError,
- expected: 'at least one'
- });
- }
- return result;
- };
- var JestAssertionError = function (_Error) {
- _inherits(JestAssertionError, _Error);
- function JestAssertionError() {
- _classCallCheck(this, JestAssertionError);
- return _possibleConstructorReturn(this, (JestAssertionError.__proto__ || _Object$getPrototypeOf(JestAssertionError)).apply(this, arguments));
- }
- return JestAssertionError;
- }(Error);
- var isPromise = function isPromise(obj) {
- return !!obj && ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
- };
- var createToThrowErrorMatchingSnapshotMatcher = function createToThrowErrorMatchingSnapshotMatcher(matcher) {
- return function (received, testNameOrInlineSnapshot) {
- return matcher.apply(this, [received, testNameOrInlineSnapshot, true]);
- };
- };
- var getPromiseMatcher = function getPromiseMatcher(name, matcher) {
- if (name === 'toThrow' || name === 'toThrowError') {
- return createMatcher('.' + name, true);
- } else if (name === 'toThrowErrorMatchingSnapshot' || name === 'toThrowErrorMatchingInlineSnapshot') {
- return createToThrowErrorMatchingSnapshotMatcher(matcher);
- }
- return null;
- };
- var expect = function expect(actual) {
- if ((arguments.length <= 1 ? 0 : arguments.length - 1) !== 0) {
- throw new Error('Expect takes at most one argument.');
- }
- var allMatchers = getMatchers();
- var expectation = {
- not: {},
- rejects: { not: {} },
- resolves: { not: {} }
- };
- var err = new JestAssertionError();
- _Object$keys(allMatchers).forEach(function (name) {
- var matcher = allMatchers[name];
- var promiseMatcher = getPromiseMatcher(name, matcher) || matcher;
- expectation[name] = makeThrowingMatcher(matcher, false, actual);
- expectation.not[name] = makeThrowingMatcher(matcher, true, actual);
- expectation.resolves[name] = makeResolveMatcher(name, promiseMatcher, false, actual, err);
- expectation.resolves.not[name] = makeResolveMatcher(name, promiseMatcher, true, actual, err);
- expectation.rejects[name] = makeRejectMatcher(name, promiseMatcher, false, actual, err);
- expectation.rejects.not[name] = makeRejectMatcher(name, promiseMatcher, true, actual, err);
- });
- return expectation;
- };
- var getMessage = function getMessage(message) {
- return message && message() || build_14('No message was specified for this matcher.');
- };
- var makeResolveMatcher = function makeResolveMatcher(matcherName, matcher, isNot, actual, outerErr) {
- return function () {
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- var matcherStatement = '.resolves.' + (isNot ? 'not.' : '') + matcherName;
- if (!isPromise(actual)) {
- throw new JestAssertionError(build_1(matcherStatement, 'received', '') + '\n\n' + (build_14('received') + ' value must be a Promise.\n') + build_7('Received', actual, build_9));
- }
- var innerErr = new JestAssertionError();
- return actual.then(function (result) {
- return makeThrowingMatcher(matcher, isNot, result, innerErr).apply(null, args);
- }, function (reason) {
- outerErr.message = build_1(matcherStatement, 'received', '') + '\n\n' + ('Expected ' + build_14('received') + ' Promise to resolve, ') + 'instead it rejected to value\n' + (' ' + build_9(reason));
- return _Promise.reject(outerErr);
- });
- };
- };
- var makeRejectMatcher = function makeRejectMatcher(matcherName, matcher, isNot, actual, outerErr) {
- return function () {
- for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- args[_key2] = arguments[_key2];
- }
- var matcherStatement = '.rejects.' + (isNot ? 'not.' : '') + matcherName;
- if (!isPromise(actual)) {
- throw new JestAssertionError(build_1(matcherStatement, 'received', '') + '\n\n' + (build_14('received') + ' value must be a Promise.\n') + build_7('Received', actual, build_9));
- }
- var innerErr = new JestAssertionError();
- return actual.then(function (result) {
- outerErr.message = build_1(matcherStatement, 'received', '') + '\n\n' + ('Expected ' + build_14('received') + ' Promise to reject, ') + 'instead it resolved to value\n' + (' ' + build_9(result));
- return _Promise.reject(outerErr);
- }, function (reason) {
- return makeThrowingMatcher(matcher, isNot, reason, innerErr).apply(null, args);
- });
- };
- };
- var makeThrowingMatcher = function makeThrowingMatcher(matcher, isNot, actual, err) {
- return function throwingMatcher() {
- var throws = true;
- var utils = _Object$assign({}, matcherUtils, {
- iterableEquality: iterableEquality,
- subsetEquality: subsetEquality
- });
- var matcherContext = _Object$assign(
- // When throws is disabled, the matcher will not throw errors during test
- // execution but instead add them to the global matcher state. If a
- // matcher throws, test execution is normally stopped immediately. The
- // snapshot matcher uses it because we want to log all snapshot
- // failures in a test.
- { dontThrow: function dontThrow() {
- return throws = false;
- } }, getState(), {
- equals: equals,
- error: err,
- isNot: isNot,
- utils: utils
- });
- var processResult = function processResult(result) {
- _validateResult(result);
- getState().assertionCalls++;
- if (result.pass && isNot || !result.pass && !isNot) {
- // XOR
- var message = getMessage(result.message);
- var error = void 0;
- if (err) {
- error = err;
- error.message = message;
- } else {
- error = new JestAssertionError(message);
- // Try to remove this function from the stack trace frame.
- // Guard for some environments (browsers) that do not support this feature.
- if (Error.captureStackTrace) {
- Error.captureStackTrace(error, throwingMatcher);
- }
- }
- // Passing the result of the matcher with the error so that a custom
- // reporter could access the actual and expected objects of the result
- // for example in order to display a custom visual diff
- error.matcherResult = result;
- if (throws) {
- throw error;
- } else {
- getState().suppressedErrors.push(error);
- }
- }
- };
- var handlError = function handlError(error) {
- if (matcher[INTERNAL_MATCHER_FLAG] === true && !(error instanceof JestAssertionError) && error.name !== 'PrettyFormatPluginError' &&
- // Guard for some environments (browsers) that do not support this feature.
- Error.captureStackTrace) {
- // Try to remove this and deeper functions from the stack trace frame.
- Error.captureStackTrace(error, throwingMatcher);
- }
- throw error;
- };
- var potentialResult = void 0;
- try {
- for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
- args[_key3] = arguments[_key3];
- }
- potentialResult = matcher.apply(matcherContext, [actual].concat(args));
- if (isPromise(potentialResult)) {
- var asyncResult = potentialResult;
- return asyncResult.then(function (aResult) {
- return processResult(aResult);
- }).catch(function (error) {
- return handlError(error);
- });
- } else {
- var syncResult = potentialResult;
- return processResult(syncResult);
- }
- } catch (error) {
- return handlError(error);
- }
- };
- };
- expect.extend = function (matchers$$1) {
- return setMatchers(matchers$$1, false, expect);
- };
- expect.anything = anything;
- expect.any = any$1;
- expect.not = {
- arrayContaining: arrayNotContaining,
- objectContaining: objectNotContaining,
- stringContaining: stringNotContaining,
- stringMatching: stringNotMatching
- };
- expect.objectContaining = objectContaining;
- expect.arrayContaining = arrayContaining;
- expect.stringContaining = stringContaining;
- expect.stringMatching = stringMatching;
- var _validateResult = function _validateResult(result) {
- if ((typeof result === 'undefined' ? 'undefined' : _typeof(result)) !== 'object' || typeof result.pass !== 'boolean' || result.message && typeof result.message !== 'string' && typeof result.message !== 'function') {
- throw new Error('Unexpected return from a matcher function.\n' + 'Matcher functions should ' + 'return an object in the following format:\n' + ' {message?: string | function, pass: boolean}\n' + ('\'' + build_11(result) + '\' was returned'));
- }
- };
- function assertions(expected) {
- var error = new Error();
- if (Error.captureStackTrace) {
- Error.captureStackTrace(error, assertions);
- }
- getState().expectedAssertionsNumber = expected;
- getState().expectedAssertionsNumberError = error;
- }
- function hasAssertions() {
- var error = new Error();
- if (Error.captureStackTrace) {
- Error.captureStackTrace(error, hasAssertions);
- }
- build_6(arguments.length <= 0 ? undefined : arguments[0], '.hasAssertions');
- getState().isExpectingAssertions = true;
- getState().isExpectingAssertionsError = error;
- }
- // add default jest matchers
- setMatchers(matchers, true, expect);
- setMatchers(spyMatchers, true, expect);
- setMatchers(matchers$1, true, expect);
- expect.addSnapshotSerializer = function () {
- return void 0;
- };
- expect.assertions = assertions;
- expect.hasAssertions = hasAssertions;
- expect.getState = getState;
- expect.setState = setState;
- expect.extractExpectedAssertionsErrors = extractExpectedAssertionsErrors;
- module.exports = expect;
- })));
|