vue.runtime.esm.js 222 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452
  1. /*!
  2. * Vue.js v2.6.12
  3. * (c) 2014-2020 Evan You
  4. * Released under the MIT License.
  5. */
  6. /* */
  7. var emptyObject = Object.freeze({});
  8. // These helpers produce better VM code in JS engines due to their
  9. // explicitness and function inlining.
  10. function isUndef (v) {
  11. return v === undefined || v === null
  12. }
  13. function isDef (v) {
  14. return v !== undefined && v !== null
  15. }
  16. function isTrue (v) {
  17. return v === true
  18. }
  19. function isFalse (v) {
  20. return v === false
  21. }
  22. /**
  23. * Check if value is primitive.
  24. */
  25. function isPrimitive (value) {
  26. return (
  27. typeof value === 'string' ||
  28. typeof value === 'number' ||
  29. // $flow-disable-line
  30. typeof value === 'symbol' ||
  31. typeof value === 'boolean'
  32. )
  33. }
  34. /**
  35. * Quick object check - this is primarily used to tell
  36. * Objects from primitive values when we know the value
  37. * is a JSON-compliant type.
  38. */
  39. function isObject (obj) {
  40. return obj !== null && typeof obj === 'object'
  41. }
  42. /**
  43. * Get the raw type string of a value, e.g., [object Object].
  44. */
  45. var _toString = Object.prototype.toString;
  46. function toRawType (value) {
  47. return _toString.call(value).slice(8, -1)
  48. }
  49. /**
  50. * Strict object type check. Only returns true
  51. * for plain JavaScript objects.
  52. */
  53. function isPlainObject (obj) {
  54. return _toString.call(obj) === '[object Object]'
  55. }
  56. function isRegExp (v) {
  57. return _toString.call(v) === '[object RegExp]'
  58. }
  59. /**
  60. * Check if val is a valid array index.
  61. */
  62. function isValidArrayIndex (val) {
  63. var n = parseFloat(String(val));
  64. return n >= 0 && Math.floor(n) === n && isFinite(val)
  65. }
  66. function isPromise (val) {
  67. return (
  68. isDef(val) &&
  69. typeof val.then === 'function' &&
  70. typeof val.catch === 'function'
  71. )
  72. }
  73. /**
  74. * Convert a value to a string that is actually rendered.
  75. */
  76. function toString (val) {
  77. return val == null
  78. ? ''
  79. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  80. ? JSON.stringify(val, null, 2)
  81. : String(val)
  82. }
  83. /**
  84. * Convert an input value to a number for persistence.
  85. * If the conversion fails, return original string.
  86. */
  87. function toNumber (val) {
  88. var n = parseFloat(val);
  89. return isNaN(n) ? val : n
  90. }
  91. /**
  92. * Make a map and return a function for checking if a key
  93. * is in that map.
  94. */
  95. function makeMap (
  96. str,
  97. expectsLowerCase
  98. ) {
  99. var map = Object.create(null);
  100. var list = str.split(',');
  101. for (var i = 0; i < list.length; i++) {
  102. map[list[i]] = true;
  103. }
  104. return expectsLowerCase
  105. ? function (val) { return map[val.toLowerCase()]; }
  106. : function (val) { return map[val]; }
  107. }
  108. /**
  109. * Check if a tag is a built-in tag.
  110. */
  111. var isBuiltInTag = makeMap('slot,component', true);
  112. /**
  113. * Check if an attribute is a reserved attribute.
  114. */
  115. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  116. /**
  117. * Remove an item from an array.
  118. */
  119. function remove (arr, item) {
  120. if (arr.length) {
  121. var index = arr.indexOf(item);
  122. if (index > -1) {
  123. return arr.splice(index, 1)
  124. }
  125. }
  126. }
  127. /**
  128. * Check whether an object has the property.
  129. */
  130. var hasOwnProperty = Object.prototype.hasOwnProperty;
  131. function hasOwn (obj, key) {
  132. return hasOwnProperty.call(obj, key)
  133. }
  134. /**
  135. * Create a cached version of a pure function.
  136. */
  137. function cached (fn) {
  138. var cache = Object.create(null);
  139. return (function cachedFn (str) {
  140. var hit = cache[str];
  141. return hit || (cache[str] = fn(str))
  142. })
  143. }
  144. /**
  145. * Camelize a hyphen-delimited string.
  146. */
  147. var camelizeRE = /-(\w)/g;
  148. var camelize = cached(function (str) {
  149. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  150. });
  151. /**
  152. * Capitalize a string.
  153. */
  154. var capitalize = cached(function (str) {
  155. return str.charAt(0).toUpperCase() + str.slice(1)
  156. });
  157. /**
  158. * Hyphenate a camelCase string.
  159. */
  160. var hyphenateRE = /\B([A-Z])/g;
  161. var hyphenate = cached(function (str) {
  162. return str.replace(hyphenateRE, '-$1').toLowerCase()
  163. });
  164. /**
  165. * Simple bind polyfill for environments that do not support it,
  166. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  167. * since native bind is now performant enough in most browsers.
  168. * But removing it would mean breaking code that was able to run in
  169. * PhantomJS 1.x, so this must be kept for backward compatibility.
  170. */
  171. /* istanbul ignore next */
  172. function polyfillBind (fn, ctx) {
  173. function boundFn (a) {
  174. var l = arguments.length;
  175. return l
  176. ? l > 1
  177. ? fn.apply(ctx, arguments)
  178. : fn.call(ctx, a)
  179. : fn.call(ctx)
  180. }
  181. boundFn._length = fn.length;
  182. return boundFn
  183. }
  184. function nativeBind (fn, ctx) {
  185. return fn.bind(ctx)
  186. }
  187. var bind = Function.prototype.bind
  188. ? nativeBind
  189. : polyfillBind;
  190. /**
  191. * Convert an Array-like object to a real Array.
  192. */
  193. function toArray (list, start) {
  194. start = start || 0;
  195. var i = list.length - start;
  196. var ret = new Array(i);
  197. while (i--) {
  198. ret[i] = list[i + start];
  199. }
  200. return ret
  201. }
  202. /**
  203. * Mix properties into target object.
  204. */
  205. function extend (to, _from) {
  206. for (var key in _from) {
  207. to[key] = _from[key];
  208. }
  209. return to
  210. }
  211. /**
  212. * Merge an Array of Objects into a single Object.
  213. */
  214. function toObject (arr) {
  215. var res = {};
  216. for (var i = 0; i < arr.length; i++) {
  217. if (arr[i]) {
  218. extend(res, arr[i]);
  219. }
  220. }
  221. return res
  222. }
  223. /* eslint-disable no-unused-vars */
  224. /**
  225. * Perform no operation.
  226. * Stubbing args to make Flow happy without leaving useless transpiled code
  227. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  228. */
  229. function noop (a, b, c) {}
  230. /**
  231. * Always return false.
  232. */
  233. var no = function (a, b, c) { return false; };
  234. /* eslint-enable no-unused-vars */
  235. /**
  236. * Return the same value.
  237. */
  238. var identity = function (_) { return _; };
  239. /**
  240. * Check if two values are loosely equal - that is,
  241. * if they are plain objects, do they have the same shape?
  242. */
  243. function looseEqual (a, b) {
  244. if (a === b) { return true }
  245. var isObjectA = isObject(a);
  246. var isObjectB = isObject(b);
  247. if (isObjectA && isObjectB) {
  248. try {
  249. var isArrayA = Array.isArray(a);
  250. var isArrayB = Array.isArray(b);
  251. if (isArrayA && isArrayB) {
  252. return a.length === b.length && a.every(function (e, i) {
  253. return looseEqual(e, b[i])
  254. })
  255. } else if (a instanceof Date && b instanceof Date) {
  256. return a.getTime() === b.getTime()
  257. } else if (!isArrayA && !isArrayB) {
  258. var keysA = Object.keys(a);
  259. var keysB = Object.keys(b);
  260. return keysA.length === keysB.length && keysA.every(function (key) {
  261. return looseEqual(a[key], b[key])
  262. })
  263. } else {
  264. /* istanbul ignore next */
  265. return false
  266. }
  267. } catch (e) {
  268. /* istanbul ignore next */
  269. return false
  270. }
  271. } else if (!isObjectA && !isObjectB) {
  272. return String(a) === String(b)
  273. } else {
  274. return false
  275. }
  276. }
  277. /**
  278. * Return the first index at which a loosely equal value can be
  279. * found in the array (if value is a plain object, the array must
  280. * contain an object of the same shape), or -1 if it is not present.
  281. */
  282. function looseIndexOf (arr, val) {
  283. for (var i = 0; i < arr.length; i++) {
  284. if (looseEqual(arr[i], val)) { return i }
  285. }
  286. return -1
  287. }
  288. /**
  289. * Ensure a function is called only once.
  290. */
  291. function once (fn) {
  292. var called = false;
  293. return function () {
  294. if (!called) {
  295. called = true;
  296. fn.apply(this, arguments);
  297. }
  298. }
  299. }
  300. var SSR_ATTR = 'data-server-rendered';
  301. var ASSET_TYPES = [
  302. 'component',
  303. 'directive',
  304. 'filter'
  305. ];
  306. var LIFECYCLE_HOOKS = [
  307. 'beforeCreate',
  308. 'created',
  309. 'beforeMount',
  310. 'mounted',
  311. 'beforeUpdate',
  312. 'updated',
  313. 'beforeDestroy',
  314. 'destroyed',
  315. 'activated',
  316. 'deactivated',
  317. 'errorCaptured',
  318. 'serverPrefetch'
  319. ];
  320. /* */
  321. var config = ({
  322. /**
  323. * Option merge strategies (used in core/util/options)
  324. */
  325. // $flow-disable-line
  326. optionMergeStrategies: Object.create(null),
  327. /**
  328. * Whether to suppress warnings.
  329. */
  330. silent: false,
  331. /**
  332. * Show production mode tip message on boot?
  333. */
  334. productionTip: process.env.NODE_ENV !== 'production',
  335. /**
  336. * Whether to enable devtools
  337. */
  338. devtools: process.env.NODE_ENV !== 'production',
  339. /**
  340. * Whether to record perf
  341. */
  342. performance: false,
  343. /**
  344. * Error handler for watcher errors
  345. */
  346. errorHandler: null,
  347. /**
  348. * Warn handler for watcher warns
  349. */
  350. warnHandler: null,
  351. /**
  352. * Ignore certain custom elements
  353. */
  354. ignoredElements: [],
  355. /**
  356. * Custom user key aliases for v-on
  357. */
  358. // $flow-disable-line
  359. keyCodes: Object.create(null),
  360. /**
  361. * Check if a tag is reserved so that it cannot be registered as a
  362. * component. This is platform-dependent and may be overwritten.
  363. */
  364. isReservedTag: no,
  365. /**
  366. * Check if an attribute is reserved so that it cannot be used as a component
  367. * prop. This is platform-dependent and may be overwritten.
  368. */
  369. isReservedAttr: no,
  370. /**
  371. * Check if a tag is an unknown element.
  372. * Platform-dependent.
  373. */
  374. isUnknownElement: no,
  375. /**
  376. * Get the namespace of an element
  377. */
  378. getTagNamespace: noop,
  379. /**
  380. * Parse the real tag name for the specific platform.
  381. */
  382. parsePlatformTagName: identity,
  383. /**
  384. * Check if an attribute must be bound using property, e.g. value
  385. * Platform-dependent.
  386. */
  387. mustUseProp: no,
  388. /**
  389. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  390. * This will significantly reduce performance if set to false.
  391. */
  392. async: true,
  393. /**
  394. * Exposed for legacy reasons
  395. */
  396. _lifecycleHooks: LIFECYCLE_HOOKS
  397. });
  398. /* */
  399. /**
  400. * unicode letters used for parsing html tags, component names and property paths.
  401. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  402. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  403. */
  404. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  405. /**
  406. * Check if a string starts with $ or _
  407. */
  408. function isReserved (str) {
  409. var c = (str + '').charCodeAt(0);
  410. return c === 0x24 || c === 0x5F
  411. }
  412. /**
  413. * Define a property.
  414. */
  415. function def (obj, key, val, enumerable) {
  416. Object.defineProperty(obj, key, {
  417. value: val,
  418. enumerable: !!enumerable,
  419. writable: true,
  420. configurable: true
  421. });
  422. }
  423. /**
  424. * Parse simple path.
  425. */
  426. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  427. function parsePath (path) {
  428. if (bailRE.test(path)) {
  429. return
  430. }
  431. var segments = path.split('.');
  432. return function (obj) {
  433. for (var i = 0; i < segments.length; i++) {
  434. if (!obj) { return }
  435. obj = obj[segments[i]];
  436. }
  437. return obj
  438. }
  439. }
  440. /* */
  441. // can we use __proto__?
  442. var hasProto = '__proto__' in {};
  443. // Browser environment sniffing
  444. var inBrowser = typeof window !== 'undefined';
  445. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  446. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  447. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  448. var isIE = UA && /msie|trident/.test(UA);
  449. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  450. var isEdge = UA && UA.indexOf('edge/') > 0;
  451. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  452. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  453. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  454. var isPhantomJS = UA && /phantomjs/.test(UA);
  455. var isFF = UA && UA.match(/firefox\/(\d+)/);
  456. // Firefox has a "watch" function on Object.prototype...
  457. var nativeWatch = ({}).watch;
  458. var supportsPassive = false;
  459. if (inBrowser) {
  460. try {
  461. var opts = {};
  462. Object.defineProperty(opts, 'passive', ({
  463. get: function get () {
  464. /* istanbul ignore next */
  465. supportsPassive = true;
  466. }
  467. })); // https://github.com/facebook/flow/issues/285
  468. window.addEventListener('test-passive', null, opts);
  469. } catch (e) {}
  470. }
  471. // this needs to be lazy-evaled because vue may be required before
  472. // vue-server-renderer can set VUE_ENV
  473. var _isServer;
  474. var isServerRendering = function () {
  475. if (_isServer === undefined) {
  476. /* istanbul ignore if */
  477. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  478. // detect presence of vue-server-renderer and avoid
  479. // Webpack shimming the process
  480. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  481. } else {
  482. _isServer = false;
  483. }
  484. }
  485. return _isServer
  486. };
  487. // detect devtools
  488. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  489. /* istanbul ignore next */
  490. function isNative (Ctor) {
  491. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  492. }
  493. var hasSymbol =
  494. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  495. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  496. var _Set;
  497. /* istanbul ignore if */ // $flow-disable-line
  498. if (typeof Set !== 'undefined' && isNative(Set)) {
  499. // use native Set when available.
  500. _Set = Set;
  501. } else {
  502. // a non-standard Set polyfill that only works with primitive keys.
  503. _Set = /*@__PURE__*/(function () {
  504. function Set () {
  505. this.set = Object.create(null);
  506. }
  507. Set.prototype.has = function has (key) {
  508. return this.set[key] === true
  509. };
  510. Set.prototype.add = function add (key) {
  511. this.set[key] = true;
  512. };
  513. Set.prototype.clear = function clear () {
  514. this.set = Object.create(null);
  515. };
  516. return Set;
  517. }());
  518. }
  519. /* */
  520. var warn = noop;
  521. var tip = noop;
  522. var generateComponentTrace = (noop); // work around flow check
  523. var formatComponentName = (noop);
  524. if (process.env.NODE_ENV !== 'production') {
  525. var hasConsole = typeof console !== 'undefined';
  526. var classifyRE = /(?:^|[-_])(\w)/g;
  527. var classify = function (str) { return str
  528. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  529. .replace(/[-_]/g, ''); };
  530. warn = function (msg, vm) {
  531. var trace = vm ? generateComponentTrace(vm) : '';
  532. if (config.warnHandler) {
  533. config.warnHandler.call(null, msg, vm, trace);
  534. } else if (hasConsole && (!config.silent)) {
  535. console.error(("[Vue warn]: " + msg + trace));
  536. }
  537. };
  538. tip = function (msg, vm) {
  539. if (hasConsole && (!config.silent)) {
  540. console.warn("[Vue tip]: " + msg + (
  541. vm ? generateComponentTrace(vm) : ''
  542. ));
  543. }
  544. };
  545. formatComponentName = function (vm, includeFile) {
  546. if (vm.$root === vm) {
  547. return '<Root>'
  548. }
  549. var options = typeof vm === 'function' && vm.cid != null
  550. ? vm.options
  551. : vm._isVue
  552. ? vm.$options || vm.constructor.options
  553. : vm;
  554. var name = options.name || options._componentTag;
  555. var file = options.__file;
  556. if (!name && file) {
  557. var match = file.match(/([^/\\]+)\.vue$/);
  558. name = match && match[1];
  559. }
  560. return (
  561. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  562. (file && includeFile !== false ? (" at " + file) : '')
  563. )
  564. };
  565. var repeat = function (str, n) {
  566. var res = '';
  567. while (n) {
  568. if (n % 2 === 1) { res += str; }
  569. if (n > 1) { str += str; }
  570. n >>= 1;
  571. }
  572. return res
  573. };
  574. generateComponentTrace = function (vm) {
  575. if (vm._isVue && vm.$parent) {
  576. var tree = [];
  577. var currentRecursiveSequence = 0;
  578. while (vm) {
  579. if (tree.length > 0) {
  580. var last = tree[tree.length - 1];
  581. if (last.constructor === vm.constructor) {
  582. currentRecursiveSequence++;
  583. vm = vm.$parent;
  584. continue
  585. } else if (currentRecursiveSequence > 0) {
  586. tree[tree.length - 1] = [last, currentRecursiveSequence];
  587. currentRecursiveSequence = 0;
  588. }
  589. }
  590. tree.push(vm);
  591. vm = vm.$parent;
  592. }
  593. return '\n\nfound in\n\n' + tree
  594. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  595. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  596. : formatComponentName(vm))); })
  597. .join('\n')
  598. } else {
  599. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  600. }
  601. };
  602. }
  603. /* */
  604. var uid = 0;
  605. /**
  606. * A dep is an observable that can have multiple
  607. * directives subscribing to it.
  608. */
  609. var Dep = function Dep () {
  610. this.id = uid++;
  611. this.subs = [];
  612. };
  613. Dep.prototype.addSub = function addSub (sub) {
  614. this.subs.push(sub);
  615. };
  616. Dep.prototype.removeSub = function removeSub (sub) {
  617. remove(this.subs, sub);
  618. };
  619. Dep.prototype.depend = function depend () {
  620. if (Dep.target) {
  621. Dep.target.addDep(this);
  622. }
  623. };
  624. Dep.prototype.notify = function notify () {
  625. // stabilize the subscriber list first
  626. var subs = this.subs.slice();
  627. if (process.env.NODE_ENV !== 'production' && !config.async) {
  628. // subs aren't sorted in scheduler if not running async
  629. // we need to sort them now to make sure they fire in correct
  630. // order
  631. subs.sort(function (a, b) { return a.id - b.id; });
  632. }
  633. for (var i = 0, l = subs.length; i < l; i++) {
  634. subs[i].update();
  635. }
  636. };
  637. // The current target watcher being evaluated.
  638. // This is globally unique because only one watcher
  639. // can be evaluated at a time.
  640. Dep.target = null;
  641. var targetStack = [];
  642. function pushTarget (target) {
  643. targetStack.push(target);
  644. Dep.target = target;
  645. }
  646. function popTarget () {
  647. targetStack.pop();
  648. Dep.target = targetStack[targetStack.length - 1];
  649. }
  650. /* */
  651. var VNode = function VNode (
  652. tag,
  653. data,
  654. children,
  655. text,
  656. elm,
  657. context,
  658. componentOptions,
  659. asyncFactory
  660. ) {
  661. this.tag = tag;
  662. this.data = data;
  663. this.children = children;
  664. this.text = text;
  665. this.elm = elm;
  666. this.ns = undefined;
  667. this.context = context;
  668. this.fnContext = undefined;
  669. this.fnOptions = undefined;
  670. this.fnScopeId = undefined;
  671. this.key = data && data.key;
  672. this.componentOptions = componentOptions;
  673. this.componentInstance = undefined;
  674. this.parent = undefined;
  675. this.raw = false;
  676. this.isStatic = false;
  677. this.isRootInsert = true;
  678. this.isComment = false;
  679. this.isCloned = false;
  680. this.isOnce = false;
  681. this.asyncFactory = asyncFactory;
  682. this.asyncMeta = undefined;
  683. this.isAsyncPlaceholder = false;
  684. };
  685. var prototypeAccessors = { child: { configurable: true } };
  686. // DEPRECATED: alias for componentInstance for backwards compat.
  687. /* istanbul ignore next */
  688. prototypeAccessors.child.get = function () {
  689. return this.componentInstance
  690. };
  691. Object.defineProperties( VNode.prototype, prototypeAccessors );
  692. var createEmptyVNode = function (text) {
  693. if ( text === void 0 ) text = '';
  694. var node = new VNode();
  695. node.text = text;
  696. node.isComment = true;
  697. return node
  698. };
  699. function createTextVNode (val) {
  700. return new VNode(undefined, undefined, undefined, String(val))
  701. }
  702. // optimized shallow clone
  703. // used for static nodes and slot nodes because they may be reused across
  704. // multiple renders, cloning them avoids errors when DOM manipulations rely
  705. // on their elm reference.
  706. function cloneVNode (vnode) {
  707. var cloned = new VNode(
  708. vnode.tag,
  709. vnode.data,
  710. // #7975
  711. // clone children array to avoid mutating original in case of cloning
  712. // a child.
  713. vnode.children && vnode.children.slice(),
  714. vnode.text,
  715. vnode.elm,
  716. vnode.context,
  717. vnode.componentOptions,
  718. vnode.asyncFactory
  719. );
  720. cloned.ns = vnode.ns;
  721. cloned.isStatic = vnode.isStatic;
  722. cloned.key = vnode.key;
  723. cloned.isComment = vnode.isComment;
  724. cloned.fnContext = vnode.fnContext;
  725. cloned.fnOptions = vnode.fnOptions;
  726. cloned.fnScopeId = vnode.fnScopeId;
  727. cloned.asyncMeta = vnode.asyncMeta;
  728. cloned.isCloned = true;
  729. return cloned
  730. }
  731. /*
  732. * not type checking this file because flow doesn't play well with
  733. * dynamically accessing methods on Array prototype
  734. */
  735. var arrayProto = Array.prototype;
  736. var arrayMethods = Object.create(arrayProto);
  737. var methodsToPatch = [
  738. 'push',
  739. 'pop',
  740. 'shift',
  741. 'unshift',
  742. 'splice',
  743. 'sort',
  744. 'reverse'
  745. ];
  746. /**
  747. * Intercept mutating methods and emit events
  748. */
  749. methodsToPatch.forEach(function (method) {
  750. // cache original method
  751. var original = arrayProto[method];
  752. def(arrayMethods, method, function mutator () {
  753. var args = [], len = arguments.length;
  754. while ( len-- ) args[ len ] = arguments[ len ];
  755. var result = original.apply(this, args);
  756. var ob = this.__ob__;
  757. var inserted;
  758. switch (method) {
  759. case 'push':
  760. case 'unshift':
  761. inserted = args;
  762. break
  763. case 'splice':
  764. inserted = args.slice(2);
  765. break
  766. }
  767. if (inserted) { ob.observeArray(inserted); }
  768. // notify change
  769. ob.dep.notify();
  770. return result
  771. });
  772. });
  773. /* */
  774. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  775. /**
  776. * In some cases we may want to disable observation inside a component's
  777. * update computation.
  778. */
  779. var shouldObserve = true;
  780. function toggleObserving (value) {
  781. shouldObserve = value;
  782. }
  783. /**
  784. * Observer class that is attached to each observed
  785. * object. Once attached, the observer converts the target
  786. * object's property keys into getter/setters that
  787. * collect dependencies and dispatch updates.
  788. */
  789. var Observer = function Observer (value) {
  790. this.value = value;
  791. this.dep = new Dep();
  792. this.vmCount = 0;
  793. def(value, '__ob__', this);
  794. if (Array.isArray(value)) {
  795. if (hasProto) {
  796. protoAugment(value, arrayMethods);
  797. } else {
  798. copyAugment(value, arrayMethods, arrayKeys);
  799. }
  800. this.observeArray(value);
  801. } else {
  802. this.walk(value);
  803. }
  804. };
  805. /**
  806. * Walk through all properties and convert them into
  807. * getter/setters. This method should only be called when
  808. * value type is Object.
  809. */
  810. Observer.prototype.walk = function walk (obj) {
  811. var keys = Object.keys(obj);
  812. for (var i = 0; i < keys.length; i++) {
  813. defineReactive$$1(obj, keys[i]);
  814. }
  815. };
  816. /**
  817. * Observe a list of Array items.
  818. */
  819. Observer.prototype.observeArray = function observeArray (items) {
  820. for (var i = 0, l = items.length; i < l; i++) {
  821. observe(items[i]);
  822. }
  823. };
  824. // helpers
  825. /**
  826. * Augment a target Object or Array by intercepting
  827. * the prototype chain using __proto__
  828. */
  829. function protoAugment (target, src) {
  830. /* eslint-disable no-proto */
  831. target.__proto__ = src;
  832. /* eslint-enable no-proto */
  833. }
  834. /**
  835. * Augment a target Object or Array by defining
  836. * hidden properties.
  837. */
  838. /* istanbul ignore next */
  839. function copyAugment (target, src, keys) {
  840. for (var i = 0, l = keys.length; i < l; i++) {
  841. var key = keys[i];
  842. def(target, key, src[key]);
  843. }
  844. }
  845. /**
  846. * Attempt to create an observer instance for a value,
  847. * returns the new observer if successfully observed,
  848. * or the existing observer if the value already has one.
  849. */
  850. function observe (value, asRootData) {
  851. if (!isObject(value) || value instanceof VNode) {
  852. return
  853. }
  854. var ob;
  855. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  856. ob = value.__ob__;
  857. } else if (
  858. shouldObserve &&
  859. !isServerRendering() &&
  860. (Array.isArray(value) || isPlainObject(value)) &&
  861. Object.isExtensible(value) &&
  862. !value._isVue
  863. ) {
  864. ob = new Observer(value);
  865. }
  866. if (asRootData && ob) {
  867. ob.vmCount++;
  868. }
  869. return ob
  870. }
  871. /**
  872. * Define a reactive property on an Object.
  873. */
  874. function defineReactive$$1 (
  875. obj,
  876. key,
  877. val,
  878. customSetter,
  879. shallow
  880. ) {
  881. var dep = new Dep();
  882. var property = Object.getOwnPropertyDescriptor(obj, key);
  883. if (property && property.configurable === false) {
  884. return
  885. }
  886. // cater for pre-defined getter/setters
  887. var getter = property && property.get;
  888. var setter = property && property.set;
  889. if ((!getter || setter) && arguments.length === 2) {
  890. val = obj[key];
  891. }
  892. var childOb = !shallow && observe(val);
  893. Object.defineProperty(obj, key, {
  894. enumerable: true,
  895. configurable: true,
  896. get: function reactiveGetter () {
  897. var value = getter ? getter.call(obj) : val;
  898. if (Dep.target) {
  899. dep.depend();
  900. if (childOb) {
  901. childOb.dep.depend();
  902. if (Array.isArray(value)) {
  903. dependArray(value);
  904. }
  905. }
  906. }
  907. return value
  908. },
  909. set: function reactiveSetter (newVal) {
  910. var value = getter ? getter.call(obj) : val;
  911. /* eslint-disable no-self-compare */
  912. if (newVal === value || (newVal !== newVal && value !== value)) {
  913. return
  914. }
  915. /* eslint-enable no-self-compare */
  916. if (process.env.NODE_ENV !== 'production' && customSetter) {
  917. customSetter();
  918. }
  919. // #7981: for accessor properties without setter
  920. if (getter && !setter) { return }
  921. if (setter) {
  922. setter.call(obj, newVal);
  923. } else {
  924. val = newVal;
  925. }
  926. childOb = !shallow && observe(newVal);
  927. dep.notify();
  928. }
  929. });
  930. }
  931. /**
  932. * Set a property on an object. Adds the new property and
  933. * triggers change notification if the property doesn't
  934. * already exist.
  935. */
  936. function set (target, key, val) {
  937. if (process.env.NODE_ENV !== 'production' &&
  938. (isUndef(target) || isPrimitive(target))
  939. ) {
  940. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  941. }
  942. if (Array.isArray(target) && isValidArrayIndex(key)) {
  943. target.length = Math.max(target.length, key);
  944. target.splice(key, 1, val);
  945. return val
  946. }
  947. if (key in target && !(key in Object.prototype)) {
  948. target[key] = val;
  949. return val
  950. }
  951. var ob = (target).__ob__;
  952. if (target._isVue || (ob && ob.vmCount)) {
  953. process.env.NODE_ENV !== 'production' && warn(
  954. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  955. 'at runtime - declare it upfront in the data option.'
  956. );
  957. return val
  958. }
  959. if (!ob) {
  960. target[key] = val;
  961. return val
  962. }
  963. defineReactive$$1(ob.value, key, val);
  964. ob.dep.notify();
  965. return val
  966. }
  967. /**
  968. * Delete a property and trigger change if necessary.
  969. */
  970. function del (target, key) {
  971. if (process.env.NODE_ENV !== 'production' &&
  972. (isUndef(target) || isPrimitive(target))
  973. ) {
  974. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  975. }
  976. if (Array.isArray(target) && isValidArrayIndex(key)) {
  977. target.splice(key, 1);
  978. return
  979. }
  980. var ob = (target).__ob__;
  981. if (target._isVue || (ob && ob.vmCount)) {
  982. process.env.NODE_ENV !== 'production' && warn(
  983. 'Avoid deleting properties on a Vue instance or its root $data ' +
  984. '- just set it to null.'
  985. );
  986. return
  987. }
  988. if (!hasOwn(target, key)) {
  989. return
  990. }
  991. delete target[key];
  992. if (!ob) {
  993. return
  994. }
  995. ob.dep.notify();
  996. }
  997. /**
  998. * Collect dependencies on array elements when the array is touched, since
  999. * we cannot intercept array element access like property getters.
  1000. */
  1001. function dependArray (value) {
  1002. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  1003. e = value[i];
  1004. e && e.__ob__ && e.__ob__.dep.depend();
  1005. if (Array.isArray(e)) {
  1006. dependArray(e);
  1007. }
  1008. }
  1009. }
  1010. /* */
  1011. /**
  1012. * Option overwriting strategies are functions that handle
  1013. * how to merge a parent option value and a child option
  1014. * value into the final value.
  1015. */
  1016. var strats = config.optionMergeStrategies;
  1017. /**
  1018. * Options with restrictions
  1019. */
  1020. if (process.env.NODE_ENV !== 'production') {
  1021. strats.el = strats.propsData = function (parent, child, vm, key) {
  1022. if (!vm) {
  1023. warn(
  1024. "option \"" + key + "\" can only be used during instance " +
  1025. 'creation with the `new` keyword.'
  1026. );
  1027. }
  1028. return defaultStrat(parent, child)
  1029. };
  1030. }
  1031. /**
  1032. * Helper that recursively merges two data objects together.
  1033. */
  1034. function mergeData (to, from) {
  1035. if (!from) { return to }
  1036. var key, toVal, fromVal;
  1037. var keys = hasSymbol
  1038. ? Reflect.ownKeys(from)
  1039. : Object.keys(from);
  1040. for (var i = 0; i < keys.length; i++) {
  1041. key = keys[i];
  1042. // in case the object is already observed...
  1043. if (key === '__ob__') { continue }
  1044. toVal = to[key];
  1045. fromVal = from[key];
  1046. if (!hasOwn(to, key)) {
  1047. set(to, key, fromVal);
  1048. } else if (
  1049. toVal !== fromVal &&
  1050. isPlainObject(toVal) &&
  1051. isPlainObject(fromVal)
  1052. ) {
  1053. mergeData(toVal, fromVal);
  1054. }
  1055. }
  1056. return to
  1057. }
  1058. /**
  1059. * Data
  1060. */
  1061. function mergeDataOrFn (
  1062. parentVal,
  1063. childVal,
  1064. vm
  1065. ) {
  1066. if (!vm) {
  1067. // in a Vue.extend merge, both should be functions
  1068. if (!childVal) {
  1069. return parentVal
  1070. }
  1071. if (!parentVal) {
  1072. return childVal
  1073. }
  1074. // when parentVal & childVal are both present,
  1075. // we need to return a function that returns the
  1076. // merged result of both functions... no need to
  1077. // check if parentVal is a function here because
  1078. // it has to be a function to pass previous merges.
  1079. return function mergedDataFn () {
  1080. return mergeData(
  1081. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  1082. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  1083. )
  1084. }
  1085. } else {
  1086. return function mergedInstanceDataFn () {
  1087. // instance merge
  1088. var instanceData = typeof childVal === 'function'
  1089. ? childVal.call(vm, vm)
  1090. : childVal;
  1091. var defaultData = typeof parentVal === 'function'
  1092. ? parentVal.call(vm, vm)
  1093. : parentVal;
  1094. if (instanceData) {
  1095. return mergeData(instanceData, defaultData)
  1096. } else {
  1097. return defaultData
  1098. }
  1099. }
  1100. }
  1101. }
  1102. strats.data = function (
  1103. parentVal,
  1104. childVal,
  1105. vm
  1106. ) {
  1107. if (!vm) {
  1108. if (childVal && typeof childVal !== 'function') {
  1109. process.env.NODE_ENV !== 'production' && warn(
  1110. 'The "data" option should be a function ' +
  1111. 'that returns a per-instance value in component ' +
  1112. 'definitions.',
  1113. vm
  1114. );
  1115. return parentVal
  1116. }
  1117. return mergeDataOrFn(parentVal, childVal)
  1118. }
  1119. return mergeDataOrFn(parentVal, childVal, vm)
  1120. };
  1121. /**
  1122. * Hooks and props are merged as arrays.
  1123. */
  1124. function mergeHook (
  1125. parentVal,
  1126. childVal
  1127. ) {
  1128. var res = childVal
  1129. ? parentVal
  1130. ? parentVal.concat(childVal)
  1131. : Array.isArray(childVal)
  1132. ? childVal
  1133. : [childVal]
  1134. : parentVal;
  1135. return res
  1136. ? dedupeHooks(res)
  1137. : res
  1138. }
  1139. function dedupeHooks (hooks) {
  1140. var res = [];
  1141. for (var i = 0; i < hooks.length; i++) {
  1142. if (res.indexOf(hooks[i]) === -1) {
  1143. res.push(hooks[i]);
  1144. }
  1145. }
  1146. return res
  1147. }
  1148. LIFECYCLE_HOOKS.forEach(function (hook) {
  1149. strats[hook] = mergeHook;
  1150. });
  1151. /**
  1152. * Assets
  1153. *
  1154. * When a vm is present (instance creation), we need to do
  1155. * a three-way merge between constructor options, instance
  1156. * options and parent options.
  1157. */
  1158. function mergeAssets (
  1159. parentVal,
  1160. childVal,
  1161. vm,
  1162. key
  1163. ) {
  1164. var res = Object.create(parentVal || null);
  1165. if (childVal) {
  1166. process.env.NODE_ENV !== 'production' && assertObjectType(key, childVal, vm);
  1167. return extend(res, childVal)
  1168. } else {
  1169. return res
  1170. }
  1171. }
  1172. ASSET_TYPES.forEach(function (type) {
  1173. strats[type + 's'] = mergeAssets;
  1174. });
  1175. /**
  1176. * Watchers.
  1177. *
  1178. * Watchers hashes should not overwrite one
  1179. * another, so we merge them as arrays.
  1180. */
  1181. strats.watch = function (
  1182. parentVal,
  1183. childVal,
  1184. vm,
  1185. key
  1186. ) {
  1187. // work around Firefox's Object.prototype.watch...
  1188. if (parentVal === nativeWatch) { parentVal = undefined; }
  1189. if (childVal === nativeWatch) { childVal = undefined; }
  1190. /* istanbul ignore if */
  1191. if (!childVal) { return Object.create(parentVal || null) }
  1192. if (process.env.NODE_ENV !== 'production') {
  1193. assertObjectType(key, childVal, vm);
  1194. }
  1195. if (!parentVal) { return childVal }
  1196. var ret = {};
  1197. extend(ret, parentVal);
  1198. for (var key$1 in childVal) {
  1199. var parent = ret[key$1];
  1200. var child = childVal[key$1];
  1201. if (parent && !Array.isArray(parent)) {
  1202. parent = [parent];
  1203. }
  1204. ret[key$1] = parent
  1205. ? parent.concat(child)
  1206. : Array.isArray(child) ? child : [child];
  1207. }
  1208. return ret
  1209. };
  1210. /**
  1211. * Other object hashes.
  1212. */
  1213. strats.props =
  1214. strats.methods =
  1215. strats.inject =
  1216. strats.computed = function (
  1217. parentVal,
  1218. childVal,
  1219. vm,
  1220. key
  1221. ) {
  1222. if (childVal && process.env.NODE_ENV !== 'production') {
  1223. assertObjectType(key, childVal, vm);
  1224. }
  1225. if (!parentVal) { return childVal }
  1226. var ret = Object.create(null);
  1227. extend(ret, parentVal);
  1228. if (childVal) { extend(ret, childVal); }
  1229. return ret
  1230. };
  1231. strats.provide = mergeDataOrFn;
  1232. /**
  1233. * Default strategy.
  1234. */
  1235. var defaultStrat = function (parentVal, childVal) {
  1236. return childVal === undefined
  1237. ? parentVal
  1238. : childVal
  1239. };
  1240. /**
  1241. * Validate component names
  1242. */
  1243. function checkComponents (options) {
  1244. for (var key in options.components) {
  1245. validateComponentName(key);
  1246. }
  1247. }
  1248. function validateComponentName (name) {
  1249. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  1250. warn(
  1251. 'Invalid component name: "' + name + '". Component names ' +
  1252. 'should conform to valid custom element name in html5 specification.'
  1253. );
  1254. }
  1255. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  1256. warn(
  1257. 'Do not use built-in or reserved HTML elements as component ' +
  1258. 'id: ' + name
  1259. );
  1260. }
  1261. }
  1262. /**
  1263. * Ensure all props option syntax are normalized into the
  1264. * Object-based format.
  1265. */
  1266. function normalizeProps (options, vm) {
  1267. var props = options.props;
  1268. if (!props) { return }
  1269. var res = {};
  1270. var i, val, name;
  1271. if (Array.isArray(props)) {
  1272. i = props.length;
  1273. while (i--) {
  1274. val = props[i];
  1275. if (typeof val === 'string') {
  1276. name = camelize(val);
  1277. res[name] = { type: null };
  1278. } else if (process.env.NODE_ENV !== 'production') {
  1279. warn('props must be strings when using array syntax.');
  1280. }
  1281. }
  1282. } else if (isPlainObject(props)) {
  1283. for (var key in props) {
  1284. val = props[key];
  1285. name = camelize(key);
  1286. res[name] = isPlainObject(val)
  1287. ? val
  1288. : { type: val };
  1289. }
  1290. } else if (process.env.NODE_ENV !== 'production') {
  1291. warn(
  1292. "Invalid value for option \"props\": expected an Array or an Object, " +
  1293. "but got " + (toRawType(props)) + ".",
  1294. vm
  1295. );
  1296. }
  1297. options.props = res;
  1298. }
  1299. /**
  1300. * Normalize all injections into Object-based format
  1301. */
  1302. function normalizeInject (options, vm) {
  1303. var inject = options.inject;
  1304. if (!inject) { return }
  1305. var normalized = options.inject = {};
  1306. if (Array.isArray(inject)) {
  1307. for (var i = 0; i < inject.length; i++) {
  1308. normalized[inject[i]] = { from: inject[i] };
  1309. }
  1310. } else if (isPlainObject(inject)) {
  1311. for (var key in inject) {
  1312. var val = inject[key];
  1313. normalized[key] = isPlainObject(val)
  1314. ? extend({ from: key }, val)
  1315. : { from: val };
  1316. }
  1317. } else if (process.env.NODE_ENV !== 'production') {
  1318. warn(
  1319. "Invalid value for option \"inject\": expected an Array or an Object, " +
  1320. "but got " + (toRawType(inject)) + ".",
  1321. vm
  1322. );
  1323. }
  1324. }
  1325. /**
  1326. * Normalize raw function directives into object format.
  1327. */
  1328. function normalizeDirectives (options) {
  1329. var dirs = options.directives;
  1330. if (dirs) {
  1331. for (var key in dirs) {
  1332. var def$$1 = dirs[key];
  1333. if (typeof def$$1 === 'function') {
  1334. dirs[key] = { bind: def$$1, update: def$$1 };
  1335. }
  1336. }
  1337. }
  1338. }
  1339. function assertObjectType (name, value, vm) {
  1340. if (!isPlainObject(value)) {
  1341. warn(
  1342. "Invalid value for option \"" + name + "\": expected an Object, " +
  1343. "but got " + (toRawType(value)) + ".",
  1344. vm
  1345. );
  1346. }
  1347. }
  1348. /**
  1349. * Merge two option objects into a new one.
  1350. * Core utility used in both instantiation and inheritance.
  1351. */
  1352. function mergeOptions (
  1353. parent,
  1354. child,
  1355. vm
  1356. ) {
  1357. if (process.env.NODE_ENV !== 'production') {
  1358. checkComponents(child);
  1359. }
  1360. if (typeof child === 'function') {
  1361. child = child.options;
  1362. }
  1363. normalizeProps(child, vm);
  1364. normalizeInject(child, vm);
  1365. normalizeDirectives(child);
  1366. // Apply extends and mixins on the child options,
  1367. // but only if it is a raw options object that isn't
  1368. // the result of another mergeOptions call.
  1369. // Only merged options has the _base property.
  1370. if (!child._base) {
  1371. if (child.extends) {
  1372. parent = mergeOptions(parent, child.extends, vm);
  1373. }
  1374. if (child.mixins) {
  1375. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1376. parent = mergeOptions(parent, child.mixins[i], vm);
  1377. }
  1378. }
  1379. }
  1380. var options = {};
  1381. var key;
  1382. for (key in parent) {
  1383. mergeField(key);
  1384. }
  1385. for (key in child) {
  1386. if (!hasOwn(parent, key)) {
  1387. mergeField(key);
  1388. }
  1389. }
  1390. function mergeField (key) {
  1391. var strat = strats[key] || defaultStrat;
  1392. options[key] = strat(parent[key], child[key], vm, key);
  1393. }
  1394. return options
  1395. }
  1396. /**
  1397. * Resolve an asset.
  1398. * This function is used because child instances need access
  1399. * to assets defined in its ancestor chain.
  1400. */
  1401. function resolveAsset (
  1402. options,
  1403. type,
  1404. id,
  1405. warnMissing
  1406. ) {
  1407. /* istanbul ignore if */
  1408. if (typeof id !== 'string') {
  1409. return
  1410. }
  1411. var assets = options[type];
  1412. // check local registration variations first
  1413. if (hasOwn(assets, id)) { return assets[id] }
  1414. var camelizedId = camelize(id);
  1415. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  1416. var PascalCaseId = capitalize(camelizedId);
  1417. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  1418. // fallback to prototype chain
  1419. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  1420. if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {
  1421. warn(
  1422. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  1423. options
  1424. );
  1425. }
  1426. return res
  1427. }
  1428. /* */
  1429. function validateProp (
  1430. key,
  1431. propOptions,
  1432. propsData,
  1433. vm
  1434. ) {
  1435. var prop = propOptions[key];
  1436. var absent = !hasOwn(propsData, key);
  1437. var value = propsData[key];
  1438. // boolean casting
  1439. var booleanIndex = getTypeIndex(Boolean, prop.type);
  1440. if (booleanIndex > -1) {
  1441. if (absent && !hasOwn(prop, 'default')) {
  1442. value = false;
  1443. } else if (value === '' || value === hyphenate(key)) {
  1444. // only cast empty string / same name to boolean if
  1445. // boolean has higher priority
  1446. var stringIndex = getTypeIndex(String, prop.type);
  1447. if (stringIndex < 0 || booleanIndex < stringIndex) {
  1448. value = true;
  1449. }
  1450. }
  1451. }
  1452. // check default value
  1453. if (value === undefined) {
  1454. value = getPropDefaultValue(vm, prop, key);
  1455. // since the default value is a fresh copy,
  1456. // make sure to observe it.
  1457. var prevShouldObserve = shouldObserve;
  1458. toggleObserving(true);
  1459. observe(value);
  1460. toggleObserving(prevShouldObserve);
  1461. }
  1462. if (
  1463. process.env.NODE_ENV !== 'production' &&
  1464. // skip validation for weex recycle-list child component props
  1465. !(false)
  1466. ) {
  1467. assertProp(prop, key, value, vm, absent);
  1468. }
  1469. return value
  1470. }
  1471. /**
  1472. * Get the default value of a prop.
  1473. */
  1474. function getPropDefaultValue (vm, prop, key) {
  1475. // no default, return undefined
  1476. if (!hasOwn(prop, 'default')) {
  1477. return undefined
  1478. }
  1479. var def = prop.default;
  1480. // warn against non-factory defaults for Object & Array
  1481. if (process.env.NODE_ENV !== 'production' && isObject(def)) {
  1482. warn(
  1483. 'Invalid default value for prop "' + key + '": ' +
  1484. 'Props with type Object/Array must use a factory function ' +
  1485. 'to return the default value.',
  1486. vm
  1487. );
  1488. }
  1489. // the raw prop value was also undefined from previous render,
  1490. // return previous default value to avoid unnecessary watcher trigger
  1491. if (vm && vm.$options.propsData &&
  1492. vm.$options.propsData[key] === undefined &&
  1493. vm._props[key] !== undefined
  1494. ) {
  1495. return vm._props[key]
  1496. }
  1497. // call factory function for non-Function types
  1498. // a value is Function if its prototype is function even across different execution context
  1499. return typeof def === 'function' && getType(prop.type) !== 'Function'
  1500. ? def.call(vm)
  1501. : def
  1502. }
  1503. /**
  1504. * Assert whether a prop is valid.
  1505. */
  1506. function assertProp (
  1507. prop,
  1508. name,
  1509. value,
  1510. vm,
  1511. absent
  1512. ) {
  1513. if (prop.required && absent) {
  1514. warn(
  1515. 'Missing required prop: "' + name + '"',
  1516. vm
  1517. );
  1518. return
  1519. }
  1520. if (value == null && !prop.required) {
  1521. return
  1522. }
  1523. var type = prop.type;
  1524. var valid = !type || type === true;
  1525. var expectedTypes = [];
  1526. if (type) {
  1527. if (!Array.isArray(type)) {
  1528. type = [type];
  1529. }
  1530. for (var i = 0; i < type.length && !valid; i++) {
  1531. var assertedType = assertType(value, type[i]);
  1532. expectedTypes.push(assertedType.expectedType || '');
  1533. valid = assertedType.valid;
  1534. }
  1535. }
  1536. if (!valid) {
  1537. warn(
  1538. getInvalidTypeMessage(name, value, expectedTypes),
  1539. vm
  1540. );
  1541. return
  1542. }
  1543. var validator = prop.validator;
  1544. if (validator) {
  1545. if (!validator(value)) {
  1546. warn(
  1547. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  1548. vm
  1549. );
  1550. }
  1551. }
  1552. }
  1553. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  1554. function assertType (value, type) {
  1555. var valid;
  1556. var expectedType = getType(type);
  1557. if (simpleCheckRE.test(expectedType)) {
  1558. var t = typeof value;
  1559. valid = t === expectedType.toLowerCase();
  1560. // for primitive wrapper objects
  1561. if (!valid && t === 'object') {
  1562. valid = value instanceof type;
  1563. }
  1564. } else if (expectedType === 'Object') {
  1565. valid = isPlainObject(value);
  1566. } else if (expectedType === 'Array') {
  1567. valid = Array.isArray(value);
  1568. } else {
  1569. valid = value instanceof type;
  1570. }
  1571. return {
  1572. valid: valid,
  1573. expectedType: expectedType
  1574. }
  1575. }
  1576. /**
  1577. * Use function string name to check built-in types,
  1578. * because a simple equality check will fail when running
  1579. * across different vms / iframes.
  1580. */
  1581. function getType (fn) {
  1582. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  1583. return match ? match[1] : ''
  1584. }
  1585. function isSameType (a, b) {
  1586. return getType(a) === getType(b)
  1587. }
  1588. function getTypeIndex (type, expectedTypes) {
  1589. if (!Array.isArray(expectedTypes)) {
  1590. return isSameType(expectedTypes, type) ? 0 : -1
  1591. }
  1592. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  1593. if (isSameType(expectedTypes[i], type)) {
  1594. return i
  1595. }
  1596. }
  1597. return -1
  1598. }
  1599. function getInvalidTypeMessage (name, value, expectedTypes) {
  1600. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  1601. " Expected " + (expectedTypes.map(capitalize).join(', '));
  1602. var expectedType = expectedTypes[0];
  1603. var receivedType = toRawType(value);
  1604. var expectedValue = styleValue(value, expectedType);
  1605. var receivedValue = styleValue(value, receivedType);
  1606. // check if we need to specify expected value
  1607. if (expectedTypes.length === 1 &&
  1608. isExplicable(expectedType) &&
  1609. !isBoolean(expectedType, receivedType)) {
  1610. message += " with value " + expectedValue;
  1611. }
  1612. message += ", got " + receivedType + " ";
  1613. // check if we need to specify received value
  1614. if (isExplicable(receivedType)) {
  1615. message += "with value " + receivedValue + ".";
  1616. }
  1617. return message
  1618. }
  1619. function styleValue (value, type) {
  1620. if (type === 'String') {
  1621. return ("\"" + value + "\"")
  1622. } else if (type === 'Number') {
  1623. return ("" + (Number(value)))
  1624. } else {
  1625. return ("" + value)
  1626. }
  1627. }
  1628. function isExplicable (value) {
  1629. var explicitTypes = ['string', 'number', 'boolean'];
  1630. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  1631. }
  1632. function isBoolean () {
  1633. var args = [], len = arguments.length;
  1634. while ( len-- ) args[ len ] = arguments[ len ];
  1635. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  1636. }
  1637. /* */
  1638. function handleError (err, vm, info) {
  1639. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  1640. // See: https://github.com/vuejs/vuex/issues/1505
  1641. pushTarget();
  1642. try {
  1643. if (vm) {
  1644. var cur = vm;
  1645. while ((cur = cur.$parent)) {
  1646. var hooks = cur.$options.errorCaptured;
  1647. if (hooks) {
  1648. for (var i = 0; i < hooks.length; i++) {
  1649. try {
  1650. var capture = hooks[i].call(cur, err, vm, info) === false;
  1651. if (capture) { return }
  1652. } catch (e) {
  1653. globalHandleError(e, cur, 'errorCaptured hook');
  1654. }
  1655. }
  1656. }
  1657. }
  1658. }
  1659. globalHandleError(err, vm, info);
  1660. } finally {
  1661. popTarget();
  1662. }
  1663. }
  1664. function invokeWithErrorHandling (
  1665. handler,
  1666. context,
  1667. args,
  1668. vm,
  1669. info
  1670. ) {
  1671. var res;
  1672. try {
  1673. res = args ? handler.apply(context, args) : handler.call(context);
  1674. if (res && !res._isVue && isPromise(res) && !res._handled) {
  1675. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  1676. // issue #9511
  1677. // avoid catch triggering multiple times when nested calls
  1678. res._handled = true;
  1679. }
  1680. } catch (e) {
  1681. handleError(e, vm, info);
  1682. }
  1683. return res
  1684. }
  1685. function globalHandleError (err, vm, info) {
  1686. if (config.errorHandler) {
  1687. try {
  1688. return config.errorHandler.call(null, err, vm, info)
  1689. } catch (e) {
  1690. // if the user intentionally throws the original error in the handler,
  1691. // do not log it twice
  1692. if (e !== err) {
  1693. logError(e, null, 'config.errorHandler');
  1694. }
  1695. }
  1696. }
  1697. logError(err, vm, info);
  1698. }
  1699. function logError (err, vm, info) {
  1700. if (process.env.NODE_ENV !== 'production') {
  1701. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  1702. }
  1703. /* istanbul ignore else */
  1704. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  1705. console.error(err);
  1706. } else {
  1707. throw err
  1708. }
  1709. }
  1710. /* */
  1711. var isUsingMicroTask = false;
  1712. var callbacks = [];
  1713. var pending = false;
  1714. function flushCallbacks () {
  1715. pending = false;
  1716. var copies = callbacks.slice(0);
  1717. callbacks.length = 0;
  1718. for (var i = 0; i < copies.length; i++) {
  1719. copies[i]();
  1720. }
  1721. }
  1722. // Here we have async deferring wrappers using microtasks.
  1723. // In 2.5 we used (macro) tasks (in combination with microtasks).
  1724. // However, it has subtle problems when state is changed right before repaint
  1725. // (e.g. #6813, out-in transitions).
  1726. // Also, using (macro) tasks in event handler would cause some weird behaviors
  1727. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  1728. // So we now use microtasks everywhere, again.
  1729. // A major drawback of this tradeoff is that there are some scenarios
  1730. // where microtasks have too high a priority and fire in between supposedly
  1731. // sequential events (e.g. #4521, #6690, which have workarounds)
  1732. // or even between bubbling of the same event (#6566).
  1733. var timerFunc;
  1734. // The nextTick behavior leverages the microtask queue, which can be accessed
  1735. // via either native Promise.then or MutationObserver.
  1736. // MutationObserver has wider support, however it is seriously bugged in
  1737. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  1738. // completely stops working after triggering a few times... so, if native
  1739. // Promise is available, we will use it:
  1740. /* istanbul ignore next, $flow-disable-line */
  1741. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  1742. var p = Promise.resolve();
  1743. timerFunc = function () {
  1744. p.then(flushCallbacks);
  1745. // In problematic UIWebViews, Promise.then doesn't completely break, but
  1746. // it can get stuck in a weird state where callbacks are pushed into the
  1747. // microtask queue but the queue isn't being flushed, until the browser
  1748. // needs to do some other work, e.g. handle a timer. Therefore we can
  1749. // "force" the microtask queue to be flushed by adding an empty timer.
  1750. if (isIOS) { setTimeout(noop); }
  1751. };
  1752. isUsingMicroTask = true;
  1753. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  1754. isNative(MutationObserver) ||
  1755. // PhantomJS and iOS 7.x
  1756. MutationObserver.toString() === '[object MutationObserverConstructor]'
  1757. )) {
  1758. // Use MutationObserver where native Promise is not available,
  1759. // e.g. PhantomJS, iOS7, Android 4.4
  1760. // (#6466 MutationObserver is unreliable in IE11)
  1761. var counter = 1;
  1762. var observer = new MutationObserver(flushCallbacks);
  1763. var textNode = document.createTextNode(String(counter));
  1764. observer.observe(textNode, {
  1765. characterData: true
  1766. });
  1767. timerFunc = function () {
  1768. counter = (counter + 1) % 2;
  1769. textNode.data = String(counter);
  1770. };
  1771. isUsingMicroTask = true;
  1772. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  1773. // Fallback to setImmediate.
  1774. // Technically it leverages the (macro) task queue,
  1775. // but it is still a better choice than setTimeout.
  1776. timerFunc = function () {
  1777. setImmediate(flushCallbacks);
  1778. };
  1779. } else {
  1780. // Fallback to setTimeout.
  1781. timerFunc = function () {
  1782. setTimeout(flushCallbacks, 0);
  1783. };
  1784. }
  1785. function nextTick (cb, ctx) {
  1786. var _resolve;
  1787. callbacks.push(function () {
  1788. if (cb) {
  1789. try {
  1790. cb.call(ctx);
  1791. } catch (e) {
  1792. handleError(e, ctx, 'nextTick');
  1793. }
  1794. } else if (_resolve) {
  1795. _resolve(ctx);
  1796. }
  1797. });
  1798. if (!pending) {
  1799. pending = true;
  1800. timerFunc();
  1801. }
  1802. // $flow-disable-line
  1803. if (!cb && typeof Promise !== 'undefined') {
  1804. return new Promise(function (resolve) {
  1805. _resolve = resolve;
  1806. })
  1807. }
  1808. }
  1809. /* */
  1810. /* not type checking this file because flow doesn't play well with Proxy */
  1811. var initProxy;
  1812. if (process.env.NODE_ENV !== 'production') {
  1813. var allowedGlobals = makeMap(
  1814. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  1815. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  1816. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  1817. 'require' // for Webpack/Browserify
  1818. );
  1819. var warnNonPresent = function (target, key) {
  1820. warn(
  1821. "Property or method \"" + key + "\" is not defined on the instance but " +
  1822. 'referenced during render. Make sure that this property is reactive, ' +
  1823. 'either in the data option, or for class-based components, by ' +
  1824. 'initializing the property. ' +
  1825. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  1826. target
  1827. );
  1828. };
  1829. var warnReservedPrefix = function (target, key) {
  1830. warn(
  1831. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  1832. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  1833. 'prevent conflicts with Vue internals. ' +
  1834. 'See: https://vuejs.org/v2/api/#data',
  1835. target
  1836. );
  1837. };
  1838. var hasProxy =
  1839. typeof Proxy !== 'undefined' && isNative(Proxy);
  1840. if (hasProxy) {
  1841. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  1842. config.keyCodes = new Proxy(config.keyCodes, {
  1843. set: function set (target, key, value) {
  1844. if (isBuiltInModifier(key)) {
  1845. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  1846. return false
  1847. } else {
  1848. target[key] = value;
  1849. return true
  1850. }
  1851. }
  1852. });
  1853. }
  1854. var hasHandler = {
  1855. has: function has (target, key) {
  1856. var has = key in target;
  1857. var isAllowed = allowedGlobals(key) ||
  1858. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  1859. if (!has && !isAllowed) {
  1860. if (key in target.$data) { warnReservedPrefix(target, key); }
  1861. else { warnNonPresent(target, key); }
  1862. }
  1863. return has || !isAllowed
  1864. }
  1865. };
  1866. var getHandler = {
  1867. get: function get (target, key) {
  1868. if (typeof key === 'string' && !(key in target)) {
  1869. if (key in target.$data) { warnReservedPrefix(target, key); }
  1870. else { warnNonPresent(target, key); }
  1871. }
  1872. return target[key]
  1873. }
  1874. };
  1875. initProxy = function initProxy (vm) {
  1876. if (hasProxy) {
  1877. // determine which proxy handler to use
  1878. var options = vm.$options;
  1879. var handlers = options.render && options.render._withStripped
  1880. ? getHandler
  1881. : hasHandler;
  1882. vm._renderProxy = new Proxy(vm, handlers);
  1883. } else {
  1884. vm._renderProxy = vm;
  1885. }
  1886. };
  1887. }
  1888. /* */
  1889. var seenObjects = new _Set();
  1890. /**
  1891. * Recursively traverse an object to evoke all converted
  1892. * getters, so that every nested property inside the object
  1893. * is collected as a "deep" dependency.
  1894. */
  1895. function traverse (val) {
  1896. _traverse(val, seenObjects);
  1897. seenObjects.clear();
  1898. }
  1899. function _traverse (val, seen) {
  1900. var i, keys;
  1901. var isA = Array.isArray(val);
  1902. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  1903. return
  1904. }
  1905. if (val.__ob__) {
  1906. var depId = val.__ob__.dep.id;
  1907. if (seen.has(depId)) {
  1908. return
  1909. }
  1910. seen.add(depId);
  1911. }
  1912. if (isA) {
  1913. i = val.length;
  1914. while (i--) { _traverse(val[i], seen); }
  1915. } else {
  1916. keys = Object.keys(val);
  1917. i = keys.length;
  1918. while (i--) { _traverse(val[keys[i]], seen); }
  1919. }
  1920. }
  1921. var mark;
  1922. var measure;
  1923. if (process.env.NODE_ENV !== 'production') {
  1924. var perf = inBrowser && window.performance;
  1925. /* istanbul ignore if */
  1926. if (
  1927. perf &&
  1928. perf.mark &&
  1929. perf.measure &&
  1930. perf.clearMarks &&
  1931. perf.clearMeasures
  1932. ) {
  1933. mark = function (tag) { return perf.mark(tag); };
  1934. measure = function (name, startTag, endTag) {
  1935. perf.measure(name, startTag, endTag);
  1936. perf.clearMarks(startTag);
  1937. perf.clearMarks(endTag);
  1938. // perf.clearMeasures(name)
  1939. };
  1940. }
  1941. }
  1942. /* */
  1943. var normalizeEvent = cached(function (name) {
  1944. var passive = name.charAt(0) === '&';
  1945. name = passive ? name.slice(1) : name;
  1946. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  1947. name = once$$1 ? name.slice(1) : name;
  1948. var capture = name.charAt(0) === '!';
  1949. name = capture ? name.slice(1) : name;
  1950. return {
  1951. name: name,
  1952. once: once$$1,
  1953. capture: capture,
  1954. passive: passive
  1955. }
  1956. });
  1957. function createFnInvoker (fns, vm) {
  1958. function invoker () {
  1959. var arguments$1 = arguments;
  1960. var fns = invoker.fns;
  1961. if (Array.isArray(fns)) {
  1962. var cloned = fns.slice();
  1963. for (var i = 0; i < cloned.length; i++) {
  1964. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  1965. }
  1966. } else {
  1967. // return handler return value for single handlers
  1968. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  1969. }
  1970. }
  1971. invoker.fns = fns;
  1972. return invoker
  1973. }
  1974. function updateListeners (
  1975. on,
  1976. oldOn,
  1977. add,
  1978. remove$$1,
  1979. createOnceHandler,
  1980. vm
  1981. ) {
  1982. var name, def$$1, cur, old, event;
  1983. for (name in on) {
  1984. def$$1 = cur = on[name];
  1985. old = oldOn[name];
  1986. event = normalizeEvent(name);
  1987. if (isUndef(cur)) {
  1988. process.env.NODE_ENV !== 'production' && warn(
  1989. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  1990. vm
  1991. );
  1992. } else if (isUndef(old)) {
  1993. if (isUndef(cur.fns)) {
  1994. cur = on[name] = createFnInvoker(cur, vm);
  1995. }
  1996. if (isTrue(event.once)) {
  1997. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  1998. }
  1999. add(event.name, cur, event.capture, event.passive, event.params);
  2000. } else if (cur !== old) {
  2001. old.fns = cur;
  2002. on[name] = old;
  2003. }
  2004. }
  2005. for (name in oldOn) {
  2006. if (isUndef(on[name])) {
  2007. event = normalizeEvent(name);
  2008. remove$$1(event.name, oldOn[name], event.capture);
  2009. }
  2010. }
  2011. }
  2012. /* */
  2013. function mergeVNodeHook (def, hookKey, hook) {
  2014. if (def instanceof VNode) {
  2015. def = def.data.hook || (def.data.hook = {});
  2016. }
  2017. var invoker;
  2018. var oldHook = def[hookKey];
  2019. function wrappedHook () {
  2020. hook.apply(this, arguments);
  2021. // important: remove merged hook to ensure it's called only once
  2022. // and prevent memory leak
  2023. remove(invoker.fns, wrappedHook);
  2024. }
  2025. if (isUndef(oldHook)) {
  2026. // no existing hook
  2027. invoker = createFnInvoker([wrappedHook]);
  2028. } else {
  2029. /* istanbul ignore if */
  2030. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  2031. // already a merged invoker
  2032. invoker = oldHook;
  2033. invoker.fns.push(wrappedHook);
  2034. } else {
  2035. // existing plain hook
  2036. invoker = createFnInvoker([oldHook, wrappedHook]);
  2037. }
  2038. }
  2039. invoker.merged = true;
  2040. def[hookKey] = invoker;
  2041. }
  2042. /* */
  2043. function extractPropsFromVNodeData (
  2044. data,
  2045. Ctor,
  2046. tag
  2047. ) {
  2048. // we are only extracting raw values here.
  2049. // validation and default values are handled in the child
  2050. // component itself.
  2051. var propOptions = Ctor.options.props;
  2052. if (isUndef(propOptions)) {
  2053. return
  2054. }
  2055. var res = {};
  2056. var attrs = data.attrs;
  2057. var props = data.props;
  2058. if (isDef(attrs) || isDef(props)) {
  2059. for (var key in propOptions) {
  2060. var altKey = hyphenate(key);
  2061. if (process.env.NODE_ENV !== 'production') {
  2062. var keyInLowerCase = key.toLowerCase();
  2063. if (
  2064. key !== keyInLowerCase &&
  2065. attrs && hasOwn(attrs, keyInLowerCase)
  2066. ) {
  2067. tip(
  2068. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  2069. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  2070. " \"" + key + "\". " +
  2071. "Note that HTML attributes are case-insensitive and camelCased " +
  2072. "props need to use their kebab-case equivalents when using in-DOM " +
  2073. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  2074. );
  2075. }
  2076. }
  2077. checkProp(res, props, key, altKey, true) ||
  2078. checkProp(res, attrs, key, altKey, false);
  2079. }
  2080. }
  2081. return res
  2082. }
  2083. function checkProp (
  2084. res,
  2085. hash,
  2086. key,
  2087. altKey,
  2088. preserve
  2089. ) {
  2090. if (isDef(hash)) {
  2091. if (hasOwn(hash, key)) {
  2092. res[key] = hash[key];
  2093. if (!preserve) {
  2094. delete hash[key];
  2095. }
  2096. return true
  2097. } else if (hasOwn(hash, altKey)) {
  2098. res[key] = hash[altKey];
  2099. if (!preserve) {
  2100. delete hash[altKey];
  2101. }
  2102. return true
  2103. }
  2104. }
  2105. return false
  2106. }
  2107. /* */
  2108. // The template compiler attempts to minimize the need for normalization by
  2109. // statically analyzing the template at compile time.
  2110. //
  2111. // For plain HTML markup, normalization can be completely skipped because the
  2112. // generated render function is guaranteed to return Array<VNode>. There are
  2113. // two cases where extra normalization is needed:
  2114. // 1. When the children contains components - because a functional component
  2115. // may return an Array instead of a single root. In this case, just a simple
  2116. // normalization is needed - if any child is an Array, we flatten the whole
  2117. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  2118. // because functional components already normalize their own children.
  2119. function simpleNormalizeChildren (children) {
  2120. for (var i = 0; i < children.length; i++) {
  2121. if (Array.isArray(children[i])) {
  2122. return Array.prototype.concat.apply([], children)
  2123. }
  2124. }
  2125. return children
  2126. }
  2127. // 2. When the children contains constructs that always generated nested Arrays,
  2128. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  2129. // with hand-written render functions / JSX. In such cases a full normalization
  2130. // is needed to cater to all possible types of children values.
  2131. function normalizeChildren (children) {
  2132. return isPrimitive(children)
  2133. ? [createTextVNode(children)]
  2134. : Array.isArray(children)
  2135. ? normalizeArrayChildren(children)
  2136. : undefined
  2137. }
  2138. function isTextNode (node) {
  2139. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  2140. }
  2141. function normalizeArrayChildren (children, nestedIndex) {
  2142. var res = [];
  2143. var i, c, lastIndex, last;
  2144. for (i = 0; i < children.length; i++) {
  2145. c = children[i];
  2146. if (isUndef(c) || typeof c === 'boolean') { continue }
  2147. lastIndex = res.length - 1;
  2148. last = res[lastIndex];
  2149. // nested
  2150. if (Array.isArray(c)) {
  2151. if (c.length > 0) {
  2152. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  2153. // merge adjacent text nodes
  2154. if (isTextNode(c[0]) && isTextNode(last)) {
  2155. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  2156. c.shift();
  2157. }
  2158. res.push.apply(res, c);
  2159. }
  2160. } else if (isPrimitive(c)) {
  2161. if (isTextNode(last)) {
  2162. // merge adjacent text nodes
  2163. // this is necessary for SSR hydration because text nodes are
  2164. // essentially merged when rendered to HTML strings
  2165. res[lastIndex] = createTextVNode(last.text + c);
  2166. } else if (c !== '') {
  2167. // convert primitive to vnode
  2168. res.push(createTextVNode(c));
  2169. }
  2170. } else {
  2171. if (isTextNode(c) && isTextNode(last)) {
  2172. // merge adjacent text nodes
  2173. res[lastIndex] = createTextVNode(last.text + c.text);
  2174. } else {
  2175. // default key for nested array children (likely generated by v-for)
  2176. if (isTrue(children._isVList) &&
  2177. isDef(c.tag) &&
  2178. isUndef(c.key) &&
  2179. isDef(nestedIndex)) {
  2180. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  2181. }
  2182. res.push(c);
  2183. }
  2184. }
  2185. }
  2186. return res
  2187. }
  2188. /* */
  2189. function initProvide (vm) {
  2190. var provide = vm.$options.provide;
  2191. if (provide) {
  2192. vm._provided = typeof provide === 'function'
  2193. ? provide.call(vm)
  2194. : provide;
  2195. }
  2196. }
  2197. function initInjections (vm) {
  2198. var result = resolveInject(vm.$options.inject, vm);
  2199. if (result) {
  2200. toggleObserving(false);
  2201. Object.keys(result).forEach(function (key) {
  2202. /* istanbul ignore else */
  2203. if (process.env.NODE_ENV !== 'production') {
  2204. defineReactive$$1(vm, key, result[key], function () {
  2205. warn(
  2206. "Avoid mutating an injected value directly since the changes will be " +
  2207. "overwritten whenever the provided component re-renders. " +
  2208. "injection being mutated: \"" + key + "\"",
  2209. vm
  2210. );
  2211. });
  2212. } else {
  2213. defineReactive$$1(vm, key, result[key]);
  2214. }
  2215. });
  2216. toggleObserving(true);
  2217. }
  2218. }
  2219. function resolveInject (inject, vm) {
  2220. if (inject) {
  2221. // inject is :any because flow is not smart enough to figure out cached
  2222. var result = Object.create(null);
  2223. var keys = hasSymbol
  2224. ? Reflect.ownKeys(inject)
  2225. : Object.keys(inject);
  2226. for (var i = 0; i < keys.length; i++) {
  2227. var key = keys[i];
  2228. // #6574 in case the inject object is observed...
  2229. if (key === '__ob__') { continue }
  2230. var provideKey = inject[key].from;
  2231. var source = vm;
  2232. while (source) {
  2233. if (source._provided && hasOwn(source._provided, provideKey)) {
  2234. result[key] = source._provided[provideKey];
  2235. break
  2236. }
  2237. source = source.$parent;
  2238. }
  2239. if (!source) {
  2240. if ('default' in inject[key]) {
  2241. var provideDefault = inject[key].default;
  2242. result[key] = typeof provideDefault === 'function'
  2243. ? provideDefault.call(vm)
  2244. : provideDefault;
  2245. } else if (process.env.NODE_ENV !== 'production') {
  2246. warn(("Injection \"" + key + "\" not found"), vm);
  2247. }
  2248. }
  2249. }
  2250. return result
  2251. }
  2252. }
  2253. /* */
  2254. /**
  2255. * Runtime helper for resolving raw children VNodes into a slot object.
  2256. */
  2257. function resolveSlots (
  2258. children,
  2259. context
  2260. ) {
  2261. if (!children || !children.length) {
  2262. return {}
  2263. }
  2264. var slots = {};
  2265. for (var i = 0, l = children.length; i < l; i++) {
  2266. var child = children[i];
  2267. var data = child.data;
  2268. // remove slot attribute if the node is resolved as a Vue slot node
  2269. if (data && data.attrs && data.attrs.slot) {
  2270. delete data.attrs.slot;
  2271. }
  2272. // named slots should only be respected if the vnode was rendered in the
  2273. // same context.
  2274. if ((child.context === context || child.fnContext === context) &&
  2275. data && data.slot != null
  2276. ) {
  2277. var name = data.slot;
  2278. var slot = (slots[name] || (slots[name] = []));
  2279. if (child.tag === 'template') {
  2280. slot.push.apply(slot, child.children || []);
  2281. } else {
  2282. slot.push(child);
  2283. }
  2284. } else {
  2285. (slots.default || (slots.default = [])).push(child);
  2286. }
  2287. }
  2288. // ignore slots that contains only whitespace
  2289. for (var name$1 in slots) {
  2290. if (slots[name$1].every(isWhitespace)) {
  2291. delete slots[name$1];
  2292. }
  2293. }
  2294. return slots
  2295. }
  2296. function isWhitespace (node) {
  2297. return (node.isComment && !node.asyncFactory) || node.text === ' '
  2298. }
  2299. /* */
  2300. function normalizeScopedSlots (
  2301. slots,
  2302. normalSlots,
  2303. prevSlots
  2304. ) {
  2305. var res;
  2306. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  2307. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  2308. var key = slots && slots.$key;
  2309. if (!slots) {
  2310. res = {};
  2311. } else if (slots._normalized) {
  2312. // fast path 1: child component re-render only, parent did not change
  2313. return slots._normalized
  2314. } else if (
  2315. isStable &&
  2316. prevSlots &&
  2317. prevSlots !== emptyObject &&
  2318. key === prevSlots.$key &&
  2319. !hasNormalSlots &&
  2320. !prevSlots.$hasNormal
  2321. ) {
  2322. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  2323. // only need to normalize once
  2324. return prevSlots
  2325. } else {
  2326. res = {};
  2327. for (var key$1 in slots) {
  2328. if (slots[key$1] && key$1[0] !== '$') {
  2329. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  2330. }
  2331. }
  2332. }
  2333. // expose normal slots on scopedSlots
  2334. for (var key$2 in normalSlots) {
  2335. if (!(key$2 in res)) {
  2336. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  2337. }
  2338. }
  2339. // avoriaz seems to mock a non-extensible $scopedSlots object
  2340. // and when that is passed down this would cause an error
  2341. if (slots && Object.isExtensible(slots)) {
  2342. (slots)._normalized = res;
  2343. }
  2344. def(res, '$stable', isStable);
  2345. def(res, '$key', key);
  2346. def(res, '$hasNormal', hasNormalSlots);
  2347. return res
  2348. }
  2349. function normalizeScopedSlot(normalSlots, key, fn) {
  2350. var normalized = function () {
  2351. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  2352. res = res && typeof res === 'object' && !Array.isArray(res)
  2353. ? [res] // single vnode
  2354. : normalizeChildren(res);
  2355. return res && (
  2356. res.length === 0 ||
  2357. (res.length === 1 && res[0].isComment) // #9658
  2358. ) ? undefined
  2359. : res
  2360. };
  2361. // this is a slot using the new v-slot syntax without scope. although it is
  2362. // compiled as a scoped slot, render fn users would expect it to be present
  2363. // on this.$slots because the usage is semantically a normal slot.
  2364. if (fn.proxy) {
  2365. Object.defineProperty(normalSlots, key, {
  2366. get: normalized,
  2367. enumerable: true,
  2368. configurable: true
  2369. });
  2370. }
  2371. return normalized
  2372. }
  2373. function proxyNormalSlot(slots, key) {
  2374. return function () { return slots[key]; }
  2375. }
  2376. /* */
  2377. /**
  2378. * Runtime helper for rendering v-for lists.
  2379. */
  2380. function renderList (
  2381. val,
  2382. render
  2383. ) {
  2384. var ret, i, l, keys, key;
  2385. if (Array.isArray(val) || typeof val === 'string') {
  2386. ret = new Array(val.length);
  2387. for (i = 0, l = val.length; i < l; i++) {
  2388. ret[i] = render(val[i], i);
  2389. }
  2390. } else if (typeof val === 'number') {
  2391. ret = new Array(val);
  2392. for (i = 0; i < val; i++) {
  2393. ret[i] = render(i + 1, i);
  2394. }
  2395. } else if (isObject(val)) {
  2396. if (hasSymbol && val[Symbol.iterator]) {
  2397. ret = [];
  2398. var iterator = val[Symbol.iterator]();
  2399. var result = iterator.next();
  2400. while (!result.done) {
  2401. ret.push(render(result.value, ret.length));
  2402. result = iterator.next();
  2403. }
  2404. } else {
  2405. keys = Object.keys(val);
  2406. ret = new Array(keys.length);
  2407. for (i = 0, l = keys.length; i < l; i++) {
  2408. key = keys[i];
  2409. ret[i] = render(val[key], key, i);
  2410. }
  2411. }
  2412. }
  2413. if (!isDef(ret)) {
  2414. ret = [];
  2415. }
  2416. (ret)._isVList = true;
  2417. return ret
  2418. }
  2419. /* */
  2420. /**
  2421. * Runtime helper for rendering <slot>
  2422. */
  2423. function renderSlot (
  2424. name,
  2425. fallback,
  2426. props,
  2427. bindObject
  2428. ) {
  2429. var scopedSlotFn = this.$scopedSlots[name];
  2430. var nodes;
  2431. if (scopedSlotFn) { // scoped slot
  2432. props = props || {};
  2433. if (bindObject) {
  2434. if (process.env.NODE_ENV !== 'production' && !isObject(bindObject)) {
  2435. warn(
  2436. 'slot v-bind without argument expects an Object',
  2437. this
  2438. );
  2439. }
  2440. props = extend(extend({}, bindObject), props);
  2441. }
  2442. nodes = scopedSlotFn(props) || fallback;
  2443. } else {
  2444. nodes = this.$slots[name] || fallback;
  2445. }
  2446. var target = props && props.slot;
  2447. if (target) {
  2448. return this.$createElement('template', { slot: target }, nodes)
  2449. } else {
  2450. return nodes
  2451. }
  2452. }
  2453. /* */
  2454. /**
  2455. * Runtime helper for resolving filters
  2456. */
  2457. function resolveFilter (id) {
  2458. return resolveAsset(this.$options, 'filters', id, true) || identity
  2459. }
  2460. /* */
  2461. function isKeyNotMatch (expect, actual) {
  2462. if (Array.isArray(expect)) {
  2463. return expect.indexOf(actual) === -1
  2464. } else {
  2465. return expect !== actual
  2466. }
  2467. }
  2468. /**
  2469. * Runtime helper for checking keyCodes from config.
  2470. * exposed as Vue.prototype._k
  2471. * passing in eventKeyName as last argument separately for backwards compat
  2472. */
  2473. function checkKeyCodes (
  2474. eventKeyCode,
  2475. key,
  2476. builtInKeyCode,
  2477. eventKeyName,
  2478. builtInKeyName
  2479. ) {
  2480. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  2481. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  2482. return isKeyNotMatch(builtInKeyName, eventKeyName)
  2483. } else if (mappedKeyCode) {
  2484. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  2485. } else if (eventKeyName) {
  2486. return hyphenate(eventKeyName) !== key
  2487. }
  2488. }
  2489. /* */
  2490. /**
  2491. * Runtime helper for merging v-bind="object" into a VNode's data.
  2492. */
  2493. function bindObjectProps (
  2494. data,
  2495. tag,
  2496. value,
  2497. asProp,
  2498. isSync
  2499. ) {
  2500. if (value) {
  2501. if (!isObject(value)) {
  2502. process.env.NODE_ENV !== 'production' && warn(
  2503. 'v-bind without argument expects an Object or Array value',
  2504. this
  2505. );
  2506. } else {
  2507. if (Array.isArray(value)) {
  2508. value = toObject(value);
  2509. }
  2510. var hash;
  2511. var loop = function ( key ) {
  2512. if (
  2513. key === 'class' ||
  2514. key === 'style' ||
  2515. isReservedAttribute(key)
  2516. ) {
  2517. hash = data;
  2518. } else {
  2519. var type = data.attrs && data.attrs.type;
  2520. hash = asProp || config.mustUseProp(tag, type, key)
  2521. ? data.domProps || (data.domProps = {})
  2522. : data.attrs || (data.attrs = {});
  2523. }
  2524. var camelizedKey = camelize(key);
  2525. var hyphenatedKey = hyphenate(key);
  2526. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  2527. hash[key] = value[key];
  2528. if (isSync) {
  2529. var on = data.on || (data.on = {});
  2530. on[("update:" + key)] = function ($event) {
  2531. value[key] = $event;
  2532. };
  2533. }
  2534. }
  2535. };
  2536. for (var key in value) loop( key );
  2537. }
  2538. }
  2539. return data
  2540. }
  2541. /* */
  2542. /**
  2543. * Runtime helper for rendering static trees.
  2544. */
  2545. function renderStatic (
  2546. index,
  2547. isInFor
  2548. ) {
  2549. var cached = this._staticTrees || (this._staticTrees = []);
  2550. var tree = cached[index];
  2551. // if has already-rendered static tree and not inside v-for,
  2552. // we can reuse the same tree.
  2553. if (tree && !isInFor) {
  2554. return tree
  2555. }
  2556. // otherwise, render a fresh tree.
  2557. tree = cached[index] = this.$options.staticRenderFns[index].call(
  2558. this._renderProxy,
  2559. null,
  2560. this // for render fns generated for functional component templates
  2561. );
  2562. markStatic(tree, ("__static__" + index), false);
  2563. return tree
  2564. }
  2565. /**
  2566. * Runtime helper for v-once.
  2567. * Effectively it means marking the node as static with a unique key.
  2568. */
  2569. function markOnce (
  2570. tree,
  2571. index,
  2572. key
  2573. ) {
  2574. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  2575. return tree
  2576. }
  2577. function markStatic (
  2578. tree,
  2579. key,
  2580. isOnce
  2581. ) {
  2582. if (Array.isArray(tree)) {
  2583. for (var i = 0; i < tree.length; i++) {
  2584. if (tree[i] && typeof tree[i] !== 'string') {
  2585. markStaticNode(tree[i], (key + "_" + i), isOnce);
  2586. }
  2587. }
  2588. } else {
  2589. markStaticNode(tree, key, isOnce);
  2590. }
  2591. }
  2592. function markStaticNode (node, key, isOnce) {
  2593. node.isStatic = true;
  2594. node.key = key;
  2595. node.isOnce = isOnce;
  2596. }
  2597. /* */
  2598. function bindObjectListeners (data, value) {
  2599. if (value) {
  2600. if (!isPlainObject(value)) {
  2601. process.env.NODE_ENV !== 'production' && warn(
  2602. 'v-on without argument expects an Object value',
  2603. this
  2604. );
  2605. } else {
  2606. var on = data.on = data.on ? extend({}, data.on) : {};
  2607. for (var key in value) {
  2608. var existing = on[key];
  2609. var ours = value[key];
  2610. on[key] = existing ? [].concat(existing, ours) : ours;
  2611. }
  2612. }
  2613. }
  2614. return data
  2615. }
  2616. /* */
  2617. function resolveScopedSlots (
  2618. fns, // see flow/vnode
  2619. res,
  2620. // the following are added in 2.6
  2621. hasDynamicKeys,
  2622. contentHashKey
  2623. ) {
  2624. res = res || { $stable: !hasDynamicKeys };
  2625. for (var i = 0; i < fns.length; i++) {
  2626. var slot = fns[i];
  2627. if (Array.isArray(slot)) {
  2628. resolveScopedSlots(slot, res, hasDynamicKeys);
  2629. } else if (slot) {
  2630. // marker for reverse proxying v-slot without scope on this.$slots
  2631. if (slot.proxy) {
  2632. slot.fn.proxy = true;
  2633. }
  2634. res[slot.key] = slot.fn;
  2635. }
  2636. }
  2637. if (contentHashKey) {
  2638. (res).$key = contentHashKey;
  2639. }
  2640. return res
  2641. }
  2642. /* */
  2643. function bindDynamicKeys (baseObj, values) {
  2644. for (var i = 0; i < values.length; i += 2) {
  2645. var key = values[i];
  2646. if (typeof key === 'string' && key) {
  2647. baseObj[values[i]] = values[i + 1];
  2648. } else if (process.env.NODE_ENV !== 'production' && key !== '' && key !== null) {
  2649. // null is a special value for explicitly removing a binding
  2650. warn(
  2651. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  2652. this
  2653. );
  2654. }
  2655. }
  2656. return baseObj
  2657. }
  2658. // helper to dynamically append modifier runtime markers to event names.
  2659. // ensure only append when value is already string, otherwise it will be cast
  2660. // to string and cause the type check to miss.
  2661. function prependModifier (value, symbol) {
  2662. return typeof value === 'string' ? symbol + value : value
  2663. }
  2664. /* */
  2665. function installRenderHelpers (target) {
  2666. target._o = markOnce;
  2667. target._n = toNumber;
  2668. target._s = toString;
  2669. target._l = renderList;
  2670. target._t = renderSlot;
  2671. target._q = looseEqual;
  2672. target._i = looseIndexOf;
  2673. target._m = renderStatic;
  2674. target._f = resolveFilter;
  2675. target._k = checkKeyCodes;
  2676. target._b = bindObjectProps;
  2677. target._v = createTextVNode;
  2678. target._e = createEmptyVNode;
  2679. target._u = resolveScopedSlots;
  2680. target._g = bindObjectListeners;
  2681. target._d = bindDynamicKeys;
  2682. target._p = prependModifier;
  2683. }
  2684. /* */
  2685. function FunctionalRenderContext (
  2686. data,
  2687. props,
  2688. children,
  2689. parent,
  2690. Ctor
  2691. ) {
  2692. var this$1 = this;
  2693. var options = Ctor.options;
  2694. // ensure the createElement function in functional components
  2695. // gets a unique context - this is necessary for correct named slot check
  2696. var contextVm;
  2697. if (hasOwn(parent, '_uid')) {
  2698. contextVm = Object.create(parent);
  2699. // $flow-disable-line
  2700. contextVm._original = parent;
  2701. } else {
  2702. // the context vm passed in is a functional context as well.
  2703. // in this case we want to make sure we are able to get a hold to the
  2704. // real context instance.
  2705. contextVm = parent;
  2706. // $flow-disable-line
  2707. parent = parent._original;
  2708. }
  2709. var isCompiled = isTrue(options._compiled);
  2710. var needNormalization = !isCompiled;
  2711. this.data = data;
  2712. this.props = props;
  2713. this.children = children;
  2714. this.parent = parent;
  2715. this.listeners = data.on || emptyObject;
  2716. this.injections = resolveInject(options.inject, parent);
  2717. this.slots = function () {
  2718. if (!this$1.$slots) {
  2719. normalizeScopedSlots(
  2720. data.scopedSlots,
  2721. this$1.$slots = resolveSlots(children, parent)
  2722. );
  2723. }
  2724. return this$1.$slots
  2725. };
  2726. Object.defineProperty(this, 'scopedSlots', ({
  2727. enumerable: true,
  2728. get: function get () {
  2729. return normalizeScopedSlots(data.scopedSlots, this.slots())
  2730. }
  2731. }));
  2732. // support for compiled functional template
  2733. if (isCompiled) {
  2734. // exposing $options for renderStatic()
  2735. this.$options = options;
  2736. // pre-resolve slots for renderSlot()
  2737. this.$slots = this.slots();
  2738. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  2739. }
  2740. if (options._scopeId) {
  2741. this._c = function (a, b, c, d) {
  2742. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  2743. if (vnode && !Array.isArray(vnode)) {
  2744. vnode.fnScopeId = options._scopeId;
  2745. vnode.fnContext = parent;
  2746. }
  2747. return vnode
  2748. };
  2749. } else {
  2750. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  2751. }
  2752. }
  2753. installRenderHelpers(FunctionalRenderContext.prototype);
  2754. function createFunctionalComponent (
  2755. Ctor,
  2756. propsData,
  2757. data,
  2758. contextVm,
  2759. children
  2760. ) {
  2761. var options = Ctor.options;
  2762. var props = {};
  2763. var propOptions = options.props;
  2764. if (isDef(propOptions)) {
  2765. for (var key in propOptions) {
  2766. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  2767. }
  2768. } else {
  2769. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  2770. if (isDef(data.props)) { mergeProps(props, data.props); }
  2771. }
  2772. var renderContext = new FunctionalRenderContext(
  2773. data,
  2774. props,
  2775. children,
  2776. contextVm,
  2777. Ctor
  2778. );
  2779. var vnode = options.render.call(null, renderContext._c, renderContext);
  2780. if (vnode instanceof VNode) {
  2781. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  2782. } else if (Array.isArray(vnode)) {
  2783. var vnodes = normalizeChildren(vnode) || [];
  2784. var res = new Array(vnodes.length);
  2785. for (var i = 0; i < vnodes.length; i++) {
  2786. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  2787. }
  2788. return res
  2789. }
  2790. }
  2791. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  2792. // #7817 clone node before setting fnContext, otherwise if the node is reused
  2793. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  2794. // that should not be matched to match.
  2795. var clone = cloneVNode(vnode);
  2796. clone.fnContext = contextVm;
  2797. clone.fnOptions = options;
  2798. if (process.env.NODE_ENV !== 'production') {
  2799. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  2800. }
  2801. if (data.slot) {
  2802. (clone.data || (clone.data = {})).slot = data.slot;
  2803. }
  2804. return clone
  2805. }
  2806. function mergeProps (to, from) {
  2807. for (var key in from) {
  2808. to[camelize(key)] = from[key];
  2809. }
  2810. }
  2811. /* */
  2812. /* */
  2813. /* */
  2814. /* */
  2815. // inline hooks to be invoked on component VNodes during patch
  2816. var componentVNodeHooks = {
  2817. init: function init (vnode, hydrating) {
  2818. if (
  2819. vnode.componentInstance &&
  2820. !vnode.componentInstance._isDestroyed &&
  2821. vnode.data.keepAlive
  2822. ) {
  2823. // kept-alive components, treat as a patch
  2824. var mountedNode = vnode; // work around flow
  2825. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  2826. } else {
  2827. var child = vnode.componentInstance = createComponentInstanceForVnode(
  2828. vnode,
  2829. activeInstance
  2830. );
  2831. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  2832. }
  2833. },
  2834. prepatch: function prepatch (oldVnode, vnode) {
  2835. var options = vnode.componentOptions;
  2836. var child = vnode.componentInstance = oldVnode.componentInstance;
  2837. updateChildComponent(
  2838. child,
  2839. options.propsData, // updated props
  2840. options.listeners, // updated listeners
  2841. vnode, // new parent vnode
  2842. options.children // new children
  2843. );
  2844. },
  2845. insert: function insert (vnode) {
  2846. var context = vnode.context;
  2847. var componentInstance = vnode.componentInstance;
  2848. if (!componentInstance._isMounted) {
  2849. componentInstance._isMounted = true;
  2850. callHook(componentInstance, 'mounted');
  2851. }
  2852. if (vnode.data.keepAlive) {
  2853. if (context._isMounted) {
  2854. // vue-router#1212
  2855. // During updates, a kept-alive component's child components may
  2856. // change, so directly walking the tree here may call activated hooks
  2857. // on incorrect children. Instead we push them into a queue which will
  2858. // be processed after the whole patch process ended.
  2859. queueActivatedComponent(componentInstance);
  2860. } else {
  2861. activateChildComponent(componentInstance, true /* direct */);
  2862. }
  2863. }
  2864. },
  2865. destroy: function destroy (vnode) {
  2866. var componentInstance = vnode.componentInstance;
  2867. if (!componentInstance._isDestroyed) {
  2868. if (!vnode.data.keepAlive) {
  2869. componentInstance.$destroy();
  2870. } else {
  2871. deactivateChildComponent(componentInstance, true /* direct */);
  2872. }
  2873. }
  2874. }
  2875. };
  2876. var hooksToMerge = Object.keys(componentVNodeHooks);
  2877. function createComponent (
  2878. Ctor,
  2879. data,
  2880. context,
  2881. children,
  2882. tag
  2883. ) {
  2884. if (isUndef(Ctor)) {
  2885. return
  2886. }
  2887. var baseCtor = context.$options._base;
  2888. // plain options object: turn it into a constructor
  2889. if (isObject(Ctor)) {
  2890. Ctor = baseCtor.extend(Ctor);
  2891. }
  2892. // if at this stage it's not a constructor or an async component factory,
  2893. // reject.
  2894. if (typeof Ctor !== 'function') {
  2895. if (process.env.NODE_ENV !== 'production') {
  2896. warn(("Invalid Component definition: " + (String(Ctor))), context);
  2897. }
  2898. return
  2899. }
  2900. // async component
  2901. var asyncFactory;
  2902. if (isUndef(Ctor.cid)) {
  2903. asyncFactory = Ctor;
  2904. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  2905. if (Ctor === undefined) {
  2906. // return a placeholder node for async component, which is rendered
  2907. // as a comment node but preserves all the raw information for the node.
  2908. // the information will be used for async server-rendering and hydration.
  2909. return createAsyncPlaceholder(
  2910. asyncFactory,
  2911. data,
  2912. context,
  2913. children,
  2914. tag
  2915. )
  2916. }
  2917. }
  2918. data = data || {};
  2919. // resolve constructor options in case global mixins are applied after
  2920. // component constructor creation
  2921. resolveConstructorOptions(Ctor);
  2922. // transform component v-model data into props & events
  2923. if (isDef(data.model)) {
  2924. transformModel(Ctor.options, data);
  2925. }
  2926. // extract props
  2927. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  2928. // functional component
  2929. if (isTrue(Ctor.options.functional)) {
  2930. return createFunctionalComponent(Ctor, propsData, data, context, children)
  2931. }
  2932. // extract listeners, since these needs to be treated as
  2933. // child component listeners instead of DOM listeners
  2934. var listeners = data.on;
  2935. // replace with listeners with .native modifier
  2936. // so it gets processed during parent component patch.
  2937. data.on = data.nativeOn;
  2938. if (isTrue(Ctor.options.abstract)) {
  2939. // abstract components do not keep anything
  2940. // other than props & listeners & slot
  2941. // work around flow
  2942. var slot = data.slot;
  2943. data = {};
  2944. if (slot) {
  2945. data.slot = slot;
  2946. }
  2947. }
  2948. // install component management hooks onto the placeholder node
  2949. installComponentHooks(data);
  2950. // return a placeholder vnode
  2951. var name = Ctor.options.name || tag;
  2952. var vnode = new VNode(
  2953. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  2954. data, undefined, undefined, undefined, context,
  2955. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  2956. asyncFactory
  2957. );
  2958. return vnode
  2959. }
  2960. function createComponentInstanceForVnode (
  2961. vnode, // we know it's MountedComponentVNode but flow doesn't
  2962. parent // activeInstance in lifecycle state
  2963. ) {
  2964. var options = {
  2965. _isComponent: true,
  2966. _parentVnode: vnode,
  2967. parent: parent
  2968. };
  2969. // check inline-template render functions
  2970. var inlineTemplate = vnode.data.inlineTemplate;
  2971. if (isDef(inlineTemplate)) {
  2972. options.render = inlineTemplate.render;
  2973. options.staticRenderFns = inlineTemplate.staticRenderFns;
  2974. }
  2975. return new vnode.componentOptions.Ctor(options)
  2976. }
  2977. function installComponentHooks (data) {
  2978. var hooks = data.hook || (data.hook = {});
  2979. for (var i = 0; i < hooksToMerge.length; i++) {
  2980. var key = hooksToMerge[i];
  2981. var existing = hooks[key];
  2982. var toMerge = componentVNodeHooks[key];
  2983. if (existing !== toMerge && !(existing && existing._merged)) {
  2984. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  2985. }
  2986. }
  2987. }
  2988. function mergeHook$1 (f1, f2) {
  2989. var merged = function (a, b) {
  2990. // flow complains about extra args which is why we use any
  2991. f1(a, b);
  2992. f2(a, b);
  2993. };
  2994. merged._merged = true;
  2995. return merged
  2996. }
  2997. // transform component v-model info (value and callback) into
  2998. // prop and event handler respectively.
  2999. function transformModel (options, data) {
  3000. var prop = (options.model && options.model.prop) || 'value';
  3001. var event = (options.model && options.model.event) || 'input'
  3002. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  3003. var on = data.on || (data.on = {});
  3004. var existing = on[event];
  3005. var callback = data.model.callback;
  3006. if (isDef(existing)) {
  3007. if (
  3008. Array.isArray(existing)
  3009. ? existing.indexOf(callback) === -1
  3010. : existing !== callback
  3011. ) {
  3012. on[event] = [callback].concat(existing);
  3013. }
  3014. } else {
  3015. on[event] = callback;
  3016. }
  3017. }
  3018. /* */
  3019. var SIMPLE_NORMALIZE = 1;
  3020. var ALWAYS_NORMALIZE = 2;
  3021. // wrapper function for providing a more flexible interface
  3022. // without getting yelled at by flow
  3023. function createElement (
  3024. context,
  3025. tag,
  3026. data,
  3027. children,
  3028. normalizationType,
  3029. alwaysNormalize
  3030. ) {
  3031. if (Array.isArray(data) || isPrimitive(data)) {
  3032. normalizationType = children;
  3033. children = data;
  3034. data = undefined;
  3035. }
  3036. if (isTrue(alwaysNormalize)) {
  3037. normalizationType = ALWAYS_NORMALIZE;
  3038. }
  3039. return _createElement(context, tag, data, children, normalizationType)
  3040. }
  3041. function _createElement (
  3042. context,
  3043. tag,
  3044. data,
  3045. children,
  3046. normalizationType
  3047. ) {
  3048. if (isDef(data) && isDef((data).__ob__)) {
  3049. process.env.NODE_ENV !== 'production' && warn(
  3050. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  3051. 'Always create fresh vnode data objects in each render!',
  3052. context
  3053. );
  3054. return createEmptyVNode()
  3055. }
  3056. // object syntax in v-bind
  3057. if (isDef(data) && isDef(data.is)) {
  3058. tag = data.is;
  3059. }
  3060. if (!tag) {
  3061. // in case of component :is set to falsy value
  3062. return createEmptyVNode()
  3063. }
  3064. // warn against non-primitive key
  3065. if (process.env.NODE_ENV !== 'production' &&
  3066. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  3067. ) {
  3068. {
  3069. warn(
  3070. 'Avoid using non-primitive value as key, ' +
  3071. 'use string/number value instead.',
  3072. context
  3073. );
  3074. }
  3075. }
  3076. // support single function children as default scoped slot
  3077. if (Array.isArray(children) &&
  3078. typeof children[0] === 'function'
  3079. ) {
  3080. data = data || {};
  3081. data.scopedSlots = { default: children[0] };
  3082. children.length = 0;
  3083. }
  3084. if (normalizationType === ALWAYS_NORMALIZE) {
  3085. children = normalizeChildren(children);
  3086. } else if (normalizationType === SIMPLE_NORMALIZE) {
  3087. children = simpleNormalizeChildren(children);
  3088. }
  3089. var vnode, ns;
  3090. if (typeof tag === 'string') {
  3091. var Ctor;
  3092. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  3093. if (config.isReservedTag(tag)) {
  3094. // platform built-in elements
  3095. if (process.env.NODE_ENV !== 'production' && isDef(data) && isDef(data.nativeOn)) {
  3096. warn(
  3097. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  3098. context
  3099. );
  3100. }
  3101. vnode = new VNode(
  3102. config.parsePlatformTagName(tag), data, children,
  3103. undefined, undefined, context
  3104. );
  3105. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  3106. // component
  3107. vnode = createComponent(Ctor, data, context, children, tag);
  3108. } else {
  3109. // unknown or unlisted namespaced elements
  3110. // check at runtime because it may get assigned a namespace when its
  3111. // parent normalizes children
  3112. vnode = new VNode(
  3113. tag, data, children,
  3114. undefined, undefined, context
  3115. );
  3116. }
  3117. } else {
  3118. // direct component options / constructor
  3119. vnode = createComponent(tag, data, context, children);
  3120. }
  3121. if (Array.isArray(vnode)) {
  3122. return vnode
  3123. } else if (isDef(vnode)) {
  3124. if (isDef(ns)) { applyNS(vnode, ns); }
  3125. if (isDef(data)) { registerDeepBindings(data); }
  3126. return vnode
  3127. } else {
  3128. return createEmptyVNode()
  3129. }
  3130. }
  3131. function applyNS (vnode, ns, force) {
  3132. vnode.ns = ns;
  3133. if (vnode.tag === 'foreignObject') {
  3134. // use default namespace inside foreignObject
  3135. ns = undefined;
  3136. force = true;
  3137. }
  3138. if (isDef(vnode.children)) {
  3139. for (var i = 0, l = vnode.children.length; i < l; i++) {
  3140. var child = vnode.children[i];
  3141. if (isDef(child.tag) && (
  3142. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  3143. applyNS(child, ns, force);
  3144. }
  3145. }
  3146. }
  3147. }
  3148. // ref #5318
  3149. // necessary to ensure parent re-render when deep bindings like :style and
  3150. // :class are used on slot nodes
  3151. function registerDeepBindings (data) {
  3152. if (isObject(data.style)) {
  3153. traverse(data.style);
  3154. }
  3155. if (isObject(data.class)) {
  3156. traverse(data.class);
  3157. }
  3158. }
  3159. /* */
  3160. function initRender (vm) {
  3161. vm._vnode = null; // the root of the child tree
  3162. vm._staticTrees = null; // v-once cached trees
  3163. var options = vm.$options;
  3164. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  3165. var renderContext = parentVnode && parentVnode.context;
  3166. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  3167. vm.$scopedSlots = emptyObject;
  3168. // bind the createElement fn to this instance
  3169. // so that we get proper render context inside it.
  3170. // args order: tag, data, children, normalizationType, alwaysNormalize
  3171. // internal version is used by render functions compiled from templates
  3172. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  3173. // normalization is always applied for the public version, used in
  3174. // user-written render functions.
  3175. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  3176. // $attrs & $listeners are exposed for easier HOC creation.
  3177. // they need to be reactive so that HOCs using them are always updated
  3178. var parentData = parentVnode && parentVnode.data;
  3179. /* istanbul ignore else */
  3180. if (process.env.NODE_ENV !== 'production') {
  3181. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  3182. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  3183. }, true);
  3184. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  3185. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  3186. }, true);
  3187. } else {
  3188. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true);
  3189. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, null, true);
  3190. }
  3191. }
  3192. var currentRenderingInstance = null;
  3193. function renderMixin (Vue) {
  3194. // install runtime convenience helpers
  3195. installRenderHelpers(Vue.prototype);
  3196. Vue.prototype.$nextTick = function (fn) {
  3197. return nextTick(fn, this)
  3198. };
  3199. Vue.prototype._render = function () {
  3200. var vm = this;
  3201. var ref = vm.$options;
  3202. var render = ref.render;
  3203. var _parentVnode = ref._parentVnode;
  3204. if (_parentVnode) {
  3205. vm.$scopedSlots = normalizeScopedSlots(
  3206. _parentVnode.data.scopedSlots,
  3207. vm.$slots,
  3208. vm.$scopedSlots
  3209. );
  3210. }
  3211. // set parent vnode. this allows render functions to have access
  3212. // to the data on the placeholder node.
  3213. vm.$vnode = _parentVnode;
  3214. // render self
  3215. var vnode;
  3216. try {
  3217. // There's no need to maintain a stack because all render fns are called
  3218. // separately from one another. Nested component's render fns are called
  3219. // when parent component is patched.
  3220. currentRenderingInstance = vm;
  3221. vnode = render.call(vm._renderProxy, vm.$createElement);
  3222. } catch (e) {
  3223. handleError(e, vm, "render");
  3224. // return error render result,
  3225. // or previous vnode to prevent render error causing blank component
  3226. /* istanbul ignore else */
  3227. if (process.env.NODE_ENV !== 'production' && vm.$options.renderError) {
  3228. try {
  3229. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  3230. } catch (e) {
  3231. handleError(e, vm, "renderError");
  3232. vnode = vm._vnode;
  3233. }
  3234. } else {
  3235. vnode = vm._vnode;
  3236. }
  3237. } finally {
  3238. currentRenderingInstance = null;
  3239. }
  3240. // if the returned array contains only a single node, allow it
  3241. if (Array.isArray(vnode) && vnode.length === 1) {
  3242. vnode = vnode[0];
  3243. }
  3244. // return empty vnode in case the render function errored out
  3245. if (!(vnode instanceof VNode)) {
  3246. if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) {
  3247. warn(
  3248. 'Multiple root nodes returned from render function. Render function ' +
  3249. 'should return a single root node.',
  3250. vm
  3251. );
  3252. }
  3253. vnode = createEmptyVNode();
  3254. }
  3255. // set parent
  3256. vnode.parent = _parentVnode;
  3257. return vnode
  3258. };
  3259. }
  3260. /* */
  3261. function ensureCtor (comp, base) {
  3262. if (
  3263. comp.__esModule ||
  3264. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  3265. ) {
  3266. comp = comp.default;
  3267. }
  3268. return isObject(comp)
  3269. ? base.extend(comp)
  3270. : comp
  3271. }
  3272. function createAsyncPlaceholder (
  3273. factory,
  3274. data,
  3275. context,
  3276. children,
  3277. tag
  3278. ) {
  3279. var node = createEmptyVNode();
  3280. node.asyncFactory = factory;
  3281. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  3282. return node
  3283. }
  3284. function resolveAsyncComponent (
  3285. factory,
  3286. baseCtor
  3287. ) {
  3288. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  3289. return factory.errorComp
  3290. }
  3291. if (isDef(factory.resolved)) {
  3292. return factory.resolved
  3293. }
  3294. var owner = currentRenderingInstance;
  3295. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  3296. // already pending
  3297. factory.owners.push(owner);
  3298. }
  3299. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  3300. return factory.loadingComp
  3301. }
  3302. if (owner && !isDef(factory.owners)) {
  3303. var owners = factory.owners = [owner];
  3304. var sync = true;
  3305. var timerLoading = null;
  3306. var timerTimeout = null
  3307. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  3308. var forceRender = function (renderCompleted) {
  3309. for (var i = 0, l = owners.length; i < l; i++) {
  3310. (owners[i]).$forceUpdate();
  3311. }
  3312. if (renderCompleted) {
  3313. owners.length = 0;
  3314. if (timerLoading !== null) {
  3315. clearTimeout(timerLoading);
  3316. timerLoading = null;
  3317. }
  3318. if (timerTimeout !== null) {
  3319. clearTimeout(timerTimeout);
  3320. timerTimeout = null;
  3321. }
  3322. }
  3323. };
  3324. var resolve = once(function (res) {
  3325. // cache resolved
  3326. factory.resolved = ensureCtor(res, baseCtor);
  3327. // invoke callbacks only if this is not a synchronous resolve
  3328. // (async resolves are shimmed as synchronous during SSR)
  3329. if (!sync) {
  3330. forceRender(true);
  3331. } else {
  3332. owners.length = 0;
  3333. }
  3334. });
  3335. var reject = once(function (reason) {
  3336. process.env.NODE_ENV !== 'production' && warn(
  3337. "Failed to resolve async component: " + (String(factory)) +
  3338. (reason ? ("\nReason: " + reason) : '')
  3339. );
  3340. if (isDef(factory.errorComp)) {
  3341. factory.error = true;
  3342. forceRender(true);
  3343. }
  3344. });
  3345. var res = factory(resolve, reject);
  3346. if (isObject(res)) {
  3347. if (isPromise(res)) {
  3348. // () => Promise
  3349. if (isUndef(factory.resolved)) {
  3350. res.then(resolve, reject);
  3351. }
  3352. } else if (isPromise(res.component)) {
  3353. res.component.then(resolve, reject);
  3354. if (isDef(res.error)) {
  3355. factory.errorComp = ensureCtor(res.error, baseCtor);
  3356. }
  3357. if (isDef(res.loading)) {
  3358. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  3359. if (res.delay === 0) {
  3360. factory.loading = true;
  3361. } else {
  3362. timerLoading = setTimeout(function () {
  3363. timerLoading = null;
  3364. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  3365. factory.loading = true;
  3366. forceRender(false);
  3367. }
  3368. }, res.delay || 200);
  3369. }
  3370. }
  3371. if (isDef(res.timeout)) {
  3372. timerTimeout = setTimeout(function () {
  3373. timerTimeout = null;
  3374. if (isUndef(factory.resolved)) {
  3375. reject(
  3376. process.env.NODE_ENV !== 'production'
  3377. ? ("timeout (" + (res.timeout) + "ms)")
  3378. : null
  3379. );
  3380. }
  3381. }, res.timeout);
  3382. }
  3383. }
  3384. }
  3385. sync = false;
  3386. // return in case resolved synchronously
  3387. return factory.loading
  3388. ? factory.loadingComp
  3389. : factory.resolved
  3390. }
  3391. }
  3392. /* */
  3393. function isAsyncPlaceholder (node) {
  3394. return node.isComment && node.asyncFactory
  3395. }
  3396. /* */
  3397. function getFirstComponentChild (children) {
  3398. if (Array.isArray(children)) {
  3399. for (var i = 0; i < children.length; i++) {
  3400. var c = children[i];
  3401. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  3402. return c
  3403. }
  3404. }
  3405. }
  3406. }
  3407. /* */
  3408. /* */
  3409. function initEvents (vm) {
  3410. vm._events = Object.create(null);
  3411. vm._hasHookEvent = false;
  3412. // init parent attached events
  3413. var listeners = vm.$options._parentListeners;
  3414. if (listeners) {
  3415. updateComponentListeners(vm, listeners);
  3416. }
  3417. }
  3418. var target;
  3419. function add (event, fn) {
  3420. target.$on(event, fn);
  3421. }
  3422. function remove$1 (event, fn) {
  3423. target.$off(event, fn);
  3424. }
  3425. function createOnceHandler (event, fn) {
  3426. var _target = target;
  3427. return function onceHandler () {
  3428. var res = fn.apply(null, arguments);
  3429. if (res !== null) {
  3430. _target.$off(event, onceHandler);
  3431. }
  3432. }
  3433. }
  3434. function updateComponentListeners (
  3435. vm,
  3436. listeners,
  3437. oldListeners
  3438. ) {
  3439. target = vm;
  3440. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  3441. target = undefined;
  3442. }
  3443. function eventsMixin (Vue) {
  3444. var hookRE = /^hook:/;
  3445. Vue.prototype.$on = function (event, fn) {
  3446. var vm = this;
  3447. if (Array.isArray(event)) {
  3448. for (var i = 0, l = event.length; i < l; i++) {
  3449. vm.$on(event[i], fn);
  3450. }
  3451. } else {
  3452. (vm._events[event] || (vm._events[event] = [])).push(fn);
  3453. // optimize hook:event cost by using a boolean flag marked at registration
  3454. // instead of a hash lookup
  3455. if (hookRE.test(event)) {
  3456. vm._hasHookEvent = true;
  3457. }
  3458. }
  3459. return vm
  3460. };
  3461. Vue.prototype.$once = function (event, fn) {
  3462. var vm = this;
  3463. function on () {
  3464. vm.$off(event, on);
  3465. fn.apply(vm, arguments);
  3466. }
  3467. on.fn = fn;
  3468. vm.$on(event, on);
  3469. return vm
  3470. };
  3471. Vue.prototype.$off = function (event, fn) {
  3472. var vm = this;
  3473. // all
  3474. if (!arguments.length) {
  3475. vm._events = Object.create(null);
  3476. return vm
  3477. }
  3478. // array of events
  3479. if (Array.isArray(event)) {
  3480. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  3481. vm.$off(event[i$1], fn);
  3482. }
  3483. return vm
  3484. }
  3485. // specific event
  3486. var cbs = vm._events[event];
  3487. if (!cbs) {
  3488. return vm
  3489. }
  3490. if (!fn) {
  3491. vm._events[event] = null;
  3492. return vm
  3493. }
  3494. // specific handler
  3495. var cb;
  3496. var i = cbs.length;
  3497. while (i--) {
  3498. cb = cbs[i];
  3499. if (cb === fn || cb.fn === fn) {
  3500. cbs.splice(i, 1);
  3501. break
  3502. }
  3503. }
  3504. return vm
  3505. };
  3506. Vue.prototype.$emit = function (event) {
  3507. var vm = this;
  3508. if (process.env.NODE_ENV !== 'production') {
  3509. var lowerCaseEvent = event.toLowerCase();
  3510. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  3511. tip(
  3512. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  3513. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  3514. "Note that HTML attributes are case-insensitive and you cannot use " +
  3515. "v-on to listen to camelCase events when using in-DOM templates. " +
  3516. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  3517. );
  3518. }
  3519. }
  3520. var cbs = vm._events[event];
  3521. if (cbs) {
  3522. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  3523. var args = toArray(arguments, 1);
  3524. var info = "event handler for \"" + event + "\"";
  3525. for (var i = 0, l = cbs.length; i < l; i++) {
  3526. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  3527. }
  3528. }
  3529. return vm
  3530. };
  3531. }
  3532. /* */
  3533. var activeInstance = null;
  3534. var isUpdatingChildComponent = false;
  3535. function setActiveInstance(vm) {
  3536. var prevActiveInstance = activeInstance;
  3537. activeInstance = vm;
  3538. return function () {
  3539. activeInstance = prevActiveInstance;
  3540. }
  3541. }
  3542. function initLifecycle (vm) {
  3543. var options = vm.$options;
  3544. // locate first non-abstract parent
  3545. var parent = options.parent;
  3546. if (parent && !options.abstract) {
  3547. while (parent.$options.abstract && parent.$parent) {
  3548. parent = parent.$parent;
  3549. }
  3550. parent.$children.push(vm);
  3551. }
  3552. vm.$parent = parent;
  3553. vm.$root = parent ? parent.$root : vm;
  3554. vm.$children = [];
  3555. vm.$refs = {};
  3556. vm._watcher = null;
  3557. vm._inactive = null;
  3558. vm._directInactive = false;
  3559. vm._isMounted = false;
  3560. vm._isDestroyed = false;
  3561. vm._isBeingDestroyed = false;
  3562. }
  3563. function lifecycleMixin (Vue) {
  3564. Vue.prototype._update = function (vnode, hydrating) {
  3565. var vm = this;
  3566. var prevEl = vm.$el;
  3567. var prevVnode = vm._vnode;
  3568. var restoreActiveInstance = setActiveInstance(vm);
  3569. vm._vnode = vnode;
  3570. // Vue.prototype.__patch__ is injected in entry points
  3571. // based on the rendering backend used.
  3572. if (!prevVnode) {
  3573. // initial render
  3574. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  3575. } else {
  3576. // updates
  3577. vm.$el = vm.__patch__(prevVnode, vnode);
  3578. }
  3579. restoreActiveInstance();
  3580. // update __vue__ reference
  3581. if (prevEl) {
  3582. prevEl.__vue__ = null;
  3583. }
  3584. if (vm.$el) {
  3585. vm.$el.__vue__ = vm;
  3586. }
  3587. // if parent is an HOC, update its $el as well
  3588. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  3589. vm.$parent.$el = vm.$el;
  3590. }
  3591. // updated hook is called by the scheduler to ensure that children are
  3592. // updated in a parent's updated hook.
  3593. };
  3594. Vue.prototype.$forceUpdate = function () {
  3595. var vm = this;
  3596. if (vm._watcher) {
  3597. vm._watcher.update();
  3598. }
  3599. };
  3600. Vue.prototype.$destroy = function () {
  3601. var vm = this;
  3602. if (vm._isBeingDestroyed) {
  3603. return
  3604. }
  3605. callHook(vm, 'beforeDestroy');
  3606. vm._isBeingDestroyed = true;
  3607. // remove self from parent
  3608. var parent = vm.$parent;
  3609. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  3610. remove(parent.$children, vm);
  3611. }
  3612. // teardown watchers
  3613. if (vm._watcher) {
  3614. vm._watcher.teardown();
  3615. }
  3616. var i = vm._watchers.length;
  3617. while (i--) {
  3618. vm._watchers[i].teardown();
  3619. }
  3620. // remove reference from data ob
  3621. // frozen object may not have observer.
  3622. if (vm._data.__ob__) {
  3623. vm._data.__ob__.vmCount--;
  3624. }
  3625. // call the last hook...
  3626. vm._isDestroyed = true;
  3627. // invoke destroy hooks on current rendered tree
  3628. vm.__patch__(vm._vnode, null);
  3629. // fire destroyed hook
  3630. callHook(vm, 'destroyed');
  3631. // turn off all instance listeners.
  3632. vm.$off();
  3633. // remove __vue__ reference
  3634. if (vm.$el) {
  3635. vm.$el.__vue__ = null;
  3636. }
  3637. // release circular reference (#6759)
  3638. if (vm.$vnode) {
  3639. vm.$vnode.parent = null;
  3640. }
  3641. };
  3642. }
  3643. function mountComponent (
  3644. vm,
  3645. el,
  3646. hydrating
  3647. ) {
  3648. vm.$el = el;
  3649. if (!vm.$options.render) {
  3650. vm.$options.render = createEmptyVNode;
  3651. if (process.env.NODE_ENV !== 'production') {
  3652. /* istanbul ignore if */
  3653. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  3654. vm.$options.el || el) {
  3655. warn(
  3656. 'You are using the runtime-only build of Vue where the template ' +
  3657. 'compiler is not available. Either pre-compile the templates into ' +
  3658. 'render functions, or use the compiler-included build.',
  3659. vm
  3660. );
  3661. } else {
  3662. warn(
  3663. 'Failed to mount component: template or render function not defined.',
  3664. vm
  3665. );
  3666. }
  3667. }
  3668. }
  3669. callHook(vm, 'beforeMount');
  3670. var updateComponent;
  3671. /* istanbul ignore if */
  3672. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  3673. updateComponent = function () {
  3674. var name = vm._name;
  3675. var id = vm._uid;
  3676. var startTag = "vue-perf-start:" + id;
  3677. var endTag = "vue-perf-end:" + id;
  3678. mark(startTag);
  3679. var vnode = vm._render();
  3680. mark(endTag);
  3681. measure(("vue " + name + " render"), startTag, endTag);
  3682. mark(startTag);
  3683. vm._update(vnode, hydrating);
  3684. mark(endTag);
  3685. measure(("vue " + name + " patch"), startTag, endTag);
  3686. };
  3687. } else {
  3688. updateComponent = function () {
  3689. vm._update(vm._render(), hydrating);
  3690. };
  3691. }
  3692. // we set this to vm._watcher inside the watcher's constructor
  3693. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  3694. // component's mounted hook), which relies on vm._watcher being already defined
  3695. new Watcher(vm, updateComponent, noop, {
  3696. before: function before () {
  3697. if (vm._isMounted && !vm._isDestroyed) {
  3698. callHook(vm, 'beforeUpdate');
  3699. }
  3700. }
  3701. }, true /* isRenderWatcher */);
  3702. hydrating = false;
  3703. // manually mounted instance, call mounted on self
  3704. // mounted is called for render-created child components in its inserted hook
  3705. if (vm.$vnode == null) {
  3706. vm._isMounted = true;
  3707. callHook(vm, 'mounted');
  3708. }
  3709. return vm
  3710. }
  3711. function updateChildComponent (
  3712. vm,
  3713. propsData,
  3714. listeners,
  3715. parentVnode,
  3716. renderChildren
  3717. ) {
  3718. if (process.env.NODE_ENV !== 'production') {
  3719. isUpdatingChildComponent = true;
  3720. }
  3721. // determine whether component has slot children
  3722. // we need to do this before overwriting $options._renderChildren.
  3723. // check if there are dynamic scopedSlots (hand-written or compiled but with
  3724. // dynamic slot names). Static scoped slots compiled from template has the
  3725. // "$stable" marker.
  3726. var newScopedSlots = parentVnode.data.scopedSlots;
  3727. var oldScopedSlots = vm.$scopedSlots;
  3728. var hasDynamicScopedSlot = !!(
  3729. (newScopedSlots && !newScopedSlots.$stable) ||
  3730. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  3731. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  3732. );
  3733. // Any static slot children from the parent may have changed during parent's
  3734. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  3735. // update is necessary to ensure correctness.
  3736. var needsForceUpdate = !!(
  3737. renderChildren || // has new static slots
  3738. vm.$options._renderChildren || // has old static slots
  3739. hasDynamicScopedSlot
  3740. );
  3741. vm.$options._parentVnode = parentVnode;
  3742. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  3743. if (vm._vnode) { // update child tree's parent
  3744. vm._vnode.parent = parentVnode;
  3745. }
  3746. vm.$options._renderChildren = renderChildren;
  3747. // update $attrs and $listeners hash
  3748. // these are also reactive so they may trigger child update if the child
  3749. // used them during render
  3750. vm.$attrs = parentVnode.data.attrs || emptyObject;
  3751. vm.$listeners = listeners || emptyObject;
  3752. // update props
  3753. if (propsData && vm.$options.props) {
  3754. toggleObserving(false);
  3755. var props = vm._props;
  3756. var propKeys = vm.$options._propKeys || [];
  3757. for (var i = 0; i < propKeys.length; i++) {
  3758. var key = propKeys[i];
  3759. var propOptions = vm.$options.props; // wtf flow?
  3760. props[key] = validateProp(key, propOptions, propsData, vm);
  3761. }
  3762. toggleObserving(true);
  3763. // keep a copy of raw propsData
  3764. vm.$options.propsData = propsData;
  3765. }
  3766. // update listeners
  3767. listeners = listeners || emptyObject;
  3768. var oldListeners = vm.$options._parentListeners;
  3769. vm.$options._parentListeners = listeners;
  3770. updateComponentListeners(vm, listeners, oldListeners);
  3771. // resolve slots + force update if has children
  3772. if (needsForceUpdate) {
  3773. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  3774. vm.$forceUpdate();
  3775. }
  3776. if (process.env.NODE_ENV !== 'production') {
  3777. isUpdatingChildComponent = false;
  3778. }
  3779. }
  3780. function isInInactiveTree (vm) {
  3781. while (vm && (vm = vm.$parent)) {
  3782. if (vm._inactive) { return true }
  3783. }
  3784. return false
  3785. }
  3786. function activateChildComponent (vm, direct) {
  3787. if (direct) {
  3788. vm._directInactive = false;
  3789. if (isInInactiveTree(vm)) {
  3790. return
  3791. }
  3792. } else if (vm._directInactive) {
  3793. return
  3794. }
  3795. if (vm._inactive || vm._inactive === null) {
  3796. vm._inactive = false;
  3797. for (var i = 0; i < vm.$children.length; i++) {
  3798. activateChildComponent(vm.$children[i]);
  3799. }
  3800. callHook(vm, 'activated');
  3801. }
  3802. }
  3803. function deactivateChildComponent (vm, direct) {
  3804. if (direct) {
  3805. vm._directInactive = true;
  3806. if (isInInactiveTree(vm)) {
  3807. return
  3808. }
  3809. }
  3810. if (!vm._inactive) {
  3811. vm._inactive = true;
  3812. for (var i = 0; i < vm.$children.length; i++) {
  3813. deactivateChildComponent(vm.$children[i]);
  3814. }
  3815. callHook(vm, 'deactivated');
  3816. }
  3817. }
  3818. function callHook (vm, hook) {
  3819. // #7573 disable dep collection when invoking lifecycle hooks
  3820. pushTarget();
  3821. var handlers = vm.$options[hook];
  3822. var info = hook + " hook";
  3823. if (handlers) {
  3824. for (var i = 0, j = handlers.length; i < j; i++) {
  3825. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  3826. }
  3827. }
  3828. if (vm._hasHookEvent) {
  3829. vm.$emit('hook:' + hook);
  3830. }
  3831. popTarget();
  3832. }
  3833. /* */
  3834. var MAX_UPDATE_COUNT = 100;
  3835. var queue = [];
  3836. var activatedChildren = [];
  3837. var has = {};
  3838. var circular = {};
  3839. var waiting = false;
  3840. var flushing = false;
  3841. var index = 0;
  3842. /**
  3843. * Reset the scheduler's state.
  3844. */
  3845. function resetSchedulerState () {
  3846. index = queue.length = activatedChildren.length = 0;
  3847. has = {};
  3848. if (process.env.NODE_ENV !== 'production') {
  3849. circular = {};
  3850. }
  3851. waiting = flushing = false;
  3852. }
  3853. // Async edge case #6566 requires saving the timestamp when event listeners are
  3854. // attached. However, calling performance.now() has a perf overhead especially
  3855. // if the page has thousands of event listeners. Instead, we take a timestamp
  3856. // every time the scheduler flushes and use that for all event listeners
  3857. // attached during that flush.
  3858. var currentFlushTimestamp = 0;
  3859. // Async edge case fix requires storing an event listener's attach timestamp.
  3860. var getNow = Date.now;
  3861. // Determine what event timestamp the browser is using. Annoyingly, the
  3862. // timestamp can either be hi-res (relative to page load) or low-res
  3863. // (relative to UNIX epoch), so in order to compare time we have to use the
  3864. // same timestamp type when saving the flush timestamp.
  3865. // All IE versions use low-res event timestamps, and have problematic clock
  3866. // implementations (#9632)
  3867. if (inBrowser && !isIE) {
  3868. var performance = window.performance;
  3869. if (
  3870. performance &&
  3871. typeof performance.now === 'function' &&
  3872. getNow() > document.createEvent('Event').timeStamp
  3873. ) {
  3874. // if the event timestamp, although evaluated AFTER the Date.now(), is
  3875. // smaller than it, it means the event is using a hi-res timestamp,
  3876. // and we need to use the hi-res version for event listener timestamps as
  3877. // well.
  3878. getNow = function () { return performance.now(); };
  3879. }
  3880. }
  3881. /**
  3882. * Flush both queues and run the watchers.
  3883. */
  3884. function flushSchedulerQueue () {
  3885. currentFlushTimestamp = getNow();
  3886. flushing = true;
  3887. var watcher, id;
  3888. // Sort queue before flush.
  3889. // This ensures that:
  3890. // 1. Components are updated from parent to child. (because parent is always
  3891. // created before the child)
  3892. // 2. A component's user watchers are run before its render watcher (because
  3893. // user watchers are created before the render watcher)
  3894. // 3. If a component is destroyed during a parent component's watcher run,
  3895. // its watchers can be skipped.
  3896. queue.sort(function (a, b) { return a.id - b.id; });
  3897. // do not cache length because more watchers might be pushed
  3898. // as we run existing watchers
  3899. for (index = 0; index < queue.length; index++) {
  3900. watcher = queue[index];
  3901. if (watcher.before) {
  3902. watcher.before();
  3903. }
  3904. id = watcher.id;
  3905. has[id] = null;
  3906. watcher.run();
  3907. // in dev build, check and stop circular updates.
  3908. if (process.env.NODE_ENV !== 'production' && has[id] != null) {
  3909. circular[id] = (circular[id] || 0) + 1;
  3910. if (circular[id] > MAX_UPDATE_COUNT) {
  3911. warn(
  3912. 'You may have an infinite update loop ' + (
  3913. watcher.user
  3914. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  3915. : "in a component render function."
  3916. ),
  3917. watcher.vm
  3918. );
  3919. break
  3920. }
  3921. }
  3922. }
  3923. // keep copies of post queues before resetting state
  3924. var activatedQueue = activatedChildren.slice();
  3925. var updatedQueue = queue.slice();
  3926. resetSchedulerState();
  3927. // call component updated and activated hooks
  3928. callActivatedHooks(activatedQueue);
  3929. callUpdatedHooks(updatedQueue);
  3930. // devtool hook
  3931. /* istanbul ignore if */
  3932. if (devtools && config.devtools) {
  3933. devtools.emit('flush');
  3934. }
  3935. }
  3936. function callUpdatedHooks (queue) {
  3937. var i = queue.length;
  3938. while (i--) {
  3939. var watcher = queue[i];
  3940. var vm = watcher.vm;
  3941. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  3942. callHook(vm, 'updated');
  3943. }
  3944. }
  3945. }
  3946. /**
  3947. * Queue a kept-alive component that was activated during patch.
  3948. * The queue will be processed after the entire tree has been patched.
  3949. */
  3950. function queueActivatedComponent (vm) {
  3951. // setting _inactive to false here so that a render function can
  3952. // rely on checking whether it's in an inactive tree (e.g. router-view)
  3953. vm._inactive = false;
  3954. activatedChildren.push(vm);
  3955. }
  3956. function callActivatedHooks (queue) {
  3957. for (var i = 0; i < queue.length; i++) {
  3958. queue[i]._inactive = true;
  3959. activateChildComponent(queue[i], true /* true */);
  3960. }
  3961. }
  3962. /**
  3963. * Push a watcher into the watcher queue.
  3964. * Jobs with duplicate IDs will be skipped unless it's
  3965. * pushed when the queue is being flushed.
  3966. */
  3967. function queueWatcher (watcher) {
  3968. var id = watcher.id;
  3969. if (has[id] == null) {
  3970. has[id] = true;
  3971. if (!flushing) {
  3972. queue.push(watcher);
  3973. } else {
  3974. // if already flushing, splice the watcher based on its id
  3975. // if already past its id, it will be run next immediately.
  3976. var i = queue.length - 1;
  3977. while (i > index && queue[i].id > watcher.id) {
  3978. i--;
  3979. }
  3980. queue.splice(i + 1, 0, watcher);
  3981. }
  3982. // queue the flush
  3983. if (!waiting) {
  3984. waiting = true;
  3985. if (process.env.NODE_ENV !== 'production' && !config.async) {
  3986. flushSchedulerQueue();
  3987. return
  3988. }
  3989. nextTick(flushSchedulerQueue);
  3990. }
  3991. }
  3992. }
  3993. /* */
  3994. var uid$2 = 0;
  3995. /**
  3996. * A watcher parses an expression, collects dependencies,
  3997. * and fires callback when the expression value changes.
  3998. * This is used for both the $watch() api and directives.
  3999. */
  4000. var Watcher = function Watcher (
  4001. vm,
  4002. expOrFn,
  4003. cb,
  4004. options,
  4005. isRenderWatcher
  4006. ) {
  4007. this.vm = vm;
  4008. if (isRenderWatcher) {
  4009. vm._watcher = this;
  4010. }
  4011. vm._watchers.push(this);
  4012. // options
  4013. if (options) {
  4014. this.deep = !!options.deep;
  4015. this.user = !!options.user;
  4016. this.lazy = !!options.lazy;
  4017. this.sync = !!options.sync;
  4018. this.before = options.before;
  4019. } else {
  4020. this.deep = this.user = this.lazy = this.sync = false;
  4021. }
  4022. this.cb = cb;
  4023. this.id = ++uid$2; // uid for batching
  4024. this.active = true;
  4025. this.dirty = this.lazy; // for lazy watchers
  4026. this.deps = [];
  4027. this.newDeps = [];
  4028. this.depIds = new _Set();
  4029. this.newDepIds = new _Set();
  4030. this.expression = process.env.NODE_ENV !== 'production'
  4031. ? expOrFn.toString()
  4032. : '';
  4033. // parse expression for getter
  4034. if (typeof expOrFn === 'function') {
  4035. this.getter = expOrFn;
  4036. } else {
  4037. this.getter = parsePath(expOrFn);
  4038. if (!this.getter) {
  4039. this.getter = noop;
  4040. process.env.NODE_ENV !== 'production' && warn(
  4041. "Failed watching path: \"" + expOrFn + "\" " +
  4042. 'Watcher only accepts simple dot-delimited paths. ' +
  4043. 'For full control, use a function instead.',
  4044. vm
  4045. );
  4046. }
  4047. }
  4048. this.value = this.lazy
  4049. ? undefined
  4050. : this.get();
  4051. };
  4052. /**
  4053. * Evaluate the getter, and re-collect dependencies.
  4054. */
  4055. Watcher.prototype.get = function get () {
  4056. pushTarget(this);
  4057. var value;
  4058. var vm = this.vm;
  4059. try {
  4060. value = this.getter.call(vm, vm);
  4061. } catch (e) {
  4062. if (this.user) {
  4063. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  4064. } else {
  4065. throw e
  4066. }
  4067. } finally {
  4068. // "touch" every property so they are all tracked as
  4069. // dependencies for deep watching
  4070. if (this.deep) {
  4071. traverse(value);
  4072. }
  4073. popTarget();
  4074. this.cleanupDeps();
  4075. }
  4076. return value
  4077. };
  4078. /**
  4079. * Add a dependency to this directive.
  4080. */
  4081. Watcher.prototype.addDep = function addDep (dep) {
  4082. var id = dep.id;
  4083. if (!this.newDepIds.has(id)) {
  4084. this.newDepIds.add(id);
  4085. this.newDeps.push(dep);
  4086. if (!this.depIds.has(id)) {
  4087. dep.addSub(this);
  4088. }
  4089. }
  4090. };
  4091. /**
  4092. * Clean up for dependency collection.
  4093. */
  4094. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  4095. var i = this.deps.length;
  4096. while (i--) {
  4097. var dep = this.deps[i];
  4098. if (!this.newDepIds.has(dep.id)) {
  4099. dep.removeSub(this);
  4100. }
  4101. }
  4102. var tmp = this.depIds;
  4103. this.depIds = this.newDepIds;
  4104. this.newDepIds = tmp;
  4105. this.newDepIds.clear();
  4106. tmp = this.deps;
  4107. this.deps = this.newDeps;
  4108. this.newDeps = tmp;
  4109. this.newDeps.length = 0;
  4110. };
  4111. /**
  4112. * Subscriber interface.
  4113. * Will be called when a dependency changes.
  4114. */
  4115. Watcher.prototype.update = function update () {
  4116. /* istanbul ignore else */
  4117. if (this.lazy) {
  4118. this.dirty = true;
  4119. } else if (this.sync) {
  4120. this.run();
  4121. } else {
  4122. queueWatcher(this);
  4123. }
  4124. };
  4125. /**
  4126. * Scheduler job interface.
  4127. * Will be called by the scheduler.
  4128. */
  4129. Watcher.prototype.run = function run () {
  4130. if (this.active) {
  4131. var value = this.get();
  4132. if (
  4133. value !== this.value ||
  4134. // Deep watchers and watchers on Object/Arrays should fire even
  4135. // when the value is the same, because the value may
  4136. // have mutated.
  4137. isObject(value) ||
  4138. this.deep
  4139. ) {
  4140. // set new value
  4141. var oldValue = this.value;
  4142. this.value = value;
  4143. if (this.user) {
  4144. try {
  4145. this.cb.call(this.vm, value, oldValue);
  4146. } catch (e) {
  4147. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  4148. }
  4149. } else {
  4150. this.cb.call(this.vm, value, oldValue);
  4151. }
  4152. }
  4153. }
  4154. };
  4155. /**
  4156. * Evaluate the value of the watcher.
  4157. * This only gets called for lazy watchers.
  4158. */
  4159. Watcher.prototype.evaluate = function evaluate () {
  4160. this.value = this.get();
  4161. this.dirty = false;
  4162. };
  4163. /**
  4164. * Depend on all deps collected by this watcher.
  4165. */
  4166. Watcher.prototype.depend = function depend () {
  4167. var i = this.deps.length;
  4168. while (i--) {
  4169. this.deps[i].depend();
  4170. }
  4171. };
  4172. /**
  4173. * Remove self from all dependencies' subscriber list.
  4174. */
  4175. Watcher.prototype.teardown = function teardown () {
  4176. if (this.active) {
  4177. // remove self from vm's watcher list
  4178. // this is a somewhat expensive operation so we skip it
  4179. // if the vm is being destroyed.
  4180. if (!this.vm._isBeingDestroyed) {
  4181. remove(this.vm._watchers, this);
  4182. }
  4183. var i = this.deps.length;
  4184. while (i--) {
  4185. this.deps[i].removeSub(this);
  4186. }
  4187. this.active = false;
  4188. }
  4189. };
  4190. /* */
  4191. var sharedPropertyDefinition = {
  4192. enumerable: true,
  4193. configurable: true,
  4194. get: noop,
  4195. set: noop
  4196. };
  4197. function proxy (target, sourceKey, key) {
  4198. sharedPropertyDefinition.get = function proxyGetter () {
  4199. return this[sourceKey][key]
  4200. };
  4201. sharedPropertyDefinition.set = function proxySetter (val) {
  4202. this[sourceKey][key] = val;
  4203. };
  4204. Object.defineProperty(target, key, sharedPropertyDefinition);
  4205. }
  4206. function initState (vm) {
  4207. vm._watchers = [];
  4208. var opts = vm.$options;
  4209. if (opts.props) { initProps(vm, opts.props); }
  4210. if (opts.methods) { initMethods(vm, opts.methods); }
  4211. if (opts.data) {
  4212. initData(vm);
  4213. } else {
  4214. observe(vm._data = {}, true /* asRootData */);
  4215. }
  4216. if (opts.computed) { initComputed(vm, opts.computed); }
  4217. if (opts.watch && opts.watch !== nativeWatch) {
  4218. initWatch(vm, opts.watch);
  4219. }
  4220. }
  4221. function initProps (vm, propsOptions) {
  4222. var propsData = vm.$options.propsData || {};
  4223. var props = vm._props = {};
  4224. // cache prop keys so that future props updates can iterate using Array
  4225. // instead of dynamic object key enumeration.
  4226. var keys = vm.$options._propKeys = [];
  4227. var isRoot = !vm.$parent;
  4228. // root instance props should be converted
  4229. if (!isRoot) {
  4230. toggleObserving(false);
  4231. }
  4232. var loop = function ( key ) {
  4233. keys.push(key);
  4234. var value = validateProp(key, propsOptions, propsData, vm);
  4235. /* istanbul ignore else */
  4236. if (process.env.NODE_ENV !== 'production') {
  4237. var hyphenatedKey = hyphenate(key);
  4238. if (isReservedAttribute(hyphenatedKey) ||
  4239. config.isReservedAttr(hyphenatedKey)) {
  4240. warn(
  4241. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  4242. vm
  4243. );
  4244. }
  4245. defineReactive$$1(props, key, value, function () {
  4246. if (!isRoot && !isUpdatingChildComponent) {
  4247. warn(
  4248. "Avoid mutating a prop directly since the value will be " +
  4249. "overwritten whenever the parent component re-renders. " +
  4250. "Instead, use a data or computed property based on the prop's " +
  4251. "value. Prop being mutated: \"" + key + "\"",
  4252. vm
  4253. );
  4254. }
  4255. });
  4256. } else {
  4257. defineReactive$$1(props, key, value);
  4258. }
  4259. // static props are already proxied on the component's prototype
  4260. // during Vue.extend(). We only need to proxy props defined at
  4261. // instantiation here.
  4262. if (!(key in vm)) {
  4263. proxy(vm, "_props", key);
  4264. }
  4265. };
  4266. for (var key in propsOptions) loop( key );
  4267. toggleObserving(true);
  4268. }
  4269. function initData (vm) {
  4270. var data = vm.$options.data;
  4271. data = vm._data = typeof data === 'function'
  4272. ? getData(data, vm)
  4273. : data || {};
  4274. if (!isPlainObject(data)) {
  4275. data = {};
  4276. process.env.NODE_ENV !== 'production' && warn(
  4277. 'data functions should return an object:\n' +
  4278. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  4279. vm
  4280. );
  4281. }
  4282. // proxy data on instance
  4283. var keys = Object.keys(data);
  4284. var props = vm.$options.props;
  4285. var methods = vm.$options.methods;
  4286. var i = keys.length;
  4287. while (i--) {
  4288. var key = keys[i];
  4289. if (process.env.NODE_ENV !== 'production') {
  4290. if (methods && hasOwn(methods, key)) {
  4291. warn(
  4292. ("Method \"" + key + "\" has already been defined as a data property."),
  4293. vm
  4294. );
  4295. }
  4296. }
  4297. if (props && hasOwn(props, key)) {
  4298. process.env.NODE_ENV !== 'production' && warn(
  4299. "The data property \"" + key + "\" is already declared as a prop. " +
  4300. "Use prop default value instead.",
  4301. vm
  4302. );
  4303. } else if (!isReserved(key)) {
  4304. proxy(vm, "_data", key);
  4305. }
  4306. }
  4307. // observe data
  4308. observe(data, true /* asRootData */);
  4309. }
  4310. function getData (data, vm) {
  4311. // #7573 disable dep collection when invoking data getters
  4312. pushTarget();
  4313. try {
  4314. return data.call(vm, vm)
  4315. } catch (e) {
  4316. handleError(e, vm, "data()");
  4317. return {}
  4318. } finally {
  4319. popTarget();
  4320. }
  4321. }
  4322. var computedWatcherOptions = { lazy: true };
  4323. function initComputed (vm, computed) {
  4324. // $flow-disable-line
  4325. var watchers = vm._computedWatchers = Object.create(null);
  4326. // computed properties are just getters during SSR
  4327. var isSSR = isServerRendering();
  4328. for (var key in computed) {
  4329. var userDef = computed[key];
  4330. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  4331. if (process.env.NODE_ENV !== 'production' && getter == null) {
  4332. warn(
  4333. ("Getter is missing for computed property \"" + key + "\"."),
  4334. vm
  4335. );
  4336. }
  4337. if (!isSSR) {
  4338. // create internal watcher for the computed property.
  4339. watchers[key] = new Watcher(
  4340. vm,
  4341. getter || noop,
  4342. noop,
  4343. computedWatcherOptions
  4344. );
  4345. }
  4346. // component-defined computed properties are already defined on the
  4347. // component prototype. We only need to define computed properties defined
  4348. // at instantiation here.
  4349. if (!(key in vm)) {
  4350. defineComputed(vm, key, userDef);
  4351. } else if (process.env.NODE_ENV !== 'production') {
  4352. if (key in vm.$data) {
  4353. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  4354. } else if (vm.$options.props && key in vm.$options.props) {
  4355. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  4356. }
  4357. }
  4358. }
  4359. }
  4360. function defineComputed (
  4361. target,
  4362. key,
  4363. userDef
  4364. ) {
  4365. var shouldCache = !isServerRendering();
  4366. if (typeof userDef === 'function') {
  4367. sharedPropertyDefinition.get = shouldCache
  4368. ? createComputedGetter(key)
  4369. : createGetterInvoker(userDef);
  4370. sharedPropertyDefinition.set = noop;
  4371. } else {
  4372. sharedPropertyDefinition.get = userDef.get
  4373. ? shouldCache && userDef.cache !== false
  4374. ? createComputedGetter(key)
  4375. : createGetterInvoker(userDef.get)
  4376. : noop;
  4377. sharedPropertyDefinition.set = userDef.set || noop;
  4378. }
  4379. if (process.env.NODE_ENV !== 'production' &&
  4380. sharedPropertyDefinition.set === noop) {
  4381. sharedPropertyDefinition.set = function () {
  4382. warn(
  4383. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  4384. this
  4385. );
  4386. };
  4387. }
  4388. Object.defineProperty(target, key, sharedPropertyDefinition);
  4389. }
  4390. function createComputedGetter (key) {
  4391. return function computedGetter () {
  4392. var watcher = this._computedWatchers && this._computedWatchers[key];
  4393. if (watcher) {
  4394. if (watcher.dirty) {
  4395. watcher.evaluate();
  4396. }
  4397. if (Dep.target) {
  4398. watcher.depend();
  4399. }
  4400. return watcher.value
  4401. }
  4402. }
  4403. }
  4404. function createGetterInvoker(fn) {
  4405. return function computedGetter () {
  4406. return fn.call(this, this)
  4407. }
  4408. }
  4409. function initMethods (vm, methods) {
  4410. var props = vm.$options.props;
  4411. for (var key in methods) {
  4412. if (process.env.NODE_ENV !== 'production') {
  4413. if (typeof methods[key] !== 'function') {
  4414. warn(
  4415. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  4416. "Did you reference the function correctly?",
  4417. vm
  4418. );
  4419. }
  4420. if (props && hasOwn(props, key)) {
  4421. warn(
  4422. ("Method \"" + key + "\" has already been defined as a prop."),
  4423. vm
  4424. );
  4425. }
  4426. if ((key in vm) && isReserved(key)) {
  4427. warn(
  4428. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  4429. "Avoid defining component methods that start with _ or $."
  4430. );
  4431. }
  4432. }
  4433. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  4434. }
  4435. }
  4436. function initWatch (vm, watch) {
  4437. for (var key in watch) {
  4438. var handler = watch[key];
  4439. if (Array.isArray(handler)) {
  4440. for (var i = 0; i < handler.length; i++) {
  4441. createWatcher(vm, key, handler[i]);
  4442. }
  4443. } else {
  4444. createWatcher(vm, key, handler);
  4445. }
  4446. }
  4447. }
  4448. function createWatcher (
  4449. vm,
  4450. expOrFn,
  4451. handler,
  4452. options
  4453. ) {
  4454. if (isPlainObject(handler)) {
  4455. options = handler;
  4456. handler = handler.handler;
  4457. }
  4458. if (typeof handler === 'string') {
  4459. handler = vm[handler];
  4460. }
  4461. return vm.$watch(expOrFn, handler, options)
  4462. }
  4463. function stateMixin (Vue) {
  4464. // flow somehow has problems with directly declared definition object
  4465. // when using Object.defineProperty, so we have to procedurally build up
  4466. // the object here.
  4467. var dataDef = {};
  4468. dataDef.get = function () { return this._data };
  4469. var propsDef = {};
  4470. propsDef.get = function () { return this._props };
  4471. if (process.env.NODE_ENV !== 'production') {
  4472. dataDef.set = function () {
  4473. warn(
  4474. 'Avoid replacing instance root $data. ' +
  4475. 'Use nested data properties instead.',
  4476. this
  4477. );
  4478. };
  4479. propsDef.set = function () {
  4480. warn("$props is readonly.", this);
  4481. };
  4482. }
  4483. Object.defineProperty(Vue.prototype, '$data', dataDef);
  4484. Object.defineProperty(Vue.prototype, '$props', propsDef);
  4485. Vue.prototype.$set = set;
  4486. Vue.prototype.$delete = del;
  4487. Vue.prototype.$watch = function (
  4488. expOrFn,
  4489. cb,
  4490. options
  4491. ) {
  4492. var vm = this;
  4493. if (isPlainObject(cb)) {
  4494. return createWatcher(vm, expOrFn, cb, options)
  4495. }
  4496. options = options || {};
  4497. options.user = true;
  4498. var watcher = new Watcher(vm, expOrFn, cb, options);
  4499. if (options.immediate) {
  4500. try {
  4501. cb.call(vm, watcher.value);
  4502. } catch (error) {
  4503. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  4504. }
  4505. }
  4506. return function unwatchFn () {
  4507. watcher.teardown();
  4508. }
  4509. };
  4510. }
  4511. /* */
  4512. var uid$3 = 0;
  4513. function initMixin (Vue) {
  4514. Vue.prototype._init = function (options) {
  4515. var vm = this;
  4516. // a uid
  4517. vm._uid = uid$3++;
  4518. var startTag, endTag;
  4519. /* istanbul ignore if */
  4520. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  4521. startTag = "vue-perf-start:" + (vm._uid);
  4522. endTag = "vue-perf-end:" + (vm._uid);
  4523. mark(startTag);
  4524. }
  4525. // a flag to avoid this being observed
  4526. vm._isVue = true;
  4527. // merge options
  4528. if (options && options._isComponent) {
  4529. // optimize internal component instantiation
  4530. // since dynamic options merging is pretty slow, and none of the
  4531. // internal component options needs special treatment.
  4532. initInternalComponent(vm, options);
  4533. } else {
  4534. vm.$options = mergeOptions(
  4535. resolveConstructorOptions(vm.constructor),
  4536. options || {},
  4537. vm
  4538. );
  4539. }
  4540. /* istanbul ignore else */
  4541. if (process.env.NODE_ENV !== 'production') {
  4542. initProxy(vm);
  4543. } else {
  4544. vm._renderProxy = vm;
  4545. }
  4546. // expose real self
  4547. vm._self = vm;
  4548. initLifecycle(vm);
  4549. initEvents(vm);
  4550. initRender(vm);
  4551. callHook(vm, 'beforeCreate');
  4552. initInjections(vm); // resolve injections before data/props
  4553. initState(vm);
  4554. initProvide(vm); // resolve provide after data/props
  4555. callHook(vm, 'created');
  4556. /* istanbul ignore if */
  4557. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  4558. vm._name = formatComponentName(vm, false);
  4559. mark(endTag);
  4560. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  4561. }
  4562. if (vm.$options.el) {
  4563. vm.$mount(vm.$options.el);
  4564. }
  4565. };
  4566. }
  4567. function initInternalComponent (vm, options) {
  4568. var opts = vm.$options = Object.create(vm.constructor.options);
  4569. // doing this because it's faster than dynamic enumeration.
  4570. var parentVnode = options._parentVnode;
  4571. opts.parent = options.parent;
  4572. opts._parentVnode = parentVnode;
  4573. var vnodeComponentOptions = parentVnode.componentOptions;
  4574. opts.propsData = vnodeComponentOptions.propsData;
  4575. opts._parentListeners = vnodeComponentOptions.listeners;
  4576. opts._renderChildren = vnodeComponentOptions.children;
  4577. opts._componentTag = vnodeComponentOptions.tag;
  4578. if (options.render) {
  4579. opts.render = options.render;
  4580. opts.staticRenderFns = options.staticRenderFns;
  4581. }
  4582. }
  4583. function resolveConstructorOptions (Ctor) {
  4584. var options = Ctor.options;
  4585. if (Ctor.super) {
  4586. var superOptions = resolveConstructorOptions(Ctor.super);
  4587. var cachedSuperOptions = Ctor.superOptions;
  4588. if (superOptions !== cachedSuperOptions) {
  4589. // super option changed,
  4590. // need to resolve new options.
  4591. Ctor.superOptions = superOptions;
  4592. // check if there are any late-modified/attached options (#4976)
  4593. var modifiedOptions = resolveModifiedOptions(Ctor);
  4594. // update base extend options
  4595. if (modifiedOptions) {
  4596. extend(Ctor.extendOptions, modifiedOptions);
  4597. }
  4598. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4599. if (options.name) {
  4600. options.components[options.name] = Ctor;
  4601. }
  4602. }
  4603. }
  4604. return options
  4605. }
  4606. function resolveModifiedOptions (Ctor) {
  4607. var modified;
  4608. var latest = Ctor.options;
  4609. var sealed = Ctor.sealedOptions;
  4610. for (var key in latest) {
  4611. if (latest[key] !== sealed[key]) {
  4612. if (!modified) { modified = {}; }
  4613. modified[key] = latest[key];
  4614. }
  4615. }
  4616. return modified
  4617. }
  4618. function Vue (options) {
  4619. if (process.env.NODE_ENV !== 'production' &&
  4620. !(this instanceof Vue)
  4621. ) {
  4622. warn('Vue is a constructor and should be called with the `new` keyword');
  4623. }
  4624. this._init(options);
  4625. }
  4626. initMixin(Vue);
  4627. stateMixin(Vue);
  4628. eventsMixin(Vue);
  4629. lifecycleMixin(Vue);
  4630. renderMixin(Vue);
  4631. /* */
  4632. function initUse (Vue) {
  4633. Vue.use = function (plugin) {
  4634. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  4635. if (installedPlugins.indexOf(plugin) > -1) {
  4636. return this
  4637. }
  4638. // additional parameters
  4639. var args = toArray(arguments, 1);
  4640. args.unshift(this);
  4641. if (typeof plugin.install === 'function') {
  4642. plugin.install.apply(plugin, args);
  4643. } else if (typeof plugin === 'function') {
  4644. plugin.apply(null, args);
  4645. }
  4646. installedPlugins.push(plugin);
  4647. return this
  4648. };
  4649. }
  4650. /* */
  4651. function initMixin$1 (Vue) {
  4652. Vue.mixin = function (mixin) {
  4653. this.options = mergeOptions(this.options, mixin);
  4654. return this
  4655. };
  4656. }
  4657. /* */
  4658. function initExtend (Vue) {
  4659. /**
  4660. * Each instance constructor, including Vue, has a unique
  4661. * cid. This enables us to create wrapped "child
  4662. * constructors" for prototypal inheritance and cache them.
  4663. */
  4664. Vue.cid = 0;
  4665. var cid = 1;
  4666. /**
  4667. * Class inheritance
  4668. */
  4669. Vue.extend = function (extendOptions) {
  4670. extendOptions = extendOptions || {};
  4671. var Super = this;
  4672. var SuperId = Super.cid;
  4673. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  4674. if (cachedCtors[SuperId]) {
  4675. return cachedCtors[SuperId]
  4676. }
  4677. var name = extendOptions.name || Super.options.name;
  4678. if (process.env.NODE_ENV !== 'production' && name) {
  4679. validateComponentName(name);
  4680. }
  4681. var Sub = function VueComponent (options) {
  4682. this._init(options);
  4683. };
  4684. Sub.prototype = Object.create(Super.prototype);
  4685. Sub.prototype.constructor = Sub;
  4686. Sub.cid = cid++;
  4687. Sub.options = mergeOptions(
  4688. Super.options,
  4689. extendOptions
  4690. );
  4691. Sub['super'] = Super;
  4692. // For props and computed properties, we define the proxy getters on
  4693. // the Vue instances at extension time, on the extended prototype. This
  4694. // avoids Object.defineProperty calls for each instance created.
  4695. if (Sub.options.props) {
  4696. initProps$1(Sub);
  4697. }
  4698. if (Sub.options.computed) {
  4699. initComputed$1(Sub);
  4700. }
  4701. // allow further extension/mixin/plugin usage
  4702. Sub.extend = Super.extend;
  4703. Sub.mixin = Super.mixin;
  4704. Sub.use = Super.use;
  4705. // create asset registers, so extended classes
  4706. // can have their private assets too.
  4707. ASSET_TYPES.forEach(function (type) {
  4708. Sub[type] = Super[type];
  4709. });
  4710. // enable recursive self-lookup
  4711. if (name) {
  4712. Sub.options.components[name] = Sub;
  4713. }
  4714. // keep a reference to the super options at extension time.
  4715. // later at instantiation we can check if Super's options have
  4716. // been updated.
  4717. Sub.superOptions = Super.options;
  4718. Sub.extendOptions = extendOptions;
  4719. Sub.sealedOptions = extend({}, Sub.options);
  4720. // cache constructor
  4721. cachedCtors[SuperId] = Sub;
  4722. return Sub
  4723. };
  4724. }
  4725. function initProps$1 (Comp) {
  4726. var props = Comp.options.props;
  4727. for (var key in props) {
  4728. proxy(Comp.prototype, "_props", key);
  4729. }
  4730. }
  4731. function initComputed$1 (Comp) {
  4732. var computed = Comp.options.computed;
  4733. for (var key in computed) {
  4734. defineComputed(Comp.prototype, key, computed[key]);
  4735. }
  4736. }
  4737. /* */
  4738. function initAssetRegisters (Vue) {
  4739. /**
  4740. * Create asset registration methods.
  4741. */
  4742. ASSET_TYPES.forEach(function (type) {
  4743. Vue[type] = function (
  4744. id,
  4745. definition
  4746. ) {
  4747. if (!definition) {
  4748. return this.options[type + 's'][id]
  4749. } else {
  4750. /* istanbul ignore if */
  4751. if (process.env.NODE_ENV !== 'production' && type === 'component') {
  4752. validateComponentName(id);
  4753. }
  4754. if (type === 'component' && isPlainObject(definition)) {
  4755. definition.name = definition.name || id;
  4756. definition = this.options._base.extend(definition);
  4757. }
  4758. if (type === 'directive' && typeof definition === 'function') {
  4759. definition = { bind: definition, update: definition };
  4760. }
  4761. this.options[type + 's'][id] = definition;
  4762. return definition
  4763. }
  4764. };
  4765. });
  4766. }
  4767. /* */
  4768. function getComponentName (opts) {
  4769. return opts && (opts.Ctor.options.name || opts.tag)
  4770. }
  4771. function matches (pattern, name) {
  4772. if (Array.isArray(pattern)) {
  4773. return pattern.indexOf(name) > -1
  4774. } else if (typeof pattern === 'string') {
  4775. return pattern.split(',').indexOf(name) > -1
  4776. } else if (isRegExp(pattern)) {
  4777. return pattern.test(name)
  4778. }
  4779. /* istanbul ignore next */
  4780. return false
  4781. }
  4782. function pruneCache (keepAliveInstance, filter) {
  4783. var cache = keepAliveInstance.cache;
  4784. var keys = keepAliveInstance.keys;
  4785. var _vnode = keepAliveInstance._vnode;
  4786. for (var key in cache) {
  4787. var cachedNode = cache[key];
  4788. if (cachedNode) {
  4789. var name = getComponentName(cachedNode.componentOptions);
  4790. if (name && !filter(name)) {
  4791. pruneCacheEntry(cache, key, keys, _vnode);
  4792. }
  4793. }
  4794. }
  4795. }
  4796. function pruneCacheEntry (
  4797. cache,
  4798. key,
  4799. keys,
  4800. current
  4801. ) {
  4802. var cached$$1 = cache[key];
  4803. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  4804. cached$$1.componentInstance.$destroy();
  4805. }
  4806. cache[key] = null;
  4807. remove(keys, key);
  4808. }
  4809. var patternTypes = [String, RegExp, Array];
  4810. var KeepAlive = {
  4811. name: 'keep-alive',
  4812. abstract: true,
  4813. props: {
  4814. include: patternTypes,
  4815. exclude: patternTypes,
  4816. max: [String, Number]
  4817. },
  4818. created: function created () {
  4819. this.cache = Object.create(null);
  4820. this.keys = [];
  4821. },
  4822. destroyed: function destroyed () {
  4823. for (var key in this.cache) {
  4824. pruneCacheEntry(this.cache, key, this.keys);
  4825. }
  4826. },
  4827. mounted: function mounted () {
  4828. var this$1 = this;
  4829. this.$watch('include', function (val) {
  4830. pruneCache(this$1, function (name) { return matches(val, name); });
  4831. });
  4832. this.$watch('exclude', function (val) {
  4833. pruneCache(this$1, function (name) { return !matches(val, name); });
  4834. });
  4835. },
  4836. render: function render () {
  4837. var slot = this.$slots.default;
  4838. var vnode = getFirstComponentChild(slot);
  4839. var componentOptions = vnode && vnode.componentOptions;
  4840. if (componentOptions) {
  4841. // check pattern
  4842. var name = getComponentName(componentOptions);
  4843. var ref = this;
  4844. var include = ref.include;
  4845. var exclude = ref.exclude;
  4846. if (
  4847. // not included
  4848. (include && (!name || !matches(include, name))) ||
  4849. // excluded
  4850. (exclude && name && matches(exclude, name))
  4851. ) {
  4852. return vnode
  4853. }
  4854. var ref$1 = this;
  4855. var cache = ref$1.cache;
  4856. var keys = ref$1.keys;
  4857. var key = vnode.key == null
  4858. // same constructor may get registered as different local components
  4859. // so cid alone is not enough (#3269)
  4860. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  4861. : vnode.key;
  4862. if (cache[key]) {
  4863. vnode.componentInstance = cache[key].componentInstance;
  4864. // make current key freshest
  4865. remove(keys, key);
  4866. keys.push(key);
  4867. } else {
  4868. cache[key] = vnode;
  4869. keys.push(key);
  4870. // prune oldest entry
  4871. if (this.max && keys.length > parseInt(this.max)) {
  4872. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  4873. }
  4874. }
  4875. vnode.data.keepAlive = true;
  4876. }
  4877. return vnode || (slot && slot[0])
  4878. }
  4879. };
  4880. var builtInComponents = {
  4881. KeepAlive: KeepAlive
  4882. };
  4883. /* */
  4884. function initGlobalAPI (Vue) {
  4885. // config
  4886. var configDef = {};
  4887. configDef.get = function () { return config; };
  4888. if (process.env.NODE_ENV !== 'production') {
  4889. configDef.set = function () {
  4890. warn(
  4891. 'Do not replace the Vue.config object, set individual fields instead.'
  4892. );
  4893. };
  4894. }
  4895. Object.defineProperty(Vue, 'config', configDef);
  4896. // exposed util methods.
  4897. // NOTE: these are not considered part of the public API - avoid relying on
  4898. // them unless you are aware of the risk.
  4899. Vue.util = {
  4900. warn: warn,
  4901. extend: extend,
  4902. mergeOptions: mergeOptions,
  4903. defineReactive: defineReactive$$1
  4904. };
  4905. Vue.set = set;
  4906. Vue.delete = del;
  4907. Vue.nextTick = nextTick;
  4908. // 2.6 explicit observable API
  4909. Vue.observable = function (obj) {
  4910. observe(obj);
  4911. return obj
  4912. };
  4913. Vue.options = Object.create(null);
  4914. ASSET_TYPES.forEach(function (type) {
  4915. Vue.options[type + 's'] = Object.create(null);
  4916. });
  4917. // this is used to identify the "base" constructor to extend all plain-object
  4918. // components with in Weex's multi-instance scenarios.
  4919. Vue.options._base = Vue;
  4920. extend(Vue.options.components, builtInComponents);
  4921. initUse(Vue);
  4922. initMixin$1(Vue);
  4923. initExtend(Vue);
  4924. initAssetRegisters(Vue);
  4925. }
  4926. initGlobalAPI(Vue);
  4927. Object.defineProperty(Vue.prototype, '$isServer', {
  4928. get: isServerRendering
  4929. });
  4930. Object.defineProperty(Vue.prototype, '$ssrContext', {
  4931. get: function get () {
  4932. /* istanbul ignore next */
  4933. return this.$vnode && this.$vnode.ssrContext
  4934. }
  4935. });
  4936. // expose FunctionalRenderContext for ssr runtime helper installation
  4937. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  4938. value: FunctionalRenderContext
  4939. });
  4940. Vue.version = '2.6.12';
  4941. /* */
  4942. // these are reserved for web because they are directly compiled away
  4943. // during template compilation
  4944. var isReservedAttr = makeMap('style,class');
  4945. // attributes that should be using props for binding
  4946. var acceptValue = makeMap('input,textarea,option,select,progress');
  4947. var mustUseProp = function (tag, type, attr) {
  4948. return (
  4949. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  4950. (attr === 'selected' && tag === 'option') ||
  4951. (attr === 'checked' && tag === 'input') ||
  4952. (attr === 'muted' && tag === 'video')
  4953. )
  4954. };
  4955. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  4956. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  4957. var convertEnumeratedValue = function (key, value) {
  4958. return isFalsyAttrValue(value) || value === 'false'
  4959. ? 'false'
  4960. // allow arbitrary string value for contenteditable
  4961. : key === 'contenteditable' && isValidContentEditableValue(value)
  4962. ? value
  4963. : 'true'
  4964. };
  4965. var isBooleanAttr = makeMap(
  4966. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  4967. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  4968. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  4969. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  4970. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  4971. 'truespeed,typemustmatch,visible'
  4972. );
  4973. var xlinkNS = 'http://www.w3.org/1999/xlink';
  4974. var isXlink = function (name) {
  4975. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  4976. };
  4977. var getXlinkProp = function (name) {
  4978. return isXlink(name) ? name.slice(6, name.length) : ''
  4979. };
  4980. var isFalsyAttrValue = function (val) {
  4981. return val == null || val === false
  4982. };
  4983. /* */
  4984. function genClassForVnode (vnode) {
  4985. var data = vnode.data;
  4986. var parentNode = vnode;
  4987. var childNode = vnode;
  4988. while (isDef(childNode.componentInstance)) {
  4989. childNode = childNode.componentInstance._vnode;
  4990. if (childNode && childNode.data) {
  4991. data = mergeClassData(childNode.data, data);
  4992. }
  4993. }
  4994. while (isDef(parentNode = parentNode.parent)) {
  4995. if (parentNode && parentNode.data) {
  4996. data = mergeClassData(data, parentNode.data);
  4997. }
  4998. }
  4999. return renderClass(data.staticClass, data.class)
  5000. }
  5001. function mergeClassData (child, parent) {
  5002. return {
  5003. staticClass: concat(child.staticClass, parent.staticClass),
  5004. class: isDef(child.class)
  5005. ? [child.class, parent.class]
  5006. : parent.class
  5007. }
  5008. }
  5009. function renderClass (
  5010. staticClass,
  5011. dynamicClass
  5012. ) {
  5013. if (isDef(staticClass) || isDef(dynamicClass)) {
  5014. return concat(staticClass, stringifyClass(dynamicClass))
  5015. }
  5016. /* istanbul ignore next */
  5017. return ''
  5018. }
  5019. function concat (a, b) {
  5020. return a ? b ? (a + ' ' + b) : a : (b || '')
  5021. }
  5022. function stringifyClass (value) {
  5023. if (Array.isArray(value)) {
  5024. return stringifyArray(value)
  5025. }
  5026. if (isObject(value)) {
  5027. return stringifyObject(value)
  5028. }
  5029. if (typeof value === 'string') {
  5030. return value
  5031. }
  5032. /* istanbul ignore next */
  5033. return ''
  5034. }
  5035. function stringifyArray (value) {
  5036. var res = '';
  5037. var stringified;
  5038. for (var i = 0, l = value.length; i < l; i++) {
  5039. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  5040. if (res) { res += ' '; }
  5041. res += stringified;
  5042. }
  5043. }
  5044. return res
  5045. }
  5046. function stringifyObject (value) {
  5047. var res = '';
  5048. for (var key in value) {
  5049. if (value[key]) {
  5050. if (res) { res += ' '; }
  5051. res += key;
  5052. }
  5053. }
  5054. return res
  5055. }
  5056. /* */
  5057. var namespaceMap = {
  5058. svg: 'http://www.w3.org/2000/svg',
  5059. math: 'http://www.w3.org/1998/Math/MathML'
  5060. };
  5061. var isHTMLTag = makeMap(
  5062. 'html,body,base,head,link,meta,style,title,' +
  5063. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  5064. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  5065. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  5066. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  5067. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  5068. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  5069. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  5070. 'output,progress,select,textarea,' +
  5071. 'details,dialog,menu,menuitem,summary,' +
  5072. 'content,element,shadow,template,blockquote,iframe,tfoot'
  5073. );
  5074. // this map is intentionally selective, only covering SVG elements that may
  5075. // contain child elements.
  5076. var isSVG = makeMap(
  5077. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  5078. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  5079. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  5080. true
  5081. );
  5082. var isReservedTag = function (tag) {
  5083. return isHTMLTag(tag) || isSVG(tag)
  5084. };
  5085. function getTagNamespace (tag) {
  5086. if (isSVG(tag)) {
  5087. return 'svg'
  5088. }
  5089. // basic support for MathML
  5090. // note it doesn't support other MathML elements being component roots
  5091. if (tag === 'math') {
  5092. return 'math'
  5093. }
  5094. }
  5095. var unknownElementCache = Object.create(null);
  5096. function isUnknownElement (tag) {
  5097. /* istanbul ignore if */
  5098. if (!inBrowser) {
  5099. return true
  5100. }
  5101. if (isReservedTag(tag)) {
  5102. return false
  5103. }
  5104. tag = tag.toLowerCase();
  5105. /* istanbul ignore if */
  5106. if (unknownElementCache[tag] != null) {
  5107. return unknownElementCache[tag]
  5108. }
  5109. var el = document.createElement(tag);
  5110. if (tag.indexOf('-') > -1) {
  5111. // http://stackoverflow.com/a/28210364/1070244
  5112. return (unknownElementCache[tag] = (
  5113. el.constructor === window.HTMLUnknownElement ||
  5114. el.constructor === window.HTMLElement
  5115. ))
  5116. } else {
  5117. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  5118. }
  5119. }
  5120. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  5121. /* */
  5122. /**
  5123. * Query an element selector if it's not an element already.
  5124. */
  5125. function query (el) {
  5126. if (typeof el === 'string') {
  5127. var selected = document.querySelector(el);
  5128. if (!selected) {
  5129. process.env.NODE_ENV !== 'production' && warn(
  5130. 'Cannot find element: ' + el
  5131. );
  5132. return document.createElement('div')
  5133. }
  5134. return selected
  5135. } else {
  5136. return el
  5137. }
  5138. }
  5139. /* */
  5140. function createElement$1 (tagName, vnode) {
  5141. var elm = document.createElement(tagName);
  5142. if (tagName !== 'select') {
  5143. return elm
  5144. }
  5145. // false or null will remove the attribute but undefined will not
  5146. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  5147. elm.setAttribute('multiple', 'multiple');
  5148. }
  5149. return elm
  5150. }
  5151. function createElementNS (namespace, tagName) {
  5152. return document.createElementNS(namespaceMap[namespace], tagName)
  5153. }
  5154. function createTextNode (text) {
  5155. return document.createTextNode(text)
  5156. }
  5157. function createComment (text) {
  5158. return document.createComment(text)
  5159. }
  5160. function insertBefore (parentNode, newNode, referenceNode) {
  5161. parentNode.insertBefore(newNode, referenceNode);
  5162. }
  5163. function removeChild (node, child) {
  5164. node.removeChild(child);
  5165. }
  5166. function appendChild (node, child) {
  5167. node.appendChild(child);
  5168. }
  5169. function parentNode (node) {
  5170. return node.parentNode
  5171. }
  5172. function nextSibling (node) {
  5173. return node.nextSibling
  5174. }
  5175. function tagName (node) {
  5176. return node.tagName
  5177. }
  5178. function setTextContent (node, text) {
  5179. node.textContent = text;
  5180. }
  5181. function setStyleScope (node, scopeId) {
  5182. node.setAttribute(scopeId, '');
  5183. }
  5184. var nodeOps = /*#__PURE__*/Object.freeze({
  5185. createElement: createElement$1,
  5186. createElementNS: createElementNS,
  5187. createTextNode: createTextNode,
  5188. createComment: createComment,
  5189. insertBefore: insertBefore,
  5190. removeChild: removeChild,
  5191. appendChild: appendChild,
  5192. parentNode: parentNode,
  5193. nextSibling: nextSibling,
  5194. tagName: tagName,
  5195. setTextContent: setTextContent,
  5196. setStyleScope: setStyleScope
  5197. });
  5198. /* */
  5199. var ref = {
  5200. create: function create (_, vnode) {
  5201. registerRef(vnode);
  5202. },
  5203. update: function update (oldVnode, vnode) {
  5204. if (oldVnode.data.ref !== vnode.data.ref) {
  5205. registerRef(oldVnode, true);
  5206. registerRef(vnode);
  5207. }
  5208. },
  5209. destroy: function destroy (vnode) {
  5210. registerRef(vnode, true);
  5211. }
  5212. };
  5213. function registerRef (vnode, isRemoval) {
  5214. var key = vnode.data.ref;
  5215. if (!isDef(key)) { return }
  5216. var vm = vnode.context;
  5217. var ref = vnode.componentInstance || vnode.elm;
  5218. var refs = vm.$refs;
  5219. if (isRemoval) {
  5220. if (Array.isArray(refs[key])) {
  5221. remove(refs[key], ref);
  5222. } else if (refs[key] === ref) {
  5223. refs[key] = undefined;
  5224. }
  5225. } else {
  5226. if (vnode.data.refInFor) {
  5227. if (!Array.isArray(refs[key])) {
  5228. refs[key] = [ref];
  5229. } else if (refs[key].indexOf(ref) < 0) {
  5230. // $flow-disable-line
  5231. refs[key].push(ref);
  5232. }
  5233. } else {
  5234. refs[key] = ref;
  5235. }
  5236. }
  5237. }
  5238. /**
  5239. * Virtual DOM patching algorithm based on Snabbdom by
  5240. * Simon Friis Vindum (@paldepind)
  5241. * Licensed under the MIT License
  5242. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  5243. *
  5244. * modified by Evan You (@yyx990803)
  5245. *
  5246. * Not type-checking this because this file is perf-critical and the cost
  5247. * of making flow understand it is not worth it.
  5248. */
  5249. var emptyNode = new VNode('', {}, []);
  5250. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  5251. function sameVnode (a, b) {
  5252. return (
  5253. a.key === b.key && (
  5254. (
  5255. a.tag === b.tag &&
  5256. a.isComment === b.isComment &&
  5257. isDef(a.data) === isDef(b.data) &&
  5258. sameInputType(a, b)
  5259. ) || (
  5260. isTrue(a.isAsyncPlaceholder) &&
  5261. a.asyncFactory === b.asyncFactory &&
  5262. isUndef(b.asyncFactory.error)
  5263. )
  5264. )
  5265. )
  5266. }
  5267. function sameInputType (a, b) {
  5268. if (a.tag !== 'input') { return true }
  5269. var i;
  5270. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  5271. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  5272. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  5273. }
  5274. function createKeyToOldIdx (children, beginIdx, endIdx) {
  5275. var i, key;
  5276. var map = {};
  5277. for (i = beginIdx; i <= endIdx; ++i) {
  5278. key = children[i].key;
  5279. if (isDef(key)) { map[key] = i; }
  5280. }
  5281. return map
  5282. }
  5283. function createPatchFunction (backend) {
  5284. var i, j;
  5285. var cbs = {};
  5286. var modules = backend.modules;
  5287. var nodeOps = backend.nodeOps;
  5288. for (i = 0; i < hooks.length; ++i) {
  5289. cbs[hooks[i]] = [];
  5290. for (j = 0; j < modules.length; ++j) {
  5291. if (isDef(modules[j][hooks[i]])) {
  5292. cbs[hooks[i]].push(modules[j][hooks[i]]);
  5293. }
  5294. }
  5295. }
  5296. function emptyNodeAt (elm) {
  5297. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  5298. }
  5299. function createRmCb (childElm, listeners) {
  5300. function remove$$1 () {
  5301. if (--remove$$1.listeners === 0) {
  5302. removeNode(childElm);
  5303. }
  5304. }
  5305. remove$$1.listeners = listeners;
  5306. return remove$$1
  5307. }
  5308. function removeNode (el) {
  5309. var parent = nodeOps.parentNode(el);
  5310. // element may have already been removed due to v-html / v-text
  5311. if (isDef(parent)) {
  5312. nodeOps.removeChild(parent, el);
  5313. }
  5314. }
  5315. function isUnknownElement$$1 (vnode, inVPre) {
  5316. return (
  5317. !inVPre &&
  5318. !vnode.ns &&
  5319. !(
  5320. config.ignoredElements.length &&
  5321. config.ignoredElements.some(function (ignore) {
  5322. return isRegExp(ignore)
  5323. ? ignore.test(vnode.tag)
  5324. : ignore === vnode.tag
  5325. })
  5326. ) &&
  5327. config.isUnknownElement(vnode.tag)
  5328. )
  5329. }
  5330. var creatingElmInVPre = 0;
  5331. function createElm (
  5332. vnode,
  5333. insertedVnodeQueue,
  5334. parentElm,
  5335. refElm,
  5336. nested,
  5337. ownerArray,
  5338. index
  5339. ) {
  5340. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5341. // This vnode was used in a previous render!
  5342. // now it's used as a new node, overwriting its elm would cause
  5343. // potential patch errors down the road when it's used as an insertion
  5344. // reference node. Instead, we clone the node on-demand before creating
  5345. // associated DOM element for it.
  5346. vnode = ownerArray[index] = cloneVNode(vnode);
  5347. }
  5348. vnode.isRootInsert = !nested; // for transition enter check
  5349. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  5350. return
  5351. }
  5352. var data = vnode.data;
  5353. var children = vnode.children;
  5354. var tag = vnode.tag;
  5355. if (isDef(tag)) {
  5356. if (process.env.NODE_ENV !== 'production') {
  5357. if (data && data.pre) {
  5358. creatingElmInVPre++;
  5359. }
  5360. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  5361. warn(
  5362. 'Unknown custom element: <' + tag + '> - did you ' +
  5363. 'register the component correctly? For recursive components, ' +
  5364. 'make sure to provide the "name" option.',
  5365. vnode.context
  5366. );
  5367. }
  5368. }
  5369. vnode.elm = vnode.ns
  5370. ? nodeOps.createElementNS(vnode.ns, tag)
  5371. : nodeOps.createElement(tag, vnode);
  5372. setScope(vnode);
  5373. /* istanbul ignore if */
  5374. {
  5375. createChildren(vnode, children, insertedVnodeQueue);
  5376. if (isDef(data)) {
  5377. invokeCreateHooks(vnode, insertedVnodeQueue);
  5378. }
  5379. insert(parentElm, vnode.elm, refElm);
  5380. }
  5381. if (process.env.NODE_ENV !== 'production' && data && data.pre) {
  5382. creatingElmInVPre--;
  5383. }
  5384. } else if (isTrue(vnode.isComment)) {
  5385. vnode.elm = nodeOps.createComment(vnode.text);
  5386. insert(parentElm, vnode.elm, refElm);
  5387. } else {
  5388. vnode.elm = nodeOps.createTextNode(vnode.text);
  5389. insert(parentElm, vnode.elm, refElm);
  5390. }
  5391. }
  5392. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5393. var i = vnode.data;
  5394. if (isDef(i)) {
  5395. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  5396. if (isDef(i = i.hook) && isDef(i = i.init)) {
  5397. i(vnode, false /* hydrating */);
  5398. }
  5399. // after calling the init hook, if the vnode is a child component
  5400. // it should've created a child instance and mounted it. the child
  5401. // component also has set the placeholder vnode's elm.
  5402. // in that case we can just return the element and be done.
  5403. if (isDef(vnode.componentInstance)) {
  5404. initComponent(vnode, insertedVnodeQueue);
  5405. insert(parentElm, vnode.elm, refElm);
  5406. if (isTrue(isReactivated)) {
  5407. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  5408. }
  5409. return true
  5410. }
  5411. }
  5412. }
  5413. function initComponent (vnode, insertedVnodeQueue) {
  5414. if (isDef(vnode.data.pendingInsert)) {
  5415. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  5416. vnode.data.pendingInsert = null;
  5417. }
  5418. vnode.elm = vnode.componentInstance.$el;
  5419. if (isPatchable(vnode)) {
  5420. invokeCreateHooks(vnode, insertedVnodeQueue);
  5421. setScope(vnode);
  5422. } else {
  5423. // empty component root.
  5424. // skip all element-related modules except for ref (#3455)
  5425. registerRef(vnode);
  5426. // make sure to invoke the insert hook
  5427. insertedVnodeQueue.push(vnode);
  5428. }
  5429. }
  5430. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5431. var i;
  5432. // hack for #4339: a reactivated component with inner transition
  5433. // does not trigger because the inner node's created hooks are not called
  5434. // again. It's not ideal to involve module-specific logic in here but
  5435. // there doesn't seem to be a better way to do it.
  5436. var innerNode = vnode;
  5437. while (innerNode.componentInstance) {
  5438. innerNode = innerNode.componentInstance._vnode;
  5439. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  5440. for (i = 0; i < cbs.activate.length; ++i) {
  5441. cbs.activate[i](emptyNode, innerNode);
  5442. }
  5443. insertedVnodeQueue.push(innerNode);
  5444. break
  5445. }
  5446. }
  5447. // unlike a newly created component,
  5448. // a reactivated keep-alive component doesn't insert itself
  5449. insert(parentElm, vnode.elm, refElm);
  5450. }
  5451. function insert (parent, elm, ref$$1) {
  5452. if (isDef(parent)) {
  5453. if (isDef(ref$$1)) {
  5454. if (nodeOps.parentNode(ref$$1) === parent) {
  5455. nodeOps.insertBefore(parent, elm, ref$$1);
  5456. }
  5457. } else {
  5458. nodeOps.appendChild(parent, elm);
  5459. }
  5460. }
  5461. }
  5462. function createChildren (vnode, children, insertedVnodeQueue) {
  5463. if (Array.isArray(children)) {
  5464. if (process.env.NODE_ENV !== 'production') {
  5465. checkDuplicateKeys(children);
  5466. }
  5467. for (var i = 0; i < children.length; ++i) {
  5468. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  5469. }
  5470. } else if (isPrimitive(vnode.text)) {
  5471. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  5472. }
  5473. }
  5474. function isPatchable (vnode) {
  5475. while (vnode.componentInstance) {
  5476. vnode = vnode.componentInstance._vnode;
  5477. }
  5478. return isDef(vnode.tag)
  5479. }
  5480. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  5481. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5482. cbs.create[i$1](emptyNode, vnode);
  5483. }
  5484. i = vnode.data.hook; // Reuse variable
  5485. if (isDef(i)) {
  5486. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  5487. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  5488. }
  5489. }
  5490. // set scope id attribute for scoped CSS.
  5491. // this is implemented as a special case to avoid the overhead
  5492. // of going through the normal attribute patching process.
  5493. function setScope (vnode) {
  5494. var i;
  5495. if (isDef(i = vnode.fnScopeId)) {
  5496. nodeOps.setStyleScope(vnode.elm, i);
  5497. } else {
  5498. var ancestor = vnode;
  5499. while (ancestor) {
  5500. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  5501. nodeOps.setStyleScope(vnode.elm, i);
  5502. }
  5503. ancestor = ancestor.parent;
  5504. }
  5505. }
  5506. // for slot content they should also get the scopeId from the host instance.
  5507. if (isDef(i = activeInstance) &&
  5508. i !== vnode.context &&
  5509. i !== vnode.fnContext &&
  5510. isDef(i = i.$options._scopeId)
  5511. ) {
  5512. nodeOps.setStyleScope(vnode.elm, i);
  5513. }
  5514. }
  5515. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  5516. for (; startIdx <= endIdx; ++startIdx) {
  5517. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  5518. }
  5519. }
  5520. function invokeDestroyHook (vnode) {
  5521. var i, j;
  5522. var data = vnode.data;
  5523. if (isDef(data)) {
  5524. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  5525. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  5526. }
  5527. if (isDef(i = vnode.children)) {
  5528. for (j = 0; j < vnode.children.length; ++j) {
  5529. invokeDestroyHook(vnode.children[j]);
  5530. }
  5531. }
  5532. }
  5533. function removeVnodes (vnodes, startIdx, endIdx) {
  5534. for (; startIdx <= endIdx; ++startIdx) {
  5535. var ch = vnodes[startIdx];
  5536. if (isDef(ch)) {
  5537. if (isDef(ch.tag)) {
  5538. removeAndInvokeRemoveHook(ch);
  5539. invokeDestroyHook(ch);
  5540. } else { // Text node
  5541. removeNode(ch.elm);
  5542. }
  5543. }
  5544. }
  5545. }
  5546. function removeAndInvokeRemoveHook (vnode, rm) {
  5547. if (isDef(rm) || isDef(vnode.data)) {
  5548. var i;
  5549. var listeners = cbs.remove.length + 1;
  5550. if (isDef(rm)) {
  5551. // we have a recursively passed down rm callback
  5552. // increase the listeners count
  5553. rm.listeners += listeners;
  5554. } else {
  5555. // directly removing
  5556. rm = createRmCb(vnode.elm, listeners);
  5557. }
  5558. // recursively invoke hooks on child component root node
  5559. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  5560. removeAndInvokeRemoveHook(i, rm);
  5561. }
  5562. for (i = 0; i < cbs.remove.length; ++i) {
  5563. cbs.remove[i](vnode, rm);
  5564. }
  5565. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  5566. i(vnode, rm);
  5567. } else {
  5568. rm();
  5569. }
  5570. } else {
  5571. removeNode(vnode.elm);
  5572. }
  5573. }
  5574. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  5575. var oldStartIdx = 0;
  5576. var newStartIdx = 0;
  5577. var oldEndIdx = oldCh.length - 1;
  5578. var oldStartVnode = oldCh[0];
  5579. var oldEndVnode = oldCh[oldEndIdx];
  5580. var newEndIdx = newCh.length - 1;
  5581. var newStartVnode = newCh[0];
  5582. var newEndVnode = newCh[newEndIdx];
  5583. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  5584. // removeOnly is a special flag used only by <transition-group>
  5585. // to ensure removed elements stay in correct relative positions
  5586. // during leaving transitions
  5587. var canMove = !removeOnly;
  5588. if (process.env.NODE_ENV !== 'production') {
  5589. checkDuplicateKeys(newCh);
  5590. }
  5591. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  5592. if (isUndef(oldStartVnode)) {
  5593. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  5594. } else if (isUndef(oldEndVnode)) {
  5595. oldEndVnode = oldCh[--oldEndIdx];
  5596. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  5597. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5598. oldStartVnode = oldCh[++oldStartIdx];
  5599. newStartVnode = newCh[++newStartIdx];
  5600. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  5601. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5602. oldEndVnode = oldCh[--oldEndIdx];
  5603. newEndVnode = newCh[--newEndIdx];
  5604. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  5605. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5606. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  5607. oldStartVnode = oldCh[++oldStartIdx];
  5608. newEndVnode = newCh[--newEndIdx];
  5609. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  5610. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5611. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  5612. oldEndVnode = oldCh[--oldEndIdx];
  5613. newStartVnode = newCh[++newStartIdx];
  5614. } else {
  5615. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  5616. idxInOld = isDef(newStartVnode.key)
  5617. ? oldKeyToIdx[newStartVnode.key]
  5618. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  5619. if (isUndef(idxInOld)) { // New element
  5620. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5621. } else {
  5622. vnodeToMove = oldCh[idxInOld];
  5623. if (sameVnode(vnodeToMove, newStartVnode)) {
  5624. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5625. oldCh[idxInOld] = undefined;
  5626. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  5627. } else {
  5628. // same key but different element. treat as new element
  5629. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5630. }
  5631. }
  5632. newStartVnode = newCh[++newStartIdx];
  5633. }
  5634. }
  5635. if (oldStartIdx > oldEndIdx) {
  5636. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  5637. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  5638. } else if (newStartIdx > newEndIdx) {
  5639. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  5640. }
  5641. }
  5642. function checkDuplicateKeys (children) {
  5643. var seenKeys = {};
  5644. for (var i = 0; i < children.length; i++) {
  5645. var vnode = children[i];
  5646. var key = vnode.key;
  5647. if (isDef(key)) {
  5648. if (seenKeys[key]) {
  5649. warn(
  5650. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  5651. vnode.context
  5652. );
  5653. } else {
  5654. seenKeys[key] = true;
  5655. }
  5656. }
  5657. }
  5658. }
  5659. function findIdxInOld (node, oldCh, start, end) {
  5660. for (var i = start; i < end; i++) {
  5661. var c = oldCh[i];
  5662. if (isDef(c) && sameVnode(node, c)) { return i }
  5663. }
  5664. }
  5665. function patchVnode (
  5666. oldVnode,
  5667. vnode,
  5668. insertedVnodeQueue,
  5669. ownerArray,
  5670. index,
  5671. removeOnly
  5672. ) {
  5673. if (oldVnode === vnode) {
  5674. return
  5675. }
  5676. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5677. // clone reused vnode
  5678. vnode = ownerArray[index] = cloneVNode(vnode);
  5679. }
  5680. var elm = vnode.elm = oldVnode.elm;
  5681. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  5682. if (isDef(vnode.asyncFactory.resolved)) {
  5683. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  5684. } else {
  5685. vnode.isAsyncPlaceholder = true;
  5686. }
  5687. return
  5688. }
  5689. // reuse element for static trees.
  5690. // note we only do this if the vnode is cloned -
  5691. // if the new node is not cloned it means the render functions have been
  5692. // reset by the hot-reload-api and we need to do a proper re-render.
  5693. if (isTrue(vnode.isStatic) &&
  5694. isTrue(oldVnode.isStatic) &&
  5695. vnode.key === oldVnode.key &&
  5696. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  5697. ) {
  5698. vnode.componentInstance = oldVnode.componentInstance;
  5699. return
  5700. }
  5701. var i;
  5702. var data = vnode.data;
  5703. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  5704. i(oldVnode, vnode);
  5705. }
  5706. var oldCh = oldVnode.children;
  5707. var ch = vnode.children;
  5708. if (isDef(data) && isPatchable(vnode)) {
  5709. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  5710. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  5711. }
  5712. if (isUndef(vnode.text)) {
  5713. if (isDef(oldCh) && isDef(ch)) {
  5714. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  5715. } else if (isDef(ch)) {
  5716. if (process.env.NODE_ENV !== 'production') {
  5717. checkDuplicateKeys(ch);
  5718. }
  5719. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  5720. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  5721. } else if (isDef(oldCh)) {
  5722. removeVnodes(oldCh, 0, oldCh.length - 1);
  5723. } else if (isDef(oldVnode.text)) {
  5724. nodeOps.setTextContent(elm, '');
  5725. }
  5726. } else if (oldVnode.text !== vnode.text) {
  5727. nodeOps.setTextContent(elm, vnode.text);
  5728. }
  5729. if (isDef(data)) {
  5730. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  5731. }
  5732. }
  5733. function invokeInsertHook (vnode, queue, initial) {
  5734. // delay insert hooks for component root nodes, invoke them after the
  5735. // element is really inserted
  5736. if (isTrue(initial) && isDef(vnode.parent)) {
  5737. vnode.parent.data.pendingInsert = queue;
  5738. } else {
  5739. for (var i = 0; i < queue.length; ++i) {
  5740. queue[i].data.hook.insert(queue[i]);
  5741. }
  5742. }
  5743. }
  5744. var hydrationBailed = false;
  5745. // list of modules that can skip create hook during hydration because they
  5746. // are already rendered on the client or has no need for initialization
  5747. // Note: style is excluded because it relies on initial clone for future
  5748. // deep updates (#7063).
  5749. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  5750. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  5751. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  5752. var i;
  5753. var tag = vnode.tag;
  5754. var data = vnode.data;
  5755. var children = vnode.children;
  5756. inVPre = inVPre || (data && data.pre);
  5757. vnode.elm = elm;
  5758. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  5759. vnode.isAsyncPlaceholder = true;
  5760. return true
  5761. }
  5762. // assert node match
  5763. if (process.env.NODE_ENV !== 'production') {
  5764. if (!assertNodeMatch(elm, vnode, inVPre)) {
  5765. return false
  5766. }
  5767. }
  5768. if (isDef(data)) {
  5769. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  5770. if (isDef(i = vnode.componentInstance)) {
  5771. // child component. it should have hydrated its own tree.
  5772. initComponent(vnode, insertedVnodeQueue);
  5773. return true
  5774. }
  5775. }
  5776. if (isDef(tag)) {
  5777. if (isDef(children)) {
  5778. // empty element, allow client to pick up and populate children
  5779. if (!elm.hasChildNodes()) {
  5780. createChildren(vnode, children, insertedVnodeQueue);
  5781. } else {
  5782. // v-html and domProps: innerHTML
  5783. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  5784. if (i !== elm.innerHTML) {
  5785. /* istanbul ignore if */
  5786. if (process.env.NODE_ENV !== 'production' &&
  5787. typeof console !== 'undefined' &&
  5788. !hydrationBailed
  5789. ) {
  5790. hydrationBailed = true;
  5791. console.warn('Parent: ', elm);
  5792. console.warn('server innerHTML: ', i);
  5793. console.warn('client innerHTML: ', elm.innerHTML);
  5794. }
  5795. return false
  5796. }
  5797. } else {
  5798. // iterate and compare children lists
  5799. var childrenMatch = true;
  5800. var childNode = elm.firstChild;
  5801. for (var i$1 = 0; i$1 < children.length; i$1++) {
  5802. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  5803. childrenMatch = false;
  5804. break
  5805. }
  5806. childNode = childNode.nextSibling;
  5807. }
  5808. // if childNode is not null, it means the actual childNodes list is
  5809. // longer than the virtual children list.
  5810. if (!childrenMatch || childNode) {
  5811. /* istanbul ignore if */
  5812. if (process.env.NODE_ENV !== 'production' &&
  5813. typeof console !== 'undefined' &&
  5814. !hydrationBailed
  5815. ) {
  5816. hydrationBailed = true;
  5817. console.warn('Parent: ', elm);
  5818. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  5819. }
  5820. return false
  5821. }
  5822. }
  5823. }
  5824. }
  5825. if (isDef(data)) {
  5826. var fullInvoke = false;
  5827. for (var key in data) {
  5828. if (!isRenderedModule(key)) {
  5829. fullInvoke = true;
  5830. invokeCreateHooks(vnode, insertedVnodeQueue);
  5831. break
  5832. }
  5833. }
  5834. if (!fullInvoke && data['class']) {
  5835. // ensure collecting deps for deep class bindings for future updates
  5836. traverse(data['class']);
  5837. }
  5838. }
  5839. } else if (elm.data !== vnode.text) {
  5840. elm.data = vnode.text;
  5841. }
  5842. return true
  5843. }
  5844. function assertNodeMatch (node, vnode, inVPre) {
  5845. if (isDef(vnode.tag)) {
  5846. return vnode.tag.indexOf('vue-component') === 0 || (
  5847. !isUnknownElement$$1(vnode, inVPre) &&
  5848. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  5849. )
  5850. } else {
  5851. return node.nodeType === (vnode.isComment ? 8 : 3)
  5852. }
  5853. }
  5854. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  5855. if (isUndef(vnode)) {
  5856. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  5857. return
  5858. }
  5859. var isInitialPatch = false;
  5860. var insertedVnodeQueue = [];
  5861. if (isUndef(oldVnode)) {
  5862. // empty mount (likely as component), create new root element
  5863. isInitialPatch = true;
  5864. createElm(vnode, insertedVnodeQueue);
  5865. } else {
  5866. var isRealElement = isDef(oldVnode.nodeType);
  5867. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  5868. // patch existing root node
  5869. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  5870. } else {
  5871. if (isRealElement) {
  5872. // mounting to a real element
  5873. // check if this is server-rendered content and if we can perform
  5874. // a successful hydration.
  5875. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  5876. oldVnode.removeAttribute(SSR_ATTR);
  5877. hydrating = true;
  5878. }
  5879. if (isTrue(hydrating)) {
  5880. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  5881. invokeInsertHook(vnode, insertedVnodeQueue, true);
  5882. return oldVnode
  5883. } else if (process.env.NODE_ENV !== 'production') {
  5884. warn(
  5885. 'The client-side rendered virtual DOM tree is not matching ' +
  5886. 'server-rendered content. This is likely caused by incorrect ' +
  5887. 'HTML markup, for example nesting block-level elements inside ' +
  5888. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  5889. 'full client-side render.'
  5890. );
  5891. }
  5892. }
  5893. // either not server-rendered, or hydration failed.
  5894. // create an empty node and replace it
  5895. oldVnode = emptyNodeAt(oldVnode);
  5896. }
  5897. // replacing existing element
  5898. var oldElm = oldVnode.elm;
  5899. var parentElm = nodeOps.parentNode(oldElm);
  5900. // create new node
  5901. createElm(
  5902. vnode,
  5903. insertedVnodeQueue,
  5904. // extremely rare edge case: do not insert if old element is in a
  5905. // leaving transition. Only happens when combining transition +
  5906. // keep-alive + HOCs. (#4590)
  5907. oldElm._leaveCb ? null : parentElm,
  5908. nodeOps.nextSibling(oldElm)
  5909. );
  5910. // update parent placeholder node element, recursively
  5911. if (isDef(vnode.parent)) {
  5912. var ancestor = vnode.parent;
  5913. var patchable = isPatchable(vnode);
  5914. while (ancestor) {
  5915. for (var i = 0; i < cbs.destroy.length; ++i) {
  5916. cbs.destroy[i](ancestor);
  5917. }
  5918. ancestor.elm = vnode.elm;
  5919. if (patchable) {
  5920. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5921. cbs.create[i$1](emptyNode, ancestor);
  5922. }
  5923. // #6513
  5924. // invoke insert hooks that may have been merged by create hooks.
  5925. // e.g. for directives that uses the "inserted" hook.
  5926. var insert = ancestor.data.hook.insert;
  5927. if (insert.merged) {
  5928. // start at index 1 to avoid re-invoking component mounted hook
  5929. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  5930. insert.fns[i$2]();
  5931. }
  5932. }
  5933. } else {
  5934. registerRef(ancestor);
  5935. }
  5936. ancestor = ancestor.parent;
  5937. }
  5938. }
  5939. // destroy old node
  5940. if (isDef(parentElm)) {
  5941. removeVnodes([oldVnode], 0, 0);
  5942. } else if (isDef(oldVnode.tag)) {
  5943. invokeDestroyHook(oldVnode);
  5944. }
  5945. }
  5946. }
  5947. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  5948. return vnode.elm
  5949. }
  5950. }
  5951. /* */
  5952. var directives = {
  5953. create: updateDirectives,
  5954. update: updateDirectives,
  5955. destroy: function unbindDirectives (vnode) {
  5956. updateDirectives(vnode, emptyNode);
  5957. }
  5958. };
  5959. function updateDirectives (oldVnode, vnode) {
  5960. if (oldVnode.data.directives || vnode.data.directives) {
  5961. _update(oldVnode, vnode);
  5962. }
  5963. }
  5964. function _update (oldVnode, vnode) {
  5965. var isCreate = oldVnode === emptyNode;
  5966. var isDestroy = vnode === emptyNode;
  5967. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  5968. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  5969. var dirsWithInsert = [];
  5970. var dirsWithPostpatch = [];
  5971. var key, oldDir, dir;
  5972. for (key in newDirs) {
  5973. oldDir = oldDirs[key];
  5974. dir = newDirs[key];
  5975. if (!oldDir) {
  5976. // new directive, bind
  5977. callHook$1(dir, 'bind', vnode, oldVnode);
  5978. if (dir.def && dir.def.inserted) {
  5979. dirsWithInsert.push(dir);
  5980. }
  5981. } else {
  5982. // existing directive, update
  5983. dir.oldValue = oldDir.value;
  5984. dir.oldArg = oldDir.arg;
  5985. callHook$1(dir, 'update', vnode, oldVnode);
  5986. if (dir.def && dir.def.componentUpdated) {
  5987. dirsWithPostpatch.push(dir);
  5988. }
  5989. }
  5990. }
  5991. if (dirsWithInsert.length) {
  5992. var callInsert = function () {
  5993. for (var i = 0; i < dirsWithInsert.length; i++) {
  5994. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  5995. }
  5996. };
  5997. if (isCreate) {
  5998. mergeVNodeHook(vnode, 'insert', callInsert);
  5999. } else {
  6000. callInsert();
  6001. }
  6002. }
  6003. if (dirsWithPostpatch.length) {
  6004. mergeVNodeHook(vnode, 'postpatch', function () {
  6005. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  6006. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  6007. }
  6008. });
  6009. }
  6010. if (!isCreate) {
  6011. for (key in oldDirs) {
  6012. if (!newDirs[key]) {
  6013. // no longer present, unbind
  6014. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  6015. }
  6016. }
  6017. }
  6018. }
  6019. var emptyModifiers = Object.create(null);
  6020. function normalizeDirectives$1 (
  6021. dirs,
  6022. vm
  6023. ) {
  6024. var res = Object.create(null);
  6025. if (!dirs) {
  6026. // $flow-disable-line
  6027. return res
  6028. }
  6029. var i, dir;
  6030. for (i = 0; i < dirs.length; i++) {
  6031. dir = dirs[i];
  6032. if (!dir.modifiers) {
  6033. // $flow-disable-line
  6034. dir.modifiers = emptyModifiers;
  6035. }
  6036. res[getRawDirName(dir)] = dir;
  6037. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  6038. }
  6039. // $flow-disable-line
  6040. return res
  6041. }
  6042. function getRawDirName (dir) {
  6043. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  6044. }
  6045. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  6046. var fn = dir.def && dir.def[hook];
  6047. if (fn) {
  6048. try {
  6049. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  6050. } catch (e) {
  6051. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  6052. }
  6053. }
  6054. }
  6055. var baseModules = [
  6056. ref,
  6057. directives
  6058. ];
  6059. /* */
  6060. function updateAttrs (oldVnode, vnode) {
  6061. var opts = vnode.componentOptions;
  6062. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  6063. return
  6064. }
  6065. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  6066. return
  6067. }
  6068. var key, cur, old;
  6069. var elm = vnode.elm;
  6070. var oldAttrs = oldVnode.data.attrs || {};
  6071. var attrs = vnode.data.attrs || {};
  6072. // clone observed objects, as the user probably wants to mutate it
  6073. if (isDef(attrs.__ob__)) {
  6074. attrs = vnode.data.attrs = extend({}, attrs);
  6075. }
  6076. for (key in attrs) {
  6077. cur = attrs[key];
  6078. old = oldAttrs[key];
  6079. if (old !== cur) {
  6080. setAttr(elm, key, cur);
  6081. }
  6082. }
  6083. // #4391: in IE9, setting type can reset value for input[type=radio]
  6084. // #6666: IE/Edge forces progress value down to 1 before setting a max
  6085. /* istanbul ignore if */
  6086. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  6087. setAttr(elm, 'value', attrs.value);
  6088. }
  6089. for (key in oldAttrs) {
  6090. if (isUndef(attrs[key])) {
  6091. if (isXlink(key)) {
  6092. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6093. } else if (!isEnumeratedAttr(key)) {
  6094. elm.removeAttribute(key);
  6095. }
  6096. }
  6097. }
  6098. }
  6099. function setAttr (el, key, value) {
  6100. if (el.tagName.indexOf('-') > -1) {
  6101. baseSetAttr(el, key, value);
  6102. } else if (isBooleanAttr(key)) {
  6103. // set attribute for blank value
  6104. // e.g. <option disabled>Select one</option>
  6105. if (isFalsyAttrValue(value)) {
  6106. el.removeAttribute(key);
  6107. } else {
  6108. // technically allowfullscreen is a boolean attribute for <iframe>,
  6109. // but Flash expects a value of "true" when used on <embed> tag
  6110. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  6111. ? 'true'
  6112. : key;
  6113. el.setAttribute(key, value);
  6114. }
  6115. } else if (isEnumeratedAttr(key)) {
  6116. el.setAttribute(key, convertEnumeratedValue(key, value));
  6117. } else if (isXlink(key)) {
  6118. if (isFalsyAttrValue(value)) {
  6119. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6120. } else {
  6121. el.setAttributeNS(xlinkNS, key, value);
  6122. }
  6123. } else {
  6124. baseSetAttr(el, key, value);
  6125. }
  6126. }
  6127. function baseSetAttr (el, key, value) {
  6128. if (isFalsyAttrValue(value)) {
  6129. el.removeAttribute(key);
  6130. } else {
  6131. // #7138: IE10 & 11 fires input event when setting placeholder on
  6132. // <textarea>... block the first input event and remove the blocker
  6133. // immediately.
  6134. /* istanbul ignore if */
  6135. if (
  6136. isIE && !isIE9 &&
  6137. el.tagName === 'TEXTAREA' &&
  6138. key === 'placeholder' && value !== '' && !el.__ieph
  6139. ) {
  6140. var blocker = function (e) {
  6141. e.stopImmediatePropagation();
  6142. el.removeEventListener('input', blocker);
  6143. };
  6144. el.addEventListener('input', blocker);
  6145. // $flow-disable-line
  6146. el.__ieph = true; /* IE placeholder patched */
  6147. }
  6148. el.setAttribute(key, value);
  6149. }
  6150. }
  6151. var attrs = {
  6152. create: updateAttrs,
  6153. update: updateAttrs
  6154. };
  6155. /* */
  6156. function updateClass (oldVnode, vnode) {
  6157. var el = vnode.elm;
  6158. var data = vnode.data;
  6159. var oldData = oldVnode.data;
  6160. if (
  6161. isUndef(data.staticClass) &&
  6162. isUndef(data.class) && (
  6163. isUndef(oldData) || (
  6164. isUndef(oldData.staticClass) &&
  6165. isUndef(oldData.class)
  6166. )
  6167. )
  6168. ) {
  6169. return
  6170. }
  6171. var cls = genClassForVnode(vnode);
  6172. // handle transition classes
  6173. var transitionClass = el._transitionClasses;
  6174. if (isDef(transitionClass)) {
  6175. cls = concat(cls, stringifyClass(transitionClass));
  6176. }
  6177. // set the class
  6178. if (cls !== el._prevClass) {
  6179. el.setAttribute('class', cls);
  6180. el._prevClass = cls;
  6181. }
  6182. }
  6183. var klass = {
  6184. create: updateClass,
  6185. update: updateClass
  6186. };
  6187. /* */
  6188. /* */
  6189. /* */
  6190. /* */
  6191. // in some cases, the event used has to be determined at runtime
  6192. // so we used some reserved tokens during compile.
  6193. var RANGE_TOKEN = '__r';
  6194. var CHECKBOX_RADIO_TOKEN = '__c';
  6195. /* */
  6196. // normalize v-model event tokens that can only be determined at runtime.
  6197. // it's important to place the event as the first in the array because
  6198. // the whole point is ensuring the v-model callback gets called before
  6199. // user-attached handlers.
  6200. function normalizeEvents (on) {
  6201. /* istanbul ignore if */
  6202. if (isDef(on[RANGE_TOKEN])) {
  6203. // IE input[type=range] only supports `change` event
  6204. var event = isIE ? 'change' : 'input';
  6205. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  6206. delete on[RANGE_TOKEN];
  6207. }
  6208. // This was originally intended to fix #4521 but no longer necessary
  6209. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  6210. /* istanbul ignore if */
  6211. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  6212. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  6213. delete on[CHECKBOX_RADIO_TOKEN];
  6214. }
  6215. }
  6216. var target$1;
  6217. function createOnceHandler$1 (event, handler, capture) {
  6218. var _target = target$1; // save current target element in closure
  6219. return function onceHandler () {
  6220. var res = handler.apply(null, arguments);
  6221. if (res !== null) {
  6222. remove$2(event, onceHandler, capture, _target);
  6223. }
  6224. }
  6225. }
  6226. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  6227. // implementation and does not fire microtasks in between event propagation, so
  6228. // safe to exclude.
  6229. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  6230. function add$1 (
  6231. name,
  6232. handler,
  6233. capture,
  6234. passive
  6235. ) {
  6236. // async edge case #6566: inner click event triggers patch, event handler
  6237. // attached to outer element during patch, and triggered again. This
  6238. // happens because browsers fire microtask ticks between event propagation.
  6239. // the solution is simple: we save the timestamp when a handler is attached,
  6240. // and the handler would only fire if the event passed to it was fired
  6241. // AFTER it was attached.
  6242. if (useMicrotaskFix) {
  6243. var attachedTimestamp = currentFlushTimestamp;
  6244. var original = handler;
  6245. handler = original._wrapper = function (e) {
  6246. if (
  6247. // no bubbling, should always fire.
  6248. // this is just a safety net in case event.timeStamp is unreliable in
  6249. // certain weird environments...
  6250. e.target === e.currentTarget ||
  6251. // event is fired after handler attachment
  6252. e.timeStamp >= attachedTimestamp ||
  6253. // bail for environments that have buggy event.timeStamp implementations
  6254. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  6255. // #9681 QtWebEngine event.timeStamp is negative value
  6256. e.timeStamp <= 0 ||
  6257. // #9448 bail if event is fired in another document in a multi-page
  6258. // electron/nw.js app, since event.timeStamp will be using a different
  6259. // starting reference
  6260. e.target.ownerDocument !== document
  6261. ) {
  6262. return original.apply(this, arguments)
  6263. }
  6264. };
  6265. }
  6266. target$1.addEventListener(
  6267. name,
  6268. handler,
  6269. supportsPassive
  6270. ? { capture: capture, passive: passive }
  6271. : capture
  6272. );
  6273. }
  6274. function remove$2 (
  6275. name,
  6276. handler,
  6277. capture,
  6278. _target
  6279. ) {
  6280. (_target || target$1).removeEventListener(
  6281. name,
  6282. handler._wrapper || handler,
  6283. capture
  6284. );
  6285. }
  6286. function updateDOMListeners (oldVnode, vnode) {
  6287. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  6288. return
  6289. }
  6290. var on = vnode.data.on || {};
  6291. var oldOn = oldVnode.data.on || {};
  6292. target$1 = vnode.elm;
  6293. normalizeEvents(on);
  6294. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  6295. target$1 = undefined;
  6296. }
  6297. var events = {
  6298. create: updateDOMListeners,
  6299. update: updateDOMListeners
  6300. };
  6301. /* */
  6302. var svgContainer;
  6303. function updateDOMProps (oldVnode, vnode) {
  6304. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  6305. return
  6306. }
  6307. var key, cur;
  6308. var elm = vnode.elm;
  6309. var oldProps = oldVnode.data.domProps || {};
  6310. var props = vnode.data.domProps || {};
  6311. // clone observed objects, as the user probably wants to mutate it
  6312. if (isDef(props.__ob__)) {
  6313. props = vnode.data.domProps = extend({}, props);
  6314. }
  6315. for (key in oldProps) {
  6316. if (!(key in props)) {
  6317. elm[key] = '';
  6318. }
  6319. }
  6320. for (key in props) {
  6321. cur = props[key];
  6322. // ignore children if the node has textContent or innerHTML,
  6323. // as these will throw away existing DOM nodes and cause removal errors
  6324. // on subsequent patches (#3360)
  6325. if (key === 'textContent' || key === 'innerHTML') {
  6326. if (vnode.children) { vnode.children.length = 0; }
  6327. if (cur === oldProps[key]) { continue }
  6328. // #6601 work around Chrome version <= 55 bug where single textNode
  6329. // replaced by innerHTML/textContent retains its parentNode property
  6330. if (elm.childNodes.length === 1) {
  6331. elm.removeChild(elm.childNodes[0]);
  6332. }
  6333. }
  6334. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  6335. // store value as _value as well since
  6336. // non-string values will be stringified
  6337. elm._value = cur;
  6338. // avoid resetting cursor position when value is the same
  6339. var strCur = isUndef(cur) ? '' : String(cur);
  6340. if (shouldUpdateValue(elm, strCur)) {
  6341. elm.value = strCur;
  6342. }
  6343. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  6344. // IE doesn't support innerHTML for SVG elements
  6345. svgContainer = svgContainer || document.createElement('div');
  6346. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  6347. var svg = svgContainer.firstChild;
  6348. while (elm.firstChild) {
  6349. elm.removeChild(elm.firstChild);
  6350. }
  6351. while (svg.firstChild) {
  6352. elm.appendChild(svg.firstChild);
  6353. }
  6354. } else if (
  6355. // skip the update if old and new VDOM state is the same.
  6356. // `value` is handled separately because the DOM value may be temporarily
  6357. // out of sync with VDOM state due to focus, composition and modifiers.
  6358. // This #4521 by skipping the unnecessary `checked` update.
  6359. cur !== oldProps[key]
  6360. ) {
  6361. // some property updates can throw
  6362. // e.g. `value` on <progress> w/ non-finite value
  6363. try {
  6364. elm[key] = cur;
  6365. } catch (e) {}
  6366. }
  6367. }
  6368. }
  6369. // check platforms/web/util/attrs.js acceptValue
  6370. function shouldUpdateValue (elm, checkVal) {
  6371. return (!elm.composing && (
  6372. elm.tagName === 'OPTION' ||
  6373. isNotInFocusAndDirty(elm, checkVal) ||
  6374. isDirtyWithModifiers(elm, checkVal)
  6375. ))
  6376. }
  6377. function isNotInFocusAndDirty (elm, checkVal) {
  6378. // return true when textbox (.number and .trim) loses focus and its value is
  6379. // not equal to the updated value
  6380. var notInFocus = true;
  6381. // #6157
  6382. // work around IE bug when accessing document.activeElement in an iframe
  6383. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  6384. return notInFocus && elm.value !== checkVal
  6385. }
  6386. function isDirtyWithModifiers (elm, newVal) {
  6387. var value = elm.value;
  6388. var modifiers = elm._vModifiers; // injected by v-model runtime
  6389. if (isDef(modifiers)) {
  6390. if (modifiers.number) {
  6391. return toNumber(value) !== toNumber(newVal)
  6392. }
  6393. if (modifiers.trim) {
  6394. return value.trim() !== newVal.trim()
  6395. }
  6396. }
  6397. return value !== newVal
  6398. }
  6399. var domProps = {
  6400. create: updateDOMProps,
  6401. update: updateDOMProps
  6402. };
  6403. /* */
  6404. var parseStyleText = cached(function (cssText) {
  6405. var res = {};
  6406. var listDelimiter = /;(?![^(]*\))/g;
  6407. var propertyDelimiter = /:(.+)/;
  6408. cssText.split(listDelimiter).forEach(function (item) {
  6409. if (item) {
  6410. var tmp = item.split(propertyDelimiter);
  6411. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6412. }
  6413. });
  6414. return res
  6415. });
  6416. // merge static and dynamic style data on the same vnode
  6417. function normalizeStyleData (data) {
  6418. var style = normalizeStyleBinding(data.style);
  6419. // static style is pre-processed into an object during compilation
  6420. // and is always a fresh object, so it's safe to merge into it
  6421. return data.staticStyle
  6422. ? extend(data.staticStyle, style)
  6423. : style
  6424. }
  6425. // normalize possible array / string values into Object
  6426. function normalizeStyleBinding (bindingStyle) {
  6427. if (Array.isArray(bindingStyle)) {
  6428. return toObject(bindingStyle)
  6429. }
  6430. if (typeof bindingStyle === 'string') {
  6431. return parseStyleText(bindingStyle)
  6432. }
  6433. return bindingStyle
  6434. }
  6435. /**
  6436. * parent component style should be after child's
  6437. * so that parent component's style could override it
  6438. */
  6439. function getStyle (vnode, checkChild) {
  6440. var res = {};
  6441. var styleData;
  6442. if (checkChild) {
  6443. var childNode = vnode;
  6444. while (childNode.componentInstance) {
  6445. childNode = childNode.componentInstance._vnode;
  6446. if (
  6447. childNode && childNode.data &&
  6448. (styleData = normalizeStyleData(childNode.data))
  6449. ) {
  6450. extend(res, styleData);
  6451. }
  6452. }
  6453. }
  6454. if ((styleData = normalizeStyleData(vnode.data))) {
  6455. extend(res, styleData);
  6456. }
  6457. var parentNode = vnode;
  6458. while ((parentNode = parentNode.parent)) {
  6459. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  6460. extend(res, styleData);
  6461. }
  6462. }
  6463. return res
  6464. }
  6465. /* */
  6466. var cssVarRE = /^--/;
  6467. var importantRE = /\s*!important$/;
  6468. var setProp = function (el, name, val) {
  6469. /* istanbul ignore if */
  6470. if (cssVarRE.test(name)) {
  6471. el.style.setProperty(name, val);
  6472. } else if (importantRE.test(val)) {
  6473. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  6474. } else {
  6475. var normalizedName = normalize(name);
  6476. if (Array.isArray(val)) {
  6477. // Support values array created by autoprefixer, e.g.
  6478. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  6479. // Set them one by one, and the browser will only set those it can recognize
  6480. for (var i = 0, len = val.length; i < len; i++) {
  6481. el.style[normalizedName] = val[i];
  6482. }
  6483. } else {
  6484. el.style[normalizedName] = val;
  6485. }
  6486. }
  6487. };
  6488. var vendorNames = ['Webkit', 'Moz', 'ms'];
  6489. var emptyStyle;
  6490. var normalize = cached(function (prop) {
  6491. emptyStyle = emptyStyle || document.createElement('div').style;
  6492. prop = camelize(prop);
  6493. if (prop !== 'filter' && (prop in emptyStyle)) {
  6494. return prop
  6495. }
  6496. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  6497. for (var i = 0; i < vendorNames.length; i++) {
  6498. var name = vendorNames[i] + capName;
  6499. if (name in emptyStyle) {
  6500. return name
  6501. }
  6502. }
  6503. });
  6504. function updateStyle (oldVnode, vnode) {
  6505. var data = vnode.data;
  6506. var oldData = oldVnode.data;
  6507. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  6508. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  6509. ) {
  6510. return
  6511. }
  6512. var cur, name;
  6513. var el = vnode.elm;
  6514. var oldStaticStyle = oldData.staticStyle;
  6515. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  6516. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  6517. var oldStyle = oldStaticStyle || oldStyleBinding;
  6518. var style = normalizeStyleBinding(vnode.data.style) || {};
  6519. // store normalized style under a different key for next diff
  6520. // make sure to clone it if it's reactive, since the user likely wants
  6521. // to mutate it.
  6522. vnode.data.normalizedStyle = isDef(style.__ob__)
  6523. ? extend({}, style)
  6524. : style;
  6525. var newStyle = getStyle(vnode, true);
  6526. for (name in oldStyle) {
  6527. if (isUndef(newStyle[name])) {
  6528. setProp(el, name, '');
  6529. }
  6530. }
  6531. for (name in newStyle) {
  6532. cur = newStyle[name];
  6533. if (cur !== oldStyle[name]) {
  6534. // ie9 setting to null has no effect, must use empty string
  6535. setProp(el, name, cur == null ? '' : cur);
  6536. }
  6537. }
  6538. }
  6539. var style = {
  6540. create: updateStyle,
  6541. update: updateStyle
  6542. };
  6543. /* */
  6544. var whitespaceRE = /\s+/;
  6545. /**
  6546. * Add class with compatibility for SVG since classList is not supported on
  6547. * SVG elements in IE
  6548. */
  6549. function addClass (el, cls) {
  6550. /* istanbul ignore if */
  6551. if (!cls || !(cls = cls.trim())) {
  6552. return
  6553. }
  6554. /* istanbul ignore else */
  6555. if (el.classList) {
  6556. if (cls.indexOf(' ') > -1) {
  6557. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  6558. } else {
  6559. el.classList.add(cls);
  6560. }
  6561. } else {
  6562. var cur = " " + (el.getAttribute('class') || '') + " ";
  6563. if (cur.indexOf(' ' + cls + ' ') < 0) {
  6564. el.setAttribute('class', (cur + cls).trim());
  6565. }
  6566. }
  6567. }
  6568. /**
  6569. * Remove class with compatibility for SVG since classList is not supported on
  6570. * SVG elements in IE
  6571. */
  6572. function removeClass (el, cls) {
  6573. /* istanbul ignore if */
  6574. if (!cls || !(cls = cls.trim())) {
  6575. return
  6576. }
  6577. /* istanbul ignore else */
  6578. if (el.classList) {
  6579. if (cls.indexOf(' ') > -1) {
  6580. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  6581. } else {
  6582. el.classList.remove(cls);
  6583. }
  6584. if (!el.classList.length) {
  6585. el.removeAttribute('class');
  6586. }
  6587. } else {
  6588. var cur = " " + (el.getAttribute('class') || '') + " ";
  6589. var tar = ' ' + cls + ' ';
  6590. while (cur.indexOf(tar) >= 0) {
  6591. cur = cur.replace(tar, ' ');
  6592. }
  6593. cur = cur.trim();
  6594. if (cur) {
  6595. el.setAttribute('class', cur);
  6596. } else {
  6597. el.removeAttribute('class');
  6598. }
  6599. }
  6600. }
  6601. /* */
  6602. function resolveTransition (def$$1) {
  6603. if (!def$$1) {
  6604. return
  6605. }
  6606. /* istanbul ignore else */
  6607. if (typeof def$$1 === 'object') {
  6608. var res = {};
  6609. if (def$$1.css !== false) {
  6610. extend(res, autoCssTransition(def$$1.name || 'v'));
  6611. }
  6612. extend(res, def$$1);
  6613. return res
  6614. } else if (typeof def$$1 === 'string') {
  6615. return autoCssTransition(def$$1)
  6616. }
  6617. }
  6618. var autoCssTransition = cached(function (name) {
  6619. return {
  6620. enterClass: (name + "-enter"),
  6621. enterToClass: (name + "-enter-to"),
  6622. enterActiveClass: (name + "-enter-active"),
  6623. leaveClass: (name + "-leave"),
  6624. leaveToClass: (name + "-leave-to"),
  6625. leaveActiveClass: (name + "-leave-active")
  6626. }
  6627. });
  6628. var hasTransition = inBrowser && !isIE9;
  6629. var TRANSITION = 'transition';
  6630. var ANIMATION = 'animation';
  6631. // Transition property/event sniffing
  6632. var transitionProp = 'transition';
  6633. var transitionEndEvent = 'transitionend';
  6634. var animationProp = 'animation';
  6635. var animationEndEvent = 'animationend';
  6636. if (hasTransition) {
  6637. /* istanbul ignore if */
  6638. if (window.ontransitionend === undefined &&
  6639. window.onwebkittransitionend !== undefined
  6640. ) {
  6641. transitionProp = 'WebkitTransition';
  6642. transitionEndEvent = 'webkitTransitionEnd';
  6643. }
  6644. if (window.onanimationend === undefined &&
  6645. window.onwebkitanimationend !== undefined
  6646. ) {
  6647. animationProp = 'WebkitAnimation';
  6648. animationEndEvent = 'webkitAnimationEnd';
  6649. }
  6650. }
  6651. // binding to window is necessary to make hot reload work in IE in strict mode
  6652. var raf = inBrowser
  6653. ? window.requestAnimationFrame
  6654. ? window.requestAnimationFrame.bind(window)
  6655. : setTimeout
  6656. : /* istanbul ignore next */ function (fn) { return fn(); };
  6657. function nextFrame (fn) {
  6658. raf(function () {
  6659. raf(fn);
  6660. });
  6661. }
  6662. function addTransitionClass (el, cls) {
  6663. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  6664. if (transitionClasses.indexOf(cls) < 0) {
  6665. transitionClasses.push(cls);
  6666. addClass(el, cls);
  6667. }
  6668. }
  6669. function removeTransitionClass (el, cls) {
  6670. if (el._transitionClasses) {
  6671. remove(el._transitionClasses, cls);
  6672. }
  6673. removeClass(el, cls);
  6674. }
  6675. function whenTransitionEnds (
  6676. el,
  6677. expectedType,
  6678. cb
  6679. ) {
  6680. var ref = getTransitionInfo(el, expectedType);
  6681. var type = ref.type;
  6682. var timeout = ref.timeout;
  6683. var propCount = ref.propCount;
  6684. if (!type) { return cb() }
  6685. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  6686. var ended = 0;
  6687. var end = function () {
  6688. el.removeEventListener(event, onEnd);
  6689. cb();
  6690. };
  6691. var onEnd = function (e) {
  6692. if (e.target === el) {
  6693. if (++ended >= propCount) {
  6694. end();
  6695. }
  6696. }
  6697. };
  6698. setTimeout(function () {
  6699. if (ended < propCount) {
  6700. end();
  6701. }
  6702. }, timeout + 1);
  6703. el.addEventListener(event, onEnd);
  6704. }
  6705. var transformRE = /\b(transform|all)(,|$)/;
  6706. function getTransitionInfo (el, expectedType) {
  6707. var styles = window.getComputedStyle(el);
  6708. // JSDOM may return undefined for transition properties
  6709. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  6710. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  6711. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  6712. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  6713. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  6714. var animationTimeout = getTimeout(animationDelays, animationDurations);
  6715. var type;
  6716. var timeout = 0;
  6717. var propCount = 0;
  6718. /* istanbul ignore if */
  6719. if (expectedType === TRANSITION) {
  6720. if (transitionTimeout > 0) {
  6721. type = TRANSITION;
  6722. timeout = transitionTimeout;
  6723. propCount = transitionDurations.length;
  6724. }
  6725. } else if (expectedType === ANIMATION) {
  6726. if (animationTimeout > 0) {
  6727. type = ANIMATION;
  6728. timeout = animationTimeout;
  6729. propCount = animationDurations.length;
  6730. }
  6731. } else {
  6732. timeout = Math.max(transitionTimeout, animationTimeout);
  6733. type = timeout > 0
  6734. ? transitionTimeout > animationTimeout
  6735. ? TRANSITION
  6736. : ANIMATION
  6737. : null;
  6738. propCount = type
  6739. ? type === TRANSITION
  6740. ? transitionDurations.length
  6741. : animationDurations.length
  6742. : 0;
  6743. }
  6744. var hasTransform =
  6745. type === TRANSITION &&
  6746. transformRE.test(styles[transitionProp + 'Property']);
  6747. return {
  6748. type: type,
  6749. timeout: timeout,
  6750. propCount: propCount,
  6751. hasTransform: hasTransform
  6752. }
  6753. }
  6754. function getTimeout (delays, durations) {
  6755. /* istanbul ignore next */
  6756. while (delays.length < durations.length) {
  6757. delays = delays.concat(delays);
  6758. }
  6759. return Math.max.apply(null, durations.map(function (d, i) {
  6760. return toMs(d) + toMs(delays[i])
  6761. }))
  6762. }
  6763. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  6764. // in a locale-dependent way, using a comma instead of a dot.
  6765. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  6766. // as a floor function) causing unexpected behaviors
  6767. function toMs (s) {
  6768. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  6769. }
  6770. /* */
  6771. function enter (vnode, toggleDisplay) {
  6772. var el = vnode.elm;
  6773. // call leave callback now
  6774. if (isDef(el._leaveCb)) {
  6775. el._leaveCb.cancelled = true;
  6776. el._leaveCb();
  6777. }
  6778. var data = resolveTransition(vnode.data.transition);
  6779. if (isUndef(data)) {
  6780. return
  6781. }
  6782. /* istanbul ignore if */
  6783. if (isDef(el._enterCb) || el.nodeType !== 1) {
  6784. return
  6785. }
  6786. var css = data.css;
  6787. var type = data.type;
  6788. var enterClass = data.enterClass;
  6789. var enterToClass = data.enterToClass;
  6790. var enterActiveClass = data.enterActiveClass;
  6791. var appearClass = data.appearClass;
  6792. var appearToClass = data.appearToClass;
  6793. var appearActiveClass = data.appearActiveClass;
  6794. var beforeEnter = data.beforeEnter;
  6795. var enter = data.enter;
  6796. var afterEnter = data.afterEnter;
  6797. var enterCancelled = data.enterCancelled;
  6798. var beforeAppear = data.beforeAppear;
  6799. var appear = data.appear;
  6800. var afterAppear = data.afterAppear;
  6801. var appearCancelled = data.appearCancelled;
  6802. var duration = data.duration;
  6803. // activeInstance will always be the <transition> component managing this
  6804. // transition. One edge case to check is when the <transition> is placed
  6805. // as the root node of a child component. In that case we need to check
  6806. // <transition>'s parent for appear check.
  6807. var context = activeInstance;
  6808. var transitionNode = activeInstance.$vnode;
  6809. while (transitionNode && transitionNode.parent) {
  6810. context = transitionNode.context;
  6811. transitionNode = transitionNode.parent;
  6812. }
  6813. var isAppear = !context._isMounted || !vnode.isRootInsert;
  6814. if (isAppear && !appear && appear !== '') {
  6815. return
  6816. }
  6817. var startClass = isAppear && appearClass
  6818. ? appearClass
  6819. : enterClass;
  6820. var activeClass = isAppear && appearActiveClass
  6821. ? appearActiveClass
  6822. : enterActiveClass;
  6823. var toClass = isAppear && appearToClass
  6824. ? appearToClass
  6825. : enterToClass;
  6826. var beforeEnterHook = isAppear
  6827. ? (beforeAppear || beforeEnter)
  6828. : beforeEnter;
  6829. var enterHook = isAppear
  6830. ? (typeof appear === 'function' ? appear : enter)
  6831. : enter;
  6832. var afterEnterHook = isAppear
  6833. ? (afterAppear || afterEnter)
  6834. : afterEnter;
  6835. var enterCancelledHook = isAppear
  6836. ? (appearCancelled || enterCancelled)
  6837. : enterCancelled;
  6838. var explicitEnterDuration = toNumber(
  6839. isObject(duration)
  6840. ? duration.enter
  6841. : duration
  6842. );
  6843. if (process.env.NODE_ENV !== 'production' && explicitEnterDuration != null) {
  6844. checkDuration(explicitEnterDuration, 'enter', vnode);
  6845. }
  6846. var expectsCSS = css !== false && !isIE9;
  6847. var userWantsControl = getHookArgumentsLength(enterHook);
  6848. var cb = el._enterCb = once(function () {
  6849. if (expectsCSS) {
  6850. removeTransitionClass(el, toClass);
  6851. removeTransitionClass(el, activeClass);
  6852. }
  6853. if (cb.cancelled) {
  6854. if (expectsCSS) {
  6855. removeTransitionClass(el, startClass);
  6856. }
  6857. enterCancelledHook && enterCancelledHook(el);
  6858. } else {
  6859. afterEnterHook && afterEnterHook(el);
  6860. }
  6861. el._enterCb = null;
  6862. });
  6863. if (!vnode.data.show) {
  6864. // remove pending leave element on enter by injecting an insert hook
  6865. mergeVNodeHook(vnode, 'insert', function () {
  6866. var parent = el.parentNode;
  6867. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  6868. if (pendingNode &&
  6869. pendingNode.tag === vnode.tag &&
  6870. pendingNode.elm._leaveCb
  6871. ) {
  6872. pendingNode.elm._leaveCb();
  6873. }
  6874. enterHook && enterHook(el, cb);
  6875. });
  6876. }
  6877. // start enter transition
  6878. beforeEnterHook && beforeEnterHook(el);
  6879. if (expectsCSS) {
  6880. addTransitionClass(el, startClass);
  6881. addTransitionClass(el, activeClass);
  6882. nextFrame(function () {
  6883. removeTransitionClass(el, startClass);
  6884. if (!cb.cancelled) {
  6885. addTransitionClass(el, toClass);
  6886. if (!userWantsControl) {
  6887. if (isValidDuration(explicitEnterDuration)) {
  6888. setTimeout(cb, explicitEnterDuration);
  6889. } else {
  6890. whenTransitionEnds(el, type, cb);
  6891. }
  6892. }
  6893. }
  6894. });
  6895. }
  6896. if (vnode.data.show) {
  6897. toggleDisplay && toggleDisplay();
  6898. enterHook && enterHook(el, cb);
  6899. }
  6900. if (!expectsCSS && !userWantsControl) {
  6901. cb();
  6902. }
  6903. }
  6904. function leave (vnode, rm) {
  6905. var el = vnode.elm;
  6906. // call enter callback now
  6907. if (isDef(el._enterCb)) {
  6908. el._enterCb.cancelled = true;
  6909. el._enterCb();
  6910. }
  6911. var data = resolveTransition(vnode.data.transition);
  6912. if (isUndef(data) || el.nodeType !== 1) {
  6913. return rm()
  6914. }
  6915. /* istanbul ignore if */
  6916. if (isDef(el._leaveCb)) {
  6917. return
  6918. }
  6919. var css = data.css;
  6920. var type = data.type;
  6921. var leaveClass = data.leaveClass;
  6922. var leaveToClass = data.leaveToClass;
  6923. var leaveActiveClass = data.leaveActiveClass;
  6924. var beforeLeave = data.beforeLeave;
  6925. var leave = data.leave;
  6926. var afterLeave = data.afterLeave;
  6927. var leaveCancelled = data.leaveCancelled;
  6928. var delayLeave = data.delayLeave;
  6929. var duration = data.duration;
  6930. var expectsCSS = css !== false && !isIE9;
  6931. var userWantsControl = getHookArgumentsLength(leave);
  6932. var explicitLeaveDuration = toNumber(
  6933. isObject(duration)
  6934. ? duration.leave
  6935. : duration
  6936. );
  6937. if (process.env.NODE_ENV !== 'production' && isDef(explicitLeaveDuration)) {
  6938. checkDuration(explicitLeaveDuration, 'leave', vnode);
  6939. }
  6940. var cb = el._leaveCb = once(function () {
  6941. if (el.parentNode && el.parentNode._pending) {
  6942. el.parentNode._pending[vnode.key] = null;
  6943. }
  6944. if (expectsCSS) {
  6945. removeTransitionClass(el, leaveToClass);
  6946. removeTransitionClass(el, leaveActiveClass);
  6947. }
  6948. if (cb.cancelled) {
  6949. if (expectsCSS) {
  6950. removeTransitionClass(el, leaveClass);
  6951. }
  6952. leaveCancelled && leaveCancelled(el);
  6953. } else {
  6954. rm();
  6955. afterLeave && afterLeave(el);
  6956. }
  6957. el._leaveCb = null;
  6958. });
  6959. if (delayLeave) {
  6960. delayLeave(performLeave);
  6961. } else {
  6962. performLeave();
  6963. }
  6964. function performLeave () {
  6965. // the delayed leave may have already been cancelled
  6966. if (cb.cancelled) {
  6967. return
  6968. }
  6969. // record leaving element
  6970. if (!vnode.data.show && el.parentNode) {
  6971. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  6972. }
  6973. beforeLeave && beforeLeave(el);
  6974. if (expectsCSS) {
  6975. addTransitionClass(el, leaveClass);
  6976. addTransitionClass(el, leaveActiveClass);
  6977. nextFrame(function () {
  6978. removeTransitionClass(el, leaveClass);
  6979. if (!cb.cancelled) {
  6980. addTransitionClass(el, leaveToClass);
  6981. if (!userWantsControl) {
  6982. if (isValidDuration(explicitLeaveDuration)) {
  6983. setTimeout(cb, explicitLeaveDuration);
  6984. } else {
  6985. whenTransitionEnds(el, type, cb);
  6986. }
  6987. }
  6988. }
  6989. });
  6990. }
  6991. leave && leave(el, cb);
  6992. if (!expectsCSS && !userWantsControl) {
  6993. cb();
  6994. }
  6995. }
  6996. }
  6997. // only used in dev mode
  6998. function checkDuration (val, name, vnode) {
  6999. if (typeof val !== 'number') {
  7000. warn(
  7001. "<transition> explicit " + name + " duration is not a valid number - " +
  7002. "got " + (JSON.stringify(val)) + ".",
  7003. vnode.context
  7004. );
  7005. } else if (isNaN(val)) {
  7006. warn(
  7007. "<transition> explicit " + name + " duration is NaN - " +
  7008. 'the duration expression might be incorrect.',
  7009. vnode.context
  7010. );
  7011. }
  7012. }
  7013. function isValidDuration (val) {
  7014. return typeof val === 'number' && !isNaN(val)
  7015. }
  7016. /**
  7017. * Normalize a transition hook's argument length. The hook may be:
  7018. * - a merged hook (invoker) with the original in .fns
  7019. * - a wrapped component method (check ._length)
  7020. * - a plain function (.length)
  7021. */
  7022. function getHookArgumentsLength (fn) {
  7023. if (isUndef(fn)) {
  7024. return false
  7025. }
  7026. var invokerFns = fn.fns;
  7027. if (isDef(invokerFns)) {
  7028. // invoker
  7029. return getHookArgumentsLength(
  7030. Array.isArray(invokerFns)
  7031. ? invokerFns[0]
  7032. : invokerFns
  7033. )
  7034. } else {
  7035. return (fn._length || fn.length) > 1
  7036. }
  7037. }
  7038. function _enter (_, vnode) {
  7039. if (vnode.data.show !== true) {
  7040. enter(vnode);
  7041. }
  7042. }
  7043. var transition = inBrowser ? {
  7044. create: _enter,
  7045. activate: _enter,
  7046. remove: function remove$$1 (vnode, rm) {
  7047. /* istanbul ignore else */
  7048. if (vnode.data.show !== true) {
  7049. leave(vnode, rm);
  7050. } else {
  7051. rm();
  7052. }
  7053. }
  7054. } : {};
  7055. var platformModules = [
  7056. attrs,
  7057. klass,
  7058. events,
  7059. domProps,
  7060. style,
  7061. transition
  7062. ];
  7063. /* */
  7064. // the directive module should be applied last, after all
  7065. // built-in modules have been applied.
  7066. var modules = platformModules.concat(baseModules);
  7067. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  7068. /**
  7069. * Not type checking this file because flow doesn't like attaching
  7070. * properties to Elements.
  7071. */
  7072. /* istanbul ignore if */
  7073. if (isIE9) {
  7074. // http://www.matts411.com/post/internet-explorer-9-oninput/
  7075. document.addEventListener('selectionchange', function () {
  7076. var el = document.activeElement;
  7077. if (el && el.vmodel) {
  7078. trigger(el, 'input');
  7079. }
  7080. });
  7081. }
  7082. var directive = {
  7083. inserted: function inserted (el, binding, vnode, oldVnode) {
  7084. if (vnode.tag === 'select') {
  7085. // #6903
  7086. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  7087. mergeVNodeHook(vnode, 'postpatch', function () {
  7088. directive.componentUpdated(el, binding, vnode);
  7089. });
  7090. } else {
  7091. setSelected(el, binding, vnode.context);
  7092. }
  7093. el._vOptions = [].map.call(el.options, getValue);
  7094. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  7095. el._vModifiers = binding.modifiers;
  7096. if (!binding.modifiers.lazy) {
  7097. el.addEventListener('compositionstart', onCompositionStart);
  7098. el.addEventListener('compositionend', onCompositionEnd);
  7099. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  7100. // switching focus before confirming composition choice
  7101. // this also fixes the issue where some browsers e.g. iOS Chrome
  7102. // fires "change" instead of "input" on autocomplete.
  7103. el.addEventListener('change', onCompositionEnd);
  7104. /* istanbul ignore if */
  7105. if (isIE9) {
  7106. el.vmodel = true;
  7107. }
  7108. }
  7109. }
  7110. },
  7111. componentUpdated: function componentUpdated (el, binding, vnode) {
  7112. if (vnode.tag === 'select') {
  7113. setSelected(el, binding, vnode.context);
  7114. // in case the options rendered by v-for have changed,
  7115. // it's possible that the value is out-of-sync with the rendered options.
  7116. // detect such cases and filter out values that no longer has a matching
  7117. // option in the DOM.
  7118. var prevOptions = el._vOptions;
  7119. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  7120. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  7121. // trigger change event if
  7122. // no matching option found for at least one value
  7123. var needReset = el.multiple
  7124. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  7125. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  7126. if (needReset) {
  7127. trigger(el, 'change');
  7128. }
  7129. }
  7130. }
  7131. }
  7132. };
  7133. function setSelected (el, binding, vm) {
  7134. actuallySetSelected(el, binding, vm);
  7135. /* istanbul ignore if */
  7136. if (isIE || isEdge) {
  7137. setTimeout(function () {
  7138. actuallySetSelected(el, binding, vm);
  7139. }, 0);
  7140. }
  7141. }
  7142. function actuallySetSelected (el, binding, vm) {
  7143. var value = binding.value;
  7144. var isMultiple = el.multiple;
  7145. if (isMultiple && !Array.isArray(value)) {
  7146. process.env.NODE_ENV !== 'production' && warn(
  7147. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  7148. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  7149. vm
  7150. );
  7151. return
  7152. }
  7153. var selected, option;
  7154. for (var i = 0, l = el.options.length; i < l; i++) {
  7155. option = el.options[i];
  7156. if (isMultiple) {
  7157. selected = looseIndexOf(value, getValue(option)) > -1;
  7158. if (option.selected !== selected) {
  7159. option.selected = selected;
  7160. }
  7161. } else {
  7162. if (looseEqual(getValue(option), value)) {
  7163. if (el.selectedIndex !== i) {
  7164. el.selectedIndex = i;
  7165. }
  7166. return
  7167. }
  7168. }
  7169. }
  7170. if (!isMultiple) {
  7171. el.selectedIndex = -1;
  7172. }
  7173. }
  7174. function hasNoMatchingOption (value, options) {
  7175. return options.every(function (o) { return !looseEqual(o, value); })
  7176. }
  7177. function getValue (option) {
  7178. return '_value' in option
  7179. ? option._value
  7180. : option.value
  7181. }
  7182. function onCompositionStart (e) {
  7183. e.target.composing = true;
  7184. }
  7185. function onCompositionEnd (e) {
  7186. // prevent triggering an input event for no reason
  7187. if (!e.target.composing) { return }
  7188. e.target.composing = false;
  7189. trigger(e.target, 'input');
  7190. }
  7191. function trigger (el, type) {
  7192. var e = document.createEvent('HTMLEvents');
  7193. e.initEvent(type, true, true);
  7194. el.dispatchEvent(e);
  7195. }
  7196. /* */
  7197. // recursively search for possible transition defined inside the component root
  7198. function locateNode (vnode) {
  7199. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  7200. ? locateNode(vnode.componentInstance._vnode)
  7201. : vnode
  7202. }
  7203. var show = {
  7204. bind: function bind (el, ref, vnode) {
  7205. var value = ref.value;
  7206. vnode = locateNode(vnode);
  7207. var transition$$1 = vnode.data && vnode.data.transition;
  7208. var originalDisplay = el.__vOriginalDisplay =
  7209. el.style.display === 'none' ? '' : el.style.display;
  7210. if (value && transition$$1) {
  7211. vnode.data.show = true;
  7212. enter(vnode, function () {
  7213. el.style.display = originalDisplay;
  7214. });
  7215. } else {
  7216. el.style.display = value ? originalDisplay : 'none';
  7217. }
  7218. },
  7219. update: function update (el, ref, vnode) {
  7220. var value = ref.value;
  7221. var oldValue = ref.oldValue;
  7222. /* istanbul ignore if */
  7223. if (!value === !oldValue) { return }
  7224. vnode = locateNode(vnode);
  7225. var transition$$1 = vnode.data && vnode.data.transition;
  7226. if (transition$$1) {
  7227. vnode.data.show = true;
  7228. if (value) {
  7229. enter(vnode, function () {
  7230. el.style.display = el.__vOriginalDisplay;
  7231. });
  7232. } else {
  7233. leave(vnode, function () {
  7234. el.style.display = 'none';
  7235. });
  7236. }
  7237. } else {
  7238. el.style.display = value ? el.__vOriginalDisplay : 'none';
  7239. }
  7240. },
  7241. unbind: function unbind (
  7242. el,
  7243. binding,
  7244. vnode,
  7245. oldVnode,
  7246. isDestroy
  7247. ) {
  7248. if (!isDestroy) {
  7249. el.style.display = el.__vOriginalDisplay;
  7250. }
  7251. }
  7252. };
  7253. var platformDirectives = {
  7254. model: directive,
  7255. show: show
  7256. };
  7257. /* */
  7258. var transitionProps = {
  7259. name: String,
  7260. appear: Boolean,
  7261. css: Boolean,
  7262. mode: String,
  7263. type: String,
  7264. enterClass: String,
  7265. leaveClass: String,
  7266. enterToClass: String,
  7267. leaveToClass: String,
  7268. enterActiveClass: String,
  7269. leaveActiveClass: String,
  7270. appearClass: String,
  7271. appearActiveClass: String,
  7272. appearToClass: String,
  7273. duration: [Number, String, Object]
  7274. };
  7275. // in case the child is also an abstract component, e.g. <keep-alive>
  7276. // we want to recursively retrieve the real component to be rendered
  7277. function getRealChild (vnode) {
  7278. var compOptions = vnode && vnode.componentOptions;
  7279. if (compOptions && compOptions.Ctor.options.abstract) {
  7280. return getRealChild(getFirstComponentChild(compOptions.children))
  7281. } else {
  7282. return vnode
  7283. }
  7284. }
  7285. function extractTransitionData (comp) {
  7286. var data = {};
  7287. var options = comp.$options;
  7288. // props
  7289. for (var key in options.propsData) {
  7290. data[key] = comp[key];
  7291. }
  7292. // events.
  7293. // extract listeners and pass them directly to the transition methods
  7294. var listeners = options._parentListeners;
  7295. for (var key$1 in listeners) {
  7296. data[camelize(key$1)] = listeners[key$1];
  7297. }
  7298. return data
  7299. }
  7300. function placeholder (h, rawChild) {
  7301. if (/\d-keep-alive$/.test(rawChild.tag)) {
  7302. return h('keep-alive', {
  7303. props: rawChild.componentOptions.propsData
  7304. })
  7305. }
  7306. }
  7307. function hasParentTransition (vnode) {
  7308. while ((vnode = vnode.parent)) {
  7309. if (vnode.data.transition) {
  7310. return true
  7311. }
  7312. }
  7313. }
  7314. function isSameChild (child, oldChild) {
  7315. return oldChild.key === child.key && oldChild.tag === child.tag
  7316. }
  7317. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  7318. var isVShowDirective = function (d) { return d.name === 'show'; };
  7319. var Transition = {
  7320. name: 'transition',
  7321. props: transitionProps,
  7322. abstract: true,
  7323. render: function render (h) {
  7324. var this$1 = this;
  7325. var children = this.$slots.default;
  7326. if (!children) {
  7327. return
  7328. }
  7329. // filter out text nodes (possible whitespaces)
  7330. children = children.filter(isNotTextNode);
  7331. /* istanbul ignore if */
  7332. if (!children.length) {
  7333. return
  7334. }
  7335. // warn multiple elements
  7336. if (process.env.NODE_ENV !== 'production' && children.length > 1) {
  7337. warn(
  7338. '<transition> can only be used on a single element. Use ' +
  7339. '<transition-group> for lists.',
  7340. this.$parent
  7341. );
  7342. }
  7343. var mode = this.mode;
  7344. // warn invalid mode
  7345. if (process.env.NODE_ENV !== 'production' &&
  7346. mode && mode !== 'in-out' && mode !== 'out-in'
  7347. ) {
  7348. warn(
  7349. 'invalid <transition> mode: ' + mode,
  7350. this.$parent
  7351. );
  7352. }
  7353. var rawChild = children[0];
  7354. // if this is a component root node and the component's
  7355. // parent container node also has transition, skip.
  7356. if (hasParentTransition(this.$vnode)) {
  7357. return rawChild
  7358. }
  7359. // apply transition data to child
  7360. // use getRealChild() to ignore abstract components e.g. keep-alive
  7361. var child = getRealChild(rawChild);
  7362. /* istanbul ignore if */
  7363. if (!child) {
  7364. return rawChild
  7365. }
  7366. if (this._leaving) {
  7367. return placeholder(h, rawChild)
  7368. }
  7369. // ensure a key that is unique to the vnode type and to this transition
  7370. // component instance. This key will be used to remove pending leaving nodes
  7371. // during entering.
  7372. var id = "__transition-" + (this._uid) + "-";
  7373. child.key = child.key == null
  7374. ? child.isComment
  7375. ? id + 'comment'
  7376. : id + child.tag
  7377. : isPrimitive(child.key)
  7378. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  7379. : child.key;
  7380. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  7381. var oldRawChild = this._vnode;
  7382. var oldChild = getRealChild(oldRawChild);
  7383. // mark v-show
  7384. // so that the transition module can hand over the control to the directive
  7385. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  7386. child.data.show = true;
  7387. }
  7388. if (
  7389. oldChild &&
  7390. oldChild.data &&
  7391. !isSameChild(child, oldChild) &&
  7392. !isAsyncPlaceholder(oldChild) &&
  7393. // #6687 component root is a comment node
  7394. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  7395. ) {
  7396. // replace old child transition data with fresh one
  7397. // important for dynamic transitions!
  7398. var oldData = oldChild.data.transition = extend({}, data);
  7399. // handle transition mode
  7400. if (mode === 'out-in') {
  7401. // return placeholder node and queue update when leave finishes
  7402. this._leaving = true;
  7403. mergeVNodeHook(oldData, 'afterLeave', function () {
  7404. this$1._leaving = false;
  7405. this$1.$forceUpdate();
  7406. });
  7407. return placeholder(h, rawChild)
  7408. } else if (mode === 'in-out') {
  7409. if (isAsyncPlaceholder(child)) {
  7410. return oldRawChild
  7411. }
  7412. var delayedLeave;
  7413. var performLeave = function () { delayedLeave(); };
  7414. mergeVNodeHook(data, 'afterEnter', performLeave);
  7415. mergeVNodeHook(data, 'enterCancelled', performLeave);
  7416. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  7417. }
  7418. }
  7419. return rawChild
  7420. }
  7421. };
  7422. /* */
  7423. var props = extend({
  7424. tag: String,
  7425. moveClass: String
  7426. }, transitionProps);
  7427. delete props.mode;
  7428. var TransitionGroup = {
  7429. props: props,
  7430. beforeMount: function beforeMount () {
  7431. var this$1 = this;
  7432. var update = this._update;
  7433. this._update = function (vnode, hydrating) {
  7434. var restoreActiveInstance = setActiveInstance(this$1);
  7435. // force removing pass
  7436. this$1.__patch__(
  7437. this$1._vnode,
  7438. this$1.kept,
  7439. false, // hydrating
  7440. true // removeOnly (!important, avoids unnecessary moves)
  7441. );
  7442. this$1._vnode = this$1.kept;
  7443. restoreActiveInstance();
  7444. update.call(this$1, vnode, hydrating);
  7445. };
  7446. },
  7447. render: function render (h) {
  7448. var tag = this.tag || this.$vnode.data.tag || 'span';
  7449. var map = Object.create(null);
  7450. var prevChildren = this.prevChildren = this.children;
  7451. var rawChildren = this.$slots.default || [];
  7452. var children = this.children = [];
  7453. var transitionData = extractTransitionData(this);
  7454. for (var i = 0; i < rawChildren.length; i++) {
  7455. var c = rawChildren[i];
  7456. if (c.tag) {
  7457. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  7458. children.push(c);
  7459. map[c.key] = c
  7460. ;(c.data || (c.data = {})).transition = transitionData;
  7461. } else if (process.env.NODE_ENV !== 'production') {
  7462. var opts = c.componentOptions;
  7463. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  7464. warn(("<transition-group> children must be keyed: <" + name + ">"));
  7465. }
  7466. }
  7467. }
  7468. if (prevChildren) {
  7469. var kept = [];
  7470. var removed = [];
  7471. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  7472. var c$1 = prevChildren[i$1];
  7473. c$1.data.transition = transitionData;
  7474. c$1.data.pos = c$1.elm.getBoundingClientRect();
  7475. if (map[c$1.key]) {
  7476. kept.push(c$1);
  7477. } else {
  7478. removed.push(c$1);
  7479. }
  7480. }
  7481. this.kept = h(tag, null, kept);
  7482. this.removed = removed;
  7483. }
  7484. return h(tag, null, children)
  7485. },
  7486. updated: function updated () {
  7487. var children = this.prevChildren;
  7488. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  7489. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  7490. return
  7491. }
  7492. // we divide the work into three loops to avoid mixing DOM reads and writes
  7493. // in each iteration - which helps prevent layout thrashing.
  7494. children.forEach(callPendingCbs);
  7495. children.forEach(recordPosition);
  7496. children.forEach(applyTranslation);
  7497. // force reflow to put everything in position
  7498. // assign to this to avoid being removed in tree-shaking
  7499. // $flow-disable-line
  7500. this._reflow = document.body.offsetHeight;
  7501. children.forEach(function (c) {
  7502. if (c.data.moved) {
  7503. var el = c.elm;
  7504. var s = el.style;
  7505. addTransitionClass(el, moveClass);
  7506. s.transform = s.WebkitTransform = s.transitionDuration = '';
  7507. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  7508. if (e && e.target !== el) {
  7509. return
  7510. }
  7511. if (!e || /transform$/.test(e.propertyName)) {
  7512. el.removeEventListener(transitionEndEvent, cb);
  7513. el._moveCb = null;
  7514. removeTransitionClass(el, moveClass);
  7515. }
  7516. });
  7517. }
  7518. });
  7519. },
  7520. methods: {
  7521. hasMove: function hasMove (el, moveClass) {
  7522. /* istanbul ignore if */
  7523. if (!hasTransition) {
  7524. return false
  7525. }
  7526. /* istanbul ignore if */
  7527. if (this._hasMove) {
  7528. return this._hasMove
  7529. }
  7530. // Detect whether an element with the move class applied has
  7531. // CSS transitions. Since the element may be inside an entering
  7532. // transition at this very moment, we make a clone of it and remove
  7533. // all other transition classes applied to ensure only the move class
  7534. // is applied.
  7535. var clone = el.cloneNode();
  7536. if (el._transitionClasses) {
  7537. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  7538. }
  7539. addClass(clone, moveClass);
  7540. clone.style.display = 'none';
  7541. this.$el.appendChild(clone);
  7542. var info = getTransitionInfo(clone);
  7543. this.$el.removeChild(clone);
  7544. return (this._hasMove = info.hasTransform)
  7545. }
  7546. }
  7547. };
  7548. function callPendingCbs (c) {
  7549. /* istanbul ignore if */
  7550. if (c.elm._moveCb) {
  7551. c.elm._moveCb();
  7552. }
  7553. /* istanbul ignore if */
  7554. if (c.elm._enterCb) {
  7555. c.elm._enterCb();
  7556. }
  7557. }
  7558. function recordPosition (c) {
  7559. c.data.newPos = c.elm.getBoundingClientRect();
  7560. }
  7561. function applyTranslation (c) {
  7562. var oldPos = c.data.pos;
  7563. var newPos = c.data.newPos;
  7564. var dx = oldPos.left - newPos.left;
  7565. var dy = oldPos.top - newPos.top;
  7566. if (dx || dy) {
  7567. c.data.moved = true;
  7568. var s = c.elm.style;
  7569. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  7570. s.transitionDuration = '0s';
  7571. }
  7572. }
  7573. var platformComponents = {
  7574. Transition: Transition,
  7575. TransitionGroup: TransitionGroup
  7576. };
  7577. /* */
  7578. // install platform specific utils
  7579. Vue.config.mustUseProp = mustUseProp;
  7580. Vue.config.isReservedTag = isReservedTag;
  7581. Vue.config.isReservedAttr = isReservedAttr;
  7582. Vue.config.getTagNamespace = getTagNamespace;
  7583. Vue.config.isUnknownElement = isUnknownElement;
  7584. // install platform runtime directives & components
  7585. extend(Vue.options.directives, platformDirectives);
  7586. extend(Vue.options.components, platformComponents);
  7587. // install platform patch function
  7588. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  7589. // public mount method
  7590. Vue.prototype.$mount = function (
  7591. el,
  7592. hydrating
  7593. ) {
  7594. el = el && inBrowser ? query(el) : undefined;
  7595. return mountComponent(this, el, hydrating)
  7596. };
  7597. // devtools global hook
  7598. /* istanbul ignore next */
  7599. if (inBrowser) {
  7600. setTimeout(function () {
  7601. if (config.devtools) {
  7602. if (devtools) {
  7603. devtools.emit('init', Vue);
  7604. } else if (
  7605. process.env.NODE_ENV !== 'production' &&
  7606. process.env.NODE_ENV !== 'test'
  7607. ) {
  7608. console[console.info ? 'info' : 'log'](
  7609. 'Download the Vue Devtools extension for a better development experience:\n' +
  7610. 'https://github.com/vuejs/vue-devtools'
  7611. );
  7612. }
  7613. }
  7614. if (process.env.NODE_ENV !== 'production' &&
  7615. process.env.NODE_ENV !== 'test' &&
  7616. config.productionTip !== false &&
  7617. typeof console !== 'undefined'
  7618. ) {
  7619. console[console.info ? 'info' : 'log'](
  7620. "You are running Vue in development mode.\n" +
  7621. "Make sure to turn on production mode when deploying for production.\n" +
  7622. "See more tips at https://vuejs.org/guide/deployment.html"
  7623. );
  7624. }
  7625. }, 0);
  7626. }
  7627. /* */
  7628. export default Vue;