vue-test-utils.umd.js 236 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('vue'), require('vue-template-compiler')) :
  3. typeof define === 'function' && define.amd ? define(['vue', 'vue-template-compiler'], factory) :
  4. (global.VueTestUtils = factory(global.Vue,global.VueTemplateCompiler));
  5. }(this, (function (Vue,vueTemplateCompiler) { 'use strict';
  6. Vue = Vue && Vue.hasOwnProperty('default') ? Vue['default'] : Vue;
  7. var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  8. function createCommonjsModule(fn, module) {
  9. return module = { exports: {} }, fn(module, module.exports), module.exports;
  10. }
  11. var semver = createCommonjsModule(function (module, exports) {
  12. exports = module.exports = SemVer;
  13. // The debug function is excluded entirely from the minified version.
  14. /* nomin */ var debug;
  15. /* nomin */ if (typeof process === 'object' &&
  16. /* nomin */ process.env &&
  17. /* nomin */ process.env.NODE_DEBUG &&
  18. /* nomin */ /\bsemver\b/i.test(process.env.NODE_DEBUG))
  19. /* nomin */ { debug = function() {
  20. /* nomin */ var args = Array.prototype.slice.call(arguments, 0);
  21. /* nomin */ args.unshift('SEMVER');
  22. /* nomin */ console.log.apply(console, args);
  23. /* nomin */ }; }
  24. /* nomin */ else
  25. /* nomin */ { debug = function() {}; }
  26. // Note: this is the semver.org version of the spec that it implements
  27. // Not necessarily the package version of this code.
  28. exports.SEMVER_SPEC_VERSION = '2.0.0';
  29. var MAX_LENGTH = 256;
  30. var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
  31. // Max safe segment length for coercion.
  32. var MAX_SAFE_COMPONENT_LENGTH = 16;
  33. // The actual regexps go on exports.re
  34. var re = exports.re = [];
  35. var src = exports.src = [];
  36. var R = 0;
  37. // The following Regular Expressions can be used for tokenizing,
  38. // validating, and parsing SemVer version strings.
  39. // ## Numeric Identifier
  40. // A single `0`, or a non-zero digit followed by zero or more digits.
  41. var NUMERICIDENTIFIER = R++;
  42. src[NUMERICIDENTIFIER] = '0|[1-9]\\d*';
  43. var NUMERICIDENTIFIERLOOSE = R++;
  44. src[NUMERICIDENTIFIERLOOSE] = '[0-9]+';
  45. // ## Non-numeric Identifier
  46. // Zero or more digits, followed by a letter or hyphen, and then zero or
  47. // more letters, digits, or hyphens.
  48. var NONNUMERICIDENTIFIER = R++;
  49. src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*';
  50. // ## Main Version
  51. // Three dot-separated numeric identifiers.
  52. var MAINVERSION = R++;
  53. src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' +
  54. '(' + src[NUMERICIDENTIFIER] + ')\\.' +
  55. '(' + src[NUMERICIDENTIFIER] + ')';
  56. var MAINVERSIONLOOSE = R++;
  57. src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
  58. '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
  59. '(' + src[NUMERICIDENTIFIERLOOSE] + ')';
  60. // ## Pre-release Version Identifier
  61. // A numeric identifier, or a non-numeric identifier.
  62. var PRERELEASEIDENTIFIER = R++;
  63. src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] +
  64. '|' + src[NONNUMERICIDENTIFIER] + ')';
  65. var PRERELEASEIDENTIFIERLOOSE = R++;
  66. src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] +
  67. '|' + src[NONNUMERICIDENTIFIER] + ')';
  68. // ## Pre-release Version
  69. // Hyphen, followed by one or more dot-separated pre-release version
  70. // identifiers.
  71. var PRERELEASE = R++;
  72. src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] +
  73. '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))';
  74. var PRERELEASELOOSE = R++;
  75. src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] +
  76. '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))';
  77. // ## Build Metadata Identifier
  78. // Any combination of digits, letters, or hyphens.
  79. var BUILDIDENTIFIER = R++;
  80. src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+';
  81. // ## Build Metadata
  82. // Plus sign, followed by one or more period-separated build metadata
  83. // identifiers.
  84. var BUILD = R++;
  85. src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] +
  86. '(?:\\.' + src[BUILDIDENTIFIER] + ')*))';
  87. // ## Full Version String
  88. // A main version, followed optionally by a pre-release version and
  89. // build metadata.
  90. // Note that the only major, minor, patch, and pre-release sections of
  91. // the version string are capturing groups. The build metadata is not a
  92. // capturing group, because it should not ever be used in version
  93. // comparison.
  94. var FULL = R++;
  95. var FULLPLAIN = 'v?' + src[MAINVERSION] +
  96. src[PRERELEASE] + '?' +
  97. src[BUILD] + '?';
  98. src[FULL] = '^' + FULLPLAIN + '$';
  99. // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
  100. // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
  101. // common in the npm registry.
  102. var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] +
  103. src[PRERELEASELOOSE] + '?' +
  104. src[BUILD] + '?';
  105. var LOOSE = R++;
  106. src[LOOSE] = '^' + LOOSEPLAIN + '$';
  107. var GTLT = R++;
  108. src[GTLT] = '((?:<|>)?=?)';
  109. // Something like "2.*" or "1.2.x".
  110. // Note that "x.x" is a valid xRange identifer, meaning "any version"
  111. // Only the first item is strictly required.
  112. var XRANGEIDENTIFIERLOOSE = R++;
  113. src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*';
  114. var XRANGEIDENTIFIER = R++;
  115. src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*';
  116. var XRANGEPLAIN = R++;
  117. src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' +
  118. '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
  119. '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
  120. '(?:' + src[PRERELEASE] + ')?' +
  121. src[BUILD] + '?' +
  122. ')?)?';
  123. var XRANGEPLAINLOOSE = R++;
  124. src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
  125. '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
  126. '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
  127. '(?:' + src[PRERELEASELOOSE] + ')?' +
  128. src[BUILD] + '?' +
  129. ')?)?';
  130. var XRANGE = R++;
  131. src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$';
  132. var XRANGELOOSE = R++;
  133. src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$';
  134. // Coercion.
  135. // Extract anything that could conceivably be a part of a valid semver
  136. var COERCE = R++;
  137. src[COERCE] = '(?:^|[^\\d])' +
  138. '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' +
  139. '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
  140. '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
  141. '(?:$|[^\\d])';
  142. // Tilde ranges.
  143. // Meaning is "reasonably at or greater than"
  144. var LONETILDE = R++;
  145. src[LONETILDE] = '(?:~>?)';
  146. var TILDETRIM = R++;
  147. src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+';
  148. re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g');
  149. var tildeTrimReplace = '$1~';
  150. var TILDE = R++;
  151. src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$';
  152. var TILDELOOSE = R++;
  153. src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$';
  154. // Caret ranges.
  155. // Meaning is "at least and backwards compatible with"
  156. var LONECARET = R++;
  157. src[LONECARET] = '(?:\\^)';
  158. var CARETTRIM = R++;
  159. src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+';
  160. re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g');
  161. var caretTrimReplace = '$1^';
  162. var CARET = R++;
  163. src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$';
  164. var CARETLOOSE = R++;
  165. src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$';
  166. // A simple gt/lt/eq thing, or just "" to indicate "any version"
  167. var COMPARATORLOOSE = R++;
  168. src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$';
  169. var COMPARATOR = R++;
  170. src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$';
  171. // An expression to strip any whitespace between the gtlt and the thing
  172. // it modifies, so that `> 1.2.3` ==> `>1.2.3`
  173. var COMPARATORTRIM = R++;
  174. src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] +
  175. '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')';
  176. // this one has to use the /g flag
  177. re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g');
  178. var comparatorTrimReplace = '$1$2$3';
  179. // Something like `1.2.3 - 1.2.4`
  180. // Note that these all use the loose form, because they'll be
  181. // checked against either the strict or loose comparator form
  182. // later.
  183. var HYPHENRANGE = R++;
  184. src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' +
  185. '\\s+-\\s+' +
  186. '(' + src[XRANGEPLAIN] + ')' +
  187. '\\s*$';
  188. var HYPHENRANGELOOSE = R++;
  189. src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' +
  190. '\\s+-\\s+' +
  191. '(' + src[XRANGEPLAINLOOSE] + ')' +
  192. '\\s*$';
  193. // Star ranges basically just allow anything at all.
  194. var STAR = R++;
  195. src[STAR] = '(<|>)?=?\\s*\\*';
  196. // Compile to actual regexp objects.
  197. // All are flag-free, unless they were created above with a flag.
  198. for (var i = 0; i < R; i++) {
  199. debug(i, src[i]);
  200. if (!re[i])
  201. { re[i] = new RegExp(src[i]); }
  202. }
  203. exports.parse = parse;
  204. function parse(version, options) {
  205. if (!options || typeof options !== 'object')
  206. { options = { loose: !!options, includePrerelease: false }; }
  207. if (version instanceof SemVer)
  208. { return version; }
  209. if (typeof version !== 'string')
  210. { return null; }
  211. if (version.length > MAX_LENGTH)
  212. { return null; }
  213. var r = options.loose ? re[LOOSE] : re[FULL];
  214. if (!r.test(version))
  215. { return null; }
  216. try {
  217. return new SemVer(version, options);
  218. } catch (er) {
  219. return null;
  220. }
  221. }
  222. exports.valid = valid;
  223. function valid(version, options) {
  224. var v = parse(version, options);
  225. return v ? v.version : null;
  226. }
  227. exports.clean = clean;
  228. function clean(version, options) {
  229. var s = parse(version.trim().replace(/^[=v]+/, ''), options);
  230. return s ? s.version : null;
  231. }
  232. exports.SemVer = SemVer;
  233. function SemVer(version, options) {
  234. if (!options || typeof options !== 'object')
  235. { options = { loose: !!options, includePrerelease: false }; }
  236. if (version instanceof SemVer) {
  237. if (version.loose === options.loose)
  238. { return version; }
  239. else
  240. { version = version.version; }
  241. } else if (typeof version !== 'string') {
  242. throw new TypeError('Invalid Version: ' + version);
  243. }
  244. if (version.length > MAX_LENGTH)
  245. { throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') }
  246. if (!(this instanceof SemVer))
  247. { return new SemVer(version, options); }
  248. debug('SemVer', version, options);
  249. this.options = options;
  250. this.loose = !!options.loose;
  251. var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL]);
  252. if (!m)
  253. { throw new TypeError('Invalid Version: ' + version); }
  254. this.raw = version;
  255. // these are actually numbers
  256. this.major = +m[1];
  257. this.minor = +m[2];
  258. this.patch = +m[3];
  259. if (this.major > MAX_SAFE_INTEGER || this.major < 0)
  260. { throw new TypeError('Invalid major version') }
  261. if (this.minor > MAX_SAFE_INTEGER || this.minor < 0)
  262. { throw new TypeError('Invalid minor version') }
  263. if (this.patch > MAX_SAFE_INTEGER || this.patch < 0)
  264. { throw new TypeError('Invalid patch version') }
  265. // numberify any prerelease numeric ids
  266. if (!m[4])
  267. { this.prerelease = []; }
  268. else
  269. { this.prerelease = m[4].split('.').map(function(id) {
  270. if (/^[0-9]+$/.test(id)) {
  271. var num = +id;
  272. if (num >= 0 && num < MAX_SAFE_INTEGER)
  273. { return num; }
  274. }
  275. return id;
  276. }); }
  277. this.build = m[5] ? m[5].split('.') : [];
  278. this.format();
  279. }
  280. SemVer.prototype.format = function() {
  281. this.version = this.major + '.' + this.minor + '.' + this.patch;
  282. if (this.prerelease.length)
  283. { this.version += '-' + this.prerelease.join('.'); }
  284. return this.version;
  285. };
  286. SemVer.prototype.toString = function() {
  287. return this.version;
  288. };
  289. SemVer.prototype.compare = function(other) {
  290. debug('SemVer.compare', this.version, this.options, other);
  291. if (!(other instanceof SemVer))
  292. { other = new SemVer(other, this.options); }
  293. return this.compareMain(other) || this.comparePre(other);
  294. };
  295. SemVer.prototype.compareMain = function(other) {
  296. if (!(other instanceof SemVer))
  297. { other = new SemVer(other, this.options); }
  298. return compareIdentifiers(this.major, other.major) ||
  299. compareIdentifiers(this.minor, other.minor) ||
  300. compareIdentifiers(this.patch, other.patch);
  301. };
  302. SemVer.prototype.comparePre = function(other) {
  303. var this$1 = this;
  304. if (!(other instanceof SemVer))
  305. { other = new SemVer(other, this.options); }
  306. // NOT having a prerelease is > having one
  307. if (this.prerelease.length && !other.prerelease.length)
  308. { return -1; }
  309. else if (!this.prerelease.length && other.prerelease.length)
  310. { return 1; }
  311. else if (!this.prerelease.length && !other.prerelease.length)
  312. { return 0; }
  313. var i = 0;
  314. do {
  315. var a = this$1.prerelease[i];
  316. var b = other.prerelease[i];
  317. debug('prerelease compare', i, a, b);
  318. if (a === undefined && b === undefined)
  319. { return 0; }
  320. else if (b === undefined)
  321. { return 1; }
  322. else if (a === undefined)
  323. { return -1; }
  324. else if (a === b)
  325. { continue; }
  326. else
  327. { return compareIdentifiers(a, b); }
  328. } while (++i);
  329. };
  330. // preminor will bump the version up to the next minor release, and immediately
  331. // down to pre-release. premajor and prepatch work the same way.
  332. SemVer.prototype.inc = function(release, identifier) {
  333. var this$1 = this;
  334. switch (release) {
  335. case 'premajor':
  336. this.prerelease.length = 0;
  337. this.patch = 0;
  338. this.minor = 0;
  339. this.major++;
  340. this.inc('pre', identifier);
  341. break;
  342. case 'preminor':
  343. this.prerelease.length = 0;
  344. this.patch = 0;
  345. this.minor++;
  346. this.inc('pre', identifier);
  347. break;
  348. case 'prepatch':
  349. // If this is already a prerelease, it will bump to the next version
  350. // drop any prereleases that might already exist, since they are not
  351. // relevant at this point.
  352. this.prerelease.length = 0;
  353. this.inc('patch', identifier);
  354. this.inc('pre', identifier);
  355. break;
  356. // If the input is a non-prerelease version, this acts the same as
  357. // prepatch.
  358. case 'prerelease':
  359. if (this.prerelease.length === 0)
  360. { this.inc('patch', identifier); }
  361. this.inc('pre', identifier);
  362. break;
  363. case 'major':
  364. // If this is a pre-major version, bump up to the same major version.
  365. // Otherwise increment major.
  366. // 1.0.0-5 bumps to 1.0.0
  367. // 1.1.0 bumps to 2.0.0
  368. if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0)
  369. { this.major++; }
  370. this.minor = 0;
  371. this.patch = 0;
  372. this.prerelease = [];
  373. break;
  374. case 'minor':
  375. // If this is a pre-minor version, bump up to the same minor version.
  376. // Otherwise increment minor.
  377. // 1.2.0-5 bumps to 1.2.0
  378. // 1.2.1 bumps to 1.3.0
  379. if (this.patch !== 0 || this.prerelease.length === 0)
  380. { this.minor++; }
  381. this.patch = 0;
  382. this.prerelease = [];
  383. break;
  384. case 'patch':
  385. // If this is not a pre-release version, it will increment the patch.
  386. // If it is a pre-release it will bump up to the same patch version.
  387. // 1.2.0-5 patches to 1.2.0
  388. // 1.2.0 patches to 1.2.1
  389. if (this.prerelease.length === 0)
  390. { this.patch++; }
  391. this.prerelease = [];
  392. break;
  393. // This probably shouldn't be used publicly.
  394. // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
  395. case 'pre':
  396. if (this.prerelease.length === 0)
  397. { this.prerelease = [0]; }
  398. else {
  399. var i = this.prerelease.length;
  400. while (--i >= 0) {
  401. if (typeof this$1.prerelease[i] === 'number') {
  402. this$1.prerelease[i]++;
  403. i = -2;
  404. }
  405. }
  406. if (i === -1) // didn't increment anything
  407. { this.prerelease.push(0); }
  408. }
  409. if (identifier) {
  410. // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
  411. // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
  412. if (this.prerelease[0] === identifier) {
  413. if (isNaN(this.prerelease[1]))
  414. { this.prerelease = [identifier, 0]; }
  415. } else
  416. { this.prerelease = [identifier, 0]; }
  417. }
  418. break;
  419. default:
  420. throw new Error('invalid increment argument: ' + release);
  421. }
  422. this.format();
  423. this.raw = this.version;
  424. return this;
  425. };
  426. exports.inc = inc;
  427. function inc(version, release, loose, identifier) {
  428. if (typeof(loose) === 'string') {
  429. identifier = loose;
  430. loose = undefined;
  431. }
  432. try {
  433. return new SemVer(version, loose).inc(release, identifier).version;
  434. } catch (er) {
  435. return null;
  436. }
  437. }
  438. exports.diff = diff;
  439. function diff(version1, version2) {
  440. if (eq(version1, version2)) {
  441. return null;
  442. } else {
  443. var v1 = parse(version1);
  444. var v2 = parse(version2);
  445. if (v1.prerelease.length || v2.prerelease.length) {
  446. for (var key in v1) {
  447. if (key === 'major' || key === 'minor' || key === 'patch') {
  448. if (v1[key] !== v2[key]) {
  449. return 'pre'+key;
  450. }
  451. }
  452. }
  453. return 'prerelease';
  454. }
  455. for (var key in v1) {
  456. if (key === 'major' || key === 'minor' || key === 'patch') {
  457. if (v1[key] !== v2[key]) {
  458. return key;
  459. }
  460. }
  461. }
  462. }
  463. }
  464. exports.compareIdentifiers = compareIdentifiers;
  465. var numeric = /^[0-9]+$/;
  466. function compareIdentifiers(a, b) {
  467. var anum = numeric.test(a);
  468. var bnum = numeric.test(b);
  469. if (anum && bnum) {
  470. a = +a;
  471. b = +b;
  472. }
  473. return (anum && !bnum) ? -1 :
  474. (bnum && !anum) ? 1 :
  475. a < b ? -1 :
  476. a > b ? 1 :
  477. 0;
  478. }
  479. exports.rcompareIdentifiers = rcompareIdentifiers;
  480. function rcompareIdentifiers(a, b) {
  481. return compareIdentifiers(b, a);
  482. }
  483. exports.major = major;
  484. function major(a, loose) {
  485. return new SemVer(a, loose).major;
  486. }
  487. exports.minor = minor;
  488. function minor(a, loose) {
  489. return new SemVer(a, loose).minor;
  490. }
  491. exports.patch = patch;
  492. function patch(a, loose) {
  493. return new SemVer(a, loose).patch;
  494. }
  495. exports.compare = compare;
  496. function compare(a, b, loose) {
  497. return new SemVer(a, loose).compare(new SemVer(b, loose));
  498. }
  499. exports.compareLoose = compareLoose;
  500. function compareLoose(a, b) {
  501. return compare(a, b, true);
  502. }
  503. exports.rcompare = rcompare;
  504. function rcompare(a, b, loose) {
  505. return compare(b, a, loose);
  506. }
  507. exports.sort = sort;
  508. function sort(list, loose) {
  509. return list.sort(function(a, b) {
  510. return exports.compare(a, b, loose);
  511. });
  512. }
  513. exports.rsort = rsort;
  514. function rsort(list, loose) {
  515. return list.sort(function(a, b) {
  516. return exports.rcompare(a, b, loose);
  517. });
  518. }
  519. exports.gt = gt;
  520. function gt(a, b, loose) {
  521. return compare(a, b, loose) > 0;
  522. }
  523. exports.lt = lt;
  524. function lt(a, b, loose) {
  525. return compare(a, b, loose) < 0;
  526. }
  527. exports.eq = eq;
  528. function eq(a, b, loose) {
  529. return compare(a, b, loose) === 0;
  530. }
  531. exports.neq = neq;
  532. function neq(a, b, loose) {
  533. return compare(a, b, loose) !== 0;
  534. }
  535. exports.gte = gte;
  536. function gte(a, b, loose) {
  537. return compare(a, b, loose) >= 0;
  538. }
  539. exports.lte = lte;
  540. function lte(a, b, loose) {
  541. return compare(a, b, loose) <= 0;
  542. }
  543. exports.cmp = cmp;
  544. function cmp(a, op, b, loose) {
  545. var ret;
  546. switch (op) {
  547. case '===':
  548. if (typeof a === 'object') { a = a.version; }
  549. if (typeof b === 'object') { b = b.version; }
  550. ret = a === b;
  551. break;
  552. case '!==':
  553. if (typeof a === 'object') { a = a.version; }
  554. if (typeof b === 'object') { b = b.version; }
  555. ret = a !== b;
  556. break;
  557. case '': case '=': case '==': ret = eq(a, b, loose); break;
  558. case '!=': ret = neq(a, b, loose); break;
  559. case '>': ret = gt(a, b, loose); break;
  560. case '>=': ret = gte(a, b, loose); break;
  561. case '<': ret = lt(a, b, loose); break;
  562. case '<=': ret = lte(a, b, loose); break;
  563. default: throw new TypeError('Invalid operator: ' + op);
  564. }
  565. return ret;
  566. }
  567. exports.Comparator = Comparator;
  568. function Comparator(comp, options) {
  569. if (!options || typeof options !== 'object')
  570. { options = { loose: !!options, includePrerelease: false }; }
  571. if (comp instanceof Comparator) {
  572. if (comp.loose === !!options.loose)
  573. { return comp; }
  574. else
  575. { comp = comp.value; }
  576. }
  577. if (!(this instanceof Comparator))
  578. { return new Comparator(comp, options); }
  579. debug('comparator', comp, options);
  580. this.options = options;
  581. this.loose = !!options.loose;
  582. this.parse(comp);
  583. if (this.semver === ANY)
  584. { this.value = ''; }
  585. else
  586. { this.value = this.operator + this.semver.version; }
  587. debug('comp', this);
  588. }
  589. var ANY = {};
  590. Comparator.prototype.parse = function(comp) {
  591. var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
  592. var m = comp.match(r);
  593. if (!m)
  594. { throw new TypeError('Invalid comparator: ' + comp); }
  595. this.operator = m[1];
  596. if (this.operator === '=')
  597. { this.operator = ''; }
  598. // if it literally is just '>' or '' then allow anything.
  599. if (!m[2])
  600. { this.semver = ANY; }
  601. else
  602. { this.semver = new SemVer(m[2], this.options.loose); }
  603. };
  604. Comparator.prototype.toString = function() {
  605. return this.value;
  606. };
  607. Comparator.prototype.test = function(version) {
  608. debug('Comparator.test', version, this.options.loose);
  609. if (this.semver === ANY)
  610. { return true; }
  611. if (typeof version === 'string')
  612. { version = new SemVer(version, this.options); }
  613. return cmp(version, this.operator, this.semver, this.options);
  614. };
  615. Comparator.prototype.intersects = function(comp, options) {
  616. if (!(comp instanceof Comparator)) {
  617. throw new TypeError('a Comparator is required');
  618. }
  619. if (!options || typeof options !== 'object')
  620. { options = { loose: !!options, includePrerelease: false }; }
  621. var rangeTmp;
  622. if (this.operator === '') {
  623. rangeTmp = new Range(comp.value, options);
  624. return satisfies(this.value, rangeTmp, options);
  625. } else if (comp.operator === '') {
  626. rangeTmp = new Range(this.value, options);
  627. return satisfies(comp.semver, rangeTmp, options);
  628. }
  629. var sameDirectionIncreasing =
  630. (this.operator === '>=' || this.operator === '>') &&
  631. (comp.operator === '>=' || comp.operator === '>');
  632. var sameDirectionDecreasing =
  633. (this.operator === '<=' || this.operator === '<') &&
  634. (comp.operator === '<=' || comp.operator === '<');
  635. var sameSemVer = this.semver.version === comp.semver.version;
  636. var differentDirectionsInclusive =
  637. (this.operator === '>=' || this.operator === '<=') &&
  638. (comp.operator === '>=' || comp.operator === '<=');
  639. var oppositeDirectionsLessThan =
  640. cmp(this.semver, '<', comp.semver, options) &&
  641. ((this.operator === '>=' || this.operator === '>') &&
  642. (comp.operator === '<=' || comp.operator === '<'));
  643. var oppositeDirectionsGreaterThan =
  644. cmp(this.semver, '>', comp.semver, options) &&
  645. ((this.operator === '<=' || this.operator === '<') &&
  646. (comp.operator === '>=' || comp.operator === '>'));
  647. return sameDirectionIncreasing || sameDirectionDecreasing ||
  648. (sameSemVer && differentDirectionsInclusive) ||
  649. oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
  650. };
  651. exports.Range = Range;
  652. function Range(range, options) {
  653. if (!options || typeof options !== 'object')
  654. { options = { loose: !!options, includePrerelease: false }; }
  655. if (range instanceof Range) {
  656. if (range.loose === !!options.loose &&
  657. range.includePrerelease === !!options.includePrerelease) {
  658. return range;
  659. } else {
  660. return new Range(range.raw, options);
  661. }
  662. }
  663. if (range instanceof Comparator) {
  664. return new Range(range.value, options);
  665. }
  666. if (!(this instanceof Range))
  667. { return new Range(range, options); }
  668. this.options = options;
  669. this.loose = !!options.loose;
  670. this.includePrerelease = !!options.includePrerelease;
  671. // First, split based on boolean or ||
  672. this.raw = range;
  673. this.set = range.split(/\s*\|\|\s*/).map(function(range) {
  674. return this.parseRange(range.trim());
  675. }, this).filter(function(c) {
  676. // throw out any that are not relevant for whatever reason
  677. return c.length;
  678. });
  679. if (!this.set.length) {
  680. throw new TypeError('Invalid SemVer Range: ' + range);
  681. }
  682. this.format();
  683. }
  684. Range.prototype.format = function() {
  685. this.range = this.set.map(function(comps) {
  686. return comps.join(' ').trim();
  687. }).join('||').trim();
  688. return this.range;
  689. };
  690. Range.prototype.toString = function() {
  691. return this.range;
  692. };
  693. Range.prototype.parseRange = function(range) {
  694. var loose = this.options.loose;
  695. range = range.trim();
  696. // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
  697. var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE];
  698. range = range.replace(hr, hyphenReplace);
  699. debug('hyphen replace', range);
  700. // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
  701. range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace);
  702. debug('comparator trim', range, re[COMPARATORTRIM]);
  703. // `~ 1.2.3` => `~1.2.3`
  704. range = range.replace(re[TILDETRIM], tildeTrimReplace);
  705. // `^ 1.2.3` => `^1.2.3`
  706. range = range.replace(re[CARETTRIM], caretTrimReplace);
  707. // normalize spaces
  708. range = range.split(/\s+/).join(' ');
  709. // At this point, the range is completely trimmed and
  710. // ready to be split into comparators.
  711. var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
  712. var set = range.split(' ').map(function(comp) {
  713. return parseComparator(comp, this.options);
  714. }, this).join(' ').split(/\s+/);
  715. if (this.options.loose) {
  716. // in loose mode, throw out any that are not valid comparators
  717. set = set.filter(function(comp) {
  718. return !!comp.match(compRe);
  719. });
  720. }
  721. set = set.map(function(comp) {
  722. return new Comparator(comp, this.options);
  723. }, this);
  724. return set;
  725. };
  726. Range.prototype.intersects = function(range, options) {
  727. if (!(range instanceof Range)) {
  728. throw new TypeError('a Range is required');
  729. }
  730. return this.set.some(function(thisComparators) {
  731. return thisComparators.every(function(thisComparator) {
  732. return range.set.some(function(rangeComparators) {
  733. return rangeComparators.every(function(rangeComparator) {
  734. return thisComparator.intersects(rangeComparator, options);
  735. });
  736. });
  737. });
  738. });
  739. };
  740. // Mostly just for testing and legacy API reasons
  741. exports.toComparators = toComparators;
  742. function toComparators(range, options) {
  743. return new Range(range, options).set.map(function(comp) {
  744. return comp.map(function(c) {
  745. return c.value;
  746. }).join(' ').trim().split(' ');
  747. });
  748. }
  749. // comprised of xranges, tildes, stars, and gtlt's at this point.
  750. // already replaced the hyphen ranges
  751. // turn into a set of JUST comparators.
  752. function parseComparator(comp, options) {
  753. debug('comp', comp, options);
  754. comp = replaceCarets(comp, options);
  755. debug('caret', comp);
  756. comp = replaceTildes(comp, options);
  757. debug('tildes', comp);
  758. comp = replaceXRanges(comp, options);
  759. debug('xrange', comp);
  760. comp = replaceStars(comp, options);
  761. debug('stars', comp);
  762. return comp;
  763. }
  764. function isX(id) {
  765. return !id || id.toLowerCase() === 'x' || id === '*';
  766. }
  767. // ~, ~> --> * (any, kinda silly)
  768. // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
  769. // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
  770. // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
  771. // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
  772. // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
  773. function replaceTildes(comp, options) {
  774. return comp.trim().split(/\s+/).map(function(comp) {
  775. return replaceTilde(comp, options);
  776. }).join(' ');
  777. }
  778. function replaceTilde(comp, options) {
  779. if (!options || typeof options !== 'object')
  780. { options = { loose: !!options, includePrerelease: false }; }
  781. var r = options.loose ? re[TILDELOOSE] : re[TILDE];
  782. return comp.replace(r, function(_, M, m, p, pr) {
  783. debug('tilde', comp, _, M, m, p, pr);
  784. var ret;
  785. if (isX(M))
  786. { ret = ''; }
  787. else if (isX(m))
  788. { ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; }
  789. else if (isX(p))
  790. // ~1.2 == >=1.2.0 <1.3.0
  791. { ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; }
  792. else if (pr) {
  793. debug('replaceTilde pr', pr);
  794. if (pr.charAt(0) !== '-')
  795. { pr = '-' + pr; }
  796. ret = '>=' + M + '.' + m + '.' + p + pr +
  797. ' <' + M + '.' + (+m + 1) + '.0';
  798. } else
  799. // ~1.2.3 == >=1.2.3 <1.3.0
  800. { ret = '>=' + M + '.' + m + '.' + p +
  801. ' <' + M + '.' + (+m + 1) + '.0'; }
  802. debug('tilde return', ret);
  803. return ret;
  804. });
  805. }
  806. // ^ --> * (any, kinda silly)
  807. // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
  808. // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
  809. // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
  810. // ^1.2.3 --> >=1.2.3 <2.0.0
  811. // ^1.2.0 --> >=1.2.0 <2.0.0
  812. function replaceCarets(comp, options) {
  813. return comp.trim().split(/\s+/).map(function(comp) {
  814. return replaceCaret(comp, options);
  815. }).join(' ');
  816. }
  817. function replaceCaret(comp, options) {
  818. debug('caret', comp, options);
  819. if (!options || typeof options !== 'object')
  820. { options = { loose: !!options, includePrerelease: false }; }
  821. var r = options.loose ? re[CARETLOOSE] : re[CARET];
  822. return comp.replace(r, function(_, M, m, p, pr) {
  823. debug('caret', comp, _, M, m, p, pr);
  824. var ret;
  825. if (isX(M))
  826. { ret = ''; }
  827. else if (isX(m))
  828. { ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; }
  829. else if (isX(p)) {
  830. if (M === '0')
  831. { ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; }
  832. else
  833. { ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'; }
  834. } else if (pr) {
  835. debug('replaceCaret pr', pr);
  836. if (pr.charAt(0) !== '-')
  837. { pr = '-' + pr; }
  838. if (M === '0') {
  839. if (m === '0')
  840. { ret = '>=' + M + '.' + m + '.' + p + pr +
  841. ' <' + M + '.' + m + '.' + (+p + 1); }
  842. else
  843. { ret = '>=' + M + '.' + m + '.' + p + pr +
  844. ' <' + M + '.' + (+m + 1) + '.0'; }
  845. } else
  846. { ret = '>=' + M + '.' + m + '.' + p + pr +
  847. ' <' + (+M + 1) + '.0.0'; }
  848. } else {
  849. debug('no pr');
  850. if (M === '0') {
  851. if (m === '0')
  852. { ret = '>=' + M + '.' + m + '.' + p +
  853. ' <' + M + '.' + m + '.' + (+p + 1); }
  854. else
  855. { ret = '>=' + M + '.' + m + '.' + p +
  856. ' <' + M + '.' + (+m + 1) + '.0'; }
  857. } else
  858. { ret = '>=' + M + '.' + m + '.' + p +
  859. ' <' + (+M + 1) + '.0.0'; }
  860. }
  861. debug('caret return', ret);
  862. return ret;
  863. });
  864. }
  865. function replaceXRanges(comp, options) {
  866. debug('replaceXRanges', comp, options);
  867. return comp.split(/\s+/).map(function(comp) {
  868. return replaceXRange(comp, options);
  869. }).join(' ');
  870. }
  871. function replaceXRange(comp, options) {
  872. comp = comp.trim();
  873. if (!options || typeof options !== 'object')
  874. { options = { loose: !!options, includePrerelease: false }; }
  875. var r = options.loose ? re[XRANGELOOSE] : re[XRANGE];
  876. return comp.replace(r, function(ret, gtlt, M, m, p, pr) {
  877. debug('xRange', comp, ret, gtlt, M, m, p, pr);
  878. var xM = isX(M);
  879. var xm = xM || isX(m);
  880. var xp = xm || isX(p);
  881. var anyX = xp;
  882. if (gtlt === '=' && anyX)
  883. { gtlt = ''; }
  884. if (xM) {
  885. if (gtlt === '>' || gtlt === '<') {
  886. // nothing is allowed
  887. ret = '<0.0.0';
  888. } else {
  889. // nothing is forbidden
  890. ret = '*';
  891. }
  892. } else if (gtlt && anyX) {
  893. // replace X with 0
  894. if (xm)
  895. { m = 0; }
  896. if (xp)
  897. { p = 0; }
  898. if (gtlt === '>') {
  899. // >1 => >=2.0.0
  900. // >1.2 => >=1.3.0
  901. // >1.2.3 => >= 1.2.4
  902. gtlt = '>=';
  903. if (xm) {
  904. M = +M + 1;
  905. m = 0;
  906. p = 0;
  907. } else if (xp) {
  908. m = +m + 1;
  909. p = 0;
  910. }
  911. } else if (gtlt === '<=') {
  912. // <=0.7.x is actually <0.8.0, since any 0.7.x should
  913. // pass. Similarly, <=7.x is actually <8.0.0, etc.
  914. gtlt = '<';
  915. if (xm)
  916. { M = +M + 1; }
  917. else
  918. { m = +m + 1; }
  919. }
  920. ret = gtlt + M + '.' + m + '.' + p;
  921. } else if (xm) {
  922. ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
  923. } else if (xp) {
  924. ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
  925. }
  926. debug('xRange return', ret);
  927. return ret;
  928. });
  929. }
  930. // Because * is AND-ed with everything else in the comparator,
  931. // and '' means "any version", just remove the *s entirely.
  932. function replaceStars(comp, options) {
  933. debug('replaceStars', comp, options);
  934. // Looseness is ignored here. star is always as loose as it gets!
  935. return comp.trim().replace(re[STAR], '');
  936. }
  937. // This function is passed to string.replace(re[HYPHENRANGE])
  938. // M, m, patch, prerelease, build
  939. // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
  940. // 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
  941. // 1.2 - 3.4 => >=1.2.0 <3.5.0
  942. function hyphenReplace($0,
  943. from, fM, fm, fp, fpr, fb,
  944. to, tM, tm, tp, tpr, tb) {
  945. if (isX(fM))
  946. { from = ''; }
  947. else if (isX(fm))
  948. { from = '>=' + fM + '.0.0'; }
  949. else if (isX(fp))
  950. { from = '>=' + fM + '.' + fm + '.0'; }
  951. else
  952. { from = '>=' + from; }
  953. if (isX(tM))
  954. { to = ''; }
  955. else if (isX(tm))
  956. { to = '<' + (+tM + 1) + '.0.0'; }
  957. else if (isX(tp))
  958. { to = '<' + tM + '.' + (+tm + 1) + '.0'; }
  959. else if (tpr)
  960. { to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr; }
  961. else
  962. { to = '<=' + to; }
  963. return (from + ' ' + to).trim();
  964. }
  965. // if ANY of the sets match ALL of its comparators, then pass
  966. Range.prototype.test = function(version) {
  967. var this$1 = this;
  968. if (!version)
  969. { return false; }
  970. if (typeof version === 'string')
  971. { version = new SemVer(version, this.options); }
  972. for (var i = 0; i < this.set.length; i++) {
  973. if (testSet(this$1.set[i], version, this$1.options))
  974. { return true; }
  975. }
  976. return false;
  977. };
  978. function testSet(set, version, options) {
  979. for (var i = 0; i < set.length; i++) {
  980. if (!set[i].test(version))
  981. { return false; }
  982. }
  983. if (!options)
  984. { options = {}; }
  985. if (version.prerelease.length && !options.includePrerelease) {
  986. // Find the set of versions that are allowed to have prereleases
  987. // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
  988. // That should allow `1.2.3-pr.2` to pass.
  989. // However, `1.2.4-alpha.notready` should NOT be allowed,
  990. // even though it's within the range set by the comparators.
  991. for (var i = 0; i < set.length; i++) {
  992. debug(set[i].semver);
  993. if (set[i].semver === ANY)
  994. { continue; }
  995. if (set[i].semver.prerelease.length > 0) {
  996. var allowed = set[i].semver;
  997. if (allowed.major === version.major &&
  998. allowed.minor === version.minor &&
  999. allowed.patch === version.patch)
  1000. { return true; }
  1001. }
  1002. }
  1003. // Version has a -pre, but it's not one of the ones we like.
  1004. return false;
  1005. }
  1006. return true;
  1007. }
  1008. exports.satisfies = satisfies;
  1009. function satisfies(version, range, options) {
  1010. try {
  1011. range = new Range(range, options);
  1012. } catch (er) {
  1013. return false;
  1014. }
  1015. return range.test(version);
  1016. }
  1017. exports.maxSatisfying = maxSatisfying;
  1018. function maxSatisfying(versions, range, options) {
  1019. var max = null;
  1020. var maxSV = null;
  1021. try {
  1022. var rangeObj = new Range(range, options);
  1023. } catch (er) {
  1024. return null;
  1025. }
  1026. versions.forEach(function (v) {
  1027. if (rangeObj.test(v)) { // satisfies(v, range, options)
  1028. if (!max || maxSV.compare(v) === -1) { // compare(max, v, true)
  1029. max = v;
  1030. maxSV = new SemVer(max, options);
  1031. }
  1032. }
  1033. });
  1034. return max;
  1035. }
  1036. exports.minSatisfying = minSatisfying;
  1037. function minSatisfying(versions, range, options) {
  1038. var min = null;
  1039. var minSV = null;
  1040. try {
  1041. var rangeObj = new Range(range, options);
  1042. } catch (er) {
  1043. return null;
  1044. }
  1045. versions.forEach(function (v) {
  1046. if (rangeObj.test(v)) { // satisfies(v, range, options)
  1047. if (!min || minSV.compare(v) === 1) { // compare(min, v, true)
  1048. min = v;
  1049. minSV = new SemVer(min, options);
  1050. }
  1051. }
  1052. });
  1053. return min;
  1054. }
  1055. exports.validRange = validRange;
  1056. function validRange(range, options) {
  1057. try {
  1058. // Return '*' instead of '' so that truthiness works.
  1059. // This will throw if it's invalid anyway
  1060. return new Range(range, options).range || '*';
  1061. } catch (er) {
  1062. return null;
  1063. }
  1064. }
  1065. // Determine if version is less than all the versions possible in the range
  1066. exports.ltr = ltr;
  1067. function ltr(version, range, options) {
  1068. return outside(version, range, '<', options);
  1069. }
  1070. // Determine if version is greater than all the versions possible in the range.
  1071. exports.gtr = gtr;
  1072. function gtr(version, range, options) {
  1073. return outside(version, range, '>', options);
  1074. }
  1075. exports.outside = outside;
  1076. function outside(version, range, hilo, options) {
  1077. version = new SemVer(version, options);
  1078. range = new Range(range, options);
  1079. var gtfn, ltefn, ltfn, comp, ecomp;
  1080. switch (hilo) {
  1081. case '>':
  1082. gtfn = gt;
  1083. ltefn = lte;
  1084. ltfn = lt;
  1085. comp = '>';
  1086. ecomp = '>=';
  1087. break;
  1088. case '<':
  1089. gtfn = lt;
  1090. ltefn = gte;
  1091. ltfn = gt;
  1092. comp = '<';
  1093. ecomp = '<=';
  1094. break;
  1095. default:
  1096. throw new TypeError('Must provide a hilo val of "<" or ">"');
  1097. }
  1098. // If it satisifes the range it is not outside
  1099. if (satisfies(version, range, options)) {
  1100. return false;
  1101. }
  1102. // From now on, variable terms are as if we're in "gtr" mode.
  1103. // but note that everything is flipped for the "ltr" function.
  1104. for (var i = 0; i < range.set.length; ++i) {
  1105. var comparators = range.set[i];
  1106. var high = null;
  1107. var low = null;
  1108. comparators.forEach(function(comparator) {
  1109. if (comparator.semver === ANY) {
  1110. comparator = new Comparator('>=0.0.0');
  1111. }
  1112. high = high || comparator;
  1113. low = low || comparator;
  1114. if (gtfn(comparator.semver, high.semver, options)) {
  1115. high = comparator;
  1116. } else if (ltfn(comparator.semver, low.semver, options)) {
  1117. low = comparator;
  1118. }
  1119. });
  1120. // If the edge version comparator has a operator then our version
  1121. // isn't outside it
  1122. if (high.operator === comp || high.operator === ecomp) {
  1123. return false;
  1124. }
  1125. // If the lowest version comparator has an operator and our version
  1126. // is less than it then it isn't higher than the range
  1127. if ((!low.operator || low.operator === comp) &&
  1128. ltefn(version, low.semver)) {
  1129. return false;
  1130. } else if (low.operator === ecomp && ltfn(version, low.semver)) {
  1131. return false;
  1132. }
  1133. }
  1134. return true;
  1135. }
  1136. exports.prerelease = prerelease;
  1137. function prerelease(version, options) {
  1138. var parsed = parse(version, options);
  1139. return (parsed && parsed.prerelease.length) ? parsed.prerelease : null;
  1140. }
  1141. exports.intersects = intersects;
  1142. function intersects(r1, r2, options) {
  1143. r1 = new Range(r1, options);
  1144. r2 = new Range(r2, options);
  1145. return r1.intersects(r2)
  1146. }
  1147. exports.coerce = coerce;
  1148. function coerce(version) {
  1149. if (version instanceof SemVer)
  1150. { return version; }
  1151. if (typeof version !== 'string')
  1152. { return null; }
  1153. var match = version.match(re[COERCE]);
  1154. if (match == null)
  1155. { return null; }
  1156. return parse((match[1] || '0') + '.' + (match[2] || '0') + '.' + (match[3] || '0'));
  1157. }
  1158. });
  1159. var semver_1 = semver.SEMVER_SPEC_VERSION;
  1160. var semver_2 = semver.re;
  1161. var semver_3 = semver.src;
  1162. var semver_4 = semver.parse;
  1163. var semver_5 = semver.valid;
  1164. var semver_6 = semver.clean;
  1165. var semver_7 = semver.SemVer;
  1166. var semver_8 = semver.inc;
  1167. var semver_9 = semver.diff;
  1168. var semver_10 = semver.compareIdentifiers;
  1169. var semver_11 = semver.rcompareIdentifiers;
  1170. var semver_12 = semver.major;
  1171. var semver_13 = semver.minor;
  1172. var semver_14 = semver.patch;
  1173. var semver_15 = semver.compare;
  1174. var semver_16 = semver.compareLoose;
  1175. var semver_17 = semver.rcompare;
  1176. var semver_18 = semver.sort;
  1177. var semver_19 = semver.rsort;
  1178. var semver_20 = semver.gt;
  1179. var semver_21 = semver.lt;
  1180. var semver_22 = semver.eq;
  1181. var semver_23 = semver.neq;
  1182. var semver_24 = semver.gte;
  1183. var semver_25 = semver.lte;
  1184. var semver_26 = semver.cmp;
  1185. var semver_27 = semver.Comparator;
  1186. var semver_28 = semver.Range;
  1187. var semver_29 = semver.toComparators;
  1188. var semver_30 = semver.satisfies;
  1189. var semver_31 = semver.maxSatisfying;
  1190. var semver_32 = semver.minSatisfying;
  1191. var semver_33 = semver.validRange;
  1192. var semver_34 = semver.ltr;
  1193. var semver_35 = semver.gtr;
  1194. var semver_36 = semver.outside;
  1195. var semver_37 = semver.prerelease;
  1196. var semver_38 = semver.intersects;
  1197. var semver_39 = semver.coerce;
  1198. //
  1199. function throwError(msg) {
  1200. throw new Error(("[vue-test-utils]: " + msg))
  1201. }
  1202. function warn(msg) {
  1203. console.error(("[vue-test-utils]: " + msg));
  1204. }
  1205. var camelizeRE = /-(\w)/g;
  1206. var camelize = function (str) {
  1207. var camelizedStr = str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; }
  1208. );
  1209. return camelizedStr.charAt(0).toLowerCase() + camelizedStr.slice(1)
  1210. };
  1211. /**
  1212. * Capitalize a string.
  1213. */
  1214. var capitalize = function (str) { return str.charAt(0).toUpperCase() + str.slice(1); };
  1215. /**
  1216. * Hyphenate a camelCase string.
  1217. */
  1218. var hyphenateRE = /\B([A-Z])/g;
  1219. var hyphenate = function (str) { return str.replace(hyphenateRE, '-$1').toLowerCase(); };
  1220. function hasOwnProperty(obj, prop) {
  1221. return Object.prototype.hasOwnProperty.call(obj, prop)
  1222. }
  1223. function resolveComponent(id, components) {
  1224. if (typeof id !== 'string') {
  1225. return
  1226. }
  1227. // check local registration variations first
  1228. if (hasOwnProperty(components, id)) {
  1229. return components[id]
  1230. }
  1231. var camelizedId = camelize(id);
  1232. if (hasOwnProperty(components, camelizedId)) {
  1233. return components[camelizedId]
  1234. }
  1235. var PascalCaseId = capitalize(camelizedId);
  1236. if (hasOwnProperty(components, PascalCaseId)) {
  1237. return components[PascalCaseId]
  1238. }
  1239. // fallback to prototype chain
  1240. return components[id] || components[camelizedId] || components[PascalCaseId]
  1241. }
  1242. var UA =
  1243. typeof window !== 'undefined' &&
  1244. 'navigator' in window &&
  1245. navigator.userAgent.toLowerCase();
  1246. var isPhantomJS = UA && UA.includes && UA.match(/phantomjs/i);
  1247. var isEdge = UA && UA.indexOf('edge/') > 0;
  1248. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  1249. // get the event used to trigger v-model handler that updates bound data
  1250. function getCheckedEvent() {
  1251. var version = Vue.version;
  1252. if (semver.satisfies(version, '2.1.9 - 2.1.10')) {
  1253. return 'click'
  1254. }
  1255. if (semver.satisfies(version, '2.2 - 2.4')) {
  1256. return isChrome ? 'click' : 'change'
  1257. }
  1258. // change is handler for version 2.0 - 2.1.8, and 2.5+
  1259. return 'change'
  1260. }
  1261. //
  1262. function isDomSelector(selector) {
  1263. if (typeof selector !== 'string') {
  1264. return false
  1265. }
  1266. try {
  1267. if (typeof document === 'undefined') {
  1268. throwError(
  1269. "mount must be run in a browser environment like " +
  1270. "PhantomJS, jsdom or chrome"
  1271. );
  1272. }
  1273. } catch (error) {
  1274. throwError(
  1275. "mount must be run in a browser environment like " +
  1276. "PhantomJS, jsdom or chrome"
  1277. );
  1278. }
  1279. try {
  1280. document.querySelector(selector);
  1281. return true
  1282. } catch (error) {
  1283. return false
  1284. }
  1285. }
  1286. function isVueComponent(c) {
  1287. if (isConstructor(c)) {
  1288. return true
  1289. }
  1290. if (c === null || typeof c !== 'object') {
  1291. return false
  1292. }
  1293. if (c.extends || c._Ctor) {
  1294. return true
  1295. }
  1296. if (typeof c.template === 'string') {
  1297. return true
  1298. }
  1299. return typeof c.render === 'function'
  1300. }
  1301. function componentNeedsCompiling(component) {
  1302. return (
  1303. component &&
  1304. !component.render &&
  1305. (component.template || component.extends || component.extendOptions) &&
  1306. !component.functional
  1307. )
  1308. }
  1309. function isRefSelector(refOptionsObject) {
  1310. if (
  1311. typeof refOptionsObject !== 'object' ||
  1312. Object.keys(refOptionsObject || {}).length !== 1
  1313. ) {
  1314. return false
  1315. }
  1316. return typeof refOptionsObject.ref === 'string'
  1317. }
  1318. function isNameSelector(nameOptionsObject) {
  1319. if (typeof nameOptionsObject !== 'object' || nameOptionsObject === null) {
  1320. return false
  1321. }
  1322. return !!nameOptionsObject.name
  1323. }
  1324. function isConstructor(c) {
  1325. return typeof c === 'function' && c.cid
  1326. }
  1327. function isDynamicComponent(c) {
  1328. return typeof c === 'function' && !c.cid
  1329. }
  1330. function isComponentOptions(c) {
  1331. return typeof c === 'object' && (c.template || c.render)
  1332. }
  1333. function isFunctionalComponent(c) {
  1334. if (!isVueComponent(c)) {
  1335. return false
  1336. }
  1337. if (isConstructor(c)) {
  1338. return c.options.functional
  1339. }
  1340. return c.functional
  1341. }
  1342. function templateContainsComponent(
  1343. template,
  1344. name
  1345. ) {
  1346. return [capitalize, camelize, hyphenate].some(function (format) {
  1347. var re = new RegExp(("<" + (format(name)) + "\\s*(\\s|>|(/>))"), 'g');
  1348. return re.test(template)
  1349. })
  1350. }
  1351. function isPlainObject(c) {
  1352. return Object.prototype.toString.call(c) === '[object Object]'
  1353. }
  1354. function makeMap(str, expectsLowerCase) {
  1355. var map = Object.create(null);
  1356. var list = str.split(',');
  1357. for (var i = 0; i < list.length; i++) {
  1358. map[list[i]] = true;
  1359. }
  1360. return expectsLowerCase
  1361. ? function(val) {
  1362. return map[val.toLowerCase()]
  1363. }
  1364. : function(val) {
  1365. return map[val]
  1366. }
  1367. }
  1368. var isHTMLTag = makeMap(
  1369. 'html,body,base,head,link,meta,style,title,' +
  1370. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  1371. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  1372. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  1373. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,' +
  1374. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  1375. 'caption,col,colgroup,table,thead,tbody,td,th,tr,video,' +
  1376. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  1377. 'output,progress,select,textarea,' +
  1378. 'details,dialog,menu,menuitem,summary,' +
  1379. 'content,element,shadow,template,blockquote,iframe,tfoot'
  1380. );
  1381. // this map is intentionally selective, only covering SVG elements that may
  1382. // contain child elements.
  1383. var isSVG = makeMap(
  1384. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  1385. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  1386. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  1387. true
  1388. );
  1389. var isReservedTag = function (tag) { return isHTMLTag(tag) || isSVG(tag); };
  1390. var NAME_SELECTOR = 'NAME_SELECTOR';
  1391. var COMPONENT_SELECTOR = 'COMPONENT_SELECTOR';
  1392. var REF_SELECTOR = 'REF_SELECTOR';
  1393. var DOM_SELECTOR = 'DOM_SELECTOR';
  1394. var INVALID_SELECTOR = 'INVALID_SELECTOR';
  1395. var COMPAT_SYNC_MODE = 'COMPAT_SYNC_MODE';
  1396. var VUE_VERSION = Number(
  1397. ((Vue.version.split('.')[0]) + "." + (Vue.version.split('.')[1]))
  1398. );
  1399. var FUNCTIONAL_OPTIONS =
  1400. VUE_VERSION >= 2.5 ? 'fnOptions' : 'functionalOptions';
  1401. var BEFORE_RENDER_LIFECYCLE_HOOK = semver.gt(Vue.version, '2.1.8')
  1402. ? 'beforeCreate'
  1403. : 'beforeMount';
  1404. var CREATE_ELEMENT_ALIAS = semver.gt(Vue.version, '2.1.5')
  1405. ? '_c'
  1406. : '_h';
  1407. //
  1408. function getSelectorType(selector) {
  1409. if (isDomSelector(selector)) { return DOM_SELECTOR }
  1410. if (isVueComponent(selector)) { return COMPONENT_SELECTOR }
  1411. if (isNameSelector(selector)) { return NAME_SELECTOR }
  1412. if (isRefSelector(selector)) { return REF_SELECTOR }
  1413. return INVALID_SELECTOR
  1414. }
  1415. function getSelector(
  1416. selector,
  1417. methodName
  1418. ) {
  1419. var type = getSelectorType(selector);
  1420. if (type === INVALID_SELECTOR) {
  1421. throwError(
  1422. "wrapper." + methodName + "() must be passed a valid CSS selector, Vue " +
  1423. "constructor, or valid find option object"
  1424. );
  1425. }
  1426. return {
  1427. type: type,
  1428. value: selector
  1429. }
  1430. }
  1431. //
  1432. function getRealChild(vnode) {
  1433. var compOptions = vnode && vnode.componentOptions;
  1434. if (compOptions && compOptions.Ctor.options.abstract) {
  1435. return getRealChild(getFirstComponentChild(compOptions.children))
  1436. } else {
  1437. return vnode
  1438. }
  1439. }
  1440. function isSameChild(child, oldChild) {
  1441. return oldChild.key === child.key && oldChild.tag === child.tag
  1442. }
  1443. function getFirstComponentChild(children) {
  1444. if (Array.isArray(children)) {
  1445. for (var i = 0; i < children.length; i++) {
  1446. var c = children[i];
  1447. if (c && (c.componentOptions || isAsyncPlaceholder(c))) {
  1448. return c
  1449. }
  1450. }
  1451. }
  1452. }
  1453. function isPrimitive(value) {
  1454. return (
  1455. typeof value === 'string' ||
  1456. typeof value === 'number' ||
  1457. // $FlowIgnore
  1458. typeof value === 'symbol' ||
  1459. typeof value === 'boolean'
  1460. )
  1461. }
  1462. function isAsyncPlaceholder(node) {
  1463. return node.isComment && node.asyncFactory
  1464. }
  1465. function hasParentTransition(vnode) {
  1466. while ((vnode = vnode.parent)) {
  1467. if (vnode.data.transition) {
  1468. return true
  1469. }
  1470. }
  1471. }
  1472. var TransitionStub = {
  1473. render: function render(h) {
  1474. var children = this.$options._renderChildren;
  1475. if (!children) {
  1476. return
  1477. }
  1478. // filter out text nodes (possible whitespaces)
  1479. children = children.filter(function (c) { return c.tag || isAsyncPlaceholder(c); });
  1480. /* istanbul ignore if */
  1481. if (!children.length) {
  1482. return
  1483. }
  1484. // warn multiple elements
  1485. if (children.length > 1) {
  1486. warn(
  1487. "<transition> can only be used on a single element. " +
  1488. "Use " +
  1489. '<transition-group> for lists.'
  1490. );
  1491. }
  1492. var mode = this.mode;
  1493. // warn invalid mode
  1494. if (mode && mode !== 'in-out' && mode !== 'out-in') {
  1495. warn('invalid <transition> mode: ' + mode);
  1496. }
  1497. var rawChild = children[0];
  1498. // if this is a component root node and the component's
  1499. // parent container node also has transition, skip.
  1500. if (hasParentTransition(this.$vnode)) {
  1501. return rawChild
  1502. }
  1503. // apply transition data to child
  1504. // use getRealChild() to ignore abstract components e.g. keep-alive
  1505. var child = getRealChild(rawChild);
  1506. if (!child) {
  1507. return rawChild
  1508. }
  1509. var id = "__transition-" + (this._uid) + "-";
  1510. child.key =
  1511. child.key == null
  1512. ? child.isComment
  1513. ? id + 'comment'
  1514. : id + child.tag
  1515. : isPrimitive(child.key)
  1516. ? String(child.key).indexOf(id) === 0
  1517. ? child.key
  1518. : id + child.key
  1519. : child.key;
  1520. var data = child.data || (child.data = {});
  1521. var oldRawChild = this._vnode;
  1522. var oldChild = getRealChild(oldRawChild);
  1523. if (
  1524. child.data.directives &&
  1525. child.data.directives.some(function (d) { return d.name === 'show'; })
  1526. ) {
  1527. child.data.show = true;
  1528. }
  1529. // mark v-show
  1530. // so that the transition module can hand over the control
  1531. // to the directive
  1532. if (
  1533. child.data.directives &&
  1534. child.data.directives.some(function (d) { return d.name === 'show'; })
  1535. ) {
  1536. child.data.show = true;
  1537. }
  1538. if (
  1539. oldChild &&
  1540. oldChild.data &&
  1541. !isSameChild(child, oldChild) &&
  1542. !isAsyncPlaceholder(oldChild) &&
  1543. // #6687 component root is a comment node
  1544. !(
  1545. oldChild.componentInstance &&
  1546. oldChild.componentInstance._vnode.isComment
  1547. )
  1548. ) {
  1549. oldChild.data = Object.assign({}, data);
  1550. }
  1551. return rawChild
  1552. }
  1553. }
  1554. //
  1555. var TransitionGroupStub = {
  1556. render: function render(h) {
  1557. var tag = this.tag || this.$vnode.data.tag || 'span';
  1558. var children = this.$slots.default || [];
  1559. return h(tag, null, children)
  1560. }
  1561. }
  1562. var config = {
  1563. stubs: {
  1564. transition: TransitionStub,
  1565. 'transition-group': TransitionGroupStub
  1566. },
  1567. mocks: {},
  1568. methods: {},
  1569. provide: {},
  1570. logModifiedComponents: true,
  1571. silent: true
  1572. }
  1573. //
  1574. var WrapperArray = function WrapperArray(wrappers) {
  1575. var length = wrappers.length;
  1576. // $FlowIgnore
  1577. Object.defineProperty(this, 'wrappers', {
  1578. get: function () { return wrappers; },
  1579. set: function () { return throwError('wrapperArray.wrappers is read-only'); }
  1580. });
  1581. // $FlowIgnore
  1582. Object.defineProperty(this, 'length', {
  1583. get: function () { return length; },
  1584. set: function () { return throwError('wrapperArray.length is read-only'); }
  1585. });
  1586. };
  1587. WrapperArray.prototype.at = function at (index) {
  1588. if (index > this.length - 1) {
  1589. throwError(("no item exists at " + index));
  1590. }
  1591. return this.wrappers[index]
  1592. };
  1593. WrapperArray.prototype.attributes = function attributes () {
  1594. this.throwErrorIfWrappersIsEmpty('attributes');
  1595. throwError(
  1596. "attributes must be called on a single wrapper, use " +
  1597. "at(i) to access a wrapper"
  1598. );
  1599. };
  1600. WrapperArray.prototype.classes = function classes () {
  1601. this.throwErrorIfWrappersIsEmpty('classes');
  1602. throwError(
  1603. "classes must be called on a single wrapper, use " +
  1604. "at(i) to access a wrapper"
  1605. );
  1606. };
  1607. WrapperArray.prototype.contains = function contains (selector) {
  1608. this.throwErrorIfWrappersIsEmpty('contains');
  1609. return this.wrappers.every(function (wrapper) { return wrapper.contains(selector); })
  1610. };
  1611. WrapperArray.prototype.exists = function exists () {
  1612. return this.length > 0 && this.wrappers.every(function (wrapper) { return wrapper.exists(); })
  1613. };
  1614. WrapperArray.prototype.filter = function filter (predicate) {
  1615. return new WrapperArray(this.wrappers.filter(predicate))
  1616. };
  1617. WrapperArray.prototype.emitted = function emitted () {
  1618. this.throwErrorIfWrappersIsEmpty('emitted');
  1619. throwError(
  1620. "emitted must be called on a single wrapper, use " +
  1621. "at(i) to access a wrapper"
  1622. );
  1623. };
  1624. WrapperArray.prototype.emittedByOrder = function emittedByOrder () {
  1625. this.throwErrorIfWrappersIsEmpty('emittedByOrder');
  1626. throwError(
  1627. "emittedByOrder must be called on a single wrapper, " +
  1628. "use at(i) to access a wrapper"
  1629. );
  1630. };
  1631. WrapperArray.prototype.findAll = function findAll () {
  1632. this.throwErrorIfWrappersIsEmpty('findAll');
  1633. throwError(
  1634. "findAll must be called on a single wrapper, use " +
  1635. "at(i) to access a wrapper"
  1636. );
  1637. };
  1638. WrapperArray.prototype.find = function find () {
  1639. this.throwErrorIfWrappersIsEmpty('find');
  1640. throwError(
  1641. "find must be called on a single wrapper, use at(i) " +
  1642. "to access a wrapper"
  1643. );
  1644. };
  1645. WrapperArray.prototype.html = function html () {
  1646. this.throwErrorIfWrappersIsEmpty('html');
  1647. throwError(
  1648. "html must be called on a single wrapper, use at(i) " +
  1649. "to access a wrapper"
  1650. );
  1651. };
  1652. WrapperArray.prototype.is = function is (selector) {
  1653. this.throwErrorIfWrappersIsEmpty('is');
  1654. return this.wrappers.every(function (wrapper) { return wrapper.is(selector); })
  1655. };
  1656. WrapperArray.prototype.isEmpty = function isEmpty () {
  1657. this.throwErrorIfWrappersIsEmpty('isEmpty');
  1658. return this.wrappers.every(function (wrapper) { return wrapper.isEmpty(); })
  1659. };
  1660. WrapperArray.prototype.isVisible = function isVisible () {
  1661. this.throwErrorIfWrappersIsEmpty('isVisible');
  1662. return this.wrappers.every(function (wrapper) { return wrapper.isVisible(); })
  1663. };
  1664. WrapperArray.prototype.isVueInstance = function isVueInstance () {
  1665. this.throwErrorIfWrappersIsEmpty('isVueInstance');
  1666. return this.wrappers.every(function (wrapper) { return wrapper.isVueInstance(); })
  1667. };
  1668. WrapperArray.prototype.name = function name () {
  1669. this.throwErrorIfWrappersIsEmpty('name');
  1670. throwError(
  1671. "name must be called on a single wrapper, use at(i) " +
  1672. "to access a wrapper"
  1673. );
  1674. };
  1675. WrapperArray.prototype.props = function props () {
  1676. this.throwErrorIfWrappersIsEmpty('props');
  1677. throwError(
  1678. "props must be called on a single wrapper, use " +
  1679. "at(i) to access a wrapper"
  1680. );
  1681. };
  1682. WrapperArray.prototype.text = function text () {
  1683. this.throwErrorIfWrappersIsEmpty('text');
  1684. throwError(
  1685. "text must be called on a single wrapper, use at(i) " +
  1686. "to access a wrapper"
  1687. );
  1688. };
  1689. WrapperArray.prototype.throwErrorIfWrappersIsEmpty = function throwErrorIfWrappersIsEmpty (method) {
  1690. if (this.wrappers.length === 0) {
  1691. throwError((method + " cannot be called on 0 items"));
  1692. }
  1693. };
  1694. WrapperArray.prototype.setData = function setData (data) {
  1695. this.throwErrorIfWrappersIsEmpty('setData');
  1696. this.wrappers.forEach(function (wrapper) { return wrapper.setData(data); });
  1697. };
  1698. WrapperArray.prototype.setMethods = function setMethods (props) {
  1699. this.throwErrorIfWrappersIsEmpty('setMethods');
  1700. this.wrappers.forEach(function (wrapper) { return wrapper.setMethods(props); });
  1701. };
  1702. WrapperArray.prototype.setProps = function setProps (props) {
  1703. this.throwErrorIfWrappersIsEmpty('setProps');
  1704. this.wrappers.forEach(function (wrapper) { return wrapper.setProps(props); });
  1705. };
  1706. WrapperArray.prototype.setValue = function setValue (value) {
  1707. this.throwErrorIfWrappersIsEmpty('setValue');
  1708. this.wrappers.forEach(function (wrapper) { return wrapper.setValue(value); });
  1709. };
  1710. WrapperArray.prototype.setChecked = function setChecked (checked) {
  1711. if ( checked === void 0 ) checked = true;
  1712. this.throwErrorIfWrappersIsEmpty('setChecked');
  1713. this.wrappers.forEach(function (wrapper) { return wrapper.setChecked(checked); });
  1714. };
  1715. WrapperArray.prototype.setSelected = function setSelected () {
  1716. this.throwErrorIfWrappersIsEmpty('setSelected');
  1717. throwError(
  1718. "setSelected must be called on a single wrapper, " +
  1719. "use at(i) to access a wrapper"
  1720. );
  1721. };
  1722. WrapperArray.prototype.trigger = function trigger (event, options) {
  1723. this.throwErrorIfWrappersIsEmpty('trigger');
  1724. this.wrappers.forEach(function (wrapper) { return wrapper.trigger(event, options); });
  1725. };
  1726. WrapperArray.prototype.update = function update () {
  1727. this.throwErrorIfWrappersIsEmpty('update');
  1728. warn(
  1729. "update has been removed. All changes are now " +
  1730. "synchrnous without calling update"
  1731. );
  1732. };
  1733. WrapperArray.prototype.destroy = function destroy () {
  1734. this.throwErrorIfWrappersIsEmpty('destroy');
  1735. this.wrappers.forEach(function (wrapper) { return wrapper.destroy(); });
  1736. };
  1737. //
  1738. var ErrorWrapper = function ErrorWrapper(selector) {
  1739. this.selector = selector;
  1740. };
  1741. ErrorWrapper.prototype.at = function at () {
  1742. throwError(
  1743. ("find did not return " + (this.selector) + ", cannot call at() on empty Wrapper")
  1744. );
  1745. };
  1746. ErrorWrapper.prototype.attributes = function attributes () {
  1747. throwError(
  1748. ("find did not return " + (this.selector) + ", cannot call attributes() on empty Wrapper")
  1749. );
  1750. };
  1751. ErrorWrapper.prototype.classes = function classes () {
  1752. throwError(
  1753. ("find did not return " + (this.selector) + ", cannot call classes() on empty Wrapper")
  1754. );
  1755. };
  1756. ErrorWrapper.prototype.contains = function contains () {
  1757. throwError(
  1758. ("find did not return " + (this.selector) + ", cannot call contains() on empty Wrapper")
  1759. );
  1760. };
  1761. ErrorWrapper.prototype.emitted = function emitted () {
  1762. throwError(
  1763. ("find did not return " + (this.selector) + ", cannot call emitted() on empty Wrapper")
  1764. );
  1765. };
  1766. ErrorWrapper.prototype.emittedByOrder = function emittedByOrder () {
  1767. throwError(
  1768. ("find did not return " + (this.selector) + ", cannot call emittedByOrder() on empty Wrapper")
  1769. );
  1770. };
  1771. ErrorWrapper.prototype.exists = function exists () {
  1772. return false
  1773. };
  1774. ErrorWrapper.prototype.filter = function filter () {
  1775. throwError(
  1776. ("find did not return " + (this.selector) + ", cannot call filter() on empty Wrapper")
  1777. );
  1778. };
  1779. ErrorWrapper.prototype.visible = function visible () {
  1780. throwError(
  1781. ("find did not return " + (this.selector) + ", cannot call visible() on empty Wrapper")
  1782. );
  1783. };
  1784. ErrorWrapper.prototype.hasAttribute = function hasAttribute () {
  1785. throwError(
  1786. ("find did not return " + (this.selector) + ", cannot call hasAttribute() on empty Wrapper")
  1787. );
  1788. };
  1789. ErrorWrapper.prototype.hasClass = function hasClass () {
  1790. throwError(
  1791. ("find did not return " + (this.selector) + ", cannot call hasClass() on empty Wrapper")
  1792. );
  1793. };
  1794. ErrorWrapper.prototype.hasProp = function hasProp () {
  1795. throwError(
  1796. ("find did not return " + (this.selector) + ", cannot call hasProp() on empty Wrapper")
  1797. );
  1798. };
  1799. ErrorWrapper.prototype.hasStyle = function hasStyle () {
  1800. throwError(
  1801. ("find did not return " + (this.selector) + ", cannot call hasStyle() on empty Wrapper")
  1802. );
  1803. };
  1804. ErrorWrapper.prototype.findAll = function findAll () {
  1805. throwError(
  1806. ("find did not return " + (this.selector) + ", cannot call findAll() on empty Wrapper")
  1807. );
  1808. };
  1809. ErrorWrapper.prototype.find = function find () {
  1810. throwError(
  1811. ("find did not return " + (this.selector) + ", cannot call find() on empty Wrapper")
  1812. );
  1813. };
  1814. ErrorWrapper.prototype.html = function html () {
  1815. throwError(
  1816. ("find did not return " + (this.selector) + ", cannot call html() on empty Wrapper")
  1817. );
  1818. };
  1819. ErrorWrapper.prototype.is = function is () {
  1820. throwError(
  1821. ("find did not return " + (this.selector) + ", cannot call is() on empty Wrapper")
  1822. );
  1823. };
  1824. ErrorWrapper.prototype.isEmpty = function isEmpty () {
  1825. throwError(
  1826. ("find did not return " + (this.selector) + ", cannot call isEmpty() on empty Wrapper")
  1827. );
  1828. };
  1829. ErrorWrapper.prototype.isVisible = function isVisible () {
  1830. throwError(
  1831. ("find did not return " + (this.selector) + ", cannot call isVisible() on empty Wrapper")
  1832. );
  1833. };
  1834. ErrorWrapper.prototype.isVueInstance = function isVueInstance () {
  1835. throwError(
  1836. ("find did not return " + (this.selector) + ", cannot call isVueInstance() on empty Wrapper")
  1837. );
  1838. };
  1839. ErrorWrapper.prototype.name = function name () {
  1840. throwError(
  1841. ("find did not return " + (this.selector) + ", cannot call name() on empty Wrapper")
  1842. );
  1843. };
  1844. ErrorWrapper.prototype.props = function props () {
  1845. throwError(
  1846. ("find did not return " + (this.selector) + ", cannot call props() on empty Wrapper")
  1847. );
  1848. };
  1849. ErrorWrapper.prototype.text = function text () {
  1850. throwError(
  1851. ("find did not return " + (this.selector) + ", cannot call text() on empty Wrapper")
  1852. );
  1853. };
  1854. ErrorWrapper.prototype.setComputed = function setComputed () {
  1855. throwError(
  1856. ("find did not return " + (this.selector) + ", cannot call setComputed() on empty Wrapper")
  1857. );
  1858. };
  1859. ErrorWrapper.prototype.setData = function setData () {
  1860. throwError(
  1861. ("find did not return " + (this.selector) + ", cannot call setData() on empty Wrapper")
  1862. );
  1863. };
  1864. ErrorWrapper.prototype.setMethods = function setMethods () {
  1865. throwError(
  1866. ("find did not return " + (this.selector) + ", cannot call setMethods() on empty Wrapper")
  1867. );
  1868. };
  1869. ErrorWrapper.prototype.setProps = function setProps () {
  1870. throwError(
  1871. ("find did not return " + (this.selector) + ", cannot call setProps() on empty Wrapper")
  1872. );
  1873. };
  1874. ErrorWrapper.prototype.setValue = function setValue () {
  1875. throwError(
  1876. ("find did not return " + (this.selector) + ", cannot call setValue() on empty Wrapper")
  1877. );
  1878. };
  1879. ErrorWrapper.prototype.setChecked = function setChecked () {
  1880. throwError(
  1881. ("find did not return " + (this.selector) + ", cannot call setChecked() on empty Wrapper")
  1882. );
  1883. };
  1884. ErrorWrapper.prototype.setSelected = function setSelected () {
  1885. throwError(
  1886. ("find did not return " + (this.selector) + ", cannot call setSelected() on empty Wrapper")
  1887. );
  1888. };
  1889. ErrorWrapper.prototype.trigger = function trigger () {
  1890. throwError(
  1891. ("find did not return " + (this.selector) + ", cannot call trigger() on empty Wrapper")
  1892. );
  1893. };
  1894. ErrorWrapper.prototype.update = function update () {
  1895. throwError(
  1896. "update has been removed from vue-test-utils." +
  1897. "All updates are now synchronous by default"
  1898. );
  1899. };
  1900. ErrorWrapper.prototype.destroy = function destroy () {
  1901. throwError(
  1902. ("find did not return " + (this.selector) + ", cannot call destroy() on empty Wrapper")
  1903. );
  1904. };
  1905. //
  1906. function findDOMNodes(
  1907. element,
  1908. selector
  1909. ) {
  1910. var nodes = [];
  1911. if (!element || !element.querySelectorAll || !element.matches) {
  1912. return nodes
  1913. }
  1914. if (element.matches(selector)) {
  1915. nodes.push(element);
  1916. }
  1917. // $FlowIgnore
  1918. return nodes.concat([].slice.call(element.querySelectorAll(selector)))
  1919. }
  1920. function vmMatchesName(vm, name) {
  1921. return (
  1922. !!name && (vm.name === name || (vm.$options && vm.$options.name === name))
  1923. )
  1924. }
  1925. function vmCtorMatches(vm, component) {
  1926. if (
  1927. (vm.$options && vm.$options.$_vueTestUtils_original === component) ||
  1928. vm.$_vueTestUtils_original === component
  1929. ) {
  1930. return true
  1931. }
  1932. var Ctor = isConstructor(component)
  1933. ? component.options._Ctor
  1934. : component._Ctor;
  1935. if (!Ctor) {
  1936. return false
  1937. }
  1938. if (vm.constructor.extendOptions === component) {
  1939. return true
  1940. }
  1941. if (component.functional) {
  1942. return Object.keys(vm._Ctor || {}).some(function (c) {
  1943. return component === vm._Ctor[c].extendOptions
  1944. })
  1945. }
  1946. }
  1947. function matches(node, selector) {
  1948. if (selector.type === DOM_SELECTOR) {
  1949. var element = node instanceof Element ? node : node.elm;
  1950. return element && element.matches && element.matches(selector.value)
  1951. }
  1952. var isFunctionalSelector = isConstructor(selector.value)
  1953. ? selector.value.options.functional
  1954. : selector.value.functional;
  1955. var componentInstance = isFunctionalSelector
  1956. ? node[FUNCTIONAL_OPTIONS]
  1957. : node.child;
  1958. if (!componentInstance) {
  1959. return false
  1960. }
  1961. if (selector.type === COMPONENT_SELECTOR) {
  1962. if (vmCtorMatches(componentInstance, selector.value)) {
  1963. return true
  1964. }
  1965. }
  1966. // Fallback to name selector for COMPONENT_SELECTOR for Vue < 2.1
  1967. var nameSelector = isConstructor(selector.value)
  1968. ? selector.value.extendOptions.name
  1969. : selector.value.name;
  1970. return vmMatchesName(componentInstance, nameSelector)
  1971. }
  1972. //
  1973. function findAllInstances(rootVm) {
  1974. var instances = [rootVm];
  1975. var i = 0;
  1976. while (i < instances.length) {
  1977. var vm = instances[i]
  1978. ;(vm.$children || []).forEach(function (child) {
  1979. instances.push(child);
  1980. });
  1981. i++;
  1982. }
  1983. return instances
  1984. }
  1985. function findAllVNodes(vnode, selector) {
  1986. var matchingNodes = [];
  1987. var nodes = [vnode];
  1988. while (nodes.length) {
  1989. var node = nodes.shift();
  1990. if (node.children) {
  1991. var children = [].concat( node.children ).reverse();
  1992. children.forEach(function (n) {
  1993. nodes.unshift(n);
  1994. });
  1995. }
  1996. if (node.child) {
  1997. nodes.unshift(node.child._vnode);
  1998. }
  1999. if (matches(node, selector)) {
  2000. matchingNodes.push(node);
  2001. }
  2002. }
  2003. return matchingNodes
  2004. }
  2005. function removeDuplicateNodes(vNodes) {
  2006. var vNodeElms = vNodes.map(function (vNode) { return vNode.elm; });
  2007. return vNodes.filter(function (vNode, index) { return index === vNodeElms.indexOf(vNode.elm); })
  2008. }
  2009. function find(
  2010. root,
  2011. vm,
  2012. selector
  2013. ) {
  2014. if (root instanceof Element && selector.type !== DOM_SELECTOR) {
  2015. throwError(
  2016. "cannot find a Vue instance on a DOM node. The node " +
  2017. "you are calling find on does not exist in the " +
  2018. "VDom. Are you adding the node as innerHTML?"
  2019. );
  2020. }
  2021. if (
  2022. selector.type === COMPONENT_SELECTOR &&
  2023. (selector.value.functional ||
  2024. (selector.value.options && selector.value.options.functional)) &&
  2025. VUE_VERSION < 2.3
  2026. ) {
  2027. throwError(
  2028. "find for functional components is not supported " + "in Vue < 2.3"
  2029. );
  2030. }
  2031. if (root instanceof Element) {
  2032. return findDOMNodes(root, selector.value)
  2033. }
  2034. if (!root && selector.type !== DOM_SELECTOR) {
  2035. throwError(
  2036. "cannot find a Vue instance on a DOM node. The node " +
  2037. "you are calling find on does not exist in the " +
  2038. "VDom. Are you adding the node as innerHTML?"
  2039. );
  2040. }
  2041. if (!vm && selector.type === REF_SELECTOR) {
  2042. throwError("$ref selectors can only be used on Vue component " + "wrappers");
  2043. }
  2044. if (vm && vm.$refs && selector.value.ref in vm.$refs) {
  2045. var refs = vm.$refs[selector.value.ref];
  2046. return Array.isArray(refs) ? refs : [refs]
  2047. }
  2048. var nodes = findAllVNodes(root, selector);
  2049. var dedupedNodes = removeDuplicateNodes(nodes);
  2050. if (nodes.length > 0 || selector.type !== DOM_SELECTOR) {
  2051. return dedupedNodes
  2052. }
  2053. // Fallback in case element exists in HTML, but not in vnode tree
  2054. // (e.g. if innerHTML is set as a domProp)
  2055. return findDOMNodes(root.elm, selector.value)
  2056. }
  2057. //
  2058. function createWrapper(
  2059. node,
  2060. options
  2061. ) {
  2062. if ( options === void 0 ) options = {};
  2063. var componentInstance = node.child;
  2064. if (componentInstance) {
  2065. return new VueWrapper(componentInstance, options)
  2066. }
  2067. return node instanceof Vue
  2068. ? new VueWrapper(node, options)
  2069. : new Wrapper(node, options)
  2070. }
  2071. //
  2072. var i = 0;
  2073. function orderDeps(watcher) {
  2074. watcher.deps.forEach(function (dep) {
  2075. if (dep._sortedId === i) {
  2076. return
  2077. }
  2078. dep._sortedId = i;
  2079. dep.subs.forEach(orderDeps);
  2080. dep.subs = dep.subs.sort(function (a, b) { return a.id - b.id; });
  2081. });
  2082. }
  2083. function orderVmWatchers(vm) {
  2084. if (vm._watchers) {
  2085. vm._watchers.forEach(orderDeps);
  2086. }
  2087. if (vm._computedWatchers) {
  2088. Object.keys(vm._computedWatchers).forEach(function (computedWatcher) {
  2089. orderDeps(vm._computedWatchers[computedWatcher]);
  2090. });
  2091. }
  2092. vm._watcher && orderDeps(vm._watcher);
  2093. vm.$children.forEach(orderVmWatchers);
  2094. }
  2095. function orderWatchers(vm) {
  2096. orderVmWatchers(vm);
  2097. i++;
  2098. }
  2099. function recursivelySetData(vm, target, data) {
  2100. Object.keys(data).forEach(function (key) {
  2101. var val = data[key];
  2102. var targetVal = target[key];
  2103. if (isPlainObject(val) && isPlainObject(targetVal)) {
  2104. recursivelySetData(vm, targetVal, val);
  2105. } else {
  2106. vm.$set(target, key, val);
  2107. }
  2108. });
  2109. }
  2110. var abort = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2111. var afterprint = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2112. var animationend = {"eventInterface":"AnimationEvent","bubbles":true,"cancelable":false};
  2113. var animationiteration = {"eventInterface":"AnimationEvent","bubbles":true,"cancelable":false};
  2114. var animationstart = {"eventInterface":"AnimationEvent","bubbles":true,"cancelable":false};
  2115. var appinstalled = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2116. var audioprocess = {"eventInterface":"AudioProcessingEvent"};
  2117. var audioend = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2118. var audiostart = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2119. var beforeprint = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2120. var beforeunload = {"eventInterface":"BeforeUnloadEvent","bubbles":false,"cancelable":true};
  2121. var beginEvent = {"eventInterface":"TimeEvent","bubbles":false,"cancelable":false};
  2122. var blur = {"eventInterface":"FocusEvent","bubbles":false,"cancelable":false};
  2123. var boundary = {"eventInterface":"SpeechSynthesisEvent","bubbles":false,"cancelable":false};
  2124. var cached = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2125. var canplay = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2126. var canplaythrough = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2127. var change = {"eventInterface":"Event","bubbles":true,"cancelable":false};
  2128. var chargingchange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2129. var chargingtimechange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2130. var checking = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2131. var click = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
  2132. var close = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2133. var complete = {"eventInterface":"OfflineAudioCompletionEvent"};
  2134. var compositionend = {"eventInterface":"CompositionEvent","bubbles":true,"cancelable":true};
  2135. var compositionstart = {"eventInterface":"CompositionEvent","bubbles":true,"cancelable":true};
  2136. var compositionupdate = {"eventInterface":"CompositionEvent","bubbles":true,"cancelable":false};
  2137. var contextmenu = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
  2138. var copy = {"eventInterface":"ClipboardEvent"};
  2139. var cut = {"eventInterface":"ClipboardEvent","bubbles":true,"cancelable":true};
  2140. var dblclick = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
  2141. var devicechange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2142. var devicelight = {"eventInterface":"DeviceLightEvent","bubbles":false,"cancelable":false};
  2143. var devicemotion = {"eventInterface":"DeviceMotionEvent","bubbles":false,"cancelable":false};
  2144. var deviceorientation = {"eventInterface":"DeviceOrientationEvent","bubbles":false,"cancelable":false};
  2145. var deviceproximity = {"eventInterface":"DeviceProximityEvent","bubbles":false,"cancelable":false};
  2146. var dischargingtimechange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2147. var DOMActivate = {"eventInterface":"UIEvent","bubbles":true,"cancelable":true};
  2148. var DOMAttributeNameChanged = {"eventInterface":"MutationNameEvent","bubbles":true,"cancelable":true};
  2149. var DOMAttrModified = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true};
  2150. var DOMCharacterDataModified = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true};
  2151. var DOMContentLoaded = {"eventInterface":"Event","bubbles":true,"cancelable":true};
  2152. var DOMElementNameChanged = {"eventInterface":"MutationNameEvent","bubbles":true,"cancelable":true};
  2153. var DOMFocusIn = {"eventInterface":"FocusEvent","bubbles":true,"cancelable":true};
  2154. var DOMFocusOut = {"eventInterface":"FocusEvent","bubbles":true,"cancelable":true};
  2155. var DOMNodeInserted = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true};
  2156. var DOMNodeInsertedIntoDocument = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true};
  2157. var DOMNodeRemoved = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true};
  2158. var DOMNodeRemovedFromDocument = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true};
  2159. var DOMSubtreeModified = {"eventInterface":"MutationEvent"};
  2160. var downloading = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2161. var drag = {"eventInterface":"DragEvent","bubbles":true,"cancelable":true};
  2162. var dragend = {"eventInterface":"DragEvent","bubbles":true,"cancelable":false};
  2163. var dragenter = {"eventInterface":"DragEvent","bubbles":true,"cancelable":true};
  2164. var dragleave = {"eventInterface":"DragEvent","bubbles":true,"cancelable":false};
  2165. var dragover = {"eventInterface":"DragEvent","bubbles":true,"cancelable":true};
  2166. var dragstart = {"eventInterface":"DragEvent","bubbles":true,"cancelable":true};
  2167. var drop = {"eventInterface":"DragEvent","bubbles":true,"cancelable":true};
  2168. var durationchange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2169. var emptied = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2170. var end = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2171. var ended = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2172. var endEvent = {"eventInterface":"TimeEvent","bubbles":false,"cancelable":false};
  2173. var error = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2174. var focus = {"eventInterface":"FocusEvent","bubbles":false,"cancelable":false};
  2175. var focusin = {"eventInterface":"FocusEvent","bubbles":true,"cancelable":false};
  2176. var focusout = {"eventInterface":"FocusEvent","bubbles":true,"cancelable":false};
  2177. var fullscreenchange = {"eventInterface":"Event","bubbles":true,"cancelable":false};
  2178. var fullscreenerror = {"eventInterface":"Event","bubbles":true,"cancelable":false};
  2179. var gamepadconnected = {"eventInterface":"GamepadEvent","bubbles":false,"cancelable":false};
  2180. var gamepaddisconnected = {"eventInterface":"GamepadEvent","bubbles":false,"cancelable":false};
  2181. var gotpointercapture = {"eventInterface":"PointerEvent","bubbles":false,"cancelable":false};
  2182. var hashchange = {"eventInterface":"HashChangeEvent","bubbles":true,"cancelable":false};
  2183. var lostpointercapture = {"eventInterface":"PointerEvent","bubbles":false,"cancelable":false};
  2184. var input = {"eventInterface":"Event","bubbles":true,"cancelable":false};
  2185. var invalid = {"eventInterface":"Event","cancelable":true,"bubbles":false};
  2186. var keydown = {"eventInterface":"KeyboardEvent","bubbles":true,"cancelable":true};
  2187. var keypress = {"eventInterface":"KeyboardEvent","bubbles":true,"cancelable":true};
  2188. var keyup = {"eventInterface":"KeyboardEvent","bubbles":true,"cancelable":true};
  2189. var languagechange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2190. var levelchange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2191. var load = {"eventInterface":"UIEvent","bubbles":false,"cancelable":false};
  2192. var loadeddata = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2193. var loadedmetadata = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2194. var loadend = {"eventInterface":"ProgressEvent","bubbles":false,"cancelable":false};
  2195. var loadstart = {"eventInterface":"ProgressEvent","bubbles":false,"cancelable":false};
  2196. var mark = {"eventInterface":"SpeechSynthesisEvent","bubbles":false,"cancelable":false};
  2197. var message = {"eventInterface":"MessageEvent","bubbles":false,"cancelable":false};
  2198. var messageerror = {"eventInterface":"MessageEvent","bubbles":false,"cancelable":false};
  2199. var mousedown = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
  2200. var mouseenter = {"eventInterface":"MouseEvent","bubbles":false,"cancelable":false};
  2201. var mouseleave = {"eventInterface":"MouseEvent","bubbles":false,"cancelable":false};
  2202. var mousemove = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
  2203. var mouseout = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
  2204. var mouseover = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
  2205. var mouseup = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
  2206. var nomatch = {"eventInterface":"SpeechRecognitionEvent","bubbles":false,"cancelable":false};
  2207. var notificationclick = {"eventInterface":"NotificationEvent","bubbles":false,"cancelable":false};
  2208. var noupdate = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2209. var obsolete = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2210. var offline = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2211. var online = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2212. var open = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2213. var orientationchange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2214. var pagehide = {"eventInterface":"PageTransitionEvent","bubbles":false,"cancelable":false};
  2215. var pageshow = {"eventInterface":"PageTransitionEvent","bubbles":false,"cancelable":false};
  2216. var paste = {"eventInterface":"ClipboardEvent","bubbles":true,"cancelable":true};
  2217. var pause = {"eventInterface":"SpeechSynthesisEvent","bubbles":false,"cancelable":false};
  2218. var pointercancel = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":false};
  2219. var pointerdown = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":true};
  2220. var pointerenter = {"eventInterface":"PointerEvent","bubbles":false,"cancelable":false};
  2221. var pointerleave = {"eventInterface":"PointerEvent","bubbles":false,"cancelable":false};
  2222. var pointerlockchange = {"eventInterface":"Event","bubbles":true,"cancelable":false};
  2223. var pointerlockerror = {"eventInterface":"Event","bubbles":true,"cancelable":false};
  2224. var pointermove = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":true};
  2225. var pointerout = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":true};
  2226. var pointerover = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":true};
  2227. var pointerup = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":true};
  2228. var play = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2229. var playing = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2230. var popstate = {"eventInterface":"PopStateEvent","bubbles":true,"cancelable":false};
  2231. var progress = {"eventInterface":"ProgressEvent","bubbles":false,"cancelable":false};
  2232. var push = {"eventInterface":"PushEvent","bubbles":false,"cancelable":false};
  2233. var pushsubscriptionchange = {"eventInterface":"PushEvent","bubbles":false,"cancelable":false};
  2234. var ratechange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2235. var readystatechange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2236. var repeatEvent = {"eventInterface":"TimeEvent","bubbles":false,"cancelable":false};
  2237. var reset = {"eventInterface":"Event","bubbles":true,"cancelable":true};
  2238. var resize = {"eventInterface":"UIEvent","bubbles":false,"cancelable":false};
  2239. var resourcetimingbufferfull = {"eventInterface":"Performance","bubbles":true,"cancelable":true};
  2240. var result = {"eventInterface":"SpeechRecognitionEvent","bubbles":false,"cancelable":false};
  2241. var resume = {"eventInterface":"SpeechSynthesisEvent","bubbles":false,"cancelable":false};
  2242. var scroll = {"eventInterface":"UIEvent","bubbles":false,"cancelable":false};
  2243. var seeked = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2244. var seeking = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2245. var select = {"eventInterface":"UIEvent","bubbles":true,"cancelable":false};
  2246. var selectstart = {"eventInterface":"Event","bubbles":true,"cancelable":true};
  2247. var selectionchange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2248. var show = {"eventInterface":"MouseEvent","bubbles":false,"cancelable":false};
  2249. var slotchange = {"eventInterface":"Event","bubbles":true,"cancelable":false};
  2250. var soundend = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2251. var soundstart = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2252. var speechend = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2253. var speechstart = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2254. var stalled = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2255. var start = {"eventInterface":"SpeechSynthesisEvent","bubbles":false,"cancelable":false};
  2256. var storage = {"eventInterface":"StorageEvent","bubbles":false,"cancelable":false};
  2257. var submit = {"eventInterface":"Event","bubbles":true,"cancelable":true};
  2258. var success = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2259. var suspend = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2260. var SVGAbort = {"eventInterface":"SVGEvent","bubbles":true,"cancelable":false};
  2261. var SVGError = {"eventInterface":"SVGEvent","bubbles":true,"cancelable":false};
  2262. var SVGLoad = {"eventInterface":"SVGEvent","bubbles":false,"cancelable":false};
  2263. var SVGResize = {"eventInterface":"SVGEvent","bubbles":true,"cancelable":false};
  2264. var SVGScroll = {"eventInterface":"SVGEvent","bubbles":true,"cancelable":false};
  2265. var SVGUnload = {"eventInterface":"SVGEvent","bubbles":false,"cancelable":false};
  2266. var SVGZoom = {"eventInterface":"SVGZoomEvent","bubbles":true,"cancelable":false};
  2267. var timeout = {"eventInterface":"ProgressEvent","bubbles":false,"cancelable":false};
  2268. var timeupdate = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2269. var touchcancel = {"eventInterface":"TouchEvent","bubbles":true,"cancelable":false};
  2270. var touchend = {"eventInterface":"TouchEvent","bubbles":true,"cancelable":true};
  2271. var touchmove = {"eventInterface":"TouchEvent","bubbles":true,"cancelable":true};
  2272. var touchstart = {"eventInterface":"TouchEvent","bubbles":true,"cancelable":true};
  2273. var transitionend = {"eventInterface":"TransitionEvent","bubbles":true,"cancelable":true};
  2274. var unload = {"eventInterface":"UIEvent","bubbles":false};
  2275. var updateready = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2276. var userproximity = {"eventInterface":"UserProximityEvent","bubbles":false,"cancelable":false};
  2277. var voiceschanged = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2278. var visibilitychange = {"eventInterface":"Event","bubbles":true,"cancelable":false};
  2279. var volumechange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2280. var waiting = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2281. var wheel = {"eventInterface":"WheelEvent","bubbles":true,"cancelable":true};
  2282. var domEventTypes = {
  2283. abort: abort,
  2284. afterprint: afterprint,
  2285. animationend: animationend,
  2286. animationiteration: animationiteration,
  2287. animationstart: animationstart,
  2288. appinstalled: appinstalled,
  2289. audioprocess: audioprocess,
  2290. audioend: audioend,
  2291. audiostart: audiostart,
  2292. beforeprint: beforeprint,
  2293. beforeunload: beforeunload,
  2294. beginEvent: beginEvent,
  2295. blur: blur,
  2296. boundary: boundary,
  2297. cached: cached,
  2298. canplay: canplay,
  2299. canplaythrough: canplaythrough,
  2300. change: change,
  2301. chargingchange: chargingchange,
  2302. chargingtimechange: chargingtimechange,
  2303. checking: checking,
  2304. click: click,
  2305. close: close,
  2306. complete: complete,
  2307. compositionend: compositionend,
  2308. compositionstart: compositionstart,
  2309. compositionupdate: compositionupdate,
  2310. contextmenu: contextmenu,
  2311. copy: copy,
  2312. cut: cut,
  2313. dblclick: dblclick,
  2314. devicechange: devicechange,
  2315. devicelight: devicelight,
  2316. devicemotion: devicemotion,
  2317. deviceorientation: deviceorientation,
  2318. deviceproximity: deviceproximity,
  2319. dischargingtimechange: dischargingtimechange,
  2320. DOMActivate: DOMActivate,
  2321. DOMAttributeNameChanged: DOMAttributeNameChanged,
  2322. DOMAttrModified: DOMAttrModified,
  2323. DOMCharacterDataModified: DOMCharacterDataModified,
  2324. DOMContentLoaded: DOMContentLoaded,
  2325. DOMElementNameChanged: DOMElementNameChanged,
  2326. DOMFocusIn: DOMFocusIn,
  2327. DOMFocusOut: DOMFocusOut,
  2328. DOMNodeInserted: DOMNodeInserted,
  2329. DOMNodeInsertedIntoDocument: DOMNodeInsertedIntoDocument,
  2330. DOMNodeRemoved: DOMNodeRemoved,
  2331. DOMNodeRemovedFromDocument: DOMNodeRemovedFromDocument,
  2332. DOMSubtreeModified: DOMSubtreeModified,
  2333. downloading: downloading,
  2334. drag: drag,
  2335. dragend: dragend,
  2336. dragenter: dragenter,
  2337. dragleave: dragleave,
  2338. dragover: dragover,
  2339. dragstart: dragstart,
  2340. drop: drop,
  2341. durationchange: durationchange,
  2342. emptied: emptied,
  2343. end: end,
  2344. ended: ended,
  2345. endEvent: endEvent,
  2346. error: error,
  2347. focus: focus,
  2348. focusin: focusin,
  2349. focusout: focusout,
  2350. fullscreenchange: fullscreenchange,
  2351. fullscreenerror: fullscreenerror,
  2352. gamepadconnected: gamepadconnected,
  2353. gamepaddisconnected: gamepaddisconnected,
  2354. gotpointercapture: gotpointercapture,
  2355. hashchange: hashchange,
  2356. lostpointercapture: lostpointercapture,
  2357. input: input,
  2358. invalid: invalid,
  2359. keydown: keydown,
  2360. keypress: keypress,
  2361. keyup: keyup,
  2362. languagechange: languagechange,
  2363. levelchange: levelchange,
  2364. load: load,
  2365. loadeddata: loadeddata,
  2366. loadedmetadata: loadedmetadata,
  2367. loadend: loadend,
  2368. loadstart: loadstart,
  2369. mark: mark,
  2370. message: message,
  2371. messageerror: messageerror,
  2372. mousedown: mousedown,
  2373. mouseenter: mouseenter,
  2374. mouseleave: mouseleave,
  2375. mousemove: mousemove,
  2376. mouseout: mouseout,
  2377. mouseover: mouseover,
  2378. mouseup: mouseup,
  2379. nomatch: nomatch,
  2380. notificationclick: notificationclick,
  2381. noupdate: noupdate,
  2382. obsolete: obsolete,
  2383. offline: offline,
  2384. online: online,
  2385. open: open,
  2386. orientationchange: orientationchange,
  2387. pagehide: pagehide,
  2388. pageshow: pageshow,
  2389. paste: paste,
  2390. pause: pause,
  2391. pointercancel: pointercancel,
  2392. pointerdown: pointerdown,
  2393. pointerenter: pointerenter,
  2394. pointerleave: pointerleave,
  2395. pointerlockchange: pointerlockchange,
  2396. pointerlockerror: pointerlockerror,
  2397. pointermove: pointermove,
  2398. pointerout: pointerout,
  2399. pointerover: pointerover,
  2400. pointerup: pointerup,
  2401. play: play,
  2402. playing: playing,
  2403. popstate: popstate,
  2404. progress: progress,
  2405. push: push,
  2406. pushsubscriptionchange: pushsubscriptionchange,
  2407. ratechange: ratechange,
  2408. readystatechange: readystatechange,
  2409. repeatEvent: repeatEvent,
  2410. reset: reset,
  2411. resize: resize,
  2412. resourcetimingbufferfull: resourcetimingbufferfull,
  2413. result: result,
  2414. resume: resume,
  2415. scroll: scroll,
  2416. seeked: seeked,
  2417. seeking: seeking,
  2418. select: select,
  2419. selectstart: selectstart,
  2420. selectionchange: selectionchange,
  2421. show: show,
  2422. slotchange: slotchange,
  2423. soundend: soundend,
  2424. soundstart: soundstart,
  2425. speechend: speechend,
  2426. speechstart: speechstart,
  2427. stalled: stalled,
  2428. start: start,
  2429. storage: storage,
  2430. submit: submit,
  2431. success: success,
  2432. suspend: suspend,
  2433. SVGAbort: SVGAbort,
  2434. SVGError: SVGError,
  2435. SVGLoad: SVGLoad,
  2436. SVGResize: SVGResize,
  2437. SVGScroll: SVGScroll,
  2438. SVGUnload: SVGUnload,
  2439. SVGZoom: SVGZoom,
  2440. timeout: timeout,
  2441. timeupdate: timeupdate,
  2442. touchcancel: touchcancel,
  2443. touchend: touchend,
  2444. touchmove: touchmove,
  2445. touchstart: touchstart,
  2446. transitionend: transitionend,
  2447. unload: unload,
  2448. updateready: updateready,
  2449. userproximity: userproximity,
  2450. voiceschanged: voiceschanged,
  2451. visibilitychange: visibilitychange,
  2452. volumechange: volumechange,
  2453. waiting: waiting,
  2454. wheel: wheel
  2455. };
  2456. var domEventTypes$1 = Object.freeze({
  2457. abort: abort,
  2458. afterprint: afterprint,
  2459. animationend: animationend,
  2460. animationiteration: animationiteration,
  2461. animationstart: animationstart,
  2462. appinstalled: appinstalled,
  2463. audioprocess: audioprocess,
  2464. audioend: audioend,
  2465. audiostart: audiostart,
  2466. beforeprint: beforeprint,
  2467. beforeunload: beforeunload,
  2468. beginEvent: beginEvent,
  2469. blur: blur,
  2470. boundary: boundary,
  2471. cached: cached,
  2472. canplay: canplay,
  2473. canplaythrough: canplaythrough,
  2474. change: change,
  2475. chargingchange: chargingchange,
  2476. chargingtimechange: chargingtimechange,
  2477. checking: checking,
  2478. click: click,
  2479. close: close,
  2480. complete: complete,
  2481. compositionend: compositionend,
  2482. compositionstart: compositionstart,
  2483. compositionupdate: compositionupdate,
  2484. contextmenu: contextmenu,
  2485. copy: copy,
  2486. cut: cut,
  2487. dblclick: dblclick,
  2488. devicechange: devicechange,
  2489. devicelight: devicelight,
  2490. devicemotion: devicemotion,
  2491. deviceorientation: deviceorientation,
  2492. deviceproximity: deviceproximity,
  2493. dischargingtimechange: dischargingtimechange,
  2494. DOMActivate: DOMActivate,
  2495. DOMAttributeNameChanged: DOMAttributeNameChanged,
  2496. DOMAttrModified: DOMAttrModified,
  2497. DOMCharacterDataModified: DOMCharacterDataModified,
  2498. DOMContentLoaded: DOMContentLoaded,
  2499. DOMElementNameChanged: DOMElementNameChanged,
  2500. DOMFocusIn: DOMFocusIn,
  2501. DOMFocusOut: DOMFocusOut,
  2502. DOMNodeInserted: DOMNodeInserted,
  2503. DOMNodeInsertedIntoDocument: DOMNodeInsertedIntoDocument,
  2504. DOMNodeRemoved: DOMNodeRemoved,
  2505. DOMNodeRemovedFromDocument: DOMNodeRemovedFromDocument,
  2506. DOMSubtreeModified: DOMSubtreeModified,
  2507. downloading: downloading,
  2508. drag: drag,
  2509. dragend: dragend,
  2510. dragenter: dragenter,
  2511. dragleave: dragleave,
  2512. dragover: dragover,
  2513. dragstart: dragstart,
  2514. drop: drop,
  2515. durationchange: durationchange,
  2516. emptied: emptied,
  2517. end: end,
  2518. ended: ended,
  2519. endEvent: endEvent,
  2520. error: error,
  2521. focus: focus,
  2522. focusin: focusin,
  2523. focusout: focusout,
  2524. fullscreenchange: fullscreenchange,
  2525. fullscreenerror: fullscreenerror,
  2526. gamepadconnected: gamepadconnected,
  2527. gamepaddisconnected: gamepaddisconnected,
  2528. gotpointercapture: gotpointercapture,
  2529. hashchange: hashchange,
  2530. lostpointercapture: lostpointercapture,
  2531. input: input,
  2532. invalid: invalid,
  2533. keydown: keydown,
  2534. keypress: keypress,
  2535. keyup: keyup,
  2536. languagechange: languagechange,
  2537. levelchange: levelchange,
  2538. load: load,
  2539. loadeddata: loadeddata,
  2540. loadedmetadata: loadedmetadata,
  2541. loadend: loadend,
  2542. loadstart: loadstart,
  2543. mark: mark,
  2544. message: message,
  2545. messageerror: messageerror,
  2546. mousedown: mousedown,
  2547. mouseenter: mouseenter,
  2548. mouseleave: mouseleave,
  2549. mousemove: mousemove,
  2550. mouseout: mouseout,
  2551. mouseover: mouseover,
  2552. mouseup: mouseup,
  2553. nomatch: nomatch,
  2554. notificationclick: notificationclick,
  2555. noupdate: noupdate,
  2556. obsolete: obsolete,
  2557. offline: offline,
  2558. online: online,
  2559. open: open,
  2560. orientationchange: orientationchange,
  2561. pagehide: pagehide,
  2562. pageshow: pageshow,
  2563. paste: paste,
  2564. pause: pause,
  2565. pointercancel: pointercancel,
  2566. pointerdown: pointerdown,
  2567. pointerenter: pointerenter,
  2568. pointerleave: pointerleave,
  2569. pointerlockchange: pointerlockchange,
  2570. pointerlockerror: pointerlockerror,
  2571. pointermove: pointermove,
  2572. pointerout: pointerout,
  2573. pointerover: pointerover,
  2574. pointerup: pointerup,
  2575. play: play,
  2576. playing: playing,
  2577. popstate: popstate,
  2578. progress: progress,
  2579. push: push,
  2580. pushsubscriptionchange: pushsubscriptionchange,
  2581. ratechange: ratechange,
  2582. readystatechange: readystatechange,
  2583. repeatEvent: repeatEvent,
  2584. reset: reset,
  2585. resize: resize,
  2586. resourcetimingbufferfull: resourcetimingbufferfull,
  2587. result: result,
  2588. resume: resume,
  2589. scroll: scroll,
  2590. seeked: seeked,
  2591. seeking: seeking,
  2592. select: select,
  2593. selectstart: selectstart,
  2594. selectionchange: selectionchange,
  2595. show: show,
  2596. slotchange: slotchange,
  2597. soundend: soundend,
  2598. soundstart: soundstart,
  2599. speechend: speechend,
  2600. speechstart: speechstart,
  2601. stalled: stalled,
  2602. start: start,
  2603. storage: storage,
  2604. submit: submit,
  2605. success: success,
  2606. suspend: suspend,
  2607. SVGAbort: SVGAbort,
  2608. SVGError: SVGError,
  2609. SVGLoad: SVGLoad,
  2610. SVGResize: SVGResize,
  2611. SVGScroll: SVGScroll,
  2612. SVGUnload: SVGUnload,
  2613. SVGZoom: SVGZoom,
  2614. timeout: timeout,
  2615. timeupdate: timeupdate,
  2616. touchcancel: touchcancel,
  2617. touchend: touchend,
  2618. touchmove: touchmove,
  2619. touchstart: touchstart,
  2620. transitionend: transitionend,
  2621. unload: unload,
  2622. updateready: updateready,
  2623. userproximity: userproximity,
  2624. voiceschanged: voiceschanged,
  2625. visibilitychange: visibilitychange,
  2626. volumechange: volumechange,
  2627. waiting: waiting,
  2628. wheel: wheel,
  2629. default: domEventTypes
  2630. });
  2631. var require$$0 = ( domEventTypes$1 && domEventTypes ) || domEventTypes$1;
  2632. var domEventTypes$2 = require$$0;
  2633. var defaultEventType = {
  2634. eventInterface: 'Event',
  2635. cancelable: true,
  2636. bubbles: true
  2637. };
  2638. var modifiers = {
  2639. enter: 13,
  2640. tab: 9,
  2641. delete: 46,
  2642. esc: 27,
  2643. space: 32,
  2644. up: 38,
  2645. down: 40,
  2646. left: 37,
  2647. right: 39,
  2648. end: 35,
  2649. home: 36,
  2650. backspace: 8,
  2651. insert: 45,
  2652. pageup: 33,
  2653. pagedown: 34
  2654. };
  2655. function createEvent(
  2656. type,
  2657. modifier,
  2658. ref,
  2659. options
  2660. ) {
  2661. var eventInterface = ref.eventInterface;
  2662. var bubbles = ref.bubbles;
  2663. var cancelable = ref.cancelable;
  2664. var SupportedEventInterface =
  2665. typeof window[eventInterface] === 'function'
  2666. ? window[eventInterface]
  2667. : window.Event;
  2668. var event = new SupportedEventInterface(type, Object.assign({}, options,
  2669. {bubbles: bubbles,
  2670. cancelable: cancelable,
  2671. keyCode: modifiers[modifier]}));
  2672. return event
  2673. }
  2674. function createOldEvent(
  2675. type,
  2676. modifier,
  2677. ref
  2678. ) {
  2679. var eventInterface = ref.eventInterface;
  2680. var bubbles = ref.bubbles;
  2681. var cancelable = ref.cancelable;
  2682. var event = document.createEvent('Event');
  2683. event.initEvent(type, bubbles, cancelable);
  2684. event.keyCode = modifiers[modifier];
  2685. return event
  2686. }
  2687. function createDOMEvent(type, options) {
  2688. var ref = type.split('.');
  2689. var eventType = ref[0];
  2690. var modifier = ref[1];
  2691. var meta = domEventTypes$2[eventType] || defaultEventType;
  2692. // Fallback for IE10,11 - https://stackoverflow.com/questions/26596123
  2693. var event =
  2694. typeof window.Event === 'function'
  2695. ? createEvent(eventType, modifier, meta, options)
  2696. : createOldEvent(eventType, modifier, meta);
  2697. var eventPrototype = Object.getPrototypeOf(event);
  2698. Object.keys(options || {}).forEach(function (key) {
  2699. var propertyDescriptor = Object.getOwnPropertyDescriptor(
  2700. eventPrototype,
  2701. key
  2702. );
  2703. var canSetProperty = !(
  2704. propertyDescriptor && propertyDescriptor.setter === undefined
  2705. );
  2706. if (canSetProperty) {
  2707. event[key] = options[key];
  2708. }
  2709. });
  2710. return event
  2711. }
  2712. function errorHandler(errorOrString, vm) {
  2713. var error =
  2714. typeof errorOrString === 'object' ? errorOrString : new Error(errorOrString);
  2715. vm._error = error;
  2716. throw error
  2717. }
  2718. function throwIfInstancesThrew(vm) {
  2719. var instancesWithError = findAllInstances(vm).filter(function (_vm) { return _vm._error; });
  2720. if (instancesWithError.length > 0) {
  2721. throw instancesWithError[0]._error
  2722. }
  2723. }
  2724. var hasWarned = false;
  2725. // Vue swallows errors thrown by instances, even if the global error handler
  2726. // throws. In order to throw in the test, we add an _error property to an
  2727. // instance when it throws. Then we loop through the instances with
  2728. // throwIfInstancesThrew and throw an error in the test context if any
  2729. // instances threw.
  2730. function addGlobalErrorHandler(_Vue) {
  2731. var existingErrorHandler = _Vue.config.errorHandler;
  2732. if (existingErrorHandler === errorHandler) {
  2733. return
  2734. }
  2735. if (_Vue.config.errorHandler && !hasWarned) {
  2736. warn(
  2737. "Global error handler detected (Vue.config.errorHandler). \n" +
  2738. "Vue Test Utils sets a custom error handler to throw errors " +
  2739. "thrown by instances. If you want this behavior in " +
  2740. "your tests, you must remove the global error handler."
  2741. );
  2742. hasWarned = true;
  2743. } else {
  2744. _Vue.config.errorHandler = errorHandler;
  2745. }
  2746. }
  2747. //
  2748. var Wrapper = function Wrapper(
  2749. node,
  2750. options,
  2751. isVueWrapper
  2752. ) {
  2753. var vnode = node instanceof Element ? null : node;
  2754. var element = node instanceof Element ? node : node.elm;
  2755. // Prevent redefine by VueWrapper
  2756. if (!isVueWrapper) {
  2757. // $FlowIgnore : issue with defineProperty
  2758. Object.defineProperty(this, 'rootNode', {
  2759. get: function () { return vnode || element; },
  2760. set: function () { return throwError('wrapper.rootNode is read-only'); }
  2761. });
  2762. // $FlowIgnore
  2763. Object.defineProperty(this, 'vnode', {
  2764. get: function () { return vnode; },
  2765. set: function () { return throwError('wrapper.vnode is read-only'); }
  2766. });
  2767. // $FlowIgnore
  2768. Object.defineProperty(this, 'element', {
  2769. get: function () { return element; },
  2770. set: function () { return throwError('wrapper.element is read-only'); }
  2771. });
  2772. // $FlowIgnore
  2773. Object.defineProperty(this, 'vm', {
  2774. get: function () { return undefined; },
  2775. set: function () { return throwError('wrapper.vm is read-only'); }
  2776. });
  2777. }
  2778. var frozenOptions = Object.freeze(options);
  2779. // $FlowIgnore
  2780. Object.defineProperty(this, 'options', {
  2781. get: function () { return frozenOptions; },
  2782. set: function () { return throwError('wrapper.options is read-only'); }
  2783. });
  2784. if (
  2785. this.vnode &&
  2786. (this.vnode[FUNCTIONAL_OPTIONS] || this.vnode.functionalContext)
  2787. ) {
  2788. this.isFunctionalComponent = true;
  2789. }
  2790. };
  2791. Wrapper.prototype.at = function at () {
  2792. throwError('at() must be called on a WrapperArray');
  2793. };
  2794. /**
  2795. * Returns an Object containing all the attribute/value pairs on the element.
  2796. */
  2797. Wrapper.prototype.attributes = function attributes (key) {
  2798. var attributes = this.element.attributes;
  2799. var attributeMap = {};
  2800. for (var i = 0; i < attributes.length; i++) {
  2801. var att = attributes.item(i);
  2802. attributeMap[att.localName] = att.value;
  2803. }
  2804. return key ? attributeMap[key] : attributeMap
  2805. };
  2806. /**
  2807. * Returns an Array containing all the classes on the element
  2808. */
  2809. Wrapper.prototype.classes = function classes (className) {
  2810. var this$1 = this;
  2811. var classAttribute = this.element.getAttribute('class');
  2812. var classes = classAttribute ? classAttribute.split(' ') : [];
  2813. // Handle converting cssmodules identifiers back to the original class name
  2814. if (this.vm && this.vm.$style) {
  2815. var cssModuleIdentifiers = Object.keys(this.vm.$style).reduce(
  2816. function (acc, key) {
  2817. // $FlowIgnore
  2818. var moduleIdent = this$1.vm.$style[key];
  2819. if (moduleIdent) {
  2820. acc[moduleIdent.split(' ')[0]] = key;
  2821. }
  2822. return acc
  2823. },
  2824. {}
  2825. );
  2826. classes = classes.map(function (name) { return cssModuleIdentifiers[name] || name; });
  2827. }
  2828. return className ? !!(classes.indexOf(className) > -1) : classes
  2829. };
  2830. /**
  2831. * Checks if wrapper contains provided selector.
  2832. */
  2833. Wrapper.prototype.contains = function contains (rawSelector) {
  2834. var selector = getSelector(rawSelector, 'contains');
  2835. var nodes = find(this.rootNode, this.vm, selector);
  2836. return nodes.length > 0
  2837. };
  2838. /**
  2839. * Calls destroy on vm
  2840. */
  2841. Wrapper.prototype.destroy = function destroy () {
  2842. if (!this.isVueInstance()) {
  2843. throwError("wrapper.destroy() can only be called on a Vue instance");
  2844. }
  2845. if (this.element.parentNode) {
  2846. this.element.parentNode.removeChild(this.element);
  2847. }
  2848. // $FlowIgnore
  2849. this.vm.$destroy();
  2850. throwIfInstancesThrew(this.vm);
  2851. };
  2852. /**
  2853. * Returns an object containing custom events emitted by the Wrapper vm
  2854. */
  2855. Wrapper.prototype.emitted = function emitted (
  2856. event
  2857. ) {
  2858. if (!this._emitted && !this.vm) {
  2859. throwError("wrapper.emitted() can only be called on a Vue instance");
  2860. }
  2861. if (event) {
  2862. return this._emitted[event]
  2863. }
  2864. return this._emitted
  2865. };
  2866. /**
  2867. * Returns an Array containing custom events emitted by the Wrapper vm
  2868. */
  2869. Wrapper.prototype.emittedByOrder = function emittedByOrder () {
  2870. if (!this._emittedByOrder && !this.vm) {
  2871. throwError(
  2872. "wrapper.emittedByOrder() can only be called on a Vue instance"
  2873. );
  2874. }
  2875. return this._emittedByOrder
  2876. };
  2877. /**
  2878. * Utility to check wrapper exists. Returns true as Wrapper always exists
  2879. */
  2880. Wrapper.prototype.exists = function exists () {
  2881. if (this.vm) {
  2882. return !!this.vm && !this.vm._isDestroyed
  2883. }
  2884. return true
  2885. };
  2886. Wrapper.prototype.filter = function filter () {
  2887. throwError('filter() must be called on a WrapperArray');
  2888. };
  2889. /**
  2890. * Finds first node in tree of the current wrapper that
  2891. * matches the provided selector.
  2892. */
  2893. Wrapper.prototype.find = function find$1 (rawSelector) {
  2894. var selector = getSelector(rawSelector, 'find');
  2895. var node = find(this.rootNode, this.vm, selector)[0];
  2896. if (!node) {
  2897. if (selector.type === REF_SELECTOR) {
  2898. return new ErrorWrapper(("ref=\"" + (selector.value.ref) + "\""))
  2899. }
  2900. return new ErrorWrapper(
  2901. typeof selector.value === 'string' ? selector.value : 'Component'
  2902. )
  2903. }
  2904. return createWrapper(node, this.options)
  2905. };
  2906. /**
  2907. * Finds node in tree of the current wrapper that matches
  2908. * the provided selector.
  2909. */
  2910. Wrapper.prototype.findAll = function findAll (rawSelector) {
  2911. var this$1 = this;
  2912. var selector = getSelector(rawSelector, 'findAll');
  2913. var nodes = find(this.rootNode, this.vm, selector);
  2914. var wrappers = nodes.map(function (node) {
  2915. // Using CSS Selector, returns a VueWrapper instance if the root element
  2916. // binds a Vue instance.
  2917. return createWrapper(node, this$1.options)
  2918. });
  2919. return new WrapperArray(wrappers)
  2920. };
  2921. /**
  2922. * Returns HTML of element as a string
  2923. */
  2924. Wrapper.prototype.html = function html () {
  2925. return this.element.outerHTML
  2926. };
  2927. /**
  2928. * Checks if node matches selector
  2929. */
  2930. Wrapper.prototype.is = function is (rawSelector) {
  2931. var selector = getSelector(rawSelector, 'is');
  2932. if (selector.type === REF_SELECTOR) {
  2933. throwError('$ref selectors can not be used with wrapper.is()');
  2934. }
  2935. return matches(this.rootNode, selector)
  2936. };
  2937. /**
  2938. * Checks if node is empty
  2939. */
  2940. Wrapper.prototype.isEmpty = function isEmpty () {
  2941. if (!this.vnode) {
  2942. return this.element.innerHTML === ''
  2943. }
  2944. var nodes = [];
  2945. var node = this.vnode;
  2946. var i = 0;
  2947. while (node) {
  2948. if (node.child) {
  2949. nodes.push(node.child._vnode);
  2950. }
  2951. node.children &&
  2952. node.children.forEach(function (n) {
  2953. nodes.push(n);
  2954. });
  2955. node = nodes[i++];
  2956. }
  2957. return nodes.every(function (n) { return n.isComment || n.child; })
  2958. };
  2959. /**
  2960. * Checks if node is visible
  2961. */
  2962. Wrapper.prototype.isVisible = function isVisible () {
  2963. var element = this.element;
  2964. while (element) {
  2965. if (
  2966. element.style &&
  2967. (element.style.visibility === 'hidden' ||
  2968. element.style.display === 'none')
  2969. ) {
  2970. return false
  2971. }
  2972. element = element.parentElement;
  2973. }
  2974. return true
  2975. };
  2976. /**
  2977. * Checks if wrapper is a vue instance
  2978. */
  2979. Wrapper.prototype.isVueInstance = function isVueInstance () {
  2980. return !!this.vm
  2981. };
  2982. /**
  2983. * Returns name of component, or tag name if node is not a Vue component
  2984. */
  2985. Wrapper.prototype.name = function name () {
  2986. if (this.vm) {
  2987. return (
  2988. this.vm.$options.name ||
  2989. // compat for Vue < 2.3
  2990. (this.vm.$options.extendOptions && this.vm.$options.extendOptions.name)
  2991. )
  2992. }
  2993. if (!this.vnode) {
  2994. return this.element.tagName
  2995. }
  2996. return this.vnode.tag
  2997. };
  2998. /**
  2999. * Returns an Object containing the prop name/value pairs on the element
  3000. */
  3001. Wrapper.prototype.props = function props (key) {
  3002. var this$1 = this;
  3003. if (this.isFunctionalComponent) {
  3004. throwError(
  3005. "wrapper.props() cannot be called on a mounted functional component."
  3006. );
  3007. }
  3008. if (!this.vm) {
  3009. throwError('wrapper.props() must be called on a Vue instance');
  3010. }
  3011. var props = {};
  3012. var keys = this.vm && this.vm.$options._propKeys;
  3013. if (keys) {
  3014. (keys || {}).forEach(function (key) {
  3015. if (this$1.vm) {
  3016. props[key] = this$1.vm[key];
  3017. }
  3018. });
  3019. }
  3020. if (key) {
  3021. return props[key]
  3022. }
  3023. return props
  3024. };
  3025. /**
  3026. * Checks radio button or checkbox element
  3027. */
  3028. Wrapper.prototype.setChecked = function setChecked (checked) {
  3029. if ( checked === void 0 ) checked = true;
  3030. if (typeof checked !== 'boolean') {
  3031. throwError('wrapper.setChecked() must be passed a boolean');
  3032. }
  3033. var tagName = this.element.tagName;
  3034. // $FlowIgnore
  3035. var type = this.attributes().type;
  3036. var event = getCheckedEvent();
  3037. if (tagName === 'INPUT' && type === 'checkbox') {
  3038. if (this.element.checked === checked) {
  3039. return
  3040. }
  3041. if (event !== 'click' || isPhantomJS) {
  3042. // $FlowIgnore
  3043. this.element.checked = checked;
  3044. }
  3045. this.trigger(event);
  3046. return
  3047. }
  3048. if (tagName === 'INPUT' && type === 'radio') {
  3049. if (!checked) {
  3050. throwError(
  3051. "wrapper.setChecked() cannot be called with parameter false on a " +
  3052. "<input type=\"radio\" /> element."
  3053. );
  3054. }
  3055. if (event !== 'click' || isPhantomJS) {
  3056. // $FlowIgnore
  3057. this.element.selected = true;
  3058. }
  3059. this.trigger(event);
  3060. return
  3061. }
  3062. throwError("wrapper.setChecked() cannot be called on this element");
  3063. };
  3064. /**
  3065. * Selects <option></option> element
  3066. */
  3067. Wrapper.prototype.setSelected = function setSelected () {
  3068. var tagName = this.element.tagName;
  3069. if (tagName === 'SELECT') {
  3070. throwError(
  3071. "wrapper.setSelected() cannot be called on select. Call it on one of " +
  3072. "its options"
  3073. );
  3074. }
  3075. if (tagName === 'OPTION') {
  3076. // $FlowIgnore
  3077. this.element.selected = true;
  3078. // $FlowIgnore
  3079. var parentElement = this.element.parentElement;
  3080. // $FlowIgnore
  3081. if (parentElement.tagName === 'OPTGROUP') {
  3082. // $FlowIgnore
  3083. parentElement = parentElement.parentElement;
  3084. }
  3085. // $FlowIgnore
  3086. createWrapper(parentElement, this.options).trigger('change');
  3087. return
  3088. }
  3089. throwError("wrapper.setSelected() cannot be called on this element");
  3090. };
  3091. /**
  3092. * Sets vm data
  3093. */
  3094. Wrapper.prototype.setData = function setData (data) {
  3095. if (this.isFunctionalComponent) {
  3096. throwError("wrapper.setData() cannot be called on a functional component");
  3097. }
  3098. if (!this.vm) {
  3099. throwError("wrapper.setData() can only be called on a Vue instance");
  3100. }
  3101. recursivelySetData(this.vm, this.vm, data);
  3102. };
  3103. /**
  3104. * Sets vm methods
  3105. */
  3106. Wrapper.prototype.setMethods = function setMethods (methods) {
  3107. var this$1 = this;
  3108. if (!this.isVueInstance()) {
  3109. throwError("wrapper.setMethods() can only be called on a Vue instance");
  3110. }
  3111. Object.keys(methods).forEach(function (key) {
  3112. // $FlowIgnore : Problem with possibly null this.vm
  3113. this$1.vm[key] = methods[key];
  3114. // $FlowIgnore : Problem with possibly null this.vm
  3115. this$1.vm.$options.methods[key] = methods[key];
  3116. });
  3117. if (this.vnode) {
  3118. var context = this.vnode.context;
  3119. if (context.$options.render) { context._update(context._render()); }
  3120. }
  3121. };
  3122. /**
  3123. * Sets vm props
  3124. */
  3125. Wrapper.prototype.setProps = function setProps (data) {
  3126. var this$1 = this;
  3127. var originalConfig = Vue.config.silent;
  3128. Vue.config.silent = config.silent;
  3129. if (this.isFunctionalComponent) {
  3130. throwError(
  3131. "wrapper.setProps() cannot be called on a functional component"
  3132. );
  3133. }
  3134. if (!this.vm) {
  3135. throwError("wrapper.setProps() can only be called on a Vue instance");
  3136. }
  3137. Object.keys(data).forEach(function (key) {
  3138. if (
  3139. typeof data[key] === 'object' &&
  3140. data[key] !== null &&
  3141. // $FlowIgnore : Problem with possibly null this.vm
  3142. data[key] === this$1.vm[key]
  3143. ) {
  3144. throwError(
  3145. "wrapper.setProps() called with the same object of the existing " +
  3146. key + " property. You must call wrapper.setProps() with a new " +
  3147. "object to trigger reactivity"
  3148. );
  3149. }
  3150. if (
  3151. !this$1.vm ||
  3152. !this$1.vm.$options._propKeys ||
  3153. !this$1.vm.$options._propKeys.some(function (prop) { return prop === key; })
  3154. ) {
  3155. if (VUE_VERSION > 2.3) {
  3156. // $FlowIgnore : Problem with possibly null this.vm
  3157. this$1.vm.$attrs[key] = data[key];
  3158. return
  3159. }
  3160. throwError(
  3161. "wrapper.setProps() called with " + key + " property which " +
  3162. "is not defined on the component"
  3163. );
  3164. }
  3165. if (this$1.vm && this$1.vm._props) {
  3166. // Set actual props value
  3167. this$1.vm._props[key] = data[key];
  3168. // $FlowIgnore : Problem with possibly null this.vm
  3169. this$1.vm[key] = data[key];
  3170. } else {
  3171. // $FlowIgnore : Problem with possibly null this.vm.$options
  3172. this$1.vm.$options.propsData[key] = data[key];
  3173. // $FlowIgnore : Problem with possibly null this.vm
  3174. this$1.vm[key] = data[key];
  3175. // $FlowIgnore : Need to call this twice to fix watcher bug in 2.0.x
  3176. this$1.vm[key] = data[key];
  3177. }
  3178. });
  3179. // $FlowIgnore : Problem with possibly null this.vm
  3180. this.vm.$forceUpdate();
  3181. if (this.options.sync === COMPAT_SYNC_MODE) {
  3182. // $FlowIgnore : Problem with possibly null this.vm
  3183. orderWatchers(this.vm || this.vnode.context.$root);
  3184. }
  3185. Vue.config.silent = originalConfig;
  3186. };
  3187. /**
  3188. * Sets element value and triggers input event
  3189. */
  3190. Wrapper.prototype.setValue = function setValue (value) {
  3191. var tagName = this.element.tagName;
  3192. // $FlowIgnore
  3193. var type = this.attributes().type;
  3194. if (tagName === 'OPTION') {
  3195. throwError(
  3196. "wrapper.setValue() cannot be called on an <option> element. Use " +
  3197. "wrapper.setSelected() instead"
  3198. );
  3199. } else if (tagName === 'INPUT' && type === 'checkbox') {
  3200. throwError(
  3201. "wrapper.setValue() cannot be called on a <input type=\"checkbox\" /> " +
  3202. "element. Use wrapper.setChecked() instead"
  3203. );
  3204. } else if (tagName === 'INPUT' && type === 'radio') {
  3205. throwError(
  3206. "wrapper.setValue() cannot be called on a <input type=\"radio\" /> " +
  3207. "element. Use wrapper.setChecked() instead"
  3208. );
  3209. } else if (
  3210. tagName === 'INPUT' ||
  3211. tagName === 'TEXTAREA' ||
  3212. tagName === 'SELECT'
  3213. ) {
  3214. var event = tagName === 'SELECT' ? 'change' : 'input';
  3215. // $FlowIgnore
  3216. this.element.value = value;
  3217. this.trigger(event);
  3218. } else {
  3219. throwError("wrapper.setValue() cannot be called on this element");
  3220. }
  3221. };
  3222. /**
  3223. * Return text of wrapper element
  3224. */
  3225. Wrapper.prototype.text = function text () {
  3226. return this.element.textContent.trim()
  3227. };
  3228. /**
  3229. * Dispatches a DOM event on wrapper
  3230. */
  3231. Wrapper.prototype.trigger = function trigger (type, options) {
  3232. if ( options === void 0 ) options = {};
  3233. if (typeof type !== 'string') {
  3234. throwError('wrapper.trigger() must be passed a string');
  3235. }
  3236. if (options.target) {
  3237. throwError(
  3238. "you cannot set the target value of an event. See the notes section " +
  3239. "of the docs for more details—" +
  3240. "https://vue-test-utils.vuejs.org/api/wrapper/trigger.html"
  3241. );
  3242. }
  3243. // Don't fire event on a disabled element
  3244. if (this.attributes().disabled) {
  3245. return
  3246. }
  3247. var event = createDOMEvent(type, options);
  3248. this.element.dispatchEvent(event);
  3249. if (this.vnode && this.options.sync === COMPAT_SYNC_MODE) {
  3250. orderWatchers(this.vm || this.vnode.context.$root);
  3251. }
  3252. };
  3253. Wrapper.prototype.update = function update () {
  3254. warn(
  3255. "update has been removed from vue-test-utils. All updates are now " +
  3256. "synchronous by default"
  3257. );
  3258. };
  3259. //
  3260. function setDepsSync(dep) {
  3261. dep.subs.forEach(setWatcherSync);
  3262. }
  3263. function setWatcherSync(watcher) {
  3264. if (watcher.sync === true) {
  3265. return
  3266. }
  3267. watcher.sync = true;
  3268. watcher.deps.forEach(setDepsSync);
  3269. }
  3270. function setWatchersToSync(vm) {
  3271. if (vm._watchers) {
  3272. vm._watchers.forEach(setWatcherSync);
  3273. }
  3274. if (vm._computedWatchers) {
  3275. Object.keys(vm._computedWatchers).forEach(function (computedWatcher) {
  3276. setWatcherSync(vm._computedWatchers[computedWatcher]);
  3277. });
  3278. }
  3279. setWatcherSync(vm._watcher);
  3280. vm.$children.forEach(setWatchersToSync);
  3281. // preventing double registration
  3282. if (!vm.$_vueTestUtils_updateInSetWatcherSync) {
  3283. vm.$_vueTestUtils_updateInSetWatcherSync = vm._update;
  3284. vm._update = function(vnode, hydrating) {
  3285. var this$1 = this;
  3286. this.$_vueTestUtils_updateInSetWatcherSync(vnode, hydrating);
  3287. if (VUE_VERSION >= 2.1 && this._isMounted && this.$options.updated) {
  3288. this.$options.updated.forEach(function (handler) {
  3289. handler.call(this$1);
  3290. });
  3291. }
  3292. };
  3293. }
  3294. }
  3295. //
  3296. var VueWrapper = (function (Wrapper$$1) {
  3297. function VueWrapper(vm, options) {
  3298. var this$1 = this;
  3299. Wrapper$$1.call(this, vm._vnode, options, true);
  3300. // $FlowIgnore : issue with defineProperty
  3301. Object.defineProperty(this, 'rootNode', {
  3302. get: function () { return vm.$vnode || { child: this$1.vm }; },
  3303. set: function () { return throwError('wrapper.vnode is read-only'); }
  3304. });
  3305. // $FlowIgnore : issue with defineProperty
  3306. Object.defineProperty(this, 'vnode', {
  3307. get: function () { return vm._vnode; },
  3308. set: function () { return throwError('wrapper.vnode is read-only'); }
  3309. });
  3310. // $FlowIgnore
  3311. Object.defineProperty(this, 'element', {
  3312. get: function () { return vm.$el; },
  3313. set: function () { return throwError('wrapper.element is read-only'); }
  3314. });
  3315. // $FlowIgnore
  3316. Object.defineProperty(this, 'vm', {
  3317. get: function () { return vm; },
  3318. set: function () { return throwError('wrapper.vm is read-only'); }
  3319. });
  3320. if (options.sync === COMPAT_SYNC_MODE) {
  3321. setWatchersToSync(vm);
  3322. orderWatchers(vm);
  3323. }
  3324. this.isFunctionalComponent = vm.$options._isFunctionalContainer;
  3325. this._emitted = vm.__emitted;
  3326. this._emittedByOrder = vm.__emittedByOrder;
  3327. }
  3328. if ( Wrapper$$1 ) VueWrapper.__proto__ = Wrapper$$1;
  3329. VueWrapper.prototype = Object.create( Wrapper$$1 && Wrapper$$1.prototype );
  3330. VueWrapper.prototype.constructor = VueWrapper;
  3331. return VueWrapper;
  3332. }(Wrapper));
  3333. //
  3334. function createVNodes(vm, slotValue, name) {
  3335. var el = vueTemplateCompiler.compileToFunctions(
  3336. ("<div><template slot=" + name + ">" + slotValue + "</template></div>")
  3337. );
  3338. var _staticRenderFns = vm._renderProxy.$options.staticRenderFns;
  3339. var _staticTrees = vm._renderProxy._staticTrees;
  3340. vm._renderProxy._staticTrees = [];
  3341. vm._renderProxy.$options.staticRenderFns = el.staticRenderFns;
  3342. var vnode = el.render.call(vm._renderProxy, vm.$createElement);
  3343. vm._renderProxy.$options.staticRenderFns = _staticRenderFns;
  3344. vm._renderProxy._staticTrees = _staticTrees;
  3345. return vnode.children[0]
  3346. }
  3347. function createVNodesForSlot(
  3348. vm,
  3349. slotValue,
  3350. name
  3351. ) {
  3352. if (typeof slotValue === 'string') {
  3353. return createVNodes(vm, slotValue, name)
  3354. }
  3355. var vnode = vm.$createElement(slotValue)
  3356. ;(vnode.data || (vnode.data = {})).slot = name;
  3357. return vnode
  3358. }
  3359. function createSlotVNodes(
  3360. vm,
  3361. slots
  3362. ) {
  3363. return Object.keys(slots).reduce(function (acc, key) {
  3364. var content = slots[key];
  3365. if (Array.isArray(content)) {
  3366. var nodes = content.map(function (slotDef) { return createVNodesForSlot(vm, slotDef, key); }
  3367. );
  3368. return acc.concat(nodes)
  3369. }
  3370. return acc.concat(createVNodesForSlot(vm, content, key))
  3371. }, [])
  3372. }
  3373. //
  3374. function addMocks(
  3375. _Vue,
  3376. mockedProperties
  3377. ) {
  3378. if ( mockedProperties === void 0 ) mockedProperties = {};
  3379. if (mockedProperties === false) {
  3380. return
  3381. }
  3382. Object.keys(mockedProperties).forEach(function (key) {
  3383. try {
  3384. // $FlowIgnore
  3385. _Vue.prototype[key] = mockedProperties[key];
  3386. } catch (e) {
  3387. warn(
  3388. "could not overwrite property " + key + ", this is " +
  3389. "usually caused by a plugin that has added " +
  3390. "the property as a read-only value"
  3391. );
  3392. }
  3393. // $FlowIgnore
  3394. Vue.util.defineReactive(_Vue, key, mockedProperties[key]);
  3395. });
  3396. }
  3397. //
  3398. function logEvents(
  3399. vm,
  3400. emitted,
  3401. emittedByOrder
  3402. ) {
  3403. var emit = vm.$emit;
  3404. vm.$emit = function (name) {
  3405. var args = [], len = arguments.length - 1;
  3406. while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
  3407. (emitted[name] || (emitted[name] = [])).push(args);
  3408. emittedByOrder.push({ name: name, args: args });
  3409. return emit.call.apply(emit, [ vm, name ].concat( args ))
  3410. };
  3411. }
  3412. function addEventLogger(_Vue) {
  3413. _Vue.mixin({
  3414. beforeCreate: function() {
  3415. this.__emitted = Object.create(null);
  3416. this.__emittedByOrder = [];
  3417. logEvents(this, this.__emitted, this.__emittedByOrder);
  3418. }
  3419. });
  3420. }
  3421. function addStubs(_Vue, stubComponents) {
  3422. var obj;
  3423. function addStubComponentsMixin() {
  3424. Object.assign(this.$options.components, stubComponents);
  3425. }
  3426. _Vue.mixin(( obj = {}, obj[BEFORE_RENDER_LIFECYCLE_HOOK] = addStubComponentsMixin, obj));
  3427. }
  3428. //
  3429. function compileFromString(str) {
  3430. if (!vueTemplateCompiler.compileToFunctions) {
  3431. throwError(
  3432. "vueTemplateCompiler is undefined, you must pass " +
  3433. "precompiled components if vue-template-compiler is " +
  3434. "undefined"
  3435. );
  3436. }
  3437. return vueTemplateCompiler.compileToFunctions(str)
  3438. }
  3439. function compileTemplate(component) {
  3440. if (component.template) {
  3441. Object.assign(component, vueTemplateCompiler.compileToFunctions(component.template));
  3442. }
  3443. if (component.components) {
  3444. Object.keys(component.components).forEach(function (c) {
  3445. var cmp = component.components[c];
  3446. if (!cmp.render) {
  3447. compileTemplate(cmp);
  3448. }
  3449. });
  3450. }
  3451. if (component.extends) {
  3452. compileTemplate(component.extends);
  3453. }
  3454. if (component.extendOptions && !component.options.render) {
  3455. compileTemplate(component.options);
  3456. }
  3457. }
  3458. function compileTemplateForSlots(slots) {
  3459. Object.keys(slots).forEach(function (key) {
  3460. var slot = Array.isArray(slots[key]) ? slots[key] : [slots[key]];
  3461. slot.forEach(function (slotValue) {
  3462. if (componentNeedsCompiling(slotValue)) {
  3463. compileTemplate(slotValue);
  3464. }
  3465. });
  3466. });
  3467. }
  3468. //
  3469. var MOUNTING_OPTIONS = [
  3470. 'attachToDocument',
  3471. 'mocks',
  3472. 'slots',
  3473. 'localVue',
  3474. 'stubs',
  3475. 'context',
  3476. 'clone',
  3477. 'attrs',
  3478. 'listeners',
  3479. 'propsData',
  3480. 'sync',
  3481. 'shouldProxy'
  3482. ];
  3483. function extractInstanceOptions(options) {
  3484. var instanceOptions = Object.assign({}, options);
  3485. MOUNTING_OPTIONS.forEach(function (mountingOption) {
  3486. delete instanceOptions[mountingOption];
  3487. });
  3488. return instanceOptions
  3489. }
  3490. //
  3491. function isDestructuringSlotScope(slotScope) {
  3492. return slotScope[0] === '{' && slotScope[slotScope.length - 1] === '}'
  3493. }
  3494. function getVueTemplateCompilerHelpers(
  3495. _Vue
  3496. ) {
  3497. // $FlowIgnore
  3498. var vue = new _Vue();
  3499. var helpers = {};
  3500. var names = [
  3501. '_c',
  3502. '_o',
  3503. '_n',
  3504. '_s',
  3505. '_l',
  3506. '_t',
  3507. '_q',
  3508. '_i',
  3509. '_m',
  3510. '_f',
  3511. '_k',
  3512. '_b',
  3513. '_v',
  3514. '_e',
  3515. '_u',
  3516. '_g'
  3517. ];
  3518. names.forEach(function (name) {
  3519. helpers[name] = vue._renderProxy[name];
  3520. });
  3521. helpers.$createElement = vue._renderProxy.$createElement;
  3522. return helpers
  3523. }
  3524. function validateEnvironment() {
  3525. if (VUE_VERSION < 2.1) {
  3526. throwError("the scopedSlots option is only supported in vue@2.1+.");
  3527. }
  3528. }
  3529. var slotScopeRe = /<[^>]+ slot-scope=\"(.+)\"/;
  3530. // Hide warning about <template> disallowed as root element
  3531. function customWarn(msg) {
  3532. if (msg.indexOf('Cannot use <template> as component root element') === -1) {
  3533. console.error(msg);
  3534. }
  3535. }
  3536. function createScopedSlots(
  3537. scopedSlotsOption,
  3538. _Vue
  3539. ) {
  3540. var scopedSlots = {};
  3541. if (!scopedSlotsOption) {
  3542. return scopedSlots
  3543. }
  3544. validateEnvironment();
  3545. var helpers = getVueTemplateCompilerHelpers(_Vue);
  3546. var loop = function ( scopedSlotName ) {
  3547. var slot = scopedSlotsOption[scopedSlotName];
  3548. var isFn = typeof slot === 'function';
  3549. // Type check to silence flow (can't use isFn)
  3550. var renderFn =
  3551. typeof slot === 'function'
  3552. ? slot
  3553. : vueTemplateCompiler.compileToFunctions(slot, { warn: customWarn }).render;
  3554. var hasSlotScopeAttr = !isFn && slot.match(slotScopeRe);
  3555. var slotScope = hasSlotScopeAttr && hasSlotScopeAttr[1];
  3556. scopedSlots[scopedSlotName] = function(props) {
  3557. var obj;
  3558. var res;
  3559. if (isFn) {
  3560. res = renderFn.call(Object.assign({}, helpers), props);
  3561. } else if (slotScope && !isDestructuringSlotScope(slotScope)) {
  3562. res = renderFn.call(Object.assign({}, helpers, ( obj = {}, obj[slotScope] = props, obj)));
  3563. } else if (slotScope && isDestructuringSlotScope(slotScope)) {
  3564. res = renderFn.call(Object.assign({}, helpers, props));
  3565. } else {
  3566. res = renderFn.call(Object.assign({}, helpers, {props: props}));
  3567. }
  3568. // res is Array if <template> is a root element
  3569. return Array.isArray(res) ? res[0] : res
  3570. };
  3571. };
  3572. for (var scopedSlotName in scopedSlotsOption) loop( scopedSlotName );
  3573. return scopedSlots
  3574. }
  3575. //
  3576. function isVueComponentStub(comp) {
  3577. return (comp && comp.template) || isVueComponent(comp)
  3578. }
  3579. function isValidStub(stub) {
  3580. return (
  3581. typeof stub === 'boolean' ||
  3582. (!!stub && typeof stub === 'string') ||
  3583. isVueComponentStub(stub)
  3584. )
  3585. }
  3586. function resolveComponent$1(obj, component) {
  3587. return (
  3588. obj[component] ||
  3589. obj[hyphenate(component)] ||
  3590. obj[camelize(component)] ||
  3591. obj[capitalize(camelize(component))] ||
  3592. obj[capitalize(component)] ||
  3593. {}
  3594. )
  3595. }
  3596. function getCoreProperties(componentOptions) {
  3597. return {
  3598. attrs: componentOptions.attrs,
  3599. name: componentOptions.name,
  3600. props: componentOptions.props,
  3601. on: componentOptions.on,
  3602. key: componentOptions.key,
  3603. ref: componentOptions.ref,
  3604. domProps: componentOptions.domProps,
  3605. class: componentOptions.class,
  3606. staticClass: componentOptions.staticClass,
  3607. staticStyle: componentOptions.staticStyle,
  3608. style: componentOptions.style,
  3609. normalizedStyle: componentOptions.normalizedStyle,
  3610. nativeOn: componentOptions.nativeOn,
  3611. functional: componentOptions.functional
  3612. }
  3613. }
  3614. function createClassString(staticClass, dynamicClass) {
  3615. if (staticClass && dynamicClass) {
  3616. return staticClass + ' ' + dynamicClass
  3617. }
  3618. return staticClass || dynamicClass
  3619. }
  3620. function resolveOptions(component, _Vue) {
  3621. if (isDynamicComponent(component)) {
  3622. return {}
  3623. }
  3624. return isConstructor(component)
  3625. ? component.options
  3626. : _Vue.extend(component).options
  3627. }
  3628. function createStubFromComponent(
  3629. originalComponent,
  3630. name,
  3631. _Vue
  3632. ) {
  3633. var componentOptions = resolveOptions(originalComponent, _Vue);
  3634. var tagName = (name || 'anonymous') + "-stub";
  3635. // ignoreElements does not exist in Vue 2.0.x
  3636. if (Vue.config.ignoredElements) {
  3637. Vue.config.ignoredElements.push(tagName);
  3638. }
  3639. return Object.assign({}, getCoreProperties(componentOptions),
  3640. {$_vueTestUtils_original: originalComponent,
  3641. $_doNotStubChildren: true,
  3642. render: function render(h, context) {
  3643. return h(
  3644. tagName,
  3645. {
  3646. attrs: componentOptions.functional
  3647. ? Object.assign({}, context.props,
  3648. context.data.attrs,
  3649. {class: createClassString(
  3650. context.data.staticClass,
  3651. context.data.class
  3652. )})
  3653. : Object.assign({}, this.$props)
  3654. },
  3655. context ? context.children : this.$options._renderChildren
  3656. )
  3657. }})
  3658. }
  3659. function createStubFromString(
  3660. templateString,
  3661. originalComponent,
  3662. name,
  3663. _Vue
  3664. ) {
  3665. if ( originalComponent === void 0 ) originalComponent = {};
  3666. if (templateContainsComponent(templateString, name)) {
  3667. throwError('options.stub cannot contain a circular reference');
  3668. }
  3669. var componentOptions = resolveOptions(originalComponent, _Vue);
  3670. return Object.assign({}, getCoreProperties(componentOptions),
  3671. {$_doNotStubChildren: true},
  3672. compileFromString(templateString))
  3673. }
  3674. function validateStub(stub) {
  3675. if (!isValidStub(stub)) {
  3676. throwError("options.stub values must be passed a string or " + "component");
  3677. }
  3678. }
  3679. function createStubsFromStubsObject(
  3680. originalComponents,
  3681. stubs,
  3682. _Vue
  3683. ) {
  3684. if ( originalComponents === void 0 ) originalComponents = {};
  3685. return Object.keys(stubs || {}).reduce(function (acc, stubName) {
  3686. var stub = stubs[stubName];
  3687. validateStub(stub);
  3688. if (stub === false) {
  3689. return acc
  3690. }
  3691. if (stub === true) {
  3692. var component = resolveComponent$1(originalComponents, stubName);
  3693. acc[stubName] = createStubFromComponent(component, stubName, _Vue);
  3694. return acc
  3695. }
  3696. if (typeof stub === 'string') {
  3697. var component$1 = resolveComponent$1(originalComponents, stubName);
  3698. acc[stubName] = createStubFromString(stub, component$1, stubName, _Vue);
  3699. return acc
  3700. }
  3701. if (componentNeedsCompiling(stub)) {
  3702. compileTemplate(stub);
  3703. }
  3704. acc[stubName] = stub;
  3705. return acc
  3706. }, {})
  3707. }
  3708. var isWhitelisted = function (el, whitelist) { return resolveComponent(el, whitelist); };
  3709. var isAlreadyStubbed = function (el, stubs) { return stubs.has(el); };
  3710. function shouldExtend(component, _Vue) {
  3711. return isConstructor(component) || (component && component.extends)
  3712. }
  3713. function extend(component, _Vue) {
  3714. var componentOptions = component.options ? component.options : component;
  3715. var stub = _Vue.extend(componentOptions);
  3716. stub.options.$_vueTestUtils_original = component;
  3717. stub.options._base = _Vue;
  3718. return stub
  3719. }
  3720. function createStubIfNeeded(shouldStub, component, _Vue, el) {
  3721. if (shouldStub) {
  3722. return createStubFromComponent(component || {}, el, _Vue)
  3723. }
  3724. if (shouldExtend(component, _Vue)) {
  3725. return extend(component, _Vue)
  3726. }
  3727. }
  3728. function shouldNotBeStubbed(el, whitelist, modifiedComponents) {
  3729. return (
  3730. (typeof el === 'string' && isReservedTag(el)) ||
  3731. isWhitelisted(el, whitelist) ||
  3732. isAlreadyStubbed(el, modifiedComponents)
  3733. )
  3734. }
  3735. function patchCreateElement(_Vue, stubs, stubAllComponents) {
  3736. var obj;
  3737. // This mixin patches vm.$createElement so that we can stub all components
  3738. // before they are rendered in shallow mode. We also need to ensure that
  3739. // component constructors were created from the _Vue constructor. If not,
  3740. // we must replace them with components created from the _Vue constructor
  3741. // before calling the original $createElement. This ensures that components
  3742. // have the correct instance properties and stubs when they are rendered.
  3743. function patchCreateElementMixin() {
  3744. var vm = this;
  3745. if (vm.$options.$_doNotStubChildren || vm.$options._isFunctionalContainer) {
  3746. return
  3747. }
  3748. var modifiedComponents = new Set();
  3749. var originalCreateElement = vm.$createElement;
  3750. var originalComponents = vm.$options.components;
  3751. var createElement = function (el) {
  3752. var obj;
  3753. var args = [], len = arguments.length - 1;
  3754. while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
  3755. if (shouldNotBeStubbed(el, stubs, modifiedComponents)) {
  3756. return originalCreateElement.apply(void 0, [ el ].concat( args ))
  3757. }
  3758. if (isConstructor(el) || isComponentOptions(el)) {
  3759. if (stubAllComponents) {
  3760. var stub = createStubFromComponent(el, el.name || 'anonymous', _Vue);
  3761. return originalCreateElement.apply(void 0, [ stub ].concat( args ))
  3762. }
  3763. var Constructor = shouldExtend(el, _Vue) ? extend(el, _Vue) : el;
  3764. return originalCreateElement.apply(void 0, [ Constructor ].concat( args ))
  3765. }
  3766. if (typeof el === 'string') {
  3767. var original = resolveComponent(el, originalComponents);
  3768. if (!original) {
  3769. return originalCreateElement.apply(void 0, [ el ].concat( args ))
  3770. }
  3771. if (isDynamicComponent(original)) {
  3772. return originalCreateElement.apply(void 0, [ el ].concat( args ))
  3773. }
  3774. var stub$1 = createStubIfNeeded(stubAllComponents, original, _Vue, el);
  3775. if (stub$1) {
  3776. Object.assign(vm.$options.components, ( obj = {}, obj[el] = stub$1, obj));
  3777. modifiedComponents.add(el);
  3778. }
  3779. }
  3780. return originalCreateElement.apply(void 0, [ el ].concat( args ))
  3781. };
  3782. vm[CREATE_ELEMENT_ALIAS] = createElement;
  3783. vm.$createElement = createElement;
  3784. }
  3785. _Vue.mixin(( obj = {}, obj[BEFORE_RENDER_LIFECYCLE_HOOK] = patchCreateElementMixin, obj));
  3786. }
  3787. //
  3788. function createContext(options, scopedSlots) {
  3789. var on = Object.assign({}, (options.context && options.context.on),
  3790. options.listeners);
  3791. return Object.assign({}, {attrs: Object.assign({}, options.attrs,
  3792. // pass as attrs so that inheritAttrs works correctly
  3793. // propsData should take precedence over attrs
  3794. options.propsData)},
  3795. (options.context || {}),
  3796. {on: on,
  3797. scopedSlots: scopedSlots})
  3798. }
  3799. function createChildren(vm, h, ref) {
  3800. var slots = ref.slots;
  3801. var context = ref.context;
  3802. var slotVNodes = slots ? createSlotVNodes(vm, slots) : undefined;
  3803. return (
  3804. (context &&
  3805. context.children &&
  3806. context.children.map(function (x) { return (typeof x === 'function' ? x(h) : x); })) ||
  3807. slotVNodes
  3808. )
  3809. }
  3810. function createInstance(
  3811. component,
  3812. options,
  3813. _Vue
  3814. ) {
  3815. var componentOptions = isConstructor(component)
  3816. ? component.options
  3817. : component;
  3818. // instance options are options that are passed to the
  3819. // root instance when it's instantiated
  3820. var instanceOptions = extractInstanceOptions(options);
  3821. var stubComponentsObject = createStubsFromStubsObject(
  3822. componentOptions.components,
  3823. // $FlowIgnore
  3824. options.stubs,
  3825. _Vue
  3826. );
  3827. addEventLogger(_Vue);
  3828. addMocks(_Vue, options.mocks);
  3829. addStubs(_Vue, stubComponentsObject);
  3830. patchCreateElement(_Vue, stubComponentsObject, options.shouldProxy);
  3831. if (componentNeedsCompiling(componentOptions)) {
  3832. compileTemplate(componentOptions);
  3833. }
  3834. // used to identify extended component using constructor
  3835. componentOptions.$_vueTestUtils_original = component;
  3836. // make sure all extends are based on this instance
  3837. var Constructor = _Vue.extend(componentOptions).extend(instanceOptions);
  3838. Constructor.options._base = _Vue;
  3839. var scopedSlots = createScopedSlots(options.scopedSlots, _Vue);
  3840. var parentComponentOptions = options.parentComponent || {};
  3841. parentComponentOptions.provide = options.provide;
  3842. parentComponentOptions.$_doNotStubChildren = true;
  3843. parentComponentOptions._isFunctionalContainer = componentOptions.functional;
  3844. parentComponentOptions.render = function(h) {
  3845. return h(
  3846. Constructor,
  3847. createContext(options, scopedSlots),
  3848. createChildren(this, h, options)
  3849. )
  3850. };
  3851. var Parent = _Vue.extend(parentComponentOptions);
  3852. return new Parent()
  3853. }
  3854. //
  3855. function createElement() {
  3856. if (document) {
  3857. var elem = document.createElement('div');
  3858. if (document.body) {
  3859. document.body.appendChild(elem);
  3860. }
  3861. return elem
  3862. }
  3863. }
  3864. function normalizeStubs(stubs) {
  3865. if ( stubs === void 0 ) stubs = {};
  3866. if (stubs === false) {
  3867. return false
  3868. }
  3869. if (isPlainObject(stubs)) {
  3870. return stubs
  3871. }
  3872. if (Array.isArray(stubs)) {
  3873. return stubs.reduce(function (acc, stub) {
  3874. if (typeof stub !== 'string') {
  3875. throwError('each item in an options.stubs array must be a string');
  3876. }
  3877. acc[stub] = true;
  3878. return acc
  3879. }, {})
  3880. }
  3881. throwError('options.stubs must be an object or an Array');
  3882. }
  3883. function normalizeProvide(provide) {
  3884. // Objects are not resolved in extended components in Vue < 2.5
  3885. // https://github.com/vuejs/vue/issues/6436
  3886. if (typeof provide === 'object' && VUE_VERSION < 2.5) {
  3887. var obj = Object.assign({}, provide);
  3888. return function () { return obj; }
  3889. }
  3890. return provide
  3891. }
  3892. //
  3893. function getOption(option, config) {
  3894. if (option === false) {
  3895. return false
  3896. }
  3897. if (option || (config && Object.keys(config).length > 0)) {
  3898. if (option instanceof Function) {
  3899. return option
  3900. }
  3901. if (config instanceof Function) {
  3902. throw new Error("Config can't be a Function.")
  3903. }
  3904. return Object.assign({}, config,
  3905. option)
  3906. }
  3907. }
  3908. function mergeOptions(options, config) {
  3909. var mocks = (getOption(options.mocks, config.mocks));
  3910. var methods = (getOption(options.methods, config.methods));
  3911. var provide = (getOption(options.provide, config.provide));
  3912. return Object.assign({}, options,
  3913. {provide: normalizeProvide(provide),
  3914. stubs: getOption(normalizeStubs(options.stubs), config.stubs),
  3915. mocks: mocks,
  3916. methods: methods,
  3917. sync: !!(options.sync || options.sync === undefined)})
  3918. }
  3919. //
  3920. function warnIfNoWindow() {
  3921. if (typeof window === 'undefined') {
  3922. throwError(
  3923. "window is undefined, vue-test-utils needs to be " +
  3924. "run in a browser environment. \n" +
  3925. "You can run the tests in node using jsdom \n" +
  3926. "See https://vue-test-utils.vuejs.org/guides/#browser-environment " +
  3927. "for more details."
  3928. );
  3929. }
  3930. }
  3931. /**
  3932. * Removes all key-value entries from the list cache.
  3933. *
  3934. * @private
  3935. * @name clear
  3936. * @memberOf ListCache
  3937. */
  3938. function listCacheClear() {
  3939. this.__data__ = [];
  3940. this.size = 0;
  3941. }
  3942. var _listCacheClear = listCacheClear;
  3943. /**
  3944. * Performs a
  3945. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3946. * comparison between two values to determine if they are equivalent.
  3947. *
  3948. * @static
  3949. * @memberOf _
  3950. * @since 4.0.0
  3951. * @category Lang
  3952. * @param {*} value The value to compare.
  3953. * @param {*} other The other value to compare.
  3954. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  3955. * @example
  3956. *
  3957. * var object = { 'a': 1 };
  3958. * var other = { 'a': 1 };
  3959. *
  3960. * _.eq(object, object);
  3961. * // => true
  3962. *
  3963. * _.eq(object, other);
  3964. * // => false
  3965. *
  3966. * _.eq('a', 'a');
  3967. * // => true
  3968. *
  3969. * _.eq('a', Object('a'));
  3970. * // => false
  3971. *
  3972. * _.eq(NaN, NaN);
  3973. * // => true
  3974. */
  3975. function eq(value, other) {
  3976. return value === other || (value !== value && other !== other);
  3977. }
  3978. var eq_1 = eq;
  3979. /**
  3980. * Gets the index at which the `key` is found in `array` of key-value pairs.
  3981. *
  3982. * @private
  3983. * @param {Array} array The array to inspect.
  3984. * @param {*} key The key to search for.
  3985. * @returns {number} Returns the index of the matched value, else `-1`.
  3986. */
  3987. function assocIndexOf(array, key) {
  3988. var length = array.length;
  3989. while (length--) {
  3990. if (eq_1(array[length][0], key)) {
  3991. return length;
  3992. }
  3993. }
  3994. return -1;
  3995. }
  3996. var _assocIndexOf = assocIndexOf;
  3997. /** Used for built-in method references. */
  3998. var arrayProto = Array.prototype;
  3999. /** Built-in value references. */
  4000. var splice = arrayProto.splice;
  4001. /**
  4002. * Removes `key` and its value from the list cache.
  4003. *
  4004. * @private
  4005. * @name delete
  4006. * @memberOf ListCache
  4007. * @param {string} key The key of the value to remove.
  4008. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  4009. */
  4010. function listCacheDelete(key) {
  4011. var data = this.__data__,
  4012. index = _assocIndexOf(data, key);
  4013. if (index < 0) {
  4014. return false;
  4015. }
  4016. var lastIndex = data.length - 1;
  4017. if (index == lastIndex) {
  4018. data.pop();
  4019. } else {
  4020. splice.call(data, index, 1);
  4021. }
  4022. --this.size;
  4023. return true;
  4024. }
  4025. var _listCacheDelete = listCacheDelete;
  4026. /**
  4027. * Gets the list cache value for `key`.
  4028. *
  4029. * @private
  4030. * @name get
  4031. * @memberOf ListCache
  4032. * @param {string} key The key of the value to get.
  4033. * @returns {*} Returns the entry value.
  4034. */
  4035. function listCacheGet(key) {
  4036. var data = this.__data__,
  4037. index = _assocIndexOf(data, key);
  4038. return index < 0 ? undefined : data[index][1];
  4039. }
  4040. var _listCacheGet = listCacheGet;
  4041. /**
  4042. * Checks if a list cache value for `key` exists.
  4043. *
  4044. * @private
  4045. * @name has
  4046. * @memberOf ListCache
  4047. * @param {string} key The key of the entry to check.
  4048. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4049. */
  4050. function listCacheHas(key) {
  4051. return _assocIndexOf(this.__data__, key) > -1;
  4052. }
  4053. var _listCacheHas = listCacheHas;
  4054. /**
  4055. * Sets the list cache `key` to `value`.
  4056. *
  4057. * @private
  4058. * @name set
  4059. * @memberOf ListCache
  4060. * @param {string} key The key of the value to set.
  4061. * @param {*} value The value to set.
  4062. * @returns {Object} Returns the list cache instance.
  4063. */
  4064. function listCacheSet(key, value) {
  4065. var data = this.__data__,
  4066. index = _assocIndexOf(data, key);
  4067. if (index < 0) {
  4068. ++this.size;
  4069. data.push([key, value]);
  4070. } else {
  4071. data[index][1] = value;
  4072. }
  4073. return this;
  4074. }
  4075. var _listCacheSet = listCacheSet;
  4076. /**
  4077. * Creates an list cache object.
  4078. *
  4079. * @private
  4080. * @constructor
  4081. * @param {Array} [entries] The key-value pairs to cache.
  4082. */
  4083. function ListCache(entries) {
  4084. var this$1 = this;
  4085. var index = -1,
  4086. length = entries == null ? 0 : entries.length;
  4087. this.clear();
  4088. while (++index < length) {
  4089. var entry = entries[index];
  4090. this$1.set(entry[0], entry[1]);
  4091. }
  4092. }
  4093. // Add methods to `ListCache`.
  4094. ListCache.prototype.clear = _listCacheClear;
  4095. ListCache.prototype['delete'] = _listCacheDelete;
  4096. ListCache.prototype.get = _listCacheGet;
  4097. ListCache.prototype.has = _listCacheHas;
  4098. ListCache.prototype.set = _listCacheSet;
  4099. var _ListCache = ListCache;
  4100. /**
  4101. * Removes all key-value entries from the stack.
  4102. *
  4103. * @private
  4104. * @name clear
  4105. * @memberOf Stack
  4106. */
  4107. function stackClear() {
  4108. this.__data__ = new _ListCache;
  4109. this.size = 0;
  4110. }
  4111. var _stackClear = stackClear;
  4112. /**
  4113. * Removes `key` and its value from the stack.
  4114. *
  4115. * @private
  4116. * @name delete
  4117. * @memberOf Stack
  4118. * @param {string} key The key of the value to remove.
  4119. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  4120. */
  4121. function stackDelete(key) {
  4122. var data = this.__data__,
  4123. result = data['delete'](key);
  4124. this.size = data.size;
  4125. return result;
  4126. }
  4127. var _stackDelete = stackDelete;
  4128. /**
  4129. * Gets the stack value for `key`.
  4130. *
  4131. * @private
  4132. * @name get
  4133. * @memberOf Stack
  4134. * @param {string} key The key of the value to get.
  4135. * @returns {*} Returns the entry value.
  4136. */
  4137. function stackGet(key) {
  4138. return this.__data__.get(key);
  4139. }
  4140. var _stackGet = stackGet;
  4141. /**
  4142. * Checks if a stack value for `key` exists.
  4143. *
  4144. * @private
  4145. * @name has
  4146. * @memberOf Stack
  4147. * @param {string} key The key of the entry to check.
  4148. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4149. */
  4150. function stackHas(key) {
  4151. return this.__data__.has(key);
  4152. }
  4153. var _stackHas = stackHas;
  4154. /** Detect free variable `global` from Node.js. */
  4155. var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
  4156. var _freeGlobal = freeGlobal;
  4157. /** Detect free variable `self`. */
  4158. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  4159. /** Used as a reference to the global object. */
  4160. var root = _freeGlobal || freeSelf || Function('return this')();
  4161. var _root = root;
  4162. /** Built-in value references. */
  4163. var Symbol = _root.Symbol;
  4164. var _Symbol = Symbol;
  4165. /** Used for built-in method references. */
  4166. var objectProto = Object.prototype;
  4167. /** Used to check objects for own properties. */
  4168. var hasOwnProperty$1 = objectProto.hasOwnProperty;
  4169. /**
  4170. * Used to resolve the
  4171. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  4172. * of values.
  4173. */
  4174. var nativeObjectToString = objectProto.toString;
  4175. /** Built-in value references. */
  4176. var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
  4177. /**
  4178. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  4179. *
  4180. * @private
  4181. * @param {*} value The value to query.
  4182. * @returns {string} Returns the raw `toStringTag`.
  4183. */
  4184. function getRawTag(value) {
  4185. var isOwn = hasOwnProperty$1.call(value, symToStringTag),
  4186. tag = value[symToStringTag];
  4187. try {
  4188. value[symToStringTag] = undefined;
  4189. var unmasked = true;
  4190. } catch (e) {}
  4191. var result = nativeObjectToString.call(value);
  4192. if (unmasked) {
  4193. if (isOwn) {
  4194. value[symToStringTag] = tag;
  4195. } else {
  4196. delete value[symToStringTag];
  4197. }
  4198. }
  4199. return result;
  4200. }
  4201. var _getRawTag = getRawTag;
  4202. /** Used for built-in method references. */
  4203. var objectProto$1 = Object.prototype;
  4204. /**
  4205. * Used to resolve the
  4206. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  4207. * of values.
  4208. */
  4209. var nativeObjectToString$1 = objectProto$1.toString;
  4210. /**
  4211. * Converts `value` to a string using `Object.prototype.toString`.
  4212. *
  4213. * @private
  4214. * @param {*} value The value to convert.
  4215. * @returns {string} Returns the converted string.
  4216. */
  4217. function objectToString(value) {
  4218. return nativeObjectToString$1.call(value);
  4219. }
  4220. var _objectToString = objectToString;
  4221. /** `Object#toString` result references. */
  4222. var nullTag = '[object Null]',
  4223. undefinedTag = '[object Undefined]';
  4224. /** Built-in value references. */
  4225. var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
  4226. /**
  4227. * The base implementation of `getTag` without fallbacks for buggy environments.
  4228. *
  4229. * @private
  4230. * @param {*} value The value to query.
  4231. * @returns {string} Returns the `toStringTag`.
  4232. */
  4233. function baseGetTag(value) {
  4234. if (value == null) {
  4235. return value === undefined ? undefinedTag : nullTag;
  4236. }
  4237. return (symToStringTag$1 && symToStringTag$1 in Object(value))
  4238. ? _getRawTag(value)
  4239. : _objectToString(value);
  4240. }
  4241. var _baseGetTag = baseGetTag;
  4242. /**
  4243. * Checks if `value` is the
  4244. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  4245. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  4246. *
  4247. * @static
  4248. * @memberOf _
  4249. * @since 0.1.0
  4250. * @category Lang
  4251. * @param {*} value The value to check.
  4252. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  4253. * @example
  4254. *
  4255. * _.isObject({});
  4256. * // => true
  4257. *
  4258. * _.isObject([1, 2, 3]);
  4259. * // => true
  4260. *
  4261. * _.isObject(_.noop);
  4262. * // => true
  4263. *
  4264. * _.isObject(null);
  4265. * // => false
  4266. */
  4267. function isObject(value) {
  4268. var type = typeof value;
  4269. return value != null && (type == 'object' || type == 'function');
  4270. }
  4271. var isObject_1 = isObject;
  4272. /** `Object#toString` result references. */
  4273. var asyncTag = '[object AsyncFunction]',
  4274. funcTag = '[object Function]',
  4275. genTag = '[object GeneratorFunction]',
  4276. proxyTag = '[object Proxy]';
  4277. /**
  4278. * Checks if `value` is classified as a `Function` object.
  4279. *
  4280. * @static
  4281. * @memberOf _
  4282. * @since 0.1.0
  4283. * @category Lang
  4284. * @param {*} value The value to check.
  4285. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  4286. * @example
  4287. *
  4288. * _.isFunction(_);
  4289. * // => true
  4290. *
  4291. * _.isFunction(/abc/);
  4292. * // => false
  4293. */
  4294. function isFunction(value) {
  4295. if (!isObject_1(value)) {
  4296. return false;
  4297. }
  4298. // The use of `Object#toString` avoids issues with the `typeof` operator
  4299. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  4300. var tag = _baseGetTag(value);
  4301. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  4302. }
  4303. var isFunction_1 = isFunction;
  4304. /** Used to detect overreaching core-js shims. */
  4305. var coreJsData = _root['__core-js_shared__'];
  4306. var _coreJsData = coreJsData;
  4307. /** Used to detect methods masquerading as native. */
  4308. var maskSrcKey = (function() {
  4309. var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || '');
  4310. return uid ? ('Symbol(src)_1.' + uid) : '';
  4311. }());
  4312. /**
  4313. * Checks if `func` has its source masked.
  4314. *
  4315. * @private
  4316. * @param {Function} func The function to check.
  4317. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  4318. */
  4319. function isMasked(func) {
  4320. return !!maskSrcKey && (maskSrcKey in func);
  4321. }
  4322. var _isMasked = isMasked;
  4323. /** Used for built-in method references. */
  4324. var funcProto = Function.prototype;
  4325. /** Used to resolve the decompiled source of functions. */
  4326. var funcToString = funcProto.toString;
  4327. /**
  4328. * Converts `func` to its source code.
  4329. *
  4330. * @private
  4331. * @param {Function} func The function to convert.
  4332. * @returns {string} Returns the source code.
  4333. */
  4334. function toSource(func) {
  4335. if (func != null) {
  4336. try {
  4337. return funcToString.call(func);
  4338. } catch (e) {}
  4339. try {
  4340. return (func + '');
  4341. } catch (e) {}
  4342. }
  4343. return '';
  4344. }
  4345. var _toSource = toSource;
  4346. /**
  4347. * Used to match `RegExp`
  4348. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  4349. */
  4350. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  4351. /** Used to detect host constructors (Safari). */
  4352. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  4353. /** Used for built-in method references. */
  4354. var funcProto$1 = Function.prototype,
  4355. objectProto$2 = Object.prototype;
  4356. /** Used to resolve the decompiled source of functions. */
  4357. var funcToString$1 = funcProto$1.toString;
  4358. /** Used to check objects for own properties. */
  4359. var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
  4360. /** Used to detect if a method is native. */
  4361. var reIsNative = RegExp('^' +
  4362. funcToString$1.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&')
  4363. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  4364. );
  4365. /**
  4366. * The base implementation of `_.isNative` without bad shim checks.
  4367. *
  4368. * @private
  4369. * @param {*} value The value to check.
  4370. * @returns {boolean} Returns `true` if `value` is a native function,
  4371. * else `false`.
  4372. */
  4373. function baseIsNative(value) {
  4374. if (!isObject_1(value) || _isMasked(value)) {
  4375. return false;
  4376. }
  4377. var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor;
  4378. return pattern.test(_toSource(value));
  4379. }
  4380. var _baseIsNative = baseIsNative;
  4381. /**
  4382. * Gets the value at `key` of `object`.
  4383. *
  4384. * @private
  4385. * @param {Object} [object] The object to query.
  4386. * @param {string} key The key of the property to get.
  4387. * @returns {*} Returns the property value.
  4388. */
  4389. function getValue(object, key) {
  4390. return object == null ? undefined : object[key];
  4391. }
  4392. var _getValue = getValue;
  4393. /**
  4394. * Gets the native function at `key` of `object`.
  4395. *
  4396. * @private
  4397. * @param {Object} object The object to query.
  4398. * @param {string} key The key of the method to get.
  4399. * @returns {*} Returns the function if it's native, else `undefined`.
  4400. */
  4401. function getNative(object, key) {
  4402. var value = _getValue(object, key);
  4403. return _baseIsNative(value) ? value : undefined;
  4404. }
  4405. var _getNative = getNative;
  4406. /* Built-in method references that are verified to be native. */
  4407. var Map = _getNative(_root, 'Map');
  4408. var _Map = Map;
  4409. /* Built-in method references that are verified to be native. */
  4410. var nativeCreate = _getNative(Object, 'create');
  4411. var _nativeCreate = nativeCreate;
  4412. /**
  4413. * Removes all key-value entries from the hash.
  4414. *
  4415. * @private
  4416. * @name clear
  4417. * @memberOf Hash
  4418. */
  4419. function hashClear() {
  4420. this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
  4421. this.size = 0;
  4422. }
  4423. var _hashClear = hashClear;
  4424. /**
  4425. * Removes `key` and its value from the hash.
  4426. *
  4427. * @private
  4428. * @name delete
  4429. * @memberOf Hash
  4430. * @param {Object} hash The hash to modify.
  4431. * @param {string} key The key of the value to remove.
  4432. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  4433. */
  4434. function hashDelete(key) {
  4435. var result = this.has(key) && delete this.__data__[key];
  4436. this.size -= result ? 1 : 0;
  4437. return result;
  4438. }
  4439. var _hashDelete = hashDelete;
  4440. /** Used to stand-in for `undefined` hash values. */
  4441. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  4442. /** Used for built-in method references. */
  4443. var objectProto$3 = Object.prototype;
  4444. /** Used to check objects for own properties. */
  4445. var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
  4446. /**
  4447. * Gets the hash value for `key`.
  4448. *
  4449. * @private
  4450. * @name get
  4451. * @memberOf Hash
  4452. * @param {string} key The key of the value to get.
  4453. * @returns {*} Returns the entry value.
  4454. */
  4455. function hashGet(key) {
  4456. var data = this.__data__;
  4457. if (_nativeCreate) {
  4458. var result = data[key];
  4459. return result === HASH_UNDEFINED ? undefined : result;
  4460. }
  4461. return hasOwnProperty$3.call(data, key) ? data[key] : undefined;
  4462. }
  4463. var _hashGet = hashGet;
  4464. /** Used for built-in method references. */
  4465. var objectProto$4 = Object.prototype;
  4466. /** Used to check objects for own properties. */
  4467. var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
  4468. /**
  4469. * Checks if a hash value for `key` exists.
  4470. *
  4471. * @private
  4472. * @name has
  4473. * @memberOf Hash
  4474. * @param {string} key The key of the entry to check.
  4475. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4476. */
  4477. function hashHas(key) {
  4478. var data = this.__data__;
  4479. return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$4.call(data, key);
  4480. }
  4481. var _hashHas = hashHas;
  4482. /** Used to stand-in for `undefined` hash values. */
  4483. var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
  4484. /**
  4485. * Sets the hash `key` to `value`.
  4486. *
  4487. * @private
  4488. * @name set
  4489. * @memberOf Hash
  4490. * @param {string} key The key of the value to set.
  4491. * @param {*} value The value to set.
  4492. * @returns {Object} Returns the hash instance.
  4493. */
  4494. function hashSet(key, value) {
  4495. var data = this.__data__;
  4496. this.size += this.has(key) ? 0 : 1;
  4497. data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
  4498. return this;
  4499. }
  4500. var _hashSet = hashSet;
  4501. /**
  4502. * Creates a hash object.
  4503. *
  4504. * @private
  4505. * @constructor
  4506. * @param {Array} [entries] The key-value pairs to cache.
  4507. */
  4508. function Hash(entries) {
  4509. var this$1 = this;
  4510. var index = -1,
  4511. length = entries == null ? 0 : entries.length;
  4512. this.clear();
  4513. while (++index < length) {
  4514. var entry = entries[index];
  4515. this$1.set(entry[0], entry[1]);
  4516. }
  4517. }
  4518. // Add methods to `Hash`.
  4519. Hash.prototype.clear = _hashClear;
  4520. Hash.prototype['delete'] = _hashDelete;
  4521. Hash.prototype.get = _hashGet;
  4522. Hash.prototype.has = _hashHas;
  4523. Hash.prototype.set = _hashSet;
  4524. var _Hash = Hash;
  4525. /**
  4526. * Removes all key-value entries from the map.
  4527. *
  4528. * @private
  4529. * @name clear
  4530. * @memberOf MapCache
  4531. */
  4532. function mapCacheClear() {
  4533. this.size = 0;
  4534. this.__data__ = {
  4535. 'hash': new _Hash,
  4536. 'map': new (_Map || _ListCache),
  4537. 'string': new _Hash
  4538. };
  4539. }
  4540. var _mapCacheClear = mapCacheClear;
  4541. /**
  4542. * Checks if `value` is suitable for use as unique object key.
  4543. *
  4544. * @private
  4545. * @param {*} value The value to check.
  4546. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  4547. */
  4548. function isKeyable(value) {
  4549. var type = typeof value;
  4550. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  4551. ? (value !== '__proto__')
  4552. : (value === null);
  4553. }
  4554. var _isKeyable = isKeyable;
  4555. /**
  4556. * Gets the data for `map`.
  4557. *
  4558. * @private
  4559. * @param {Object} map The map to query.
  4560. * @param {string} key The reference key.
  4561. * @returns {*} Returns the map data.
  4562. */
  4563. function getMapData(map, key) {
  4564. var data = map.__data__;
  4565. return _isKeyable(key)
  4566. ? data[typeof key == 'string' ? 'string' : 'hash']
  4567. : data.map;
  4568. }
  4569. var _getMapData = getMapData;
  4570. /**
  4571. * Removes `key` and its value from the map.
  4572. *
  4573. * @private
  4574. * @name delete
  4575. * @memberOf MapCache
  4576. * @param {string} key The key of the value to remove.
  4577. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  4578. */
  4579. function mapCacheDelete(key) {
  4580. var result = _getMapData(this, key)['delete'](key);
  4581. this.size -= result ? 1 : 0;
  4582. return result;
  4583. }
  4584. var _mapCacheDelete = mapCacheDelete;
  4585. /**
  4586. * Gets the map value for `key`.
  4587. *
  4588. * @private
  4589. * @name get
  4590. * @memberOf MapCache
  4591. * @param {string} key The key of the value to get.
  4592. * @returns {*} Returns the entry value.
  4593. */
  4594. function mapCacheGet(key) {
  4595. return _getMapData(this, key).get(key);
  4596. }
  4597. var _mapCacheGet = mapCacheGet;
  4598. /**
  4599. * Checks if a map value for `key` exists.
  4600. *
  4601. * @private
  4602. * @name has
  4603. * @memberOf MapCache
  4604. * @param {string} key The key of the entry to check.
  4605. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4606. */
  4607. function mapCacheHas(key) {
  4608. return _getMapData(this, key).has(key);
  4609. }
  4610. var _mapCacheHas = mapCacheHas;
  4611. /**
  4612. * Sets the map `key` to `value`.
  4613. *
  4614. * @private
  4615. * @name set
  4616. * @memberOf MapCache
  4617. * @param {string} key The key of the value to set.
  4618. * @param {*} value The value to set.
  4619. * @returns {Object} Returns the map cache instance.
  4620. */
  4621. function mapCacheSet(key, value) {
  4622. var data = _getMapData(this, key),
  4623. size = data.size;
  4624. data.set(key, value);
  4625. this.size += data.size == size ? 0 : 1;
  4626. return this;
  4627. }
  4628. var _mapCacheSet = mapCacheSet;
  4629. /**
  4630. * Creates a map cache object to store key-value pairs.
  4631. *
  4632. * @private
  4633. * @constructor
  4634. * @param {Array} [entries] The key-value pairs to cache.
  4635. */
  4636. function MapCache(entries) {
  4637. var this$1 = this;
  4638. var index = -1,
  4639. length = entries == null ? 0 : entries.length;
  4640. this.clear();
  4641. while (++index < length) {
  4642. var entry = entries[index];
  4643. this$1.set(entry[0], entry[1]);
  4644. }
  4645. }
  4646. // Add methods to `MapCache`.
  4647. MapCache.prototype.clear = _mapCacheClear;
  4648. MapCache.prototype['delete'] = _mapCacheDelete;
  4649. MapCache.prototype.get = _mapCacheGet;
  4650. MapCache.prototype.has = _mapCacheHas;
  4651. MapCache.prototype.set = _mapCacheSet;
  4652. var _MapCache = MapCache;
  4653. /** Used as the size to enable large array optimizations. */
  4654. var LARGE_ARRAY_SIZE = 200;
  4655. /**
  4656. * Sets the stack `key` to `value`.
  4657. *
  4658. * @private
  4659. * @name set
  4660. * @memberOf Stack
  4661. * @param {string} key The key of the value to set.
  4662. * @param {*} value The value to set.
  4663. * @returns {Object} Returns the stack cache instance.
  4664. */
  4665. function stackSet(key, value) {
  4666. var data = this.__data__;
  4667. if (data instanceof _ListCache) {
  4668. var pairs = data.__data__;
  4669. if (!_Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  4670. pairs.push([key, value]);
  4671. this.size = ++data.size;
  4672. return this;
  4673. }
  4674. data = this.__data__ = new _MapCache(pairs);
  4675. }
  4676. data.set(key, value);
  4677. this.size = data.size;
  4678. return this;
  4679. }
  4680. var _stackSet = stackSet;
  4681. /**
  4682. * Creates a stack cache object to store key-value pairs.
  4683. *
  4684. * @private
  4685. * @constructor
  4686. * @param {Array} [entries] The key-value pairs to cache.
  4687. */
  4688. function Stack(entries) {
  4689. var data = this.__data__ = new _ListCache(entries);
  4690. this.size = data.size;
  4691. }
  4692. // Add methods to `Stack`.
  4693. Stack.prototype.clear = _stackClear;
  4694. Stack.prototype['delete'] = _stackDelete;
  4695. Stack.prototype.get = _stackGet;
  4696. Stack.prototype.has = _stackHas;
  4697. Stack.prototype.set = _stackSet;
  4698. var _Stack = Stack;
  4699. /**
  4700. * A specialized version of `_.forEach` for arrays without support for
  4701. * iteratee shorthands.
  4702. *
  4703. * @private
  4704. * @param {Array} [array] The array to iterate over.
  4705. * @param {Function} iteratee The function invoked per iteration.
  4706. * @returns {Array} Returns `array`.
  4707. */
  4708. function arrayEach(array, iteratee) {
  4709. var index = -1,
  4710. length = array == null ? 0 : array.length;
  4711. while (++index < length) {
  4712. if (iteratee(array[index], index, array) === false) {
  4713. break;
  4714. }
  4715. }
  4716. return array;
  4717. }
  4718. var _arrayEach = arrayEach;
  4719. var defineProperty = (function() {
  4720. try {
  4721. var func = _getNative(Object, 'defineProperty');
  4722. func({}, '', {});
  4723. return func;
  4724. } catch (e) {}
  4725. }());
  4726. var _defineProperty = defineProperty;
  4727. /**
  4728. * The base implementation of `assignValue` and `assignMergeValue` without
  4729. * value checks.
  4730. *
  4731. * @private
  4732. * @param {Object} object The object to modify.
  4733. * @param {string} key The key of the property to assign.
  4734. * @param {*} value The value to assign.
  4735. */
  4736. function baseAssignValue(object, key, value) {
  4737. if (key == '__proto__' && _defineProperty) {
  4738. _defineProperty(object, key, {
  4739. 'configurable': true,
  4740. 'enumerable': true,
  4741. 'value': value,
  4742. 'writable': true
  4743. });
  4744. } else {
  4745. object[key] = value;
  4746. }
  4747. }
  4748. var _baseAssignValue = baseAssignValue;
  4749. /** Used for built-in method references. */
  4750. var objectProto$5 = Object.prototype;
  4751. /** Used to check objects for own properties. */
  4752. var hasOwnProperty$5 = objectProto$5.hasOwnProperty;
  4753. /**
  4754. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  4755. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  4756. * for equality comparisons.
  4757. *
  4758. * @private
  4759. * @param {Object} object The object to modify.
  4760. * @param {string} key The key of the property to assign.
  4761. * @param {*} value The value to assign.
  4762. */
  4763. function assignValue(object, key, value) {
  4764. var objValue = object[key];
  4765. if (!(hasOwnProperty$5.call(object, key) && eq_1(objValue, value)) ||
  4766. (value === undefined && !(key in object))) {
  4767. _baseAssignValue(object, key, value);
  4768. }
  4769. }
  4770. var _assignValue = assignValue;
  4771. /**
  4772. * Copies properties of `source` to `object`.
  4773. *
  4774. * @private
  4775. * @param {Object} source The object to copy properties from.
  4776. * @param {Array} props The property identifiers to copy.
  4777. * @param {Object} [object={}] The object to copy properties to.
  4778. * @param {Function} [customizer] The function to customize copied values.
  4779. * @returns {Object} Returns `object`.
  4780. */
  4781. function copyObject(source, props, object, customizer) {
  4782. var isNew = !object;
  4783. object || (object = {});
  4784. var index = -1,
  4785. length = props.length;
  4786. while (++index < length) {
  4787. var key = props[index];
  4788. var newValue = customizer
  4789. ? customizer(object[key], source[key], key, object, source)
  4790. : undefined;
  4791. if (newValue === undefined) {
  4792. newValue = source[key];
  4793. }
  4794. if (isNew) {
  4795. _baseAssignValue(object, key, newValue);
  4796. } else {
  4797. _assignValue(object, key, newValue);
  4798. }
  4799. }
  4800. return object;
  4801. }
  4802. var _copyObject = copyObject;
  4803. /**
  4804. * The base implementation of `_.times` without support for iteratee shorthands
  4805. * or max array length checks.
  4806. *
  4807. * @private
  4808. * @param {number} n The number of times to invoke `iteratee`.
  4809. * @param {Function} iteratee The function invoked per iteration.
  4810. * @returns {Array} Returns the array of results.
  4811. */
  4812. function baseTimes(n, iteratee) {
  4813. var index = -1,
  4814. result = Array(n);
  4815. while (++index < n) {
  4816. result[index] = iteratee(index);
  4817. }
  4818. return result;
  4819. }
  4820. var _baseTimes = baseTimes;
  4821. /**
  4822. * Checks if `value` is object-like. A value is object-like if it's not `null`
  4823. * and has a `typeof` result of "object".
  4824. *
  4825. * @static
  4826. * @memberOf _
  4827. * @since 4.0.0
  4828. * @category Lang
  4829. * @param {*} value The value to check.
  4830. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  4831. * @example
  4832. *
  4833. * _.isObjectLike({});
  4834. * // => true
  4835. *
  4836. * _.isObjectLike([1, 2, 3]);
  4837. * // => true
  4838. *
  4839. * _.isObjectLike(_.noop);
  4840. * // => false
  4841. *
  4842. * _.isObjectLike(null);
  4843. * // => false
  4844. */
  4845. function isObjectLike(value) {
  4846. return value != null && typeof value == 'object';
  4847. }
  4848. var isObjectLike_1 = isObjectLike;
  4849. /** `Object#toString` result references. */
  4850. var argsTag = '[object Arguments]';
  4851. /**
  4852. * The base implementation of `_.isArguments`.
  4853. *
  4854. * @private
  4855. * @param {*} value The value to check.
  4856. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  4857. */
  4858. function baseIsArguments(value) {
  4859. return isObjectLike_1(value) && _baseGetTag(value) == argsTag;
  4860. }
  4861. var _baseIsArguments = baseIsArguments;
  4862. /** Used for built-in method references. */
  4863. var objectProto$6 = Object.prototype;
  4864. /** Used to check objects for own properties. */
  4865. var hasOwnProperty$6 = objectProto$6.hasOwnProperty;
  4866. /** Built-in value references. */
  4867. var propertyIsEnumerable = objectProto$6.propertyIsEnumerable;
  4868. /**
  4869. * Checks if `value` is likely an `arguments` object.
  4870. *
  4871. * @static
  4872. * @memberOf _
  4873. * @since 0.1.0
  4874. * @category Lang
  4875. * @param {*} value The value to check.
  4876. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  4877. * else `false`.
  4878. * @example
  4879. *
  4880. * _.isArguments(function() { return arguments; }());
  4881. * // => true
  4882. *
  4883. * _.isArguments([1, 2, 3]);
  4884. * // => false
  4885. */
  4886. var isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {
  4887. return isObjectLike_1(value) && hasOwnProperty$6.call(value, 'callee') &&
  4888. !propertyIsEnumerable.call(value, 'callee');
  4889. };
  4890. var isArguments_1 = isArguments;
  4891. /**
  4892. * Checks if `value` is classified as an `Array` object.
  4893. *
  4894. * @static
  4895. * @memberOf _
  4896. * @since 0.1.0
  4897. * @category Lang
  4898. * @param {*} value The value to check.
  4899. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  4900. * @example
  4901. *
  4902. * _.isArray([1, 2, 3]);
  4903. * // => true
  4904. *
  4905. * _.isArray(document.body.children);
  4906. * // => false
  4907. *
  4908. * _.isArray('abc');
  4909. * // => false
  4910. *
  4911. * _.isArray(_.noop);
  4912. * // => false
  4913. */
  4914. var isArray = Array.isArray;
  4915. var isArray_1 = isArray;
  4916. /**
  4917. * This method returns `false`.
  4918. *
  4919. * @static
  4920. * @memberOf _
  4921. * @since 4.13.0
  4922. * @category Util
  4923. * @returns {boolean} Returns `false`.
  4924. * @example
  4925. *
  4926. * _.times(2, _.stubFalse);
  4927. * // => [false, false]
  4928. */
  4929. function stubFalse() {
  4930. return false;
  4931. }
  4932. var stubFalse_1 = stubFalse;
  4933. var isBuffer_1 = createCommonjsModule(function (module, exports) {
  4934. /** Detect free variable `exports`. */
  4935. var freeExports = 'object' == 'object' && exports && !exports.nodeType && exports;
  4936. /** Detect free variable `module`. */
  4937. var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
  4938. /** Detect the popular CommonJS extension `module.exports`. */
  4939. var moduleExports = freeModule && freeModule.exports === freeExports;
  4940. /** Built-in value references. */
  4941. var Buffer = moduleExports ? _root.Buffer : undefined;
  4942. /* Built-in method references for those with the same name as other `lodash` methods. */
  4943. var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
  4944. /**
  4945. * Checks if `value` is a buffer.
  4946. *
  4947. * @static
  4948. * @memberOf _
  4949. * @since 4.3.0
  4950. * @category Lang
  4951. * @param {*} value The value to check.
  4952. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  4953. * @example
  4954. *
  4955. * _.isBuffer(new Buffer(2));
  4956. * // => true
  4957. *
  4958. * _.isBuffer(new Uint8Array(2));
  4959. * // => false
  4960. */
  4961. var isBuffer = nativeIsBuffer || stubFalse_1;
  4962. module.exports = isBuffer;
  4963. });
  4964. /** Used as references for various `Number` constants. */
  4965. var MAX_SAFE_INTEGER = 9007199254740991;
  4966. /** Used to detect unsigned integer values. */
  4967. var reIsUint = /^(?:0|[1-9]\d*)$/;
  4968. /**
  4969. * Checks if `value` is a valid array-like index.
  4970. *
  4971. * @private
  4972. * @param {*} value The value to check.
  4973. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  4974. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  4975. */
  4976. function isIndex(value, length) {
  4977. length = length == null ? MAX_SAFE_INTEGER : length;
  4978. return !!length &&
  4979. (typeof value == 'number' || reIsUint.test(value)) &&
  4980. (value > -1 && value % 1 == 0 && value < length);
  4981. }
  4982. var _isIndex = isIndex;
  4983. /** Used as references for various `Number` constants. */
  4984. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  4985. /**
  4986. * Checks if `value` is a valid array-like length.
  4987. *
  4988. * **Note:** This method is loosely based on
  4989. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  4990. *
  4991. * @static
  4992. * @memberOf _
  4993. * @since 4.0.0
  4994. * @category Lang
  4995. * @param {*} value The value to check.
  4996. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  4997. * @example
  4998. *
  4999. * _.isLength(3);
  5000. * // => true
  5001. *
  5002. * _.isLength(Number.MIN_VALUE);
  5003. * // => false
  5004. *
  5005. * _.isLength(Infinity);
  5006. * // => false
  5007. *
  5008. * _.isLength('3');
  5009. * // => false
  5010. */
  5011. function isLength(value) {
  5012. return typeof value == 'number' &&
  5013. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
  5014. }
  5015. var isLength_1 = isLength;
  5016. /** `Object#toString` result references. */
  5017. var argsTag$1 = '[object Arguments]',
  5018. arrayTag = '[object Array]',
  5019. boolTag = '[object Boolean]',
  5020. dateTag = '[object Date]',
  5021. errorTag = '[object Error]',
  5022. funcTag$1 = '[object Function]',
  5023. mapTag = '[object Map]',
  5024. numberTag = '[object Number]',
  5025. objectTag = '[object Object]',
  5026. regexpTag = '[object RegExp]',
  5027. setTag = '[object Set]',
  5028. stringTag = '[object String]',
  5029. weakMapTag = '[object WeakMap]';
  5030. var arrayBufferTag = '[object ArrayBuffer]',
  5031. dataViewTag = '[object DataView]',
  5032. float32Tag = '[object Float32Array]',
  5033. float64Tag = '[object Float64Array]',
  5034. int8Tag = '[object Int8Array]',
  5035. int16Tag = '[object Int16Array]',
  5036. int32Tag = '[object Int32Array]',
  5037. uint8Tag = '[object Uint8Array]',
  5038. uint8ClampedTag = '[object Uint8ClampedArray]',
  5039. uint16Tag = '[object Uint16Array]',
  5040. uint32Tag = '[object Uint32Array]';
  5041. /** Used to identify `toStringTag` values of typed arrays. */
  5042. var typedArrayTags = {};
  5043. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  5044. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  5045. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  5046. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  5047. typedArrayTags[uint32Tag] = true;
  5048. typedArrayTags[argsTag$1] = typedArrayTags[arrayTag] =
  5049. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  5050. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  5051. typedArrayTags[errorTag] = typedArrayTags[funcTag$1] =
  5052. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  5053. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  5054. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  5055. typedArrayTags[weakMapTag] = false;
  5056. /**
  5057. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  5058. *
  5059. * @private
  5060. * @param {*} value The value to check.
  5061. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  5062. */
  5063. function baseIsTypedArray(value) {
  5064. return isObjectLike_1(value) &&
  5065. isLength_1(value.length) && !!typedArrayTags[_baseGetTag(value)];
  5066. }
  5067. var _baseIsTypedArray = baseIsTypedArray;
  5068. /**
  5069. * The base implementation of `_.unary` without support for storing metadata.
  5070. *
  5071. * @private
  5072. * @param {Function} func The function to cap arguments for.
  5073. * @returns {Function} Returns the new capped function.
  5074. */
  5075. function baseUnary(func) {
  5076. return function(value) {
  5077. return func(value);
  5078. };
  5079. }
  5080. var _baseUnary = baseUnary;
  5081. var _nodeUtil = createCommonjsModule(function (module, exports) {
  5082. /** Detect free variable `exports`. */
  5083. var freeExports = 'object' == 'object' && exports && !exports.nodeType && exports;
  5084. /** Detect free variable `module`. */
  5085. var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
  5086. /** Detect the popular CommonJS extension `module.exports`. */
  5087. var moduleExports = freeModule && freeModule.exports === freeExports;
  5088. /** Detect free variable `process` from Node.js. */
  5089. var freeProcess = moduleExports && _freeGlobal.process;
  5090. /** Used to access faster Node.js helpers. */
  5091. var nodeUtil = (function() {
  5092. try {
  5093. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  5094. } catch (e) {}
  5095. }());
  5096. module.exports = nodeUtil;
  5097. });
  5098. /* Node.js helper references. */
  5099. var nodeIsTypedArray = _nodeUtil && _nodeUtil.isTypedArray;
  5100. /**
  5101. * Checks if `value` is classified as a typed array.
  5102. *
  5103. * @static
  5104. * @memberOf _
  5105. * @since 3.0.0
  5106. * @category Lang
  5107. * @param {*} value The value to check.
  5108. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  5109. * @example
  5110. *
  5111. * _.isTypedArray(new Uint8Array);
  5112. * // => true
  5113. *
  5114. * _.isTypedArray([]);
  5115. * // => false
  5116. */
  5117. var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsTypedArray;
  5118. var isTypedArray_1 = isTypedArray;
  5119. /** Used for built-in method references. */
  5120. var objectProto$7 = Object.prototype;
  5121. /** Used to check objects for own properties. */
  5122. var hasOwnProperty$7 = objectProto$7.hasOwnProperty;
  5123. /**
  5124. * Creates an array of the enumerable property names of the array-like `value`.
  5125. *
  5126. * @private
  5127. * @param {*} value The value to query.
  5128. * @param {boolean} inherited Specify returning inherited property names.
  5129. * @returns {Array} Returns the array of property names.
  5130. */
  5131. function arrayLikeKeys(value, inherited) {
  5132. var isArr = isArray_1(value),
  5133. isArg = !isArr && isArguments_1(value),
  5134. isBuff = !isArr && !isArg && isBuffer_1(value),
  5135. isType = !isArr && !isArg && !isBuff && isTypedArray_1(value),
  5136. skipIndexes = isArr || isArg || isBuff || isType,
  5137. result = skipIndexes ? _baseTimes(value.length, String) : [],
  5138. length = result.length;
  5139. for (var key in value) {
  5140. if ((inherited || hasOwnProperty$7.call(value, key)) &&
  5141. !(skipIndexes && (
  5142. // Safari 9 has enumerable `arguments.length` in strict mode.
  5143. key == 'length' ||
  5144. // Node.js 0.10 has enumerable non-index properties on buffers.
  5145. (isBuff && (key == 'offset' || key == 'parent')) ||
  5146. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  5147. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  5148. // Skip index properties.
  5149. _isIndex(key, length)
  5150. ))) {
  5151. result.push(key);
  5152. }
  5153. }
  5154. return result;
  5155. }
  5156. var _arrayLikeKeys = arrayLikeKeys;
  5157. /** Used for built-in method references. */
  5158. var objectProto$8 = Object.prototype;
  5159. /**
  5160. * Checks if `value` is likely a prototype object.
  5161. *
  5162. * @private
  5163. * @param {*} value The value to check.
  5164. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  5165. */
  5166. function isPrototype(value) {
  5167. var Ctor = value && value.constructor,
  5168. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$8;
  5169. return value === proto;
  5170. }
  5171. var _isPrototype = isPrototype;
  5172. /**
  5173. * Creates a unary function that invokes `func` with its argument transformed.
  5174. *
  5175. * @private
  5176. * @param {Function} func The function to wrap.
  5177. * @param {Function} transform The argument transform.
  5178. * @returns {Function} Returns the new function.
  5179. */
  5180. function overArg(func, transform) {
  5181. return function(arg) {
  5182. return func(transform(arg));
  5183. };
  5184. }
  5185. var _overArg = overArg;
  5186. /* Built-in method references for those with the same name as other `lodash` methods. */
  5187. var nativeKeys = _overArg(Object.keys, Object);
  5188. var _nativeKeys = nativeKeys;
  5189. /** Used for built-in method references. */
  5190. var objectProto$9 = Object.prototype;
  5191. /** Used to check objects for own properties. */
  5192. var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
  5193. /**
  5194. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  5195. *
  5196. * @private
  5197. * @param {Object} object The object to query.
  5198. * @returns {Array} Returns the array of property names.
  5199. */
  5200. function baseKeys(object) {
  5201. if (!_isPrototype(object)) {
  5202. return _nativeKeys(object);
  5203. }
  5204. var result = [];
  5205. for (var key in Object(object)) {
  5206. if (hasOwnProperty$8.call(object, key) && key != 'constructor') {
  5207. result.push(key);
  5208. }
  5209. }
  5210. return result;
  5211. }
  5212. var _baseKeys = baseKeys;
  5213. /**
  5214. * Checks if `value` is array-like. A value is considered array-like if it's
  5215. * not a function and has a `value.length` that's an integer greater than or
  5216. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  5217. *
  5218. * @static
  5219. * @memberOf _
  5220. * @since 4.0.0
  5221. * @category Lang
  5222. * @param {*} value The value to check.
  5223. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  5224. * @example
  5225. *
  5226. * _.isArrayLike([1, 2, 3]);
  5227. * // => true
  5228. *
  5229. * _.isArrayLike(document.body.children);
  5230. * // => true
  5231. *
  5232. * _.isArrayLike('abc');
  5233. * // => true
  5234. *
  5235. * _.isArrayLike(_.noop);
  5236. * // => false
  5237. */
  5238. function isArrayLike(value) {
  5239. return value != null && isLength_1(value.length) && !isFunction_1(value);
  5240. }
  5241. var isArrayLike_1 = isArrayLike;
  5242. /**
  5243. * Creates an array of the own enumerable property names of `object`.
  5244. *
  5245. * **Note:** Non-object values are coerced to objects. See the
  5246. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  5247. * for more details.
  5248. *
  5249. * @static
  5250. * @since 0.1.0
  5251. * @memberOf _
  5252. * @category Object
  5253. * @param {Object} object The object to query.
  5254. * @returns {Array} Returns the array of property names.
  5255. * @example
  5256. *
  5257. * function Foo() {
  5258. * this.a = 1;
  5259. * this.b = 2;
  5260. * }
  5261. *
  5262. * Foo.prototype.c = 3;
  5263. *
  5264. * _.keys(new Foo);
  5265. * // => ['a', 'b'] (iteration order is not guaranteed)
  5266. *
  5267. * _.keys('hi');
  5268. * // => ['0', '1']
  5269. */
  5270. function keys(object) {
  5271. return isArrayLike_1(object) ? _arrayLikeKeys(object) : _baseKeys(object);
  5272. }
  5273. var keys_1 = keys;
  5274. /**
  5275. * The base implementation of `_.assign` without support for multiple sources
  5276. * or `customizer` functions.
  5277. *
  5278. * @private
  5279. * @param {Object} object The destination object.
  5280. * @param {Object} source The source object.
  5281. * @returns {Object} Returns `object`.
  5282. */
  5283. function baseAssign(object, source) {
  5284. return object && _copyObject(source, keys_1(source), object);
  5285. }
  5286. var _baseAssign = baseAssign;
  5287. /**
  5288. * This function is like
  5289. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  5290. * except that it includes inherited enumerable properties.
  5291. *
  5292. * @private
  5293. * @param {Object} object The object to query.
  5294. * @returns {Array} Returns the array of property names.
  5295. */
  5296. function nativeKeysIn(object) {
  5297. var result = [];
  5298. if (object != null) {
  5299. for (var key in Object(object)) {
  5300. result.push(key);
  5301. }
  5302. }
  5303. return result;
  5304. }
  5305. var _nativeKeysIn = nativeKeysIn;
  5306. /** Used for built-in method references. */
  5307. var objectProto$10 = Object.prototype;
  5308. /** Used to check objects for own properties. */
  5309. var hasOwnProperty$9 = objectProto$10.hasOwnProperty;
  5310. /**
  5311. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  5312. *
  5313. * @private
  5314. * @param {Object} object The object to query.
  5315. * @returns {Array} Returns the array of property names.
  5316. */
  5317. function baseKeysIn(object) {
  5318. if (!isObject_1(object)) {
  5319. return _nativeKeysIn(object);
  5320. }
  5321. var isProto = _isPrototype(object),
  5322. result = [];
  5323. for (var key in object) {
  5324. if (!(key == 'constructor' && (isProto || !hasOwnProperty$9.call(object, key)))) {
  5325. result.push(key);
  5326. }
  5327. }
  5328. return result;
  5329. }
  5330. var _baseKeysIn = baseKeysIn;
  5331. /**
  5332. * Creates an array of the own and inherited enumerable property names of `object`.
  5333. *
  5334. * **Note:** Non-object values are coerced to objects.
  5335. *
  5336. * @static
  5337. * @memberOf _
  5338. * @since 3.0.0
  5339. * @category Object
  5340. * @param {Object} object The object to query.
  5341. * @returns {Array} Returns the array of property names.
  5342. * @example
  5343. *
  5344. * function Foo() {
  5345. * this.a = 1;
  5346. * this.b = 2;
  5347. * }
  5348. *
  5349. * Foo.prototype.c = 3;
  5350. *
  5351. * _.keysIn(new Foo);
  5352. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  5353. */
  5354. function keysIn$1(object) {
  5355. return isArrayLike_1(object) ? _arrayLikeKeys(object, true) : _baseKeysIn(object);
  5356. }
  5357. var keysIn_1 = keysIn$1;
  5358. /**
  5359. * The base implementation of `_.assignIn` without support for multiple sources
  5360. * or `customizer` functions.
  5361. *
  5362. * @private
  5363. * @param {Object} object The destination object.
  5364. * @param {Object} source The source object.
  5365. * @returns {Object} Returns `object`.
  5366. */
  5367. function baseAssignIn(object, source) {
  5368. return object && _copyObject(source, keysIn_1(source), object);
  5369. }
  5370. var _baseAssignIn = baseAssignIn;
  5371. var _cloneBuffer = createCommonjsModule(function (module, exports) {
  5372. /** Detect free variable `exports`. */
  5373. var freeExports = 'object' == 'object' && exports && !exports.nodeType && exports;
  5374. /** Detect free variable `module`. */
  5375. var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
  5376. /** Detect the popular CommonJS extension `module.exports`. */
  5377. var moduleExports = freeModule && freeModule.exports === freeExports;
  5378. /** Built-in value references. */
  5379. var Buffer = moduleExports ? _root.Buffer : undefined,
  5380. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
  5381. /**
  5382. * Creates a clone of `buffer`.
  5383. *
  5384. * @private
  5385. * @param {Buffer} buffer The buffer to clone.
  5386. * @param {boolean} [isDeep] Specify a deep clone.
  5387. * @returns {Buffer} Returns the cloned buffer.
  5388. */
  5389. function cloneBuffer(buffer, isDeep) {
  5390. if (isDeep) {
  5391. return buffer.slice();
  5392. }
  5393. var length = buffer.length,
  5394. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  5395. buffer.copy(result);
  5396. return result;
  5397. }
  5398. module.exports = cloneBuffer;
  5399. });
  5400. /**
  5401. * Copies the values of `source` to `array`.
  5402. *
  5403. * @private
  5404. * @param {Array} source The array to copy values from.
  5405. * @param {Array} [array=[]] The array to copy values to.
  5406. * @returns {Array} Returns `array`.
  5407. */
  5408. function copyArray(source, array) {
  5409. var index = -1,
  5410. length = source.length;
  5411. array || (array = Array(length));
  5412. while (++index < length) {
  5413. array[index] = source[index];
  5414. }
  5415. return array;
  5416. }
  5417. var _copyArray = copyArray;
  5418. /**
  5419. * A specialized version of `_.filter` for arrays without support for
  5420. * iteratee shorthands.
  5421. *
  5422. * @private
  5423. * @param {Array} [array] The array to iterate over.
  5424. * @param {Function} predicate The function invoked per iteration.
  5425. * @returns {Array} Returns the new filtered array.
  5426. */
  5427. function arrayFilter(array, predicate) {
  5428. var index = -1,
  5429. length = array == null ? 0 : array.length,
  5430. resIndex = 0,
  5431. result = [];
  5432. while (++index < length) {
  5433. var value = array[index];
  5434. if (predicate(value, index, array)) {
  5435. result[resIndex++] = value;
  5436. }
  5437. }
  5438. return result;
  5439. }
  5440. var _arrayFilter = arrayFilter;
  5441. /**
  5442. * This method returns a new empty array.
  5443. *
  5444. * @static
  5445. * @memberOf _
  5446. * @since 4.13.0
  5447. * @category Util
  5448. * @returns {Array} Returns the new empty array.
  5449. * @example
  5450. *
  5451. * var arrays = _.times(2, _.stubArray);
  5452. *
  5453. * console.log(arrays);
  5454. * // => [[], []]
  5455. *
  5456. * console.log(arrays[0] === arrays[1]);
  5457. * // => false
  5458. */
  5459. function stubArray() {
  5460. return [];
  5461. }
  5462. var stubArray_1 = stubArray;
  5463. /** Used for built-in method references. */
  5464. var objectProto$11 = Object.prototype;
  5465. /** Built-in value references. */
  5466. var propertyIsEnumerable$1 = objectProto$11.propertyIsEnumerable;
  5467. /* Built-in method references for those with the same name as other `lodash` methods. */
  5468. var nativeGetSymbols = Object.getOwnPropertySymbols;
  5469. /**
  5470. * Creates an array of the own enumerable symbols of `object`.
  5471. *
  5472. * @private
  5473. * @param {Object} object The object to query.
  5474. * @returns {Array} Returns the array of symbols.
  5475. */
  5476. var getSymbols = !nativeGetSymbols ? stubArray_1 : function(object) {
  5477. if (object == null) {
  5478. return [];
  5479. }
  5480. object = Object(object);
  5481. return _arrayFilter(nativeGetSymbols(object), function(symbol) {
  5482. return propertyIsEnumerable$1.call(object, symbol);
  5483. });
  5484. };
  5485. var _getSymbols = getSymbols;
  5486. /**
  5487. * Copies own symbols of `source` to `object`.
  5488. *
  5489. * @private
  5490. * @param {Object} source The object to copy symbols from.
  5491. * @param {Object} [object={}] The object to copy symbols to.
  5492. * @returns {Object} Returns `object`.
  5493. */
  5494. function copySymbols(source, object) {
  5495. return _copyObject(source, _getSymbols(source), object);
  5496. }
  5497. var _copySymbols = copySymbols;
  5498. /**
  5499. * Appends the elements of `values` to `array`.
  5500. *
  5501. * @private
  5502. * @param {Array} array The array to modify.
  5503. * @param {Array} values The values to append.
  5504. * @returns {Array} Returns `array`.
  5505. */
  5506. function arrayPush(array, values) {
  5507. var index = -1,
  5508. length = values.length,
  5509. offset = array.length;
  5510. while (++index < length) {
  5511. array[offset + index] = values[index];
  5512. }
  5513. return array;
  5514. }
  5515. var _arrayPush = arrayPush;
  5516. /** Built-in value references. */
  5517. var getPrototype = _overArg(Object.getPrototypeOf, Object);
  5518. var _getPrototype = getPrototype;
  5519. /* Built-in method references for those with the same name as other `lodash` methods. */
  5520. var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
  5521. /**
  5522. * Creates an array of the own and inherited enumerable symbols of `object`.
  5523. *
  5524. * @private
  5525. * @param {Object} object The object to query.
  5526. * @returns {Array} Returns the array of symbols.
  5527. */
  5528. var getSymbolsIn = !nativeGetSymbols$1 ? stubArray_1 : function(object) {
  5529. var result = [];
  5530. while (object) {
  5531. _arrayPush(result, _getSymbols(object));
  5532. object = _getPrototype(object);
  5533. }
  5534. return result;
  5535. };
  5536. var _getSymbolsIn = getSymbolsIn;
  5537. /**
  5538. * Copies own and inherited symbols of `source` to `object`.
  5539. *
  5540. * @private
  5541. * @param {Object} source The object to copy symbols from.
  5542. * @param {Object} [object={}] The object to copy symbols to.
  5543. * @returns {Object} Returns `object`.
  5544. */
  5545. function copySymbolsIn(source, object) {
  5546. return _copyObject(source, _getSymbolsIn(source), object);
  5547. }
  5548. var _copySymbolsIn = copySymbolsIn;
  5549. /**
  5550. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  5551. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  5552. * symbols of `object`.
  5553. *
  5554. * @private
  5555. * @param {Object} object The object to query.
  5556. * @param {Function} keysFunc The function to get the keys of `object`.
  5557. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  5558. * @returns {Array} Returns the array of property names and symbols.
  5559. */
  5560. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  5561. var result = keysFunc(object);
  5562. return isArray_1(object) ? result : _arrayPush(result, symbolsFunc(object));
  5563. }
  5564. var _baseGetAllKeys = baseGetAllKeys;
  5565. /**
  5566. * Creates an array of own enumerable property names and symbols of `object`.
  5567. *
  5568. * @private
  5569. * @param {Object} object The object to query.
  5570. * @returns {Array} Returns the array of property names and symbols.
  5571. */
  5572. function getAllKeys(object) {
  5573. return _baseGetAllKeys(object, keys_1, _getSymbols);
  5574. }
  5575. var _getAllKeys = getAllKeys;
  5576. /**
  5577. * Creates an array of own and inherited enumerable property names and
  5578. * symbols of `object`.
  5579. *
  5580. * @private
  5581. * @param {Object} object The object to query.
  5582. * @returns {Array} Returns the array of property names and symbols.
  5583. */
  5584. function getAllKeysIn(object) {
  5585. return _baseGetAllKeys(object, keysIn_1, _getSymbolsIn);
  5586. }
  5587. var _getAllKeysIn = getAllKeysIn;
  5588. /* Built-in method references that are verified to be native. */
  5589. var DataView = _getNative(_root, 'DataView');
  5590. var _DataView = DataView;
  5591. /* Built-in method references that are verified to be native. */
  5592. var Promise = _getNative(_root, 'Promise');
  5593. var _Promise = Promise;
  5594. /* Built-in method references that are verified to be native. */
  5595. var Set$1 = _getNative(_root, 'Set');
  5596. var _Set = Set$1;
  5597. /* Built-in method references that are verified to be native. */
  5598. var WeakMap = _getNative(_root, 'WeakMap');
  5599. var _WeakMap = WeakMap;
  5600. /** `Object#toString` result references. */
  5601. var mapTag$1 = '[object Map]',
  5602. objectTag$1 = '[object Object]',
  5603. promiseTag = '[object Promise]',
  5604. setTag$1 = '[object Set]',
  5605. weakMapTag$1 = '[object WeakMap]';
  5606. var dataViewTag$1 = '[object DataView]';
  5607. /** Used to detect maps, sets, and weakmaps. */
  5608. var dataViewCtorString = _toSource(_DataView),
  5609. mapCtorString = _toSource(_Map),
  5610. promiseCtorString = _toSource(_Promise),
  5611. setCtorString = _toSource(_Set),
  5612. weakMapCtorString = _toSource(_WeakMap);
  5613. /**
  5614. * Gets the `toStringTag` of `value`.
  5615. *
  5616. * @private
  5617. * @param {*} value The value to query.
  5618. * @returns {string} Returns the `toStringTag`.
  5619. */
  5620. var getTag = _baseGetTag;
  5621. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  5622. if ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag$1) ||
  5623. (_Map && getTag(new _Map) != mapTag$1) ||
  5624. (_Promise && getTag(_Promise.resolve()) != promiseTag) ||
  5625. (_Set && getTag(new _Set) != setTag$1) ||
  5626. (_WeakMap && getTag(new _WeakMap) != weakMapTag$1)) {
  5627. getTag = function(value) {
  5628. var result = _baseGetTag(value),
  5629. Ctor = result == objectTag$1 ? value.constructor : undefined,
  5630. ctorString = Ctor ? _toSource(Ctor) : '';
  5631. if (ctorString) {
  5632. switch (ctorString) {
  5633. case dataViewCtorString: return dataViewTag$1;
  5634. case mapCtorString: return mapTag$1;
  5635. case promiseCtorString: return promiseTag;
  5636. case setCtorString: return setTag$1;
  5637. case weakMapCtorString: return weakMapTag$1;
  5638. }
  5639. }
  5640. return result;
  5641. };
  5642. }
  5643. var _getTag = getTag;
  5644. /** Used for built-in method references. */
  5645. var objectProto$12 = Object.prototype;
  5646. /** Used to check objects for own properties. */
  5647. var hasOwnProperty$10 = objectProto$12.hasOwnProperty;
  5648. /**
  5649. * Initializes an array clone.
  5650. *
  5651. * @private
  5652. * @param {Array} array The array to clone.
  5653. * @returns {Array} Returns the initialized clone.
  5654. */
  5655. function initCloneArray(array) {
  5656. var length = array.length,
  5657. result = array.constructor(length);
  5658. // Add properties assigned by `RegExp#exec`.
  5659. if (length && typeof array[0] == 'string' && hasOwnProperty$10.call(array, 'index')) {
  5660. result.index = array.index;
  5661. result.input = array.input;
  5662. }
  5663. return result;
  5664. }
  5665. var _initCloneArray = initCloneArray;
  5666. /** Built-in value references. */
  5667. var Uint8Array = _root.Uint8Array;
  5668. var _Uint8Array = Uint8Array;
  5669. /**
  5670. * Creates a clone of `arrayBuffer`.
  5671. *
  5672. * @private
  5673. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  5674. * @returns {ArrayBuffer} Returns the cloned array buffer.
  5675. */
  5676. function cloneArrayBuffer(arrayBuffer) {
  5677. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  5678. new _Uint8Array(result).set(new _Uint8Array(arrayBuffer));
  5679. return result;
  5680. }
  5681. var _cloneArrayBuffer = cloneArrayBuffer;
  5682. /**
  5683. * Creates a clone of `dataView`.
  5684. *
  5685. * @private
  5686. * @param {Object} dataView The data view to clone.
  5687. * @param {boolean} [isDeep] Specify a deep clone.
  5688. * @returns {Object} Returns the cloned data view.
  5689. */
  5690. function cloneDataView(dataView, isDeep) {
  5691. var buffer = isDeep ? _cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  5692. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  5693. }
  5694. var _cloneDataView = cloneDataView;
  5695. /**
  5696. * Adds the key-value `pair` to `map`.
  5697. *
  5698. * @private
  5699. * @param {Object} map The map to modify.
  5700. * @param {Array} pair The key-value pair to add.
  5701. * @returns {Object} Returns `map`.
  5702. */
  5703. function addMapEntry(map, pair) {
  5704. // Don't return `map.set` because it's not chainable in IE 11.
  5705. map.set(pair[0], pair[1]);
  5706. return map;
  5707. }
  5708. var _addMapEntry = addMapEntry;
  5709. /**
  5710. * A specialized version of `_.reduce` for arrays without support for
  5711. * iteratee shorthands.
  5712. *
  5713. * @private
  5714. * @param {Array} [array] The array to iterate over.
  5715. * @param {Function} iteratee The function invoked per iteration.
  5716. * @param {*} [accumulator] The initial value.
  5717. * @param {boolean} [initAccum] Specify using the first element of `array` as
  5718. * the initial value.
  5719. * @returns {*} Returns the accumulated value.
  5720. */
  5721. function arrayReduce(array, iteratee, accumulator, initAccum) {
  5722. var index = -1,
  5723. length = array == null ? 0 : array.length;
  5724. if (initAccum && length) {
  5725. accumulator = array[++index];
  5726. }
  5727. while (++index < length) {
  5728. accumulator = iteratee(accumulator, array[index], index, array);
  5729. }
  5730. return accumulator;
  5731. }
  5732. var _arrayReduce = arrayReduce;
  5733. /**
  5734. * Converts `map` to its key-value pairs.
  5735. *
  5736. * @private
  5737. * @param {Object} map The map to convert.
  5738. * @returns {Array} Returns the key-value pairs.
  5739. */
  5740. function mapToArray(map) {
  5741. var index = -1,
  5742. result = Array(map.size);
  5743. map.forEach(function(value, key) {
  5744. result[++index] = [key, value];
  5745. });
  5746. return result;
  5747. }
  5748. var _mapToArray = mapToArray;
  5749. /** Used to compose bitmasks for cloning. */
  5750. var CLONE_DEEP_FLAG = 1;
  5751. /**
  5752. * Creates a clone of `map`.
  5753. *
  5754. * @private
  5755. * @param {Object} map The map to clone.
  5756. * @param {Function} cloneFunc The function to clone values.
  5757. * @param {boolean} [isDeep] Specify a deep clone.
  5758. * @returns {Object} Returns the cloned map.
  5759. */
  5760. function cloneMap(map, isDeep, cloneFunc) {
  5761. var array = isDeep ? cloneFunc(_mapToArray(map), CLONE_DEEP_FLAG) : _mapToArray(map);
  5762. return _arrayReduce(array, _addMapEntry, new map.constructor);
  5763. }
  5764. var _cloneMap = cloneMap;
  5765. /** Used to match `RegExp` flags from their coerced string values. */
  5766. var reFlags = /\w*$/;
  5767. /**
  5768. * Creates a clone of `regexp`.
  5769. *
  5770. * @private
  5771. * @param {Object} regexp The regexp to clone.
  5772. * @returns {Object} Returns the cloned regexp.
  5773. */
  5774. function cloneRegExp(regexp) {
  5775. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  5776. result.lastIndex = regexp.lastIndex;
  5777. return result;
  5778. }
  5779. var _cloneRegExp = cloneRegExp;
  5780. /**
  5781. * Adds `value` to `set`.
  5782. *
  5783. * @private
  5784. * @param {Object} set The set to modify.
  5785. * @param {*} value The value to add.
  5786. * @returns {Object} Returns `set`.
  5787. */
  5788. function addSetEntry(set, value) {
  5789. // Don't return `set.add` because it's not chainable in IE 11.
  5790. set.add(value);
  5791. return set;
  5792. }
  5793. var _addSetEntry = addSetEntry;
  5794. /**
  5795. * Converts `set` to an array of its values.
  5796. *
  5797. * @private
  5798. * @param {Object} set The set to convert.
  5799. * @returns {Array} Returns the values.
  5800. */
  5801. function setToArray(set) {
  5802. var index = -1,
  5803. result = Array(set.size);
  5804. set.forEach(function(value) {
  5805. result[++index] = value;
  5806. });
  5807. return result;
  5808. }
  5809. var _setToArray = setToArray;
  5810. /** Used to compose bitmasks for cloning. */
  5811. var CLONE_DEEP_FLAG$1 = 1;
  5812. /**
  5813. * Creates a clone of `set`.
  5814. *
  5815. * @private
  5816. * @param {Object} set The set to clone.
  5817. * @param {Function} cloneFunc The function to clone values.
  5818. * @param {boolean} [isDeep] Specify a deep clone.
  5819. * @returns {Object} Returns the cloned set.
  5820. */
  5821. function cloneSet(set, isDeep, cloneFunc) {
  5822. var array = isDeep ? cloneFunc(_setToArray(set), CLONE_DEEP_FLAG$1) : _setToArray(set);
  5823. return _arrayReduce(array, _addSetEntry, new set.constructor);
  5824. }
  5825. var _cloneSet = cloneSet;
  5826. /** Used to convert symbols to primitives and strings. */
  5827. var symbolProto = _Symbol ? _Symbol.prototype : undefined,
  5828. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
  5829. /**
  5830. * Creates a clone of the `symbol` object.
  5831. *
  5832. * @private
  5833. * @param {Object} symbol The symbol object to clone.
  5834. * @returns {Object} Returns the cloned symbol object.
  5835. */
  5836. function cloneSymbol(symbol) {
  5837. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  5838. }
  5839. var _cloneSymbol = cloneSymbol;
  5840. /**
  5841. * Creates a clone of `typedArray`.
  5842. *
  5843. * @private
  5844. * @param {Object} typedArray The typed array to clone.
  5845. * @param {boolean} [isDeep] Specify a deep clone.
  5846. * @returns {Object} Returns the cloned typed array.
  5847. */
  5848. function cloneTypedArray(typedArray, isDeep) {
  5849. var buffer = isDeep ? _cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  5850. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  5851. }
  5852. var _cloneTypedArray = cloneTypedArray;
  5853. /** `Object#toString` result references. */
  5854. var boolTag$1 = '[object Boolean]',
  5855. dateTag$1 = '[object Date]',
  5856. mapTag$2 = '[object Map]',
  5857. numberTag$1 = '[object Number]',
  5858. regexpTag$1 = '[object RegExp]',
  5859. setTag$2 = '[object Set]',
  5860. stringTag$1 = '[object String]',
  5861. symbolTag = '[object Symbol]';
  5862. var arrayBufferTag$1 = '[object ArrayBuffer]',
  5863. dataViewTag$2 = '[object DataView]',
  5864. float32Tag$1 = '[object Float32Array]',
  5865. float64Tag$1 = '[object Float64Array]',
  5866. int8Tag$1 = '[object Int8Array]',
  5867. int16Tag$1 = '[object Int16Array]',
  5868. int32Tag$1 = '[object Int32Array]',
  5869. uint8Tag$1 = '[object Uint8Array]',
  5870. uint8ClampedTag$1 = '[object Uint8ClampedArray]',
  5871. uint16Tag$1 = '[object Uint16Array]',
  5872. uint32Tag$1 = '[object Uint32Array]';
  5873. /**
  5874. * Initializes an object clone based on its `toStringTag`.
  5875. *
  5876. * **Note:** This function only supports cloning values with tags of
  5877. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  5878. *
  5879. * @private
  5880. * @param {Object} object The object to clone.
  5881. * @param {string} tag The `toStringTag` of the object to clone.
  5882. * @param {Function} cloneFunc The function to clone values.
  5883. * @param {boolean} [isDeep] Specify a deep clone.
  5884. * @returns {Object} Returns the initialized clone.
  5885. */
  5886. function initCloneByTag(object, tag, cloneFunc, isDeep) {
  5887. var Ctor = object.constructor;
  5888. switch (tag) {
  5889. case arrayBufferTag$1:
  5890. return _cloneArrayBuffer(object);
  5891. case boolTag$1:
  5892. case dateTag$1:
  5893. return new Ctor(+object);
  5894. case dataViewTag$2:
  5895. return _cloneDataView(object, isDeep);
  5896. case float32Tag$1: case float64Tag$1:
  5897. case int8Tag$1: case int16Tag$1: case int32Tag$1:
  5898. case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1:
  5899. return _cloneTypedArray(object, isDeep);
  5900. case mapTag$2:
  5901. return _cloneMap(object, isDeep, cloneFunc);
  5902. case numberTag$1:
  5903. case stringTag$1:
  5904. return new Ctor(object);
  5905. case regexpTag$1:
  5906. return _cloneRegExp(object);
  5907. case setTag$2:
  5908. return _cloneSet(object, isDeep, cloneFunc);
  5909. case symbolTag:
  5910. return _cloneSymbol(object);
  5911. }
  5912. }
  5913. var _initCloneByTag = initCloneByTag;
  5914. /** Built-in value references. */
  5915. var objectCreate = Object.create;
  5916. /**
  5917. * The base implementation of `_.create` without support for assigning
  5918. * properties to the created object.
  5919. *
  5920. * @private
  5921. * @param {Object} proto The object to inherit from.
  5922. * @returns {Object} Returns the new object.
  5923. */
  5924. var baseCreate = (function() {
  5925. function object() {}
  5926. return function(proto) {
  5927. if (!isObject_1(proto)) {
  5928. return {};
  5929. }
  5930. if (objectCreate) {
  5931. return objectCreate(proto);
  5932. }
  5933. object.prototype = proto;
  5934. var result = new object;
  5935. object.prototype = undefined;
  5936. return result;
  5937. };
  5938. }());
  5939. var _baseCreate = baseCreate;
  5940. /**
  5941. * Initializes an object clone.
  5942. *
  5943. * @private
  5944. * @param {Object} object The object to clone.
  5945. * @returns {Object} Returns the initialized clone.
  5946. */
  5947. function initCloneObject(object) {
  5948. return (typeof object.constructor == 'function' && !_isPrototype(object))
  5949. ? _baseCreate(_getPrototype(object))
  5950. : {};
  5951. }
  5952. var _initCloneObject = initCloneObject;
  5953. /** Used to compose bitmasks for cloning. */
  5954. var CLONE_DEEP_FLAG$2 = 1,
  5955. CLONE_FLAT_FLAG = 2,
  5956. CLONE_SYMBOLS_FLAG = 4;
  5957. /** `Object#toString` result references. */
  5958. var argsTag$2 = '[object Arguments]',
  5959. arrayTag$1 = '[object Array]',
  5960. boolTag$2 = '[object Boolean]',
  5961. dateTag$2 = '[object Date]',
  5962. errorTag$1 = '[object Error]',
  5963. funcTag$2 = '[object Function]',
  5964. genTag$1 = '[object GeneratorFunction]',
  5965. mapTag$3 = '[object Map]',
  5966. numberTag$2 = '[object Number]',
  5967. objectTag$2 = '[object Object]',
  5968. regexpTag$2 = '[object RegExp]',
  5969. setTag$3 = '[object Set]',
  5970. stringTag$2 = '[object String]',
  5971. symbolTag$1 = '[object Symbol]',
  5972. weakMapTag$2 = '[object WeakMap]';
  5973. var arrayBufferTag$2 = '[object ArrayBuffer]',
  5974. dataViewTag$3 = '[object DataView]',
  5975. float32Tag$2 = '[object Float32Array]',
  5976. float64Tag$2 = '[object Float64Array]',
  5977. int8Tag$2 = '[object Int8Array]',
  5978. int16Tag$2 = '[object Int16Array]',
  5979. int32Tag$2 = '[object Int32Array]',
  5980. uint8Tag$2 = '[object Uint8Array]',
  5981. uint8ClampedTag$2 = '[object Uint8ClampedArray]',
  5982. uint16Tag$2 = '[object Uint16Array]',
  5983. uint32Tag$2 = '[object Uint32Array]';
  5984. /** Used to identify `toStringTag` values supported by `_.clone`. */
  5985. var cloneableTags = {};
  5986. cloneableTags[argsTag$2] = cloneableTags[arrayTag$1] =
  5987. cloneableTags[arrayBufferTag$2] = cloneableTags[dataViewTag$3] =
  5988. cloneableTags[boolTag$2] = cloneableTags[dateTag$2] =
  5989. cloneableTags[float32Tag$2] = cloneableTags[float64Tag$2] =
  5990. cloneableTags[int8Tag$2] = cloneableTags[int16Tag$2] =
  5991. cloneableTags[int32Tag$2] = cloneableTags[mapTag$3] =
  5992. cloneableTags[numberTag$2] = cloneableTags[objectTag$2] =
  5993. cloneableTags[regexpTag$2] = cloneableTags[setTag$3] =
  5994. cloneableTags[stringTag$2] = cloneableTags[symbolTag$1] =
  5995. cloneableTags[uint8Tag$2] = cloneableTags[uint8ClampedTag$2] =
  5996. cloneableTags[uint16Tag$2] = cloneableTags[uint32Tag$2] = true;
  5997. cloneableTags[errorTag$1] = cloneableTags[funcTag$2] =
  5998. cloneableTags[weakMapTag$2] = false;
  5999. /**
  6000. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  6001. * traversed objects.
  6002. *
  6003. * @private
  6004. * @param {*} value The value to clone.
  6005. * @param {boolean} bitmask The bitmask flags.
  6006. * 1 - Deep clone
  6007. * 2 - Flatten inherited properties
  6008. * 4 - Clone symbols
  6009. * @param {Function} [customizer] The function to customize cloning.
  6010. * @param {string} [key] The key of `value`.
  6011. * @param {Object} [object] The parent object of `value`.
  6012. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  6013. * @returns {*} Returns the cloned value.
  6014. */
  6015. function baseClone(value, bitmask, customizer, key, object, stack) {
  6016. var result,
  6017. isDeep = bitmask & CLONE_DEEP_FLAG$2,
  6018. isFlat = bitmask & CLONE_FLAT_FLAG,
  6019. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  6020. if (customizer) {
  6021. result = object ? customizer(value, key, object, stack) : customizer(value);
  6022. }
  6023. if (result !== undefined) {
  6024. return result;
  6025. }
  6026. if (!isObject_1(value)) {
  6027. return value;
  6028. }
  6029. var isArr = isArray_1(value);
  6030. if (isArr) {
  6031. result = _initCloneArray(value);
  6032. if (!isDeep) {
  6033. return _copyArray(value, result);
  6034. }
  6035. } else {
  6036. var tag = _getTag(value),
  6037. isFunc = tag == funcTag$2 || tag == genTag$1;
  6038. if (isBuffer_1(value)) {
  6039. return _cloneBuffer(value, isDeep);
  6040. }
  6041. if (tag == objectTag$2 || tag == argsTag$2 || (isFunc && !object)) {
  6042. result = (isFlat || isFunc) ? {} : _initCloneObject(value);
  6043. if (!isDeep) {
  6044. return isFlat
  6045. ? _copySymbolsIn(value, _baseAssignIn(result, value))
  6046. : _copySymbols(value, _baseAssign(result, value));
  6047. }
  6048. } else {
  6049. if (!cloneableTags[tag]) {
  6050. return object ? value : {};
  6051. }
  6052. result = _initCloneByTag(value, tag, baseClone, isDeep);
  6053. }
  6054. }
  6055. // Check for circular references and return its corresponding clone.
  6056. stack || (stack = new _Stack);
  6057. var stacked = stack.get(value);
  6058. if (stacked) {
  6059. return stacked;
  6060. }
  6061. stack.set(value, result);
  6062. var keysFunc = isFull
  6063. ? (isFlat ? _getAllKeysIn : _getAllKeys)
  6064. : (isFlat ? keysIn : keys_1);
  6065. var props = isArr ? undefined : keysFunc(value);
  6066. _arrayEach(props || value, function(subValue, key) {
  6067. if (props) {
  6068. key = subValue;
  6069. subValue = value[key];
  6070. }
  6071. // Recursively populate clone (susceptible to call stack limits).
  6072. _assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  6073. });
  6074. return result;
  6075. }
  6076. var _baseClone = baseClone;
  6077. /** Used to compose bitmasks for cloning. */
  6078. var CLONE_DEEP_FLAG$3 = 1,
  6079. CLONE_SYMBOLS_FLAG$1 = 4;
  6080. /**
  6081. * This method is like `_.clone` except that it recursively clones `value`.
  6082. *
  6083. * @static
  6084. * @memberOf _
  6085. * @since 1.0.0
  6086. * @category Lang
  6087. * @param {*} value The value to recursively clone.
  6088. * @returns {*} Returns the deep cloned value.
  6089. * @see _.clone
  6090. * @example
  6091. *
  6092. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  6093. *
  6094. * var deep = _.cloneDeep(objects);
  6095. * console.log(deep[0] === objects[0]);
  6096. * // => false
  6097. */
  6098. function cloneDeep(value) {
  6099. return _baseClone(value, CLONE_DEEP_FLAG$3 | CLONE_SYMBOLS_FLAG$1);
  6100. }
  6101. var cloneDeep_1 = cloneDeep;
  6102. //
  6103. function createLocalVue(_Vue) {
  6104. if ( _Vue === void 0 ) _Vue = Vue;
  6105. var instance = _Vue.extend();
  6106. // clone global APIs
  6107. Object.keys(_Vue).forEach(function (key) {
  6108. if (!instance.hasOwnProperty(key)) {
  6109. var original = _Vue[key];
  6110. // cloneDeep can fail when cloning Vue instances
  6111. // cloneDeep checks that the instance has a Symbol
  6112. // which errors in Vue < 2.17 (https://github.com/vuejs/vue/pull/7878)
  6113. try {
  6114. instance[key] =
  6115. typeof original === 'object' ? cloneDeep_1(original) : original;
  6116. } catch (e) {
  6117. instance[key] = original;
  6118. }
  6119. }
  6120. });
  6121. // config is not enumerable
  6122. instance.config = cloneDeep_1(Vue.config);
  6123. instance.config.errorHandler = Vue.config.errorHandler;
  6124. // option merge strategies need to be exposed by reference
  6125. // so that merge strats registered by plugins can work properly
  6126. instance.config.optionMergeStrategies = Vue.config.optionMergeStrategies;
  6127. // make sure all extends are based on this instance.
  6128. // this is important so that global components registered by plugins,
  6129. // e.g. router-link are created using the correct base constructor
  6130. instance.options._base = instance;
  6131. // compat for vue-router < 2.7.1 where it does not allow multiple installs
  6132. if (instance._installedPlugins && instance._installedPlugins.length) {
  6133. instance._installedPlugins.length = 0;
  6134. }
  6135. var use = instance.use;
  6136. instance.use = function (plugin) {
  6137. var rest = [], len = arguments.length - 1;
  6138. while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ];
  6139. if (plugin.installed === true) {
  6140. plugin.installed = false;
  6141. }
  6142. if (plugin.install && plugin.install.installed === true) {
  6143. plugin.install.installed = false;
  6144. }
  6145. use.call.apply(use, [ instance, plugin ].concat( rest ));
  6146. };
  6147. return instance
  6148. }
  6149. var semver$1 = createCommonjsModule(function (module, exports) {
  6150. exports = module.exports = SemVer;
  6151. // The debug function is excluded entirely from the minified version.
  6152. /* nomin */ var debug;
  6153. /* nomin */ if (typeof process === 'object' &&
  6154. /* nomin */ process.env &&
  6155. /* nomin */ process.env.NODE_DEBUG &&
  6156. /* nomin */ /\bsemver\b/i.test(process.env.NODE_DEBUG))
  6157. /* nomin */ { debug = function() {
  6158. /* nomin */ var args = Array.prototype.slice.call(arguments, 0);
  6159. /* nomin */ args.unshift('SEMVER');
  6160. /* nomin */ console.log.apply(console, args);
  6161. /* nomin */ }; }
  6162. /* nomin */ else
  6163. /* nomin */ { debug = function() {}; }
  6164. // Note: this is the semver.org version of the spec that it implements
  6165. // Not necessarily the package version of this code.
  6166. exports.SEMVER_SPEC_VERSION = '2.0.0';
  6167. var MAX_LENGTH = 256;
  6168. var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
  6169. // Max safe segment length for coercion.
  6170. var MAX_SAFE_COMPONENT_LENGTH = 16;
  6171. // The actual regexps go on exports.re
  6172. var re = exports.re = [];
  6173. var src = exports.src = [];
  6174. var R = 0;
  6175. // The following Regular Expressions can be used for tokenizing,
  6176. // validating, and parsing SemVer version strings.
  6177. // ## Numeric Identifier
  6178. // A single `0`, or a non-zero digit followed by zero or more digits.
  6179. var NUMERICIDENTIFIER = R++;
  6180. src[NUMERICIDENTIFIER] = '0|[1-9]\\d*';
  6181. var NUMERICIDENTIFIERLOOSE = R++;
  6182. src[NUMERICIDENTIFIERLOOSE] = '[0-9]+';
  6183. // ## Non-numeric Identifier
  6184. // Zero or more digits, followed by a letter or hyphen, and then zero or
  6185. // more letters, digits, or hyphens.
  6186. var NONNUMERICIDENTIFIER = R++;
  6187. src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*';
  6188. // ## Main Version
  6189. // Three dot-separated numeric identifiers.
  6190. var MAINVERSION = R++;
  6191. src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' +
  6192. '(' + src[NUMERICIDENTIFIER] + ')\\.' +
  6193. '(' + src[NUMERICIDENTIFIER] + ')';
  6194. var MAINVERSIONLOOSE = R++;
  6195. src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
  6196. '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
  6197. '(' + src[NUMERICIDENTIFIERLOOSE] + ')';
  6198. // ## Pre-release Version Identifier
  6199. // A numeric identifier, or a non-numeric identifier.
  6200. var PRERELEASEIDENTIFIER = R++;
  6201. src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] +
  6202. '|' + src[NONNUMERICIDENTIFIER] + ')';
  6203. var PRERELEASEIDENTIFIERLOOSE = R++;
  6204. src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] +
  6205. '|' + src[NONNUMERICIDENTIFIER] + ')';
  6206. // ## Pre-release Version
  6207. // Hyphen, followed by one or more dot-separated pre-release version
  6208. // identifiers.
  6209. var PRERELEASE = R++;
  6210. src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] +
  6211. '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))';
  6212. var PRERELEASELOOSE = R++;
  6213. src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] +
  6214. '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))';
  6215. // ## Build Metadata Identifier
  6216. // Any combination of digits, letters, or hyphens.
  6217. var BUILDIDENTIFIER = R++;
  6218. src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+';
  6219. // ## Build Metadata
  6220. // Plus sign, followed by one or more period-separated build metadata
  6221. // identifiers.
  6222. var BUILD = R++;
  6223. src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] +
  6224. '(?:\\.' + src[BUILDIDENTIFIER] + ')*))';
  6225. // ## Full Version String
  6226. // A main version, followed optionally by a pre-release version and
  6227. // build metadata.
  6228. // Note that the only major, minor, patch, and pre-release sections of
  6229. // the version string are capturing groups. The build metadata is not a
  6230. // capturing group, because it should not ever be used in version
  6231. // comparison.
  6232. var FULL = R++;
  6233. var FULLPLAIN = 'v?' + src[MAINVERSION] +
  6234. src[PRERELEASE] + '?' +
  6235. src[BUILD] + '?';
  6236. src[FULL] = '^' + FULLPLAIN + '$';
  6237. // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
  6238. // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
  6239. // common in the npm registry.
  6240. var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] +
  6241. src[PRERELEASELOOSE] + '?' +
  6242. src[BUILD] + '?';
  6243. var LOOSE = R++;
  6244. src[LOOSE] = '^' + LOOSEPLAIN + '$';
  6245. var GTLT = R++;
  6246. src[GTLT] = '((?:<|>)?=?)';
  6247. // Something like "2.*" or "1.2.x".
  6248. // Note that "x.x" is a valid xRange identifer, meaning "any version"
  6249. // Only the first item is strictly required.
  6250. var XRANGEIDENTIFIERLOOSE = R++;
  6251. src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*';
  6252. var XRANGEIDENTIFIER = R++;
  6253. src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*';
  6254. var XRANGEPLAIN = R++;
  6255. src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' +
  6256. '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
  6257. '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
  6258. '(?:' + src[PRERELEASE] + ')?' +
  6259. src[BUILD] + '?' +
  6260. ')?)?';
  6261. var XRANGEPLAINLOOSE = R++;
  6262. src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
  6263. '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
  6264. '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
  6265. '(?:' + src[PRERELEASELOOSE] + ')?' +
  6266. src[BUILD] + '?' +
  6267. ')?)?';
  6268. var XRANGE = R++;
  6269. src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$';
  6270. var XRANGELOOSE = R++;
  6271. src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$';
  6272. // Coercion.
  6273. // Extract anything that could conceivably be a part of a valid semver
  6274. var COERCE = R++;
  6275. src[COERCE] = '(?:^|[^\\d])' +
  6276. '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' +
  6277. '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
  6278. '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
  6279. '(?:$|[^\\d])';
  6280. // Tilde ranges.
  6281. // Meaning is "reasonably at or greater than"
  6282. var LONETILDE = R++;
  6283. src[LONETILDE] = '(?:~>?)';
  6284. var TILDETRIM = R++;
  6285. src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+';
  6286. re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g');
  6287. var tildeTrimReplace = '$1~';
  6288. var TILDE = R++;
  6289. src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$';
  6290. var TILDELOOSE = R++;
  6291. src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$';
  6292. // Caret ranges.
  6293. // Meaning is "at least and backwards compatible with"
  6294. var LONECARET = R++;
  6295. src[LONECARET] = '(?:\\^)';
  6296. var CARETTRIM = R++;
  6297. src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+';
  6298. re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g');
  6299. var caretTrimReplace = '$1^';
  6300. var CARET = R++;
  6301. src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$';
  6302. var CARETLOOSE = R++;
  6303. src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$';
  6304. // A simple gt/lt/eq thing, or just "" to indicate "any version"
  6305. var COMPARATORLOOSE = R++;
  6306. src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$';
  6307. var COMPARATOR = R++;
  6308. src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$';
  6309. // An expression to strip any whitespace between the gtlt and the thing
  6310. // it modifies, so that `> 1.2.3` ==> `>1.2.3`
  6311. var COMPARATORTRIM = R++;
  6312. src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] +
  6313. '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')';
  6314. // this one has to use the /g flag
  6315. re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g');
  6316. var comparatorTrimReplace = '$1$2$3';
  6317. // Something like `1.2.3 - 1.2.4`
  6318. // Note that these all use the loose form, because they'll be
  6319. // checked against either the strict or loose comparator form
  6320. // later.
  6321. var HYPHENRANGE = R++;
  6322. src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' +
  6323. '\\s+-\\s+' +
  6324. '(' + src[XRANGEPLAIN] + ')' +
  6325. '\\s*$';
  6326. var HYPHENRANGELOOSE = R++;
  6327. src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' +
  6328. '\\s+-\\s+' +
  6329. '(' + src[XRANGEPLAINLOOSE] + ')' +
  6330. '\\s*$';
  6331. // Star ranges basically just allow anything at all.
  6332. var STAR = R++;
  6333. src[STAR] = '(<|>)?=?\\s*\\*';
  6334. // Compile to actual regexp objects.
  6335. // All are flag-free, unless they were created above with a flag.
  6336. for (var i = 0; i < R; i++) {
  6337. debug(i, src[i]);
  6338. if (!re[i])
  6339. { re[i] = new RegExp(src[i]); }
  6340. }
  6341. exports.parse = parse;
  6342. function parse(version, loose) {
  6343. if (version instanceof SemVer)
  6344. { return version; }
  6345. if (typeof version !== 'string')
  6346. { return null; }
  6347. if (version.length > MAX_LENGTH)
  6348. { return null; }
  6349. var r = loose ? re[LOOSE] : re[FULL];
  6350. if (!r.test(version))
  6351. { return null; }
  6352. try {
  6353. return new SemVer(version, loose);
  6354. } catch (er) {
  6355. return null;
  6356. }
  6357. }
  6358. exports.valid = valid;
  6359. function valid(version, loose) {
  6360. var v = parse(version, loose);
  6361. return v ? v.version : null;
  6362. }
  6363. exports.clean = clean;
  6364. function clean(version, loose) {
  6365. var s = parse(version.trim().replace(/^[=v]+/, ''), loose);
  6366. return s ? s.version : null;
  6367. }
  6368. exports.SemVer = SemVer;
  6369. function SemVer(version, loose) {
  6370. if (version instanceof SemVer) {
  6371. if (version.loose === loose)
  6372. { return version; }
  6373. else
  6374. { version = version.version; }
  6375. } else if (typeof version !== 'string') {
  6376. throw new TypeError('Invalid Version: ' + version);
  6377. }
  6378. if (version.length > MAX_LENGTH)
  6379. { throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') }
  6380. if (!(this instanceof SemVer))
  6381. { return new SemVer(version, loose); }
  6382. debug('SemVer', version, loose);
  6383. this.loose = loose;
  6384. var m = version.trim().match(loose ? re[LOOSE] : re[FULL]);
  6385. if (!m)
  6386. { throw new TypeError('Invalid Version: ' + version); }
  6387. this.raw = version;
  6388. // these are actually numbers
  6389. this.major = +m[1];
  6390. this.minor = +m[2];
  6391. this.patch = +m[3];
  6392. if (this.major > MAX_SAFE_INTEGER || this.major < 0)
  6393. { throw new TypeError('Invalid major version') }
  6394. if (this.minor > MAX_SAFE_INTEGER || this.minor < 0)
  6395. { throw new TypeError('Invalid minor version') }
  6396. if (this.patch > MAX_SAFE_INTEGER || this.patch < 0)
  6397. { throw new TypeError('Invalid patch version') }
  6398. // numberify any prerelease numeric ids
  6399. if (!m[4])
  6400. { this.prerelease = []; }
  6401. else
  6402. { this.prerelease = m[4].split('.').map(function(id) {
  6403. if (/^[0-9]+$/.test(id)) {
  6404. var num = +id;
  6405. if (num >= 0 && num < MAX_SAFE_INTEGER)
  6406. { return num; }
  6407. }
  6408. return id;
  6409. }); }
  6410. this.build = m[5] ? m[5].split('.') : [];
  6411. this.format();
  6412. }
  6413. SemVer.prototype.format = function() {
  6414. this.version = this.major + '.' + this.minor + '.' + this.patch;
  6415. if (this.prerelease.length)
  6416. { this.version += '-' + this.prerelease.join('.'); }
  6417. return this.version;
  6418. };
  6419. SemVer.prototype.toString = function() {
  6420. return this.version;
  6421. };
  6422. SemVer.prototype.compare = function(other) {
  6423. debug('SemVer.compare', this.version, this.loose, other);
  6424. if (!(other instanceof SemVer))
  6425. { other = new SemVer(other, this.loose); }
  6426. return this.compareMain(other) || this.comparePre(other);
  6427. };
  6428. SemVer.prototype.compareMain = function(other) {
  6429. if (!(other instanceof SemVer))
  6430. { other = new SemVer(other, this.loose); }
  6431. return compareIdentifiers(this.major, other.major) ||
  6432. compareIdentifiers(this.minor, other.minor) ||
  6433. compareIdentifiers(this.patch, other.patch);
  6434. };
  6435. SemVer.prototype.comparePre = function(other) {
  6436. var this$1 = this;
  6437. if (!(other instanceof SemVer))
  6438. { other = new SemVer(other, this.loose); }
  6439. // NOT having a prerelease is > having one
  6440. if (this.prerelease.length && !other.prerelease.length)
  6441. { return -1; }
  6442. else if (!this.prerelease.length && other.prerelease.length)
  6443. { return 1; }
  6444. else if (!this.prerelease.length && !other.prerelease.length)
  6445. { return 0; }
  6446. var i = 0;
  6447. do {
  6448. var a = this$1.prerelease[i];
  6449. var b = other.prerelease[i];
  6450. debug('prerelease compare', i, a, b);
  6451. if (a === undefined && b === undefined)
  6452. { return 0; }
  6453. else if (b === undefined)
  6454. { return 1; }
  6455. else if (a === undefined)
  6456. { return -1; }
  6457. else if (a === b)
  6458. { continue; }
  6459. else
  6460. { return compareIdentifiers(a, b); }
  6461. } while (++i);
  6462. };
  6463. // preminor will bump the version up to the next minor release, and immediately
  6464. // down to pre-release. premajor and prepatch work the same way.
  6465. SemVer.prototype.inc = function(release, identifier) {
  6466. var this$1 = this;
  6467. switch (release) {
  6468. case 'premajor':
  6469. this.prerelease.length = 0;
  6470. this.patch = 0;
  6471. this.minor = 0;
  6472. this.major++;
  6473. this.inc('pre', identifier);
  6474. break;
  6475. case 'preminor':
  6476. this.prerelease.length = 0;
  6477. this.patch = 0;
  6478. this.minor++;
  6479. this.inc('pre', identifier);
  6480. break;
  6481. case 'prepatch':
  6482. // If this is already a prerelease, it will bump to the next version
  6483. // drop any prereleases that might already exist, since they are not
  6484. // relevant at this point.
  6485. this.prerelease.length = 0;
  6486. this.inc('patch', identifier);
  6487. this.inc('pre', identifier);
  6488. break;
  6489. // If the input is a non-prerelease version, this acts the same as
  6490. // prepatch.
  6491. case 'prerelease':
  6492. if (this.prerelease.length === 0)
  6493. { this.inc('patch', identifier); }
  6494. this.inc('pre', identifier);
  6495. break;
  6496. case 'major':
  6497. // If this is a pre-major version, bump up to the same major version.
  6498. // Otherwise increment major.
  6499. // 1.0.0-5 bumps to 1.0.0
  6500. // 1.1.0 bumps to 2.0.0
  6501. if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0)
  6502. { this.major++; }
  6503. this.minor = 0;
  6504. this.patch = 0;
  6505. this.prerelease = [];
  6506. break;
  6507. case 'minor':
  6508. // If this is a pre-minor version, bump up to the same minor version.
  6509. // Otherwise increment minor.
  6510. // 1.2.0-5 bumps to 1.2.0
  6511. // 1.2.1 bumps to 1.3.0
  6512. if (this.patch !== 0 || this.prerelease.length === 0)
  6513. { this.minor++; }
  6514. this.patch = 0;
  6515. this.prerelease = [];
  6516. break;
  6517. case 'patch':
  6518. // If this is not a pre-release version, it will increment the patch.
  6519. // If it is a pre-release it will bump up to the same patch version.
  6520. // 1.2.0-5 patches to 1.2.0
  6521. // 1.2.0 patches to 1.2.1
  6522. if (this.prerelease.length === 0)
  6523. { this.patch++; }
  6524. this.prerelease = [];
  6525. break;
  6526. // This probably shouldn't be used publicly.
  6527. // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
  6528. case 'pre':
  6529. if (this.prerelease.length === 0)
  6530. { this.prerelease = [0]; }
  6531. else {
  6532. var i = this.prerelease.length;
  6533. while (--i >= 0) {
  6534. if (typeof this$1.prerelease[i] === 'number') {
  6535. this$1.prerelease[i]++;
  6536. i = -2;
  6537. }
  6538. }
  6539. if (i === -1) // didn't increment anything
  6540. { this.prerelease.push(0); }
  6541. }
  6542. if (identifier) {
  6543. // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
  6544. // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
  6545. if (this.prerelease[0] === identifier) {
  6546. if (isNaN(this.prerelease[1]))
  6547. { this.prerelease = [identifier, 0]; }
  6548. } else
  6549. { this.prerelease = [identifier, 0]; }
  6550. }
  6551. break;
  6552. default:
  6553. throw new Error('invalid increment argument: ' + release);
  6554. }
  6555. this.format();
  6556. this.raw = this.version;
  6557. return this;
  6558. };
  6559. exports.inc = inc;
  6560. function inc(version, release, loose, identifier) {
  6561. if (typeof(loose) === 'string') {
  6562. identifier = loose;
  6563. loose = undefined;
  6564. }
  6565. try {
  6566. return new SemVer(version, loose).inc(release, identifier).version;
  6567. } catch (er) {
  6568. return null;
  6569. }
  6570. }
  6571. exports.diff = diff;
  6572. function diff(version1, version2) {
  6573. if (eq(version1, version2)) {
  6574. return null;
  6575. } else {
  6576. var v1 = parse(version1);
  6577. var v2 = parse(version2);
  6578. if (v1.prerelease.length || v2.prerelease.length) {
  6579. for (var key in v1) {
  6580. if (key === 'major' || key === 'minor' || key === 'patch') {
  6581. if (v1[key] !== v2[key]) {
  6582. return 'pre'+key;
  6583. }
  6584. }
  6585. }
  6586. return 'prerelease';
  6587. }
  6588. for (var key in v1) {
  6589. if (key === 'major' || key === 'minor' || key === 'patch') {
  6590. if (v1[key] !== v2[key]) {
  6591. return key;
  6592. }
  6593. }
  6594. }
  6595. }
  6596. }
  6597. exports.compareIdentifiers = compareIdentifiers;
  6598. var numeric = /^[0-9]+$/;
  6599. function compareIdentifiers(a, b) {
  6600. var anum = numeric.test(a);
  6601. var bnum = numeric.test(b);
  6602. if (anum && bnum) {
  6603. a = +a;
  6604. b = +b;
  6605. }
  6606. return (anum && !bnum) ? -1 :
  6607. (bnum && !anum) ? 1 :
  6608. a < b ? -1 :
  6609. a > b ? 1 :
  6610. 0;
  6611. }
  6612. exports.rcompareIdentifiers = rcompareIdentifiers;
  6613. function rcompareIdentifiers(a, b) {
  6614. return compareIdentifiers(b, a);
  6615. }
  6616. exports.major = major;
  6617. function major(a, loose) {
  6618. return new SemVer(a, loose).major;
  6619. }
  6620. exports.minor = minor;
  6621. function minor(a, loose) {
  6622. return new SemVer(a, loose).minor;
  6623. }
  6624. exports.patch = patch;
  6625. function patch(a, loose) {
  6626. return new SemVer(a, loose).patch;
  6627. }
  6628. exports.compare = compare;
  6629. function compare(a, b, loose) {
  6630. return new SemVer(a, loose).compare(new SemVer(b, loose));
  6631. }
  6632. exports.compareLoose = compareLoose;
  6633. function compareLoose(a, b) {
  6634. return compare(a, b, true);
  6635. }
  6636. exports.rcompare = rcompare;
  6637. function rcompare(a, b, loose) {
  6638. return compare(b, a, loose);
  6639. }
  6640. exports.sort = sort;
  6641. function sort(list, loose) {
  6642. return list.sort(function(a, b) {
  6643. return exports.compare(a, b, loose);
  6644. });
  6645. }
  6646. exports.rsort = rsort;
  6647. function rsort(list, loose) {
  6648. return list.sort(function(a, b) {
  6649. return exports.rcompare(a, b, loose);
  6650. });
  6651. }
  6652. exports.gt = gt;
  6653. function gt(a, b, loose) {
  6654. return compare(a, b, loose) > 0;
  6655. }
  6656. exports.lt = lt;
  6657. function lt(a, b, loose) {
  6658. return compare(a, b, loose) < 0;
  6659. }
  6660. exports.eq = eq;
  6661. function eq(a, b, loose) {
  6662. return compare(a, b, loose) === 0;
  6663. }
  6664. exports.neq = neq;
  6665. function neq(a, b, loose) {
  6666. return compare(a, b, loose) !== 0;
  6667. }
  6668. exports.gte = gte;
  6669. function gte(a, b, loose) {
  6670. return compare(a, b, loose) >= 0;
  6671. }
  6672. exports.lte = lte;
  6673. function lte(a, b, loose) {
  6674. return compare(a, b, loose) <= 0;
  6675. }
  6676. exports.cmp = cmp;
  6677. function cmp(a, op, b, loose) {
  6678. var ret;
  6679. switch (op) {
  6680. case '===':
  6681. if (typeof a === 'object') { a = a.version; }
  6682. if (typeof b === 'object') { b = b.version; }
  6683. ret = a === b;
  6684. break;
  6685. case '!==':
  6686. if (typeof a === 'object') { a = a.version; }
  6687. if (typeof b === 'object') { b = b.version; }
  6688. ret = a !== b;
  6689. break;
  6690. case '': case '=': case '==': ret = eq(a, b, loose); break;
  6691. case '!=': ret = neq(a, b, loose); break;
  6692. case '>': ret = gt(a, b, loose); break;
  6693. case '>=': ret = gte(a, b, loose); break;
  6694. case '<': ret = lt(a, b, loose); break;
  6695. case '<=': ret = lte(a, b, loose); break;
  6696. default: throw new TypeError('Invalid operator: ' + op);
  6697. }
  6698. return ret;
  6699. }
  6700. exports.Comparator = Comparator;
  6701. function Comparator(comp, loose) {
  6702. if (comp instanceof Comparator) {
  6703. if (comp.loose === loose)
  6704. { return comp; }
  6705. else
  6706. { comp = comp.value; }
  6707. }
  6708. if (!(this instanceof Comparator))
  6709. { return new Comparator(comp, loose); }
  6710. debug('comparator', comp, loose);
  6711. this.loose = loose;
  6712. this.parse(comp);
  6713. if (this.semver === ANY)
  6714. { this.value = ''; }
  6715. else
  6716. { this.value = this.operator + this.semver.version; }
  6717. debug('comp', this);
  6718. }
  6719. var ANY = {};
  6720. Comparator.prototype.parse = function(comp) {
  6721. var r = this.loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
  6722. var m = comp.match(r);
  6723. if (!m)
  6724. { throw new TypeError('Invalid comparator: ' + comp); }
  6725. this.operator = m[1];
  6726. if (this.operator === '=')
  6727. { this.operator = ''; }
  6728. // if it literally is just '>' or '' then allow anything.
  6729. if (!m[2])
  6730. { this.semver = ANY; }
  6731. else
  6732. { this.semver = new SemVer(m[2], this.loose); }
  6733. };
  6734. Comparator.prototype.toString = function() {
  6735. return this.value;
  6736. };
  6737. Comparator.prototype.test = function(version) {
  6738. debug('Comparator.test', version, this.loose);
  6739. if (this.semver === ANY)
  6740. { return true; }
  6741. if (typeof version === 'string')
  6742. { version = new SemVer(version, this.loose); }
  6743. return cmp(version, this.operator, this.semver, this.loose);
  6744. };
  6745. Comparator.prototype.intersects = function(comp, loose) {
  6746. if (!(comp instanceof Comparator)) {
  6747. throw new TypeError('a Comparator is required');
  6748. }
  6749. var rangeTmp;
  6750. if (this.operator === '') {
  6751. rangeTmp = new Range(comp.value, loose);
  6752. return satisfies(this.value, rangeTmp, loose);
  6753. } else if (comp.operator === '') {
  6754. rangeTmp = new Range(this.value, loose);
  6755. return satisfies(comp.semver, rangeTmp, loose);
  6756. }
  6757. var sameDirectionIncreasing =
  6758. (this.operator === '>=' || this.operator === '>') &&
  6759. (comp.operator === '>=' || comp.operator === '>');
  6760. var sameDirectionDecreasing =
  6761. (this.operator === '<=' || this.operator === '<') &&
  6762. (comp.operator === '<=' || comp.operator === '<');
  6763. var sameSemVer = this.semver.version === comp.semver.version;
  6764. var differentDirectionsInclusive =
  6765. (this.operator === '>=' || this.operator === '<=') &&
  6766. (comp.operator === '>=' || comp.operator === '<=');
  6767. var oppositeDirectionsLessThan =
  6768. cmp(this.semver, '<', comp.semver, loose) &&
  6769. ((this.operator === '>=' || this.operator === '>') &&
  6770. (comp.operator === '<=' || comp.operator === '<'));
  6771. var oppositeDirectionsGreaterThan =
  6772. cmp(this.semver, '>', comp.semver, loose) &&
  6773. ((this.operator === '<=' || this.operator === '<') &&
  6774. (comp.operator === '>=' || comp.operator === '>'));
  6775. return sameDirectionIncreasing || sameDirectionDecreasing ||
  6776. (sameSemVer && differentDirectionsInclusive) ||
  6777. oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
  6778. };
  6779. exports.Range = Range;
  6780. function Range(range, loose) {
  6781. if (range instanceof Range) {
  6782. if (range.loose === loose) {
  6783. return range;
  6784. } else {
  6785. return new Range(range.raw, loose);
  6786. }
  6787. }
  6788. if (range instanceof Comparator) {
  6789. return new Range(range.value, loose);
  6790. }
  6791. if (!(this instanceof Range))
  6792. { return new Range(range, loose); }
  6793. this.loose = loose;
  6794. // First, split based on boolean or ||
  6795. this.raw = range;
  6796. this.set = range.split(/\s*\|\|\s*/).map(function(range) {
  6797. return this.parseRange(range.trim());
  6798. }, this).filter(function(c) {
  6799. // throw out any that are not relevant for whatever reason
  6800. return c.length;
  6801. });
  6802. if (!this.set.length) {
  6803. throw new TypeError('Invalid SemVer Range: ' + range);
  6804. }
  6805. this.format();
  6806. }
  6807. Range.prototype.format = function() {
  6808. this.range = this.set.map(function(comps) {
  6809. return comps.join(' ').trim();
  6810. }).join('||').trim();
  6811. return this.range;
  6812. };
  6813. Range.prototype.toString = function() {
  6814. return this.range;
  6815. };
  6816. Range.prototype.parseRange = function(range) {
  6817. var loose = this.loose;
  6818. range = range.trim();
  6819. debug('range', range, loose);
  6820. // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
  6821. var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE];
  6822. range = range.replace(hr, hyphenReplace);
  6823. debug('hyphen replace', range);
  6824. // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
  6825. range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace);
  6826. debug('comparator trim', range, re[COMPARATORTRIM]);
  6827. // `~ 1.2.3` => `~1.2.3`
  6828. range = range.replace(re[TILDETRIM], tildeTrimReplace);
  6829. // `^ 1.2.3` => `^1.2.3`
  6830. range = range.replace(re[CARETTRIM], caretTrimReplace);
  6831. // normalize spaces
  6832. range = range.split(/\s+/).join(' ');
  6833. // At this point, the range is completely trimmed and
  6834. // ready to be split into comparators.
  6835. var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
  6836. var set = range.split(' ').map(function(comp) {
  6837. return parseComparator(comp, loose);
  6838. }).join(' ').split(/\s+/);
  6839. if (this.loose) {
  6840. // in loose mode, throw out any that are not valid comparators
  6841. set = set.filter(function(comp) {
  6842. return !!comp.match(compRe);
  6843. });
  6844. }
  6845. set = set.map(function(comp) {
  6846. return new Comparator(comp, loose);
  6847. });
  6848. return set;
  6849. };
  6850. Range.prototype.intersects = function(range, loose) {
  6851. if (!(range instanceof Range)) {
  6852. throw new TypeError('a Range is required');
  6853. }
  6854. return this.set.some(function(thisComparators) {
  6855. return thisComparators.every(function(thisComparator) {
  6856. return range.set.some(function(rangeComparators) {
  6857. return rangeComparators.every(function(rangeComparator) {
  6858. return thisComparator.intersects(rangeComparator, loose);
  6859. });
  6860. });
  6861. });
  6862. });
  6863. };
  6864. // Mostly just for testing and legacy API reasons
  6865. exports.toComparators = toComparators;
  6866. function toComparators(range, loose) {
  6867. return new Range(range, loose).set.map(function(comp) {
  6868. return comp.map(function(c) {
  6869. return c.value;
  6870. }).join(' ').trim().split(' ');
  6871. });
  6872. }
  6873. // comprised of xranges, tildes, stars, and gtlt's at this point.
  6874. // already replaced the hyphen ranges
  6875. // turn into a set of JUST comparators.
  6876. function parseComparator(comp, loose) {
  6877. debug('comp', comp);
  6878. comp = replaceCarets(comp, loose);
  6879. debug('caret', comp);
  6880. comp = replaceTildes(comp, loose);
  6881. debug('tildes', comp);
  6882. comp = replaceXRanges(comp, loose);
  6883. debug('xrange', comp);
  6884. comp = replaceStars(comp, loose);
  6885. debug('stars', comp);
  6886. return comp;
  6887. }
  6888. function isX(id) {
  6889. return !id || id.toLowerCase() === 'x' || id === '*';
  6890. }
  6891. // ~, ~> --> * (any, kinda silly)
  6892. // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
  6893. // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
  6894. // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
  6895. // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
  6896. // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
  6897. function replaceTildes(comp, loose) {
  6898. return comp.trim().split(/\s+/).map(function(comp) {
  6899. return replaceTilde(comp, loose);
  6900. }).join(' ');
  6901. }
  6902. function replaceTilde(comp, loose) {
  6903. var r = loose ? re[TILDELOOSE] : re[TILDE];
  6904. return comp.replace(r, function(_, M, m, p, pr) {
  6905. debug('tilde', comp, _, M, m, p, pr);
  6906. var ret;
  6907. if (isX(M))
  6908. { ret = ''; }
  6909. else if (isX(m))
  6910. { ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; }
  6911. else if (isX(p))
  6912. // ~1.2 == >=1.2.0 <1.3.0
  6913. { ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; }
  6914. else if (pr) {
  6915. debug('replaceTilde pr', pr);
  6916. if (pr.charAt(0) !== '-')
  6917. { pr = '-' + pr; }
  6918. ret = '>=' + M + '.' + m + '.' + p + pr +
  6919. ' <' + M + '.' + (+m + 1) + '.0';
  6920. } else
  6921. // ~1.2.3 == >=1.2.3 <1.3.0
  6922. { ret = '>=' + M + '.' + m + '.' + p +
  6923. ' <' + M + '.' + (+m + 1) + '.0'; }
  6924. debug('tilde return', ret);
  6925. return ret;
  6926. });
  6927. }
  6928. // ^ --> * (any, kinda silly)
  6929. // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
  6930. // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
  6931. // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
  6932. // ^1.2.3 --> >=1.2.3 <2.0.0
  6933. // ^1.2.0 --> >=1.2.0 <2.0.0
  6934. function replaceCarets(comp, loose) {
  6935. return comp.trim().split(/\s+/).map(function(comp) {
  6936. return replaceCaret(comp, loose);
  6937. }).join(' ');
  6938. }
  6939. function replaceCaret(comp, loose) {
  6940. debug('caret', comp, loose);
  6941. var r = loose ? re[CARETLOOSE] : re[CARET];
  6942. return comp.replace(r, function(_, M, m, p, pr) {
  6943. debug('caret', comp, _, M, m, p, pr);
  6944. var ret;
  6945. if (isX(M))
  6946. { ret = ''; }
  6947. else if (isX(m))
  6948. { ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; }
  6949. else if (isX(p)) {
  6950. if (M === '0')
  6951. { ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; }
  6952. else
  6953. { ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'; }
  6954. } else if (pr) {
  6955. debug('replaceCaret pr', pr);
  6956. if (pr.charAt(0) !== '-')
  6957. { pr = '-' + pr; }
  6958. if (M === '0') {
  6959. if (m === '0')
  6960. { ret = '>=' + M + '.' + m + '.' + p + pr +
  6961. ' <' + M + '.' + m + '.' + (+p + 1); }
  6962. else
  6963. { ret = '>=' + M + '.' + m + '.' + p + pr +
  6964. ' <' + M + '.' + (+m + 1) + '.0'; }
  6965. } else
  6966. { ret = '>=' + M + '.' + m + '.' + p + pr +
  6967. ' <' + (+M + 1) + '.0.0'; }
  6968. } else {
  6969. debug('no pr');
  6970. if (M === '0') {
  6971. if (m === '0')
  6972. { ret = '>=' + M + '.' + m + '.' + p +
  6973. ' <' + M + '.' + m + '.' + (+p + 1); }
  6974. else
  6975. { ret = '>=' + M + '.' + m + '.' + p +
  6976. ' <' + M + '.' + (+m + 1) + '.0'; }
  6977. } else
  6978. { ret = '>=' + M + '.' + m + '.' + p +
  6979. ' <' + (+M + 1) + '.0.0'; }
  6980. }
  6981. debug('caret return', ret);
  6982. return ret;
  6983. });
  6984. }
  6985. function replaceXRanges(comp, loose) {
  6986. debug('replaceXRanges', comp, loose);
  6987. return comp.split(/\s+/).map(function(comp) {
  6988. return replaceXRange(comp, loose);
  6989. }).join(' ');
  6990. }
  6991. function replaceXRange(comp, loose) {
  6992. comp = comp.trim();
  6993. var r = loose ? re[XRANGELOOSE] : re[XRANGE];
  6994. return comp.replace(r, function(ret, gtlt, M, m, p, pr) {
  6995. debug('xRange', comp, ret, gtlt, M, m, p, pr);
  6996. var xM = isX(M);
  6997. var xm = xM || isX(m);
  6998. var xp = xm || isX(p);
  6999. var anyX = xp;
  7000. if (gtlt === '=' && anyX)
  7001. { gtlt = ''; }
  7002. if (xM) {
  7003. if (gtlt === '>' || gtlt === '<') {
  7004. // nothing is allowed
  7005. ret = '<0.0.0';
  7006. } else {
  7007. // nothing is forbidden
  7008. ret = '*';
  7009. }
  7010. } else if (gtlt && anyX) {
  7011. // replace X with 0
  7012. if (xm)
  7013. { m = 0; }
  7014. if (xp)
  7015. { p = 0; }
  7016. if (gtlt === '>') {
  7017. // >1 => >=2.0.0
  7018. // >1.2 => >=1.3.0
  7019. // >1.2.3 => >= 1.2.4
  7020. gtlt = '>=';
  7021. if (xm) {
  7022. M = +M + 1;
  7023. m = 0;
  7024. p = 0;
  7025. } else if (xp) {
  7026. m = +m + 1;
  7027. p = 0;
  7028. }
  7029. } else if (gtlt === '<=') {
  7030. // <=0.7.x is actually <0.8.0, since any 0.7.x should
  7031. // pass. Similarly, <=7.x is actually <8.0.0, etc.
  7032. gtlt = '<';
  7033. if (xm)
  7034. { M = +M + 1; }
  7035. else
  7036. { m = +m + 1; }
  7037. }
  7038. ret = gtlt + M + '.' + m + '.' + p;
  7039. } else if (xm) {
  7040. ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
  7041. } else if (xp) {
  7042. ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
  7043. }
  7044. debug('xRange return', ret);
  7045. return ret;
  7046. });
  7047. }
  7048. // Because * is AND-ed with everything else in the comparator,
  7049. // and '' means "any version", just remove the *s entirely.
  7050. function replaceStars(comp, loose) {
  7051. debug('replaceStars', comp, loose);
  7052. // Looseness is ignored here. star is always as loose as it gets!
  7053. return comp.trim().replace(re[STAR], '');
  7054. }
  7055. // This function is passed to string.replace(re[HYPHENRANGE])
  7056. // M, m, patch, prerelease, build
  7057. // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
  7058. // 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
  7059. // 1.2 - 3.4 => >=1.2.0 <3.5.0
  7060. function hyphenReplace($0,
  7061. from, fM, fm, fp, fpr, fb,
  7062. to, tM, tm, tp, tpr, tb) {
  7063. if (isX(fM))
  7064. { from = ''; }
  7065. else if (isX(fm))
  7066. { from = '>=' + fM + '.0.0'; }
  7067. else if (isX(fp))
  7068. { from = '>=' + fM + '.' + fm + '.0'; }
  7069. else
  7070. { from = '>=' + from; }
  7071. if (isX(tM))
  7072. { to = ''; }
  7073. else if (isX(tm))
  7074. { to = '<' + (+tM + 1) + '.0.0'; }
  7075. else if (isX(tp))
  7076. { to = '<' + tM + '.' + (+tm + 1) + '.0'; }
  7077. else if (tpr)
  7078. { to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr; }
  7079. else
  7080. { to = '<=' + to; }
  7081. return (from + ' ' + to).trim();
  7082. }
  7083. // if ANY of the sets match ALL of its comparators, then pass
  7084. Range.prototype.test = function(version) {
  7085. var this$1 = this;
  7086. if (!version)
  7087. { return false; }
  7088. if (typeof version === 'string')
  7089. { version = new SemVer(version, this.loose); }
  7090. for (var i = 0; i < this.set.length; i++) {
  7091. if (testSet(this$1.set[i], version))
  7092. { return true; }
  7093. }
  7094. return false;
  7095. };
  7096. function testSet(set, version) {
  7097. for (var i = 0; i < set.length; i++) {
  7098. if (!set[i].test(version))
  7099. { return false; }
  7100. }
  7101. if (version.prerelease.length) {
  7102. // Find the set of versions that are allowed to have prereleases
  7103. // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
  7104. // That should allow `1.2.3-pr.2` to pass.
  7105. // However, `1.2.4-alpha.notready` should NOT be allowed,
  7106. // even though it's within the range set by the comparators.
  7107. for (var i = 0; i < set.length; i++) {
  7108. debug(set[i].semver);
  7109. if (set[i].semver === ANY)
  7110. { continue; }
  7111. if (set[i].semver.prerelease.length > 0) {
  7112. var allowed = set[i].semver;
  7113. if (allowed.major === version.major &&
  7114. allowed.minor === version.minor &&
  7115. allowed.patch === version.patch)
  7116. { return true; }
  7117. }
  7118. }
  7119. // Version has a -pre, but it's not one of the ones we like.
  7120. return false;
  7121. }
  7122. return true;
  7123. }
  7124. exports.satisfies = satisfies;
  7125. function satisfies(version, range, loose) {
  7126. try {
  7127. range = new Range(range, loose);
  7128. } catch (er) {
  7129. return false;
  7130. }
  7131. return range.test(version);
  7132. }
  7133. exports.maxSatisfying = maxSatisfying;
  7134. function maxSatisfying(versions, range, loose) {
  7135. var max = null;
  7136. var maxSV = null;
  7137. try {
  7138. var rangeObj = new Range(range, loose);
  7139. } catch (er) {
  7140. return null;
  7141. }
  7142. versions.forEach(function (v) {
  7143. if (rangeObj.test(v)) { // satisfies(v, range, loose)
  7144. if (!max || maxSV.compare(v) === -1) { // compare(max, v, true)
  7145. max = v;
  7146. maxSV = new SemVer(max, loose);
  7147. }
  7148. }
  7149. });
  7150. return max;
  7151. }
  7152. exports.minSatisfying = minSatisfying;
  7153. function minSatisfying(versions, range, loose) {
  7154. var min = null;
  7155. var minSV = null;
  7156. try {
  7157. var rangeObj = new Range(range, loose);
  7158. } catch (er) {
  7159. return null;
  7160. }
  7161. versions.forEach(function (v) {
  7162. if (rangeObj.test(v)) { // satisfies(v, range, loose)
  7163. if (!min || minSV.compare(v) === 1) { // compare(min, v, true)
  7164. min = v;
  7165. minSV = new SemVer(min, loose);
  7166. }
  7167. }
  7168. });
  7169. return min;
  7170. }
  7171. exports.validRange = validRange;
  7172. function validRange(range, loose) {
  7173. try {
  7174. // Return '*' instead of '' so that truthiness works.
  7175. // This will throw if it's invalid anyway
  7176. return new Range(range, loose).range || '*';
  7177. } catch (er) {
  7178. return null;
  7179. }
  7180. }
  7181. // Determine if version is less than all the versions possible in the range
  7182. exports.ltr = ltr;
  7183. function ltr(version, range, loose) {
  7184. return outside(version, range, '<', loose);
  7185. }
  7186. // Determine if version is greater than all the versions possible in the range.
  7187. exports.gtr = gtr;
  7188. function gtr(version, range, loose) {
  7189. return outside(version, range, '>', loose);
  7190. }
  7191. exports.outside = outside;
  7192. function outside(version, range, hilo, loose) {
  7193. version = new SemVer(version, loose);
  7194. range = new Range(range, loose);
  7195. var gtfn, ltefn, ltfn, comp, ecomp;
  7196. switch (hilo) {
  7197. case '>':
  7198. gtfn = gt;
  7199. ltefn = lte;
  7200. ltfn = lt;
  7201. comp = '>';
  7202. ecomp = '>=';
  7203. break;
  7204. case '<':
  7205. gtfn = lt;
  7206. ltefn = gte;
  7207. ltfn = gt;
  7208. comp = '<';
  7209. ecomp = '<=';
  7210. break;
  7211. default:
  7212. throw new TypeError('Must provide a hilo val of "<" or ">"');
  7213. }
  7214. // If it satisifes the range it is not outside
  7215. if (satisfies(version, range, loose)) {
  7216. return false;
  7217. }
  7218. // From now on, variable terms are as if we're in "gtr" mode.
  7219. // but note that everything is flipped for the "ltr" function.
  7220. for (var i = 0; i < range.set.length; ++i) {
  7221. var comparators = range.set[i];
  7222. var high = null;
  7223. var low = null;
  7224. comparators.forEach(function(comparator) {
  7225. if (comparator.semver === ANY) {
  7226. comparator = new Comparator('>=0.0.0');
  7227. }
  7228. high = high || comparator;
  7229. low = low || comparator;
  7230. if (gtfn(comparator.semver, high.semver, loose)) {
  7231. high = comparator;
  7232. } else if (ltfn(comparator.semver, low.semver, loose)) {
  7233. low = comparator;
  7234. }
  7235. });
  7236. // If the edge version comparator has a operator then our version
  7237. // isn't outside it
  7238. if (high.operator === comp || high.operator === ecomp) {
  7239. return false;
  7240. }
  7241. // If the lowest version comparator has an operator and our version
  7242. // is less than it then it isn't higher than the range
  7243. if ((!low.operator || low.operator === comp) &&
  7244. ltefn(version, low.semver)) {
  7245. return false;
  7246. } else if (low.operator === ecomp && ltfn(version, low.semver)) {
  7247. return false;
  7248. }
  7249. }
  7250. return true;
  7251. }
  7252. exports.prerelease = prerelease;
  7253. function prerelease(version, loose) {
  7254. var parsed = parse(version, loose);
  7255. return (parsed && parsed.prerelease.length) ? parsed.prerelease : null;
  7256. }
  7257. exports.intersects = intersects;
  7258. function intersects(r1, r2, loose) {
  7259. r1 = new Range(r1, loose);
  7260. r2 = new Range(r2, loose);
  7261. return r1.intersects(r2)
  7262. }
  7263. exports.coerce = coerce;
  7264. function coerce(version) {
  7265. if (version instanceof SemVer)
  7266. { return version; }
  7267. if (typeof version !== 'string')
  7268. { return null; }
  7269. var match = version.match(re[COERCE]);
  7270. if (match == null)
  7271. { return null; }
  7272. return parse((match[1] || '0') + '.' + (match[2] || '0') + '.' + (match[3] || '0'));
  7273. }
  7274. });
  7275. var semver_1$1 = semver$1.SEMVER_SPEC_VERSION;
  7276. var semver_2$1 = semver$1.re;
  7277. var semver_3$1 = semver$1.src;
  7278. var semver_4$1 = semver$1.parse;
  7279. var semver_5$1 = semver$1.valid;
  7280. var semver_6$1 = semver$1.clean;
  7281. var semver_7$1 = semver$1.SemVer;
  7282. var semver_8$1 = semver$1.inc;
  7283. var semver_9$1 = semver$1.diff;
  7284. var semver_10$1 = semver$1.compareIdentifiers;
  7285. var semver_11$1 = semver$1.rcompareIdentifiers;
  7286. var semver_12$1 = semver$1.major;
  7287. var semver_13$1 = semver$1.minor;
  7288. var semver_14$1 = semver$1.patch;
  7289. var semver_15$1 = semver$1.compare;
  7290. var semver_16$1 = semver$1.compareLoose;
  7291. var semver_17$1 = semver$1.rcompare;
  7292. var semver_18$1 = semver$1.sort;
  7293. var semver_19$1 = semver$1.rsort;
  7294. var semver_20$1 = semver$1.gt;
  7295. var semver_21$1 = semver$1.lt;
  7296. var semver_22$1 = semver$1.eq;
  7297. var semver_23$1 = semver$1.neq;
  7298. var semver_24$1 = semver$1.gte;
  7299. var semver_25$1 = semver$1.lte;
  7300. var semver_26$1 = semver$1.cmp;
  7301. var semver_27$1 = semver$1.Comparator;
  7302. var semver_28$1 = semver$1.Range;
  7303. var semver_29$1 = semver$1.toComparators;
  7304. var semver_30$1 = semver$1.satisfies;
  7305. var semver_31$1 = semver$1.maxSatisfying;
  7306. var semver_32$1 = semver$1.minSatisfying;
  7307. var semver_33$1 = semver$1.validRange;
  7308. var semver_34$1 = semver$1.ltr;
  7309. var semver_35$1 = semver$1.gtr;
  7310. var semver_36$1 = semver$1.outside;
  7311. var semver_37$1 = semver$1.prerelease;
  7312. var semver_38$1 = semver$1.intersects;
  7313. var semver_39$1 = semver$1.coerce;
  7314. //
  7315. function isValidSlot(slot) {
  7316. return isVueComponent(slot) || typeof slot === 'string'
  7317. }
  7318. function requiresTemplateCompiler(slot) {
  7319. if (typeof slot === 'string' && !vueTemplateCompiler.compileToFunctions) {
  7320. throwError(
  7321. "vueTemplateCompiler is undefined, you must pass " +
  7322. "precompiled components if vue-template-compiler is " +
  7323. "undefined"
  7324. );
  7325. }
  7326. }
  7327. function validateSlots(slots) {
  7328. Object.keys(slots).forEach(function (key) {
  7329. var slot = Array.isArray(slots[key]) ? slots[key] : [slots[key]];
  7330. slot.forEach(function (slotValue) {
  7331. if (!isValidSlot(slotValue)) {
  7332. throwError(
  7333. "slots[key] must be a Component, string or an array " +
  7334. "of Components"
  7335. );
  7336. }
  7337. requiresTemplateCompiler(slotValue);
  7338. });
  7339. });
  7340. }
  7341. function vueExtendUnsupportedOption(option) {
  7342. return (
  7343. "options." + option + " is not supported for " +
  7344. "components created with Vue.extend in Vue < 2.3. " +
  7345. "You can set " + option + " to false to mount the component."
  7346. )
  7347. }
  7348. // these options aren't supported if Vue is version < 2.3
  7349. // for components using Vue.extend. This is due to a bug
  7350. // that means the mixins we use to add properties are not applied
  7351. // correctly
  7352. var UNSUPPORTED_VERSION_OPTIONS = ['mocks', 'stubs', 'localVue'];
  7353. function validateOptions(options, component) {
  7354. if (options.parentComponent && !isPlainObject(options.parentComponent)) {
  7355. throwError(
  7356. "options.parentComponent should be a valid Vue component options object"
  7357. );
  7358. }
  7359. if (!isFunctionalComponent(component) && options.context) {
  7360. throwError(
  7361. "mount.context can only be used when mounting a functional component"
  7362. );
  7363. }
  7364. if (options.context && !isPlainObject(options.context)) {
  7365. throwError('mount.context must be an object');
  7366. }
  7367. if (VUE_VERSION < 2.3 && isConstructor(component)) {
  7368. UNSUPPORTED_VERSION_OPTIONS.forEach(function (option) {
  7369. if (options[option]) {
  7370. throwError(vueExtendUnsupportedOption(option));
  7371. }
  7372. });
  7373. }
  7374. if (options.slots) {
  7375. compileTemplateForSlots(options.slots);
  7376. // validate slots outside of the createSlots function so
  7377. // that we can throw an error without it being caught by
  7378. // the Vue error handler
  7379. // $FlowIgnore
  7380. validateSlots(options.slots);
  7381. }
  7382. }
  7383. //
  7384. Vue.config.productionTip = false;
  7385. Vue.config.devtools = false;
  7386. function getSyncOption(syncOption) {
  7387. if (syncOption === false) {
  7388. Vue.config.async = true;
  7389. return false
  7390. }
  7391. if (semver$1.lt(Vue.version, '2.5.18')) {
  7392. warn(
  7393. "Vue Test Utils runs in sync mode by default. Due to bugs, sync mode " +
  7394. "requires Vue > 2.5.18. In Vue Test Utils 1.0 sync mode will only be " +
  7395. "supported with Vue 2.5.18+ running in development mode. If you are " +
  7396. "unable to upgrade, you should rewrite your tests to run asynchronously" +
  7397. "you can do this by setting the sync mounting option to false."
  7398. );
  7399. return COMPAT_SYNC_MODE
  7400. }
  7401. if (typeof Vue.config.async === 'undefined') {
  7402. warn(
  7403. "Sync mode only works when Vue runs in dev mode. " +
  7404. "Please set Vue to run in dev mode, or set sync to false"
  7405. );
  7406. }
  7407. Vue.config.async = false;
  7408. return true
  7409. }
  7410. function mount(
  7411. component,
  7412. options
  7413. ) {
  7414. if ( options === void 0 ) options = {};
  7415. warnIfNoWindow();
  7416. addGlobalErrorHandler(Vue);
  7417. var _Vue = createLocalVue(options.localVue);
  7418. var mergedOptions = mergeOptions(options, config);
  7419. validateOptions(mergedOptions, component);
  7420. var parentVm = createInstance(component, mergedOptions, _Vue);
  7421. var el = options.attachToDocument ? createElement() : undefined;
  7422. var vm = parentVm.$mount(el);
  7423. component._Ctor = {};
  7424. throwIfInstancesThrew(vm);
  7425. var sync = getSyncOption(mergedOptions.sync);
  7426. var wrapperOptions = {
  7427. attachedToDocument: !!mergedOptions.attachToDocument,
  7428. sync: sync
  7429. };
  7430. var root = parentVm.$options._isFunctionalContainer
  7431. ? vm._vnode
  7432. : vm.$children[0];
  7433. return createWrapper(root, wrapperOptions)
  7434. }
  7435. //
  7436. function shallowMount(
  7437. component,
  7438. options
  7439. ) {
  7440. if ( options === void 0 ) options = {};
  7441. return mount(component, Object.assign({}, options,
  7442. {shouldProxy: true}))
  7443. }
  7444. //
  7445. var toTypes = [String, Object];
  7446. var eventTypes = [String, Array];
  7447. var RouterLinkStub = {
  7448. name: 'RouterLinkStub',
  7449. props: {
  7450. to: {
  7451. type: toTypes,
  7452. required: true
  7453. },
  7454. tag: {
  7455. type: String,
  7456. default: 'a'
  7457. },
  7458. exact: Boolean,
  7459. append: Boolean,
  7460. replace: Boolean,
  7461. activeClass: String,
  7462. exactActiveClass: String,
  7463. event: {
  7464. type: eventTypes,
  7465. default: 'click'
  7466. }
  7467. },
  7468. render: function render(h) {
  7469. return h(this.tag, undefined, this.$slots.default)
  7470. }
  7471. }
  7472. function shallow(component, options) {
  7473. warn(
  7474. "shallow has been renamed to shallowMount. shallow " +
  7475. "will be removed in 1.0.0, use shallowMount instead"
  7476. );
  7477. return shallowMount(component, options)
  7478. }
  7479. var index = {
  7480. createLocalVue: createLocalVue,
  7481. createWrapper: createWrapper,
  7482. config: config,
  7483. mount: mount,
  7484. shallow: shallow,
  7485. shallowMount: shallowMount,
  7486. TransitionStub: TransitionStub,
  7487. TransitionGroupStub: TransitionGroupStub,
  7488. RouterLinkStub: RouterLinkStub,
  7489. Wrapper: Wrapper,
  7490. WrapperArray: WrapperArray
  7491. }
  7492. return index;
  7493. })));