vue.js 271 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517
  1. /*!
  2. * Vue.js v2.5.1
  3. * (c) 2014-2017 Evan You
  4. * Released under the MIT License.
  5. */
  6. (function (global, factory) {
  7. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  8. typeof define === 'function' && define.amd ? define(factory) :
  9. (global.Vue = factory());
  10. }(this, (function () { 'use strict';
  11. /* */
  12. // these helpers produces better vm code in JS engines due to their
  13. // explicitness and function inlining
  14. function isUndef (v) {
  15. return v === undefined || v === null
  16. }
  17. function isDef (v) {
  18. return v !== undefined && v !== null
  19. }
  20. function isTrue (v) {
  21. return v === true
  22. }
  23. function isFalse (v) {
  24. return v === false
  25. }
  26. /**
  27. * Check if value is primitive
  28. */
  29. function isPrimitive (value) {
  30. return (
  31. typeof value === 'string' ||
  32. typeof value === 'number' ||
  33. typeof value === 'boolean'
  34. )
  35. }
  36. /**
  37. * Quick object check - this is primarily used to tell
  38. * Objects from primitive values when we know the value
  39. * is a JSON-compliant type.
  40. */
  41. function isObject (obj) {
  42. return obj !== null && typeof obj === 'object'
  43. }
  44. /**
  45. * Get the raw type string of a value e.g. [object Object]
  46. */
  47. var _toString = Object.prototype.toString;
  48. function toRawType (value) {
  49. return _toString.call(value).slice(8, -1)
  50. }
  51. /**
  52. * Strict object type check. Only returns true
  53. * for plain JavaScript objects.
  54. */
  55. function isPlainObject (obj) {
  56. return _toString.call(obj) === '[object Object]'
  57. }
  58. function isRegExp (v) {
  59. return _toString.call(v) === '[object RegExp]'
  60. }
  61. /**
  62. * Check if val is a valid array index.
  63. */
  64. function isValidArrayIndex (val) {
  65. var n = parseFloat(String(val));
  66. return n >= 0 && Math.floor(n) === n && isFinite(val)
  67. }
  68. /**
  69. * Convert a value to a string that is actually rendered.
  70. */
  71. function toString (val) {
  72. return val == null
  73. ? ''
  74. : typeof val === 'object'
  75. ? JSON.stringify(val, null, 2)
  76. : String(val)
  77. }
  78. /**
  79. * Convert a input value to a number for persistence.
  80. * If the conversion fails, return original string.
  81. */
  82. function toNumber (val) {
  83. var n = parseFloat(val);
  84. return isNaN(n) ? val : n
  85. }
  86. /**
  87. * Make a map and return a function for checking if a key
  88. * is in that map.
  89. */
  90. function makeMap (
  91. str,
  92. expectsLowerCase
  93. ) {
  94. var map = Object.create(null);
  95. var list = str.split(',');
  96. for (var i = 0; i < list.length; i++) {
  97. map[list[i]] = true;
  98. }
  99. return expectsLowerCase
  100. ? function (val) { return map[val.toLowerCase()]; }
  101. : function (val) { return map[val]; }
  102. }
  103. /**
  104. * Check if a tag is a built-in tag.
  105. */
  106. var isBuiltInTag = makeMap('slot,component', true);
  107. /**
  108. * Check if a attribute is a reserved attribute.
  109. */
  110. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  111. /**
  112. * Remove an item from an array
  113. */
  114. function remove (arr, item) {
  115. if (arr.length) {
  116. var index = arr.indexOf(item);
  117. if (index > -1) {
  118. return arr.splice(index, 1)
  119. }
  120. }
  121. }
  122. /**
  123. * Check whether the object has the property.
  124. */
  125. var hasOwnProperty = Object.prototype.hasOwnProperty;
  126. function hasOwn (obj, key) {
  127. return hasOwnProperty.call(obj, key)
  128. }
  129. /**
  130. * Create a cached version of a pure function.
  131. */
  132. function cached (fn) {
  133. var cache = Object.create(null);
  134. return (function cachedFn (str) {
  135. var hit = cache[str];
  136. return hit || (cache[str] = fn(str))
  137. })
  138. }
  139. /**
  140. * Camelize a hyphen-delimited string.
  141. */
  142. var camelizeRE = /-(\w)/g;
  143. var camelize = cached(function (str) {
  144. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  145. });
  146. /**
  147. * Capitalize a string.
  148. */
  149. var capitalize = cached(function (str) {
  150. return str.charAt(0).toUpperCase() + str.slice(1)
  151. });
  152. /**
  153. * Hyphenate a camelCase string.
  154. */
  155. var hyphenateRE = /\B([A-Z])/g;
  156. var hyphenate = cached(function (str) {
  157. return str.replace(hyphenateRE, '-$1').toLowerCase()
  158. });
  159. /**
  160. * Simple bind, faster than native
  161. */
  162. function bind (fn, ctx) {
  163. function boundFn (a) {
  164. var l = arguments.length;
  165. return l
  166. ? l > 1
  167. ? fn.apply(ctx, arguments)
  168. : fn.call(ctx, a)
  169. : fn.call(ctx)
  170. }
  171. // record original fn length
  172. boundFn._length = fn.length;
  173. return boundFn
  174. }
  175. /**
  176. * Convert an Array-like object to a real Array.
  177. */
  178. function toArray (list, start) {
  179. start = start || 0;
  180. var i = list.length - start;
  181. var ret = new Array(i);
  182. while (i--) {
  183. ret[i] = list[i + start];
  184. }
  185. return ret
  186. }
  187. /**
  188. * Mix properties into target object.
  189. */
  190. function extend (to, _from) {
  191. for (var key in _from) {
  192. to[key] = _from[key];
  193. }
  194. return to
  195. }
  196. /**
  197. * Merge an Array of Objects into a single Object.
  198. */
  199. function toObject (arr) {
  200. var res = {};
  201. for (var i = 0; i < arr.length; i++) {
  202. if (arr[i]) {
  203. extend(res, arr[i]);
  204. }
  205. }
  206. return res
  207. }
  208. /**
  209. * Perform no operation.
  210. * Stubbing args to make Flow happy without leaving useless transpiled code
  211. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/)
  212. */
  213. function noop (a, b, c) {}
  214. /**
  215. * Always return false.
  216. */
  217. var no = function (a, b, c) { return false; };
  218. /**
  219. * Return same value
  220. */
  221. var identity = function (_) { return _; };
  222. /**
  223. * Generate a static keys string from compiler modules.
  224. */
  225. function genStaticKeys (modules) {
  226. return modules.reduce(function (keys, m) {
  227. return keys.concat(m.staticKeys || [])
  228. }, []).join(',')
  229. }
  230. /**
  231. * Check if two values are loosely equal - that is,
  232. * if they are plain objects, do they have the same shape?
  233. */
  234. function looseEqual (a, b) {
  235. if (a === b) { return true }
  236. var isObjectA = isObject(a);
  237. var isObjectB = isObject(b);
  238. if (isObjectA && isObjectB) {
  239. try {
  240. var isArrayA = Array.isArray(a);
  241. var isArrayB = Array.isArray(b);
  242. if (isArrayA && isArrayB) {
  243. return a.length === b.length && a.every(function (e, i) {
  244. return looseEqual(e, b[i])
  245. })
  246. } else if (!isArrayA && !isArrayB) {
  247. var keysA = Object.keys(a);
  248. var keysB = Object.keys(b);
  249. return keysA.length === keysB.length && keysA.every(function (key) {
  250. return looseEqual(a[key], b[key])
  251. })
  252. } else {
  253. /* istanbul ignore next */
  254. return false
  255. }
  256. } catch (e) {
  257. /* istanbul ignore next */
  258. return false
  259. }
  260. } else if (!isObjectA && !isObjectB) {
  261. return String(a) === String(b)
  262. } else {
  263. return false
  264. }
  265. }
  266. function looseIndexOf (arr, val) {
  267. for (var i = 0; i < arr.length; i++) {
  268. if (looseEqual(arr[i], val)) { return i }
  269. }
  270. return -1
  271. }
  272. /**
  273. * Ensure a function is called only once.
  274. */
  275. function once (fn) {
  276. var called = false;
  277. return function () {
  278. if (!called) {
  279. called = true;
  280. fn.apply(this, arguments);
  281. }
  282. }
  283. }
  284. var SSR_ATTR = 'data-server-rendered';
  285. var ASSET_TYPES = [
  286. 'component',
  287. 'directive',
  288. 'filter'
  289. ];
  290. var LIFECYCLE_HOOKS = [
  291. 'beforeCreate',
  292. 'created',
  293. 'beforeMount',
  294. 'mounted',
  295. 'beforeUpdate',
  296. 'updated',
  297. 'beforeDestroy',
  298. 'destroyed',
  299. 'activated',
  300. 'deactivated',
  301. 'errorCaptured'
  302. ];
  303. /* */
  304. var config = ({
  305. /**
  306. * Option merge strategies (used in core/util/options)
  307. */
  308. optionMergeStrategies: Object.create(null),
  309. /**
  310. * Whether to suppress warnings.
  311. */
  312. silent: false,
  313. /**
  314. * Show production mode tip message on boot?
  315. */
  316. productionTip: "development" !== 'production',
  317. /**
  318. * Whether to enable devtools
  319. */
  320. devtools: "development" !== 'production',
  321. /**
  322. * Whether to record perf
  323. */
  324. performance: false,
  325. /**
  326. * Error handler for watcher errors
  327. */
  328. errorHandler: null,
  329. /**
  330. * Warn handler for watcher warns
  331. */
  332. warnHandler: null,
  333. /**
  334. * Ignore certain custom elements
  335. */
  336. ignoredElements: [],
  337. /**
  338. * Custom user key aliases for v-on
  339. */
  340. keyCodes: Object.create(null),
  341. /**
  342. * Check if a tag is reserved so that it cannot be registered as a
  343. * component. This is platform-dependent and may be overwritten.
  344. */
  345. isReservedTag: no,
  346. /**
  347. * Check if an attribute is reserved so that it cannot be used as a component
  348. * prop. This is platform-dependent and may be overwritten.
  349. */
  350. isReservedAttr: no,
  351. /**
  352. * Check if a tag is an unknown element.
  353. * Platform-dependent.
  354. */
  355. isUnknownElement: no,
  356. /**
  357. * Get the namespace of an element
  358. */
  359. getTagNamespace: noop,
  360. /**
  361. * Parse the real tag name for the specific platform.
  362. */
  363. parsePlatformTagName: identity,
  364. /**
  365. * Check if an attribute must be bound using property, e.g. value
  366. * Platform-dependent.
  367. */
  368. mustUseProp: no,
  369. /**
  370. * Exposed for legacy reasons
  371. */
  372. _lifecycleHooks: LIFECYCLE_HOOKS
  373. });
  374. /* */
  375. var emptyObject = Object.freeze({});
  376. /**
  377. * Check if a string starts with $ or _
  378. */
  379. function isReserved (str) {
  380. var c = (str + '').charCodeAt(0);
  381. return c === 0x24 || c === 0x5F
  382. }
  383. /**
  384. * Define a property.
  385. */
  386. function def (obj, key, val, enumerable) {
  387. Object.defineProperty(obj, key, {
  388. value: val,
  389. enumerable: !!enumerable,
  390. writable: true,
  391. configurable: true
  392. });
  393. }
  394. /**
  395. * Parse simple path.
  396. */
  397. var bailRE = /[^\w.$]/;
  398. function parsePath (path) {
  399. if (bailRE.test(path)) {
  400. return
  401. }
  402. var segments = path.split('.');
  403. return function (obj) {
  404. for (var i = 0; i < segments.length; i++) {
  405. if (!obj) { return }
  406. obj = obj[segments[i]];
  407. }
  408. return obj
  409. }
  410. }
  411. /* */
  412. var warn = noop;
  413. var tip = noop;
  414. var generateComponentTrace = (noop); // work around flow check
  415. var formatComponentName = (noop);
  416. {
  417. var hasConsole = typeof console !== 'undefined';
  418. var classifyRE = /(?:^|[-_])(\w)/g;
  419. var classify = function (str) { return str
  420. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  421. .replace(/[-_]/g, ''); };
  422. warn = function (msg, vm) {
  423. var trace = vm ? generateComponentTrace(vm) : '';
  424. if (config.warnHandler) {
  425. config.warnHandler.call(null, msg, vm, trace);
  426. } else if (hasConsole && (!config.silent)) {
  427. console.error(("[Vue warn]: " + msg + trace));
  428. }
  429. };
  430. tip = function (msg, vm) {
  431. if (hasConsole && (!config.silent)) {
  432. console.warn("[Vue tip]: " + msg + (
  433. vm ? generateComponentTrace(vm) : ''
  434. ));
  435. }
  436. };
  437. formatComponentName = function (vm, includeFile) {
  438. if (vm.$root === vm) {
  439. return '<Root>'
  440. }
  441. var options = typeof vm === 'function' && vm.cid != null
  442. ? vm.options
  443. : vm._isVue
  444. ? vm.$options || vm.constructor.options
  445. : vm || {};
  446. var name = options.name || options._componentTag;
  447. var file = options.__file;
  448. if (!name && file) {
  449. var match = file.match(/([^/\\]+)\.vue$/);
  450. name = match && match[1];
  451. }
  452. return (
  453. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  454. (file && includeFile !== false ? (" at " + file) : '')
  455. )
  456. };
  457. var repeat = function (str, n) {
  458. var res = '';
  459. while (n) {
  460. if (n % 2 === 1) { res += str; }
  461. if (n > 1) { str += str; }
  462. n >>= 1;
  463. }
  464. return res
  465. };
  466. generateComponentTrace = function (vm) {
  467. if (vm._isVue && vm.$parent) {
  468. var tree = [];
  469. var currentRecursiveSequence = 0;
  470. while (vm) {
  471. if (tree.length > 0) {
  472. var last = tree[tree.length - 1];
  473. if (last.constructor === vm.constructor) {
  474. currentRecursiveSequence++;
  475. vm = vm.$parent;
  476. continue
  477. } else if (currentRecursiveSequence > 0) {
  478. tree[tree.length - 1] = [last, currentRecursiveSequence];
  479. currentRecursiveSequence = 0;
  480. }
  481. }
  482. tree.push(vm);
  483. vm = vm.$parent;
  484. }
  485. return '\n\nfound in\n\n' + tree
  486. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  487. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  488. : formatComponentName(vm))); })
  489. .join('\n')
  490. } else {
  491. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  492. }
  493. };
  494. }
  495. /* */
  496. function handleError (err, vm, info) {
  497. if (vm) {
  498. var cur = vm;
  499. while ((cur = cur.$parent)) {
  500. var hooks = cur.$options.errorCaptured;
  501. if (hooks) {
  502. for (var i = 0; i < hooks.length; i++) {
  503. try {
  504. var capture = hooks[i].call(cur, err, vm, info) === false;
  505. if (capture) { return }
  506. } catch (e) {
  507. globalHandleError(e, cur, 'errorCaptured hook');
  508. }
  509. }
  510. }
  511. }
  512. }
  513. globalHandleError(err, vm, info);
  514. }
  515. function globalHandleError (err, vm, info) {
  516. if (config.errorHandler) {
  517. try {
  518. return config.errorHandler.call(null, err, vm, info)
  519. } catch (e) {
  520. logError(e, null, 'config.errorHandler');
  521. }
  522. }
  523. logError(err, vm, info);
  524. }
  525. function logError (err, vm, info) {
  526. {
  527. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  528. }
  529. /* istanbul ignore else */
  530. if (inBrowser && typeof console !== 'undefined') {
  531. console.error(err);
  532. } else {
  533. throw err
  534. }
  535. }
  536. /* */
  537. /* globals MessageChannel */
  538. // can we use __proto__?
  539. var hasProto = '__proto__' in {};
  540. // Browser environment sniffing
  541. var inBrowser = typeof window !== 'undefined';
  542. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  543. var isIE = UA && /msie|trident/.test(UA);
  544. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  545. var isEdge = UA && UA.indexOf('edge/') > 0;
  546. var isAndroid = UA && UA.indexOf('android') > 0;
  547. var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
  548. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  549. // Firefox has a "watch" function on Object.prototype...
  550. var nativeWatch = ({}).watch;
  551. var supportsPassive = false;
  552. if (inBrowser) {
  553. try {
  554. var opts = {};
  555. Object.defineProperty(opts, 'passive', ({
  556. get: function get () {
  557. /* istanbul ignore next */
  558. supportsPassive = true;
  559. }
  560. })); // https://github.com/facebook/flow/issues/285
  561. window.addEventListener('test-passive', null, opts);
  562. } catch (e) {}
  563. }
  564. // this needs to be lazy-evaled because vue may be required before
  565. // vue-server-renderer can set VUE_ENV
  566. var _isServer;
  567. var isServerRendering = function () {
  568. if (_isServer === undefined) {
  569. /* istanbul ignore if */
  570. if (!inBrowser && typeof global !== 'undefined') {
  571. // detect presence of vue-server-renderer and avoid
  572. // Webpack shimming the process
  573. _isServer = global['process'].env.VUE_ENV === 'server';
  574. } else {
  575. _isServer = false;
  576. }
  577. }
  578. return _isServer
  579. };
  580. // detect devtools
  581. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  582. /* istanbul ignore next */
  583. function isNative (Ctor) {
  584. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  585. }
  586. var hasSymbol =
  587. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  588. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  589. /**
  590. * Defer a task to execute it asynchronously.
  591. */
  592. var nextTick = (function () {
  593. var callbacks = [];
  594. var pending = false;
  595. var timerFunc;
  596. function nextTickHandler () {
  597. pending = false;
  598. var copies = callbacks.slice(0);
  599. callbacks.length = 0;
  600. for (var i = 0; i < copies.length; i++) {
  601. copies[i]();
  602. }
  603. }
  604. // An asynchronous deferring mechanism.
  605. // In pre 2.4, we used to use microtasks (Promise/MutationObserver)
  606. // but microtasks actually has too high a priority and fires in between
  607. // supposedly sequential events (e.g. #4521, #6690) or even between
  608. // bubbling of the same event (#6566). Technically setImmediate should be
  609. // the ideal choice, but it's not available everywhere; and the only polyfill
  610. // that consistently queues the callback after all DOM events triggered in the
  611. // same loop is by using MessageChannel.
  612. /* istanbul ignore if */
  613. if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  614. timerFunc = function () {
  615. setImmediate(nextTickHandler);
  616. };
  617. } else if (typeof MessageChannel !== 'undefined' && (
  618. isNative(MessageChannel) ||
  619. // PhantomJS
  620. MessageChannel.toString() === '[object MessageChannelConstructor]'
  621. )) {
  622. var channel = new MessageChannel();
  623. var port = channel.port2;
  624. channel.port1.onmessage = nextTickHandler;
  625. timerFunc = function () {
  626. port.postMessage(1);
  627. };
  628. } else
  629. /* istanbul ignore next */
  630. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  631. // use microtask in non-DOM environments, e.g. Weex
  632. var p = Promise.resolve();
  633. timerFunc = function () {
  634. p.then(nextTickHandler);
  635. };
  636. } else {
  637. // fallback to setTimeout
  638. timerFunc = function () {
  639. setTimeout(nextTickHandler, 0);
  640. };
  641. }
  642. return function queueNextTick (cb, ctx) {
  643. var _resolve;
  644. callbacks.push(function () {
  645. if (cb) {
  646. try {
  647. cb.call(ctx);
  648. } catch (e) {
  649. handleError(e, ctx, 'nextTick');
  650. }
  651. } else if (_resolve) {
  652. _resolve(ctx);
  653. }
  654. });
  655. if (!pending) {
  656. pending = true;
  657. timerFunc();
  658. }
  659. // $flow-disable-line
  660. if (!cb && typeof Promise !== 'undefined') {
  661. return new Promise(function (resolve, reject) {
  662. _resolve = resolve;
  663. })
  664. }
  665. }
  666. })();
  667. var _Set;
  668. /* istanbul ignore if */ // $flow-disable-line
  669. if (typeof Set !== 'undefined' && isNative(Set)) {
  670. // use native Set when available.
  671. _Set = Set;
  672. } else {
  673. // a non-standard Set polyfill that only works with primitive keys.
  674. _Set = (function () {
  675. function Set () {
  676. this.set = Object.create(null);
  677. }
  678. Set.prototype.has = function has (key) {
  679. return this.set[key] === true
  680. };
  681. Set.prototype.add = function add (key) {
  682. this.set[key] = true;
  683. };
  684. Set.prototype.clear = function clear () {
  685. this.set = Object.create(null);
  686. };
  687. return Set;
  688. }());
  689. }
  690. /* */
  691. var uid = 0;
  692. /**
  693. * A dep is an observable that can have multiple
  694. * directives subscribing to it.
  695. */
  696. var Dep = function Dep () {
  697. this.id = uid++;
  698. this.subs = [];
  699. };
  700. Dep.prototype.addSub = function addSub (sub) {
  701. this.subs.push(sub);
  702. };
  703. Dep.prototype.removeSub = function removeSub (sub) {
  704. remove(this.subs, sub);
  705. };
  706. Dep.prototype.depend = function depend () {
  707. if (Dep.target) {
  708. Dep.target.addDep(this);
  709. }
  710. };
  711. Dep.prototype.notify = function notify () {
  712. // stabilize the subscriber list first
  713. var subs = this.subs.slice();
  714. for (var i = 0, l = subs.length; i < l; i++) {
  715. subs[i].update();
  716. }
  717. };
  718. // the current target watcher being evaluated.
  719. // this is globally unique because there could be only one
  720. // watcher being evaluated at any time.
  721. Dep.target = null;
  722. var targetStack = [];
  723. function pushTarget (_target) {
  724. if (Dep.target) { targetStack.push(Dep.target); }
  725. Dep.target = _target;
  726. }
  727. function popTarget () {
  728. Dep.target = targetStack.pop();
  729. }
  730. /* */
  731. var VNode = function VNode (
  732. tag,
  733. data,
  734. children,
  735. text,
  736. elm,
  737. context,
  738. componentOptions,
  739. asyncFactory
  740. ) {
  741. this.tag = tag;
  742. this.data = data;
  743. this.children = children;
  744. this.text = text;
  745. this.elm = elm;
  746. this.ns = undefined;
  747. this.context = context;
  748. this.functionalContext = undefined;
  749. this.functionalOptions = undefined;
  750. this.functionalScopeId = undefined;
  751. this.key = data && data.key;
  752. this.componentOptions = componentOptions;
  753. this.componentInstance = undefined;
  754. this.parent = undefined;
  755. this.raw = false;
  756. this.isStatic = false;
  757. this.isRootInsert = true;
  758. this.isComment = false;
  759. this.isCloned = false;
  760. this.isOnce = false;
  761. this.asyncFactory = asyncFactory;
  762. this.asyncMeta = undefined;
  763. this.isAsyncPlaceholder = false;
  764. };
  765. var prototypeAccessors = { child: { configurable: true } };
  766. // DEPRECATED: alias for componentInstance for backwards compat.
  767. /* istanbul ignore next */
  768. prototypeAccessors.child.get = function () {
  769. return this.componentInstance
  770. };
  771. Object.defineProperties( VNode.prototype, prototypeAccessors );
  772. var createEmptyVNode = function (text) {
  773. if ( text === void 0 ) text = '';
  774. var node = new VNode();
  775. node.text = text;
  776. node.isComment = true;
  777. return node
  778. };
  779. function createTextVNode (val) {
  780. return new VNode(undefined, undefined, undefined, String(val))
  781. }
  782. // optimized shallow clone
  783. // used for static nodes and slot nodes because they may be reused across
  784. // multiple renders, cloning them avoids errors when DOM manipulations rely
  785. // on their elm reference.
  786. function cloneVNode (vnode, deep) {
  787. var cloned = new VNode(
  788. vnode.tag,
  789. vnode.data,
  790. vnode.children,
  791. vnode.text,
  792. vnode.elm,
  793. vnode.context,
  794. vnode.componentOptions,
  795. vnode.asyncFactory
  796. );
  797. cloned.ns = vnode.ns;
  798. cloned.isStatic = vnode.isStatic;
  799. cloned.key = vnode.key;
  800. cloned.isComment = vnode.isComment;
  801. cloned.isCloned = true;
  802. if (deep && vnode.children) {
  803. cloned.children = cloneVNodes(vnode.children);
  804. }
  805. return cloned
  806. }
  807. function cloneVNodes (vnodes, deep) {
  808. var len = vnodes.length;
  809. var res = new Array(len);
  810. for (var i = 0; i < len; i++) {
  811. res[i] = cloneVNode(vnodes[i], deep);
  812. }
  813. return res
  814. }
  815. /*
  816. * not type checking this file because flow doesn't play well with
  817. * dynamically accessing methods on Array prototype
  818. */
  819. var arrayProto = Array.prototype;
  820. var arrayMethods = Object.create(arrayProto);[
  821. 'push',
  822. 'pop',
  823. 'shift',
  824. 'unshift',
  825. 'splice',
  826. 'sort',
  827. 'reverse'
  828. ]
  829. .forEach(function (method) {
  830. // cache original method
  831. var original = arrayProto[method];
  832. def(arrayMethods, method, function mutator () {
  833. var args = [], len = arguments.length;
  834. while ( len-- ) args[ len ] = arguments[ len ];
  835. var result = original.apply(this, args);
  836. var ob = this.__ob__;
  837. var inserted;
  838. switch (method) {
  839. case 'push':
  840. case 'unshift':
  841. inserted = args;
  842. break
  843. case 'splice':
  844. inserted = args.slice(2);
  845. break
  846. }
  847. if (inserted) { ob.observeArray(inserted); }
  848. // notify change
  849. ob.dep.notify();
  850. return result
  851. });
  852. });
  853. /* */
  854. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  855. /**
  856. * By default, when a reactive property is set, the new value is
  857. * also converted to become reactive. However when passing down props,
  858. * we don't want to force conversion because the value may be a nested value
  859. * under a frozen data structure. Converting it would defeat the optimization.
  860. */
  861. var observerState = {
  862. shouldConvert: true
  863. };
  864. /**
  865. * Observer class that are attached to each observed
  866. * object. Once attached, the observer converts target
  867. * object's property keys into getter/setters that
  868. * collect dependencies and dispatches updates.
  869. */
  870. var Observer = function Observer (value) {
  871. this.value = value;
  872. this.dep = new Dep();
  873. this.vmCount = 0;
  874. def(value, '__ob__', this);
  875. if (Array.isArray(value)) {
  876. var augment = hasProto
  877. ? protoAugment
  878. : copyAugment;
  879. augment(value, arrayMethods, arrayKeys);
  880. this.observeArray(value);
  881. } else {
  882. this.walk(value);
  883. }
  884. };
  885. /**
  886. * Walk through each property and convert them into
  887. * getter/setters. This method should only be called when
  888. * value type is Object.
  889. */
  890. Observer.prototype.walk = function walk (obj) {
  891. var keys = Object.keys(obj);
  892. for (var i = 0; i < keys.length; i++) {
  893. defineReactive(obj, keys[i], obj[keys[i]]);
  894. }
  895. };
  896. /**
  897. * Observe a list of Array items.
  898. */
  899. Observer.prototype.observeArray = function observeArray (items) {
  900. for (var i = 0, l = items.length; i < l; i++) {
  901. observe(items[i]);
  902. }
  903. };
  904. // helpers
  905. /**
  906. * Augment an target Object or Array by intercepting
  907. * the prototype chain using __proto__
  908. */
  909. function protoAugment (target, src, keys) {
  910. /* eslint-disable no-proto */
  911. target.__proto__ = src;
  912. /* eslint-enable no-proto */
  913. }
  914. /**
  915. * Augment an target Object or Array by defining
  916. * hidden properties.
  917. */
  918. /* istanbul ignore next */
  919. function copyAugment (target, src, keys) {
  920. for (var i = 0, l = keys.length; i < l; i++) {
  921. var key = keys[i];
  922. def(target, key, src[key]);
  923. }
  924. }
  925. /**
  926. * Attempt to create an observer instance for a value,
  927. * returns the new observer if successfully observed,
  928. * or the existing observer if the value already has one.
  929. */
  930. function observe (value, asRootData) {
  931. if (!isObject(value) || value instanceof VNode) {
  932. return
  933. }
  934. var ob;
  935. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  936. ob = value.__ob__;
  937. } else if (
  938. observerState.shouldConvert &&
  939. !isServerRendering() &&
  940. (Array.isArray(value) || isPlainObject(value)) &&
  941. Object.isExtensible(value) &&
  942. !value._isVue
  943. ) {
  944. ob = new Observer(value);
  945. }
  946. if (asRootData && ob) {
  947. ob.vmCount++;
  948. }
  949. return ob
  950. }
  951. /**
  952. * Define a reactive property on an Object.
  953. */
  954. function defineReactive (
  955. obj,
  956. key,
  957. val,
  958. customSetter,
  959. shallow
  960. ) {
  961. var dep = new Dep();
  962. var property = Object.getOwnPropertyDescriptor(obj, key);
  963. if (property && property.configurable === false) {
  964. return
  965. }
  966. // cater for pre-defined getter/setters
  967. var getter = property && property.get;
  968. var setter = property && property.set;
  969. var childOb = !shallow && observe(val);
  970. Object.defineProperty(obj, key, {
  971. enumerable: true,
  972. configurable: true,
  973. get: function reactiveGetter () {
  974. var value = getter ? getter.call(obj) : val;
  975. if (Dep.target) {
  976. dep.depend();
  977. if (childOb) {
  978. childOb.dep.depend();
  979. if (Array.isArray(value)) {
  980. dependArray(value);
  981. }
  982. }
  983. }
  984. return value
  985. },
  986. set: function reactiveSetter (newVal) {
  987. var value = getter ? getter.call(obj) : val;
  988. /* eslint-disable no-self-compare */
  989. if (newVal === value || (newVal !== newVal && value !== value)) {
  990. return
  991. }
  992. /* eslint-enable no-self-compare */
  993. if ("development" !== 'production' && customSetter) {
  994. customSetter();
  995. }
  996. if (setter) {
  997. setter.call(obj, newVal);
  998. } else {
  999. val = newVal;
  1000. }
  1001. childOb = !shallow && observe(newVal);
  1002. dep.notify();
  1003. }
  1004. });
  1005. }
  1006. /**
  1007. * Set a property on an object. Adds the new property and
  1008. * triggers change notification if the property doesn't
  1009. * already exist.
  1010. */
  1011. function set (target, key, val) {
  1012. if (Array.isArray(target) && isValidArrayIndex(key)) {
  1013. target.length = Math.max(target.length, key);
  1014. target.splice(key, 1, val);
  1015. return val
  1016. }
  1017. if (hasOwn(target, key)) {
  1018. target[key] = val;
  1019. return val
  1020. }
  1021. var ob = (target).__ob__;
  1022. if (target._isVue || (ob && ob.vmCount)) {
  1023. "development" !== 'production' && warn(
  1024. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  1025. 'at runtime - declare it upfront in the data option.'
  1026. );
  1027. return val
  1028. }
  1029. if (!ob) {
  1030. target[key] = val;
  1031. return val
  1032. }
  1033. defineReactive(ob.value, key, val);
  1034. ob.dep.notify();
  1035. return val
  1036. }
  1037. /**
  1038. * Delete a property and trigger change if necessary.
  1039. */
  1040. function del (target, key) {
  1041. if (Array.isArray(target) && isValidArrayIndex(key)) {
  1042. target.splice(key, 1);
  1043. return
  1044. }
  1045. var ob = (target).__ob__;
  1046. if (target._isVue || (ob && ob.vmCount)) {
  1047. "development" !== 'production' && warn(
  1048. 'Avoid deleting properties on a Vue instance or its root $data ' +
  1049. '- just set it to null.'
  1050. );
  1051. return
  1052. }
  1053. if (!hasOwn(target, key)) {
  1054. return
  1055. }
  1056. delete target[key];
  1057. if (!ob) {
  1058. return
  1059. }
  1060. ob.dep.notify();
  1061. }
  1062. /**
  1063. * Collect dependencies on array elements when the array is touched, since
  1064. * we cannot intercept array element access like property getters.
  1065. */
  1066. function dependArray (value) {
  1067. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  1068. e = value[i];
  1069. e && e.__ob__ && e.__ob__.dep.depend();
  1070. if (Array.isArray(e)) {
  1071. dependArray(e);
  1072. }
  1073. }
  1074. }
  1075. /* */
  1076. /**
  1077. * Option overwriting strategies are functions that handle
  1078. * how to merge a parent option value and a child option
  1079. * value into the final value.
  1080. */
  1081. var strats = config.optionMergeStrategies;
  1082. /**
  1083. * Options with restrictions
  1084. */
  1085. {
  1086. strats.el = strats.propsData = function (parent, child, vm, key) {
  1087. if (!vm) {
  1088. warn(
  1089. "option \"" + key + "\" can only be used during instance " +
  1090. 'creation with the `new` keyword.'
  1091. );
  1092. }
  1093. return defaultStrat(parent, child)
  1094. };
  1095. }
  1096. /**
  1097. * Helper that recursively merges two data objects together.
  1098. */
  1099. function mergeData (to, from) {
  1100. if (!from) { return to }
  1101. var key, toVal, fromVal;
  1102. var keys = Object.keys(from);
  1103. for (var i = 0; i < keys.length; i++) {
  1104. key = keys[i];
  1105. toVal = to[key];
  1106. fromVal = from[key];
  1107. if (!hasOwn(to, key)) {
  1108. set(to, key, fromVal);
  1109. } else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
  1110. mergeData(toVal, fromVal);
  1111. }
  1112. }
  1113. return to
  1114. }
  1115. /**
  1116. * Data
  1117. */
  1118. function mergeDataOrFn (
  1119. parentVal,
  1120. childVal,
  1121. vm
  1122. ) {
  1123. if (!vm) {
  1124. // in a Vue.extend merge, both should be functions
  1125. if (!childVal) {
  1126. return parentVal
  1127. }
  1128. if (!parentVal) {
  1129. return childVal
  1130. }
  1131. // when parentVal & childVal are both present,
  1132. // we need to return a function that returns the
  1133. // merged result of both functions... no need to
  1134. // check if parentVal is a function here because
  1135. // it has to be a function to pass previous merges.
  1136. return function mergedDataFn () {
  1137. return mergeData(
  1138. typeof childVal === 'function' ? childVal.call(this) : childVal,
  1139. typeof parentVal === 'function' ? parentVal.call(this) : parentVal
  1140. )
  1141. }
  1142. } else if (parentVal || childVal) {
  1143. return function mergedInstanceDataFn () {
  1144. // instance merge
  1145. var instanceData = typeof childVal === 'function'
  1146. ? childVal.call(vm)
  1147. : childVal;
  1148. var defaultData = typeof parentVal === 'function'
  1149. ? parentVal.call(vm)
  1150. : parentVal;
  1151. if (instanceData) {
  1152. return mergeData(instanceData, defaultData)
  1153. } else {
  1154. return defaultData
  1155. }
  1156. }
  1157. }
  1158. }
  1159. strats.data = function (
  1160. parentVal,
  1161. childVal,
  1162. vm
  1163. ) {
  1164. if (!vm) {
  1165. if (childVal && typeof childVal !== 'function') {
  1166. "development" !== 'production' && warn(
  1167. 'The "data" option should be a function ' +
  1168. 'that returns a per-instance value in component ' +
  1169. 'definitions.',
  1170. vm
  1171. );
  1172. return parentVal
  1173. }
  1174. return mergeDataOrFn.call(this, parentVal, childVal)
  1175. }
  1176. return mergeDataOrFn(parentVal, childVal, vm)
  1177. };
  1178. /**
  1179. * Hooks and props are merged as arrays.
  1180. */
  1181. function mergeHook (
  1182. parentVal,
  1183. childVal
  1184. ) {
  1185. return childVal
  1186. ? parentVal
  1187. ? parentVal.concat(childVal)
  1188. : Array.isArray(childVal)
  1189. ? childVal
  1190. : [childVal]
  1191. : parentVal
  1192. }
  1193. LIFECYCLE_HOOKS.forEach(function (hook) {
  1194. strats[hook] = mergeHook;
  1195. });
  1196. /**
  1197. * Assets
  1198. *
  1199. * When a vm is present (instance creation), we need to do
  1200. * a three-way merge between constructor options, instance
  1201. * options and parent options.
  1202. */
  1203. function mergeAssets (
  1204. parentVal,
  1205. childVal,
  1206. vm,
  1207. key
  1208. ) {
  1209. var res = Object.create(parentVal || null);
  1210. if (childVal) {
  1211. "development" !== 'production' && assertObjectType(key, childVal, vm);
  1212. return extend(res, childVal)
  1213. } else {
  1214. return res
  1215. }
  1216. }
  1217. ASSET_TYPES.forEach(function (type) {
  1218. strats[type + 's'] = mergeAssets;
  1219. });
  1220. /**
  1221. * Watchers.
  1222. *
  1223. * Watchers hashes should not overwrite one
  1224. * another, so we merge them as arrays.
  1225. */
  1226. strats.watch = function (
  1227. parentVal,
  1228. childVal,
  1229. vm,
  1230. key
  1231. ) {
  1232. // work around Firefox's Object.prototype.watch...
  1233. if (parentVal === nativeWatch) { parentVal = undefined; }
  1234. if (childVal === nativeWatch) { childVal = undefined; }
  1235. /* istanbul ignore if */
  1236. if (!childVal) { return Object.create(parentVal || null) }
  1237. {
  1238. assertObjectType(key, childVal, vm);
  1239. }
  1240. if (!parentVal) { return childVal }
  1241. var ret = {};
  1242. extend(ret, parentVal);
  1243. for (var key$1 in childVal) {
  1244. var parent = ret[key$1];
  1245. var child = childVal[key$1];
  1246. if (parent && !Array.isArray(parent)) {
  1247. parent = [parent];
  1248. }
  1249. ret[key$1] = parent
  1250. ? parent.concat(child)
  1251. : Array.isArray(child) ? child : [child];
  1252. }
  1253. return ret
  1254. };
  1255. /**
  1256. * Other object hashes.
  1257. */
  1258. strats.props =
  1259. strats.methods =
  1260. strats.inject =
  1261. strats.computed = function (
  1262. parentVal,
  1263. childVal,
  1264. vm,
  1265. key
  1266. ) {
  1267. if (childVal && "development" !== 'production') {
  1268. assertObjectType(key, childVal, vm);
  1269. }
  1270. if (!parentVal) { return childVal }
  1271. var ret = Object.create(null);
  1272. extend(ret, parentVal);
  1273. if (childVal) { extend(ret, childVal); }
  1274. return ret
  1275. };
  1276. strats.provide = mergeDataOrFn;
  1277. /**
  1278. * Default strategy.
  1279. */
  1280. var defaultStrat = function (parentVal, childVal) {
  1281. return childVal === undefined
  1282. ? parentVal
  1283. : childVal
  1284. };
  1285. /**
  1286. * Validate component names
  1287. */
  1288. function checkComponents (options) {
  1289. for (var key in options.components) {
  1290. var lower = key.toLowerCase();
  1291. if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
  1292. warn(
  1293. 'Do not use built-in or reserved HTML elements as component ' +
  1294. 'id: ' + key
  1295. );
  1296. }
  1297. }
  1298. }
  1299. /**
  1300. * Ensure all props option syntax are normalized into the
  1301. * Object-based format.
  1302. */
  1303. function normalizeProps (options, vm) {
  1304. var props = options.props;
  1305. if (!props) { return }
  1306. var res = {};
  1307. var i, val, name;
  1308. if (Array.isArray(props)) {
  1309. i = props.length;
  1310. while (i--) {
  1311. val = props[i];
  1312. if (typeof val === 'string') {
  1313. name = camelize(val);
  1314. res[name] = { type: null };
  1315. } else {
  1316. warn('props must be strings when using array syntax.');
  1317. }
  1318. }
  1319. } else if (isPlainObject(props)) {
  1320. for (var key in props) {
  1321. val = props[key];
  1322. name = camelize(key);
  1323. res[name] = isPlainObject(val)
  1324. ? val
  1325. : { type: val };
  1326. }
  1327. } else {
  1328. warn(
  1329. "Invalid value for option \"props\": expected an Array or an Object, " +
  1330. "but got " + (toRawType(props)) + ".",
  1331. vm
  1332. );
  1333. }
  1334. options.props = res;
  1335. }
  1336. /**
  1337. * Normalize all injections into Object-based format
  1338. */
  1339. function normalizeInject (options, vm) {
  1340. var inject = options.inject;
  1341. var normalized = options.inject = {};
  1342. if (Array.isArray(inject)) {
  1343. for (var i = 0; i < inject.length; i++) {
  1344. normalized[inject[i]] = { from: inject[i] };
  1345. }
  1346. } else if (isPlainObject(inject)) {
  1347. for (var key in inject) {
  1348. var val = inject[key];
  1349. normalized[key] = isPlainObject(val)
  1350. ? extend({ from: key }, val)
  1351. : { from: val };
  1352. }
  1353. } else if ("development" !== 'production' && inject) {
  1354. warn(
  1355. "Invalid value for option \"inject\": expected an Array or an Object, " +
  1356. "but got " + (toRawType(inject)) + ".",
  1357. vm
  1358. );
  1359. }
  1360. }
  1361. /**
  1362. * Normalize raw function directives into object format.
  1363. */
  1364. function normalizeDirectives (options) {
  1365. var dirs = options.directives;
  1366. if (dirs) {
  1367. for (var key in dirs) {
  1368. var def = dirs[key];
  1369. if (typeof def === 'function') {
  1370. dirs[key] = { bind: def, update: def };
  1371. }
  1372. }
  1373. }
  1374. }
  1375. function assertObjectType (name, value, vm) {
  1376. if (!isPlainObject(value)) {
  1377. warn(
  1378. "Invalid value for option \"" + name + "\": expected an Object, " +
  1379. "but got " + (toRawType(value)) + ".",
  1380. vm
  1381. );
  1382. }
  1383. }
  1384. /**
  1385. * Merge two option objects into a new one.
  1386. * Core utility used in both instantiation and inheritance.
  1387. */
  1388. function mergeOptions (
  1389. parent,
  1390. child,
  1391. vm
  1392. ) {
  1393. {
  1394. checkComponents(child);
  1395. }
  1396. if (typeof child === 'function') {
  1397. child = child.options;
  1398. }
  1399. normalizeProps(child, vm);
  1400. normalizeInject(child, vm);
  1401. normalizeDirectives(child);
  1402. var extendsFrom = child.extends;
  1403. if (extendsFrom) {
  1404. parent = mergeOptions(parent, extendsFrom, vm);
  1405. }
  1406. if (child.mixins) {
  1407. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1408. parent = mergeOptions(parent, child.mixins[i], vm);
  1409. }
  1410. }
  1411. var options = {};
  1412. var key;
  1413. for (key in parent) {
  1414. mergeField(key);
  1415. }
  1416. for (key in child) {
  1417. if (!hasOwn(parent, key)) {
  1418. mergeField(key);
  1419. }
  1420. }
  1421. function mergeField (key) {
  1422. var strat = strats[key] || defaultStrat;
  1423. options[key] = strat(parent[key], child[key], vm, key);
  1424. }
  1425. return options
  1426. }
  1427. /**
  1428. * Resolve an asset.
  1429. * This function is used because child instances need access
  1430. * to assets defined in its ancestor chain.
  1431. */
  1432. function resolveAsset (
  1433. options,
  1434. type,
  1435. id,
  1436. warnMissing
  1437. ) {
  1438. /* istanbul ignore if */
  1439. if (typeof id !== 'string') {
  1440. return
  1441. }
  1442. var assets = options[type];
  1443. // check local registration variations first
  1444. if (hasOwn(assets, id)) { return assets[id] }
  1445. var camelizedId = camelize(id);
  1446. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  1447. var PascalCaseId = capitalize(camelizedId);
  1448. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  1449. // fallback to prototype chain
  1450. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  1451. if ("development" !== 'production' && warnMissing && !res) {
  1452. warn(
  1453. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  1454. options
  1455. );
  1456. }
  1457. return res
  1458. }
  1459. /* */
  1460. function validateProp (
  1461. key,
  1462. propOptions,
  1463. propsData,
  1464. vm
  1465. ) {
  1466. var prop = propOptions[key];
  1467. var absent = !hasOwn(propsData, key);
  1468. var value = propsData[key];
  1469. // handle boolean props
  1470. if (isType(Boolean, prop.type)) {
  1471. if (absent && !hasOwn(prop, 'default')) {
  1472. value = false;
  1473. } else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) {
  1474. value = true;
  1475. }
  1476. }
  1477. // check default value
  1478. if (value === undefined) {
  1479. value = getPropDefaultValue(vm, prop, key);
  1480. // since the default value is a fresh copy,
  1481. // make sure to observe it.
  1482. var prevShouldConvert = observerState.shouldConvert;
  1483. observerState.shouldConvert = true;
  1484. observe(value);
  1485. observerState.shouldConvert = prevShouldConvert;
  1486. }
  1487. {
  1488. assertProp(prop, key, value, vm, absent);
  1489. }
  1490. return value
  1491. }
  1492. /**
  1493. * Get the default value of a prop.
  1494. */
  1495. function getPropDefaultValue (vm, prop, key) {
  1496. // no default, return undefined
  1497. if (!hasOwn(prop, 'default')) {
  1498. return undefined
  1499. }
  1500. var def = prop.default;
  1501. // warn against non-factory defaults for Object & Array
  1502. if ("development" !== 'production' && isObject(def)) {
  1503. warn(
  1504. 'Invalid default value for prop "' + key + '": ' +
  1505. 'Props with type Object/Array must use a factory function ' +
  1506. 'to return the default value.',
  1507. vm
  1508. );
  1509. }
  1510. // the raw prop value was also undefined from previous render,
  1511. // return previous default value to avoid unnecessary watcher trigger
  1512. if (vm && vm.$options.propsData &&
  1513. vm.$options.propsData[key] === undefined &&
  1514. vm._props[key] !== undefined
  1515. ) {
  1516. return vm._props[key]
  1517. }
  1518. // call factory function for non-Function types
  1519. // a value is Function if its prototype is function even across different execution context
  1520. return typeof def === 'function' && getType(prop.type) !== 'Function'
  1521. ? def.call(vm)
  1522. : def
  1523. }
  1524. /**
  1525. * Assert whether a prop is valid.
  1526. */
  1527. function assertProp (
  1528. prop,
  1529. name,
  1530. value,
  1531. vm,
  1532. absent
  1533. ) {
  1534. if (prop.required && absent) {
  1535. warn(
  1536. 'Missing required prop: "' + name + '"',
  1537. vm
  1538. );
  1539. return
  1540. }
  1541. if (value == null && !prop.required) {
  1542. return
  1543. }
  1544. var type = prop.type;
  1545. var valid = !type || type === true;
  1546. var expectedTypes = [];
  1547. if (type) {
  1548. if (!Array.isArray(type)) {
  1549. type = [type];
  1550. }
  1551. for (var i = 0; i < type.length && !valid; i++) {
  1552. var assertedType = assertType(value, type[i]);
  1553. expectedTypes.push(assertedType.expectedType || '');
  1554. valid = assertedType.valid;
  1555. }
  1556. }
  1557. if (!valid) {
  1558. warn(
  1559. "Invalid prop: type check failed for prop \"" + name + "\"." +
  1560. " Expected " + (expectedTypes.map(capitalize).join(', ')) +
  1561. ", got " + (toRawType(value)) + ".",
  1562. vm
  1563. );
  1564. return
  1565. }
  1566. var validator = prop.validator;
  1567. if (validator) {
  1568. if (!validator(value)) {
  1569. warn(
  1570. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  1571. vm
  1572. );
  1573. }
  1574. }
  1575. }
  1576. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  1577. function assertType (value, type) {
  1578. var valid;
  1579. var expectedType = getType(type);
  1580. if (simpleCheckRE.test(expectedType)) {
  1581. var t = typeof value;
  1582. valid = t === expectedType.toLowerCase();
  1583. // for primitive wrapper objects
  1584. if (!valid && t === 'object') {
  1585. valid = value instanceof type;
  1586. }
  1587. } else if (expectedType === 'Object') {
  1588. valid = isPlainObject(value);
  1589. } else if (expectedType === 'Array') {
  1590. valid = Array.isArray(value);
  1591. } else {
  1592. valid = value instanceof type;
  1593. }
  1594. return {
  1595. valid: valid,
  1596. expectedType: expectedType
  1597. }
  1598. }
  1599. /**
  1600. * Use function string name to check built-in types,
  1601. * because a simple equality check will fail when running
  1602. * across different vms / iframes.
  1603. */
  1604. function getType (fn) {
  1605. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  1606. return match ? match[1] : ''
  1607. }
  1608. function isType (type, fn) {
  1609. if (!Array.isArray(fn)) {
  1610. return getType(fn) === getType(type)
  1611. }
  1612. for (var i = 0, len = fn.length; i < len; i++) {
  1613. if (getType(fn[i]) === getType(type)) {
  1614. return true
  1615. }
  1616. }
  1617. /* istanbul ignore next */
  1618. return false
  1619. }
  1620. /* */
  1621. var mark;
  1622. var measure;
  1623. {
  1624. var perf = inBrowser && window.performance;
  1625. /* istanbul ignore if */
  1626. if (
  1627. perf &&
  1628. perf.mark &&
  1629. perf.measure &&
  1630. perf.clearMarks &&
  1631. perf.clearMeasures
  1632. ) {
  1633. mark = function (tag) { return perf.mark(tag); };
  1634. measure = function (name, startTag, endTag) {
  1635. perf.measure(name, startTag, endTag);
  1636. perf.clearMarks(startTag);
  1637. perf.clearMarks(endTag);
  1638. perf.clearMeasures(name);
  1639. };
  1640. }
  1641. }
  1642. /* not type checking this file because flow doesn't play well with Proxy */
  1643. var initProxy;
  1644. {
  1645. var allowedGlobals = makeMap(
  1646. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  1647. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  1648. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  1649. 'require' // for Webpack/Browserify
  1650. );
  1651. var warnNonPresent = function (target, key) {
  1652. warn(
  1653. "Property or method \"" + key + "\" is not defined on the instance but " +
  1654. 'referenced during render. Make sure that this property is reactive, ' +
  1655. 'either in the data option, or for class-based components, by ' +
  1656. 'initializing the property. ' +
  1657. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  1658. target
  1659. );
  1660. };
  1661. var hasProxy =
  1662. typeof Proxy !== 'undefined' &&
  1663. Proxy.toString().match(/native code/);
  1664. if (hasProxy) {
  1665. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  1666. config.keyCodes = new Proxy(config.keyCodes, {
  1667. set: function set (target, key, value) {
  1668. if (isBuiltInModifier(key)) {
  1669. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  1670. return false
  1671. } else {
  1672. target[key] = value;
  1673. return true
  1674. }
  1675. }
  1676. });
  1677. }
  1678. var hasHandler = {
  1679. has: function has (target, key) {
  1680. var has = key in target;
  1681. var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
  1682. if (!has && !isAllowed) {
  1683. warnNonPresent(target, key);
  1684. }
  1685. return has || !isAllowed
  1686. }
  1687. };
  1688. var getHandler = {
  1689. get: function get (target, key) {
  1690. if (typeof key === 'string' && !(key in target)) {
  1691. warnNonPresent(target, key);
  1692. }
  1693. return target[key]
  1694. }
  1695. };
  1696. initProxy = function initProxy (vm) {
  1697. if (hasProxy) {
  1698. // determine which proxy handler to use
  1699. var options = vm.$options;
  1700. var handlers = options.render && options.render._withStripped
  1701. ? getHandler
  1702. : hasHandler;
  1703. vm._renderProxy = new Proxy(vm, handlers);
  1704. } else {
  1705. vm._renderProxy = vm;
  1706. }
  1707. };
  1708. }
  1709. /* */
  1710. var normalizeEvent = cached(function (name) {
  1711. var passive = name.charAt(0) === '&';
  1712. name = passive ? name.slice(1) : name;
  1713. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  1714. name = once$$1 ? name.slice(1) : name;
  1715. var capture = name.charAt(0) === '!';
  1716. name = capture ? name.slice(1) : name;
  1717. return {
  1718. name: name,
  1719. once: once$$1,
  1720. capture: capture,
  1721. passive: passive
  1722. }
  1723. });
  1724. function createFnInvoker (fns) {
  1725. function invoker () {
  1726. var arguments$1 = arguments;
  1727. var fns = invoker.fns;
  1728. if (Array.isArray(fns)) {
  1729. var cloned = fns.slice();
  1730. for (var i = 0; i < cloned.length; i++) {
  1731. cloned[i].apply(null, arguments$1);
  1732. }
  1733. } else {
  1734. // return handler return value for single handlers
  1735. return fns.apply(null, arguments)
  1736. }
  1737. }
  1738. invoker.fns = fns;
  1739. return invoker
  1740. }
  1741. function updateListeners (
  1742. on,
  1743. oldOn,
  1744. add,
  1745. remove$$1,
  1746. vm
  1747. ) {
  1748. var name, cur, old, event;
  1749. for (name in on) {
  1750. cur = on[name];
  1751. old = oldOn[name];
  1752. event = normalizeEvent(name);
  1753. if (isUndef(cur)) {
  1754. "development" !== 'production' && warn(
  1755. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  1756. vm
  1757. );
  1758. } else if (isUndef(old)) {
  1759. if (isUndef(cur.fns)) {
  1760. cur = on[name] = createFnInvoker(cur);
  1761. }
  1762. add(event.name, cur, event.once, event.capture, event.passive);
  1763. } else if (cur !== old) {
  1764. old.fns = cur;
  1765. on[name] = old;
  1766. }
  1767. }
  1768. for (name in oldOn) {
  1769. if (isUndef(on[name])) {
  1770. event = normalizeEvent(name);
  1771. remove$$1(event.name, oldOn[name], event.capture);
  1772. }
  1773. }
  1774. }
  1775. /* */
  1776. function mergeVNodeHook (def, hookKey, hook) {
  1777. var invoker;
  1778. var oldHook = def[hookKey];
  1779. function wrappedHook () {
  1780. hook.apply(this, arguments);
  1781. // important: remove merged hook to ensure it's called only once
  1782. // and prevent memory leak
  1783. remove(invoker.fns, wrappedHook);
  1784. }
  1785. if (isUndef(oldHook)) {
  1786. // no existing hook
  1787. invoker = createFnInvoker([wrappedHook]);
  1788. } else {
  1789. /* istanbul ignore if */
  1790. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  1791. // already a merged invoker
  1792. invoker = oldHook;
  1793. invoker.fns.push(wrappedHook);
  1794. } else {
  1795. // existing plain hook
  1796. invoker = createFnInvoker([oldHook, wrappedHook]);
  1797. }
  1798. }
  1799. invoker.merged = true;
  1800. def[hookKey] = invoker;
  1801. }
  1802. /* */
  1803. function extractPropsFromVNodeData (
  1804. data,
  1805. Ctor,
  1806. tag
  1807. ) {
  1808. // we are only extracting raw values here.
  1809. // validation and default values are handled in the child
  1810. // component itself.
  1811. var propOptions = Ctor.options.props;
  1812. if (isUndef(propOptions)) {
  1813. return
  1814. }
  1815. var res = {};
  1816. var attrs = data.attrs;
  1817. var props = data.props;
  1818. if (isDef(attrs) || isDef(props)) {
  1819. for (var key in propOptions) {
  1820. var altKey = hyphenate(key);
  1821. {
  1822. var keyInLowerCase = key.toLowerCase();
  1823. if (
  1824. key !== keyInLowerCase &&
  1825. attrs && hasOwn(attrs, keyInLowerCase)
  1826. ) {
  1827. tip(
  1828. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  1829. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  1830. " \"" + key + "\". " +
  1831. "Note that HTML attributes are case-insensitive and camelCased " +
  1832. "props need to use their kebab-case equivalents when using in-DOM " +
  1833. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  1834. );
  1835. }
  1836. }
  1837. checkProp(res, props, key, altKey, true) ||
  1838. checkProp(res, attrs, key, altKey, false);
  1839. }
  1840. }
  1841. return res
  1842. }
  1843. function checkProp (
  1844. res,
  1845. hash,
  1846. key,
  1847. altKey,
  1848. preserve
  1849. ) {
  1850. if (isDef(hash)) {
  1851. if (hasOwn(hash, key)) {
  1852. res[key] = hash[key];
  1853. if (!preserve) {
  1854. delete hash[key];
  1855. }
  1856. return true
  1857. } else if (hasOwn(hash, altKey)) {
  1858. res[key] = hash[altKey];
  1859. if (!preserve) {
  1860. delete hash[altKey];
  1861. }
  1862. return true
  1863. }
  1864. }
  1865. return false
  1866. }
  1867. /* */
  1868. // The template compiler attempts to minimize the need for normalization by
  1869. // statically analyzing the template at compile time.
  1870. //
  1871. // For plain HTML markup, normalization can be completely skipped because the
  1872. // generated render function is guaranteed to return Array<VNode>. There are
  1873. // two cases where extra normalization is needed:
  1874. // 1. When the children contains components - because a functional component
  1875. // may return an Array instead of a single root. In this case, just a simple
  1876. // normalization is needed - if any child is an Array, we flatten the whole
  1877. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  1878. // because functional components already normalize their own children.
  1879. function simpleNormalizeChildren (children) {
  1880. for (var i = 0; i < children.length; i++) {
  1881. if (Array.isArray(children[i])) {
  1882. return Array.prototype.concat.apply([], children)
  1883. }
  1884. }
  1885. return children
  1886. }
  1887. // 2. When the children contains constructs that always generated nested Arrays,
  1888. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  1889. // with hand-written render functions / JSX. In such cases a full normalization
  1890. // is needed to cater to all possible types of children values.
  1891. function normalizeChildren (children) {
  1892. return isPrimitive(children)
  1893. ? [createTextVNode(children)]
  1894. : Array.isArray(children)
  1895. ? normalizeArrayChildren(children)
  1896. : undefined
  1897. }
  1898. function isTextNode (node) {
  1899. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  1900. }
  1901. function normalizeArrayChildren (children, nestedIndex) {
  1902. var res = [];
  1903. var i, c, lastIndex, last;
  1904. for (i = 0; i < children.length; i++) {
  1905. c = children[i];
  1906. if (isUndef(c) || typeof c === 'boolean') { continue }
  1907. lastIndex = res.length - 1;
  1908. last = res[lastIndex];
  1909. // nested
  1910. if (Array.isArray(c)) {
  1911. if (c.length > 0) {
  1912. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  1913. // merge adjacent text nodes
  1914. if (isTextNode(c[0]) && isTextNode(last)) {
  1915. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  1916. c.shift();
  1917. }
  1918. res.push.apply(res, c);
  1919. }
  1920. } else if (isPrimitive(c)) {
  1921. if (isTextNode(last)) {
  1922. // merge adjacent text nodes
  1923. // this is necessary for SSR hydration because text nodes are
  1924. // essentially merged when rendered to HTML strings
  1925. res[lastIndex] = createTextVNode(last.text + c);
  1926. } else if (c !== '') {
  1927. // convert primitive to vnode
  1928. res.push(createTextVNode(c));
  1929. }
  1930. } else {
  1931. if (isTextNode(c) && isTextNode(last)) {
  1932. // merge adjacent text nodes
  1933. res[lastIndex] = createTextVNode(last.text + c.text);
  1934. } else {
  1935. // default key for nested array children (likely generated by v-for)
  1936. if (isTrue(children._isVList) &&
  1937. isDef(c.tag) &&
  1938. isUndef(c.key) &&
  1939. isDef(nestedIndex)) {
  1940. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  1941. }
  1942. res.push(c);
  1943. }
  1944. }
  1945. }
  1946. return res
  1947. }
  1948. /* */
  1949. function ensureCtor (comp, base) {
  1950. if (
  1951. comp.__esModule ||
  1952. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  1953. ) {
  1954. comp = comp.default;
  1955. }
  1956. return isObject(comp)
  1957. ? base.extend(comp)
  1958. : comp
  1959. }
  1960. function createAsyncPlaceholder (
  1961. factory,
  1962. data,
  1963. context,
  1964. children,
  1965. tag
  1966. ) {
  1967. var node = createEmptyVNode();
  1968. node.asyncFactory = factory;
  1969. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  1970. return node
  1971. }
  1972. function resolveAsyncComponent (
  1973. factory,
  1974. baseCtor,
  1975. context
  1976. ) {
  1977. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  1978. return factory.errorComp
  1979. }
  1980. if (isDef(factory.resolved)) {
  1981. return factory.resolved
  1982. }
  1983. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  1984. return factory.loadingComp
  1985. }
  1986. if (isDef(factory.contexts)) {
  1987. // already pending
  1988. factory.contexts.push(context);
  1989. } else {
  1990. var contexts = factory.contexts = [context];
  1991. var sync = true;
  1992. var forceRender = function () {
  1993. for (var i = 0, l = contexts.length; i < l; i++) {
  1994. contexts[i].$forceUpdate();
  1995. }
  1996. };
  1997. var resolve = once(function (res) {
  1998. // cache resolved
  1999. factory.resolved = ensureCtor(res, baseCtor);
  2000. // invoke callbacks only if this is not a synchronous resolve
  2001. // (async resolves are shimmed as synchronous during SSR)
  2002. if (!sync) {
  2003. forceRender();
  2004. }
  2005. });
  2006. var reject = once(function (reason) {
  2007. "development" !== 'production' && warn(
  2008. "Failed to resolve async component: " + (String(factory)) +
  2009. (reason ? ("\nReason: " + reason) : '')
  2010. );
  2011. if (isDef(factory.errorComp)) {
  2012. factory.error = true;
  2013. forceRender();
  2014. }
  2015. });
  2016. var res = factory(resolve, reject);
  2017. if (isObject(res)) {
  2018. if (typeof res.then === 'function') {
  2019. // () => Promise
  2020. if (isUndef(factory.resolved)) {
  2021. res.then(resolve, reject);
  2022. }
  2023. } else if (isDef(res.component) && typeof res.component.then === 'function') {
  2024. res.component.then(resolve, reject);
  2025. if (isDef(res.error)) {
  2026. factory.errorComp = ensureCtor(res.error, baseCtor);
  2027. }
  2028. if (isDef(res.loading)) {
  2029. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  2030. if (res.delay === 0) {
  2031. factory.loading = true;
  2032. } else {
  2033. setTimeout(function () {
  2034. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  2035. factory.loading = true;
  2036. forceRender();
  2037. }
  2038. }, res.delay || 200);
  2039. }
  2040. }
  2041. if (isDef(res.timeout)) {
  2042. setTimeout(function () {
  2043. if (isUndef(factory.resolved)) {
  2044. reject(
  2045. "timeout (" + (res.timeout) + "ms)"
  2046. );
  2047. }
  2048. }, res.timeout);
  2049. }
  2050. }
  2051. }
  2052. sync = false;
  2053. // return in case resolved synchronously
  2054. return factory.loading
  2055. ? factory.loadingComp
  2056. : factory.resolved
  2057. }
  2058. }
  2059. /* */
  2060. function isAsyncPlaceholder (node) {
  2061. return node.isComment && node.asyncFactory
  2062. }
  2063. /* */
  2064. function getFirstComponentChild (children) {
  2065. if (Array.isArray(children)) {
  2066. for (var i = 0; i < children.length; i++) {
  2067. var c = children[i];
  2068. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  2069. return c
  2070. }
  2071. }
  2072. }
  2073. }
  2074. /* */
  2075. /* */
  2076. function initEvents (vm) {
  2077. vm._events = Object.create(null);
  2078. vm._hasHookEvent = false;
  2079. // init parent attached events
  2080. var listeners = vm.$options._parentListeners;
  2081. if (listeners) {
  2082. updateComponentListeners(vm, listeners);
  2083. }
  2084. }
  2085. var target;
  2086. function add (event, fn, once) {
  2087. if (once) {
  2088. target.$once(event, fn);
  2089. } else {
  2090. target.$on(event, fn);
  2091. }
  2092. }
  2093. function remove$1 (event, fn) {
  2094. target.$off(event, fn);
  2095. }
  2096. function updateComponentListeners (
  2097. vm,
  2098. listeners,
  2099. oldListeners
  2100. ) {
  2101. target = vm;
  2102. updateListeners(listeners, oldListeners || {}, add, remove$1, vm);
  2103. }
  2104. function eventsMixin (Vue) {
  2105. var hookRE = /^hook:/;
  2106. Vue.prototype.$on = function (event, fn) {
  2107. var this$1 = this;
  2108. var vm = this;
  2109. if (Array.isArray(event)) {
  2110. for (var i = 0, l = event.length; i < l; i++) {
  2111. this$1.$on(event[i], fn);
  2112. }
  2113. } else {
  2114. (vm._events[event] || (vm._events[event] = [])).push(fn);
  2115. // optimize hook:event cost by using a boolean flag marked at registration
  2116. // instead of a hash lookup
  2117. if (hookRE.test(event)) {
  2118. vm._hasHookEvent = true;
  2119. }
  2120. }
  2121. return vm
  2122. };
  2123. Vue.prototype.$once = function (event, fn) {
  2124. var vm = this;
  2125. function on () {
  2126. vm.$off(event, on);
  2127. fn.apply(vm, arguments);
  2128. }
  2129. on.fn = fn;
  2130. vm.$on(event, on);
  2131. return vm
  2132. };
  2133. Vue.prototype.$off = function (event, fn) {
  2134. var this$1 = this;
  2135. var vm = this;
  2136. // all
  2137. if (!arguments.length) {
  2138. vm._events = Object.create(null);
  2139. return vm
  2140. }
  2141. // array of events
  2142. if (Array.isArray(event)) {
  2143. for (var i = 0, l = event.length; i < l; i++) {
  2144. this$1.$off(event[i], fn);
  2145. }
  2146. return vm
  2147. }
  2148. // specific event
  2149. var cbs = vm._events[event];
  2150. if (!cbs) {
  2151. return vm
  2152. }
  2153. if (arguments.length === 1) {
  2154. vm._events[event] = null;
  2155. return vm
  2156. }
  2157. if (fn) {
  2158. // specific handler
  2159. var cb;
  2160. var i$1 = cbs.length;
  2161. while (i$1--) {
  2162. cb = cbs[i$1];
  2163. if (cb === fn || cb.fn === fn) {
  2164. cbs.splice(i$1, 1);
  2165. break
  2166. }
  2167. }
  2168. }
  2169. return vm
  2170. };
  2171. Vue.prototype.$emit = function (event) {
  2172. var vm = this;
  2173. {
  2174. var lowerCaseEvent = event.toLowerCase();
  2175. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  2176. tip(
  2177. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  2178. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  2179. "Note that HTML attributes are case-insensitive and you cannot use " +
  2180. "v-on to listen to camelCase events when using in-DOM templates. " +
  2181. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  2182. );
  2183. }
  2184. }
  2185. var cbs = vm._events[event];
  2186. if (cbs) {
  2187. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  2188. var args = toArray(arguments, 1);
  2189. for (var i = 0, l = cbs.length; i < l; i++) {
  2190. try {
  2191. cbs[i].apply(vm, args);
  2192. } catch (e) {
  2193. handleError(e, vm, ("event handler for \"" + event + "\""));
  2194. }
  2195. }
  2196. }
  2197. return vm
  2198. };
  2199. }
  2200. /* */
  2201. /**
  2202. * Runtime helper for resolving raw children VNodes into a slot object.
  2203. */
  2204. function resolveSlots (
  2205. children,
  2206. context
  2207. ) {
  2208. var slots = {};
  2209. if (!children) {
  2210. return slots
  2211. }
  2212. var defaultSlot = [];
  2213. for (var i = 0, l = children.length; i < l; i++) {
  2214. var child = children[i];
  2215. var data = child.data;
  2216. // remove slot attribute if the node is resolved as a Vue slot node
  2217. if (data && data.attrs && data.attrs.slot) {
  2218. delete data.attrs.slot;
  2219. }
  2220. // named slots should only be respected if the vnode was rendered in the
  2221. // same context.
  2222. if ((child.context === context || child.functionalContext === context) &&
  2223. data && data.slot != null
  2224. ) {
  2225. var name = child.data.slot;
  2226. var slot = (slots[name] || (slots[name] = []));
  2227. if (child.tag === 'template') {
  2228. slot.push.apply(slot, child.children);
  2229. } else {
  2230. slot.push(child);
  2231. }
  2232. } else {
  2233. defaultSlot.push(child);
  2234. }
  2235. }
  2236. // ignore whitespace
  2237. if (!defaultSlot.every(isWhitespace)) {
  2238. slots.default = defaultSlot;
  2239. }
  2240. return slots
  2241. }
  2242. function isWhitespace (node) {
  2243. return node.isComment || node.text === ' '
  2244. }
  2245. function resolveScopedSlots (
  2246. fns, // see flow/vnode
  2247. res
  2248. ) {
  2249. res = res || {};
  2250. for (var i = 0; i < fns.length; i++) {
  2251. if (Array.isArray(fns[i])) {
  2252. resolveScopedSlots(fns[i], res);
  2253. } else {
  2254. res[fns[i].key] = fns[i].fn;
  2255. }
  2256. }
  2257. return res
  2258. }
  2259. /* */
  2260. var activeInstance = null;
  2261. var isUpdatingChildComponent = false;
  2262. function initLifecycle (vm) {
  2263. var options = vm.$options;
  2264. // locate first non-abstract parent
  2265. var parent = options.parent;
  2266. if (parent && !options.abstract) {
  2267. while (parent.$options.abstract && parent.$parent) {
  2268. parent = parent.$parent;
  2269. }
  2270. parent.$children.push(vm);
  2271. }
  2272. vm.$parent = parent;
  2273. vm.$root = parent ? parent.$root : vm;
  2274. vm.$children = [];
  2275. vm.$refs = {};
  2276. vm._watcher = null;
  2277. vm._inactive = null;
  2278. vm._directInactive = false;
  2279. vm._isMounted = false;
  2280. vm._isDestroyed = false;
  2281. vm._isBeingDestroyed = false;
  2282. }
  2283. function lifecycleMixin (Vue) {
  2284. Vue.prototype._update = function (vnode, hydrating) {
  2285. var vm = this;
  2286. if (vm._isMounted) {
  2287. callHook(vm, 'beforeUpdate');
  2288. }
  2289. var prevEl = vm.$el;
  2290. var prevVnode = vm._vnode;
  2291. var prevActiveInstance = activeInstance;
  2292. activeInstance = vm;
  2293. vm._vnode = vnode;
  2294. // Vue.prototype.__patch__ is injected in entry points
  2295. // based on the rendering backend used.
  2296. if (!prevVnode) {
  2297. // initial render
  2298. vm.$el = vm.__patch__(
  2299. vm.$el, vnode, hydrating, false /* removeOnly */,
  2300. vm.$options._parentElm,
  2301. vm.$options._refElm
  2302. );
  2303. // no need for the ref nodes after initial patch
  2304. // this prevents keeping a detached DOM tree in memory (#5851)
  2305. vm.$options._parentElm = vm.$options._refElm = null;
  2306. } else {
  2307. // updates
  2308. vm.$el = vm.__patch__(prevVnode, vnode);
  2309. }
  2310. activeInstance = prevActiveInstance;
  2311. // update __vue__ reference
  2312. if (prevEl) {
  2313. prevEl.__vue__ = null;
  2314. }
  2315. if (vm.$el) {
  2316. vm.$el.__vue__ = vm;
  2317. }
  2318. // if parent is an HOC, update its $el as well
  2319. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  2320. vm.$parent.$el = vm.$el;
  2321. }
  2322. // updated hook is called by the scheduler to ensure that children are
  2323. // updated in a parent's updated hook.
  2324. };
  2325. Vue.prototype.$forceUpdate = function () {
  2326. var vm = this;
  2327. if (vm._watcher) {
  2328. vm._watcher.update();
  2329. }
  2330. };
  2331. Vue.prototype.$destroy = function () {
  2332. var vm = this;
  2333. if (vm._isBeingDestroyed) {
  2334. return
  2335. }
  2336. callHook(vm, 'beforeDestroy');
  2337. vm._isBeingDestroyed = true;
  2338. // remove self from parent
  2339. var parent = vm.$parent;
  2340. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  2341. remove(parent.$children, vm);
  2342. }
  2343. // teardown watchers
  2344. if (vm._watcher) {
  2345. vm._watcher.teardown();
  2346. }
  2347. var i = vm._watchers.length;
  2348. while (i--) {
  2349. vm._watchers[i].teardown();
  2350. }
  2351. // remove reference from data ob
  2352. // frozen object may not have observer.
  2353. if (vm._data.__ob__) {
  2354. vm._data.__ob__.vmCount--;
  2355. }
  2356. // call the last hook...
  2357. vm._isDestroyed = true;
  2358. // invoke destroy hooks on current rendered tree
  2359. vm.__patch__(vm._vnode, null);
  2360. // fire destroyed hook
  2361. callHook(vm, 'destroyed');
  2362. // turn off all instance listeners.
  2363. vm.$off();
  2364. // remove __vue__ reference
  2365. if (vm.$el) {
  2366. vm.$el.__vue__ = null;
  2367. }
  2368. // release circular reference (#6759)
  2369. if (vm.$vnode) {
  2370. vm.$vnode.parent = null;
  2371. }
  2372. };
  2373. }
  2374. function mountComponent (
  2375. vm,
  2376. el,
  2377. hydrating
  2378. ) {
  2379. vm.$el = el;
  2380. if (!vm.$options.render) {
  2381. vm.$options.render = createEmptyVNode;
  2382. {
  2383. /* istanbul ignore if */
  2384. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  2385. vm.$options.el || el) {
  2386. warn(
  2387. 'You are using the runtime-only build of Vue where the template ' +
  2388. 'compiler is not available. Either pre-compile the templates into ' +
  2389. 'render functions, or use the compiler-included build.',
  2390. vm
  2391. );
  2392. } else {
  2393. warn(
  2394. 'Failed to mount component: template or render function not defined.',
  2395. vm
  2396. );
  2397. }
  2398. }
  2399. }
  2400. callHook(vm, 'beforeMount');
  2401. var updateComponent;
  2402. /* istanbul ignore if */
  2403. if ("development" !== 'production' && config.performance && mark) {
  2404. updateComponent = function () {
  2405. var name = vm._name;
  2406. var id = vm._uid;
  2407. var startTag = "vue-perf-start:" + id;
  2408. var endTag = "vue-perf-end:" + id;
  2409. mark(startTag);
  2410. var vnode = vm._render();
  2411. mark(endTag);
  2412. measure(("vue " + name + " render"), startTag, endTag);
  2413. mark(startTag);
  2414. vm._update(vnode, hydrating);
  2415. mark(endTag);
  2416. measure(("vue " + name + " patch"), startTag, endTag);
  2417. };
  2418. } else {
  2419. updateComponent = function () {
  2420. vm._update(vm._render(), hydrating);
  2421. };
  2422. }
  2423. vm._watcher = new Watcher(vm, updateComponent, noop);
  2424. hydrating = false;
  2425. // manually mounted instance, call mounted on self
  2426. // mounted is called for render-created child components in its inserted hook
  2427. if (vm.$vnode == null) {
  2428. vm._isMounted = true;
  2429. callHook(vm, 'mounted');
  2430. }
  2431. return vm
  2432. }
  2433. function updateChildComponent (
  2434. vm,
  2435. propsData,
  2436. listeners,
  2437. parentVnode,
  2438. renderChildren
  2439. ) {
  2440. {
  2441. isUpdatingChildComponent = true;
  2442. }
  2443. // determine whether component has slot children
  2444. // we need to do this before overwriting $options._renderChildren
  2445. var hasChildren = !!(
  2446. renderChildren || // has new static slots
  2447. vm.$options._renderChildren || // has old static slots
  2448. parentVnode.data.scopedSlots || // has new scoped slots
  2449. vm.$scopedSlots !== emptyObject // has old scoped slots
  2450. );
  2451. vm.$options._parentVnode = parentVnode;
  2452. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  2453. if (vm._vnode) { // update child tree's parent
  2454. vm._vnode.parent = parentVnode;
  2455. }
  2456. vm.$options._renderChildren = renderChildren;
  2457. // update $attrs and $listeners hash
  2458. // these are also reactive so they may trigger child update if the child
  2459. // used them during render
  2460. vm.$attrs = (parentVnode.data && parentVnode.data.attrs) || emptyObject;
  2461. vm.$listeners = listeners || emptyObject;
  2462. // update props
  2463. if (propsData && vm.$options.props) {
  2464. observerState.shouldConvert = false;
  2465. var props = vm._props;
  2466. var propKeys = vm.$options._propKeys || [];
  2467. for (var i = 0; i < propKeys.length; i++) {
  2468. var key = propKeys[i];
  2469. props[key] = validateProp(key, vm.$options.props, propsData, vm);
  2470. }
  2471. observerState.shouldConvert = true;
  2472. // keep a copy of raw propsData
  2473. vm.$options.propsData = propsData;
  2474. }
  2475. // update listeners
  2476. if (listeners) {
  2477. var oldListeners = vm.$options._parentListeners;
  2478. vm.$options._parentListeners = listeners;
  2479. updateComponentListeners(vm, listeners, oldListeners);
  2480. }
  2481. // resolve slots + force update if has children
  2482. if (hasChildren) {
  2483. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  2484. vm.$forceUpdate();
  2485. }
  2486. {
  2487. isUpdatingChildComponent = false;
  2488. }
  2489. }
  2490. function isInInactiveTree (vm) {
  2491. while (vm && (vm = vm.$parent)) {
  2492. if (vm._inactive) { return true }
  2493. }
  2494. return false
  2495. }
  2496. function activateChildComponent (vm, direct) {
  2497. if (direct) {
  2498. vm._directInactive = false;
  2499. if (isInInactiveTree(vm)) {
  2500. return
  2501. }
  2502. } else if (vm._directInactive) {
  2503. return
  2504. }
  2505. if (vm._inactive || vm._inactive === null) {
  2506. vm._inactive = false;
  2507. for (var i = 0; i < vm.$children.length; i++) {
  2508. activateChildComponent(vm.$children[i]);
  2509. }
  2510. callHook(vm, 'activated');
  2511. }
  2512. }
  2513. function deactivateChildComponent (vm, direct) {
  2514. if (direct) {
  2515. vm._directInactive = true;
  2516. if (isInInactiveTree(vm)) {
  2517. return
  2518. }
  2519. }
  2520. if (!vm._inactive) {
  2521. vm._inactive = true;
  2522. for (var i = 0; i < vm.$children.length; i++) {
  2523. deactivateChildComponent(vm.$children[i]);
  2524. }
  2525. callHook(vm, 'deactivated');
  2526. }
  2527. }
  2528. function callHook (vm, hook) {
  2529. var handlers = vm.$options[hook];
  2530. if (handlers) {
  2531. for (var i = 0, j = handlers.length; i < j; i++) {
  2532. try {
  2533. handlers[i].call(vm);
  2534. } catch (e) {
  2535. handleError(e, vm, (hook + " hook"));
  2536. }
  2537. }
  2538. }
  2539. if (vm._hasHookEvent) {
  2540. vm.$emit('hook:' + hook);
  2541. }
  2542. }
  2543. /* */
  2544. var MAX_UPDATE_COUNT = 100;
  2545. var queue = [];
  2546. var activatedChildren = [];
  2547. var has = {};
  2548. var circular = {};
  2549. var waiting = false;
  2550. var flushing = false;
  2551. var index = 0;
  2552. /**
  2553. * Reset the scheduler's state.
  2554. */
  2555. function resetSchedulerState () {
  2556. index = queue.length = activatedChildren.length = 0;
  2557. has = {};
  2558. {
  2559. circular = {};
  2560. }
  2561. waiting = flushing = false;
  2562. }
  2563. /**
  2564. * Flush both queues and run the watchers.
  2565. */
  2566. function flushSchedulerQueue () {
  2567. flushing = true;
  2568. var watcher, id;
  2569. // Sort queue before flush.
  2570. // This ensures that:
  2571. // 1. Components are updated from parent to child. (because parent is always
  2572. // created before the child)
  2573. // 2. A component's user watchers are run before its render watcher (because
  2574. // user watchers are created before the render watcher)
  2575. // 3. If a component is destroyed during a parent component's watcher run,
  2576. // its watchers can be skipped.
  2577. queue.sort(function (a, b) { return a.id - b.id; });
  2578. // do not cache length because more watchers might be pushed
  2579. // as we run existing watchers
  2580. for (index = 0; index < queue.length; index++) {
  2581. watcher = queue[index];
  2582. id = watcher.id;
  2583. has[id] = null;
  2584. watcher.run();
  2585. // in dev build, check and stop circular updates.
  2586. if ("development" !== 'production' && has[id] != null) {
  2587. circular[id] = (circular[id] || 0) + 1;
  2588. if (circular[id] > MAX_UPDATE_COUNT) {
  2589. warn(
  2590. 'You may have an infinite update loop ' + (
  2591. watcher.user
  2592. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  2593. : "in a component render function."
  2594. ),
  2595. watcher.vm
  2596. );
  2597. break
  2598. }
  2599. }
  2600. }
  2601. // keep copies of post queues before resetting state
  2602. var activatedQueue = activatedChildren.slice();
  2603. var updatedQueue = queue.slice();
  2604. resetSchedulerState();
  2605. // call component updated and activated hooks
  2606. callActivatedHooks(activatedQueue);
  2607. callUpdatedHooks(updatedQueue);
  2608. // devtool hook
  2609. /* istanbul ignore if */
  2610. if (devtools && config.devtools) {
  2611. devtools.emit('flush');
  2612. }
  2613. }
  2614. function callUpdatedHooks (queue) {
  2615. var i = queue.length;
  2616. while (i--) {
  2617. var watcher = queue[i];
  2618. var vm = watcher.vm;
  2619. if (vm._watcher === watcher && vm._isMounted) {
  2620. callHook(vm, 'updated');
  2621. }
  2622. }
  2623. }
  2624. /**
  2625. * Queue a kept-alive component that was activated during patch.
  2626. * The queue will be processed after the entire tree has been patched.
  2627. */
  2628. function queueActivatedComponent (vm) {
  2629. // setting _inactive to false here so that a render function can
  2630. // rely on checking whether it's in an inactive tree (e.g. router-view)
  2631. vm._inactive = false;
  2632. activatedChildren.push(vm);
  2633. }
  2634. function callActivatedHooks (queue) {
  2635. for (var i = 0; i < queue.length; i++) {
  2636. queue[i]._inactive = true;
  2637. activateChildComponent(queue[i], true /* true */);
  2638. }
  2639. }
  2640. /**
  2641. * Push a watcher into the watcher queue.
  2642. * Jobs with duplicate IDs will be skipped unless it's
  2643. * pushed when the queue is being flushed.
  2644. */
  2645. function queueWatcher (watcher) {
  2646. var id = watcher.id;
  2647. if (has[id] == null) {
  2648. has[id] = true;
  2649. if (!flushing) {
  2650. queue.push(watcher);
  2651. } else {
  2652. // if already flushing, splice the watcher based on its id
  2653. // if already past its id, it will be run next immediately.
  2654. var i = queue.length - 1;
  2655. while (i > index && queue[i].id > watcher.id) {
  2656. i--;
  2657. }
  2658. queue.splice(i + 1, 0, watcher);
  2659. }
  2660. // queue the flush
  2661. if (!waiting) {
  2662. waiting = true;
  2663. nextTick(flushSchedulerQueue);
  2664. }
  2665. }
  2666. }
  2667. /* */
  2668. var uid$2 = 0;
  2669. /**
  2670. * A watcher parses an expression, collects dependencies,
  2671. * and fires callback when the expression value changes.
  2672. * This is used for both the $watch() api and directives.
  2673. */
  2674. var Watcher = function Watcher (
  2675. vm,
  2676. expOrFn,
  2677. cb,
  2678. options
  2679. ) {
  2680. this.vm = vm;
  2681. vm._watchers.push(this);
  2682. // options
  2683. if (options) {
  2684. this.deep = !!options.deep;
  2685. this.user = !!options.user;
  2686. this.lazy = !!options.lazy;
  2687. this.sync = !!options.sync;
  2688. } else {
  2689. this.deep = this.user = this.lazy = this.sync = false;
  2690. }
  2691. this.cb = cb;
  2692. this.id = ++uid$2; // uid for batching
  2693. this.active = true;
  2694. this.dirty = this.lazy; // for lazy watchers
  2695. this.deps = [];
  2696. this.newDeps = [];
  2697. this.depIds = new _Set();
  2698. this.newDepIds = new _Set();
  2699. this.expression = expOrFn.toString();
  2700. // parse expression for getter
  2701. if (typeof expOrFn === 'function') {
  2702. this.getter = expOrFn;
  2703. } else {
  2704. this.getter = parsePath(expOrFn);
  2705. if (!this.getter) {
  2706. this.getter = function () {};
  2707. "development" !== 'production' && warn(
  2708. "Failed watching path: \"" + expOrFn + "\" " +
  2709. 'Watcher only accepts simple dot-delimited paths. ' +
  2710. 'For full control, use a function instead.',
  2711. vm
  2712. );
  2713. }
  2714. }
  2715. this.value = this.lazy
  2716. ? undefined
  2717. : this.get();
  2718. };
  2719. /**
  2720. * Evaluate the getter, and re-collect dependencies.
  2721. */
  2722. Watcher.prototype.get = function get () {
  2723. pushTarget(this);
  2724. var value;
  2725. var vm = this.vm;
  2726. try {
  2727. value = this.getter.call(vm, vm);
  2728. } catch (e) {
  2729. if (this.user) {
  2730. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  2731. } else {
  2732. throw e
  2733. }
  2734. } finally {
  2735. // "touch" every property so they are all tracked as
  2736. // dependencies for deep watching
  2737. if (this.deep) {
  2738. traverse(value);
  2739. }
  2740. popTarget();
  2741. this.cleanupDeps();
  2742. }
  2743. return value
  2744. };
  2745. /**
  2746. * Add a dependency to this directive.
  2747. */
  2748. Watcher.prototype.addDep = function addDep (dep) {
  2749. var id = dep.id;
  2750. if (!this.newDepIds.has(id)) {
  2751. this.newDepIds.add(id);
  2752. this.newDeps.push(dep);
  2753. if (!this.depIds.has(id)) {
  2754. dep.addSub(this);
  2755. }
  2756. }
  2757. };
  2758. /**
  2759. * Clean up for dependency collection.
  2760. */
  2761. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  2762. var this$1 = this;
  2763. var i = this.deps.length;
  2764. while (i--) {
  2765. var dep = this$1.deps[i];
  2766. if (!this$1.newDepIds.has(dep.id)) {
  2767. dep.removeSub(this$1);
  2768. }
  2769. }
  2770. var tmp = this.depIds;
  2771. this.depIds = this.newDepIds;
  2772. this.newDepIds = tmp;
  2773. this.newDepIds.clear();
  2774. tmp = this.deps;
  2775. this.deps = this.newDeps;
  2776. this.newDeps = tmp;
  2777. this.newDeps.length = 0;
  2778. };
  2779. /**
  2780. * Subscriber interface.
  2781. * Will be called when a dependency changes.
  2782. */
  2783. Watcher.prototype.update = function update () {
  2784. /* istanbul ignore else */
  2785. if (this.lazy) {
  2786. this.dirty = true;
  2787. } else if (this.sync) {
  2788. this.run();
  2789. } else {
  2790. queueWatcher(this);
  2791. }
  2792. };
  2793. /**
  2794. * Scheduler job interface.
  2795. * Will be called by the scheduler.
  2796. */
  2797. Watcher.prototype.run = function run () {
  2798. if (this.active) {
  2799. var value = this.get();
  2800. if (
  2801. value !== this.value ||
  2802. // Deep watchers and watchers on Object/Arrays should fire even
  2803. // when the value is the same, because the value may
  2804. // have mutated.
  2805. isObject(value) ||
  2806. this.deep
  2807. ) {
  2808. // set new value
  2809. var oldValue = this.value;
  2810. this.value = value;
  2811. if (this.user) {
  2812. try {
  2813. this.cb.call(this.vm, value, oldValue);
  2814. } catch (e) {
  2815. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  2816. }
  2817. } else {
  2818. this.cb.call(this.vm, value, oldValue);
  2819. }
  2820. }
  2821. }
  2822. };
  2823. /**
  2824. * Evaluate the value of the watcher.
  2825. * This only gets called for lazy watchers.
  2826. */
  2827. Watcher.prototype.evaluate = function evaluate () {
  2828. this.value = this.get();
  2829. this.dirty = false;
  2830. };
  2831. /**
  2832. * Depend on all deps collected by this watcher.
  2833. */
  2834. Watcher.prototype.depend = function depend () {
  2835. var this$1 = this;
  2836. var i = this.deps.length;
  2837. while (i--) {
  2838. this$1.deps[i].depend();
  2839. }
  2840. };
  2841. /**
  2842. * Remove self from all dependencies' subscriber list.
  2843. */
  2844. Watcher.prototype.teardown = function teardown () {
  2845. var this$1 = this;
  2846. if (this.active) {
  2847. // remove self from vm's watcher list
  2848. // this is a somewhat expensive operation so we skip it
  2849. // if the vm is being destroyed.
  2850. if (!this.vm._isBeingDestroyed) {
  2851. remove(this.vm._watchers, this);
  2852. }
  2853. var i = this.deps.length;
  2854. while (i--) {
  2855. this$1.deps[i].removeSub(this$1);
  2856. }
  2857. this.active = false;
  2858. }
  2859. };
  2860. /**
  2861. * Recursively traverse an object to evoke all converted
  2862. * getters, so that every nested property inside the object
  2863. * is collected as a "deep" dependency.
  2864. */
  2865. var seenObjects = new _Set();
  2866. function traverse (val) {
  2867. seenObjects.clear();
  2868. _traverse(val, seenObjects);
  2869. }
  2870. function _traverse (val, seen) {
  2871. var i, keys;
  2872. var isA = Array.isArray(val);
  2873. if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
  2874. return
  2875. }
  2876. if (val.__ob__) {
  2877. var depId = val.__ob__.dep.id;
  2878. if (seen.has(depId)) {
  2879. return
  2880. }
  2881. seen.add(depId);
  2882. }
  2883. if (isA) {
  2884. i = val.length;
  2885. while (i--) { _traverse(val[i], seen); }
  2886. } else {
  2887. keys = Object.keys(val);
  2888. i = keys.length;
  2889. while (i--) { _traverse(val[keys[i]], seen); }
  2890. }
  2891. }
  2892. /* */
  2893. var sharedPropertyDefinition = {
  2894. enumerable: true,
  2895. configurable: true,
  2896. get: noop,
  2897. set: noop
  2898. };
  2899. function proxy (target, sourceKey, key) {
  2900. sharedPropertyDefinition.get = function proxyGetter () {
  2901. return this[sourceKey][key]
  2902. };
  2903. sharedPropertyDefinition.set = function proxySetter (val) {
  2904. this[sourceKey][key] = val;
  2905. };
  2906. Object.defineProperty(target, key, sharedPropertyDefinition);
  2907. }
  2908. function initState (vm) {
  2909. vm._watchers = [];
  2910. var opts = vm.$options;
  2911. if (opts.props) { initProps(vm, opts.props); }
  2912. if (opts.methods) { initMethods(vm, opts.methods); }
  2913. if (opts.data) {
  2914. initData(vm);
  2915. } else {
  2916. observe(vm._data = {}, true /* asRootData */);
  2917. }
  2918. if (opts.computed) { initComputed(vm, opts.computed); }
  2919. if (opts.watch && opts.watch !== nativeWatch) {
  2920. initWatch(vm, opts.watch);
  2921. }
  2922. }
  2923. function initProps (vm, propsOptions) {
  2924. var propsData = vm.$options.propsData || {};
  2925. var props = vm._props = {};
  2926. // cache prop keys so that future props updates can iterate using Array
  2927. // instead of dynamic object key enumeration.
  2928. var keys = vm.$options._propKeys = [];
  2929. var isRoot = !vm.$parent;
  2930. // root instance props should be converted
  2931. observerState.shouldConvert = isRoot;
  2932. var loop = function ( key ) {
  2933. keys.push(key);
  2934. var value = validateProp(key, propsOptions, propsData, vm);
  2935. /* istanbul ignore else */
  2936. {
  2937. var hyphenatedKey = hyphenate(key);
  2938. if (isReservedAttribute(hyphenatedKey) ||
  2939. config.isReservedAttr(hyphenatedKey)) {
  2940. warn(
  2941. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  2942. vm
  2943. );
  2944. }
  2945. defineReactive(props, key, value, function () {
  2946. if (vm.$parent && !isUpdatingChildComponent) {
  2947. warn(
  2948. "Avoid mutating a prop directly since the value will be " +
  2949. "overwritten whenever the parent component re-renders. " +
  2950. "Instead, use a data or computed property based on the prop's " +
  2951. "value. Prop being mutated: \"" + key + "\"",
  2952. vm
  2953. );
  2954. }
  2955. });
  2956. }
  2957. // static props are already proxied on the component's prototype
  2958. // during Vue.extend(). We only need to proxy props defined at
  2959. // instantiation here.
  2960. if (!(key in vm)) {
  2961. proxy(vm, "_props", key);
  2962. }
  2963. };
  2964. for (var key in propsOptions) loop( key );
  2965. observerState.shouldConvert = true;
  2966. }
  2967. function initData (vm) {
  2968. var data = vm.$options.data;
  2969. data = vm._data = typeof data === 'function'
  2970. ? getData(data, vm)
  2971. : data || {};
  2972. if (!isPlainObject(data)) {
  2973. data = {};
  2974. "development" !== 'production' && warn(
  2975. 'data functions should return an object:\n' +
  2976. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  2977. vm
  2978. );
  2979. }
  2980. // proxy data on instance
  2981. var keys = Object.keys(data);
  2982. var props = vm.$options.props;
  2983. var methods = vm.$options.methods;
  2984. var i = keys.length;
  2985. while (i--) {
  2986. var key = keys[i];
  2987. {
  2988. if (methods && hasOwn(methods, key)) {
  2989. warn(
  2990. ("Method \"" + key + "\" has already been defined as a data property."),
  2991. vm
  2992. );
  2993. }
  2994. }
  2995. if (props && hasOwn(props, key)) {
  2996. "development" !== 'production' && warn(
  2997. "The data property \"" + key + "\" is already declared as a prop. " +
  2998. "Use prop default value instead.",
  2999. vm
  3000. );
  3001. } else if (!isReserved(key)) {
  3002. proxy(vm, "_data", key);
  3003. }
  3004. }
  3005. // observe data
  3006. observe(data, true /* asRootData */);
  3007. }
  3008. function getData (data, vm) {
  3009. try {
  3010. return data.call(vm, vm)
  3011. } catch (e) {
  3012. handleError(e, vm, "data()");
  3013. return {}
  3014. }
  3015. }
  3016. var computedWatcherOptions = { lazy: true };
  3017. function initComputed (vm, computed) {
  3018. var watchers = vm._computedWatchers = Object.create(null);
  3019. // computed properties are just getters during SSR
  3020. var isSSR = isServerRendering();
  3021. for (var key in computed) {
  3022. var userDef = computed[key];
  3023. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  3024. if ("development" !== 'production' && getter == null) {
  3025. warn(
  3026. ("Getter is missing for computed property \"" + key + "\"."),
  3027. vm
  3028. );
  3029. }
  3030. if (!isSSR) {
  3031. // create internal watcher for the computed property.
  3032. watchers[key] = new Watcher(
  3033. vm,
  3034. getter || noop,
  3035. noop,
  3036. computedWatcherOptions
  3037. );
  3038. }
  3039. // component-defined computed properties are already defined on the
  3040. // component prototype. We only need to define computed properties defined
  3041. // at instantiation here.
  3042. if (!(key in vm)) {
  3043. defineComputed(vm, key, userDef);
  3044. } else {
  3045. if (key in vm.$data) {
  3046. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  3047. } else if (vm.$options.props && key in vm.$options.props) {
  3048. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  3049. }
  3050. }
  3051. }
  3052. }
  3053. function defineComputed (
  3054. target,
  3055. key,
  3056. userDef
  3057. ) {
  3058. var shouldCache = !isServerRendering();
  3059. if (typeof userDef === 'function') {
  3060. sharedPropertyDefinition.get = shouldCache
  3061. ? createComputedGetter(key)
  3062. : userDef;
  3063. sharedPropertyDefinition.set = noop;
  3064. } else {
  3065. sharedPropertyDefinition.get = userDef.get
  3066. ? shouldCache && userDef.cache !== false
  3067. ? createComputedGetter(key)
  3068. : userDef.get
  3069. : noop;
  3070. sharedPropertyDefinition.set = userDef.set
  3071. ? userDef.set
  3072. : noop;
  3073. }
  3074. if ("development" !== 'production' &&
  3075. sharedPropertyDefinition.set === noop) {
  3076. sharedPropertyDefinition.set = function () {
  3077. warn(
  3078. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  3079. this
  3080. );
  3081. };
  3082. }
  3083. Object.defineProperty(target, key, sharedPropertyDefinition);
  3084. }
  3085. function createComputedGetter (key) {
  3086. return function computedGetter () {
  3087. var watcher = this._computedWatchers && this._computedWatchers[key];
  3088. if (watcher) {
  3089. if (watcher.dirty) {
  3090. watcher.evaluate();
  3091. }
  3092. if (Dep.target) {
  3093. watcher.depend();
  3094. }
  3095. return watcher.value
  3096. }
  3097. }
  3098. }
  3099. function initMethods (vm, methods) {
  3100. var props = vm.$options.props;
  3101. for (var key in methods) {
  3102. {
  3103. if (methods[key] == null) {
  3104. warn(
  3105. "Method \"" + key + "\" has an undefined value in the component definition. " +
  3106. "Did you reference the function correctly?",
  3107. vm
  3108. );
  3109. }
  3110. if (props && hasOwn(props, key)) {
  3111. warn(
  3112. ("Method \"" + key + "\" has already been defined as a prop."),
  3113. vm
  3114. );
  3115. }
  3116. if ((key in vm) && isReserved(key)) {
  3117. warn(
  3118. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  3119. "Avoid defining component methods that start with _ or $."
  3120. );
  3121. }
  3122. }
  3123. vm[key] = methods[key] == null ? noop : bind(methods[key], vm);
  3124. }
  3125. }
  3126. function initWatch (vm, watch) {
  3127. for (var key in watch) {
  3128. var handler = watch[key];
  3129. if (Array.isArray(handler)) {
  3130. for (var i = 0; i < handler.length; i++) {
  3131. createWatcher(vm, key, handler[i]);
  3132. }
  3133. } else {
  3134. createWatcher(vm, key, handler);
  3135. }
  3136. }
  3137. }
  3138. function createWatcher (
  3139. vm,
  3140. keyOrFn,
  3141. handler,
  3142. options
  3143. ) {
  3144. if (isPlainObject(handler)) {
  3145. options = handler;
  3146. handler = handler.handler;
  3147. }
  3148. if (typeof handler === 'string') {
  3149. handler = vm[handler];
  3150. }
  3151. return vm.$watch(keyOrFn, handler, options)
  3152. }
  3153. function stateMixin (Vue) {
  3154. // flow somehow has problems with directly declared definition object
  3155. // when using Object.defineProperty, so we have to procedurally build up
  3156. // the object here.
  3157. var dataDef = {};
  3158. dataDef.get = function () { return this._data };
  3159. var propsDef = {};
  3160. propsDef.get = function () { return this._props };
  3161. {
  3162. dataDef.set = function (newData) {
  3163. warn(
  3164. 'Avoid replacing instance root $data. ' +
  3165. 'Use nested data properties instead.',
  3166. this
  3167. );
  3168. };
  3169. propsDef.set = function () {
  3170. warn("$props is readonly.", this);
  3171. };
  3172. }
  3173. Object.defineProperty(Vue.prototype, '$data', dataDef);
  3174. Object.defineProperty(Vue.prototype, '$props', propsDef);
  3175. Vue.prototype.$set = set;
  3176. Vue.prototype.$delete = del;
  3177. Vue.prototype.$watch = function (
  3178. expOrFn,
  3179. cb,
  3180. options
  3181. ) {
  3182. var vm = this;
  3183. if (isPlainObject(cb)) {
  3184. return createWatcher(vm, expOrFn, cb, options)
  3185. }
  3186. options = options || {};
  3187. options.user = true;
  3188. var watcher = new Watcher(vm, expOrFn, cb, options);
  3189. if (options.immediate) {
  3190. cb.call(vm, watcher.value);
  3191. }
  3192. return function unwatchFn () {
  3193. watcher.teardown();
  3194. }
  3195. };
  3196. }
  3197. /* */
  3198. function initProvide (vm) {
  3199. var provide = vm.$options.provide;
  3200. if (provide) {
  3201. vm._provided = typeof provide === 'function'
  3202. ? provide.call(vm)
  3203. : provide;
  3204. }
  3205. }
  3206. function initInjections (vm) {
  3207. var result = resolveInject(vm.$options.inject, vm);
  3208. if (result) {
  3209. observerState.shouldConvert = false;
  3210. Object.keys(result).forEach(function (key) {
  3211. /* istanbul ignore else */
  3212. {
  3213. defineReactive(vm, key, result[key], function () {
  3214. warn(
  3215. "Avoid mutating an injected value directly since the changes will be " +
  3216. "overwritten whenever the provided component re-renders. " +
  3217. "injection being mutated: \"" + key + "\"",
  3218. vm
  3219. );
  3220. });
  3221. }
  3222. });
  3223. observerState.shouldConvert = true;
  3224. }
  3225. }
  3226. function resolveInject (inject, vm) {
  3227. if (inject) {
  3228. // inject is :any because flow is not smart enough to figure out cached
  3229. var result = Object.create(null);
  3230. var keys = hasSymbol
  3231. ? Reflect.ownKeys(inject).filter(function (key) {
  3232. /* istanbul ignore next */
  3233. return Object.getOwnPropertyDescriptor(inject, key).enumerable
  3234. })
  3235. : Object.keys(inject);
  3236. for (var i = 0; i < keys.length; i++) {
  3237. var key = keys[i];
  3238. var provideKey = inject[key].from;
  3239. var source = vm;
  3240. while (source) {
  3241. if (source._provided && provideKey in source._provided) {
  3242. result[key] = source._provided[provideKey];
  3243. break
  3244. }
  3245. source = source.$parent;
  3246. }
  3247. if (!source) {
  3248. if ('default' in inject[key]) {
  3249. var provideDefault = inject[key].default;
  3250. result[key] = typeof provideDefault === 'function'
  3251. ? provideDefault.call(vm)
  3252. : provideDefault;
  3253. } else {
  3254. warn(("Injection \"" + key + "\" not found"), vm);
  3255. }
  3256. }
  3257. }
  3258. return result
  3259. }
  3260. }
  3261. /* */
  3262. /**
  3263. * Runtime helper for rendering v-for lists.
  3264. */
  3265. function renderList (
  3266. val,
  3267. render
  3268. ) {
  3269. var ret, i, l, keys, key;
  3270. if (Array.isArray(val) || typeof val === 'string') {
  3271. ret = new Array(val.length);
  3272. for (i = 0, l = val.length; i < l; i++) {
  3273. ret[i] = render(val[i], i);
  3274. }
  3275. } else if (typeof val === 'number') {
  3276. ret = new Array(val);
  3277. for (i = 0; i < val; i++) {
  3278. ret[i] = render(i + 1, i);
  3279. }
  3280. } else if (isObject(val)) {
  3281. keys = Object.keys(val);
  3282. ret = new Array(keys.length);
  3283. for (i = 0, l = keys.length; i < l; i++) {
  3284. key = keys[i];
  3285. ret[i] = render(val[key], key, i);
  3286. }
  3287. }
  3288. if (isDef(ret)) {
  3289. (ret)._isVList = true;
  3290. }
  3291. return ret
  3292. }
  3293. /* */
  3294. /**
  3295. * Runtime helper for rendering <slot>
  3296. */
  3297. function renderSlot (
  3298. name,
  3299. fallback,
  3300. props,
  3301. bindObject
  3302. ) {
  3303. var scopedSlotFn = this.$scopedSlots[name];
  3304. if (scopedSlotFn) { // scoped slot
  3305. props = props || {};
  3306. if (bindObject) {
  3307. if ("development" !== 'production' && !isObject(bindObject)) {
  3308. warn(
  3309. 'slot v-bind without argument expects an Object',
  3310. this
  3311. );
  3312. }
  3313. props = extend(extend({}, bindObject), props);
  3314. }
  3315. return scopedSlotFn(props) || fallback
  3316. } else {
  3317. var slotNodes = this.$slots[name];
  3318. // warn duplicate slot usage
  3319. if (slotNodes && "development" !== 'production') {
  3320. slotNodes._rendered && warn(
  3321. "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
  3322. "- this will likely cause render errors.",
  3323. this
  3324. );
  3325. slotNodes._rendered = true;
  3326. }
  3327. return slotNodes || fallback
  3328. }
  3329. }
  3330. /* */
  3331. /**
  3332. * Runtime helper for resolving filters
  3333. */
  3334. function resolveFilter (id) {
  3335. return resolveAsset(this.$options, 'filters', id, true) || identity
  3336. }
  3337. /* */
  3338. /**
  3339. * Runtime helper for checking keyCodes from config.
  3340. * exposed as Vue.prototype._k
  3341. * passing in eventKeyName as last argument separately for backwards compat
  3342. */
  3343. function checkKeyCodes (
  3344. eventKeyCode,
  3345. key,
  3346. builtInAlias,
  3347. eventKeyName
  3348. ) {
  3349. var keyCodes = config.keyCodes[key] || builtInAlias;
  3350. if (keyCodes) {
  3351. if (Array.isArray(keyCodes)) {
  3352. return keyCodes.indexOf(eventKeyCode) === -1
  3353. } else {
  3354. return keyCodes !== eventKeyCode
  3355. }
  3356. } else if (eventKeyName) {
  3357. return hyphenate(eventKeyName) !== key
  3358. }
  3359. }
  3360. /* */
  3361. /**
  3362. * Runtime helper for merging v-bind="object" into a VNode's data.
  3363. */
  3364. function bindObjectProps (
  3365. data,
  3366. tag,
  3367. value,
  3368. asProp,
  3369. isSync
  3370. ) {
  3371. if (value) {
  3372. if (!isObject(value)) {
  3373. "development" !== 'production' && warn(
  3374. 'v-bind without argument expects an Object or Array value',
  3375. this
  3376. );
  3377. } else {
  3378. if (Array.isArray(value)) {
  3379. value = toObject(value);
  3380. }
  3381. var hash;
  3382. var loop = function ( key ) {
  3383. if (
  3384. key === 'class' ||
  3385. key === 'style' ||
  3386. isReservedAttribute(key)
  3387. ) {
  3388. hash = data;
  3389. } else {
  3390. var type = data.attrs && data.attrs.type;
  3391. hash = asProp || config.mustUseProp(tag, type, key)
  3392. ? data.domProps || (data.domProps = {})
  3393. : data.attrs || (data.attrs = {});
  3394. }
  3395. if (!(key in hash)) {
  3396. hash[key] = value[key];
  3397. if (isSync) {
  3398. var on = data.on || (data.on = {});
  3399. on[("update:" + key)] = function ($event) {
  3400. value[key] = $event;
  3401. };
  3402. }
  3403. }
  3404. };
  3405. for (var key in value) loop( key );
  3406. }
  3407. }
  3408. return data
  3409. }
  3410. /* */
  3411. /**
  3412. * Runtime helper for rendering static trees.
  3413. */
  3414. function renderStatic (
  3415. index,
  3416. isInFor
  3417. ) {
  3418. // static trees can be rendered once and cached on the contructor options
  3419. // so every instance shares the same cached trees
  3420. var renderFns = this.$options.staticRenderFns;
  3421. var cached = renderFns.cached || (renderFns.cached = []);
  3422. var tree = cached[index];
  3423. // if has already-rendered static tree and not inside v-for,
  3424. // we can reuse the same tree by doing a shallow clone.
  3425. if (tree && !isInFor) {
  3426. return Array.isArray(tree)
  3427. ? cloneVNodes(tree)
  3428. : cloneVNode(tree)
  3429. }
  3430. // otherwise, render a fresh tree.
  3431. tree = cached[index] = renderFns[index].call(this._renderProxy, null, this);
  3432. markStatic(tree, ("__static__" + index), false);
  3433. return tree
  3434. }
  3435. /**
  3436. * Runtime helper for v-once.
  3437. * Effectively it means marking the node as static with a unique key.
  3438. */
  3439. function markOnce (
  3440. tree,
  3441. index,
  3442. key
  3443. ) {
  3444. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  3445. return tree
  3446. }
  3447. function markStatic (
  3448. tree,
  3449. key,
  3450. isOnce
  3451. ) {
  3452. if (Array.isArray(tree)) {
  3453. for (var i = 0; i < tree.length; i++) {
  3454. if (tree[i] && typeof tree[i] !== 'string') {
  3455. markStaticNode(tree[i], (key + "_" + i), isOnce);
  3456. }
  3457. }
  3458. } else {
  3459. markStaticNode(tree, key, isOnce);
  3460. }
  3461. }
  3462. function markStaticNode (node, key, isOnce) {
  3463. node.isStatic = true;
  3464. node.key = key;
  3465. node.isOnce = isOnce;
  3466. }
  3467. /* */
  3468. function bindObjectListeners (data, value) {
  3469. if (value) {
  3470. if (!isPlainObject(value)) {
  3471. "development" !== 'production' && warn(
  3472. 'v-on without argument expects an Object value',
  3473. this
  3474. );
  3475. } else {
  3476. var on = data.on = data.on ? extend({}, data.on) : {};
  3477. for (var key in value) {
  3478. var existing = on[key];
  3479. var ours = value[key];
  3480. on[key] = existing ? [].concat(existing, ours) : ours;
  3481. }
  3482. }
  3483. }
  3484. return data
  3485. }
  3486. /* */
  3487. function installRenderHelpers (target) {
  3488. target._o = markOnce;
  3489. target._n = toNumber;
  3490. target._s = toString;
  3491. target._l = renderList;
  3492. target._t = renderSlot;
  3493. target._q = looseEqual;
  3494. target._i = looseIndexOf;
  3495. target._m = renderStatic;
  3496. target._f = resolveFilter;
  3497. target._k = checkKeyCodes;
  3498. target._b = bindObjectProps;
  3499. target._v = createTextVNode;
  3500. target._e = createEmptyVNode;
  3501. target._u = resolveScopedSlots;
  3502. target._g = bindObjectListeners;
  3503. }
  3504. /* */
  3505. function FunctionalRenderContext (
  3506. data,
  3507. props,
  3508. children,
  3509. parent,
  3510. Ctor
  3511. ) {
  3512. var options = Ctor.options;
  3513. this.data = data;
  3514. this.props = props;
  3515. this.children = children;
  3516. this.parent = parent;
  3517. this.listeners = data.on || emptyObject;
  3518. this.injections = resolveInject(options.inject, parent);
  3519. this.slots = function () { return resolveSlots(children, parent); };
  3520. // ensure the createElement function in functional components
  3521. // gets a unique context - this is necessary for correct named slot check
  3522. var contextVm = Object.create(parent);
  3523. var isCompiled = isTrue(options._compiled);
  3524. var needNormalization = !isCompiled;
  3525. // support for compiled functional template
  3526. if (isCompiled) {
  3527. // exposing $options for renderStatic()
  3528. this.$options = options;
  3529. // pre-resolve slots for renderSlot()
  3530. this.$slots = this.slots();
  3531. this.$scopedSlots = data.scopedSlots || emptyObject;
  3532. }
  3533. if (options._scopeId) {
  3534. this._c = function (a, b, c, d) {
  3535. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  3536. if (vnode) {
  3537. vnode.functionalScopeId = options._scopeId;
  3538. vnode.functionalContext = parent;
  3539. }
  3540. return vnode
  3541. };
  3542. } else {
  3543. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  3544. }
  3545. }
  3546. installRenderHelpers(FunctionalRenderContext.prototype);
  3547. function createFunctionalComponent (
  3548. Ctor,
  3549. propsData,
  3550. data,
  3551. contextVm,
  3552. children
  3553. ) {
  3554. var options = Ctor.options;
  3555. var props = {};
  3556. var propOptions = options.props;
  3557. if (isDef(propOptions)) {
  3558. for (var key in propOptions) {
  3559. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  3560. }
  3561. } else {
  3562. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  3563. if (isDef(data.props)) { mergeProps(props, data.props); }
  3564. }
  3565. var renderContext = new FunctionalRenderContext(
  3566. data,
  3567. props,
  3568. children,
  3569. contextVm,
  3570. Ctor
  3571. );
  3572. var vnode = options.render.call(null, renderContext._c, renderContext);
  3573. if (vnode instanceof VNode) {
  3574. vnode.functionalContext = contextVm;
  3575. vnode.functionalOptions = options;
  3576. if (data.slot) {
  3577. (vnode.data || (vnode.data = {})).slot = data.slot;
  3578. }
  3579. }
  3580. return vnode
  3581. }
  3582. function mergeProps (to, from) {
  3583. for (var key in from) {
  3584. to[camelize(key)] = from[key];
  3585. }
  3586. }
  3587. /* */
  3588. // hooks to be invoked on component VNodes during patch
  3589. var componentVNodeHooks = {
  3590. init: function init (
  3591. vnode,
  3592. hydrating,
  3593. parentElm,
  3594. refElm
  3595. ) {
  3596. if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) {
  3597. var child = vnode.componentInstance = createComponentInstanceForVnode(
  3598. vnode,
  3599. activeInstance,
  3600. parentElm,
  3601. refElm
  3602. );
  3603. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  3604. } else if (vnode.data.keepAlive) {
  3605. // kept-alive components, treat as a patch
  3606. var mountedNode = vnode; // work around flow
  3607. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  3608. }
  3609. },
  3610. prepatch: function prepatch (oldVnode, vnode) {
  3611. var options = vnode.componentOptions;
  3612. var child = vnode.componentInstance = oldVnode.componentInstance;
  3613. updateChildComponent(
  3614. child,
  3615. options.propsData, // updated props
  3616. options.listeners, // updated listeners
  3617. vnode, // new parent vnode
  3618. options.children // new children
  3619. );
  3620. },
  3621. insert: function insert (vnode) {
  3622. var context = vnode.context;
  3623. var componentInstance = vnode.componentInstance;
  3624. if (!componentInstance._isMounted) {
  3625. componentInstance._isMounted = true;
  3626. callHook(componentInstance, 'mounted');
  3627. }
  3628. if (vnode.data.keepAlive) {
  3629. if (context._isMounted) {
  3630. // vue-router#1212
  3631. // During updates, a kept-alive component's child components may
  3632. // change, so directly walking the tree here may call activated hooks
  3633. // on incorrect children. Instead we push them into a queue which will
  3634. // be processed after the whole patch process ended.
  3635. queueActivatedComponent(componentInstance);
  3636. } else {
  3637. activateChildComponent(componentInstance, true /* direct */);
  3638. }
  3639. }
  3640. },
  3641. destroy: function destroy (vnode) {
  3642. var componentInstance = vnode.componentInstance;
  3643. if (!componentInstance._isDestroyed) {
  3644. if (!vnode.data.keepAlive) {
  3645. componentInstance.$destroy();
  3646. } else {
  3647. deactivateChildComponent(componentInstance, true /* direct */);
  3648. }
  3649. }
  3650. }
  3651. };
  3652. var hooksToMerge = Object.keys(componentVNodeHooks);
  3653. function createComponent (
  3654. Ctor,
  3655. data,
  3656. context,
  3657. children,
  3658. tag
  3659. ) {
  3660. if (isUndef(Ctor)) {
  3661. return
  3662. }
  3663. var baseCtor = context.$options._base;
  3664. // plain options object: turn it into a constructor
  3665. if (isObject(Ctor)) {
  3666. Ctor = baseCtor.extend(Ctor);
  3667. }
  3668. // if at this stage it's not a constructor or an async component factory,
  3669. // reject.
  3670. if (typeof Ctor !== 'function') {
  3671. {
  3672. warn(("Invalid Component definition: " + (String(Ctor))), context);
  3673. }
  3674. return
  3675. }
  3676. // async component
  3677. var asyncFactory;
  3678. if (isUndef(Ctor.cid)) {
  3679. asyncFactory = Ctor;
  3680. Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context);
  3681. if (Ctor === undefined) {
  3682. // return a placeholder node for async component, which is rendered
  3683. // as a comment node but preserves all the raw information for the node.
  3684. // the information will be used for async server-rendering and hydration.
  3685. return createAsyncPlaceholder(
  3686. asyncFactory,
  3687. data,
  3688. context,
  3689. children,
  3690. tag
  3691. )
  3692. }
  3693. }
  3694. data = data || {};
  3695. // resolve constructor options in case global mixins are applied after
  3696. // component constructor creation
  3697. resolveConstructorOptions(Ctor);
  3698. // transform component v-model data into props & events
  3699. if (isDef(data.model)) {
  3700. transformModel(Ctor.options, data);
  3701. }
  3702. // extract props
  3703. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  3704. // functional component
  3705. if (isTrue(Ctor.options.functional)) {
  3706. return createFunctionalComponent(Ctor, propsData, data, context, children)
  3707. }
  3708. // extract listeners, since these needs to be treated as
  3709. // child component listeners instead of DOM listeners
  3710. var listeners = data.on;
  3711. // replace with listeners with .native modifier
  3712. // so it gets processed during parent component patch.
  3713. data.on = data.nativeOn;
  3714. if (isTrue(Ctor.options.abstract)) {
  3715. // abstract components do not keep anything
  3716. // other than props & listeners & slot
  3717. // work around flow
  3718. var slot = data.slot;
  3719. data = {};
  3720. if (slot) {
  3721. data.slot = slot;
  3722. }
  3723. }
  3724. // merge component management hooks onto the placeholder node
  3725. mergeHooks(data);
  3726. // return a placeholder vnode
  3727. var name = Ctor.options.name || tag;
  3728. var vnode = new VNode(
  3729. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  3730. data, undefined, undefined, undefined, context,
  3731. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  3732. asyncFactory
  3733. );
  3734. return vnode
  3735. }
  3736. function createComponentInstanceForVnode (
  3737. vnode, // we know it's MountedComponentVNode but flow doesn't
  3738. parent, // activeInstance in lifecycle state
  3739. parentElm,
  3740. refElm
  3741. ) {
  3742. var vnodeComponentOptions = vnode.componentOptions;
  3743. var options = {
  3744. _isComponent: true,
  3745. parent: parent,
  3746. propsData: vnodeComponentOptions.propsData,
  3747. _componentTag: vnodeComponentOptions.tag,
  3748. _parentVnode: vnode,
  3749. _parentListeners: vnodeComponentOptions.listeners,
  3750. _renderChildren: vnodeComponentOptions.children,
  3751. _parentElm: parentElm || null,
  3752. _refElm: refElm || null
  3753. };
  3754. // check inline-template render functions
  3755. var inlineTemplate = vnode.data.inlineTemplate;
  3756. if (isDef(inlineTemplate)) {
  3757. options.render = inlineTemplate.render;
  3758. options.staticRenderFns = inlineTemplate.staticRenderFns;
  3759. }
  3760. return new vnodeComponentOptions.Ctor(options)
  3761. }
  3762. function mergeHooks (data) {
  3763. if (!data.hook) {
  3764. data.hook = {};
  3765. }
  3766. for (var i = 0; i < hooksToMerge.length; i++) {
  3767. var key = hooksToMerge[i];
  3768. var fromParent = data.hook[key];
  3769. var ours = componentVNodeHooks[key];
  3770. data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
  3771. }
  3772. }
  3773. function mergeHook$1 (one, two) {
  3774. return function (a, b, c, d) {
  3775. one(a, b, c, d);
  3776. two(a, b, c, d);
  3777. }
  3778. }
  3779. // transform component v-model info (value and callback) into
  3780. // prop and event handler respectively.
  3781. function transformModel (options, data) {
  3782. var prop = (options.model && options.model.prop) || 'value';
  3783. var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value;
  3784. var on = data.on || (data.on = {});
  3785. if (isDef(on[event])) {
  3786. on[event] = [data.model.callback].concat(on[event]);
  3787. } else {
  3788. on[event] = data.model.callback;
  3789. }
  3790. }
  3791. /* */
  3792. var SIMPLE_NORMALIZE = 1;
  3793. var ALWAYS_NORMALIZE = 2;
  3794. // wrapper function for providing a more flexible interface
  3795. // without getting yelled at by flow
  3796. function createElement (
  3797. context,
  3798. tag,
  3799. data,
  3800. children,
  3801. normalizationType,
  3802. alwaysNormalize
  3803. ) {
  3804. if (Array.isArray(data) || isPrimitive(data)) {
  3805. normalizationType = children;
  3806. children = data;
  3807. data = undefined;
  3808. }
  3809. if (isTrue(alwaysNormalize)) {
  3810. normalizationType = ALWAYS_NORMALIZE;
  3811. }
  3812. return _createElement(context, tag, data, children, normalizationType)
  3813. }
  3814. function _createElement (
  3815. context,
  3816. tag,
  3817. data,
  3818. children,
  3819. normalizationType
  3820. ) {
  3821. if (isDef(data) && isDef((data).__ob__)) {
  3822. "development" !== 'production' && warn(
  3823. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  3824. 'Always create fresh vnode data objects in each render!',
  3825. context
  3826. );
  3827. return createEmptyVNode()
  3828. }
  3829. // object syntax in v-bind
  3830. if (isDef(data) && isDef(data.is)) {
  3831. tag = data.is;
  3832. }
  3833. if (!tag) {
  3834. // in case of component :is set to falsy value
  3835. return createEmptyVNode()
  3836. }
  3837. // warn against non-primitive key
  3838. if ("development" !== 'production' &&
  3839. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  3840. ) {
  3841. warn(
  3842. 'Avoid using non-primitive value as key, ' +
  3843. 'use string/number value instead.',
  3844. context
  3845. );
  3846. }
  3847. // support single function children as default scoped slot
  3848. if (Array.isArray(children) &&
  3849. typeof children[0] === 'function'
  3850. ) {
  3851. data = data || {};
  3852. data.scopedSlots = { default: children[0] };
  3853. children.length = 0;
  3854. }
  3855. if (normalizationType === ALWAYS_NORMALIZE) {
  3856. children = normalizeChildren(children);
  3857. } else if (normalizationType === SIMPLE_NORMALIZE) {
  3858. children = simpleNormalizeChildren(children);
  3859. }
  3860. var vnode, ns;
  3861. if (typeof tag === 'string') {
  3862. var Ctor;
  3863. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  3864. if (config.isReservedTag(tag)) {
  3865. // platform built-in elements
  3866. vnode = new VNode(
  3867. config.parsePlatformTagName(tag), data, children,
  3868. undefined, undefined, context
  3869. );
  3870. } else if (isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  3871. // component
  3872. vnode = createComponent(Ctor, data, context, children, tag);
  3873. } else {
  3874. // unknown or unlisted namespaced elements
  3875. // check at runtime because it may get assigned a namespace when its
  3876. // parent normalizes children
  3877. vnode = new VNode(
  3878. tag, data, children,
  3879. undefined, undefined, context
  3880. );
  3881. }
  3882. } else {
  3883. // direct component options / constructor
  3884. vnode = createComponent(tag, data, context, children);
  3885. }
  3886. if (isDef(vnode)) {
  3887. if (ns) { applyNS(vnode, ns); }
  3888. return vnode
  3889. } else {
  3890. return createEmptyVNode()
  3891. }
  3892. }
  3893. function applyNS (vnode, ns, force) {
  3894. vnode.ns = ns;
  3895. if (vnode.tag === 'foreignObject') {
  3896. // use default namespace inside foreignObject
  3897. ns = undefined;
  3898. force = true;
  3899. }
  3900. if (isDef(vnode.children)) {
  3901. for (var i = 0, l = vnode.children.length; i < l; i++) {
  3902. var child = vnode.children[i];
  3903. if (isDef(child.tag) && (isUndef(child.ns) || isTrue(force))) {
  3904. applyNS(child, ns, force);
  3905. }
  3906. }
  3907. }
  3908. }
  3909. /* */
  3910. function initRender (vm) {
  3911. vm._vnode = null; // the root of the child tree
  3912. var options = vm.$options;
  3913. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  3914. var renderContext = parentVnode && parentVnode.context;
  3915. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  3916. vm.$scopedSlots = emptyObject;
  3917. // bind the createElement fn to this instance
  3918. // so that we get proper render context inside it.
  3919. // args order: tag, data, children, normalizationType, alwaysNormalize
  3920. // internal version is used by render functions compiled from templates
  3921. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  3922. // normalization is always applied for the public version, used in
  3923. // user-written render functions.
  3924. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  3925. // $attrs & $listeners are exposed for easier HOC creation.
  3926. // they need to be reactive so that HOCs using them are always updated
  3927. var parentData = parentVnode && parentVnode.data;
  3928. /* istanbul ignore else */
  3929. {
  3930. defineReactive(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  3931. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  3932. }, true);
  3933. defineReactive(vm, '$listeners', options._parentListeners || emptyObject, function () {
  3934. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  3935. }, true);
  3936. }
  3937. }
  3938. function renderMixin (Vue) {
  3939. // install runtime convenience helpers
  3940. installRenderHelpers(Vue.prototype);
  3941. Vue.prototype.$nextTick = function (fn) {
  3942. return nextTick(fn, this)
  3943. };
  3944. Vue.prototype._render = function () {
  3945. var vm = this;
  3946. var ref = vm.$options;
  3947. var render = ref.render;
  3948. var _parentVnode = ref._parentVnode;
  3949. if (vm._isMounted) {
  3950. // if the parent didn't update, the slot nodes will be the ones from
  3951. // last render. They need to be cloned to ensure "freshness" for this render.
  3952. for (var key in vm.$slots) {
  3953. var slot = vm.$slots[key];
  3954. if (slot._rendered) {
  3955. vm.$slots[key] = cloneVNodes(slot, true /* deep */);
  3956. }
  3957. }
  3958. }
  3959. vm.$scopedSlots = (_parentVnode && _parentVnode.data.scopedSlots) || emptyObject;
  3960. // set parent vnode. this allows render functions to have access
  3961. // to the data on the placeholder node.
  3962. vm.$vnode = _parentVnode;
  3963. // render self
  3964. var vnode;
  3965. try {
  3966. vnode = render.call(vm._renderProxy, vm.$createElement);
  3967. } catch (e) {
  3968. handleError(e, vm, "render");
  3969. // return error render result,
  3970. // or previous vnode to prevent render error causing blank component
  3971. /* istanbul ignore else */
  3972. {
  3973. if (vm.$options.renderError) {
  3974. try {
  3975. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  3976. } catch (e) {
  3977. handleError(e, vm, "renderError");
  3978. vnode = vm._vnode;
  3979. }
  3980. } else {
  3981. vnode = vm._vnode;
  3982. }
  3983. }
  3984. }
  3985. // return empty vnode in case the render function errored out
  3986. if (!(vnode instanceof VNode)) {
  3987. if ("development" !== 'production' && Array.isArray(vnode)) {
  3988. warn(
  3989. 'Multiple root nodes returned from render function. Render function ' +
  3990. 'should return a single root node.',
  3991. vm
  3992. );
  3993. }
  3994. vnode = createEmptyVNode();
  3995. }
  3996. // set parent
  3997. vnode.parent = _parentVnode;
  3998. return vnode
  3999. };
  4000. }
  4001. /* */
  4002. var uid$1 = 0;
  4003. function initMixin (Vue) {
  4004. Vue.prototype._init = function (options) {
  4005. var vm = this;
  4006. // a uid
  4007. vm._uid = uid$1++;
  4008. var startTag, endTag;
  4009. /* istanbul ignore if */
  4010. if ("development" !== 'production' && config.performance && mark) {
  4011. startTag = "vue-perf-start:" + (vm._uid);
  4012. endTag = "vue-perf-end:" + (vm._uid);
  4013. mark(startTag);
  4014. }
  4015. // a flag to avoid this being observed
  4016. vm._isVue = true;
  4017. // merge options
  4018. if (options && options._isComponent) {
  4019. // optimize internal component instantiation
  4020. // since dynamic options merging is pretty slow, and none of the
  4021. // internal component options needs special treatment.
  4022. initInternalComponent(vm, options);
  4023. } else {
  4024. vm.$options = mergeOptions(
  4025. resolveConstructorOptions(vm.constructor),
  4026. options || {},
  4027. vm
  4028. );
  4029. }
  4030. /* istanbul ignore else */
  4031. {
  4032. initProxy(vm);
  4033. }
  4034. // expose real self
  4035. vm._self = vm;
  4036. initLifecycle(vm);
  4037. initEvents(vm);
  4038. initRender(vm);
  4039. callHook(vm, 'beforeCreate');
  4040. initInjections(vm); // resolve injections before data/props
  4041. initState(vm);
  4042. initProvide(vm); // resolve provide after data/props
  4043. callHook(vm, 'created');
  4044. /* istanbul ignore if */
  4045. if ("development" !== 'production' && config.performance && mark) {
  4046. vm._name = formatComponentName(vm, false);
  4047. mark(endTag);
  4048. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  4049. }
  4050. if (vm.$options.el) {
  4051. vm.$mount(vm.$options.el);
  4052. }
  4053. };
  4054. }
  4055. function initInternalComponent (vm, options) {
  4056. var opts = vm.$options = Object.create(vm.constructor.options);
  4057. // doing this because it's faster than dynamic enumeration.
  4058. opts.parent = options.parent;
  4059. opts.propsData = options.propsData;
  4060. opts._parentVnode = options._parentVnode;
  4061. opts._parentListeners = options._parentListeners;
  4062. opts._renderChildren = options._renderChildren;
  4063. opts._componentTag = options._componentTag;
  4064. opts._parentElm = options._parentElm;
  4065. opts._refElm = options._refElm;
  4066. if (options.render) {
  4067. opts.render = options.render;
  4068. opts.staticRenderFns = options.staticRenderFns;
  4069. }
  4070. }
  4071. function resolveConstructorOptions (Ctor) {
  4072. var options = Ctor.options;
  4073. if (Ctor.super) {
  4074. var superOptions = resolveConstructorOptions(Ctor.super);
  4075. var cachedSuperOptions = Ctor.superOptions;
  4076. if (superOptions !== cachedSuperOptions) {
  4077. // super option changed,
  4078. // need to resolve new options.
  4079. Ctor.superOptions = superOptions;
  4080. // check if there are any late-modified/attached options (#4976)
  4081. var modifiedOptions = resolveModifiedOptions(Ctor);
  4082. // update base extend options
  4083. if (modifiedOptions) {
  4084. extend(Ctor.extendOptions, modifiedOptions);
  4085. }
  4086. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4087. if (options.name) {
  4088. options.components[options.name] = Ctor;
  4089. }
  4090. }
  4091. }
  4092. return options
  4093. }
  4094. function resolveModifiedOptions (Ctor) {
  4095. var modified;
  4096. var latest = Ctor.options;
  4097. var extended = Ctor.extendOptions;
  4098. var sealed = Ctor.sealedOptions;
  4099. for (var key in latest) {
  4100. if (latest[key] !== sealed[key]) {
  4101. if (!modified) { modified = {}; }
  4102. modified[key] = dedupe(latest[key], extended[key], sealed[key]);
  4103. }
  4104. }
  4105. return modified
  4106. }
  4107. function dedupe (latest, extended, sealed) {
  4108. // compare latest and sealed to ensure lifecycle hooks won't be duplicated
  4109. // between merges
  4110. if (Array.isArray(latest)) {
  4111. var res = [];
  4112. sealed = Array.isArray(sealed) ? sealed : [sealed];
  4113. extended = Array.isArray(extended) ? extended : [extended];
  4114. for (var i = 0; i < latest.length; i++) {
  4115. // push original options and not sealed options to exclude duplicated options
  4116. if (extended.indexOf(latest[i]) >= 0 || sealed.indexOf(latest[i]) < 0) {
  4117. res.push(latest[i]);
  4118. }
  4119. }
  4120. return res
  4121. } else {
  4122. return latest
  4123. }
  4124. }
  4125. function Vue$3 (options) {
  4126. if ("development" !== 'production' &&
  4127. !(this instanceof Vue$3)
  4128. ) {
  4129. warn('Vue is a constructor and should be called with the `new` keyword');
  4130. }
  4131. this._init(options);
  4132. }
  4133. initMixin(Vue$3);
  4134. stateMixin(Vue$3);
  4135. eventsMixin(Vue$3);
  4136. lifecycleMixin(Vue$3);
  4137. renderMixin(Vue$3);
  4138. /* */
  4139. function initUse (Vue) {
  4140. Vue.use = function (plugin) {
  4141. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  4142. if (installedPlugins.indexOf(plugin) > -1) {
  4143. return this
  4144. }
  4145. // additional parameters
  4146. var args = toArray(arguments, 1);
  4147. args.unshift(this);
  4148. if (typeof plugin.install === 'function') {
  4149. plugin.install.apply(plugin, args);
  4150. } else if (typeof plugin === 'function') {
  4151. plugin.apply(null, args);
  4152. }
  4153. installedPlugins.push(plugin);
  4154. return this
  4155. };
  4156. }
  4157. /* */
  4158. function initMixin$1 (Vue) {
  4159. Vue.mixin = function (mixin) {
  4160. this.options = mergeOptions(this.options, mixin);
  4161. return this
  4162. };
  4163. }
  4164. /* */
  4165. function initExtend (Vue) {
  4166. /**
  4167. * Each instance constructor, including Vue, has a unique
  4168. * cid. This enables us to create wrapped "child
  4169. * constructors" for prototypal inheritance and cache them.
  4170. */
  4171. Vue.cid = 0;
  4172. var cid = 1;
  4173. /**
  4174. * Class inheritance
  4175. */
  4176. Vue.extend = function (extendOptions) {
  4177. extendOptions = extendOptions || {};
  4178. var Super = this;
  4179. var SuperId = Super.cid;
  4180. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  4181. if (cachedCtors[SuperId]) {
  4182. return cachedCtors[SuperId]
  4183. }
  4184. var name = extendOptions.name || Super.options.name;
  4185. {
  4186. if (!/^[a-zA-Z][\w-]*$/.test(name)) {
  4187. warn(
  4188. 'Invalid component name: "' + name + '". Component names ' +
  4189. 'can only contain alphanumeric characters and the hyphen, ' +
  4190. 'and must start with a letter.'
  4191. );
  4192. }
  4193. }
  4194. var Sub = function VueComponent (options) {
  4195. this._init(options);
  4196. };
  4197. Sub.prototype = Object.create(Super.prototype);
  4198. Sub.prototype.constructor = Sub;
  4199. Sub.cid = cid++;
  4200. Sub.options = mergeOptions(
  4201. Super.options,
  4202. extendOptions
  4203. );
  4204. Sub['super'] = Super;
  4205. // For props and computed properties, we define the proxy getters on
  4206. // the Vue instances at extension time, on the extended prototype. This
  4207. // avoids Object.defineProperty calls for each instance created.
  4208. if (Sub.options.props) {
  4209. initProps$1(Sub);
  4210. }
  4211. if (Sub.options.computed) {
  4212. initComputed$1(Sub);
  4213. }
  4214. // allow further extension/mixin/plugin usage
  4215. Sub.extend = Super.extend;
  4216. Sub.mixin = Super.mixin;
  4217. Sub.use = Super.use;
  4218. // create asset registers, so extended classes
  4219. // can have their private assets too.
  4220. ASSET_TYPES.forEach(function (type) {
  4221. Sub[type] = Super[type];
  4222. });
  4223. // enable recursive self-lookup
  4224. if (name) {
  4225. Sub.options.components[name] = Sub;
  4226. }
  4227. // keep a reference to the super options at extension time.
  4228. // later at instantiation we can check if Super's options have
  4229. // been updated.
  4230. Sub.superOptions = Super.options;
  4231. Sub.extendOptions = extendOptions;
  4232. Sub.sealedOptions = extend({}, Sub.options);
  4233. // cache constructor
  4234. cachedCtors[SuperId] = Sub;
  4235. return Sub
  4236. };
  4237. }
  4238. function initProps$1 (Comp) {
  4239. var props = Comp.options.props;
  4240. for (var key in props) {
  4241. proxy(Comp.prototype, "_props", key);
  4242. }
  4243. }
  4244. function initComputed$1 (Comp) {
  4245. var computed = Comp.options.computed;
  4246. for (var key in computed) {
  4247. defineComputed(Comp.prototype, key, computed[key]);
  4248. }
  4249. }
  4250. /* */
  4251. function initAssetRegisters (Vue) {
  4252. /**
  4253. * Create asset registration methods.
  4254. */
  4255. ASSET_TYPES.forEach(function (type) {
  4256. Vue[type] = function (
  4257. id,
  4258. definition
  4259. ) {
  4260. if (!definition) {
  4261. return this.options[type + 's'][id]
  4262. } else {
  4263. /* istanbul ignore if */
  4264. {
  4265. if (type === 'component' && config.isReservedTag(id)) {
  4266. warn(
  4267. 'Do not use built-in or reserved HTML elements as component ' +
  4268. 'id: ' + id
  4269. );
  4270. }
  4271. }
  4272. if (type === 'component' && isPlainObject(definition)) {
  4273. definition.name = definition.name || id;
  4274. definition = this.options._base.extend(definition);
  4275. }
  4276. if (type === 'directive' && typeof definition === 'function') {
  4277. definition = { bind: definition, update: definition };
  4278. }
  4279. this.options[type + 's'][id] = definition;
  4280. return definition
  4281. }
  4282. };
  4283. });
  4284. }
  4285. /* */
  4286. function getComponentName (opts) {
  4287. return opts && (opts.Ctor.options.name || opts.tag)
  4288. }
  4289. function matches (pattern, name) {
  4290. if (Array.isArray(pattern)) {
  4291. return pattern.indexOf(name) > -1
  4292. } else if (typeof pattern === 'string') {
  4293. return pattern.split(',').indexOf(name) > -1
  4294. } else if (isRegExp(pattern)) {
  4295. return pattern.test(name)
  4296. }
  4297. /* istanbul ignore next */
  4298. return false
  4299. }
  4300. function pruneCache (keepAliveInstance, filter) {
  4301. var cache = keepAliveInstance.cache;
  4302. var keys = keepAliveInstance.keys;
  4303. var _vnode = keepAliveInstance._vnode;
  4304. for (var key in cache) {
  4305. var cachedNode = cache[key];
  4306. if (cachedNode) {
  4307. var name = getComponentName(cachedNode.componentOptions);
  4308. if (name && !filter(name)) {
  4309. pruneCacheEntry(cache, key, keys, _vnode);
  4310. }
  4311. }
  4312. }
  4313. }
  4314. function pruneCacheEntry (
  4315. cache,
  4316. key,
  4317. keys,
  4318. current
  4319. ) {
  4320. var cached$$1 = cache[key];
  4321. if (cached$$1 && cached$$1 !== current) {
  4322. cached$$1.componentInstance.$destroy();
  4323. }
  4324. cache[key] = null;
  4325. remove(keys, key);
  4326. }
  4327. var patternTypes = [String, RegExp, Array];
  4328. var KeepAlive = {
  4329. name: 'keep-alive',
  4330. abstract: true,
  4331. props: {
  4332. include: patternTypes,
  4333. exclude: patternTypes,
  4334. max: [String, Number]
  4335. },
  4336. created: function created () {
  4337. this.cache = Object.create(null);
  4338. this.keys = [];
  4339. },
  4340. destroyed: function destroyed () {
  4341. var this$1 = this;
  4342. for (var key in this$1.cache) {
  4343. pruneCacheEntry(this$1.cache, key, this$1.keys);
  4344. }
  4345. },
  4346. watch: {
  4347. include: function include (val) {
  4348. pruneCache(this, function (name) { return matches(val, name); });
  4349. },
  4350. exclude: function exclude (val) {
  4351. pruneCache(this, function (name) { return !matches(val, name); });
  4352. }
  4353. },
  4354. render: function render () {
  4355. var vnode = getFirstComponentChild(this.$slots.default);
  4356. var componentOptions = vnode && vnode.componentOptions;
  4357. if (componentOptions) {
  4358. // check pattern
  4359. var name = getComponentName(componentOptions);
  4360. if (name && (
  4361. (this.include && !matches(this.include, name)) ||
  4362. (this.exclude && matches(this.exclude, name))
  4363. )) {
  4364. return vnode
  4365. }
  4366. var ref = this;
  4367. var cache = ref.cache;
  4368. var keys = ref.keys;
  4369. var key = vnode.key == null
  4370. // same constructor may get registered as different local components
  4371. // so cid alone is not enough (#3269)
  4372. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  4373. : vnode.key;
  4374. if (cache[key]) {
  4375. vnode.componentInstance = cache[key].componentInstance;
  4376. // make current key freshest
  4377. remove(keys, key);
  4378. keys.push(key);
  4379. } else {
  4380. cache[key] = vnode;
  4381. keys.push(key);
  4382. // prune oldest entry
  4383. if (this.max && keys.length > parseInt(this.max)) {
  4384. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  4385. }
  4386. }
  4387. vnode.data.keepAlive = true;
  4388. }
  4389. return vnode
  4390. }
  4391. };
  4392. var builtInComponents = {
  4393. KeepAlive: KeepAlive
  4394. };
  4395. /* */
  4396. function initGlobalAPI (Vue) {
  4397. // config
  4398. var configDef = {};
  4399. configDef.get = function () { return config; };
  4400. {
  4401. configDef.set = function () {
  4402. warn(
  4403. 'Do not replace the Vue.config object, set individual fields instead.'
  4404. );
  4405. };
  4406. }
  4407. Object.defineProperty(Vue, 'config', configDef);
  4408. // exposed util methods.
  4409. // NOTE: these are not considered part of the public API - avoid relying on
  4410. // them unless you are aware of the risk.
  4411. Vue.util = {
  4412. warn: warn,
  4413. extend: extend,
  4414. mergeOptions: mergeOptions,
  4415. defineReactive: defineReactive
  4416. };
  4417. Vue.set = set;
  4418. Vue.delete = del;
  4419. Vue.nextTick = nextTick;
  4420. Vue.options = Object.create(null);
  4421. ASSET_TYPES.forEach(function (type) {
  4422. Vue.options[type + 's'] = Object.create(null);
  4423. });
  4424. // this is used to identify the "base" constructor to extend all plain-object
  4425. // components with in Weex's multi-instance scenarios.
  4426. Vue.options._base = Vue;
  4427. extend(Vue.options.components, builtInComponents);
  4428. initUse(Vue);
  4429. initMixin$1(Vue);
  4430. initExtend(Vue);
  4431. initAssetRegisters(Vue);
  4432. }
  4433. initGlobalAPI(Vue$3);
  4434. Object.defineProperty(Vue$3.prototype, '$isServer', {
  4435. get: isServerRendering
  4436. });
  4437. Object.defineProperty(Vue$3.prototype, '$ssrContext', {
  4438. get: function get () {
  4439. /* istanbul ignore next */
  4440. return this.$vnode && this.$vnode.ssrContext
  4441. }
  4442. });
  4443. Vue$3.version = '2.5.1';
  4444. /* */
  4445. // these are reserved for web because they are directly compiled away
  4446. // during template compilation
  4447. var isReservedAttr = makeMap('style,class');
  4448. // attributes that should be using props for binding
  4449. var acceptValue = makeMap('input,textarea,option,select,progress');
  4450. var mustUseProp = function (tag, type, attr) {
  4451. return (
  4452. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  4453. (attr === 'selected' && tag === 'option') ||
  4454. (attr === 'checked' && tag === 'input') ||
  4455. (attr === 'muted' && tag === 'video')
  4456. )
  4457. };
  4458. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  4459. var isBooleanAttr = makeMap(
  4460. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  4461. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  4462. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  4463. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  4464. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  4465. 'truespeed,typemustmatch,visible'
  4466. );
  4467. var xlinkNS = 'http://www.w3.org/1999/xlink';
  4468. var isXlink = function (name) {
  4469. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  4470. };
  4471. var getXlinkProp = function (name) {
  4472. return isXlink(name) ? name.slice(6, name.length) : ''
  4473. };
  4474. var isFalsyAttrValue = function (val) {
  4475. return val == null || val === false
  4476. };
  4477. /* */
  4478. function genClassForVnode (vnode) {
  4479. var data = vnode.data;
  4480. var parentNode = vnode;
  4481. var childNode = vnode;
  4482. while (isDef(childNode.componentInstance)) {
  4483. childNode = childNode.componentInstance._vnode;
  4484. if (childNode.data) {
  4485. data = mergeClassData(childNode.data, data);
  4486. }
  4487. }
  4488. while (isDef(parentNode = parentNode.parent)) {
  4489. if (parentNode.data) {
  4490. data = mergeClassData(data, parentNode.data);
  4491. }
  4492. }
  4493. return renderClass(data.staticClass, data.class)
  4494. }
  4495. function mergeClassData (child, parent) {
  4496. return {
  4497. staticClass: concat(child.staticClass, parent.staticClass),
  4498. class: isDef(child.class)
  4499. ? [child.class, parent.class]
  4500. : parent.class
  4501. }
  4502. }
  4503. function renderClass (
  4504. staticClass,
  4505. dynamicClass
  4506. ) {
  4507. if (isDef(staticClass) || isDef(dynamicClass)) {
  4508. return concat(staticClass, stringifyClass(dynamicClass))
  4509. }
  4510. /* istanbul ignore next */
  4511. return ''
  4512. }
  4513. function concat (a, b) {
  4514. return a ? b ? (a + ' ' + b) : a : (b || '')
  4515. }
  4516. function stringifyClass (value) {
  4517. if (Array.isArray(value)) {
  4518. return stringifyArray(value)
  4519. }
  4520. if (isObject(value)) {
  4521. return stringifyObject(value)
  4522. }
  4523. if (typeof value === 'string') {
  4524. return value
  4525. }
  4526. /* istanbul ignore next */
  4527. return ''
  4528. }
  4529. function stringifyArray (value) {
  4530. var res = '';
  4531. var stringified;
  4532. for (var i = 0, l = value.length; i < l; i++) {
  4533. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  4534. if (res) { res += ' '; }
  4535. res += stringified;
  4536. }
  4537. }
  4538. return res
  4539. }
  4540. function stringifyObject (value) {
  4541. var res = '';
  4542. for (var key in value) {
  4543. if (value[key]) {
  4544. if (res) { res += ' '; }
  4545. res += key;
  4546. }
  4547. }
  4548. return res
  4549. }
  4550. /* */
  4551. var namespaceMap = {
  4552. svg: 'http://www.w3.org/2000/svg',
  4553. math: 'http://www.w3.org/1998/Math/MathML'
  4554. };
  4555. var isHTMLTag = makeMap(
  4556. 'html,body,base,head,link,meta,style,title,' +
  4557. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  4558. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  4559. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  4560. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  4561. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  4562. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  4563. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  4564. 'output,progress,select,textarea,' +
  4565. 'details,dialog,menu,menuitem,summary,' +
  4566. 'content,element,shadow,template,blockquote,iframe,tfoot'
  4567. );
  4568. // this map is intentionally selective, only covering SVG elements that may
  4569. // contain child elements.
  4570. var isSVG = makeMap(
  4571. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  4572. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  4573. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  4574. true
  4575. );
  4576. var isPreTag = function (tag) { return tag === 'pre'; };
  4577. var isReservedTag = function (tag) {
  4578. return isHTMLTag(tag) || isSVG(tag)
  4579. };
  4580. function getTagNamespace (tag) {
  4581. if (isSVG(tag)) {
  4582. return 'svg'
  4583. }
  4584. // basic support for MathML
  4585. // note it doesn't support other MathML elements being component roots
  4586. if (tag === 'math') {
  4587. return 'math'
  4588. }
  4589. }
  4590. var unknownElementCache = Object.create(null);
  4591. function isUnknownElement (tag) {
  4592. /* istanbul ignore if */
  4593. if (!inBrowser) {
  4594. return true
  4595. }
  4596. if (isReservedTag(tag)) {
  4597. return false
  4598. }
  4599. tag = tag.toLowerCase();
  4600. /* istanbul ignore if */
  4601. if (unknownElementCache[tag] != null) {
  4602. return unknownElementCache[tag]
  4603. }
  4604. var el = document.createElement(tag);
  4605. if (tag.indexOf('-') > -1) {
  4606. // http://stackoverflow.com/a/28210364/1070244
  4607. return (unknownElementCache[tag] = (
  4608. el.constructor === window.HTMLUnknownElement ||
  4609. el.constructor === window.HTMLElement
  4610. ))
  4611. } else {
  4612. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  4613. }
  4614. }
  4615. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  4616. /* */
  4617. /**
  4618. * Query an element selector if it's not an element already.
  4619. */
  4620. function query (el) {
  4621. if (typeof el === 'string') {
  4622. var selected = document.querySelector(el);
  4623. if (!selected) {
  4624. "development" !== 'production' && warn(
  4625. 'Cannot find element: ' + el
  4626. );
  4627. return document.createElement('div')
  4628. }
  4629. return selected
  4630. } else {
  4631. return el
  4632. }
  4633. }
  4634. /* */
  4635. function createElement$1 (tagName, vnode) {
  4636. var elm = document.createElement(tagName);
  4637. if (tagName !== 'select') {
  4638. return elm
  4639. }
  4640. // false or null will remove the attribute but undefined will not
  4641. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  4642. elm.setAttribute('multiple', 'multiple');
  4643. }
  4644. return elm
  4645. }
  4646. function createElementNS (namespace, tagName) {
  4647. return document.createElementNS(namespaceMap[namespace], tagName)
  4648. }
  4649. function createTextNode (text) {
  4650. return document.createTextNode(text)
  4651. }
  4652. function createComment (text) {
  4653. return document.createComment(text)
  4654. }
  4655. function insertBefore (parentNode, newNode, referenceNode) {
  4656. parentNode.insertBefore(newNode, referenceNode);
  4657. }
  4658. function removeChild (node, child) {
  4659. node.removeChild(child);
  4660. }
  4661. function appendChild (node, child) {
  4662. node.appendChild(child);
  4663. }
  4664. function parentNode (node) {
  4665. return node.parentNode
  4666. }
  4667. function nextSibling (node) {
  4668. return node.nextSibling
  4669. }
  4670. function tagName (node) {
  4671. return node.tagName
  4672. }
  4673. function setTextContent (node, text) {
  4674. node.textContent = text;
  4675. }
  4676. function setAttribute (node, key, val) {
  4677. node.setAttribute(key, val);
  4678. }
  4679. var nodeOps = Object.freeze({
  4680. createElement: createElement$1,
  4681. createElementNS: createElementNS,
  4682. createTextNode: createTextNode,
  4683. createComment: createComment,
  4684. insertBefore: insertBefore,
  4685. removeChild: removeChild,
  4686. appendChild: appendChild,
  4687. parentNode: parentNode,
  4688. nextSibling: nextSibling,
  4689. tagName: tagName,
  4690. setTextContent: setTextContent,
  4691. setAttribute: setAttribute
  4692. });
  4693. /* */
  4694. var ref = {
  4695. create: function create (_, vnode) {
  4696. registerRef(vnode);
  4697. },
  4698. update: function update (oldVnode, vnode) {
  4699. if (oldVnode.data.ref !== vnode.data.ref) {
  4700. registerRef(oldVnode, true);
  4701. registerRef(vnode);
  4702. }
  4703. },
  4704. destroy: function destroy (vnode) {
  4705. registerRef(vnode, true);
  4706. }
  4707. };
  4708. function registerRef (vnode, isRemoval) {
  4709. var key = vnode.data.ref;
  4710. if (!key) { return }
  4711. var vm = vnode.context;
  4712. var ref = vnode.componentInstance || vnode.elm;
  4713. var refs = vm.$refs;
  4714. if (isRemoval) {
  4715. if (Array.isArray(refs[key])) {
  4716. remove(refs[key], ref);
  4717. } else if (refs[key] === ref) {
  4718. refs[key] = undefined;
  4719. }
  4720. } else {
  4721. if (vnode.data.refInFor) {
  4722. if (!Array.isArray(refs[key])) {
  4723. refs[key] = [ref];
  4724. } else if (refs[key].indexOf(ref) < 0) {
  4725. // $flow-disable-line
  4726. refs[key].push(ref);
  4727. }
  4728. } else {
  4729. refs[key] = ref;
  4730. }
  4731. }
  4732. }
  4733. /**
  4734. * Virtual DOM patching algorithm based on Snabbdom by
  4735. * Simon Friis Vindum (@paldepind)
  4736. * Licensed under the MIT License
  4737. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  4738. *
  4739. * modified by Evan You (@yyx990803)
  4740. *
  4741. * Not type-checking this because this file is perf-critical and the cost
  4742. * of making flow understand it is not worth it.
  4743. */
  4744. var emptyNode = new VNode('', {}, []);
  4745. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  4746. function sameVnode (a, b) {
  4747. return (
  4748. a.key === b.key && (
  4749. (
  4750. a.tag === b.tag &&
  4751. a.isComment === b.isComment &&
  4752. isDef(a.data) === isDef(b.data) &&
  4753. sameInputType(a, b)
  4754. ) || (
  4755. isTrue(a.isAsyncPlaceholder) &&
  4756. a.asyncFactory === b.asyncFactory &&
  4757. isUndef(b.asyncFactory.error)
  4758. )
  4759. )
  4760. )
  4761. }
  4762. function sameInputType (a, b) {
  4763. if (a.tag !== 'input') { return true }
  4764. var i;
  4765. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  4766. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  4767. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  4768. }
  4769. function createKeyToOldIdx (children, beginIdx, endIdx) {
  4770. var i, key;
  4771. var map = {};
  4772. for (i = beginIdx; i <= endIdx; ++i) {
  4773. key = children[i].key;
  4774. if (isDef(key)) { map[key] = i; }
  4775. }
  4776. return map
  4777. }
  4778. function createPatchFunction (backend) {
  4779. var i, j;
  4780. var cbs = {};
  4781. var modules = backend.modules;
  4782. var nodeOps = backend.nodeOps;
  4783. for (i = 0; i < hooks.length; ++i) {
  4784. cbs[hooks[i]] = [];
  4785. for (j = 0; j < modules.length; ++j) {
  4786. if (isDef(modules[j][hooks[i]])) {
  4787. cbs[hooks[i]].push(modules[j][hooks[i]]);
  4788. }
  4789. }
  4790. }
  4791. function emptyNodeAt (elm) {
  4792. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  4793. }
  4794. function createRmCb (childElm, listeners) {
  4795. function remove () {
  4796. if (--remove.listeners === 0) {
  4797. removeNode(childElm);
  4798. }
  4799. }
  4800. remove.listeners = listeners;
  4801. return remove
  4802. }
  4803. function removeNode (el) {
  4804. var parent = nodeOps.parentNode(el);
  4805. // element may have already been removed due to v-html / v-text
  4806. if (isDef(parent)) {
  4807. nodeOps.removeChild(parent, el);
  4808. }
  4809. }
  4810. var inPre = 0;
  4811. function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
  4812. vnode.isRootInsert = !nested; // for transition enter check
  4813. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  4814. return
  4815. }
  4816. var data = vnode.data;
  4817. var children = vnode.children;
  4818. var tag = vnode.tag;
  4819. if (isDef(tag)) {
  4820. {
  4821. if (data && data.pre) {
  4822. inPre++;
  4823. }
  4824. if (
  4825. !inPre &&
  4826. !vnode.ns &&
  4827. !(
  4828. config.ignoredElements.length &&
  4829. config.ignoredElements.some(function (ignore) {
  4830. return isRegExp(ignore)
  4831. ? ignore.test(tag)
  4832. : ignore === tag
  4833. })
  4834. ) &&
  4835. config.isUnknownElement(tag)
  4836. ) {
  4837. warn(
  4838. 'Unknown custom element: <' + tag + '> - did you ' +
  4839. 'register the component correctly? For recursive components, ' +
  4840. 'make sure to provide the "name" option.',
  4841. vnode.context
  4842. );
  4843. }
  4844. }
  4845. vnode.elm = vnode.ns
  4846. ? nodeOps.createElementNS(vnode.ns, tag)
  4847. : nodeOps.createElement(tag, vnode);
  4848. setScope(vnode);
  4849. /* istanbul ignore if */
  4850. {
  4851. createChildren(vnode, children, insertedVnodeQueue);
  4852. if (isDef(data)) {
  4853. invokeCreateHooks(vnode, insertedVnodeQueue);
  4854. }
  4855. insert(parentElm, vnode.elm, refElm);
  4856. }
  4857. if ("development" !== 'production' && data && data.pre) {
  4858. inPre--;
  4859. }
  4860. } else if (isTrue(vnode.isComment)) {
  4861. vnode.elm = nodeOps.createComment(vnode.text);
  4862. insert(parentElm, vnode.elm, refElm);
  4863. } else {
  4864. vnode.elm = nodeOps.createTextNode(vnode.text);
  4865. insert(parentElm, vnode.elm, refElm);
  4866. }
  4867. }
  4868. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  4869. var i = vnode.data;
  4870. if (isDef(i)) {
  4871. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  4872. if (isDef(i = i.hook) && isDef(i = i.init)) {
  4873. i(vnode, false /* hydrating */, parentElm, refElm);
  4874. }
  4875. // after calling the init hook, if the vnode is a child component
  4876. // it should've created a child instance and mounted it. the child
  4877. // component also has set the placeholder vnode's elm.
  4878. // in that case we can just return the element and be done.
  4879. if (isDef(vnode.componentInstance)) {
  4880. initComponent(vnode, insertedVnodeQueue);
  4881. if (isTrue(isReactivated)) {
  4882. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  4883. }
  4884. return true
  4885. }
  4886. }
  4887. }
  4888. function initComponent (vnode, insertedVnodeQueue) {
  4889. if (isDef(vnode.data.pendingInsert)) {
  4890. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  4891. vnode.data.pendingInsert = null;
  4892. }
  4893. vnode.elm = vnode.componentInstance.$el;
  4894. if (isPatchable(vnode)) {
  4895. invokeCreateHooks(vnode, insertedVnodeQueue);
  4896. setScope(vnode);
  4897. } else {
  4898. // empty component root.
  4899. // skip all element-related modules except for ref (#3455)
  4900. registerRef(vnode);
  4901. // make sure to invoke the insert hook
  4902. insertedVnodeQueue.push(vnode);
  4903. }
  4904. }
  4905. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  4906. var i;
  4907. // hack for #4339: a reactivated component with inner transition
  4908. // does not trigger because the inner node's created hooks are not called
  4909. // again. It's not ideal to involve module-specific logic in here but
  4910. // there doesn't seem to be a better way to do it.
  4911. var innerNode = vnode;
  4912. while (innerNode.componentInstance) {
  4913. innerNode = innerNode.componentInstance._vnode;
  4914. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  4915. for (i = 0; i < cbs.activate.length; ++i) {
  4916. cbs.activate[i](emptyNode, innerNode);
  4917. }
  4918. insertedVnodeQueue.push(innerNode);
  4919. break
  4920. }
  4921. }
  4922. // unlike a newly created component,
  4923. // a reactivated keep-alive component doesn't insert itself
  4924. insert(parentElm, vnode.elm, refElm);
  4925. }
  4926. function insert (parent, elm, ref$$1) {
  4927. if (isDef(parent)) {
  4928. if (isDef(ref$$1)) {
  4929. if (ref$$1.parentNode === parent) {
  4930. nodeOps.insertBefore(parent, elm, ref$$1);
  4931. }
  4932. } else {
  4933. nodeOps.appendChild(parent, elm);
  4934. }
  4935. }
  4936. }
  4937. function createChildren (vnode, children, insertedVnodeQueue) {
  4938. if (Array.isArray(children)) {
  4939. for (var i = 0; i < children.length; ++i) {
  4940. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true);
  4941. }
  4942. } else if (isPrimitive(vnode.text)) {
  4943. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(vnode.text));
  4944. }
  4945. }
  4946. function isPatchable (vnode) {
  4947. while (vnode.componentInstance) {
  4948. vnode = vnode.componentInstance._vnode;
  4949. }
  4950. return isDef(vnode.tag)
  4951. }
  4952. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  4953. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  4954. cbs.create[i$1](emptyNode, vnode);
  4955. }
  4956. i = vnode.data.hook; // Reuse variable
  4957. if (isDef(i)) {
  4958. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  4959. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  4960. }
  4961. }
  4962. // set scope id attribute for scoped CSS.
  4963. // this is implemented as a special case to avoid the overhead
  4964. // of going through the normal attribute patching process.
  4965. function setScope (vnode) {
  4966. var i;
  4967. if (isDef(i = vnode.functionalScopeId)) {
  4968. nodeOps.setAttribute(vnode.elm, i, '');
  4969. } else {
  4970. var ancestor = vnode;
  4971. while (ancestor) {
  4972. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  4973. nodeOps.setAttribute(vnode.elm, i, '');
  4974. }
  4975. ancestor = ancestor.parent;
  4976. }
  4977. }
  4978. // for slot content they should also get the scopeId from the host instance.
  4979. if (isDef(i = activeInstance) &&
  4980. i !== vnode.context &&
  4981. i !== vnode.functionalContext &&
  4982. isDef(i = i.$options._scopeId)
  4983. ) {
  4984. nodeOps.setAttribute(vnode.elm, i, '');
  4985. }
  4986. }
  4987. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  4988. for (; startIdx <= endIdx; ++startIdx) {
  4989. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm);
  4990. }
  4991. }
  4992. function invokeDestroyHook (vnode) {
  4993. var i, j;
  4994. var data = vnode.data;
  4995. if (isDef(data)) {
  4996. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  4997. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  4998. }
  4999. if (isDef(i = vnode.children)) {
  5000. for (j = 0; j < vnode.children.length; ++j) {
  5001. invokeDestroyHook(vnode.children[j]);
  5002. }
  5003. }
  5004. }
  5005. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  5006. for (; startIdx <= endIdx; ++startIdx) {
  5007. var ch = vnodes[startIdx];
  5008. if (isDef(ch)) {
  5009. if (isDef(ch.tag)) {
  5010. removeAndInvokeRemoveHook(ch);
  5011. invokeDestroyHook(ch);
  5012. } else { // Text node
  5013. removeNode(ch.elm);
  5014. }
  5015. }
  5016. }
  5017. }
  5018. function removeAndInvokeRemoveHook (vnode, rm) {
  5019. if (isDef(rm) || isDef(vnode.data)) {
  5020. var i;
  5021. var listeners = cbs.remove.length + 1;
  5022. if (isDef(rm)) {
  5023. // we have a recursively passed down rm callback
  5024. // increase the listeners count
  5025. rm.listeners += listeners;
  5026. } else {
  5027. // directly removing
  5028. rm = createRmCb(vnode.elm, listeners);
  5029. }
  5030. // recursively invoke hooks on child component root node
  5031. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  5032. removeAndInvokeRemoveHook(i, rm);
  5033. }
  5034. for (i = 0; i < cbs.remove.length; ++i) {
  5035. cbs.remove[i](vnode, rm);
  5036. }
  5037. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  5038. i(vnode, rm);
  5039. } else {
  5040. rm();
  5041. }
  5042. } else {
  5043. removeNode(vnode.elm);
  5044. }
  5045. }
  5046. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  5047. var oldStartIdx = 0;
  5048. var newStartIdx = 0;
  5049. var oldEndIdx = oldCh.length - 1;
  5050. var oldStartVnode = oldCh[0];
  5051. var oldEndVnode = oldCh[oldEndIdx];
  5052. var newEndIdx = newCh.length - 1;
  5053. var newStartVnode = newCh[0];
  5054. var newEndVnode = newCh[newEndIdx];
  5055. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  5056. // removeOnly is a special flag used only by <transition-group>
  5057. // to ensure removed elements stay in correct relative positions
  5058. // during leaving transitions
  5059. var canMove = !removeOnly;
  5060. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  5061. if (isUndef(oldStartVnode)) {
  5062. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  5063. } else if (isUndef(oldEndVnode)) {
  5064. oldEndVnode = oldCh[--oldEndIdx];
  5065. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  5066. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
  5067. oldStartVnode = oldCh[++oldStartIdx];
  5068. newStartVnode = newCh[++newStartIdx];
  5069. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  5070. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
  5071. oldEndVnode = oldCh[--oldEndIdx];
  5072. newEndVnode = newCh[--newEndIdx];
  5073. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  5074. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
  5075. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  5076. oldStartVnode = oldCh[++oldStartIdx];
  5077. newEndVnode = newCh[--newEndIdx];
  5078. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  5079. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
  5080. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  5081. oldEndVnode = oldCh[--oldEndIdx];
  5082. newStartVnode = newCh[++newStartIdx];
  5083. } else {
  5084. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  5085. idxInOld = isDef(newStartVnode.key)
  5086. ? oldKeyToIdx[newStartVnode.key]
  5087. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  5088. if (isUndef(idxInOld)) { // New element
  5089. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  5090. } else {
  5091. vnodeToMove = oldCh[idxInOld];
  5092. /* istanbul ignore if */
  5093. if ("development" !== 'production' && !vnodeToMove) {
  5094. warn(
  5095. 'It seems there are duplicate keys that is causing an update error. ' +
  5096. 'Make sure each v-for item has a unique key.'
  5097. );
  5098. }
  5099. if (sameVnode(vnodeToMove, newStartVnode)) {
  5100. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue);
  5101. oldCh[idxInOld] = undefined;
  5102. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  5103. } else {
  5104. // same key but different element. treat as new element
  5105. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  5106. }
  5107. }
  5108. newStartVnode = newCh[++newStartIdx];
  5109. }
  5110. }
  5111. if (oldStartIdx > oldEndIdx) {
  5112. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  5113. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  5114. } else if (newStartIdx > newEndIdx) {
  5115. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  5116. }
  5117. }
  5118. function findIdxInOld (node, oldCh, start, end) {
  5119. for (var i = start; i < end; i++) {
  5120. var c = oldCh[i];
  5121. if (isDef(c) && sameVnode(node, c)) { return i }
  5122. }
  5123. }
  5124. function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
  5125. if (oldVnode === vnode) {
  5126. return
  5127. }
  5128. var elm = vnode.elm = oldVnode.elm;
  5129. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  5130. if (isDef(vnode.asyncFactory.resolved)) {
  5131. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  5132. } else {
  5133. vnode.isAsyncPlaceholder = true;
  5134. }
  5135. return
  5136. }
  5137. // reuse element for static trees.
  5138. // note we only do this if the vnode is cloned -
  5139. // if the new node is not cloned it means the render functions have been
  5140. // reset by the hot-reload-api and we need to do a proper re-render.
  5141. if (isTrue(vnode.isStatic) &&
  5142. isTrue(oldVnode.isStatic) &&
  5143. vnode.key === oldVnode.key &&
  5144. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  5145. ) {
  5146. vnode.componentInstance = oldVnode.componentInstance;
  5147. return
  5148. }
  5149. var i;
  5150. var data = vnode.data;
  5151. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  5152. i(oldVnode, vnode);
  5153. }
  5154. var oldCh = oldVnode.children;
  5155. var ch = vnode.children;
  5156. if (isDef(data) && isPatchable(vnode)) {
  5157. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  5158. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  5159. }
  5160. if (isUndef(vnode.text)) {
  5161. if (isDef(oldCh) && isDef(ch)) {
  5162. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  5163. } else if (isDef(ch)) {
  5164. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  5165. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  5166. } else if (isDef(oldCh)) {
  5167. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  5168. } else if (isDef(oldVnode.text)) {
  5169. nodeOps.setTextContent(elm, '');
  5170. }
  5171. } else if (oldVnode.text !== vnode.text) {
  5172. nodeOps.setTextContent(elm, vnode.text);
  5173. }
  5174. if (isDef(data)) {
  5175. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  5176. }
  5177. }
  5178. function invokeInsertHook (vnode, queue, initial) {
  5179. // delay insert hooks for component root nodes, invoke them after the
  5180. // element is really inserted
  5181. if (isTrue(initial) && isDef(vnode.parent)) {
  5182. vnode.parent.data.pendingInsert = queue;
  5183. } else {
  5184. for (var i = 0; i < queue.length; ++i) {
  5185. queue[i].data.hook.insert(queue[i]);
  5186. }
  5187. }
  5188. }
  5189. var bailed = false;
  5190. // list of modules that can skip create hook during hydration because they
  5191. // are already rendered on the client or has no need for initialization
  5192. var isRenderedModule = makeMap('attrs,style,class,staticClass,staticStyle,key');
  5193. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  5194. function hydrate (elm, vnode, insertedVnodeQueue) {
  5195. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  5196. vnode.elm = elm;
  5197. vnode.isAsyncPlaceholder = true;
  5198. return true
  5199. }
  5200. {
  5201. if (!assertNodeMatch(elm, vnode)) {
  5202. return false
  5203. }
  5204. }
  5205. vnode.elm = elm;
  5206. var tag = vnode.tag;
  5207. var data = vnode.data;
  5208. var children = vnode.children;
  5209. if (isDef(data)) {
  5210. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  5211. if (isDef(i = vnode.componentInstance)) {
  5212. // child component. it should have hydrated its own tree.
  5213. initComponent(vnode, insertedVnodeQueue);
  5214. return true
  5215. }
  5216. }
  5217. if (isDef(tag)) {
  5218. if (isDef(children)) {
  5219. // empty element, allow client to pick up and populate children
  5220. if (!elm.hasChildNodes()) {
  5221. createChildren(vnode, children, insertedVnodeQueue);
  5222. } else {
  5223. // v-html and domProps: innerHTML
  5224. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  5225. if (i !== elm.innerHTML) {
  5226. /* istanbul ignore if */
  5227. if ("development" !== 'production' &&
  5228. typeof console !== 'undefined' &&
  5229. !bailed
  5230. ) {
  5231. bailed = true;
  5232. console.warn('Parent: ', elm);
  5233. console.warn('server innerHTML: ', i);
  5234. console.warn('client innerHTML: ', elm.innerHTML);
  5235. }
  5236. return false
  5237. }
  5238. } else {
  5239. // iterate and compare children lists
  5240. var childrenMatch = true;
  5241. var childNode = elm.firstChild;
  5242. for (var i$1 = 0; i$1 < children.length; i$1++) {
  5243. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue)) {
  5244. childrenMatch = false;
  5245. break
  5246. }
  5247. childNode = childNode.nextSibling;
  5248. }
  5249. // if childNode is not null, it means the actual childNodes list is
  5250. // longer than the virtual children list.
  5251. if (!childrenMatch || childNode) {
  5252. /* istanbul ignore if */
  5253. if ("development" !== 'production' &&
  5254. typeof console !== 'undefined' &&
  5255. !bailed
  5256. ) {
  5257. bailed = true;
  5258. console.warn('Parent: ', elm);
  5259. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  5260. }
  5261. return false
  5262. }
  5263. }
  5264. }
  5265. }
  5266. if (isDef(data)) {
  5267. for (var key in data) {
  5268. if (!isRenderedModule(key)) {
  5269. invokeCreateHooks(vnode, insertedVnodeQueue);
  5270. break
  5271. }
  5272. }
  5273. }
  5274. } else if (elm.data !== vnode.text) {
  5275. elm.data = vnode.text;
  5276. }
  5277. return true
  5278. }
  5279. function assertNodeMatch (node, vnode) {
  5280. if (isDef(vnode.tag)) {
  5281. return (
  5282. vnode.tag.indexOf('vue-component') === 0 ||
  5283. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  5284. )
  5285. } else {
  5286. return node.nodeType === (vnode.isComment ? 8 : 3)
  5287. }
  5288. }
  5289. return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) {
  5290. if (isUndef(vnode)) {
  5291. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  5292. return
  5293. }
  5294. var isInitialPatch = false;
  5295. var insertedVnodeQueue = [];
  5296. if (isUndef(oldVnode)) {
  5297. // empty mount (likely as component), create new root element
  5298. isInitialPatch = true;
  5299. createElm(vnode, insertedVnodeQueue, parentElm, refElm);
  5300. } else {
  5301. var isRealElement = isDef(oldVnode.nodeType);
  5302. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  5303. // patch existing root node
  5304. patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
  5305. } else {
  5306. if (isRealElement) {
  5307. // mounting to a real element
  5308. // check if this is server-rendered content and if we can perform
  5309. // a successful hydration.
  5310. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  5311. oldVnode.removeAttribute(SSR_ATTR);
  5312. hydrating = true;
  5313. }
  5314. if (isTrue(hydrating)) {
  5315. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  5316. invokeInsertHook(vnode, insertedVnodeQueue, true);
  5317. return oldVnode
  5318. } else {
  5319. warn(
  5320. 'The client-side rendered virtual DOM tree is not matching ' +
  5321. 'server-rendered content. This is likely caused by incorrect ' +
  5322. 'HTML markup, for example nesting block-level elements inside ' +
  5323. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  5324. 'full client-side render.'
  5325. );
  5326. }
  5327. }
  5328. // either not server-rendered, or hydration failed.
  5329. // create an empty node and replace it
  5330. oldVnode = emptyNodeAt(oldVnode);
  5331. }
  5332. // replacing existing element
  5333. var oldElm = oldVnode.elm;
  5334. var parentElm$1 = nodeOps.parentNode(oldElm);
  5335. createElm(
  5336. vnode,
  5337. insertedVnodeQueue,
  5338. // extremely rare edge case: do not insert if old element is in a
  5339. // leaving transition. Only happens when combining transition +
  5340. // keep-alive + HOCs. (#4590)
  5341. oldElm._leaveCb ? null : parentElm$1,
  5342. nodeOps.nextSibling(oldElm)
  5343. );
  5344. if (isDef(vnode.parent)) {
  5345. // component root element replaced.
  5346. // update parent placeholder node element, recursively
  5347. var ancestor = vnode.parent;
  5348. var patchable = isPatchable(vnode);
  5349. while (ancestor) {
  5350. for (var i = 0; i < cbs.destroy.length; ++i) {
  5351. cbs.destroy[i](ancestor);
  5352. }
  5353. ancestor.elm = vnode.elm;
  5354. if (patchable) {
  5355. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5356. cbs.create[i$1](emptyNode, ancestor);
  5357. }
  5358. // #6513
  5359. // invoke insert hooks that may have been merged by create hooks.
  5360. // e.g. for directives that uses the "inserted" hook.
  5361. var insert = ancestor.data.hook.insert;
  5362. if (insert.merged) {
  5363. // start at index 1 to avoid re-invoking component mounted hook
  5364. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  5365. insert.fns[i$2]();
  5366. }
  5367. }
  5368. } else {
  5369. registerRef(ancestor);
  5370. }
  5371. ancestor = ancestor.parent;
  5372. }
  5373. }
  5374. if (isDef(parentElm$1)) {
  5375. removeVnodes(parentElm$1, [oldVnode], 0, 0);
  5376. } else if (isDef(oldVnode.tag)) {
  5377. invokeDestroyHook(oldVnode);
  5378. }
  5379. }
  5380. }
  5381. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  5382. return vnode.elm
  5383. }
  5384. }
  5385. /* */
  5386. var directives = {
  5387. create: updateDirectives,
  5388. update: updateDirectives,
  5389. destroy: function unbindDirectives (vnode) {
  5390. updateDirectives(vnode, emptyNode);
  5391. }
  5392. };
  5393. function updateDirectives (oldVnode, vnode) {
  5394. if (oldVnode.data.directives || vnode.data.directives) {
  5395. _update(oldVnode, vnode);
  5396. }
  5397. }
  5398. function _update (oldVnode, vnode) {
  5399. var isCreate = oldVnode === emptyNode;
  5400. var isDestroy = vnode === emptyNode;
  5401. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  5402. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  5403. var dirsWithInsert = [];
  5404. var dirsWithPostpatch = [];
  5405. var key, oldDir, dir;
  5406. for (key in newDirs) {
  5407. oldDir = oldDirs[key];
  5408. dir = newDirs[key];
  5409. if (!oldDir) {
  5410. // new directive, bind
  5411. callHook$1(dir, 'bind', vnode, oldVnode);
  5412. if (dir.def && dir.def.inserted) {
  5413. dirsWithInsert.push(dir);
  5414. }
  5415. } else {
  5416. // existing directive, update
  5417. dir.oldValue = oldDir.value;
  5418. callHook$1(dir, 'update', vnode, oldVnode);
  5419. if (dir.def && dir.def.componentUpdated) {
  5420. dirsWithPostpatch.push(dir);
  5421. }
  5422. }
  5423. }
  5424. if (dirsWithInsert.length) {
  5425. var callInsert = function () {
  5426. for (var i = 0; i < dirsWithInsert.length; i++) {
  5427. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  5428. }
  5429. };
  5430. if (isCreate) {
  5431. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', callInsert);
  5432. } else {
  5433. callInsert();
  5434. }
  5435. }
  5436. if (dirsWithPostpatch.length) {
  5437. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'postpatch', function () {
  5438. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  5439. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  5440. }
  5441. });
  5442. }
  5443. if (!isCreate) {
  5444. for (key in oldDirs) {
  5445. if (!newDirs[key]) {
  5446. // no longer present, unbind
  5447. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  5448. }
  5449. }
  5450. }
  5451. }
  5452. var emptyModifiers = Object.create(null);
  5453. function normalizeDirectives$1 (
  5454. dirs,
  5455. vm
  5456. ) {
  5457. var res = Object.create(null);
  5458. if (!dirs) {
  5459. return res
  5460. }
  5461. var i, dir;
  5462. for (i = 0; i < dirs.length; i++) {
  5463. dir = dirs[i];
  5464. if (!dir.modifiers) {
  5465. dir.modifiers = emptyModifiers;
  5466. }
  5467. res[getRawDirName(dir)] = dir;
  5468. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  5469. }
  5470. return res
  5471. }
  5472. function getRawDirName (dir) {
  5473. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  5474. }
  5475. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  5476. var fn = dir.def && dir.def[hook];
  5477. if (fn) {
  5478. try {
  5479. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  5480. } catch (e) {
  5481. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  5482. }
  5483. }
  5484. }
  5485. var baseModules = [
  5486. ref,
  5487. directives
  5488. ];
  5489. /* */
  5490. function updateAttrs (oldVnode, vnode) {
  5491. var opts = vnode.componentOptions;
  5492. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  5493. return
  5494. }
  5495. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  5496. return
  5497. }
  5498. var key, cur, old;
  5499. var elm = vnode.elm;
  5500. var oldAttrs = oldVnode.data.attrs || {};
  5501. var attrs = vnode.data.attrs || {};
  5502. // clone observed objects, as the user probably wants to mutate it
  5503. if (isDef(attrs.__ob__)) {
  5504. attrs = vnode.data.attrs = extend({}, attrs);
  5505. }
  5506. for (key in attrs) {
  5507. cur = attrs[key];
  5508. old = oldAttrs[key];
  5509. if (old !== cur) {
  5510. setAttr(elm, key, cur);
  5511. }
  5512. }
  5513. // #4391: in IE9, setting type can reset value for input[type=radio]
  5514. // #6666: IE/Edge forces progress value down to 1 before setting a max
  5515. /* istanbul ignore if */
  5516. if ((isIE9 || isEdge) && attrs.value !== oldAttrs.value) {
  5517. setAttr(elm, 'value', attrs.value);
  5518. }
  5519. for (key in oldAttrs) {
  5520. if (isUndef(attrs[key])) {
  5521. if (isXlink(key)) {
  5522. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  5523. } else if (!isEnumeratedAttr(key)) {
  5524. elm.removeAttribute(key);
  5525. }
  5526. }
  5527. }
  5528. }
  5529. function setAttr (el, key, value) {
  5530. if (isBooleanAttr(key)) {
  5531. // set attribute for blank value
  5532. // e.g. <option disabled>Select one</option>
  5533. if (isFalsyAttrValue(value)) {
  5534. el.removeAttribute(key);
  5535. } else {
  5536. // technically allowfullscreen is a boolean attribute for <iframe>,
  5537. // but Flash expects a value of "true" when used on <embed> tag
  5538. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  5539. ? 'true'
  5540. : key;
  5541. el.setAttribute(key, value);
  5542. }
  5543. } else if (isEnumeratedAttr(key)) {
  5544. el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
  5545. } else if (isXlink(key)) {
  5546. if (isFalsyAttrValue(value)) {
  5547. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  5548. } else {
  5549. el.setAttributeNS(xlinkNS, key, value);
  5550. }
  5551. } else {
  5552. if (isFalsyAttrValue(value)) {
  5553. el.removeAttribute(key);
  5554. } else {
  5555. el.setAttribute(key, value);
  5556. }
  5557. }
  5558. }
  5559. var attrs = {
  5560. create: updateAttrs,
  5561. update: updateAttrs
  5562. };
  5563. /* */
  5564. function updateClass (oldVnode, vnode) {
  5565. var el = vnode.elm;
  5566. var data = vnode.data;
  5567. var oldData = oldVnode.data;
  5568. if (
  5569. isUndef(data.staticClass) &&
  5570. isUndef(data.class) && (
  5571. isUndef(oldData) || (
  5572. isUndef(oldData.staticClass) &&
  5573. isUndef(oldData.class)
  5574. )
  5575. )
  5576. ) {
  5577. return
  5578. }
  5579. var cls = genClassForVnode(vnode);
  5580. // handle transition classes
  5581. var transitionClass = el._transitionClasses;
  5582. if (isDef(transitionClass)) {
  5583. cls = concat(cls, stringifyClass(transitionClass));
  5584. }
  5585. // set the class
  5586. if (cls !== el._prevClass) {
  5587. el.setAttribute('class', cls);
  5588. el._prevClass = cls;
  5589. }
  5590. }
  5591. var klass = {
  5592. create: updateClass,
  5593. update: updateClass
  5594. };
  5595. /* */
  5596. var validDivisionCharRE = /[\w).+\-_$\]]/;
  5597. function parseFilters (exp) {
  5598. var inSingle = false;
  5599. var inDouble = false;
  5600. var inTemplateString = false;
  5601. var inRegex = false;
  5602. var curly = 0;
  5603. var square = 0;
  5604. var paren = 0;
  5605. var lastFilterIndex = 0;
  5606. var c, prev, i, expression, filters;
  5607. for (i = 0; i < exp.length; i++) {
  5608. prev = c;
  5609. c = exp.charCodeAt(i);
  5610. if (inSingle) {
  5611. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  5612. } else if (inDouble) {
  5613. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  5614. } else if (inTemplateString) {
  5615. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  5616. } else if (inRegex) {
  5617. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  5618. } else if (
  5619. c === 0x7C && // pipe
  5620. exp.charCodeAt(i + 1) !== 0x7C &&
  5621. exp.charCodeAt(i - 1) !== 0x7C &&
  5622. !curly && !square && !paren
  5623. ) {
  5624. if (expression === undefined) {
  5625. // first filter, end of expression
  5626. lastFilterIndex = i + 1;
  5627. expression = exp.slice(0, i).trim();
  5628. } else {
  5629. pushFilter();
  5630. }
  5631. } else {
  5632. switch (c) {
  5633. case 0x22: inDouble = true; break // "
  5634. case 0x27: inSingle = true; break // '
  5635. case 0x60: inTemplateString = true; break // `
  5636. case 0x28: paren++; break // (
  5637. case 0x29: paren--; break // )
  5638. case 0x5B: square++; break // [
  5639. case 0x5D: square--; break // ]
  5640. case 0x7B: curly++; break // {
  5641. case 0x7D: curly--; break // }
  5642. }
  5643. if (c === 0x2f) { // /
  5644. var j = i - 1;
  5645. var p = (void 0);
  5646. // find first non-whitespace prev char
  5647. for (; j >= 0; j--) {
  5648. p = exp.charAt(j);
  5649. if (p !== ' ') { break }
  5650. }
  5651. if (!p || !validDivisionCharRE.test(p)) {
  5652. inRegex = true;
  5653. }
  5654. }
  5655. }
  5656. }
  5657. if (expression === undefined) {
  5658. expression = exp.slice(0, i).trim();
  5659. } else if (lastFilterIndex !== 0) {
  5660. pushFilter();
  5661. }
  5662. function pushFilter () {
  5663. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  5664. lastFilterIndex = i + 1;
  5665. }
  5666. if (filters) {
  5667. for (i = 0; i < filters.length; i++) {
  5668. expression = wrapFilter(expression, filters[i]);
  5669. }
  5670. }
  5671. return expression
  5672. }
  5673. function wrapFilter (exp, filter) {
  5674. var i = filter.indexOf('(');
  5675. if (i < 0) {
  5676. // _f: resolveFilter
  5677. return ("_f(\"" + filter + "\")(" + exp + ")")
  5678. } else {
  5679. var name = filter.slice(0, i);
  5680. var args = filter.slice(i + 1);
  5681. return ("_f(\"" + name + "\")(" + exp + "," + args)
  5682. }
  5683. }
  5684. /* */
  5685. function baseWarn (msg) {
  5686. console.error(("[Vue compiler]: " + msg));
  5687. }
  5688. function pluckModuleFunction (
  5689. modules,
  5690. key
  5691. ) {
  5692. return modules
  5693. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  5694. : []
  5695. }
  5696. function addProp (el, name, value) {
  5697. (el.props || (el.props = [])).push({ name: name, value: value });
  5698. }
  5699. function addAttr (el, name, value) {
  5700. (el.attrs || (el.attrs = [])).push({ name: name, value: value });
  5701. }
  5702. function addDirective (
  5703. el,
  5704. name,
  5705. rawName,
  5706. value,
  5707. arg,
  5708. modifiers
  5709. ) {
  5710. (el.directives || (el.directives = [])).push({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers });
  5711. }
  5712. function addHandler (
  5713. el,
  5714. name,
  5715. value,
  5716. modifiers,
  5717. important,
  5718. warn
  5719. ) {
  5720. // warn prevent and passive modifier
  5721. /* istanbul ignore if */
  5722. if (
  5723. "development" !== 'production' && warn &&
  5724. modifiers && modifiers.prevent && modifiers.passive
  5725. ) {
  5726. warn(
  5727. 'passive and prevent can\'t be used together. ' +
  5728. 'Passive handler can\'t prevent default event.'
  5729. );
  5730. }
  5731. // check capture modifier
  5732. if (modifiers && modifiers.capture) {
  5733. delete modifiers.capture;
  5734. name = '!' + name; // mark the event as captured
  5735. }
  5736. if (modifiers && modifiers.once) {
  5737. delete modifiers.once;
  5738. name = '~' + name; // mark the event as once
  5739. }
  5740. /* istanbul ignore if */
  5741. if (modifiers && modifiers.passive) {
  5742. delete modifiers.passive;
  5743. name = '&' + name; // mark the event as passive
  5744. }
  5745. var events;
  5746. if (modifiers && modifiers.native) {
  5747. delete modifiers.native;
  5748. events = el.nativeEvents || (el.nativeEvents = {});
  5749. } else {
  5750. events = el.events || (el.events = {});
  5751. }
  5752. var newHandler = { value: value, modifiers: modifiers };
  5753. var handlers = events[name];
  5754. /* istanbul ignore if */
  5755. if (Array.isArray(handlers)) {
  5756. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  5757. } else if (handlers) {
  5758. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  5759. } else {
  5760. events[name] = newHandler;
  5761. }
  5762. }
  5763. function getBindingAttr (
  5764. el,
  5765. name,
  5766. getStatic
  5767. ) {
  5768. var dynamicValue =
  5769. getAndRemoveAttr(el, ':' + name) ||
  5770. getAndRemoveAttr(el, 'v-bind:' + name);
  5771. if (dynamicValue != null) {
  5772. return parseFilters(dynamicValue)
  5773. } else if (getStatic !== false) {
  5774. var staticValue = getAndRemoveAttr(el, name);
  5775. if (staticValue != null) {
  5776. return JSON.stringify(staticValue)
  5777. }
  5778. }
  5779. }
  5780. // note: this only removes the attr from the Array (attrsList) so that it
  5781. // doesn't get processed by processAttrs.
  5782. // By default it does NOT remove it from the map (attrsMap) because the map is
  5783. // needed during codegen.
  5784. function getAndRemoveAttr (
  5785. el,
  5786. name,
  5787. removeFromMap
  5788. ) {
  5789. var val;
  5790. if ((val = el.attrsMap[name]) != null) {
  5791. var list = el.attrsList;
  5792. for (var i = 0, l = list.length; i < l; i++) {
  5793. if (list[i].name === name) {
  5794. list.splice(i, 1);
  5795. break
  5796. }
  5797. }
  5798. }
  5799. if (removeFromMap) {
  5800. delete el.attrsMap[name];
  5801. }
  5802. return val
  5803. }
  5804. /* */
  5805. /**
  5806. * Cross-platform code generation for component v-model
  5807. */
  5808. function genComponentModel (
  5809. el,
  5810. value,
  5811. modifiers
  5812. ) {
  5813. var ref = modifiers || {};
  5814. var number = ref.number;
  5815. var trim = ref.trim;
  5816. var baseValueExpression = '$$v';
  5817. var valueExpression = baseValueExpression;
  5818. if (trim) {
  5819. valueExpression =
  5820. "(typeof " + baseValueExpression + " === 'string'" +
  5821. "? " + baseValueExpression + ".trim()" +
  5822. ": " + baseValueExpression + ")";
  5823. }
  5824. if (number) {
  5825. valueExpression = "_n(" + valueExpression + ")";
  5826. }
  5827. var assignment = genAssignmentCode(value, valueExpression);
  5828. el.model = {
  5829. value: ("(" + value + ")"),
  5830. expression: ("\"" + value + "\""),
  5831. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  5832. };
  5833. }
  5834. /**
  5835. * Cross-platform codegen helper for generating v-model value assignment code.
  5836. */
  5837. function genAssignmentCode (
  5838. value,
  5839. assignment
  5840. ) {
  5841. var res = parseModel(value);
  5842. if (res.key === null) {
  5843. return (value + "=" + assignment)
  5844. } else {
  5845. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  5846. }
  5847. }
  5848. /**
  5849. * Parse a v-model expression into a base path and a final key segment.
  5850. * Handles both dot-path and possible square brackets.
  5851. *
  5852. * Possible cases:
  5853. *
  5854. * - test
  5855. * - test[key]
  5856. * - test[test1[key]]
  5857. * - test["a"][key]
  5858. * - xxx.test[a[a].test1[key]]
  5859. * - test.xxx.a["asa"][test1[key]]
  5860. *
  5861. */
  5862. var len;
  5863. var str;
  5864. var chr;
  5865. var index$1;
  5866. var expressionPos;
  5867. var expressionEndPos;
  5868. function parseModel (val) {
  5869. len = val.length;
  5870. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  5871. index$1 = val.lastIndexOf('.');
  5872. if (index$1 > -1) {
  5873. return {
  5874. exp: val.slice(0, index$1),
  5875. key: '"' + val.slice(index$1 + 1) + '"'
  5876. }
  5877. } else {
  5878. return {
  5879. exp: val,
  5880. key: null
  5881. }
  5882. }
  5883. }
  5884. str = val;
  5885. index$1 = expressionPos = expressionEndPos = 0;
  5886. while (!eof()) {
  5887. chr = next();
  5888. /* istanbul ignore if */
  5889. if (isStringStart(chr)) {
  5890. parseString(chr);
  5891. } else if (chr === 0x5B) {
  5892. parseBracket(chr);
  5893. }
  5894. }
  5895. return {
  5896. exp: val.slice(0, expressionPos),
  5897. key: val.slice(expressionPos + 1, expressionEndPos)
  5898. }
  5899. }
  5900. function next () {
  5901. return str.charCodeAt(++index$1)
  5902. }
  5903. function eof () {
  5904. return index$1 >= len
  5905. }
  5906. function isStringStart (chr) {
  5907. return chr === 0x22 || chr === 0x27
  5908. }
  5909. function parseBracket (chr) {
  5910. var inBracket = 1;
  5911. expressionPos = index$1;
  5912. while (!eof()) {
  5913. chr = next();
  5914. if (isStringStart(chr)) {
  5915. parseString(chr);
  5916. continue
  5917. }
  5918. if (chr === 0x5B) { inBracket++; }
  5919. if (chr === 0x5D) { inBracket--; }
  5920. if (inBracket === 0) {
  5921. expressionEndPos = index$1;
  5922. break
  5923. }
  5924. }
  5925. }
  5926. function parseString (chr) {
  5927. var stringQuote = chr;
  5928. while (!eof()) {
  5929. chr = next();
  5930. if (chr === stringQuote) {
  5931. break
  5932. }
  5933. }
  5934. }
  5935. /* */
  5936. var warn$1;
  5937. // in some cases, the event used has to be determined at runtime
  5938. // so we used some reserved tokens during compile.
  5939. var RANGE_TOKEN = '__r';
  5940. var CHECKBOX_RADIO_TOKEN = '__c';
  5941. function model (
  5942. el,
  5943. dir,
  5944. _warn
  5945. ) {
  5946. warn$1 = _warn;
  5947. var value = dir.value;
  5948. var modifiers = dir.modifiers;
  5949. var tag = el.tag;
  5950. var type = el.attrsMap.type;
  5951. {
  5952. // inputs with type="file" are read only and setting the input's
  5953. // value will throw an error.
  5954. if (tag === 'input' && type === 'file') {
  5955. warn$1(
  5956. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  5957. "File inputs are read only. Use a v-on:change listener instead."
  5958. );
  5959. }
  5960. }
  5961. if (el.component) {
  5962. genComponentModel(el, value, modifiers);
  5963. // component v-model doesn't need extra runtime
  5964. return false
  5965. } else if (tag === 'select') {
  5966. genSelect(el, value, modifiers);
  5967. } else if (tag === 'input' && type === 'checkbox') {
  5968. genCheckboxModel(el, value, modifiers);
  5969. } else if (tag === 'input' && type === 'radio') {
  5970. genRadioModel(el, value, modifiers);
  5971. } else if (tag === 'input' || tag === 'textarea') {
  5972. genDefaultModel(el, value, modifiers);
  5973. } else if (!config.isReservedTag(tag)) {
  5974. genComponentModel(el, value, modifiers);
  5975. // component v-model doesn't need extra runtime
  5976. return false
  5977. } else {
  5978. warn$1(
  5979. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  5980. "v-model is not supported on this element type. " +
  5981. 'If you are working with contenteditable, it\'s recommended to ' +
  5982. 'wrap a library dedicated for that purpose inside a custom component.'
  5983. );
  5984. }
  5985. // ensure runtime directive metadata
  5986. return true
  5987. }
  5988. function genCheckboxModel (
  5989. el,
  5990. value,
  5991. modifiers
  5992. ) {
  5993. var number = modifiers && modifiers.number;
  5994. var valueBinding = getBindingAttr(el, 'value') || 'null';
  5995. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  5996. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  5997. addProp(el, 'checked',
  5998. "Array.isArray(" + value + ")" +
  5999. "?_i(" + value + "," + valueBinding + ")>-1" + (
  6000. trueValueBinding === 'true'
  6001. ? (":(" + value + ")")
  6002. : (":_q(" + value + "," + trueValueBinding + ")")
  6003. )
  6004. );
  6005. addHandler(el, 'change',
  6006. "var $$a=" + value + "," +
  6007. '$$el=$event.target,' +
  6008. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  6009. 'if(Array.isArray($$a)){' +
  6010. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  6011. '$$i=_i($$a,$$v);' +
  6012. "if($$el.checked){$$i<0&&(" + value + "=$$a.concat([$$v]))}" +
  6013. "else{$$i>-1&&(" + value + "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" +
  6014. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  6015. null, true
  6016. );
  6017. }
  6018. function genRadioModel (
  6019. el,
  6020. value,
  6021. modifiers
  6022. ) {
  6023. var number = modifiers && modifiers.number;
  6024. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6025. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  6026. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  6027. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  6028. }
  6029. function genSelect (
  6030. el,
  6031. value,
  6032. modifiers
  6033. ) {
  6034. var number = modifiers && modifiers.number;
  6035. var selectedVal = "Array.prototype.filter" +
  6036. ".call($event.target.options,function(o){return o.selected})" +
  6037. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  6038. "return " + (number ? '_n(val)' : 'val') + "})";
  6039. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  6040. var code = "var $$selectedVal = " + selectedVal + ";";
  6041. code = code + " " + (genAssignmentCode(value, assignment));
  6042. addHandler(el, 'change', code, null, true);
  6043. }
  6044. function genDefaultModel (
  6045. el,
  6046. value,
  6047. modifiers
  6048. ) {
  6049. var type = el.attrsMap.type;
  6050. var ref = modifiers || {};
  6051. var lazy = ref.lazy;
  6052. var number = ref.number;
  6053. var trim = ref.trim;
  6054. var needCompositionGuard = !lazy && type !== 'range';
  6055. var event = lazy
  6056. ? 'change'
  6057. : type === 'range'
  6058. ? RANGE_TOKEN
  6059. : 'input';
  6060. var valueExpression = '$event.target.value';
  6061. if (trim) {
  6062. valueExpression = "$event.target.value.trim()";
  6063. }
  6064. if (number) {
  6065. valueExpression = "_n(" + valueExpression + ")";
  6066. }
  6067. var code = genAssignmentCode(value, valueExpression);
  6068. if (needCompositionGuard) {
  6069. code = "if($event.target.composing)return;" + code;
  6070. }
  6071. addProp(el, 'value', ("(" + value + ")"));
  6072. addHandler(el, event, code, null, true);
  6073. if (trim || number) {
  6074. addHandler(el, 'blur', '$forceUpdate()');
  6075. }
  6076. }
  6077. /* */
  6078. // normalize v-model event tokens that can only be determined at runtime.
  6079. // it's important to place the event as the first in the array because
  6080. // the whole point is ensuring the v-model callback gets called before
  6081. // user-attached handlers.
  6082. function normalizeEvents (on) {
  6083. /* istanbul ignore if */
  6084. if (isDef(on[RANGE_TOKEN])) {
  6085. // IE input[type=range] only supports `change` event
  6086. var event = isIE ? 'change' : 'input';
  6087. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  6088. delete on[RANGE_TOKEN];
  6089. }
  6090. // This was originally intended to fix #4521 but no longer necessary
  6091. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  6092. /* istanbul ignore if */
  6093. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  6094. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  6095. delete on[CHECKBOX_RADIO_TOKEN];
  6096. }
  6097. }
  6098. var target$1;
  6099. function add$1 (
  6100. event,
  6101. handler,
  6102. once$$1,
  6103. capture,
  6104. passive
  6105. ) {
  6106. if (once$$1) {
  6107. var oldHandler = handler;
  6108. var _target = target$1; // save current target element in closure
  6109. handler = function (ev) {
  6110. var res = arguments.length === 1
  6111. ? oldHandler(ev)
  6112. : oldHandler.apply(null, arguments);
  6113. if (res !== null) {
  6114. remove$2(event, handler, capture, _target);
  6115. }
  6116. };
  6117. }
  6118. target$1.addEventListener(
  6119. event,
  6120. handler,
  6121. supportsPassive
  6122. ? { capture: capture, passive: passive }
  6123. : capture
  6124. );
  6125. }
  6126. function remove$2 (
  6127. event,
  6128. handler,
  6129. capture,
  6130. _target
  6131. ) {
  6132. (_target || target$1).removeEventListener(event, handler, capture);
  6133. }
  6134. function updateDOMListeners (oldVnode, vnode) {
  6135. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  6136. return
  6137. }
  6138. var on = vnode.data.on || {};
  6139. var oldOn = oldVnode.data.on || {};
  6140. target$1 = vnode.elm;
  6141. normalizeEvents(on);
  6142. updateListeners(on, oldOn, add$1, remove$2, vnode.context);
  6143. }
  6144. var events = {
  6145. create: updateDOMListeners,
  6146. update: updateDOMListeners
  6147. };
  6148. /* */
  6149. function updateDOMProps (oldVnode, vnode) {
  6150. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  6151. return
  6152. }
  6153. var key, cur;
  6154. var elm = vnode.elm;
  6155. var oldProps = oldVnode.data.domProps || {};
  6156. var props = vnode.data.domProps || {};
  6157. // clone observed objects, as the user probably wants to mutate it
  6158. if (isDef(props.__ob__)) {
  6159. props = vnode.data.domProps = extend({}, props);
  6160. }
  6161. for (key in oldProps) {
  6162. if (isUndef(props[key])) {
  6163. elm[key] = '';
  6164. }
  6165. }
  6166. for (key in props) {
  6167. cur = props[key];
  6168. // ignore children if the node has textContent or innerHTML,
  6169. // as these will throw away existing DOM nodes and cause removal errors
  6170. // on subsequent patches (#3360)
  6171. if (key === 'textContent' || key === 'innerHTML') {
  6172. if (vnode.children) { vnode.children.length = 0; }
  6173. if (cur === oldProps[key]) { continue }
  6174. // #6601 work around Chrome version <= 55 bug where single textNode
  6175. // replaced by innerHTML/textContent retains its parentNode property
  6176. if (elm.childNodes.length === 1) {
  6177. elm.removeChild(elm.childNodes[0]);
  6178. }
  6179. }
  6180. if (key === 'value') {
  6181. // store value as _value as well since
  6182. // non-string values will be stringified
  6183. elm._value = cur;
  6184. // avoid resetting cursor position when value is the same
  6185. var strCur = isUndef(cur) ? '' : String(cur);
  6186. if (shouldUpdateValue(elm, strCur)) {
  6187. elm.value = strCur;
  6188. }
  6189. } else {
  6190. elm[key] = cur;
  6191. }
  6192. }
  6193. }
  6194. // check platforms/web/util/attrs.js acceptValue
  6195. function shouldUpdateValue (elm, checkVal) {
  6196. return (!elm.composing && (
  6197. elm.tagName === 'OPTION' ||
  6198. isDirty(elm, checkVal) ||
  6199. isInputChanged(elm, checkVal)
  6200. ))
  6201. }
  6202. function isDirty (elm, checkVal) {
  6203. // return true when textbox (.number and .trim) loses focus and its value is
  6204. // not equal to the updated value
  6205. var notInFocus = true;
  6206. // #6157
  6207. // work around IE bug when accessing document.activeElement in an iframe
  6208. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  6209. return notInFocus && elm.value !== checkVal
  6210. }
  6211. function isInputChanged (elm, newVal) {
  6212. var value = elm.value;
  6213. var modifiers = elm._vModifiers; // injected by v-model runtime
  6214. if (isDef(modifiers) && modifiers.number) {
  6215. return toNumber(value) !== toNumber(newVal)
  6216. }
  6217. if (isDef(modifiers) && modifiers.trim) {
  6218. return value.trim() !== newVal.trim()
  6219. }
  6220. return value !== newVal
  6221. }
  6222. var domProps = {
  6223. create: updateDOMProps,
  6224. update: updateDOMProps
  6225. };
  6226. /* */
  6227. var parseStyleText = cached(function (cssText) {
  6228. var res = {};
  6229. var listDelimiter = /;(?![^(]*\))/g;
  6230. var propertyDelimiter = /:(.+)/;
  6231. cssText.split(listDelimiter).forEach(function (item) {
  6232. if (item) {
  6233. var tmp = item.split(propertyDelimiter);
  6234. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6235. }
  6236. });
  6237. return res
  6238. });
  6239. // merge static and dynamic style data on the same vnode
  6240. function normalizeStyleData (data) {
  6241. var style = normalizeStyleBinding(data.style);
  6242. // static style is pre-processed into an object during compilation
  6243. // and is always a fresh object, so it's safe to merge into it
  6244. return data.staticStyle
  6245. ? extend(data.staticStyle, style)
  6246. : style
  6247. }
  6248. // normalize possible array / string values into Object
  6249. function normalizeStyleBinding (bindingStyle) {
  6250. if (Array.isArray(bindingStyle)) {
  6251. return toObject(bindingStyle)
  6252. }
  6253. if (typeof bindingStyle === 'string') {
  6254. return parseStyleText(bindingStyle)
  6255. }
  6256. return bindingStyle
  6257. }
  6258. /**
  6259. * parent component style should be after child's
  6260. * so that parent component's style could override it
  6261. */
  6262. function getStyle (vnode, checkChild) {
  6263. var res = {};
  6264. var styleData;
  6265. if (checkChild) {
  6266. var childNode = vnode;
  6267. while (childNode.componentInstance) {
  6268. childNode = childNode.componentInstance._vnode;
  6269. if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
  6270. extend(res, styleData);
  6271. }
  6272. }
  6273. }
  6274. if ((styleData = normalizeStyleData(vnode.data))) {
  6275. extend(res, styleData);
  6276. }
  6277. var parentNode = vnode;
  6278. while ((parentNode = parentNode.parent)) {
  6279. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  6280. extend(res, styleData);
  6281. }
  6282. }
  6283. return res
  6284. }
  6285. /* */
  6286. var cssVarRE = /^--/;
  6287. var importantRE = /\s*!important$/;
  6288. var setProp = function (el, name, val) {
  6289. /* istanbul ignore if */
  6290. if (cssVarRE.test(name)) {
  6291. el.style.setProperty(name, val);
  6292. } else if (importantRE.test(val)) {
  6293. el.style.setProperty(name, val.replace(importantRE, ''), 'important');
  6294. } else {
  6295. var normalizedName = normalize(name);
  6296. if (Array.isArray(val)) {
  6297. // Support values array created by autoprefixer, e.g.
  6298. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  6299. // Set them one by one, and the browser will only set those it can recognize
  6300. for (var i = 0, len = val.length; i < len; i++) {
  6301. el.style[normalizedName] = val[i];
  6302. }
  6303. } else {
  6304. el.style[normalizedName] = val;
  6305. }
  6306. }
  6307. };
  6308. var vendorNames = ['Webkit', 'Moz', 'ms'];
  6309. var emptyStyle;
  6310. var normalize = cached(function (prop) {
  6311. emptyStyle = emptyStyle || document.createElement('div').style;
  6312. prop = camelize(prop);
  6313. if (prop !== 'filter' && (prop in emptyStyle)) {
  6314. return prop
  6315. }
  6316. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  6317. for (var i = 0; i < vendorNames.length; i++) {
  6318. var name = vendorNames[i] + capName;
  6319. if (name in emptyStyle) {
  6320. return name
  6321. }
  6322. }
  6323. });
  6324. function updateStyle (oldVnode, vnode) {
  6325. var data = vnode.data;
  6326. var oldData = oldVnode.data;
  6327. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  6328. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  6329. ) {
  6330. return
  6331. }
  6332. var cur, name;
  6333. var el = vnode.elm;
  6334. var oldStaticStyle = oldData.staticStyle;
  6335. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  6336. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  6337. var oldStyle = oldStaticStyle || oldStyleBinding;
  6338. var style = normalizeStyleBinding(vnode.data.style) || {};
  6339. // store normalized style under a different key for next diff
  6340. // make sure to clone it if it's reactive, since the user likely wants
  6341. // to mutate it.
  6342. vnode.data.normalizedStyle = isDef(style.__ob__)
  6343. ? extend({}, style)
  6344. : style;
  6345. var newStyle = getStyle(vnode, true);
  6346. for (name in oldStyle) {
  6347. if (isUndef(newStyle[name])) {
  6348. setProp(el, name, '');
  6349. }
  6350. }
  6351. for (name in newStyle) {
  6352. cur = newStyle[name];
  6353. if (cur !== oldStyle[name]) {
  6354. // ie9 setting to null has no effect, must use empty string
  6355. setProp(el, name, cur == null ? '' : cur);
  6356. }
  6357. }
  6358. }
  6359. var style = {
  6360. create: updateStyle,
  6361. update: updateStyle
  6362. };
  6363. /* */
  6364. /**
  6365. * Add class with compatibility for SVG since classList is not supported on
  6366. * SVG elements in IE
  6367. */
  6368. function addClass (el, cls) {
  6369. /* istanbul ignore if */
  6370. if (!cls || !(cls = cls.trim())) {
  6371. return
  6372. }
  6373. /* istanbul ignore else */
  6374. if (el.classList) {
  6375. if (cls.indexOf(' ') > -1) {
  6376. cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
  6377. } else {
  6378. el.classList.add(cls);
  6379. }
  6380. } else {
  6381. var cur = " " + (el.getAttribute('class') || '') + " ";
  6382. if (cur.indexOf(' ' + cls + ' ') < 0) {
  6383. el.setAttribute('class', (cur + cls).trim());
  6384. }
  6385. }
  6386. }
  6387. /**
  6388. * Remove class with compatibility for SVG since classList is not supported on
  6389. * SVG elements in IE
  6390. */
  6391. function removeClass (el, cls) {
  6392. /* istanbul ignore if */
  6393. if (!cls || !(cls = cls.trim())) {
  6394. return
  6395. }
  6396. /* istanbul ignore else */
  6397. if (el.classList) {
  6398. if (cls.indexOf(' ') > -1) {
  6399. cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
  6400. } else {
  6401. el.classList.remove(cls);
  6402. }
  6403. if (!el.classList.length) {
  6404. el.removeAttribute('class');
  6405. }
  6406. } else {
  6407. var cur = " " + (el.getAttribute('class') || '') + " ";
  6408. var tar = ' ' + cls + ' ';
  6409. while (cur.indexOf(tar) >= 0) {
  6410. cur = cur.replace(tar, ' ');
  6411. }
  6412. cur = cur.trim();
  6413. if (cur) {
  6414. el.setAttribute('class', cur);
  6415. } else {
  6416. el.removeAttribute('class');
  6417. }
  6418. }
  6419. }
  6420. /* */
  6421. function resolveTransition (def) {
  6422. if (!def) {
  6423. return
  6424. }
  6425. /* istanbul ignore else */
  6426. if (typeof def === 'object') {
  6427. var res = {};
  6428. if (def.css !== false) {
  6429. extend(res, autoCssTransition(def.name || 'v'));
  6430. }
  6431. extend(res, def);
  6432. return res
  6433. } else if (typeof def === 'string') {
  6434. return autoCssTransition(def)
  6435. }
  6436. }
  6437. var autoCssTransition = cached(function (name) {
  6438. return {
  6439. enterClass: (name + "-enter"),
  6440. enterToClass: (name + "-enter-to"),
  6441. enterActiveClass: (name + "-enter-active"),
  6442. leaveClass: (name + "-leave"),
  6443. leaveToClass: (name + "-leave-to"),
  6444. leaveActiveClass: (name + "-leave-active")
  6445. }
  6446. });
  6447. var hasTransition = inBrowser && !isIE9;
  6448. var TRANSITION = 'transition';
  6449. var ANIMATION = 'animation';
  6450. // Transition property/event sniffing
  6451. var transitionProp = 'transition';
  6452. var transitionEndEvent = 'transitionend';
  6453. var animationProp = 'animation';
  6454. var animationEndEvent = 'animationend';
  6455. if (hasTransition) {
  6456. /* istanbul ignore if */
  6457. if (window.ontransitionend === undefined &&
  6458. window.onwebkittransitionend !== undefined
  6459. ) {
  6460. transitionProp = 'WebkitTransition';
  6461. transitionEndEvent = 'webkitTransitionEnd';
  6462. }
  6463. if (window.onanimationend === undefined &&
  6464. window.onwebkitanimationend !== undefined
  6465. ) {
  6466. animationProp = 'WebkitAnimation';
  6467. animationEndEvent = 'webkitAnimationEnd';
  6468. }
  6469. }
  6470. // binding to window is necessary to make hot reload work in IE in strict mode
  6471. var raf = inBrowser
  6472. ? window.requestAnimationFrame
  6473. ? window.requestAnimationFrame.bind(window)
  6474. : setTimeout
  6475. : /* istanbul ignore next */ function (fn) { return fn(); };
  6476. function nextFrame (fn) {
  6477. raf(function () {
  6478. raf(fn);
  6479. });
  6480. }
  6481. function addTransitionClass (el, cls) {
  6482. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  6483. if (transitionClasses.indexOf(cls) < 0) {
  6484. transitionClasses.push(cls);
  6485. addClass(el, cls);
  6486. }
  6487. }
  6488. function removeTransitionClass (el, cls) {
  6489. if (el._transitionClasses) {
  6490. remove(el._transitionClasses, cls);
  6491. }
  6492. removeClass(el, cls);
  6493. }
  6494. function whenTransitionEnds (
  6495. el,
  6496. expectedType,
  6497. cb
  6498. ) {
  6499. var ref = getTransitionInfo(el, expectedType);
  6500. var type = ref.type;
  6501. var timeout = ref.timeout;
  6502. var propCount = ref.propCount;
  6503. if (!type) { return cb() }
  6504. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  6505. var ended = 0;
  6506. var end = function () {
  6507. el.removeEventListener(event, onEnd);
  6508. cb();
  6509. };
  6510. var onEnd = function (e) {
  6511. if (e.target === el) {
  6512. if (++ended >= propCount) {
  6513. end();
  6514. }
  6515. }
  6516. };
  6517. setTimeout(function () {
  6518. if (ended < propCount) {
  6519. end();
  6520. }
  6521. }, timeout + 1);
  6522. el.addEventListener(event, onEnd);
  6523. }
  6524. var transformRE = /\b(transform|all)(,|$)/;
  6525. function getTransitionInfo (el, expectedType) {
  6526. var styles = window.getComputedStyle(el);
  6527. var transitionDelays = styles[transitionProp + 'Delay'].split(', ');
  6528. var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
  6529. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  6530. var animationDelays = styles[animationProp + 'Delay'].split(', ');
  6531. var animationDurations = styles[animationProp + 'Duration'].split(', ');
  6532. var animationTimeout = getTimeout(animationDelays, animationDurations);
  6533. var type;
  6534. var timeout = 0;
  6535. var propCount = 0;
  6536. /* istanbul ignore if */
  6537. if (expectedType === TRANSITION) {
  6538. if (transitionTimeout > 0) {
  6539. type = TRANSITION;
  6540. timeout = transitionTimeout;
  6541. propCount = transitionDurations.length;
  6542. }
  6543. } else if (expectedType === ANIMATION) {
  6544. if (animationTimeout > 0) {
  6545. type = ANIMATION;
  6546. timeout = animationTimeout;
  6547. propCount = animationDurations.length;
  6548. }
  6549. } else {
  6550. timeout = Math.max(transitionTimeout, animationTimeout);
  6551. type = timeout > 0
  6552. ? transitionTimeout > animationTimeout
  6553. ? TRANSITION
  6554. : ANIMATION
  6555. : null;
  6556. propCount = type
  6557. ? type === TRANSITION
  6558. ? transitionDurations.length
  6559. : animationDurations.length
  6560. : 0;
  6561. }
  6562. var hasTransform =
  6563. type === TRANSITION &&
  6564. transformRE.test(styles[transitionProp + 'Property']);
  6565. return {
  6566. type: type,
  6567. timeout: timeout,
  6568. propCount: propCount,
  6569. hasTransform: hasTransform
  6570. }
  6571. }
  6572. function getTimeout (delays, durations) {
  6573. /* istanbul ignore next */
  6574. while (delays.length < durations.length) {
  6575. delays = delays.concat(delays);
  6576. }
  6577. return Math.max.apply(null, durations.map(function (d, i) {
  6578. return toMs(d) + toMs(delays[i])
  6579. }))
  6580. }
  6581. function toMs (s) {
  6582. return Number(s.slice(0, -1)) * 1000
  6583. }
  6584. /* */
  6585. function enter (vnode, toggleDisplay) {
  6586. var el = vnode.elm;
  6587. // call leave callback now
  6588. if (isDef(el._leaveCb)) {
  6589. el._leaveCb.cancelled = true;
  6590. el._leaveCb();
  6591. }
  6592. var data = resolveTransition(vnode.data.transition);
  6593. if (isUndef(data)) {
  6594. return
  6595. }
  6596. /* istanbul ignore if */
  6597. if (isDef(el._enterCb) || el.nodeType !== 1) {
  6598. return
  6599. }
  6600. var css = data.css;
  6601. var type = data.type;
  6602. var enterClass = data.enterClass;
  6603. var enterToClass = data.enterToClass;
  6604. var enterActiveClass = data.enterActiveClass;
  6605. var appearClass = data.appearClass;
  6606. var appearToClass = data.appearToClass;
  6607. var appearActiveClass = data.appearActiveClass;
  6608. var beforeEnter = data.beforeEnter;
  6609. var enter = data.enter;
  6610. var afterEnter = data.afterEnter;
  6611. var enterCancelled = data.enterCancelled;
  6612. var beforeAppear = data.beforeAppear;
  6613. var appear = data.appear;
  6614. var afterAppear = data.afterAppear;
  6615. var appearCancelled = data.appearCancelled;
  6616. var duration = data.duration;
  6617. // activeInstance will always be the <transition> component managing this
  6618. // transition. One edge case to check is when the <transition> is placed
  6619. // as the root node of a child component. In that case we need to check
  6620. // <transition>'s parent for appear check.
  6621. var context = activeInstance;
  6622. var transitionNode = activeInstance.$vnode;
  6623. while (transitionNode && transitionNode.parent) {
  6624. transitionNode = transitionNode.parent;
  6625. context = transitionNode.context;
  6626. }
  6627. var isAppear = !context._isMounted || !vnode.isRootInsert;
  6628. if (isAppear && !appear && appear !== '') {
  6629. return
  6630. }
  6631. var startClass = isAppear && appearClass
  6632. ? appearClass
  6633. : enterClass;
  6634. var activeClass = isAppear && appearActiveClass
  6635. ? appearActiveClass
  6636. : enterActiveClass;
  6637. var toClass = isAppear && appearToClass
  6638. ? appearToClass
  6639. : enterToClass;
  6640. var beforeEnterHook = isAppear
  6641. ? (beforeAppear || beforeEnter)
  6642. : beforeEnter;
  6643. var enterHook = isAppear
  6644. ? (typeof appear === 'function' ? appear : enter)
  6645. : enter;
  6646. var afterEnterHook = isAppear
  6647. ? (afterAppear || afterEnter)
  6648. : afterEnter;
  6649. var enterCancelledHook = isAppear
  6650. ? (appearCancelled || enterCancelled)
  6651. : enterCancelled;
  6652. var explicitEnterDuration = toNumber(
  6653. isObject(duration)
  6654. ? duration.enter
  6655. : duration
  6656. );
  6657. if ("development" !== 'production' && explicitEnterDuration != null) {
  6658. checkDuration(explicitEnterDuration, 'enter', vnode);
  6659. }
  6660. var expectsCSS = css !== false && !isIE9;
  6661. var userWantsControl = getHookArgumentsLength(enterHook);
  6662. var cb = el._enterCb = once(function () {
  6663. if (expectsCSS) {
  6664. removeTransitionClass(el, toClass);
  6665. removeTransitionClass(el, activeClass);
  6666. }
  6667. if (cb.cancelled) {
  6668. if (expectsCSS) {
  6669. removeTransitionClass(el, startClass);
  6670. }
  6671. enterCancelledHook && enterCancelledHook(el);
  6672. } else {
  6673. afterEnterHook && afterEnterHook(el);
  6674. }
  6675. el._enterCb = null;
  6676. });
  6677. if (!vnode.data.show) {
  6678. // remove pending leave element on enter by injecting an insert hook
  6679. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () {
  6680. var parent = el.parentNode;
  6681. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  6682. if (pendingNode &&
  6683. pendingNode.tag === vnode.tag &&
  6684. pendingNode.elm._leaveCb
  6685. ) {
  6686. pendingNode.elm._leaveCb();
  6687. }
  6688. enterHook && enterHook(el, cb);
  6689. });
  6690. }
  6691. // start enter transition
  6692. beforeEnterHook && beforeEnterHook(el);
  6693. if (expectsCSS) {
  6694. addTransitionClass(el, startClass);
  6695. addTransitionClass(el, activeClass);
  6696. nextFrame(function () {
  6697. addTransitionClass(el, toClass);
  6698. removeTransitionClass(el, startClass);
  6699. if (!cb.cancelled && !userWantsControl) {
  6700. if (isValidDuration(explicitEnterDuration)) {
  6701. setTimeout(cb, explicitEnterDuration);
  6702. } else {
  6703. whenTransitionEnds(el, type, cb);
  6704. }
  6705. }
  6706. });
  6707. }
  6708. if (vnode.data.show) {
  6709. toggleDisplay && toggleDisplay();
  6710. enterHook && enterHook(el, cb);
  6711. }
  6712. if (!expectsCSS && !userWantsControl) {
  6713. cb();
  6714. }
  6715. }
  6716. function leave (vnode, rm) {
  6717. var el = vnode.elm;
  6718. // call enter callback now
  6719. if (isDef(el._enterCb)) {
  6720. el._enterCb.cancelled = true;
  6721. el._enterCb();
  6722. }
  6723. var data = resolveTransition(vnode.data.transition);
  6724. if (isUndef(data)) {
  6725. return rm()
  6726. }
  6727. /* istanbul ignore if */
  6728. if (isDef(el._leaveCb) || el.nodeType !== 1) {
  6729. return
  6730. }
  6731. var css = data.css;
  6732. var type = data.type;
  6733. var leaveClass = data.leaveClass;
  6734. var leaveToClass = data.leaveToClass;
  6735. var leaveActiveClass = data.leaveActiveClass;
  6736. var beforeLeave = data.beforeLeave;
  6737. var leave = data.leave;
  6738. var afterLeave = data.afterLeave;
  6739. var leaveCancelled = data.leaveCancelled;
  6740. var delayLeave = data.delayLeave;
  6741. var duration = data.duration;
  6742. var expectsCSS = css !== false && !isIE9;
  6743. var userWantsControl = getHookArgumentsLength(leave);
  6744. var explicitLeaveDuration = toNumber(
  6745. isObject(duration)
  6746. ? duration.leave
  6747. : duration
  6748. );
  6749. if ("development" !== 'production' && isDef(explicitLeaveDuration)) {
  6750. checkDuration(explicitLeaveDuration, 'leave', vnode);
  6751. }
  6752. var cb = el._leaveCb = once(function () {
  6753. if (el.parentNode && el.parentNode._pending) {
  6754. el.parentNode._pending[vnode.key] = null;
  6755. }
  6756. if (expectsCSS) {
  6757. removeTransitionClass(el, leaveToClass);
  6758. removeTransitionClass(el, leaveActiveClass);
  6759. }
  6760. if (cb.cancelled) {
  6761. if (expectsCSS) {
  6762. removeTransitionClass(el, leaveClass);
  6763. }
  6764. leaveCancelled && leaveCancelled(el);
  6765. } else {
  6766. rm();
  6767. afterLeave && afterLeave(el);
  6768. }
  6769. el._leaveCb = null;
  6770. });
  6771. if (delayLeave) {
  6772. delayLeave(performLeave);
  6773. } else {
  6774. performLeave();
  6775. }
  6776. function performLeave () {
  6777. // the delayed leave may have already been cancelled
  6778. if (cb.cancelled) {
  6779. return
  6780. }
  6781. // record leaving element
  6782. if (!vnode.data.show) {
  6783. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  6784. }
  6785. beforeLeave && beforeLeave(el);
  6786. if (expectsCSS) {
  6787. addTransitionClass(el, leaveClass);
  6788. addTransitionClass(el, leaveActiveClass);
  6789. nextFrame(function () {
  6790. addTransitionClass(el, leaveToClass);
  6791. removeTransitionClass(el, leaveClass);
  6792. if (!cb.cancelled && !userWantsControl) {
  6793. if (isValidDuration(explicitLeaveDuration)) {
  6794. setTimeout(cb, explicitLeaveDuration);
  6795. } else {
  6796. whenTransitionEnds(el, type, cb);
  6797. }
  6798. }
  6799. });
  6800. }
  6801. leave && leave(el, cb);
  6802. if (!expectsCSS && !userWantsControl) {
  6803. cb();
  6804. }
  6805. }
  6806. }
  6807. // only used in dev mode
  6808. function checkDuration (val, name, vnode) {
  6809. if (typeof val !== 'number') {
  6810. warn(
  6811. "<transition> explicit " + name + " duration is not a valid number - " +
  6812. "got " + (JSON.stringify(val)) + ".",
  6813. vnode.context
  6814. );
  6815. } else if (isNaN(val)) {
  6816. warn(
  6817. "<transition> explicit " + name + " duration is NaN - " +
  6818. 'the duration expression might be incorrect.',
  6819. vnode.context
  6820. );
  6821. }
  6822. }
  6823. function isValidDuration (val) {
  6824. return typeof val === 'number' && !isNaN(val)
  6825. }
  6826. /**
  6827. * Normalize a transition hook's argument length. The hook may be:
  6828. * - a merged hook (invoker) with the original in .fns
  6829. * - a wrapped component method (check ._length)
  6830. * - a plain function (.length)
  6831. */
  6832. function getHookArgumentsLength (fn) {
  6833. if (isUndef(fn)) {
  6834. return false
  6835. }
  6836. var invokerFns = fn.fns;
  6837. if (isDef(invokerFns)) {
  6838. // invoker
  6839. return getHookArgumentsLength(
  6840. Array.isArray(invokerFns)
  6841. ? invokerFns[0]
  6842. : invokerFns
  6843. )
  6844. } else {
  6845. return (fn._length || fn.length) > 1
  6846. }
  6847. }
  6848. function _enter (_, vnode) {
  6849. if (vnode.data.show !== true) {
  6850. enter(vnode);
  6851. }
  6852. }
  6853. var transition = inBrowser ? {
  6854. create: _enter,
  6855. activate: _enter,
  6856. remove: function remove$$1 (vnode, rm) {
  6857. /* istanbul ignore else */
  6858. if (vnode.data.show !== true) {
  6859. leave(vnode, rm);
  6860. } else {
  6861. rm();
  6862. }
  6863. }
  6864. } : {};
  6865. var platformModules = [
  6866. attrs,
  6867. klass,
  6868. events,
  6869. domProps,
  6870. style,
  6871. transition
  6872. ];
  6873. /* */
  6874. // the directive module should be applied last, after all
  6875. // built-in modules have been applied.
  6876. var modules = platformModules.concat(baseModules);
  6877. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  6878. /**
  6879. * Not type checking this file because flow doesn't like attaching
  6880. * properties to Elements.
  6881. */
  6882. /* istanbul ignore if */
  6883. if (isIE9) {
  6884. // http://www.matts411.com/post/internet-explorer-9-oninput/
  6885. document.addEventListener('selectionchange', function () {
  6886. var el = document.activeElement;
  6887. if (el && el.vmodel) {
  6888. trigger(el, 'input');
  6889. }
  6890. });
  6891. }
  6892. var model$1 = {
  6893. inserted: function inserted (el, binding, vnode) {
  6894. if (vnode.tag === 'select') {
  6895. setSelected(el, binding, vnode.context);
  6896. el._vOptions = [].map.call(el.options, getValue);
  6897. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  6898. el._vModifiers = binding.modifiers;
  6899. if (!binding.modifiers.lazy) {
  6900. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  6901. // switching focus before confirming composition choice
  6902. // this also fixes the issue where some browsers e.g. iOS Chrome
  6903. // fires "change" instead of "input" on autocomplete.
  6904. el.addEventListener('change', onCompositionEnd);
  6905. if (!isAndroid) {
  6906. el.addEventListener('compositionstart', onCompositionStart);
  6907. el.addEventListener('compositionend', onCompositionEnd);
  6908. }
  6909. /* istanbul ignore if */
  6910. if (isIE9) {
  6911. el.vmodel = true;
  6912. }
  6913. }
  6914. }
  6915. },
  6916. componentUpdated: function componentUpdated (el, binding, vnode) {
  6917. if (vnode.tag === 'select') {
  6918. setSelected(el, binding, vnode.context);
  6919. // in case the options rendered by v-for have changed,
  6920. // it's possible that the value is out-of-sync with the rendered options.
  6921. // detect such cases and filter out values that no longer has a matching
  6922. // option in the DOM.
  6923. var prevOptions = el._vOptions;
  6924. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  6925. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  6926. // trigger change event if
  6927. // no matching option found for at least one value
  6928. var needReset = el.multiple
  6929. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  6930. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  6931. if (needReset) {
  6932. trigger(el, 'change');
  6933. }
  6934. }
  6935. }
  6936. }
  6937. };
  6938. function setSelected (el, binding, vm) {
  6939. actuallySetSelected(el, binding, vm);
  6940. /* istanbul ignore if */
  6941. if (isIE || isEdge) {
  6942. setTimeout(function () {
  6943. actuallySetSelected(el, binding, vm);
  6944. }, 0);
  6945. }
  6946. }
  6947. function actuallySetSelected (el, binding, vm) {
  6948. var value = binding.value;
  6949. var isMultiple = el.multiple;
  6950. if (isMultiple && !Array.isArray(value)) {
  6951. "development" !== 'production' && warn(
  6952. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  6953. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  6954. vm
  6955. );
  6956. return
  6957. }
  6958. var selected, option;
  6959. for (var i = 0, l = el.options.length; i < l; i++) {
  6960. option = el.options[i];
  6961. if (isMultiple) {
  6962. selected = looseIndexOf(value, getValue(option)) > -1;
  6963. if (option.selected !== selected) {
  6964. option.selected = selected;
  6965. }
  6966. } else {
  6967. if (looseEqual(getValue(option), value)) {
  6968. if (el.selectedIndex !== i) {
  6969. el.selectedIndex = i;
  6970. }
  6971. return
  6972. }
  6973. }
  6974. }
  6975. if (!isMultiple) {
  6976. el.selectedIndex = -1;
  6977. }
  6978. }
  6979. function hasNoMatchingOption (value, options) {
  6980. return options.every(function (o) { return !looseEqual(o, value); })
  6981. }
  6982. function getValue (option) {
  6983. return '_value' in option
  6984. ? option._value
  6985. : option.value
  6986. }
  6987. function onCompositionStart (e) {
  6988. e.target.composing = true;
  6989. }
  6990. function onCompositionEnd (e) {
  6991. // prevent triggering an input event for no reason
  6992. if (!e.target.composing) { return }
  6993. e.target.composing = false;
  6994. trigger(e.target, 'input');
  6995. }
  6996. function trigger (el, type) {
  6997. var e = document.createEvent('HTMLEvents');
  6998. e.initEvent(type, true, true);
  6999. el.dispatchEvent(e);
  7000. }
  7001. /* */
  7002. // recursively search for possible transition defined inside the component root
  7003. function locateNode (vnode) {
  7004. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  7005. ? locateNode(vnode.componentInstance._vnode)
  7006. : vnode
  7007. }
  7008. var show = {
  7009. bind: function bind (el, ref, vnode) {
  7010. var value = ref.value;
  7011. vnode = locateNode(vnode);
  7012. var transition$$1 = vnode.data && vnode.data.transition;
  7013. var originalDisplay = el.__vOriginalDisplay =
  7014. el.style.display === 'none' ? '' : el.style.display;
  7015. if (value && transition$$1) {
  7016. vnode.data.show = true;
  7017. enter(vnode, function () {
  7018. el.style.display = originalDisplay;
  7019. });
  7020. } else {
  7021. el.style.display = value ? originalDisplay : 'none';
  7022. }
  7023. },
  7024. update: function update (el, ref, vnode) {
  7025. var value = ref.value;
  7026. var oldValue = ref.oldValue;
  7027. /* istanbul ignore if */
  7028. if (value === oldValue) { return }
  7029. vnode = locateNode(vnode);
  7030. var transition$$1 = vnode.data && vnode.data.transition;
  7031. if (transition$$1) {
  7032. vnode.data.show = true;
  7033. if (value) {
  7034. enter(vnode, function () {
  7035. el.style.display = el.__vOriginalDisplay;
  7036. });
  7037. } else {
  7038. leave(vnode, function () {
  7039. el.style.display = 'none';
  7040. });
  7041. }
  7042. } else {
  7043. el.style.display = value ? el.__vOriginalDisplay : 'none';
  7044. }
  7045. },
  7046. unbind: function unbind (
  7047. el,
  7048. binding,
  7049. vnode,
  7050. oldVnode,
  7051. isDestroy
  7052. ) {
  7053. if (!isDestroy) {
  7054. el.style.display = el.__vOriginalDisplay;
  7055. }
  7056. }
  7057. };
  7058. var platformDirectives = {
  7059. model: model$1,
  7060. show: show
  7061. };
  7062. /* */
  7063. // Provides transition support for a single element/component.
  7064. // supports transition mode (out-in / in-out)
  7065. var transitionProps = {
  7066. name: String,
  7067. appear: Boolean,
  7068. css: Boolean,
  7069. mode: String,
  7070. type: String,
  7071. enterClass: String,
  7072. leaveClass: String,
  7073. enterToClass: String,
  7074. leaveToClass: String,
  7075. enterActiveClass: String,
  7076. leaveActiveClass: String,
  7077. appearClass: String,
  7078. appearActiveClass: String,
  7079. appearToClass: String,
  7080. duration: [Number, String, Object]
  7081. };
  7082. // in case the child is also an abstract component, e.g. <keep-alive>
  7083. // we want to recursively retrieve the real component to be rendered
  7084. function getRealChild (vnode) {
  7085. var compOptions = vnode && vnode.componentOptions;
  7086. if (compOptions && compOptions.Ctor.options.abstract) {
  7087. return getRealChild(getFirstComponentChild(compOptions.children))
  7088. } else {
  7089. return vnode
  7090. }
  7091. }
  7092. function extractTransitionData (comp) {
  7093. var data = {};
  7094. var options = comp.$options;
  7095. // props
  7096. for (var key in options.propsData) {
  7097. data[key] = comp[key];
  7098. }
  7099. // events.
  7100. // extract listeners and pass them directly to the transition methods
  7101. var listeners = options._parentListeners;
  7102. for (var key$1 in listeners) {
  7103. data[camelize(key$1)] = listeners[key$1];
  7104. }
  7105. return data
  7106. }
  7107. function placeholder (h, rawChild) {
  7108. if (/\d-keep-alive$/.test(rawChild.tag)) {
  7109. return h('keep-alive', {
  7110. props: rawChild.componentOptions.propsData
  7111. })
  7112. }
  7113. }
  7114. function hasParentTransition (vnode) {
  7115. while ((vnode = vnode.parent)) {
  7116. if (vnode.data.transition) {
  7117. return true
  7118. }
  7119. }
  7120. }
  7121. function isSameChild (child, oldChild) {
  7122. return oldChild.key === child.key && oldChild.tag === child.tag
  7123. }
  7124. var Transition = {
  7125. name: 'transition',
  7126. props: transitionProps,
  7127. abstract: true,
  7128. render: function render (h) {
  7129. var this$1 = this;
  7130. var children = this.$options._renderChildren;
  7131. if (!children) {
  7132. return
  7133. }
  7134. // filter out text nodes (possible whitespaces)
  7135. children = children.filter(function (c) { return c.tag || isAsyncPlaceholder(c); });
  7136. /* istanbul ignore if */
  7137. if (!children.length) {
  7138. return
  7139. }
  7140. // warn multiple elements
  7141. if ("development" !== 'production' && children.length > 1) {
  7142. warn(
  7143. '<transition> can only be used on a single element. Use ' +
  7144. '<transition-group> for lists.',
  7145. this.$parent
  7146. );
  7147. }
  7148. var mode = this.mode;
  7149. // warn invalid mode
  7150. if ("development" !== 'production' &&
  7151. mode && mode !== 'in-out' && mode !== 'out-in'
  7152. ) {
  7153. warn(
  7154. 'invalid <transition> mode: ' + mode,
  7155. this.$parent
  7156. );
  7157. }
  7158. var rawChild = children[0];
  7159. // if this is a component root node and the component's
  7160. // parent container node also has transition, skip.
  7161. if (hasParentTransition(this.$vnode)) {
  7162. return rawChild
  7163. }
  7164. // apply transition data to child
  7165. // use getRealChild() to ignore abstract components e.g. keep-alive
  7166. var child = getRealChild(rawChild);
  7167. /* istanbul ignore if */
  7168. if (!child) {
  7169. return rawChild
  7170. }
  7171. if (this._leaving) {
  7172. return placeholder(h, rawChild)
  7173. }
  7174. // ensure a key that is unique to the vnode type and to this transition
  7175. // component instance. This key will be used to remove pending leaving nodes
  7176. // during entering.
  7177. var id = "__transition-" + (this._uid) + "-";
  7178. child.key = child.key == null
  7179. ? child.isComment
  7180. ? id + 'comment'
  7181. : id + child.tag
  7182. : isPrimitive(child.key)
  7183. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  7184. : child.key;
  7185. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  7186. var oldRawChild = this._vnode;
  7187. var oldChild = getRealChild(oldRawChild);
  7188. // mark v-show
  7189. // so that the transition module can hand over the control to the directive
  7190. if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
  7191. child.data.show = true;
  7192. }
  7193. if (
  7194. oldChild &&
  7195. oldChild.data &&
  7196. !isSameChild(child, oldChild) &&
  7197. !isAsyncPlaceholder(oldChild)
  7198. ) {
  7199. // replace old child transition data with fresh one
  7200. // important for dynamic transitions!
  7201. var oldData = oldChild.data.transition = extend({}, data);
  7202. // handle transition mode
  7203. if (mode === 'out-in') {
  7204. // return placeholder node and queue update when leave finishes
  7205. this._leaving = true;
  7206. mergeVNodeHook(oldData, 'afterLeave', function () {
  7207. this$1._leaving = false;
  7208. this$1.$forceUpdate();
  7209. });
  7210. return placeholder(h, rawChild)
  7211. } else if (mode === 'in-out') {
  7212. if (isAsyncPlaceholder(child)) {
  7213. return oldRawChild
  7214. }
  7215. var delayedLeave;
  7216. var performLeave = function () { delayedLeave(); };
  7217. mergeVNodeHook(data, 'afterEnter', performLeave);
  7218. mergeVNodeHook(data, 'enterCancelled', performLeave);
  7219. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  7220. }
  7221. }
  7222. return rawChild
  7223. }
  7224. };
  7225. /* */
  7226. // Provides transition support for list items.
  7227. // supports move transitions using the FLIP technique.
  7228. // Because the vdom's children update algorithm is "unstable" - i.e.
  7229. // it doesn't guarantee the relative positioning of removed elements,
  7230. // we force transition-group to update its children into two passes:
  7231. // in the first pass, we remove all nodes that need to be removed,
  7232. // triggering their leaving transition; in the second pass, we insert/move
  7233. // into the final desired state. This way in the second pass removed
  7234. // nodes will remain where they should be.
  7235. var props = extend({
  7236. tag: String,
  7237. moveClass: String
  7238. }, transitionProps);
  7239. delete props.mode;
  7240. var TransitionGroup = {
  7241. props: props,
  7242. render: function render (h) {
  7243. var tag = this.tag || this.$vnode.data.tag || 'span';
  7244. var map = Object.create(null);
  7245. var prevChildren = this.prevChildren = this.children;
  7246. var rawChildren = this.$slots.default || [];
  7247. var children = this.children = [];
  7248. var transitionData = extractTransitionData(this);
  7249. for (var i = 0; i < rawChildren.length; i++) {
  7250. var c = rawChildren[i];
  7251. if (c.tag) {
  7252. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  7253. children.push(c);
  7254. map[c.key] = c
  7255. ;(c.data || (c.data = {})).transition = transitionData;
  7256. } else {
  7257. var opts = c.componentOptions;
  7258. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  7259. warn(("<transition-group> children must be keyed: <" + name + ">"));
  7260. }
  7261. }
  7262. }
  7263. if (prevChildren) {
  7264. var kept = [];
  7265. var removed = [];
  7266. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  7267. var c$1 = prevChildren[i$1];
  7268. c$1.data.transition = transitionData;
  7269. c$1.data.pos = c$1.elm.getBoundingClientRect();
  7270. if (map[c$1.key]) {
  7271. kept.push(c$1);
  7272. } else {
  7273. removed.push(c$1);
  7274. }
  7275. }
  7276. this.kept = h(tag, null, kept);
  7277. this.removed = removed;
  7278. }
  7279. return h(tag, null, children)
  7280. },
  7281. beforeUpdate: function beforeUpdate () {
  7282. // force removing pass
  7283. this.__patch__(
  7284. this._vnode,
  7285. this.kept,
  7286. false, // hydrating
  7287. true // removeOnly (!important, avoids unnecessary moves)
  7288. );
  7289. this._vnode = this.kept;
  7290. },
  7291. updated: function updated () {
  7292. var children = this.prevChildren;
  7293. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  7294. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  7295. return
  7296. }
  7297. // we divide the work into three loops to avoid mixing DOM reads and writes
  7298. // in each iteration - which helps prevent layout thrashing.
  7299. children.forEach(callPendingCbs);
  7300. children.forEach(recordPosition);
  7301. children.forEach(applyTranslation);
  7302. // force reflow to put everything in position
  7303. // assign to this to avoid being removed in tree-shaking
  7304. // $flow-disable-line
  7305. this._reflow = document.body.offsetHeight;
  7306. children.forEach(function (c) {
  7307. if (c.data.moved) {
  7308. var el = c.elm;
  7309. var s = el.style;
  7310. addTransitionClass(el, moveClass);
  7311. s.transform = s.WebkitTransform = s.transitionDuration = '';
  7312. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  7313. if (!e || /transform$/.test(e.propertyName)) {
  7314. el.removeEventListener(transitionEndEvent, cb);
  7315. el._moveCb = null;
  7316. removeTransitionClass(el, moveClass);
  7317. }
  7318. });
  7319. }
  7320. });
  7321. },
  7322. methods: {
  7323. hasMove: function hasMove (el, moveClass) {
  7324. /* istanbul ignore if */
  7325. if (!hasTransition) {
  7326. return false
  7327. }
  7328. /* istanbul ignore if */
  7329. if (this._hasMove) {
  7330. return this._hasMove
  7331. }
  7332. // Detect whether an element with the move class applied has
  7333. // CSS transitions. Since the element may be inside an entering
  7334. // transition at this very moment, we make a clone of it and remove
  7335. // all other transition classes applied to ensure only the move class
  7336. // is applied.
  7337. var clone = el.cloneNode();
  7338. if (el._transitionClasses) {
  7339. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  7340. }
  7341. addClass(clone, moveClass);
  7342. clone.style.display = 'none';
  7343. this.$el.appendChild(clone);
  7344. var info = getTransitionInfo(clone);
  7345. this.$el.removeChild(clone);
  7346. return (this._hasMove = info.hasTransform)
  7347. }
  7348. }
  7349. };
  7350. function callPendingCbs (c) {
  7351. /* istanbul ignore if */
  7352. if (c.elm._moveCb) {
  7353. c.elm._moveCb();
  7354. }
  7355. /* istanbul ignore if */
  7356. if (c.elm._enterCb) {
  7357. c.elm._enterCb();
  7358. }
  7359. }
  7360. function recordPosition (c) {
  7361. c.data.newPos = c.elm.getBoundingClientRect();
  7362. }
  7363. function applyTranslation (c) {
  7364. var oldPos = c.data.pos;
  7365. var newPos = c.data.newPos;
  7366. var dx = oldPos.left - newPos.left;
  7367. var dy = oldPos.top - newPos.top;
  7368. if (dx || dy) {
  7369. c.data.moved = true;
  7370. var s = c.elm.style;
  7371. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  7372. s.transitionDuration = '0s';
  7373. }
  7374. }
  7375. var platformComponents = {
  7376. Transition: Transition,
  7377. TransitionGroup: TransitionGroup
  7378. };
  7379. /* */
  7380. // install platform specific utils
  7381. Vue$3.config.mustUseProp = mustUseProp;
  7382. Vue$3.config.isReservedTag = isReservedTag;
  7383. Vue$3.config.isReservedAttr = isReservedAttr;
  7384. Vue$3.config.getTagNamespace = getTagNamespace;
  7385. Vue$3.config.isUnknownElement = isUnknownElement;
  7386. // install platform runtime directives & components
  7387. extend(Vue$3.options.directives, platformDirectives);
  7388. extend(Vue$3.options.components, platformComponents);
  7389. // install platform patch function
  7390. Vue$3.prototype.__patch__ = inBrowser ? patch : noop;
  7391. // public mount method
  7392. Vue$3.prototype.$mount = function (
  7393. el,
  7394. hydrating
  7395. ) {
  7396. el = el && inBrowser ? query(el) : undefined;
  7397. return mountComponent(this, el, hydrating)
  7398. };
  7399. // devtools global hook
  7400. /* istanbul ignore next */
  7401. Vue$3.nextTick(function () {
  7402. if (config.devtools) {
  7403. if (devtools) {
  7404. devtools.emit('init', Vue$3);
  7405. } else if ("development" !== 'production' && isChrome) {
  7406. console[console.info ? 'info' : 'log'](
  7407. 'Download the Vue Devtools extension for a better development experience:\n' +
  7408. 'https://github.com/vuejs/vue-devtools'
  7409. );
  7410. }
  7411. }
  7412. if ("development" !== 'production' &&
  7413. config.productionTip !== false &&
  7414. inBrowser && typeof console !== 'undefined'
  7415. ) {
  7416. console[console.info ? 'info' : 'log'](
  7417. "You are running Vue in development mode.\n" +
  7418. "Make sure to turn on production mode when deploying for production.\n" +
  7419. "See more tips at https://vuejs.org/guide/deployment.html"
  7420. );
  7421. }
  7422. }, 0);
  7423. /* */
  7424. // check whether current browser encodes a char inside attribute values
  7425. function shouldDecode (content, encoded) {
  7426. var div = document.createElement('div');
  7427. div.innerHTML = "<div a=\"" + content + "\"/>";
  7428. return div.innerHTML.indexOf(encoded) > 0
  7429. }
  7430. // #3663
  7431. // IE encodes newlines inside attribute values while other browsers don't
  7432. var shouldDecodeNewlines = inBrowser ? shouldDecode('\n', '&#10;') : false;
  7433. /* */
  7434. var defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g;
  7435. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  7436. var buildRegex = cached(function (delimiters) {
  7437. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  7438. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  7439. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  7440. });
  7441. function parseText (
  7442. text,
  7443. delimiters
  7444. ) {
  7445. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  7446. if (!tagRE.test(text)) {
  7447. return
  7448. }
  7449. var tokens = [];
  7450. var lastIndex = tagRE.lastIndex = 0;
  7451. var match, index;
  7452. while ((match = tagRE.exec(text))) {
  7453. index = match.index;
  7454. // push text token
  7455. if (index > lastIndex) {
  7456. tokens.push(JSON.stringify(text.slice(lastIndex, index)));
  7457. }
  7458. // tag token
  7459. var exp = parseFilters(match[1].trim());
  7460. tokens.push(("_s(" + exp + ")"));
  7461. lastIndex = index + match[0].length;
  7462. }
  7463. if (lastIndex < text.length) {
  7464. tokens.push(JSON.stringify(text.slice(lastIndex)));
  7465. }
  7466. return tokens.join('+')
  7467. }
  7468. /* */
  7469. function transformNode (el, options) {
  7470. var warn = options.warn || baseWarn;
  7471. var staticClass = getAndRemoveAttr(el, 'class');
  7472. if ("development" !== 'production' && staticClass) {
  7473. var expression = parseText(staticClass, options.delimiters);
  7474. if (expression) {
  7475. warn(
  7476. "class=\"" + staticClass + "\": " +
  7477. 'Interpolation inside attributes has been removed. ' +
  7478. 'Use v-bind or the colon shorthand instead. For example, ' +
  7479. 'instead of <div class="{{ val }}">, use <div :class="val">.'
  7480. );
  7481. }
  7482. }
  7483. if (staticClass) {
  7484. el.staticClass = JSON.stringify(staticClass);
  7485. }
  7486. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  7487. if (classBinding) {
  7488. el.classBinding = classBinding;
  7489. }
  7490. }
  7491. function genData (el) {
  7492. var data = '';
  7493. if (el.staticClass) {
  7494. data += "staticClass:" + (el.staticClass) + ",";
  7495. }
  7496. if (el.classBinding) {
  7497. data += "class:" + (el.classBinding) + ",";
  7498. }
  7499. return data
  7500. }
  7501. var klass$1 = {
  7502. staticKeys: ['staticClass'],
  7503. transformNode: transformNode,
  7504. genData: genData
  7505. };
  7506. /* */
  7507. function transformNode$1 (el, options) {
  7508. var warn = options.warn || baseWarn;
  7509. var staticStyle = getAndRemoveAttr(el, 'style');
  7510. if (staticStyle) {
  7511. /* istanbul ignore if */
  7512. {
  7513. var expression = parseText(staticStyle, options.delimiters);
  7514. if (expression) {
  7515. warn(
  7516. "style=\"" + staticStyle + "\": " +
  7517. 'Interpolation inside attributes has been removed. ' +
  7518. 'Use v-bind or the colon shorthand instead. For example, ' +
  7519. 'instead of <div style="{{ val }}">, use <div :style="val">.'
  7520. );
  7521. }
  7522. }
  7523. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  7524. }
  7525. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  7526. if (styleBinding) {
  7527. el.styleBinding = styleBinding;
  7528. }
  7529. }
  7530. function genData$1 (el) {
  7531. var data = '';
  7532. if (el.staticStyle) {
  7533. data += "staticStyle:" + (el.staticStyle) + ",";
  7534. }
  7535. if (el.styleBinding) {
  7536. data += "style:(" + (el.styleBinding) + "),";
  7537. }
  7538. return data
  7539. }
  7540. var style$1 = {
  7541. staticKeys: ['staticStyle'],
  7542. transformNode: transformNode$1,
  7543. genData: genData$1
  7544. };
  7545. /* */
  7546. var decoder;
  7547. var he = {
  7548. decode: function decode (html) {
  7549. decoder = decoder || document.createElement('div');
  7550. decoder.innerHTML = html;
  7551. return decoder.textContent
  7552. }
  7553. };
  7554. /* */
  7555. var isUnaryTag = makeMap(
  7556. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  7557. 'link,meta,param,source,track,wbr'
  7558. );
  7559. // Elements that you can, intentionally, leave open
  7560. // (and which close themselves)
  7561. var canBeLeftOpenTag = makeMap(
  7562. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  7563. );
  7564. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  7565. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  7566. var isNonPhrasingTag = makeMap(
  7567. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  7568. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  7569. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  7570. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  7571. 'title,tr,track'
  7572. );
  7573. /**
  7574. * Not type-checking this file because it's mostly vendor code.
  7575. */
  7576. /*!
  7577. * HTML Parser By John Resig (ejohn.org)
  7578. * Modified by Juriy "kangax" Zaytsev
  7579. * Original code by Erik Arvidsson, Mozilla Public License
  7580. * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
  7581. */
  7582. // Regular Expressions for parsing tags and attributes
  7583. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  7584. // could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName
  7585. // but for Vue templates we can enforce a simple charset
  7586. var ncname = '[a-zA-Z_][\\w\\-\\.]*';
  7587. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  7588. var startTagOpen = new RegExp(("^<" + qnameCapture));
  7589. var startTagClose = /^\s*(\/?)>/;
  7590. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  7591. var doctype = /^<!DOCTYPE [^>]+>/i;
  7592. var comment = /^<!--/;
  7593. var conditionalComment = /^<!\[/;
  7594. var IS_REGEX_CAPTURING_BROKEN = false;
  7595. 'x'.replace(/x(.)?/g, function (m, g) {
  7596. IS_REGEX_CAPTURING_BROKEN = g === '';
  7597. });
  7598. // Special Elements (can contain anything)
  7599. var isPlainTextElement = makeMap('script,style,textarea', true);
  7600. var reCache = {};
  7601. var decodingMap = {
  7602. '&lt;': '<',
  7603. '&gt;': '>',
  7604. '&quot;': '"',
  7605. '&amp;': '&',
  7606. '&#10;': '\n'
  7607. };
  7608. var encodedAttr = /&(?:lt|gt|quot|amp);/g;
  7609. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#10);/g;
  7610. // #5992
  7611. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  7612. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  7613. function decodeAttr (value, shouldDecodeNewlines) {
  7614. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  7615. return value.replace(re, function (match) { return decodingMap[match]; })
  7616. }
  7617. function parseHTML (html, options) {
  7618. var stack = [];
  7619. var expectHTML = options.expectHTML;
  7620. var isUnaryTag$$1 = options.isUnaryTag || no;
  7621. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  7622. var index = 0;
  7623. var last, lastTag;
  7624. while (html) {
  7625. last = html;
  7626. // Make sure we're not in a plaintext content element like script/style
  7627. if (!lastTag || !isPlainTextElement(lastTag)) {
  7628. var textEnd = html.indexOf('<');
  7629. if (textEnd === 0) {
  7630. // Comment:
  7631. if (comment.test(html)) {
  7632. var commentEnd = html.indexOf('-->');
  7633. if (commentEnd >= 0) {
  7634. if (options.shouldKeepComment) {
  7635. options.comment(html.substring(4, commentEnd));
  7636. }
  7637. advance(commentEnd + 3);
  7638. continue
  7639. }
  7640. }
  7641. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  7642. if (conditionalComment.test(html)) {
  7643. var conditionalEnd = html.indexOf(']>');
  7644. if (conditionalEnd >= 0) {
  7645. advance(conditionalEnd + 2);
  7646. continue
  7647. }
  7648. }
  7649. // Doctype:
  7650. var doctypeMatch = html.match(doctype);
  7651. if (doctypeMatch) {
  7652. advance(doctypeMatch[0].length);
  7653. continue
  7654. }
  7655. // End tag:
  7656. var endTagMatch = html.match(endTag);
  7657. if (endTagMatch) {
  7658. var curIndex = index;
  7659. advance(endTagMatch[0].length);
  7660. parseEndTag(endTagMatch[1], curIndex, index);
  7661. continue
  7662. }
  7663. // Start tag:
  7664. var startTagMatch = parseStartTag();
  7665. if (startTagMatch) {
  7666. handleStartTag(startTagMatch);
  7667. if (shouldIgnoreFirstNewline(lastTag, html)) {
  7668. advance(1);
  7669. }
  7670. continue
  7671. }
  7672. }
  7673. var text = (void 0), rest = (void 0), next = (void 0);
  7674. if (textEnd >= 0) {
  7675. rest = html.slice(textEnd);
  7676. while (
  7677. !endTag.test(rest) &&
  7678. !startTagOpen.test(rest) &&
  7679. !comment.test(rest) &&
  7680. !conditionalComment.test(rest)
  7681. ) {
  7682. // < in plain text, be forgiving and treat it as text
  7683. next = rest.indexOf('<', 1);
  7684. if (next < 0) { break }
  7685. textEnd += next;
  7686. rest = html.slice(textEnd);
  7687. }
  7688. text = html.substring(0, textEnd);
  7689. advance(textEnd);
  7690. }
  7691. if (textEnd < 0) {
  7692. text = html;
  7693. html = '';
  7694. }
  7695. if (options.chars && text) {
  7696. options.chars(text);
  7697. }
  7698. } else {
  7699. var endTagLength = 0;
  7700. var stackedTag = lastTag.toLowerCase();
  7701. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  7702. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  7703. endTagLength = endTag.length;
  7704. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  7705. text = text
  7706. .replace(/<!--([\s\S]*?)-->/g, '$1')
  7707. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  7708. }
  7709. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  7710. text = text.slice(1);
  7711. }
  7712. if (options.chars) {
  7713. options.chars(text);
  7714. }
  7715. return ''
  7716. });
  7717. index += html.length - rest$1.length;
  7718. html = rest$1;
  7719. parseEndTag(stackedTag, index - endTagLength, index);
  7720. }
  7721. if (html === last) {
  7722. options.chars && options.chars(html);
  7723. if ("development" !== 'production' && !stack.length && options.warn) {
  7724. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""));
  7725. }
  7726. break
  7727. }
  7728. }
  7729. // Clean up any remaining tags
  7730. parseEndTag();
  7731. function advance (n) {
  7732. index += n;
  7733. html = html.substring(n);
  7734. }
  7735. function parseStartTag () {
  7736. var start = html.match(startTagOpen);
  7737. if (start) {
  7738. var match = {
  7739. tagName: start[1],
  7740. attrs: [],
  7741. start: index
  7742. };
  7743. advance(start[0].length);
  7744. var end, attr;
  7745. while (!(end = html.match(startTagClose)) && (attr = html.match(attribute))) {
  7746. advance(attr[0].length);
  7747. match.attrs.push(attr);
  7748. }
  7749. if (end) {
  7750. match.unarySlash = end[1];
  7751. advance(end[0].length);
  7752. match.end = index;
  7753. return match
  7754. }
  7755. }
  7756. }
  7757. function handleStartTag (match) {
  7758. var tagName = match.tagName;
  7759. var unarySlash = match.unarySlash;
  7760. if (expectHTML) {
  7761. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  7762. parseEndTag(lastTag);
  7763. }
  7764. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  7765. parseEndTag(tagName);
  7766. }
  7767. }
  7768. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  7769. var l = match.attrs.length;
  7770. var attrs = new Array(l);
  7771. for (var i = 0; i < l; i++) {
  7772. var args = match.attrs[i];
  7773. // hackish work around FF bug https://bugzilla.mozilla.org/show_bug.cgi?id=369778
  7774. if (IS_REGEX_CAPTURING_BROKEN && args[0].indexOf('""') === -1) {
  7775. if (args[3] === '') { delete args[3]; }
  7776. if (args[4] === '') { delete args[4]; }
  7777. if (args[5] === '') { delete args[5]; }
  7778. }
  7779. var value = args[3] || args[4] || args[5] || '';
  7780. attrs[i] = {
  7781. name: args[1],
  7782. value: decodeAttr(
  7783. value,
  7784. options.shouldDecodeNewlines
  7785. )
  7786. };
  7787. }
  7788. if (!unary) {
  7789. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs });
  7790. lastTag = tagName;
  7791. }
  7792. if (options.start) {
  7793. options.start(tagName, attrs, unary, match.start, match.end);
  7794. }
  7795. }
  7796. function parseEndTag (tagName, start, end) {
  7797. var pos, lowerCasedTagName;
  7798. if (start == null) { start = index; }
  7799. if (end == null) { end = index; }
  7800. if (tagName) {
  7801. lowerCasedTagName = tagName.toLowerCase();
  7802. }
  7803. // Find the closest opened tag of the same type
  7804. if (tagName) {
  7805. for (pos = stack.length - 1; pos >= 0; pos--) {
  7806. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  7807. break
  7808. }
  7809. }
  7810. } else {
  7811. // If no tag name is provided, clean shop
  7812. pos = 0;
  7813. }
  7814. if (pos >= 0) {
  7815. // Close all the open elements, up the stack
  7816. for (var i = stack.length - 1; i >= pos; i--) {
  7817. if ("development" !== 'production' &&
  7818. (i > pos || !tagName) &&
  7819. options.warn
  7820. ) {
  7821. options.warn(
  7822. ("tag <" + (stack[i].tag) + "> has no matching end tag.")
  7823. );
  7824. }
  7825. if (options.end) {
  7826. options.end(stack[i].tag, start, end);
  7827. }
  7828. }
  7829. // Remove the open elements from the stack
  7830. stack.length = pos;
  7831. lastTag = pos && stack[pos - 1].tag;
  7832. } else if (lowerCasedTagName === 'br') {
  7833. if (options.start) {
  7834. options.start(tagName, [], true, start, end);
  7835. }
  7836. } else if (lowerCasedTagName === 'p') {
  7837. if (options.start) {
  7838. options.start(tagName, [], false, start, end);
  7839. }
  7840. if (options.end) {
  7841. options.end(tagName, start, end);
  7842. }
  7843. }
  7844. }
  7845. }
  7846. /* */
  7847. var onRE = /^@|^v-on:/;
  7848. var dirRE = /^v-|^@|^:/;
  7849. var forAliasRE = /(.*?)\s+(?:in|of)\s+(.*)/;
  7850. var forIteratorRE = /\((\{[^}]*\}|[^,]*),([^,]*)(?:,([^,]*))?\)/;
  7851. var argRE = /:(.*)$/;
  7852. var bindRE = /^:|^v-bind:/;
  7853. var modifierRE = /\.[^.]+/g;
  7854. var decodeHTMLCached = cached(he.decode);
  7855. // configurable state
  7856. var warn$2;
  7857. var delimiters;
  7858. var transforms;
  7859. var preTransforms;
  7860. var postTransforms;
  7861. var platformIsPreTag;
  7862. var platformMustUseProp;
  7863. var platformGetTagNamespace;
  7864. function createASTElement (
  7865. tag,
  7866. attrs,
  7867. parent
  7868. ) {
  7869. return {
  7870. type: 1,
  7871. tag: tag,
  7872. attrsList: attrs,
  7873. attrsMap: makeAttrsMap(attrs),
  7874. parent: parent,
  7875. children: []
  7876. }
  7877. }
  7878. /**
  7879. * Convert HTML string to AST.
  7880. */
  7881. function parse (
  7882. template,
  7883. options
  7884. ) {
  7885. warn$2 = options.warn || baseWarn;
  7886. platformIsPreTag = options.isPreTag || no;
  7887. platformMustUseProp = options.mustUseProp || no;
  7888. platformGetTagNamespace = options.getTagNamespace || no;
  7889. transforms = pluckModuleFunction(options.modules, 'transformNode');
  7890. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  7891. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  7892. delimiters = options.delimiters;
  7893. var stack = [];
  7894. var preserveWhitespace = options.preserveWhitespace !== false;
  7895. var root;
  7896. var currentParent;
  7897. var inVPre = false;
  7898. var inPre = false;
  7899. var warned = false;
  7900. function warnOnce (msg) {
  7901. if (!warned) {
  7902. warned = true;
  7903. warn$2(msg);
  7904. }
  7905. }
  7906. function endPre (element) {
  7907. // check pre state
  7908. if (element.pre) {
  7909. inVPre = false;
  7910. }
  7911. if (platformIsPreTag(element.tag)) {
  7912. inPre = false;
  7913. }
  7914. }
  7915. parseHTML(template, {
  7916. warn: warn$2,
  7917. expectHTML: options.expectHTML,
  7918. isUnaryTag: options.isUnaryTag,
  7919. canBeLeftOpenTag: options.canBeLeftOpenTag,
  7920. shouldDecodeNewlines: options.shouldDecodeNewlines,
  7921. shouldKeepComment: options.comments,
  7922. start: function start (tag, attrs, unary) {
  7923. // check namespace.
  7924. // inherit parent ns if there is one
  7925. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  7926. // handle IE svg bug
  7927. /* istanbul ignore if */
  7928. if (isIE && ns === 'svg') {
  7929. attrs = guardIESVGBug(attrs);
  7930. }
  7931. var element = createASTElement(tag, attrs, currentParent);
  7932. if (ns) {
  7933. element.ns = ns;
  7934. }
  7935. if (isForbiddenTag(element) && !isServerRendering()) {
  7936. element.forbidden = true;
  7937. "development" !== 'production' && warn$2(
  7938. 'Templates should only be responsible for mapping the state to the ' +
  7939. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  7940. "<" + tag + ">" + ', as they will not be parsed.'
  7941. );
  7942. }
  7943. // apply pre-transforms
  7944. for (var i = 0; i < preTransforms.length; i++) {
  7945. element = preTransforms[i](element, options) || element;
  7946. }
  7947. if (!inVPre) {
  7948. processPre(element);
  7949. if (element.pre) {
  7950. inVPre = true;
  7951. }
  7952. }
  7953. if (platformIsPreTag(element.tag)) {
  7954. inPre = true;
  7955. }
  7956. if (inVPre) {
  7957. processRawAttrs(element);
  7958. } else if (!element.processed) {
  7959. // structural directives
  7960. processFor(element);
  7961. processIf(element);
  7962. processOnce(element);
  7963. // element-scope stuff
  7964. processElement(element, options);
  7965. }
  7966. function checkRootConstraints (el) {
  7967. {
  7968. if (el.tag === 'slot' || el.tag === 'template') {
  7969. warnOnce(
  7970. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  7971. 'contain multiple nodes.'
  7972. );
  7973. }
  7974. if (el.attrsMap.hasOwnProperty('v-for')) {
  7975. warnOnce(
  7976. 'Cannot use v-for on stateful component root element because ' +
  7977. 'it renders multiple elements.'
  7978. );
  7979. }
  7980. }
  7981. }
  7982. // tree management
  7983. if (!root) {
  7984. root = element;
  7985. checkRootConstraints(root);
  7986. } else if (!stack.length) {
  7987. // allow root elements with v-if, v-else-if and v-else
  7988. if (root.if && (element.elseif || element.else)) {
  7989. checkRootConstraints(element);
  7990. addIfCondition(root, {
  7991. exp: element.elseif,
  7992. block: element
  7993. });
  7994. } else {
  7995. warnOnce(
  7996. "Component template should contain exactly one root element. " +
  7997. "If you are using v-if on multiple elements, " +
  7998. "use v-else-if to chain them instead."
  7999. );
  8000. }
  8001. }
  8002. if (currentParent && !element.forbidden) {
  8003. if (element.elseif || element.else) {
  8004. processIfConditions(element, currentParent);
  8005. } else if (element.slotScope) { // scoped slot
  8006. currentParent.plain = false;
  8007. var name = element.slotTarget || '"default"';(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  8008. } else {
  8009. currentParent.children.push(element);
  8010. element.parent = currentParent;
  8011. }
  8012. }
  8013. if (!unary) {
  8014. currentParent = element;
  8015. stack.push(element);
  8016. } else {
  8017. endPre(element);
  8018. }
  8019. // apply post-transforms
  8020. for (var i$1 = 0; i$1 < postTransforms.length; i$1++) {
  8021. postTransforms[i$1](element, options);
  8022. }
  8023. },
  8024. end: function end () {
  8025. // remove trailing whitespace
  8026. var element = stack[stack.length - 1];
  8027. var lastNode = element.children[element.children.length - 1];
  8028. if (lastNode && lastNode.type === 3 && lastNode.text === ' ' && !inPre) {
  8029. element.children.pop();
  8030. }
  8031. // pop stack
  8032. stack.length -= 1;
  8033. currentParent = stack[stack.length - 1];
  8034. endPre(element);
  8035. },
  8036. chars: function chars (text) {
  8037. if (!currentParent) {
  8038. {
  8039. if (text === template) {
  8040. warnOnce(
  8041. 'Component template requires a root element, rather than just text.'
  8042. );
  8043. } else if ((text = text.trim())) {
  8044. warnOnce(
  8045. ("text \"" + text + "\" outside root element will be ignored.")
  8046. );
  8047. }
  8048. }
  8049. return
  8050. }
  8051. // IE textarea placeholder bug
  8052. /* istanbul ignore if */
  8053. if (isIE &&
  8054. currentParent.tag === 'textarea' &&
  8055. currentParent.attrsMap.placeholder === text
  8056. ) {
  8057. return
  8058. }
  8059. var children = currentParent.children;
  8060. text = inPre || text.trim()
  8061. ? isTextTag(currentParent) ? text : decodeHTMLCached(text)
  8062. // only preserve whitespace if its not right after a starting tag
  8063. : preserveWhitespace && children.length ? ' ' : '';
  8064. if (text) {
  8065. var expression;
  8066. if (!inVPre && text !== ' ' && (expression = parseText(text, delimiters))) {
  8067. children.push({
  8068. type: 2,
  8069. expression: expression,
  8070. text: text
  8071. });
  8072. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  8073. children.push({
  8074. type: 3,
  8075. text: text
  8076. });
  8077. }
  8078. }
  8079. },
  8080. comment: function comment (text) {
  8081. currentParent.children.push({
  8082. type: 3,
  8083. text: text,
  8084. isComment: true
  8085. });
  8086. }
  8087. });
  8088. return root
  8089. }
  8090. function processPre (el) {
  8091. if (getAndRemoveAttr(el, 'v-pre') != null) {
  8092. el.pre = true;
  8093. }
  8094. }
  8095. function processRawAttrs (el) {
  8096. var l = el.attrsList.length;
  8097. if (l) {
  8098. var attrs = el.attrs = new Array(l);
  8099. for (var i = 0; i < l; i++) {
  8100. attrs[i] = {
  8101. name: el.attrsList[i].name,
  8102. value: JSON.stringify(el.attrsList[i].value)
  8103. };
  8104. }
  8105. } else if (!el.pre) {
  8106. // non root node in pre blocks with no attributes
  8107. el.plain = true;
  8108. }
  8109. }
  8110. function processElement (element, options) {
  8111. processKey(element);
  8112. // determine whether this is a plain element after
  8113. // removing structural attributes
  8114. element.plain = !element.key && !element.attrsList.length;
  8115. processRef(element);
  8116. processSlot(element);
  8117. processComponent(element);
  8118. for (var i = 0; i < transforms.length; i++) {
  8119. element = transforms[i](element, options) || element;
  8120. }
  8121. processAttrs(element);
  8122. }
  8123. function processKey (el) {
  8124. var exp = getBindingAttr(el, 'key');
  8125. if (exp) {
  8126. if ("development" !== 'production' && el.tag === 'template') {
  8127. warn$2("<template> cannot be keyed. Place the key on real elements instead.");
  8128. }
  8129. el.key = exp;
  8130. }
  8131. }
  8132. function processRef (el) {
  8133. var ref = getBindingAttr(el, 'ref');
  8134. if (ref) {
  8135. el.ref = ref;
  8136. el.refInFor = checkInFor(el);
  8137. }
  8138. }
  8139. function processFor (el) {
  8140. var exp;
  8141. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  8142. var inMatch = exp.match(forAliasRE);
  8143. if (!inMatch) {
  8144. "development" !== 'production' && warn$2(
  8145. ("Invalid v-for expression: " + exp)
  8146. );
  8147. return
  8148. }
  8149. el.for = inMatch[2].trim();
  8150. var alias = inMatch[1].trim();
  8151. var iteratorMatch = alias.match(forIteratorRE);
  8152. if (iteratorMatch) {
  8153. el.alias = iteratorMatch[1].trim();
  8154. el.iterator1 = iteratorMatch[2].trim();
  8155. if (iteratorMatch[3]) {
  8156. el.iterator2 = iteratorMatch[3].trim();
  8157. }
  8158. } else {
  8159. el.alias = alias;
  8160. }
  8161. }
  8162. }
  8163. function processIf (el) {
  8164. var exp = getAndRemoveAttr(el, 'v-if');
  8165. if (exp) {
  8166. el.if = exp;
  8167. addIfCondition(el, {
  8168. exp: exp,
  8169. block: el
  8170. });
  8171. } else {
  8172. if (getAndRemoveAttr(el, 'v-else') != null) {
  8173. el.else = true;
  8174. }
  8175. var elseif = getAndRemoveAttr(el, 'v-else-if');
  8176. if (elseif) {
  8177. el.elseif = elseif;
  8178. }
  8179. }
  8180. }
  8181. function processIfConditions (el, parent) {
  8182. var prev = findPrevElement(parent.children);
  8183. if (prev && prev.if) {
  8184. addIfCondition(prev, {
  8185. exp: el.elseif,
  8186. block: el
  8187. });
  8188. } else {
  8189. warn$2(
  8190. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  8191. "used on element <" + (el.tag) + "> without corresponding v-if."
  8192. );
  8193. }
  8194. }
  8195. function findPrevElement (children) {
  8196. var i = children.length;
  8197. while (i--) {
  8198. if (children[i].type === 1) {
  8199. return children[i]
  8200. } else {
  8201. if ("development" !== 'production' && children[i].text !== ' ') {
  8202. warn$2(
  8203. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  8204. "will be ignored."
  8205. );
  8206. }
  8207. children.pop();
  8208. }
  8209. }
  8210. }
  8211. function addIfCondition (el, condition) {
  8212. if (!el.ifConditions) {
  8213. el.ifConditions = [];
  8214. }
  8215. el.ifConditions.push(condition);
  8216. }
  8217. function processOnce (el) {
  8218. var once$$1 = getAndRemoveAttr(el, 'v-once');
  8219. if (once$$1 != null) {
  8220. el.once = true;
  8221. }
  8222. }
  8223. function processSlot (el) {
  8224. if (el.tag === 'slot') {
  8225. el.slotName = getBindingAttr(el, 'name');
  8226. if ("development" !== 'production' && el.key) {
  8227. warn$2(
  8228. "`key` does not work on <slot> because slots are abstract outlets " +
  8229. "and can possibly expand into multiple elements. " +
  8230. "Use the key on a wrapping element instead."
  8231. );
  8232. }
  8233. } else {
  8234. var slotScope;
  8235. if (el.tag === 'template') {
  8236. slotScope = getAndRemoveAttr(el, 'scope');
  8237. /* istanbul ignore if */
  8238. if ("development" !== 'production' && slotScope) {
  8239. warn$2(
  8240. "the \"scope\" attribute for scoped slots have been deprecated and " +
  8241. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  8242. "can also be used on plain elements in addition to <template> to " +
  8243. "denote scoped slots.",
  8244. true
  8245. );
  8246. }
  8247. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  8248. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  8249. el.slotScope = slotScope;
  8250. }
  8251. var slotTarget = getBindingAttr(el, 'slot');
  8252. if (slotTarget) {
  8253. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  8254. // preserve slot as an attribute for native shadow DOM compat
  8255. // only for non-scoped slots.
  8256. if (!el.slotScope) {
  8257. addAttr(el, 'slot', slotTarget);
  8258. }
  8259. }
  8260. }
  8261. }
  8262. function processComponent (el) {
  8263. var binding;
  8264. if ((binding = getBindingAttr(el, 'is'))) {
  8265. el.component = binding;
  8266. }
  8267. if (getAndRemoveAttr(el, 'inline-template') != null) {
  8268. el.inlineTemplate = true;
  8269. }
  8270. }
  8271. function processAttrs (el) {
  8272. var list = el.attrsList;
  8273. var i, l, name, rawName, value, modifiers, isProp;
  8274. for (i = 0, l = list.length; i < l; i++) {
  8275. name = rawName = list[i].name;
  8276. value = list[i].value;
  8277. if (dirRE.test(name)) {
  8278. // mark element as dynamic
  8279. el.hasBindings = true;
  8280. // modifiers
  8281. modifiers = parseModifiers(name);
  8282. if (modifiers) {
  8283. name = name.replace(modifierRE, '');
  8284. }
  8285. if (bindRE.test(name)) { // v-bind
  8286. name = name.replace(bindRE, '');
  8287. value = parseFilters(value);
  8288. isProp = false;
  8289. if (modifiers) {
  8290. if (modifiers.prop) {
  8291. isProp = true;
  8292. name = camelize(name);
  8293. if (name === 'innerHtml') { name = 'innerHTML'; }
  8294. }
  8295. if (modifiers.camel) {
  8296. name = camelize(name);
  8297. }
  8298. if (modifiers.sync) {
  8299. addHandler(
  8300. el,
  8301. ("update:" + (camelize(name))),
  8302. genAssignmentCode(value, "$event")
  8303. );
  8304. }
  8305. }
  8306. if (isProp || (
  8307. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  8308. )) {
  8309. addProp(el, name, value);
  8310. } else {
  8311. addAttr(el, name, value);
  8312. }
  8313. } else if (onRE.test(name)) { // v-on
  8314. name = name.replace(onRE, '');
  8315. addHandler(el, name, value, modifiers, false, warn$2);
  8316. } else { // normal directives
  8317. name = name.replace(dirRE, '');
  8318. // parse arg
  8319. var argMatch = name.match(argRE);
  8320. var arg = argMatch && argMatch[1];
  8321. if (arg) {
  8322. name = name.slice(0, -(arg.length + 1));
  8323. }
  8324. addDirective(el, name, rawName, value, arg, modifiers);
  8325. if ("development" !== 'production' && name === 'model') {
  8326. checkForAliasModel(el, value);
  8327. }
  8328. }
  8329. } else {
  8330. // literal attribute
  8331. {
  8332. var expression = parseText(value, delimiters);
  8333. if (expression) {
  8334. warn$2(
  8335. name + "=\"" + value + "\": " +
  8336. 'Interpolation inside attributes has been removed. ' +
  8337. 'Use v-bind or the colon shorthand instead. For example, ' +
  8338. 'instead of <div id="{{ val }}">, use <div :id="val">.'
  8339. );
  8340. }
  8341. }
  8342. addAttr(el, name, JSON.stringify(value));
  8343. }
  8344. }
  8345. }
  8346. function checkInFor (el) {
  8347. var parent = el;
  8348. while (parent) {
  8349. if (parent.for !== undefined) {
  8350. return true
  8351. }
  8352. parent = parent.parent;
  8353. }
  8354. return false
  8355. }
  8356. function parseModifiers (name) {
  8357. var match = name.match(modifierRE);
  8358. if (match) {
  8359. var ret = {};
  8360. match.forEach(function (m) { ret[m.slice(1)] = true; });
  8361. return ret
  8362. }
  8363. }
  8364. function makeAttrsMap (attrs) {
  8365. var map = {};
  8366. for (var i = 0, l = attrs.length; i < l; i++) {
  8367. if (
  8368. "development" !== 'production' &&
  8369. map[attrs[i].name] && !isIE && !isEdge
  8370. ) {
  8371. warn$2('duplicate attribute: ' + attrs[i].name);
  8372. }
  8373. map[attrs[i].name] = attrs[i].value;
  8374. }
  8375. return map
  8376. }
  8377. // for script (e.g. type="x/template") or style, do not decode content
  8378. function isTextTag (el) {
  8379. return el.tag === 'script' || el.tag === 'style'
  8380. }
  8381. function isForbiddenTag (el) {
  8382. return (
  8383. el.tag === 'style' ||
  8384. (el.tag === 'script' && (
  8385. !el.attrsMap.type ||
  8386. el.attrsMap.type === 'text/javascript'
  8387. ))
  8388. )
  8389. }
  8390. var ieNSBug = /^xmlns:NS\d+/;
  8391. var ieNSPrefix = /^NS\d+:/;
  8392. /* istanbul ignore next */
  8393. function guardIESVGBug (attrs) {
  8394. var res = [];
  8395. for (var i = 0; i < attrs.length; i++) {
  8396. var attr = attrs[i];
  8397. if (!ieNSBug.test(attr.name)) {
  8398. attr.name = attr.name.replace(ieNSPrefix, '');
  8399. res.push(attr);
  8400. }
  8401. }
  8402. return res
  8403. }
  8404. function checkForAliasModel (el, value) {
  8405. var _el = el;
  8406. while (_el) {
  8407. if (_el.for && _el.alias === value) {
  8408. warn$2(
  8409. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  8410. "You are binding v-model directly to a v-for iteration alias. " +
  8411. "This will not be able to modify the v-for source array because " +
  8412. "writing to the alias is like modifying a function local variable. " +
  8413. "Consider using an array of objects and use v-model on an object property instead."
  8414. );
  8415. }
  8416. _el = _el.parent;
  8417. }
  8418. }
  8419. /* */
  8420. /**
  8421. * Expand input[v-model] with dyanmic type bindings into v-if-else chains
  8422. * Turn this:
  8423. * <input v-model="data[type]" :type="type">
  8424. * into this:
  8425. * <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]">
  8426. * <input v-else-if="type === 'radio'" type="radio" v-model="data[type]">
  8427. * <input v-else :type="type" v-model="data[type]">
  8428. */
  8429. function preTransformNode (el, options) {
  8430. if (el.tag === 'input') {
  8431. var map = el.attrsMap;
  8432. if (map['v-model'] && (map['v-bind:type'] || map[':type'])) {
  8433. var typeBinding = getBindingAttr(el, 'type');
  8434. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  8435. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  8436. // 1. checkbox
  8437. var branch0 = cloneASTElement(el);
  8438. // process for on the main node
  8439. processFor(branch0);
  8440. addRawAttr(branch0, 'type', 'checkbox');
  8441. processElement(branch0, options);
  8442. branch0.processed = true; // prevent it from double-processed
  8443. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  8444. addIfCondition(branch0, {
  8445. exp: branch0.if,
  8446. block: branch0
  8447. });
  8448. // 2. add radio else-if condition
  8449. var branch1 = cloneASTElement(el);
  8450. getAndRemoveAttr(branch1, 'v-for', true);
  8451. addRawAttr(branch1, 'type', 'radio');
  8452. processElement(branch1, options);
  8453. addIfCondition(branch0, {
  8454. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  8455. block: branch1
  8456. });
  8457. // 3. other
  8458. var branch2 = cloneASTElement(el);
  8459. getAndRemoveAttr(branch2, 'v-for', true);
  8460. addRawAttr(branch2, ':type', typeBinding);
  8461. processElement(branch2, options);
  8462. addIfCondition(branch0, {
  8463. exp: ifCondition,
  8464. block: branch2
  8465. });
  8466. return branch0
  8467. }
  8468. }
  8469. }
  8470. function cloneASTElement (el) {
  8471. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  8472. }
  8473. function addRawAttr (el, name, value) {
  8474. el.attrsMap[name] = value;
  8475. el.attrsList.push({ name: name, value: value });
  8476. }
  8477. var model$2 = {
  8478. preTransformNode: preTransformNode
  8479. };
  8480. var modules$1 = [
  8481. klass$1,
  8482. style$1,
  8483. model$2
  8484. ];
  8485. /* */
  8486. function text (el, dir) {
  8487. if (dir.value) {
  8488. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"));
  8489. }
  8490. }
  8491. /* */
  8492. function html (el, dir) {
  8493. if (dir.value) {
  8494. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"));
  8495. }
  8496. }
  8497. var directives$1 = {
  8498. model: model,
  8499. text: text,
  8500. html: html
  8501. };
  8502. /* */
  8503. var baseOptions = {
  8504. expectHTML: true,
  8505. modules: modules$1,
  8506. directives: directives$1,
  8507. isPreTag: isPreTag,
  8508. isUnaryTag: isUnaryTag,
  8509. mustUseProp: mustUseProp,
  8510. canBeLeftOpenTag: canBeLeftOpenTag,
  8511. isReservedTag: isReservedTag,
  8512. getTagNamespace: getTagNamespace,
  8513. staticKeys: genStaticKeys(modules$1)
  8514. };
  8515. /* */
  8516. var isStaticKey;
  8517. var isPlatformReservedTag;
  8518. var genStaticKeysCached = cached(genStaticKeys$1);
  8519. /**
  8520. * Goal of the optimizer: walk the generated template AST tree
  8521. * and detect sub-trees that are purely static, i.e. parts of
  8522. * the DOM that never needs to change.
  8523. *
  8524. * Once we detect these sub-trees, we can:
  8525. *
  8526. * 1. Hoist them into constants, so that we no longer need to
  8527. * create fresh nodes for them on each re-render;
  8528. * 2. Completely skip them in the patching process.
  8529. */
  8530. function optimize (root, options) {
  8531. if (!root) { return }
  8532. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  8533. isPlatformReservedTag = options.isReservedTag || no;
  8534. // first pass: mark all non-static nodes.
  8535. markStatic$1(root);
  8536. // second pass: mark static roots.
  8537. markStaticRoots(root, false);
  8538. }
  8539. function genStaticKeys$1 (keys) {
  8540. return makeMap(
  8541. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs' +
  8542. (keys ? ',' + keys : '')
  8543. )
  8544. }
  8545. function markStatic$1 (node) {
  8546. node.static = isStatic(node);
  8547. if (node.type === 1) {
  8548. // do not make component slot content static. this avoids
  8549. // 1. components not able to mutate slot nodes
  8550. // 2. static slot content fails for hot-reloading
  8551. if (
  8552. !isPlatformReservedTag(node.tag) &&
  8553. node.tag !== 'slot' &&
  8554. node.attrsMap['inline-template'] == null
  8555. ) {
  8556. return
  8557. }
  8558. for (var i = 0, l = node.children.length; i < l; i++) {
  8559. var child = node.children[i];
  8560. markStatic$1(child);
  8561. if (!child.static) {
  8562. node.static = false;
  8563. }
  8564. }
  8565. if (node.ifConditions) {
  8566. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  8567. var block = node.ifConditions[i$1].block;
  8568. markStatic$1(block);
  8569. if (!block.static) {
  8570. node.static = false;
  8571. }
  8572. }
  8573. }
  8574. }
  8575. }
  8576. function markStaticRoots (node, isInFor) {
  8577. if (node.type === 1) {
  8578. if (node.static || node.once) {
  8579. node.staticInFor = isInFor;
  8580. }
  8581. // For a node to qualify as a static root, it should have children that
  8582. // are not just static text. Otherwise the cost of hoisting out will
  8583. // outweigh the benefits and it's better off to just always render it fresh.
  8584. if (node.static && node.children.length && !(
  8585. node.children.length === 1 &&
  8586. node.children[0].type === 3
  8587. )) {
  8588. node.staticRoot = true;
  8589. return
  8590. } else {
  8591. node.staticRoot = false;
  8592. }
  8593. if (node.children) {
  8594. for (var i = 0, l = node.children.length; i < l; i++) {
  8595. markStaticRoots(node.children[i], isInFor || !!node.for);
  8596. }
  8597. }
  8598. if (node.ifConditions) {
  8599. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  8600. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  8601. }
  8602. }
  8603. }
  8604. }
  8605. function isStatic (node) {
  8606. if (node.type === 2) { // expression
  8607. return false
  8608. }
  8609. if (node.type === 3) { // text
  8610. return true
  8611. }
  8612. return !!(node.pre || (
  8613. !node.hasBindings && // no dynamic bindings
  8614. !node.if && !node.for && // not v-if or v-for or v-else
  8615. !isBuiltInTag(node.tag) && // not a built-in
  8616. isPlatformReservedTag(node.tag) && // not a component
  8617. !isDirectChildOfTemplateFor(node) &&
  8618. Object.keys(node).every(isStaticKey)
  8619. ))
  8620. }
  8621. function isDirectChildOfTemplateFor (node) {
  8622. while (node.parent) {
  8623. node = node.parent;
  8624. if (node.tag !== 'template') {
  8625. return false
  8626. }
  8627. if (node.for) {
  8628. return true
  8629. }
  8630. }
  8631. return false
  8632. }
  8633. /* */
  8634. var fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
  8635. var simplePathRE = /^\s*[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?']|\[".*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*\s*$/;
  8636. // keyCode aliases
  8637. var keyCodes = {
  8638. esc: 27,
  8639. tab: 9,
  8640. enter: 13,
  8641. space: 32,
  8642. up: 38,
  8643. left: 37,
  8644. right: 39,
  8645. down: 40,
  8646. 'delete': [8, 46]
  8647. };
  8648. // #4868: modifiers that prevent the execution of the listener
  8649. // need to explicitly return null so that we can determine whether to remove
  8650. // the listener for .once
  8651. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  8652. var modifierCode = {
  8653. stop: '$event.stopPropagation();',
  8654. prevent: '$event.preventDefault();',
  8655. self: genGuard("$event.target !== $event.currentTarget"),
  8656. ctrl: genGuard("!$event.ctrlKey"),
  8657. shift: genGuard("!$event.shiftKey"),
  8658. alt: genGuard("!$event.altKey"),
  8659. meta: genGuard("!$event.metaKey"),
  8660. left: genGuard("'button' in $event && $event.button !== 0"),
  8661. middle: genGuard("'button' in $event && $event.button !== 1"),
  8662. right: genGuard("'button' in $event && $event.button !== 2")
  8663. };
  8664. function genHandlers (
  8665. events,
  8666. isNative,
  8667. warn
  8668. ) {
  8669. var res = isNative ? 'nativeOn:{' : 'on:{';
  8670. for (var name in events) {
  8671. var handler = events[name];
  8672. // #5330: warn click.right, since right clicks do not actually fire click events.
  8673. if ("development" !== 'production' &&
  8674. name === 'click' &&
  8675. handler && handler.modifiers && handler.modifiers.right
  8676. ) {
  8677. warn(
  8678. "Use \"contextmenu\" instead of \"click.right\" since right clicks " +
  8679. "do not actually fire \"click\" events."
  8680. );
  8681. }
  8682. res += "\"" + name + "\":" + (genHandler(name, handler)) + ",";
  8683. }
  8684. return res.slice(0, -1) + '}'
  8685. }
  8686. function genHandler (
  8687. name,
  8688. handler
  8689. ) {
  8690. if (!handler) {
  8691. return 'function(){}'
  8692. }
  8693. if (Array.isArray(handler)) {
  8694. return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
  8695. }
  8696. var isMethodPath = simplePathRE.test(handler.value);
  8697. var isFunctionExpression = fnExpRE.test(handler.value);
  8698. if (!handler.modifiers) {
  8699. return isMethodPath || isFunctionExpression
  8700. ? handler.value
  8701. : ("function($event){" + (handler.value) + "}") // inline statement
  8702. } else {
  8703. var code = '';
  8704. var genModifierCode = '';
  8705. var keys = [];
  8706. for (var key in handler.modifiers) {
  8707. if (modifierCode[key]) {
  8708. genModifierCode += modifierCode[key];
  8709. // left/right
  8710. if (keyCodes[key]) {
  8711. keys.push(key);
  8712. }
  8713. } else if (key === 'exact') {
  8714. var modifiers = (handler.modifiers);
  8715. genModifierCode += genGuard(
  8716. ['ctrl', 'shift', 'alt', 'meta']
  8717. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  8718. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  8719. .join('||')
  8720. );
  8721. } else {
  8722. keys.push(key);
  8723. }
  8724. }
  8725. if (keys.length) {
  8726. code += genKeyFilter(keys);
  8727. }
  8728. // Make sure modifiers like prevent and stop get executed after key filtering
  8729. if (genModifierCode) {
  8730. code += genModifierCode;
  8731. }
  8732. var handlerCode = isMethodPath
  8733. ? handler.value + '($event)'
  8734. : isFunctionExpression
  8735. ? ("(" + (handler.value) + ")($event)")
  8736. : handler.value;
  8737. return ("function($event){" + code + handlerCode + "}")
  8738. }
  8739. }
  8740. function genKeyFilter (keys) {
  8741. return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
  8742. }
  8743. function genFilterCode (key) {
  8744. var keyVal = parseInt(key, 10);
  8745. if (keyVal) {
  8746. return ("$event.keyCode!==" + keyVal)
  8747. }
  8748. var code = keyCodes[key];
  8749. return (
  8750. "_k($event.keyCode," +
  8751. (JSON.stringify(key)) + "," +
  8752. (JSON.stringify(code)) + "," +
  8753. "$event.key)"
  8754. )
  8755. }
  8756. /* */
  8757. function on (el, dir) {
  8758. if ("development" !== 'production' && dir.modifiers) {
  8759. warn("v-on without argument does not support modifiers.");
  8760. }
  8761. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  8762. }
  8763. /* */
  8764. function bind$1 (el, dir) {
  8765. el.wrapData = function (code) {
  8766. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  8767. };
  8768. }
  8769. /* */
  8770. var baseDirectives = {
  8771. on: on,
  8772. bind: bind$1,
  8773. cloak: noop
  8774. };
  8775. /* */
  8776. var CodegenState = function CodegenState (options) {
  8777. this.options = options;
  8778. this.warn = options.warn || baseWarn;
  8779. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  8780. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  8781. this.directives = extend(extend({}, baseDirectives), options.directives);
  8782. var isReservedTag = options.isReservedTag || no;
  8783. this.maybeComponent = function (el) { return !isReservedTag(el.tag); };
  8784. this.onceId = 0;
  8785. this.staticRenderFns = [];
  8786. };
  8787. function generate (
  8788. ast,
  8789. options
  8790. ) {
  8791. var state = new CodegenState(options);
  8792. var code = ast ? genElement(ast, state) : '_c("div")';
  8793. return {
  8794. render: ("with(this){return " + code + "}"),
  8795. staticRenderFns: state.staticRenderFns
  8796. }
  8797. }
  8798. function genElement (el, state) {
  8799. if (el.staticRoot && !el.staticProcessed) {
  8800. return genStatic(el, state)
  8801. } else if (el.once && !el.onceProcessed) {
  8802. return genOnce(el, state)
  8803. } else if (el.for && !el.forProcessed) {
  8804. return genFor(el, state)
  8805. } else if (el.if && !el.ifProcessed) {
  8806. return genIf(el, state)
  8807. } else if (el.tag === 'template' && !el.slotTarget) {
  8808. return genChildren(el, state) || 'void 0'
  8809. } else if (el.tag === 'slot') {
  8810. return genSlot(el, state)
  8811. } else {
  8812. // component or element
  8813. var code;
  8814. if (el.component) {
  8815. code = genComponent(el.component, el, state);
  8816. } else {
  8817. var data = el.plain ? undefined : genData$2(el, state);
  8818. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  8819. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  8820. }
  8821. // module transforms
  8822. for (var i = 0; i < state.transforms.length; i++) {
  8823. code = state.transforms[i](el, code);
  8824. }
  8825. return code
  8826. }
  8827. }
  8828. // hoist static sub-trees out
  8829. function genStatic (el, state) {
  8830. el.staticProcessed = true;
  8831. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  8832. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  8833. }
  8834. // v-once
  8835. function genOnce (el, state) {
  8836. el.onceProcessed = true;
  8837. if (el.if && !el.ifProcessed) {
  8838. return genIf(el, state)
  8839. } else if (el.staticInFor) {
  8840. var key = '';
  8841. var parent = el.parent;
  8842. while (parent) {
  8843. if (parent.for) {
  8844. key = parent.key;
  8845. break
  8846. }
  8847. parent = parent.parent;
  8848. }
  8849. if (!key) {
  8850. "development" !== 'production' && state.warn(
  8851. "v-once can only be used inside v-for that is keyed. "
  8852. );
  8853. return genElement(el, state)
  8854. }
  8855. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  8856. } else {
  8857. return genStatic(el, state)
  8858. }
  8859. }
  8860. function genIf (
  8861. el,
  8862. state,
  8863. altGen,
  8864. altEmpty
  8865. ) {
  8866. el.ifProcessed = true; // avoid recursion
  8867. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  8868. }
  8869. function genIfConditions (
  8870. conditions,
  8871. state,
  8872. altGen,
  8873. altEmpty
  8874. ) {
  8875. if (!conditions.length) {
  8876. return altEmpty || '_e()'
  8877. }
  8878. var condition = conditions.shift();
  8879. if (condition.exp) {
  8880. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  8881. } else {
  8882. return ("" + (genTernaryExp(condition.block)))
  8883. }
  8884. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  8885. function genTernaryExp (el) {
  8886. return altGen
  8887. ? altGen(el, state)
  8888. : el.once
  8889. ? genOnce(el, state)
  8890. : genElement(el, state)
  8891. }
  8892. }
  8893. function genFor (
  8894. el,
  8895. state,
  8896. altGen,
  8897. altHelper
  8898. ) {
  8899. var exp = el.for;
  8900. var alias = el.alias;
  8901. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  8902. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  8903. if ("development" !== 'production' &&
  8904. state.maybeComponent(el) &&
  8905. el.tag !== 'slot' &&
  8906. el.tag !== 'template' &&
  8907. !el.key
  8908. ) {
  8909. state.warn(
  8910. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  8911. "v-for should have explicit keys. " +
  8912. "See https://vuejs.org/guide/list.html#key for more info.",
  8913. true /* tip */
  8914. );
  8915. }
  8916. el.forProcessed = true; // avoid recursion
  8917. return (altHelper || '_l') + "((" + exp + ")," +
  8918. "function(" + alias + iterator1 + iterator2 + "){" +
  8919. "return " + ((altGen || genElement)(el, state)) +
  8920. '})'
  8921. }
  8922. function genData$2 (el, state) {
  8923. var data = '{';
  8924. // directives first.
  8925. // directives may mutate the el's other properties before they are generated.
  8926. var dirs = genDirectives(el, state);
  8927. if (dirs) { data += dirs + ','; }
  8928. // key
  8929. if (el.key) {
  8930. data += "key:" + (el.key) + ",";
  8931. }
  8932. // ref
  8933. if (el.ref) {
  8934. data += "ref:" + (el.ref) + ",";
  8935. }
  8936. if (el.refInFor) {
  8937. data += "refInFor:true,";
  8938. }
  8939. // pre
  8940. if (el.pre) {
  8941. data += "pre:true,";
  8942. }
  8943. // record original tag name for components using "is" attribute
  8944. if (el.component) {
  8945. data += "tag:\"" + (el.tag) + "\",";
  8946. }
  8947. // module data generation functions
  8948. for (var i = 0; i < state.dataGenFns.length; i++) {
  8949. data += state.dataGenFns[i](el);
  8950. }
  8951. // attributes
  8952. if (el.attrs) {
  8953. data += "attrs:{" + (genProps(el.attrs)) + "},";
  8954. }
  8955. // DOM props
  8956. if (el.props) {
  8957. data += "domProps:{" + (genProps(el.props)) + "},";
  8958. }
  8959. // event handlers
  8960. if (el.events) {
  8961. data += (genHandlers(el.events, false, state.warn)) + ",";
  8962. }
  8963. if (el.nativeEvents) {
  8964. data += (genHandlers(el.nativeEvents, true, state.warn)) + ",";
  8965. }
  8966. // slot target
  8967. // only for non-scoped slots
  8968. if (el.slotTarget && !el.slotScope) {
  8969. data += "slot:" + (el.slotTarget) + ",";
  8970. }
  8971. // scoped slots
  8972. if (el.scopedSlots) {
  8973. data += (genScopedSlots(el.scopedSlots, state)) + ",";
  8974. }
  8975. // component v-model
  8976. if (el.model) {
  8977. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  8978. }
  8979. // inline-template
  8980. if (el.inlineTemplate) {
  8981. var inlineTemplate = genInlineTemplate(el, state);
  8982. if (inlineTemplate) {
  8983. data += inlineTemplate + ",";
  8984. }
  8985. }
  8986. data = data.replace(/,$/, '') + '}';
  8987. // v-bind data wrap
  8988. if (el.wrapData) {
  8989. data = el.wrapData(data);
  8990. }
  8991. // v-on data wrap
  8992. if (el.wrapListeners) {
  8993. data = el.wrapListeners(data);
  8994. }
  8995. return data
  8996. }
  8997. function genDirectives (el, state) {
  8998. var dirs = el.directives;
  8999. if (!dirs) { return }
  9000. var res = 'directives:[';
  9001. var hasRuntime = false;
  9002. var i, l, dir, needRuntime;
  9003. for (i = 0, l = dirs.length; i < l; i++) {
  9004. dir = dirs[i];
  9005. needRuntime = true;
  9006. var gen = state.directives[dir.name];
  9007. if (gen) {
  9008. // compile-time directive that manipulates AST.
  9009. // returns true if it also needs a runtime counterpart.
  9010. needRuntime = !!gen(el, dir, state.warn);
  9011. }
  9012. if (needRuntime) {
  9013. hasRuntime = true;
  9014. res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:\"" + (dir.arg) + "\"") : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
  9015. }
  9016. }
  9017. if (hasRuntime) {
  9018. return res.slice(0, -1) + ']'
  9019. }
  9020. }
  9021. function genInlineTemplate (el, state) {
  9022. var ast = el.children[0];
  9023. if ("development" !== 'production' && (
  9024. el.children.length !== 1 || ast.type !== 1
  9025. )) {
  9026. state.warn('Inline-template components must have exactly one child element.');
  9027. }
  9028. if (ast.type === 1) {
  9029. var inlineRenderFns = generate(ast, state.options);
  9030. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  9031. }
  9032. }
  9033. function genScopedSlots (
  9034. slots,
  9035. state
  9036. ) {
  9037. return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
  9038. return genScopedSlot(key, slots[key], state)
  9039. }).join(',')) + "])")
  9040. }
  9041. function genScopedSlot (
  9042. key,
  9043. el,
  9044. state
  9045. ) {
  9046. if (el.for && !el.forProcessed) {
  9047. return genForScopedSlot(key, el, state)
  9048. }
  9049. var fn = "function(" + (String(el.slotScope)) + "){" +
  9050. "return " + (el.tag === 'template'
  9051. ? el.if
  9052. ? ((el.if) + "?" + (genChildren(el, state) || 'undefined') + ":undefined")
  9053. : genChildren(el, state) || 'undefined'
  9054. : genElement(el, state)) + "}";
  9055. return ("{key:" + key + ",fn:" + fn + "}")
  9056. }
  9057. function genForScopedSlot (
  9058. key,
  9059. el,
  9060. state
  9061. ) {
  9062. var exp = el.for;
  9063. var alias = el.alias;
  9064. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  9065. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  9066. el.forProcessed = true; // avoid recursion
  9067. return "_l((" + exp + ")," +
  9068. "function(" + alias + iterator1 + iterator2 + "){" +
  9069. "return " + (genScopedSlot(key, el, state)) +
  9070. '})'
  9071. }
  9072. function genChildren (
  9073. el,
  9074. state,
  9075. checkSkip,
  9076. altGenElement,
  9077. altGenNode
  9078. ) {
  9079. var children = el.children;
  9080. if (children.length) {
  9081. var el$1 = children[0];
  9082. // optimize single v-for
  9083. if (children.length === 1 &&
  9084. el$1.for &&
  9085. el$1.tag !== 'template' &&
  9086. el$1.tag !== 'slot'
  9087. ) {
  9088. return (altGenElement || genElement)(el$1, state)
  9089. }
  9090. var normalizationType = checkSkip
  9091. ? getNormalizationType(children, state.maybeComponent)
  9092. : 0;
  9093. var gen = altGenNode || genNode;
  9094. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType ? ("," + normalizationType) : ''))
  9095. }
  9096. }
  9097. // determine the normalization needed for the children array.
  9098. // 0: no normalization needed
  9099. // 1: simple normalization needed (possible 1-level deep nested array)
  9100. // 2: full normalization needed
  9101. function getNormalizationType (
  9102. children,
  9103. maybeComponent
  9104. ) {
  9105. var res = 0;
  9106. for (var i = 0; i < children.length; i++) {
  9107. var el = children[i];
  9108. if (el.type !== 1) {
  9109. continue
  9110. }
  9111. if (needsNormalization(el) ||
  9112. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  9113. res = 2;
  9114. break
  9115. }
  9116. if (maybeComponent(el) ||
  9117. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  9118. res = 1;
  9119. }
  9120. }
  9121. return res
  9122. }
  9123. function needsNormalization (el) {
  9124. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  9125. }
  9126. function genNode (node, state) {
  9127. if (node.type === 1) {
  9128. return genElement(node, state)
  9129. } if (node.type === 3 && node.isComment) {
  9130. return genComment(node)
  9131. } else {
  9132. return genText(node)
  9133. }
  9134. }
  9135. function genText (text) {
  9136. return ("_v(" + (text.type === 2
  9137. ? text.expression // no need for () because already wrapped in _s()
  9138. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  9139. }
  9140. function genComment (comment) {
  9141. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  9142. }
  9143. function genSlot (el, state) {
  9144. var slotName = el.slotName || '"default"';
  9145. var children = genChildren(el, state);
  9146. var res = "_t(" + slotName + (children ? ("," + children) : '');
  9147. var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}");
  9148. var bind$$1 = el.attrsMap['v-bind'];
  9149. if ((attrs || bind$$1) && !children) {
  9150. res += ",null";
  9151. }
  9152. if (attrs) {
  9153. res += "," + attrs;
  9154. }
  9155. if (bind$$1) {
  9156. res += (attrs ? '' : ',null') + "," + bind$$1;
  9157. }
  9158. return res + ')'
  9159. }
  9160. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  9161. function genComponent (
  9162. componentName,
  9163. el,
  9164. state
  9165. ) {
  9166. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  9167. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  9168. }
  9169. function genProps (props) {
  9170. var res = '';
  9171. for (var i = 0; i < props.length; i++) {
  9172. var prop = props[i];
  9173. res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
  9174. }
  9175. return res.slice(0, -1)
  9176. }
  9177. // #3895, #4268
  9178. function transformSpecialNewlines (text) {
  9179. return text
  9180. .replace(/\u2028/g, '\\u2028')
  9181. .replace(/\u2029/g, '\\u2029')
  9182. }
  9183. /* */
  9184. // these keywords should not appear inside expressions, but operators like
  9185. // typeof, instanceof and in are allowed
  9186. var prohibitedKeywordRE = new RegExp('\\b' + (
  9187. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  9188. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  9189. 'extends,finally,continue,debugger,function,arguments'
  9190. ).split(',').join('\\b|\\b') + '\\b');
  9191. // these unary operators should not be used as property/method names
  9192. var unaryOperatorsRE = new RegExp('\\b' + (
  9193. 'delete,typeof,void'
  9194. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  9195. // check valid identifier for v-for
  9196. var identRE = /[A-Za-z_$][\w$]*/;
  9197. // strip strings in expressions
  9198. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  9199. // detect problematic expressions in a template
  9200. function detectErrors (ast) {
  9201. var errors = [];
  9202. if (ast) {
  9203. checkNode(ast, errors);
  9204. }
  9205. return errors
  9206. }
  9207. function checkNode (node, errors) {
  9208. if (node.type === 1) {
  9209. for (var name in node.attrsMap) {
  9210. if (dirRE.test(name)) {
  9211. var value = node.attrsMap[name];
  9212. if (value) {
  9213. if (name === 'v-for') {
  9214. checkFor(node, ("v-for=\"" + value + "\""), errors);
  9215. } else if (onRE.test(name)) {
  9216. checkEvent(value, (name + "=\"" + value + "\""), errors);
  9217. } else {
  9218. checkExpression(value, (name + "=\"" + value + "\""), errors);
  9219. }
  9220. }
  9221. }
  9222. }
  9223. if (node.children) {
  9224. for (var i = 0; i < node.children.length; i++) {
  9225. checkNode(node.children[i], errors);
  9226. }
  9227. }
  9228. } else if (node.type === 2) {
  9229. checkExpression(node.expression, node.text, errors);
  9230. }
  9231. }
  9232. function checkEvent (exp, text, errors) {
  9233. var stipped = exp.replace(stripStringRE, '');
  9234. var keywordMatch = stipped.match(unaryOperatorsRE);
  9235. if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
  9236. errors.push(
  9237. "avoid using JavaScript unary operator as property name: " +
  9238. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
  9239. );
  9240. }
  9241. checkExpression(exp, text, errors);
  9242. }
  9243. function checkFor (node, text, errors) {
  9244. checkExpression(node.for || '', text, errors);
  9245. checkIdentifier(node.alias, 'v-for alias', text, errors);
  9246. checkIdentifier(node.iterator1, 'v-for iterator', text, errors);
  9247. checkIdentifier(node.iterator2, 'v-for iterator', text, errors);
  9248. }
  9249. function checkIdentifier (ident, type, text, errors) {
  9250. if (typeof ident === 'string' && !identRE.test(ident)) {
  9251. errors.push(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())));
  9252. }
  9253. }
  9254. function checkExpression (exp, text, errors) {
  9255. try {
  9256. new Function(("return " + exp));
  9257. } catch (e) {
  9258. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  9259. if (keywordMatch) {
  9260. errors.push(
  9261. "avoid using JavaScript keyword as property name: " +
  9262. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim())
  9263. );
  9264. } else {
  9265. errors.push(
  9266. "invalid expression: " + (e.message) + " in\n\n" +
  9267. " " + exp + "\n\n" +
  9268. " Raw expression: " + (text.trim()) + "\n"
  9269. );
  9270. }
  9271. }
  9272. }
  9273. /* */
  9274. function createFunction (code, errors) {
  9275. try {
  9276. return new Function(code)
  9277. } catch (err) {
  9278. errors.push({ err: err, code: code });
  9279. return noop
  9280. }
  9281. }
  9282. function createCompileToFunctionFn (compile) {
  9283. var cache = Object.create(null);
  9284. return function compileToFunctions (
  9285. template,
  9286. options,
  9287. vm
  9288. ) {
  9289. options = extend({}, options);
  9290. var warn$$1 = options.warn || warn;
  9291. delete options.warn;
  9292. /* istanbul ignore if */
  9293. {
  9294. // detect possible CSP restriction
  9295. try {
  9296. new Function('return 1');
  9297. } catch (e) {
  9298. if (e.toString().match(/unsafe-eval|CSP/)) {
  9299. warn$$1(
  9300. 'It seems you are using the standalone build of Vue.js in an ' +
  9301. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  9302. 'The template compiler cannot work in this environment. Consider ' +
  9303. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  9304. 'templates into render functions.'
  9305. );
  9306. }
  9307. }
  9308. }
  9309. // check cache
  9310. var key = options.delimiters
  9311. ? String(options.delimiters) + template
  9312. : template;
  9313. if (cache[key]) {
  9314. return cache[key]
  9315. }
  9316. // compile
  9317. var compiled = compile(template, options);
  9318. // check compilation errors/tips
  9319. {
  9320. if (compiled.errors && compiled.errors.length) {
  9321. warn$$1(
  9322. "Error compiling template:\n\n" + template + "\n\n" +
  9323. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  9324. vm
  9325. );
  9326. }
  9327. if (compiled.tips && compiled.tips.length) {
  9328. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  9329. }
  9330. }
  9331. // turn code into functions
  9332. var res = {};
  9333. var fnGenErrors = [];
  9334. res.render = createFunction(compiled.render, fnGenErrors);
  9335. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  9336. return createFunction(code, fnGenErrors)
  9337. });
  9338. // check function generation errors.
  9339. // this should only happen if there is a bug in the compiler itself.
  9340. // mostly for codegen development use
  9341. /* istanbul ignore if */
  9342. {
  9343. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  9344. warn$$1(
  9345. "Failed to generate render function:\n\n" +
  9346. fnGenErrors.map(function (ref) {
  9347. var err = ref.err;
  9348. var code = ref.code;
  9349. return ((err.toString()) + " in\n\n" + code + "\n");
  9350. }).join('\n'),
  9351. vm
  9352. );
  9353. }
  9354. }
  9355. return (cache[key] = res)
  9356. }
  9357. }
  9358. /* */
  9359. function createCompilerCreator (baseCompile) {
  9360. return function createCompiler (baseOptions) {
  9361. function compile (
  9362. template,
  9363. options
  9364. ) {
  9365. var finalOptions = Object.create(baseOptions);
  9366. var errors = [];
  9367. var tips = [];
  9368. finalOptions.warn = function (msg, tip) {
  9369. (tip ? tips : errors).push(msg);
  9370. };
  9371. if (options) {
  9372. // merge custom modules
  9373. if (options.modules) {
  9374. finalOptions.modules =
  9375. (baseOptions.modules || []).concat(options.modules);
  9376. }
  9377. // merge custom directives
  9378. if (options.directives) {
  9379. finalOptions.directives = extend(
  9380. Object.create(baseOptions.directives),
  9381. options.directives
  9382. );
  9383. }
  9384. // copy other options
  9385. for (var key in options) {
  9386. if (key !== 'modules' && key !== 'directives') {
  9387. finalOptions[key] = options[key];
  9388. }
  9389. }
  9390. }
  9391. var compiled = baseCompile(template, finalOptions);
  9392. {
  9393. errors.push.apply(errors, detectErrors(compiled.ast));
  9394. }
  9395. compiled.errors = errors;
  9396. compiled.tips = tips;
  9397. return compiled
  9398. }
  9399. return {
  9400. compile: compile,
  9401. compileToFunctions: createCompileToFunctionFn(compile)
  9402. }
  9403. }
  9404. }
  9405. /* */
  9406. // `createCompilerCreator` allows creating compilers that use alternative
  9407. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  9408. // Here we just export a default compiler using the default parts.
  9409. var createCompiler = createCompilerCreator(function baseCompile (
  9410. template,
  9411. options
  9412. ) {
  9413. var ast = parse(template.trim(), options);
  9414. optimize(ast, options);
  9415. var code = generate(ast, options);
  9416. return {
  9417. ast: ast,
  9418. render: code.render,
  9419. staticRenderFns: code.staticRenderFns
  9420. }
  9421. });
  9422. /* */
  9423. var ref$1 = createCompiler(baseOptions);
  9424. var compileToFunctions = ref$1.compileToFunctions;
  9425. /* */
  9426. var idToTemplate = cached(function (id) {
  9427. var el = query(id);
  9428. return el && el.innerHTML
  9429. });
  9430. var mount = Vue$3.prototype.$mount;
  9431. Vue$3.prototype.$mount = function (
  9432. el,
  9433. hydrating
  9434. ) {
  9435. el = el && query(el);
  9436. /* istanbul ignore if */
  9437. if (el === document.body || el === document.documentElement) {
  9438. "development" !== 'production' && warn(
  9439. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  9440. );
  9441. return this
  9442. }
  9443. var options = this.$options;
  9444. // resolve template/el and convert to render function
  9445. if (!options.render) {
  9446. var template = options.template;
  9447. if (template) {
  9448. if (typeof template === 'string') {
  9449. if (template.charAt(0) === '#') {
  9450. template = idToTemplate(template);
  9451. /* istanbul ignore if */
  9452. if ("development" !== 'production' && !template) {
  9453. warn(
  9454. ("Template element not found or is empty: " + (options.template)),
  9455. this
  9456. );
  9457. }
  9458. }
  9459. } else if (template.nodeType) {
  9460. template = template.innerHTML;
  9461. } else {
  9462. {
  9463. warn('invalid template option:' + template, this);
  9464. }
  9465. return this
  9466. }
  9467. } else if (el) {
  9468. template = getOuterHTML(el);
  9469. }
  9470. if (template) {
  9471. /* istanbul ignore if */
  9472. if ("development" !== 'production' && config.performance && mark) {
  9473. mark('compile');
  9474. }
  9475. var ref = compileToFunctions(template, {
  9476. shouldDecodeNewlines: shouldDecodeNewlines,
  9477. delimiters: options.delimiters,
  9478. comments: options.comments
  9479. }, this);
  9480. var render = ref.render;
  9481. var staticRenderFns = ref.staticRenderFns;
  9482. options.render = render;
  9483. options.staticRenderFns = staticRenderFns;
  9484. /* istanbul ignore if */
  9485. if ("development" !== 'production' && config.performance && mark) {
  9486. mark('compile end');
  9487. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  9488. }
  9489. }
  9490. }
  9491. return mount.call(this, el, hydrating)
  9492. };
  9493. /**
  9494. * Get outerHTML of elements, taking care
  9495. * of SVG elements in IE as well.
  9496. */
  9497. function getOuterHTML (el) {
  9498. if (el.outerHTML) {
  9499. return el.outerHTML
  9500. } else {
  9501. var container = document.createElement('div');
  9502. container.appendChild(el.cloneNode(true));
  9503. return container.innerHTML
  9504. }
  9505. }
  9506. Vue$3.compile = compileToFunctions;
  9507. return Vue$3;
  9508. })));