vue.runtime.esm.js 208 KB

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