vue.esm.js 265 KB

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