vue.runtime.common.js 210 KB

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