vue-test-utils.js 236 KB

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