vue.runtime.js 188 KB

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