1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734 |
- 'use strict';
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
- var Vue = _interopDefault(require('vue'));
- var vueTemplateCompiler = require('vue-template-compiler');
- var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
- function createCommonjsModule(fn, module) {
- return module = { exports: {} }, fn(module, module.exports), module.exports;
- }
- var semver = createCommonjsModule(function (module, exports) {
- exports = module.exports = SemVer;
- // The debug function is excluded entirely from the minified version.
- /* nomin */ var debug;
- /* nomin */ if (typeof process === 'object' &&
- /* nomin */ process.env &&
- /* nomin */ process.env.NODE_DEBUG &&
- /* nomin */ /\bsemver\b/i.test(process.env.NODE_DEBUG))
- /* nomin */ { debug = function() {
- /* nomin */ var args = Array.prototype.slice.call(arguments, 0);
- /* nomin */ args.unshift('SEMVER');
- /* nomin */ console.log.apply(console, args);
- /* nomin */ }; }
- /* nomin */ else
- /* nomin */ { debug = function() {}; }
- // Note: this is the semver.org version of the spec that it implements
- // Not necessarily the package version of this code.
- exports.SEMVER_SPEC_VERSION = '2.0.0';
- var MAX_LENGTH = 256;
- var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
- // Max safe segment length for coercion.
- var MAX_SAFE_COMPONENT_LENGTH = 16;
- // The actual regexps go on exports.re
- var re = exports.re = [];
- var src = exports.src = [];
- var R = 0;
- // The following Regular Expressions can be used for tokenizing,
- // validating, and parsing SemVer version strings.
- // ## Numeric Identifier
- // A single `0`, or a non-zero digit followed by zero or more digits.
- var NUMERICIDENTIFIER = R++;
- src[NUMERICIDENTIFIER] = '0|[1-9]\\d*';
- var NUMERICIDENTIFIERLOOSE = R++;
- src[NUMERICIDENTIFIERLOOSE] = '[0-9]+';
- // ## Non-numeric Identifier
- // Zero or more digits, followed by a letter or hyphen, and then zero or
- // more letters, digits, or hyphens.
- var NONNUMERICIDENTIFIER = R++;
- src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*';
- // ## Main Version
- // Three dot-separated numeric identifiers.
- var MAINVERSION = R++;
- src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' +
- '(' + src[NUMERICIDENTIFIER] + ')\\.' +
- '(' + src[NUMERICIDENTIFIER] + ')';
- var MAINVERSIONLOOSE = R++;
- src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
- '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
- '(' + src[NUMERICIDENTIFIERLOOSE] + ')';
- // ## Pre-release Version Identifier
- // A numeric identifier, or a non-numeric identifier.
- var PRERELEASEIDENTIFIER = R++;
- src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] +
- '|' + src[NONNUMERICIDENTIFIER] + ')';
- var PRERELEASEIDENTIFIERLOOSE = R++;
- src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] +
- '|' + src[NONNUMERICIDENTIFIER] + ')';
- // ## Pre-release Version
- // Hyphen, followed by one or more dot-separated pre-release version
- // identifiers.
- var PRERELEASE = R++;
- src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] +
- '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))';
- var PRERELEASELOOSE = R++;
- src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] +
- '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))';
- // ## Build Metadata Identifier
- // Any combination of digits, letters, or hyphens.
- var BUILDIDENTIFIER = R++;
- src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+';
- // ## Build Metadata
- // Plus sign, followed by one or more period-separated build metadata
- // identifiers.
- var BUILD = R++;
- src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] +
- '(?:\\.' + src[BUILDIDENTIFIER] + ')*))';
- // ## Full Version String
- // A main version, followed optionally by a pre-release version and
- // build metadata.
- // Note that the only major, minor, patch, and pre-release sections of
- // the version string are capturing groups. The build metadata is not a
- // capturing group, because it should not ever be used in version
- // comparison.
- var FULL = R++;
- var FULLPLAIN = 'v?' + src[MAINVERSION] +
- src[PRERELEASE] + '?' +
- src[BUILD] + '?';
- src[FULL] = '^' + FULLPLAIN + '$';
- // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
- // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
- // common in the npm registry.
- var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] +
- src[PRERELEASELOOSE] + '?' +
- src[BUILD] + '?';
- var LOOSE = R++;
- src[LOOSE] = '^' + LOOSEPLAIN + '$';
- var GTLT = R++;
- src[GTLT] = '((?:<|>)?=?)';
- // Something like "2.*" or "1.2.x".
- // Note that "x.x" is a valid xRange identifer, meaning "any version"
- // Only the first item is strictly required.
- var XRANGEIDENTIFIERLOOSE = R++;
- src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*';
- var XRANGEIDENTIFIER = R++;
- src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*';
- var XRANGEPLAIN = R++;
- src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' +
- '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
- '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
- '(?:' + src[PRERELEASE] + ')?' +
- src[BUILD] + '?' +
- ')?)?';
- var XRANGEPLAINLOOSE = R++;
- src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
- '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
- '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
- '(?:' + src[PRERELEASELOOSE] + ')?' +
- src[BUILD] + '?' +
- ')?)?';
- var XRANGE = R++;
- src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$';
- var XRANGELOOSE = R++;
- src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$';
- // Coercion.
- // Extract anything that could conceivably be a part of a valid semver
- var COERCE = R++;
- src[COERCE] = '(?:^|[^\\d])' +
- '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' +
- '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
- '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
- '(?:$|[^\\d])';
- // Tilde ranges.
- // Meaning is "reasonably at or greater than"
- var LONETILDE = R++;
- src[LONETILDE] = '(?:~>?)';
- var TILDETRIM = R++;
- src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+';
- re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g');
- var tildeTrimReplace = '$1~';
- var TILDE = R++;
- src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$';
- var TILDELOOSE = R++;
- src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$';
- // Caret ranges.
- // Meaning is "at least and backwards compatible with"
- var LONECARET = R++;
- src[LONECARET] = '(?:\\^)';
- var CARETTRIM = R++;
- src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+';
- re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g');
- var caretTrimReplace = '$1^';
- var CARET = R++;
- src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$';
- var CARETLOOSE = R++;
- src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$';
- // A simple gt/lt/eq thing, or just "" to indicate "any version"
- var COMPARATORLOOSE = R++;
- src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$';
- var COMPARATOR = R++;
- src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$';
- // An expression to strip any whitespace between the gtlt and the thing
- // it modifies, so that `> 1.2.3` ==> `>1.2.3`
- var COMPARATORTRIM = R++;
- src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] +
- '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')';
- // this one has to use the /g flag
- re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g');
- var comparatorTrimReplace = '$1$2$3';
- // Something like `1.2.3 - 1.2.4`
- // Note that these all use the loose form, because they'll be
- // checked against either the strict or loose comparator form
- // later.
- var HYPHENRANGE = R++;
- src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' +
- '\\s+-\\s+' +
- '(' + src[XRANGEPLAIN] + ')' +
- '\\s*$';
- var HYPHENRANGELOOSE = R++;
- src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' +
- '\\s+-\\s+' +
- '(' + src[XRANGEPLAINLOOSE] + ')' +
- '\\s*$';
- // Star ranges basically just allow anything at all.
- var STAR = R++;
- src[STAR] = '(<|>)?=?\\s*\\*';
- // Compile to actual regexp objects.
- // All are flag-free, unless they were created above with a flag.
- for (var i = 0; i < R; i++) {
- debug(i, src[i]);
- if (!re[i])
- { re[i] = new RegExp(src[i]); }
- }
- exports.parse = parse;
- function parse(version, options) {
- if (!options || typeof options !== 'object')
- { options = { loose: !!options, includePrerelease: false }; }
- if (version instanceof SemVer)
- { return version; }
- if (typeof version !== 'string')
- { return null; }
- if (version.length > MAX_LENGTH)
- { return null; }
- var r = options.loose ? re[LOOSE] : re[FULL];
- if (!r.test(version))
- { return null; }
- try {
- return new SemVer(version, options);
- } catch (er) {
- return null;
- }
- }
- exports.valid = valid;
- function valid(version, options) {
- var v = parse(version, options);
- return v ? v.version : null;
- }
- exports.clean = clean;
- function clean(version, options) {
- var s = parse(version.trim().replace(/^[=v]+/, ''), options);
- return s ? s.version : null;
- }
- exports.SemVer = SemVer;
- function SemVer(version, options) {
- if (!options || typeof options !== 'object')
- { options = { loose: !!options, includePrerelease: false }; }
- if (version instanceof SemVer) {
- if (version.loose === options.loose)
- { return version; }
- else
- { version = version.version; }
- } else if (typeof version !== 'string') {
- throw new TypeError('Invalid Version: ' + version);
- }
- if (version.length > MAX_LENGTH)
- { throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') }
- if (!(this instanceof SemVer))
- { return new SemVer(version, options); }
- debug('SemVer', version, options);
- this.options = options;
- this.loose = !!options.loose;
- var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL]);
- if (!m)
- { throw new TypeError('Invalid Version: ' + version); }
- this.raw = version;
- // these are actually numbers
- this.major = +m[1];
- this.minor = +m[2];
- this.patch = +m[3];
- if (this.major > MAX_SAFE_INTEGER || this.major < 0)
- { throw new TypeError('Invalid major version') }
- if (this.minor > MAX_SAFE_INTEGER || this.minor < 0)
- { throw new TypeError('Invalid minor version') }
- if (this.patch > MAX_SAFE_INTEGER || this.patch < 0)
- { throw new TypeError('Invalid patch version') }
- // numberify any prerelease numeric ids
- if (!m[4])
- { this.prerelease = []; }
- else
- { this.prerelease = m[4].split('.').map(function(id) {
- if (/^[0-9]+$/.test(id)) {
- var num = +id;
- if (num >= 0 && num < MAX_SAFE_INTEGER)
- { return num; }
- }
- return id;
- }); }
- this.build = m[5] ? m[5].split('.') : [];
- this.format();
- }
- SemVer.prototype.format = function() {
- this.version = this.major + '.' + this.minor + '.' + this.patch;
- if (this.prerelease.length)
- { this.version += '-' + this.prerelease.join('.'); }
- return this.version;
- };
- SemVer.prototype.toString = function() {
- return this.version;
- };
- SemVer.prototype.compare = function(other) {
- debug('SemVer.compare', this.version, this.options, other);
- if (!(other instanceof SemVer))
- { other = new SemVer(other, this.options); }
- return this.compareMain(other) || this.comparePre(other);
- };
- SemVer.prototype.compareMain = function(other) {
- if (!(other instanceof SemVer))
- { other = new SemVer(other, this.options); }
- return compareIdentifiers(this.major, other.major) ||
- compareIdentifiers(this.minor, other.minor) ||
- compareIdentifiers(this.patch, other.patch);
- };
- SemVer.prototype.comparePre = function(other) {
- var this$1 = this;
- if (!(other instanceof SemVer))
- { other = new SemVer(other, this.options); }
- // NOT having a prerelease is > having one
- if (this.prerelease.length && !other.prerelease.length)
- { return -1; }
- else if (!this.prerelease.length && other.prerelease.length)
- { return 1; }
- else if (!this.prerelease.length && !other.prerelease.length)
- { return 0; }
- var i = 0;
- do {
- var a = this$1.prerelease[i];
- var b = other.prerelease[i];
- debug('prerelease compare', i, a, b);
- if (a === undefined && b === undefined)
- { return 0; }
- else if (b === undefined)
- { return 1; }
- else if (a === undefined)
- { return -1; }
- else if (a === b)
- { continue; }
- else
- { return compareIdentifiers(a, b); }
- } while (++i);
- };
- // preminor will bump the version up to the next minor release, and immediately
- // down to pre-release. premajor and prepatch work the same way.
- SemVer.prototype.inc = function(release, identifier) {
- var this$1 = this;
- switch (release) {
- case 'premajor':
- this.prerelease.length = 0;
- this.patch = 0;
- this.minor = 0;
- this.major++;
- this.inc('pre', identifier);
- break;
- case 'preminor':
- this.prerelease.length = 0;
- this.patch = 0;
- this.minor++;
- this.inc('pre', identifier);
- break;
- case 'prepatch':
- // If this is already a prerelease, it will bump to the next version
- // drop any prereleases that might already exist, since they are not
- // relevant at this point.
- this.prerelease.length = 0;
- this.inc('patch', identifier);
- this.inc('pre', identifier);
- break;
- // If the input is a non-prerelease version, this acts the same as
- // prepatch.
- case 'prerelease':
- if (this.prerelease.length === 0)
- { this.inc('patch', identifier); }
- this.inc('pre', identifier);
- break;
- case 'major':
- // If this is a pre-major version, bump up to the same major version.
- // Otherwise increment major.
- // 1.0.0-5 bumps to 1.0.0
- // 1.1.0 bumps to 2.0.0
- if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0)
- { this.major++; }
- this.minor = 0;
- this.patch = 0;
- this.prerelease = [];
- break;
- case 'minor':
- // If this is a pre-minor version, bump up to the same minor version.
- // Otherwise increment minor.
- // 1.2.0-5 bumps to 1.2.0
- // 1.2.1 bumps to 1.3.0
- if (this.patch !== 0 || this.prerelease.length === 0)
- { this.minor++; }
- this.patch = 0;
- this.prerelease = [];
- break;
- case 'patch':
- // If this is not a pre-release version, it will increment the patch.
- // If it is a pre-release it will bump up to the same patch version.
- // 1.2.0-5 patches to 1.2.0
- // 1.2.0 patches to 1.2.1
- if (this.prerelease.length === 0)
- { this.patch++; }
- this.prerelease = [];
- break;
- // This probably shouldn't be used publicly.
- // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
- case 'pre':
- if (this.prerelease.length === 0)
- { this.prerelease = [0]; }
- else {
- var i = this.prerelease.length;
- while (--i >= 0) {
- if (typeof this$1.prerelease[i] === 'number') {
- this$1.prerelease[i]++;
- i = -2;
- }
- }
- if (i === -1) // didn't increment anything
- { this.prerelease.push(0); }
- }
- if (identifier) {
- // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
- // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
- if (this.prerelease[0] === identifier) {
- if (isNaN(this.prerelease[1]))
- { this.prerelease = [identifier, 0]; }
- } else
- { this.prerelease = [identifier, 0]; }
- }
- break;
- default:
- throw new Error('invalid increment argument: ' + release);
- }
- this.format();
- this.raw = this.version;
- return this;
- };
- exports.inc = inc;
- function inc(version, release, loose, identifier) {
- if (typeof(loose) === 'string') {
- identifier = loose;
- loose = undefined;
- }
- try {
- return new SemVer(version, loose).inc(release, identifier).version;
- } catch (er) {
- return null;
- }
- }
- exports.diff = diff;
- function diff(version1, version2) {
- if (eq(version1, version2)) {
- return null;
- } else {
- var v1 = parse(version1);
- var v2 = parse(version2);
- if (v1.prerelease.length || v2.prerelease.length) {
- for (var key in v1) {
- if (key === 'major' || key === 'minor' || key === 'patch') {
- if (v1[key] !== v2[key]) {
- return 'pre'+key;
- }
- }
- }
- return 'prerelease';
- }
- for (var key in v1) {
- if (key === 'major' || key === 'minor' || key === 'patch') {
- if (v1[key] !== v2[key]) {
- return key;
- }
- }
- }
- }
- }
- exports.compareIdentifiers = compareIdentifiers;
- var numeric = /^[0-9]+$/;
- function compareIdentifiers(a, b) {
- var anum = numeric.test(a);
- var bnum = numeric.test(b);
- if (anum && bnum) {
- a = +a;
- b = +b;
- }
- return (anum && !bnum) ? -1 :
- (bnum && !anum) ? 1 :
- a < b ? -1 :
- a > b ? 1 :
- 0;
- }
- exports.rcompareIdentifiers = rcompareIdentifiers;
- function rcompareIdentifiers(a, b) {
- return compareIdentifiers(b, a);
- }
- exports.major = major;
- function major(a, loose) {
- return new SemVer(a, loose).major;
- }
- exports.minor = minor;
- function minor(a, loose) {
- return new SemVer(a, loose).minor;
- }
- exports.patch = patch;
- function patch(a, loose) {
- return new SemVer(a, loose).patch;
- }
- exports.compare = compare;
- function compare(a, b, loose) {
- return new SemVer(a, loose).compare(new SemVer(b, loose));
- }
- exports.compareLoose = compareLoose;
- function compareLoose(a, b) {
- return compare(a, b, true);
- }
- exports.rcompare = rcompare;
- function rcompare(a, b, loose) {
- return compare(b, a, loose);
- }
- exports.sort = sort;
- function sort(list, loose) {
- return list.sort(function(a, b) {
- return exports.compare(a, b, loose);
- });
- }
- exports.rsort = rsort;
- function rsort(list, loose) {
- return list.sort(function(a, b) {
- return exports.rcompare(a, b, loose);
- });
- }
- exports.gt = gt;
- function gt(a, b, loose) {
- return compare(a, b, loose) > 0;
- }
- exports.lt = lt;
- function lt(a, b, loose) {
- return compare(a, b, loose) < 0;
- }
- exports.eq = eq;
- function eq(a, b, loose) {
- return compare(a, b, loose) === 0;
- }
- exports.neq = neq;
- function neq(a, b, loose) {
- return compare(a, b, loose) !== 0;
- }
- exports.gte = gte;
- function gte(a, b, loose) {
- return compare(a, b, loose) >= 0;
- }
- exports.lte = lte;
- function lte(a, b, loose) {
- return compare(a, b, loose) <= 0;
- }
- exports.cmp = cmp;
- function cmp(a, op, b, loose) {
- var ret;
- switch (op) {
- case '===':
- if (typeof a === 'object') { a = a.version; }
- if (typeof b === 'object') { b = b.version; }
- ret = a === b;
- break;
- case '!==':
- if (typeof a === 'object') { a = a.version; }
- if (typeof b === 'object') { b = b.version; }
- ret = a !== b;
- break;
- case '': case '=': case '==': ret = eq(a, b, loose); break;
- case '!=': ret = neq(a, b, loose); break;
- case '>': ret = gt(a, b, loose); break;
- case '>=': ret = gte(a, b, loose); break;
- case '<': ret = lt(a, b, loose); break;
- case '<=': ret = lte(a, b, loose); break;
- default: throw new TypeError('Invalid operator: ' + op);
- }
- return ret;
- }
- exports.Comparator = Comparator;
- function Comparator(comp, options) {
- if (!options || typeof options !== 'object')
- { options = { loose: !!options, includePrerelease: false }; }
- if (comp instanceof Comparator) {
- if (comp.loose === !!options.loose)
- { return comp; }
- else
- { comp = comp.value; }
- }
- if (!(this instanceof Comparator))
- { return new Comparator(comp, options); }
- debug('comparator', comp, options);
- this.options = options;
- this.loose = !!options.loose;
- this.parse(comp);
- if (this.semver === ANY)
- { this.value = ''; }
- else
- { this.value = this.operator + this.semver.version; }
- debug('comp', this);
- }
- var ANY = {};
- Comparator.prototype.parse = function(comp) {
- var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
- var m = comp.match(r);
- if (!m)
- { throw new TypeError('Invalid comparator: ' + comp); }
- this.operator = m[1];
- if (this.operator === '=')
- { this.operator = ''; }
- // if it literally is just '>' or '' then allow anything.
- if (!m[2])
- { this.semver = ANY; }
- else
- { this.semver = new SemVer(m[2], this.options.loose); }
- };
- Comparator.prototype.toString = function() {
- return this.value;
- };
- Comparator.prototype.test = function(version) {
- debug('Comparator.test', version, this.options.loose);
- if (this.semver === ANY)
- { return true; }
- if (typeof version === 'string')
- { version = new SemVer(version, this.options); }
- return cmp(version, this.operator, this.semver, this.options);
- };
- Comparator.prototype.intersects = function(comp, options) {
- if (!(comp instanceof Comparator)) {
- throw new TypeError('a Comparator is required');
- }
- if (!options || typeof options !== 'object')
- { options = { loose: !!options, includePrerelease: false }; }
- var rangeTmp;
- if (this.operator === '') {
- rangeTmp = new Range(comp.value, options);
- return satisfies(this.value, rangeTmp, options);
- } else if (comp.operator === '') {
- rangeTmp = new Range(this.value, options);
- return satisfies(comp.semver, rangeTmp, options);
- }
- var sameDirectionIncreasing =
- (this.operator === '>=' || this.operator === '>') &&
- (comp.operator === '>=' || comp.operator === '>');
- var sameDirectionDecreasing =
- (this.operator === '<=' || this.operator === '<') &&
- (comp.operator === '<=' || comp.operator === '<');
- var sameSemVer = this.semver.version === comp.semver.version;
- var differentDirectionsInclusive =
- (this.operator === '>=' || this.operator === '<=') &&
- (comp.operator === '>=' || comp.operator === '<=');
- var oppositeDirectionsLessThan =
- cmp(this.semver, '<', comp.semver, options) &&
- ((this.operator === '>=' || this.operator === '>') &&
- (comp.operator === '<=' || comp.operator === '<'));
- var oppositeDirectionsGreaterThan =
- cmp(this.semver, '>', comp.semver, options) &&
- ((this.operator === '<=' || this.operator === '<') &&
- (comp.operator === '>=' || comp.operator === '>'));
- return sameDirectionIncreasing || sameDirectionDecreasing ||
- (sameSemVer && differentDirectionsInclusive) ||
- oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
- };
- exports.Range = Range;
- function Range(range, options) {
- if (!options || typeof options !== 'object')
- { options = { loose: !!options, includePrerelease: false }; }
- if (range instanceof Range) {
- if (range.loose === !!options.loose &&
- range.includePrerelease === !!options.includePrerelease) {
- return range;
- } else {
- return new Range(range.raw, options);
- }
- }
- if (range instanceof Comparator) {
- return new Range(range.value, options);
- }
- if (!(this instanceof Range))
- { return new Range(range, options); }
- this.options = options;
- this.loose = !!options.loose;
- this.includePrerelease = !!options.includePrerelease;
- // First, split based on boolean or ||
- this.raw = range;
- this.set = range.split(/\s*\|\|\s*/).map(function(range) {
- return this.parseRange(range.trim());
- }, this).filter(function(c) {
- // throw out any that are not relevant for whatever reason
- return c.length;
- });
- if (!this.set.length) {
- throw new TypeError('Invalid SemVer Range: ' + range);
- }
- this.format();
- }
- Range.prototype.format = function() {
- this.range = this.set.map(function(comps) {
- return comps.join(' ').trim();
- }).join('||').trim();
- return this.range;
- };
- Range.prototype.toString = function() {
- return this.range;
- };
- Range.prototype.parseRange = function(range) {
- var loose = this.options.loose;
- range = range.trim();
- // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
- var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE];
- range = range.replace(hr, hyphenReplace);
- debug('hyphen replace', range);
- // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
- range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace);
- debug('comparator trim', range, re[COMPARATORTRIM]);
- // `~ 1.2.3` => `~1.2.3`
- range = range.replace(re[TILDETRIM], tildeTrimReplace);
- // `^ 1.2.3` => `^1.2.3`
- range = range.replace(re[CARETTRIM], caretTrimReplace);
- // normalize spaces
- range = range.split(/\s+/).join(' ');
- // At this point, the range is completely trimmed and
- // ready to be split into comparators.
- var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
- var set = range.split(' ').map(function(comp) {
- return parseComparator(comp, this.options);
- }, this).join(' ').split(/\s+/);
- if (this.options.loose) {
- // in loose mode, throw out any that are not valid comparators
- set = set.filter(function(comp) {
- return !!comp.match(compRe);
- });
- }
- set = set.map(function(comp) {
- return new Comparator(comp, this.options);
- }, this);
- return set;
- };
- Range.prototype.intersects = function(range, options) {
- if (!(range instanceof Range)) {
- throw new TypeError('a Range is required');
- }
- return this.set.some(function(thisComparators) {
- return thisComparators.every(function(thisComparator) {
- return range.set.some(function(rangeComparators) {
- return rangeComparators.every(function(rangeComparator) {
- return thisComparator.intersects(rangeComparator, options);
- });
- });
- });
- });
- };
- // Mostly just for testing and legacy API reasons
- exports.toComparators = toComparators;
- function toComparators(range, options) {
- return new Range(range, options).set.map(function(comp) {
- return comp.map(function(c) {
- return c.value;
- }).join(' ').trim().split(' ');
- });
- }
- // comprised of xranges, tildes, stars, and gtlt's at this point.
- // already replaced the hyphen ranges
- // turn into a set of JUST comparators.
- function parseComparator(comp, options) {
- debug('comp', comp, options);
- comp = replaceCarets(comp, options);
- debug('caret', comp);
- comp = replaceTildes(comp, options);
- debug('tildes', comp);
- comp = replaceXRanges(comp, options);
- debug('xrange', comp);
- comp = replaceStars(comp, options);
- debug('stars', comp);
- return comp;
- }
- function isX(id) {
- return !id || id.toLowerCase() === 'x' || id === '*';
- }
- // ~, ~> --> * (any, kinda silly)
- // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
- // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
- // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
- // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
- // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
- function replaceTildes(comp, options) {
- return comp.trim().split(/\s+/).map(function(comp) {
- return replaceTilde(comp, options);
- }).join(' ');
- }
- function replaceTilde(comp, options) {
- if (!options || typeof options !== 'object')
- { options = { loose: !!options, includePrerelease: false }; }
- var r = options.loose ? re[TILDELOOSE] : re[TILDE];
- return comp.replace(r, function(_, M, m, p, pr) {
- debug('tilde', comp, _, M, m, p, pr);
- var ret;
- if (isX(M))
- { ret = ''; }
- else if (isX(m))
- { ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; }
- else if (isX(p))
- // ~1.2 == >=1.2.0 <1.3.0
- { ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; }
- else if (pr) {
- debug('replaceTilde pr', pr);
- if (pr.charAt(0) !== '-')
- { pr = '-' + pr; }
- ret = '>=' + M + '.' + m + '.' + p + pr +
- ' <' + M + '.' + (+m + 1) + '.0';
- } else
- // ~1.2.3 == >=1.2.3 <1.3.0
- { ret = '>=' + M + '.' + m + '.' + p +
- ' <' + M + '.' + (+m + 1) + '.0'; }
- debug('tilde return', ret);
- return ret;
- });
- }
- // ^ --> * (any, kinda silly)
- // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
- // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
- // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
- // ^1.2.3 --> >=1.2.3 <2.0.0
- // ^1.2.0 --> >=1.2.0 <2.0.0
- function replaceCarets(comp, options) {
- return comp.trim().split(/\s+/).map(function(comp) {
- return replaceCaret(comp, options);
- }).join(' ');
- }
- function replaceCaret(comp, options) {
- debug('caret', comp, options);
- if (!options || typeof options !== 'object')
- { options = { loose: !!options, includePrerelease: false }; }
- var r = options.loose ? re[CARETLOOSE] : re[CARET];
- return comp.replace(r, function(_, M, m, p, pr) {
- debug('caret', comp, _, M, m, p, pr);
- var ret;
- if (isX(M))
- { ret = ''; }
- else if (isX(m))
- { ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; }
- else if (isX(p)) {
- if (M === '0')
- { ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; }
- else
- { ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'; }
- } else if (pr) {
- debug('replaceCaret pr', pr);
- if (pr.charAt(0) !== '-')
- { pr = '-' + pr; }
- if (M === '0') {
- if (m === '0')
- { ret = '>=' + M + '.' + m + '.' + p + pr +
- ' <' + M + '.' + m + '.' + (+p + 1); }
- else
- { ret = '>=' + M + '.' + m + '.' + p + pr +
- ' <' + M + '.' + (+m + 1) + '.0'; }
- } else
- { ret = '>=' + M + '.' + m + '.' + p + pr +
- ' <' + (+M + 1) + '.0.0'; }
- } else {
- debug('no pr');
- if (M === '0') {
- if (m === '0')
- { ret = '>=' + M + '.' + m + '.' + p +
- ' <' + M + '.' + m + '.' + (+p + 1); }
- else
- { ret = '>=' + M + '.' + m + '.' + p +
- ' <' + M + '.' + (+m + 1) + '.0'; }
- } else
- { ret = '>=' + M + '.' + m + '.' + p +
- ' <' + (+M + 1) + '.0.0'; }
- }
- debug('caret return', ret);
- return ret;
- });
- }
- function replaceXRanges(comp, options) {
- debug('replaceXRanges', comp, options);
- return comp.split(/\s+/).map(function(comp) {
- return replaceXRange(comp, options);
- }).join(' ');
- }
- function replaceXRange(comp, options) {
- comp = comp.trim();
- if (!options || typeof options !== 'object')
- { options = { loose: !!options, includePrerelease: false }; }
- var r = options.loose ? re[XRANGELOOSE] : re[XRANGE];
- return comp.replace(r, function(ret, gtlt, M, m, p, pr) {
- debug('xRange', comp, ret, gtlt, M, m, p, pr);
- var xM = isX(M);
- var xm = xM || isX(m);
- var xp = xm || isX(p);
- var anyX = xp;
- if (gtlt === '=' && anyX)
- { gtlt = ''; }
- if (xM) {
- if (gtlt === '>' || gtlt === '<') {
- // nothing is allowed
- ret = '<0.0.0';
- } else {
- // nothing is forbidden
- ret = '*';
- }
- } else if (gtlt && anyX) {
- // replace X with 0
- if (xm)
- { m = 0; }
- if (xp)
- { p = 0; }
- if (gtlt === '>') {
- // >1 => >=2.0.0
- // >1.2 => >=1.3.0
- // >1.2.3 => >= 1.2.4
- gtlt = '>=';
- if (xm) {
- M = +M + 1;
- m = 0;
- p = 0;
- } else if (xp) {
- m = +m + 1;
- p = 0;
- }
- } else if (gtlt === '<=') {
- // <=0.7.x is actually <0.8.0, since any 0.7.x should
- // pass. Similarly, <=7.x is actually <8.0.0, etc.
- gtlt = '<';
- if (xm)
- { M = +M + 1; }
- else
- { m = +m + 1; }
- }
- ret = gtlt + M + '.' + m + '.' + p;
- } else if (xm) {
- ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
- } else if (xp) {
- ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
- }
- debug('xRange return', ret);
- return ret;
- });
- }
- // Because * is AND-ed with everything else in the comparator,
- // and '' means "any version", just remove the *s entirely.
- function replaceStars(comp, options) {
- debug('replaceStars', comp, options);
- // Looseness is ignored here. star is always as loose as it gets!
- return comp.trim().replace(re[STAR], '');
- }
- // This function is passed to string.replace(re[HYPHENRANGE])
- // M, m, patch, prerelease, build
- // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
- // 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
- // 1.2 - 3.4 => >=1.2.0 <3.5.0
- function hyphenReplace($0,
- from, fM, fm, fp, fpr, fb,
- to, tM, tm, tp, tpr, tb) {
- if (isX(fM))
- { from = ''; }
- else if (isX(fm))
- { from = '>=' + fM + '.0.0'; }
- else if (isX(fp))
- { from = '>=' + fM + '.' + fm + '.0'; }
- else
- { from = '>=' + from; }
- if (isX(tM))
- { to = ''; }
- else if (isX(tm))
- { to = '<' + (+tM + 1) + '.0.0'; }
- else if (isX(tp))
- { to = '<' + tM + '.' + (+tm + 1) + '.0'; }
- else if (tpr)
- { to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr; }
- else
- { to = '<=' + to; }
- return (from + ' ' + to).trim();
- }
- // if ANY of the sets match ALL of its comparators, then pass
- Range.prototype.test = function(version) {
- var this$1 = this;
- if (!version)
- { return false; }
- if (typeof version === 'string')
- { version = new SemVer(version, this.options); }
- for (var i = 0; i < this.set.length; i++) {
- if (testSet(this$1.set[i], version, this$1.options))
- { return true; }
- }
- return false;
- };
- function testSet(set, version, options) {
- for (var i = 0; i < set.length; i++) {
- if (!set[i].test(version))
- { return false; }
- }
- if (!options)
- { options = {}; }
- if (version.prerelease.length && !options.includePrerelease) {
- // Find the set of versions that are allowed to have prereleases
- // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
- // That should allow `1.2.3-pr.2` to pass.
- // However, `1.2.4-alpha.notready` should NOT be allowed,
- // even though it's within the range set by the comparators.
- for (var i = 0; i < set.length; i++) {
- debug(set[i].semver);
- if (set[i].semver === ANY)
- { continue; }
- if (set[i].semver.prerelease.length > 0) {
- var allowed = set[i].semver;
- if (allowed.major === version.major &&
- allowed.minor === version.minor &&
- allowed.patch === version.patch)
- { return true; }
- }
- }
- // Version has a -pre, but it's not one of the ones we like.
- return false;
- }
- return true;
- }
- exports.satisfies = satisfies;
- function satisfies(version, range, options) {
- try {
- range = new Range(range, options);
- } catch (er) {
- return false;
- }
- return range.test(version);
- }
- exports.maxSatisfying = maxSatisfying;
- function maxSatisfying(versions, range, options) {
- var max = null;
- var maxSV = null;
- try {
- var rangeObj = new Range(range, options);
- } catch (er) {
- return null;
- }
- versions.forEach(function (v) {
- if (rangeObj.test(v)) { // satisfies(v, range, options)
- if (!max || maxSV.compare(v) === -1) { // compare(max, v, true)
- max = v;
- maxSV = new SemVer(max, options);
- }
- }
- });
- return max;
- }
- exports.minSatisfying = minSatisfying;
- function minSatisfying(versions, range, options) {
- var min = null;
- var minSV = null;
- try {
- var rangeObj = new Range(range, options);
- } catch (er) {
- return null;
- }
- versions.forEach(function (v) {
- if (rangeObj.test(v)) { // satisfies(v, range, options)
- if (!min || minSV.compare(v) === 1) { // compare(min, v, true)
- min = v;
- minSV = new SemVer(min, options);
- }
- }
- });
- return min;
- }
- exports.validRange = validRange;
- function validRange(range, options) {
- try {
- // Return '*' instead of '' so that truthiness works.
- // This will throw if it's invalid anyway
- return new Range(range, options).range || '*';
- } catch (er) {
- return null;
- }
- }
- // Determine if version is less than all the versions possible in the range
- exports.ltr = ltr;
- function ltr(version, range, options) {
- return outside(version, range, '<', options);
- }
- // Determine if version is greater than all the versions possible in the range.
- exports.gtr = gtr;
- function gtr(version, range, options) {
- return outside(version, range, '>', options);
- }
- exports.outside = outside;
- function outside(version, range, hilo, options) {
- version = new SemVer(version, options);
- range = new Range(range, options);
- var gtfn, ltefn, ltfn, comp, ecomp;
- switch (hilo) {
- case '>':
- gtfn = gt;
- ltefn = lte;
- ltfn = lt;
- comp = '>';
- ecomp = '>=';
- break;
- case '<':
- gtfn = lt;
- ltefn = gte;
- ltfn = gt;
- comp = '<';
- ecomp = '<=';
- break;
- default:
- throw new TypeError('Must provide a hilo val of "<" or ">"');
- }
- // If it satisifes the range it is not outside
- if (satisfies(version, range, options)) {
- return false;
- }
- // From now on, variable terms are as if we're in "gtr" mode.
- // but note that everything is flipped for the "ltr" function.
- for (var i = 0; i < range.set.length; ++i) {
- var comparators = range.set[i];
- var high = null;
- var low = null;
- comparators.forEach(function(comparator) {
- if (comparator.semver === ANY) {
- comparator = new Comparator('>=0.0.0');
- }
- high = high || comparator;
- low = low || comparator;
- if (gtfn(comparator.semver, high.semver, options)) {
- high = comparator;
- } else if (ltfn(comparator.semver, low.semver, options)) {
- low = comparator;
- }
- });
- // If the edge version comparator has a operator then our version
- // isn't outside it
- if (high.operator === comp || high.operator === ecomp) {
- return false;
- }
- // If the lowest version comparator has an operator and our version
- // is less than it then it isn't higher than the range
- if ((!low.operator || low.operator === comp) &&
- ltefn(version, low.semver)) {
- return false;
- } else if (low.operator === ecomp && ltfn(version, low.semver)) {
- return false;
- }
- }
- return true;
- }
- exports.prerelease = prerelease;
- function prerelease(version, options) {
- var parsed = parse(version, options);
- return (parsed && parsed.prerelease.length) ? parsed.prerelease : null;
- }
- exports.intersects = intersects;
- function intersects(r1, r2, options) {
- r1 = new Range(r1, options);
- r2 = new Range(r2, options);
- return r1.intersects(r2)
- }
- exports.coerce = coerce;
- function coerce(version) {
- if (version instanceof SemVer)
- { return version; }
- if (typeof version !== 'string')
- { return null; }
- var match = version.match(re[COERCE]);
- if (match == null)
- { return null; }
- return parse((match[1] || '0') + '.' + (match[2] || '0') + '.' + (match[3] || '0'));
- }
- });
- var semver_1 = semver.SEMVER_SPEC_VERSION;
- var semver_2 = semver.re;
- var semver_3 = semver.src;
- var semver_4 = semver.parse;
- var semver_5 = semver.valid;
- var semver_6 = semver.clean;
- var semver_7 = semver.SemVer;
- var semver_8 = semver.inc;
- var semver_9 = semver.diff;
- var semver_10 = semver.compareIdentifiers;
- var semver_11 = semver.rcompareIdentifiers;
- var semver_12 = semver.major;
- var semver_13 = semver.minor;
- var semver_14 = semver.patch;
- var semver_15 = semver.compare;
- var semver_16 = semver.compareLoose;
- var semver_17 = semver.rcompare;
- var semver_18 = semver.sort;
- var semver_19 = semver.rsort;
- var semver_20 = semver.gt;
- var semver_21 = semver.lt;
- var semver_22 = semver.eq;
- var semver_23 = semver.neq;
- var semver_24 = semver.gte;
- var semver_25 = semver.lte;
- var semver_26 = semver.cmp;
- var semver_27 = semver.Comparator;
- var semver_28 = semver.Range;
- var semver_29 = semver.toComparators;
- var semver_30 = semver.satisfies;
- var semver_31 = semver.maxSatisfying;
- var semver_32 = semver.minSatisfying;
- var semver_33 = semver.validRange;
- var semver_34 = semver.ltr;
- var semver_35 = semver.gtr;
- var semver_36 = semver.outside;
- var semver_37 = semver.prerelease;
- var semver_38 = semver.intersects;
- var semver_39 = semver.coerce;
- //
- function throwError(msg) {
- throw new Error(("[vue-test-utils]: " + msg))
- }
- function warn(msg) {
- console.error(("[vue-test-utils]: " + msg));
- }
- var camelizeRE = /-(\w)/g;
- var camelize = function (str) {
- var camelizedStr = str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; }
- );
- return camelizedStr.charAt(0).toLowerCase() + camelizedStr.slice(1)
- };
- /**
- * Capitalize a string.
- */
- var capitalize = function (str) { return str.charAt(0).toUpperCase() + str.slice(1); };
- /**
- * Hyphenate a camelCase string.
- */
- var hyphenateRE = /\B([A-Z])/g;
- var hyphenate = function (str) { return str.replace(hyphenateRE, '-$1').toLowerCase(); };
- function hasOwnProperty(obj, prop) {
- return Object.prototype.hasOwnProperty.call(obj, prop)
- }
- function resolveComponent(id, components) {
- if (typeof id !== 'string') {
- return
- }
- // check local registration variations first
- if (hasOwnProperty(components, id)) {
- return components[id]
- }
- var camelizedId = camelize(id);
- if (hasOwnProperty(components, camelizedId)) {
- return components[camelizedId]
- }
- var PascalCaseId = capitalize(camelizedId);
- if (hasOwnProperty(components, PascalCaseId)) {
- return components[PascalCaseId]
- }
- // fallback to prototype chain
- return components[id] || components[camelizedId] || components[PascalCaseId]
- }
- var UA =
- typeof window !== 'undefined' &&
- 'navigator' in window &&
- navigator.userAgent.toLowerCase();
- var isPhantomJS = UA && UA.includes && UA.match(/phantomjs/i);
- var isEdge = UA && UA.indexOf('edge/') > 0;
- var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
- // get the event used to trigger v-model handler that updates bound data
- function getCheckedEvent() {
- var version = Vue.version;
- if (semver.satisfies(version, '2.1.9 - 2.1.10')) {
- return 'click'
- }
- if (semver.satisfies(version, '2.2 - 2.4')) {
- return isChrome ? 'click' : 'change'
- }
- // change is handler for version 2.0 - 2.1.8, and 2.5+
- return 'change'
- }
- //
- function isDomSelector(selector) {
- if (typeof selector !== 'string') {
- return false
- }
- try {
- if (typeof document === 'undefined') {
- throwError(
- "mount must be run in a browser environment like " +
- "PhantomJS, jsdom or chrome"
- );
- }
- } catch (error) {
- throwError(
- "mount must be run in a browser environment like " +
- "PhantomJS, jsdom or chrome"
- );
- }
- try {
- document.querySelector(selector);
- return true
- } catch (error) {
- return false
- }
- }
- function isVueComponent(c) {
- if (isConstructor(c)) {
- return true
- }
- if (c === null || typeof c !== 'object') {
- return false
- }
- if (c.extends || c._Ctor) {
- return true
- }
- if (typeof c.template === 'string') {
- return true
- }
- return typeof c.render === 'function'
- }
- function componentNeedsCompiling(component) {
- return (
- component &&
- !component.render &&
- (component.template || component.extends || component.extendOptions) &&
- !component.functional
- )
- }
- function isRefSelector(refOptionsObject) {
- if (
- typeof refOptionsObject !== 'object' ||
- Object.keys(refOptionsObject || {}).length !== 1
- ) {
- return false
- }
- return typeof refOptionsObject.ref === 'string'
- }
- function isNameSelector(nameOptionsObject) {
- if (typeof nameOptionsObject !== 'object' || nameOptionsObject === null) {
- return false
- }
- return !!nameOptionsObject.name
- }
- function isConstructor(c) {
- return typeof c === 'function' && c.cid
- }
- function isDynamicComponent(c) {
- return typeof c === 'function' && !c.cid
- }
- function isComponentOptions(c) {
- return typeof c === 'object' && (c.template || c.render)
- }
- function isFunctionalComponent(c) {
- if (!isVueComponent(c)) {
- return false
- }
- if (isConstructor(c)) {
- return c.options.functional
- }
- return c.functional
- }
- function templateContainsComponent(
- template,
- name
- ) {
- return [capitalize, camelize, hyphenate].some(function (format) {
- var re = new RegExp(("<" + (format(name)) + "\\s*(\\s|>|(/>))"), 'g');
- return re.test(template)
- })
- }
- function isPlainObject(c) {
- return Object.prototype.toString.call(c) === '[object Object]'
- }
- function makeMap(str, expectsLowerCase) {
- var map = Object.create(null);
- var list = str.split(',');
- for (var i = 0; i < list.length; i++) {
- map[list[i]] = true;
- }
- return expectsLowerCase
- ? function(val) {
- return map[val.toLowerCase()]
- }
- : function(val) {
- return map[val]
- }
- }
- var isHTMLTag = makeMap(
- 'html,body,base,head,link,meta,style,title,' +
- 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
- 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
- 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
- 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,' +
- 'embed,object,param,source,canvas,script,noscript,del,ins,' +
- 'caption,col,colgroup,table,thead,tbody,td,th,tr,video,' +
- 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
- 'output,progress,select,textarea,' +
- 'details,dialog,menu,menuitem,summary,' +
- 'content,element,shadow,template,blockquote,iframe,tfoot'
- );
- // this map is intentionally selective, only covering SVG elements that may
- // contain child elements.
- var isSVG = makeMap(
- 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
- 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
- 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
- true
- );
- var isReservedTag = function (tag) { return isHTMLTag(tag) || isSVG(tag); };
- var NAME_SELECTOR = 'NAME_SELECTOR';
- var COMPONENT_SELECTOR = 'COMPONENT_SELECTOR';
- var REF_SELECTOR = 'REF_SELECTOR';
- var DOM_SELECTOR = 'DOM_SELECTOR';
- var INVALID_SELECTOR = 'INVALID_SELECTOR';
- var COMPAT_SYNC_MODE = 'COMPAT_SYNC_MODE';
- var VUE_VERSION = Number(
- ((Vue.version.split('.')[0]) + "." + (Vue.version.split('.')[1]))
- );
- var FUNCTIONAL_OPTIONS =
- VUE_VERSION >= 2.5 ? 'fnOptions' : 'functionalOptions';
- var BEFORE_RENDER_LIFECYCLE_HOOK = semver.gt(Vue.version, '2.1.8')
- ? 'beforeCreate'
- : 'beforeMount';
- var CREATE_ELEMENT_ALIAS = semver.gt(Vue.version, '2.1.5')
- ? '_c'
- : '_h';
- //
- function getSelectorType(selector) {
- if (isDomSelector(selector)) { return DOM_SELECTOR }
- if (isVueComponent(selector)) { return COMPONENT_SELECTOR }
- if (isNameSelector(selector)) { return NAME_SELECTOR }
- if (isRefSelector(selector)) { return REF_SELECTOR }
- return INVALID_SELECTOR
- }
- function getSelector(
- selector,
- methodName
- ) {
- var type = getSelectorType(selector);
- if (type === INVALID_SELECTOR) {
- throwError(
- "wrapper." + methodName + "() must be passed a valid CSS selector, Vue " +
- "constructor, or valid find option object"
- );
- }
- return {
- type: type,
- value: selector
- }
- }
- //
- function getRealChild(vnode) {
- var compOptions = vnode && vnode.componentOptions;
- if (compOptions && compOptions.Ctor.options.abstract) {
- return getRealChild(getFirstComponentChild(compOptions.children))
- } else {
- return vnode
- }
- }
- function isSameChild(child, oldChild) {
- return oldChild.key === child.key && oldChild.tag === child.tag
- }
- function getFirstComponentChild(children) {
- if (Array.isArray(children)) {
- for (var i = 0; i < children.length; i++) {
- var c = children[i];
- if (c && (c.componentOptions || isAsyncPlaceholder(c))) {
- return c
- }
- }
- }
- }
- function isPrimitive(value) {
- return (
- typeof value === 'string' ||
- typeof value === 'number' ||
- // $FlowIgnore
- typeof value === 'symbol' ||
- typeof value === 'boolean'
- )
- }
- function isAsyncPlaceholder(node) {
- return node.isComment && node.asyncFactory
- }
- function hasParentTransition(vnode) {
- while ((vnode = vnode.parent)) {
- if (vnode.data.transition) {
- return true
- }
- }
- }
- var TransitionStub = {
- render: function render(h) {
- var children = this.$options._renderChildren;
- if (!children) {
- return
- }
- // filter out text nodes (possible whitespaces)
- children = children.filter(function (c) { return c.tag || isAsyncPlaceholder(c); });
- /* istanbul ignore if */
- if (!children.length) {
- return
- }
- // warn multiple elements
- if (children.length > 1) {
- warn(
- "<transition> can only be used on a single element. " +
- "Use " +
- '<transition-group> for lists.'
- );
- }
- var mode = this.mode;
- // warn invalid mode
- if (mode && mode !== 'in-out' && mode !== 'out-in') {
- warn('invalid <transition> mode: ' + mode);
- }
- var rawChild = children[0];
- // if this is a component root node and the component's
- // parent container node also has transition, skip.
- if (hasParentTransition(this.$vnode)) {
- return rawChild
- }
- // apply transition data to child
- // use getRealChild() to ignore abstract components e.g. keep-alive
- var child = getRealChild(rawChild);
- if (!child) {
- return rawChild
- }
- var id = "__transition-" + (this._uid) + "-";
- child.key =
- child.key == null
- ? child.isComment
- ? id + 'comment'
- : id + child.tag
- : isPrimitive(child.key)
- ? String(child.key).indexOf(id) === 0
- ? child.key
- : id + child.key
- : child.key;
- var data = child.data || (child.data = {});
- var oldRawChild = this._vnode;
- var oldChild = getRealChild(oldRawChild);
- if (
- child.data.directives &&
- child.data.directives.some(function (d) { return d.name === 'show'; })
- ) {
- child.data.show = true;
- }
- // mark v-show
- // so that the transition module can hand over the control
- // to the directive
- if (
- child.data.directives &&
- child.data.directives.some(function (d) { return d.name === 'show'; })
- ) {
- child.data.show = true;
- }
- if (
- oldChild &&
- oldChild.data &&
- !isSameChild(child, oldChild) &&
- !isAsyncPlaceholder(oldChild) &&
- // #6687 component root is a comment node
- !(
- oldChild.componentInstance &&
- oldChild.componentInstance._vnode.isComment
- )
- ) {
- oldChild.data = Object.assign({}, data);
- }
- return rawChild
- }
- }
- //
- var TransitionGroupStub = {
- render: function render(h) {
- var tag = this.tag || this.$vnode.data.tag || 'span';
- var children = this.$slots.default || [];
- return h(tag, null, children)
- }
- }
- var config = {
- stubs: {
- transition: TransitionStub,
- 'transition-group': TransitionGroupStub
- },
- mocks: {},
- methods: {},
- provide: {},
- logModifiedComponents: true,
- silent: true
- }
- //
- var WrapperArray = function WrapperArray(wrappers) {
- var length = wrappers.length;
- // $FlowIgnore
- Object.defineProperty(this, 'wrappers', {
- get: function () { return wrappers; },
- set: function () { return throwError('wrapperArray.wrappers is read-only'); }
- });
- // $FlowIgnore
- Object.defineProperty(this, 'length', {
- get: function () { return length; },
- set: function () { return throwError('wrapperArray.length is read-only'); }
- });
- };
- WrapperArray.prototype.at = function at (index) {
- if (index > this.length - 1) {
- throwError(("no item exists at " + index));
- }
- return this.wrappers[index]
- };
- WrapperArray.prototype.attributes = function attributes () {
- this.throwErrorIfWrappersIsEmpty('attributes');
- throwError(
- "attributes must be called on a single wrapper, use " +
- "at(i) to access a wrapper"
- );
- };
- WrapperArray.prototype.classes = function classes () {
- this.throwErrorIfWrappersIsEmpty('classes');
- throwError(
- "classes must be called on a single wrapper, use " +
- "at(i) to access a wrapper"
- );
- };
- WrapperArray.prototype.contains = function contains (selector) {
- this.throwErrorIfWrappersIsEmpty('contains');
- return this.wrappers.every(function (wrapper) { return wrapper.contains(selector); })
- };
- WrapperArray.prototype.exists = function exists () {
- return this.length > 0 && this.wrappers.every(function (wrapper) { return wrapper.exists(); })
- };
- WrapperArray.prototype.filter = function filter (predicate) {
- return new WrapperArray(this.wrappers.filter(predicate))
- };
- WrapperArray.prototype.emitted = function emitted () {
- this.throwErrorIfWrappersIsEmpty('emitted');
- throwError(
- "emitted must be called on a single wrapper, use " +
- "at(i) to access a wrapper"
- );
- };
- WrapperArray.prototype.emittedByOrder = function emittedByOrder () {
- this.throwErrorIfWrappersIsEmpty('emittedByOrder');
- throwError(
- "emittedByOrder must be called on a single wrapper, " +
- "use at(i) to access a wrapper"
- );
- };
- WrapperArray.prototype.findAll = function findAll () {
- this.throwErrorIfWrappersIsEmpty('findAll');
- throwError(
- "findAll must be called on a single wrapper, use " +
- "at(i) to access a wrapper"
- );
- };
- WrapperArray.prototype.find = function find () {
- this.throwErrorIfWrappersIsEmpty('find');
- throwError(
- "find must be called on a single wrapper, use at(i) " +
- "to access a wrapper"
- );
- };
- WrapperArray.prototype.html = function html () {
- this.throwErrorIfWrappersIsEmpty('html');
- throwError(
- "html must be called on a single wrapper, use at(i) " +
- "to access a wrapper"
- );
- };
- WrapperArray.prototype.is = function is (selector) {
- this.throwErrorIfWrappersIsEmpty('is');
- return this.wrappers.every(function (wrapper) { return wrapper.is(selector); })
- };
- WrapperArray.prototype.isEmpty = function isEmpty () {
- this.throwErrorIfWrappersIsEmpty('isEmpty');
- return this.wrappers.every(function (wrapper) { return wrapper.isEmpty(); })
- };
- WrapperArray.prototype.isVisible = function isVisible () {
- this.throwErrorIfWrappersIsEmpty('isVisible');
- return this.wrappers.every(function (wrapper) { return wrapper.isVisible(); })
- };
- WrapperArray.prototype.isVueInstance = function isVueInstance () {
- this.throwErrorIfWrappersIsEmpty('isVueInstance');
- return this.wrappers.every(function (wrapper) { return wrapper.isVueInstance(); })
- };
- WrapperArray.prototype.name = function name () {
- this.throwErrorIfWrappersIsEmpty('name');
- throwError(
- "name must be called on a single wrapper, use at(i) " +
- "to access a wrapper"
- );
- };
- WrapperArray.prototype.props = function props () {
- this.throwErrorIfWrappersIsEmpty('props');
- throwError(
- "props must be called on a single wrapper, use " +
- "at(i) to access a wrapper"
- );
- };
- WrapperArray.prototype.text = function text () {
- this.throwErrorIfWrappersIsEmpty('text');
- throwError(
- "text must be called on a single wrapper, use at(i) " +
- "to access a wrapper"
- );
- };
- WrapperArray.prototype.throwErrorIfWrappersIsEmpty = function throwErrorIfWrappersIsEmpty (method) {
- if (this.wrappers.length === 0) {
- throwError((method + " cannot be called on 0 items"));
- }
- };
- WrapperArray.prototype.setData = function setData (data) {
- this.throwErrorIfWrappersIsEmpty('setData');
- this.wrappers.forEach(function (wrapper) { return wrapper.setData(data); });
- };
- WrapperArray.prototype.setMethods = function setMethods (props) {
- this.throwErrorIfWrappersIsEmpty('setMethods');
- this.wrappers.forEach(function (wrapper) { return wrapper.setMethods(props); });
- };
- WrapperArray.prototype.setProps = function setProps (props) {
- this.throwErrorIfWrappersIsEmpty('setProps');
- this.wrappers.forEach(function (wrapper) { return wrapper.setProps(props); });
- };
- WrapperArray.prototype.setValue = function setValue (value) {
- this.throwErrorIfWrappersIsEmpty('setValue');
- this.wrappers.forEach(function (wrapper) { return wrapper.setValue(value); });
- };
- WrapperArray.prototype.setChecked = function setChecked (checked) {
- if ( checked === void 0 ) checked = true;
- this.throwErrorIfWrappersIsEmpty('setChecked');
- this.wrappers.forEach(function (wrapper) { return wrapper.setChecked(checked); });
- };
- WrapperArray.prototype.setSelected = function setSelected () {
- this.throwErrorIfWrappersIsEmpty('setSelected');
- throwError(
- "setSelected must be called on a single wrapper, " +
- "use at(i) to access a wrapper"
- );
- };
- WrapperArray.prototype.trigger = function trigger (event, options) {
- this.throwErrorIfWrappersIsEmpty('trigger');
- this.wrappers.forEach(function (wrapper) { return wrapper.trigger(event, options); });
- };
- WrapperArray.prototype.update = function update () {
- this.throwErrorIfWrappersIsEmpty('update');
- warn(
- "update has been removed. All changes are now " +
- "synchrnous without calling update"
- );
- };
- WrapperArray.prototype.destroy = function destroy () {
- this.throwErrorIfWrappersIsEmpty('destroy');
- this.wrappers.forEach(function (wrapper) { return wrapper.destroy(); });
- };
- //
- var ErrorWrapper = function ErrorWrapper(selector) {
- this.selector = selector;
- };
- ErrorWrapper.prototype.at = function at () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call at() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.attributes = function attributes () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call attributes() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.classes = function classes () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call classes() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.contains = function contains () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call contains() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.emitted = function emitted () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call emitted() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.emittedByOrder = function emittedByOrder () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call emittedByOrder() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.exists = function exists () {
- return false
- };
- ErrorWrapper.prototype.filter = function filter () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call filter() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.visible = function visible () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call visible() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.hasAttribute = function hasAttribute () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call hasAttribute() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.hasClass = function hasClass () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call hasClass() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.hasProp = function hasProp () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call hasProp() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.hasStyle = function hasStyle () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call hasStyle() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.findAll = function findAll () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call findAll() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.find = function find () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call find() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.html = function html () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call html() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.is = function is () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call is() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.isEmpty = function isEmpty () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call isEmpty() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.isVisible = function isVisible () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call isVisible() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.isVueInstance = function isVueInstance () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call isVueInstance() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.name = function name () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call name() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.props = function props () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call props() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.text = function text () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call text() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.setComputed = function setComputed () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call setComputed() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.setData = function setData () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call setData() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.setMethods = function setMethods () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call setMethods() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.setProps = function setProps () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call setProps() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.setValue = function setValue () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call setValue() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.setChecked = function setChecked () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call setChecked() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.setSelected = function setSelected () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call setSelected() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.trigger = function trigger () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call trigger() on empty Wrapper")
- );
- };
- ErrorWrapper.prototype.update = function update () {
- throwError(
- "update has been removed from vue-test-utils." +
- "All updates are now synchronous by default"
- );
- };
- ErrorWrapper.prototype.destroy = function destroy () {
- throwError(
- ("find did not return " + (this.selector) + ", cannot call destroy() on empty Wrapper")
- );
- };
- //
- function findDOMNodes(
- element,
- selector
- ) {
- var nodes = [];
- if (!element || !element.querySelectorAll || !element.matches) {
- return nodes
- }
- if (element.matches(selector)) {
- nodes.push(element);
- }
- // $FlowIgnore
- return nodes.concat([].slice.call(element.querySelectorAll(selector)))
- }
- function vmMatchesName(vm, name) {
- return (
- !!name && (vm.name === name || (vm.$options && vm.$options.name === name))
- )
- }
- function vmCtorMatches(vm, component) {
- if (
- (vm.$options && vm.$options.$_vueTestUtils_original === component) ||
- vm.$_vueTestUtils_original === component
- ) {
- return true
- }
- var Ctor = isConstructor(component)
- ? component.options._Ctor
- : component._Ctor;
- if (!Ctor) {
- return false
- }
- if (vm.constructor.extendOptions === component) {
- return true
- }
- if (component.functional) {
- return Object.keys(vm._Ctor || {}).some(function (c) {
- return component === vm._Ctor[c].extendOptions
- })
- }
- }
- function matches(node, selector) {
- if (selector.type === DOM_SELECTOR) {
- var element = node instanceof Element ? node : node.elm;
- return element && element.matches && element.matches(selector.value)
- }
- var isFunctionalSelector = isConstructor(selector.value)
- ? selector.value.options.functional
- : selector.value.functional;
- var componentInstance = isFunctionalSelector
- ? node[FUNCTIONAL_OPTIONS]
- : node.child;
- if (!componentInstance) {
- return false
- }
- if (selector.type === COMPONENT_SELECTOR) {
- if (vmCtorMatches(componentInstance, selector.value)) {
- return true
- }
- }
- // Fallback to name selector for COMPONENT_SELECTOR for Vue < 2.1
- var nameSelector = isConstructor(selector.value)
- ? selector.value.extendOptions.name
- : selector.value.name;
- return vmMatchesName(componentInstance, nameSelector)
- }
- //
- function findAllInstances(rootVm) {
- var instances = [rootVm];
- var i = 0;
- while (i < instances.length) {
- var vm = instances[i]
- ;(vm.$children || []).forEach(function (child) {
- instances.push(child);
- });
- i++;
- }
- return instances
- }
- function findAllVNodes(vnode, selector) {
- var matchingNodes = [];
- var nodes = [vnode];
- while (nodes.length) {
- var node = nodes.shift();
- if (node.children) {
- var children = [].concat( node.children ).reverse();
- children.forEach(function (n) {
- nodes.unshift(n);
- });
- }
- if (node.child) {
- nodes.unshift(node.child._vnode);
- }
- if (matches(node, selector)) {
- matchingNodes.push(node);
- }
- }
- return matchingNodes
- }
- function removeDuplicateNodes(vNodes) {
- var vNodeElms = vNodes.map(function (vNode) { return vNode.elm; });
- return vNodes.filter(function (vNode, index) { return index === vNodeElms.indexOf(vNode.elm); })
- }
- function find(
- root,
- vm,
- selector
- ) {
- if (root instanceof Element && selector.type !== DOM_SELECTOR) {
- throwError(
- "cannot find a Vue instance on a DOM node. The node " +
- "you are calling find on does not exist in the " +
- "VDom. Are you adding the node as innerHTML?"
- );
- }
- if (
- selector.type === COMPONENT_SELECTOR &&
- (selector.value.functional ||
- (selector.value.options && selector.value.options.functional)) &&
- VUE_VERSION < 2.3
- ) {
- throwError(
- "find for functional components is not supported " + "in Vue < 2.3"
- );
- }
- if (root instanceof Element) {
- return findDOMNodes(root, selector.value)
- }
- if (!root && selector.type !== DOM_SELECTOR) {
- throwError(
- "cannot find a Vue instance on a DOM node. The node " +
- "you are calling find on does not exist in the " +
- "VDom. Are you adding the node as innerHTML?"
- );
- }
- if (!vm && selector.type === REF_SELECTOR) {
- throwError("$ref selectors can only be used on Vue component " + "wrappers");
- }
- if (vm && vm.$refs && selector.value.ref in vm.$refs) {
- var refs = vm.$refs[selector.value.ref];
- return Array.isArray(refs) ? refs : [refs]
- }
- var nodes = findAllVNodes(root, selector);
- var dedupedNodes = removeDuplicateNodes(nodes);
- if (nodes.length > 0 || selector.type !== DOM_SELECTOR) {
- return dedupedNodes
- }
- // Fallback in case element exists in HTML, but not in vnode tree
- // (e.g. if innerHTML is set as a domProp)
- return findDOMNodes(root.elm, selector.value)
- }
- //
- function createWrapper(
- node,
- options
- ) {
- if ( options === void 0 ) options = {};
- var componentInstance = node.child;
- if (componentInstance) {
- return new VueWrapper(componentInstance, options)
- }
- return node instanceof Vue
- ? new VueWrapper(node, options)
- : new Wrapper(node, options)
- }
- //
- var i = 0;
- function orderDeps(watcher) {
- watcher.deps.forEach(function (dep) {
- if (dep._sortedId === i) {
- return
- }
- dep._sortedId = i;
- dep.subs.forEach(orderDeps);
- dep.subs = dep.subs.sort(function (a, b) { return a.id - b.id; });
- });
- }
- function orderVmWatchers(vm) {
- if (vm._watchers) {
- vm._watchers.forEach(orderDeps);
- }
- if (vm._computedWatchers) {
- Object.keys(vm._computedWatchers).forEach(function (computedWatcher) {
- orderDeps(vm._computedWatchers[computedWatcher]);
- });
- }
- vm._watcher && orderDeps(vm._watcher);
- vm.$children.forEach(orderVmWatchers);
- }
- function orderWatchers(vm) {
- orderVmWatchers(vm);
- i++;
- }
- function recursivelySetData(vm, target, data) {
- Object.keys(data).forEach(function (key) {
- var val = data[key];
- var targetVal = target[key];
- if (isPlainObject(val) && isPlainObject(targetVal)) {
- recursivelySetData(vm, targetVal, val);
- } else {
- vm.$set(target, key, val);
- }
- });
- }
- var abort = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var afterprint = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var animationend = {"eventInterface":"AnimationEvent","bubbles":true,"cancelable":false};
- var animationiteration = {"eventInterface":"AnimationEvent","bubbles":true,"cancelable":false};
- var animationstart = {"eventInterface":"AnimationEvent","bubbles":true,"cancelable":false};
- var appinstalled = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var audioprocess = {"eventInterface":"AudioProcessingEvent"};
- var audioend = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var audiostart = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var beforeprint = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var beforeunload = {"eventInterface":"BeforeUnloadEvent","bubbles":false,"cancelable":true};
- var beginEvent = {"eventInterface":"TimeEvent","bubbles":false,"cancelable":false};
- var blur = {"eventInterface":"FocusEvent","bubbles":false,"cancelable":false};
- var boundary = {"eventInterface":"SpeechSynthesisEvent","bubbles":false,"cancelable":false};
- var cached = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var canplay = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var canplaythrough = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var change = {"eventInterface":"Event","bubbles":true,"cancelable":false};
- var chargingchange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var chargingtimechange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var checking = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var click = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
- var close = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var complete = {"eventInterface":"OfflineAudioCompletionEvent"};
- var compositionend = {"eventInterface":"CompositionEvent","bubbles":true,"cancelable":true};
- var compositionstart = {"eventInterface":"CompositionEvent","bubbles":true,"cancelable":true};
- var compositionupdate = {"eventInterface":"CompositionEvent","bubbles":true,"cancelable":false};
- var contextmenu = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
- var copy = {"eventInterface":"ClipboardEvent"};
- var cut = {"eventInterface":"ClipboardEvent","bubbles":true,"cancelable":true};
- var dblclick = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
- var devicechange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var devicelight = {"eventInterface":"DeviceLightEvent","bubbles":false,"cancelable":false};
- var devicemotion = {"eventInterface":"DeviceMotionEvent","bubbles":false,"cancelable":false};
- var deviceorientation = {"eventInterface":"DeviceOrientationEvent","bubbles":false,"cancelable":false};
- var deviceproximity = {"eventInterface":"DeviceProximityEvent","bubbles":false,"cancelable":false};
- var dischargingtimechange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var DOMActivate = {"eventInterface":"UIEvent","bubbles":true,"cancelable":true};
- var DOMAttributeNameChanged = {"eventInterface":"MutationNameEvent","bubbles":true,"cancelable":true};
- var DOMAttrModified = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true};
- var DOMCharacterDataModified = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true};
- var DOMContentLoaded = {"eventInterface":"Event","bubbles":true,"cancelable":true};
- var DOMElementNameChanged = {"eventInterface":"MutationNameEvent","bubbles":true,"cancelable":true};
- var DOMFocusIn = {"eventInterface":"FocusEvent","bubbles":true,"cancelable":true};
- var DOMFocusOut = {"eventInterface":"FocusEvent","bubbles":true,"cancelable":true};
- var DOMNodeInserted = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true};
- var DOMNodeInsertedIntoDocument = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true};
- var DOMNodeRemoved = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true};
- var DOMNodeRemovedFromDocument = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true};
- var DOMSubtreeModified = {"eventInterface":"MutationEvent"};
- var downloading = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var drag = {"eventInterface":"DragEvent","bubbles":true,"cancelable":true};
- var dragend = {"eventInterface":"DragEvent","bubbles":true,"cancelable":false};
- var dragenter = {"eventInterface":"DragEvent","bubbles":true,"cancelable":true};
- var dragleave = {"eventInterface":"DragEvent","bubbles":true,"cancelable":false};
- var dragover = {"eventInterface":"DragEvent","bubbles":true,"cancelable":true};
- var dragstart = {"eventInterface":"DragEvent","bubbles":true,"cancelable":true};
- var drop = {"eventInterface":"DragEvent","bubbles":true,"cancelable":true};
- var durationchange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var emptied = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var end = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var ended = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var endEvent = {"eventInterface":"TimeEvent","bubbles":false,"cancelable":false};
- var error = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var focus = {"eventInterface":"FocusEvent","bubbles":false,"cancelable":false};
- var focusin = {"eventInterface":"FocusEvent","bubbles":true,"cancelable":false};
- var focusout = {"eventInterface":"FocusEvent","bubbles":true,"cancelable":false};
- var fullscreenchange = {"eventInterface":"Event","bubbles":true,"cancelable":false};
- var fullscreenerror = {"eventInterface":"Event","bubbles":true,"cancelable":false};
- var gamepadconnected = {"eventInterface":"GamepadEvent","bubbles":false,"cancelable":false};
- var gamepaddisconnected = {"eventInterface":"GamepadEvent","bubbles":false,"cancelable":false};
- var gotpointercapture = {"eventInterface":"PointerEvent","bubbles":false,"cancelable":false};
- var hashchange = {"eventInterface":"HashChangeEvent","bubbles":true,"cancelable":false};
- var lostpointercapture = {"eventInterface":"PointerEvent","bubbles":false,"cancelable":false};
- var input = {"eventInterface":"Event","bubbles":true,"cancelable":false};
- var invalid = {"eventInterface":"Event","cancelable":true,"bubbles":false};
- var keydown = {"eventInterface":"KeyboardEvent","bubbles":true,"cancelable":true};
- var keypress = {"eventInterface":"KeyboardEvent","bubbles":true,"cancelable":true};
- var keyup = {"eventInterface":"KeyboardEvent","bubbles":true,"cancelable":true};
- var languagechange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var levelchange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var load = {"eventInterface":"UIEvent","bubbles":false,"cancelable":false};
- var loadeddata = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var loadedmetadata = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var loadend = {"eventInterface":"ProgressEvent","bubbles":false,"cancelable":false};
- var loadstart = {"eventInterface":"ProgressEvent","bubbles":false,"cancelable":false};
- var mark = {"eventInterface":"SpeechSynthesisEvent","bubbles":false,"cancelable":false};
- var message = {"eventInterface":"MessageEvent","bubbles":false,"cancelable":false};
- var messageerror = {"eventInterface":"MessageEvent","bubbles":false,"cancelable":false};
- var mousedown = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
- var mouseenter = {"eventInterface":"MouseEvent","bubbles":false,"cancelable":false};
- var mouseleave = {"eventInterface":"MouseEvent","bubbles":false,"cancelable":false};
- var mousemove = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
- var mouseout = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
- var mouseover = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
- var mouseup = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
- var nomatch = {"eventInterface":"SpeechRecognitionEvent","bubbles":false,"cancelable":false};
- var notificationclick = {"eventInterface":"NotificationEvent","bubbles":false,"cancelable":false};
- var noupdate = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var obsolete = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var offline = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var online = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var open = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var orientationchange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var pagehide = {"eventInterface":"PageTransitionEvent","bubbles":false,"cancelable":false};
- var pageshow = {"eventInterface":"PageTransitionEvent","bubbles":false,"cancelable":false};
- var paste = {"eventInterface":"ClipboardEvent","bubbles":true,"cancelable":true};
- var pause = {"eventInterface":"SpeechSynthesisEvent","bubbles":false,"cancelable":false};
- var pointercancel = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":false};
- var pointerdown = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":true};
- var pointerenter = {"eventInterface":"PointerEvent","bubbles":false,"cancelable":false};
- var pointerleave = {"eventInterface":"PointerEvent","bubbles":false,"cancelable":false};
- var pointerlockchange = {"eventInterface":"Event","bubbles":true,"cancelable":false};
- var pointerlockerror = {"eventInterface":"Event","bubbles":true,"cancelable":false};
- var pointermove = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":true};
- var pointerout = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":true};
- var pointerover = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":true};
- var pointerup = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":true};
- var play = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var playing = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var popstate = {"eventInterface":"PopStateEvent","bubbles":true,"cancelable":false};
- var progress = {"eventInterface":"ProgressEvent","bubbles":false,"cancelable":false};
- var push = {"eventInterface":"PushEvent","bubbles":false,"cancelable":false};
- var pushsubscriptionchange = {"eventInterface":"PushEvent","bubbles":false,"cancelable":false};
- var ratechange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var readystatechange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var repeatEvent = {"eventInterface":"TimeEvent","bubbles":false,"cancelable":false};
- var reset = {"eventInterface":"Event","bubbles":true,"cancelable":true};
- var resize = {"eventInterface":"UIEvent","bubbles":false,"cancelable":false};
- var resourcetimingbufferfull = {"eventInterface":"Performance","bubbles":true,"cancelable":true};
- var result = {"eventInterface":"SpeechRecognitionEvent","bubbles":false,"cancelable":false};
- var resume = {"eventInterface":"SpeechSynthesisEvent","bubbles":false,"cancelable":false};
- var scroll = {"eventInterface":"UIEvent","bubbles":false,"cancelable":false};
- var seeked = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var seeking = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var select = {"eventInterface":"UIEvent","bubbles":true,"cancelable":false};
- var selectstart = {"eventInterface":"Event","bubbles":true,"cancelable":true};
- var selectionchange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var show = {"eventInterface":"MouseEvent","bubbles":false,"cancelable":false};
- var slotchange = {"eventInterface":"Event","bubbles":true,"cancelable":false};
- var soundend = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var soundstart = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var speechend = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var speechstart = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var stalled = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var start = {"eventInterface":"SpeechSynthesisEvent","bubbles":false,"cancelable":false};
- var storage = {"eventInterface":"StorageEvent","bubbles":false,"cancelable":false};
- var submit = {"eventInterface":"Event","bubbles":true,"cancelable":true};
- var success = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var suspend = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var SVGAbort = {"eventInterface":"SVGEvent","bubbles":true,"cancelable":false};
- var SVGError = {"eventInterface":"SVGEvent","bubbles":true,"cancelable":false};
- var SVGLoad = {"eventInterface":"SVGEvent","bubbles":false,"cancelable":false};
- var SVGResize = {"eventInterface":"SVGEvent","bubbles":true,"cancelable":false};
- var SVGScroll = {"eventInterface":"SVGEvent","bubbles":true,"cancelable":false};
- var SVGUnload = {"eventInterface":"SVGEvent","bubbles":false,"cancelable":false};
- var SVGZoom = {"eventInterface":"SVGZoomEvent","bubbles":true,"cancelable":false};
- var timeout = {"eventInterface":"ProgressEvent","bubbles":false,"cancelable":false};
- var timeupdate = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var touchcancel = {"eventInterface":"TouchEvent","bubbles":true,"cancelable":false};
- var touchend = {"eventInterface":"TouchEvent","bubbles":true,"cancelable":true};
- var touchmove = {"eventInterface":"TouchEvent","bubbles":true,"cancelable":true};
- var touchstart = {"eventInterface":"TouchEvent","bubbles":true,"cancelable":true};
- var transitionend = {"eventInterface":"TransitionEvent","bubbles":true,"cancelable":true};
- var unload = {"eventInterface":"UIEvent","bubbles":false};
- var updateready = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var userproximity = {"eventInterface":"UserProximityEvent","bubbles":false,"cancelable":false};
- var voiceschanged = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var visibilitychange = {"eventInterface":"Event","bubbles":true,"cancelable":false};
- var volumechange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var waiting = {"eventInterface":"Event","bubbles":false,"cancelable":false};
- var wheel = {"eventInterface":"WheelEvent","bubbles":true,"cancelable":true};
- var domEventTypes = {
- abort: abort,
- afterprint: afterprint,
- animationend: animationend,
- animationiteration: animationiteration,
- animationstart: animationstart,
- appinstalled: appinstalled,
- audioprocess: audioprocess,
- audioend: audioend,
- audiostart: audiostart,
- beforeprint: beforeprint,
- beforeunload: beforeunload,
- beginEvent: beginEvent,
- blur: blur,
- boundary: boundary,
- cached: cached,
- canplay: canplay,
- canplaythrough: canplaythrough,
- change: change,
- chargingchange: chargingchange,
- chargingtimechange: chargingtimechange,
- checking: checking,
- click: click,
- close: close,
- complete: complete,
- compositionend: compositionend,
- compositionstart: compositionstart,
- compositionupdate: compositionupdate,
- contextmenu: contextmenu,
- copy: copy,
- cut: cut,
- dblclick: dblclick,
- devicechange: devicechange,
- devicelight: devicelight,
- devicemotion: devicemotion,
- deviceorientation: deviceorientation,
- deviceproximity: deviceproximity,
- dischargingtimechange: dischargingtimechange,
- DOMActivate: DOMActivate,
- DOMAttributeNameChanged: DOMAttributeNameChanged,
- DOMAttrModified: DOMAttrModified,
- DOMCharacterDataModified: DOMCharacterDataModified,
- DOMContentLoaded: DOMContentLoaded,
- DOMElementNameChanged: DOMElementNameChanged,
- DOMFocusIn: DOMFocusIn,
- DOMFocusOut: DOMFocusOut,
- DOMNodeInserted: DOMNodeInserted,
- DOMNodeInsertedIntoDocument: DOMNodeInsertedIntoDocument,
- DOMNodeRemoved: DOMNodeRemoved,
- DOMNodeRemovedFromDocument: DOMNodeRemovedFromDocument,
- DOMSubtreeModified: DOMSubtreeModified,
- downloading: downloading,
- drag: drag,
- dragend: dragend,
- dragenter: dragenter,
- dragleave: dragleave,
- dragover: dragover,
- dragstart: dragstart,
- drop: drop,
- durationchange: durationchange,
- emptied: emptied,
- end: end,
- ended: ended,
- endEvent: endEvent,
- error: error,
- focus: focus,
- focusin: focusin,
- focusout: focusout,
- fullscreenchange: fullscreenchange,
- fullscreenerror: fullscreenerror,
- gamepadconnected: gamepadconnected,
- gamepaddisconnected: gamepaddisconnected,
- gotpointercapture: gotpointercapture,
- hashchange: hashchange,
- lostpointercapture: lostpointercapture,
- input: input,
- invalid: invalid,
- keydown: keydown,
- keypress: keypress,
- keyup: keyup,
- languagechange: languagechange,
- levelchange: levelchange,
- load: load,
- loadeddata: loadeddata,
- loadedmetadata: loadedmetadata,
- loadend: loadend,
- loadstart: loadstart,
- mark: mark,
- message: message,
- messageerror: messageerror,
- mousedown: mousedown,
- mouseenter: mouseenter,
- mouseleave: mouseleave,
- mousemove: mousemove,
- mouseout: mouseout,
- mouseover: mouseover,
- mouseup: mouseup,
- nomatch: nomatch,
- notificationclick: notificationclick,
- noupdate: noupdate,
- obsolete: obsolete,
- offline: offline,
- online: online,
- open: open,
- orientationchange: orientationchange,
- pagehide: pagehide,
- pageshow: pageshow,
- paste: paste,
- pause: pause,
- pointercancel: pointercancel,
- pointerdown: pointerdown,
- pointerenter: pointerenter,
- pointerleave: pointerleave,
- pointerlockchange: pointerlockchange,
- pointerlockerror: pointerlockerror,
- pointermove: pointermove,
- pointerout: pointerout,
- pointerover: pointerover,
- pointerup: pointerup,
- play: play,
- playing: playing,
- popstate: popstate,
- progress: progress,
- push: push,
- pushsubscriptionchange: pushsubscriptionchange,
- ratechange: ratechange,
- readystatechange: readystatechange,
- repeatEvent: repeatEvent,
- reset: reset,
- resize: resize,
- resourcetimingbufferfull: resourcetimingbufferfull,
- result: result,
- resume: resume,
- scroll: scroll,
- seeked: seeked,
- seeking: seeking,
- select: select,
- selectstart: selectstart,
- selectionchange: selectionchange,
- show: show,
- slotchange: slotchange,
- soundend: soundend,
- soundstart: soundstart,
- speechend: speechend,
- speechstart: speechstart,
- stalled: stalled,
- start: start,
- storage: storage,
- submit: submit,
- success: success,
- suspend: suspend,
- SVGAbort: SVGAbort,
- SVGError: SVGError,
- SVGLoad: SVGLoad,
- SVGResize: SVGResize,
- SVGScroll: SVGScroll,
- SVGUnload: SVGUnload,
- SVGZoom: SVGZoom,
- timeout: timeout,
- timeupdate: timeupdate,
- touchcancel: touchcancel,
- touchend: touchend,
- touchmove: touchmove,
- touchstart: touchstart,
- transitionend: transitionend,
- unload: unload,
- updateready: updateready,
- userproximity: userproximity,
- voiceschanged: voiceschanged,
- visibilitychange: visibilitychange,
- volumechange: volumechange,
- waiting: waiting,
- wheel: wheel
- };
- var domEventTypes$1 = Object.freeze({
- abort: abort,
- afterprint: afterprint,
- animationend: animationend,
- animationiteration: animationiteration,
- animationstart: animationstart,
- appinstalled: appinstalled,
- audioprocess: audioprocess,
- audioend: audioend,
- audiostart: audiostart,
- beforeprint: beforeprint,
- beforeunload: beforeunload,
- beginEvent: beginEvent,
- blur: blur,
- boundary: boundary,
- cached: cached,
- canplay: canplay,
- canplaythrough: canplaythrough,
- change: change,
- chargingchange: chargingchange,
- chargingtimechange: chargingtimechange,
- checking: checking,
- click: click,
- close: close,
- complete: complete,
- compositionend: compositionend,
- compositionstart: compositionstart,
- compositionupdate: compositionupdate,
- contextmenu: contextmenu,
- copy: copy,
- cut: cut,
- dblclick: dblclick,
- devicechange: devicechange,
- devicelight: devicelight,
- devicemotion: devicemotion,
- deviceorientation: deviceorientation,
- deviceproximity: deviceproximity,
- dischargingtimechange: dischargingtimechange,
- DOMActivate: DOMActivate,
- DOMAttributeNameChanged: DOMAttributeNameChanged,
- DOMAttrModified: DOMAttrModified,
- DOMCharacterDataModified: DOMCharacterDataModified,
- DOMContentLoaded: DOMContentLoaded,
- DOMElementNameChanged: DOMElementNameChanged,
- DOMFocusIn: DOMFocusIn,
- DOMFocusOut: DOMFocusOut,
- DOMNodeInserted: DOMNodeInserted,
- DOMNodeInsertedIntoDocument: DOMNodeInsertedIntoDocument,
- DOMNodeRemoved: DOMNodeRemoved,
- DOMNodeRemovedFromDocument: DOMNodeRemovedFromDocument,
- DOMSubtreeModified: DOMSubtreeModified,
- downloading: downloading,
- drag: drag,
- dragend: dragend,
- dragenter: dragenter,
- dragleave: dragleave,
- dragover: dragover,
- dragstart: dragstart,
- drop: drop,
- durationchange: durationchange,
- emptied: emptied,
- end: end,
- ended: ended,
- endEvent: endEvent,
- error: error,
- focus: focus,
- focusin: focusin,
- focusout: focusout,
- fullscreenchange: fullscreenchange,
- fullscreenerror: fullscreenerror,
- gamepadconnected: gamepadconnected,
- gamepaddisconnected: gamepaddisconnected,
- gotpointercapture: gotpointercapture,
- hashchange: hashchange,
- lostpointercapture: lostpointercapture,
- input: input,
- invalid: invalid,
- keydown: keydown,
- keypress: keypress,
- keyup: keyup,
- languagechange: languagechange,
- levelchange: levelchange,
- load: load,
- loadeddata: loadeddata,
- loadedmetadata: loadedmetadata,
- loadend: loadend,
- loadstart: loadstart,
- mark: mark,
- message: message,
- messageerror: messageerror,
- mousedown: mousedown,
- mouseenter: mouseenter,
- mouseleave: mouseleave,
- mousemove: mousemove,
- mouseout: mouseout,
- mouseover: mouseover,
- mouseup: mouseup,
- nomatch: nomatch,
- notificationclick: notificationclick,
- noupdate: noupdate,
- obsolete: obsolete,
- offline: offline,
- online: online,
- open: open,
- orientationchange: orientationchange,
- pagehide: pagehide,
- pageshow: pageshow,
- paste: paste,
- pause: pause,
- pointercancel: pointercancel,
- pointerdown: pointerdown,
- pointerenter: pointerenter,
- pointerleave: pointerleave,
- pointerlockchange: pointerlockchange,
- pointerlockerror: pointerlockerror,
- pointermove: pointermove,
- pointerout: pointerout,
- pointerover: pointerover,
- pointerup: pointerup,
- play: play,
- playing: playing,
- popstate: popstate,
- progress: progress,
- push: push,
- pushsubscriptionchange: pushsubscriptionchange,
- ratechange: ratechange,
- readystatechange: readystatechange,
- repeatEvent: repeatEvent,
- reset: reset,
- resize: resize,
- resourcetimingbufferfull: resourcetimingbufferfull,
- result: result,
- resume: resume,
- scroll: scroll,
- seeked: seeked,
- seeking: seeking,
- select: select,
- selectstart: selectstart,
- selectionchange: selectionchange,
- show: show,
- slotchange: slotchange,
- soundend: soundend,
- soundstart: soundstart,
- speechend: speechend,
- speechstart: speechstart,
- stalled: stalled,
- start: start,
- storage: storage,
- submit: submit,
- success: success,
- suspend: suspend,
- SVGAbort: SVGAbort,
- SVGError: SVGError,
- SVGLoad: SVGLoad,
- SVGResize: SVGResize,
- SVGScroll: SVGScroll,
- SVGUnload: SVGUnload,
- SVGZoom: SVGZoom,
- timeout: timeout,
- timeupdate: timeupdate,
- touchcancel: touchcancel,
- touchend: touchend,
- touchmove: touchmove,
- touchstart: touchstart,
- transitionend: transitionend,
- unload: unload,
- updateready: updateready,
- userproximity: userproximity,
- voiceschanged: voiceschanged,
- visibilitychange: visibilitychange,
- volumechange: volumechange,
- waiting: waiting,
- wheel: wheel,
- default: domEventTypes
- });
- var require$$0 = ( domEventTypes$1 && domEventTypes ) || domEventTypes$1;
- var domEventTypes$2 = require$$0;
- var defaultEventType = {
- eventInterface: 'Event',
- cancelable: true,
- bubbles: true
- };
- var modifiers = {
- enter: 13,
- tab: 9,
- delete: 46,
- esc: 27,
- space: 32,
- up: 38,
- down: 40,
- left: 37,
- right: 39,
- end: 35,
- home: 36,
- backspace: 8,
- insert: 45,
- pageup: 33,
- pagedown: 34
- };
- function createEvent(
- type,
- modifier,
- ref,
- options
- ) {
- var eventInterface = ref.eventInterface;
- var bubbles = ref.bubbles;
- var cancelable = ref.cancelable;
- var SupportedEventInterface =
- typeof window[eventInterface] === 'function'
- ? window[eventInterface]
- : window.Event;
- var event = new SupportedEventInterface(type, Object.assign({}, options,
- {bubbles: bubbles,
- cancelable: cancelable,
- keyCode: modifiers[modifier]}));
- return event
- }
- function createOldEvent(
- type,
- modifier,
- ref
- ) {
- var eventInterface = ref.eventInterface;
- var bubbles = ref.bubbles;
- var cancelable = ref.cancelable;
- var event = document.createEvent('Event');
- event.initEvent(type, bubbles, cancelable);
- event.keyCode = modifiers[modifier];
- return event
- }
- function createDOMEvent(type, options) {
- var ref = type.split('.');
- var eventType = ref[0];
- var modifier = ref[1];
- var meta = domEventTypes$2[eventType] || defaultEventType;
- // Fallback for IE10,11 - https://stackoverflow.com/questions/26596123
- var event =
- typeof window.Event === 'function'
- ? createEvent(eventType, modifier, meta, options)
- : createOldEvent(eventType, modifier, meta);
- var eventPrototype = Object.getPrototypeOf(event);
- Object.keys(options || {}).forEach(function (key) {
- var propertyDescriptor = Object.getOwnPropertyDescriptor(
- eventPrototype,
- key
- );
- var canSetProperty = !(
- propertyDescriptor && propertyDescriptor.setter === undefined
- );
- if (canSetProperty) {
- event[key] = options[key];
- }
- });
- return event
- }
- function errorHandler(errorOrString, vm) {
- var error =
- typeof errorOrString === 'object' ? errorOrString : new Error(errorOrString);
- vm._error = error;
- throw error
- }
- function throwIfInstancesThrew(vm) {
- var instancesWithError = findAllInstances(vm).filter(function (_vm) { return _vm._error; });
- if (instancesWithError.length > 0) {
- throw instancesWithError[0]._error
- }
- }
- var hasWarned = false;
- // Vue swallows errors thrown by instances, even if the global error handler
- // throws. In order to throw in the test, we add an _error property to an
- // instance when it throws. Then we loop through the instances with
- // throwIfInstancesThrew and throw an error in the test context if any
- // instances threw.
- function addGlobalErrorHandler(_Vue) {
- var existingErrorHandler = _Vue.config.errorHandler;
- if (existingErrorHandler === errorHandler) {
- return
- }
- if (_Vue.config.errorHandler && !hasWarned) {
- warn(
- "Global error handler detected (Vue.config.errorHandler). \n" +
- "Vue Test Utils sets a custom error handler to throw errors " +
- "thrown by instances. If you want this behavior in " +
- "your tests, you must remove the global error handler."
- );
- hasWarned = true;
- } else {
- _Vue.config.errorHandler = errorHandler;
- }
- }
- //
- var Wrapper = function Wrapper(
- node,
- options,
- isVueWrapper
- ) {
- var vnode = node instanceof Element ? null : node;
- var element = node instanceof Element ? node : node.elm;
- // Prevent redefine by VueWrapper
- if (!isVueWrapper) {
- // $FlowIgnore : issue with defineProperty
- Object.defineProperty(this, 'rootNode', {
- get: function () { return vnode || element; },
- set: function () { return throwError('wrapper.rootNode is read-only'); }
- });
- // $FlowIgnore
- Object.defineProperty(this, 'vnode', {
- get: function () { return vnode; },
- set: function () { return throwError('wrapper.vnode is read-only'); }
- });
- // $FlowIgnore
- Object.defineProperty(this, 'element', {
- get: function () { return element; },
- set: function () { return throwError('wrapper.element is read-only'); }
- });
- // $FlowIgnore
- Object.defineProperty(this, 'vm', {
- get: function () { return undefined; },
- set: function () { return throwError('wrapper.vm is read-only'); }
- });
- }
- var frozenOptions = Object.freeze(options);
- // $FlowIgnore
- Object.defineProperty(this, 'options', {
- get: function () { return frozenOptions; },
- set: function () { return throwError('wrapper.options is read-only'); }
- });
- if (
- this.vnode &&
- (this.vnode[FUNCTIONAL_OPTIONS] || this.vnode.functionalContext)
- ) {
- this.isFunctionalComponent = true;
- }
- };
- Wrapper.prototype.at = function at () {
- throwError('at() must be called on a WrapperArray');
- };
- /**
- * Returns an Object containing all the attribute/value pairs on the element.
- */
- Wrapper.prototype.attributes = function attributes (key) {
- var attributes = this.element.attributes;
- var attributeMap = {};
- for (var i = 0; i < attributes.length; i++) {
- var att = attributes.item(i);
- attributeMap[att.localName] = att.value;
- }
- return key ? attributeMap[key] : attributeMap
- };
- /**
- * Returns an Array containing all the classes on the element
- */
- Wrapper.prototype.classes = function classes (className) {
- var this$1 = this;
- var classAttribute = this.element.getAttribute('class');
- var classes = classAttribute ? classAttribute.split(' ') : [];
- // Handle converting cssmodules identifiers back to the original class name
- if (this.vm && this.vm.$style) {
- var cssModuleIdentifiers = Object.keys(this.vm.$style).reduce(
- function (acc, key) {
- // $FlowIgnore
- var moduleIdent = this$1.vm.$style[key];
- if (moduleIdent) {
- acc[moduleIdent.split(' ')[0]] = key;
- }
- return acc
- },
- {}
- );
- classes = classes.map(function (name) { return cssModuleIdentifiers[name] || name; });
- }
- return className ? !!(classes.indexOf(className) > -1) : classes
- };
- /**
- * Checks if wrapper contains provided selector.
- */
- Wrapper.prototype.contains = function contains (rawSelector) {
- var selector = getSelector(rawSelector, 'contains');
- var nodes = find(this.rootNode, this.vm, selector);
- return nodes.length > 0
- };
- /**
- * Calls destroy on vm
- */
- Wrapper.prototype.destroy = function destroy () {
- if (!this.isVueInstance()) {
- throwError("wrapper.destroy() can only be called on a Vue instance");
- }
- if (this.element.parentNode) {
- this.element.parentNode.removeChild(this.element);
- }
- // $FlowIgnore
- this.vm.$destroy();
- throwIfInstancesThrew(this.vm);
- };
- /**
- * Returns an object containing custom events emitted by the Wrapper vm
- */
- Wrapper.prototype.emitted = function emitted (
- event
- ) {
- if (!this._emitted && !this.vm) {
- throwError("wrapper.emitted() can only be called on a Vue instance");
- }
- if (event) {
- return this._emitted[event]
- }
- return this._emitted
- };
- /**
- * Returns an Array containing custom events emitted by the Wrapper vm
- */
- Wrapper.prototype.emittedByOrder = function emittedByOrder () {
- if (!this._emittedByOrder && !this.vm) {
- throwError(
- "wrapper.emittedByOrder() can only be called on a Vue instance"
- );
- }
- return this._emittedByOrder
- };
- /**
- * Utility to check wrapper exists. Returns true as Wrapper always exists
- */
- Wrapper.prototype.exists = function exists () {
- if (this.vm) {
- return !!this.vm && !this.vm._isDestroyed
- }
- return true
- };
- Wrapper.prototype.filter = function filter () {
- throwError('filter() must be called on a WrapperArray');
- };
- /**
- * Finds first node in tree of the current wrapper that
- * matches the provided selector.
- */
- Wrapper.prototype.find = function find$1 (rawSelector) {
- var selector = getSelector(rawSelector, 'find');
- var node = find(this.rootNode, this.vm, selector)[0];
- if (!node) {
- if (selector.type === REF_SELECTOR) {
- return new ErrorWrapper(("ref=\"" + (selector.value.ref) + "\""))
- }
- return new ErrorWrapper(
- typeof selector.value === 'string' ? selector.value : 'Component'
- )
- }
- return createWrapper(node, this.options)
- };
- /**
- * Finds node in tree of the current wrapper that matches
- * the provided selector.
- */
- Wrapper.prototype.findAll = function findAll (rawSelector) {
- var this$1 = this;
- var selector = getSelector(rawSelector, 'findAll');
- var nodes = find(this.rootNode, this.vm, selector);
- var wrappers = nodes.map(function (node) {
- // Using CSS Selector, returns a VueWrapper instance if the root element
- // binds a Vue instance.
- return createWrapper(node, this$1.options)
- });
- return new WrapperArray(wrappers)
- };
- /**
- * Returns HTML of element as a string
- */
- Wrapper.prototype.html = function html () {
- return this.element.outerHTML
- };
- /**
- * Checks if node matches selector
- */
- Wrapper.prototype.is = function is (rawSelector) {
- var selector = getSelector(rawSelector, 'is');
- if (selector.type === REF_SELECTOR) {
- throwError('$ref selectors can not be used with wrapper.is()');
- }
- return matches(this.rootNode, selector)
- };
- /**
- * Checks if node is empty
- */
- Wrapper.prototype.isEmpty = function isEmpty () {
- if (!this.vnode) {
- return this.element.innerHTML === ''
- }
- var nodes = [];
- var node = this.vnode;
- var i = 0;
- while (node) {
- if (node.child) {
- nodes.push(node.child._vnode);
- }
- node.children &&
- node.children.forEach(function (n) {
- nodes.push(n);
- });
- node = nodes[i++];
- }
- return nodes.every(function (n) { return n.isComment || n.child; })
- };
- /**
- * Checks if node is visible
- */
- Wrapper.prototype.isVisible = function isVisible () {
- var element = this.element;
- while (element) {
- if (
- element.style &&
- (element.style.visibility === 'hidden' ||
- element.style.display === 'none')
- ) {
- return false
- }
- element = element.parentElement;
- }
- return true
- };
- /**
- * Checks if wrapper is a vue instance
- */
- Wrapper.prototype.isVueInstance = function isVueInstance () {
- return !!this.vm
- };
- /**
- * Returns name of component, or tag name if node is not a Vue component
- */
- Wrapper.prototype.name = function name () {
- if (this.vm) {
- return (
- this.vm.$options.name ||
- // compat for Vue < 2.3
- (this.vm.$options.extendOptions && this.vm.$options.extendOptions.name)
- )
- }
- if (!this.vnode) {
- return this.element.tagName
- }
- return this.vnode.tag
- };
- /**
- * Returns an Object containing the prop name/value pairs on the element
- */
- Wrapper.prototype.props = function props (key) {
- var this$1 = this;
- if (this.isFunctionalComponent) {
- throwError(
- "wrapper.props() cannot be called on a mounted functional component."
- );
- }
- if (!this.vm) {
- throwError('wrapper.props() must be called on a Vue instance');
- }
- var props = {};
- var keys = this.vm && this.vm.$options._propKeys;
- if (keys) {
- (keys || {}).forEach(function (key) {
- if (this$1.vm) {
- props[key] = this$1.vm[key];
- }
- });
- }
- if (key) {
- return props[key]
- }
- return props
- };
- /**
- * Checks radio button or checkbox element
- */
- Wrapper.prototype.setChecked = function setChecked (checked) {
- if ( checked === void 0 ) checked = true;
- if (typeof checked !== 'boolean') {
- throwError('wrapper.setChecked() must be passed a boolean');
- }
- var tagName = this.element.tagName;
- // $FlowIgnore
- var type = this.attributes().type;
- var event = getCheckedEvent();
- if (tagName === 'INPUT' && type === 'checkbox') {
- if (this.element.checked === checked) {
- return
- }
- if (event !== 'click' || isPhantomJS) {
- // $FlowIgnore
- this.element.checked = checked;
- }
- this.trigger(event);
- return
- }
- if (tagName === 'INPUT' && type === 'radio') {
- if (!checked) {
- throwError(
- "wrapper.setChecked() cannot be called with parameter false on a " +
- "<input type=\"radio\" /> element."
- );
- }
- if (event !== 'click' || isPhantomJS) {
- // $FlowIgnore
- this.element.selected = true;
- }
- this.trigger(event);
- return
- }
- throwError("wrapper.setChecked() cannot be called on this element");
- };
- /**
- * Selects <option></option> element
- */
- Wrapper.prototype.setSelected = function setSelected () {
- var tagName = this.element.tagName;
- if (tagName === 'SELECT') {
- throwError(
- "wrapper.setSelected() cannot be called on select. Call it on one of " +
- "its options"
- );
- }
- if (tagName === 'OPTION') {
- // $FlowIgnore
- this.element.selected = true;
- // $FlowIgnore
- var parentElement = this.element.parentElement;
- // $FlowIgnore
- if (parentElement.tagName === 'OPTGROUP') {
- // $FlowIgnore
- parentElement = parentElement.parentElement;
- }
- // $FlowIgnore
- createWrapper(parentElement, this.options).trigger('change');
- return
- }
- throwError("wrapper.setSelected() cannot be called on this element");
- };
- /**
- * Sets vm data
- */
- Wrapper.prototype.setData = function setData (data) {
- if (this.isFunctionalComponent) {
- throwError("wrapper.setData() cannot be called on a functional component");
- }
- if (!this.vm) {
- throwError("wrapper.setData() can only be called on a Vue instance");
- }
- recursivelySetData(this.vm, this.vm, data);
- };
- /**
- * Sets vm methods
- */
- Wrapper.prototype.setMethods = function setMethods (methods) {
- var this$1 = this;
- if (!this.isVueInstance()) {
- throwError("wrapper.setMethods() can only be called on a Vue instance");
- }
- Object.keys(methods).forEach(function (key) {
- // $FlowIgnore : Problem with possibly null this.vm
- this$1.vm[key] = methods[key];
- // $FlowIgnore : Problem with possibly null this.vm
- this$1.vm.$options.methods[key] = methods[key];
- });
- if (this.vnode) {
- var context = this.vnode.context;
- if (context.$options.render) { context._update(context._render()); }
- }
- };
- /**
- * Sets vm props
- */
- Wrapper.prototype.setProps = function setProps (data) {
- var this$1 = this;
- var originalConfig = Vue.config.silent;
- Vue.config.silent = config.silent;
- if (this.isFunctionalComponent) {
- throwError(
- "wrapper.setProps() cannot be called on a functional component"
- );
- }
- if (!this.vm) {
- throwError("wrapper.setProps() can only be called on a Vue instance");
- }
- Object.keys(data).forEach(function (key) {
- if (
- typeof data[key] === 'object' &&
- data[key] !== null &&
- // $FlowIgnore : Problem with possibly null this.vm
- data[key] === this$1.vm[key]
- ) {
- throwError(
- "wrapper.setProps() called with the same object of the existing " +
- key + " property. You must call wrapper.setProps() with a new " +
- "object to trigger reactivity"
- );
- }
- if (
- !this$1.vm ||
- !this$1.vm.$options._propKeys ||
- !this$1.vm.$options._propKeys.some(function (prop) { return prop === key; })
- ) {
- if (VUE_VERSION > 2.3) {
- // $FlowIgnore : Problem with possibly null this.vm
- this$1.vm.$attrs[key] = data[key];
- return
- }
- throwError(
- "wrapper.setProps() called with " + key + " property which " +
- "is not defined on the component"
- );
- }
- if (this$1.vm && this$1.vm._props) {
- // Set actual props value
- this$1.vm._props[key] = data[key];
- // $FlowIgnore : Problem with possibly null this.vm
- this$1.vm[key] = data[key];
- } else {
- // $FlowIgnore : Problem with possibly null this.vm.$options
- this$1.vm.$options.propsData[key] = data[key];
- // $FlowIgnore : Problem with possibly null this.vm
- this$1.vm[key] = data[key];
- // $FlowIgnore : Need to call this twice to fix watcher bug in 2.0.x
- this$1.vm[key] = data[key];
- }
- });
- // $FlowIgnore : Problem with possibly null this.vm
- this.vm.$forceUpdate();
- if (this.options.sync === COMPAT_SYNC_MODE) {
- // $FlowIgnore : Problem with possibly null this.vm
- orderWatchers(this.vm || this.vnode.context.$root);
- }
- Vue.config.silent = originalConfig;
- };
- /**
- * Sets element value and triggers input event
- */
- Wrapper.prototype.setValue = function setValue (value) {
- var tagName = this.element.tagName;
- // $FlowIgnore
- var type = this.attributes().type;
- if (tagName === 'OPTION') {
- throwError(
- "wrapper.setValue() cannot be called on an <option> element. Use " +
- "wrapper.setSelected() instead"
- );
- } else if (tagName === 'INPUT' && type === 'checkbox') {
- throwError(
- "wrapper.setValue() cannot be called on a <input type=\"checkbox\" /> " +
- "element. Use wrapper.setChecked() instead"
- );
- } else if (tagName === 'INPUT' && type === 'radio') {
- throwError(
- "wrapper.setValue() cannot be called on a <input type=\"radio\" /> " +
- "element. Use wrapper.setChecked() instead"
- );
- } else if (
- tagName === 'INPUT' ||
- tagName === 'TEXTAREA' ||
- tagName === 'SELECT'
- ) {
- var event = tagName === 'SELECT' ? 'change' : 'input';
- // $FlowIgnore
- this.element.value = value;
- this.trigger(event);
- } else {
- throwError("wrapper.setValue() cannot be called on this element");
- }
- };
- /**
- * Return text of wrapper element
- */
- Wrapper.prototype.text = function text () {
- return this.element.textContent.trim()
- };
- /**
- * Dispatches a DOM event on wrapper
- */
- Wrapper.prototype.trigger = function trigger (type, options) {
- if ( options === void 0 ) options = {};
- if (typeof type !== 'string') {
- throwError('wrapper.trigger() must be passed a string');
- }
- if (options.target) {
- throwError(
- "you cannot set the target value of an event. See the notes section " +
- "of the docs for more details—" +
- "https://vue-test-utils.vuejs.org/api/wrapper/trigger.html"
- );
- }
- // Don't fire event on a disabled element
- if (this.attributes().disabled) {
- return
- }
- var event = createDOMEvent(type, options);
- this.element.dispatchEvent(event);
- if (this.vnode && this.options.sync === COMPAT_SYNC_MODE) {
- orderWatchers(this.vm || this.vnode.context.$root);
- }
- };
- Wrapper.prototype.update = function update () {
- warn(
- "update has been removed from vue-test-utils. All updates are now " +
- "synchronous by default"
- );
- };
- //
- function setDepsSync(dep) {
- dep.subs.forEach(setWatcherSync);
- }
- function setWatcherSync(watcher) {
- if (watcher.sync === true) {
- return
- }
- watcher.sync = true;
- watcher.deps.forEach(setDepsSync);
- }
- function setWatchersToSync(vm) {
- if (vm._watchers) {
- vm._watchers.forEach(setWatcherSync);
- }
- if (vm._computedWatchers) {
- Object.keys(vm._computedWatchers).forEach(function (computedWatcher) {
- setWatcherSync(vm._computedWatchers[computedWatcher]);
- });
- }
- setWatcherSync(vm._watcher);
- vm.$children.forEach(setWatchersToSync);
- // preventing double registration
- if (!vm.$_vueTestUtils_updateInSetWatcherSync) {
- vm.$_vueTestUtils_updateInSetWatcherSync = vm._update;
- vm._update = function(vnode, hydrating) {
- var this$1 = this;
- this.$_vueTestUtils_updateInSetWatcherSync(vnode, hydrating);
- if (VUE_VERSION >= 2.1 && this._isMounted && this.$options.updated) {
- this.$options.updated.forEach(function (handler) {
- handler.call(this$1);
- });
- }
- };
- }
- }
- //
- var VueWrapper = (function (Wrapper$$1) {
- function VueWrapper(vm, options) {
- var this$1 = this;
- Wrapper$$1.call(this, vm._vnode, options, true);
- // $FlowIgnore : issue with defineProperty
- Object.defineProperty(this, 'rootNode', {
- get: function () { return vm.$vnode || { child: this$1.vm }; },
- set: function () { return throwError('wrapper.vnode is read-only'); }
- });
- // $FlowIgnore : issue with defineProperty
- Object.defineProperty(this, 'vnode', {
- get: function () { return vm._vnode; },
- set: function () { return throwError('wrapper.vnode is read-only'); }
- });
- // $FlowIgnore
- Object.defineProperty(this, 'element', {
- get: function () { return vm.$el; },
- set: function () { return throwError('wrapper.element is read-only'); }
- });
- // $FlowIgnore
- Object.defineProperty(this, 'vm', {
- get: function () { return vm; },
- set: function () { return throwError('wrapper.vm is read-only'); }
- });
- if (options.sync === COMPAT_SYNC_MODE) {
- setWatchersToSync(vm);
- orderWatchers(vm);
- }
- this.isFunctionalComponent = vm.$options._isFunctionalContainer;
- this._emitted = vm.__emitted;
- this._emittedByOrder = vm.__emittedByOrder;
- }
- if ( Wrapper$$1 ) VueWrapper.__proto__ = Wrapper$$1;
- VueWrapper.prototype = Object.create( Wrapper$$1 && Wrapper$$1.prototype );
- VueWrapper.prototype.constructor = VueWrapper;
- return VueWrapper;
- }(Wrapper));
- //
- function createVNodes(vm, slotValue, name) {
- var el = vueTemplateCompiler.compileToFunctions(
- ("<div><template slot=" + name + ">" + slotValue + "</template></div>")
- );
- var _staticRenderFns = vm._renderProxy.$options.staticRenderFns;
- var _staticTrees = vm._renderProxy._staticTrees;
- vm._renderProxy._staticTrees = [];
- vm._renderProxy.$options.staticRenderFns = el.staticRenderFns;
- var vnode = el.render.call(vm._renderProxy, vm.$createElement);
- vm._renderProxy.$options.staticRenderFns = _staticRenderFns;
- vm._renderProxy._staticTrees = _staticTrees;
- return vnode.children[0]
- }
- function createVNodesForSlot(
- vm,
- slotValue,
- name
- ) {
- if (typeof slotValue === 'string') {
- return createVNodes(vm, slotValue, name)
- }
- var vnode = vm.$createElement(slotValue)
- ;(vnode.data || (vnode.data = {})).slot = name;
- return vnode
- }
- function createSlotVNodes(
- vm,
- slots
- ) {
- return Object.keys(slots).reduce(function (acc, key) {
- var content = slots[key];
- if (Array.isArray(content)) {
- var nodes = content.map(function (slotDef) { return createVNodesForSlot(vm, slotDef, key); }
- );
- return acc.concat(nodes)
- }
- return acc.concat(createVNodesForSlot(vm, content, key))
- }, [])
- }
- //
- function addMocks(
- _Vue,
- mockedProperties
- ) {
- if ( mockedProperties === void 0 ) mockedProperties = {};
- if (mockedProperties === false) {
- return
- }
- Object.keys(mockedProperties).forEach(function (key) {
- try {
- // $FlowIgnore
- _Vue.prototype[key] = mockedProperties[key];
- } catch (e) {
- warn(
- "could not overwrite property " + key + ", this is " +
- "usually caused by a plugin that has added " +
- "the property as a read-only value"
- );
- }
- // $FlowIgnore
- Vue.util.defineReactive(_Vue, key, mockedProperties[key]);
- });
- }
- //
- function logEvents(
- vm,
- emitted,
- emittedByOrder
- ) {
- var emit = vm.$emit;
- vm.$emit = function (name) {
- var args = [], len = arguments.length - 1;
- while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
- (emitted[name] || (emitted[name] = [])).push(args);
- emittedByOrder.push({ name: name, args: args });
- return emit.call.apply(emit, [ vm, name ].concat( args ))
- };
- }
- function addEventLogger(_Vue) {
- _Vue.mixin({
- beforeCreate: function() {
- this.__emitted = Object.create(null);
- this.__emittedByOrder = [];
- logEvents(this, this.__emitted, this.__emittedByOrder);
- }
- });
- }
- function addStubs(_Vue, stubComponents) {
- var obj;
- function addStubComponentsMixin() {
- Object.assign(this.$options.components, stubComponents);
- }
- _Vue.mixin(( obj = {}, obj[BEFORE_RENDER_LIFECYCLE_HOOK] = addStubComponentsMixin, obj));
- }
- //
- function compileFromString(str) {
- if (!vueTemplateCompiler.compileToFunctions) {
- throwError(
- "vueTemplateCompiler is undefined, you must pass " +
- "precompiled components if vue-template-compiler is " +
- "undefined"
- );
- }
- return vueTemplateCompiler.compileToFunctions(str)
- }
- function compileTemplate(component) {
- if (component.template) {
- Object.assign(component, vueTemplateCompiler.compileToFunctions(component.template));
- }
- if (component.components) {
- Object.keys(component.components).forEach(function (c) {
- var cmp = component.components[c];
- if (!cmp.render) {
- compileTemplate(cmp);
- }
- });
- }
- if (component.extends) {
- compileTemplate(component.extends);
- }
- if (component.extendOptions && !component.options.render) {
- compileTemplate(component.options);
- }
- }
- function compileTemplateForSlots(slots) {
- Object.keys(slots).forEach(function (key) {
- var slot = Array.isArray(slots[key]) ? slots[key] : [slots[key]];
- slot.forEach(function (slotValue) {
- if (componentNeedsCompiling(slotValue)) {
- compileTemplate(slotValue);
- }
- });
- });
- }
- //
- var MOUNTING_OPTIONS = [
- 'attachToDocument',
- 'mocks',
- 'slots',
- 'localVue',
- 'stubs',
- 'context',
- 'clone',
- 'attrs',
- 'listeners',
- 'propsData',
- 'sync',
- 'shouldProxy'
- ];
- function extractInstanceOptions(options) {
- var instanceOptions = Object.assign({}, options);
- MOUNTING_OPTIONS.forEach(function (mountingOption) {
- delete instanceOptions[mountingOption];
- });
- return instanceOptions
- }
- //
- function isDestructuringSlotScope(slotScope) {
- return slotScope[0] === '{' && slotScope[slotScope.length - 1] === '}'
- }
- function getVueTemplateCompilerHelpers(
- _Vue
- ) {
- // $FlowIgnore
- var vue = new _Vue();
- var helpers = {};
- var names = [
- '_c',
- '_o',
- '_n',
- '_s',
- '_l',
- '_t',
- '_q',
- '_i',
- '_m',
- '_f',
- '_k',
- '_b',
- '_v',
- '_e',
- '_u',
- '_g'
- ];
- names.forEach(function (name) {
- helpers[name] = vue._renderProxy[name];
- });
- helpers.$createElement = vue._renderProxy.$createElement;
- return helpers
- }
- function validateEnvironment() {
- if (VUE_VERSION < 2.1) {
- throwError("the scopedSlots option is only supported in vue@2.1+.");
- }
- }
- var slotScopeRe = /<[^>]+ slot-scope=\"(.+)\"/;
- // Hide warning about <template> disallowed as root element
- function customWarn(msg) {
- if (msg.indexOf('Cannot use <template> as component root element') === -1) {
- console.error(msg);
- }
- }
- function createScopedSlots(
- scopedSlotsOption,
- _Vue
- ) {
- var scopedSlots = {};
- if (!scopedSlotsOption) {
- return scopedSlots
- }
- validateEnvironment();
- var helpers = getVueTemplateCompilerHelpers(_Vue);
- var loop = function ( scopedSlotName ) {
- var slot = scopedSlotsOption[scopedSlotName];
- var isFn = typeof slot === 'function';
- // Type check to silence flow (can't use isFn)
- var renderFn =
- typeof slot === 'function'
- ? slot
- : vueTemplateCompiler.compileToFunctions(slot, { warn: customWarn }).render;
- var hasSlotScopeAttr = !isFn && slot.match(slotScopeRe);
- var slotScope = hasSlotScopeAttr && hasSlotScopeAttr[1];
- scopedSlots[scopedSlotName] = function(props) {
- var obj;
- var res;
- if (isFn) {
- res = renderFn.call(Object.assign({}, helpers), props);
- } else if (slotScope && !isDestructuringSlotScope(slotScope)) {
- res = renderFn.call(Object.assign({}, helpers, ( obj = {}, obj[slotScope] = props, obj)));
- } else if (slotScope && isDestructuringSlotScope(slotScope)) {
- res = renderFn.call(Object.assign({}, helpers, props));
- } else {
- res = renderFn.call(Object.assign({}, helpers, {props: props}));
- }
- // res is Array if <template> is a root element
- return Array.isArray(res) ? res[0] : res
- };
- };
- for (var scopedSlotName in scopedSlotsOption) loop( scopedSlotName );
- return scopedSlots
- }
- //
- function isVueComponentStub(comp) {
- return (comp && comp.template) || isVueComponent(comp)
- }
- function isValidStub(stub) {
- return (
- typeof stub === 'boolean' ||
- (!!stub && typeof stub === 'string') ||
- isVueComponentStub(stub)
- )
- }
- function resolveComponent$1(obj, component) {
- return (
- obj[component] ||
- obj[hyphenate(component)] ||
- obj[camelize(component)] ||
- obj[capitalize(camelize(component))] ||
- obj[capitalize(component)] ||
- {}
- )
- }
- function getCoreProperties(componentOptions) {
- return {
- attrs: componentOptions.attrs,
- name: componentOptions.name,
- props: componentOptions.props,
- on: componentOptions.on,
- key: componentOptions.key,
- ref: componentOptions.ref,
- domProps: componentOptions.domProps,
- class: componentOptions.class,
- staticClass: componentOptions.staticClass,
- staticStyle: componentOptions.staticStyle,
- style: componentOptions.style,
- normalizedStyle: componentOptions.normalizedStyle,
- nativeOn: componentOptions.nativeOn,
- functional: componentOptions.functional
- }
- }
- function createClassString(staticClass, dynamicClass) {
- if (staticClass && dynamicClass) {
- return staticClass + ' ' + dynamicClass
- }
- return staticClass || dynamicClass
- }
- function resolveOptions(component, _Vue) {
- if (isDynamicComponent(component)) {
- return {}
- }
- return isConstructor(component)
- ? component.options
- : _Vue.extend(component).options
- }
- function createStubFromComponent(
- originalComponent,
- name,
- _Vue
- ) {
- var componentOptions = resolveOptions(originalComponent, _Vue);
- var tagName = (name || 'anonymous') + "-stub";
- // ignoreElements does not exist in Vue 2.0.x
- if (Vue.config.ignoredElements) {
- Vue.config.ignoredElements.push(tagName);
- }
- return Object.assign({}, getCoreProperties(componentOptions),
- {$_vueTestUtils_original: originalComponent,
- $_doNotStubChildren: true,
- render: function render(h, context) {
- return h(
- tagName,
- {
- attrs: componentOptions.functional
- ? Object.assign({}, context.props,
- context.data.attrs,
- {class: createClassString(
- context.data.staticClass,
- context.data.class
- )})
- : Object.assign({}, this.$props)
- },
- context ? context.children : this.$options._renderChildren
- )
- }})
- }
- function createStubFromString(
- templateString,
- originalComponent,
- name,
- _Vue
- ) {
- if ( originalComponent === void 0 ) originalComponent = {};
- if (templateContainsComponent(templateString, name)) {
- throwError('options.stub cannot contain a circular reference');
- }
- var componentOptions = resolveOptions(originalComponent, _Vue);
- return Object.assign({}, getCoreProperties(componentOptions),
- {$_doNotStubChildren: true},
- compileFromString(templateString))
- }
- function validateStub(stub) {
- if (!isValidStub(stub)) {
- throwError("options.stub values must be passed a string or " + "component");
- }
- }
- function createStubsFromStubsObject(
- originalComponents,
- stubs,
- _Vue
- ) {
- if ( originalComponents === void 0 ) originalComponents = {};
- return Object.keys(stubs || {}).reduce(function (acc, stubName) {
- var stub = stubs[stubName];
- validateStub(stub);
- if (stub === false) {
- return acc
- }
- if (stub === true) {
- var component = resolveComponent$1(originalComponents, stubName);
- acc[stubName] = createStubFromComponent(component, stubName, _Vue);
- return acc
- }
- if (typeof stub === 'string') {
- var component$1 = resolveComponent$1(originalComponents, stubName);
- acc[stubName] = createStubFromString(stub, component$1, stubName, _Vue);
- return acc
- }
- if (componentNeedsCompiling(stub)) {
- compileTemplate(stub);
- }
- acc[stubName] = stub;
- return acc
- }, {})
- }
- var isWhitelisted = function (el, whitelist) { return resolveComponent(el, whitelist); };
- var isAlreadyStubbed = function (el, stubs) { return stubs.has(el); };
- function shouldExtend(component, _Vue) {
- return isConstructor(component) || (component && component.extends)
- }
- function extend(component, _Vue) {
- var componentOptions = component.options ? component.options : component;
- var stub = _Vue.extend(componentOptions);
- stub.options.$_vueTestUtils_original = component;
- stub.options._base = _Vue;
- return stub
- }
- function createStubIfNeeded(shouldStub, component, _Vue, el) {
- if (shouldStub) {
- return createStubFromComponent(component || {}, el, _Vue)
- }
- if (shouldExtend(component, _Vue)) {
- return extend(component, _Vue)
- }
- }
- function shouldNotBeStubbed(el, whitelist, modifiedComponents) {
- return (
- (typeof el === 'string' && isReservedTag(el)) ||
- isWhitelisted(el, whitelist) ||
- isAlreadyStubbed(el, modifiedComponents)
- )
- }
- function patchCreateElement(_Vue, stubs, stubAllComponents) {
- var obj;
- // This mixin patches vm.$createElement so that we can stub all components
- // before they are rendered in shallow mode. We also need to ensure that
- // component constructors were created from the _Vue constructor. If not,
- // we must replace them with components created from the _Vue constructor
- // before calling the original $createElement. This ensures that components
- // have the correct instance properties and stubs when they are rendered.
- function patchCreateElementMixin() {
- var vm = this;
- if (vm.$options.$_doNotStubChildren || vm.$options._isFunctionalContainer) {
- return
- }
- var modifiedComponents = new Set();
- var originalCreateElement = vm.$createElement;
- var originalComponents = vm.$options.components;
- var createElement = function (el) {
- var obj;
- var args = [], len = arguments.length - 1;
- while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
- if (shouldNotBeStubbed(el, stubs, modifiedComponents)) {
- return originalCreateElement.apply(void 0, [ el ].concat( args ))
- }
- if (isConstructor(el) || isComponentOptions(el)) {
- if (stubAllComponents) {
- var stub = createStubFromComponent(el, el.name || 'anonymous', _Vue);
- return originalCreateElement.apply(void 0, [ stub ].concat( args ))
- }
- var Constructor = shouldExtend(el, _Vue) ? extend(el, _Vue) : el;
- return originalCreateElement.apply(void 0, [ Constructor ].concat( args ))
- }
- if (typeof el === 'string') {
- var original = resolveComponent(el, originalComponents);
- if (!original) {
- return originalCreateElement.apply(void 0, [ el ].concat( args ))
- }
- if (isDynamicComponent(original)) {
- return originalCreateElement.apply(void 0, [ el ].concat( args ))
- }
- var stub$1 = createStubIfNeeded(stubAllComponents, original, _Vue, el);
- if (stub$1) {
- Object.assign(vm.$options.components, ( obj = {}, obj[el] = stub$1, obj));
- modifiedComponents.add(el);
- }
- }
- return originalCreateElement.apply(void 0, [ el ].concat( args ))
- };
- vm[CREATE_ELEMENT_ALIAS] = createElement;
- vm.$createElement = createElement;
- }
- _Vue.mixin(( obj = {}, obj[BEFORE_RENDER_LIFECYCLE_HOOK] = patchCreateElementMixin, obj));
- }
- //
- function createContext(options, scopedSlots) {
- var on = Object.assign({}, (options.context && options.context.on),
- options.listeners);
- return Object.assign({}, {attrs: Object.assign({}, options.attrs,
- // pass as attrs so that inheritAttrs works correctly
- // propsData should take precedence over attrs
- options.propsData)},
- (options.context || {}),
- {on: on,
- scopedSlots: scopedSlots})
- }
- function createChildren(vm, h, ref) {
- var slots = ref.slots;
- var context = ref.context;
- var slotVNodes = slots ? createSlotVNodes(vm, slots) : undefined;
- return (
- (context &&
- context.children &&
- context.children.map(function (x) { return (typeof x === 'function' ? x(h) : x); })) ||
- slotVNodes
- )
- }
- function createInstance(
- component,
- options,
- _Vue
- ) {
- var componentOptions = isConstructor(component)
- ? component.options
- : component;
- // instance options are options that are passed to the
- // root instance when it's instantiated
- var instanceOptions = extractInstanceOptions(options);
- var stubComponentsObject = createStubsFromStubsObject(
- componentOptions.components,
- // $FlowIgnore
- options.stubs,
- _Vue
- );
- addEventLogger(_Vue);
- addMocks(_Vue, options.mocks);
- addStubs(_Vue, stubComponentsObject);
- patchCreateElement(_Vue, stubComponentsObject, options.shouldProxy);
- if (componentNeedsCompiling(componentOptions)) {
- compileTemplate(componentOptions);
- }
- // used to identify extended component using constructor
- componentOptions.$_vueTestUtils_original = component;
- // make sure all extends are based on this instance
- var Constructor = _Vue.extend(componentOptions).extend(instanceOptions);
- Constructor.options._base = _Vue;
- var scopedSlots = createScopedSlots(options.scopedSlots, _Vue);
- var parentComponentOptions = options.parentComponent || {};
- parentComponentOptions.provide = options.provide;
- parentComponentOptions.$_doNotStubChildren = true;
- parentComponentOptions._isFunctionalContainer = componentOptions.functional;
- parentComponentOptions.render = function(h) {
- return h(
- Constructor,
- createContext(options, scopedSlots),
- createChildren(this, h, options)
- )
- };
- var Parent = _Vue.extend(parentComponentOptions);
- return new Parent()
- }
- //
- function createElement() {
- if (document) {
- var elem = document.createElement('div');
- if (document.body) {
- document.body.appendChild(elem);
- }
- return elem
- }
- }
- function normalizeStubs(stubs) {
- if ( stubs === void 0 ) stubs = {};
- if (stubs === false) {
- return false
- }
- if (isPlainObject(stubs)) {
- return stubs
- }
- if (Array.isArray(stubs)) {
- return stubs.reduce(function (acc, stub) {
- if (typeof stub !== 'string') {
- throwError('each item in an options.stubs array must be a string');
- }
- acc[stub] = true;
- return acc
- }, {})
- }
- throwError('options.stubs must be an object or an Array');
- }
- function normalizeProvide(provide) {
- // Objects are not resolved in extended components in Vue < 2.5
- // https://github.com/vuejs/vue/issues/6436
- if (typeof provide === 'object' && VUE_VERSION < 2.5) {
- var obj = Object.assign({}, provide);
- return function () { return obj; }
- }
- return provide
- }
- //
- function getOption(option, config) {
- if (option === false) {
- return false
- }
- if (option || (config && Object.keys(config).length > 0)) {
- if (option instanceof Function) {
- return option
- }
- if (config instanceof Function) {
- throw new Error("Config can't be a Function.")
- }
- return Object.assign({}, config,
- option)
- }
- }
- function mergeOptions(options, config) {
- var mocks = (getOption(options.mocks, config.mocks));
- var methods = (getOption(options.methods, config.methods));
- var provide = (getOption(options.provide, config.provide));
- return Object.assign({}, options,
- {provide: normalizeProvide(provide),
- stubs: getOption(normalizeStubs(options.stubs), config.stubs),
- mocks: mocks,
- methods: methods,
- sync: !!(options.sync || options.sync === undefined)})
- }
- //
- function warnIfNoWindow() {
- if (typeof window === 'undefined') {
- throwError(
- "window is undefined, vue-test-utils needs to be " +
- "run in a browser environment. \n" +
- "You can run the tests in node using jsdom \n" +
- "See https://vue-test-utils.vuejs.org/guides/#browser-environment " +
- "for more details."
- );
- }
- }
- /**
- * Removes all key-value entries from the list cache.
- *
- * @private
- * @name clear
- * @memberOf ListCache
- */
- function listCacheClear() {
- this.__data__ = [];
- this.size = 0;
- }
- var _listCacheClear = listCacheClear;
- /**
- * Performs a
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * comparison between two values to determine if they are equivalent.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- * @example
- *
- * var object = { 'a': 1 };
- * var other = { 'a': 1 };
- *
- * _.eq(object, object);
- * // => true
- *
- * _.eq(object, other);
- * // => false
- *
- * _.eq('a', 'a');
- * // => true
- *
- * _.eq('a', Object('a'));
- * // => false
- *
- * _.eq(NaN, NaN);
- * // => true
- */
- function eq(value, other) {
- return value === other || (value !== value && other !== other);
- }
- var eq_1 = eq;
- /**
- * Gets the index at which the `key` is found in `array` of key-value pairs.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {*} key The key to search for.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */
- function assocIndexOf(array, key) {
- var length = array.length;
- while (length--) {
- if (eq_1(array[length][0], key)) {
- return length;
- }
- }
- return -1;
- }
- var _assocIndexOf = assocIndexOf;
- /** Used for built-in method references. */
- var arrayProto = Array.prototype;
- /** Built-in value references. */
- var splice = arrayProto.splice;
- /**
- * Removes `key` and its value from the list cache.
- *
- * @private
- * @name delete
- * @memberOf ListCache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */
- function listCacheDelete(key) {
- var data = this.__data__,
- index = _assocIndexOf(data, key);
- if (index < 0) {
- return false;
- }
- var lastIndex = data.length - 1;
- if (index == lastIndex) {
- data.pop();
- } else {
- splice.call(data, index, 1);
- }
- --this.size;
- return true;
- }
- var _listCacheDelete = listCacheDelete;
- /**
- * Gets the list cache value for `key`.
- *
- * @private
- * @name get
- * @memberOf ListCache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */
- function listCacheGet(key) {
- var data = this.__data__,
- index = _assocIndexOf(data, key);
- return index < 0 ? undefined : data[index][1];
- }
- var _listCacheGet = listCacheGet;
- /**
- * Checks if a list cache value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf ListCache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */
- function listCacheHas(key) {
- return _assocIndexOf(this.__data__, key) > -1;
- }
- var _listCacheHas = listCacheHas;
- /**
- * Sets the list cache `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf ListCache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the list cache instance.
- */
- function listCacheSet(key, value) {
- var data = this.__data__,
- index = _assocIndexOf(data, key);
- if (index < 0) {
- ++this.size;
- data.push([key, value]);
- } else {
- data[index][1] = value;
- }
- return this;
- }
- var _listCacheSet = listCacheSet;
- /**
- * Creates an list cache object.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */
- function ListCache(entries) {
- var this$1 = this;
- var index = -1,
- length = entries == null ? 0 : entries.length;
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this$1.set(entry[0], entry[1]);
- }
- }
- // Add methods to `ListCache`.
- ListCache.prototype.clear = _listCacheClear;
- ListCache.prototype['delete'] = _listCacheDelete;
- ListCache.prototype.get = _listCacheGet;
- ListCache.prototype.has = _listCacheHas;
- ListCache.prototype.set = _listCacheSet;
- var _ListCache = ListCache;
- /**
- * Removes all key-value entries from the stack.
- *
- * @private
- * @name clear
- * @memberOf Stack
- */
- function stackClear() {
- this.__data__ = new _ListCache;
- this.size = 0;
- }
- var _stackClear = stackClear;
- /**
- * Removes `key` and its value from the stack.
- *
- * @private
- * @name delete
- * @memberOf Stack
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */
- function stackDelete(key) {
- var data = this.__data__,
- result = data['delete'](key);
- this.size = data.size;
- return result;
- }
- var _stackDelete = stackDelete;
- /**
- * Gets the stack value for `key`.
- *
- * @private
- * @name get
- * @memberOf Stack
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */
- function stackGet(key) {
- return this.__data__.get(key);
- }
- var _stackGet = stackGet;
- /**
- * Checks if a stack value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf Stack
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */
- function stackHas(key) {
- return this.__data__.has(key);
- }
- var _stackHas = stackHas;
- /** Detect free variable `global` from Node.js. */
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
- var _freeGlobal = freeGlobal;
- /** Detect free variable `self`. */
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
- /** Used as a reference to the global object. */
- var root = _freeGlobal || freeSelf || Function('return this')();
- var _root = root;
- /** Built-in value references. */
- var Symbol = _root.Symbol;
- var _Symbol = Symbol;
- /** Used for built-in method references. */
- var objectProto = Object.prototype;
- /** Used to check objects for own properties. */
- var hasOwnProperty$1 = objectProto.hasOwnProperty;
- /**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */
- var nativeObjectToString = objectProto.toString;
- /** Built-in value references. */
- var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
- /**
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the raw `toStringTag`.
- */
- function getRawTag(value) {
- var isOwn = hasOwnProperty$1.call(value, symToStringTag),
- tag = value[symToStringTag];
- try {
- value[symToStringTag] = undefined;
- var unmasked = true;
- } catch (e) {}
- var result = nativeObjectToString.call(value);
- if (unmasked) {
- if (isOwn) {
- value[symToStringTag] = tag;
- } else {
- delete value[symToStringTag];
- }
- }
- return result;
- }
- var _getRawTag = getRawTag;
- /** Used for built-in method references. */
- var objectProto$1 = Object.prototype;
- /**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */
- var nativeObjectToString$1 = objectProto$1.toString;
- /**
- * Converts `value` to a string using `Object.prototype.toString`.
- *
- * @private
- * @param {*} value The value to convert.
- * @returns {string} Returns the converted string.
- */
- function objectToString(value) {
- return nativeObjectToString$1.call(value);
- }
- var _objectToString = objectToString;
- /** `Object#toString` result references. */
- var nullTag = '[object Null]',
- undefinedTag = '[object Undefined]';
- /** Built-in value references. */
- var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
- /**
- * The base implementation of `getTag` without fallbacks for buggy environments.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */
- function baseGetTag(value) {
- if (value == null) {
- return value === undefined ? undefinedTag : nullTag;
- }
- return (symToStringTag$1 && symToStringTag$1 in Object(value))
- ? _getRawTag(value)
- : _objectToString(value);
- }
- var _baseGetTag = baseGetTag;
- /**
- * Checks if `value` is the
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */
- function isObject(value) {
- var type = typeof value;
- return value != null && (type == 'object' || type == 'function');
- }
- var isObject_1 = isObject;
- /** `Object#toString` result references. */
- var asyncTag = '[object AsyncFunction]',
- funcTag = '[object Function]',
- genTag = '[object GeneratorFunction]',
- proxyTag = '[object Proxy]';
- /**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */
- function isFunction(value) {
- if (!isObject_1(value)) {
- return false;
- }
- // The use of `Object#toString` avoids issues with the `typeof` operator
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
- var tag = _baseGetTag(value);
- return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
- }
- var isFunction_1 = isFunction;
- /** Used to detect overreaching core-js shims. */
- var coreJsData = _root['__core-js_shared__'];
- var _coreJsData = coreJsData;
- /** Used to detect methods masquerading as native. */
- var maskSrcKey = (function() {
- var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || '');
- return uid ? ('Symbol(src)_1.' + uid) : '';
- }());
- /**
- * Checks if `func` has its source masked.
- *
- * @private
- * @param {Function} func The function to check.
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
- */
- function isMasked(func) {
- return !!maskSrcKey && (maskSrcKey in func);
- }
- var _isMasked = isMasked;
- /** Used for built-in method references. */
- var funcProto = Function.prototype;
- /** Used to resolve the decompiled source of functions. */
- var funcToString = funcProto.toString;
- /**
- * Converts `func` to its source code.
- *
- * @private
- * @param {Function} func The function to convert.
- * @returns {string} Returns the source code.
- */
- function toSource(func) {
- if (func != null) {
- try {
- return funcToString.call(func);
- } catch (e) {}
- try {
- return (func + '');
- } catch (e) {}
- }
- return '';
- }
- var _toSource = toSource;
- /**
- * Used to match `RegExp`
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
- */
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
- /** Used to detect host constructors (Safari). */
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
- /** Used for built-in method references. */
- var funcProto$1 = Function.prototype,
- objectProto$2 = Object.prototype;
- /** Used to resolve the decompiled source of functions. */
- var funcToString$1 = funcProto$1.toString;
- /** Used to check objects for own properties. */
- var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
- /** Used to detect if a method is native. */
- var reIsNative = RegExp('^' +
- funcToString$1.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&')
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
- );
- /**
- * The base implementation of `_.isNative` without bad shim checks.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a native function,
- * else `false`.
- */
- function baseIsNative(value) {
- if (!isObject_1(value) || _isMasked(value)) {
- return false;
- }
- var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor;
- return pattern.test(_toSource(value));
- }
- var _baseIsNative = baseIsNative;
- /**
- * Gets the value at `key` of `object`.
- *
- * @private
- * @param {Object} [object] The object to query.
- * @param {string} key The key of the property to get.
- * @returns {*} Returns the property value.
- */
- function getValue(object, key) {
- return object == null ? undefined : object[key];
- }
- var _getValue = getValue;
- /**
- * Gets the native function at `key` of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {string} key The key of the method to get.
- * @returns {*} Returns the function if it's native, else `undefined`.
- */
- function getNative(object, key) {
- var value = _getValue(object, key);
- return _baseIsNative(value) ? value : undefined;
- }
- var _getNative = getNative;
- /* Built-in method references that are verified to be native. */
- var Map = _getNative(_root, 'Map');
- var _Map = Map;
- /* Built-in method references that are verified to be native. */
- var nativeCreate = _getNative(Object, 'create');
- var _nativeCreate = nativeCreate;
- /**
- * Removes all key-value entries from the hash.
- *
- * @private
- * @name clear
- * @memberOf Hash
- */
- function hashClear() {
- this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
- this.size = 0;
- }
- var _hashClear = hashClear;
- /**
- * Removes `key` and its value from the hash.
- *
- * @private
- * @name delete
- * @memberOf Hash
- * @param {Object} hash The hash to modify.
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */
- function hashDelete(key) {
- var result = this.has(key) && delete this.__data__[key];
- this.size -= result ? 1 : 0;
- return result;
- }
- var _hashDelete = hashDelete;
- /** Used to stand-in for `undefined` hash values. */
- var HASH_UNDEFINED = '__lodash_hash_undefined__';
- /** Used for built-in method references. */
- var objectProto$3 = Object.prototype;
- /** Used to check objects for own properties. */
- var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
- /**
- * Gets the hash value for `key`.
- *
- * @private
- * @name get
- * @memberOf Hash
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */
- function hashGet(key) {
- var data = this.__data__;
- if (_nativeCreate) {
- var result = data[key];
- return result === HASH_UNDEFINED ? undefined : result;
- }
- return hasOwnProperty$3.call(data, key) ? data[key] : undefined;
- }
- var _hashGet = hashGet;
- /** Used for built-in method references. */
- var objectProto$4 = Object.prototype;
- /** Used to check objects for own properties. */
- var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
- /**
- * Checks if a hash value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf Hash
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */
- function hashHas(key) {
- var data = this.__data__;
- return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$4.call(data, key);
- }
- var _hashHas = hashHas;
- /** Used to stand-in for `undefined` hash values. */
- var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
- /**
- * Sets the hash `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf Hash
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the hash instance.
- */
- function hashSet(key, value) {
- var data = this.__data__;
- this.size += this.has(key) ? 0 : 1;
- data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
- return this;
- }
- var _hashSet = hashSet;
- /**
- * Creates a hash object.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */
- function Hash(entries) {
- var this$1 = this;
- var index = -1,
- length = entries == null ? 0 : entries.length;
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this$1.set(entry[0], entry[1]);
- }
- }
- // Add methods to `Hash`.
- Hash.prototype.clear = _hashClear;
- Hash.prototype['delete'] = _hashDelete;
- Hash.prototype.get = _hashGet;
- Hash.prototype.has = _hashHas;
- Hash.prototype.set = _hashSet;
- var _Hash = Hash;
- /**
- * Removes all key-value entries from the map.
- *
- * @private
- * @name clear
- * @memberOf MapCache
- */
- function mapCacheClear() {
- this.size = 0;
- this.__data__ = {
- 'hash': new _Hash,
- 'map': new (_Map || _ListCache),
- 'string': new _Hash
- };
- }
- var _mapCacheClear = mapCacheClear;
- /**
- * Checks if `value` is suitable for use as unique object key.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
- */
- function isKeyable(value) {
- var type = typeof value;
- return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
- ? (value !== '__proto__')
- : (value === null);
- }
- var _isKeyable = isKeyable;
- /**
- * Gets the data for `map`.
- *
- * @private
- * @param {Object} map The map to query.
- * @param {string} key The reference key.
- * @returns {*} Returns the map data.
- */
- function getMapData(map, key) {
- var data = map.__data__;
- return _isKeyable(key)
- ? data[typeof key == 'string' ? 'string' : 'hash']
- : data.map;
- }
- var _getMapData = getMapData;
- /**
- * Removes `key` and its value from the map.
- *
- * @private
- * @name delete
- * @memberOf MapCache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */
- function mapCacheDelete(key) {
- var result = _getMapData(this, key)['delete'](key);
- this.size -= result ? 1 : 0;
- return result;
- }
- var _mapCacheDelete = mapCacheDelete;
- /**
- * Gets the map value for `key`.
- *
- * @private
- * @name get
- * @memberOf MapCache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */
- function mapCacheGet(key) {
- return _getMapData(this, key).get(key);
- }
- var _mapCacheGet = mapCacheGet;
- /**
- * Checks if a map value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf MapCache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */
- function mapCacheHas(key) {
- return _getMapData(this, key).has(key);
- }
- var _mapCacheHas = mapCacheHas;
- /**
- * Sets the map `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf MapCache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the map cache instance.
- */
- function mapCacheSet(key, value) {
- var data = _getMapData(this, key),
- size = data.size;
- data.set(key, value);
- this.size += data.size == size ? 0 : 1;
- return this;
- }
- var _mapCacheSet = mapCacheSet;
- /**
- * Creates a map cache object to store key-value pairs.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */
- function MapCache(entries) {
- var this$1 = this;
- var index = -1,
- length = entries == null ? 0 : entries.length;
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this$1.set(entry[0], entry[1]);
- }
- }
- // Add methods to `MapCache`.
- MapCache.prototype.clear = _mapCacheClear;
- MapCache.prototype['delete'] = _mapCacheDelete;
- MapCache.prototype.get = _mapCacheGet;
- MapCache.prototype.has = _mapCacheHas;
- MapCache.prototype.set = _mapCacheSet;
- var _MapCache = MapCache;
- /** Used as the size to enable large array optimizations. */
- var LARGE_ARRAY_SIZE = 200;
- /**
- * Sets the stack `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf Stack
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the stack cache instance.
- */
- function stackSet(key, value) {
- var data = this.__data__;
- if (data instanceof _ListCache) {
- var pairs = data.__data__;
- if (!_Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
- pairs.push([key, value]);
- this.size = ++data.size;
- return this;
- }
- data = this.__data__ = new _MapCache(pairs);
- }
- data.set(key, value);
- this.size = data.size;
- return this;
- }
- var _stackSet = stackSet;
- /**
- * Creates a stack cache object to store key-value pairs.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */
- function Stack(entries) {
- var data = this.__data__ = new _ListCache(entries);
- this.size = data.size;
- }
- // Add methods to `Stack`.
- Stack.prototype.clear = _stackClear;
- Stack.prototype['delete'] = _stackDelete;
- Stack.prototype.get = _stackGet;
- Stack.prototype.has = _stackHas;
- Stack.prototype.set = _stackSet;
- var _Stack = Stack;
- /**
- * A specialized version of `_.forEach` for arrays without support for
- * iteratee shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns `array`.
- */
- function arrayEach(array, iteratee) {
- var index = -1,
- length = array == null ? 0 : array.length;
- while (++index < length) {
- if (iteratee(array[index], index, array) === false) {
- break;
- }
- }
- return array;
- }
- var _arrayEach = arrayEach;
- var defineProperty = (function() {
- try {
- var func = _getNative(Object, 'defineProperty');
- func({}, '', {});
- return func;
- } catch (e) {}
- }());
- var _defineProperty = defineProperty;
- /**
- * The base implementation of `assignValue` and `assignMergeValue` without
- * value checks.
- *
- * @private
- * @param {Object} object The object to modify.
- * @param {string} key The key of the property to assign.
- * @param {*} value The value to assign.
- */
- function baseAssignValue(object, key, value) {
- if (key == '__proto__' && _defineProperty) {
- _defineProperty(object, key, {
- 'configurable': true,
- 'enumerable': true,
- 'value': value,
- 'writable': true
- });
- } else {
- object[key] = value;
- }
- }
- var _baseAssignValue = baseAssignValue;
- /** Used for built-in method references. */
- var objectProto$5 = Object.prototype;
- /** Used to check objects for own properties. */
- var hasOwnProperty$5 = objectProto$5.hasOwnProperty;
- /**
- * Assigns `value` to `key` of `object` if the existing value is not equivalent
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * for equality comparisons.
- *
- * @private
- * @param {Object} object The object to modify.
- * @param {string} key The key of the property to assign.
- * @param {*} value The value to assign.
- */
- function assignValue(object, key, value) {
- var objValue = object[key];
- if (!(hasOwnProperty$5.call(object, key) && eq_1(objValue, value)) ||
- (value === undefined && !(key in object))) {
- _baseAssignValue(object, key, value);
- }
- }
- var _assignValue = assignValue;
- /**
- * Copies properties of `source` to `object`.
- *
- * @private
- * @param {Object} source The object to copy properties from.
- * @param {Array} props The property identifiers to copy.
- * @param {Object} [object={}] The object to copy properties to.
- * @param {Function} [customizer] The function to customize copied values.
- * @returns {Object} Returns `object`.
- */
- function copyObject(source, props, object, customizer) {
- var isNew = !object;
- object || (object = {});
- var index = -1,
- length = props.length;
- while (++index < length) {
- var key = props[index];
- var newValue = customizer
- ? customizer(object[key], source[key], key, object, source)
- : undefined;
- if (newValue === undefined) {
- newValue = source[key];
- }
- if (isNew) {
- _baseAssignValue(object, key, newValue);
- } else {
- _assignValue(object, key, newValue);
- }
- }
- return object;
- }
- var _copyObject = copyObject;
- /**
- * The base implementation of `_.times` without support for iteratee shorthands
- * or max array length checks.
- *
- * @private
- * @param {number} n The number of times to invoke `iteratee`.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the array of results.
- */
- function baseTimes(n, iteratee) {
- var index = -1,
- result = Array(n);
- while (++index < n) {
- result[index] = iteratee(index);
- }
- return result;
- }
- var _baseTimes = baseTimes;
- /**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */
- function isObjectLike(value) {
- return value != null && typeof value == 'object';
- }
- var isObjectLike_1 = isObjectLike;
- /** `Object#toString` result references. */
- var argsTag = '[object Arguments]';
- /**
- * The base implementation of `_.isArguments`.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- */
- function baseIsArguments(value) {
- return isObjectLike_1(value) && _baseGetTag(value) == argsTag;
- }
- var _baseIsArguments = baseIsArguments;
- /** Used for built-in method references. */
- var objectProto$6 = Object.prototype;
- /** Used to check objects for own properties. */
- var hasOwnProperty$6 = objectProto$6.hasOwnProperty;
- /** Built-in value references. */
- var propertyIsEnumerable = objectProto$6.propertyIsEnumerable;
- /**
- * Checks if `value` is likely an `arguments` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- * else `false`.
- * @example
- *
- * _.isArguments(function() { return arguments; }());
- * // => true
- *
- * _.isArguments([1, 2, 3]);
- * // => false
- */
- var isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {
- return isObjectLike_1(value) && hasOwnProperty$6.call(value, 'callee') &&
- !propertyIsEnumerable.call(value, 'callee');
- };
- var isArguments_1 = isArguments;
- /**
- * Checks if `value` is classified as an `Array` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
- * @example
- *
- * _.isArray([1, 2, 3]);
- * // => true
- *
- * _.isArray(document.body.children);
- * // => false
- *
- * _.isArray('abc');
- * // => false
- *
- * _.isArray(_.noop);
- * // => false
- */
- var isArray = Array.isArray;
- var isArray_1 = isArray;
- /**
- * This method returns `false`.
- *
- * @static
- * @memberOf _
- * @since 4.13.0
- * @category Util
- * @returns {boolean} Returns `false`.
- * @example
- *
- * _.times(2, _.stubFalse);
- * // => [false, false]
- */
- function stubFalse() {
- return false;
- }
- var stubFalse_1 = stubFalse;
- var isBuffer_1 = createCommonjsModule(function (module, exports) {
- /** Detect free variable `exports`. */
- var freeExports = 'object' == 'object' && exports && !exports.nodeType && exports;
- /** Detect free variable `module`. */
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
- /** Detect the popular CommonJS extension `module.exports`. */
- var moduleExports = freeModule && freeModule.exports === freeExports;
- /** Built-in value references. */
- var Buffer = moduleExports ? _root.Buffer : undefined;
- /* Built-in method references for those with the same name as other `lodash` methods. */
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
- /**
- * Checks if `value` is a buffer.
- *
- * @static
- * @memberOf _
- * @since 4.3.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
- * @example
- *
- * _.isBuffer(new Buffer(2));
- * // => true
- *
- * _.isBuffer(new Uint8Array(2));
- * // => false
- */
- var isBuffer = nativeIsBuffer || stubFalse_1;
- module.exports = isBuffer;
- });
- /** Used as references for various `Number` constants. */
- var MAX_SAFE_INTEGER = 9007199254740991;
- /** Used to detect unsigned integer values. */
- var reIsUint = /^(?:0|[1-9]\d*)$/;
- /**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */
- function isIndex(value, length) {
- length = length == null ? MAX_SAFE_INTEGER : length;
- return !!length &&
- (typeof value == 'number' || reIsUint.test(value)) &&
- (value > -1 && value % 1 == 0 && value < length);
- }
- var _isIndex = isIndex;
- /** Used as references for various `Number` constants. */
- var MAX_SAFE_INTEGER$1 = 9007199254740991;
- /**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This method is loosely based on
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- * @example
- *
- * _.isLength(3);
- * // => true
- *
- * _.isLength(Number.MIN_VALUE);
- * // => false
- *
- * _.isLength(Infinity);
- * // => false
- *
- * _.isLength('3');
- * // => false
- */
- function isLength(value) {
- return typeof value == 'number' &&
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
- }
- var isLength_1 = isLength;
- /** `Object#toString` result references. */
- var argsTag$1 = '[object Arguments]',
- arrayTag = '[object Array]',
- boolTag = '[object Boolean]',
- dateTag = '[object Date]',
- errorTag = '[object Error]',
- funcTag$1 = '[object Function]',
- mapTag = '[object Map]',
- numberTag = '[object Number]',
- objectTag = '[object Object]',
- regexpTag = '[object RegExp]',
- setTag = '[object Set]',
- stringTag = '[object String]',
- weakMapTag = '[object WeakMap]';
- var arrayBufferTag = '[object ArrayBuffer]',
- dataViewTag = '[object DataView]',
- float32Tag = '[object Float32Array]',
- float64Tag = '[object Float64Array]',
- int8Tag = '[object Int8Array]',
- int16Tag = '[object Int16Array]',
- int32Tag = '[object Int32Array]',
- uint8Tag = '[object Uint8Array]',
- uint8ClampedTag = '[object Uint8ClampedArray]',
- uint16Tag = '[object Uint16Array]',
- uint32Tag = '[object Uint32Array]';
- /** Used to identify `toStringTag` values of typed arrays. */
- var typedArrayTags = {};
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
- typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
- typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
- typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
- typedArrayTags[uint32Tag] = true;
- typedArrayTags[argsTag$1] = typedArrayTags[arrayTag] =
- typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
- typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
- typedArrayTags[errorTag] = typedArrayTags[funcTag$1] =
- typedArrayTags[mapTag] = typedArrayTags[numberTag] =
- typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
- typedArrayTags[setTag] = typedArrayTags[stringTag] =
- typedArrayTags[weakMapTag] = false;
- /**
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
- */
- function baseIsTypedArray(value) {
- return isObjectLike_1(value) &&
- isLength_1(value.length) && !!typedArrayTags[_baseGetTag(value)];
- }
- var _baseIsTypedArray = baseIsTypedArray;
- /**
- * The base implementation of `_.unary` without support for storing metadata.
- *
- * @private
- * @param {Function} func The function to cap arguments for.
- * @returns {Function} Returns the new capped function.
- */
- function baseUnary(func) {
- return function(value) {
- return func(value);
- };
- }
- var _baseUnary = baseUnary;
- var _nodeUtil = createCommonjsModule(function (module, exports) {
- /** Detect free variable `exports`. */
- var freeExports = 'object' == 'object' && exports && !exports.nodeType && exports;
- /** Detect free variable `module`. */
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
- /** Detect the popular CommonJS extension `module.exports`. */
- var moduleExports = freeModule && freeModule.exports === freeExports;
- /** Detect free variable `process` from Node.js. */
- var freeProcess = moduleExports && _freeGlobal.process;
- /** Used to access faster Node.js helpers. */
- var nodeUtil = (function() {
- try {
- return freeProcess && freeProcess.binding && freeProcess.binding('util');
- } catch (e) {}
- }());
- module.exports = nodeUtil;
- });
- /* Node.js helper references. */
- var nodeIsTypedArray = _nodeUtil && _nodeUtil.isTypedArray;
- /**
- * Checks if `value` is classified as a typed array.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
- * @example
- *
- * _.isTypedArray(new Uint8Array);
- * // => true
- *
- * _.isTypedArray([]);
- * // => false
- */
- var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsTypedArray;
- var isTypedArray_1 = isTypedArray;
- /** Used for built-in method references. */
- var objectProto$7 = Object.prototype;
- /** Used to check objects for own properties. */
- var hasOwnProperty$7 = objectProto$7.hasOwnProperty;
- /**
- * Creates an array of the enumerable property names of the array-like `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @param {boolean} inherited Specify returning inherited property names.
- * @returns {Array} Returns the array of property names.
- */
- function arrayLikeKeys(value, inherited) {
- var isArr = isArray_1(value),
- isArg = !isArr && isArguments_1(value),
- isBuff = !isArr && !isArg && isBuffer_1(value),
- isType = !isArr && !isArg && !isBuff && isTypedArray_1(value),
- skipIndexes = isArr || isArg || isBuff || isType,
- result = skipIndexes ? _baseTimes(value.length, String) : [],
- length = result.length;
- for (var key in value) {
- if ((inherited || hasOwnProperty$7.call(value, key)) &&
- !(skipIndexes && (
- // Safari 9 has enumerable `arguments.length` in strict mode.
- key == 'length' ||
- // Node.js 0.10 has enumerable non-index properties on buffers.
- (isBuff && (key == 'offset' || key == 'parent')) ||
- // PhantomJS 2 has enumerable non-index properties on typed arrays.
- (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
- // Skip index properties.
- _isIndex(key, length)
- ))) {
- result.push(key);
- }
- }
- return result;
- }
- var _arrayLikeKeys = arrayLikeKeys;
- /** Used for built-in method references. */
- var objectProto$8 = Object.prototype;
- /**
- * Checks if `value` is likely a prototype object.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
- */
- function isPrototype(value) {
- var Ctor = value && value.constructor,
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$8;
- return value === proto;
- }
- var _isPrototype = isPrototype;
- /**
- * Creates a unary function that invokes `func` with its argument transformed.
- *
- * @private
- * @param {Function} func The function to wrap.
- * @param {Function} transform The argument transform.
- * @returns {Function} Returns the new function.
- */
- function overArg(func, transform) {
- return function(arg) {
- return func(transform(arg));
- };
- }
- var _overArg = overArg;
- /* Built-in method references for those with the same name as other `lodash` methods. */
- var nativeKeys = _overArg(Object.keys, Object);
- var _nativeKeys = nativeKeys;
- /** Used for built-in method references. */
- var objectProto$9 = Object.prototype;
- /** Used to check objects for own properties. */
- var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
- /**
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */
- function baseKeys(object) {
- if (!_isPrototype(object)) {
- return _nativeKeys(object);
- }
- var result = [];
- for (var key in Object(object)) {
- if (hasOwnProperty$8.call(object, key) && key != 'constructor') {
- result.push(key);
- }
- }
- return result;
- }
- var _baseKeys = baseKeys;
- /**
- * Checks if `value` is array-like. A value is considered array-like if it's
- * not a function and has a `value.length` that's an integer greater than or
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- * @example
- *
- * _.isArrayLike([1, 2, 3]);
- * // => true
- *
- * _.isArrayLike(document.body.children);
- * // => true
- *
- * _.isArrayLike('abc');
- * // => true
- *
- * _.isArrayLike(_.noop);
- * // => false
- */
- function isArrayLike(value) {
- return value != null && isLength_1(value.length) && !isFunction_1(value);
- }
- var isArrayLike_1 = isArrayLike;
- /**
- * Creates an array of the own enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects. See the
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
- * for more details.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keys(new Foo);
- * // => ['a', 'b'] (iteration order is not guaranteed)
- *
- * _.keys('hi');
- * // => ['0', '1']
- */
- function keys(object) {
- return isArrayLike_1(object) ? _arrayLikeKeys(object) : _baseKeys(object);
- }
- var keys_1 = keys;
- /**
- * The base implementation of `_.assign` without support for multiple sources
- * or `customizer` functions.
- *
- * @private
- * @param {Object} object The destination object.
- * @param {Object} source The source object.
- * @returns {Object} Returns `object`.
- */
- function baseAssign(object, source) {
- return object && _copyObject(source, keys_1(source), object);
- }
- var _baseAssign = baseAssign;
- /**
- * This function is like
- * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
- * except that it includes inherited enumerable properties.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */
- function nativeKeysIn(object) {
- var result = [];
- if (object != null) {
- for (var key in Object(object)) {
- result.push(key);
- }
- }
- return result;
- }
- var _nativeKeysIn = nativeKeysIn;
- /** Used for built-in method references. */
- var objectProto$10 = Object.prototype;
- /** Used to check objects for own properties. */
- var hasOwnProperty$9 = objectProto$10.hasOwnProperty;
- /**
- * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */
- function baseKeysIn(object) {
- if (!isObject_1(object)) {
- return _nativeKeysIn(object);
- }
- var isProto = _isPrototype(object),
- result = [];
- for (var key in object) {
- if (!(key == 'constructor' && (isProto || !hasOwnProperty$9.call(object, key)))) {
- result.push(key);
- }
- }
- return result;
- }
- var _baseKeysIn = baseKeysIn;
- /**
- * Creates an array of the own and inherited enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keysIn(new Foo);
- * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
- */
- function keysIn$1(object) {
- return isArrayLike_1(object) ? _arrayLikeKeys(object, true) : _baseKeysIn(object);
- }
- var keysIn_1 = keysIn$1;
- /**
- * The base implementation of `_.assignIn` without support for multiple sources
- * or `customizer` functions.
- *
- * @private
- * @param {Object} object The destination object.
- * @param {Object} source The source object.
- * @returns {Object} Returns `object`.
- */
- function baseAssignIn(object, source) {
- return object && _copyObject(source, keysIn_1(source), object);
- }
- var _baseAssignIn = baseAssignIn;
- var _cloneBuffer = createCommonjsModule(function (module, exports) {
- /** Detect free variable `exports`. */
- var freeExports = 'object' == 'object' && exports && !exports.nodeType && exports;
- /** Detect free variable `module`. */
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
- /** Detect the popular CommonJS extension `module.exports`. */
- var moduleExports = freeModule && freeModule.exports === freeExports;
- /** Built-in value references. */
- var Buffer = moduleExports ? _root.Buffer : undefined,
- allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
- /**
- * Creates a clone of `buffer`.
- *
- * @private
- * @param {Buffer} buffer The buffer to clone.
- * @param {boolean} [isDeep] Specify a deep clone.
- * @returns {Buffer} Returns the cloned buffer.
- */
- function cloneBuffer(buffer, isDeep) {
- if (isDeep) {
- return buffer.slice();
- }
- var length = buffer.length,
- result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
- buffer.copy(result);
- return result;
- }
- module.exports = cloneBuffer;
- });
- /**
- * Copies the values of `source` to `array`.
- *
- * @private
- * @param {Array} source The array to copy values from.
- * @param {Array} [array=[]] The array to copy values to.
- * @returns {Array} Returns `array`.
- */
- function copyArray(source, array) {
- var index = -1,
- length = source.length;
- array || (array = Array(length));
- while (++index < length) {
- array[index] = source[index];
- }
- return array;
- }
- var _copyArray = copyArray;
- /**
- * A specialized version of `_.filter` for arrays without support for
- * iteratee shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} predicate The function invoked per iteration.
- * @returns {Array} Returns the new filtered array.
- */
- function arrayFilter(array, predicate) {
- var index = -1,
- length = array == null ? 0 : array.length,
- resIndex = 0,
- result = [];
- while (++index < length) {
- var value = array[index];
- if (predicate(value, index, array)) {
- result[resIndex++] = value;
- }
- }
- return result;
- }
- var _arrayFilter = arrayFilter;
- /**
- * This method returns a new empty array.
- *
- * @static
- * @memberOf _
- * @since 4.13.0
- * @category Util
- * @returns {Array} Returns the new empty array.
- * @example
- *
- * var arrays = _.times(2, _.stubArray);
- *
- * console.log(arrays);
- * // => [[], []]
- *
- * console.log(arrays[0] === arrays[1]);
- * // => false
- */
- function stubArray() {
- return [];
- }
- var stubArray_1 = stubArray;
- /** Used for built-in method references. */
- var objectProto$11 = Object.prototype;
- /** Built-in value references. */
- var propertyIsEnumerable$1 = objectProto$11.propertyIsEnumerable;
- /* Built-in method references for those with the same name as other `lodash` methods. */
- var nativeGetSymbols = Object.getOwnPropertySymbols;
- /**
- * Creates an array of the own enumerable symbols of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of symbols.
- */
- var getSymbols = !nativeGetSymbols ? stubArray_1 : function(object) {
- if (object == null) {
- return [];
- }
- object = Object(object);
- return _arrayFilter(nativeGetSymbols(object), function(symbol) {
- return propertyIsEnumerable$1.call(object, symbol);
- });
- };
- var _getSymbols = getSymbols;
- /**
- * Copies own symbols of `source` to `object`.
- *
- * @private
- * @param {Object} source The object to copy symbols from.
- * @param {Object} [object={}] The object to copy symbols to.
- * @returns {Object} Returns `object`.
- */
- function copySymbols(source, object) {
- return _copyObject(source, _getSymbols(source), object);
- }
- var _copySymbols = copySymbols;
- /**
- * Appends the elements of `values` to `array`.
- *
- * @private
- * @param {Array} array The array to modify.
- * @param {Array} values The values to append.
- * @returns {Array} Returns `array`.
- */
- function arrayPush(array, values) {
- var index = -1,
- length = values.length,
- offset = array.length;
- while (++index < length) {
- array[offset + index] = values[index];
- }
- return array;
- }
- var _arrayPush = arrayPush;
- /** Built-in value references. */
- var getPrototype = _overArg(Object.getPrototypeOf, Object);
- var _getPrototype = getPrototype;
- /* Built-in method references for those with the same name as other `lodash` methods. */
- var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
- /**
- * Creates an array of the own and inherited enumerable symbols of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of symbols.
- */
- var getSymbolsIn = !nativeGetSymbols$1 ? stubArray_1 : function(object) {
- var result = [];
- while (object) {
- _arrayPush(result, _getSymbols(object));
- object = _getPrototype(object);
- }
- return result;
- };
- var _getSymbolsIn = getSymbolsIn;
- /**
- * Copies own and inherited symbols of `source` to `object`.
- *
- * @private
- * @param {Object} source The object to copy symbols from.
- * @param {Object} [object={}] The object to copy symbols to.
- * @returns {Object} Returns `object`.
- */
- function copySymbolsIn(source, object) {
- return _copyObject(source, _getSymbolsIn(source), object);
- }
- var _copySymbolsIn = copySymbolsIn;
- /**
- * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
- * `keysFunc` and `symbolsFunc` to get the enumerable property names and
- * symbols of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Function} keysFunc The function to get the keys of `object`.
- * @param {Function} symbolsFunc The function to get the symbols of `object`.
- * @returns {Array} Returns the array of property names and symbols.
- */
- function baseGetAllKeys(object, keysFunc, symbolsFunc) {
- var result = keysFunc(object);
- return isArray_1(object) ? result : _arrayPush(result, symbolsFunc(object));
- }
- var _baseGetAllKeys = baseGetAllKeys;
- /**
- * Creates an array of own enumerable property names and symbols of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names and symbols.
- */
- function getAllKeys(object) {
- return _baseGetAllKeys(object, keys_1, _getSymbols);
- }
- var _getAllKeys = getAllKeys;
- /**
- * Creates an array of own and inherited enumerable property names and
- * symbols of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names and symbols.
- */
- function getAllKeysIn(object) {
- return _baseGetAllKeys(object, keysIn_1, _getSymbolsIn);
- }
- var _getAllKeysIn = getAllKeysIn;
- /* Built-in method references that are verified to be native. */
- var DataView = _getNative(_root, 'DataView');
- var _DataView = DataView;
- /* Built-in method references that are verified to be native. */
- var Promise = _getNative(_root, 'Promise');
- var _Promise = Promise;
- /* Built-in method references that are verified to be native. */
- var Set$1 = _getNative(_root, 'Set');
- var _Set = Set$1;
- /* Built-in method references that are verified to be native. */
- var WeakMap = _getNative(_root, 'WeakMap');
- var _WeakMap = WeakMap;
- /** `Object#toString` result references. */
- var mapTag$1 = '[object Map]',
- objectTag$1 = '[object Object]',
- promiseTag = '[object Promise]',
- setTag$1 = '[object Set]',
- weakMapTag$1 = '[object WeakMap]';
- var dataViewTag$1 = '[object DataView]';
- /** Used to detect maps, sets, and weakmaps. */
- var dataViewCtorString = _toSource(_DataView),
- mapCtorString = _toSource(_Map),
- promiseCtorString = _toSource(_Promise),
- setCtorString = _toSource(_Set),
- weakMapCtorString = _toSource(_WeakMap);
- /**
- * Gets the `toStringTag` of `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */
- var getTag = _baseGetTag;
- // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
- if ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag$1) ||
- (_Map && getTag(new _Map) != mapTag$1) ||
- (_Promise && getTag(_Promise.resolve()) != promiseTag) ||
- (_Set && getTag(new _Set) != setTag$1) ||
- (_WeakMap && getTag(new _WeakMap) != weakMapTag$1)) {
- getTag = function(value) {
- var result = _baseGetTag(value),
- Ctor = result == objectTag$1 ? value.constructor : undefined,
- ctorString = Ctor ? _toSource(Ctor) : '';
- if (ctorString) {
- switch (ctorString) {
- case dataViewCtorString: return dataViewTag$1;
- case mapCtorString: return mapTag$1;
- case promiseCtorString: return promiseTag;
- case setCtorString: return setTag$1;
- case weakMapCtorString: return weakMapTag$1;
- }
- }
- return result;
- };
- }
- var _getTag = getTag;
- /** Used for built-in method references. */
- var objectProto$12 = Object.prototype;
- /** Used to check objects for own properties. */
- var hasOwnProperty$10 = objectProto$12.hasOwnProperty;
- /**
- * Initializes an array clone.
- *
- * @private
- * @param {Array} array The array to clone.
- * @returns {Array} Returns the initialized clone.
- */
- function initCloneArray(array) {
- var length = array.length,
- result = array.constructor(length);
- // Add properties assigned by `RegExp#exec`.
- if (length && typeof array[0] == 'string' && hasOwnProperty$10.call(array, 'index')) {
- result.index = array.index;
- result.input = array.input;
- }
- return result;
- }
- var _initCloneArray = initCloneArray;
- /** Built-in value references. */
- var Uint8Array = _root.Uint8Array;
- var _Uint8Array = Uint8Array;
- /**
- * Creates a clone of `arrayBuffer`.
- *
- * @private
- * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
- * @returns {ArrayBuffer} Returns the cloned array buffer.
- */
- function cloneArrayBuffer(arrayBuffer) {
- var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
- new _Uint8Array(result).set(new _Uint8Array(arrayBuffer));
- return result;
- }
- var _cloneArrayBuffer = cloneArrayBuffer;
- /**
- * Creates a clone of `dataView`.
- *
- * @private
- * @param {Object} dataView The data view to clone.
- * @param {boolean} [isDeep] Specify a deep clone.
- * @returns {Object} Returns the cloned data view.
- */
- function cloneDataView(dataView, isDeep) {
- var buffer = isDeep ? _cloneArrayBuffer(dataView.buffer) : dataView.buffer;
- return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
- }
- var _cloneDataView = cloneDataView;
- /**
- * Adds the key-value `pair` to `map`.
- *
- * @private
- * @param {Object} map The map to modify.
- * @param {Array} pair The key-value pair to add.
- * @returns {Object} Returns `map`.
- */
- function addMapEntry(map, pair) {
- // Don't return `map.set` because it's not chainable in IE 11.
- map.set(pair[0], pair[1]);
- return map;
- }
- var _addMapEntry = addMapEntry;
- /**
- * A specialized version of `_.reduce` for arrays without support for
- * iteratee shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @param {*} [accumulator] The initial value.
- * @param {boolean} [initAccum] Specify using the first element of `array` as
- * the initial value.
- * @returns {*} Returns the accumulated value.
- */
- function arrayReduce(array, iteratee, accumulator, initAccum) {
- var index = -1,
- length = array == null ? 0 : array.length;
- if (initAccum && length) {
- accumulator = array[++index];
- }
- while (++index < length) {
- accumulator = iteratee(accumulator, array[index], index, array);
- }
- return accumulator;
- }
- var _arrayReduce = arrayReduce;
- /**
- * Converts `map` to its key-value pairs.
- *
- * @private
- * @param {Object} map The map to convert.
- * @returns {Array} Returns the key-value pairs.
- */
- function mapToArray(map) {
- var index = -1,
- result = Array(map.size);
- map.forEach(function(value, key) {
- result[++index] = [key, value];
- });
- return result;
- }
- var _mapToArray = mapToArray;
- /** Used to compose bitmasks for cloning. */
- var CLONE_DEEP_FLAG = 1;
- /**
- * Creates a clone of `map`.
- *
- * @private
- * @param {Object} map The map to clone.
- * @param {Function} cloneFunc The function to clone values.
- * @param {boolean} [isDeep] Specify a deep clone.
- * @returns {Object} Returns the cloned map.
- */
- function cloneMap(map, isDeep, cloneFunc) {
- var array = isDeep ? cloneFunc(_mapToArray(map), CLONE_DEEP_FLAG) : _mapToArray(map);
- return _arrayReduce(array, _addMapEntry, new map.constructor);
- }
- var _cloneMap = cloneMap;
- /** Used to match `RegExp` flags from their coerced string values. */
- var reFlags = /\w*$/;
- /**
- * Creates a clone of `regexp`.
- *
- * @private
- * @param {Object} regexp The regexp to clone.
- * @returns {Object} Returns the cloned regexp.
- */
- function cloneRegExp(regexp) {
- var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
- result.lastIndex = regexp.lastIndex;
- return result;
- }
- var _cloneRegExp = cloneRegExp;
- /**
- * Adds `value` to `set`.
- *
- * @private
- * @param {Object} set The set to modify.
- * @param {*} value The value to add.
- * @returns {Object} Returns `set`.
- */
- function addSetEntry(set, value) {
- // Don't return `set.add` because it's not chainable in IE 11.
- set.add(value);
- return set;
- }
- var _addSetEntry = addSetEntry;
- /**
- * Converts `set` to an array of its values.
- *
- * @private
- * @param {Object} set The set to convert.
- * @returns {Array} Returns the values.
- */
- function setToArray(set) {
- var index = -1,
- result = Array(set.size);
- set.forEach(function(value) {
- result[++index] = value;
- });
- return result;
- }
- var _setToArray = setToArray;
- /** Used to compose bitmasks for cloning. */
- var CLONE_DEEP_FLAG$1 = 1;
- /**
- * Creates a clone of `set`.
- *
- * @private
- * @param {Object} set The set to clone.
- * @param {Function} cloneFunc The function to clone values.
- * @param {boolean} [isDeep] Specify a deep clone.
- * @returns {Object} Returns the cloned set.
- */
- function cloneSet(set, isDeep, cloneFunc) {
- var array = isDeep ? cloneFunc(_setToArray(set), CLONE_DEEP_FLAG$1) : _setToArray(set);
- return _arrayReduce(array, _addSetEntry, new set.constructor);
- }
- var _cloneSet = cloneSet;
- /** Used to convert symbols to primitives and strings. */
- var symbolProto = _Symbol ? _Symbol.prototype : undefined,
- symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
- /**
- * Creates a clone of the `symbol` object.
- *
- * @private
- * @param {Object} symbol The symbol object to clone.
- * @returns {Object} Returns the cloned symbol object.
- */
- function cloneSymbol(symbol) {
- return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
- }
- var _cloneSymbol = cloneSymbol;
- /**
- * Creates a clone of `typedArray`.
- *
- * @private
- * @param {Object} typedArray The typed array to clone.
- * @param {boolean} [isDeep] Specify a deep clone.
- * @returns {Object} Returns the cloned typed array.
- */
- function cloneTypedArray(typedArray, isDeep) {
- var buffer = isDeep ? _cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
- return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
- }
- var _cloneTypedArray = cloneTypedArray;
- /** `Object#toString` result references. */
- var boolTag$1 = '[object Boolean]',
- dateTag$1 = '[object Date]',
- mapTag$2 = '[object Map]',
- numberTag$1 = '[object Number]',
- regexpTag$1 = '[object RegExp]',
- setTag$2 = '[object Set]',
- stringTag$1 = '[object String]',
- symbolTag = '[object Symbol]';
- var arrayBufferTag$1 = '[object ArrayBuffer]',
- dataViewTag$2 = '[object DataView]',
- float32Tag$1 = '[object Float32Array]',
- float64Tag$1 = '[object Float64Array]',
- int8Tag$1 = '[object Int8Array]',
- int16Tag$1 = '[object Int16Array]',
- int32Tag$1 = '[object Int32Array]',
- uint8Tag$1 = '[object Uint8Array]',
- uint8ClampedTag$1 = '[object Uint8ClampedArray]',
- uint16Tag$1 = '[object Uint16Array]',
- uint32Tag$1 = '[object Uint32Array]';
- /**
- * Initializes an object clone based on its `toStringTag`.
- *
- * **Note:** This function only supports cloning values with tags of
- * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
- *
- * @private
- * @param {Object} object The object to clone.
- * @param {string} tag The `toStringTag` of the object to clone.
- * @param {Function} cloneFunc The function to clone values.
- * @param {boolean} [isDeep] Specify a deep clone.
- * @returns {Object} Returns the initialized clone.
- */
- function initCloneByTag(object, tag, cloneFunc, isDeep) {
- var Ctor = object.constructor;
- switch (tag) {
- case arrayBufferTag$1:
- return _cloneArrayBuffer(object);
- case boolTag$1:
- case dateTag$1:
- return new Ctor(+object);
- case dataViewTag$2:
- return _cloneDataView(object, isDeep);
- case float32Tag$1: case float64Tag$1:
- case int8Tag$1: case int16Tag$1: case int32Tag$1:
- case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1:
- return _cloneTypedArray(object, isDeep);
- case mapTag$2:
- return _cloneMap(object, isDeep, cloneFunc);
- case numberTag$1:
- case stringTag$1:
- return new Ctor(object);
- case regexpTag$1:
- return _cloneRegExp(object);
- case setTag$2:
- return _cloneSet(object, isDeep, cloneFunc);
- case symbolTag:
- return _cloneSymbol(object);
- }
- }
- var _initCloneByTag = initCloneByTag;
- /** Built-in value references. */
- var objectCreate = Object.create;
- /**
- * The base implementation of `_.create` without support for assigning
- * properties to the created object.
- *
- * @private
- * @param {Object} proto The object to inherit from.
- * @returns {Object} Returns the new object.
- */
- var baseCreate = (function() {
- function object() {}
- return function(proto) {
- if (!isObject_1(proto)) {
- return {};
- }
- if (objectCreate) {
- return objectCreate(proto);
- }
- object.prototype = proto;
- var result = new object;
- object.prototype = undefined;
- return result;
- };
- }());
- var _baseCreate = baseCreate;
- /**
- * Initializes an object clone.
- *
- * @private
- * @param {Object} object The object to clone.
- * @returns {Object} Returns the initialized clone.
- */
- function initCloneObject(object) {
- return (typeof object.constructor == 'function' && !_isPrototype(object))
- ? _baseCreate(_getPrototype(object))
- : {};
- }
- var _initCloneObject = initCloneObject;
- /** Used to compose bitmasks for cloning. */
- var CLONE_DEEP_FLAG$2 = 1,
- CLONE_FLAT_FLAG = 2,
- CLONE_SYMBOLS_FLAG = 4;
- /** `Object#toString` result references. */
- var argsTag$2 = '[object Arguments]',
- arrayTag$1 = '[object Array]',
- boolTag$2 = '[object Boolean]',
- dateTag$2 = '[object Date]',
- errorTag$1 = '[object Error]',
- funcTag$2 = '[object Function]',
- genTag$1 = '[object GeneratorFunction]',
- mapTag$3 = '[object Map]',
- numberTag$2 = '[object Number]',
- objectTag$2 = '[object Object]',
- regexpTag$2 = '[object RegExp]',
- setTag$3 = '[object Set]',
- stringTag$2 = '[object String]',
- symbolTag$1 = '[object Symbol]',
- weakMapTag$2 = '[object WeakMap]';
- var arrayBufferTag$2 = '[object ArrayBuffer]',
- dataViewTag$3 = '[object DataView]',
- float32Tag$2 = '[object Float32Array]',
- float64Tag$2 = '[object Float64Array]',
- int8Tag$2 = '[object Int8Array]',
- int16Tag$2 = '[object Int16Array]',
- int32Tag$2 = '[object Int32Array]',
- uint8Tag$2 = '[object Uint8Array]',
- uint8ClampedTag$2 = '[object Uint8ClampedArray]',
- uint16Tag$2 = '[object Uint16Array]',
- uint32Tag$2 = '[object Uint32Array]';
- /** Used to identify `toStringTag` values supported by `_.clone`. */
- var cloneableTags = {};
- cloneableTags[argsTag$2] = cloneableTags[arrayTag$1] =
- cloneableTags[arrayBufferTag$2] = cloneableTags[dataViewTag$3] =
- cloneableTags[boolTag$2] = cloneableTags[dateTag$2] =
- cloneableTags[float32Tag$2] = cloneableTags[float64Tag$2] =
- cloneableTags[int8Tag$2] = cloneableTags[int16Tag$2] =
- cloneableTags[int32Tag$2] = cloneableTags[mapTag$3] =
- cloneableTags[numberTag$2] = cloneableTags[objectTag$2] =
- cloneableTags[regexpTag$2] = cloneableTags[setTag$3] =
- cloneableTags[stringTag$2] = cloneableTags[symbolTag$1] =
- cloneableTags[uint8Tag$2] = cloneableTags[uint8ClampedTag$2] =
- cloneableTags[uint16Tag$2] = cloneableTags[uint32Tag$2] = true;
- cloneableTags[errorTag$1] = cloneableTags[funcTag$2] =
- cloneableTags[weakMapTag$2] = false;
- /**
- * The base implementation of `_.clone` and `_.cloneDeep` which tracks
- * traversed objects.
- *
- * @private
- * @param {*} value The value to clone.
- * @param {boolean} bitmask The bitmask flags.
- * 1 - Deep clone
- * 2 - Flatten inherited properties
- * 4 - Clone symbols
- * @param {Function} [customizer] The function to customize cloning.
- * @param {string} [key] The key of `value`.
- * @param {Object} [object] The parent object of `value`.
- * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
- * @returns {*} Returns the cloned value.
- */
- function baseClone(value, bitmask, customizer, key, object, stack) {
- var result,
- isDeep = bitmask & CLONE_DEEP_FLAG$2,
- isFlat = bitmask & CLONE_FLAT_FLAG,
- isFull = bitmask & CLONE_SYMBOLS_FLAG;
- if (customizer) {
- result = object ? customizer(value, key, object, stack) : customizer(value);
- }
- if (result !== undefined) {
- return result;
- }
- if (!isObject_1(value)) {
- return value;
- }
- var isArr = isArray_1(value);
- if (isArr) {
- result = _initCloneArray(value);
- if (!isDeep) {
- return _copyArray(value, result);
- }
- } else {
- var tag = _getTag(value),
- isFunc = tag == funcTag$2 || tag == genTag$1;
- if (isBuffer_1(value)) {
- return _cloneBuffer(value, isDeep);
- }
- if (tag == objectTag$2 || tag == argsTag$2 || (isFunc && !object)) {
- result = (isFlat || isFunc) ? {} : _initCloneObject(value);
- if (!isDeep) {
- return isFlat
- ? _copySymbolsIn(value, _baseAssignIn(result, value))
- : _copySymbols(value, _baseAssign(result, value));
- }
- } else {
- if (!cloneableTags[tag]) {
- return object ? value : {};
- }
- result = _initCloneByTag(value, tag, baseClone, isDeep);
- }
- }
- // Check for circular references and return its corresponding clone.
- stack || (stack = new _Stack);
- var stacked = stack.get(value);
- if (stacked) {
- return stacked;
- }
- stack.set(value, result);
- var keysFunc = isFull
- ? (isFlat ? _getAllKeysIn : _getAllKeys)
- : (isFlat ? keysIn : keys_1);
- var props = isArr ? undefined : keysFunc(value);
- _arrayEach(props || value, function(subValue, key) {
- if (props) {
- key = subValue;
- subValue = value[key];
- }
- // Recursively populate clone (susceptible to call stack limits).
- _assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
- });
- return result;
- }
- var _baseClone = baseClone;
- /** Used to compose bitmasks for cloning. */
- var CLONE_DEEP_FLAG$3 = 1,
- CLONE_SYMBOLS_FLAG$1 = 4;
- /**
- * This method is like `_.clone` except that it recursively clones `value`.
- *
- * @static
- * @memberOf _
- * @since 1.0.0
- * @category Lang
- * @param {*} value The value to recursively clone.
- * @returns {*} Returns the deep cloned value.
- * @see _.clone
- * @example
- *
- * var objects = [{ 'a': 1 }, { 'b': 2 }];
- *
- * var deep = _.cloneDeep(objects);
- * console.log(deep[0] === objects[0]);
- * // => false
- */
- function cloneDeep(value) {
- return _baseClone(value, CLONE_DEEP_FLAG$3 | CLONE_SYMBOLS_FLAG$1);
- }
- var cloneDeep_1 = cloneDeep;
- //
- function createLocalVue(_Vue) {
- if ( _Vue === void 0 ) _Vue = Vue;
- var instance = _Vue.extend();
- // clone global APIs
- Object.keys(_Vue).forEach(function (key) {
- if (!instance.hasOwnProperty(key)) {
- var original = _Vue[key];
- // cloneDeep can fail when cloning Vue instances
- // cloneDeep checks that the instance has a Symbol
- // which errors in Vue < 2.17 (https://github.com/vuejs/vue/pull/7878)
- try {
- instance[key] =
- typeof original === 'object' ? cloneDeep_1(original) : original;
- } catch (e) {
- instance[key] = original;
- }
- }
- });
- // config is not enumerable
- instance.config = cloneDeep_1(Vue.config);
- instance.config.errorHandler = Vue.config.errorHandler;
- // option merge strategies need to be exposed by reference
- // so that merge strats registered by plugins can work properly
- instance.config.optionMergeStrategies = Vue.config.optionMergeStrategies;
- // make sure all extends are based on this instance.
- // this is important so that global components registered by plugins,
- // e.g. router-link are created using the correct base constructor
- instance.options._base = instance;
- // compat for vue-router < 2.7.1 where it does not allow multiple installs
- if (instance._installedPlugins && instance._installedPlugins.length) {
- instance._installedPlugins.length = 0;
- }
- var use = instance.use;
- instance.use = function (plugin) {
- var rest = [], len = arguments.length - 1;
- while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ];
- if (plugin.installed === true) {
- plugin.installed = false;
- }
- if (plugin.install && plugin.install.installed === true) {
- plugin.install.installed = false;
- }
- use.call.apply(use, [ instance, plugin ].concat( rest ));
- };
- return instance
- }
- var semver$1 = createCommonjsModule(function (module, exports) {
- exports = module.exports = SemVer;
- // The debug function is excluded entirely from the minified version.
- /* nomin */ var debug;
- /* nomin */ if (typeof process === 'object' &&
- /* nomin */ process.env &&
- /* nomin */ process.env.NODE_DEBUG &&
- /* nomin */ /\bsemver\b/i.test(process.env.NODE_DEBUG))
- /* nomin */ { debug = function() {
- /* nomin */ var args = Array.prototype.slice.call(arguments, 0);
- /* nomin */ args.unshift('SEMVER');
- /* nomin */ console.log.apply(console, args);
- /* nomin */ }; }
- /* nomin */ else
- /* nomin */ { debug = function() {}; }
- // Note: this is the semver.org version of the spec that it implements
- // Not necessarily the package version of this code.
- exports.SEMVER_SPEC_VERSION = '2.0.0';
- var MAX_LENGTH = 256;
- var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
- // Max safe segment length for coercion.
- var MAX_SAFE_COMPONENT_LENGTH = 16;
- // The actual regexps go on exports.re
- var re = exports.re = [];
- var src = exports.src = [];
- var R = 0;
- // The following Regular Expressions can be used for tokenizing,
- // validating, and parsing SemVer version strings.
- // ## Numeric Identifier
- // A single `0`, or a non-zero digit followed by zero or more digits.
- var NUMERICIDENTIFIER = R++;
- src[NUMERICIDENTIFIER] = '0|[1-9]\\d*';
- var NUMERICIDENTIFIERLOOSE = R++;
- src[NUMERICIDENTIFIERLOOSE] = '[0-9]+';
- // ## Non-numeric Identifier
- // Zero or more digits, followed by a letter or hyphen, and then zero or
- // more letters, digits, or hyphens.
- var NONNUMERICIDENTIFIER = R++;
- src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*';
- // ## Main Version
- // Three dot-separated numeric identifiers.
- var MAINVERSION = R++;
- src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' +
- '(' + src[NUMERICIDENTIFIER] + ')\\.' +
- '(' + src[NUMERICIDENTIFIER] + ')';
- var MAINVERSIONLOOSE = R++;
- src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
- '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
- '(' + src[NUMERICIDENTIFIERLOOSE] + ')';
- // ## Pre-release Version Identifier
- // A numeric identifier, or a non-numeric identifier.
- var PRERELEASEIDENTIFIER = R++;
- src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] +
- '|' + src[NONNUMERICIDENTIFIER] + ')';
- var PRERELEASEIDENTIFIERLOOSE = R++;
- src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] +
- '|' + src[NONNUMERICIDENTIFIER] + ')';
- // ## Pre-release Version
- // Hyphen, followed by one or more dot-separated pre-release version
- // identifiers.
- var PRERELEASE = R++;
- src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] +
- '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))';
- var PRERELEASELOOSE = R++;
- src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] +
- '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))';
- // ## Build Metadata Identifier
- // Any combination of digits, letters, or hyphens.
- var BUILDIDENTIFIER = R++;
- src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+';
- // ## Build Metadata
- // Plus sign, followed by one or more period-separated build metadata
- // identifiers.
- var BUILD = R++;
- src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] +
- '(?:\\.' + src[BUILDIDENTIFIER] + ')*))';
- // ## Full Version String
- // A main version, followed optionally by a pre-release version and
- // build metadata.
- // Note that the only major, minor, patch, and pre-release sections of
- // the version string are capturing groups. The build metadata is not a
- // capturing group, because it should not ever be used in version
- // comparison.
- var FULL = R++;
- var FULLPLAIN = 'v?' + src[MAINVERSION] +
- src[PRERELEASE] + '?' +
- src[BUILD] + '?';
- src[FULL] = '^' + FULLPLAIN + '$';
- // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
- // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
- // common in the npm registry.
- var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] +
- src[PRERELEASELOOSE] + '?' +
- src[BUILD] + '?';
- var LOOSE = R++;
- src[LOOSE] = '^' + LOOSEPLAIN + '$';
- var GTLT = R++;
- src[GTLT] = '((?:<|>)?=?)';
- // Something like "2.*" or "1.2.x".
- // Note that "x.x" is a valid xRange identifer, meaning "any version"
- // Only the first item is strictly required.
- var XRANGEIDENTIFIERLOOSE = R++;
- src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*';
- var XRANGEIDENTIFIER = R++;
- src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*';
- var XRANGEPLAIN = R++;
- src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' +
- '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
- '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
- '(?:' + src[PRERELEASE] + ')?' +
- src[BUILD] + '?' +
- ')?)?';
- var XRANGEPLAINLOOSE = R++;
- src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
- '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
- '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
- '(?:' + src[PRERELEASELOOSE] + ')?' +
- src[BUILD] + '?' +
- ')?)?';
- var XRANGE = R++;
- src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$';
- var XRANGELOOSE = R++;
- src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$';
- // Coercion.
- // Extract anything that could conceivably be a part of a valid semver
- var COERCE = R++;
- src[COERCE] = '(?:^|[^\\d])' +
- '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' +
- '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
- '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
- '(?:$|[^\\d])';
- // Tilde ranges.
- // Meaning is "reasonably at or greater than"
- var LONETILDE = R++;
- src[LONETILDE] = '(?:~>?)';
- var TILDETRIM = R++;
- src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+';
- re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g');
- var tildeTrimReplace = '$1~';
- var TILDE = R++;
- src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$';
- var TILDELOOSE = R++;
- src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$';
- // Caret ranges.
- // Meaning is "at least and backwards compatible with"
- var LONECARET = R++;
- src[LONECARET] = '(?:\\^)';
- var CARETTRIM = R++;
- src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+';
- re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g');
- var caretTrimReplace = '$1^';
- var CARET = R++;
- src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$';
- var CARETLOOSE = R++;
- src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$';
- // A simple gt/lt/eq thing, or just "" to indicate "any version"
- var COMPARATORLOOSE = R++;
- src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$';
- var COMPARATOR = R++;
- src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$';
- // An expression to strip any whitespace between the gtlt and the thing
- // it modifies, so that `> 1.2.3` ==> `>1.2.3`
- var COMPARATORTRIM = R++;
- src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] +
- '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')';
- // this one has to use the /g flag
- re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g');
- var comparatorTrimReplace = '$1$2$3';
- // Something like `1.2.3 - 1.2.4`
- // Note that these all use the loose form, because they'll be
- // checked against either the strict or loose comparator form
- // later.
- var HYPHENRANGE = R++;
- src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' +
- '\\s+-\\s+' +
- '(' + src[XRANGEPLAIN] + ')' +
- '\\s*$';
- var HYPHENRANGELOOSE = R++;
- src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' +
- '\\s+-\\s+' +
- '(' + src[XRANGEPLAINLOOSE] + ')' +
- '\\s*$';
- // Star ranges basically just allow anything at all.
- var STAR = R++;
- src[STAR] = '(<|>)?=?\\s*\\*';
- // Compile to actual regexp objects.
- // All are flag-free, unless they were created above with a flag.
- for (var i = 0; i < R; i++) {
- debug(i, src[i]);
- if (!re[i])
- { re[i] = new RegExp(src[i]); }
- }
- exports.parse = parse;
- function parse(version, loose) {
- if (version instanceof SemVer)
- { return version; }
- if (typeof version !== 'string')
- { return null; }
- if (version.length > MAX_LENGTH)
- { return null; }
- var r = loose ? re[LOOSE] : re[FULL];
- if (!r.test(version))
- { return null; }
- try {
- return new SemVer(version, loose);
- } catch (er) {
- return null;
- }
- }
- exports.valid = valid;
- function valid(version, loose) {
- var v = parse(version, loose);
- return v ? v.version : null;
- }
- exports.clean = clean;
- function clean(version, loose) {
- var s = parse(version.trim().replace(/^[=v]+/, ''), loose);
- return s ? s.version : null;
- }
- exports.SemVer = SemVer;
- function SemVer(version, loose) {
- if (version instanceof SemVer) {
- if (version.loose === loose)
- { return version; }
- else
- { version = version.version; }
- } else if (typeof version !== 'string') {
- throw new TypeError('Invalid Version: ' + version);
- }
- if (version.length > MAX_LENGTH)
- { throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') }
- if (!(this instanceof SemVer))
- { return new SemVer(version, loose); }
- debug('SemVer', version, loose);
- this.loose = loose;
- var m = version.trim().match(loose ? re[LOOSE] : re[FULL]);
- if (!m)
- { throw new TypeError('Invalid Version: ' + version); }
- this.raw = version;
- // these are actually numbers
- this.major = +m[1];
- this.minor = +m[2];
- this.patch = +m[3];
- if (this.major > MAX_SAFE_INTEGER || this.major < 0)
- { throw new TypeError('Invalid major version') }
- if (this.minor > MAX_SAFE_INTEGER || this.minor < 0)
- { throw new TypeError('Invalid minor version') }
- if (this.patch > MAX_SAFE_INTEGER || this.patch < 0)
- { throw new TypeError('Invalid patch version') }
- // numberify any prerelease numeric ids
- if (!m[4])
- { this.prerelease = []; }
- else
- { this.prerelease = m[4].split('.').map(function(id) {
- if (/^[0-9]+$/.test(id)) {
- var num = +id;
- if (num >= 0 && num < MAX_SAFE_INTEGER)
- { return num; }
- }
- return id;
- }); }
- this.build = m[5] ? m[5].split('.') : [];
- this.format();
- }
- SemVer.prototype.format = function() {
- this.version = this.major + '.' + this.minor + '.' + this.patch;
- if (this.prerelease.length)
- { this.version += '-' + this.prerelease.join('.'); }
- return this.version;
- };
- SemVer.prototype.toString = function() {
- return this.version;
- };
- SemVer.prototype.compare = function(other) {
- debug('SemVer.compare', this.version, this.loose, other);
- if (!(other instanceof SemVer))
- { other = new SemVer(other, this.loose); }
- return this.compareMain(other) || this.comparePre(other);
- };
- SemVer.prototype.compareMain = function(other) {
- if (!(other instanceof SemVer))
- { other = new SemVer(other, this.loose); }
- return compareIdentifiers(this.major, other.major) ||
- compareIdentifiers(this.minor, other.minor) ||
- compareIdentifiers(this.patch, other.patch);
- };
- SemVer.prototype.comparePre = function(other) {
- var this$1 = this;
- if (!(other instanceof SemVer))
- { other = new SemVer(other, this.loose); }
- // NOT having a prerelease is > having one
- if (this.prerelease.length && !other.prerelease.length)
- { return -1; }
- else if (!this.prerelease.length && other.prerelease.length)
- { return 1; }
- else if (!this.prerelease.length && !other.prerelease.length)
- { return 0; }
- var i = 0;
- do {
- var a = this$1.prerelease[i];
- var b = other.prerelease[i];
- debug('prerelease compare', i, a, b);
- if (a === undefined && b === undefined)
- { return 0; }
- else if (b === undefined)
- { return 1; }
- else if (a === undefined)
- { return -1; }
- else if (a === b)
- { continue; }
- else
- { return compareIdentifiers(a, b); }
- } while (++i);
- };
- // preminor will bump the version up to the next minor release, and immediately
- // down to pre-release. premajor and prepatch work the same way.
- SemVer.prototype.inc = function(release, identifier) {
- var this$1 = this;
- switch (release) {
- case 'premajor':
- this.prerelease.length = 0;
- this.patch = 0;
- this.minor = 0;
- this.major++;
- this.inc('pre', identifier);
- break;
- case 'preminor':
- this.prerelease.length = 0;
- this.patch = 0;
- this.minor++;
- this.inc('pre', identifier);
- break;
- case 'prepatch':
- // If this is already a prerelease, it will bump to the next version
- // drop any prereleases that might already exist, since they are not
- // relevant at this point.
- this.prerelease.length = 0;
- this.inc('patch', identifier);
- this.inc('pre', identifier);
- break;
- // If the input is a non-prerelease version, this acts the same as
- // prepatch.
- case 'prerelease':
- if (this.prerelease.length === 0)
- { this.inc('patch', identifier); }
- this.inc('pre', identifier);
- break;
- case 'major':
- // If this is a pre-major version, bump up to the same major version.
- // Otherwise increment major.
- // 1.0.0-5 bumps to 1.0.0
- // 1.1.0 bumps to 2.0.0
- if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0)
- { this.major++; }
- this.minor = 0;
- this.patch = 0;
- this.prerelease = [];
- break;
- case 'minor':
- // If this is a pre-minor version, bump up to the same minor version.
- // Otherwise increment minor.
- // 1.2.0-5 bumps to 1.2.0
- // 1.2.1 bumps to 1.3.0
- if (this.patch !== 0 || this.prerelease.length === 0)
- { this.minor++; }
- this.patch = 0;
- this.prerelease = [];
- break;
- case 'patch':
- // If this is not a pre-release version, it will increment the patch.
- // If it is a pre-release it will bump up to the same patch version.
- // 1.2.0-5 patches to 1.2.0
- // 1.2.0 patches to 1.2.1
- if (this.prerelease.length === 0)
- { this.patch++; }
- this.prerelease = [];
- break;
- // This probably shouldn't be used publicly.
- // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
- case 'pre':
- if (this.prerelease.length === 0)
- { this.prerelease = [0]; }
- else {
- var i = this.prerelease.length;
- while (--i >= 0) {
- if (typeof this$1.prerelease[i] === 'number') {
- this$1.prerelease[i]++;
- i = -2;
- }
- }
- if (i === -1) // didn't increment anything
- { this.prerelease.push(0); }
- }
- if (identifier) {
- // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
- // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
- if (this.prerelease[0] === identifier) {
- if (isNaN(this.prerelease[1]))
- { this.prerelease = [identifier, 0]; }
- } else
- { this.prerelease = [identifier, 0]; }
- }
- break;
- default:
- throw new Error('invalid increment argument: ' + release);
- }
- this.format();
- this.raw = this.version;
- return this;
- };
- exports.inc = inc;
- function inc(version, release, loose, identifier) {
- if (typeof(loose) === 'string') {
- identifier = loose;
- loose = undefined;
- }
- try {
- return new SemVer(version, loose).inc(release, identifier).version;
- } catch (er) {
- return null;
- }
- }
- exports.diff = diff;
- function diff(version1, version2) {
- if (eq(version1, version2)) {
- return null;
- } else {
- var v1 = parse(version1);
- var v2 = parse(version2);
- if (v1.prerelease.length || v2.prerelease.length) {
- for (var key in v1) {
- if (key === 'major' || key === 'minor' || key === 'patch') {
- if (v1[key] !== v2[key]) {
- return 'pre'+key;
- }
- }
- }
- return 'prerelease';
- }
- for (var key in v1) {
- if (key === 'major' || key === 'minor' || key === 'patch') {
- if (v1[key] !== v2[key]) {
- return key;
- }
- }
- }
- }
- }
- exports.compareIdentifiers = compareIdentifiers;
- var numeric = /^[0-9]+$/;
- function compareIdentifiers(a, b) {
- var anum = numeric.test(a);
- var bnum = numeric.test(b);
- if (anum && bnum) {
- a = +a;
- b = +b;
- }
- return (anum && !bnum) ? -1 :
- (bnum && !anum) ? 1 :
- a < b ? -1 :
- a > b ? 1 :
- 0;
- }
- exports.rcompareIdentifiers = rcompareIdentifiers;
- function rcompareIdentifiers(a, b) {
- return compareIdentifiers(b, a);
- }
- exports.major = major;
- function major(a, loose) {
- return new SemVer(a, loose).major;
- }
- exports.minor = minor;
- function minor(a, loose) {
- return new SemVer(a, loose).minor;
- }
- exports.patch = patch;
- function patch(a, loose) {
- return new SemVer(a, loose).patch;
- }
- exports.compare = compare;
- function compare(a, b, loose) {
- return new SemVer(a, loose).compare(new SemVer(b, loose));
- }
- exports.compareLoose = compareLoose;
- function compareLoose(a, b) {
- return compare(a, b, true);
- }
- exports.rcompare = rcompare;
- function rcompare(a, b, loose) {
- return compare(b, a, loose);
- }
- exports.sort = sort;
- function sort(list, loose) {
- return list.sort(function(a, b) {
- return exports.compare(a, b, loose);
- });
- }
- exports.rsort = rsort;
- function rsort(list, loose) {
- return list.sort(function(a, b) {
- return exports.rcompare(a, b, loose);
- });
- }
- exports.gt = gt;
- function gt(a, b, loose) {
- return compare(a, b, loose) > 0;
- }
- exports.lt = lt;
- function lt(a, b, loose) {
- return compare(a, b, loose) < 0;
- }
- exports.eq = eq;
- function eq(a, b, loose) {
- return compare(a, b, loose) === 0;
- }
- exports.neq = neq;
- function neq(a, b, loose) {
- return compare(a, b, loose) !== 0;
- }
- exports.gte = gte;
- function gte(a, b, loose) {
- return compare(a, b, loose) >= 0;
- }
- exports.lte = lte;
- function lte(a, b, loose) {
- return compare(a, b, loose) <= 0;
- }
- exports.cmp = cmp;
- function cmp(a, op, b, loose) {
- var ret;
- switch (op) {
- case '===':
- if (typeof a === 'object') { a = a.version; }
- if (typeof b === 'object') { b = b.version; }
- ret = a === b;
- break;
- case '!==':
- if (typeof a === 'object') { a = a.version; }
- if (typeof b === 'object') { b = b.version; }
- ret = a !== b;
- break;
- case '': case '=': case '==': ret = eq(a, b, loose); break;
- case '!=': ret = neq(a, b, loose); break;
- case '>': ret = gt(a, b, loose); break;
- case '>=': ret = gte(a, b, loose); break;
- case '<': ret = lt(a, b, loose); break;
- case '<=': ret = lte(a, b, loose); break;
- default: throw new TypeError('Invalid operator: ' + op);
- }
- return ret;
- }
- exports.Comparator = Comparator;
- function Comparator(comp, loose) {
- if (comp instanceof Comparator) {
- if (comp.loose === loose)
- { return comp; }
- else
- { comp = comp.value; }
- }
- if (!(this instanceof Comparator))
- { return new Comparator(comp, loose); }
- debug('comparator', comp, loose);
- this.loose = loose;
- this.parse(comp);
- if (this.semver === ANY)
- { this.value = ''; }
- else
- { this.value = this.operator + this.semver.version; }
- debug('comp', this);
- }
- var ANY = {};
- Comparator.prototype.parse = function(comp) {
- var r = this.loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
- var m = comp.match(r);
- if (!m)
- { throw new TypeError('Invalid comparator: ' + comp); }
- this.operator = m[1];
- if (this.operator === '=')
- { this.operator = ''; }
- // if it literally is just '>' or '' then allow anything.
- if (!m[2])
- { this.semver = ANY; }
- else
- { this.semver = new SemVer(m[2], this.loose); }
- };
- Comparator.prototype.toString = function() {
- return this.value;
- };
- Comparator.prototype.test = function(version) {
- debug('Comparator.test', version, this.loose);
- if (this.semver === ANY)
- { return true; }
- if (typeof version === 'string')
- { version = new SemVer(version, this.loose); }
- return cmp(version, this.operator, this.semver, this.loose);
- };
- Comparator.prototype.intersects = function(comp, loose) {
- if (!(comp instanceof Comparator)) {
- throw new TypeError('a Comparator is required');
- }
- var rangeTmp;
- if (this.operator === '') {
- rangeTmp = new Range(comp.value, loose);
- return satisfies(this.value, rangeTmp, loose);
- } else if (comp.operator === '') {
- rangeTmp = new Range(this.value, loose);
- return satisfies(comp.semver, rangeTmp, loose);
- }
- var sameDirectionIncreasing =
- (this.operator === '>=' || this.operator === '>') &&
- (comp.operator === '>=' || comp.operator === '>');
- var sameDirectionDecreasing =
- (this.operator === '<=' || this.operator === '<') &&
- (comp.operator === '<=' || comp.operator === '<');
- var sameSemVer = this.semver.version === comp.semver.version;
- var differentDirectionsInclusive =
- (this.operator === '>=' || this.operator === '<=') &&
- (comp.operator === '>=' || comp.operator === '<=');
- var oppositeDirectionsLessThan =
- cmp(this.semver, '<', comp.semver, loose) &&
- ((this.operator === '>=' || this.operator === '>') &&
- (comp.operator === '<=' || comp.operator === '<'));
- var oppositeDirectionsGreaterThan =
- cmp(this.semver, '>', comp.semver, loose) &&
- ((this.operator === '<=' || this.operator === '<') &&
- (comp.operator === '>=' || comp.operator === '>'));
- return sameDirectionIncreasing || sameDirectionDecreasing ||
- (sameSemVer && differentDirectionsInclusive) ||
- oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
- };
- exports.Range = Range;
- function Range(range, loose) {
- if (range instanceof Range) {
- if (range.loose === loose) {
- return range;
- } else {
- return new Range(range.raw, loose);
- }
- }
- if (range instanceof Comparator) {
- return new Range(range.value, loose);
- }
- if (!(this instanceof Range))
- { return new Range(range, loose); }
- this.loose = loose;
- // First, split based on boolean or ||
- this.raw = range;
- this.set = range.split(/\s*\|\|\s*/).map(function(range) {
- return this.parseRange(range.trim());
- }, this).filter(function(c) {
- // throw out any that are not relevant for whatever reason
- return c.length;
- });
- if (!this.set.length) {
- throw new TypeError('Invalid SemVer Range: ' + range);
- }
- this.format();
- }
- Range.prototype.format = function() {
- this.range = this.set.map(function(comps) {
- return comps.join(' ').trim();
- }).join('||').trim();
- return this.range;
- };
- Range.prototype.toString = function() {
- return this.range;
- };
- Range.prototype.parseRange = function(range) {
- var loose = this.loose;
- range = range.trim();
- debug('range', range, loose);
- // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
- var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE];
- range = range.replace(hr, hyphenReplace);
- debug('hyphen replace', range);
- // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
- range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace);
- debug('comparator trim', range, re[COMPARATORTRIM]);
- // `~ 1.2.3` => `~1.2.3`
- range = range.replace(re[TILDETRIM], tildeTrimReplace);
- // `^ 1.2.3` => `^1.2.3`
- range = range.replace(re[CARETTRIM], caretTrimReplace);
- // normalize spaces
- range = range.split(/\s+/).join(' ');
- // At this point, the range is completely trimmed and
- // ready to be split into comparators.
- var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
- var set = range.split(' ').map(function(comp) {
- return parseComparator(comp, loose);
- }).join(' ').split(/\s+/);
- if (this.loose) {
- // in loose mode, throw out any that are not valid comparators
- set = set.filter(function(comp) {
- return !!comp.match(compRe);
- });
- }
- set = set.map(function(comp) {
- return new Comparator(comp, loose);
- });
- return set;
- };
- Range.prototype.intersects = function(range, loose) {
- if (!(range instanceof Range)) {
- throw new TypeError('a Range is required');
- }
- return this.set.some(function(thisComparators) {
- return thisComparators.every(function(thisComparator) {
- return range.set.some(function(rangeComparators) {
- return rangeComparators.every(function(rangeComparator) {
- return thisComparator.intersects(rangeComparator, loose);
- });
- });
- });
- });
- };
- // Mostly just for testing and legacy API reasons
- exports.toComparators = toComparators;
- function toComparators(range, loose) {
- return new Range(range, loose).set.map(function(comp) {
- return comp.map(function(c) {
- return c.value;
- }).join(' ').trim().split(' ');
- });
- }
- // comprised of xranges, tildes, stars, and gtlt's at this point.
- // already replaced the hyphen ranges
- // turn into a set of JUST comparators.
- function parseComparator(comp, loose) {
- debug('comp', comp);
- comp = replaceCarets(comp, loose);
- debug('caret', comp);
- comp = replaceTildes(comp, loose);
- debug('tildes', comp);
- comp = replaceXRanges(comp, loose);
- debug('xrange', comp);
- comp = replaceStars(comp, loose);
- debug('stars', comp);
- return comp;
- }
- function isX(id) {
- return !id || id.toLowerCase() === 'x' || id === '*';
- }
- // ~, ~> --> * (any, kinda silly)
- // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
- // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
- // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
- // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
- // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
- function replaceTildes(comp, loose) {
- return comp.trim().split(/\s+/).map(function(comp) {
- return replaceTilde(comp, loose);
- }).join(' ');
- }
- function replaceTilde(comp, loose) {
- var r = loose ? re[TILDELOOSE] : re[TILDE];
- return comp.replace(r, function(_, M, m, p, pr) {
- debug('tilde', comp, _, M, m, p, pr);
- var ret;
- if (isX(M))
- { ret = ''; }
- else if (isX(m))
- { ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; }
- else if (isX(p))
- // ~1.2 == >=1.2.0 <1.3.0
- { ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; }
- else if (pr) {
- debug('replaceTilde pr', pr);
- if (pr.charAt(0) !== '-')
- { pr = '-' + pr; }
- ret = '>=' + M + '.' + m + '.' + p + pr +
- ' <' + M + '.' + (+m + 1) + '.0';
- } else
- // ~1.2.3 == >=1.2.3 <1.3.0
- { ret = '>=' + M + '.' + m + '.' + p +
- ' <' + M + '.' + (+m + 1) + '.0'; }
- debug('tilde return', ret);
- return ret;
- });
- }
- // ^ --> * (any, kinda silly)
- // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
- // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
- // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
- // ^1.2.3 --> >=1.2.3 <2.0.0
- // ^1.2.0 --> >=1.2.0 <2.0.0
- function replaceCarets(comp, loose) {
- return comp.trim().split(/\s+/).map(function(comp) {
- return replaceCaret(comp, loose);
- }).join(' ');
- }
- function replaceCaret(comp, loose) {
- debug('caret', comp, loose);
- var r = loose ? re[CARETLOOSE] : re[CARET];
- return comp.replace(r, function(_, M, m, p, pr) {
- debug('caret', comp, _, M, m, p, pr);
- var ret;
- if (isX(M))
- { ret = ''; }
- else if (isX(m))
- { ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; }
- else if (isX(p)) {
- if (M === '0')
- { ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; }
- else
- { ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'; }
- } else if (pr) {
- debug('replaceCaret pr', pr);
- if (pr.charAt(0) !== '-')
- { pr = '-' + pr; }
- if (M === '0') {
- if (m === '0')
- { ret = '>=' + M + '.' + m + '.' + p + pr +
- ' <' + M + '.' + m + '.' + (+p + 1); }
- else
- { ret = '>=' + M + '.' + m + '.' + p + pr +
- ' <' + M + '.' + (+m + 1) + '.0'; }
- } else
- { ret = '>=' + M + '.' + m + '.' + p + pr +
- ' <' + (+M + 1) + '.0.0'; }
- } else {
- debug('no pr');
- if (M === '0') {
- if (m === '0')
- { ret = '>=' + M + '.' + m + '.' + p +
- ' <' + M + '.' + m + '.' + (+p + 1); }
- else
- { ret = '>=' + M + '.' + m + '.' + p +
- ' <' + M + '.' + (+m + 1) + '.0'; }
- } else
- { ret = '>=' + M + '.' + m + '.' + p +
- ' <' + (+M + 1) + '.0.0'; }
- }
- debug('caret return', ret);
- return ret;
- });
- }
- function replaceXRanges(comp, loose) {
- debug('replaceXRanges', comp, loose);
- return comp.split(/\s+/).map(function(comp) {
- return replaceXRange(comp, loose);
- }).join(' ');
- }
- function replaceXRange(comp, loose) {
- comp = comp.trim();
- var r = loose ? re[XRANGELOOSE] : re[XRANGE];
- return comp.replace(r, function(ret, gtlt, M, m, p, pr) {
- debug('xRange', comp, ret, gtlt, M, m, p, pr);
- var xM = isX(M);
- var xm = xM || isX(m);
- var xp = xm || isX(p);
- var anyX = xp;
- if (gtlt === '=' && anyX)
- { gtlt = ''; }
- if (xM) {
- if (gtlt === '>' || gtlt === '<') {
- // nothing is allowed
- ret = '<0.0.0';
- } else {
- // nothing is forbidden
- ret = '*';
- }
- } else if (gtlt && anyX) {
- // replace X with 0
- if (xm)
- { m = 0; }
- if (xp)
- { p = 0; }
- if (gtlt === '>') {
- // >1 => >=2.0.0
- // >1.2 => >=1.3.0
- // >1.2.3 => >= 1.2.4
- gtlt = '>=';
- if (xm) {
- M = +M + 1;
- m = 0;
- p = 0;
- } else if (xp) {
- m = +m + 1;
- p = 0;
- }
- } else if (gtlt === '<=') {
- // <=0.7.x is actually <0.8.0, since any 0.7.x should
- // pass. Similarly, <=7.x is actually <8.0.0, etc.
- gtlt = '<';
- if (xm)
- { M = +M + 1; }
- else
- { m = +m + 1; }
- }
- ret = gtlt + M + '.' + m + '.' + p;
- } else if (xm) {
- ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
- } else if (xp) {
- ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
- }
- debug('xRange return', ret);
- return ret;
- });
- }
- // Because * is AND-ed with everything else in the comparator,
- // and '' means "any version", just remove the *s entirely.
- function replaceStars(comp, loose) {
- debug('replaceStars', comp, loose);
- // Looseness is ignored here. star is always as loose as it gets!
- return comp.trim().replace(re[STAR], '');
- }
- // This function is passed to string.replace(re[HYPHENRANGE])
- // M, m, patch, prerelease, build
- // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
- // 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
- // 1.2 - 3.4 => >=1.2.0 <3.5.0
- function hyphenReplace($0,
- from, fM, fm, fp, fpr, fb,
- to, tM, tm, tp, tpr, tb) {
- if (isX(fM))
- { from = ''; }
- else if (isX(fm))
- { from = '>=' + fM + '.0.0'; }
- else if (isX(fp))
- { from = '>=' + fM + '.' + fm + '.0'; }
- else
- { from = '>=' + from; }
- if (isX(tM))
- { to = ''; }
- else if (isX(tm))
- { to = '<' + (+tM + 1) + '.0.0'; }
- else if (isX(tp))
- { to = '<' + tM + '.' + (+tm + 1) + '.0'; }
- else if (tpr)
- { to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr; }
- else
- { to = '<=' + to; }
- return (from + ' ' + to).trim();
- }
- // if ANY of the sets match ALL of its comparators, then pass
- Range.prototype.test = function(version) {
- var this$1 = this;
- if (!version)
- { return false; }
- if (typeof version === 'string')
- { version = new SemVer(version, this.loose); }
- for (var i = 0; i < this.set.length; i++) {
- if (testSet(this$1.set[i], version))
- { return true; }
- }
- return false;
- };
- function testSet(set, version) {
- for (var i = 0; i < set.length; i++) {
- if (!set[i].test(version))
- { return false; }
- }
- if (version.prerelease.length) {
- // Find the set of versions that are allowed to have prereleases
- // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
- // That should allow `1.2.3-pr.2` to pass.
- // However, `1.2.4-alpha.notready` should NOT be allowed,
- // even though it's within the range set by the comparators.
- for (var i = 0; i < set.length; i++) {
- debug(set[i].semver);
- if (set[i].semver === ANY)
- { continue; }
- if (set[i].semver.prerelease.length > 0) {
- var allowed = set[i].semver;
- if (allowed.major === version.major &&
- allowed.minor === version.minor &&
- allowed.patch === version.patch)
- { return true; }
- }
- }
- // Version has a -pre, but it's not one of the ones we like.
- return false;
- }
- return true;
- }
- exports.satisfies = satisfies;
- function satisfies(version, range, loose) {
- try {
- range = new Range(range, loose);
- } catch (er) {
- return false;
- }
- return range.test(version);
- }
- exports.maxSatisfying = maxSatisfying;
- function maxSatisfying(versions, range, loose) {
- var max = null;
- var maxSV = null;
- try {
- var rangeObj = new Range(range, loose);
- } catch (er) {
- return null;
- }
- versions.forEach(function (v) {
- if (rangeObj.test(v)) { // satisfies(v, range, loose)
- if (!max || maxSV.compare(v) === -1) { // compare(max, v, true)
- max = v;
- maxSV = new SemVer(max, loose);
- }
- }
- });
- return max;
- }
- exports.minSatisfying = minSatisfying;
- function minSatisfying(versions, range, loose) {
- var min = null;
- var minSV = null;
- try {
- var rangeObj = new Range(range, loose);
- } catch (er) {
- return null;
- }
- versions.forEach(function (v) {
- if (rangeObj.test(v)) { // satisfies(v, range, loose)
- if (!min || minSV.compare(v) === 1) { // compare(min, v, true)
- min = v;
- minSV = new SemVer(min, loose);
- }
- }
- });
- return min;
- }
- exports.validRange = validRange;
- function validRange(range, loose) {
- try {
- // Return '*' instead of '' so that truthiness works.
- // This will throw if it's invalid anyway
- return new Range(range, loose).range || '*';
- } catch (er) {
- return null;
- }
- }
- // Determine if version is less than all the versions possible in the range
- exports.ltr = ltr;
- function ltr(version, range, loose) {
- return outside(version, range, '<', loose);
- }
- // Determine if version is greater than all the versions possible in the range.
- exports.gtr = gtr;
- function gtr(version, range, loose) {
- return outside(version, range, '>', loose);
- }
- exports.outside = outside;
- function outside(version, range, hilo, loose) {
- version = new SemVer(version, loose);
- range = new Range(range, loose);
- var gtfn, ltefn, ltfn, comp, ecomp;
- switch (hilo) {
- case '>':
- gtfn = gt;
- ltefn = lte;
- ltfn = lt;
- comp = '>';
- ecomp = '>=';
- break;
- case '<':
- gtfn = lt;
- ltefn = gte;
- ltfn = gt;
- comp = '<';
- ecomp = '<=';
- break;
- default:
- throw new TypeError('Must provide a hilo val of "<" or ">"');
- }
- // If it satisifes the range it is not outside
- if (satisfies(version, range, loose)) {
- return false;
- }
- // From now on, variable terms are as if we're in "gtr" mode.
- // but note that everything is flipped for the "ltr" function.
- for (var i = 0; i < range.set.length; ++i) {
- var comparators = range.set[i];
- var high = null;
- var low = null;
- comparators.forEach(function(comparator) {
- if (comparator.semver === ANY) {
- comparator = new Comparator('>=0.0.0');
- }
- high = high || comparator;
- low = low || comparator;
- if (gtfn(comparator.semver, high.semver, loose)) {
- high = comparator;
- } else if (ltfn(comparator.semver, low.semver, loose)) {
- low = comparator;
- }
- });
- // If the edge version comparator has a operator then our version
- // isn't outside it
- if (high.operator === comp || high.operator === ecomp) {
- return false;
- }
- // If the lowest version comparator has an operator and our version
- // is less than it then it isn't higher than the range
- if ((!low.operator || low.operator === comp) &&
- ltefn(version, low.semver)) {
- return false;
- } else if (low.operator === ecomp && ltfn(version, low.semver)) {
- return false;
- }
- }
- return true;
- }
- exports.prerelease = prerelease;
- function prerelease(version, loose) {
- var parsed = parse(version, loose);
- return (parsed && parsed.prerelease.length) ? parsed.prerelease : null;
- }
- exports.intersects = intersects;
- function intersects(r1, r2, loose) {
- r1 = new Range(r1, loose);
- r2 = new Range(r2, loose);
- return r1.intersects(r2)
- }
- exports.coerce = coerce;
- function coerce(version) {
- if (version instanceof SemVer)
- { return version; }
- if (typeof version !== 'string')
- { return null; }
- var match = version.match(re[COERCE]);
- if (match == null)
- { return null; }
- return parse((match[1] || '0') + '.' + (match[2] || '0') + '.' + (match[3] || '0'));
- }
- });
- var semver_1$1 = semver$1.SEMVER_SPEC_VERSION;
- var semver_2$1 = semver$1.re;
- var semver_3$1 = semver$1.src;
- var semver_4$1 = semver$1.parse;
- var semver_5$1 = semver$1.valid;
- var semver_6$1 = semver$1.clean;
- var semver_7$1 = semver$1.SemVer;
- var semver_8$1 = semver$1.inc;
- var semver_9$1 = semver$1.diff;
- var semver_10$1 = semver$1.compareIdentifiers;
- var semver_11$1 = semver$1.rcompareIdentifiers;
- var semver_12$1 = semver$1.major;
- var semver_13$1 = semver$1.minor;
- var semver_14$1 = semver$1.patch;
- var semver_15$1 = semver$1.compare;
- var semver_16$1 = semver$1.compareLoose;
- var semver_17$1 = semver$1.rcompare;
- var semver_18$1 = semver$1.sort;
- var semver_19$1 = semver$1.rsort;
- var semver_20$1 = semver$1.gt;
- var semver_21$1 = semver$1.lt;
- var semver_22$1 = semver$1.eq;
- var semver_23$1 = semver$1.neq;
- var semver_24$1 = semver$1.gte;
- var semver_25$1 = semver$1.lte;
- var semver_26$1 = semver$1.cmp;
- var semver_27$1 = semver$1.Comparator;
- var semver_28$1 = semver$1.Range;
- var semver_29$1 = semver$1.toComparators;
- var semver_30$1 = semver$1.satisfies;
- var semver_31$1 = semver$1.maxSatisfying;
- var semver_32$1 = semver$1.minSatisfying;
- var semver_33$1 = semver$1.validRange;
- var semver_34$1 = semver$1.ltr;
- var semver_35$1 = semver$1.gtr;
- var semver_36$1 = semver$1.outside;
- var semver_37$1 = semver$1.prerelease;
- var semver_38$1 = semver$1.intersects;
- var semver_39$1 = semver$1.coerce;
- //
- function isValidSlot(slot) {
- return isVueComponent(slot) || typeof slot === 'string'
- }
- function requiresTemplateCompiler(slot) {
- if (typeof slot === 'string' && !vueTemplateCompiler.compileToFunctions) {
- throwError(
- "vueTemplateCompiler is undefined, you must pass " +
- "precompiled components if vue-template-compiler is " +
- "undefined"
- );
- }
- }
- function validateSlots(slots) {
- Object.keys(slots).forEach(function (key) {
- var slot = Array.isArray(slots[key]) ? slots[key] : [slots[key]];
- slot.forEach(function (slotValue) {
- if (!isValidSlot(slotValue)) {
- throwError(
- "slots[key] must be a Component, string or an array " +
- "of Components"
- );
- }
- requiresTemplateCompiler(slotValue);
- });
- });
- }
- function vueExtendUnsupportedOption(option) {
- return (
- "options." + option + " is not supported for " +
- "components created with Vue.extend in Vue < 2.3. " +
- "You can set " + option + " to false to mount the component."
- )
- }
- // these options aren't supported if Vue is version < 2.3
- // for components using Vue.extend. This is due to a bug
- // that means the mixins we use to add properties are not applied
- // correctly
- var UNSUPPORTED_VERSION_OPTIONS = ['mocks', 'stubs', 'localVue'];
- function validateOptions(options, component) {
- if (options.parentComponent && !isPlainObject(options.parentComponent)) {
- throwError(
- "options.parentComponent should be a valid Vue component options object"
- );
- }
- if (!isFunctionalComponent(component) && options.context) {
- throwError(
- "mount.context can only be used when mounting a functional component"
- );
- }
- if (options.context && !isPlainObject(options.context)) {
- throwError('mount.context must be an object');
- }
- if (VUE_VERSION < 2.3 && isConstructor(component)) {
- UNSUPPORTED_VERSION_OPTIONS.forEach(function (option) {
- if (options[option]) {
- throwError(vueExtendUnsupportedOption(option));
- }
- });
- }
- if (options.slots) {
- compileTemplateForSlots(options.slots);
- // validate slots outside of the createSlots function so
- // that we can throw an error without it being caught by
- // the Vue error handler
- // $FlowIgnore
- validateSlots(options.slots);
- }
- }
- //
- Vue.config.productionTip = false;
- Vue.config.devtools = false;
- function getSyncOption(syncOption) {
- if (syncOption === false) {
- Vue.config.async = true;
- return false
- }
- if (semver$1.lt(Vue.version, '2.5.18')) {
- warn(
- "Vue Test Utils runs in sync mode by default. Due to bugs, sync mode " +
- "requires Vue > 2.5.18. In Vue Test Utils 1.0 sync mode will only be " +
- "supported with Vue 2.5.18+ running in development mode. If you are " +
- "unable to upgrade, you should rewrite your tests to run asynchronously" +
- "you can do this by setting the sync mounting option to false."
- );
- return COMPAT_SYNC_MODE
- }
- if (typeof Vue.config.async === 'undefined') {
- warn(
- "Sync mode only works when Vue runs in dev mode. " +
- "Please set Vue to run in dev mode, or set sync to false"
- );
- }
- Vue.config.async = false;
- return true
- }
- function mount(
- component,
- options
- ) {
- if ( options === void 0 ) options = {};
- warnIfNoWindow();
- addGlobalErrorHandler(Vue);
- var _Vue = createLocalVue(options.localVue);
- var mergedOptions = mergeOptions(options, config);
- validateOptions(mergedOptions, component);
- var parentVm = createInstance(component, mergedOptions, _Vue);
- var el = options.attachToDocument ? createElement() : undefined;
- var vm = parentVm.$mount(el);
- component._Ctor = {};
- throwIfInstancesThrew(vm);
- var sync = getSyncOption(mergedOptions.sync);
- var wrapperOptions = {
- attachedToDocument: !!mergedOptions.attachToDocument,
- sync: sync
- };
- var root = parentVm.$options._isFunctionalContainer
- ? vm._vnode
- : vm.$children[0];
- return createWrapper(root, wrapperOptions)
- }
- //
- function shallowMount(
- component,
- options
- ) {
- if ( options === void 0 ) options = {};
- return mount(component, Object.assign({}, options,
- {shouldProxy: true}))
- }
- //
- var toTypes = [String, Object];
- var eventTypes = [String, Array];
- var RouterLinkStub = {
- name: 'RouterLinkStub',
- props: {
- to: {
- type: toTypes,
- required: true
- },
- tag: {
- type: String,
- default: 'a'
- },
- exact: Boolean,
- append: Boolean,
- replace: Boolean,
- activeClass: String,
- exactActiveClass: String,
- event: {
- type: eventTypes,
- default: 'click'
- }
- },
- render: function render(h) {
- return h(this.tag, undefined, this.$slots.default)
- }
- }
- function shallow(component, options) {
- warn(
- "shallow has been renamed to shallowMount. shallow " +
- "will be removed in 1.0.0, use shallowMount instead"
- );
- return shallowMount(component, options)
- }
- var index = {
- createLocalVue: createLocalVue,
- createWrapper: createWrapper,
- config: config,
- mount: mount,
- shallow: shallow,
- shallowMount: shallowMount,
- TransitionStub: TransitionStub,
- TransitionGroupStub: TransitionGroupStub,
- RouterLinkStub: RouterLinkStub,
- Wrapper: Wrapper,
- WrapperArray: WrapperArray
- }
- module.exports = index;
|