vue.js 330 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855
  1. /*!
  2. * Vue.js v2.6.6
  3. * (c) 2014-2019 Evan You
  4. * Released under the MIT License.
  5. */
  6. (function (global, factory) {
  7. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  8. typeof define === 'function' && define.amd ? define(factory) :
  9. (global = global || self, global.Vue = factory());
  10. }(this, function () { 'use strict';
  11. /* */
  12. var emptyObject = Object.freeze({});
  13. // These helpers produce better VM code in JS engines due to their
  14. // explicitness and function inlining.
  15. function isUndef (v) {
  16. return v === undefined || v === null
  17. }
  18. function isDef (v) {
  19. return v !== undefined && v !== null
  20. }
  21. function isTrue (v) {
  22. return v === true
  23. }
  24. function isFalse (v) {
  25. return v === false
  26. }
  27. /**
  28. * Check if value is primitive.
  29. */
  30. function isPrimitive (value) {
  31. return (
  32. typeof value === 'string' ||
  33. typeof value === 'number' ||
  34. // $flow-disable-line
  35. typeof value === 'symbol' ||
  36. typeof value === 'boolean'
  37. )
  38. }
  39. /**
  40. * Quick object check - this is primarily used to tell
  41. * Objects from primitive values when we know the value
  42. * is a JSON-compliant type.
  43. */
  44. function isObject (obj) {
  45. return obj !== null && typeof obj === 'object'
  46. }
  47. /**
  48. * Get the raw type string of a value, e.g., [object Object].
  49. */
  50. var _toString = Object.prototype.toString;
  51. function toRawType (value) {
  52. return _toString.call(value).slice(8, -1)
  53. }
  54. /**
  55. * Strict object type check. Only returns true
  56. * for plain JavaScript objects.
  57. */
  58. function isPlainObject (obj) {
  59. return _toString.call(obj) === '[object Object]'
  60. }
  61. function isRegExp (v) {
  62. return _toString.call(v) === '[object RegExp]'
  63. }
  64. /**
  65. * Check if val is a valid array index.
  66. */
  67. function isValidArrayIndex (val) {
  68. var n = parseFloat(String(val));
  69. return n >= 0 && Math.floor(n) === n && isFinite(val)
  70. }
  71. function isPromise (val) {
  72. return (
  73. isDef(val) &&
  74. typeof val.then === 'function' &&
  75. typeof val.catch === 'function'
  76. )
  77. }
  78. /**
  79. * Convert a value to a string that is actually rendered.
  80. */
  81. function toString (val) {
  82. return val == null
  83. ? ''
  84. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  85. ? JSON.stringify(val, null, 2)
  86. : String(val)
  87. }
  88. /**
  89. * Convert an input value to a number for persistence.
  90. * If the conversion fails, return original string.
  91. */
  92. function toNumber (val) {
  93. var n = parseFloat(val);
  94. return isNaN(n) ? val : n
  95. }
  96. /**
  97. * Make a map and return a function for checking if a key
  98. * is in that map.
  99. */
  100. function makeMap (
  101. str,
  102. expectsLowerCase
  103. ) {
  104. var map = Object.create(null);
  105. var list = str.split(',');
  106. for (var i = 0; i < list.length; i++) {
  107. map[list[i]] = true;
  108. }
  109. return expectsLowerCase
  110. ? function (val) { return map[val.toLowerCase()]; }
  111. : function (val) { return map[val]; }
  112. }
  113. /**
  114. * Check if a tag is a built-in tag.
  115. */
  116. var isBuiltInTag = makeMap('slot,component', true);
  117. /**
  118. * Check if an attribute is a reserved attribute.
  119. */
  120. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  121. /**
  122. * Remove an item from an array.
  123. */
  124. function remove (arr, item) {
  125. if (arr.length) {
  126. var index = arr.indexOf(item);
  127. if (index > -1) {
  128. return arr.splice(index, 1)
  129. }
  130. }
  131. }
  132. /**
  133. * Check whether an object has the property.
  134. */
  135. var hasOwnProperty = Object.prototype.hasOwnProperty;
  136. function hasOwn (obj, key) {
  137. return hasOwnProperty.call(obj, key)
  138. }
  139. /**
  140. * Create a cached version of a pure function.
  141. */
  142. function cached (fn) {
  143. var cache = Object.create(null);
  144. return (function cachedFn (str) {
  145. var hit = cache[str];
  146. return hit || (cache[str] = fn(str))
  147. })
  148. }
  149. /**
  150. * Camelize a hyphen-delimited string.
  151. */
  152. var camelizeRE = /-(\w)/g;
  153. var camelize = cached(function (str) {
  154. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  155. });
  156. /**
  157. * Capitalize a string.
  158. */
  159. var capitalize = cached(function (str) {
  160. return str.charAt(0).toUpperCase() + str.slice(1)
  161. });
  162. /**
  163. * Hyphenate a camelCase string.
  164. */
  165. var hyphenateRE = /\B([A-Z])/g;
  166. var hyphenate = cached(function (str) {
  167. return str.replace(hyphenateRE, '-$1').toLowerCase()
  168. });
  169. /**
  170. * Simple bind polyfill for environments that do not support it,
  171. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  172. * since native bind is now performant enough in most browsers.
  173. * But removing it would mean breaking code that was able to run in
  174. * PhantomJS 1.x, so this must be kept for backward compatibility.
  175. */
  176. /* istanbul ignore next */
  177. function polyfillBind (fn, ctx) {
  178. function boundFn (a) {
  179. var l = arguments.length;
  180. return l
  181. ? l > 1
  182. ? fn.apply(ctx, arguments)
  183. : fn.call(ctx, a)
  184. : fn.call(ctx)
  185. }
  186. boundFn._length = fn.length;
  187. return boundFn
  188. }
  189. function nativeBind (fn, ctx) {
  190. return fn.bind(ctx)
  191. }
  192. var bind = Function.prototype.bind
  193. ? nativeBind
  194. : polyfillBind;
  195. /**
  196. * Convert an Array-like object to a real Array.
  197. */
  198. function toArray (list, start) {
  199. start = start || 0;
  200. var i = list.length - start;
  201. var ret = new Array(i);
  202. while (i--) {
  203. ret[i] = list[i + start];
  204. }
  205. return ret
  206. }
  207. /**
  208. * Mix properties into target object.
  209. */
  210. function extend (to, _from) {
  211. for (var key in _from) {
  212. to[key] = _from[key];
  213. }
  214. return to
  215. }
  216. /**
  217. * Merge an Array of Objects into a single Object.
  218. */
  219. function toObject (arr) {
  220. var res = {};
  221. for (var i = 0; i < arr.length; i++) {
  222. if (arr[i]) {
  223. extend(res, arr[i]);
  224. }
  225. }
  226. return res
  227. }
  228. /* eslint-disable no-unused-vars */
  229. /**
  230. * Perform no operation.
  231. * Stubbing args to make Flow happy without leaving useless transpiled code
  232. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  233. */
  234. function noop (a, b, c) {}
  235. /**
  236. * Always return false.
  237. */
  238. var no = function (a, b, c) { return false; };
  239. /* eslint-enable no-unused-vars */
  240. /**
  241. * Return the same value.
  242. */
  243. var identity = function (_) { return _; };
  244. /**
  245. * Generate a string containing static keys from compiler modules.
  246. */
  247. function genStaticKeys (modules) {
  248. return modules.reduce(function (keys, m) {
  249. return keys.concat(m.staticKeys || [])
  250. }, []).join(',')
  251. }
  252. /**
  253. * Check if two values are loosely equal - that is,
  254. * if they are plain objects, do they have the same shape?
  255. */
  256. function looseEqual (a, b) {
  257. if (a === b) { return true }
  258. var isObjectA = isObject(a);
  259. var isObjectB = isObject(b);
  260. if (isObjectA && isObjectB) {
  261. try {
  262. var isArrayA = Array.isArray(a);
  263. var isArrayB = Array.isArray(b);
  264. if (isArrayA && isArrayB) {
  265. return a.length === b.length && a.every(function (e, i) {
  266. return looseEqual(e, b[i])
  267. })
  268. } else if (a instanceof Date && b instanceof Date) {
  269. return a.getTime() === b.getTime()
  270. } else if (!isArrayA && !isArrayB) {
  271. var keysA = Object.keys(a);
  272. var keysB = Object.keys(b);
  273. return keysA.length === keysB.length && keysA.every(function (key) {
  274. return looseEqual(a[key], b[key])
  275. })
  276. } else {
  277. /* istanbul ignore next */
  278. return false
  279. }
  280. } catch (e) {
  281. /* istanbul ignore next */
  282. return false
  283. }
  284. } else if (!isObjectA && !isObjectB) {
  285. return String(a) === String(b)
  286. } else {
  287. return false
  288. }
  289. }
  290. /**
  291. * Return the first index at which a loosely equal value can be
  292. * found in the array (if value is a plain object, the array must
  293. * contain an object of the same shape), or -1 if it is not present.
  294. */
  295. function looseIndexOf (arr, val) {
  296. for (var i = 0; i < arr.length; i++) {
  297. if (looseEqual(arr[i], val)) { return i }
  298. }
  299. return -1
  300. }
  301. /**
  302. * Ensure a function is called only once.
  303. */
  304. function once (fn) {
  305. var called = false;
  306. return function () {
  307. if (!called) {
  308. called = true;
  309. fn.apply(this, arguments);
  310. }
  311. }
  312. }
  313. var SSR_ATTR = 'data-server-rendered';
  314. var ASSET_TYPES = [
  315. 'component',
  316. 'directive',
  317. 'filter'
  318. ];
  319. var LIFECYCLE_HOOKS = [
  320. 'beforeCreate',
  321. 'created',
  322. 'beforeMount',
  323. 'mounted',
  324. 'beforeUpdate',
  325. 'updated',
  326. 'beforeDestroy',
  327. 'destroyed',
  328. 'activated',
  329. 'deactivated',
  330. 'errorCaptured',
  331. 'serverPrefetch'
  332. ];
  333. /* */
  334. var config = ({
  335. /**
  336. * Option merge strategies (used in core/util/options)
  337. */
  338. // $flow-disable-line
  339. optionMergeStrategies: Object.create(null),
  340. /**
  341. * Whether to suppress warnings.
  342. */
  343. silent: false,
  344. /**
  345. * Show production mode tip message on boot?
  346. */
  347. productionTip: "development" !== 'production',
  348. /**
  349. * Whether to enable devtools
  350. */
  351. devtools: "development" !== 'production',
  352. /**
  353. * Whether to record perf
  354. */
  355. performance: false,
  356. /**
  357. * Error handler for watcher errors
  358. */
  359. errorHandler: null,
  360. /**
  361. * Warn handler for watcher warns
  362. */
  363. warnHandler: null,
  364. /**
  365. * Ignore certain custom elements
  366. */
  367. ignoredElements: [],
  368. /**
  369. * Custom user key aliases for v-on
  370. */
  371. // $flow-disable-line
  372. keyCodes: Object.create(null),
  373. /**
  374. * Check if a tag is reserved so that it cannot be registered as a
  375. * component. This is platform-dependent and may be overwritten.
  376. */
  377. isReservedTag: no,
  378. /**
  379. * Check if an attribute is reserved so that it cannot be used as a component
  380. * prop. This is platform-dependent and may be overwritten.
  381. */
  382. isReservedAttr: no,
  383. /**
  384. * Check if a tag is an unknown element.
  385. * Platform-dependent.
  386. */
  387. isUnknownElement: no,
  388. /**
  389. * Get the namespace of an element
  390. */
  391. getTagNamespace: noop,
  392. /**
  393. * Parse the real tag name for the specific platform.
  394. */
  395. parsePlatformTagName: identity,
  396. /**
  397. * Check if an attribute must be bound using property, e.g. value
  398. * Platform-dependent.
  399. */
  400. mustUseProp: no,
  401. /**
  402. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  403. * This will significantly reduce performance if set to false.
  404. */
  405. async: true,
  406. /**
  407. * Exposed for legacy reasons
  408. */
  409. _lifecycleHooks: LIFECYCLE_HOOKS
  410. });
  411. /* */
  412. /**
  413. * unicode letters used for parsing html tags, component names and property paths.
  414. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  415. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  416. */
  417. var unicodeLetters = 'a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD';
  418. /**
  419. * Check if a string starts with $ or _
  420. */
  421. function isReserved (str) {
  422. var c = (str + '').charCodeAt(0);
  423. return c === 0x24 || c === 0x5F
  424. }
  425. /**
  426. * Define a property.
  427. */
  428. function def (obj, key, val, enumerable) {
  429. Object.defineProperty(obj, key, {
  430. value: val,
  431. enumerable: !!enumerable,
  432. writable: true,
  433. configurable: true
  434. });
  435. }
  436. /**
  437. * Parse simple path.
  438. */
  439. var bailRE = new RegExp(("[^" + unicodeLetters + ".$_\\d]"));
  440. function parsePath (path) {
  441. if (bailRE.test(path)) {
  442. return
  443. }
  444. var segments = path.split('.');
  445. return function (obj) {
  446. for (var i = 0; i < segments.length; i++) {
  447. if (!obj) { return }
  448. obj = obj[segments[i]];
  449. }
  450. return obj
  451. }
  452. }
  453. /* */
  454. // can we use __proto__?
  455. var hasProto = '__proto__' in {};
  456. // Browser environment sniffing
  457. var inBrowser = typeof window !== 'undefined';
  458. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  459. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  460. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  461. var isIE = UA && /msie|trident/.test(UA);
  462. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  463. var isEdge = UA && UA.indexOf('edge/') > 0;
  464. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  465. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  466. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  467. var isPhantomJS = UA && /phantomjs/.test(UA);
  468. var isFF = UA && UA.match(/firefox\/(\d+)/);
  469. // Firefox has a "watch" function on Object.prototype...
  470. var nativeWatch = ({}).watch;
  471. var supportsPassive = false;
  472. if (inBrowser) {
  473. try {
  474. var opts = {};
  475. Object.defineProperty(opts, 'passive', ({
  476. get: function get () {
  477. /* istanbul ignore next */
  478. supportsPassive = true;
  479. }
  480. })); // https://github.com/facebook/flow/issues/285
  481. window.addEventListener('test-passive', null, opts);
  482. } catch (e) {}
  483. }
  484. // this needs to be lazy-evaled because vue may be required before
  485. // vue-server-renderer can set VUE_ENV
  486. var _isServer;
  487. var isServerRendering = function () {
  488. if (_isServer === undefined) {
  489. /* istanbul ignore if */
  490. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  491. // detect presence of vue-server-renderer and avoid
  492. // Webpack shimming the process
  493. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  494. } else {
  495. _isServer = false;
  496. }
  497. }
  498. return _isServer
  499. };
  500. // detect devtools
  501. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  502. /* istanbul ignore next */
  503. function isNative (Ctor) {
  504. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  505. }
  506. var hasSymbol =
  507. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  508. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  509. var _Set;
  510. /* istanbul ignore if */ // $flow-disable-line
  511. if (typeof Set !== 'undefined' && isNative(Set)) {
  512. // use native Set when available.
  513. _Set = Set;
  514. } else {
  515. // a non-standard Set polyfill that only works with primitive keys.
  516. _Set = /*@__PURE__*/(function () {
  517. function Set () {
  518. this.set = Object.create(null);
  519. }
  520. Set.prototype.has = function has (key) {
  521. return this.set[key] === true
  522. };
  523. Set.prototype.add = function add (key) {
  524. this.set[key] = true;
  525. };
  526. Set.prototype.clear = function clear () {
  527. this.set = Object.create(null);
  528. };
  529. return Set;
  530. }());
  531. }
  532. /* */
  533. var warn = noop;
  534. var tip = noop;
  535. var generateComponentTrace = (noop); // work around flow check
  536. var formatComponentName = (noop);
  537. {
  538. var hasConsole = typeof console !== 'undefined';
  539. var classifyRE = /(?:^|[-_])(\w)/g;
  540. var classify = function (str) { return str
  541. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  542. .replace(/[-_]/g, ''); };
  543. warn = function (msg, vm) {
  544. var trace = vm ? generateComponentTrace(vm) : '';
  545. if (config.warnHandler) {
  546. config.warnHandler.call(null, msg, vm, trace);
  547. } else if (hasConsole && (!config.silent)) {
  548. console.error(("[Vue warn]: " + msg + trace));
  549. }
  550. };
  551. tip = function (msg, vm) {
  552. if (hasConsole && (!config.silent)) {
  553. console.warn("[Vue tip]: " + msg + (
  554. vm ? generateComponentTrace(vm) : ''
  555. ));
  556. }
  557. };
  558. formatComponentName = function (vm, includeFile) {
  559. if (vm.$root === vm) {
  560. return '<Root>'
  561. }
  562. var options = typeof vm === 'function' && vm.cid != null
  563. ? vm.options
  564. : vm._isVue
  565. ? vm.$options || vm.constructor.options
  566. : vm;
  567. var name = options.name || options._componentTag;
  568. var file = options.__file;
  569. if (!name && file) {
  570. var match = file.match(/([^/\\]+)\.vue$/);
  571. name = match && match[1];
  572. }
  573. return (
  574. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  575. (file && includeFile !== false ? (" at " + file) : '')
  576. )
  577. };
  578. var repeat = function (str, n) {
  579. var res = '';
  580. while (n) {
  581. if (n % 2 === 1) { res += str; }
  582. if (n > 1) { str += str; }
  583. n >>= 1;
  584. }
  585. return res
  586. };
  587. generateComponentTrace = function (vm) {
  588. if (vm._isVue && vm.$parent) {
  589. var tree = [];
  590. var currentRecursiveSequence = 0;
  591. while (vm) {
  592. if (tree.length > 0) {
  593. var last = tree[tree.length - 1];
  594. if (last.constructor === vm.constructor) {
  595. currentRecursiveSequence++;
  596. vm = vm.$parent;
  597. continue
  598. } else if (currentRecursiveSequence > 0) {
  599. tree[tree.length - 1] = [last, currentRecursiveSequence];
  600. currentRecursiveSequence = 0;
  601. }
  602. }
  603. tree.push(vm);
  604. vm = vm.$parent;
  605. }
  606. return '\n\nfound in\n\n' + tree
  607. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  608. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  609. : formatComponentName(vm))); })
  610. .join('\n')
  611. } else {
  612. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  613. }
  614. };
  615. }
  616. /* */
  617. var uid = 0;
  618. /**
  619. * A dep is an observable that can have multiple
  620. * directives subscribing to it.
  621. */
  622. var Dep = function Dep () {
  623. this.id = uid++;
  624. this.subs = [];
  625. };
  626. Dep.prototype.addSub = function addSub (sub) {
  627. this.subs.push(sub);
  628. };
  629. Dep.prototype.removeSub = function removeSub (sub) {
  630. remove(this.subs, sub);
  631. };
  632. Dep.prototype.depend = function depend () {
  633. if (Dep.target) {
  634. Dep.target.addDep(this);
  635. }
  636. };
  637. Dep.prototype.notify = function notify () {
  638. // stabilize the subscriber list first
  639. var subs = this.subs.slice();
  640. if (!config.async) {
  641. // subs aren't sorted in scheduler if not running async
  642. // we need to sort them now to make sure they fire in correct
  643. // order
  644. subs.sort(function (a, b) { return a.id - b.id; });
  645. }
  646. for (var i = 0, l = subs.length; i < l; i++) {
  647. subs[i].update();
  648. }
  649. };
  650. // The current target watcher being evaluated.
  651. // This is globally unique because only one watcher
  652. // can be evaluated at a time.
  653. Dep.target = null;
  654. var targetStack = [];
  655. function pushTarget (target) {
  656. targetStack.push(target);
  657. Dep.target = target;
  658. }
  659. function popTarget () {
  660. targetStack.pop();
  661. Dep.target = targetStack[targetStack.length - 1];
  662. }
  663. /* */
  664. var VNode = function VNode (
  665. tag,
  666. data,
  667. children,
  668. text,
  669. elm,
  670. context,
  671. componentOptions,
  672. asyncFactory
  673. ) {
  674. this.tag = tag;
  675. this.data = data;
  676. this.children = children;
  677. this.text = text;
  678. this.elm = elm;
  679. this.ns = undefined;
  680. this.context = context;
  681. this.fnContext = undefined;
  682. this.fnOptions = undefined;
  683. this.fnScopeId = undefined;
  684. this.key = data && data.key;
  685. this.componentOptions = componentOptions;
  686. this.componentInstance = undefined;
  687. this.parent = undefined;
  688. this.raw = false;
  689. this.isStatic = false;
  690. this.isRootInsert = true;
  691. this.isComment = false;
  692. this.isCloned = false;
  693. this.isOnce = false;
  694. this.asyncFactory = asyncFactory;
  695. this.asyncMeta = undefined;
  696. this.isAsyncPlaceholder = false;
  697. };
  698. var prototypeAccessors = { child: { configurable: true } };
  699. // DEPRECATED: alias for componentInstance for backwards compat.
  700. /* istanbul ignore next */
  701. prototypeAccessors.child.get = function () {
  702. return this.componentInstance
  703. };
  704. Object.defineProperties( VNode.prototype, prototypeAccessors );
  705. var createEmptyVNode = function (text) {
  706. if ( text === void 0 ) text = '';
  707. var node = new VNode();
  708. node.text = text;
  709. node.isComment = true;
  710. return node
  711. };
  712. function createTextVNode (val) {
  713. return new VNode(undefined, undefined, undefined, String(val))
  714. }
  715. // optimized shallow clone
  716. // used for static nodes and slot nodes because they may be reused across
  717. // multiple renders, cloning them avoids errors when DOM manipulations rely
  718. // on their elm reference.
  719. function cloneVNode (vnode) {
  720. var cloned = new VNode(
  721. vnode.tag,
  722. vnode.data,
  723. // #7975
  724. // clone children array to avoid mutating original in case of cloning
  725. // a child.
  726. vnode.children && vnode.children.slice(),
  727. vnode.text,
  728. vnode.elm,
  729. vnode.context,
  730. vnode.componentOptions,
  731. vnode.asyncFactory
  732. );
  733. cloned.ns = vnode.ns;
  734. cloned.isStatic = vnode.isStatic;
  735. cloned.key = vnode.key;
  736. cloned.isComment = vnode.isComment;
  737. cloned.fnContext = vnode.fnContext;
  738. cloned.fnOptions = vnode.fnOptions;
  739. cloned.fnScopeId = vnode.fnScopeId;
  740. cloned.asyncMeta = vnode.asyncMeta;
  741. cloned.isCloned = true;
  742. return cloned
  743. }
  744. /*
  745. * not type checking this file because flow doesn't play well with
  746. * dynamically accessing methods on Array prototype
  747. */
  748. var arrayProto = Array.prototype;
  749. var arrayMethods = Object.create(arrayProto);
  750. var methodsToPatch = [
  751. 'push',
  752. 'pop',
  753. 'shift',
  754. 'unshift',
  755. 'splice',
  756. 'sort',
  757. 'reverse'
  758. ];
  759. /**
  760. * Intercept mutating methods and emit events
  761. */
  762. methodsToPatch.forEach(function (method) {
  763. // cache original method
  764. var original = arrayProto[method];
  765. def(arrayMethods, method, function mutator () {
  766. var args = [], len = arguments.length;
  767. while ( len-- ) args[ len ] = arguments[ len ];
  768. var result = original.apply(this, args);
  769. var ob = this.__ob__;
  770. var inserted;
  771. switch (method) {
  772. case 'push':
  773. case 'unshift':
  774. inserted = args;
  775. break
  776. case 'splice':
  777. inserted = args.slice(2);
  778. break
  779. }
  780. if (inserted) { ob.observeArray(inserted); }
  781. // notify change
  782. ob.dep.notify();
  783. return result
  784. });
  785. });
  786. /* */
  787. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  788. /**
  789. * In some cases we may want to disable observation inside a component's
  790. * update computation.
  791. */
  792. var shouldObserve = true;
  793. function toggleObserving (value) {
  794. shouldObserve = value;
  795. }
  796. /**
  797. * Observer class that is attached to each observed
  798. * object. Once attached, the observer converts the target
  799. * object's property keys into getter/setters that
  800. * collect dependencies and dispatch updates.
  801. */
  802. var Observer = function Observer (value) {
  803. this.value = value;
  804. this.dep = new Dep();
  805. this.vmCount = 0;
  806. def(value, '__ob__', this);
  807. if (Array.isArray(value)) {
  808. if (hasProto) {
  809. protoAugment(value, arrayMethods);
  810. } else {
  811. copyAugment(value, arrayMethods, arrayKeys);
  812. }
  813. this.observeArray(value);
  814. } else {
  815. this.walk(value);
  816. }
  817. };
  818. /**
  819. * Walk through all properties and convert them into
  820. * getter/setters. This method should only be called when
  821. * value type is Object.
  822. */
  823. Observer.prototype.walk = function walk (obj) {
  824. var keys = Object.keys(obj);
  825. for (var i = 0; i < keys.length; i++) {
  826. defineReactive$$1(obj, keys[i]);
  827. }
  828. };
  829. /**
  830. * Observe a list of Array items.
  831. */
  832. Observer.prototype.observeArray = function observeArray (items) {
  833. for (var i = 0, l = items.length; i < l; i++) {
  834. observe(items[i]);
  835. }
  836. };
  837. // helpers
  838. /**
  839. * Augment a target Object or Array by intercepting
  840. * the prototype chain using __proto__
  841. */
  842. function protoAugment (target, src) {
  843. /* eslint-disable no-proto */
  844. target.__proto__ = src;
  845. /* eslint-enable no-proto */
  846. }
  847. /**
  848. * Augment a target Object or Array by defining
  849. * hidden properties.
  850. */
  851. /* istanbul ignore next */
  852. function copyAugment (target, src, keys) {
  853. for (var i = 0, l = keys.length; i < l; i++) {
  854. var key = keys[i];
  855. def(target, key, src[key]);
  856. }
  857. }
  858. /**
  859. * Attempt to create an observer instance for a value,
  860. * returns the new observer if successfully observed,
  861. * or the existing observer if the value already has one.
  862. */
  863. function observe (value, asRootData) {
  864. if (!isObject(value) || value instanceof VNode) {
  865. return
  866. }
  867. var ob;
  868. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  869. ob = value.__ob__;
  870. } else if (
  871. shouldObserve &&
  872. !isServerRendering() &&
  873. (Array.isArray(value) || isPlainObject(value)) &&
  874. Object.isExtensible(value) &&
  875. !value._isVue
  876. ) {
  877. ob = new Observer(value);
  878. }
  879. if (asRootData && ob) {
  880. ob.vmCount++;
  881. }
  882. return ob
  883. }
  884. /**
  885. * Define a reactive property on an Object.
  886. */
  887. function defineReactive$$1 (
  888. obj,
  889. key,
  890. val,
  891. customSetter,
  892. shallow
  893. ) {
  894. var dep = new Dep();
  895. var property = Object.getOwnPropertyDescriptor(obj, key);
  896. if (property && property.configurable === false) {
  897. return
  898. }
  899. // cater for pre-defined getter/setters
  900. var getter = property && property.get;
  901. var setter = property && property.set;
  902. if ((!getter || setter) && arguments.length === 2) {
  903. val = obj[key];
  904. }
  905. var childOb = !shallow && observe(val);
  906. Object.defineProperty(obj, key, {
  907. enumerable: true,
  908. configurable: true,
  909. get: function reactiveGetter () {
  910. var value = getter ? getter.call(obj) : val;
  911. if (Dep.target) {
  912. dep.depend();
  913. if (childOb) {
  914. childOb.dep.depend();
  915. if (Array.isArray(value)) {
  916. dependArray(value);
  917. }
  918. }
  919. }
  920. return value
  921. },
  922. set: function reactiveSetter (newVal) {
  923. var value = getter ? getter.call(obj) : val;
  924. /* eslint-disable no-self-compare */
  925. if (newVal === value || (newVal !== newVal && value !== value)) {
  926. return
  927. }
  928. /* eslint-enable no-self-compare */
  929. if (customSetter) {
  930. customSetter();
  931. }
  932. // #7981: for accessor properties without setter
  933. if (getter && !setter) { return }
  934. if (setter) {
  935. setter.call(obj, newVal);
  936. } else {
  937. val = newVal;
  938. }
  939. childOb = !shallow && observe(newVal);
  940. dep.notify();
  941. }
  942. });
  943. }
  944. /**
  945. * Set a property on an object. Adds the new property and
  946. * triggers change notification if the property doesn't
  947. * already exist.
  948. */
  949. function set (target, key, val) {
  950. if (isUndef(target) || isPrimitive(target)
  951. ) {
  952. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  953. }
  954. if (Array.isArray(target) && isValidArrayIndex(key)) {
  955. target.length = Math.max(target.length, key);
  956. target.splice(key, 1, val);
  957. return val
  958. }
  959. if (key in target && !(key in Object.prototype)) {
  960. target[key] = val;
  961. return val
  962. }
  963. var ob = (target).__ob__;
  964. if (target._isVue || (ob && ob.vmCount)) {
  965. warn(
  966. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  967. 'at runtime - declare it upfront in the data option.'
  968. );
  969. return val
  970. }
  971. if (!ob) {
  972. target[key] = val;
  973. return val
  974. }
  975. defineReactive$$1(ob.value, key, val);
  976. ob.dep.notify();
  977. return val
  978. }
  979. /**
  980. * Delete a property and trigger change if necessary.
  981. */
  982. function del (target, key) {
  983. if (isUndef(target) || isPrimitive(target)
  984. ) {
  985. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  986. }
  987. if (Array.isArray(target) && isValidArrayIndex(key)) {
  988. target.splice(key, 1);
  989. return
  990. }
  991. var ob = (target).__ob__;
  992. if (target._isVue || (ob && ob.vmCount)) {
  993. warn(
  994. 'Avoid deleting properties on a Vue instance or its root $data ' +
  995. '- just set it to null.'
  996. );
  997. return
  998. }
  999. if (!hasOwn(target, key)) {
  1000. return
  1001. }
  1002. delete target[key];
  1003. if (!ob) {
  1004. return
  1005. }
  1006. ob.dep.notify();
  1007. }
  1008. /**
  1009. * Collect dependencies on array elements when the array is touched, since
  1010. * we cannot intercept array element access like property getters.
  1011. */
  1012. function dependArray (value) {
  1013. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  1014. e = value[i];
  1015. e && e.__ob__ && e.__ob__.dep.depend();
  1016. if (Array.isArray(e)) {
  1017. dependArray(e);
  1018. }
  1019. }
  1020. }
  1021. /* */
  1022. /**
  1023. * Option overwriting strategies are functions that handle
  1024. * how to merge a parent option value and a child option
  1025. * value into the final value.
  1026. */
  1027. var strats = config.optionMergeStrategies;
  1028. /**
  1029. * Options with restrictions
  1030. */
  1031. {
  1032. strats.el = strats.propsData = function (parent, child, vm, key) {
  1033. if (!vm) {
  1034. warn(
  1035. "option \"" + key + "\" can only be used during instance " +
  1036. 'creation with the `new` keyword.'
  1037. );
  1038. }
  1039. return defaultStrat(parent, child)
  1040. };
  1041. }
  1042. /**
  1043. * Helper that recursively merges two data objects together.
  1044. */
  1045. function mergeData (to, from) {
  1046. if (!from) { return to }
  1047. var key, toVal, fromVal;
  1048. var keys = hasSymbol
  1049. ? Reflect.ownKeys(from)
  1050. : Object.keys(from);
  1051. for (var i = 0; i < keys.length; i++) {
  1052. key = keys[i];
  1053. // in case the object is already observed...
  1054. if (key === '__ob__') { continue }
  1055. toVal = to[key];
  1056. fromVal = from[key];
  1057. if (!hasOwn(to, key)) {
  1058. set(to, key, fromVal);
  1059. } else if (
  1060. toVal !== fromVal &&
  1061. isPlainObject(toVal) &&
  1062. isPlainObject(fromVal)
  1063. ) {
  1064. mergeData(toVal, fromVal);
  1065. }
  1066. }
  1067. return to
  1068. }
  1069. /**
  1070. * Data
  1071. */
  1072. function mergeDataOrFn (
  1073. parentVal,
  1074. childVal,
  1075. vm
  1076. ) {
  1077. if (!vm) {
  1078. // in a Vue.extend merge, both should be functions
  1079. if (!childVal) {
  1080. return parentVal
  1081. }
  1082. if (!parentVal) {
  1083. return childVal
  1084. }
  1085. // when parentVal & childVal are both present,
  1086. // we need to return a function that returns the
  1087. // merged result of both functions... no need to
  1088. // check if parentVal is a function here because
  1089. // it has to be a function to pass previous merges.
  1090. return function mergedDataFn () {
  1091. return mergeData(
  1092. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  1093. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  1094. )
  1095. }
  1096. } else {
  1097. return function mergedInstanceDataFn () {
  1098. // instance merge
  1099. var instanceData = typeof childVal === 'function'
  1100. ? childVal.call(vm, vm)
  1101. : childVal;
  1102. var defaultData = typeof parentVal === 'function'
  1103. ? parentVal.call(vm, vm)
  1104. : parentVal;
  1105. if (instanceData) {
  1106. return mergeData(instanceData, defaultData)
  1107. } else {
  1108. return defaultData
  1109. }
  1110. }
  1111. }
  1112. }
  1113. strats.data = function (
  1114. parentVal,
  1115. childVal,
  1116. vm
  1117. ) {
  1118. if (!vm) {
  1119. if (childVal && typeof childVal !== 'function') {
  1120. warn(
  1121. 'The "data" option should be a function ' +
  1122. 'that returns a per-instance value in component ' +
  1123. 'definitions.',
  1124. vm
  1125. );
  1126. return parentVal
  1127. }
  1128. return mergeDataOrFn(parentVal, childVal)
  1129. }
  1130. return mergeDataOrFn(parentVal, childVal, vm)
  1131. };
  1132. /**
  1133. * Hooks and props are merged as arrays.
  1134. */
  1135. function mergeHook (
  1136. parentVal,
  1137. childVal
  1138. ) {
  1139. var res = childVal
  1140. ? parentVal
  1141. ? parentVal.concat(childVal)
  1142. : Array.isArray(childVal)
  1143. ? childVal
  1144. : [childVal]
  1145. : parentVal;
  1146. return res
  1147. ? dedupeHooks(res)
  1148. : res
  1149. }
  1150. function dedupeHooks (hooks) {
  1151. var res = [];
  1152. for (var i = 0; i < hooks.length; i++) {
  1153. if (res.indexOf(hooks[i]) === -1) {
  1154. res.push(hooks[i]);
  1155. }
  1156. }
  1157. return res
  1158. }
  1159. LIFECYCLE_HOOKS.forEach(function (hook) {
  1160. strats[hook] = mergeHook;
  1161. });
  1162. /**
  1163. * Assets
  1164. *
  1165. * When a vm is present (instance creation), we need to do
  1166. * a three-way merge between constructor options, instance
  1167. * options and parent options.
  1168. */
  1169. function mergeAssets (
  1170. parentVal,
  1171. childVal,
  1172. vm,
  1173. key
  1174. ) {
  1175. var res = Object.create(parentVal || null);
  1176. if (childVal) {
  1177. assertObjectType(key, childVal, vm);
  1178. return extend(res, childVal)
  1179. } else {
  1180. return res
  1181. }
  1182. }
  1183. ASSET_TYPES.forEach(function (type) {
  1184. strats[type + 's'] = mergeAssets;
  1185. });
  1186. /**
  1187. * Watchers.
  1188. *
  1189. * Watchers hashes should not overwrite one
  1190. * another, so we merge them as arrays.
  1191. */
  1192. strats.watch = function (
  1193. parentVal,
  1194. childVal,
  1195. vm,
  1196. key
  1197. ) {
  1198. // work around Firefox's Object.prototype.watch...
  1199. if (parentVal === nativeWatch) { parentVal = undefined; }
  1200. if (childVal === nativeWatch) { childVal = undefined; }
  1201. /* istanbul ignore if */
  1202. if (!childVal) { return Object.create(parentVal || null) }
  1203. {
  1204. assertObjectType(key, childVal, vm);
  1205. }
  1206. if (!parentVal) { return childVal }
  1207. var ret = {};
  1208. extend(ret, parentVal);
  1209. for (var key$1 in childVal) {
  1210. var parent = ret[key$1];
  1211. var child = childVal[key$1];
  1212. if (parent && !Array.isArray(parent)) {
  1213. parent = [parent];
  1214. }
  1215. ret[key$1] = parent
  1216. ? parent.concat(child)
  1217. : Array.isArray(child) ? child : [child];
  1218. }
  1219. return ret
  1220. };
  1221. /**
  1222. * Other object hashes.
  1223. */
  1224. strats.props =
  1225. strats.methods =
  1226. strats.inject =
  1227. strats.computed = function (
  1228. parentVal,
  1229. childVal,
  1230. vm,
  1231. key
  1232. ) {
  1233. if (childVal && "development" !== 'production') {
  1234. assertObjectType(key, childVal, vm);
  1235. }
  1236. if (!parentVal) { return childVal }
  1237. var ret = Object.create(null);
  1238. extend(ret, parentVal);
  1239. if (childVal) { extend(ret, childVal); }
  1240. return ret
  1241. };
  1242. strats.provide = mergeDataOrFn;
  1243. /**
  1244. * Default strategy.
  1245. */
  1246. var defaultStrat = function (parentVal, childVal) {
  1247. return childVal === undefined
  1248. ? parentVal
  1249. : childVal
  1250. };
  1251. /**
  1252. * Validate component names
  1253. */
  1254. function checkComponents (options) {
  1255. for (var key in options.components) {
  1256. validateComponentName(key);
  1257. }
  1258. }
  1259. function validateComponentName (name) {
  1260. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + unicodeLetters + "]*$")).test(name)) {
  1261. warn(
  1262. 'Invalid component name: "' + name + '". Component names ' +
  1263. 'should conform to valid custom element name in html5 specification.'
  1264. );
  1265. }
  1266. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  1267. warn(
  1268. 'Do not use built-in or reserved HTML elements as component ' +
  1269. 'id: ' + name
  1270. );
  1271. }
  1272. }
  1273. /**
  1274. * Ensure all props option syntax are normalized into the
  1275. * Object-based format.
  1276. */
  1277. function normalizeProps (options, vm) {
  1278. var props = options.props;
  1279. if (!props) { return }
  1280. var res = {};
  1281. var i, val, name;
  1282. if (Array.isArray(props)) {
  1283. i = props.length;
  1284. while (i--) {
  1285. val = props[i];
  1286. if (typeof val === 'string') {
  1287. name = camelize(val);
  1288. res[name] = { type: null };
  1289. } else {
  1290. warn('props must be strings when using array syntax.');
  1291. }
  1292. }
  1293. } else if (isPlainObject(props)) {
  1294. for (var key in props) {
  1295. val = props[key];
  1296. name = camelize(key);
  1297. res[name] = isPlainObject(val)
  1298. ? val
  1299. : { type: val };
  1300. }
  1301. } else {
  1302. warn(
  1303. "Invalid value for option \"props\": expected an Array or an Object, " +
  1304. "but got " + (toRawType(props)) + ".",
  1305. vm
  1306. );
  1307. }
  1308. options.props = res;
  1309. }
  1310. /**
  1311. * Normalize all injections into Object-based format
  1312. */
  1313. function normalizeInject (options, vm) {
  1314. var inject = options.inject;
  1315. if (!inject) { return }
  1316. var normalized = options.inject = {};
  1317. if (Array.isArray(inject)) {
  1318. for (var i = 0; i < inject.length; i++) {
  1319. normalized[inject[i]] = { from: inject[i] };
  1320. }
  1321. } else if (isPlainObject(inject)) {
  1322. for (var key in inject) {
  1323. var val = inject[key];
  1324. normalized[key] = isPlainObject(val)
  1325. ? extend({ from: key }, val)
  1326. : { from: val };
  1327. }
  1328. } else {
  1329. warn(
  1330. "Invalid value for option \"inject\": expected an Array or an Object, " +
  1331. "but got " + (toRawType(inject)) + ".",
  1332. vm
  1333. );
  1334. }
  1335. }
  1336. /**
  1337. * Normalize raw function directives into object format.
  1338. */
  1339. function normalizeDirectives (options) {
  1340. var dirs = options.directives;
  1341. if (dirs) {
  1342. for (var key in dirs) {
  1343. var def$$1 = dirs[key];
  1344. if (typeof def$$1 === 'function') {
  1345. dirs[key] = { bind: def$$1, update: def$$1 };
  1346. }
  1347. }
  1348. }
  1349. }
  1350. function assertObjectType (name, value, vm) {
  1351. if (!isPlainObject(value)) {
  1352. warn(
  1353. "Invalid value for option \"" + name + "\": expected an Object, " +
  1354. "but got " + (toRawType(value)) + ".",
  1355. vm
  1356. );
  1357. }
  1358. }
  1359. /**
  1360. * Merge two option objects into a new one.
  1361. * Core utility used in both instantiation and inheritance.
  1362. */
  1363. function mergeOptions (
  1364. parent,
  1365. child,
  1366. vm
  1367. ) {
  1368. {
  1369. checkComponents(child);
  1370. }
  1371. if (typeof child === 'function') {
  1372. child = child.options;
  1373. }
  1374. normalizeProps(child, vm);
  1375. normalizeInject(child, vm);
  1376. normalizeDirectives(child);
  1377. // Apply extends and mixins on the child options,
  1378. // but only if it is a raw options object that isn't
  1379. // the result of another mergeOptions call.
  1380. // Only merged options has the _base property.
  1381. if (!child._base) {
  1382. if (child.extends) {
  1383. parent = mergeOptions(parent, child.extends, vm);
  1384. }
  1385. if (child.mixins) {
  1386. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1387. parent = mergeOptions(parent, child.mixins[i], vm);
  1388. }
  1389. }
  1390. }
  1391. var options = {};
  1392. var key;
  1393. for (key in parent) {
  1394. mergeField(key);
  1395. }
  1396. for (key in child) {
  1397. if (!hasOwn(parent, key)) {
  1398. mergeField(key);
  1399. }
  1400. }
  1401. function mergeField (key) {
  1402. var strat = strats[key] || defaultStrat;
  1403. options[key] = strat(parent[key], child[key], vm, key);
  1404. }
  1405. return options
  1406. }
  1407. /**
  1408. * Resolve an asset.
  1409. * This function is used because child instances need access
  1410. * to assets defined in its ancestor chain.
  1411. */
  1412. function resolveAsset (
  1413. options,
  1414. type,
  1415. id,
  1416. warnMissing
  1417. ) {
  1418. /* istanbul ignore if */
  1419. if (typeof id !== 'string') {
  1420. return
  1421. }
  1422. var assets = options[type];
  1423. // check local registration variations first
  1424. if (hasOwn(assets, id)) { return assets[id] }
  1425. var camelizedId = camelize(id);
  1426. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  1427. var PascalCaseId = capitalize(camelizedId);
  1428. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  1429. // fallback to prototype chain
  1430. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  1431. if (warnMissing && !res) {
  1432. warn(
  1433. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  1434. options
  1435. );
  1436. }
  1437. return res
  1438. }
  1439. /* */
  1440. function validateProp (
  1441. key,
  1442. propOptions,
  1443. propsData,
  1444. vm
  1445. ) {
  1446. var prop = propOptions[key];
  1447. var absent = !hasOwn(propsData, key);
  1448. var value = propsData[key];
  1449. // boolean casting
  1450. var booleanIndex = getTypeIndex(Boolean, prop.type);
  1451. if (booleanIndex > -1) {
  1452. if (absent && !hasOwn(prop, 'default')) {
  1453. value = false;
  1454. } else if (value === '' || value === hyphenate(key)) {
  1455. // only cast empty string / same name to boolean if
  1456. // boolean has higher priority
  1457. var stringIndex = getTypeIndex(String, prop.type);
  1458. if (stringIndex < 0 || booleanIndex < stringIndex) {
  1459. value = true;
  1460. }
  1461. }
  1462. }
  1463. // check default value
  1464. if (value === undefined) {
  1465. value = getPropDefaultValue(vm, prop, key);
  1466. // since the default value is a fresh copy,
  1467. // make sure to observe it.
  1468. var prevShouldObserve = shouldObserve;
  1469. toggleObserving(true);
  1470. observe(value);
  1471. toggleObserving(prevShouldObserve);
  1472. }
  1473. {
  1474. assertProp(prop, key, value, vm, absent);
  1475. }
  1476. return value
  1477. }
  1478. /**
  1479. * Get the default value of a prop.
  1480. */
  1481. function getPropDefaultValue (vm, prop, key) {
  1482. // no default, return undefined
  1483. if (!hasOwn(prop, 'default')) {
  1484. return undefined
  1485. }
  1486. var def = prop.default;
  1487. // warn against non-factory defaults for Object & Array
  1488. if (isObject(def)) {
  1489. warn(
  1490. 'Invalid default value for prop "' + key + '": ' +
  1491. 'Props with type Object/Array must use a factory function ' +
  1492. 'to return the default value.',
  1493. vm
  1494. );
  1495. }
  1496. // the raw prop value was also undefined from previous render,
  1497. // return previous default value to avoid unnecessary watcher trigger
  1498. if (vm && vm.$options.propsData &&
  1499. vm.$options.propsData[key] === undefined &&
  1500. vm._props[key] !== undefined
  1501. ) {
  1502. return vm._props[key]
  1503. }
  1504. // call factory function for non-Function types
  1505. // a value is Function if its prototype is function even across different execution context
  1506. return typeof def === 'function' && getType(prop.type) !== 'Function'
  1507. ? def.call(vm)
  1508. : def
  1509. }
  1510. /**
  1511. * Assert whether a prop is valid.
  1512. */
  1513. function assertProp (
  1514. prop,
  1515. name,
  1516. value,
  1517. vm,
  1518. absent
  1519. ) {
  1520. if (prop.required && absent) {
  1521. warn(
  1522. 'Missing required prop: "' + name + '"',
  1523. vm
  1524. );
  1525. return
  1526. }
  1527. if (value == null && !prop.required) {
  1528. return
  1529. }
  1530. var type = prop.type;
  1531. var valid = !type || type === true;
  1532. var expectedTypes = [];
  1533. if (type) {
  1534. if (!Array.isArray(type)) {
  1535. type = [type];
  1536. }
  1537. for (var i = 0; i < type.length && !valid; i++) {
  1538. var assertedType = assertType(value, type[i]);
  1539. expectedTypes.push(assertedType.expectedType || '');
  1540. valid = assertedType.valid;
  1541. }
  1542. }
  1543. if (!valid) {
  1544. warn(
  1545. getInvalidTypeMessage(name, value, expectedTypes),
  1546. vm
  1547. );
  1548. return
  1549. }
  1550. var validator = prop.validator;
  1551. if (validator) {
  1552. if (!validator(value)) {
  1553. warn(
  1554. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  1555. vm
  1556. );
  1557. }
  1558. }
  1559. }
  1560. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  1561. function assertType (value, type) {
  1562. var valid;
  1563. var expectedType = getType(type);
  1564. if (simpleCheckRE.test(expectedType)) {
  1565. var t = typeof value;
  1566. valid = t === expectedType.toLowerCase();
  1567. // for primitive wrapper objects
  1568. if (!valid && t === 'object') {
  1569. valid = value instanceof type;
  1570. }
  1571. } else if (expectedType === 'Object') {
  1572. valid = isPlainObject(value);
  1573. } else if (expectedType === 'Array') {
  1574. valid = Array.isArray(value);
  1575. } else {
  1576. valid = value instanceof type;
  1577. }
  1578. return {
  1579. valid: valid,
  1580. expectedType: expectedType
  1581. }
  1582. }
  1583. /**
  1584. * Use function string name to check built-in types,
  1585. * because a simple equality check will fail when running
  1586. * across different vms / iframes.
  1587. */
  1588. function getType (fn) {
  1589. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  1590. return match ? match[1] : ''
  1591. }
  1592. function isSameType (a, b) {
  1593. return getType(a) === getType(b)
  1594. }
  1595. function getTypeIndex (type, expectedTypes) {
  1596. if (!Array.isArray(expectedTypes)) {
  1597. return isSameType(expectedTypes, type) ? 0 : -1
  1598. }
  1599. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  1600. if (isSameType(expectedTypes[i], type)) {
  1601. return i
  1602. }
  1603. }
  1604. return -1
  1605. }
  1606. function getInvalidTypeMessage (name, value, expectedTypes) {
  1607. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  1608. " Expected " + (expectedTypes.map(capitalize).join(', '));
  1609. var expectedType = expectedTypes[0];
  1610. var receivedType = toRawType(value);
  1611. var expectedValue = styleValue(value, expectedType);
  1612. var receivedValue = styleValue(value, receivedType);
  1613. // check if we need to specify expected value
  1614. if (expectedTypes.length === 1 &&
  1615. isExplicable(expectedType) &&
  1616. !isBoolean(expectedType, receivedType)) {
  1617. message += " with value " + expectedValue;
  1618. }
  1619. message += ", got " + receivedType + " ";
  1620. // check if we need to specify received value
  1621. if (isExplicable(receivedType)) {
  1622. message += "with value " + receivedValue + ".";
  1623. }
  1624. return message
  1625. }
  1626. function styleValue (value, type) {
  1627. if (type === 'String') {
  1628. return ("\"" + value + "\"")
  1629. } else if (type === 'Number') {
  1630. return ("" + (Number(value)))
  1631. } else {
  1632. return ("" + value)
  1633. }
  1634. }
  1635. function isExplicable (value) {
  1636. var explicitTypes = ['string', 'number', 'boolean'];
  1637. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  1638. }
  1639. function isBoolean () {
  1640. var args = [], len = arguments.length;
  1641. while ( len-- ) args[ len ] = arguments[ len ];
  1642. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  1643. }
  1644. /* */
  1645. function handleError (err, vm, info) {
  1646. if (vm) {
  1647. var cur = vm;
  1648. while ((cur = cur.$parent)) {
  1649. var hooks = cur.$options.errorCaptured;
  1650. if (hooks) {
  1651. for (var i = 0; i < hooks.length; i++) {
  1652. try {
  1653. var capture = hooks[i].call(cur, err, vm, info) === false;
  1654. if (capture) { return }
  1655. } catch (e) {
  1656. globalHandleError(e, cur, 'errorCaptured hook');
  1657. }
  1658. }
  1659. }
  1660. }
  1661. }
  1662. globalHandleError(err, vm, info);
  1663. }
  1664. function invokeWithErrorHandling (
  1665. handler,
  1666. context,
  1667. args,
  1668. vm,
  1669. info
  1670. ) {
  1671. var res;
  1672. try {
  1673. res = args ? handler.apply(context, args) : handler.call(context);
  1674. if (res && !res._isVue && isPromise(res)) {
  1675. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  1676. }
  1677. } catch (e) {
  1678. handleError(e, vm, info);
  1679. }
  1680. return res
  1681. }
  1682. function globalHandleError (err, vm, info) {
  1683. if (config.errorHandler) {
  1684. try {
  1685. return config.errorHandler.call(null, err, vm, info)
  1686. } catch (e) {
  1687. // if the user intentionally throws the original error in the handler,
  1688. // do not log it twice
  1689. if (e !== err) {
  1690. logError(e, null, 'config.errorHandler');
  1691. }
  1692. }
  1693. }
  1694. logError(err, vm, info);
  1695. }
  1696. function logError (err, vm, info) {
  1697. {
  1698. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  1699. }
  1700. /* istanbul ignore else */
  1701. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  1702. console.error(err);
  1703. } else {
  1704. throw err
  1705. }
  1706. }
  1707. /* */
  1708. var isUsingMicroTask = false;
  1709. var callbacks = [];
  1710. var pending = false;
  1711. function flushCallbacks () {
  1712. pending = false;
  1713. var copies = callbacks.slice(0);
  1714. callbacks.length = 0;
  1715. for (var i = 0; i < copies.length; i++) {
  1716. copies[i]();
  1717. }
  1718. }
  1719. // Here we have async deferring wrappers using microtasks.
  1720. // In 2.5 we used (macro) tasks (in combination with microtasks).
  1721. // However, it has subtle problems when state is changed right before repaint
  1722. // (e.g. #6813, out-in transitions).
  1723. // Also, using (macro) tasks in event handler would cause some weird behaviors
  1724. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  1725. // So we now use microtasks everywhere, again.
  1726. // A major drawback of this tradeoff is that there are some scenarios
  1727. // where microtasks have too high a priority and fire in between supposedly
  1728. // sequential events (e.g. #4521, #6690, which have workarounds)
  1729. // or even between bubbling of the same event (#6566).
  1730. var timerFunc;
  1731. // The nextTick behavior leverages the microtask queue, which can be accessed
  1732. // via either native Promise.then or MutationObserver.
  1733. // MutationObserver has wider support, however it is seriously bugged in
  1734. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  1735. // completely stops working after triggering a few times... so, if native
  1736. // Promise is available, we will use it:
  1737. /* istanbul ignore next, $flow-disable-line */
  1738. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  1739. var p = Promise.resolve();
  1740. timerFunc = function () {
  1741. p.then(flushCallbacks);
  1742. // In problematic UIWebViews, Promise.then doesn't completely break, but
  1743. // it can get stuck in a weird state where callbacks are pushed into the
  1744. // microtask queue but the queue isn't being flushed, until the browser
  1745. // needs to do some other work, e.g. handle a timer. Therefore we can
  1746. // "force" the microtask queue to be flushed by adding an empty timer.
  1747. if (isIOS) { setTimeout(noop); }
  1748. };
  1749. isUsingMicroTask = true;
  1750. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  1751. isNative(MutationObserver) ||
  1752. // PhantomJS and iOS 7.x
  1753. MutationObserver.toString() === '[object MutationObserverConstructor]'
  1754. )) {
  1755. // Use MutationObserver where native Promise is not available,
  1756. // e.g. PhantomJS, iOS7, Android 4.4
  1757. // (#6466 MutationObserver is unreliable in IE11)
  1758. var counter = 1;
  1759. var observer = new MutationObserver(flushCallbacks);
  1760. var textNode = document.createTextNode(String(counter));
  1761. observer.observe(textNode, {
  1762. characterData: true
  1763. });
  1764. timerFunc = function () {
  1765. counter = (counter + 1) % 2;
  1766. textNode.data = String(counter);
  1767. };
  1768. isUsingMicroTask = true;
  1769. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  1770. // Fallback to setImmediate.
  1771. // Techinically it leverages the (macro) task queue,
  1772. // but it is still a better choice than setTimeout.
  1773. timerFunc = function () {
  1774. setImmediate(flushCallbacks);
  1775. };
  1776. } else {
  1777. // Fallback to setTimeout.
  1778. timerFunc = function () {
  1779. setTimeout(flushCallbacks, 0);
  1780. };
  1781. }
  1782. function nextTick (cb, ctx) {
  1783. var _resolve;
  1784. callbacks.push(function () {
  1785. if (cb) {
  1786. try {
  1787. cb.call(ctx);
  1788. } catch (e) {
  1789. handleError(e, ctx, 'nextTick');
  1790. }
  1791. } else if (_resolve) {
  1792. _resolve(ctx);
  1793. }
  1794. });
  1795. if (!pending) {
  1796. pending = true;
  1797. timerFunc();
  1798. }
  1799. // $flow-disable-line
  1800. if (!cb && typeof Promise !== 'undefined') {
  1801. return new Promise(function (resolve) {
  1802. _resolve = resolve;
  1803. })
  1804. }
  1805. }
  1806. /* */
  1807. var mark;
  1808. var measure;
  1809. {
  1810. var perf = inBrowser && window.performance;
  1811. /* istanbul ignore if */
  1812. if (
  1813. perf &&
  1814. perf.mark &&
  1815. perf.measure &&
  1816. perf.clearMarks &&
  1817. perf.clearMeasures
  1818. ) {
  1819. mark = function (tag) { return perf.mark(tag); };
  1820. measure = function (name, startTag, endTag) {
  1821. perf.measure(name, startTag, endTag);
  1822. perf.clearMarks(startTag);
  1823. perf.clearMarks(endTag);
  1824. // perf.clearMeasures(name)
  1825. };
  1826. }
  1827. }
  1828. /* not type checking this file because flow doesn't play well with Proxy */
  1829. var initProxy;
  1830. {
  1831. var allowedGlobals = makeMap(
  1832. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  1833. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  1834. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  1835. 'require' // for Webpack/Browserify
  1836. );
  1837. var warnNonPresent = function (target, key) {
  1838. warn(
  1839. "Property or method \"" + key + "\" is not defined on the instance but " +
  1840. 'referenced during render. Make sure that this property is reactive, ' +
  1841. 'either in the data option, or for class-based components, by ' +
  1842. 'initializing the property. ' +
  1843. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  1844. target
  1845. );
  1846. };
  1847. var warnReservedPrefix = function (target, key) {
  1848. warn(
  1849. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  1850. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  1851. 'prevent conflicts with Vue internals' +
  1852. 'See: https://vuejs.org/v2/api/#data',
  1853. target
  1854. );
  1855. };
  1856. var hasProxy =
  1857. typeof Proxy !== 'undefined' && isNative(Proxy);
  1858. if (hasProxy) {
  1859. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  1860. config.keyCodes = new Proxy(config.keyCodes, {
  1861. set: function set (target, key, value) {
  1862. if (isBuiltInModifier(key)) {
  1863. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  1864. return false
  1865. } else {
  1866. target[key] = value;
  1867. return true
  1868. }
  1869. }
  1870. });
  1871. }
  1872. var hasHandler = {
  1873. has: function has (target, key) {
  1874. var has = key in target;
  1875. var isAllowed = allowedGlobals(key) ||
  1876. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  1877. if (!has && !isAllowed) {
  1878. if (key in target.$data) { warnReservedPrefix(target, key); }
  1879. else { warnNonPresent(target, key); }
  1880. }
  1881. return has || !isAllowed
  1882. }
  1883. };
  1884. var getHandler = {
  1885. get: function get (target, key) {
  1886. if (typeof key === 'string' && !(key in target)) {
  1887. if (key in target.$data) { warnReservedPrefix(target, key); }
  1888. else { warnNonPresent(target, key); }
  1889. }
  1890. return target[key]
  1891. }
  1892. };
  1893. initProxy = function initProxy (vm) {
  1894. if (hasProxy) {
  1895. // determine which proxy handler to use
  1896. var options = vm.$options;
  1897. var handlers = options.render && options.render._withStripped
  1898. ? getHandler
  1899. : hasHandler;
  1900. vm._renderProxy = new Proxy(vm, handlers);
  1901. } else {
  1902. vm._renderProxy = vm;
  1903. }
  1904. };
  1905. }
  1906. /* */
  1907. var seenObjects = new _Set();
  1908. /**
  1909. * Recursively traverse an object to evoke all converted
  1910. * getters, so that every nested property inside the object
  1911. * is collected as a "deep" dependency.
  1912. */
  1913. function traverse (val) {
  1914. _traverse(val, seenObjects);
  1915. seenObjects.clear();
  1916. }
  1917. function _traverse (val, seen) {
  1918. var i, keys;
  1919. var isA = Array.isArray(val);
  1920. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  1921. return
  1922. }
  1923. if (val.__ob__) {
  1924. var depId = val.__ob__.dep.id;
  1925. if (seen.has(depId)) {
  1926. return
  1927. }
  1928. seen.add(depId);
  1929. }
  1930. if (isA) {
  1931. i = val.length;
  1932. while (i--) { _traverse(val[i], seen); }
  1933. } else {
  1934. keys = Object.keys(val);
  1935. i = keys.length;
  1936. while (i--) { _traverse(val[keys[i]], seen); }
  1937. }
  1938. }
  1939. /* */
  1940. var normalizeEvent = cached(function (name) {
  1941. var passive = name.charAt(0) === '&';
  1942. name = passive ? name.slice(1) : name;
  1943. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  1944. name = once$$1 ? name.slice(1) : name;
  1945. var capture = name.charAt(0) === '!';
  1946. name = capture ? name.slice(1) : name;
  1947. return {
  1948. name: name,
  1949. once: once$$1,
  1950. capture: capture,
  1951. passive: passive
  1952. }
  1953. });
  1954. function createFnInvoker (fns, vm) {
  1955. function invoker () {
  1956. var arguments$1 = arguments;
  1957. var fns = invoker.fns;
  1958. if (Array.isArray(fns)) {
  1959. var cloned = fns.slice();
  1960. for (var i = 0; i < cloned.length; i++) {
  1961. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  1962. }
  1963. } else {
  1964. // return handler return value for single handlers
  1965. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  1966. }
  1967. }
  1968. invoker.fns = fns;
  1969. return invoker
  1970. }
  1971. function updateListeners (
  1972. on,
  1973. oldOn,
  1974. add,
  1975. remove$$1,
  1976. createOnceHandler,
  1977. vm
  1978. ) {
  1979. var name, def$$1, cur, old, event;
  1980. for (name in on) {
  1981. def$$1 = cur = on[name];
  1982. old = oldOn[name];
  1983. event = normalizeEvent(name);
  1984. if (isUndef(cur)) {
  1985. warn(
  1986. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  1987. vm
  1988. );
  1989. } else if (isUndef(old)) {
  1990. if (isUndef(cur.fns)) {
  1991. cur = on[name] = createFnInvoker(cur, vm);
  1992. }
  1993. if (isTrue(event.once)) {
  1994. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  1995. }
  1996. add(event.name, cur, event.capture, event.passive, event.params);
  1997. } else if (cur !== old) {
  1998. old.fns = cur;
  1999. on[name] = old;
  2000. }
  2001. }
  2002. for (name in oldOn) {
  2003. if (isUndef(on[name])) {
  2004. event = normalizeEvent(name);
  2005. remove$$1(event.name, oldOn[name], event.capture);
  2006. }
  2007. }
  2008. }
  2009. /* */
  2010. function mergeVNodeHook (def, hookKey, hook) {
  2011. if (def instanceof VNode) {
  2012. def = def.data.hook || (def.data.hook = {});
  2013. }
  2014. var invoker;
  2015. var oldHook = def[hookKey];
  2016. function wrappedHook () {
  2017. hook.apply(this, arguments);
  2018. // important: remove merged hook to ensure it's called only once
  2019. // and prevent memory leak
  2020. remove(invoker.fns, wrappedHook);
  2021. }
  2022. if (isUndef(oldHook)) {
  2023. // no existing hook
  2024. invoker = createFnInvoker([wrappedHook]);
  2025. } else {
  2026. /* istanbul ignore if */
  2027. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  2028. // already a merged invoker
  2029. invoker = oldHook;
  2030. invoker.fns.push(wrappedHook);
  2031. } else {
  2032. // existing plain hook
  2033. invoker = createFnInvoker([oldHook, wrappedHook]);
  2034. }
  2035. }
  2036. invoker.merged = true;
  2037. def[hookKey] = invoker;
  2038. }
  2039. /* */
  2040. function extractPropsFromVNodeData (
  2041. data,
  2042. Ctor,
  2043. tag
  2044. ) {
  2045. // we are only extracting raw values here.
  2046. // validation and default values are handled in the child
  2047. // component itself.
  2048. var propOptions = Ctor.options.props;
  2049. if (isUndef(propOptions)) {
  2050. return
  2051. }
  2052. var res = {};
  2053. var attrs = data.attrs;
  2054. var props = data.props;
  2055. if (isDef(attrs) || isDef(props)) {
  2056. for (var key in propOptions) {
  2057. var altKey = hyphenate(key);
  2058. {
  2059. var keyInLowerCase = key.toLowerCase();
  2060. if (
  2061. key !== keyInLowerCase &&
  2062. attrs && hasOwn(attrs, keyInLowerCase)
  2063. ) {
  2064. tip(
  2065. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  2066. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  2067. " \"" + key + "\". " +
  2068. "Note that HTML attributes are case-insensitive and camelCased " +
  2069. "props need to use their kebab-case equivalents when using in-DOM " +
  2070. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  2071. );
  2072. }
  2073. }
  2074. checkProp(res, props, key, altKey, true) ||
  2075. checkProp(res, attrs, key, altKey, false);
  2076. }
  2077. }
  2078. return res
  2079. }
  2080. function checkProp (
  2081. res,
  2082. hash,
  2083. key,
  2084. altKey,
  2085. preserve
  2086. ) {
  2087. if (isDef(hash)) {
  2088. if (hasOwn(hash, key)) {
  2089. res[key] = hash[key];
  2090. if (!preserve) {
  2091. delete hash[key];
  2092. }
  2093. return true
  2094. } else if (hasOwn(hash, altKey)) {
  2095. res[key] = hash[altKey];
  2096. if (!preserve) {
  2097. delete hash[altKey];
  2098. }
  2099. return true
  2100. }
  2101. }
  2102. return false
  2103. }
  2104. /* */
  2105. // The template compiler attempts to minimize the need for normalization by
  2106. // statically analyzing the template at compile time.
  2107. //
  2108. // For plain HTML markup, normalization can be completely skipped because the
  2109. // generated render function is guaranteed to return Array<VNode>. There are
  2110. // two cases where extra normalization is needed:
  2111. // 1. When the children contains components - because a functional component
  2112. // may return an Array instead of a single root. In this case, just a simple
  2113. // normalization is needed - if any child is an Array, we flatten the whole
  2114. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  2115. // because functional components already normalize their own children.
  2116. function simpleNormalizeChildren (children) {
  2117. for (var i = 0; i < children.length; i++) {
  2118. if (Array.isArray(children[i])) {
  2119. return Array.prototype.concat.apply([], children)
  2120. }
  2121. }
  2122. return children
  2123. }
  2124. // 2. When the children contains constructs that always generated nested Arrays,
  2125. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  2126. // with hand-written render functions / JSX. In such cases a full normalization
  2127. // is needed to cater to all possible types of children values.
  2128. function normalizeChildren (children) {
  2129. return isPrimitive(children)
  2130. ? [createTextVNode(children)]
  2131. : Array.isArray(children)
  2132. ? normalizeArrayChildren(children)
  2133. : undefined
  2134. }
  2135. function isTextNode (node) {
  2136. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  2137. }
  2138. function normalizeArrayChildren (children, nestedIndex) {
  2139. var res = [];
  2140. var i, c, lastIndex, last;
  2141. for (i = 0; i < children.length; i++) {
  2142. c = children[i];
  2143. if (isUndef(c) || typeof c === 'boolean') { continue }
  2144. lastIndex = res.length - 1;
  2145. last = res[lastIndex];
  2146. // nested
  2147. if (Array.isArray(c)) {
  2148. if (c.length > 0) {
  2149. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  2150. // merge adjacent text nodes
  2151. if (isTextNode(c[0]) && isTextNode(last)) {
  2152. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  2153. c.shift();
  2154. }
  2155. res.push.apply(res, c);
  2156. }
  2157. } else if (isPrimitive(c)) {
  2158. if (isTextNode(last)) {
  2159. // merge adjacent text nodes
  2160. // this is necessary for SSR hydration because text nodes are
  2161. // essentially merged when rendered to HTML strings
  2162. res[lastIndex] = createTextVNode(last.text + c);
  2163. } else if (c !== '') {
  2164. // convert primitive to vnode
  2165. res.push(createTextVNode(c));
  2166. }
  2167. } else {
  2168. if (isTextNode(c) && isTextNode(last)) {
  2169. // merge adjacent text nodes
  2170. res[lastIndex] = createTextVNode(last.text + c.text);
  2171. } else {
  2172. // default key for nested array children (likely generated by v-for)
  2173. if (isTrue(children._isVList) &&
  2174. isDef(c.tag) &&
  2175. isUndef(c.key) &&
  2176. isDef(nestedIndex)) {
  2177. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  2178. }
  2179. res.push(c);
  2180. }
  2181. }
  2182. }
  2183. return res
  2184. }
  2185. /* */
  2186. function initProvide (vm) {
  2187. var provide = vm.$options.provide;
  2188. if (provide) {
  2189. vm._provided = typeof provide === 'function'
  2190. ? provide.call(vm)
  2191. : provide;
  2192. }
  2193. }
  2194. function initInjections (vm) {
  2195. var result = resolveInject(vm.$options.inject, vm);
  2196. if (result) {
  2197. toggleObserving(false);
  2198. Object.keys(result).forEach(function (key) {
  2199. /* istanbul ignore else */
  2200. {
  2201. defineReactive$$1(vm, key, result[key], function () {
  2202. warn(
  2203. "Avoid mutating an injected value directly since the changes will be " +
  2204. "overwritten whenever the provided component re-renders. " +
  2205. "injection being mutated: \"" + key + "\"",
  2206. vm
  2207. );
  2208. });
  2209. }
  2210. });
  2211. toggleObserving(true);
  2212. }
  2213. }
  2214. function resolveInject (inject, vm) {
  2215. if (inject) {
  2216. // inject is :any because flow is not smart enough to figure out cached
  2217. var result = Object.create(null);
  2218. var keys = hasSymbol
  2219. ? Reflect.ownKeys(inject)
  2220. : Object.keys(inject);
  2221. for (var i = 0; i < keys.length; i++) {
  2222. var key = keys[i];
  2223. // #6574 in case the inject object is observed...
  2224. if (key === '__ob__') { continue }
  2225. var provideKey = inject[key].from;
  2226. var source = vm;
  2227. while (source) {
  2228. if (source._provided && hasOwn(source._provided, provideKey)) {
  2229. result[key] = source._provided[provideKey];
  2230. break
  2231. }
  2232. source = source.$parent;
  2233. }
  2234. if (!source) {
  2235. if ('default' in inject[key]) {
  2236. var provideDefault = inject[key].default;
  2237. result[key] = typeof provideDefault === 'function'
  2238. ? provideDefault.call(vm)
  2239. : provideDefault;
  2240. } else {
  2241. warn(("Injection \"" + key + "\" not found"), vm);
  2242. }
  2243. }
  2244. }
  2245. return result
  2246. }
  2247. }
  2248. /* */
  2249. /**
  2250. * Runtime helper for resolving raw children VNodes into a slot object.
  2251. */
  2252. function resolveSlots (
  2253. children,
  2254. context
  2255. ) {
  2256. if (!children || !children.length) {
  2257. return {}
  2258. }
  2259. var slots = {};
  2260. for (var i = 0, l = children.length; i < l; i++) {
  2261. var child = children[i];
  2262. var data = child.data;
  2263. // remove slot attribute if the node is resolved as a Vue slot node
  2264. if (data && data.attrs && data.attrs.slot) {
  2265. delete data.attrs.slot;
  2266. }
  2267. // named slots should only be respected if the vnode was rendered in the
  2268. // same context.
  2269. if ((child.context === context || child.fnContext === context) &&
  2270. data && data.slot != null
  2271. ) {
  2272. var name = data.slot;
  2273. var slot = (slots[name] || (slots[name] = []));
  2274. if (child.tag === 'template') {
  2275. slot.push.apply(slot, child.children || []);
  2276. } else {
  2277. slot.push(child);
  2278. }
  2279. } else {
  2280. (slots.default || (slots.default = [])).push(child);
  2281. }
  2282. }
  2283. // ignore slots that contains only whitespace
  2284. for (var name$1 in slots) {
  2285. if (slots[name$1].every(isWhitespace)) {
  2286. delete slots[name$1];
  2287. }
  2288. }
  2289. return slots
  2290. }
  2291. function isWhitespace (node) {
  2292. return (node.isComment && !node.asyncFactory) || node.text === ' '
  2293. }
  2294. /* */
  2295. function normalizeScopedSlots (
  2296. slots,
  2297. normalSlots,
  2298. prevSlots
  2299. ) {
  2300. var res;
  2301. if (!slots) {
  2302. res = {};
  2303. } else if (slots._normalized) {
  2304. // fast path 1: child component re-render only, parent did not change
  2305. return slots._normalized
  2306. } else if (
  2307. slots.$stable &&
  2308. prevSlots &&
  2309. prevSlots !== emptyObject &&
  2310. Object.keys(normalSlots).length === 0
  2311. ) {
  2312. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  2313. // only need to normalize once
  2314. return prevSlots
  2315. } else {
  2316. res = {};
  2317. for (var key in slots) {
  2318. if (slots[key] && key[0] !== '$') {
  2319. res[key] = normalizeScopedSlot(normalSlots, key, slots[key]);
  2320. }
  2321. }
  2322. }
  2323. // expose normal slots on scopedSlots
  2324. for (var key$1 in normalSlots) {
  2325. if (!(key$1 in res)) {
  2326. res[key$1] = proxyNormalSlot(normalSlots, key$1);
  2327. }
  2328. }
  2329. // avoriaz seems to mock a non-extensible $scopedSlots object
  2330. // and when that is passed down this would cause an error
  2331. if (slots && Object.isExtensible(slots)) {
  2332. (slots)._normalized = res;
  2333. }
  2334. def(res, '$stable', slots ? !!slots.$stable : true);
  2335. return res
  2336. }
  2337. function normalizeScopedSlot(normalSlots, key, fn) {
  2338. var normalized = function () {
  2339. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  2340. res = res && typeof res === 'object' && !Array.isArray(res)
  2341. ? [res] // single vnode
  2342. : normalizeChildren(res);
  2343. return res && res.length === 0
  2344. ? undefined
  2345. : res
  2346. };
  2347. // this is a slot using the new v-slot syntax without scope. although it is
  2348. // compiled as a scoped slot, render fn users would expect it to be present
  2349. // on this.$slots because the usage is semantically a normal slot.
  2350. if (fn.proxy) {
  2351. Object.defineProperty(normalSlots, key, {
  2352. get: normalized,
  2353. enumerable: true,
  2354. configurable: true
  2355. });
  2356. }
  2357. return normalized
  2358. }
  2359. function proxyNormalSlot(slots, key) {
  2360. return function () { return slots[key]; }
  2361. }
  2362. /* */
  2363. /**
  2364. * Runtime helper for rendering v-for lists.
  2365. */
  2366. function renderList (
  2367. val,
  2368. render
  2369. ) {
  2370. var ret, i, l, keys, key;
  2371. if (Array.isArray(val) || typeof val === 'string') {
  2372. ret = new Array(val.length);
  2373. for (i = 0, l = val.length; i < l; i++) {
  2374. ret[i] = render(val[i], i);
  2375. }
  2376. } else if (typeof val === 'number') {
  2377. ret = new Array(val);
  2378. for (i = 0; i < val; i++) {
  2379. ret[i] = render(i + 1, i);
  2380. }
  2381. } else if (isObject(val)) {
  2382. if (hasSymbol && val[Symbol.iterator]) {
  2383. ret = [];
  2384. var iterator = val[Symbol.iterator]();
  2385. var result = iterator.next();
  2386. while (!result.done) {
  2387. ret.push(render(result.value, ret.length));
  2388. result = iterator.next();
  2389. }
  2390. } else {
  2391. keys = Object.keys(val);
  2392. ret = new Array(keys.length);
  2393. for (i = 0, l = keys.length; i < l; i++) {
  2394. key = keys[i];
  2395. ret[i] = render(val[key], key, i);
  2396. }
  2397. }
  2398. }
  2399. if (!isDef(ret)) {
  2400. ret = [];
  2401. }
  2402. (ret)._isVList = true;
  2403. return ret
  2404. }
  2405. /* */
  2406. /**
  2407. * Runtime helper for rendering <slot>
  2408. */
  2409. function renderSlot (
  2410. name,
  2411. fallback,
  2412. props,
  2413. bindObject
  2414. ) {
  2415. var scopedSlotFn = this.$scopedSlots[name];
  2416. var nodes;
  2417. if (scopedSlotFn) { // scoped slot
  2418. props = props || {};
  2419. if (bindObject) {
  2420. if (!isObject(bindObject)) {
  2421. warn(
  2422. 'slot v-bind without argument expects an Object',
  2423. this
  2424. );
  2425. }
  2426. props = extend(extend({}, bindObject), props);
  2427. }
  2428. nodes = scopedSlotFn(props) || fallback;
  2429. } else {
  2430. nodes = this.$slots[name] || fallback;
  2431. }
  2432. var target = props && props.slot;
  2433. if (target) {
  2434. return this.$createElement('template', { slot: target }, nodes)
  2435. } else {
  2436. return nodes
  2437. }
  2438. }
  2439. /* */
  2440. /**
  2441. * Runtime helper for resolving filters
  2442. */
  2443. function resolveFilter (id) {
  2444. return resolveAsset(this.$options, 'filters', id, true) || identity
  2445. }
  2446. /* */
  2447. function isKeyNotMatch (expect, actual) {
  2448. if (Array.isArray(expect)) {
  2449. return expect.indexOf(actual) === -1
  2450. } else {
  2451. return expect !== actual
  2452. }
  2453. }
  2454. /**
  2455. * Runtime helper for checking keyCodes from config.
  2456. * exposed as Vue.prototype._k
  2457. * passing in eventKeyName as last argument separately for backwards compat
  2458. */
  2459. function checkKeyCodes (
  2460. eventKeyCode,
  2461. key,
  2462. builtInKeyCode,
  2463. eventKeyName,
  2464. builtInKeyName
  2465. ) {
  2466. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  2467. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  2468. return isKeyNotMatch(builtInKeyName, eventKeyName)
  2469. } else if (mappedKeyCode) {
  2470. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  2471. } else if (eventKeyName) {
  2472. return hyphenate(eventKeyName) !== key
  2473. }
  2474. }
  2475. /* */
  2476. /**
  2477. * Runtime helper for merging v-bind="object" into a VNode's data.
  2478. */
  2479. function bindObjectProps (
  2480. data,
  2481. tag,
  2482. value,
  2483. asProp,
  2484. isSync
  2485. ) {
  2486. if (value) {
  2487. if (!isObject(value)) {
  2488. warn(
  2489. 'v-bind without argument expects an Object or Array value',
  2490. this
  2491. );
  2492. } else {
  2493. if (Array.isArray(value)) {
  2494. value = toObject(value);
  2495. }
  2496. var hash;
  2497. var loop = function ( key ) {
  2498. if (
  2499. key === 'class' ||
  2500. key === 'style' ||
  2501. isReservedAttribute(key)
  2502. ) {
  2503. hash = data;
  2504. } else {
  2505. var type = data.attrs && data.attrs.type;
  2506. hash = asProp || config.mustUseProp(tag, type, key)
  2507. ? data.domProps || (data.domProps = {})
  2508. : data.attrs || (data.attrs = {});
  2509. }
  2510. var camelizedKey = camelize(key);
  2511. if (!(key in hash) && !(camelizedKey in hash)) {
  2512. hash[key] = value[key];
  2513. if (isSync) {
  2514. var on = data.on || (data.on = {});
  2515. on[("update:" + camelizedKey)] = function ($event) {
  2516. value[key] = $event;
  2517. };
  2518. }
  2519. }
  2520. };
  2521. for (var key in value) loop( key );
  2522. }
  2523. }
  2524. return data
  2525. }
  2526. /* */
  2527. /**
  2528. * Runtime helper for rendering static trees.
  2529. */
  2530. function renderStatic (
  2531. index,
  2532. isInFor
  2533. ) {
  2534. var cached = this._staticTrees || (this._staticTrees = []);
  2535. var tree = cached[index];
  2536. // if has already-rendered static tree and not inside v-for,
  2537. // we can reuse the same tree.
  2538. if (tree && !isInFor) {
  2539. return tree
  2540. }
  2541. // otherwise, render a fresh tree.
  2542. tree = cached[index] = this.$options.staticRenderFns[index].call(
  2543. this._renderProxy,
  2544. null,
  2545. this // for render fns generated for functional component templates
  2546. );
  2547. markStatic(tree, ("__static__" + index), false);
  2548. return tree
  2549. }
  2550. /**
  2551. * Runtime helper for v-once.
  2552. * Effectively it means marking the node as static with a unique key.
  2553. */
  2554. function markOnce (
  2555. tree,
  2556. index,
  2557. key
  2558. ) {
  2559. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  2560. return tree
  2561. }
  2562. function markStatic (
  2563. tree,
  2564. key,
  2565. isOnce
  2566. ) {
  2567. if (Array.isArray(tree)) {
  2568. for (var i = 0; i < tree.length; i++) {
  2569. if (tree[i] && typeof tree[i] !== 'string') {
  2570. markStaticNode(tree[i], (key + "_" + i), isOnce);
  2571. }
  2572. }
  2573. } else {
  2574. markStaticNode(tree, key, isOnce);
  2575. }
  2576. }
  2577. function markStaticNode (node, key, isOnce) {
  2578. node.isStatic = true;
  2579. node.key = key;
  2580. node.isOnce = isOnce;
  2581. }
  2582. /* */
  2583. function bindObjectListeners (data, value) {
  2584. if (value) {
  2585. if (!isPlainObject(value)) {
  2586. warn(
  2587. 'v-on without argument expects an Object value',
  2588. this
  2589. );
  2590. } else {
  2591. var on = data.on = data.on ? extend({}, data.on) : {};
  2592. for (var key in value) {
  2593. var existing = on[key];
  2594. var ours = value[key];
  2595. on[key] = existing ? [].concat(existing, ours) : ours;
  2596. }
  2597. }
  2598. }
  2599. return data
  2600. }
  2601. /* */
  2602. function resolveScopedSlots (
  2603. fns, // see flow/vnode
  2604. hasDynamicKeys,
  2605. res
  2606. ) {
  2607. res = res || { $stable: !hasDynamicKeys };
  2608. for (var i = 0; i < fns.length; i++) {
  2609. var slot = fns[i];
  2610. if (Array.isArray(slot)) {
  2611. resolveScopedSlots(slot, hasDynamicKeys, res);
  2612. } else if (slot) {
  2613. // marker for reverse proxying v-slot without scope on this.$slots
  2614. if (slot.proxy) {
  2615. slot.fn.proxy = true;
  2616. }
  2617. res[slot.key] = slot.fn;
  2618. }
  2619. }
  2620. return res
  2621. }
  2622. /* */
  2623. function bindDynamicKeys (baseObj, values) {
  2624. for (var i = 0; i < values.length; i += 2) {
  2625. var key = values[i];
  2626. if (typeof key === 'string' && key) {
  2627. baseObj[values[i]] = values[i + 1];
  2628. } else if (key !== '' && key !== null) {
  2629. // null is a speical value for explicitly removing a binding
  2630. warn(
  2631. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  2632. this
  2633. );
  2634. }
  2635. }
  2636. return baseObj
  2637. }
  2638. // helper to dynamically append modifier runtime markers to event names.
  2639. // ensure only append when value is already string, otherwise it will be cast
  2640. // to string and cause the type check to miss.
  2641. function prependModifier (value, symbol) {
  2642. return typeof value === 'string' ? symbol + value : value
  2643. }
  2644. /* */
  2645. function installRenderHelpers (target) {
  2646. target._o = markOnce;
  2647. target._n = toNumber;
  2648. target._s = toString;
  2649. target._l = renderList;
  2650. target._t = renderSlot;
  2651. target._q = looseEqual;
  2652. target._i = looseIndexOf;
  2653. target._m = renderStatic;
  2654. target._f = resolveFilter;
  2655. target._k = checkKeyCodes;
  2656. target._b = bindObjectProps;
  2657. target._v = createTextVNode;
  2658. target._e = createEmptyVNode;
  2659. target._u = resolveScopedSlots;
  2660. target._g = bindObjectListeners;
  2661. target._d = bindDynamicKeys;
  2662. target._p = prependModifier;
  2663. }
  2664. /* */
  2665. function FunctionalRenderContext (
  2666. data,
  2667. props,
  2668. children,
  2669. parent,
  2670. Ctor
  2671. ) {
  2672. var this$1 = this;
  2673. var options = Ctor.options;
  2674. // ensure the createElement function in functional components
  2675. // gets a unique context - this is necessary for correct named slot check
  2676. var contextVm;
  2677. if (hasOwn(parent, '_uid')) {
  2678. contextVm = Object.create(parent);
  2679. // $flow-disable-line
  2680. contextVm._original = parent;
  2681. } else {
  2682. // the context vm passed in is a functional context as well.
  2683. // in this case we want to make sure we are able to get a hold to the
  2684. // real context instance.
  2685. contextVm = parent;
  2686. // $flow-disable-line
  2687. parent = parent._original;
  2688. }
  2689. var isCompiled = isTrue(options._compiled);
  2690. var needNormalization = !isCompiled;
  2691. this.data = data;
  2692. this.props = props;
  2693. this.children = children;
  2694. this.parent = parent;
  2695. this.listeners = data.on || emptyObject;
  2696. this.injections = resolveInject(options.inject, parent);
  2697. this.slots = function () {
  2698. if (!this$1.$slots) {
  2699. normalizeScopedSlots(
  2700. data.scopedSlots,
  2701. this$1.$slots = resolveSlots(children, parent)
  2702. );
  2703. }
  2704. return this$1.$slots
  2705. };
  2706. Object.defineProperty(this, 'scopedSlots', ({
  2707. enumerable: true,
  2708. get: function get () {
  2709. return normalizeScopedSlots(data.scopedSlots, this.slots())
  2710. }
  2711. }));
  2712. // support for compiled functional template
  2713. if (isCompiled) {
  2714. // exposing $options for renderStatic()
  2715. this.$options = options;
  2716. // pre-resolve slots for renderSlot()
  2717. this.$slots = this.slots();
  2718. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  2719. }
  2720. if (options._scopeId) {
  2721. this._c = function (a, b, c, d) {
  2722. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  2723. if (vnode && !Array.isArray(vnode)) {
  2724. vnode.fnScopeId = options._scopeId;
  2725. vnode.fnContext = parent;
  2726. }
  2727. return vnode
  2728. };
  2729. } else {
  2730. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  2731. }
  2732. }
  2733. installRenderHelpers(FunctionalRenderContext.prototype);
  2734. function createFunctionalComponent (
  2735. Ctor,
  2736. propsData,
  2737. data,
  2738. contextVm,
  2739. children
  2740. ) {
  2741. var options = Ctor.options;
  2742. var props = {};
  2743. var propOptions = options.props;
  2744. if (isDef(propOptions)) {
  2745. for (var key in propOptions) {
  2746. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  2747. }
  2748. } else {
  2749. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  2750. if (isDef(data.props)) { mergeProps(props, data.props); }
  2751. }
  2752. var renderContext = new FunctionalRenderContext(
  2753. data,
  2754. props,
  2755. children,
  2756. contextVm,
  2757. Ctor
  2758. );
  2759. var vnode = options.render.call(null, renderContext._c, renderContext);
  2760. if (vnode instanceof VNode) {
  2761. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  2762. } else if (Array.isArray(vnode)) {
  2763. var vnodes = normalizeChildren(vnode) || [];
  2764. var res = new Array(vnodes.length);
  2765. for (var i = 0; i < vnodes.length; i++) {
  2766. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  2767. }
  2768. return res
  2769. }
  2770. }
  2771. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  2772. // #7817 clone node before setting fnContext, otherwise if the node is reused
  2773. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  2774. // that should not be matched to match.
  2775. var clone = cloneVNode(vnode);
  2776. clone.fnContext = contextVm;
  2777. clone.fnOptions = options;
  2778. {
  2779. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  2780. }
  2781. if (data.slot) {
  2782. (clone.data || (clone.data = {})).slot = data.slot;
  2783. }
  2784. return clone
  2785. }
  2786. function mergeProps (to, from) {
  2787. for (var key in from) {
  2788. to[camelize(key)] = from[key];
  2789. }
  2790. }
  2791. /* */
  2792. /* */
  2793. /* */
  2794. /* */
  2795. // inline hooks to be invoked on component VNodes during patch
  2796. var componentVNodeHooks = {
  2797. init: function init (vnode, hydrating) {
  2798. if (
  2799. vnode.componentInstance &&
  2800. !vnode.componentInstance._isDestroyed &&
  2801. vnode.data.keepAlive
  2802. ) {
  2803. // kept-alive components, treat as a patch
  2804. var mountedNode = vnode; // work around flow
  2805. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  2806. } else {
  2807. var child = vnode.componentInstance = createComponentInstanceForVnode(
  2808. vnode,
  2809. activeInstance
  2810. );
  2811. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  2812. }
  2813. },
  2814. prepatch: function prepatch (oldVnode, vnode) {
  2815. var options = vnode.componentOptions;
  2816. var child = vnode.componentInstance = oldVnode.componentInstance;
  2817. updateChildComponent(
  2818. child,
  2819. options.propsData, // updated props
  2820. options.listeners, // updated listeners
  2821. vnode, // new parent vnode
  2822. options.children // new children
  2823. );
  2824. },
  2825. insert: function insert (vnode) {
  2826. var context = vnode.context;
  2827. var componentInstance = vnode.componentInstance;
  2828. if (!componentInstance._isMounted) {
  2829. componentInstance._isMounted = true;
  2830. callHook(componentInstance, 'mounted');
  2831. }
  2832. if (vnode.data.keepAlive) {
  2833. if (context._isMounted) {
  2834. // vue-router#1212
  2835. // During updates, a kept-alive component's child components may
  2836. // change, so directly walking the tree here may call activated hooks
  2837. // on incorrect children. Instead we push them into a queue which will
  2838. // be processed after the whole patch process ended.
  2839. queueActivatedComponent(componentInstance);
  2840. } else {
  2841. activateChildComponent(componentInstance, true /* direct */);
  2842. }
  2843. }
  2844. },
  2845. destroy: function destroy (vnode) {
  2846. var componentInstance = vnode.componentInstance;
  2847. if (!componentInstance._isDestroyed) {
  2848. if (!vnode.data.keepAlive) {
  2849. componentInstance.$destroy();
  2850. } else {
  2851. deactivateChildComponent(componentInstance, true /* direct */);
  2852. }
  2853. }
  2854. }
  2855. };
  2856. var hooksToMerge = Object.keys(componentVNodeHooks);
  2857. function createComponent (
  2858. Ctor,
  2859. data,
  2860. context,
  2861. children,
  2862. tag
  2863. ) {
  2864. if (isUndef(Ctor)) {
  2865. return
  2866. }
  2867. var baseCtor = context.$options._base;
  2868. // plain options object: turn it into a constructor
  2869. if (isObject(Ctor)) {
  2870. Ctor = baseCtor.extend(Ctor);
  2871. }
  2872. // if at this stage it's not a constructor or an async component factory,
  2873. // reject.
  2874. if (typeof Ctor !== 'function') {
  2875. {
  2876. warn(("Invalid Component definition: " + (String(Ctor))), context);
  2877. }
  2878. return
  2879. }
  2880. // async component
  2881. var asyncFactory;
  2882. if (isUndef(Ctor.cid)) {
  2883. asyncFactory = Ctor;
  2884. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  2885. if (Ctor === undefined) {
  2886. // return a placeholder node for async component, which is rendered
  2887. // as a comment node but preserves all the raw information for the node.
  2888. // the information will be used for async server-rendering and hydration.
  2889. return createAsyncPlaceholder(
  2890. asyncFactory,
  2891. data,
  2892. context,
  2893. children,
  2894. tag
  2895. )
  2896. }
  2897. }
  2898. data = data || {};
  2899. // resolve constructor options in case global mixins are applied after
  2900. // component constructor creation
  2901. resolveConstructorOptions(Ctor);
  2902. // transform component v-model data into props & events
  2903. if (isDef(data.model)) {
  2904. transformModel(Ctor.options, data);
  2905. }
  2906. // extract props
  2907. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  2908. // functional component
  2909. if (isTrue(Ctor.options.functional)) {
  2910. return createFunctionalComponent(Ctor, propsData, data, context, children)
  2911. }
  2912. // extract listeners, since these needs to be treated as
  2913. // child component listeners instead of DOM listeners
  2914. var listeners = data.on;
  2915. // replace with listeners with .native modifier
  2916. // so it gets processed during parent component patch.
  2917. data.on = data.nativeOn;
  2918. if (isTrue(Ctor.options.abstract)) {
  2919. // abstract components do not keep anything
  2920. // other than props & listeners & slot
  2921. // work around flow
  2922. var slot = data.slot;
  2923. data = {};
  2924. if (slot) {
  2925. data.slot = slot;
  2926. }
  2927. }
  2928. // install component management hooks onto the placeholder node
  2929. installComponentHooks(data);
  2930. // return a placeholder vnode
  2931. var name = Ctor.options.name || tag;
  2932. var vnode = new VNode(
  2933. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  2934. data, undefined, undefined, undefined, context,
  2935. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  2936. asyncFactory
  2937. );
  2938. return vnode
  2939. }
  2940. function createComponentInstanceForVnode (
  2941. vnode, // we know it's MountedComponentVNode but flow doesn't
  2942. parent // activeInstance in lifecycle state
  2943. ) {
  2944. var options = {
  2945. _isComponent: true,
  2946. _parentVnode: vnode,
  2947. parent: parent
  2948. };
  2949. // check inline-template render functions
  2950. var inlineTemplate = vnode.data.inlineTemplate;
  2951. if (isDef(inlineTemplate)) {
  2952. options.render = inlineTemplate.render;
  2953. options.staticRenderFns = inlineTemplate.staticRenderFns;
  2954. }
  2955. return new vnode.componentOptions.Ctor(options)
  2956. }
  2957. function installComponentHooks (data) {
  2958. var hooks = data.hook || (data.hook = {});
  2959. for (var i = 0; i < hooksToMerge.length; i++) {
  2960. var key = hooksToMerge[i];
  2961. var existing = hooks[key];
  2962. var toMerge = componentVNodeHooks[key];
  2963. if (existing !== toMerge && !(existing && existing._merged)) {
  2964. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  2965. }
  2966. }
  2967. }
  2968. function mergeHook$1 (f1, f2) {
  2969. var merged = function (a, b) {
  2970. // flow complains about extra args which is why we use any
  2971. f1(a, b);
  2972. f2(a, b);
  2973. };
  2974. merged._merged = true;
  2975. return merged
  2976. }
  2977. // transform component v-model info (value and callback) into
  2978. // prop and event handler respectively.
  2979. function transformModel (options, data) {
  2980. var prop = (options.model && options.model.prop) || 'value';
  2981. var event = (options.model && options.model.event) || 'input'
  2982. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  2983. var on = data.on || (data.on = {});
  2984. var existing = on[event];
  2985. var callback = data.model.callback;
  2986. if (isDef(existing)) {
  2987. if (
  2988. Array.isArray(existing)
  2989. ? existing.indexOf(callback) === -1
  2990. : existing !== callback
  2991. ) {
  2992. on[event] = [callback].concat(existing);
  2993. }
  2994. } else {
  2995. on[event] = callback;
  2996. }
  2997. }
  2998. /* */
  2999. var SIMPLE_NORMALIZE = 1;
  3000. var ALWAYS_NORMALIZE = 2;
  3001. // wrapper function for providing a more flexible interface
  3002. // without getting yelled at by flow
  3003. function createElement (
  3004. context,
  3005. tag,
  3006. data,
  3007. children,
  3008. normalizationType,
  3009. alwaysNormalize
  3010. ) {
  3011. if (Array.isArray(data) || isPrimitive(data)) {
  3012. normalizationType = children;
  3013. children = data;
  3014. data = undefined;
  3015. }
  3016. if (isTrue(alwaysNormalize)) {
  3017. normalizationType = ALWAYS_NORMALIZE;
  3018. }
  3019. return _createElement(context, tag, data, children, normalizationType)
  3020. }
  3021. function _createElement (
  3022. context,
  3023. tag,
  3024. data,
  3025. children,
  3026. normalizationType
  3027. ) {
  3028. if (isDef(data) && isDef((data).__ob__)) {
  3029. warn(
  3030. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  3031. 'Always create fresh vnode data objects in each render!',
  3032. context
  3033. );
  3034. return createEmptyVNode()
  3035. }
  3036. // object syntax in v-bind
  3037. if (isDef(data) && isDef(data.is)) {
  3038. tag = data.is;
  3039. }
  3040. if (!tag) {
  3041. // in case of component :is set to falsy value
  3042. return createEmptyVNode()
  3043. }
  3044. // warn against non-primitive key
  3045. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  3046. ) {
  3047. {
  3048. warn(
  3049. 'Avoid using non-primitive value as key, ' +
  3050. 'use string/number value instead.',
  3051. context
  3052. );
  3053. }
  3054. }
  3055. // support single function children as default scoped slot
  3056. if (Array.isArray(children) &&
  3057. typeof children[0] === 'function'
  3058. ) {
  3059. data = data || {};
  3060. data.scopedSlots = { default: children[0] };
  3061. children.length = 0;
  3062. }
  3063. if (normalizationType === ALWAYS_NORMALIZE) {
  3064. children = normalizeChildren(children);
  3065. } else if (normalizationType === SIMPLE_NORMALIZE) {
  3066. children = simpleNormalizeChildren(children);
  3067. }
  3068. var vnode, ns;
  3069. if (typeof tag === 'string') {
  3070. var Ctor;
  3071. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  3072. if (config.isReservedTag(tag)) {
  3073. // platform built-in elements
  3074. vnode = new VNode(
  3075. config.parsePlatformTagName(tag), data, children,
  3076. undefined, undefined, context
  3077. );
  3078. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  3079. // component
  3080. vnode = createComponent(Ctor, data, context, children, tag);
  3081. } else {
  3082. // unknown or unlisted namespaced elements
  3083. // check at runtime because it may get assigned a namespace when its
  3084. // parent normalizes children
  3085. vnode = new VNode(
  3086. tag, data, children,
  3087. undefined, undefined, context
  3088. );
  3089. }
  3090. } else {
  3091. // direct component options / constructor
  3092. vnode = createComponent(tag, data, context, children);
  3093. }
  3094. if (Array.isArray(vnode)) {
  3095. return vnode
  3096. } else if (isDef(vnode)) {
  3097. if (isDef(ns)) { applyNS(vnode, ns); }
  3098. if (isDef(data)) { registerDeepBindings(data); }
  3099. return vnode
  3100. } else {
  3101. return createEmptyVNode()
  3102. }
  3103. }
  3104. function applyNS (vnode, ns, force) {
  3105. vnode.ns = ns;
  3106. if (vnode.tag === 'foreignObject') {
  3107. // use default namespace inside foreignObject
  3108. ns = undefined;
  3109. force = true;
  3110. }
  3111. if (isDef(vnode.children)) {
  3112. for (var i = 0, l = vnode.children.length; i < l; i++) {
  3113. var child = vnode.children[i];
  3114. if (isDef(child.tag) && (
  3115. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  3116. applyNS(child, ns, force);
  3117. }
  3118. }
  3119. }
  3120. }
  3121. // ref #5318
  3122. // necessary to ensure parent re-render when deep bindings like :style and
  3123. // :class are used on slot nodes
  3124. function registerDeepBindings (data) {
  3125. if (isObject(data.style)) {
  3126. traverse(data.style);
  3127. }
  3128. if (isObject(data.class)) {
  3129. traverse(data.class);
  3130. }
  3131. }
  3132. /* */
  3133. function initRender (vm) {
  3134. vm._vnode = null; // the root of the child tree
  3135. vm._staticTrees = null; // v-once cached trees
  3136. var options = vm.$options;
  3137. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  3138. var renderContext = parentVnode && parentVnode.context;
  3139. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  3140. vm.$scopedSlots = emptyObject;
  3141. // bind the createElement fn to this instance
  3142. // so that we get proper render context inside it.
  3143. // args order: tag, data, children, normalizationType, alwaysNormalize
  3144. // internal version is used by render functions compiled from templates
  3145. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  3146. // normalization is always applied for the public version, used in
  3147. // user-written render functions.
  3148. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  3149. // $attrs & $listeners are exposed for easier HOC creation.
  3150. // they need to be reactive so that HOCs using them are always updated
  3151. var parentData = parentVnode && parentVnode.data;
  3152. /* istanbul ignore else */
  3153. {
  3154. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  3155. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  3156. }, true);
  3157. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  3158. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  3159. }, true);
  3160. }
  3161. }
  3162. var currentRenderingInstance = null;
  3163. function renderMixin (Vue) {
  3164. // install runtime convenience helpers
  3165. installRenderHelpers(Vue.prototype);
  3166. Vue.prototype.$nextTick = function (fn) {
  3167. return nextTick(fn, this)
  3168. };
  3169. Vue.prototype._render = function () {
  3170. var vm = this;
  3171. var ref = vm.$options;
  3172. var render = ref.render;
  3173. var _parentVnode = ref._parentVnode;
  3174. if (_parentVnode) {
  3175. vm.$scopedSlots = normalizeScopedSlots(
  3176. _parentVnode.data.scopedSlots,
  3177. vm.$slots,
  3178. vm.$scopedSlots
  3179. );
  3180. }
  3181. // set parent vnode. this allows render functions to have access
  3182. // to the data on the placeholder node.
  3183. vm.$vnode = _parentVnode;
  3184. // render self
  3185. var vnode;
  3186. try {
  3187. // There's no need to maintain a stack becaues all render fns are called
  3188. // separately from one another. Nested component's render fns are called
  3189. // when parent component is patched.
  3190. currentRenderingInstance = vm;
  3191. vnode = render.call(vm._renderProxy, vm.$createElement);
  3192. } catch (e) {
  3193. handleError(e, vm, "render");
  3194. // return error render result,
  3195. // or previous vnode to prevent render error causing blank component
  3196. /* istanbul ignore else */
  3197. if (vm.$options.renderError) {
  3198. try {
  3199. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  3200. } catch (e) {
  3201. handleError(e, vm, "renderError");
  3202. vnode = vm._vnode;
  3203. }
  3204. } else {
  3205. vnode = vm._vnode;
  3206. }
  3207. } finally {
  3208. currentRenderingInstance = null;
  3209. }
  3210. // if the returned array contains only a single node, allow it
  3211. if (Array.isArray(vnode) && vnode.length === 1) {
  3212. vnode = vnode[0];
  3213. }
  3214. // return empty vnode in case the render function errored out
  3215. if (!(vnode instanceof VNode)) {
  3216. if (Array.isArray(vnode)) {
  3217. warn(
  3218. 'Multiple root nodes returned from render function. Render function ' +
  3219. 'should return a single root node.',
  3220. vm
  3221. );
  3222. }
  3223. vnode = createEmptyVNode();
  3224. }
  3225. // set parent
  3226. vnode.parent = _parentVnode;
  3227. return vnode
  3228. };
  3229. }
  3230. /* */
  3231. function ensureCtor (comp, base) {
  3232. if (
  3233. comp.__esModule ||
  3234. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  3235. ) {
  3236. comp = comp.default;
  3237. }
  3238. return isObject(comp)
  3239. ? base.extend(comp)
  3240. : comp
  3241. }
  3242. function createAsyncPlaceholder (
  3243. factory,
  3244. data,
  3245. context,
  3246. children,
  3247. tag
  3248. ) {
  3249. var node = createEmptyVNode();
  3250. node.asyncFactory = factory;
  3251. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  3252. return node
  3253. }
  3254. function resolveAsyncComponent (
  3255. factory,
  3256. baseCtor
  3257. ) {
  3258. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  3259. return factory.errorComp
  3260. }
  3261. if (isDef(factory.resolved)) {
  3262. return factory.resolved
  3263. }
  3264. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  3265. return factory.loadingComp
  3266. }
  3267. var owner = currentRenderingInstance;
  3268. if (isDef(factory.owners)) {
  3269. // already pending
  3270. factory.owners.push(owner);
  3271. } else {
  3272. var owners = factory.owners = [owner];
  3273. var sync = true;
  3274. var forceRender = function (renderCompleted) {
  3275. for (var i = 0, l = owners.length; i < l; i++) {
  3276. (owners[i]).$forceUpdate();
  3277. }
  3278. if (renderCompleted) {
  3279. owners.length = 0;
  3280. }
  3281. };
  3282. var resolve = once(function (res) {
  3283. // cache resolved
  3284. factory.resolved = ensureCtor(res, baseCtor);
  3285. // invoke callbacks only if this is not a synchronous resolve
  3286. // (async resolves are shimmed as synchronous during SSR)
  3287. if (!sync) {
  3288. forceRender(true);
  3289. } else {
  3290. owners.length = 0;
  3291. }
  3292. });
  3293. var reject = once(function (reason) {
  3294. warn(
  3295. "Failed to resolve async component: " + (String(factory)) +
  3296. (reason ? ("\nReason: " + reason) : '')
  3297. );
  3298. if (isDef(factory.errorComp)) {
  3299. factory.error = true;
  3300. forceRender(true);
  3301. }
  3302. });
  3303. var res = factory(resolve, reject);
  3304. if (isObject(res)) {
  3305. if (isPromise(res)) {
  3306. // () => Promise
  3307. if (isUndef(factory.resolved)) {
  3308. res.then(resolve, reject);
  3309. }
  3310. } else if (isPromise(res.component)) {
  3311. res.component.then(resolve, reject);
  3312. if (isDef(res.error)) {
  3313. factory.errorComp = ensureCtor(res.error, baseCtor);
  3314. }
  3315. if (isDef(res.loading)) {
  3316. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  3317. if (res.delay === 0) {
  3318. factory.loading = true;
  3319. } else {
  3320. setTimeout(function () {
  3321. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  3322. factory.loading = true;
  3323. forceRender(false);
  3324. }
  3325. }, res.delay || 200);
  3326. }
  3327. }
  3328. if (isDef(res.timeout)) {
  3329. setTimeout(function () {
  3330. if (isUndef(factory.resolved)) {
  3331. reject(
  3332. "timeout (" + (res.timeout) + "ms)"
  3333. );
  3334. }
  3335. }, res.timeout);
  3336. }
  3337. }
  3338. }
  3339. sync = false;
  3340. // return in case resolved synchronously
  3341. return factory.loading
  3342. ? factory.loadingComp
  3343. : factory.resolved
  3344. }
  3345. }
  3346. /* */
  3347. function isAsyncPlaceholder (node) {
  3348. return node.isComment && node.asyncFactory
  3349. }
  3350. /* */
  3351. function getFirstComponentChild (children) {
  3352. if (Array.isArray(children)) {
  3353. for (var i = 0; i < children.length; i++) {
  3354. var c = children[i];
  3355. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  3356. return c
  3357. }
  3358. }
  3359. }
  3360. }
  3361. /* */
  3362. /* */
  3363. function initEvents (vm) {
  3364. vm._events = Object.create(null);
  3365. vm._hasHookEvent = false;
  3366. // init parent attached events
  3367. var listeners = vm.$options._parentListeners;
  3368. if (listeners) {
  3369. updateComponentListeners(vm, listeners);
  3370. }
  3371. }
  3372. var target;
  3373. function add (event, fn) {
  3374. target.$on(event, fn);
  3375. }
  3376. function remove$1 (event, fn) {
  3377. target.$off(event, fn);
  3378. }
  3379. function createOnceHandler (event, fn) {
  3380. var _target = target;
  3381. return function onceHandler () {
  3382. var res = fn.apply(null, arguments);
  3383. if (res !== null) {
  3384. _target.$off(event, onceHandler);
  3385. }
  3386. }
  3387. }
  3388. function updateComponentListeners (
  3389. vm,
  3390. listeners,
  3391. oldListeners
  3392. ) {
  3393. target = vm;
  3394. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  3395. target = undefined;
  3396. }
  3397. function eventsMixin (Vue) {
  3398. var hookRE = /^hook:/;
  3399. Vue.prototype.$on = function (event, fn) {
  3400. var vm = this;
  3401. if (Array.isArray(event)) {
  3402. for (var i = 0, l = event.length; i < l; i++) {
  3403. vm.$on(event[i], fn);
  3404. }
  3405. } else {
  3406. (vm._events[event] || (vm._events[event] = [])).push(fn);
  3407. // optimize hook:event cost by using a boolean flag marked at registration
  3408. // instead of a hash lookup
  3409. if (hookRE.test(event)) {
  3410. vm._hasHookEvent = true;
  3411. }
  3412. }
  3413. return vm
  3414. };
  3415. Vue.prototype.$once = function (event, fn) {
  3416. var vm = this;
  3417. function on () {
  3418. vm.$off(event, on);
  3419. fn.apply(vm, arguments);
  3420. }
  3421. on.fn = fn;
  3422. vm.$on(event, on);
  3423. return vm
  3424. };
  3425. Vue.prototype.$off = function (event, fn) {
  3426. var vm = this;
  3427. // all
  3428. if (!arguments.length) {
  3429. vm._events = Object.create(null);
  3430. return vm
  3431. }
  3432. // array of events
  3433. if (Array.isArray(event)) {
  3434. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  3435. vm.$off(event[i$1], fn);
  3436. }
  3437. return vm
  3438. }
  3439. // specific event
  3440. var cbs = vm._events[event];
  3441. if (!cbs) {
  3442. return vm
  3443. }
  3444. if (!fn) {
  3445. vm._events[event] = null;
  3446. return vm
  3447. }
  3448. // specific handler
  3449. var cb;
  3450. var i = cbs.length;
  3451. while (i--) {
  3452. cb = cbs[i];
  3453. if (cb === fn || cb.fn === fn) {
  3454. cbs.splice(i, 1);
  3455. break
  3456. }
  3457. }
  3458. return vm
  3459. };
  3460. Vue.prototype.$emit = function (event) {
  3461. var vm = this;
  3462. {
  3463. var lowerCaseEvent = event.toLowerCase();
  3464. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  3465. tip(
  3466. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  3467. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  3468. "Note that HTML attributes are case-insensitive and you cannot use " +
  3469. "v-on to listen to camelCase events when using in-DOM templates. " +
  3470. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  3471. );
  3472. }
  3473. }
  3474. var cbs = vm._events[event];
  3475. if (cbs) {
  3476. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  3477. var args = toArray(arguments, 1);
  3478. var info = "event handler for \"" + event + "\"";
  3479. for (var i = 0, l = cbs.length; i < l; i++) {
  3480. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  3481. }
  3482. }
  3483. return vm
  3484. };
  3485. }
  3486. /* */
  3487. var activeInstance = null;
  3488. var isUpdatingChildComponent = false;
  3489. function setActiveInstance(vm) {
  3490. var prevActiveInstance = activeInstance;
  3491. activeInstance = vm;
  3492. return function () {
  3493. activeInstance = prevActiveInstance;
  3494. }
  3495. }
  3496. function initLifecycle (vm) {
  3497. var options = vm.$options;
  3498. // locate first non-abstract parent
  3499. var parent = options.parent;
  3500. if (parent && !options.abstract) {
  3501. while (parent.$options.abstract && parent.$parent) {
  3502. parent = parent.$parent;
  3503. }
  3504. parent.$children.push(vm);
  3505. }
  3506. vm.$parent = parent;
  3507. vm.$root = parent ? parent.$root : vm;
  3508. vm.$children = [];
  3509. vm.$refs = {};
  3510. vm._watcher = null;
  3511. vm._inactive = null;
  3512. vm._directInactive = false;
  3513. vm._isMounted = false;
  3514. vm._isDestroyed = false;
  3515. vm._isBeingDestroyed = false;
  3516. }
  3517. function lifecycleMixin (Vue) {
  3518. Vue.prototype._update = function (vnode, hydrating) {
  3519. var vm = this;
  3520. var prevEl = vm.$el;
  3521. var prevVnode = vm._vnode;
  3522. var restoreActiveInstance = setActiveInstance(vm);
  3523. vm._vnode = vnode;
  3524. // Vue.prototype.__patch__ is injected in entry points
  3525. // based on the rendering backend used.
  3526. if (!prevVnode) {
  3527. // initial render
  3528. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  3529. } else {
  3530. // updates
  3531. vm.$el = vm.__patch__(prevVnode, vnode);
  3532. }
  3533. restoreActiveInstance();
  3534. // update __vue__ reference
  3535. if (prevEl) {
  3536. prevEl.__vue__ = null;
  3537. }
  3538. if (vm.$el) {
  3539. vm.$el.__vue__ = vm;
  3540. }
  3541. // if parent is an HOC, update its $el as well
  3542. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  3543. vm.$parent.$el = vm.$el;
  3544. }
  3545. // updated hook is called by the scheduler to ensure that children are
  3546. // updated in a parent's updated hook.
  3547. };
  3548. Vue.prototype.$forceUpdate = function () {
  3549. var vm = this;
  3550. if (vm._watcher) {
  3551. vm._watcher.update();
  3552. }
  3553. };
  3554. Vue.prototype.$destroy = function () {
  3555. var vm = this;
  3556. if (vm._isBeingDestroyed) {
  3557. return
  3558. }
  3559. callHook(vm, 'beforeDestroy');
  3560. vm._isBeingDestroyed = true;
  3561. // remove self from parent
  3562. var parent = vm.$parent;
  3563. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  3564. remove(parent.$children, vm);
  3565. }
  3566. // teardown watchers
  3567. if (vm._watcher) {
  3568. vm._watcher.teardown();
  3569. }
  3570. var i = vm._watchers.length;
  3571. while (i--) {
  3572. vm._watchers[i].teardown();
  3573. }
  3574. // remove reference from data ob
  3575. // frozen object may not have observer.
  3576. if (vm._data.__ob__) {
  3577. vm._data.__ob__.vmCount--;
  3578. }
  3579. // call the last hook...
  3580. vm._isDestroyed = true;
  3581. // invoke destroy hooks on current rendered tree
  3582. vm.__patch__(vm._vnode, null);
  3583. // fire destroyed hook
  3584. callHook(vm, 'destroyed');
  3585. // turn off all instance listeners.
  3586. vm.$off();
  3587. // remove __vue__ reference
  3588. if (vm.$el) {
  3589. vm.$el.__vue__ = null;
  3590. }
  3591. // release circular reference (#6759)
  3592. if (vm.$vnode) {
  3593. vm.$vnode.parent = null;
  3594. }
  3595. };
  3596. }
  3597. function mountComponent (
  3598. vm,
  3599. el,
  3600. hydrating
  3601. ) {
  3602. vm.$el = el;
  3603. if (!vm.$options.render) {
  3604. vm.$options.render = createEmptyVNode;
  3605. {
  3606. /* istanbul ignore if */
  3607. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  3608. vm.$options.el || el) {
  3609. warn(
  3610. 'You are using the runtime-only build of Vue where the template ' +
  3611. 'compiler is not available. Either pre-compile the templates into ' +
  3612. 'render functions, or use the compiler-included build.',
  3613. vm
  3614. );
  3615. } else {
  3616. warn(
  3617. 'Failed to mount component: template or render function not defined.',
  3618. vm
  3619. );
  3620. }
  3621. }
  3622. }
  3623. callHook(vm, 'beforeMount');
  3624. var updateComponent;
  3625. /* istanbul ignore if */
  3626. if (config.performance && mark) {
  3627. updateComponent = function () {
  3628. var name = vm._name;
  3629. var id = vm._uid;
  3630. var startTag = "vue-perf-start:" + id;
  3631. var endTag = "vue-perf-end:" + id;
  3632. mark(startTag);
  3633. var vnode = vm._render();
  3634. mark(endTag);
  3635. measure(("vue " + name + " render"), startTag, endTag);
  3636. mark(startTag);
  3637. vm._update(vnode, hydrating);
  3638. mark(endTag);
  3639. measure(("vue " + name + " patch"), startTag, endTag);
  3640. };
  3641. } else {
  3642. updateComponent = function () {
  3643. vm._update(vm._render(), hydrating);
  3644. };
  3645. }
  3646. // we set this to vm._watcher inside the watcher's constructor
  3647. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  3648. // component's mounted hook), which relies on vm._watcher being already defined
  3649. new Watcher(vm, updateComponent, noop, {
  3650. before: function before () {
  3651. if (vm._isMounted && !vm._isDestroyed) {
  3652. callHook(vm, 'beforeUpdate');
  3653. }
  3654. }
  3655. }, true /* isRenderWatcher */);
  3656. hydrating = false;
  3657. // manually mounted instance, call mounted on self
  3658. // mounted is called for render-created child components in its inserted hook
  3659. if (vm.$vnode == null) {
  3660. vm._isMounted = true;
  3661. callHook(vm, 'mounted');
  3662. }
  3663. return vm
  3664. }
  3665. function updateChildComponent (
  3666. vm,
  3667. propsData,
  3668. listeners,
  3669. parentVnode,
  3670. renderChildren
  3671. ) {
  3672. {
  3673. isUpdatingChildComponent = true;
  3674. }
  3675. // determine whether component has slot children
  3676. // we need to do this before overwriting $options._renderChildren.
  3677. // check if there are dynamic scopedSlots (hand-written or compiled but with
  3678. // dynamic slot names). Static scoped slots compiled from template has the
  3679. // "$stable" marker.
  3680. var hasDynamicScopedSlot = !!(
  3681. (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) ||
  3682. (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable)
  3683. );
  3684. // Any static slot children from the parent may have changed during parent's
  3685. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  3686. // update is necessary to ensure correctness.
  3687. var needsForceUpdate = !!(
  3688. renderChildren || // has new static slots
  3689. vm.$options._renderChildren || // has old static slots
  3690. hasDynamicScopedSlot
  3691. );
  3692. vm.$options._parentVnode = parentVnode;
  3693. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  3694. if (vm._vnode) { // update child tree's parent
  3695. vm._vnode.parent = parentVnode;
  3696. }
  3697. vm.$options._renderChildren = renderChildren;
  3698. // update $attrs and $listeners hash
  3699. // these are also reactive so they may trigger child update if the child
  3700. // used them during render
  3701. vm.$attrs = parentVnode.data.attrs || emptyObject;
  3702. vm.$listeners = listeners || emptyObject;
  3703. // update props
  3704. if (propsData && vm.$options.props) {
  3705. toggleObserving(false);
  3706. var props = vm._props;
  3707. var propKeys = vm.$options._propKeys || [];
  3708. for (var i = 0; i < propKeys.length; i++) {
  3709. var key = propKeys[i];
  3710. var propOptions = vm.$options.props; // wtf flow?
  3711. props[key] = validateProp(key, propOptions, propsData, vm);
  3712. }
  3713. toggleObserving(true);
  3714. // keep a copy of raw propsData
  3715. vm.$options.propsData = propsData;
  3716. }
  3717. // update listeners
  3718. listeners = listeners || emptyObject;
  3719. var oldListeners = vm.$options._parentListeners;
  3720. vm.$options._parentListeners = listeners;
  3721. updateComponentListeners(vm, listeners, oldListeners);
  3722. // resolve slots + force update if has children
  3723. if (needsForceUpdate) {
  3724. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  3725. vm.$forceUpdate();
  3726. }
  3727. {
  3728. isUpdatingChildComponent = false;
  3729. }
  3730. }
  3731. function isInInactiveTree (vm) {
  3732. while (vm && (vm = vm.$parent)) {
  3733. if (vm._inactive) { return true }
  3734. }
  3735. return false
  3736. }
  3737. function activateChildComponent (vm, direct) {
  3738. if (direct) {
  3739. vm._directInactive = false;
  3740. if (isInInactiveTree(vm)) {
  3741. return
  3742. }
  3743. } else if (vm._directInactive) {
  3744. return
  3745. }
  3746. if (vm._inactive || vm._inactive === null) {
  3747. vm._inactive = false;
  3748. for (var i = 0; i < vm.$children.length; i++) {
  3749. activateChildComponent(vm.$children[i]);
  3750. }
  3751. callHook(vm, 'activated');
  3752. }
  3753. }
  3754. function deactivateChildComponent (vm, direct) {
  3755. if (direct) {
  3756. vm._directInactive = true;
  3757. if (isInInactiveTree(vm)) {
  3758. return
  3759. }
  3760. }
  3761. if (!vm._inactive) {
  3762. vm._inactive = true;
  3763. for (var i = 0; i < vm.$children.length; i++) {
  3764. deactivateChildComponent(vm.$children[i]);
  3765. }
  3766. callHook(vm, 'deactivated');
  3767. }
  3768. }
  3769. function callHook (vm, hook) {
  3770. // #7573 disable dep collection when invoking lifecycle hooks
  3771. pushTarget();
  3772. var handlers = vm.$options[hook];
  3773. var info = hook + " hook";
  3774. if (handlers) {
  3775. for (var i = 0, j = handlers.length; i < j; i++) {
  3776. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  3777. }
  3778. }
  3779. if (vm._hasHookEvent) {
  3780. vm.$emit('hook:' + hook);
  3781. }
  3782. popTarget();
  3783. }
  3784. /* */
  3785. var MAX_UPDATE_COUNT = 100;
  3786. var queue = [];
  3787. var activatedChildren = [];
  3788. var has = {};
  3789. var circular = {};
  3790. var waiting = false;
  3791. var flushing = false;
  3792. var index = 0;
  3793. /**
  3794. * Reset the scheduler's state.
  3795. */
  3796. function resetSchedulerState () {
  3797. index = queue.length = activatedChildren.length = 0;
  3798. has = {};
  3799. {
  3800. circular = {};
  3801. }
  3802. waiting = flushing = false;
  3803. }
  3804. // Async edge case #6566 requires saving the timestamp when event listeners are
  3805. // attached. However, calling performance.now() has a perf overhead especially
  3806. // if the page has thousands of event listeners. Instead, we take a timestamp
  3807. // every time the scheduler flushes and use that for all event listeners
  3808. // attached during that flush.
  3809. var currentFlushTimestamp = 0;
  3810. // Async edge case fix requires storing an event listener's attach timestamp.
  3811. var getNow = Date.now;
  3812. // Determine what event timestamp the browser is using. Annoyingly, the
  3813. // timestamp can either be hi-res (relative to page load) or low-res
  3814. // (relative to UNIX epoch), so in order to compare time we have to use the
  3815. // same timestamp type when saving the flush timestamp.
  3816. if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
  3817. // if the low-res timestamp which is bigger than the event timestamp
  3818. // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
  3819. // and we need to use the hi-res version for event listeners as well.
  3820. getNow = function () { return performance.now(); };
  3821. }
  3822. /**
  3823. * Flush both queues and run the watchers.
  3824. */
  3825. function flushSchedulerQueue () {
  3826. currentFlushTimestamp = getNow();
  3827. flushing = true;
  3828. var watcher, id;
  3829. // Sort queue before flush.
  3830. // This ensures that:
  3831. // 1. Components are updated from parent to child. (because parent is always
  3832. // created before the child)
  3833. // 2. A component's user watchers are run before its render watcher (because
  3834. // user watchers are created before the render watcher)
  3835. // 3. If a component is destroyed during a parent component's watcher run,
  3836. // its watchers can be skipped.
  3837. queue.sort(function (a, b) { return a.id - b.id; });
  3838. // do not cache length because more watchers might be pushed
  3839. // as we run existing watchers
  3840. for (index = 0; index < queue.length; index++) {
  3841. watcher = queue[index];
  3842. if (watcher.before) {
  3843. watcher.before();
  3844. }
  3845. id = watcher.id;
  3846. has[id] = null;
  3847. watcher.run();
  3848. // in dev build, check and stop circular updates.
  3849. if (has[id] != null) {
  3850. circular[id] = (circular[id] || 0) + 1;
  3851. if (circular[id] > MAX_UPDATE_COUNT) {
  3852. warn(
  3853. 'You may have an infinite update loop ' + (
  3854. watcher.user
  3855. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  3856. : "in a component render function."
  3857. ),
  3858. watcher.vm
  3859. );
  3860. break
  3861. }
  3862. }
  3863. }
  3864. // keep copies of post queues before resetting state
  3865. var activatedQueue = activatedChildren.slice();
  3866. var updatedQueue = queue.slice();
  3867. resetSchedulerState();
  3868. // call component updated and activated hooks
  3869. callActivatedHooks(activatedQueue);
  3870. callUpdatedHooks(updatedQueue);
  3871. // devtool hook
  3872. /* istanbul ignore if */
  3873. if (devtools && config.devtools) {
  3874. devtools.emit('flush');
  3875. }
  3876. }
  3877. function callUpdatedHooks (queue) {
  3878. var i = queue.length;
  3879. while (i--) {
  3880. var watcher = queue[i];
  3881. var vm = watcher.vm;
  3882. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  3883. callHook(vm, 'updated');
  3884. }
  3885. }
  3886. }
  3887. /**
  3888. * Queue a kept-alive component that was activated during patch.
  3889. * The queue will be processed after the entire tree has been patched.
  3890. */
  3891. function queueActivatedComponent (vm) {
  3892. // setting _inactive to false here so that a render function can
  3893. // rely on checking whether it's in an inactive tree (e.g. router-view)
  3894. vm._inactive = false;
  3895. activatedChildren.push(vm);
  3896. }
  3897. function callActivatedHooks (queue) {
  3898. for (var i = 0; i < queue.length; i++) {
  3899. queue[i]._inactive = true;
  3900. activateChildComponent(queue[i], true /* true */);
  3901. }
  3902. }
  3903. /**
  3904. * Push a watcher into the watcher queue.
  3905. * Jobs with duplicate IDs will be skipped unless it's
  3906. * pushed when the queue is being flushed.
  3907. */
  3908. function queueWatcher (watcher) {
  3909. var id = watcher.id;
  3910. if (has[id] == null) {
  3911. has[id] = true;
  3912. if (!flushing) {
  3913. queue.push(watcher);
  3914. } else {
  3915. // if already flushing, splice the watcher based on its id
  3916. // if already past its id, it will be run next immediately.
  3917. var i = queue.length - 1;
  3918. while (i > index && queue[i].id > watcher.id) {
  3919. i--;
  3920. }
  3921. queue.splice(i + 1, 0, watcher);
  3922. }
  3923. // queue the flush
  3924. if (!waiting) {
  3925. waiting = true;
  3926. if (!config.async) {
  3927. flushSchedulerQueue();
  3928. return
  3929. }
  3930. nextTick(flushSchedulerQueue);
  3931. }
  3932. }
  3933. }
  3934. /* */
  3935. var uid$2 = 0;
  3936. /**
  3937. * A watcher parses an expression, collects dependencies,
  3938. * and fires callback when the expression value changes.
  3939. * This is used for both the $watch() api and directives.
  3940. */
  3941. var Watcher = function Watcher (
  3942. vm,
  3943. expOrFn,
  3944. cb,
  3945. options,
  3946. isRenderWatcher
  3947. ) {
  3948. this.vm = vm;
  3949. if (isRenderWatcher) {
  3950. vm._watcher = this;
  3951. }
  3952. vm._watchers.push(this);
  3953. // options
  3954. if (options) {
  3955. this.deep = !!options.deep;
  3956. this.user = !!options.user;
  3957. this.lazy = !!options.lazy;
  3958. this.sync = !!options.sync;
  3959. this.before = options.before;
  3960. } else {
  3961. this.deep = this.user = this.lazy = this.sync = false;
  3962. }
  3963. this.cb = cb;
  3964. this.id = ++uid$2; // uid for batching
  3965. this.active = true;
  3966. this.dirty = this.lazy; // for lazy watchers
  3967. this.deps = [];
  3968. this.newDeps = [];
  3969. this.depIds = new _Set();
  3970. this.newDepIds = new _Set();
  3971. this.expression = expOrFn.toString();
  3972. // parse expression for getter
  3973. if (typeof expOrFn === 'function') {
  3974. this.getter = expOrFn;
  3975. } else {
  3976. this.getter = parsePath(expOrFn);
  3977. if (!this.getter) {
  3978. this.getter = noop;
  3979. warn(
  3980. "Failed watching path: \"" + expOrFn + "\" " +
  3981. 'Watcher only accepts simple dot-delimited paths. ' +
  3982. 'For full control, use a function instead.',
  3983. vm
  3984. );
  3985. }
  3986. }
  3987. this.value = this.lazy
  3988. ? undefined
  3989. : this.get();
  3990. };
  3991. /**
  3992. * Evaluate the getter, and re-collect dependencies.
  3993. */
  3994. Watcher.prototype.get = function get () {
  3995. pushTarget(this);
  3996. var value;
  3997. var vm = this.vm;
  3998. try {
  3999. value = this.getter.call(vm, vm);
  4000. } catch (e) {
  4001. if (this.user) {
  4002. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  4003. } else {
  4004. throw e
  4005. }
  4006. } finally {
  4007. // "touch" every property so they are all tracked as
  4008. // dependencies for deep watching
  4009. if (this.deep) {
  4010. traverse(value);
  4011. }
  4012. popTarget();
  4013. this.cleanupDeps();
  4014. }
  4015. return value
  4016. };
  4017. /**
  4018. * Add a dependency to this directive.
  4019. */
  4020. Watcher.prototype.addDep = function addDep (dep) {
  4021. var id = dep.id;
  4022. if (!this.newDepIds.has(id)) {
  4023. this.newDepIds.add(id);
  4024. this.newDeps.push(dep);
  4025. if (!this.depIds.has(id)) {
  4026. dep.addSub(this);
  4027. }
  4028. }
  4029. };
  4030. /**
  4031. * Clean up for dependency collection.
  4032. */
  4033. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  4034. var i = this.deps.length;
  4035. while (i--) {
  4036. var dep = this.deps[i];
  4037. if (!this.newDepIds.has(dep.id)) {
  4038. dep.removeSub(this);
  4039. }
  4040. }
  4041. var tmp = this.depIds;
  4042. this.depIds = this.newDepIds;
  4043. this.newDepIds = tmp;
  4044. this.newDepIds.clear();
  4045. tmp = this.deps;
  4046. this.deps = this.newDeps;
  4047. this.newDeps = tmp;
  4048. this.newDeps.length = 0;
  4049. };
  4050. /**
  4051. * Subscriber interface.
  4052. * Will be called when a dependency changes.
  4053. */
  4054. Watcher.prototype.update = function update () {
  4055. /* istanbul ignore else */
  4056. if (this.lazy) {
  4057. this.dirty = true;
  4058. } else if (this.sync) {
  4059. this.run();
  4060. } else {
  4061. queueWatcher(this);
  4062. }
  4063. };
  4064. /**
  4065. * Scheduler job interface.
  4066. * Will be called by the scheduler.
  4067. */
  4068. Watcher.prototype.run = function run () {
  4069. if (this.active) {
  4070. var value = this.get();
  4071. if (
  4072. value !== this.value ||
  4073. // Deep watchers and watchers on Object/Arrays should fire even
  4074. // when the value is the same, because the value may
  4075. // have mutated.
  4076. isObject(value) ||
  4077. this.deep
  4078. ) {
  4079. // set new value
  4080. var oldValue = this.value;
  4081. this.value = value;
  4082. if (this.user) {
  4083. try {
  4084. this.cb.call(this.vm, value, oldValue);
  4085. } catch (e) {
  4086. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  4087. }
  4088. } else {
  4089. this.cb.call(this.vm, value, oldValue);
  4090. }
  4091. }
  4092. }
  4093. };
  4094. /**
  4095. * Evaluate the value of the watcher.
  4096. * This only gets called for lazy watchers.
  4097. */
  4098. Watcher.prototype.evaluate = function evaluate () {
  4099. this.value = this.get();
  4100. this.dirty = false;
  4101. };
  4102. /**
  4103. * Depend on all deps collected by this watcher.
  4104. */
  4105. Watcher.prototype.depend = function depend () {
  4106. var i = this.deps.length;
  4107. while (i--) {
  4108. this.deps[i].depend();
  4109. }
  4110. };
  4111. /**
  4112. * Remove self from all dependencies' subscriber list.
  4113. */
  4114. Watcher.prototype.teardown = function teardown () {
  4115. if (this.active) {
  4116. // remove self from vm's watcher list
  4117. // this is a somewhat expensive operation so we skip it
  4118. // if the vm is being destroyed.
  4119. if (!this.vm._isBeingDestroyed) {
  4120. remove(this.vm._watchers, this);
  4121. }
  4122. var i = this.deps.length;
  4123. while (i--) {
  4124. this.deps[i].removeSub(this);
  4125. }
  4126. this.active = false;
  4127. }
  4128. };
  4129. /* */
  4130. var sharedPropertyDefinition = {
  4131. enumerable: true,
  4132. configurable: true,
  4133. get: noop,
  4134. set: noop
  4135. };
  4136. function proxy (target, sourceKey, key) {
  4137. sharedPropertyDefinition.get = function proxyGetter () {
  4138. return this[sourceKey][key]
  4139. };
  4140. sharedPropertyDefinition.set = function proxySetter (val) {
  4141. this[sourceKey][key] = val;
  4142. };
  4143. Object.defineProperty(target, key, sharedPropertyDefinition);
  4144. }
  4145. function initState (vm) {
  4146. vm._watchers = [];
  4147. var opts = vm.$options;
  4148. if (opts.props) { initProps(vm, opts.props); }
  4149. if (opts.methods) { initMethods(vm, opts.methods); }
  4150. if (opts.data) {
  4151. initData(vm);
  4152. } else {
  4153. observe(vm._data = {}, true /* asRootData */);
  4154. }
  4155. if (opts.computed) { initComputed(vm, opts.computed); }
  4156. if (opts.watch && opts.watch !== nativeWatch) {
  4157. initWatch(vm, opts.watch);
  4158. }
  4159. }
  4160. function initProps (vm, propsOptions) {
  4161. var propsData = vm.$options.propsData || {};
  4162. var props = vm._props = {};
  4163. // cache prop keys so that future props updates can iterate using Array
  4164. // instead of dynamic object key enumeration.
  4165. var keys = vm.$options._propKeys = [];
  4166. var isRoot = !vm.$parent;
  4167. // root instance props should be converted
  4168. if (!isRoot) {
  4169. toggleObserving(false);
  4170. }
  4171. var loop = function ( key ) {
  4172. keys.push(key);
  4173. var value = validateProp(key, propsOptions, propsData, vm);
  4174. /* istanbul ignore else */
  4175. {
  4176. var hyphenatedKey = hyphenate(key);
  4177. if (isReservedAttribute(hyphenatedKey) ||
  4178. config.isReservedAttr(hyphenatedKey)) {
  4179. warn(
  4180. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  4181. vm
  4182. );
  4183. }
  4184. defineReactive$$1(props, key, value, function () {
  4185. if (!isRoot && !isUpdatingChildComponent) {
  4186. warn(
  4187. "Avoid mutating a prop directly since the value will be " +
  4188. "overwritten whenever the parent component re-renders. " +
  4189. "Instead, use a data or computed property based on the prop's " +
  4190. "value. Prop being mutated: \"" + key + "\"",
  4191. vm
  4192. );
  4193. }
  4194. });
  4195. }
  4196. // static props are already proxied on the component's prototype
  4197. // during Vue.extend(). We only need to proxy props defined at
  4198. // instantiation here.
  4199. if (!(key in vm)) {
  4200. proxy(vm, "_props", key);
  4201. }
  4202. };
  4203. for (var key in propsOptions) loop( key );
  4204. toggleObserving(true);
  4205. }
  4206. function initData (vm) {
  4207. var data = vm.$options.data;
  4208. data = vm._data = typeof data === 'function'
  4209. ? getData(data, vm)
  4210. : data || {};
  4211. if (!isPlainObject(data)) {
  4212. data = {};
  4213. warn(
  4214. 'data functions should return an object:\n' +
  4215. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  4216. vm
  4217. );
  4218. }
  4219. // proxy data on instance
  4220. var keys = Object.keys(data);
  4221. var props = vm.$options.props;
  4222. var methods = vm.$options.methods;
  4223. var i = keys.length;
  4224. while (i--) {
  4225. var key = keys[i];
  4226. {
  4227. if (methods && hasOwn(methods, key)) {
  4228. warn(
  4229. ("Method \"" + key + "\" has already been defined as a data property."),
  4230. vm
  4231. );
  4232. }
  4233. }
  4234. if (props && hasOwn(props, key)) {
  4235. warn(
  4236. "The data property \"" + key + "\" is already declared as a prop. " +
  4237. "Use prop default value instead.",
  4238. vm
  4239. );
  4240. } else if (!isReserved(key)) {
  4241. proxy(vm, "_data", key);
  4242. }
  4243. }
  4244. // observe data
  4245. observe(data, true /* asRootData */);
  4246. }
  4247. function getData (data, vm) {
  4248. // #7573 disable dep collection when invoking data getters
  4249. pushTarget();
  4250. try {
  4251. return data.call(vm, vm)
  4252. } catch (e) {
  4253. handleError(e, vm, "data()");
  4254. return {}
  4255. } finally {
  4256. popTarget();
  4257. }
  4258. }
  4259. var computedWatcherOptions = { lazy: true };
  4260. function initComputed (vm, computed) {
  4261. // $flow-disable-line
  4262. var watchers = vm._computedWatchers = Object.create(null);
  4263. // computed properties are just getters during SSR
  4264. var isSSR = isServerRendering();
  4265. for (var key in computed) {
  4266. var userDef = computed[key];
  4267. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  4268. if (getter == null) {
  4269. warn(
  4270. ("Getter is missing for computed property \"" + key + "\"."),
  4271. vm
  4272. );
  4273. }
  4274. if (!isSSR) {
  4275. // create internal watcher for the computed property.
  4276. watchers[key] = new Watcher(
  4277. vm,
  4278. getter || noop,
  4279. noop,
  4280. computedWatcherOptions
  4281. );
  4282. }
  4283. // component-defined computed properties are already defined on the
  4284. // component prototype. We only need to define computed properties defined
  4285. // at instantiation here.
  4286. if (!(key in vm)) {
  4287. defineComputed(vm, key, userDef);
  4288. } else {
  4289. if (key in vm.$data) {
  4290. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  4291. } else if (vm.$options.props && key in vm.$options.props) {
  4292. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  4293. }
  4294. }
  4295. }
  4296. }
  4297. function defineComputed (
  4298. target,
  4299. key,
  4300. userDef
  4301. ) {
  4302. var shouldCache = !isServerRendering();
  4303. if (typeof userDef === 'function') {
  4304. sharedPropertyDefinition.get = shouldCache
  4305. ? createComputedGetter(key)
  4306. : createGetterInvoker(userDef);
  4307. sharedPropertyDefinition.set = noop;
  4308. } else {
  4309. sharedPropertyDefinition.get = userDef.get
  4310. ? shouldCache && userDef.cache !== false
  4311. ? createComputedGetter(key)
  4312. : createGetterInvoker(userDef.get)
  4313. : noop;
  4314. sharedPropertyDefinition.set = userDef.set || noop;
  4315. }
  4316. if (sharedPropertyDefinition.set === noop) {
  4317. sharedPropertyDefinition.set = function () {
  4318. warn(
  4319. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  4320. this
  4321. );
  4322. };
  4323. }
  4324. Object.defineProperty(target, key, sharedPropertyDefinition);
  4325. }
  4326. function createComputedGetter (key) {
  4327. return function computedGetter () {
  4328. var watcher = this._computedWatchers && this._computedWatchers[key];
  4329. if (watcher) {
  4330. if (watcher.dirty) {
  4331. watcher.evaluate();
  4332. }
  4333. if (Dep.target) {
  4334. watcher.depend();
  4335. }
  4336. return watcher.value
  4337. }
  4338. }
  4339. }
  4340. function createGetterInvoker(fn) {
  4341. return function computedGetter () {
  4342. return fn.call(this, this)
  4343. }
  4344. }
  4345. function initMethods (vm, methods) {
  4346. var props = vm.$options.props;
  4347. for (var key in methods) {
  4348. {
  4349. if (typeof methods[key] !== 'function') {
  4350. warn(
  4351. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  4352. "Did you reference the function correctly?",
  4353. vm
  4354. );
  4355. }
  4356. if (props && hasOwn(props, key)) {
  4357. warn(
  4358. ("Method \"" + key + "\" has already been defined as a prop."),
  4359. vm
  4360. );
  4361. }
  4362. if ((key in vm) && isReserved(key)) {
  4363. warn(
  4364. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  4365. "Avoid defining component methods that start with _ or $."
  4366. );
  4367. }
  4368. }
  4369. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  4370. }
  4371. }
  4372. function initWatch (vm, watch) {
  4373. for (var key in watch) {
  4374. var handler = watch[key];
  4375. if (Array.isArray(handler)) {
  4376. for (var i = 0; i < handler.length; i++) {
  4377. createWatcher(vm, key, handler[i]);
  4378. }
  4379. } else {
  4380. createWatcher(vm, key, handler);
  4381. }
  4382. }
  4383. }
  4384. function createWatcher (
  4385. vm,
  4386. expOrFn,
  4387. handler,
  4388. options
  4389. ) {
  4390. if (isPlainObject(handler)) {
  4391. options = handler;
  4392. handler = handler.handler;
  4393. }
  4394. if (typeof handler === 'string') {
  4395. handler = vm[handler];
  4396. }
  4397. return vm.$watch(expOrFn, handler, options)
  4398. }
  4399. function stateMixin (Vue) {
  4400. // flow somehow has problems with directly declared definition object
  4401. // when using Object.defineProperty, so we have to procedurally build up
  4402. // the object here.
  4403. var dataDef = {};
  4404. dataDef.get = function () { return this._data };
  4405. var propsDef = {};
  4406. propsDef.get = function () { return this._props };
  4407. {
  4408. dataDef.set = function () {
  4409. warn(
  4410. 'Avoid replacing instance root $data. ' +
  4411. 'Use nested data properties instead.',
  4412. this
  4413. );
  4414. };
  4415. propsDef.set = function () {
  4416. warn("$props is readonly.", this);
  4417. };
  4418. }
  4419. Object.defineProperty(Vue.prototype, '$data', dataDef);
  4420. Object.defineProperty(Vue.prototype, '$props', propsDef);
  4421. Vue.prototype.$set = set;
  4422. Vue.prototype.$delete = del;
  4423. Vue.prototype.$watch = function (
  4424. expOrFn,
  4425. cb,
  4426. options
  4427. ) {
  4428. var vm = this;
  4429. if (isPlainObject(cb)) {
  4430. return createWatcher(vm, expOrFn, cb, options)
  4431. }
  4432. options = options || {};
  4433. options.user = true;
  4434. var watcher = new Watcher(vm, expOrFn, cb, options);
  4435. if (options.immediate) {
  4436. try {
  4437. cb.call(vm, watcher.value);
  4438. } catch (error) {
  4439. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  4440. }
  4441. }
  4442. return function unwatchFn () {
  4443. watcher.teardown();
  4444. }
  4445. };
  4446. }
  4447. /* */
  4448. var uid$3 = 0;
  4449. function initMixin (Vue) {
  4450. Vue.prototype._init = function (options) {
  4451. var vm = this;
  4452. // a uid
  4453. vm._uid = uid$3++;
  4454. var startTag, endTag;
  4455. /* istanbul ignore if */
  4456. if (config.performance && mark) {
  4457. startTag = "vue-perf-start:" + (vm._uid);
  4458. endTag = "vue-perf-end:" + (vm._uid);
  4459. mark(startTag);
  4460. }
  4461. // a flag to avoid this being observed
  4462. vm._isVue = true;
  4463. // merge options
  4464. if (options && options._isComponent) {
  4465. // optimize internal component instantiation
  4466. // since dynamic options merging is pretty slow, and none of the
  4467. // internal component options needs special treatment.
  4468. initInternalComponent(vm, options);
  4469. } else {
  4470. vm.$options = mergeOptions(
  4471. resolveConstructorOptions(vm.constructor),
  4472. options || {},
  4473. vm
  4474. );
  4475. }
  4476. /* istanbul ignore else */
  4477. {
  4478. initProxy(vm);
  4479. }
  4480. // expose real self
  4481. vm._self = vm;
  4482. initLifecycle(vm);
  4483. initEvents(vm);
  4484. initRender(vm);
  4485. callHook(vm, 'beforeCreate');
  4486. initInjections(vm); // resolve injections before data/props
  4487. initState(vm);
  4488. initProvide(vm); // resolve provide after data/props
  4489. callHook(vm, 'created');
  4490. /* istanbul ignore if */
  4491. if (config.performance && mark) {
  4492. vm._name = formatComponentName(vm, false);
  4493. mark(endTag);
  4494. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  4495. }
  4496. if (vm.$options.el) {
  4497. vm.$mount(vm.$options.el);
  4498. }
  4499. };
  4500. }
  4501. function initInternalComponent (vm, options) {
  4502. var opts = vm.$options = Object.create(vm.constructor.options);
  4503. // doing this because it's faster than dynamic enumeration.
  4504. var parentVnode = options._parentVnode;
  4505. opts.parent = options.parent;
  4506. opts._parentVnode = parentVnode;
  4507. var vnodeComponentOptions = parentVnode.componentOptions;
  4508. opts.propsData = vnodeComponentOptions.propsData;
  4509. opts._parentListeners = vnodeComponentOptions.listeners;
  4510. opts._renderChildren = vnodeComponentOptions.children;
  4511. opts._componentTag = vnodeComponentOptions.tag;
  4512. if (options.render) {
  4513. opts.render = options.render;
  4514. opts.staticRenderFns = options.staticRenderFns;
  4515. }
  4516. }
  4517. function resolveConstructorOptions (Ctor) {
  4518. var options = Ctor.options;
  4519. if (Ctor.super) {
  4520. var superOptions = resolveConstructorOptions(Ctor.super);
  4521. var cachedSuperOptions = Ctor.superOptions;
  4522. if (superOptions !== cachedSuperOptions) {
  4523. // super option changed,
  4524. // need to resolve new options.
  4525. Ctor.superOptions = superOptions;
  4526. // check if there are any late-modified/attached options (#4976)
  4527. var modifiedOptions = resolveModifiedOptions(Ctor);
  4528. // update base extend options
  4529. if (modifiedOptions) {
  4530. extend(Ctor.extendOptions, modifiedOptions);
  4531. }
  4532. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4533. if (options.name) {
  4534. options.components[options.name] = Ctor;
  4535. }
  4536. }
  4537. }
  4538. return options
  4539. }
  4540. function resolveModifiedOptions (Ctor) {
  4541. var modified;
  4542. var latest = Ctor.options;
  4543. var sealed = Ctor.sealedOptions;
  4544. for (var key in latest) {
  4545. if (latest[key] !== sealed[key]) {
  4546. if (!modified) { modified = {}; }
  4547. modified[key] = latest[key];
  4548. }
  4549. }
  4550. return modified
  4551. }
  4552. function Vue (options) {
  4553. if (!(this instanceof Vue)
  4554. ) {
  4555. warn('Vue is a constructor and should be called with the `new` keyword');
  4556. }
  4557. this._init(options);
  4558. }
  4559. initMixin(Vue);
  4560. stateMixin(Vue);
  4561. eventsMixin(Vue);
  4562. lifecycleMixin(Vue);
  4563. renderMixin(Vue);
  4564. /* */
  4565. function initUse (Vue) {
  4566. Vue.use = function (plugin) {
  4567. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  4568. if (installedPlugins.indexOf(plugin) > -1) {
  4569. return this
  4570. }
  4571. // additional parameters
  4572. var args = toArray(arguments, 1);
  4573. args.unshift(this);
  4574. if (typeof plugin.install === 'function') {
  4575. plugin.install.apply(plugin, args);
  4576. } else if (typeof plugin === 'function') {
  4577. plugin.apply(null, args);
  4578. }
  4579. installedPlugins.push(plugin);
  4580. return this
  4581. };
  4582. }
  4583. /* */
  4584. function initMixin$1 (Vue) {
  4585. Vue.mixin = function (mixin) {
  4586. this.options = mergeOptions(this.options, mixin);
  4587. return this
  4588. };
  4589. }
  4590. /* */
  4591. function initExtend (Vue) {
  4592. /**
  4593. * Each instance constructor, including Vue, has a unique
  4594. * cid. This enables us to create wrapped "child
  4595. * constructors" for prototypal inheritance and cache them.
  4596. */
  4597. Vue.cid = 0;
  4598. var cid = 1;
  4599. /**
  4600. * Class inheritance
  4601. */
  4602. Vue.extend = function (extendOptions) {
  4603. extendOptions = extendOptions || {};
  4604. var Super = this;
  4605. var SuperId = Super.cid;
  4606. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  4607. if (cachedCtors[SuperId]) {
  4608. return cachedCtors[SuperId]
  4609. }
  4610. var name = extendOptions.name || Super.options.name;
  4611. if (name) {
  4612. validateComponentName(name);
  4613. }
  4614. var Sub = function VueComponent (options) {
  4615. this._init(options);
  4616. };
  4617. Sub.prototype = Object.create(Super.prototype);
  4618. Sub.prototype.constructor = Sub;
  4619. Sub.cid = cid++;
  4620. Sub.options = mergeOptions(
  4621. Super.options,
  4622. extendOptions
  4623. );
  4624. Sub['super'] = Super;
  4625. // For props and computed properties, we define the proxy getters on
  4626. // the Vue instances at extension time, on the extended prototype. This
  4627. // avoids Object.defineProperty calls for each instance created.
  4628. if (Sub.options.props) {
  4629. initProps$1(Sub);
  4630. }
  4631. if (Sub.options.computed) {
  4632. initComputed$1(Sub);
  4633. }
  4634. // allow further extension/mixin/plugin usage
  4635. Sub.extend = Super.extend;
  4636. Sub.mixin = Super.mixin;
  4637. Sub.use = Super.use;
  4638. // create asset registers, so extended classes
  4639. // can have their private assets too.
  4640. ASSET_TYPES.forEach(function (type) {
  4641. Sub[type] = Super[type];
  4642. });
  4643. // enable recursive self-lookup
  4644. if (name) {
  4645. Sub.options.components[name] = Sub;
  4646. }
  4647. // keep a reference to the super options at extension time.
  4648. // later at instantiation we can check if Super's options have
  4649. // been updated.
  4650. Sub.superOptions = Super.options;
  4651. Sub.extendOptions = extendOptions;
  4652. Sub.sealedOptions = extend({}, Sub.options);
  4653. // cache constructor
  4654. cachedCtors[SuperId] = Sub;
  4655. return Sub
  4656. };
  4657. }
  4658. function initProps$1 (Comp) {
  4659. var props = Comp.options.props;
  4660. for (var key in props) {
  4661. proxy(Comp.prototype, "_props", key);
  4662. }
  4663. }
  4664. function initComputed$1 (Comp) {
  4665. var computed = Comp.options.computed;
  4666. for (var key in computed) {
  4667. defineComputed(Comp.prototype, key, computed[key]);
  4668. }
  4669. }
  4670. /* */
  4671. function initAssetRegisters (Vue) {
  4672. /**
  4673. * Create asset registration methods.
  4674. */
  4675. ASSET_TYPES.forEach(function (type) {
  4676. Vue[type] = function (
  4677. id,
  4678. definition
  4679. ) {
  4680. if (!definition) {
  4681. return this.options[type + 's'][id]
  4682. } else {
  4683. /* istanbul ignore if */
  4684. if (type === 'component') {
  4685. validateComponentName(id);
  4686. }
  4687. if (type === 'component' && isPlainObject(definition)) {
  4688. definition.name = definition.name || id;
  4689. definition = this.options._base.extend(definition);
  4690. }
  4691. if (type === 'directive' && typeof definition === 'function') {
  4692. definition = { bind: definition, update: definition };
  4693. }
  4694. this.options[type + 's'][id] = definition;
  4695. return definition
  4696. }
  4697. };
  4698. });
  4699. }
  4700. /* */
  4701. function getComponentName (opts) {
  4702. return opts && (opts.Ctor.options.name || opts.tag)
  4703. }
  4704. function matches (pattern, name) {
  4705. if (Array.isArray(pattern)) {
  4706. return pattern.indexOf(name) > -1
  4707. } else if (typeof pattern === 'string') {
  4708. return pattern.split(',').indexOf(name) > -1
  4709. } else if (isRegExp(pattern)) {
  4710. return pattern.test(name)
  4711. }
  4712. /* istanbul ignore next */
  4713. return false
  4714. }
  4715. function pruneCache (keepAliveInstance, filter) {
  4716. var cache = keepAliveInstance.cache;
  4717. var keys = keepAliveInstance.keys;
  4718. var _vnode = keepAliveInstance._vnode;
  4719. for (var key in cache) {
  4720. var cachedNode = cache[key];
  4721. if (cachedNode) {
  4722. var name = getComponentName(cachedNode.componentOptions);
  4723. if (name && !filter(name)) {
  4724. pruneCacheEntry(cache, key, keys, _vnode);
  4725. }
  4726. }
  4727. }
  4728. }
  4729. function pruneCacheEntry (
  4730. cache,
  4731. key,
  4732. keys,
  4733. current
  4734. ) {
  4735. var cached$$1 = cache[key];
  4736. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  4737. cached$$1.componentInstance.$destroy();
  4738. }
  4739. cache[key] = null;
  4740. remove(keys, key);
  4741. }
  4742. var patternTypes = [String, RegExp, Array];
  4743. var KeepAlive = {
  4744. name: 'keep-alive',
  4745. abstract: true,
  4746. props: {
  4747. include: patternTypes,
  4748. exclude: patternTypes,
  4749. max: [String, Number]
  4750. },
  4751. created: function created () {
  4752. this.cache = Object.create(null);
  4753. this.keys = [];
  4754. },
  4755. destroyed: function destroyed () {
  4756. for (var key in this.cache) {
  4757. pruneCacheEntry(this.cache, key, this.keys);
  4758. }
  4759. },
  4760. mounted: function mounted () {
  4761. var this$1 = this;
  4762. this.$watch('include', function (val) {
  4763. pruneCache(this$1, function (name) { return matches(val, name); });
  4764. });
  4765. this.$watch('exclude', function (val) {
  4766. pruneCache(this$1, function (name) { return !matches(val, name); });
  4767. });
  4768. },
  4769. render: function render () {
  4770. var slot = this.$slots.default;
  4771. var vnode = getFirstComponentChild(slot);
  4772. var componentOptions = vnode && vnode.componentOptions;
  4773. if (componentOptions) {
  4774. // check pattern
  4775. var name = getComponentName(componentOptions);
  4776. var ref = this;
  4777. var include = ref.include;
  4778. var exclude = ref.exclude;
  4779. if (
  4780. // not included
  4781. (include && (!name || !matches(include, name))) ||
  4782. // excluded
  4783. (exclude && name && matches(exclude, name))
  4784. ) {
  4785. return vnode
  4786. }
  4787. var ref$1 = this;
  4788. var cache = ref$1.cache;
  4789. var keys = ref$1.keys;
  4790. var key = vnode.key == null
  4791. // same constructor may get registered as different local components
  4792. // so cid alone is not enough (#3269)
  4793. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  4794. : vnode.key;
  4795. if (cache[key]) {
  4796. vnode.componentInstance = cache[key].componentInstance;
  4797. // make current key freshest
  4798. remove(keys, key);
  4799. keys.push(key);
  4800. } else {
  4801. cache[key] = vnode;
  4802. keys.push(key);
  4803. // prune oldest entry
  4804. if (this.max && keys.length > parseInt(this.max)) {
  4805. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  4806. }
  4807. }
  4808. vnode.data.keepAlive = true;
  4809. }
  4810. return vnode || (slot && slot[0])
  4811. }
  4812. };
  4813. var builtInComponents = {
  4814. KeepAlive: KeepAlive
  4815. };
  4816. /* */
  4817. function initGlobalAPI (Vue) {
  4818. // config
  4819. var configDef = {};
  4820. configDef.get = function () { return config; };
  4821. {
  4822. configDef.set = function () {
  4823. warn(
  4824. 'Do not replace the Vue.config object, set individual fields instead.'
  4825. );
  4826. };
  4827. }
  4828. Object.defineProperty(Vue, 'config', configDef);
  4829. // exposed util methods.
  4830. // NOTE: these are not considered part of the public API - avoid relying on
  4831. // them unless you are aware of the risk.
  4832. Vue.util = {
  4833. warn: warn,
  4834. extend: extend,
  4835. mergeOptions: mergeOptions,
  4836. defineReactive: defineReactive$$1
  4837. };
  4838. Vue.set = set;
  4839. Vue.delete = del;
  4840. Vue.nextTick = nextTick;
  4841. // 2.6 explicit observable API
  4842. Vue.observable = function (obj) {
  4843. observe(obj);
  4844. return obj
  4845. };
  4846. Vue.options = Object.create(null);
  4847. ASSET_TYPES.forEach(function (type) {
  4848. Vue.options[type + 's'] = Object.create(null);
  4849. });
  4850. // this is used to identify the "base" constructor to extend all plain-object
  4851. // components with in Weex's multi-instance scenarios.
  4852. Vue.options._base = Vue;
  4853. extend(Vue.options.components, builtInComponents);
  4854. initUse(Vue);
  4855. initMixin$1(Vue);
  4856. initExtend(Vue);
  4857. initAssetRegisters(Vue);
  4858. }
  4859. initGlobalAPI(Vue);
  4860. Object.defineProperty(Vue.prototype, '$isServer', {
  4861. get: isServerRendering
  4862. });
  4863. Object.defineProperty(Vue.prototype, '$ssrContext', {
  4864. get: function get () {
  4865. /* istanbul ignore next */
  4866. return this.$vnode && this.$vnode.ssrContext
  4867. }
  4868. });
  4869. // expose FunctionalRenderContext for ssr runtime helper installation
  4870. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  4871. value: FunctionalRenderContext
  4872. });
  4873. Vue.version = '2.6.6';
  4874. /* */
  4875. // these are reserved for web because they are directly compiled away
  4876. // during template compilation
  4877. var isReservedAttr = makeMap('style,class');
  4878. // attributes that should be using props for binding
  4879. var acceptValue = makeMap('input,textarea,option,select,progress');
  4880. var mustUseProp = function (tag, type, attr) {
  4881. return (
  4882. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  4883. (attr === 'selected' && tag === 'option') ||
  4884. (attr === 'checked' && tag === 'input') ||
  4885. (attr === 'muted' && tag === 'video')
  4886. )
  4887. };
  4888. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  4889. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  4890. var convertEnumeratedValue = function (key, value) {
  4891. return isFalsyAttrValue(value) || value === 'false'
  4892. ? 'false'
  4893. // allow arbitrary string value for contenteditable
  4894. : key === 'contenteditable' && isValidContentEditableValue(value)
  4895. ? value
  4896. : 'true'
  4897. };
  4898. var isBooleanAttr = makeMap(
  4899. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  4900. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  4901. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  4902. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  4903. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  4904. 'truespeed,typemustmatch,visible'
  4905. );
  4906. var xlinkNS = 'http://www.w3.org/1999/xlink';
  4907. var isXlink = function (name) {
  4908. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  4909. };
  4910. var getXlinkProp = function (name) {
  4911. return isXlink(name) ? name.slice(6, name.length) : ''
  4912. };
  4913. var isFalsyAttrValue = function (val) {
  4914. return val == null || val === false
  4915. };
  4916. /* */
  4917. function genClassForVnode (vnode) {
  4918. var data = vnode.data;
  4919. var parentNode = vnode;
  4920. var childNode = vnode;
  4921. while (isDef(childNode.componentInstance)) {
  4922. childNode = childNode.componentInstance._vnode;
  4923. if (childNode && childNode.data) {
  4924. data = mergeClassData(childNode.data, data);
  4925. }
  4926. }
  4927. while (isDef(parentNode = parentNode.parent)) {
  4928. if (parentNode && parentNode.data) {
  4929. data = mergeClassData(data, parentNode.data);
  4930. }
  4931. }
  4932. return renderClass(data.staticClass, data.class)
  4933. }
  4934. function mergeClassData (child, parent) {
  4935. return {
  4936. staticClass: concat(child.staticClass, parent.staticClass),
  4937. class: isDef(child.class)
  4938. ? [child.class, parent.class]
  4939. : parent.class
  4940. }
  4941. }
  4942. function renderClass (
  4943. staticClass,
  4944. dynamicClass
  4945. ) {
  4946. if (isDef(staticClass) || isDef(dynamicClass)) {
  4947. return concat(staticClass, stringifyClass(dynamicClass))
  4948. }
  4949. /* istanbul ignore next */
  4950. return ''
  4951. }
  4952. function concat (a, b) {
  4953. return a ? b ? (a + ' ' + b) : a : (b || '')
  4954. }
  4955. function stringifyClass (value) {
  4956. if (Array.isArray(value)) {
  4957. return stringifyArray(value)
  4958. }
  4959. if (isObject(value)) {
  4960. return stringifyObject(value)
  4961. }
  4962. if (typeof value === 'string') {
  4963. return value
  4964. }
  4965. /* istanbul ignore next */
  4966. return ''
  4967. }
  4968. function stringifyArray (value) {
  4969. var res = '';
  4970. var stringified;
  4971. for (var i = 0, l = value.length; i < l; i++) {
  4972. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  4973. if (res) { res += ' '; }
  4974. res += stringified;
  4975. }
  4976. }
  4977. return res
  4978. }
  4979. function stringifyObject (value) {
  4980. var res = '';
  4981. for (var key in value) {
  4982. if (value[key]) {
  4983. if (res) { res += ' '; }
  4984. res += key;
  4985. }
  4986. }
  4987. return res
  4988. }
  4989. /* */
  4990. var namespaceMap = {
  4991. svg: 'http://www.w3.org/2000/svg',
  4992. math: 'http://www.w3.org/1998/Math/MathML'
  4993. };
  4994. var isHTMLTag = makeMap(
  4995. 'html,body,base,head,link,meta,style,title,' +
  4996. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  4997. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  4998. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  4999. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  5000. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  5001. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  5002. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  5003. 'output,progress,select,textarea,' +
  5004. 'details,dialog,menu,menuitem,summary,' +
  5005. 'content,element,shadow,template,blockquote,iframe,tfoot'
  5006. );
  5007. // this map is intentionally selective, only covering SVG elements that may
  5008. // contain child elements.
  5009. var isSVG = makeMap(
  5010. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  5011. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  5012. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  5013. true
  5014. );
  5015. var isPreTag = function (tag) { return tag === 'pre'; };
  5016. var isReservedTag = function (tag) {
  5017. return isHTMLTag(tag) || isSVG(tag)
  5018. };
  5019. function getTagNamespace (tag) {
  5020. if (isSVG(tag)) {
  5021. return 'svg'
  5022. }
  5023. // basic support for MathML
  5024. // note it doesn't support other MathML elements being component roots
  5025. if (tag === 'math') {
  5026. return 'math'
  5027. }
  5028. }
  5029. var unknownElementCache = Object.create(null);
  5030. function isUnknownElement (tag) {
  5031. /* istanbul ignore if */
  5032. if (!inBrowser) {
  5033. return true
  5034. }
  5035. if (isReservedTag(tag)) {
  5036. return false
  5037. }
  5038. tag = tag.toLowerCase();
  5039. /* istanbul ignore if */
  5040. if (unknownElementCache[tag] != null) {
  5041. return unknownElementCache[tag]
  5042. }
  5043. var el = document.createElement(tag);
  5044. if (tag.indexOf('-') > -1) {
  5045. // http://stackoverflow.com/a/28210364/1070244
  5046. return (unknownElementCache[tag] = (
  5047. el.constructor === window.HTMLUnknownElement ||
  5048. el.constructor === window.HTMLElement
  5049. ))
  5050. } else {
  5051. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  5052. }
  5053. }
  5054. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  5055. /* */
  5056. /**
  5057. * Query an element selector if it's not an element already.
  5058. */
  5059. function query (el) {
  5060. if (typeof el === 'string') {
  5061. var selected = document.querySelector(el);
  5062. if (!selected) {
  5063. warn(
  5064. 'Cannot find element: ' + el
  5065. );
  5066. return document.createElement('div')
  5067. }
  5068. return selected
  5069. } else {
  5070. return el
  5071. }
  5072. }
  5073. /* */
  5074. function createElement$1 (tagName, vnode) {
  5075. var elm = document.createElement(tagName);
  5076. if (tagName !== 'select') {
  5077. return elm
  5078. }
  5079. // false or null will remove the attribute but undefined will not
  5080. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  5081. elm.setAttribute('multiple', 'multiple');
  5082. }
  5083. return elm
  5084. }
  5085. function createElementNS (namespace, tagName) {
  5086. return document.createElementNS(namespaceMap[namespace], tagName)
  5087. }
  5088. function createTextNode (text) {
  5089. return document.createTextNode(text)
  5090. }
  5091. function createComment (text) {
  5092. return document.createComment(text)
  5093. }
  5094. function insertBefore (parentNode, newNode, referenceNode) {
  5095. parentNode.insertBefore(newNode, referenceNode);
  5096. }
  5097. function removeChild (node, child) {
  5098. node.removeChild(child);
  5099. }
  5100. function appendChild (node, child) {
  5101. node.appendChild(child);
  5102. }
  5103. function parentNode (node) {
  5104. return node.parentNode
  5105. }
  5106. function nextSibling (node) {
  5107. return node.nextSibling
  5108. }
  5109. function tagName (node) {
  5110. return node.tagName
  5111. }
  5112. function setTextContent (node, text) {
  5113. node.textContent = text;
  5114. }
  5115. function setStyleScope (node, scopeId) {
  5116. node.setAttribute(scopeId, '');
  5117. }
  5118. var nodeOps = /*#__PURE__*/Object.freeze({
  5119. createElement: createElement$1,
  5120. createElementNS: createElementNS,
  5121. createTextNode: createTextNode,
  5122. createComment: createComment,
  5123. insertBefore: insertBefore,
  5124. removeChild: removeChild,
  5125. appendChild: appendChild,
  5126. parentNode: parentNode,
  5127. nextSibling: nextSibling,
  5128. tagName: tagName,
  5129. setTextContent: setTextContent,
  5130. setStyleScope: setStyleScope
  5131. });
  5132. /* */
  5133. var ref = {
  5134. create: function create (_, vnode) {
  5135. registerRef(vnode);
  5136. },
  5137. update: function update (oldVnode, vnode) {
  5138. if (oldVnode.data.ref !== vnode.data.ref) {
  5139. registerRef(oldVnode, true);
  5140. registerRef(vnode);
  5141. }
  5142. },
  5143. destroy: function destroy (vnode) {
  5144. registerRef(vnode, true);
  5145. }
  5146. };
  5147. function registerRef (vnode, isRemoval) {
  5148. var key = vnode.data.ref;
  5149. if (!isDef(key)) { return }
  5150. var vm = vnode.context;
  5151. var ref = vnode.componentInstance || vnode.elm;
  5152. var refs = vm.$refs;
  5153. if (isRemoval) {
  5154. if (Array.isArray(refs[key])) {
  5155. remove(refs[key], ref);
  5156. } else if (refs[key] === ref) {
  5157. refs[key] = undefined;
  5158. }
  5159. } else {
  5160. if (vnode.data.refInFor) {
  5161. if (!Array.isArray(refs[key])) {
  5162. refs[key] = [ref];
  5163. } else if (refs[key].indexOf(ref) < 0) {
  5164. // $flow-disable-line
  5165. refs[key].push(ref);
  5166. }
  5167. } else {
  5168. refs[key] = ref;
  5169. }
  5170. }
  5171. }
  5172. /**
  5173. * Virtual DOM patching algorithm based on Snabbdom by
  5174. * Simon Friis Vindum (@paldepind)
  5175. * Licensed under the MIT License
  5176. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  5177. *
  5178. * modified by Evan You (@yyx990803)
  5179. *
  5180. * Not type-checking this because this file is perf-critical and the cost
  5181. * of making flow understand it is not worth it.
  5182. */
  5183. var emptyNode = new VNode('', {}, []);
  5184. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  5185. function sameVnode (a, b) {
  5186. return (
  5187. a.key === b.key && (
  5188. (
  5189. a.tag === b.tag &&
  5190. a.isComment === b.isComment &&
  5191. isDef(a.data) === isDef(b.data) &&
  5192. sameInputType(a, b)
  5193. ) || (
  5194. isTrue(a.isAsyncPlaceholder) &&
  5195. a.asyncFactory === b.asyncFactory &&
  5196. isUndef(b.asyncFactory.error)
  5197. )
  5198. )
  5199. )
  5200. }
  5201. function sameInputType (a, b) {
  5202. if (a.tag !== 'input') { return true }
  5203. var i;
  5204. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  5205. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  5206. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  5207. }
  5208. function createKeyToOldIdx (children, beginIdx, endIdx) {
  5209. var i, key;
  5210. var map = {};
  5211. for (i = beginIdx; i <= endIdx; ++i) {
  5212. key = children[i].key;
  5213. if (isDef(key)) { map[key] = i; }
  5214. }
  5215. return map
  5216. }
  5217. function createPatchFunction (backend) {
  5218. var i, j;
  5219. var cbs = {};
  5220. var modules = backend.modules;
  5221. var nodeOps = backend.nodeOps;
  5222. for (i = 0; i < hooks.length; ++i) {
  5223. cbs[hooks[i]] = [];
  5224. for (j = 0; j < modules.length; ++j) {
  5225. if (isDef(modules[j][hooks[i]])) {
  5226. cbs[hooks[i]].push(modules[j][hooks[i]]);
  5227. }
  5228. }
  5229. }
  5230. function emptyNodeAt (elm) {
  5231. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  5232. }
  5233. function createRmCb (childElm, listeners) {
  5234. function remove$$1 () {
  5235. if (--remove$$1.listeners === 0) {
  5236. removeNode(childElm);
  5237. }
  5238. }
  5239. remove$$1.listeners = listeners;
  5240. return remove$$1
  5241. }
  5242. function removeNode (el) {
  5243. var parent = nodeOps.parentNode(el);
  5244. // element may have already been removed due to v-html / v-text
  5245. if (isDef(parent)) {
  5246. nodeOps.removeChild(parent, el);
  5247. }
  5248. }
  5249. function isUnknownElement$$1 (vnode, inVPre) {
  5250. return (
  5251. !inVPre &&
  5252. !vnode.ns &&
  5253. !(
  5254. config.ignoredElements.length &&
  5255. config.ignoredElements.some(function (ignore) {
  5256. return isRegExp(ignore)
  5257. ? ignore.test(vnode.tag)
  5258. : ignore === vnode.tag
  5259. })
  5260. ) &&
  5261. config.isUnknownElement(vnode.tag)
  5262. )
  5263. }
  5264. var creatingElmInVPre = 0;
  5265. function createElm (
  5266. vnode,
  5267. insertedVnodeQueue,
  5268. parentElm,
  5269. refElm,
  5270. nested,
  5271. ownerArray,
  5272. index
  5273. ) {
  5274. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5275. // This vnode was used in a previous render!
  5276. // now it's used as a new node, overwriting its elm would cause
  5277. // potential patch errors down the road when it's used as an insertion
  5278. // reference node. Instead, we clone the node on-demand before creating
  5279. // associated DOM element for it.
  5280. vnode = ownerArray[index] = cloneVNode(vnode);
  5281. }
  5282. vnode.isRootInsert = !nested; // for transition enter check
  5283. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  5284. return
  5285. }
  5286. var data = vnode.data;
  5287. var children = vnode.children;
  5288. var tag = vnode.tag;
  5289. if (isDef(tag)) {
  5290. {
  5291. if (data && data.pre) {
  5292. creatingElmInVPre++;
  5293. }
  5294. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  5295. warn(
  5296. 'Unknown custom element: <' + tag + '> - did you ' +
  5297. 'register the component correctly? For recursive components, ' +
  5298. 'make sure to provide the "name" option.',
  5299. vnode.context
  5300. );
  5301. }
  5302. }
  5303. vnode.elm = vnode.ns
  5304. ? nodeOps.createElementNS(vnode.ns, tag)
  5305. : nodeOps.createElement(tag, vnode);
  5306. setScope(vnode);
  5307. /* istanbul ignore if */
  5308. {
  5309. createChildren(vnode, children, insertedVnodeQueue);
  5310. if (isDef(data)) {
  5311. invokeCreateHooks(vnode, insertedVnodeQueue);
  5312. }
  5313. insert(parentElm, vnode.elm, refElm);
  5314. }
  5315. if (data && data.pre) {
  5316. creatingElmInVPre--;
  5317. }
  5318. } else if (isTrue(vnode.isComment)) {
  5319. vnode.elm = nodeOps.createComment(vnode.text);
  5320. insert(parentElm, vnode.elm, refElm);
  5321. } else {
  5322. vnode.elm = nodeOps.createTextNode(vnode.text);
  5323. insert(parentElm, vnode.elm, refElm);
  5324. }
  5325. }
  5326. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5327. var i = vnode.data;
  5328. if (isDef(i)) {
  5329. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  5330. if (isDef(i = i.hook) && isDef(i = i.init)) {
  5331. i(vnode, false /* hydrating */);
  5332. }
  5333. // after calling the init hook, if the vnode is a child component
  5334. // it should've created a child instance and mounted it. the child
  5335. // component also has set the placeholder vnode's elm.
  5336. // in that case we can just return the element and be done.
  5337. if (isDef(vnode.componentInstance)) {
  5338. initComponent(vnode, insertedVnodeQueue);
  5339. insert(parentElm, vnode.elm, refElm);
  5340. if (isTrue(isReactivated)) {
  5341. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  5342. }
  5343. return true
  5344. }
  5345. }
  5346. }
  5347. function initComponent (vnode, insertedVnodeQueue) {
  5348. if (isDef(vnode.data.pendingInsert)) {
  5349. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  5350. vnode.data.pendingInsert = null;
  5351. }
  5352. vnode.elm = vnode.componentInstance.$el;
  5353. if (isPatchable(vnode)) {
  5354. invokeCreateHooks(vnode, insertedVnodeQueue);
  5355. setScope(vnode);
  5356. } else {
  5357. // empty component root.
  5358. // skip all element-related modules except for ref (#3455)
  5359. registerRef(vnode);
  5360. // make sure to invoke the insert hook
  5361. insertedVnodeQueue.push(vnode);
  5362. }
  5363. }
  5364. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5365. var i;
  5366. // hack for #4339: a reactivated component with inner transition
  5367. // does not trigger because the inner node's created hooks are not called
  5368. // again. It's not ideal to involve module-specific logic in here but
  5369. // there doesn't seem to be a better way to do it.
  5370. var innerNode = vnode;
  5371. while (innerNode.componentInstance) {
  5372. innerNode = innerNode.componentInstance._vnode;
  5373. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  5374. for (i = 0; i < cbs.activate.length; ++i) {
  5375. cbs.activate[i](emptyNode, innerNode);
  5376. }
  5377. insertedVnodeQueue.push(innerNode);
  5378. break
  5379. }
  5380. }
  5381. // unlike a newly created component,
  5382. // a reactivated keep-alive component doesn't insert itself
  5383. insert(parentElm, vnode.elm, refElm);
  5384. }
  5385. function insert (parent, elm, ref$$1) {
  5386. if (isDef(parent)) {
  5387. if (isDef(ref$$1)) {
  5388. if (nodeOps.parentNode(ref$$1) === parent) {
  5389. nodeOps.insertBefore(parent, elm, ref$$1);
  5390. }
  5391. } else {
  5392. nodeOps.appendChild(parent, elm);
  5393. }
  5394. }
  5395. }
  5396. function createChildren (vnode, children, insertedVnodeQueue) {
  5397. if (Array.isArray(children)) {
  5398. {
  5399. checkDuplicateKeys(children);
  5400. }
  5401. for (var i = 0; i < children.length; ++i) {
  5402. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  5403. }
  5404. } else if (isPrimitive(vnode.text)) {
  5405. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  5406. }
  5407. }
  5408. function isPatchable (vnode) {
  5409. while (vnode.componentInstance) {
  5410. vnode = vnode.componentInstance._vnode;
  5411. }
  5412. return isDef(vnode.tag)
  5413. }
  5414. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  5415. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5416. cbs.create[i$1](emptyNode, vnode);
  5417. }
  5418. i = vnode.data.hook; // Reuse variable
  5419. if (isDef(i)) {
  5420. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  5421. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  5422. }
  5423. }
  5424. // set scope id attribute for scoped CSS.
  5425. // this is implemented as a special case to avoid the overhead
  5426. // of going through the normal attribute patching process.
  5427. function setScope (vnode) {
  5428. var i;
  5429. if (isDef(i = vnode.fnScopeId)) {
  5430. nodeOps.setStyleScope(vnode.elm, i);
  5431. } else {
  5432. var ancestor = vnode;
  5433. while (ancestor) {
  5434. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  5435. nodeOps.setStyleScope(vnode.elm, i);
  5436. }
  5437. ancestor = ancestor.parent;
  5438. }
  5439. }
  5440. // for slot content they should also get the scopeId from the host instance.
  5441. if (isDef(i = activeInstance) &&
  5442. i !== vnode.context &&
  5443. i !== vnode.fnContext &&
  5444. isDef(i = i.$options._scopeId)
  5445. ) {
  5446. nodeOps.setStyleScope(vnode.elm, i);
  5447. }
  5448. }
  5449. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  5450. for (; startIdx <= endIdx; ++startIdx) {
  5451. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  5452. }
  5453. }
  5454. function invokeDestroyHook (vnode) {
  5455. var i, j;
  5456. var data = vnode.data;
  5457. if (isDef(data)) {
  5458. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  5459. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  5460. }
  5461. if (isDef(i = vnode.children)) {
  5462. for (j = 0; j < vnode.children.length; ++j) {
  5463. invokeDestroyHook(vnode.children[j]);
  5464. }
  5465. }
  5466. }
  5467. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  5468. for (; startIdx <= endIdx; ++startIdx) {
  5469. var ch = vnodes[startIdx];
  5470. if (isDef(ch)) {
  5471. if (isDef(ch.tag)) {
  5472. removeAndInvokeRemoveHook(ch);
  5473. invokeDestroyHook(ch);
  5474. } else { // Text node
  5475. removeNode(ch.elm);
  5476. }
  5477. }
  5478. }
  5479. }
  5480. function removeAndInvokeRemoveHook (vnode, rm) {
  5481. if (isDef(rm) || isDef(vnode.data)) {
  5482. var i;
  5483. var listeners = cbs.remove.length + 1;
  5484. if (isDef(rm)) {
  5485. // we have a recursively passed down rm callback
  5486. // increase the listeners count
  5487. rm.listeners += listeners;
  5488. } else {
  5489. // directly removing
  5490. rm = createRmCb(vnode.elm, listeners);
  5491. }
  5492. // recursively invoke hooks on child component root node
  5493. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  5494. removeAndInvokeRemoveHook(i, rm);
  5495. }
  5496. for (i = 0; i < cbs.remove.length; ++i) {
  5497. cbs.remove[i](vnode, rm);
  5498. }
  5499. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  5500. i(vnode, rm);
  5501. } else {
  5502. rm();
  5503. }
  5504. } else {
  5505. removeNode(vnode.elm);
  5506. }
  5507. }
  5508. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  5509. var oldStartIdx = 0;
  5510. var newStartIdx = 0;
  5511. var oldEndIdx = oldCh.length - 1;
  5512. var oldStartVnode = oldCh[0];
  5513. var oldEndVnode = oldCh[oldEndIdx];
  5514. var newEndIdx = newCh.length - 1;
  5515. var newStartVnode = newCh[0];
  5516. var newEndVnode = newCh[newEndIdx];
  5517. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  5518. // removeOnly is a special flag used only by <transition-group>
  5519. // to ensure removed elements stay in correct relative positions
  5520. // during leaving transitions
  5521. var canMove = !removeOnly;
  5522. {
  5523. checkDuplicateKeys(newCh);
  5524. }
  5525. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  5526. if (isUndef(oldStartVnode)) {
  5527. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  5528. } else if (isUndef(oldEndVnode)) {
  5529. oldEndVnode = oldCh[--oldEndIdx];
  5530. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  5531. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5532. oldStartVnode = oldCh[++oldStartIdx];
  5533. newStartVnode = newCh[++newStartIdx];
  5534. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  5535. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5536. oldEndVnode = oldCh[--oldEndIdx];
  5537. newEndVnode = newCh[--newEndIdx];
  5538. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  5539. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5540. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  5541. oldStartVnode = oldCh[++oldStartIdx];
  5542. newEndVnode = newCh[--newEndIdx];
  5543. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  5544. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5545. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  5546. oldEndVnode = oldCh[--oldEndIdx];
  5547. newStartVnode = newCh[++newStartIdx];
  5548. } else {
  5549. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  5550. idxInOld = isDef(newStartVnode.key)
  5551. ? oldKeyToIdx[newStartVnode.key]
  5552. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  5553. if (isUndef(idxInOld)) { // New element
  5554. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5555. } else {
  5556. vnodeToMove = oldCh[idxInOld];
  5557. if (sameVnode(vnodeToMove, newStartVnode)) {
  5558. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5559. oldCh[idxInOld] = undefined;
  5560. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  5561. } else {
  5562. // same key but different element. treat as new element
  5563. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5564. }
  5565. }
  5566. newStartVnode = newCh[++newStartIdx];
  5567. }
  5568. }
  5569. if (oldStartIdx > oldEndIdx) {
  5570. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  5571. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  5572. } else if (newStartIdx > newEndIdx) {
  5573. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  5574. }
  5575. }
  5576. function checkDuplicateKeys (children) {
  5577. var seenKeys = {};
  5578. for (var i = 0; i < children.length; i++) {
  5579. var vnode = children[i];
  5580. var key = vnode.key;
  5581. if (isDef(key)) {
  5582. if (seenKeys[key]) {
  5583. warn(
  5584. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  5585. vnode.context
  5586. );
  5587. } else {
  5588. seenKeys[key] = true;
  5589. }
  5590. }
  5591. }
  5592. }
  5593. function findIdxInOld (node, oldCh, start, end) {
  5594. for (var i = start; i < end; i++) {
  5595. var c = oldCh[i];
  5596. if (isDef(c) && sameVnode(node, c)) { return i }
  5597. }
  5598. }
  5599. function patchVnode (
  5600. oldVnode,
  5601. vnode,
  5602. insertedVnodeQueue,
  5603. ownerArray,
  5604. index,
  5605. removeOnly
  5606. ) {
  5607. if (oldVnode === vnode) {
  5608. return
  5609. }
  5610. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5611. // clone reused vnode
  5612. vnode = ownerArray[index] = cloneVNode(vnode);
  5613. }
  5614. var elm = vnode.elm = oldVnode.elm;
  5615. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  5616. if (isDef(vnode.asyncFactory.resolved)) {
  5617. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  5618. } else {
  5619. vnode.isAsyncPlaceholder = true;
  5620. }
  5621. return
  5622. }
  5623. // reuse element for static trees.
  5624. // note we only do this if the vnode is cloned -
  5625. // if the new node is not cloned it means the render functions have been
  5626. // reset by the hot-reload-api and we need to do a proper re-render.
  5627. if (isTrue(vnode.isStatic) &&
  5628. isTrue(oldVnode.isStatic) &&
  5629. vnode.key === oldVnode.key &&
  5630. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  5631. ) {
  5632. vnode.componentInstance = oldVnode.componentInstance;
  5633. return
  5634. }
  5635. var i;
  5636. var data = vnode.data;
  5637. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  5638. i(oldVnode, vnode);
  5639. }
  5640. var oldCh = oldVnode.children;
  5641. var ch = vnode.children;
  5642. if (isDef(data) && isPatchable(vnode)) {
  5643. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  5644. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  5645. }
  5646. if (isUndef(vnode.text)) {
  5647. if (isDef(oldCh) && isDef(ch)) {
  5648. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  5649. } else if (isDef(ch)) {
  5650. {
  5651. checkDuplicateKeys(ch);
  5652. }
  5653. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  5654. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  5655. } else if (isDef(oldCh)) {
  5656. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  5657. } else if (isDef(oldVnode.text)) {
  5658. nodeOps.setTextContent(elm, '');
  5659. }
  5660. } else if (oldVnode.text !== vnode.text) {
  5661. nodeOps.setTextContent(elm, vnode.text);
  5662. }
  5663. if (isDef(data)) {
  5664. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  5665. }
  5666. }
  5667. function invokeInsertHook (vnode, queue, initial) {
  5668. // delay insert hooks for component root nodes, invoke them after the
  5669. // element is really inserted
  5670. if (isTrue(initial) && isDef(vnode.parent)) {
  5671. vnode.parent.data.pendingInsert = queue;
  5672. } else {
  5673. for (var i = 0; i < queue.length; ++i) {
  5674. queue[i].data.hook.insert(queue[i]);
  5675. }
  5676. }
  5677. }
  5678. var hydrationBailed = false;
  5679. // list of modules that can skip create hook during hydration because they
  5680. // are already rendered on the client or has no need for initialization
  5681. // Note: style is excluded because it relies on initial clone for future
  5682. // deep updates (#7063).
  5683. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  5684. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  5685. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  5686. var i;
  5687. var tag = vnode.tag;
  5688. var data = vnode.data;
  5689. var children = vnode.children;
  5690. inVPre = inVPre || (data && data.pre);
  5691. vnode.elm = elm;
  5692. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  5693. vnode.isAsyncPlaceholder = true;
  5694. return true
  5695. }
  5696. // assert node match
  5697. {
  5698. if (!assertNodeMatch(elm, vnode, inVPre)) {
  5699. return false
  5700. }
  5701. }
  5702. if (isDef(data)) {
  5703. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  5704. if (isDef(i = vnode.componentInstance)) {
  5705. // child component. it should have hydrated its own tree.
  5706. initComponent(vnode, insertedVnodeQueue);
  5707. return true
  5708. }
  5709. }
  5710. if (isDef(tag)) {
  5711. if (isDef(children)) {
  5712. // empty element, allow client to pick up and populate children
  5713. if (!elm.hasChildNodes()) {
  5714. createChildren(vnode, children, insertedVnodeQueue);
  5715. } else {
  5716. // v-html and domProps: innerHTML
  5717. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  5718. if (i !== elm.innerHTML) {
  5719. /* istanbul ignore if */
  5720. if (typeof console !== 'undefined' &&
  5721. !hydrationBailed
  5722. ) {
  5723. hydrationBailed = true;
  5724. console.warn('Parent: ', elm);
  5725. console.warn('server innerHTML: ', i);
  5726. console.warn('client innerHTML: ', elm.innerHTML);
  5727. }
  5728. return false
  5729. }
  5730. } else {
  5731. // iterate and compare children lists
  5732. var childrenMatch = true;
  5733. var childNode = elm.firstChild;
  5734. for (var i$1 = 0; i$1 < children.length; i$1++) {
  5735. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  5736. childrenMatch = false;
  5737. break
  5738. }
  5739. childNode = childNode.nextSibling;
  5740. }
  5741. // if childNode is not null, it means the actual childNodes list is
  5742. // longer than the virtual children list.
  5743. if (!childrenMatch || childNode) {
  5744. /* istanbul ignore if */
  5745. if (typeof console !== 'undefined' &&
  5746. !hydrationBailed
  5747. ) {
  5748. hydrationBailed = true;
  5749. console.warn('Parent: ', elm);
  5750. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  5751. }
  5752. return false
  5753. }
  5754. }
  5755. }
  5756. }
  5757. if (isDef(data)) {
  5758. var fullInvoke = false;
  5759. for (var key in data) {
  5760. if (!isRenderedModule(key)) {
  5761. fullInvoke = true;
  5762. invokeCreateHooks(vnode, insertedVnodeQueue);
  5763. break
  5764. }
  5765. }
  5766. if (!fullInvoke && data['class']) {
  5767. // ensure collecting deps for deep class bindings for future updates
  5768. traverse(data['class']);
  5769. }
  5770. }
  5771. } else if (elm.data !== vnode.text) {
  5772. elm.data = vnode.text;
  5773. }
  5774. return true
  5775. }
  5776. function assertNodeMatch (node, vnode, inVPre) {
  5777. if (isDef(vnode.tag)) {
  5778. return vnode.tag.indexOf('vue-component') === 0 || (
  5779. !isUnknownElement$$1(vnode, inVPre) &&
  5780. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  5781. )
  5782. } else {
  5783. return node.nodeType === (vnode.isComment ? 8 : 3)
  5784. }
  5785. }
  5786. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  5787. if (isUndef(vnode)) {
  5788. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  5789. return
  5790. }
  5791. var isInitialPatch = false;
  5792. var insertedVnodeQueue = [];
  5793. if (isUndef(oldVnode)) {
  5794. // empty mount (likely as component), create new root element
  5795. isInitialPatch = true;
  5796. createElm(vnode, insertedVnodeQueue);
  5797. } else {
  5798. var isRealElement = isDef(oldVnode.nodeType);
  5799. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  5800. // patch existing root node
  5801. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  5802. } else {
  5803. if (isRealElement) {
  5804. // mounting to a real element
  5805. // check if this is server-rendered content and if we can perform
  5806. // a successful hydration.
  5807. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  5808. oldVnode.removeAttribute(SSR_ATTR);
  5809. hydrating = true;
  5810. }
  5811. if (isTrue(hydrating)) {
  5812. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  5813. invokeInsertHook(vnode, insertedVnodeQueue, true);
  5814. return oldVnode
  5815. } else {
  5816. warn(
  5817. 'The client-side rendered virtual DOM tree is not matching ' +
  5818. 'server-rendered content. This is likely caused by incorrect ' +
  5819. 'HTML markup, for example nesting block-level elements inside ' +
  5820. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  5821. 'full client-side render.'
  5822. );
  5823. }
  5824. }
  5825. // either not server-rendered, or hydration failed.
  5826. // create an empty node and replace it
  5827. oldVnode = emptyNodeAt(oldVnode);
  5828. }
  5829. // replacing existing element
  5830. var oldElm = oldVnode.elm;
  5831. var parentElm = nodeOps.parentNode(oldElm);
  5832. // create new node
  5833. createElm(
  5834. vnode,
  5835. insertedVnodeQueue,
  5836. // extremely rare edge case: do not insert if old element is in a
  5837. // leaving transition. Only happens when combining transition +
  5838. // keep-alive + HOCs. (#4590)
  5839. oldElm._leaveCb ? null : parentElm,
  5840. nodeOps.nextSibling(oldElm)
  5841. );
  5842. // update parent placeholder node element, recursively
  5843. if (isDef(vnode.parent)) {
  5844. var ancestor = vnode.parent;
  5845. var patchable = isPatchable(vnode);
  5846. while (ancestor) {
  5847. for (var i = 0; i < cbs.destroy.length; ++i) {
  5848. cbs.destroy[i](ancestor);
  5849. }
  5850. ancestor.elm = vnode.elm;
  5851. if (patchable) {
  5852. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5853. cbs.create[i$1](emptyNode, ancestor);
  5854. }
  5855. // #6513
  5856. // invoke insert hooks that may have been merged by create hooks.
  5857. // e.g. for directives that uses the "inserted" hook.
  5858. var insert = ancestor.data.hook.insert;
  5859. if (insert.merged) {
  5860. // start at index 1 to avoid re-invoking component mounted hook
  5861. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  5862. insert.fns[i$2]();
  5863. }
  5864. }
  5865. } else {
  5866. registerRef(ancestor);
  5867. }
  5868. ancestor = ancestor.parent;
  5869. }
  5870. }
  5871. // destroy old node
  5872. if (isDef(parentElm)) {
  5873. removeVnodes(parentElm, [oldVnode], 0, 0);
  5874. } else if (isDef(oldVnode.tag)) {
  5875. invokeDestroyHook(oldVnode);
  5876. }
  5877. }
  5878. }
  5879. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  5880. return vnode.elm
  5881. }
  5882. }
  5883. /* */
  5884. var directives = {
  5885. create: updateDirectives,
  5886. update: updateDirectives,
  5887. destroy: function unbindDirectives (vnode) {
  5888. updateDirectives(vnode, emptyNode);
  5889. }
  5890. };
  5891. function updateDirectives (oldVnode, vnode) {
  5892. if (oldVnode.data.directives || vnode.data.directives) {
  5893. _update(oldVnode, vnode);
  5894. }
  5895. }
  5896. function _update (oldVnode, vnode) {
  5897. var isCreate = oldVnode === emptyNode;
  5898. var isDestroy = vnode === emptyNode;
  5899. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  5900. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  5901. var dirsWithInsert = [];
  5902. var dirsWithPostpatch = [];
  5903. var key, oldDir, dir;
  5904. for (key in newDirs) {
  5905. oldDir = oldDirs[key];
  5906. dir = newDirs[key];
  5907. if (!oldDir) {
  5908. // new directive, bind
  5909. callHook$1(dir, 'bind', vnode, oldVnode);
  5910. if (dir.def && dir.def.inserted) {
  5911. dirsWithInsert.push(dir);
  5912. }
  5913. } else {
  5914. // existing directive, update
  5915. dir.oldValue = oldDir.value;
  5916. dir.oldArg = oldDir.arg;
  5917. callHook$1(dir, 'update', vnode, oldVnode);
  5918. if (dir.def && dir.def.componentUpdated) {
  5919. dirsWithPostpatch.push(dir);
  5920. }
  5921. }
  5922. }
  5923. if (dirsWithInsert.length) {
  5924. var callInsert = function () {
  5925. for (var i = 0; i < dirsWithInsert.length; i++) {
  5926. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  5927. }
  5928. };
  5929. if (isCreate) {
  5930. mergeVNodeHook(vnode, 'insert', callInsert);
  5931. } else {
  5932. callInsert();
  5933. }
  5934. }
  5935. if (dirsWithPostpatch.length) {
  5936. mergeVNodeHook(vnode, 'postpatch', function () {
  5937. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  5938. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  5939. }
  5940. });
  5941. }
  5942. if (!isCreate) {
  5943. for (key in oldDirs) {
  5944. if (!newDirs[key]) {
  5945. // no longer present, unbind
  5946. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  5947. }
  5948. }
  5949. }
  5950. }
  5951. var emptyModifiers = Object.create(null);
  5952. function normalizeDirectives$1 (
  5953. dirs,
  5954. vm
  5955. ) {
  5956. var res = Object.create(null);
  5957. if (!dirs) {
  5958. // $flow-disable-line
  5959. return res
  5960. }
  5961. var i, dir;
  5962. for (i = 0; i < dirs.length; i++) {
  5963. dir = dirs[i];
  5964. if (!dir.modifiers) {
  5965. // $flow-disable-line
  5966. dir.modifiers = emptyModifiers;
  5967. }
  5968. res[getRawDirName(dir)] = dir;
  5969. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  5970. }
  5971. // $flow-disable-line
  5972. return res
  5973. }
  5974. function getRawDirName (dir) {
  5975. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  5976. }
  5977. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  5978. var fn = dir.def && dir.def[hook];
  5979. if (fn) {
  5980. try {
  5981. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  5982. } catch (e) {
  5983. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  5984. }
  5985. }
  5986. }
  5987. var baseModules = [
  5988. ref,
  5989. directives
  5990. ];
  5991. /* */
  5992. function updateAttrs (oldVnode, vnode) {
  5993. var opts = vnode.componentOptions;
  5994. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  5995. return
  5996. }
  5997. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  5998. return
  5999. }
  6000. var key, cur, old;
  6001. var elm = vnode.elm;
  6002. var oldAttrs = oldVnode.data.attrs || {};
  6003. var attrs = vnode.data.attrs || {};
  6004. // clone observed objects, as the user probably wants to mutate it
  6005. if (isDef(attrs.__ob__)) {
  6006. attrs = vnode.data.attrs = extend({}, attrs);
  6007. }
  6008. for (key in attrs) {
  6009. cur = attrs[key];
  6010. old = oldAttrs[key];
  6011. if (old !== cur) {
  6012. setAttr(elm, key, cur);
  6013. }
  6014. }
  6015. // #4391: in IE9, setting type can reset value for input[type=radio]
  6016. // #6666: IE/Edge forces progress value down to 1 before setting a max
  6017. /* istanbul ignore if */
  6018. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  6019. setAttr(elm, 'value', attrs.value);
  6020. }
  6021. for (key in oldAttrs) {
  6022. if (isUndef(attrs[key])) {
  6023. if (isXlink(key)) {
  6024. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6025. } else if (!isEnumeratedAttr(key)) {
  6026. elm.removeAttribute(key);
  6027. }
  6028. }
  6029. }
  6030. }
  6031. function setAttr (el, key, value) {
  6032. if (el.tagName.indexOf('-') > -1) {
  6033. baseSetAttr(el, key, value);
  6034. } else if (isBooleanAttr(key)) {
  6035. // set attribute for blank value
  6036. // e.g. <option disabled>Select one</option>
  6037. if (isFalsyAttrValue(value)) {
  6038. el.removeAttribute(key);
  6039. } else {
  6040. // technically allowfullscreen is a boolean attribute for <iframe>,
  6041. // but Flash expects a value of "true" when used on <embed> tag
  6042. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  6043. ? 'true'
  6044. : key;
  6045. el.setAttribute(key, value);
  6046. }
  6047. } else if (isEnumeratedAttr(key)) {
  6048. el.setAttribute(key, convertEnumeratedValue(key, value));
  6049. } else if (isXlink(key)) {
  6050. if (isFalsyAttrValue(value)) {
  6051. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6052. } else {
  6053. el.setAttributeNS(xlinkNS, key, value);
  6054. }
  6055. } else {
  6056. baseSetAttr(el, key, value);
  6057. }
  6058. }
  6059. function baseSetAttr (el, key, value) {
  6060. if (isFalsyAttrValue(value)) {
  6061. el.removeAttribute(key);
  6062. } else {
  6063. // #7138: IE10 & 11 fires input event when setting placeholder on
  6064. // <textarea>... block the first input event and remove the blocker
  6065. // immediately.
  6066. /* istanbul ignore if */
  6067. if (
  6068. isIE && !isIE9 &&
  6069. el.tagName === 'TEXTAREA' &&
  6070. key === 'placeholder' && value !== '' && !el.__ieph
  6071. ) {
  6072. var blocker = function (e) {
  6073. e.stopImmediatePropagation();
  6074. el.removeEventListener('input', blocker);
  6075. };
  6076. el.addEventListener('input', blocker);
  6077. // $flow-disable-line
  6078. el.__ieph = true; /* IE placeholder patched */
  6079. }
  6080. el.setAttribute(key, value);
  6081. }
  6082. }
  6083. var attrs = {
  6084. create: updateAttrs,
  6085. update: updateAttrs
  6086. };
  6087. /* */
  6088. function updateClass (oldVnode, vnode) {
  6089. var el = vnode.elm;
  6090. var data = vnode.data;
  6091. var oldData = oldVnode.data;
  6092. if (
  6093. isUndef(data.staticClass) &&
  6094. isUndef(data.class) && (
  6095. isUndef(oldData) || (
  6096. isUndef(oldData.staticClass) &&
  6097. isUndef(oldData.class)
  6098. )
  6099. )
  6100. ) {
  6101. return
  6102. }
  6103. var cls = genClassForVnode(vnode);
  6104. // handle transition classes
  6105. var transitionClass = el._transitionClasses;
  6106. if (isDef(transitionClass)) {
  6107. cls = concat(cls, stringifyClass(transitionClass));
  6108. }
  6109. // set the class
  6110. if (cls !== el._prevClass) {
  6111. el.setAttribute('class', cls);
  6112. el._prevClass = cls;
  6113. }
  6114. }
  6115. var klass = {
  6116. create: updateClass,
  6117. update: updateClass
  6118. };
  6119. /* */
  6120. var validDivisionCharRE = /[\w).+\-_$\]]/;
  6121. function parseFilters (exp) {
  6122. var inSingle = false;
  6123. var inDouble = false;
  6124. var inTemplateString = false;
  6125. var inRegex = false;
  6126. var curly = 0;
  6127. var square = 0;
  6128. var paren = 0;
  6129. var lastFilterIndex = 0;
  6130. var c, prev, i, expression, filters;
  6131. for (i = 0; i < exp.length; i++) {
  6132. prev = c;
  6133. c = exp.charCodeAt(i);
  6134. if (inSingle) {
  6135. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  6136. } else if (inDouble) {
  6137. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  6138. } else if (inTemplateString) {
  6139. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  6140. } else if (inRegex) {
  6141. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  6142. } else if (
  6143. c === 0x7C && // pipe
  6144. exp.charCodeAt(i + 1) !== 0x7C &&
  6145. exp.charCodeAt(i - 1) !== 0x7C &&
  6146. !curly && !square && !paren
  6147. ) {
  6148. if (expression === undefined) {
  6149. // first filter, end of expression
  6150. lastFilterIndex = i + 1;
  6151. expression = exp.slice(0, i).trim();
  6152. } else {
  6153. pushFilter();
  6154. }
  6155. } else {
  6156. switch (c) {
  6157. case 0x22: inDouble = true; break // "
  6158. case 0x27: inSingle = true; break // '
  6159. case 0x60: inTemplateString = true; break // `
  6160. case 0x28: paren++; break // (
  6161. case 0x29: paren--; break // )
  6162. case 0x5B: square++; break // [
  6163. case 0x5D: square--; break // ]
  6164. case 0x7B: curly++; break // {
  6165. case 0x7D: curly--; break // }
  6166. }
  6167. if (c === 0x2f) { // /
  6168. var j = i - 1;
  6169. var p = (void 0);
  6170. // find first non-whitespace prev char
  6171. for (; j >= 0; j--) {
  6172. p = exp.charAt(j);
  6173. if (p !== ' ') { break }
  6174. }
  6175. if (!p || !validDivisionCharRE.test(p)) {
  6176. inRegex = true;
  6177. }
  6178. }
  6179. }
  6180. }
  6181. if (expression === undefined) {
  6182. expression = exp.slice(0, i).trim();
  6183. } else if (lastFilterIndex !== 0) {
  6184. pushFilter();
  6185. }
  6186. function pushFilter () {
  6187. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  6188. lastFilterIndex = i + 1;
  6189. }
  6190. if (filters) {
  6191. for (i = 0; i < filters.length; i++) {
  6192. expression = wrapFilter(expression, filters[i]);
  6193. }
  6194. }
  6195. return expression
  6196. }
  6197. function wrapFilter (exp, filter) {
  6198. var i = filter.indexOf('(');
  6199. if (i < 0) {
  6200. // _f: resolveFilter
  6201. return ("_f(\"" + filter + "\")(" + exp + ")")
  6202. } else {
  6203. var name = filter.slice(0, i);
  6204. var args = filter.slice(i + 1);
  6205. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  6206. }
  6207. }
  6208. /* */
  6209. /* eslint-disable no-unused-vars */
  6210. function baseWarn (msg, range) {
  6211. console.error(("[Vue compiler]: " + msg));
  6212. }
  6213. /* eslint-enable no-unused-vars */
  6214. function pluckModuleFunction (
  6215. modules,
  6216. key
  6217. ) {
  6218. return modules
  6219. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  6220. : []
  6221. }
  6222. function addProp (el, name, value, range, dynamic) {
  6223. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  6224. el.plain = false;
  6225. }
  6226. function addAttr (el, name, value, range, dynamic) {
  6227. var attrs = dynamic
  6228. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  6229. : (el.attrs || (el.attrs = []));
  6230. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  6231. el.plain = false;
  6232. }
  6233. // add a raw attr (use this in preTransforms)
  6234. function addRawAttr (el, name, value, range) {
  6235. el.attrsMap[name] = value;
  6236. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  6237. }
  6238. function addDirective (
  6239. el,
  6240. name,
  6241. rawName,
  6242. value,
  6243. arg,
  6244. isDynamicArg,
  6245. modifiers,
  6246. range
  6247. ) {
  6248. (el.directives || (el.directives = [])).push(rangeSetItem({
  6249. name: name,
  6250. rawName: rawName,
  6251. value: value,
  6252. arg: arg,
  6253. isDynamicArg: isDynamicArg,
  6254. modifiers: modifiers
  6255. }, range));
  6256. el.plain = false;
  6257. }
  6258. function prependModifierMarker (symbol, name, dynamic) {
  6259. return dynamic
  6260. ? ("_p(" + name + ",\"" + symbol + "\")")
  6261. : symbol + name // mark the event as captured
  6262. }
  6263. function addHandler (
  6264. el,
  6265. name,
  6266. value,
  6267. modifiers,
  6268. important,
  6269. warn,
  6270. range,
  6271. dynamic
  6272. ) {
  6273. modifiers = modifiers || emptyObject;
  6274. // warn prevent and passive modifier
  6275. /* istanbul ignore if */
  6276. if (
  6277. warn &&
  6278. modifiers.prevent && modifiers.passive
  6279. ) {
  6280. warn(
  6281. 'passive and prevent can\'t be used together. ' +
  6282. 'Passive handler can\'t prevent default event.',
  6283. range
  6284. );
  6285. }
  6286. // normalize click.right and click.middle since they don't actually fire
  6287. // this is technically browser-specific, but at least for now browsers are
  6288. // the only target envs that have right/middle clicks.
  6289. if (modifiers.right) {
  6290. if (dynamic) {
  6291. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  6292. } else if (name === 'click') {
  6293. name = 'contextmenu';
  6294. delete modifiers.right;
  6295. }
  6296. } else if (modifiers.middle) {
  6297. if (dynamic) {
  6298. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  6299. } else if (name === 'click') {
  6300. name = 'mouseup';
  6301. }
  6302. }
  6303. // check capture modifier
  6304. if (modifiers.capture) {
  6305. delete modifiers.capture;
  6306. name = prependModifierMarker('!', name, dynamic);
  6307. }
  6308. if (modifiers.once) {
  6309. delete modifiers.once;
  6310. name = prependModifierMarker('~', name, dynamic);
  6311. }
  6312. /* istanbul ignore if */
  6313. if (modifiers.passive) {
  6314. delete modifiers.passive;
  6315. name = prependModifierMarker('&', name, dynamic);
  6316. }
  6317. var events;
  6318. if (modifiers.native) {
  6319. delete modifiers.native;
  6320. events = el.nativeEvents || (el.nativeEvents = {});
  6321. } else {
  6322. events = el.events || (el.events = {});
  6323. }
  6324. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  6325. if (modifiers !== emptyObject) {
  6326. newHandler.modifiers = modifiers;
  6327. }
  6328. var handlers = events[name];
  6329. /* istanbul ignore if */
  6330. if (Array.isArray(handlers)) {
  6331. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  6332. } else if (handlers) {
  6333. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  6334. } else {
  6335. events[name] = newHandler;
  6336. }
  6337. el.plain = false;
  6338. }
  6339. function getRawBindingAttr (
  6340. el,
  6341. name
  6342. ) {
  6343. return el.rawAttrsMap[':' + name] ||
  6344. el.rawAttrsMap['v-bind:' + name] ||
  6345. el.rawAttrsMap[name]
  6346. }
  6347. function getBindingAttr (
  6348. el,
  6349. name,
  6350. getStatic
  6351. ) {
  6352. var dynamicValue =
  6353. getAndRemoveAttr(el, ':' + name) ||
  6354. getAndRemoveAttr(el, 'v-bind:' + name);
  6355. if (dynamicValue != null) {
  6356. return parseFilters(dynamicValue)
  6357. } else if (getStatic !== false) {
  6358. var staticValue = getAndRemoveAttr(el, name);
  6359. if (staticValue != null) {
  6360. return JSON.stringify(staticValue)
  6361. }
  6362. }
  6363. }
  6364. // note: this only removes the attr from the Array (attrsList) so that it
  6365. // doesn't get processed by processAttrs.
  6366. // By default it does NOT remove it from the map (attrsMap) because the map is
  6367. // needed during codegen.
  6368. function getAndRemoveAttr (
  6369. el,
  6370. name,
  6371. removeFromMap
  6372. ) {
  6373. var val;
  6374. if ((val = el.attrsMap[name]) != null) {
  6375. var list = el.attrsList;
  6376. for (var i = 0, l = list.length; i < l; i++) {
  6377. if (list[i].name === name) {
  6378. list.splice(i, 1);
  6379. break
  6380. }
  6381. }
  6382. }
  6383. if (removeFromMap) {
  6384. delete el.attrsMap[name];
  6385. }
  6386. return val
  6387. }
  6388. function getAndRemoveAttrByRegex (
  6389. el,
  6390. name
  6391. ) {
  6392. var list = el.attrsList;
  6393. for (var i = 0, l = list.length; i < l; i++) {
  6394. var attr = list[i];
  6395. if (name.test(attr.name)) {
  6396. list.splice(i, 1);
  6397. return attr
  6398. }
  6399. }
  6400. }
  6401. function rangeSetItem (
  6402. item,
  6403. range
  6404. ) {
  6405. if (range) {
  6406. if (range.start != null) {
  6407. item.start = range.start;
  6408. }
  6409. if (range.end != null) {
  6410. item.end = range.end;
  6411. }
  6412. }
  6413. return item
  6414. }
  6415. /* */
  6416. /**
  6417. * Cross-platform code generation for component v-model
  6418. */
  6419. function genComponentModel (
  6420. el,
  6421. value,
  6422. modifiers
  6423. ) {
  6424. var ref = modifiers || {};
  6425. var number = ref.number;
  6426. var trim = ref.trim;
  6427. var baseValueExpression = '$$v';
  6428. var valueExpression = baseValueExpression;
  6429. if (trim) {
  6430. valueExpression =
  6431. "(typeof " + baseValueExpression + " === 'string'" +
  6432. "? " + baseValueExpression + ".trim()" +
  6433. ": " + baseValueExpression + ")";
  6434. }
  6435. if (number) {
  6436. valueExpression = "_n(" + valueExpression + ")";
  6437. }
  6438. var assignment = genAssignmentCode(value, valueExpression);
  6439. el.model = {
  6440. value: ("(" + value + ")"),
  6441. expression: JSON.stringify(value),
  6442. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  6443. };
  6444. }
  6445. /**
  6446. * Cross-platform codegen helper for generating v-model value assignment code.
  6447. */
  6448. function genAssignmentCode (
  6449. value,
  6450. assignment
  6451. ) {
  6452. var res = parseModel(value);
  6453. if (res.key === null) {
  6454. return (value + "=" + assignment)
  6455. } else {
  6456. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  6457. }
  6458. }
  6459. /**
  6460. * Parse a v-model expression into a base path and a final key segment.
  6461. * Handles both dot-path and possible square brackets.
  6462. *
  6463. * Possible cases:
  6464. *
  6465. * - test
  6466. * - test[key]
  6467. * - test[test1[key]]
  6468. * - test["a"][key]
  6469. * - xxx.test[a[a].test1[key]]
  6470. * - test.xxx.a["asa"][test1[key]]
  6471. *
  6472. */
  6473. var len, str, chr, index$1, expressionPos, expressionEndPos;
  6474. function parseModel (val) {
  6475. // Fix https://github.com/vuejs/vue/pull/7730
  6476. // allow v-model="obj.val " (trailing whitespace)
  6477. val = val.trim();
  6478. len = val.length;
  6479. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  6480. index$1 = val.lastIndexOf('.');
  6481. if (index$1 > -1) {
  6482. return {
  6483. exp: val.slice(0, index$1),
  6484. key: '"' + val.slice(index$1 + 1) + '"'
  6485. }
  6486. } else {
  6487. return {
  6488. exp: val,
  6489. key: null
  6490. }
  6491. }
  6492. }
  6493. str = val;
  6494. index$1 = expressionPos = expressionEndPos = 0;
  6495. while (!eof()) {
  6496. chr = next();
  6497. /* istanbul ignore if */
  6498. if (isStringStart(chr)) {
  6499. parseString(chr);
  6500. } else if (chr === 0x5B) {
  6501. parseBracket(chr);
  6502. }
  6503. }
  6504. return {
  6505. exp: val.slice(0, expressionPos),
  6506. key: val.slice(expressionPos + 1, expressionEndPos)
  6507. }
  6508. }
  6509. function next () {
  6510. return str.charCodeAt(++index$1)
  6511. }
  6512. function eof () {
  6513. return index$1 >= len
  6514. }
  6515. function isStringStart (chr) {
  6516. return chr === 0x22 || chr === 0x27
  6517. }
  6518. function parseBracket (chr) {
  6519. var inBracket = 1;
  6520. expressionPos = index$1;
  6521. while (!eof()) {
  6522. chr = next();
  6523. if (isStringStart(chr)) {
  6524. parseString(chr);
  6525. continue
  6526. }
  6527. if (chr === 0x5B) { inBracket++; }
  6528. if (chr === 0x5D) { inBracket--; }
  6529. if (inBracket === 0) {
  6530. expressionEndPos = index$1;
  6531. break
  6532. }
  6533. }
  6534. }
  6535. function parseString (chr) {
  6536. var stringQuote = chr;
  6537. while (!eof()) {
  6538. chr = next();
  6539. if (chr === stringQuote) {
  6540. break
  6541. }
  6542. }
  6543. }
  6544. /* */
  6545. var warn$1;
  6546. // in some cases, the event used has to be determined at runtime
  6547. // so we used some reserved tokens during compile.
  6548. var RANGE_TOKEN = '__r';
  6549. var CHECKBOX_RADIO_TOKEN = '__c';
  6550. function model (
  6551. el,
  6552. dir,
  6553. _warn
  6554. ) {
  6555. warn$1 = _warn;
  6556. var value = dir.value;
  6557. var modifiers = dir.modifiers;
  6558. var tag = el.tag;
  6559. var type = el.attrsMap.type;
  6560. {
  6561. // inputs with type="file" are read only and setting the input's
  6562. // value will throw an error.
  6563. if (tag === 'input' && type === 'file') {
  6564. warn$1(
  6565. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  6566. "File inputs are read only. Use a v-on:change listener instead.",
  6567. el.rawAttrsMap['v-model']
  6568. );
  6569. }
  6570. }
  6571. if (el.component) {
  6572. genComponentModel(el, value, modifiers);
  6573. // component v-model doesn't need extra runtime
  6574. return false
  6575. } else if (tag === 'select') {
  6576. genSelect(el, value, modifiers);
  6577. } else if (tag === 'input' && type === 'checkbox') {
  6578. genCheckboxModel(el, value, modifiers);
  6579. } else if (tag === 'input' && type === 'radio') {
  6580. genRadioModel(el, value, modifiers);
  6581. } else if (tag === 'input' || tag === 'textarea') {
  6582. genDefaultModel(el, value, modifiers);
  6583. } else if (!config.isReservedTag(tag)) {
  6584. genComponentModel(el, value, modifiers);
  6585. // component v-model doesn't need extra runtime
  6586. return false
  6587. } else {
  6588. warn$1(
  6589. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  6590. "v-model is not supported on this element type. " +
  6591. 'If you are working with contenteditable, it\'s recommended to ' +
  6592. 'wrap a library dedicated for that purpose inside a custom component.',
  6593. el.rawAttrsMap['v-model']
  6594. );
  6595. }
  6596. // ensure runtime directive metadata
  6597. return true
  6598. }
  6599. function genCheckboxModel (
  6600. el,
  6601. value,
  6602. modifiers
  6603. ) {
  6604. var number = modifiers && modifiers.number;
  6605. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6606. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  6607. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  6608. addProp(el, 'checked',
  6609. "Array.isArray(" + value + ")" +
  6610. "?_i(" + value + "," + valueBinding + ")>-1" + (
  6611. trueValueBinding === 'true'
  6612. ? (":(" + value + ")")
  6613. : (":_q(" + value + "," + trueValueBinding + ")")
  6614. )
  6615. );
  6616. addHandler(el, 'change',
  6617. "var $$a=" + value + "," +
  6618. '$$el=$event.target,' +
  6619. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  6620. 'if(Array.isArray($$a)){' +
  6621. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  6622. '$$i=_i($$a,$$v);' +
  6623. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  6624. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  6625. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  6626. null, true
  6627. );
  6628. }
  6629. function genRadioModel (
  6630. el,
  6631. value,
  6632. modifiers
  6633. ) {
  6634. var number = modifiers && modifiers.number;
  6635. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6636. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  6637. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  6638. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  6639. }
  6640. function genSelect (
  6641. el,
  6642. value,
  6643. modifiers
  6644. ) {
  6645. var number = modifiers && modifiers.number;
  6646. var selectedVal = "Array.prototype.filter" +
  6647. ".call($event.target.options,function(o){return o.selected})" +
  6648. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  6649. "return " + (number ? '_n(val)' : 'val') + "})";
  6650. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  6651. var code = "var $$selectedVal = " + selectedVal + ";";
  6652. code = code + " " + (genAssignmentCode(value, assignment));
  6653. addHandler(el, 'change', code, null, true);
  6654. }
  6655. function genDefaultModel (
  6656. el,
  6657. value,
  6658. modifiers
  6659. ) {
  6660. var type = el.attrsMap.type;
  6661. // warn if v-bind:value conflicts with v-model
  6662. // except for inputs with v-bind:type
  6663. {
  6664. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  6665. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  6666. if (value$1 && !typeBinding) {
  6667. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  6668. warn$1(
  6669. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  6670. 'because the latter already expands to a value binding internally',
  6671. el.rawAttrsMap[binding]
  6672. );
  6673. }
  6674. }
  6675. var ref = modifiers || {};
  6676. var lazy = ref.lazy;
  6677. var number = ref.number;
  6678. var trim = ref.trim;
  6679. var needCompositionGuard = !lazy && type !== 'range';
  6680. var event = lazy
  6681. ? 'change'
  6682. : type === 'range'
  6683. ? RANGE_TOKEN
  6684. : 'input';
  6685. var valueExpression = '$event.target.value';
  6686. if (trim) {
  6687. valueExpression = "$event.target.value.trim()";
  6688. }
  6689. if (number) {
  6690. valueExpression = "_n(" + valueExpression + ")";
  6691. }
  6692. var code = genAssignmentCode(value, valueExpression);
  6693. if (needCompositionGuard) {
  6694. code = "if($event.target.composing)return;" + code;
  6695. }
  6696. addProp(el, 'value', ("(" + value + ")"));
  6697. addHandler(el, event, code, null, true);
  6698. if (trim || number) {
  6699. addHandler(el, 'blur', '$forceUpdate()');
  6700. }
  6701. }
  6702. /* */
  6703. // normalize v-model event tokens that can only be determined at runtime.
  6704. // it's important to place the event as the first in the array because
  6705. // the whole point is ensuring the v-model callback gets called before
  6706. // user-attached handlers.
  6707. function normalizeEvents (on) {
  6708. /* istanbul ignore if */
  6709. if (isDef(on[RANGE_TOKEN])) {
  6710. // IE input[type=range] only supports `change` event
  6711. var event = isIE ? 'change' : 'input';
  6712. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  6713. delete on[RANGE_TOKEN];
  6714. }
  6715. // This was originally intended to fix #4521 but no longer necessary
  6716. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  6717. /* istanbul ignore if */
  6718. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  6719. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  6720. delete on[CHECKBOX_RADIO_TOKEN];
  6721. }
  6722. }
  6723. var target$1;
  6724. function createOnceHandler$1 (event, handler, capture) {
  6725. var _target = target$1; // save current target element in closure
  6726. return function onceHandler () {
  6727. var res = handler.apply(null, arguments);
  6728. if (res !== null) {
  6729. remove$2(event, onceHandler, capture, _target);
  6730. }
  6731. }
  6732. }
  6733. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  6734. // implementation and does not fire microtasks in between event propagation, so
  6735. // safe to exclude.
  6736. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  6737. function add$1 (
  6738. name,
  6739. handler,
  6740. capture,
  6741. passive
  6742. ) {
  6743. // async edge case #6566: inner click event triggers patch, event handler
  6744. // attached to outer element during patch, and triggered again. This
  6745. // happens because browsers fire microtask ticks between event propagation.
  6746. // the solution is simple: we save the timestamp when a handler is attached,
  6747. // and the handler would only fire if the event passed to it was fired
  6748. // AFTER it was attached.
  6749. if (useMicrotaskFix) {
  6750. var attachedTimestamp = currentFlushTimestamp;
  6751. var original = handler;
  6752. handler = original._wrapper = function (e) {
  6753. if (
  6754. // no bubbling, should always fire.
  6755. // this is just a safety net in case event.timeStamp is unreliable in
  6756. // certain weird environments...
  6757. e.target === e.currentTarget ||
  6758. // event is fired after handler attachment
  6759. e.timeStamp >= attachedTimestamp ||
  6760. // #9462 bail for iOS 9 bug: event.timeStamp is 0 after history.pushState
  6761. e.timeStamp === 0 ||
  6762. // #9448 bail if event is fired in another document in a multi-page
  6763. // electron/nw.js app, since event.timeStamp will be using a different
  6764. // starting reference
  6765. e.target.ownerDocument !== document
  6766. ) {
  6767. return original.apply(this, arguments)
  6768. }
  6769. };
  6770. }
  6771. target$1.addEventListener(
  6772. name,
  6773. handler,
  6774. supportsPassive
  6775. ? { capture: capture, passive: passive }
  6776. : capture
  6777. );
  6778. }
  6779. function remove$2 (
  6780. name,
  6781. handler,
  6782. capture,
  6783. _target
  6784. ) {
  6785. (_target || target$1).removeEventListener(
  6786. name,
  6787. handler._wrapper || handler,
  6788. capture
  6789. );
  6790. }
  6791. function updateDOMListeners (oldVnode, vnode) {
  6792. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  6793. return
  6794. }
  6795. var on = vnode.data.on || {};
  6796. var oldOn = oldVnode.data.on || {};
  6797. target$1 = vnode.elm;
  6798. normalizeEvents(on);
  6799. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  6800. target$1 = undefined;
  6801. }
  6802. var events = {
  6803. create: updateDOMListeners,
  6804. update: updateDOMListeners
  6805. };
  6806. /* */
  6807. var svgContainer;
  6808. function updateDOMProps (oldVnode, vnode) {
  6809. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  6810. return
  6811. }
  6812. var key, cur;
  6813. var elm = vnode.elm;
  6814. var oldProps = oldVnode.data.domProps || {};
  6815. var props = vnode.data.domProps || {};
  6816. // clone observed objects, as the user probably wants to mutate it
  6817. if (isDef(props.__ob__)) {
  6818. props = vnode.data.domProps = extend({}, props);
  6819. }
  6820. for (key in oldProps) {
  6821. if (isUndef(props[key])) {
  6822. elm[key] = '';
  6823. }
  6824. }
  6825. for (key in props) {
  6826. cur = props[key];
  6827. // ignore children if the node has textContent or innerHTML,
  6828. // as these will throw away existing DOM nodes and cause removal errors
  6829. // on subsequent patches (#3360)
  6830. if (key === 'textContent' || key === 'innerHTML') {
  6831. if (vnode.children) { vnode.children.length = 0; }
  6832. if (cur === oldProps[key]) { continue }
  6833. // #6601 work around Chrome version <= 55 bug where single textNode
  6834. // replaced by innerHTML/textContent retains its parentNode property
  6835. if (elm.childNodes.length === 1) {
  6836. elm.removeChild(elm.childNodes[0]);
  6837. }
  6838. }
  6839. // skip the update if old and new VDOM state is the same.
  6840. // the only exception is `value` where the DOM value may be temporarily
  6841. // out of sync with VDOM state due to focus, composition and modifiers.
  6842. // This also covers #4521 by skipping the unnecesarry `checked` update.
  6843. if (key !== 'value' && cur === oldProps[key]) {
  6844. continue
  6845. }
  6846. if (key === 'value') {
  6847. // store value as _value as well since
  6848. // non-string values will be stringified
  6849. elm._value = cur;
  6850. // avoid resetting cursor position when value is the same
  6851. var strCur = isUndef(cur) ? '' : String(cur);
  6852. if (shouldUpdateValue(elm, strCur)) {
  6853. elm.value = strCur;
  6854. }
  6855. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  6856. // IE doesn't support innerHTML for SVG elements
  6857. svgContainer = svgContainer || document.createElement('div');
  6858. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  6859. var svg = svgContainer.firstChild;
  6860. while (elm.firstChild) {
  6861. elm.removeChild(elm.firstChild);
  6862. }
  6863. while (svg.firstChild) {
  6864. elm.appendChild(svg.firstChild);
  6865. }
  6866. } else {
  6867. elm[key] = cur;
  6868. }
  6869. }
  6870. }
  6871. // check platforms/web/util/attrs.js acceptValue
  6872. function shouldUpdateValue (elm, checkVal) {
  6873. return (!elm.composing && (
  6874. elm.tagName === 'OPTION' ||
  6875. isNotInFocusAndDirty(elm, checkVal) ||
  6876. isDirtyWithModifiers(elm, checkVal)
  6877. ))
  6878. }
  6879. function isNotInFocusAndDirty (elm, checkVal) {
  6880. // return true when textbox (.number and .trim) loses focus and its value is
  6881. // not equal to the updated value
  6882. var notInFocus = true;
  6883. // #6157
  6884. // work around IE bug when accessing document.activeElement in an iframe
  6885. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  6886. return notInFocus && elm.value !== checkVal
  6887. }
  6888. function isDirtyWithModifiers (elm, newVal) {
  6889. var value = elm.value;
  6890. var modifiers = elm._vModifiers; // injected by v-model runtime
  6891. if (isDef(modifiers)) {
  6892. if (modifiers.number) {
  6893. return toNumber(value) !== toNumber(newVal)
  6894. }
  6895. if (modifiers.trim) {
  6896. return value.trim() !== newVal.trim()
  6897. }
  6898. }
  6899. return value !== newVal
  6900. }
  6901. var domProps = {
  6902. create: updateDOMProps,
  6903. update: updateDOMProps
  6904. };
  6905. /* */
  6906. var parseStyleText = cached(function (cssText) {
  6907. var res = {};
  6908. var listDelimiter = /;(?![^(]*\))/g;
  6909. var propertyDelimiter = /:(.+)/;
  6910. cssText.split(listDelimiter).forEach(function (item) {
  6911. if (item) {
  6912. var tmp = item.split(propertyDelimiter);
  6913. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6914. }
  6915. });
  6916. return res
  6917. });
  6918. // merge static and dynamic style data on the same vnode
  6919. function normalizeStyleData (data) {
  6920. var style = normalizeStyleBinding(data.style);
  6921. // static style is pre-processed into an object during compilation
  6922. // and is always a fresh object, so it's safe to merge into it
  6923. return data.staticStyle
  6924. ? extend(data.staticStyle, style)
  6925. : style
  6926. }
  6927. // normalize possible array / string values into Object
  6928. function normalizeStyleBinding (bindingStyle) {
  6929. if (Array.isArray(bindingStyle)) {
  6930. return toObject(bindingStyle)
  6931. }
  6932. if (typeof bindingStyle === 'string') {
  6933. return parseStyleText(bindingStyle)
  6934. }
  6935. return bindingStyle
  6936. }
  6937. /**
  6938. * parent component style should be after child's
  6939. * so that parent component's style could override it
  6940. */
  6941. function getStyle (vnode, checkChild) {
  6942. var res = {};
  6943. var styleData;
  6944. if (checkChild) {
  6945. var childNode = vnode;
  6946. while (childNode.componentInstance) {
  6947. childNode = childNode.componentInstance._vnode;
  6948. if (
  6949. childNode && childNode.data &&
  6950. (styleData = normalizeStyleData(childNode.data))
  6951. ) {
  6952. extend(res, styleData);
  6953. }
  6954. }
  6955. }
  6956. if ((styleData = normalizeStyleData(vnode.data))) {
  6957. extend(res, styleData);
  6958. }
  6959. var parentNode = vnode;
  6960. while ((parentNode = parentNode.parent)) {
  6961. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  6962. extend(res, styleData);
  6963. }
  6964. }
  6965. return res
  6966. }
  6967. /* */
  6968. var cssVarRE = /^--/;
  6969. var importantRE = /\s*!important$/;
  6970. var setProp = function (el, name, val) {
  6971. /* istanbul ignore if */
  6972. if (cssVarRE.test(name)) {
  6973. el.style.setProperty(name, val);
  6974. } else if (importantRE.test(val)) {
  6975. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  6976. } else {
  6977. var normalizedName = normalize(name);
  6978. if (Array.isArray(val)) {
  6979. // Support values array created by autoprefixer, e.g.
  6980. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  6981. // Set them one by one, and the browser will only set those it can recognize
  6982. for (var i = 0, len = val.length; i < len; i++) {
  6983. el.style[normalizedName] = val[i];
  6984. }
  6985. } else {
  6986. el.style[normalizedName] = val;
  6987. }
  6988. }
  6989. };
  6990. var vendorNames = ['Webkit', 'Moz', 'ms'];
  6991. var emptyStyle;
  6992. var normalize = cached(function (prop) {
  6993. emptyStyle = emptyStyle || document.createElement('div').style;
  6994. prop = camelize(prop);
  6995. if (prop !== 'filter' && (prop in emptyStyle)) {
  6996. return prop
  6997. }
  6998. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  6999. for (var i = 0; i < vendorNames.length; i++) {
  7000. var name = vendorNames[i] + capName;
  7001. if (name in emptyStyle) {
  7002. return name
  7003. }
  7004. }
  7005. });
  7006. function updateStyle (oldVnode, vnode) {
  7007. var data = vnode.data;
  7008. var oldData = oldVnode.data;
  7009. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  7010. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  7011. ) {
  7012. return
  7013. }
  7014. var cur, name;
  7015. var el = vnode.elm;
  7016. var oldStaticStyle = oldData.staticStyle;
  7017. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  7018. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  7019. var oldStyle = oldStaticStyle || oldStyleBinding;
  7020. var style = normalizeStyleBinding(vnode.data.style) || {};
  7021. // store normalized style under a different key for next diff
  7022. // make sure to clone it if it's reactive, since the user likely wants
  7023. // to mutate it.
  7024. vnode.data.normalizedStyle = isDef(style.__ob__)
  7025. ? extend({}, style)
  7026. : style;
  7027. var newStyle = getStyle(vnode, true);
  7028. for (name in oldStyle) {
  7029. if (isUndef(newStyle[name])) {
  7030. setProp(el, name, '');
  7031. }
  7032. }
  7033. for (name in newStyle) {
  7034. cur = newStyle[name];
  7035. if (cur !== oldStyle[name]) {
  7036. // ie9 setting to null has no effect, must use empty string
  7037. setProp(el, name, cur == null ? '' : cur);
  7038. }
  7039. }
  7040. }
  7041. var style = {
  7042. create: updateStyle,
  7043. update: updateStyle
  7044. };
  7045. /* */
  7046. var whitespaceRE = /\s+/;
  7047. /**
  7048. * Add class with compatibility for SVG since classList is not supported on
  7049. * SVG elements in IE
  7050. */
  7051. function addClass (el, cls) {
  7052. /* istanbul ignore if */
  7053. if (!cls || !(cls = cls.trim())) {
  7054. return
  7055. }
  7056. /* istanbul ignore else */
  7057. if (el.classList) {
  7058. if (cls.indexOf(' ') > -1) {
  7059. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  7060. } else {
  7061. el.classList.add(cls);
  7062. }
  7063. } else {
  7064. var cur = " " + (el.getAttribute('class') || '') + " ";
  7065. if (cur.indexOf(' ' + cls + ' ') < 0) {
  7066. el.setAttribute('class', (cur + cls).trim());
  7067. }
  7068. }
  7069. }
  7070. /**
  7071. * Remove class with compatibility for SVG since classList is not supported on
  7072. * SVG elements in IE
  7073. */
  7074. function removeClass (el, cls) {
  7075. /* istanbul ignore if */
  7076. if (!cls || !(cls = cls.trim())) {
  7077. return
  7078. }
  7079. /* istanbul ignore else */
  7080. if (el.classList) {
  7081. if (cls.indexOf(' ') > -1) {
  7082. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  7083. } else {
  7084. el.classList.remove(cls);
  7085. }
  7086. if (!el.classList.length) {
  7087. el.removeAttribute('class');
  7088. }
  7089. } else {
  7090. var cur = " " + (el.getAttribute('class') || '') + " ";
  7091. var tar = ' ' + cls + ' ';
  7092. while (cur.indexOf(tar) >= 0) {
  7093. cur = cur.replace(tar, ' ');
  7094. }
  7095. cur = cur.trim();
  7096. if (cur) {
  7097. el.setAttribute('class', cur);
  7098. } else {
  7099. el.removeAttribute('class');
  7100. }
  7101. }
  7102. }
  7103. /* */
  7104. function resolveTransition (def$$1) {
  7105. if (!def$$1) {
  7106. return
  7107. }
  7108. /* istanbul ignore else */
  7109. if (typeof def$$1 === 'object') {
  7110. var res = {};
  7111. if (def$$1.css !== false) {
  7112. extend(res, autoCssTransition(def$$1.name || 'v'));
  7113. }
  7114. extend(res, def$$1);
  7115. return res
  7116. } else if (typeof def$$1 === 'string') {
  7117. return autoCssTransition(def$$1)
  7118. }
  7119. }
  7120. var autoCssTransition = cached(function (name) {
  7121. return {
  7122. enterClass: (name + "-enter"),
  7123. enterToClass: (name + "-enter-to"),
  7124. enterActiveClass: (name + "-enter-active"),
  7125. leaveClass: (name + "-leave"),
  7126. leaveToClass: (name + "-leave-to"),
  7127. leaveActiveClass: (name + "-leave-active")
  7128. }
  7129. });
  7130. var hasTransition = inBrowser && !isIE9;
  7131. var TRANSITION = 'transition';
  7132. var ANIMATION = 'animation';
  7133. // Transition property/event sniffing
  7134. var transitionProp = 'transition';
  7135. var transitionEndEvent = 'transitionend';
  7136. var animationProp = 'animation';
  7137. var animationEndEvent = 'animationend';
  7138. if (hasTransition) {
  7139. /* istanbul ignore if */
  7140. if (window.ontransitionend === undefined &&
  7141. window.onwebkittransitionend !== undefined
  7142. ) {
  7143. transitionProp = 'WebkitTransition';
  7144. transitionEndEvent = 'webkitTransitionEnd';
  7145. }
  7146. if (window.onanimationend === undefined &&
  7147. window.onwebkitanimationend !== undefined
  7148. ) {
  7149. animationProp = 'WebkitAnimation';
  7150. animationEndEvent = 'webkitAnimationEnd';
  7151. }
  7152. }
  7153. // binding to window is necessary to make hot reload work in IE in strict mode
  7154. var raf = inBrowser
  7155. ? window.requestAnimationFrame
  7156. ? window.requestAnimationFrame.bind(window)
  7157. : setTimeout
  7158. : /* istanbul ignore next */ function (fn) { return fn(); };
  7159. function nextFrame (fn) {
  7160. raf(function () {
  7161. raf(fn);
  7162. });
  7163. }
  7164. function addTransitionClass (el, cls) {
  7165. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  7166. if (transitionClasses.indexOf(cls) < 0) {
  7167. transitionClasses.push(cls);
  7168. addClass(el, cls);
  7169. }
  7170. }
  7171. function removeTransitionClass (el, cls) {
  7172. if (el._transitionClasses) {
  7173. remove(el._transitionClasses, cls);
  7174. }
  7175. removeClass(el, cls);
  7176. }
  7177. function whenTransitionEnds (
  7178. el,
  7179. expectedType,
  7180. cb
  7181. ) {
  7182. var ref = getTransitionInfo(el, expectedType);
  7183. var type = ref.type;
  7184. var timeout = ref.timeout;
  7185. var propCount = ref.propCount;
  7186. if (!type) { return cb() }
  7187. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  7188. var ended = 0;
  7189. var end = function () {
  7190. el.removeEventListener(event, onEnd);
  7191. cb();
  7192. };
  7193. var onEnd = function (e) {
  7194. if (e.target === el) {
  7195. if (++ended >= propCount) {
  7196. end();
  7197. }
  7198. }
  7199. };
  7200. setTimeout(function () {
  7201. if (ended < propCount) {
  7202. end();
  7203. }
  7204. }, timeout + 1);
  7205. el.addEventListener(event, onEnd);
  7206. }
  7207. var transformRE = /\b(transform|all)(,|$)/;
  7208. function getTransitionInfo (el, expectedType) {
  7209. var styles = window.getComputedStyle(el);
  7210. // JSDOM may return undefined for transition properties
  7211. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  7212. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  7213. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  7214. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  7215. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  7216. var animationTimeout = getTimeout(animationDelays, animationDurations);
  7217. var type;
  7218. var timeout = 0;
  7219. var propCount = 0;
  7220. /* istanbul ignore if */
  7221. if (expectedType === TRANSITION) {
  7222. if (transitionTimeout > 0) {
  7223. type = TRANSITION;
  7224. timeout = transitionTimeout;
  7225. propCount = transitionDurations.length;
  7226. }
  7227. } else if (expectedType === ANIMATION) {
  7228. if (animationTimeout > 0) {
  7229. type = ANIMATION;
  7230. timeout = animationTimeout;
  7231. propCount = animationDurations.length;
  7232. }
  7233. } else {
  7234. timeout = Math.max(transitionTimeout, animationTimeout);
  7235. type = timeout > 0
  7236. ? transitionTimeout > animationTimeout
  7237. ? TRANSITION
  7238. : ANIMATION
  7239. : null;
  7240. propCount = type
  7241. ? type === TRANSITION
  7242. ? transitionDurations.length
  7243. : animationDurations.length
  7244. : 0;
  7245. }
  7246. var hasTransform =
  7247. type === TRANSITION &&
  7248. transformRE.test(styles[transitionProp + 'Property']);
  7249. return {
  7250. type: type,
  7251. timeout: timeout,
  7252. propCount: propCount,
  7253. hasTransform: hasTransform
  7254. }
  7255. }
  7256. function getTimeout (delays, durations) {
  7257. /* istanbul ignore next */
  7258. while (delays.length < durations.length) {
  7259. delays = delays.concat(delays);
  7260. }
  7261. return Math.max.apply(null, durations.map(function (d, i) {
  7262. return toMs(d) + toMs(delays[i])
  7263. }))
  7264. }
  7265. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  7266. // in a locale-dependent way, using a comma instead of a dot.
  7267. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  7268. // as a floor function) causing unexpected behaviors
  7269. function toMs (s) {
  7270. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  7271. }
  7272. /* */
  7273. function enter (vnode, toggleDisplay) {
  7274. var el = vnode.elm;
  7275. // call leave callback now
  7276. if (isDef(el._leaveCb)) {
  7277. el._leaveCb.cancelled = true;
  7278. el._leaveCb();
  7279. }
  7280. var data = resolveTransition(vnode.data.transition);
  7281. if (isUndef(data)) {
  7282. return
  7283. }
  7284. /* istanbul ignore if */
  7285. if (isDef(el._enterCb) || el.nodeType !== 1) {
  7286. return
  7287. }
  7288. var css = data.css;
  7289. var type = data.type;
  7290. var enterClass = data.enterClass;
  7291. var enterToClass = data.enterToClass;
  7292. var enterActiveClass = data.enterActiveClass;
  7293. var appearClass = data.appearClass;
  7294. var appearToClass = data.appearToClass;
  7295. var appearActiveClass = data.appearActiveClass;
  7296. var beforeEnter = data.beforeEnter;
  7297. var enter = data.enter;
  7298. var afterEnter = data.afterEnter;
  7299. var enterCancelled = data.enterCancelled;
  7300. var beforeAppear = data.beforeAppear;
  7301. var appear = data.appear;
  7302. var afterAppear = data.afterAppear;
  7303. var appearCancelled = data.appearCancelled;
  7304. var duration = data.duration;
  7305. // activeInstance will always be the <transition> component managing this
  7306. // transition. One edge case to check is when the <transition> is placed
  7307. // as the root node of a child component. In that case we need to check
  7308. // <transition>'s parent for appear check.
  7309. var context = activeInstance;
  7310. var transitionNode = activeInstance.$vnode;
  7311. while (transitionNode && transitionNode.parent) {
  7312. transitionNode = transitionNode.parent;
  7313. context = transitionNode.context;
  7314. }
  7315. var isAppear = !context._isMounted || !vnode.isRootInsert;
  7316. if (isAppear && !appear && appear !== '') {
  7317. return
  7318. }
  7319. var startClass = isAppear && appearClass
  7320. ? appearClass
  7321. : enterClass;
  7322. var activeClass = isAppear && appearActiveClass
  7323. ? appearActiveClass
  7324. : enterActiveClass;
  7325. var toClass = isAppear && appearToClass
  7326. ? appearToClass
  7327. : enterToClass;
  7328. var beforeEnterHook = isAppear
  7329. ? (beforeAppear || beforeEnter)
  7330. : beforeEnter;
  7331. var enterHook = isAppear
  7332. ? (typeof appear === 'function' ? appear : enter)
  7333. : enter;
  7334. var afterEnterHook = isAppear
  7335. ? (afterAppear || afterEnter)
  7336. : afterEnter;
  7337. var enterCancelledHook = isAppear
  7338. ? (appearCancelled || enterCancelled)
  7339. : enterCancelled;
  7340. var explicitEnterDuration = toNumber(
  7341. isObject(duration)
  7342. ? duration.enter
  7343. : duration
  7344. );
  7345. if (explicitEnterDuration != null) {
  7346. checkDuration(explicitEnterDuration, 'enter', vnode);
  7347. }
  7348. var expectsCSS = css !== false && !isIE9;
  7349. var userWantsControl = getHookArgumentsLength(enterHook);
  7350. var cb = el._enterCb = once(function () {
  7351. if (expectsCSS) {
  7352. removeTransitionClass(el, toClass);
  7353. removeTransitionClass(el, activeClass);
  7354. }
  7355. if (cb.cancelled) {
  7356. if (expectsCSS) {
  7357. removeTransitionClass(el, startClass);
  7358. }
  7359. enterCancelledHook && enterCancelledHook(el);
  7360. } else {
  7361. afterEnterHook && afterEnterHook(el);
  7362. }
  7363. el._enterCb = null;
  7364. });
  7365. if (!vnode.data.show) {
  7366. // remove pending leave element on enter by injecting an insert hook
  7367. mergeVNodeHook(vnode, 'insert', function () {
  7368. var parent = el.parentNode;
  7369. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  7370. if (pendingNode &&
  7371. pendingNode.tag === vnode.tag &&
  7372. pendingNode.elm._leaveCb
  7373. ) {
  7374. pendingNode.elm._leaveCb();
  7375. }
  7376. enterHook && enterHook(el, cb);
  7377. });
  7378. }
  7379. // start enter transition
  7380. beforeEnterHook && beforeEnterHook(el);
  7381. if (expectsCSS) {
  7382. addTransitionClass(el, startClass);
  7383. addTransitionClass(el, activeClass);
  7384. nextFrame(function () {
  7385. removeTransitionClass(el, startClass);
  7386. if (!cb.cancelled) {
  7387. addTransitionClass(el, toClass);
  7388. if (!userWantsControl) {
  7389. if (isValidDuration(explicitEnterDuration)) {
  7390. setTimeout(cb, explicitEnterDuration);
  7391. } else {
  7392. whenTransitionEnds(el, type, cb);
  7393. }
  7394. }
  7395. }
  7396. });
  7397. }
  7398. if (vnode.data.show) {
  7399. toggleDisplay && toggleDisplay();
  7400. enterHook && enterHook(el, cb);
  7401. }
  7402. if (!expectsCSS && !userWantsControl) {
  7403. cb();
  7404. }
  7405. }
  7406. function leave (vnode, rm) {
  7407. var el = vnode.elm;
  7408. // call enter callback now
  7409. if (isDef(el._enterCb)) {
  7410. el._enterCb.cancelled = true;
  7411. el._enterCb();
  7412. }
  7413. var data = resolveTransition(vnode.data.transition);
  7414. if (isUndef(data) || el.nodeType !== 1) {
  7415. return rm()
  7416. }
  7417. /* istanbul ignore if */
  7418. if (isDef(el._leaveCb)) {
  7419. return
  7420. }
  7421. var css = data.css;
  7422. var type = data.type;
  7423. var leaveClass = data.leaveClass;
  7424. var leaveToClass = data.leaveToClass;
  7425. var leaveActiveClass = data.leaveActiveClass;
  7426. var beforeLeave = data.beforeLeave;
  7427. var leave = data.leave;
  7428. var afterLeave = data.afterLeave;
  7429. var leaveCancelled = data.leaveCancelled;
  7430. var delayLeave = data.delayLeave;
  7431. var duration = data.duration;
  7432. var expectsCSS = css !== false && !isIE9;
  7433. var userWantsControl = getHookArgumentsLength(leave);
  7434. var explicitLeaveDuration = toNumber(
  7435. isObject(duration)
  7436. ? duration.leave
  7437. : duration
  7438. );
  7439. if (isDef(explicitLeaveDuration)) {
  7440. checkDuration(explicitLeaveDuration, 'leave', vnode);
  7441. }
  7442. var cb = el._leaveCb = once(function () {
  7443. if (el.parentNode && el.parentNode._pending) {
  7444. el.parentNode._pending[vnode.key] = null;
  7445. }
  7446. if (expectsCSS) {
  7447. removeTransitionClass(el, leaveToClass);
  7448. removeTransitionClass(el, leaveActiveClass);
  7449. }
  7450. if (cb.cancelled) {
  7451. if (expectsCSS) {
  7452. removeTransitionClass(el, leaveClass);
  7453. }
  7454. leaveCancelled && leaveCancelled(el);
  7455. } else {
  7456. rm();
  7457. afterLeave && afterLeave(el);
  7458. }
  7459. el._leaveCb = null;
  7460. });
  7461. if (delayLeave) {
  7462. delayLeave(performLeave);
  7463. } else {
  7464. performLeave();
  7465. }
  7466. function performLeave () {
  7467. // the delayed leave may have already been cancelled
  7468. if (cb.cancelled) {
  7469. return
  7470. }
  7471. // record leaving element
  7472. if (!vnode.data.show && el.parentNode) {
  7473. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  7474. }
  7475. beforeLeave && beforeLeave(el);
  7476. if (expectsCSS) {
  7477. addTransitionClass(el, leaveClass);
  7478. addTransitionClass(el, leaveActiveClass);
  7479. nextFrame(function () {
  7480. removeTransitionClass(el, leaveClass);
  7481. if (!cb.cancelled) {
  7482. addTransitionClass(el, leaveToClass);
  7483. if (!userWantsControl) {
  7484. if (isValidDuration(explicitLeaveDuration)) {
  7485. setTimeout(cb, explicitLeaveDuration);
  7486. } else {
  7487. whenTransitionEnds(el, type, cb);
  7488. }
  7489. }
  7490. }
  7491. });
  7492. }
  7493. leave && leave(el, cb);
  7494. if (!expectsCSS && !userWantsControl) {
  7495. cb();
  7496. }
  7497. }
  7498. }
  7499. // only used in dev mode
  7500. function checkDuration (val, name, vnode) {
  7501. if (typeof val !== 'number') {
  7502. warn(
  7503. "<transition> explicit " + name + " duration is not a valid number - " +
  7504. "got " + (JSON.stringify(val)) + ".",
  7505. vnode.context
  7506. );
  7507. } else if (isNaN(val)) {
  7508. warn(
  7509. "<transition> explicit " + name + " duration is NaN - " +
  7510. 'the duration expression might be incorrect.',
  7511. vnode.context
  7512. );
  7513. }
  7514. }
  7515. function isValidDuration (val) {
  7516. return typeof val === 'number' && !isNaN(val)
  7517. }
  7518. /**
  7519. * Normalize a transition hook's argument length. The hook may be:
  7520. * - a merged hook (invoker) with the original in .fns
  7521. * - a wrapped component method (check ._length)
  7522. * - a plain function (.length)
  7523. */
  7524. function getHookArgumentsLength (fn) {
  7525. if (isUndef(fn)) {
  7526. return false
  7527. }
  7528. var invokerFns = fn.fns;
  7529. if (isDef(invokerFns)) {
  7530. // invoker
  7531. return getHookArgumentsLength(
  7532. Array.isArray(invokerFns)
  7533. ? invokerFns[0]
  7534. : invokerFns
  7535. )
  7536. } else {
  7537. return (fn._length || fn.length) > 1
  7538. }
  7539. }
  7540. function _enter (_, vnode) {
  7541. if (vnode.data.show !== true) {
  7542. enter(vnode);
  7543. }
  7544. }
  7545. var transition = inBrowser ? {
  7546. create: _enter,
  7547. activate: _enter,
  7548. remove: function remove$$1 (vnode, rm) {
  7549. /* istanbul ignore else */
  7550. if (vnode.data.show !== true) {
  7551. leave(vnode, rm);
  7552. } else {
  7553. rm();
  7554. }
  7555. }
  7556. } : {};
  7557. var platformModules = [
  7558. attrs,
  7559. klass,
  7560. events,
  7561. domProps,
  7562. style,
  7563. transition
  7564. ];
  7565. /* */
  7566. // the directive module should be applied last, after all
  7567. // built-in modules have been applied.
  7568. var modules = platformModules.concat(baseModules);
  7569. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  7570. /**
  7571. * Not type checking this file because flow doesn't like attaching
  7572. * properties to Elements.
  7573. */
  7574. /* istanbul ignore if */
  7575. if (isIE9) {
  7576. // http://www.matts411.com/post/internet-explorer-9-oninput/
  7577. document.addEventListener('selectionchange', function () {
  7578. var el = document.activeElement;
  7579. if (el && el.vmodel) {
  7580. trigger(el, 'input');
  7581. }
  7582. });
  7583. }
  7584. var directive = {
  7585. inserted: function inserted (el, binding, vnode, oldVnode) {
  7586. if (vnode.tag === 'select') {
  7587. // #6903
  7588. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  7589. mergeVNodeHook(vnode, 'postpatch', function () {
  7590. directive.componentUpdated(el, binding, vnode);
  7591. });
  7592. } else {
  7593. setSelected(el, binding, vnode.context);
  7594. }
  7595. el._vOptions = [].map.call(el.options, getValue);
  7596. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  7597. el._vModifiers = binding.modifiers;
  7598. if (!binding.modifiers.lazy) {
  7599. el.addEventListener('compositionstart', onCompositionStart);
  7600. el.addEventListener('compositionend', onCompositionEnd);
  7601. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  7602. // switching focus before confirming composition choice
  7603. // this also fixes the issue where some browsers e.g. iOS Chrome
  7604. // fires "change" instead of "input" on autocomplete.
  7605. el.addEventListener('change', onCompositionEnd);
  7606. /* istanbul ignore if */
  7607. if (isIE9) {
  7608. el.vmodel = true;
  7609. }
  7610. }
  7611. }
  7612. },
  7613. componentUpdated: function componentUpdated (el, binding, vnode) {
  7614. if (vnode.tag === 'select') {
  7615. setSelected(el, binding, vnode.context);
  7616. // in case the options rendered by v-for have changed,
  7617. // it's possible that the value is out-of-sync with the rendered options.
  7618. // detect such cases and filter out values that no longer has a matching
  7619. // option in the DOM.
  7620. var prevOptions = el._vOptions;
  7621. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  7622. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  7623. // trigger change event if
  7624. // no matching option found for at least one value
  7625. var needReset = el.multiple
  7626. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  7627. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  7628. if (needReset) {
  7629. trigger(el, 'change');
  7630. }
  7631. }
  7632. }
  7633. }
  7634. };
  7635. function setSelected (el, binding, vm) {
  7636. actuallySetSelected(el, binding, vm);
  7637. /* istanbul ignore if */
  7638. if (isIE || isEdge) {
  7639. setTimeout(function () {
  7640. actuallySetSelected(el, binding, vm);
  7641. }, 0);
  7642. }
  7643. }
  7644. function actuallySetSelected (el, binding, vm) {
  7645. var value = binding.value;
  7646. var isMultiple = el.multiple;
  7647. if (isMultiple && !Array.isArray(value)) {
  7648. warn(
  7649. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  7650. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  7651. vm
  7652. );
  7653. return
  7654. }
  7655. var selected, option;
  7656. for (var i = 0, l = el.options.length; i < l; i++) {
  7657. option = el.options[i];
  7658. if (isMultiple) {
  7659. selected = looseIndexOf(value, getValue(option)) > -1;
  7660. if (option.selected !== selected) {
  7661. option.selected = selected;
  7662. }
  7663. } else {
  7664. if (looseEqual(getValue(option), value)) {
  7665. if (el.selectedIndex !== i) {
  7666. el.selectedIndex = i;
  7667. }
  7668. return
  7669. }
  7670. }
  7671. }
  7672. if (!isMultiple) {
  7673. el.selectedIndex = -1;
  7674. }
  7675. }
  7676. function hasNoMatchingOption (value, options) {
  7677. return options.every(function (o) { return !looseEqual(o, value); })
  7678. }
  7679. function getValue (option) {
  7680. return '_value' in option
  7681. ? option._value
  7682. : option.value
  7683. }
  7684. function onCompositionStart (e) {
  7685. e.target.composing = true;
  7686. }
  7687. function onCompositionEnd (e) {
  7688. // prevent triggering an input event for no reason
  7689. if (!e.target.composing) { return }
  7690. e.target.composing = false;
  7691. trigger(e.target, 'input');
  7692. }
  7693. function trigger (el, type) {
  7694. var e = document.createEvent('HTMLEvents');
  7695. e.initEvent(type, true, true);
  7696. el.dispatchEvent(e);
  7697. }
  7698. /* */
  7699. // recursively search for possible transition defined inside the component root
  7700. function locateNode (vnode) {
  7701. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  7702. ? locateNode(vnode.componentInstance._vnode)
  7703. : vnode
  7704. }
  7705. var show = {
  7706. bind: function bind (el, ref, vnode) {
  7707. var value = ref.value;
  7708. vnode = locateNode(vnode);
  7709. var transition$$1 = vnode.data && vnode.data.transition;
  7710. var originalDisplay = el.__vOriginalDisplay =
  7711. el.style.display === 'none' ? '' : el.style.display;
  7712. if (value && transition$$1) {
  7713. vnode.data.show = true;
  7714. enter(vnode, function () {
  7715. el.style.display = originalDisplay;
  7716. });
  7717. } else {
  7718. el.style.display = value ? originalDisplay : 'none';
  7719. }
  7720. },
  7721. update: function update (el, ref, vnode) {
  7722. var value = ref.value;
  7723. var oldValue = ref.oldValue;
  7724. /* istanbul ignore if */
  7725. if (!value === !oldValue) { return }
  7726. vnode = locateNode(vnode);
  7727. var transition$$1 = vnode.data && vnode.data.transition;
  7728. if (transition$$1) {
  7729. vnode.data.show = true;
  7730. if (value) {
  7731. enter(vnode, function () {
  7732. el.style.display = el.__vOriginalDisplay;
  7733. });
  7734. } else {
  7735. leave(vnode, function () {
  7736. el.style.display = 'none';
  7737. });
  7738. }
  7739. } else {
  7740. el.style.display = value ? el.__vOriginalDisplay : 'none';
  7741. }
  7742. },
  7743. unbind: function unbind (
  7744. el,
  7745. binding,
  7746. vnode,
  7747. oldVnode,
  7748. isDestroy
  7749. ) {
  7750. if (!isDestroy) {
  7751. el.style.display = el.__vOriginalDisplay;
  7752. }
  7753. }
  7754. };
  7755. var platformDirectives = {
  7756. model: directive,
  7757. show: show
  7758. };
  7759. /* */
  7760. var transitionProps = {
  7761. name: String,
  7762. appear: Boolean,
  7763. css: Boolean,
  7764. mode: String,
  7765. type: String,
  7766. enterClass: String,
  7767. leaveClass: String,
  7768. enterToClass: String,
  7769. leaveToClass: String,
  7770. enterActiveClass: String,
  7771. leaveActiveClass: String,
  7772. appearClass: String,
  7773. appearActiveClass: String,
  7774. appearToClass: String,
  7775. duration: [Number, String, Object]
  7776. };
  7777. // in case the child is also an abstract component, e.g. <keep-alive>
  7778. // we want to recursively retrieve the real component to be rendered
  7779. function getRealChild (vnode) {
  7780. var compOptions = vnode && vnode.componentOptions;
  7781. if (compOptions && compOptions.Ctor.options.abstract) {
  7782. return getRealChild(getFirstComponentChild(compOptions.children))
  7783. } else {
  7784. return vnode
  7785. }
  7786. }
  7787. function extractTransitionData (comp) {
  7788. var data = {};
  7789. var options = comp.$options;
  7790. // props
  7791. for (var key in options.propsData) {
  7792. data[key] = comp[key];
  7793. }
  7794. // events.
  7795. // extract listeners and pass them directly to the transition methods
  7796. var listeners = options._parentListeners;
  7797. for (var key$1 in listeners) {
  7798. data[camelize(key$1)] = listeners[key$1];
  7799. }
  7800. return data
  7801. }
  7802. function placeholder (h, rawChild) {
  7803. if (/\d-keep-alive$/.test(rawChild.tag)) {
  7804. return h('keep-alive', {
  7805. props: rawChild.componentOptions.propsData
  7806. })
  7807. }
  7808. }
  7809. function hasParentTransition (vnode) {
  7810. while ((vnode = vnode.parent)) {
  7811. if (vnode.data.transition) {
  7812. return true
  7813. }
  7814. }
  7815. }
  7816. function isSameChild (child, oldChild) {
  7817. return oldChild.key === child.key && oldChild.tag === child.tag
  7818. }
  7819. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  7820. var isVShowDirective = function (d) { return d.name === 'show'; };
  7821. var Transition = {
  7822. name: 'transition',
  7823. props: transitionProps,
  7824. abstract: true,
  7825. render: function render (h) {
  7826. var this$1 = this;
  7827. var children = this.$slots.default;
  7828. if (!children) {
  7829. return
  7830. }
  7831. // filter out text nodes (possible whitespaces)
  7832. children = children.filter(isNotTextNode);
  7833. /* istanbul ignore if */
  7834. if (!children.length) {
  7835. return
  7836. }
  7837. // warn multiple elements
  7838. if (children.length > 1) {
  7839. warn(
  7840. '<transition> can only be used on a single element. Use ' +
  7841. '<transition-group> for lists.',
  7842. this.$parent
  7843. );
  7844. }
  7845. var mode = this.mode;
  7846. // warn invalid mode
  7847. if (mode && mode !== 'in-out' && mode !== 'out-in'
  7848. ) {
  7849. warn(
  7850. 'invalid <transition> mode: ' + mode,
  7851. this.$parent
  7852. );
  7853. }
  7854. var rawChild = children[0];
  7855. // if this is a component root node and the component's
  7856. // parent container node also has transition, skip.
  7857. if (hasParentTransition(this.$vnode)) {
  7858. return rawChild
  7859. }
  7860. // apply transition data to child
  7861. // use getRealChild() to ignore abstract components e.g. keep-alive
  7862. var child = getRealChild(rawChild);
  7863. /* istanbul ignore if */
  7864. if (!child) {
  7865. return rawChild
  7866. }
  7867. if (this._leaving) {
  7868. return placeholder(h, rawChild)
  7869. }
  7870. // ensure a key that is unique to the vnode type and to this transition
  7871. // component instance. This key will be used to remove pending leaving nodes
  7872. // during entering.
  7873. var id = "__transition-" + (this._uid) + "-";
  7874. child.key = child.key == null
  7875. ? child.isComment
  7876. ? id + 'comment'
  7877. : id + child.tag
  7878. : isPrimitive(child.key)
  7879. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  7880. : child.key;
  7881. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  7882. var oldRawChild = this._vnode;
  7883. var oldChild = getRealChild(oldRawChild);
  7884. // mark v-show
  7885. // so that the transition module can hand over the control to the directive
  7886. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  7887. child.data.show = true;
  7888. }
  7889. if (
  7890. oldChild &&
  7891. oldChild.data &&
  7892. !isSameChild(child, oldChild) &&
  7893. !isAsyncPlaceholder(oldChild) &&
  7894. // #6687 component root is a comment node
  7895. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  7896. ) {
  7897. // replace old child transition data with fresh one
  7898. // important for dynamic transitions!
  7899. var oldData = oldChild.data.transition = extend({}, data);
  7900. // handle transition mode
  7901. if (mode === 'out-in') {
  7902. // return placeholder node and queue update when leave finishes
  7903. this._leaving = true;
  7904. mergeVNodeHook(oldData, 'afterLeave', function () {
  7905. this$1._leaving = false;
  7906. this$1.$forceUpdate();
  7907. });
  7908. return placeholder(h, rawChild)
  7909. } else if (mode === 'in-out') {
  7910. if (isAsyncPlaceholder(child)) {
  7911. return oldRawChild
  7912. }
  7913. var delayedLeave;
  7914. var performLeave = function () { delayedLeave(); };
  7915. mergeVNodeHook(data, 'afterEnter', performLeave);
  7916. mergeVNodeHook(data, 'enterCancelled', performLeave);
  7917. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  7918. }
  7919. }
  7920. return rawChild
  7921. }
  7922. };
  7923. /* */
  7924. var props = extend({
  7925. tag: String,
  7926. moveClass: String
  7927. }, transitionProps);
  7928. delete props.mode;
  7929. var TransitionGroup = {
  7930. props: props,
  7931. beforeMount: function beforeMount () {
  7932. var this$1 = this;
  7933. var update = this._update;
  7934. this._update = function (vnode, hydrating) {
  7935. var restoreActiveInstance = setActiveInstance(this$1);
  7936. // force removing pass
  7937. this$1.__patch__(
  7938. this$1._vnode,
  7939. this$1.kept,
  7940. false, // hydrating
  7941. true // removeOnly (!important, avoids unnecessary moves)
  7942. );
  7943. this$1._vnode = this$1.kept;
  7944. restoreActiveInstance();
  7945. update.call(this$1, vnode, hydrating);
  7946. };
  7947. },
  7948. render: function render (h) {
  7949. var tag = this.tag || this.$vnode.data.tag || 'span';
  7950. var map = Object.create(null);
  7951. var prevChildren = this.prevChildren = this.children;
  7952. var rawChildren = this.$slots.default || [];
  7953. var children = this.children = [];
  7954. var transitionData = extractTransitionData(this);
  7955. for (var i = 0; i < rawChildren.length; i++) {
  7956. var c = rawChildren[i];
  7957. if (c.tag) {
  7958. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  7959. children.push(c);
  7960. map[c.key] = c
  7961. ;(c.data || (c.data = {})).transition = transitionData;
  7962. } else {
  7963. var opts = c.componentOptions;
  7964. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  7965. warn(("<transition-group> children must be keyed: <" + name + ">"));
  7966. }
  7967. }
  7968. }
  7969. if (prevChildren) {
  7970. var kept = [];
  7971. var removed = [];
  7972. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  7973. var c$1 = prevChildren[i$1];
  7974. c$1.data.transition = transitionData;
  7975. c$1.data.pos = c$1.elm.getBoundingClientRect();
  7976. if (map[c$1.key]) {
  7977. kept.push(c$1);
  7978. } else {
  7979. removed.push(c$1);
  7980. }
  7981. }
  7982. this.kept = h(tag, null, kept);
  7983. this.removed = removed;
  7984. }
  7985. return h(tag, null, children)
  7986. },
  7987. updated: function updated () {
  7988. var children = this.prevChildren;
  7989. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  7990. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  7991. return
  7992. }
  7993. // we divide the work into three loops to avoid mixing DOM reads and writes
  7994. // in each iteration - which helps prevent layout thrashing.
  7995. children.forEach(callPendingCbs);
  7996. children.forEach(recordPosition);
  7997. children.forEach(applyTranslation);
  7998. // force reflow to put everything in position
  7999. // assign to this to avoid being removed in tree-shaking
  8000. // $flow-disable-line
  8001. this._reflow = document.body.offsetHeight;
  8002. children.forEach(function (c) {
  8003. if (c.data.moved) {
  8004. var el = c.elm;
  8005. var s = el.style;
  8006. addTransitionClass(el, moveClass);
  8007. s.transform = s.WebkitTransform = s.transitionDuration = '';
  8008. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  8009. if (e && e.target !== el) {
  8010. return
  8011. }
  8012. if (!e || /transform$/.test(e.propertyName)) {
  8013. el.removeEventListener(transitionEndEvent, cb);
  8014. el._moveCb = null;
  8015. removeTransitionClass(el, moveClass);
  8016. }
  8017. });
  8018. }
  8019. });
  8020. },
  8021. methods: {
  8022. hasMove: function hasMove (el, moveClass) {
  8023. /* istanbul ignore if */
  8024. if (!hasTransition) {
  8025. return false
  8026. }
  8027. /* istanbul ignore if */
  8028. if (this._hasMove) {
  8029. return this._hasMove
  8030. }
  8031. // Detect whether an element with the move class applied has
  8032. // CSS transitions. Since the element may be inside an entering
  8033. // transition at this very moment, we make a clone of it and remove
  8034. // all other transition classes applied to ensure only the move class
  8035. // is applied.
  8036. var clone = el.cloneNode();
  8037. if (el._transitionClasses) {
  8038. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  8039. }
  8040. addClass(clone, moveClass);
  8041. clone.style.display = 'none';
  8042. this.$el.appendChild(clone);
  8043. var info = getTransitionInfo(clone);
  8044. this.$el.removeChild(clone);
  8045. return (this._hasMove = info.hasTransform)
  8046. }
  8047. }
  8048. };
  8049. function callPendingCbs (c) {
  8050. /* istanbul ignore if */
  8051. if (c.elm._moveCb) {
  8052. c.elm._moveCb();
  8053. }
  8054. /* istanbul ignore if */
  8055. if (c.elm._enterCb) {
  8056. c.elm._enterCb();
  8057. }
  8058. }
  8059. function recordPosition (c) {
  8060. c.data.newPos = c.elm.getBoundingClientRect();
  8061. }
  8062. function applyTranslation (c) {
  8063. var oldPos = c.data.pos;
  8064. var newPos = c.data.newPos;
  8065. var dx = oldPos.left - newPos.left;
  8066. var dy = oldPos.top - newPos.top;
  8067. if (dx || dy) {
  8068. c.data.moved = true;
  8069. var s = c.elm.style;
  8070. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  8071. s.transitionDuration = '0s';
  8072. }
  8073. }
  8074. var platformComponents = {
  8075. Transition: Transition,
  8076. TransitionGroup: TransitionGroup
  8077. };
  8078. /* */
  8079. // install platform specific utils
  8080. Vue.config.mustUseProp = mustUseProp;
  8081. Vue.config.isReservedTag = isReservedTag;
  8082. Vue.config.isReservedAttr = isReservedAttr;
  8083. Vue.config.getTagNamespace = getTagNamespace;
  8084. Vue.config.isUnknownElement = isUnknownElement;
  8085. // install platform runtime directives & components
  8086. extend(Vue.options.directives, platformDirectives);
  8087. extend(Vue.options.components, platformComponents);
  8088. // install platform patch function
  8089. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  8090. // public mount method
  8091. Vue.prototype.$mount = function (
  8092. el,
  8093. hydrating
  8094. ) {
  8095. el = el && inBrowser ? query(el) : undefined;
  8096. return mountComponent(this, el, hydrating)
  8097. };
  8098. // devtools global hook
  8099. /* istanbul ignore next */
  8100. if (inBrowser) {
  8101. setTimeout(function () {
  8102. if (config.devtools) {
  8103. if (devtools) {
  8104. devtools.emit('init', Vue);
  8105. } else {
  8106. console[console.info ? 'info' : 'log'](
  8107. 'Download the Vue Devtools extension for a better development experience:\n' +
  8108. 'https://github.com/vuejs/vue-devtools'
  8109. );
  8110. }
  8111. }
  8112. if (config.productionTip !== false &&
  8113. typeof console !== 'undefined'
  8114. ) {
  8115. console[console.info ? 'info' : 'log'](
  8116. "You are running Vue in development mode.\n" +
  8117. "Make sure to turn on production mode when deploying for production.\n" +
  8118. "See more tips at https://vuejs.org/guide/deployment.html"
  8119. );
  8120. }
  8121. }, 0);
  8122. }
  8123. /* */
  8124. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  8125. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  8126. var buildRegex = cached(function (delimiters) {
  8127. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  8128. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  8129. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  8130. });
  8131. function parseText (
  8132. text,
  8133. delimiters
  8134. ) {
  8135. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  8136. if (!tagRE.test(text)) {
  8137. return
  8138. }
  8139. var tokens = [];
  8140. var rawTokens = [];
  8141. var lastIndex = tagRE.lastIndex = 0;
  8142. var match, index, tokenValue;
  8143. while ((match = tagRE.exec(text))) {
  8144. index = match.index;
  8145. // push text token
  8146. if (index > lastIndex) {
  8147. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  8148. tokens.push(JSON.stringify(tokenValue));
  8149. }
  8150. // tag token
  8151. var exp = parseFilters(match[1].trim());
  8152. tokens.push(("_s(" + exp + ")"));
  8153. rawTokens.push({ '@binding': exp });
  8154. lastIndex = index + match[0].length;
  8155. }
  8156. if (lastIndex < text.length) {
  8157. rawTokens.push(tokenValue = text.slice(lastIndex));
  8158. tokens.push(JSON.stringify(tokenValue));
  8159. }
  8160. return {
  8161. expression: tokens.join('+'),
  8162. tokens: rawTokens
  8163. }
  8164. }
  8165. /* */
  8166. function transformNode (el, options) {
  8167. var warn = options.warn || baseWarn;
  8168. var staticClass = getAndRemoveAttr(el, 'class');
  8169. if (staticClass) {
  8170. var res = parseText(staticClass, options.delimiters);
  8171. if (res) {
  8172. warn(
  8173. "class=\"" + staticClass + "\": " +
  8174. 'Interpolation inside attributes has been removed. ' +
  8175. 'Use v-bind or the colon shorthand instead. For example, ' +
  8176. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  8177. el.rawAttrsMap['class']
  8178. );
  8179. }
  8180. }
  8181. if (staticClass) {
  8182. el.staticClass = JSON.stringify(staticClass);
  8183. }
  8184. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  8185. if (classBinding) {
  8186. el.classBinding = classBinding;
  8187. }
  8188. }
  8189. function genData (el) {
  8190. var data = '';
  8191. if (el.staticClass) {
  8192. data += "staticClass:" + (el.staticClass) + ",";
  8193. }
  8194. if (el.classBinding) {
  8195. data += "class:" + (el.classBinding) + ",";
  8196. }
  8197. return data
  8198. }
  8199. var klass$1 = {
  8200. staticKeys: ['staticClass'],
  8201. transformNode: transformNode,
  8202. genData: genData
  8203. };
  8204. /* */
  8205. function transformNode$1 (el, options) {
  8206. var warn = options.warn || baseWarn;
  8207. var staticStyle = getAndRemoveAttr(el, 'style');
  8208. if (staticStyle) {
  8209. /* istanbul ignore if */
  8210. {
  8211. var res = parseText(staticStyle, options.delimiters);
  8212. if (res) {
  8213. warn(
  8214. "style=\"" + staticStyle + "\": " +
  8215. 'Interpolation inside attributes has been removed. ' +
  8216. 'Use v-bind or the colon shorthand instead. For example, ' +
  8217. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  8218. el.rawAttrsMap['style']
  8219. );
  8220. }
  8221. }
  8222. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  8223. }
  8224. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  8225. if (styleBinding) {
  8226. el.styleBinding = styleBinding;
  8227. }
  8228. }
  8229. function genData$1 (el) {
  8230. var data = '';
  8231. if (el.staticStyle) {
  8232. data += "staticStyle:" + (el.staticStyle) + ",";
  8233. }
  8234. if (el.styleBinding) {
  8235. data += "style:(" + (el.styleBinding) + "),";
  8236. }
  8237. return data
  8238. }
  8239. var style$1 = {
  8240. staticKeys: ['staticStyle'],
  8241. transformNode: transformNode$1,
  8242. genData: genData$1
  8243. };
  8244. /* */
  8245. var decoder;
  8246. var he = {
  8247. decode: function decode (html) {
  8248. decoder = decoder || document.createElement('div');
  8249. decoder.innerHTML = html;
  8250. return decoder.textContent
  8251. }
  8252. };
  8253. /* */
  8254. var isUnaryTag = makeMap(
  8255. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  8256. 'link,meta,param,source,track,wbr'
  8257. );
  8258. // Elements that you can, intentionally, leave open
  8259. // (and which close themselves)
  8260. var canBeLeftOpenTag = makeMap(
  8261. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  8262. );
  8263. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  8264. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  8265. var isNonPhrasingTag = makeMap(
  8266. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  8267. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  8268. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  8269. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  8270. 'title,tr,track'
  8271. );
  8272. /**
  8273. * Not type-checking this file because it's mostly vendor code.
  8274. */
  8275. // Regular Expressions for parsing tags and attributes
  8276. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  8277. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  8278. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + unicodeLetters + "]*";
  8279. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  8280. var startTagOpen = new RegExp(("^<" + qnameCapture));
  8281. var startTagClose = /^\s*(\/?)>/;
  8282. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  8283. var doctype = /^<!DOCTYPE [^>]+>/i;
  8284. // #7298: escape - to avoid being pased as HTML comment when inlined in page
  8285. var comment = /^<!\--/;
  8286. var conditionalComment = /^<!\[/;
  8287. // Special Elements (can contain anything)
  8288. var isPlainTextElement = makeMap('script,style,textarea', true);
  8289. var reCache = {};
  8290. var decodingMap = {
  8291. '&lt;': '<',
  8292. '&gt;': '>',
  8293. '&quot;': '"',
  8294. '&amp;': '&',
  8295. '&#10;': '\n',
  8296. '&#9;': '\t',
  8297. '&#39;': "'"
  8298. };
  8299. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  8300. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  8301. // #5992
  8302. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  8303. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  8304. function decodeAttr (value, shouldDecodeNewlines) {
  8305. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  8306. return value.replace(re, function (match) { return decodingMap[match]; })
  8307. }
  8308. function parseHTML (html, options) {
  8309. var stack = [];
  8310. var expectHTML = options.expectHTML;
  8311. var isUnaryTag$$1 = options.isUnaryTag || no;
  8312. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  8313. var index = 0;
  8314. var last, lastTag;
  8315. while (html) {
  8316. last = html;
  8317. // Make sure we're not in a plaintext content element like script/style
  8318. if (!lastTag || !isPlainTextElement(lastTag)) {
  8319. var textEnd = html.indexOf('<');
  8320. if (textEnd === 0) {
  8321. // Comment:
  8322. if (comment.test(html)) {
  8323. var commentEnd = html.indexOf('-->');
  8324. if (commentEnd >= 0) {
  8325. if (options.shouldKeepComment) {
  8326. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  8327. }
  8328. advance(commentEnd + 3);
  8329. continue
  8330. }
  8331. }
  8332. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  8333. if (conditionalComment.test(html)) {
  8334. var conditionalEnd = html.indexOf(']>');
  8335. if (conditionalEnd >= 0) {
  8336. advance(conditionalEnd + 2);
  8337. continue
  8338. }
  8339. }
  8340. // Doctype:
  8341. var doctypeMatch = html.match(doctype);
  8342. if (doctypeMatch) {
  8343. advance(doctypeMatch[0].length);
  8344. continue
  8345. }
  8346. // End tag:
  8347. var endTagMatch = html.match(endTag);
  8348. if (endTagMatch) {
  8349. var curIndex = index;
  8350. advance(endTagMatch[0].length);
  8351. parseEndTag(endTagMatch[1], curIndex, index);
  8352. continue
  8353. }
  8354. // Start tag:
  8355. var startTagMatch = parseStartTag();
  8356. if (startTagMatch) {
  8357. handleStartTag(startTagMatch);
  8358. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  8359. advance(1);
  8360. }
  8361. continue
  8362. }
  8363. }
  8364. var text = (void 0), rest = (void 0), next = (void 0);
  8365. if (textEnd >= 0) {
  8366. rest = html.slice(textEnd);
  8367. while (
  8368. !endTag.test(rest) &&
  8369. !startTagOpen.test(rest) &&
  8370. !comment.test(rest) &&
  8371. !conditionalComment.test(rest)
  8372. ) {
  8373. // < in plain text, be forgiving and treat it as text
  8374. next = rest.indexOf('<', 1);
  8375. if (next < 0) { break }
  8376. textEnd += next;
  8377. rest = html.slice(textEnd);
  8378. }
  8379. text = html.substring(0, textEnd);
  8380. }
  8381. if (textEnd < 0) {
  8382. text = html;
  8383. }
  8384. if (text) {
  8385. advance(text.length);
  8386. }
  8387. if (options.chars && text) {
  8388. options.chars(text, index - text.length, index);
  8389. }
  8390. } else {
  8391. var endTagLength = 0;
  8392. var stackedTag = lastTag.toLowerCase();
  8393. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  8394. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  8395. endTagLength = endTag.length;
  8396. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  8397. text = text
  8398. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  8399. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  8400. }
  8401. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  8402. text = text.slice(1);
  8403. }
  8404. if (options.chars) {
  8405. options.chars(text);
  8406. }
  8407. return ''
  8408. });
  8409. index += html.length - rest$1.length;
  8410. html = rest$1;
  8411. parseEndTag(stackedTag, index - endTagLength, index);
  8412. }
  8413. if (html === last) {
  8414. options.chars && options.chars(html);
  8415. if (!stack.length && options.warn) {
  8416. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  8417. }
  8418. break
  8419. }
  8420. }
  8421. // Clean up any remaining tags
  8422. parseEndTag();
  8423. function advance (n) {
  8424. index += n;
  8425. html = html.substring(n);
  8426. }
  8427. function parseStartTag () {
  8428. var start = html.match(startTagOpen);
  8429. if (start) {
  8430. var match = {
  8431. tagName: start[1],
  8432. attrs: [],
  8433. start: index
  8434. };
  8435. advance(start[0].length);
  8436. var end, attr;
  8437. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  8438. attr.start = index;
  8439. advance(attr[0].length);
  8440. attr.end = index;
  8441. match.attrs.push(attr);
  8442. }
  8443. if (end) {
  8444. match.unarySlash = end[1];
  8445. advance(end[0].length);
  8446. match.end = index;
  8447. return match
  8448. }
  8449. }
  8450. }
  8451. function handleStartTag (match) {
  8452. var tagName = match.tagName;
  8453. var unarySlash = match.unarySlash;
  8454. if (expectHTML) {
  8455. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  8456. parseEndTag(lastTag);
  8457. }
  8458. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  8459. parseEndTag(tagName);
  8460. }
  8461. }
  8462. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  8463. var l = match.attrs.length;
  8464. var attrs = new Array(l);
  8465. for (var i = 0; i < l; i++) {
  8466. var args = match.attrs[i];
  8467. var value = args[3] || args[4] || args[5] || '';
  8468. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  8469. ? options.shouldDecodeNewlinesForHref
  8470. : options.shouldDecodeNewlines;
  8471. attrs[i] = {
  8472. name: args[1],
  8473. value: decodeAttr(value, shouldDecodeNewlines)
  8474. };
  8475. if (options.outputSourceRange) {
  8476. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  8477. attrs[i].end = args.end;
  8478. }
  8479. }
  8480. if (!unary) {
  8481. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  8482. lastTag = tagName;
  8483. }
  8484. if (options.start) {
  8485. options.start(tagName, attrs, unary, match.start, match.end);
  8486. }
  8487. }
  8488. function parseEndTag (tagName, start, end) {
  8489. var pos, lowerCasedTagName;
  8490. if (start == null) { start = index; }
  8491. if (end == null) { end = index; }
  8492. // Find the closest opened tag of the same type
  8493. if (tagName) {
  8494. lowerCasedTagName = tagName.toLowerCase();
  8495. for (pos = stack.length - 1; pos >= 0; pos--) {
  8496. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  8497. break
  8498. }
  8499. }
  8500. } else {
  8501. // If no tag name is provided, clean shop
  8502. pos = 0;
  8503. }
  8504. if (pos >= 0) {
  8505. // Close all the open elements, up the stack
  8506. for (var i = stack.length - 1; i >= pos; i--) {
  8507. if (i > pos || !tagName &&
  8508. options.warn
  8509. ) {
  8510. options.warn(
  8511. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  8512. { start: stack[i].start }
  8513. );
  8514. }
  8515. if (options.end) {
  8516. options.end(stack[i].tag, start, end);
  8517. }
  8518. }
  8519. // Remove the open elements from the stack
  8520. stack.length = pos;
  8521. lastTag = pos && stack[pos - 1].tag;
  8522. } else if (lowerCasedTagName === 'br') {
  8523. if (options.start) {
  8524. options.start(tagName, [], true, start, end);
  8525. }
  8526. } else if (lowerCasedTagName === 'p') {
  8527. if (options.start) {
  8528. options.start(tagName, [], false, start, end);
  8529. }
  8530. if (options.end) {
  8531. options.end(tagName, start, end);
  8532. }
  8533. }
  8534. }
  8535. }
  8536. /* */
  8537. var onRE = /^@|^v-on:/;
  8538. var dirRE = /^v-|^@|^:/;
  8539. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  8540. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  8541. var stripParensRE = /^\(|\)$/g;
  8542. var dynamicArgRE = /^\[.*\]$/;
  8543. var argRE = /:(.*)$/;
  8544. var bindRE = /^:|^\.|^v-bind:/;
  8545. var modifierRE = /\.[^.]+/g;
  8546. var slotRE = /^v-slot(:|$)|^#/;
  8547. var lineBreakRE = /[\r\n]/;
  8548. var whitespaceRE$1 = /\s+/g;
  8549. var invalidAttributeRE = /[\s"'<>\/=]/;
  8550. var decodeHTMLCached = cached(he.decode);
  8551. var emptySlotScopeToken = "_empty_";
  8552. // configurable state
  8553. var warn$2;
  8554. var delimiters;
  8555. var transforms;
  8556. var preTransforms;
  8557. var postTransforms;
  8558. var platformIsPreTag;
  8559. var platformMustUseProp;
  8560. var platformGetTagNamespace;
  8561. var maybeComponent;
  8562. function createASTElement (
  8563. tag,
  8564. attrs,
  8565. parent
  8566. ) {
  8567. return {
  8568. type: 1,
  8569. tag: tag,
  8570. attrsList: attrs,
  8571. attrsMap: makeAttrsMap(attrs),
  8572. rawAttrsMap: {},
  8573. parent: parent,
  8574. children: []
  8575. }
  8576. }
  8577. /**
  8578. * Convert HTML string to AST.
  8579. */
  8580. function parse (
  8581. template,
  8582. options
  8583. ) {
  8584. warn$2 = options.warn || baseWarn;
  8585. platformIsPreTag = options.isPreTag || no;
  8586. platformMustUseProp = options.mustUseProp || no;
  8587. platformGetTagNamespace = options.getTagNamespace || no;
  8588. var isReservedTag = options.isReservedTag || no;
  8589. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  8590. transforms = pluckModuleFunction(options.modules, 'transformNode');
  8591. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  8592. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  8593. delimiters = options.delimiters;
  8594. var stack = [];
  8595. var preserveWhitespace = options.preserveWhitespace !== false;
  8596. var whitespaceOption = options.whitespace;
  8597. var root;
  8598. var currentParent;
  8599. var inVPre = false;
  8600. var inPre = false;
  8601. var warned = false;
  8602. function warnOnce (msg, range) {
  8603. if (!warned) {
  8604. warned = true;
  8605. warn$2(msg, range);
  8606. }
  8607. }
  8608. function closeElement (element) {
  8609. trimEndingWhitespace(element);
  8610. if (!inVPre && !element.processed) {
  8611. element = processElement(element, options);
  8612. }
  8613. // tree management
  8614. if (!stack.length && element !== root) {
  8615. // allow root elements with v-if, v-else-if and v-else
  8616. if (root.if && (element.elseif || element.else)) {
  8617. {
  8618. checkRootConstraints(element);
  8619. }
  8620. addIfCondition(root, {
  8621. exp: element.elseif,
  8622. block: element
  8623. });
  8624. } else {
  8625. warnOnce(
  8626. "Component template should contain exactly one root element. " +
  8627. "If you are using v-if on multiple elements, " +
  8628. "use v-else-if to chain them instead.",
  8629. { start: element.start }
  8630. );
  8631. }
  8632. }
  8633. if (currentParent && !element.forbidden) {
  8634. if (element.elseif || element.else) {
  8635. processIfConditions(element, currentParent);
  8636. } else {
  8637. if (element.slotScope) {
  8638. // scoped slot
  8639. // keep it in the children list so that v-else(-if) conditions can
  8640. // find it as the prev node.
  8641. var name = element.slotTarget || '"default"'
  8642. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  8643. }
  8644. currentParent.children.push(element);
  8645. element.parent = currentParent;
  8646. }
  8647. }
  8648. // final children cleanup
  8649. // filter out scoped slots
  8650. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  8651. // remove trailing whitespace node again
  8652. trimEndingWhitespace(element);
  8653. // check pre state
  8654. if (element.pre) {
  8655. inVPre = false;
  8656. }
  8657. if (platformIsPreTag(element.tag)) {
  8658. inPre = false;
  8659. }
  8660. // apply post-transforms
  8661. for (var i = 0; i < postTransforms.length; i++) {
  8662. postTransforms[i](element, options);
  8663. }
  8664. }
  8665. function trimEndingWhitespace (el) {
  8666. // remove trailing whitespace node
  8667. if (!inPre) {
  8668. var lastNode;
  8669. while (
  8670. (lastNode = el.children[el.children.length - 1]) &&
  8671. lastNode.type === 3 &&
  8672. lastNode.text === ' '
  8673. ) {
  8674. el.children.pop();
  8675. }
  8676. }
  8677. }
  8678. function checkRootConstraints (el) {
  8679. if (el.tag === 'slot' || el.tag === 'template') {
  8680. warnOnce(
  8681. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  8682. 'contain multiple nodes.',
  8683. { start: el.start }
  8684. );
  8685. }
  8686. if (el.attrsMap.hasOwnProperty('v-for')) {
  8687. warnOnce(
  8688. 'Cannot use v-for on stateful component root element because ' +
  8689. 'it renders multiple elements.',
  8690. el.rawAttrsMap['v-for']
  8691. );
  8692. }
  8693. }
  8694. parseHTML(template, {
  8695. warn: warn$2,
  8696. expectHTML: options.expectHTML,
  8697. isUnaryTag: options.isUnaryTag,
  8698. canBeLeftOpenTag: options.canBeLeftOpenTag,
  8699. shouldDecodeNewlines: options.shouldDecodeNewlines,
  8700. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  8701. shouldKeepComment: options.comments,
  8702. outputSourceRange: options.outputSourceRange,
  8703. start: function start (tag, attrs, unary, start$1) {
  8704. // check namespace.
  8705. // inherit parent ns if there is one
  8706. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  8707. // handle IE svg bug
  8708. /* istanbul ignore if */
  8709. if (isIE && ns === 'svg') {
  8710. attrs = guardIESVGBug(attrs);
  8711. }
  8712. var element = createASTElement(tag, attrs, currentParent);
  8713. if (ns) {
  8714. element.ns = ns;
  8715. }
  8716. {
  8717. if (options.outputSourceRange) {
  8718. element.start = start$1;
  8719. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  8720. cumulated[attr.name] = attr;
  8721. return cumulated
  8722. }, {});
  8723. }
  8724. attrs.forEach(function (attr) {
  8725. if (invalidAttributeRE.test(attr.name)) {
  8726. warn$2(
  8727. "Invalid dynamic argument expression: attribute names cannot contain " +
  8728. "spaces, quotes, <, >, / or =.",
  8729. {
  8730. start: attr.start + attr.name.indexOf("["),
  8731. end: attr.start + attr.name.length
  8732. }
  8733. );
  8734. }
  8735. });
  8736. }
  8737. if (isForbiddenTag(element) && !isServerRendering()) {
  8738. element.forbidden = true;
  8739. warn$2(
  8740. 'Templates should only be responsible for mapping the state to the ' +
  8741. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  8742. "<" + tag + ">" + ', as they will not be parsed.',
  8743. { start: element.start }
  8744. );
  8745. }
  8746. // apply pre-transforms
  8747. for (var i = 0; i < preTransforms.length; i++) {
  8748. element = preTransforms[i](element, options) || element;
  8749. }
  8750. if (!inVPre) {
  8751. processPre(element);
  8752. if (element.pre) {
  8753. inVPre = true;
  8754. }
  8755. }
  8756. if (platformIsPreTag(element.tag)) {
  8757. inPre = true;
  8758. }
  8759. if (inVPre) {
  8760. processRawAttrs(element);
  8761. } else if (!element.processed) {
  8762. // structural directives
  8763. processFor(element);
  8764. processIf(element);
  8765. processOnce(element);
  8766. }
  8767. if (!root) {
  8768. root = element;
  8769. {
  8770. checkRootConstraints(root);
  8771. }
  8772. }
  8773. if (!unary) {
  8774. currentParent = element;
  8775. stack.push(element);
  8776. } else {
  8777. closeElement(element);
  8778. }
  8779. },
  8780. end: function end (tag, start, end$1) {
  8781. var element = stack[stack.length - 1];
  8782. // pop stack
  8783. stack.length -= 1;
  8784. currentParent = stack[stack.length - 1];
  8785. if (options.outputSourceRange) {
  8786. element.end = end$1;
  8787. }
  8788. closeElement(element);
  8789. },
  8790. chars: function chars (text, start, end) {
  8791. if (!currentParent) {
  8792. {
  8793. if (text === template) {
  8794. warnOnce(
  8795. 'Component template requires a root element, rather than just text.',
  8796. { start: start }
  8797. );
  8798. } else if ((text = text.trim())) {
  8799. warnOnce(
  8800. ("text \"" + text + "\" outside root element will be ignored."),
  8801. { start: start }
  8802. );
  8803. }
  8804. }
  8805. return
  8806. }
  8807. // IE textarea placeholder bug
  8808. /* istanbul ignore if */
  8809. if (isIE &&
  8810. currentParent.tag === 'textarea' &&
  8811. currentParent.attrsMap.placeholder === text
  8812. ) {
  8813. return
  8814. }
  8815. var children = currentParent.children;
  8816. if (inPre || text.trim()) {
  8817. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  8818. } else if (!children.length) {
  8819. // remove the whitespace-only node right after an opening tag
  8820. text = '';
  8821. } else if (whitespaceOption) {
  8822. if (whitespaceOption === 'condense') {
  8823. // in condense mode, remove the whitespace node if it contains
  8824. // line break, otherwise condense to a single space
  8825. text = lineBreakRE.test(text) ? '' : ' ';
  8826. } else {
  8827. text = ' ';
  8828. }
  8829. } else {
  8830. text = preserveWhitespace ? ' ' : '';
  8831. }
  8832. if (text) {
  8833. if (whitespaceOption === 'condense') {
  8834. // condense consecutive whitespaces into single space
  8835. text = text.replace(whitespaceRE$1, ' ');
  8836. }
  8837. var res;
  8838. var child;
  8839. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  8840. child = {
  8841. type: 2,
  8842. expression: res.expression,
  8843. tokens: res.tokens,
  8844. text: text
  8845. };
  8846. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  8847. child = {
  8848. type: 3,
  8849. text: text
  8850. };
  8851. }
  8852. if (child) {
  8853. if (options.outputSourceRange) {
  8854. child.start = start;
  8855. child.end = end;
  8856. }
  8857. children.push(child);
  8858. }
  8859. }
  8860. },
  8861. comment: function comment (text, start, end) {
  8862. // adding anyting as a sibling to the root node is forbidden
  8863. // comments should still be allowed, but ignored
  8864. if (currentParent) {
  8865. var child = {
  8866. type: 3,
  8867. text: text,
  8868. isComment: true
  8869. };
  8870. if (options.outputSourceRange) {
  8871. child.start = start;
  8872. child.end = end;
  8873. }
  8874. currentParent.children.push(child);
  8875. }
  8876. }
  8877. });
  8878. return root
  8879. }
  8880. function processPre (el) {
  8881. if (getAndRemoveAttr(el, 'v-pre') != null) {
  8882. el.pre = true;
  8883. }
  8884. }
  8885. function processRawAttrs (el) {
  8886. var list = el.attrsList;
  8887. var len = list.length;
  8888. if (len) {
  8889. var attrs = el.attrs = new Array(len);
  8890. for (var i = 0; i < len; i++) {
  8891. attrs[i] = {
  8892. name: list[i].name,
  8893. value: JSON.stringify(list[i].value)
  8894. };
  8895. if (list[i].start != null) {
  8896. attrs[i].start = list[i].start;
  8897. attrs[i].end = list[i].end;
  8898. }
  8899. }
  8900. } else if (!el.pre) {
  8901. // non root node in pre blocks with no attributes
  8902. el.plain = true;
  8903. }
  8904. }
  8905. function processElement (
  8906. element,
  8907. options
  8908. ) {
  8909. processKey(element);
  8910. // determine whether this is a plain element after
  8911. // removing structural attributes
  8912. element.plain = (
  8913. !element.key &&
  8914. !element.scopedSlots &&
  8915. !element.attrsList.length
  8916. );
  8917. processRef(element);
  8918. processSlotContent(element);
  8919. processSlotOutlet(element);
  8920. processComponent(element);
  8921. for (var i = 0; i < transforms.length; i++) {
  8922. element = transforms[i](element, options) || element;
  8923. }
  8924. processAttrs(element);
  8925. return element
  8926. }
  8927. function processKey (el) {
  8928. var exp = getBindingAttr(el, 'key');
  8929. if (exp) {
  8930. {
  8931. if (el.tag === 'template') {
  8932. warn$2(
  8933. "<template> cannot be keyed. Place the key on real elements instead.",
  8934. getRawBindingAttr(el, 'key')
  8935. );
  8936. }
  8937. if (el.for) {
  8938. var iterator = el.iterator2 || el.iterator1;
  8939. var parent = el.parent;
  8940. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  8941. warn$2(
  8942. "Do not use v-for index as key on <transition-group> children, " +
  8943. "this is the same as not using keys.",
  8944. getRawBindingAttr(el, 'key'),
  8945. true /* tip */
  8946. );
  8947. }
  8948. }
  8949. }
  8950. el.key = exp;
  8951. }
  8952. }
  8953. function processRef (el) {
  8954. var ref = getBindingAttr(el, 'ref');
  8955. if (ref) {
  8956. el.ref = ref;
  8957. el.refInFor = checkInFor(el);
  8958. }
  8959. }
  8960. function processFor (el) {
  8961. var exp;
  8962. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  8963. var res = parseFor(exp);
  8964. if (res) {
  8965. extend(el, res);
  8966. } else {
  8967. warn$2(
  8968. ("Invalid v-for expression: " + exp),
  8969. el.rawAttrsMap['v-for']
  8970. );
  8971. }
  8972. }
  8973. }
  8974. function parseFor (exp) {
  8975. var inMatch = exp.match(forAliasRE);
  8976. if (!inMatch) { return }
  8977. var res = {};
  8978. res.for = inMatch[2].trim();
  8979. var alias = inMatch[1].trim().replace(stripParensRE, '');
  8980. var iteratorMatch = alias.match(forIteratorRE);
  8981. if (iteratorMatch) {
  8982. res.alias = alias.replace(forIteratorRE, '').trim();
  8983. res.iterator1 = iteratorMatch[1].trim();
  8984. if (iteratorMatch[2]) {
  8985. res.iterator2 = iteratorMatch[2].trim();
  8986. }
  8987. } else {
  8988. res.alias = alias;
  8989. }
  8990. return res
  8991. }
  8992. function processIf (el) {
  8993. var exp = getAndRemoveAttr(el, 'v-if');
  8994. if (exp) {
  8995. el.if = exp;
  8996. addIfCondition(el, {
  8997. exp: exp,
  8998. block: el
  8999. });
  9000. } else {
  9001. if (getAndRemoveAttr(el, 'v-else') != null) {
  9002. el.else = true;
  9003. }
  9004. var elseif = getAndRemoveAttr(el, 'v-else-if');
  9005. if (elseif) {
  9006. el.elseif = elseif;
  9007. }
  9008. }
  9009. }
  9010. function processIfConditions (el, parent) {
  9011. var prev = findPrevElement(parent.children);
  9012. if (prev && prev.if) {
  9013. addIfCondition(prev, {
  9014. exp: el.elseif,
  9015. block: el
  9016. });
  9017. } else {
  9018. warn$2(
  9019. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  9020. "used on element <" + (el.tag) + "> without corresponding v-if.",
  9021. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  9022. );
  9023. }
  9024. }
  9025. function findPrevElement (children) {
  9026. var i = children.length;
  9027. while (i--) {
  9028. if (children[i].type === 1) {
  9029. return children[i]
  9030. } else {
  9031. if (children[i].text !== ' ') {
  9032. warn$2(
  9033. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  9034. "will be ignored.",
  9035. children[i]
  9036. );
  9037. }
  9038. children.pop();
  9039. }
  9040. }
  9041. }
  9042. function addIfCondition (el, condition) {
  9043. if (!el.ifConditions) {
  9044. el.ifConditions = [];
  9045. }
  9046. el.ifConditions.push(condition);
  9047. }
  9048. function processOnce (el) {
  9049. var once$$1 = getAndRemoveAttr(el, 'v-once');
  9050. if (once$$1 != null) {
  9051. el.once = true;
  9052. }
  9053. }
  9054. // handle content being passed to a component as slot,
  9055. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  9056. function processSlotContent (el) {
  9057. var slotScope;
  9058. if (el.tag === 'template') {
  9059. slotScope = getAndRemoveAttr(el, 'scope');
  9060. /* istanbul ignore if */
  9061. if (slotScope) {
  9062. warn$2(
  9063. "the \"scope\" attribute for scoped slots have been deprecated and " +
  9064. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  9065. "can also be used on plain elements in addition to <template> to " +
  9066. "denote scoped slots.",
  9067. el.rawAttrsMap['scope'],
  9068. true
  9069. );
  9070. }
  9071. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  9072. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  9073. /* istanbul ignore if */
  9074. if (el.attrsMap['v-for']) {
  9075. warn$2(
  9076. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  9077. "(v-for takes higher priority). Use a wrapper <template> for the " +
  9078. "scoped slot to make it clearer.",
  9079. el.rawAttrsMap['slot-scope'],
  9080. true
  9081. );
  9082. }
  9083. el.slotScope = slotScope;
  9084. }
  9085. // slot="xxx"
  9086. var slotTarget = getBindingAttr(el, 'slot');
  9087. if (slotTarget) {
  9088. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  9089. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  9090. // preserve slot as an attribute for native shadow DOM compat
  9091. // only for non-scoped slots.
  9092. if (el.tag !== 'template' && !el.slotScope) {
  9093. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  9094. }
  9095. }
  9096. // 2.6 v-slot syntax
  9097. {
  9098. if (el.tag === 'template') {
  9099. // v-slot on <template>
  9100. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  9101. if (slotBinding) {
  9102. {
  9103. if (el.slotTarget || el.slotScope) {
  9104. warn$2(
  9105. "Unexpected mixed usage of different slot syntaxes.",
  9106. el
  9107. );
  9108. }
  9109. if (el.parent && !maybeComponent(el.parent)) {
  9110. warn$2(
  9111. "<template v-slot> can only appear at the root level inside " +
  9112. "the receiving the component",
  9113. el
  9114. );
  9115. }
  9116. }
  9117. var ref = getSlotName(slotBinding);
  9118. var name = ref.name;
  9119. var dynamic = ref.dynamic;
  9120. el.slotTarget = name;
  9121. el.slotTargetDynamic = dynamic;
  9122. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  9123. }
  9124. } else {
  9125. // v-slot on component, denotes default slot
  9126. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  9127. if (slotBinding$1) {
  9128. {
  9129. if (!maybeComponent(el)) {
  9130. warn$2(
  9131. "v-slot can only be used on components or <template>.",
  9132. slotBinding$1
  9133. );
  9134. }
  9135. if (el.slotScope || el.slotTarget) {
  9136. warn$2(
  9137. "Unexpected mixed usage of different slot syntaxes.",
  9138. el
  9139. );
  9140. }
  9141. if (el.scopedSlots) {
  9142. warn$2(
  9143. "To avoid scope ambiguity, the default slot should also use " +
  9144. "<template> syntax when there are other named slots.",
  9145. slotBinding$1
  9146. );
  9147. }
  9148. }
  9149. // add the component's children to its default slot
  9150. var slots = el.scopedSlots || (el.scopedSlots = {});
  9151. var ref$1 = getSlotName(slotBinding$1);
  9152. var name$1 = ref$1.name;
  9153. var dynamic$1 = ref$1.dynamic;
  9154. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  9155. slotContainer.slotTarget = name$1;
  9156. slotContainer.slotTargetDynamic = dynamic$1;
  9157. slotContainer.children = el.children.filter(function (c) {
  9158. if (!c.slotScope) {
  9159. c.parent = slotContainer;
  9160. return true
  9161. }
  9162. });
  9163. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  9164. // remove children as they are returned from scopedSlots now
  9165. el.children = [];
  9166. // mark el non-plain so data gets generated
  9167. el.plain = false;
  9168. }
  9169. }
  9170. }
  9171. }
  9172. function getSlotName (binding) {
  9173. var name = binding.name.replace(slotRE, '');
  9174. if (!name) {
  9175. if (binding.name[0] !== '#') {
  9176. name = 'default';
  9177. } else {
  9178. warn$2(
  9179. "v-slot shorthand syntax requires a slot name.",
  9180. binding
  9181. );
  9182. }
  9183. }
  9184. return dynamicArgRE.test(name)
  9185. // dynamic [name]
  9186. ? { name: name.slice(1, -1), dynamic: true }
  9187. // static name
  9188. : { name: ("\"" + name + "\""), dynamic: false }
  9189. }
  9190. // handle <slot/> outlets
  9191. function processSlotOutlet (el) {
  9192. if (el.tag === 'slot') {
  9193. el.slotName = getBindingAttr(el, 'name');
  9194. if (el.key) {
  9195. warn$2(
  9196. "`key` does not work on <slot> because slots are abstract outlets " +
  9197. "and can possibly expand into multiple elements. " +
  9198. "Use the key on a wrapping element instead.",
  9199. getRawBindingAttr(el, 'key')
  9200. );
  9201. }
  9202. }
  9203. }
  9204. function processComponent (el) {
  9205. var binding;
  9206. if ((binding = getBindingAttr(el, 'is'))) {
  9207. el.component = binding;
  9208. }
  9209. if (getAndRemoveAttr(el, 'inline-template') != null) {
  9210. el.inlineTemplate = true;
  9211. }
  9212. }
  9213. function processAttrs (el) {
  9214. var list = el.attrsList;
  9215. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  9216. for (i = 0, l = list.length; i < l; i++) {
  9217. name = rawName = list[i].name;
  9218. value = list[i].value;
  9219. if (dirRE.test(name)) {
  9220. // mark element as dynamic
  9221. el.hasBindings = true;
  9222. // modifiers
  9223. modifiers = parseModifiers(name.replace(dirRE, ''));
  9224. // support .foo shorthand syntax for the .prop modifier
  9225. if (modifiers) {
  9226. name = name.replace(modifierRE, '');
  9227. }
  9228. if (bindRE.test(name)) { // v-bind
  9229. name = name.replace(bindRE, '');
  9230. value = parseFilters(value);
  9231. isDynamic = dynamicArgRE.test(name);
  9232. if (isDynamic) {
  9233. name = name.slice(1, -1);
  9234. }
  9235. if (
  9236. value.trim().length === 0
  9237. ) {
  9238. warn$2(
  9239. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  9240. );
  9241. }
  9242. if (modifiers) {
  9243. if (modifiers.prop && !isDynamic) {
  9244. name = camelize(name);
  9245. if (name === 'innerHtml') { name = 'innerHTML'; }
  9246. }
  9247. if (modifiers.camel && !isDynamic) {
  9248. name = camelize(name);
  9249. }
  9250. if (modifiers.sync) {
  9251. syncGen = genAssignmentCode(value, "$event");
  9252. if (!isDynamic) {
  9253. addHandler(
  9254. el,
  9255. ("update:" + (camelize(name))),
  9256. syncGen,
  9257. null,
  9258. false,
  9259. warn$2,
  9260. list[i]
  9261. );
  9262. if (hyphenate(name) !== camelize(name)) {
  9263. addHandler(
  9264. el,
  9265. ("update:" + (hyphenate(name))),
  9266. syncGen,
  9267. null,
  9268. false,
  9269. warn$2,
  9270. list[i]
  9271. );
  9272. }
  9273. } else {
  9274. // handler w/ dynamic event name
  9275. addHandler(
  9276. el,
  9277. ("\"update:\"+(" + name + ")"),
  9278. syncGen,
  9279. null,
  9280. false,
  9281. warn$2,
  9282. list[i],
  9283. true // dynamic
  9284. );
  9285. }
  9286. }
  9287. }
  9288. if ((modifiers && modifiers.prop) || (
  9289. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  9290. )) {
  9291. addProp(el, name, value, list[i], isDynamic);
  9292. } else {
  9293. addAttr(el, name, value, list[i], isDynamic);
  9294. }
  9295. } else if (onRE.test(name)) { // v-on
  9296. name = name.replace(onRE, '');
  9297. isDynamic = dynamicArgRE.test(name);
  9298. if (isDynamic) {
  9299. name = name.slice(1, -1);
  9300. }
  9301. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  9302. } else { // normal directives
  9303. name = name.replace(dirRE, '');
  9304. // parse arg
  9305. var argMatch = name.match(argRE);
  9306. var arg = argMatch && argMatch[1];
  9307. isDynamic = false;
  9308. if (arg) {
  9309. name = name.slice(0, -(arg.length + 1));
  9310. if (dynamicArgRE.test(arg)) {
  9311. arg = arg.slice(1, -1);
  9312. isDynamic = true;
  9313. }
  9314. }
  9315. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  9316. if (name === 'model') {
  9317. checkForAliasModel(el, value);
  9318. }
  9319. }
  9320. } else {
  9321. // literal attribute
  9322. {
  9323. var res = parseText(value, delimiters);
  9324. if (res) {
  9325. warn$2(
  9326. name + "=\"" + value + "\": " +
  9327. 'Interpolation inside attributes has been removed. ' +
  9328. 'Use v-bind or the colon shorthand instead. For example, ' +
  9329. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  9330. list[i]
  9331. );
  9332. }
  9333. }
  9334. addAttr(el, name, JSON.stringify(value), list[i]);
  9335. // #6887 firefox doesn't update muted state if set via attribute
  9336. // even immediately after element creation
  9337. if (!el.component &&
  9338. name === 'muted' &&
  9339. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  9340. addProp(el, name, 'true', list[i]);
  9341. }
  9342. }
  9343. }
  9344. }
  9345. function checkInFor (el) {
  9346. var parent = el;
  9347. while (parent) {
  9348. if (parent.for !== undefined) {
  9349. return true
  9350. }
  9351. parent = parent.parent;
  9352. }
  9353. return false
  9354. }
  9355. function parseModifiers (name) {
  9356. var match = name.match(modifierRE);
  9357. if (match) {
  9358. var ret = {};
  9359. match.forEach(function (m) { ret[m.slice(1)] = true; });
  9360. return ret
  9361. }
  9362. }
  9363. function makeAttrsMap (attrs) {
  9364. var map = {};
  9365. for (var i = 0, l = attrs.length; i < l; i++) {
  9366. if (
  9367. map[attrs[i].name] && !isIE && !isEdge
  9368. ) {
  9369. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  9370. }
  9371. map[attrs[i].name] = attrs[i].value;
  9372. }
  9373. return map
  9374. }
  9375. // for script (e.g. type="x/template") or style, do not decode content
  9376. function isTextTag (el) {
  9377. return el.tag === 'script' || el.tag === 'style'
  9378. }
  9379. function isForbiddenTag (el) {
  9380. return (
  9381. el.tag === 'style' ||
  9382. (el.tag === 'script' && (
  9383. !el.attrsMap.type ||
  9384. el.attrsMap.type === 'text/javascript'
  9385. ))
  9386. )
  9387. }
  9388. var ieNSBug = /^xmlns:NS\d+/;
  9389. var ieNSPrefix = /^NS\d+:/;
  9390. /* istanbul ignore next */
  9391. function guardIESVGBug (attrs) {
  9392. var res = [];
  9393. for (var i = 0; i < attrs.length; i++) {
  9394. var attr = attrs[i];
  9395. if (!ieNSBug.test(attr.name)) {
  9396. attr.name = attr.name.replace(ieNSPrefix, '');
  9397. res.push(attr);
  9398. }
  9399. }
  9400. return res
  9401. }
  9402. function checkForAliasModel (el, value) {
  9403. var _el = el;
  9404. while (_el) {
  9405. if (_el.for && _el.alias === value) {
  9406. warn$2(
  9407. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  9408. "You are binding v-model directly to a v-for iteration alias. " +
  9409. "This will not be able to modify the v-for source array because " +
  9410. "writing to the alias is like modifying a function local variable. " +
  9411. "Consider using an array of objects and use v-model on an object property instead.",
  9412. el.rawAttrsMap['v-model']
  9413. );
  9414. }
  9415. _el = _el.parent;
  9416. }
  9417. }
  9418. /* */
  9419. function preTransformNode (el, options) {
  9420. if (el.tag === 'input') {
  9421. var map = el.attrsMap;
  9422. if (!map['v-model']) {
  9423. return
  9424. }
  9425. var typeBinding;
  9426. if (map[':type'] || map['v-bind:type']) {
  9427. typeBinding = getBindingAttr(el, 'type');
  9428. }
  9429. if (!map.type && !typeBinding && map['v-bind']) {
  9430. typeBinding = "(" + (map['v-bind']) + ").type";
  9431. }
  9432. if (typeBinding) {
  9433. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  9434. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  9435. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  9436. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  9437. // 1. checkbox
  9438. var branch0 = cloneASTElement(el);
  9439. // process for on the main node
  9440. processFor(branch0);
  9441. addRawAttr(branch0, 'type', 'checkbox');
  9442. processElement(branch0, options);
  9443. branch0.processed = true; // prevent it from double-processed
  9444. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  9445. addIfCondition(branch0, {
  9446. exp: branch0.if,
  9447. block: branch0
  9448. });
  9449. // 2. add radio else-if condition
  9450. var branch1 = cloneASTElement(el);
  9451. getAndRemoveAttr(branch1, 'v-for', true);
  9452. addRawAttr(branch1, 'type', 'radio');
  9453. processElement(branch1, options);
  9454. addIfCondition(branch0, {
  9455. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  9456. block: branch1
  9457. });
  9458. // 3. other
  9459. var branch2 = cloneASTElement(el);
  9460. getAndRemoveAttr(branch2, 'v-for', true);
  9461. addRawAttr(branch2, ':type', typeBinding);
  9462. processElement(branch2, options);
  9463. addIfCondition(branch0, {
  9464. exp: ifCondition,
  9465. block: branch2
  9466. });
  9467. if (hasElse) {
  9468. branch0.else = true;
  9469. } else if (elseIfCondition) {
  9470. branch0.elseif = elseIfCondition;
  9471. }
  9472. return branch0
  9473. }
  9474. }
  9475. }
  9476. function cloneASTElement (el) {
  9477. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  9478. }
  9479. var model$1 = {
  9480. preTransformNode: preTransformNode
  9481. };
  9482. var modules$1 = [
  9483. klass$1,
  9484. style$1,
  9485. model$1
  9486. ];
  9487. /* */
  9488. function text (el, dir) {
  9489. if (dir.value) {
  9490. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  9491. }
  9492. }
  9493. /* */
  9494. function html (el, dir) {
  9495. if (dir.value) {
  9496. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  9497. }
  9498. }
  9499. var directives$1 = {
  9500. model: model,
  9501. text: text,
  9502. html: html
  9503. };
  9504. /* */
  9505. var baseOptions = {
  9506. expectHTML: true,
  9507. modules: modules$1,
  9508. directives: directives$1,
  9509. isPreTag: isPreTag,
  9510. isUnaryTag: isUnaryTag,
  9511. mustUseProp: mustUseProp,
  9512. canBeLeftOpenTag: canBeLeftOpenTag,
  9513. isReservedTag: isReservedTag,
  9514. getTagNamespace: getTagNamespace,
  9515. staticKeys: genStaticKeys(modules$1)
  9516. };
  9517. /* */
  9518. var isStaticKey;
  9519. var isPlatformReservedTag;
  9520. var genStaticKeysCached = cached(genStaticKeys$1);
  9521. /**
  9522. * Goal of the optimizer: walk the generated template AST tree
  9523. * and detect sub-trees that are purely static, i.e. parts of
  9524. * the DOM that never needs to change.
  9525. *
  9526. * Once we detect these sub-trees, we can:
  9527. *
  9528. * 1. Hoist them into constants, so that we no longer need to
  9529. * create fresh nodes for them on each re-render;
  9530. * 2. Completely skip them in the patching process.
  9531. */
  9532. function optimize (root, options) {
  9533. if (!root) { return }
  9534. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  9535. isPlatformReservedTag = options.isReservedTag || no;
  9536. // first pass: mark all non-static nodes.
  9537. markStatic$1(root);
  9538. // second pass: mark static roots.
  9539. markStaticRoots(root, false);
  9540. }
  9541. function genStaticKeys$1 (keys) {
  9542. return makeMap(
  9543. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  9544. (keys ? ',' + keys : '')
  9545. )
  9546. }
  9547. function markStatic$1 (node) {
  9548. node.static = isStatic(node);
  9549. if (node.type === 1) {
  9550. // do not make component slot content static. this avoids
  9551. // 1. components not able to mutate slot nodes
  9552. // 2. static slot content fails for hot-reloading
  9553. if (
  9554. !isPlatformReservedTag(node.tag) &&
  9555. node.tag !== 'slot' &&
  9556. node.attrsMap['inline-template'] == null
  9557. ) {
  9558. return
  9559. }
  9560. for (var i = 0, l = node.children.length; i < l; i++) {
  9561. var child = node.children[i];
  9562. markStatic$1(child);
  9563. if (!child.static) {
  9564. node.static = false;
  9565. }
  9566. }
  9567. if (node.ifConditions) {
  9568. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  9569. var block = node.ifConditions[i$1].block;
  9570. markStatic$1(block);
  9571. if (!block.static) {
  9572. node.static = false;
  9573. }
  9574. }
  9575. }
  9576. }
  9577. }
  9578. function markStaticRoots (node, isInFor) {
  9579. if (node.type === 1) {
  9580. if (node.static || node.once) {
  9581. node.staticInFor = isInFor;
  9582. }
  9583. // For a node to qualify as a static root, it should have children that
  9584. // are not just static text. Otherwise the cost of hoisting out will
  9585. // outweigh the benefits and it's better off to just always render it fresh.
  9586. if (node.static && node.children.length && !(
  9587. node.children.length === 1 &&
  9588. node.children[0].type === 3
  9589. )) {
  9590. node.staticRoot = true;
  9591. return
  9592. } else {
  9593. node.staticRoot = false;
  9594. }
  9595. if (node.children) {
  9596. for (var i = 0, l = node.children.length; i < l; i++) {
  9597. markStaticRoots(node.children[i], isInFor || !!node.for);
  9598. }
  9599. }
  9600. if (node.ifConditions) {
  9601. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  9602. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  9603. }
  9604. }
  9605. }
  9606. }
  9607. function isStatic (node) {
  9608. if (node.type === 2) { // expression
  9609. return false
  9610. }
  9611. if (node.type === 3) { // text
  9612. return true
  9613. }
  9614. return !!(node.pre || (
  9615. !node.hasBindings && // no dynamic bindings
  9616. !node.if && !node.for && // not v-if or v-for or v-else
  9617. !isBuiltInTag(node.tag) && // not a built-in
  9618. isPlatformReservedTag(node.tag) && // not a component
  9619. !isDirectChildOfTemplateFor(node) &&
  9620. Object.keys(node).every(isStaticKey)
  9621. ))
  9622. }
  9623. function isDirectChildOfTemplateFor (node) {
  9624. while (node.parent) {
  9625. node = node.parent;
  9626. if (node.tag !== 'template') {
  9627. return false
  9628. }
  9629. if (node.for) {
  9630. return true
  9631. }
  9632. }
  9633. return false
  9634. }
  9635. /* */
  9636. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
  9637. var fnInvokeRE = /\([^)]*?\);*$/;
  9638. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  9639. // KeyboardEvent.keyCode aliases
  9640. var keyCodes = {
  9641. esc: 27,
  9642. tab: 9,
  9643. enter: 13,
  9644. space: 32,
  9645. up: 38,
  9646. left: 37,
  9647. right: 39,
  9648. down: 40,
  9649. 'delete': [8, 46]
  9650. };
  9651. // KeyboardEvent.key aliases
  9652. var keyNames = {
  9653. // #7880: IE11 and Edge use `Esc` for Escape key name.
  9654. esc: ['Esc', 'Escape'],
  9655. tab: 'Tab',
  9656. enter: 'Enter',
  9657. // #9112: IE11 uses `Spacebar` for Space key name.
  9658. space: [' ', 'Spacebar'],
  9659. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  9660. up: ['Up', 'ArrowUp'],
  9661. left: ['Left', 'ArrowLeft'],
  9662. right: ['Right', 'ArrowRight'],
  9663. down: ['Down', 'ArrowDown'],
  9664. // #9112: IE11 uses `Del` for Delete key name.
  9665. 'delete': ['Backspace', 'Delete', 'Del']
  9666. };
  9667. // #4868: modifiers that prevent the execution of the listener
  9668. // need to explicitly return null so that we can determine whether to remove
  9669. // the listener for .once
  9670. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  9671. var modifierCode = {
  9672. stop: '$event.stopPropagation();',
  9673. prevent: '$event.preventDefault();',
  9674. self: genGuard("$event.target !== $event.currentTarget"),
  9675. ctrl: genGuard("!$event.ctrlKey"),
  9676. shift: genGuard("!$event.shiftKey"),
  9677. alt: genGuard("!$event.altKey"),
  9678. meta: genGuard("!$event.metaKey"),
  9679. left: genGuard("'button' in $event && $event.button !== 0"),
  9680. middle: genGuard("'button' in $event && $event.button !== 1"),
  9681. right: genGuard("'button' in $event && $event.button !== 2")
  9682. };
  9683. function genHandlers (
  9684. events,
  9685. isNative
  9686. ) {
  9687. var prefix = isNative ? 'nativeOn:' : 'on:';
  9688. var staticHandlers = "";
  9689. var dynamicHandlers = "";
  9690. for (var name in events) {
  9691. var handlerCode = genHandler(events[name]);
  9692. if (events[name] && events[name].dynamic) {
  9693. dynamicHandlers += name + "," + handlerCode + ",";
  9694. } else {
  9695. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  9696. }
  9697. }
  9698. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  9699. if (dynamicHandlers) {
  9700. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  9701. } else {
  9702. return prefix + staticHandlers
  9703. }
  9704. }
  9705. function genHandler (handler) {
  9706. if (!handler) {
  9707. return 'function(){}'
  9708. }
  9709. if (Array.isArray(handler)) {
  9710. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  9711. }
  9712. var isMethodPath = simplePathRE.test(handler.value);
  9713. var isFunctionExpression = fnExpRE.test(handler.value);
  9714. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  9715. if (!handler.modifiers) {
  9716. if (isMethodPath || isFunctionExpression) {
  9717. return handler.value
  9718. }
  9719. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  9720. } else {
  9721. var code = '';
  9722. var genModifierCode = '';
  9723. var keys = [];
  9724. for (var key in handler.modifiers) {
  9725. if (modifierCode[key]) {
  9726. genModifierCode += modifierCode[key];
  9727. // left/right
  9728. if (keyCodes[key]) {
  9729. keys.push(key);
  9730. }
  9731. } else if (key === 'exact') {
  9732. var modifiers = (handler.modifiers);
  9733. genModifierCode += genGuard(
  9734. ['ctrl', 'shift', 'alt', 'meta']
  9735. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  9736. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  9737. .join('||')
  9738. );
  9739. } else {
  9740. keys.push(key);
  9741. }
  9742. }
  9743. if (keys.length) {
  9744. code += genKeyFilter(keys);
  9745. }
  9746. // Make sure modifiers like prevent and stop get executed after key filtering
  9747. if (genModifierCode) {
  9748. code += genModifierCode;
  9749. }
  9750. var handlerCode = isMethodPath
  9751. ? ("return " + (handler.value) + "($event)")
  9752. : isFunctionExpression
  9753. ? ("return (" + (handler.value) + ")($event)")
  9754. : isFunctionInvocation
  9755. ? ("return " + (handler.value))
  9756. : handler.value;
  9757. return ("function($event){" + code + handlerCode + "}")
  9758. }
  9759. }
  9760. function genKeyFilter (keys) {
  9761. return (
  9762. // make sure the key filters only apply to KeyboardEvents
  9763. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  9764. // key events that do not have keyCode property...
  9765. "if(!$event.type.indexOf('key')&&" +
  9766. (keys.map(genFilterCode).join('&&')) + ")return null;"
  9767. )
  9768. }
  9769. function genFilterCode (key) {
  9770. var keyVal = parseInt(key, 10);
  9771. if (keyVal) {
  9772. return ("$event.keyCode!==" + keyVal)
  9773. }
  9774. var keyCode = keyCodes[key];
  9775. var keyName = keyNames[key];
  9776. return (
  9777. "_k($event.keyCode," +
  9778. (JSON.stringify(key)) + "," +
  9779. (JSON.stringify(keyCode)) + "," +
  9780. "$event.key," +
  9781. "" + (JSON.stringify(keyName)) +
  9782. ")"
  9783. )
  9784. }
  9785. /* */
  9786. function on (el, dir) {
  9787. if (dir.modifiers) {
  9788. warn("v-on without argument does not support modifiers.");
  9789. }
  9790. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  9791. }
  9792. /* */
  9793. function bind$1 (el, dir) {
  9794. el.wrapData = function (code) {
  9795. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  9796. };
  9797. }
  9798. /* */
  9799. var baseDirectives = {
  9800. on: on,
  9801. bind: bind$1,
  9802. cloak: noop
  9803. };
  9804. /* */
  9805. var CodegenState = function CodegenState (options) {
  9806. this.options = options;
  9807. this.warn = options.warn || baseWarn;
  9808. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  9809. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  9810. this.directives = extend(extend({}, baseDirectives), options.directives);
  9811. var isReservedTag = options.isReservedTag || no;
  9812. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  9813. this.onceId = 0;
  9814. this.staticRenderFns = [];
  9815. this.pre = false;
  9816. };
  9817. function generate (
  9818. ast,
  9819. options
  9820. ) {
  9821. var state = new CodegenState(options);
  9822. var code = ast ? genElement(ast, state) : '_c("div")';
  9823. return {
  9824. render: ("with(this){return " + code + "}"),
  9825. staticRenderFns: state.staticRenderFns
  9826. }
  9827. }
  9828. function genElement (el, state) {
  9829. if (el.parent) {
  9830. el.pre = el.pre || el.parent.pre;
  9831. }
  9832. if (el.staticRoot && !el.staticProcessed) {
  9833. return genStatic(el, state)
  9834. } else if (el.once && !el.onceProcessed) {
  9835. return genOnce(el, state)
  9836. } else if (el.for && !el.forProcessed) {
  9837. return genFor(el, state)
  9838. } else if (el.if && !el.ifProcessed) {
  9839. return genIf(el, state)
  9840. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  9841. return genChildren(el, state) || 'void 0'
  9842. } else if (el.tag === 'slot') {
  9843. return genSlot(el, state)
  9844. } else {
  9845. // component or element
  9846. var code;
  9847. if (el.component) {
  9848. code = genComponent(el.component, el, state);
  9849. } else {
  9850. var data;
  9851. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  9852. data = genData$2(el, state);
  9853. }
  9854. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  9855. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  9856. }
  9857. // module transforms
  9858. for (var i = 0; i < state.transforms.length; i++) {
  9859. code = state.transforms[i](el, code);
  9860. }
  9861. return code
  9862. }
  9863. }
  9864. // hoist static sub-trees out
  9865. function genStatic (el, state) {
  9866. el.staticProcessed = true;
  9867. // Some elements (templates) need to behave differently inside of a v-pre
  9868. // node. All pre nodes are static roots, so we can use this as a location to
  9869. // wrap a state change and reset it upon exiting the pre node.
  9870. var originalPreState = state.pre;
  9871. if (el.pre) {
  9872. state.pre = el.pre;
  9873. }
  9874. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  9875. state.pre = originalPreState;
  9876. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  9877. }
  9878. // v-once
  9879. function genOnce (el, state) {
  9880. el.onceProcessed = true;
  9881. if (el.if && !el.ifProcessed) {
  9882. return genIf(el, state)
  9883. } else if (el.staticInFor) {
  9884. var key = '';
  9885. var parent = el.parent;
  9886. while (parent) {
  9887. if (parent.for) {
  9888. key = parent.key;
  9889. break
  9890. }
  9891. parent = parent.parent;
  9892. }
  9893. if (!key) {
  9894. state.warn(
  9895. "v-once can only be used inside v-for that is keyed. ",
  9896. el.rawAttrsMap['v-once']
  9897. );
  9898. return genElement(el, state)
  9899. }
  9900. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  9901. } else {
  9902. return genStatic(el, state)
  9903. }
  9904. }
  9905. function genIf (
  9906. el,
  9907. state,
  9908. altGen,
  9909. altEmpty
  9910. ) {
  9911. el.ifProcessed = true; // avoid recursion
  9912. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  9913. }
  9914. function genIfConditions (
  9915. conditions,
  9916. state,
  9917. altGen,
  9918. altEmpty
  9919. ) {
  9920. if (!conditions.length) {
  9921. return altEmpty || '_e()'
  9922. }
  9923. var condition = conditions.shift();
  9924. if (condition.exp) {
  9925. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  9926. } else {
  9927. return ("" + (genTernaryExp(condition.block)))
  9928. }
  9929. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  9930. function genTernaryExp (el) {
  9931. return altGen
  9932. ? altGen(el, state)
  9933. : el.once
  9934. ? genOnce(el, state)
  9935. : genElement(el, state)
  9936. }
  9937. }
  9938. function genFor (
  9939. el,
  9940. state,
  9941. altGen,
  9942. altHelper
  9943. ) {
  9944. var exp = el.for;
  9945. var alias = el.alias;
  9946. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  9947. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  9948. if (state.maybeComponent(el) &&
  9949. el.tag !== 'slot' &&
  9950. el.tag !== 'template' &&
  9951. !el.key
  9952. ) {
  9953. state.warn(
  9954. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  9955. "v-for should have explicit keys. " +
  9956. "See https://vuejs.org/guide/list.html#key for more info.",
  9957. el.rawAttrsMap['v-for'],
  9958. true /* tip */
  9959. );
  9960. }
  9961. el.forProcessed = true; // avoid recursion
  9962. return (altHelper || '_l') + "((" + exp + ")," +
  9963. "function(" + alias + iterator1 + iterator2 + "){" +
  9964. "return " + ((altGen || genElement)(el, state)) +
  9965. '})'
  9966. }
  9967. function genData$2 (el, state) {
  9968. var data = '{';
  9969. // directives first.
  9970. // directives may mutate the el's other properties before they are generated.
  9971. var dirs = genDirectives(el, state);
  9972. if (dirs) { data += dirs + ','; }
  9973. // key
  9974. if (el.key) {
  9975. data += "key:" + (el.key) + ",";
  9976. }
  9977. // ref
  9978. if (el.ref) {
  9979. data += "ref:" + (el.ref) + ",";
  9980. }
  9981. if (el.refInFor) {
  9982. data += "refInFor:true,";
  9983. }
  9984. // pre
  9985. if (el.pre) {
  9986. data += "pre:true,";
  9987. }
  9988. // record original tag name for components using "is" attribute
  9989. if (el.component) {
  9990. data += "tag:\"" + (el.tag) + "\",";
  9991. }
  9992. // module data generation functions
  9993. for (var i = 0; i < state.dataGenFns.length; i++) {
  9994. data += state.dataGenFns[i](el);
  9995. }
  9996. // attributes
  9997. if (el.attrs) {
  9998. data += "attrs:" + (genProps(el.attrs)) + ",";
  9999. }
  10000. // DOM props
  10001. if (el.props) {
  10002. data += "domProps:" + (genProps(el.props)) + ",";
  10003. }
  10004. // event handlers
  10005. if (el.events) {
  10006. data += (genHandlers(el.events, false)) + ",";
  10007. }
  10008. if (el.nativeEvents) {
  10009. data += (genHandlers(el.nativeEvents, true)) + ",";
  10010. }
  10011. // slot target
  10012. // only for non-scoped slots
  10013. if (el.slotTarget && !el.slotScope) {
  10014. data += "slot:" + (el.slotTarget) + ",";
  10015. }
  10016. // scoped slots
  10017. if (el.scopedSlots) {
  10018. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  10019. }
  10020. // component v-model
  10021. if (el.model) {
  10022. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  10023. }
  10024. // inline-template
  10025. if (el.inlineTemplate) {
  10026. var inlineTemplate = genInlineTemplate(el, state);
  10027. if (inlineTemplate) {
  10028. data += inlineTemplate + ",";
  10029. }
  10030. }
  10031. data = data.replace(/,$/, '') + '}';
  10032. // v-bind dynamic argument wrap
  10033. // v-bind with dynamic arguments must be applied using the same v-bind object
  10034. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  10035. if (el.dynamicAttrs) {
  10036. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  10037. }
  10038. // v-bind data wrap
  10039. if (el.wrapData) {
  10040. data = el.wrapData(data);
  10041. }
  10042. // v-on data wrap
  10043. if (el.wrapListeners) {
  10044. data = el.wrapListeners(data);
  10045. }
  10046. return data
  10047. }
  10048. function genDirectives (el, state) {
  10049. var dirs = el.directives;
  10050. if (!dirs) { return }
  10051. var res = 'directives:[';
  10052. var hasRuntime = false;
  10053. var i, l, dir, needRuntime;
  10054. for (i = 0, l = dirs.length; i < l; i++) {
  10055. dir = dirs[i];
  10056. needRuntime = true;
  10057. var gen = state.directives[dir.name];
  10058. if (gen) {
  10059. // compile-time directive that manipulates AST.
  10060. // returns true if it also needs a runtime counterpart.
  10061. needRuntime = !!gen(el, dir, state.warn);
  10062. }
  10063. if (needRuntime) {
  10064. hasRuntime = true;
  10065. res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
  10066. }
  10067. }
  10068. if (hasRuntime) {
  10069. return res.slice(0, -1) + ']'
  10070. }
  10071. }
  10072. function genInlineTemplate (el, state) {
  10073. var ast = el.children[0];
  10074. if (el.children.length !== 1 || ast.type !== 1) {
  10075. state.warn(
  10076. 'Inline-template components must have exactly one child element.',
  10077. { start: el.start }
  10078. );
  10079. }
  10080. if (ast && ast.type === 1) {
  10081. var inlineRenderFns = generate(ast, state.options);
  10082. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  10083. }
  10084. }
  10085. function genScopedSlots (
  10086. el,
  10087. slots,
  10088. state
  10089. ) {
  10090. // by default scoped slots are considered "stable", this allows child
  10091. // components with only scoped slots to skip forced updates from parent.
  10092. // but in some cases we have to bail-out of this optimization
  10093. // for example if the slot contains dynamic names, has v-if or v-for on them...
  10094. var needsForceUpdate = Object.keys(slots).some(function (key) {
  10095. var slot = slots[key];
  10096. return (
  10097. slot.slotTargetDynamic ||
  10098. slot.if ||
  10099. slot.for ||
  10100. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  10101. )
  10102. });
  10103. // OR when it is inside another scoped slot (the reactivity is disconnected)
  10104. // #9438
  10105. if (!needsForceUpdate) {
  10106. var parent = el.parent;
  10107. while (parent) {
  10108. if (parent.slotScope && parent.slotScope !== emptySlotScopeToken) {
  10109. needsForceUpdate = true;
  10110. break
  10111. }
  10112. parent = parent.parent;
  10113. }
  10114. }
  10115. return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
  10116. return genScopedSlot(slots[key], state)
  10117. }).join(',')) + "]" + (needsForceUpdate ? ",true" : "") + ")")
  10118. }
  10119. function containsSlotChild (el) {
  10120. if (el.type === 1) {
  10121. if (el.tag === 'slot') {
  10122. return true
  10123. }
  10124. return el.children.some(containsSlotChild)
  10125. }
  10126. return false
  10127. }
  10128. function genScopedSlot (
  10129. el,
  10130. state
  10131. ) {
  10132. var isLegacySyntax = el.attrsMap['slot-scope'];
  10133. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  10134. return genIf(el, state, genScopedSlot, "null")
  10135. }
  10136. if (el.for && !el.forProcessed) {
  10137. return genFor(el, state, genScopedSlot)
  10138. }
  10139. var slotScope = el.slotScope === emptySlotScopeToken
  10140. ? ""
  10141. : String(el.slotScope);
  10142. var fn = "function(" + slotScope + "){" +
  10143. "return " + (el.tag === 'template'
  10144. ? el.if && isLegacySyntax
  10145. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  10146. : genChildren(el, state) || 'undefined'
  10147. : genElement(el, state)) + "}";
  10148. // reverse proxy v-slot without scope on this.$slots
  10149. var reverseProxy = slotScope ? "" : ",proxy:true";
  10150. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  10151. }
  10152. function genChildren (
  10153. el,
  10154. state,
  10155. checkSkip,
  10156. altGenElement,
  10157. altGenNode
  10158. ) {
  10159. var children = el.children;
  10160. if (children.length) {
  10161. var el$1 = children[0];
  10162. // optimize single v-for
  10163. if (children.length === 1 &&
  10164. el$1.for &&
  10165. el$1.tag !== 'template' &&
  10166. el$1.tag !== 'slot'
  10167. ) {
  10168. var normalizationType = checkSkip
  10169. ? state.maybeComponent(el$1) ? ",1" : ",0"
  10170. : "";
  10171. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  10172. }
  10173. var normalizationType$1 = checkSkip
  10174. ? getNormalizationType(children, state.maybeComponent)
  10175. : 0;
  10176. var gen = altGenNode || genNode;
  10177. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  10178. }
  10179. }
  10180. // determine the normalization needed for the children array.
  10181. // 0: no normalization needed
  10182. // 1: simple normalization needed (possible 1-level deep nested array)
  10183. // 2: full normalization needed
  10184. function getNormalizationType (
  10185. children,
  10186. maybeComponent
  10187. ) {
  10188. var res = 0;
  10189. for (var i = 0; i < children.length; i++) {
  10190. var el = children[i];
  10191. if (el.type !== 1) {
  10192. continue
  10193. }
  10194. if (needsNormalization(el) ||
  10195. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  10196. res = 2;
  10197. break
  10198. }
  10199. if (maybeComponent(el) ||
  10200. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  10201. res = 1;
  10202. }
  10203. }
  10204. return res
  10205. }
  10206. function needsNormalization (el) {
  10207. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  10208. }
  10209. function genNode (node, state) {
  10210. if (node.type === 1) {
  10211. return genElement(node, state)
  10212. } else if (node.type === 3 && node.isComment) {
  10213. return genComment(node)
  10214. } else {
  10215. return genText(node)
  10216. }
  10217. }
  10218. function genText (text) {
  10219. return ("_v(" + (text.type === 2
  10220. ? text.expression // no need for () because already wrapped in _s()
  10221. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  10222. }
  10223. function genComment (comment) {
  10224. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  10225. }
  10226. function genSlot (el, state) {
  10227. var slotName = el.slotName || '"default"';
  10228. var children = genChildren(el, state);
  10229. var res = "_t(" + slotName + (children ? ("," + children) : '');
  10230. var attrs = el.attrs || el.dynamicAttrs
  10231. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  10232. // slot props are camelized
  10233. name: camelize(attr.name),
  10234. value: attr.value,
  10235. dynamic: attr.dynamic
  10236. }); }))
  10237. : null;
  10238. var bind$$1 = el.attrsMap['v-bind'];
  10239. if ((attrs || bind$$1) && !children) {
  10240. res += ",null";
  10241. }
  10242. if (attrs) {
  10243. res += "," + attrs;
  10244. }
  10245. if (bind$$1) {
  10246. res += (attrs ? '' : ',null') + "," + bind$$1;
  10247. }
  10248. return res + ')'
  10249. }
  10250. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  10251. function genComponent (
  10252. componentName,
  10253. el,
  10254. state
  10255. ) {
  10256. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  10257. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  10258. }
  10259. function genProps (props) {
  10260. var staticProps = "";
  10261. var dynamicProps = "";
  10262. for (var i = 0; i < props.length; i++) {
  10263. var prop = props[i];
  10264. var value = transformSpecialNewlines(prop.value);
  10265. if (prop.dynamic) {
  10266. dynamicProps += (prop.name) + "," + value + ",";
  10267. } else {
  10268. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  10269. }
  10270. }
  10271. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  10272. if (dynamicProps) {
  10273. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  10274. } else {
  10275. return staticProps
  10276. }
  10277. }
  10278. // #3895, #4268
  10279. function transformSpecialNewlines (text) {
  10280. return text
  10281. .replace(/\u2028/g, '\\u2028')
  10282. .replace(/\u2029/g, '\\u2029')
  10283. }
  10284. /* */
  10285. // these keywords should not appear inside expressions, but operators like
  10286. // typeof, instanceof and in are allowed
  10287. var prohibitedKeywordRE = new RegExp('\\b' + (
  10288. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  10289. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  10290. 'extends,finally,continue,debugger,function,arguments'
  10291. ).split(',').join('\\b|\\b') + '\\b');
  10292. // these unary operators should not be used as property/method names
  10293. var unaryOperatorsRE = new RegExp('\\b' + (
  10294. 'delete,typeof,void'
  10295. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  10296. // strip strings in expressions
  10297. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  10298. // detect problematic expressions in a template
  10299. function detectErrors (ast, warn) {
  10300. if (ast) {
  10301. checkNode(ast, warn);
  10302. }
  10303. }
  10304. function checkNode (node, warn) {
  10305. if (node.type === 1) {
  10306. for (var name in node.attrsMap) {
  10307. if (dirRE.test(name)) {
  10308. var value = node.attrsMap[name];
  10309. if (value) {
  10310. var range = node.rawAttrsMap[name];
  10311. if (name === 'v-for') {
  10312. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  10313. } else if (onRE.test(name)) {
  10314. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  10315. } else {
  10316. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  10317. }
  10318. }
  10319. }
  10320. }
  10321. if (node.children) {
  10322. for (var i = 0; i < node.children.length; i++) {
  10323. checkNode(node.children[i], warn);
  10324. }
  10325. }
  10326. } else if (node.type === 2) {
  10327. checkExpression(node.expression, node.text, warn, node);
  10328. }
  10329. }
  10330. function checkEvent (exp, text, warn, range) {
  10331. var stipped = exp.replace(stripStringRE, '');
  10332. var keywordMatch = stipped.match(unaryOperatorsRE);
  10333. if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
  10334. warn(
  10335. "avoid using JavaScript unary operator as property name: " +
  10336. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  10337. range
  10338. );
  10339. }
  10340. checkExpression(exp, text, warn, range);
  10341. }
  10342. function checkFor (node, text, warn, range) {
  10343. checkExpression(node.for || '', text, warn, range);
  10344. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  10345. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  10346. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  10347. }
  10348. function checkIdentifier (
  10349. ident,
  10350. type,
  10351. text,
  10352. warn,
  10353. range
  10354. ) {
  10355. if (typeof ident === 'string') {
  10356. try {
  10357. new Function(("var " + ident + "=_"));
  10358. } catch (e) {
  10359. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  10360. }
  10361. }
  10362. }
  10363. function checkExpression (exp, text, warn, range) {
  10364. try {
  10365. new Function(("return " + exp));
  10366. } catch (e) {
  10367. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  10368. if (keywordMatch) {
  10369. warn(
  10370. "avoid using JavaScript keyword as property name: " +
  10371. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  10372. range
  10373. );
  10374. } else {
  10375. warn(
  10376. "invalid expression: " + (e.message) + " in\n\n" +
  10377. " " + exp + "\n\n" +
  10378. " Raw expression: " + (text.trim()) + "\n",
  10379. range
  10380. );
  10381. }
  10382. }
  10383. }
  10384. /* */
  10385. var range = 2;
  10386. function generateCodeFrame (
  10387. source,
  10388. start,
  10389. end
  10390. ) {
  10391. if ( start === void 0 ) start = 0;
  10392. if ( end === void 0 ) end = source.length;
  10393. var lines = source.split(/\r?\n/);
  10394. var count = 0;
  10395. var res = [];
  10396. for (var i = 0; i < lines.length; i++) {
  10397. count += lines[i].length + 1;
  10398. if (count >= start) {
  10399. for (var j = i - range; j <= i + range || end > count; j++) {
  10400. if (j < 0 || j >= lines.length) { continue }
  10401. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  10402. var lineLength = lines[j].length;
  10403. if (j === i) {
  10404. // push underline
  10405. var pad = start - (count - lineLength) + 1;
  10406. var length = end > count ? lineLength - pad : end - start;
  10407. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  10408. } else if (j > i) {
  10409. if (end > count) {
  10410. var length$1 = Math.min(end - count, lineLength);
  10411. res.push(" | " + repeat$1("^", length$1));
  10412. }
  10413. count += lineLength + 1;
  10414. }
  10415. }
  10416. break
  10417. }
  10418. }
  10419. return res.join('\n')
  10420. }
  10421. function repeat$1 (str, n) {
  10422. var result = '';
  10423. while (true) { // eslint-disable-line
  10424. if (n & 1) { result += str; }
  10425. n >>>= 1;
  10426. if (n <= 0) { break }
  10427. str += str;
  10428. }
  10429. return result
  10430. }
  10431. /* */
  10432. function createFunction (code, errors) {
  10433. try {
  10434. return new Function(code)
  10435. } catch (err) {
  10436. errors.push({ err: err, code: code });
  10437. return noop
  10438. }
  10439. }
  10440. function createCompileToFunctionFn (compile) {
  10441. var cache = Object.create(null);
  10442. return function compileToFunctions (
  10443. template,
  10444. options,
  10445. vm
  10446. ) {
  10447. options = extend({}, options);
  10448. var warn$$1 = options.warn || warn;
  10449. delete options.warn;
  10450. /* istanbul ignore if */
  10451. {
  10452. // detect possible CSP restriction
  10453. try {
  10454. new Function('return 1');
  10455. } catch (e) {
  10456. if (e.toString().match(/unsafe-eval|CSP/)) {
  10457. warn$$1(
  10458. 'It seems you are using the standalone build of Vue.js in an ' +
  10459. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  10460. 'The template compiler cannot work in this environment. Consider ' +
  10461. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  10462. 'templates into render functions.'
  10463. );
  10464. }
  10465. }
  10466. }
  10467. // check cache
  10468. var key = options.delimiters
  10469. ? String(options.delimiters) + template
  10470. : template;
  10471. if (cache[key]) {
  10472. return cache[key]
  10473. }
  10474. // compile
  10475. var compiled = compile(template, options);
  10476. // check compilation errors/tips
  10477. {
  10478. if (compiled.errors && compiled.errors.length) {
  10479. if (options.outputSourceRange) {
  10480. compiled.errors.forEach(function (e) {
  10481. warn$$1(
  10482. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  10483. generateCodeFrame(template, e.start, e.end),
  10484. vm
  10485. );
  10486. });
  10487. } else {
  10488. warn$$1(
  10489. "Error compiling template:\n\n" + template + "\n\n" +
  10490. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  10491. vm
  10492. );
  10493. }
  10494. }
  10495. if (compiled.tips && compiled.tips.length) {
  10496. if (options.outputSourceRange) {
  10497. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  10498. } else {
  10499. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  10500. }
  10501. }
  10502. }
  10503. // turn code into functions
  10504. var res = {};
  10505. var fnGenErrors = [];
  10506. res.render = createFunction(compiled.render, fnGenErrors);
  10507. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  10508. return createFunction(code, fnGenErrors)
  10509. });
  10510. // check function generation errors.
  10511. // this should only happen if there is a bug in the compiler itself.
  10512. // mostly for codegen development use
  10513. /* istanbul ignore if */
  10514. {
  10515. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  10516. warn$$1(
  10517. "Failed to generate render function:\n\n" +
  10518. fnGenErrors.map(function (ref) {
  10519. var err = ref.err;
  10520. var code = ref.code;
  10521. return ((err.toString()) + " in\n\n" + code + "\n");
  10522. }).join('\n'),
  10523. vm
  10524. );
  10525. }
  10526. }
  10527. return (cache[key] = res)
  10528. }
  10529. }
  10530. /* */
  10531. function createCompilerCreator (baseCompile) {
  10532. return function createCompiler (baseOptions) {
  10533. function compile (
  10534. template,
  10535. options
  10536. ) {
  10537. var finalOptions = Object.create(baseOptions);
  10538. var errors = [];
  10539. var tips = [];
  10540. var warn = function (msg, range, tip) {
  10541. (tip ? tips : errors).push(msg);
  10542. };
  10543. if (options) {
  10544. if (options.outputSourceRange) {
  10545. // $flow-disable-line
  10546. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  10547. warn = function (msg, range, tip) {
  10548. var data = { msg: msg };
  10549. if (range) {
  10550. if (range.start != null) {
  10551. data.start = range.start + leadingSpaceLength;
  10552. }
  10553. if (range.end != null) {
  10554. data.end = range.end + leadingSpaceLength;
  10555. }
  10556. }
  10557. (tip ? tips : errors).push(data);
  10558. };
  10559. }
  10560. // merge custom modules
  10561. if (options.modules) {
  10562. finalOptions.modules =
  10563. (baseOptions.modules || []).concat(options.modules);
  10564. }
  10565. // merge custom directives
  10566. if (options.directives) {
  10567. finalOptions.directives = extend(
  10568. Object.create(baseOptions.directives || null),
  10569. options.directives
  10570. );
  10571. }
  10572. // copy other options
  10573. for (var key in options) {
  10574. if (key !== 'modules' && key !== 'directives') {
  10575. finalOptions[key] = options[key];
  10576. }
  10577. }
  10578. }
  10579. finalOptions.warn = warn;
  10580. var compiled = baseCompile(template.trim(), finalOptions);
  10581. {
  10582. detectErrors(compiled.ast, warn);
  10583. }
  10584. compiled.errors = errors;
  10585. compiled.tips = tips;
  10586. return compiled
  10587. }
  10588. return {
  10589. compile: compile,
  10590. compileToFunctions: createCompileToFunctionFn(compile)
  10591. }
  10592. }
  10593. }
  10594. /* */
  10595. // `createCompilerCreator` allows creating compilers that use alternative
  10596. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  10597. // Here we just export a default compiler using the default parts.
  10598. var createCompiler = createCompilerCreator(function baseCompile (
  10599. template,
  10600. options
  10601. ) {
  10602. var ast = parse(template.trim(), options);
  10603. if (options.optimize !== false) {
  10604. optimize(ast, options);
  10605. }
  10606. var code = generate(ast, options);
  10607. return {
  10608. ast: ast,
  10609. render: code.render,
  10610. staticRenderFns: code.staticRenderFns
  10611. }
  10612. });
  10613. /* */
  10614. var ref$1 = createCompiler(baseOptions);
  10615. var compile = ref$1.compile;
  10616. var compileToFunctions = ref$1.compileToFunctions;
  10617. /* */
  10618. // check whether current browser encodes a char inside attribute values
  10619. var div;
  10620. function getShouldDecode (href) {
  10621. div = div || document.createElement('div');
  10622. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  10623. return div.innerHTML.indexOf('&#10;') > 0
  10624. }
  10625. // #3663: IE encodes newlines inside attribute values while other browsers don't
  10626. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  10627. // #6828: chrome encodes content in a[href]
  10628. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  10629. /* */
  10630. var idToTemplate = cached(function (id) {
  10631. var el = query(id);
  10632. return el && el.innerHTML
  10633. });
  10634. var mount = Vue.prototype.$mount;
  10635. Vue.prototype.$mount = function (
  10636. el,
  10637. hydrating
  10638. ) {
  10639. el = el && query(el);
  10640. /* istanbul ignore if */
  10641. if (el === document.body || el === document.documentElement) {
  10642. warn(
  10643. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  10644. );
  10645. return this
  10646. }
  10647. var options = this.$options;
  10648. // resolve template/el and convert to render function
  10649. if (!options.render) {
  10650. var template = options.template;
  10651. if (template) {
  10652. if (typeof template === 'string') {
  10653. if (template.charAt(0) === '#') {
  10654. template = idToTemplate(template);
  10655. /* istanbul ignore if */
  10656. if (!template) {
  10657. warn(
  10658. ("Template element not found or is empty: " + (options.template)),
  10659. this
  10660. );
  10661. }
  10662. }
  10663. } else if (template.nodeType) {
  10664. template = template.innerHTML;
  10665. } else {
  10666. {
  10667. warn('invalid template option:' + template, this);
  10668. }
  10669. return this
  10670. }
  10671. } else if (el) {
  10672. template = getOuterHTML(el);
  10673. }
  10674. if (template) {
  10675. /* istanbul ignore if */
  10676. if (config.performance && mark) {
  10677. mark('compile');
  10678. }
  10679. var ref = compileToFunctions(template, {
  10680. outputSourceRange: "development" !== 'production',
  10681. shouldDecodeNewlines: shouldDecodeNewlines,
  10682. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  10683. delimiters: options.delimiters,
  10684. comments: options.comments
  10685. }, this);
  10686. var render = ref.render;
  10687. var staticRenderFns = ref.staticRenderFns;
  10688. options.render = render;
  10689. options.staticRenderFns = staticRenderFns;
  10690. /* istanbul ignore if */
  10691. if (config.performance && mark) {
  10692. mark('compile end');
  10693. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  10694. }
  10695. }
  10696. }
  10697. return mount.call(this, el, hydrating)
  10698. };
  10699. /**
  10700. * Get outerHTML of elements, taking care
  10701. * of SVG elements in IE as well.
  10702. */
  10703. function getOuterHTML (el) {
  10704. if (el.outerHTML) {
  10705. return el.outerHTML
  10706. } else {
  10707. var container = document.createElement('div');
  10708. container.appendChild(el.cloneNode(true));
  10709. return container.innerHTML
  10710. }
  10711. }
  10712. Vue.compile = compileToFunctions;
  10713. return Vue;
  10714. }));