vue.esm.js 319 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993
  1. /*!
  2. * Vue.js v2.6.12
  3. * (c) 2014-2020 Evan You
  4. * Released under the MIT License.
  5. */
  6. /* */
  7. var emptyObject = Object.freeze({});
  8. // These helpers produce better VM code in JS engines due to their
  9. // explicitness and function inlining.
  10. function isUndef (v) {
  11. return v === undefined || v === null
  12. }
  13. function isDef (v) {
  14. return v !== undefined && v !== null
  15. }
  16. function isTrue (v) {
  17. return v === true
  18. }
  19. function isFalse (v) {
  20. return v === false
  21. }
  22. /**
  23. * Check if value is primitive.
  24. */
  25. function isPrimitive (value) {
  26. return (
  27. typeof value === 'string' ||
  28. typeof value === 'number' ||
  29. // $flow-disable-line
  30. typeof value === 'symbol' ||
  31. typeof value === 'boolean'
  32. )
  33. }
  34. /**
  35. * Quick object check - this is primarily used to tell
  36. * Objects from primitive values when we know the value
  37. * is a JSON-compliant type.
  38. */
  39. function isObject (obj) {
  40. return obj !== null && typeof obj === 'object'
  41. }
  42. /**
  43. * Get the raw type string of a value, e.g., [object Object].
  44. */
  45. var _toString = Object.prototype.toString;
  46. function toRawType (value) {
  47. return _toString.call(value).slice(8, -1)
  48. }
  49. /**
  50. * Strict object type check. Only returns true
  51. * for plain JavaScript objects.
  52. */
  53. function isPlainObject (obj) {
  54. return _toString.call(obj) === '[object Object]'
  55. }
  56. function isRegExp (v) {
  57. return _toString.call(v) === '[object RegExp]'
  58. }
  59. /**
  60. * Check if val is a valid array index.
  61. */
  62. function isValidArrayIndex (val) {
  63. var n = parseFloat(String(val));
  64. return n >= 0 && Math.floor(n) === n && isFinite(val)
  65. }
  66. function isPromise (val) {
  67. return (
  68. isDef(val) &&
  69. typeof val.then === 'function' &&
  70. typeof val.catch === 'function'
  71. )
  72. }
  73. /**
  74. * Convert a value to a string that is actually rendered.
  75. */
  76. function toString (val) {
  77. return val == null
  78. ? ''
  79. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  80. ? JSON.stringify(val, null, 2)
  81. : String(val)
  82. }
  83. /**
  84. * Convert an input value to a number for persistence.
  85. * If the conversion fails, return original string.
  86. */
  87. function toNumber (val) {
  88. var n = parseFloat(val);
  89. return isNaN(n) ? val : n
  90. }
  91. /**
  92. * Make a map and return a function for checking if a key
  93. * is in that map.
  94. */
  95. function makeMap (
  96. str,
  97. expectsLowerCase
  98. ) {
  99. var map = Object.create(null);
  100. var list = str.split(',');
  101. for (var i = 0; i < list.length; i++) {
  102. map[list[i]] = true;
  103. }
  104. return expectsLowerCase
  105. ? function (val) { return map[val.toLowerCase()]; }
  106. : function (val) { return map[val]; }
  107. }
  108. /**
  109. * Check if a tag is a built-in tag.
  110. */
  111. var isBuiltInTag = makeMap('slot,component', true);
  112. /**
  113. * Check if an attribute is a reserved attribute.
  114. */
  115. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  116. /**
  117. * Remove an item from an array.
  118. */
  119. function remove (arr, item) {
  120. if (arr.length) {
  121. var index = arr.indexOf(item);
  122. if (index > -1) {
  123. return arr.splice(index, 1)
  124. }
  125. }
  126. }
  127. /**
  128. * Check whether an object has the property.
  129. */
  130. var hasOwnProperty = Object.prototype.hasOwnProperty;
  131. function hasOwn (obj, key) {
  132. return hasOwnProperty.call(obj, key)
  133. }
  134. /**
  135. * Create a cached version of a pure function.
  136. */
  137. function cached (fn) {
  138. var cache = Object.create(null);
  139. return (function cachedFn (str) {
  140. var hit = cache[str];
  141. return hit || (cache[str] = fn(str))
  142. })
  143. }
  144. /**
  145. * Camelize a hyphen-delimited string.
  146. */
  147. var camelizeRE = /-(\w)/g;
  148. var camelize = cached(function (str) {
  149. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  150. });
  151. /**
  152. * Capitalize a string.
  153. */
  154. var capitalize = cached(function (str) {
  155. return str.charAt(0).toUpperCase() + str.slice(1)
  156. });
  157. /**
  158. * Hyphenate a camelCase string.
  159. */
  160. var hyphenateRE = /\B([A-Z])/g;
  161. var hyphenate = cached(function (str) {
  162. return str.replace(hyphenateRE, '-$1').toLowerCase()
  163. });
  164. /**
  165. * Simple bind polyfill for environments that do not support it,
  166. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  167. * since native bind is now performant enough in most browsers.
  168. * But removing it would mean breaking code that was able to run in
  169. * PhantomJS 1.x, so this must be kept for backward compatibility.
  170. */
  171. /* istanbul ignore next */
  172. function polyfillBind (fn, ctx) {
  173. function boundFn (a) {
  174. var l = arguments.length;
  175. return l
  176. ? l > 1
  177. ? fn.apply(ctx, arguments)
  178. : fn.call(ctx, a)
  179. : fn.call(ctx)
  180. }
  181. boundFn._length = fn.length;
  182. return boundFn
  183. }
  184. function nativeBind (fn, ctx) {
  185. return fn.bind(ctx)
  186. }
  187. var bind = Function.prototype.bind
  188. ? nativeBind
  189. : polyfillBind;
  190. /**
  191. * Convert an Array-like object to a real Array.
  192. */
  193. function toArray (list, start) {
  194. start = start || 0;
  195. var i = list.length - start;
  196. var ret = new Array(i);
  197. while (i--) {
  198. ret[i] = list[i + start];
  199. }
  200. return ret
  201. }
  202. /**
  203. * Mix properties into target object.
  204. */
  205. function extend (to, _from) {
  206. for (var key in _from) {
  207. to[key] = _from[key];
  208. }
  209. return to
  210. }
  211. /**
  212. * Merge an Array of Objects into a single Object.
  213. */
  214. function toObject (arr) {
  215. var res = {};
  216. for (var i = 0; i < arr.length; i++) {
  217. if (arr[i]) {
  218. extend(res, arr[i]);
  219. }
  220. }
  221. return res
  222. }
  223. /* eslint-disable no-unused-vars */
  224. /**
  225. * Perform no operation.
  226. * Stubbing args to make Flow happy without leaving useless transpiled code
  227. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  228. */
  229. function noop (a, b, c) {}
  230. /**
  231. * Always return false.
  232. */
  233. var no = function (a, b, c) { return false; };
  234. /* eslint-enable no-unused-vars */
  235. /**
  236. * Return the same value.
  237. */
  238. var identity = function (_) { return _; };
  239. /**
  240. * Generate a string containing static keys from compiler modules.
  241. */
  242. function genStaticKeys (modules) {
  243. return modules.reduce(function (keys, m) {
  244. return keys.concat(m.staticKeys || [])
  245. }, []).join(',')
  246. }
  247. /**
  248. * Check if two values are loosely equal - that is,
  249. * if they are plain objects, do they have the same shape?
  250. */
  251. function looseEqual (a, b) {
  252. if (a === b) { return true }
  253. var isObjectA = isObject(a);
  254. var isObjectB = isObject(b);
  255. if (isObjectA && isObjectB) {
  256. try {
  257. var isArrayA = Array.isArray(a);
  258. var isArrayB = Array.isArray(b);
  259. if (isArrayA && isArrayB) {
  260. return a.length === b.length && a.every(function (e, i) {
  261. return looseEqual(e, b[i])
  262. })
  263. } else if (a instanceof Date && b instanceof Date) {
  264. return a.getTime() === b.getTime()
  265. } else if (!isArrayA && !isArrayB) {
  266. var keysA = Object.keys(a);
  267. var keysB = Object.keys(b);
  268. return keysA.length === keysB.length && keysA.every(function (key) {
  269. return looseEqual(a[key], b[key])
  270. })
  271. } else {
  272. /* istanbul ignore next */
  273. return false
  274. }
  275. } catch (e) {
  276. /* istanbul ignore next */
  277. return false
  278. }
  279. } else if (!isObjectA && !isObjectB) {
  280. return String(a) === String(b)
  281. } else {
  282. return false
  283. }
  284. }
  285. /**
  286. * Return the first index at which a loosely equal value can be
  287. * found in the array (if value is a plain object, the array must
  288. * contain an object of the same shape), or -1 if it is not present.
  289. */
  290. function looseIndexOf (arr, val) {
  291. for (var i = 0; i < arr.length; i++) {
  292. if (looseEqual(arr[i], val)) { return i }
  293. }
  294. return -1
  295. }
  296. /**
  297. * Ensure a function is called only once.
  298. */
  299. function once (fn) {
  300. var called = false;
  301. return function () {
  302. if (!called) {
  303. called = true;
  304. fn.apply(this, arguments);
  305. }
  306. }
  307. }
  308. var SSR_ATTR = 'data-server-rendered';
  309. var ASSET_TYPES = [
  310. 'component',
  311. 'directive',
  312. 'filter'
  313. ];
  314. var LIFECYCLE_HOOKS = [
  315. 'beforeCreate',
  316. 'created',
  317. 'beforeMount',
  318. 'mounted',
  319. 'beforeUpdate',
  320. 'updated',
  321. 'beforeDestroy',
  322. 'destroyed',
  323. 'activated',
  324. 'deactivated',
  325. 'errorCaptured',
  326. 'serverPrefetch'
  327. ];
  328. /* */
  329. var config = ({
  330. /**
  331. * Option merge strategies (used in core/util/options)
  332. */
  333. // $flow-disable-line
  334. optionMergeStrategies: Object.create(null),
  335. /**
  336. * Whether to suppress warnings.
  337. */
  338. silent: false,
  339. /**
  340. * Show production mode tip message on boot?
  341. */
  342. productionTip: process.env.NODE_ENV !== 'production',
  343. /**
  344. * Whether to enable devtools
  345. */
  346. devtools: process.env.NODE_ENV !== 'production',
  347. /**
  348. * Whether to record perf
  349. */
  350. performance: false,
  351. /**
  352. * Error handler for watcher errors
  353. */
  354. errorHandler: null,
  355. /**
  356. * Warn handler for watcher warns
  357. */
  358. warnHandler: null,
  359. /**
  360. * Ignore certain custom elements
  361. */
  362. ignoredElements: [],
  363. /**
  364. * Custom user key aliases for v-on
  365. */
  366. // $flow-disable-line
  367. keyCodes: Object.create(null),
  368. /**
  369. * Check if a tag is reserved so that it cannot be registered as a
  370. * component. This is platform-dependent and may be overwritten.
  371. */
  372. isReservedTag: no,
  373. /**
  374. * Check if an attribute is reserved so that it cannot be used as a component
  375. * prop. This is platform-dependent and may be overwritten.
  376. */
  377. isReservedAttr: no,
  378. /**
  379. * Check if a tag is an unknown element.
  380. * Platform-dependent.
  381. */
  382. isUnknownElement: no,
  383. /**
  384. * Get the namespace of an element
  385. */
  386. getTagNamespace: noop,
  387. /**
  388. * Parse the real tag name for the specific platform.
  389. */
  390. parsePlatformTagName: identity,
  391. /**
  392. * Check if an attribute must be bound using property, e.g. value
  393. * Platform-dependent.
  394. */
  395. mustUseProp: no,
  396. /**
  397. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  398. * This will significantly reduce performance if set to false.
  399. */
  400. async: true,
  401. /**
  402. * Exposed for legacy reasons
  403. */
  404. _lifecycleHooks: LIFECYCLE_HOOKS
  405. });
  406. /* */
  407. /**
  408. * unicode letters used for parsing html tags, component names and property paths.
  409. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  410. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  411. */
  412. var unicodeRegExp = /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/;
  413. /**
  414. * Check if a string starts with $ or _
  415. */
  416. function isReserved (str) {
  417. var c = (str + '').charCodeAt(0);
  418. return c === 0x24 || c === 0x5F
  419. }
  420. /**
  421. * Define a property.
  422. */
  423. function def (obj, key, val, enumerable) {
  424. Object.defineProperty(obj, key, {
  425. value: val,
  426. enumerable: !!enumerable,
  427. writable: true,
  428. configurable: true
  429. });
  430. }
  431. /**
  432. * Parse simple path.
  433. */
  434. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  435. function parsePath (path) {
  436. if (bailRE.test(path)) {
  437. return
  438. }
  439. var segments = path.split('.');
  440. return function (obj) {
  441. for (var i = 0; i < segments.length; i++) {
  442. if (!obj) { return }
  443. obj = obj[segments[i]];
  444. }
  445. return obj
  446. }
  447. }
  448. /* */
  449. // can we use __proto__?
  450. var hasProto = '__proto__' in {};
  451. // Browser environment sniffing
  452. var inBrowser = typeof window !== 'undefined';
  453. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  454. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  455. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  456. var isIE = UA && /msie|trident/.test(UA);
  457. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  458. var isEdge = UA && UA.indexOf('edge/') > 0;
  459. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  460. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  461. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  462. var isPhantomJS = UA && /phantomjs/.test(UA);
  463. var isFF = UA && UA.match(/firefox\/(\d+)/);
  464. // Firefox has a "watch" function on Object.prototype...
  465. var nativeWatch = ({}).watch;
  466. var supportsPassive = false;
  467. if (inBrowser) {
  468. try {
  469. var opts = {};
  470. Object.defineProperty(opts, 'passive', ({
  471. get: function get () {
  472. /* istanbul ignore next */
  473. supportsPassive = true;
  474. }
  475. })); // https://github.com/facebook/flow/issues/285
  476. window.addEventListener('test-passive', null, opts);
  477. } catch (e) {}
  478. }
  479. // this needs to be lazy-evaled because vue may be required before
  480. // vue-server-renderer can set VUE_ENV
  481. var _isServer;
  482. var isServerRendering = function () {
  483. if (_isServer === undefined) {
  484. /* istanbul ignore if */
  485. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  486. // detect presence of vue-server-renderer and avoid
  487. // Webpack shimming the process
  488. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  489. } else {
  490. _isServer = false;
  491. }
  492. }
  493. return _isServer
  494. };
  495. // detect devtools
  496. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  497. /* istanbul ignore next */
  498. function isNative (Ctor) {
  499. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  500. }
  501. var hasSymbol =
  502. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  503. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  504. var _Set;
  505. /* istanbul ignore if */ // $flow-disable-line
  506. if (typeof Set !== 'undefined' && isNative(Set)) {
  507. // use native Set when available.
  508. _Set = Set;
  509. } else {
  510. // a non-standard Set polyfill that only works with primitive keys.
  511. _Set = /*@__PURE__*/(function () {
  512. function Set () {
  513. this.set = Object.create(null);
  514. }
  515. Set.prototype.has = function has (key) {
  516. return this.set[key] === true
  517. };
  518. Set.prototype.add = function add (key) {
  519. this.set[key] = true;
  520. };
  521. Set.prototype.clear = function clear () {
  522. this.set = Object.create(null);
  523. };
  524. return Set;
  525. }());
  526. }
  527. /* */
  528. var warn = noop;
  529. var tip = noop;
  530. var generateComponentTrace = (noop); // work around flow check
  531. var formatComponentName = (noop);
  532. if (process.env.NODE_ENV !== 'production') {
  533. var hasConsole = typeof console !== 'undefined';
  534. var classifyRE = /(?:^|[-_])(\w)/g;
  535. var classify = function (str) { return str
  536. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  537. .replace(/[-_]/g, ''); };
  538. warn = function (msg, vm) {
  539. var trace = vm ? generateComponentTrace(vm) : '';
  540. if (config.warnHandler) {
  541. config.warnHandler.call(null, msg, vm, trace);
  542. } else if (hasConsole && (!config.silent)) {
  543. console.error(("[Vue warn]: " + msg + trace));
  544. }
  545. };
  546. tip = function (msg, vm) {
  547. if (hasConsole && (!config.silent)) {
  548. console.warn("[Vue tip]: " + msg + (
  549. vm ? generateComponentTrace(vm) : ''
  550. ));
  551. }
  552. };
  553. formatComponentName = function (vm, includeFile) {
  554. if (vm.$root === vm) {
  555. return '<Root>'
  556. }
  557. var options = typeof vm === 'function' && vm.cid != null
  558. ? vm.options
  559. : vm._isVue
  560. ? vm.$options || vm.constructor.options
  561. : vm;
  562. var name = options.name || options._componentTag;
  563. var file = options.__file;
  564. if (!name && file) {
  565. var match = file.match(/([^/\\]+)\.vue$/);
  566. name = match && match[1];
  567. }
  568. return (
  569. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  570. (file && includeFile !== false ? (" at " + file) : '')
  571. )
  572. };
  573. var repeat = function (str, n) {
  574. var res = '';
  575. while (n) {
  576. if (n % 2 === 1) { res += str; }
  577. if (n > 1) { str += str; }
  578. n >>= 1;
  579. }
  580. return res
  581. };
  582. generateComponentTrace = function (vm) {
  583. if (vm._isVue && vm.$parent) {
  584. var tree = [];
  585. var currentRecursiveSequence = 0;
  586. while (vm) {
  587. if (tree.length > 0) {
  588. var last = tree[tree.length - 1];
  589. if (last.constructor === vm.constructor) {
  590. currentRecursiveSequence++;
  591. vm = vm.$parent;
  592. continue
  593. } else if (currentRecursiveSequence > 0) {
  594. tree[tree.length - 1] = [last, currentRecursiveSequence];
  595. currentRecursiveSequence = 0;
  596. }
  597. }
  598. tree.push(vm);
  599. vm = vm.$parent;
  600. }
  601. return '\n\nfound in\n\n' + tree
  602. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  603. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  604. : formatComponentName(vm))); })
  605. .join('\n')
  606. } else {
  607. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  608. }
  609. };
  610. }
  611. /* */
  612. var uid = 0;
  613. /**
  614. * A dep is an observable that can have multiple
  615. * directives subscribing to it.
  616. */
  617. var Dep = function Dep () {
  618. this.id = uid++;
  619. this.subs = [];
  620. };
  621. Dep.prototype.addSub = function addSub (sub) {
  622. this.subs.push(sub);
  623. };
  624. Dep.prototype.removeSub = function removeSub (sub) {
  625. remove(this.subs, sub);
  626. };
  627. Dep.prototype.depend = function depend () {
  628. if (Dep.target) {
  629. Dep.target.addDep(this);
  630. }
  631. };
  632. Dep.prototype.notify = function notify () {
  633. // stabilize the subscriber list first
  634. var subs = this.subs.slice();
  635. if (process.env.NODE_ENV !== 'production' && !config.async) {
  636. // subs aren't sorted in scheduler if not running async
  637. // we need to sort them now to make sure they fire in correct
  638. // order
  639. subs.sort(function (a, b) { return a.id - b.id; });
  640. }
  641. for (var i = 0, l = subs.length; i < l; i++) {
  642. subs[i].update();
  643. }
  644. };
  645. // The current target watcher being evaluated.
  646. // This is globally unique because only one watcher
  647. // can be evaluated at a time.
  648. Dep.target = null;
  649. var targetStack = [];
  650. function pushTarget (target) {
  651. targetStack.push(target);
  652. Dep.target = target;
  653. }
  654. function popTarget () {
  655. targetStack.pop();
  656. Dep.target = targetStack[targetStack.length - 1];
  657. }
  658. /* */
  659. var VNode = function VNode (
  660. tag,
  661. data,
  662. children,
  663. text,
  664. elm,
  665. context,
  666. componentOptions,
  667. asyncFactory
  668. ) {
  669. this.tag = tag;
  670. this.data = data;
  671. this.children = children;
  672. this.text = text;
  673. this.elm = elm;
  674. this.ns = undefined;
  675. this.context = context;
  676. this.fnContext = undefined;
  677. this.fnOptions = undefined;
  678. this.fnScopeId = undefined;
  679. this.key = data && data.key;
  680. this.componentOptions = componentOptions;
  681. this.componentInstance = undefined;
  682. this.parent = undefined;
  683. this.raw = false;
  684. this.isStatic = false;
  685. this.isRootInsert = true;
  686. this.isComment = false;
  687. this.isCloned = false;
  688. this.isOnce = false;
  689. this.asyncFactory = asyncFactory;
  690. this.asyncMeta = undefined;
  691. this.isAsyncPlaceholder = false;
  692. };
  693. var prototypeAccessors = { child: { configurable: true } };
  694. // DEPRECATED: alias for componentInstance for backwards compat.
  695. /* istanbul ignore next */
  696. prototypeAccessors.child.get = function () {
  697. return this.componentInstance
  698. };
  699. Object.defineProperties( VNode.prototype, prototypeAccessors );
  700. var createEmptyVNode = function (text) {
  701. if ( text === void 0 ) text = '';
  702. var node = new VNode();
  703. node.text = text;
  704. node.isComment = true;
  705. return node
  706. };
  707. function createTextVNode (val) {
  708. return new VNode(undefined, undefined, undefined, String(val))
  709. }
  710. // optimized shallow clone
  711. // used for static nodes and slot nodes because they may be reused across
  712. // multiple renders, cloning them avoids errors when DOM manipulations rely
  713. // on their elm reference.
  714. function cloneVNode (vnode) {
  715. var cloned = new VNode(
  716. vnode.tag,
  717. vnode.data,
  718. // #7975
  719. // clone children array to avoid mutating original in case of cloning
  720. // a child.
  721. vnode.children && vnode.children.slice(),
  722. vnode.text,
  723. vnode.elm,
  724. vnode.context,
  725. vnode.componentOptions,
  726. vnode.asyncFactory
  727. );
  728. cloned.ns = vnode.ns;
  729. cloned.isStatic = vnode.isStatic;
  730. cloned.key = vnode.key;
  731. cloned.isComment = vnode.isComment;
  732. cloned.fnContext = vnode.fnContext;
  733. cloned.fnOptions = vnode.fnOptions;
  734. cloned.fnScopeId = vnode.fnScopeId;
  735. cloned.asyncMeta = vnode.asyncMeta;
  736. cloned.isCloned = true;
  737. return cloned
  738. }
  739. /*
  740. * not type checking this file because flow doesn't play well with
  741. * dynamically accessing methods on Array prototype
  742. */
  743. var arrayProto = Array.prototype;
  744. var arrayMethods = Object.create(arrayProto);
  745. var methodsToPatch = [
  746. 'push',
  747. 'pop',
  748. 'shift',
  749. 'unshift',
  750. 'splice',
  751. 'sort',
  752. 'reverse'
  753. ];
  754. /**
  755. * Intercept mutating methods and emit events
  756. */
  757. methodsToPatch.forEach(function (method) {
  758. // cache original method
  759. var original = arrayProto[method];
  760. def(arrayMethods, method, function mutator () {
  761. var args = [], len = arguments.length;
  762. while ( len-- ) args[ len ] = arguments[ len ];
  763. var result = original.apply(this, args);
  764. var ob = this.__ob__;
  765. var inserted;
  766. switch (method) {
  767. case 'push':
  768. case 'unshift':
  769. inserted = args;
  770. break
  771. case 'splice':
  772. inserted = args.slice(2);
  773. break
  774. }
  775. if (inserted) { ob.observeArray(inserted); }
  776. // notify change
  777. ob.dep.notify();
  778. return result
  779. });
  780. });
  781. /* */
  782. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  783. /**
  784. * In some cases we may want to disable observation inside a component's
  785. * update computation.
  786. */
  787. var shouldObserve = true;
  788. function toggleObserving (value) {
  789. shouldObserve = value;
  790. }
  791. /**
  792. * Observer class that is attached to each observed
  793. * object. Once attached, the observer converts the target
  794. * object's property keys into getter/setters that
  795. * collect dependencies and dispatch updates.
  796. */
  797. var Observer = function Observer (value) {
  798. this.value = value;
  799. this.dep = new Dep();
  800. this.vmCount = 0;
  801. def(value, '__ob__', this);
  802. if (Array.isArray(value)) {
  803. if (hasProto) {
  804. protoAugment(value, arrayMethods);
  805. } else {
  806. copyAugment(value, arrayMethods, arrayKeys);
  807. }
  808. this.observeArray(value);
  809. } else {
  810. this.walk(value);
  811. }
  812. };
  813. /**
  814. * Walk through all properties and convert them into
  815. * getter/setters. This method should only be called when
  816. * value type is Object.
  817. */
  818. Observer.prototype.walk = function walk (obj) {
  819. var keys = Object.keys(obj);
  820. for (var i = 0; i < keys.length; i++) {
  821. defineReactive$$1(obj, keys[i]);
  822. }
  823. };
  824. /**
  825. * Observe a list of Array items.
  826. */
  827. Observer.prototype.observeArray = function observeArray (items) {
  828. for (var i = 0, l = items.length; i < l; i++) {
  829. observe(items[i]);
  830. }
  831. };
  832. // helpers
  833. /**
  834. * Augment a target Object or Array by intercepting
  835. * the prototype chain using __proto__
  836. */
  837. function protoAugment (target, src) {
  838. /* eslint-disable no-proto */
  839. target.__proto__ = src;
  840. /* eslint-enable no-proto */
  841. }
  842. /**
  843. * Augment a target Object or Array by defining
  844. * hidden properties.
  845. */
  846. /* istanbul ignore next */
  847. function copyAugment (target, src, keys) {
  848. for (var i = 0, l = keys.length; i < l; i++) {
  849. var key = keys[i];
  850. def(target, key, src[key]);
  851. }
  852. }
  853. /**
  854. * Attempt to create an observer instance for a value,
  855. * returns the new observer if successfully observed,
  856. * or the existing observer if the value already has one.
  857. */
  858. function observe (value, asRootData) {
  859. if (!isObject(value) || value instanceof VNode) {
  860. return
  861. }
  862. var ob;
  863. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  864. ob = value.__ob__;
  865. } else if (
  866. shouldObserve &&
  867. !isServerRendering() &&
  868. (Array.isArray(value) || isPlainObject(value)) &&
  869. Object.isExtensible(value) &&
  870. !value._isVue
  871. ) {
  872. ob = new Observer(value);
  873. }
  874. if (asRootData && ob) {
  875. ob.vmCount++;
  876. }
  877. return ob
  878. }
  879. /**
  880. * Define a reactive property on an Object.
  881. */
  882. function defineReactive$$1 (
  883. obj,
  884. key,
  885. val,
  886. customSetter,
  887. shallow
  888. ) {
  889. var dep = new Dep();
  890. var property = Object.getOwnPropertyDescriptor(obj, key);
  891. if (property && property.configurable === false) {
  892. return
  893. }
  894. // cater for pre-defined getter/setters
  895. var getter = property && property.get;
  896. var setter = property && property.set;
  897. if ((!getter || setter) && arguments.length === 2) {
  898. val = obj[key];
  899. }
  900. var childOb = !shallow && observe(val);
  901. Object.defineProperty(obj, key, {
  902. enumerable: true,
  903. configurable: true,
  904. get: function reactiveGetter () {
  905. var value = getter ? getter.call(obj) : val;
  906. if (Dep.target) {
  907. dep.depend();
  908. if (childOb) {
  909. childOb.dep.depend();
  910. if (Array.isArray(value)) {
  911. dependArray(value);
  912. }
  913. }
  914. }
  915. return value
  916. },
  917. set: function reactiveSetter (newVal) {
  918. var value = getter ? getter.call(obj) : val;
  919. /* eslint-disable no-self-compare */
  920. if (newVal === value || (newVal !== newVal && value !== value)) {
  921. return
  922. }
  923. /* eslint-enable no-self-compare */
  924. if (process.env.NODE_ENV !== 'production' && customSetter) {
  925. customSetter();
  926. }
  927. // #7981: for accessor properties without setter
  928. if (getter && !setter) { return }
  929. if (setter) {
  930. setter.call(obj, newVal);
  931. } else {
  932. val = newVal;
  933. }
  934. childOb = !shallow && observe(newVal);
  935. dep.notify();
  936. }
  937. });
  938. }
  939. /**
  940. * Set a property on an object. Adds the new property and
  941. * triggers change notification if the property doesn't
  942. * already exist.
  943. */
  944. function set (target, key, val) {
  945. if (process.env.NODE_ENV !== 'production' &&
  946. (isUndef(target) || isPrimitive(target))
  947. ) {
  948. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  949. }
  950. if (Array.isArray(target) && isValidArrayIndex(key)) {
  951. target.length = Math.max(target.length, key);
  952. target.splice(key, 1, val);
  953. return val
  954. }
  955. if (key in target && !(key in Object.prototype)) {
  956. target[key] = val;
  957. return val
  958. }
  959. var ob = (target).__ob__;
  960. if (target._isVue || (ob && ob.vmCount)) {
  961. process.env.NODE_ENV !== 'production' && warn(
  962. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  963. 'at runtime - declare it upfront in the data option.'
  964. );
  965. return val
  966. }
  967. if (!ob) {
  968. target[key] = val;
  969. return val
  970. }
  971. defineReactive$$1(ob.value, key, val);
  972. ob.dep.notify();
  973. return val
  974. }
  975. /**
  976. * Delete a property and trigger change if necessary.
  977. */
  978. function del (target, key) {
  979. if (process.env.NODE_ENV !== 'production' &&
  980. (isUndef(target) || isPrimitive(target))
  981. ) {
  982. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  983. }
  984. if (Array.isArray(target) && isValidArrayIndex(key)) {
  985. target.splice(key, 1);
  986. return
  987. }
  988. var ob = (target).__ob__;
  989. if (target._isVue || (ob && ob.vmCount)) {
  990. process.env.NODE_ENV !== 'production' && warn(
  991. 'Avoid deleting properties on a Vue instance or its root $data ' +
  992. '- just set it to null.'
  993. );
  994. return
  995. }
  996. if (!hasOwn(target, key)) {
  997. return
  998. }
  999. delete target[key];
  1000. if (!ob) {
  1001. return
  1002. }
  1003. ob.dep.notify();
  1004. }
  1005. /**
  1006. * Collect dependencies on array elements when the array is touched, since
  1007. * we cannot intercept array element access like property getters.
  1008. */
  1009. function dependArray (value) {
  1010. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  1011. e = value[i];
  1012. e && e.__ob__ && e.__ob__.dep.depend();
  1013. if (Array.isArray(e)) {
  1014. dependArray(e);
  1015. }
  1016. }
  1017. }
  1018. /* */
  1019. /**
  1020. * Option overwriting strategies are functions that handle
  1021. * how to merge a parent option value and a child option
  1022. * value into the final value.
  1023. */
  1024. var strats = config.optionMergeStrategies;
  1025. /**
  1026. * Options with restrictions
  1027. */
  1028. if (process.env.NODE_ENV !== 'production') {
  1029. strats.el = strats.propsData = function (parent, child, vm, key) {
  1030. if (!vm) {
  1031. warn(
  1032. "option \"" + key + "\" can only be used during instance " +
  1033. 'creation with the `new` keyword.'
  1034. );
  1035. }
  1036. return defaultStrat(parent, child)
  1037. };
  1038. }
  1039. /**
  1040. * Helper that recursively merges two data objects together.
  1041. */
  1042. function mergeData (to, from) {
  1043. if (!from) { return to }
  1044. var key, toVal, fromVal;
  1045. var keys = hasSymbol
  1046. ? Reflect.ownKeys(from)
  1047. : Object.keys(from);
  1048. for (var i = 0; i < keys.length; i++) {
  1049. key = keys[i];
  1050. // in case the object is already observed...
  1051. if (key === '__ob__') { continue }
  1052. toVal = to[key];
  1053. fromVal = from[key];
  1054. if (!hasOwn(to, key)) {
  1055. set(to, key, fromVal);
  1056. } else if (
  1057. toVal !== fromVal &&
  1058. isPlainObject(toVal) &&
  1059. isPlainObject(fromVal)
  1060. ) {
  1061. mergeData(toVal, fromVal);
  1062. }
  1063. }
  1064. return to
  1065. }
  1066. /**
  1067. * Data
  1068. */
  1069. function mergeDataOrFn (
  1070. parentVal,
  1071. childVal,
  1072. vm
  1073. ) {
  1074. if (!vm) {
  1075. // in a Vue.extend merge, both should be functions
  1076. if (!childVal) {
  1077. return parentVal
  1078. }
  1079. if (!parentVal) {
  1080. return childVal
  1081. }
  1082. // when parentVal & childVal are both present,
  1083. // we need to return a function that returns the
  1084. // merged result of both functions... no need to
  1085. // check if parentVal is a function here because
  1086. // it has to be a function to pass previous merges.
  1087. return function mergedDataFn () {
  1088. return mergeData(
  1089. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  1090. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  1091. )
  1092. }
  1093. } else {
  1094. return function mergedInstanceDataFn () {
  1095. // instance merge
  1096. var instanceData = typeof childVal === 'function'
  1097. ? childVal.call(vm, vm)
  1098. : childVal;
  1099. var defaultData = typeof parentVal === 'function'
  1100. ? parentVal.call(vm, vm)
  1101. : parentVal;
  1102. if (instanceData) {
  1103. return mergeData(instanceData, defaultData)
  1104. } else {
  1105. return defaultData
  1106. }
  1107. }
  1108. }
  1109. }
  1110. strats.data = function (
  1111. parentVal,
  1112. childVal,
  1113. vm
  1114. ) {
  1115. if (!vm) {
  1116. if (childVal && typeof childVal !== 'function') {
  1117. process.env.NODE_ENV !== 'production' && warn(
  1118. 'The "data" option should be a function ' +
  1119. 'that returns a per-instance value in component ' +
  1120. 'definitions.',
  1121. vm
  1122. );
  1123. return parentVal
  1124. }
  1125. return mergeDataOrFn(parentVal, childVal)
  1126. }
  1127. return mergeDataOrFn(parentVal, childVal, vm)
  1128. };
  1129. /**
  1130. * Hooks and props are merged as arrays.
  1131. */
  1132. function mergeHook (
  1133. parentVal,
  1134. childVal
  1135. ) {
  1136. var res = childVal
  1137. ? parentVal
  1138. ? parentVal.concat(childVal)
  1139. : Array.isArray(childVal)
  1140. ? childVal
  1141. : [childVal]
  1142. : parentVal;
  1143. return res
  1144. ? dedupeHooks(res)
  1145. : res
  1146. }
  1147. function dedupeHooks (hooks) {
  1148. var res = [];
  1149. for (var i = 0; i < hooks.length; i++) {
  1150. if (res.indexOf(hooks[i]) === -1) {
  1151. res.push(hooks[i]);
  1152. }
  1153. }
  1154. return res
  1155. }
  1156. LIFECYCLE_HOOKS.forEach(function (hook) {
  1157. strats[hook] = mergeHook;
  1158. });
  1159. /**
  1160. * Assets
  1161. *
  1162. * When a vm is present (instance creation), we need to do
  1163. * a three-way merge between constructor options, instance
  1164. * options and parent options.
  1165. */
  1166. function mergeAssets (
  1167. parentVal,
  1168. childVal,
  1169. vm,
  1170. key
  1171. ) {
  1172. var res = Object.create(parentVal || null);
  1173. if (childVal) {
  1174. process.env.NODE_ENV !== 'production' && assertObjectType(key, childVal, vm);
  1175. return extend(res, childVal)
  1176. } else {
  1177. return res
  1178. }
  1179. }
  1180. ASSET_TYPES.forEach(function (type) {
  1181. strats[type + 's'] = mergeAssets;
  1182. });
  1183. /**
  1184. * Watchers.
  1185. *
  1186. * Watchers hashes should not overwrite one
  1187. * another, so we merge them as arrays.
  1188. */
  1189. strats.watch = function (
  1190. parentVal,
  1191. childVal,
  1192. vm,
  1193. key
  1194. ) {
  1195. // work around Firefox's Object.prototype.watch...
  1196. if (parentVal === nativeWatch) { parentVal = undefined; }
  1197. if (childVal === nativeWatch) { childVal = undefined; }
  1198. /* istanbul ignore if */
  1199. if (!childVal) { return Object.create(parentVal || null) }
  1200. if (process.env.NODE_ENV !== 'production') {
  1201. assertObjectType(key, childVal, vm);
  1202. }
  1203. if (!parentVal) { return childVal }
  1204. var ret = {};
  1205. extend(ret, parentVal);
  1206. for (var key$1 in childVal) {
  1207. var parent = ret[key$1];
  1208. var child = childVal[key$1];
  1209. if (parent && !Array.isArray(parent)) {
  1210. parent = [parent];
  1211. }
  1212. ret[key$1] = parent
  1213. ? parent.concat(child)
  1214. : Array.isArray(child) ? child : [child];
  1215. }
  1216. return ret
  1217. };
  1218. /**
  1219. * Other object hashes.
  1220. */
  1221. strats.props =
  1222. strats.methods =
  1223. strats.inject =
  1224. strats.computed = function (
  1225. parentVal,
  1226. childVal,
  1227. vm,
  1228. key
  1229. ) {
  1230. if (childVal && process.env.NODE_ENV !== 'production') {
  1231. assertObjectType(key, childVal, vm);
  1232. }
  1233. if (!parentVal) { return childVal }
  1234. var ret = Object.create(null);
  1235. extend(ret, parentVal);
  1236. if (childVal) { extend(ret, childVal); }
  1237. return ret
  1238. };
  1239. strats.provide = mergeDataOrFn;
  1240. /**
  1241. * Default strategy.
  1242. */
  1243. var defaultStrat = function (parentVal, childVal) {
  1244. return childVal === undefined
  1245. ? parentVal
  1246. : childVal
  1247. };
  1248. /**
  1249. * Validate component names
  1250. */
  1251. function checkComponents (options) {
  1252. for (var key in options.components) {
  1253. validateComponentName(key);
  1254. }
  1255. }
  1256. function validateComponentName (name) {
  1257. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  1258. warn(
  1259. 'Invalid component name: "' + name + '". Component names ' +
  1260. 'should conform to valid custom element name in html5 specification.'
  1261. );
  1262. }
  1263. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  1264. warn(
  1265. 'Do not use built-in or reserved HTML elements as component ' +
  1266. 'id: ' + name
  1267. );
  1268. }
  1269. }
  1270. /**
  1271. * Ensure all props option syntax are normalized into the
  1272. * Object-based format.
  1273. */
  1274. function normalizeProps (options, vm) {
  1275. var props = options.props;
  1276. if (!props) { return }
  1277. var res = {};
  1278. var i, val, name;
  1279. if (Array.isArray(props)) {
  1280. i = props.length;
  1281. while (i--) {
  1282. val = props[i];
  1283. if (typeof val === 'string') {
  1284. name = camelize(val);
  1285. res[name] = { type: null };
  1286. } else if (process.env.NODE_ENV !== 'production') {
  1287. warn('props must be strings when using array syntax.');
  1288. }
  1289. }
  1290. } else if (isPlainObject(props)) {
  1291. for (var key in props) {
  1292. val = props[key];
  1293. name = camelize(key);
  1294. res[name] = isPlainObject(val)
  1295. ? val
  1296. : { type: val };
  1297. }
  1298. } else if (process.env.NODE_ENV !== 'production') {
  1299. warn(
  1300. "Invalid value for option \"props\": expected an Array or an Object, " +
  1301. "but got " + (toRawType(props)) + ".",
  1302. vm
  1303. );
  1304. }
  1305. options.props = res;
  1306. }
  1307. /**
  1308. * Normalize all injections into Object-based format
  1309. */
  1310. function normalizeInject (options, vm) {
  1311. var inject = options.inject;
  1312. if (!inject) { return }
  1313. var normalized = options.inject = {};
  1314. if (Array.isArray(inject)) {
  1315. for (var i = 0; i < inject.length; i++) {
  1316. normalized[inject[i]] = { from: inject[i] };
  1317. }
  1318. } else if (isPlainObject(inject)) {
  1319. for (var key in inject) {
  1320. var val = inject[key];
  1321. normalized[key] = isPlainObject(val)
  1322. ? extend({ from: key }, val)
  1323. : { from: val };
  1324. }
  1325. } else if (process.env.NODE_ENV !== 'production') {
  1326. warn(
  1327. "Invalid value for option \"inject\": expected an Array or an Object, " +
  1328. "but got " + (toRawType(inject)) + ".",
  1329. vm
  1330. );
  1331. }
  1332. }
  1333. /**
  1334. * Normalize raw function directives into object format.
  1335. */
  1336. function normalizeDirectives (options) {
  1337. var dirs = options.directives;
  1338. if (dirs) {
  1339. for (var key in dirs) {
  1340. var def$$1 = dirs[key];
  1341. if (typeof def$$1 === 'function') {
  1342. dirs[key] = { bind: def$$1, update: def$$1 };
  1343. }
  1344. }
  1345. }
  1346. }
  1347. function assertObjectType (name, value, vm) {
  1348. if (!isPlainObject(value)) {
  1349. warn(
  1350. "Invalid value for option \"" + name + "\": expected an Object, " +
  1351. "but got " + (toRawType(value)) + ".",
  1352. vm
  1353. );
  1354. }
  1355. }
  1356. /**
  1357. * Merge two option objects into a new one.
  1358. * Core utility used in both instantiation and inheritance.
  1359. */
  1360. function mergeOptions (
  1361. parent,
  1362. child,
  1363. vm
  1364. ) {
  1365. if (process.env.NODE_ENV !== 'production') {
  1366. checkComponents(child);
  1367. }
  1368. if (typeof child === 'function') {
  1369. child = child.options;
  1370. }
  1371. normalizeProps(child, vm);
  1372. normalizeInject(child, vm);
  1373. normalizeDirectives(child);
  1374. // Apply extends and mixins on the child options,
  1375. // but only if it is a raw options object that isn't
  1376. // the result of another mergeOptions call.
  1377. // Only merged options has the _base property.
  1378. if (!child._base) {
  1379. if (child.extends) {
  1380. parent = mergeOptions(parent, child.extends, vm);
  1381. }
  1382. if (child.mixins) {
  1383. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1384. parent = mergeOptions(parent, child.mixins[i], vm);
  1385. }
  1386. }
  1387. }
  1388. var options = {};
  1389. var key;
  1390. for (key in parent) {
  1391. mergeField(key);
  1392. }
  1393. for (key in child) {
  1394. if (!hasOwn(parent, key)) {
  1395. mergeField(key);
  1396. }
  1397. }
  1398. function mergeField (key) {
  1399. var strat = strats[key] || defaultStrat;
  1400. options[key] = strat(parent[key], child[key], vm, key);
  1401. }
  1402. return options
  1403. }
  1404. /**
  1405. * Resolve an asset.
  1406. * This function is used because child instances need access
  1407. * to assets defined in its ancestor chain.
  1408. */
  1409. function resolveAsset (
  1410. options,
  1411. type,
  1412. id,
  1413. warnMissing
  1414. ) {
  1415. /* istanbul ignore if */
  1416. if (typeof id !== 'string') {
  1417. return
  1418. }
  1419. var assets = options[type];
  1420. // check local registration variations first
  1421. if (hasOwn(assets, id)) { return assets[id] }
  1422. var camelizedId = camelize(id);
  1423. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  1424. var PascalCaseId = capitalize(camelizedId);
  1425. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  1426. // fallback to prototype chain
  1427. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  1428. if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {
  1429. warn(
  1430. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  1431. options
  1432. );
  1433. }
  1434. return res
  1435. }
  1436. /* */
  1437. function validateProp (
  1438. key,
  1439. propOptions,
  1440. propsData,
  1441. vm
  1442. ) {
  1443. var prop = propOptions[key];
  1444. var absent = !hasOwn(propsData, key);
  1445. var value = propsData[key];
  1446. // boolean casting
  1447. var booleanIndex = getTypeIndex(Boolean, prop.type);
  1448. if (booleanIndex > -1) {
  1449. if (absent && !hasOwn(prop, 'default')) {
  1450. value = false;
  1451. } else if (value === '' || value === hyphenate(key)) {
  1452. // only cast empty string / same name to boolean if
  1453. // boolean has higher priority
  1454. var stringIndex = getTypeIndex(String, prop.type);
  1455. if (stringIndex < 0 || booleanIndex < stringIndex) {
  1456. value = true;
  1457. }
  1458. }
  1459. }
  1460. // check default value
  1461. if (value === undefined) {
  1462. value = getPropDefaultValue(vm, prop, key);
  1463. // since the default value is a fresh copy,
  1464. // make sure to observe it.
  1465. var prevShouldObserve = shouldObserve;
  1466. toggleObserving(true);
  1467. observe(value);
  1468. toggleObserving(prevShouldObserve);
  1469. }
  1470. if (
  1471. process.env.NODE_ENV !== 'production' &&
  1472. // skip validation for weex recycle-list child component props
  1473. !(false)
  1474. ) {
  1475. assertProp(prop, key, value, vm, absent);
  1476. }
  1477. return value
  1478. }
  1479. /**
  1480. * Get the default value of a prop.
  1481. */
  1482. function getPropDefaultValue (vm, prop, key) {
  1483. // no default, return undefined
  1484. if (!hasOwn(prop, 'default')) {
  1485. return undefined
  1486. }
  1487. var def = prop.default;
  1488. // warn against non-factory defaults for Object & Array
  1489. if (process.env.NODE_ENV !== 'production' && isObject(def)) {
  1490. warn(
  1491. 'Invalid default value for prop "' + key + '": ' +
  1492. 'Props with type Object/Array must use a factory function ' +
  1493. 'to return the default value.',
  1494. vm
  1495. );
  1496. }
  1497. // the raw prop value was also undefined from previous render,
  1498. // return previous default value to avoid unnecessary watcher trigger
  1499. if (vm && vm.$options.propsData &&
  1500. vm.$options.propsData[key] === undefined &&
  1501. vm._props[key] !== undefined
  1502. ) {
  1503. return vm._props[key]
  1504. }
  1505. // call factory function for non-Function types
  1506. // a value is Function if its prototype is function even across different execution context
  1507. return typeof def === 'function' && getType(prop.type) !== 'Function'
  1508. ? def.call(vm)
  1509. : def
  1510. }
  1511. /**
  1512. * Assert whether a prop is valid.
  1513. */
  1514. function assertProp (
  1515. prop,
  1516. name,
  1517. value,
  1518. vm,
  1519. absent
  1520. ) {
  1521. if (prop.required && absent) {
  1522. warn(
  1523. 'Missing required prop: "' + name + '"',
  1524. vm
  1525. );
  1526. return
  1527. }
  1528. if (value == null && !prop.required) {
  1529. return
  1530. }
  1531. var type = prop.type;
  1532. var valid = !type || type === true;
  1533. var expectedTypes = [];
  1534. if (type) {
  1535. if (!Array.isArray(type)) {
  1536. type = [type];
  1537. }
  1538. for (var i = 0; i < type.length && !valid; i++) {
  1539. var assertedType = assertType(value, type[i]);
  1540. expectedTypes.push(assertedType.expectedType || '');
  1541. valid = assertedType.valid;
  1542. }
  1543. }
  1544. if (!valid) {
  1545. warn(
  1546. getInvalidTypeMessage(name, value, expectedTypes),
  1547. vm
  1548. );
  1549. return
  1550. }
  1551. var validator = prop.validator;
  1552. if (validator) {
  1553. if (!validator(value)) {
  1554. warn(
  1555. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  1556. vm
  1557. );
  1558. }
  1559. }
  1560. }
  1561. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  1562. function assertType (value, type) {
  1563. var valid;
  1564. var expectedType = getType(type);
  1565. if (simpleCheckRE.test(expectedType)) {
  1566. var t = typeof value;
  1567. valid = t === expectedType.toLowerCase();
  1568. // for primitive wrapper objects
  1569. if (!valid && t === 'object') {
  1570. valid = value instanceof type;
  1571. }
  1572. } else if (expectedType === 'Object') {
  1573. valid = isPlainObject(value);
  1574. } else if (expectedType === 'Array') {
  1575. valid = Array.isArray(value);
  1576. } else {
  1577. valid = value instanceof type;
  1578. }
  1579. return {
  1580. valid: valid,
  1581. expectedType: expectedType
  1582. }
  1583. }
  1584. /**
  1585. * Use function string name to check built-in types,
  1586. * because a simple equality check will fail when running
  1587. * across different vms / iframes.
  1588. */
  1589. function getType (fn) {
  1590. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  1591. return match ? match[1] : ''
  1592. }
  1593. function isSameType (a, b) {
  1594. return getType(a) === getType(b)
  1595. }
  1596. function getTypeIndex (type, expectedTypes) {
  1597. if (!Array.isArray(expectedTypes)) {
  1598. return isSameType(expectedTypes, type) ? 0 : -1
  1599. }
  1600. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  1601. if (isSameType(expectedTypes[i], type)) {
  1602. return i
  1603. }
  1604. }
  1605. return -1
  1606. }
  1607. function getInvalidTypeMessage (name, value, expectedTypes) {
  1608. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  1609. " Expected " + (expectedTypes.map(capitalize).join(', '));
  1610. var expectedType = expectedTypes[0];
  1611. var receivedType = toRawType(value);
  1612. var expectedValue = styleValue(value, expectedType);
  1613. var receivedValue = styleValue(value, receivedType);
  1614. // check if we need to specify expected value
  1615. if (expectedTypes.length === 1 &&
  1616. isExplicable(expectedType) &&
  1617. !isBoolean(expectedType, receivedType)) {
  1618. message += " with value " + expectedValue;
  1619. }
  1620. message += ", got " + receivedType + " ";
  1621. // check if we need to specify received value
  1622. if (isExplicable(receivedType)) {
  1623. message += "with value " + receivedValue + ".";
  1624. }
  1625. return message
  1626. }
  1627. function styleValue (value, type) {
  1628. if (type === 'String') {
  1629. return ("\"" + value + "\"")
  1630. } else if (type === 'Number') {
  1631. return ("" + (Number(value)))
  1632. } else {
  1633. return ("" + value)
  1634. }
  1635. }
  1636. function isExplicable (value) {
  1637. var explicitTypes = ['string', 'number', 'boolean'];
  1638. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  1639. }
  1640. function isBoolean () {
  1641. var args = [], len = arguments.length;
  1642. while ( len-- ) args[ len ] = arguments[ len ];
  1643. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  1644. }
  1645. /* */
  1646. function handleError (err, vm, info) {
  1647. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  1648. // See: https://github.com/vuejs/vuex/issues/1505
  1649. pushTarget();
  1650. try {
  1651. if (vm) {
  1652. var cur = vm;
  1653. while ((cur = cur.$parent)) {
  1654. var hooks = cur.$options.errorCaptured;
  1655. if (hooks) {
  1656. for (var i = 0; i < hooks.length; i++) {
  1657. try {
  1658. var capture = hooks[i].call(cur, err, vm, info) === false;
  1659. if (capture) { return }
  1660. } catch (e) {
  1661. globalHandleError(e, cur, 'errorCaptured hook');
  1662. }
  1663. }
  1664. }
  1665. }
  1666. }
  1667. globalHandleError(err, vm, info);
  1668. } finally {
  1669. popTarget();
  1670. }
  1671. }
  1672. function invokeWithErrorHandling (
  1673. handler,
  1674. context,
  1675. args,
  1676. vm,
  1677. info
  1678. ) {
  1679. var res;
  1680. try {
  1681. res = args ? handler.apply(context, args) : handler.call(context);
  1682. if (res && !res._isVue && isPromise(res) && !res._handled) {
  1683. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  1684. // issue #9511
  1685. // avoid catch triggering multiple times when nested calls
  1686. res._handled = true;
  1687. }
  1688. } catch (e) {
  1689. handleError(e, vm, info);
  1690. }
  1691. return res
  1692. }
  1693. function globalHandleError (err, vm, info) {
  1694. if (config.errorHandler) {
  1695. try {
  1696. return config.errorHandler.call(null, err, vm, info)
  1697. } catch (e) {
  1698. // if the user intentionally throws the original error in the handler,
  1699. // do not log it twice
  1700. if (e !== err) {
  1701. logError(e, null, 'config.errorHandler');
  1702. }
  1703. }
  1704. }
  1705. logError(err, vm, info);
  1706. }
  1707. function logError (err, vm, info) {
  1708. if (process.env.NODE_ENV !== 'production') {
  1709. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  1710. }
  1711. /* istanbul ignore else */
  1712. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  1713. console.error(err);
  1714. } else {
  1715. throw err
  1716. }
  1717. }
  1718. /* */
  1719. var isUsingMicroTask = false;
  1720. var callbacks = [];
  1721. var pending = false;
  1722. function flushCallbacks () {
  1723. pending = false;
  1724. var copies = callbacks.slice(0);
  1725. callbacks.length = 0;
  1726. for (var i = 0; i < copies.length; i++) {
  1727. copies[i]();
  1728. }
  1729. }
  1730. // Here we have async deferring wrappers using microtasks.
  1731. // In 2.5 we used (macro) tasks (in combination with microtasks).
  1732. // However, it has subtle problems when state is changed right before repaint
  1733. // (e.g. #6813, out-in transitions).
  1734. // Also, using (macro) tasks in event handler would cause some weird behaviors
  1735. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  1736. // So we now use microtasks everywhere, again.
  1737. // A major drawback of this tradeoff is that there are some scenarios
  1738. // where microtasks have too high a priority and fire in between supposedly
  1739. // sequential events (e.g. #4521, #6690, which have workarounds)
  1740. // or even between bubbling of the same event (#6566).
  1741. var timerFunc;
  1742. // The nextTick behavior leverages the microtask queue, which can be accessed
  1743. // via either native Promise.then or MutationObserver.
  1744. // MutationObserver has wider support, however it is seriously bugged in
  1745. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  1746. // completely stops working after triggering a few times... so, if native
  1747. // Promise is available, we will use it:
  1748. /* istanbul ignore next, $flow-disable-line */
  1749. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  1750. var p = Promise.resolve();
  1751. timerFunc = function () {
  1752. p.then(flushCallbacks);
  1753. // In problematic UIWebViews, Promise.then doesn't completely break, but
  1754. // it can get stuck in a weird state where callbacks are pushed into the
  1755. // microtask queue but the queue isn't being flushed, until the browser
  1756. // needs to do some other work, e.g. handle a timer. Therefore we can
  1757. // "force" the microtask queue to be flushed by adding an empty timer.
  1758. if (isIOS) { setTimeout(noop); }
  1759. };
  1760. isUsingMicroTask = true;
  1761. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  1762. isNative(MutationObserver) ||
  1763. // PhantomJS and iOS 7.x
  1764. MutationObserver.toString() === '[object MutationObserverConstructor]'
  1765. )) {
  1766. // Use MutationObserver where native Promise is not available,
  1767. // e.g. PhantomJS, iOS7, Android 4.4
  1768. // (#6466 MutationObserver is unreliable in IE11)
  1769. var counter = 1;
  1770. var observer = new MutationObserver(flushCallbacks);
  1771. var textNode = document.createTextNode(String(counter));
  1772. observer.observe(textNode, {
  1773. characterData: true
  1774. });
  1775. timerFunc = function () {
  1776. counter = (counter + 1) % 2;
  1777. textNode.data = String(counter);
  1778. };
  1779. isUsingMicroTask = true;
  1780. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  1781. // Fallback to setImmediate.
  1782. // Technically it leverages the (macro) task queue,
  1783. // but it is still a better choice than setTimeout.
  1784. timerFunc = function () {
  1785. setImmediate(flushCallbacks);
  1786. };
  1787. } else {
  1788. // Fallback to setTimeout.
  1789. timerFunc = function () {
  1790. setTimeout(flushCallbacks, 0);
  1791. };
  1792. }
  1793. function nextTick (cb, ctx) {
  1794. var _resolve;
  1795. callbacks.push(function () {
  1796. if (cb) {
  1797. try {
  1798. cb.call(ctx);
  1799. } catch (e) {
  1800. handleError(e, ctx, 'nextTick');
  1801. }
  1802. } else if (_resolve) {
  1803. _resolve(ctx);
  1804. }
  1805. });
  1806. if (!pending) {
  1807. pending = true;
  1808. timerFunc();
  1809. }
  1810. // $flow-disable-line
  1811. if (!cb && typeof Promise !== 'undefined') {
  1812. return new Promise(function (resolve) {
  1813. _resolve = resolve;
  1814. })
  1815. }
  1816. }
  1817. /* */
  1818. var mark;
  1819. var measure;
  1820. if (process.env.NODE_ENV !== 'production') {
  1821. var perf = inBrowser && window.performance;
  1822. /* istanbul ignore if */
  1823. if (
  1824. perf &&
  1825. perf.mark &&
  1826. perf.measure &&
  1827. perf.clearMarks &&
  1828. perf.clearMeasures
  1829. ) {
  1830. mark = function (tag) { return perf.mark(tag); };
  1831. measure = function (name, startTag, endTag) {
  1832. perf.measure(name, startTag, endTag);
  1833. perf.clearMarks(startTag);
  1834. perf.clearMarks(endTag);
  1835. // perf.clearMeasures(name)
  1836. };
  1837. }
  1838. }
  1839. /* not type checking this file because flow doesn't play well with Proxy */
  1840. var initProxy;
  1841. if (process.env.NODE_ENV !== 'production') {
  1842. var allowedGlobals = makeMap(
  1843. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  1844. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  1845. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  1846. 'require' // for Webpack/Browserify
  1847. );
  1848. var warnNonPresent = function (target, key) {
  1849. warn(
  1850. "Property or method \"" + key + "\" is not defined on the instance but " +
  1851. 'referenced during render. Make sure that this property is reactive, ' +
  1852. 'either in the data option, or for class-based components, by ' +
  1853. 'initializing the property. ' +
  1854. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  1855. target
  1856. );
  1857. };
  1858. var warnReservedPrefix = function (target, key) {
  1859. warn(
  1860. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  1861. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  1862. 'prevent conflicts with Vue internals. ' +
  1863. 'See: https://vuejs.org/v2/api/#data',
  1864. target
  1865. );
  1866. };
  1867. var hasProxy =
  1868. typeof Proxy !== 'undefined' && isNative(Proxy);
  1869. if (hasProxy) {
  1870. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  1871. config.keyCodes = new Proxy(config.keyCodes, {
  1872. set: function set (target, key, value) {
  1873. if (isBuiltInModifier(key)) {
  1874. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  1875. return false
  1876. } else {
  1877. target[key] = value;
  1878. return true
  1879. }
  1880. }
  1881. });
  1882. }
  1883. var hasHandler = {
  1884. has: function has (target, key) {
  1885. var has = key in target;
  1886. var isAllowed = allowedGlobals(key) ||
  1887. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  1888. if (!has && !isAllowed) {
  1889. if (key in target.$data) { warnReservedPrefix(target, key); }
  1890. else { warnNonPresent(target, key); }
  1891. }
  1892. return has || !isAllowed
  1893. }
  1894. };
  1895. var getHandler = {
  1896. get: function get (target, key) {
  1897. if (typeof key === 'string' && !(key in target)) {
  1898. if (key in target.$data) { warnReservedPrefix(target, key); }
  1899. else { warnNonPresent(target, key); }
  1900. }
  1901. return target[key]
  1902. }
  1903. };
  1904. initProxy = function initProxy (vm) {
  1905. if (hasProxy) {
  1906. // determine which proxy handler to use
  1907. var options = vm.$options;
  1908. var handlers = options.render && options.render._withStripped
  1909. ? getHandler
  1910. : hasHandler;
  1911. vm._renderProxy = new Proxy(vm, handlers);
  1912. } else {
  1913. vm._renderProxy = vm;
  1914. }
  1915. };
  1916. }
  1917. /* */
  1918. var seenObjects = new _Set();
  1919. /**
  1920. * Recursively traverse an object to evoke all converted
  1921. * getters, so that every nested property inside the object
  1922. * is collected as a "deep" dependency.
  1923. */
  1924. function traverse (val) {
  1925. _traverse(val, seenObjects);
  1926. seenObjects.clear();
  1927. }
  1928. function _traverse (val, seen) {
  1929. var i, keys;
  1930. var isA = Array.isArray(val);
  1931. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  1932. return
  1933. }
  1934. if (val.__ob__) {
  1935. var depId = val.__ob__.dep.id;
  1936. if (seen.has(depId)) {
  1937. return
  1938. }
  1939. seen.add(depId);
  1940. }
  1941. if (isA) {
  1942. i = val.length;
  1943. while (i--) { _traverse(val[i], seen); }
  1944. } else {
  1945. keys = Object.keys(val);
  1946. i = keys.length;
  1947. while (i--) { _traverse(val[keys[i]], seen); }
  1948. }
  1949. }
  1950. /* */
  1951. var normalizeEvent = cached(function (name) {
  1952. var passive = name.charAt(0) === '&';
  1953. name = passive ? name.slice(1) : name;
  1954. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  1955. name = once$$1 ? name.slice(1) : name;
  1956. var capture = name.charAt(0) === '!';
  1957. name = capture ? name.slice(1) : name;
  1958. return {
  1959. name: name,
  1960. once: once$$1,
  1961. capture: capture,
  1962. passive: passive
  1963. }
  1964. });
  1965. function createFnInvoker (fns, vm) {
  1966. function invoker () {
  1967. var arguments$1 = arguments;
  1968. var fns = invoker.fns;
  1969. if (Array.isArray(fns)) {
  1970. var cloned = fns.slice();
  1971. for (var i = 0; i < cloned.length; i++) {
  1972. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  1973. }
  1974. } else {
  1975. // return handler return value for single handlers
  1976. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  1977. }
  1978. }
  1979. invoker.fns = fns;
  1980. return invoker
  1981. }
  1982. function updateListeners (
  1983. on,
  1984. oldOn,
  1985. add,
  1986. remove$$1,
  1987. createOnceHandler,
  1988. vm
  1989. ) {
  1990. var name, def$$1, cur, old, event;
  1991. for (name in on) {
  1992. def$$1 = cur = on[name];
  1993. old = oldOn[name];
  1994. event = normalizeEvent(name);
  1995. if (isUndef(cur)) {
  1996. process.env.NODE_ENV !== 'production' && warn(
  1997. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  1998. vm
  1999. );
  2000. } else if (isUndef(old)) {
  2001. if (isUndef(cur.fns)) {
  2002. cur = on[name] = createFnInvoker(cur, vm);
  2003. }
  2004. if (isTrue(event.once)) {
  2005. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  2006. }
  2007. add(event.name, cur, event.capture, event.passive, event.params);
  2008. } else if (cur !== old) {
  2009. old.fns = cur;
  2010. on[name] = old;
  2011. }
  2012. }
  2013. for (name in oldOn) {
  2014. if (isUndef(on[name])) {
  2015. event = normalizeEvent(name);
  2016. remove$$1(event.name, oldOn[name], event.capture);
  2017. }
  2018. }
  2019. }
  2020. /* */
  2021. function mergeVNodeHook (def, hookKey, hook) {
  2022. if (def instanceof VNode) {
  2023. def = def.data.hook || (def.data.hook = {});
  2024. }
  2025. var invoker;
  2026. var oldHook = def[hookKey];
  2027. function wrappedHook () {
  2028. hook.apply(this, arguments);
  2029. // important: remove merged hook to ensure it's called only once
  2030. // and prevent memory leak
  2031. remove(invoker.fns, wrappedHook);
  2032. }
  2033. if (isUndef(oldHook)) {
  2034. // no existing hook
  2035. invoker = createFnInvoker([wrappedHook]);
  2036. } else {
  2037. /* istanbul ignore if */
  2038. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  2039. // already a merged invoker
  2040. invoker = oldHook;
  2041. invoker.fns.push(wrappedHook);
  2042. } else {
  2043. // existing plain hook
  2044. invoker = createFnInvoker([oldHook, wrappedHook]);
  2045. }
  2046. }
  2047. invoker.merged = true;
  2048. def[hookKey] = invoker;
  2049. }
  2050. /* */
  2051. function extractPropsFromVNodeData (
  2052. data,
  2053. Ctor,
  2054. tag
  2055. ) {
  2056. // we are only extracting raw values here.
  2057. // validation and default values are handled in the child
  2058. // component itself.
  2059. var propOptions = Ctor.options.props;
  2060. if (isUndef(propOptions)) {
  2061. return
  2062. }
  2063. var res = {};
  2064. var attrs = data.attrs;
  2065. var props = data.props;
  2066. if (isDef(attrs) || isDef(props)) {
  2067. for (var key in propOptions) {
  2068. var altKey = hyphenate(key);
  2069. if (process.env.NODE_ENV !== 'production') {
  2070. var keyInLowerCase = key.toLowerCase();
  2071. if (
  2072. key !== keyInLowerCase &&
  2073. attrs && hasOwn(attrs, keyInLowerCase)
  2074. ) {
  2075. tip(
  2076. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  2077. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  2078. " \"" + key + "\". " +
  2079. "Note that HTML attributes are case-insensitive and camelCased " +
  2080. "props need to use their kebab-case equivalents when using in-DOM " +
  2081. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  2082. );
  2083. }
  2084. }
  2085. checkProp(res, props, key, altKey, true) ||
  2086. checkProp(res, attrs, key, altKey, false);
  2087. }
  2088. }
  2089. return res
  2090. }
  2091. function checkProp (
  2092. res,
  2093. hash,
  2094. key,
  2095. altKey,
  2096. preserve
  2097. ) {
  2098. if (isDef(hash)) {
  2099. if (hasOwn(hash, key)) {
  2100. res[key] = hash[key];
  2101. if (!preserve) {
  2102. delete hash[key];
  2103. }
  2104. return true
  2105. } else if (hasOwn(hash, altKey)) {
  2106. res[key] = hash[altKey];
  2107. if (!preserve) {
  2108. delete hash[altKey];
  2109. }
  2110. return true
  2111. }
  2112. }
  2113. return false
  2114. }
  2115. /* */
  2116. // The template compiler attempts to minimize the need for normalization by
  2117. // statically analyzing the template at compile time.
  2118. //
  2119. // For plain HTML markup, normalization can be completely skipped because the
  2120. // generated render function is guaranteed to return Array<VNode>. There are
  2121. // two cases where extra normalization is needed:
  2122. // 1. When the children contains components - because a functional component
  2123. // may return an Array instead of a single root. In this case, just a simple
  2124. // normalization is needed - if any child is an Array, we flatten the whole
  2125. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  2126. // because functional components already normalize their own children.
  2127. function simpleNormalizeChildren (children) {
  2128. for (var i = 0; i < children.length; i++) {
  2129. if (Array.isArray(children[i])) {
  2130. return Array.prototype.concat.apply([], children)
  2131. }
  2132. }
  2133. return children
  2134. }
  2135. // 2. When the children contains constructs that always generated nested Arrays,
  2136. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  2137. // with hand-written render functions / JSX. In such cases a full normalization
  2138. // is needed to cater to all possible types of children values.
  2139. function normalizeChildren (children) {
  2140. return isPrimitive(children)
  2141. ? [createTextVNode(children)]
  2142. : Array.isArray(children)
  2143. ? normalizeArrayChildren(children)
  2144. : undefined
  2145. }
  2146. function isTextNode (node) {
  2147. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  2148. }
  2149. function normalizeArrayChildren (children, nestedIndex) {
  2150. var res = [];
  2151. var i, c, lastIndex, last;
  2152. for (i = 0; i < children.length; i++) {
  2153. c = children[i];
  2154. if (isUndef(c) || typeof c === 'boolean') { continue }
  2155. lastIndex = res.length - 1;
  2156. last = res[lastIndex];
  2157. // nested
  2158. if (Array.isArray(c)) {
  2159. if (c.length > 0) {
  2160. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  2161. // merge adjacent text nodes
  2162. if (isTextNode(c[0]) && isTextNode(last)) {
  2163. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  2164. c.shift();
  2165. }
  2166. res.push.apply(res, c);
  2167. }
  2168. } else if (isPrimitive(c)) {
  2169. if (isTextNode(last)) {
  2170. // merge adjacent text nodes
  2171. // this is necessary for SSR hydration because text nodes are
  2172. // essentially merged when rendered to HTML strings
  2173. res[lastIndex] = createTextVNode(last.text + c);
  2174. } else if (c !== '') {
  2175. // convert primitive to vnode
  2176. res.push(createTextVNode(c));
  2177. }
  2178. } else {
  2179. if (isTextNode(c) && isTextNode(last)) {
  2180. // merge adjacent text nodes
  2181. res[lastIndex] = createTextVNode(last.text + c.text);
  2182. } else {
  2183. // default key for nested array children (likely generated by v-for)
  2184. if (isTrue(children._isVList) &&
  2185. isDef(c.tag) &&
  2186. isUndef(c.key) &&
  2187. isDef(nestedIndex)) {
  2188. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  2189. }
  2190. res.push(c);
  2191. }
  2192. }
  2193. }
  2194. return res
  2195. }
  2196. /* */
  2197. function initProvide (vm) {
  2198. var provide = vm.$options.provide;
  2199. if (provide) {
  2200. vm._provided = typeof provide === 'function'
  2201. ? provide.call(vm)
  2202. : provide;
  2203. }
  2204. }
  2205. function initInjections (vm) {
  2206. var result = resolveInject(vm.$options.inject, vm);
  2207. if (result) {
  2208. toggleObserving(false);
  2209. Object.keys(result).forEach(function (key) {
  2210. /* istanbul ignore else */
  2211. if (process.env.NODE_ENV !== 'production') {
  2212. defineReactive$$1(vm, key, result[key], function () {
  2213. warn(
  2214. "Avoid mutating an injected value directly since the changes will be " +
  2215. "overwritten whenever the provided component re-renders. " +
  2216. "injection being mutated: \"" + key + "\"",
  2217. vm
  2218. );
  2219. });
  2220. } else {
  2221. defineReactive$$1(vm, key, result[key]);
  2222. }
  2223. });
  2224. toggleObserving(true);
  2225. }
  2226. }
  2227. function resolveInject (inject, vm) {
  2228. if (inject) {
  2229. // inject is :any because flow is not smart enough to figure out cached
  2230. var result = Object.create(null);
  2231. var keys = hasSymbol
  2232. ? Reflect.ownKeys(inject)
  2233. : Object.keys(inject);
  2234. for (var i = 0; i < keys.length; i++) {
  2235. var key = keys[i];
  2236. // #6574 in case the inject object is observed...
  2237. if (key === '__ob__') { continue }
  2238. var provideKey = inject[key].from;
  2239. var source = vm;
  2240. while (source) {
  2241. if (source._provided && hasOwn(source._provided, provideKey)) {
  2242. result[key] = source._provided[provideKey];
  2243. break
  2244. }
  2245. source = source.$parent;
  2246. }
  2247. if (!source) {
  2248. if ('default' in inject[key]) {
  2249. var provideDefault = inject[key].default;
  2250. result[key] = typeof provideDefault === 'function'
  2251. ? provideDefault.call(vm)
  2252. : provideDefault;
  2253. } else if (process.env.NODE_ENV !== 'production') {
  2254. warn(("Injection \"" + key + "\" not found"), vm);
  2255. }
  2256. }
  2257. }
  2258. return result
  2259. }
  2260. }
  2261. /* */
  2262. /**
  2263. * Runtime helper for resolving raw children VNodes into a slot object.
  2264. */
  2265. function resolveSlots (
  2266. children,
  2267. context
  2268. ) {
  2269. if (!children || !children.length) {
  2270. return {}
  2271. }
  2272. var slots = {};
  2273. for (var i = 0, l = children.length; i < l; i++) {
  2274. var child = children[i];
  2275. var data = child.data;
  2276. // remove slot attribute if the node is resolved as a Vue slot node
  2277. if (data && data.attrs && data.attrs.slot) {
  2278. delete data.attrs.slot;
  2279. }
  2280. // named slots should only be respected if the vnode was rendered in the
  2281. // same context.
  2282. if ((child.context === context || child.fnContext === context) &&
  2283. data && data.slot != null
  2284. ) {
  2285. var name = data.slot;
  2286. var slot = (slots[name] || (slots[name] = []));
  2287. if (child.tag === 'template') {
  2288. slot.push.apply(slot, child.children || []);
  2289. } else {
  2290. slot.push(child);
  2291. }
  2292. } else {
  2293. (slots.default || (slots.default = [])).push(child);
  2294. }
  2295. }
  2296. // ignore slots that contains only whitespace
  2297. for (var name$1 in slots) {
  2298. if (slots[name$1].every(isWhitespace)) {
  2299. delete slots[name$1];
  2300. }
  2301. }
  2302. return slots
  2303. }
  2304. function isWhitespace (node) {
  2305. return (node.isComment && !node.asyncFactory) || node.text === ' '
  2306. }
  2307. /* */
  2308. function normalizeScopedSlots (
  2309. slots,
  2310. normalSlots,
  2311. prevSlots
  2312. ) {
  2313. var res;
  2314. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  2315. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  2316. var key = slots && slots.$key;
  2317. if (!slots) {
  2318. res = {};
  2319. } else if (slots._normalized) {
  2320. // fast path 1: child component re-render only, parent did not change
  2321. return slots._normalized
  2322. } else if (
  2323. isStable &&
  2324. prevSlots &&
  2325. prevSlots !== emptyObject &&
  2326. key === prevSlots.$key &&
  2327. !hasNormalSlots &&
  2328. !prevSlots.$hasNormal
  2329. ) {
  2330. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  2331. // only need to normalize once
  2332. return prevSlots
  2333. } else {
  2334. res = {};
  2335. for (var key$1 in slots) {
  2336. if (slots[key$1] && key$1[0] !== '$') {
  2337. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  2338. }
  2339. }
  2340. }
  2341. // expose normal slots on scopedSlots
  2342. for (var key$2 in normalSlots) {
  2343. if (!(key$2 in res)) {
  2344. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  2345. }
  2346. }
  2347. // avoriaz seems to mock a non-extensible $scopedSlots object
  2348. // and when that is passed down this would cause an error
  2349. if (slots && Object.isExtensible(slots)) {
  2350. (slots)._normalized = res;
  2351. }
  2352. def(res, '$stable', isStable);
  2353. def(res, '$key', key);
  2354. def(res, '$hasNormal', hasNormalSlots);
  2355. return res
  2356. }
  2357. function normalizeScopedSlot(normalSlots, key, fn) {
  2358. var normalized = function () {
  2359. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  2360. res = res && typeof res === 'object' && !Array.isArray(res)
  2361. ? [res] // single vnode
  2362. : normalizeChildren(res);
  2363. return res && (
  2364. res.length === 0 ||
  2365. (res.length === 1 && res[0].isComment) // #9658
  2366. ) ? undefined
  2367. : res
  2368. };
  2369. // this is a slot using the new v-slot syntax without scope. although it is
  2370. // compiled as a scoped slot, render fn users would expect it to be present
  2371. // on this.$slots because the usage is semantically a normal slot.
  2372. if (fn.proxy) {
  2373. Object.defineProperty(normalSlots, key, {
  2374. get: normalized,
  2375. enumerable: true,
  2376. configurable: true
  2377. });
  2378. }
  2379. return normalized
  2380. }
  2381. function proxyNormalSlot(slots, key) {
  2382. return function () { return slots[key]; }
  2383. }
  2384. /* */
  2385. /**
  2386. * Runtime helper for rendering v-for lists.
  2387. */
  2388. function renderList (
  2389. val,
  2390. render
  2391. ) {
  2392. var ret, i, l, keys, key;
  2393. if (Array.isArray(val) || typeof val === 'string') {
  2394. ret = new Array(val.length);
  2395. for (i = 0, l = val.length; i < l; i++) {
  2396. ret[i] = render(val[i], i);
  2397. }
  2398. } else if (typeof val === 'number') {
  2399. ret = new Array(val);
  2400. for (i = 0; i < val; i++) {
  2401. ret[i] = render(i + 1, i);
  2402. }
  2403. } else if (isObject(val)) {
  2404. if (hasSymbol && val[Symbol.iterator]) {
  2405. ret = [];
  2406. var iterator = val[Symbol.iterator]();
  2407. var result = iterator.next();
  2408. while (!result.done) {
  2409. ret.push(render(result.value, ret.length));
  2410. result = iterator.next();
  2411. }
  2412. } else {
  2413. keys = Object.keys(val);
  2414. ret = new Array(keys.length);
  2415. for (i = 0, l = keys.length; i < l; i++) {
  2416. key = keys[i];
  2417. ret[i] = render(val[key], key, i);
  2418. }
  2419. }
  2420. }
  2421. if (!isDef(ret)) {
  2422. ret = [];
  2423. }
  2424. (ret)._isVList = true;
  2425. return ret
  2426. }
  2427. /* */
  2428. /**
  2429. * Runtime helper for rendering <slot>
  2430. */
  2431. function renderSlot (
  2432. name,
  2433. fallback,
  2434. props,
  2435. bindObject
  2436. ) {
  2437. var scopedSlotFn = this.$scopedSlots[name];
  2438. var nodes;
  2439. if (scopedSlotFn) { // scoped slot
  2440. props = props || {};
  2441. if (bindObject) {
  2442. if (process.env.NODE_ENV !== 'production' && !isObject(bindObject)) {
  2443. warn(
  2444. 'slot v-bind without argument expects an Object',
  2445. this
  2446. );
  2447. }
  2448. props = extend(extend({}, bindObject), props);
  2449. }
  2450. nodes = scopedSlotFn(props) || fallback;
  2451. } else {
  2452. nodes = this.$slots[name] || fallback;
  2453. }
  2454. var target = props && props.slot;
  2455. if (target) {
  2456. return this.$createElement('template', { slot: target }, nodes)
  2457. } else {
  2458. return nodes
  2459. }
  2460. }
  2461. /* */
  2462. /**
  2463. * Runtime helper for resolving filters
  2464. */
  2465. function resolveFilter (id) {
  2466. return resolveAsset(this.$options, 'filters', id, true) || identity
  2467. }
  2468. /* */
  2469. function isKeyNotMatch (expect, actual) {
  2470. if (Array.isArray(expect)) {
  2471. return expect.indexOf(actual) === -1
  2472. } else {
  2473. return expect !== actual
  2474. }
  2475. }
  2476. /**
  2477. * Runtime helper for checking keyCodes from config.
  2478. * exposed as Vue.prototype._k
  2479. * passing in eventKeyName as last argument separately for backwards compat
  2480. */
  2481. function checkKeyCodes (
  2482. eventKeyCode,
  2483. key,
  2484. builtInKeyCode,
  2485. eventKeyName,
  2486. builtInKeyName
  2487. ) {
  2488. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  2489. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  2490. return isKeyNotMatch(builtInKeyName, eventKeyName)
  2491. } else if (mappedKeyCode) {
  2492. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  2493. } else if (eventKeyName) {
  2494. return hyphenate(eventKeyName) !== key
  2495. }
  2496. }
  2497. /* */
  2498. /**
  2499. * Runtime helper for merging v-bind="object" into a VNode's data.
  2500. */
  2501. function bindObjectProps (
  2502. data,
  2503. tag,
  2504. value,
  2505. asProp,
  2506. isSync
  2507. ) {
  2508. if (value) {
  2509. if (!isObject(value)) {
  2510. process.env.NODE_ENV !== 'production' && warn(
  2511. 'v-bind without argument expects an Object or Array value',
  2512. this
  2513. );
  2514. } else {
  2515. if (Array.isArray(value)) {
  2516. value = toObject(value);
  2517. }
  2518. var hash;
  2519. var loop = function ( key ) {
  2520. if (
  2521. key === 'class' ||
  2522. key === 'style' ||
  2523. isReservedAttribute(key)
  2524. ) {
  2525. hash = data;
  2526. } else {
  2527. var type = data.attrs && data.attrs.type;
  2528. hash = asProp || config.mustUseProp(tag, type, key)
  2529. ? data.domProps || (data.domProps = {})
  2530. : data.attrs || (data.attrs = {});
  2531. }
  2532. var camelizedKey = camelize(key);
  2533. var hyphenatedKey = hyphenate(key);
  2534. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  2535. hash[key] = value[key];
  2536. if (isSync) {
  2537. var on = data.on || (data.on = {});
  2538. on[("update:" + key)] = function ($event) {
  2539. value[key] = $event;
  2540. };
  2541. }
  2542. }
  2543. };
  2544. for (var key in value) loop( key );
  2545. }
  2546. }
  2547. return data
  2548. }
  2549. /* */
  2550. /**
  2551. * Runtime helper for rendering static trees.
  2552. */
  2553. function renderStatic (
  2554. index,
  2555. isInFor
  2556. ) {
  2557. var cached = this._staticTrees || (this._staticTrees = []);
  2558. var tree = cached[index];
  2559. // if has already-rendered static tree and not inside v-for,
  2560. // we can reuse the same tree.
  2561. if (tree && !isInFor) {
  2562. return tree
  2563. }
  2564. // otherwise, render a fresh tree.
  2565. tree = cached[index] = this.$options.staticRenderFns[index].call(
  2566. this._renderProxy,
  2567. null,
  2568. this // for render fns generated for functional component templates
  2569. );
  2570. markStatic(tree, ("__static__" + index), false);
  2571. return tree
  2572. }
  2573. /**
  2574. * Runtime helper for v-once.
  2575. * Effectively it means marking the node as static with a unique key.
  2576. */
  2577. function markOnce (
  2578. tree,
  2579. index,
  2580. key
  2581. ) {
  2582. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  2583. return tree
  2584. }
  2585. function markStatic (
  2586. tree,
  2587. key,
  2588. isOnce
  2589. ) {
  2590. if (Array.isArray(tree)) {
  2591. for (var i = 0; i < tree.length; i++) {
  2592. if (tree[i] && typeof tree[i] !== 'string') {
  2593. markStaticNode(tree[i], (key + "_" + i), isOnce);
  2594. }
  2595. }
  2596. } else {
  2597. markStaticNode(tree, key, isOnce);
  2598. }
  2599. }
  2600. function markStaticNode (node, key, isOnce) {
  2601. node.isStatic = true;
  2602. node.key = key;
  2603. node.isOnce = isOnce;
  2604. }
  2605. /* */
  2606. function bindObjectListeners (data, value) {
  2607. if (value) {
  2608. if (!isPlainObject(value)) {
  2609. process.env.NODE_ENV !== 'production' && warn(
  2610. 'v-on without argument expects an Object value',
  2611. this
  2612. );
  2613. } else {
  2614. var on = data.on = data.on ? extend({}, data.on) : {};
  2615. for (var key in value) {
  2616. var existing = on[key];
  2617. var ours = value[key];
  2618. on[key] = existing ? [].concat(existing, ours) : ours;
  2619. }
  2620. }
  2621. }
  2622. return data
  2623. }
  2624. /* */
  2625. function resolveScopedSlots (
  2626. fns, // see flow/vnode
  2627. res,
  2628. // the following are added in 2.6
  2629. hasDynamicKeys,
  2630. contentHashKey
  2631. ) {
  2632. res = res || { $stable: !hasDynamicKeys };
  2633. for (var i = 0; i < fns.length; i++) {
  2634. var slot = fns[i];
  2635. if (Array.isArray(slot)) {
  2636. resolveScopedSlots(slot, res, hasDynamicKeys);
  2637. } else if (slot) {
  2638. // marker for reverse proxying v-slot without scope on this.$slots
  2639. if (slot.proxy) {
  2640. slot.fn.proxy = true;
  2641. }
  2642. res[slot.key] = slot.fn;
  2643. }
  2644. }
  2645. if (contentHashKey) {
  2646. (res).$key = contentHashKey;
  2647. }
  2648. return res
  2649. }
  2650. /* */
  2651. function bindDynamicKeys (baseObj, values) {
  2652. for (var i = 0; i < values.length; i += 2) {
  2653. var key = values[i];
  2654. if (typeof key === 'string' && key) {
  2655. baseObj[values[i]] = values[i + 1];
  2656. } else if (process.env.NODE_ENV !== 'production' && key !== '' && key !== null) {
  2657. // null is a special value for explicitly removing a binding
  2658. warn(
  2659. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  2660. this
  2661. );
  2662. }
  2663. }
  2664. return baseObj
  2665. }
  2666. // helper to dynamically append modifier runtime markers to event names.
  2667. // ensure only append when value is already string, otherwise it will be cast
  2668. // to string and cause the type check to miss.
  2669. function prependModifier (value, symbol) {
  2670. return typeof value === 'string' ? symbol + value : value
  2671. }
  2672. /* */
  2673. function installRenderHelpers (target) {
  2674. target._o = markOnce;
  2675. target._n = toNumber;
  2676. target._s = toString;
  2677. target._l = renderList;
  2678. target._t = renderSlot;
  2679. target._q = looseEqual;
  2680. target._i = looseIndexOf;
  2681. target._m = renderStatic;
  2682. target._f = resolveFilter;
  2683. target._k = checkKeyCodes;
  2684. target._b = bindObjectProps;
  2685. target._v = createTextVNode;
  2686. target._e = createEmptyVNode;
  2687. target._u = resolveScopedSlots;
  2688. target._g = bindObjectListeners;
  2689. target._d = bindDynamicKeys;
  2690. target._p = prependModifier;
  2691. }
  2692. /* */
  2693. function FunctionalRenderContext (
  2694. data,
  2695. props,
  2696. children,
  2697. parent,
  2698. Ctor
  2699. ) {
  2700. var this$1 = this;
  2701. var options = Ctor.options;
  2702. // ensure the createElement function in functional components
  2703. // gets a unique context - this is necessary for correct named slot check
  2704. var contextVm;
  2705. if (hasOwn(parent, '_uid')) {
  2706. contextVm = Object.create(parent);
  2707. // $flow-disable-line
  2708. contextVm._original = parent;
  2709. } else {
  2710. // the context vm passed in is a functional context as well.
  2711. // in this case we want to make sure we are able to get a hold to the
  2712. // real context instance.
  2713. contextVm = parent;
  2714. // $flow-disable-line
  2715. parent = parent._original;
  2716. }
  2717. var isCompiled = isTrue(options._compiled);
  2718. var needNormalization = !isCompiled;
  2719. this.data = data;
  2720. this.props = props;
  2721. this.children = children;
  2722. this.parent = parent;
  2723. this.listeners = data.on || emptyObject;
  2724. this.injections = resolveInject(options.inject, parent);
  2725. this.slots = function () {
  2726. if (!this$1.$slots) {
  2727. normalizeScopedSlots(
  2728. data.scopedSlots,
  2729. this$1.$slots = resolveSlots(children, parent)
  2730. );
  2731. }
  2732. return this$1.$slots
  2733. };
  2734. Object.defineProperty(this, 'scopedSlots', ({
  2735. enumerable: true,
  2736. get: function get () {
  2737. return normalizeScopedSlots(data.scopedSlots, this.slots())
  2738. }
  2739. }));
  2740. // support for compiled functional template
  2741. if (isCompiled) {
  2742. // exposing $options for renderStatic()
  2743. this.$options = options;
  2744. // pre-resolve slots for renderSlot()
  2745. this.$slots = this.slots();
  2746. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  2747. }
  2748. if (options._scopeId) {
  2749. this._c = function (a, b, c, d) {
  2750. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  2751. if (vnode && !Array.isArray(vnode)) {
  2752. vnode.fnScopeId = options._scopeId;
  2753. vnode.fnContext = parent;
  2754. }
  2755. return vnode
  2756. };
  2757. } else {
  2758. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  2759. }
  2760. }
  2761. installRenderHelpers(FunctionalRenderContext.prototype);
  2762. function createFunctionalComponent (
  2763. Ctor,
  2764. propsData,
  2765. data,
  2766. contextVm,
  2767. children
  2768. ) {
  2769. var options = Ctor.options;
  2770. var props = {};
  2771. var propOptions = options.props;
  2772. if (isDef(propOptions)) {
  2773. for (var key in propOptions) {
  2774. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  2775. }
  2776. } else {
  2777. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  2778. if (isDef(data.props)) { mergeProps(props, data.props); }
  2779. }
  2780. var renderContext = new FunctionalRenderContext(
  2781. data,
  2782. props,
  2783. children,
  2784. contextVm,
  2785. Ctor
  2786. );
  2787. var vnode = options.render.call(null, renderContext._c, renderContext);
  2788. if (vnode instanceof VNode) {
  2789. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  2790. } else if (Array.isArray(vnode)) {
  2791. var vnodes = normalizeChildren(vnode) || [];
  2792. var res = new Array(vnodes.length);
  2793. for (var i = 0; i < vnodes.length; i++) {
  2794. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  2795. }
  2796. return res
  2797. }
  2798. }
  2799. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  2800. // #7817 clone node before setting fnContext, otherwise if the node is reused
  2801. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  2802. // that should not be matched to match.
  2803. var clone = cloneVNode(vnode);
  2804. clone.fnContext = contextVm;
  2805. clone.fnOptions = options;
  2806. if (process.env.NODE_ENV !== 'production') {
  2807. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  2808. }
  2809. if (data.slot) {
  2810. (clone.data || (clone.data = {})).slot = data.slot;
  2811. }
  2812. return clone
  2813. }
  2814. function mergeProps (to, from) {
  2815. for (var key in from) {
  2816. to[camelize(key)] = from[key];
  2817. }
  2818. }
  2819. /* */
  2820. /* */
  2821. /* */
  2822. /* */
  2823. // inline hooks to be invoked on component VNodes during patch
  2824. var componentVNodeHooks = {
  2825. init: function init (vnode, hydrating) {
  2826. if (
  2827. vnode.componentInstance &&
  2828. !vnode.componentInstance._isDestroyed &&
  2829. vnode.data.keepAlive
  2830. ) {
  2831. // kept-alive components, treat as a patch
  2832. var mountedNode = vnode; // work around flow
  2833. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  2834. } else {
  2835. var child = vnode.componentInstance = createComponentInstanceForVnode(
  2836. vnode,
  2837. activeInstance
  2838. );
  2839. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  2840. }
  2841. },
  2842. prepatch: function prepatch (oldVnode, vnode) {
  2843. var options = vnode.componentOptions;
  2844. var child = vnode.componentInstance = oldVnode.componentInstance;
  2845. updateChildComponent(
  2846. child,
  2847. options.propsData, // updated props
  2848. options.listeners, // updated listeners
  2849. vnode, // new parent vnode
  2850. options.children // new children
  2851. );
  2852. },
  2853. insert: function insert (vnode) {
  2854. var context = vnode.context;
  2855. var componentInstance = vnode.componentInstance;
  2856. if (!componentInstance._isMounted) {
  2857. componentInstance._isMounted = true;
  2858. callHook(componentInstance, 'mounted');
  2859. }
  2860. if (vnode.data.keepAlive) {
  2861. if (context._isMounted) {
  2862. // vue-router#1212
  2863. // During updates, a kept-alive component's child components may
  2864. // change, so directly walking the tree here may call activated hooks
  2865. // on incorrect children. Instead we push them into a queue which will
  2866. // be processed after the whole patch process ended.
  2867. queueActivatedComponent(componentInstance);
  2868. } else {
  2869. activateChildComponent(componentInstance, true /* direct */);
  2870. }
  2871. }
  2872. },
  2873. destroy: function destroy (vnode) {
  2874. var componentInstance = vnode.componentInstance;
  2875. if (!componentInstance._isDestroyed) {
  2876. if (!vnode.data.keepAlive) {
  2877. componentInstance.$destroy();
  2878. } else {
  2879. deactivateChildComponent(componentInstance, true /* direct */);
  2880. }
  2881. }
  2882. }
  2883. };
  2884. var hooksToMerge = Object.keys(componentVNodeHooks);
  2885. function createComponent (
  2886. Ctor,
  2887. data,
  2888. context,
  2889. children,
  2890. tag
  2891. ) {
  2892. if (isUndef(Ctor)) {
  2893. return
  2894. }
  2895. var baseCtor = context.$options._base;
  2896. // plain options object: turn it into a constructor
  2897. if (isObject(Ctor)) {
  2898. Ctor = baseCtor.extend(Ctor);
  2899. }
  2900. // if at this stage it's not a constructor or an async component factory,
  2901. // reject.
  2902. if (typeof Ctor !== 'function') {
  2903. if (process.env.NODE_ENV !== 'production') {
  2904. warn(("Invalid Component definition: " + (String(Ctor))), context);
  2905. }
  2906. return
  2907. }
  2908. // async component
  2909. var asyncFactory;
  2910. if (isUndef(Ctor.cid)) {
  2911. asyncFactory = Ctor;
  2912. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  2913. if (Ctor === undefined) {
  2914. // return a placeholder node for async component, which is rendered
  2915. // as a comment node but preserves all the raw information for the node.
  2916. // the information will be used for async server-rendering and hydration.
  2917. return createAsyncPlaceholder(
  2918. asyncFactory,
  2919. data,
  2920. context,
  2921. children,
  2922. tag
  2923. )
  2924. }
  2925. }
  2926. data = data || {};
  2927. // resolve constructor options in case global mixins are applied after
  2928. // component constructor creation
  2929. resolveConstructorOptions(Ctor);
  2930. // transform component v-model data into props & events
  2931. if (isDef(data.model)) {
  2932. transformModel(Ctor.options, data);
  2933. }
  2934. // extract props
  2935. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  2936. // functional component
  2937. if (isTrue(Ctor.options.functional)) {
  2938. return createFunctionalComponent(Ctor, propsData, data, context, children)
  2939. }
  2940. // extract listeners, since these needs to be treated as
  2941. // child component listeners instead of DOM listeners
  2942. var listeners = data.on;
  2943. // replace with listeners with .native modifier
  2944. // so it gets processed during parent component patch.
  2945. data.on = data.nativeOn;
  2946. if (isTrue(Ctor.options.abstract)) {
  2947. // abstract components do not keep anything
  2948. // other than props & listeners & slot
  2949. // work around flow
  2950. var slot = data.slot;
  2951. data = {};
  2952. if (slot) {
  2953. data.slot = slot;
  2954. }
  2955. }
  2956. // install component management hooks onto the placeholder node
  2957. installComponentHooks(data);
  2958. // return a placeholder vnode
  2959. var name = Ctor.options.name || tag;
  2960. var vnode = new VNode(
  2961. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  2962. data, undefined, undefined, undefined, context,
  2963. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  2964. asyncFactory
  2965. );
  2966. return vnode
  2967. }
  2968. function createComponentInstanceForVnode (
  2969. vnode, // we know it's MountedComponentVNode but flow doesn't
  2970. parent // activeInstance in lifecycle state
  2971. ) {
  2972. var options = {
  2973. _isComponent: true,
  2974. _parentVnode: vnode,
  2975. parent: parent
  2976. };
  2977. // check inline-template render functions
  2978. var inlineTemplate = vnode.data.inlineTemplate;
  2979. if (isDef(inlineTemplate)) {
  2980. options.render = inlineTemplate.render;
  2981. options.staticRenderFns = inlineTemplate.staticRenderFns;
  2982. }
  2983. return new vnode.componentOptions.Ctor(options)
  2984. }
  2985. function installComponentHooks (data) {
  2986. var hooks = data.hook || (data.hook = {});
  2987. for (var i = 0; i < hooksToMerge.length; i++) {
  2988. var key = hooksToMerge[i];
  2989. var existing = hooks[key];
  2990. var toMerge = componentVNodeHooks[key];
  2991. if (existing !== toMerge && !(existing && existing._merged)) {
  2992. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  2993. }
  2994. }
  2995. }
  2996. function mergeHook$1 (f1, f2) {
  2997. var merged = function (a, b) {
  2998. // flow complains about extra args which is why we use any
  2999. f1(a, b);
  3000. f2(a, b);
  3001. };
  3002. merged._merged = true;
  3003. return merged
  3004. }
  3005. // transform component v-model info (value and callback) into
  3006. // prop and event handler respectively.
  3007. function transformModel (options, data) {
  3008. var prop = (options.model && options.model.prop) || 'value';
  3009. var event = (options.model && options.model.event) || 'input'
  3010. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  3011. var on = data.on || (data.on = {});
  3012. var existing = on[event];
  3013. var callback = data.model.callback;
  3014. if (isDef(existing)) {
  3015. if (
  3016. Array.isArray(existing)
  3017. ? existing.indexOf(callback) === -1
  3018. : existing !== callback
  3019. ) {
  3020. on[event] = [callback].concat(existing);
  3021. }
  3022. } else {
  3023. on[event] = callback;
  3024. }
  3025. }
  3026. /* */
  3027. var SIMPLE_NORMALIZE = 1;
  3028. var ALWAYS_NORMALIZE = 2;
  3029. // wrapper function for providing a more flexible interface
  3030. // without getting yelled at by flow
  3031. function createElement (
  3032. context,
  3033. tag,
  3034. data,
  3035. children,
  3036. normalizationType,
  3037. alwaysNormalize
  3038. ) {
  3039. if (Array.isArray(data) || isPrimitive(data)) {
  3040. normalizationType = children;
  3041. children = data;
  3042. data = undefined;
  3043. }
  3044. if (isTrue(alwaysNormalize)) {
  3045. normalizationType = ALWAYS_NORMALIZE;
  3046. }
  3047. return _createElement(context, tag, data, children, normalizationType)
  3048. }
  3049. function _createElement (
  3050. context,
  3051. tag,
  3052. data,
  3053. children,
  3054. normalizationType
  3055. ) {
  3056. if (isDef(data) && isDef((data).__ob__)) {
  3057. process.env.NODE_ENV !== 'production' && warn(
  3058. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  3059. 'Always create fresh vnode data objects in each render!',
  3060. context
  3061. );
  3062. return createEmptyVNode()
  3063. }
  3064. // object syntax in v-bind
  3065. if (isDef(data) && isDef(data.is)) {
  3066. tag = data.is;
  3067. }
  3068. if (!tag) {
  3069. // in case of component :is set to falsy value
  3070. return createEmptyVNode()
  3071. }
  3072. // warn against non-primitive key
  3073. if (process.env.NODE_ENV !== 'production' &&
  3074. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  3075. ) {
  3076. {
  3077. warn(
  3078. 'Avoid using non-primitive value as key, ' +
  3079. 'use string/number value instead.',
  3080. context
  3081. );
  3082. }
  3083. }
  3084. // support single function children as default scoped slot
  3085. if (Array.isArray(children) &&
  3086. typeof children[0] === 'function'
  3087. ) {
  3088. data = data || {};
  3089. data.scopedSlots = { default: children[0] };
  3090. children.length = 0;
  3091. }
  3092. if (normalizationType === ALWAYS_NORMALIZE) {
  3093. children = normalizeChildren(children);
  3094. } else if (normalizationType === SIMPLE_NORMALIZE) {
  3095. children = simpleNormalizeChildren(children);
  3096. }
  3097. var vnode, ns;
  3098. if (typeof tag === 'string') {
  3099. var Ctor;
  3100. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  3101. if (config.isReservedTag(tag)) {
  3102. // platform built-in elements
  3103. if (process.env.NODE_ENV !== 'production' && isDef(data) && isDef(data.nativeOn)) {
  3104. warn(
  3105. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  3106. context
  3107. );
  3108. }
  3109. vnode = new VNode(
  3110. config.parsePlatformTagName(tag), data, children,
  3111. undefined, undefined, context
  3112. );
  3113. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  3114. // component
  3115. vnode = createComponent(Ctor, data, context, children, tag);
  3116. } else {
  3117. // unknown or unlisted namespaced elements
  3118. // check at runtime because it may get assigned a namespace when its
  3119. // parent normalizes children
  3120. vnode = new VNode(
  3121. tag, data, children,
  3122. undefined, undefined, context
  3123. );
  3124. }
  3125. } else {
  3126. // direct component options / constructor
  3127. vnode = createComponent(tag, data, context, children);
  3128. }
  3129. if (Array.isArray(vnode)) {
  3130. return vnode
  3131. } else if (isDef(vnode)) {
  3132. if (isDef(ns)) { applyNS(vnode, ns); }
  3133. if (isDef(data)) { registerDeepBindings(data); }
  3134. return vnode
  3135. } else {
  3136. return createEmptyVNode()
  3137. }
  3138. }
  3139. function applyNS (vnode, ns, force) {
  3140. vnode.ns = ns;
  3141. if (vnode.tag === 'foreignObject') {
  3142. // use default namespace inside foreignObject
  3143. ns = undefined;
  3144. force = true;
  3145. }
  3146. if (isDef(vnode.children)) {
  3147. for (var i = 0, l = vnode.children.length; i < l; i++) {
  3148. var child = vnode.children[i];
  3149. if (isDef(child.tag) && (
  3150. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  3151. applyNS(child, ns, force);
  3152. }
  3153. }
  3154. }
  3155. }
  3156. // ref #5318
  3157. // necessary to ensure parent re-render when deep bindings like :style and
  3158. // :class are used on slot nodes
  3159. function registerDeepBindings (data) {
  3160. if (isObject(data.style)) {
  3161. traverse(data.style);
  3162. }
  3163. if (isObject(data.class)) {
  3164. traverse(data.class);
  3165. }
  3166. }
  3167. /* */
  3168. function initRender (vm) {
  3169. vm._vnode = null; // the root of the child tree
  3170. vm._staticTrees = null; // v-once cached trees
  3171. var options = vm.$options;
  3172. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  3173. var renderContext = parentVnode && parentVnode.context;
  3174. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  3175. vm.$scopedSlots = emptyObject;
  3176. // bind the createElement fn to this instance
  3177. // so that we get proper render context inside it.
  3178. // args order: tag, data, children, normalizationType, alwaysNormalize
  3179. // internal version is used by render functions compiled from templates
  3180. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  3181. // normalization is always applied for the public version, used in
  3182. // user-written render functions.
  3183. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  3184. // $attrs & $listeners are exposed for easier HOC creation.
  3185. // they need to be reactive so that HOCs using them are always updated
  3186. var parentData = parentVnode && parentVnode.data;
  3187. /* istanbul ignore else */
  3188. if (process.env.NODE_ENV !== 'production') {
  3189. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  3190. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  3191. }, true);
  3192. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  3193. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  3194. }, true);
  3195. } else {
  3196. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true);
  3197. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, null, true);
  3198. }
  3199. }
  3200. var currentRenderingInstance = null;
  3201. function renderMixin (Vue) {
  3202. // install runtime convenience helpers
  3203. installRenderHelpers(Vue.prototype);
  3204. Vue.prototype.$nextTick = function (fn) {
  3205. return nextTick(fn, this)
  3206. };
  3207. Vue.prototype._render = function () {
  3208. var vm = this;
  3209. var ref = vm.$options;
  3210. var render = ref.render;
  3211. var _parentVnode = ref._parentVnode;
  3212. if (_parentVnode) {
  3213. vm.$scopedSlots = normalizeScopedSlots(
  3214. _parentVnode.data.scopedSlots,
  3215. vm.$slots,
  3216. vm.$scopedSlots
  3217. );
  3218. }
  3219. // set parent vnode. this allows render functions to have access
  3220. // to the data on the placeholder node.
  3221. vm.$vnode = _parentVnode;
  3222. // render self
  3223. var vnode;
  3224. try {
  3225. // There's no need to maintain a stack because all render fns are called
  3226. // separately from one another. Nested component's render fns are called
  3227. // when parent component is patched.
  3228. currentRenderingInstance = vm;
  3229. vnode = render.call(vm._renderProxy, vm.$createElement);
  3230. } catch (e) {
  3231. handleError(e, vm, "render");
  3232. // return error render result,
  3233. // or previous vnode to prevent render error causing blank component
  3234. /* istanbul ignore else */
  3235. if (process.env.NODE_ENV !== 'production' && vm.$options.renderError) {
  3236. try {
  3237. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  3238. } catch (e) {
  3239. handleError(e, vm, "renderError");
  3240. vnode = vm._vnode;
  3241. }
  3242. } else {
  3243. vnode = vm._vnode;
  3244. }
  3245. } finally {
  3246. currentRenderingInstance = null;
  3247. }
  3248. // if the returned array contains only a single node, allow it
  3249. if (Array.isArray(vnode) && vnode.length === 1) {
  3250. vnode = vnode[0];
  3251. }
  3252. // return empty vnode in case the render function errored out
  3253. if (!(vnode instanceof VNode)) {
  3254. if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) {
  3255. warn(
  3256. 'Multiple root nodes returned from render function. Render function ' +
  3257. 'should return a single root node.',
  3258. vm
  3259. );
  3260. }
  3261. vnode = createEmptyVNode();
  3262. }
  3263. // set parent
  3264. vnode.parent = _parentVnode;
  3265. return vnode
  3266. };
  3267. }
  3268. /* */
  3269. function ensureCtor (comp, base) {
  3270. if (
  3271. comp.__esModule ||
  3272. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  3273. ) {
  3274. comp = comp.default;
  3275. }
  3276. return isObject(comp)
  3277. ? base.extend(comp)
  3278. : comp
  3279. }
  3280. function createAsyncPlaceholder (
  3281. factory,
  3282. data,
  3283. context,
  3284. children,
  3285. tag
  3286. ) {
  3287. var node = createEmptyVNode();
  3288. node.asyncFactory = factory;
  3289. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  3290. return node
  3291. }
  3292. function resolveAsyncComponent (
  3293. factory,
  3294. baseCtor
  3295. ) {
  3296. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  3297. return factory.errorComp
  3298. }
  3299. if (isDef(factory.resolved)) {
  3300. return factory.resolved
  3301. }
  3302. var owner = currentRenderingInstance;
  3303. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  3304. // already pending
  3305. factory.owners.push(owner);
  3306. }
  3307. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  3308. return factory.loadingComp
  3309. }
  3310. if (owner && !isDef(factory.owners)) {
  3311. var owners = factory.owners = [owner];
  3312. var sync = true;
  3313. var timerLoading = null;
  3314. var timerTimeout = null
  3315. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  3316. var forceRender = function (renderCompleted) {
  3317. for (var i = 0, l = owners.length; i < l; i++) {
  3318. (owners[i]).$forceUpdate();
  3319. }
  3320. if (renderCompleted) {
  3321. owners.length = 0;
  3322. if (timerLoading !== null) {
  3323. clearTimeout(timerLoading);
  3324. timerLoading = null;
  3325. }
  3326. if (timerTimeout !== null) {
  3327. clearTimeout(timerTimeout);
  3328. timerTimeout = null;
  3329. }
  3330. }
  3331. };
  3332. var resolve = once(function (res) {
  3333. // cache resolved
  3334. factory.resolved = ensureCtor(res, baseCtor);
  3335. // invoke callbacks only if this is not a synchronous resolve
  3336. // (async resolves are shimmed as synchronous during SSR)
  3337. if (!sync) {
  3338. forceRender(true);
  3339. } else {
  3340. owners.length = 0;
  3341. }
  3342. });
  3343. var reject = once(function (reason) {
  3344. process.env.NODE_ENV !== 'production' && warn(
  3345. "Failed to resolve async component: " + (String(factory)) +
  3346. (reason ? ("\nReason: " + reason) : '')
  3347. );
  3348. if (isDef(factory.errorComp)) {
  3349. factory.error = true;
  3350. forceRender(true);
  3351. }
  3352. });
  3353. var res = factory(resolve, reject);
  3354. if (isObject(res)) {
  3355. if (isPromise(res)) {
  3356. // () => Promise
  3357. if (isUndef(factory.resolved)) {
  3358. res.then(resolve, reject);
  3359. }
  3360. } else if (isPromise(res.component)) {
  3361. res.component.then(resolve, reject);
  3362. if (isDef(res.error)) {
  3363. factory.errorComp = ensureCtor(res.error, baseCtor);
  3364. }
  3365. if (isDef(res.loading)) {
  3366. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  3367. if (res.delay === 0) {
  3368. factory.loading = true;
  3369. } else {
  3370. timerLoading = setTimeout(function () {
  3371. timerLoading = null;
  3372. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  3373. factory.loading = true;
  3374. forceRender(false);
  3375. }
  3376. }, res.delay || 200);
  3377. }
  3378. }
  3379. if (isDef(res.timeout)) {
  3380. timerTimeout = setTimeout(function () {
  3381. timerTimeout = null;
  3382. if (isUndef(factory.resolved)) {
  3383. reject(
  3384. process.env.NODE_ENV !== 'production'
  3385. ? ("timeout (" + (res.timeout) + "ms)")
  3386. : null
  3387. );
  3388. }
  3389. }, res.timeout);
  3390. }
  3391. }
  3392. }
  3393. sync = false;
  3394. // return in case resolved synchronously
  3395. return factory.loading
  3396. ? factory.loadingComp
  3397. : factory.resolved
  3398. }
  3399. }
  3400. /* */
  3401. function isAsyncPlaceholder (node) {
  3402. return node.isComment && node.asyncFactory
  3403. }
  3404. /* */
  3405. function getFirstComponentChild (children) {
  3406. if (Array.isArray(children)) {
  3407. for (var i = 0; i < children.length; i++) {
  3408. var c = children[i];
  3409. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  3410. return c
  3411. }
  3412. }
  3413. }
  3414. }
  3415. /* */
  3416. /* */
  3417. function initEvents (vm) {
  3418. vm._events = Object.create(null);
  3419. vm._hasHookEvent = false;
  3420. // init parent attached events
  3421. var listeners = vm.$options._parentListeners;
  3422. if (listeners) {
  3423. updateComponentListeners(vm, listeners);
  3424. }
  3425. }
  3426. var target;
  3427. function add (event, fn) {
  3428. target.$on(event, fn);
  3429. }
  3430. function remove$1 (event, fn) {
  3431. target.$off(event, fn);
  3432. }
  3433. function createOnceHandler (event, fn) {
  3434. var _target = target;
  3435. return function onceHandler () {
  3436. var res = fn.apply(null, arguments);
  3437. if (res !== null) {
  3438. _target.$off(event, onceHandler);
  3439. }
  3440. }
  3441. }
  3442. function updateComponentListeners (
  3443. vm,
  3444. listeners,
  3445. oldListeners
  3446. ) {
  3447. target = vm;
  3448. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  3449. target = undefined;
  3450. }
  3451. function eventsMixin (Vue) {
  3452. var hookRE = /^hook:/;
  3453. Vue.prototype.$on = function (event, fn) {
  3454. var vm = this;
  3455. if (Array.isArray(event)) {
  3456. for (var i = 0, l = event.length; i < l; i++) {
  3457. vm.$on(event[i], fn);
  3458. }
  3459. } else {
  3460. (vm._events[event] || (vm._events[event] = [])).push(fn);
  3461. // optimize hook:event cost by using a boolean flag marked at registration
  3462. // instead of a hash lookup
  3463. if (hookRE.test(event)) {
  3464. vm._hasHookEvent = true;
  3465. }
  3466. }
  3467. return vm
  3468. };
  3469. Vue.prototype.$once = function (event, fn) {
  3470. var vm = this;
  3471. function on () {
  3472. vm.$off(event, on);
  3473. fn.apply(vm, arguments);
  3474. }
  3475. on.fn = fn;
  3476. vm.$on(event, on);
  3477. return vm
  3478. };
  3479. Vue.prototype.$off = function (event, fn) {
  3480. var vm = this;
  3481. // all
  3482. if (!arguments.length) {
  3483. vm._events = Object.create(null);
  3484. return vm
  3485. }
  3486. // array of events
  3487. if (Array.isArray(event)) {
  3488. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  3489. vm.$off(event[i$1], fn);
  3490. }
  3491. return vm
  3492. }
  3493. // specific event
  3494. var cbs = vm._events[event];
  3495. if (!cbs) {
  3496. return vm
  3497. }
  3498. if (!fn) {
  3499. vm._events[event] = null;
  3500. return vm
  3501. }
  3502. // specific handler
  3503. var cb;
  3504. var i = cbs.length;
  3505. while (i--) {
  3506. cb = cbs[i];
  3507. if (cb === fn || cb.fn === fn) {
  3508. cbs.splice(i, 1);
  3509. break
  3510. }
  3511. }
  3512. return vm
  3513. };
  3514. Vue.prototype.$emit = function (event) {
  3515. var vm = this;
  3516. if (process.env.NODE_ENV !== 'production') {
  3517. var lowerCaseEvent = event.toLowerCase();
  3518. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  3519. tip(
  3520. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  3521. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  3522. "Note that HTML attributes are case-insensitive and you cannot use " +
  3523. "v-on to listen to camelCase events when using in-DOM templates. " +
  3524. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  3525. );
  3526. }
  3527. }
  3528. var cbs = vm._events[event];
  3529. if (cbs) {
  3530. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  3531. var args = toArray(arguments, 1);
  3532. var info = "event handler for \"" + event + "\"";
  3533. for (var i = 0, l = cbs.length; i < l; i++) {
  3534. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  3535. }
  3536. }
  3537. return vm
  3538. };
  3539. }
  3540. /* */
  3541. var activeInstance = null;
  3542. var isUpdatingChildComponent = false;
  3543. function setActiveInstance(vm) {
  3544. var prevActiveInstance = activeInstance;
  3545. activeInstance = vm;
  3546. return function () {
  3547. activeInstance = prevActiveInstance;
  3548. }
  3549. }
  3550. function initLifecycle (vm) {
  3551. var options = vm.$options;
  3552. // locate first non-abstract parent
  3553. var parent = options.parent;
  3554. if (parent && !options.abstract) {
  3555. while (parent.$options.abstract && parent.$parent) {
  3556. parent = parent.$parent;
  3557. }
  3558. parent.$children.push(vm);
  3559. }
  3560. vm.$parent = parent;
  3561. vm.$root = parent ? parent.$root : vm;
  3562. vm.$children = [];
  3563. vm.$refs = {};
  3564. vm._watcher = null;
  3565. vm._inactive = null;
  3566. vm._directInactive = false;
  3567. vm._isMounted = false;
  3568. vm._isDestroyed = false;
  3569. vm._isBeingDestroyed = false;
  3570. }
  3571. function lifecycleMixin (Vue) {
  3572. Vue.prototype._update = function (vnode, hydrating) {
  3573. var vm = this;
  3574. var prevEl = vm.$el;
  3575. var prevVnode = vm._vnode;
  3576. var restoreActiveInstance = setActiveInstance(vm);
  3577. vm._vnode = vnode;
  3578. // Vue.prototype.__patch__ is injected in entry points
  3579. // based on the rendering backend used.
  3580. if (!prevVnode) {
  3581. // initial render
  3582. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  3583. } else {
  3584. // updates
  3585. vm.$el = vm.__patch__(prevVnode, vnode);
  3586. }
  3587. restoreActiveInstance();
  3588. // update __vue__ reference
  3589. if (prevEl) {
  3590. prevEl.__vue__ = null;
  3591. }
  3592. if (vm.$el) {
  3593. vm.$el.__vue__ = vm;
  3594. }
  3595. // if parent is an HOC, update its $el as well
  3596. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  3597. vm.$parent.$el = vm.$el;
  3598. }
  3599. // updated hook is called by the scheduler to ensure that children are
  3600. // updated in a parent's updated hook.
  3601. };
  3602. Vue.prototype.$forceUpdate = function () {
  3603. var vm = this;
  3604. if (vm._watcher) {
  3605. vm._watcher.update();
  3606. }
  3607. };
  3608. Vue.prototype.$destroy = function () {
  3609. var vm = this;
  3610. if (vm._isBeingDestroyed) {
  3611. return
  3612. }
  3613. callHook(vm, 'beforeDestroy');
  3614. vm._isBeingDestroyed = true;
  3615. // remove self from parent
  3616. var parent = vm.$parent;
  3617. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  3618. remove(parent.$children, vm);
  3619. }
  3620. // teardown watchers
  3621. if (vm._watcher) {
  3622. vm._watcher.teardown();
  3623. }
  3624. var i = vm._watchers.length;
  3625. while (i--) {
  3626. vm._watchers[i].teardown();
  3627. }
  3628. // remove reference from data ob
  3629. // frozen object may not have observer.
  3630. if (vm._data.__ob__) {
  3631. vm._data.__ob__.vmCount--;
  3632. }
  3633. // call the last hook...
  3634. vm._isDestroyed = true;
  3635. // invoke destroy hooks on current rendered tree
  3636. vm.__patch__(vm._vnode, null);
  3637. // fire destroyed hook
  3638. callHook(vm, 'destroyed');
  3639. // turn off all instance listeners.
  3640. vm.$off();
  3641. // remove __vue__ reference
  3642. if (vm.$el) {
  3643. vm.$el.__vue__ = null;
  3644. }
  3645. // release circular reference (#6759)
  3646. if (vm.$vnode) {
  3647. vm.$vnode.parent = null;
  3648. }
  3649. };
  3650. }
  3651. function mountComponent (
  3652. vm,
  3653. el,
  3654. hydrating
  3655. ) {
  3656. vm.$el = el;
  3657. if (!vm.$options.render) {
  3658. vm.$options.render = createEmptyVNode;
  3659. if (process.env.NODE_ENV !== 'production') {
  3660. /* istanbul ignore if */
  3661. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  3662. vm.$options.el || el) {
  3663. warn(
  3664. 'You are using the runtime-only build of Vue where the template ' +
  3665. 'compiler is not available. Either pre-compile the templates into ' +
  3666. 'render functions, or use the compiler-included build.',
  3667. vm
  3668. );
  3669. } else {
  3670. warn(
  3671. 'Failed to mount component: template or render function not defined.',
  3672. vm
  3673. );
  3674. }
  3675. }
  3676. }
  3677. callHook(vm, 'beforeMount');
  3678. var updateComponent;
  3679. /* istanbul ignore if */
  3680. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  3681. updateComponent = function () {
  3682. var name = vm._name;
  3683. var id = vm._uid;
  3684. var startTag = "vue-perf-start:" + id;
  3685. var endTag = "vue-perf-end:" + id;
  3686. mark(startTag);
  3687. var vnode = vm._render();
  3688. mark(endTag);
  3689. measure(("vue " + name + " render"), startTag, endTag);
  3690. mark(startTag);
  3691. vm._update(vnode, hydrating);
  3692. mark(endTag);
  3693. measure(("vue " + name + " patch"), startTag, endTag);
  3694. };
  3695. } else {
  3696. updateComponent = function () {
  3697. vm._update(vm._render(), hydrating);
  3698. };
  3699. }
  3700. // we set this to vm._watcher inside the watcher's constructor
  3701. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  3702. // component's mounted hook), which relies on vm._watcher being already defined
  3703. new Watcher(vm, updateComponent, noop, {
  3704. before: function before () {
  3705. if (vm._isMounted && !vm._isDestroyed) {
  3706. callHook(vm, 'beforeUpdate');
  3707. }
  3708. }
  3709. }, true /* isRenderWatcher */);
  3710. hydrating = false;
  3711. // manually mounted instance, call mounted on self
  3712. // mounted is called for render-created child components in its inserted hook
  3713. if (vm.$vnode == null) {
  3714. vm._isMounted = true;
  3715. callHook(vm, 'mounted');
  3716. }
  3717. return vm
  3718. }
  3719. function updateChildComponent (
  3720. vm,
  3721. propsData,
  3722. listeners,
  3723. parentVnode,
  3724. renderChildren
  3725. ) {
  3726. if (process.env.NODE_ENV !== 'production') {
  3727. isUpdatingChildComponent = true;
  3728. }
  3729. // determine whether component has slot children
  3730. // we need to do this before overwriting $options._renderChildren.
  3731. // check if there are dynamic scopedSlots (hand-written or compiled but with
  3732. // dynamic slot names). Static scoped slots compiled from template has the
  3733. // "$stable" marker.
  3734. var newScopedSlots = parentVnode.data.scopedSlots;
  3735. var oldScopedSlots = vm.$scopedSlots;
  3736. var hasDynamicScopedSlot = !!(
  3737. (newScopedSlots && !newScopedSlots.$stable) ||
  3738. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  3739. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  3740. );
  3741. // Any static slot children from the parent may have changed during parent's
  3742. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  3743. // update is necessary to ensure correctness.
  3744. var needsForceUpdate = !!(
  3745. renderChildren || // has new static slots
  3746. vm.$options._renderChildren || // has old static slots
  3747. hasDynamicScopedSlot
  3748. );
  3749. vm.$options._parentVnode = parentVnode;
  3750. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  3751. if (vm._vnode) { // update child tree's parent
  3752. vm._vnode.parent = parentVnode;
  3753. }
  3754. vm.$options._renderChildren = renderChildren;
  3755. // update $attrs and $listeners hash
  3756. // these are also reactive so they may trigger child update if the child
  3757. // used them during render
  3758. vm.$attrs = parentVnode.data.attrs || emptyObject;
  3759. vm.$listeners = listeners || emptyObject;
  3760. // update props
  3761. if (propsData && vm.$options.props) {
  3762. toggleObserving(false);
  3763. var props = vm._props;
  3764. var propKeys = vm.$options._propKeys || [];
  3765. for (var i = 0; i < propKeys.length; i++) {
  3766. var key = propKeys[i];
  3767. var propOptions = vm.$options.props; // wtf flow?
  3768. props[key] = validateProp(key, propOptions, propsData, vm);
  3769. }
  3770. toggleObserving(true);
  3771. // keep a copy of raw propsData
  3772. vm.$options.propsData = propsData;
  3773. }
  3774. // update listeners
  3775. listeners = listeners || emptyObject;
  3776. var oldListeners = vm.$options._parentListeners;
  3777. vm.$options._parentListeners = listeners;
  3778. updateComponentListeners(vm, listeners, oldListeners);
  3779. // resolve slots + force update if has children
  3780. if (needsForceUpdate) {
  3781. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  3782. vm.$forceUpdate();
  3783. }
  3784. if (process.env.NODE_ENV !== 'production') {
  3785. isUpdatingChildComponent = false;
  3786. }
  3787. }
  3788. function isInInactiveTree (vm) {
  3789. while (vm && (vm = vm.$parent)) {
  3790. if (vm._inactive) { return true }
  3791. }
  3792. return false
  3793. }
  3794. function activateChildComponent (vm, direct) {
  3795. if (direct) {
  3796. vm._directInactive = false;
  3797. if (isInInactiveTree(vm)) {
  3798. return
  3799. }
  3800. } else if (vm._directInactive) {
  3801. return
  3802. }
  3803. if (vm._inactive || vm._inactive === null) {
  3804. vm._inactive = false;
  3805. for (var i = 0; i < vm.$children.length; i++) {
  3806. activateChildComponent(vm.$children[i]);
  3807. }
  3808. callHook(vm, 'activated');
  3809. }
  3810. }
  3811. function deactivateChildComponent (vm, direct) {
  3812. if (direct) {
  3813. vm._directInactive = true;
  3814. if (isInInactiveTree(vm)) {
  3815. return
  3816. }
  3817. }
  3818. if (!vm._inactive) {
  3819. vm._inactive = true;
  3820. for (var i = 0; i < vm.$children.length; i++) {
  3821. deactivateChildComponent(vm.$children[i]);
  3822. }
  3823. callHook(vm, 'deactivated');
  3824. }
  3825. }
  3826. function callHook (vm, hook) {
  3827. // #7573 disable dep collection when invoking lifecycle hooks
  3828. pushTarget();
  3829. var handlers = vm.$options[hook];
  3830. var info = hook + " hook";
  3831. if (handlers) {
  3832. for (var i = 0, j = handlers.length; i < j; i++) {
  3833. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  3834. }
  3835. }
  3836. if (vm._hasHookEvent) {
  3837. vm.$emit('hook:' + hook);
  3838. }
  3839. popTarget();
  3840. }
  3841. /* */
  3842. var MAX_UPDATE_COUNT = 100;
  3843. var queue = [];
  3844. var activatedChildren = [];
  3845. var has = {};
  3846. var circular = {};
  3847. var waiting = false;
  3848. var flushing = false;
  3849. var index = 0;
  3850. /**
  3851. * Reset the scheduler's state.
  3852. */
  3853. function resetSchedulerState () {
  3854. index = queue.length = activatedChildren.length = 0;
  3855. has = {};
  3856. if (process.env.NODE_ENV !== 'production') {
  3857. circular = {};
  3858. }
  3859. waiting = flushing = false;
  3860. }
  3861. // Async edge case #6566 requires saving the timestamp when event listeners are
  3862. // attached. However, calling performance.now() has a perf overhead especially
  3863. // if the page has thousands of event listeners. Instead, we take a timestamp
  3864. // every time the scheduler flushes and use that for all event listeners
  3865. // attached during that flush.
  3866. var currentFlushTimestamp = 0;
  3867. // Async edge case fix requires storing an event listener's attach timestamp.
  3868. var getNow = Date.now;
  3869. // Determine what event timestamp the browser is using. Annoyingly, the
  3870. // timestamp can either be hi-res (relative to page load) or low-res
  3871. // (relative to UNIX epoch), so in order to compare time we have to use the
  3872. // same timestamp type when saving the flush timestamp.
  3873. // All IE versions use low-res event timestamps, and have problematic clock
  3874. // implementations (#9632)
  3875. if (inBrowser && !isIE) {
  3876. var performance = window.performance;
  3877. if (
  3878. performance &&
  3879. typeof performance.now === 'function' &&
  3880. getNow() > document.createEvent('Event').timeStamp
  3881. ) {
  3882. // if the event timestamp, although evaluated AFTER the Date.now(), is
  3883. // smaller than it, it means the event is using a hi-res timestamp,
  3884. // and we need to use the hi-res version for event listener timestamps as
  3885. // well.
  3886. getNow = function () { return performance.now(); };
  3887. }
  3888. }
  3889. /**
  3890. * Flush both queues and run the watchers.
  3891. */
  3892. function flushSchedulerQueue () {
  3893. currentFlushTimestamp = getNow();
  3894. flushing = true;
  3895. var watcher, id;
  3896. // Sort queue before flush.
  3897. // This ensures that:
  3898. // 1. Components are updated from parent to child. (because parent is always
  3899. // created before the child)
  3900. // 2. A component's user watchers are run before its render watcher (because
  3901. // user watchers are created before the render watcher)
  3902. // 3. If a component is destroyed during a parent component's watcher run,
  3903. // its watchers can be skipped.
  3904. queue.sort(function (a, b) { return a.id - b.id; });
  3905. // do not cache length because more watchers might be pushed
  3906. // as we run existing watchers
  3907. for (index = 0; index < queue.length; index++) {
  3908. watcher = queue[index];
  3909. if (watcher.before) {
  3910. watcher.before();
  3911. }
  3912. id = watcher.id;
  3913. has[id] = null;
  3914. watcher.run();
  3915. // in dev build, check and stop circular updates.
  3916. if (process.env.NODE_ENV !== 'production' && has[id] != null) {
  3917. circular[id] = (circular[id] || 0) + 1;
  3918. if (circular[id] > MAX_UPDATE_COUNT) {
  3919. warn(
  3920. 'You may have an infinite update loop ' + (
  3921. watcher.user
  3922. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  3923. : "in a component render function."
  3924. ),
  3925. watcher.vm
  3926. );
  3927. break
  3928. }
  3929. }
  3930. }
  3931. // keep copies of post queues before resetting state
  3932. var activatedQueue = activatedChildren.slice();
  3933. var updatedQueue = queue.slice();
  3934. resetSchedulerState();
  3935. // call component updated and activated hooks
  3936. callActivatedHooks(activatedQueue);
  3937. callUpdatedHooks(updatedQueue);
  3938. // devtool hook
  3939. /* istanbul ignore if */
  3940. if (devtools && config.devtools) {
  3941. devtools.emit('flush');
  3942. }
  3943. }
  3944. function callUpdatedHooks (queue) {
  3945. var i = queue.length;
  3946. while (i--) {
  3947. var watcher = queue[i];
  3948. var vm = watcher.vm;
  3949. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  3950. callHook(vm, 'updated');
  3951. }
  3952. }
  3953. }
  3954. /**
  3955. * Queue a kept-alive component that was activated during patch.
  3956. * The queue will be processed after the entire tree has been patched.
  3957. */
  3958. function queueActivatedComponent (vm) {
  3959. // setting _inactive to false here so that a render function can
  3960. // rely on checking whether it's in an inactive tree (e.g. router-view)
  3961. vm._inactive = false;
  3962. activatedChildren.push(vm);
  3963. }
  3964. function callActivatedHooks (queue) {
  3965. for (var i = 0; i < queue.length; i++) {
  3966. queue[i]._inactive = true;
  3967. activateChildComponent(queue[i], true /* true */);
  3968. }
  3969. }
  3970. /**
  3971. * Push a watcher into the watcher queue.
  3972. * Jobs with duplicate IDs will be skipped unless it's
  3973. * pushed when the queue is being flushed.
  3974. */
  3975. function queueWatcher (watcher) {
  3976. var id = watcher.id;
  3977. if (has[id] == null) {
  3978. has[id] = true;
  3979. if (!flushing) {
  3980. queue.push(watcher);
  3981. } else {
  3982. // if already flushing, splice the watcher based on its id
  3983. // if already past its id, it will be run next immediately.
  3984. var i = queue.length - 1;
  3985. while (i > index && queue[i].id > watcher.id) {
  3986. i--;
  3987. }
  3988. queue.splice(i + 1, 0, watcher);
  3989. }
  3990. // queue the flush
  3991. if (!waiting) {
  3992. waiting = true;
  3993. if (process.env.NODE_ENV !== 'production' && !config.async) {
  3994. flushSchedulerQueue();
  3995. return
  3996. }
  3997. nextTick(flushSchedulerQueue);
  3998. }
  3999. }
  4000. }
  4001. /* */
  4002. var uid$2 = 0;
  4003. /**
  4004. * A watcher parses an expression, collects dependencies,
  4005. * and fires callback when the expression value changes.
  4006. * This is used for both the $watch() api and directives.
  4007. */
  4008. var Watcher = function Watcher (
  4009. vm,
  4010. expOrFn,
  4011. cb,
  4012. options,
  4013. isRenderWatcher
  4014. ) {
  4015. this.vm = vm;
  4016. if (isRenderWatcher) {
  4017. vm._watcher = this;
  4018. }
  4019. vm._watchers.push(this);
  4020. // options
  4021. if (options) {
  4022. this.deep = !!options.deep;
  4023. this.user = !!options.user;
  4024. this.lazy = !!options.lazy;
  4025. this.sync = !!options.sync;
  4026. this.before = options.before;
  4027. } else {
  4028. this.deep = this.user = this.lazy = this.sync = false;
  4029. }
  4030. this.cb = cb;
  4031. this.id = ++uid$2; // uid for batching
  4032. this.active = true;
  4033. this.dirty = this.lazy; // for lazy watchers
  4034. this.deps = [];
  4035. this.newDeps = [];
  4036. this.depIds = new _Set();
  4037. this.newDepIds = new _Set();
  4038. this.expression = process.env.NODE_ENV !== 'production'
  4039. ? expOrFn.toString()
  4040. : '';
  4041. // parse expression for getter
  4042. if (typeof expOrFn === 'function') {
  4043. this.getter = expOrFn;
  4044. } else {
  4045. this.getter = parsePath(expOrFn);
  4046. if (!this.getter) {
  4047. this.getter = noop;
  4048. process.env.NODE_ENV !== 'production' && warn(
  4049. "Failed watching path: \"" + expOrFn + "\" " +
  4050. 'Watcher only accepts simple dot-delimited paths. ' +
  4051. 'For full control, use a function instead.',
  4052. vm
  4053. );
  4054. }
  4055. }
  4056. this.value = this.lazy
  4057. ? undefined
  4058. : this.get();
  4059. };
  4060. /**
  4061. * Evaluate the getter, and re-collect dependencies.
  4062. */
  4063. Watcher.prototype.get = function get () {
  4064. pushTarget(this);
  4065. var value;
  4066. var vm = this.vm;
  4067. try {
  4068. value = this.getter.call(vm, vm);
  4069. } catch (e) {
  4070. if (this.user) {
  4071. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  4072. } else {
  4073. throw e
  4074. }
  4075. } finally {
  4076. // "touch" every property so they are all tracked as
  4077. // dependencies for deep watching
  4078. if (this.deep) {
  4079. traverse(value);
  4080. }
  4081. popTarget();
  4082. this.cleanupDeps();
  4083. }
  4084. return value
  4085. };
  4086. /**
  4087. * Add a dependency to this directive.
  4088. */
  4089. Watcher.prototype.addDep = function addDep (dep) {
  4090. var id = dep.id;
  4091. if (!this.newDepIds.has(id)) {
  4092. this.newDepIds.add(id);
  4093. this.newDeps.push(dep);
  4094. if (!this.depIds.has(id)) {
  4095. dep.addSub(this);
  4096. }
  4097. }
  4098. };
  4099. /**
  4100. * Clean up for dependency collection.
  4101. */
  4102. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  4103. var i = this.deps.length;
  4104. while (i--) {
  4105. var dep = this.deps[i];
  4106. if (!this.newDepIds.has(dep.id)) {
  4107. dep.removeSub(this);
  4108. }
  4109. }
  4110. var tmp = this.depIds;
  4111. this.depIds = this.newDepIds;
  4112. this.newDepIds = tmp;
  4113. this.newDepIds.clear();
  4114. tmp = this.deps;
  4115. this.deps = this.newDeps;
  4116. this.newDeps = tmp;
  4117. this.newDeps.length = 0;
  4118. };
  4119. /**
  4120. * Subscriber interface.
  4121. * Will be called when a dependency changes.
  4122. */
  4123. Watcher.prototype.update = function update () {
  4124. /* istanbul ignore else */
  4125. if (this.lazy) {
  4126. this.dirty = true;
  4127. } else if (this.sync) {
  4128. this.run();
  4129. } else {
  4130. queueWatcher(this);
  4131. }
  4132. };
  4133. /**
  4134. * Scheduler job interface.
  4135. * Will be called by the scheduler.
  4136. */
  4137. Watcher.prototype.run = function run () {
  4138. if (this.active) {
  4139. var value = this.get();
  4140. if (
  4141. value !== this.value ||
  4142. // Deep watchers and watchers on Object/Arrays should fire even
  4143. // when the value is the same, because the value may
  4144. // have mutated.
  4145. isObject(value) ||
  4146. this.deep
  4147. ) {
  4148. // set new value
  4149. var oldValue = this.value;
  4150. this.value = value;
  4151. if (this.user) {
  4152. try {
  4153. this.cb.call(this.vm, value, oldValue);
  4154. } catch (e) {
  4155. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  4156. }
  4157. } else {
  4158. this.cb.call(this.vm, value, oldValue);
  4159. }
  4160. }
  4161. }
  4162. };
  4163. /**
  4164. * Evaluate the value of the watcher.
  4165. * This only gets called for lazy watchers.
  4166. */
  4167. Watcher.prototype.evaluate = function evaluate () {
  4168. this.value = this.get();
  4169. this.dirty = false;
  4170. };
  4171. /**
  4172. * Depend on all deps collected by this watcher.
  4173. */
  4174. Watcher.prototype.depend = function depend () {
  4175. var i = this.deps.length;
  4176. while (i--) {
  4177. this.deps[i].depend();
  4178. }
  4179. };
  4180. /**
  4181. * Remove self from all dependencies' subscriber list.
  4182. */
  4183. Watcher.prototype.teardown = function teardown () {
  4184. if (this.active) {
  4185. // remove self from vm's watcher list
  4186. // this is a somewhat expensive operation so we skip it
  4187. // if the vm is being destroyed.
  4188. if (!this.vm._isBeingDestroyed) {
  4189. remove(this.vm._watchers, this);
  4190. }
  4191. var i = this.deps.length;
  4192. while (i--) {
  4193. this.deps[i].removeSub(this);
  4194. }
  4195. this.active = false;
  4196. }
  4197. };
  4198. /* */
  4199. var sharedPropertyDefinition = {
  4200. enumerable: true,
  4201. configurable: true,
  4202. get: noop,
  4203. set: noop
  4204. };
  4205. function proxy (target, sourceKey, key) {
  4206. sharedPropertyDefinition.get = function proxyGetter () {
  4207. return this[sourceKey][key]
  4208. };
  4209. sharedPropertyDefinition.set = function proxySetter (val) {
  4210. this[sourceKey][key] = val;
  4211. };
  4212. Object.defineProperty(target, key, sharedPropertyDefinition);
  4213. }
  4214. function initState (vm) {
  4215. vm._watchers = [];
  4216. var opts = vm.$options;
  4217. if (opts.props) { initProps(vm, opts.props); }
  4218. if (opts.methods) { initMethods(vm, opts.methods); }
  4219. if (opts.data) {
  4220. initData(vm);
  4221. } else {
  4222. observe(vm._data = {}, true /* asRootData */);
  4223. }
  4224. if (opts.computed) { initComputed(vm, opts.computed); }
  4225. if (opts.watch && opts.watch !== nativeWatch) {
  4226. initWatch(vm, opts.watch);
  4227. }
  4228. }
  4229. function initProps (vm, propsOptions) {
  4230. var propsData = vm.$options.propsData || {};
  4231. var props = vm._props = {};
  4232. // cache prop keys so that future props updates can iterate using Array
  4233. // instead of dynamic object key enumeration.
  4234. var keys = vm.$options._propKeys = [];
  4235. var isRoot = !vm.$parent;
  4236. // root instance props should be converted
  4237. if (!isRoot) {
  4238. toggleObserving(false);
  4239. }
  4240. var loop = function ( key ) {
  4241. keys.push(key);
  4242. var value = validateProp(key, propsOptions, propsData, vm);
  4243. /* istanbul ignore else */
  4244. if (process.env.NODE_ENV !== 'production') {
  4245. var hyphenatedKey = hyphenate(key);
  4246. if (isReservedAttribute(hyphenatedKey) ||
  4247. config.isReservedAttr(hyphenatedKey)) {
  4248. warn(
  4249. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  4250. vm
  4251. );
  4252. }
  4253. defineReactive$$1(props, key, value, function () {
  4254. if (!isRoot && !isUpdatingChildComponent) {
  4255. warn(
  4256. "Avoid mutating a prop directly since the value will be " +
  4257. "overwritten whenever the parent component re-renders. " +
  4258. "Instead, use a data or computed property based on the prop's " +
  4259. "value. Prop being mutated: \"" + key + "\"",
  4260. vm
  4261. );
  4262. }
  4263. });
  4264. } else {
  4265. defineReactive$$1(props, key, value);
  4266. }
  4267. // static props are already proxied on the component's prototype
  4268. // during Vue.extend(). We only need to proxy props defined at
  4269. // instantiation here.
  4270. if (!(key in vm)) {
  4271. proxy(vm, "_props", key);
  4272. }
  4273. };
  4274. for (var key in propsOptions) loop( key );
  4275. toggleObserving(true);
  4276. }
  4277. function initData (vm) {
  4278. var data = vm.$options.data;
  4279. data = vm._data = typeof data === 'function'
  4280. ? getData(data, vm)
  4281. : data || {};
  4282. if (!isPlainObject(data)) {
  4283. data = {};
  4284. process.env.NODE_ENV !== 'production' && warn(
  4285. 'data functions should return an object:\n' +
  4286. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  4287. vm
  4288. );
  4289. }
  4290. // proxy data on instance
  4291. var keys = Object.keys(data);
  4292. var props = vm.$options.props;
  4293. var methods = vm.$options.methods;
  4294. var i = keys.length;
  4295. while (i--) {
  4296. var key = keys[i];
  4297. if (process.env.NODE_ENV !== 'production') {
  4298. if (methods && hasOwn(methods, key)) {
  4299. warn(
  4300. ("Method \"" + key + "\" has already been defined as a data property."),
  4301. vm
  4302. );
  4303. }
  4304. }
  4305. if (props && hasOwn(props, key)) {
  4306. process.env.NODE_ENV !== 'production' && warn(
  4307. "The data property \"" + key + "\" is already declared as a prop. " +
  4308. "Use prop default value instead.",
  4309. vm
  4310. );
  4311. } else if (!isReserved(key)) {
  4312. proxy(vm, "_data", key);
  4313. }
  4314. }
  4315. // observe data
  4316. observe(data, true /* asRootData */);
  4317. }
  4318. function getData (data, vm) {
  4319. // #7573 disable dep collection when invoking data getters
  4320. pushTarget();
  4321. try {
  4322. return data.call(vm, vm)
  4323. } catch (e) {
  4324. handleError(e, vm, "data()");
  4325. return {}
  4326. } finally {
  4327. popTarget();
  4328. }
  4329. }
  4330. var computedWatcherOptions = { lazy: true };
  4331. function initComputed (vm, computed) {
  4332. // $flow-disable-line
  4333. var watchers = vm._computedWatchers = Object.create(null);
  4334. // computed properties are just getters during SSR
  4335. var isSSR = isServerRendering();
  4336. for (var key in computed) {
  4337. var userDef = computed[key];
  4338. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  4339. if (process.env.NODE_ENV !== 'production' && getter == null) {
  4340. warn(
  4341. ("Getter is missing for computed property \"" + key + "\"."),
  4342. vm
  4343. );
  4344. }
  4345. if (!isSSR) {
  4346. // create internal watcher for the computed property.
  4347. watchers[key] = new Watcher(
  4348. vm,
  4349. getter || noop,
  4350. noop,
  4351. computedWatcherOptions
  4352. );
  4353. }
  4354. // component-defined computed properties are already defined on the
  4355. // component prototype. We only need to define computed properties defined
  4356. // at instantiation here.
  4357. if (!(key in vm)) {
  4358. defineComputed(vm, key, userDef);
  4359. } else if (process.env.NODE_ENV !== 'production') {
  4360. if (key in vm.$data) {
  4361. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  4362. } else if (vm.$options.props && key in vm.$options.props) {
  4363. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  4364. }
  4365. }
  4366. }
  4367. }
  4368. function defineComputed (
  4369. target,
  4370. key,
  4371. userDef
  4372. ) {
  4373. var shouldCache = !isServerRendering();
  4374. if (typeof userDef === 'function') {
  4375. sharedPropertyDefinition.get = shouldCache
  4376. ? createComputedGetter(key)
  4377. : createGetterInvoker(userDef);
  4378. sharedPropertyDefinition.set = noop;
  4379. } else {
  4380. sharedPropertyDefinition.get = userDef.get
  4381. ? shouldCache && userDef.cache !== false
  4382. ? createComputedGetter(key)
  4383. : createGetterInvoker(userDef.get)
  4384. : noop;
  4385. sharedPropertyDefinition.set = userDef.set || noop;
  4386. }
  4387. if (process.env.NODE_ENV !== 'production' &&
  4388. sharedPropertyDefinition.set === noop) {
  4389. sharedPropertyDefinition.set = function () {
  4390. warn(
  4391. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  4392. this
  4393. );
  4394. };
  4395. }
  4396. Object.defineProperty(target, key, sharedPropertyDefinition);
  4397. }
  4398. function createComputedGetter (key) {
  4399. return function computedGetter () {
  4400. var watcher = this._computedWatchers && this._computedWatchers[key];
  4401. if (watcher) {
  4402. if (watcher.dirty) {
  4403. watcher.evaluate();
  4404. }
  4405. if (Dep.target) {
  4406. watcher.depend();
  4407. }
  4408. return watcher.value
  4409. }
  4410. }
  4411. }
  4412. function createGetterInvoker(fn) {
  4413. return function computedGetter () {
  4414. return fn.call(this, this)
  4415. }
  4416. }
  4417. function initMethods (vm, methods) {
  4418. var props = vm.$options.props;
  4419. for (var key in methods) {
  4420. if (process.env.NODE_ENV !== 'production') {
  4421. if (typeof methods[key] !== 'function') {
  4422. warn(
  4423. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  4424. "Did you reference the function correctly?",
  4425. vm
  4426. );
  4427. }
  4428. if (props && hasOwn(props, key)) {
  4429. warn(
  4430. ("Method \"" + key + "\" has already been defined as a prop."),
  4431. vm
  4432. );
  4433. }
  4434. if ((key in vm) && isReserved(key)) {
  4435. warn(
  4436. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  4437. "Avoid defining component methods that start with _ or $."
  4438. );
  4439. }
  4440. }
  4441. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  4442. }
  4443. }
  4444. function initWatch (vm, watch) {
  4445. for (var key in watch) {
  4446. var handler = watch[key];
  4447. if (Array.isArray(handler)) {
  4448. for (var i = 0; i < handler.length; i++) {
  4449. createWatcher(vm, key, handler[i]);
  4450. }
  4451. } else {
  4452. createWatcher(vm, key, handler);
  4453. }
  4454. }
  4455. }
  4456. function createWatcher (
  4457. vm,
  4458. expOrFn,
  4459. handler,
  4460. options
  4461. ) {
  4462. if (isPlainObject(handler)) {
  4463. options = handler;
  4464. handler = handler.handler;
  4465. }
  4466. if (typeof handler === 'string') {
  4467. handler = vm[handler];
  4468. }
  4469. return vm.$watch(expOrFn, handler, options)
  4470. }
  4471. function stateMixin (Vue) {
  4472. // flow somehow has problems with directly declared definition object
  4473. // when using Object.defineProperty, so we have to procedurally build up
  4474. // the object here.
  4475. var dataDef = {};
  4476. dataDef.get = function () { return this._data };
  4477. var propsDef = {};
  4478. propsDef.get = function () { return this._props };
  4479. if (process.env.NODE_ENV !== 'production') {
  4480. dataDef.set = function () {
  4481. warn(
  4482. 'Avoid replacing instance root $data. ' +
  4483. 'Use nested data properties instead.',
  4484. this
  4485. );
  4486. };
  4487. propsDef.set = function () {
  4488. warn("$props is readonly.", this);
  4489. };
  4490. }
  4491. Object.defineProperty(Vue.prototype, '$data', dataDef);
  4492. Object.defineProperty(Vue.prototype, '$props', propsDef);
  4493. Vue.prototype.$set = set;
  4494. Vue.prototype.$delete = del;
  4495. Vue.prototype.$watch = function (
  4496. expOrFn,
  4497. cb,
  4498. options
  4499. ) {
  4500. var vm = this;
  4501. if (isPlainObject(cb)) {
  4502. return createWatcher(vm, expOrFn, cb, options)
  4503. }
  4504. options = options || {};
  4505. options.user = true;
  4506. var watcher = new Watcher(vm, expOrFn, cb, options);
  4507. if (options.immediate) {
  4508. try {
  4509. cb.call(vm, watcher.value);
  4510. } catch (error) {
  4511. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  4512. }
  4513. }
  4514. return function unwatchFn () {
  4515. watcher.teardown();
  4516. }
  4517. };
  4518. }
  4519. /* */
  4520. var uid$3 = 0;
  4521. function initMixin (Vue) {
  4522. Vue.prototype._init = function (options) {
  4523. var vm = this;
  4524. // a uid
  4525. vm._uid = uid$3++;
  4526. var startTag, endTag;
  4527. /* istanbul ignore if */
  4528. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  4529. startTag = "vue-perf-start:" + (vm._uid);
  4530. endTag = "vue-perf-end:" + (vm._uid);
  4531. mark(startTag);
  4532. }
  4533. // a flag to avoid this being observed
  4534. vm._isVue = true;
  4535. // merge options
  4536. if (options && options._isComponent) {
  4537. // optimize internal component instantiation
  4538. // since dynamic options merging is pretty slow, and none of the
  4539. // internal component options needs special treatment.
  4540. initInternalComponent(vm, options);
  4541. } else {
  4542. vm.$options = mergeOptions(
  4543. resolveConstructorOptions(vm.constructor),
  4544. options || {},
  4545. vm
  4546. );
  4547. }
  4548. /* istanbul ignore else */
  4549. if (process.env.NODE_ENV !== 'production') {
  4550. initProxy(vm);
  4551. } else {
  4552. vm._renderProxy = vm;
  4553. }
  4554. // expose real self
  4555. vm._self = vm;
  4556. initLifecycle(vm);
  4557. initEvents(vm);
  4558. initRender(vm);
  4559. callHook(vm, 'beforeCreate');
  4560. initInjections(vm); // resolve injections before data/props
  4561. initState(vm);
  4562. initProvide(vm); // resolve provide after data/props
  4563. callHook(vm, 'created');
  4564. /* istanbul ignore if */
  4565. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  4566. vm._name = formatComponentName(vm, false);
  4567. mark(endTag);
  4568. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  4569. }
  4570. if (vm.$options.el) {
  4571. vm.$mount(vm.$options.el);
  4572. }
  4573. };
  4574. }
  4575. function initInternalComponent (vm, options) {
  4576. var opts = vm.$options = Object.create(vm.constructor.options);
  4577. // doing this because it's faster than dynamic enumeration.
  4578. var parentVnode = options._parentVnode;
  4579. opts.parent = options.parent;
  4580. opts._parentVnode = parentVnode;
  4581. var vnodeComponentOptions = parentVnode.componentOptions;
  4582. opts.propsData = vnodeComponentOptions.propsData;
  4583. opts._parentListeners = vnodeComponentOptions.listeners;
  4584. opts._renderChildren = vnodeComponentOptions.children;
  4585. opts._componentTag = vnodeComponentOptions.tag;
  4586. if (options.render) {
  4587. opts.render = options.render;
  4588. opts.staticRenderFns = options.staticRenderFns;
  4589. }
  4590. }
  4591. function resolveConstructorOptions (Ctor) {
  4592. var options = Ctor.options;
  4593. if (Ctor.super) {
  4594. var superOptions = resolveConstructorOptions(Ctor.super);
  4595. var cachedSuperOptions = Ctor.superOptions;
  4596. if (superOptions !== cachedSuperOptions) {
  4597. // super option changed,
  4598. // need to resolve new options.
  4599. Ctor.superOptions = superOptions;
  4600. // check if there are any late-modified/attached options (#4976)
  4601. var modifiedOptions = resolveModifiedOptions(Ctor);
  4602. // update base extend options
  4603. if (modifiedOptions) {
  4604. extend(Ctor.extendOptions, modifiedOptions);
  4605. }
  4606. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4607. if (options.name) {
  4608. options.components[options.name] = Ctor;
  4609. }
  4610. }
  4611. }
  4612. return options
  4613. }
  4614. function resolveModifiedOptions (Ctor) {
  4615. var modified;
  4616. var latest = Ctor.options;
  4617. var sealed = Ctor.sealedOptions;
  4618. for (var key in latest) {
  4619. if (latest[key] !== sealed[key]) {
  4620. if (!modified) { modified = {}; }
  4621. modified[key] = latest[key];
  4622. }
  4623. }
  4624. return modified
  4625. }
  4626. function Vue (options) {
  4627. if (process.env.NODE_ENV !== 'production' &&
  4628. !(this instanceof Vue)
  4629. ) {
  4630. warn('Vue is a constructor and should be called with the `new` keyword');
  4631. }
  4632. this._init(options);
  4633. }
  4634. initMixin(Vue);
  4635. stateMixin(Vue);
  4636. eventsMixin(Vue);
  4637. lifecycleMixin(Vue);
  4638. renderMixin(Vue);
  4639. /* */
  4640. function initUse (Vue) {
  4641. Vue.use = function (plugin) {
  4642. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  4643. if (installedPlugins.indexOf(plugin) > -1) {
  4644. return this
  4645. }
  4646. // additional parameters
  4647. var args = toArray(arguments, 1);
  4648. args.unshift(this);
  4649. if (typeof plugin.install === 'function') {
  4650. plugin.install.apply(plugin, args);
  4651. } else if (typeof plugin === 'function') {
  4652. plugin.apply(null, args);
  4653. }
  4654. installedPlugins.push(plugin);
  4655. return this
  4656. };
  4657. }
  4658. /* */
  4659. function initMixin$1 (Vue) {
  4660. Vue.mixin = function (mixin) {
  4661. this.options = mergeOptions(this.options, mixin);
  4662. return this
  4663. };
  4664. }
  4665. /* */
  4666. function initExtend (Vue) {
  4667. /**
  4668. * Each instance constructor, including Vue, has a unique
  4669. * cid. This enables us to create wrapped "child
  4670. * constructors" for prototypal inheritance and cache them.
  4671. */
  4672. Vue.cid = 0;
  4673. var cid = 1;
  4674. /**
  4675. * Class inheritance
  4676. */
  4677. Vue.extend = function (extendOptions) {
  4678. extendOptions = extendOptions || {};
  4679. var Super = this;
  4680. var SuperId = Super.cid;
  4681. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  4682. if (cachedCtors[SuperId]) {
  4683. return cachedCtors[SuperId]
  4684. }
  4685. var name = extendOptions.name || Super.options.name;
  4686. if (process.env.NODE_ENV !== 'production' && name) {
  4687. validateComponentName(name);
  4688. }
  4689. var Sub = function VueComponent (options) {
  4690. this._init(options);
  4691. };
  4692. Sub.prototype = Object.create(Super.prototype);
  4693. Sub.prototype.constructor = Sub;
  4694. Sub.cid = cid++;
  4695. Sub.options = mergeOptions(
  4696. Super.options,
  4697. extendOptions
  4698. );
  4699. Sub['super'] = Super;
  4700. // For props and computed properties, we define the proxy getters on
  4701. // the Vue instances at extension time, on the extended prototype. This
  4702. // avoids Object.defineProperty calls for each instance created.
  4703. if (Sub.options.props) {
  4704. initProps$1(Sub);
  4705. }
  4706. if (Sub.options.computed) {
  4707. initComputed$1(Sub);
  4708. }
  4709. // allow further extension/mixin/plugin usage
  4710. Sub.extend = Super.extend;
  4711. Sub.mixin = Super.mixin;
  4712. Sub.use = Super.use;
  4713. // create asset registers, so extended classes
  4714. // can have their private assets too.
  4715. ASSET_TYPES.forEach(function (type) {
  4716. Sub[type] = Super[type];
  4717. });
  4718. // enable recursive self-lookup
  4719. if (name) {
  4720. Sub.options.components[name] = Sub;
  4721. }
  4722. // keep a reference to the super options at extension time.
  4723. // later at instantiation we can check if Super's options have
  4724. // been updated.
  4725. Sub.superOptions = Super.options;
  4726. Sub.extendOptions = extendOptions;
  4727. Sub.sealedOptions = extend({}, Sub.options);
  4728. // cache constructor
  4729. cachedCtors[SuperId] = Sub;
  4730. return Sub
  4731. };
  4732. }
  4733. function initProps$1 (Comp) {
  4734. var props = Comp.options.props;
  4735. for (var key in props) {
  4736. proxy(Comp.prototype, "_props", key);
  4737. }
  4738. }
  4739. function initComputed$1 (Comp) {
  4740. var computed = Comp.options.computed;
  4741. for (var key in computed) {
  4742. defineComputed(Comp.prototype, key, computed[key]);
  4743. }
  4744. }
  4745. /* */
  4746. function initAssetRegisters (Vue) {
  4747. /**
  4748. * Create asset registration methods.
  4749. */
  4750. ASSET_TYPES.forEach(function (type) {
  4751. Vue[type] = function (
  4752. id,
  4753. definition
  4754. ) {
  4755. if (!definition) {
  4756. return this.options[type + 's'][id]
  4757. } else {
  4758. /* istanbul ignore if */
  4759. if (process.env.NODE_ENV !== 'production' && type === 'component') {
  4760. validateComponentName(id);
  4761. }
  4762. if (type === 'component' && isPlainObject(definition)) {
  4763. definition.name = definition.name || id;
  4764. definition = this.options._base.extend(definition);
  4765. }
  4766. if (type === 'directive' && typeof definition === 'function') {
  4767. definition = { bind: definition, update: definition };
  4768. }
  4769. this.options[type + 's'][id] = definition;
  4770. return definition
  4771. }
  4772. };
  4773. });
  4774. }
  4775. /* */
  4776. function getComponentName (opts) {
  4777. return opts && (opts.Ctor.options.name || opts.tag)
  4778. }
  4779. function matches (pattern, name) {
  4780. if (Array.isArray(pattern)) {
  4781. return pattern.indexOf(name) > -1
  4782. } else if (typeof pattern === 'string') {
  4783. return pattern.split(',').indexOf(name) > -1
  4784. } else if (isRegExp(pattern)) {
  4785. return pattern.test(name)
  4786. }
  4787. /* istanbul ignore next */
  4788. return false
  4789. }
  4790. function pruneCache (keepAliveInstance, filter) {
  4791. var cache = keepAliveInstance.cache;
  4792. var keys = keepAliveInstance.keys;
  4793. var _vnode = keepAliveInstance._vnode;
  4794. for (var key in cache) {
  4795. var cachedNode = cache[key];
  4796. if (cachedNode) {
  4797. var name = getComponentName(cachedNode.componentOptions);
  4798. if (name && !filter(name)) {
  4799. pruneCacheEntry(cache, key, keys, _vnode);
  4800. }
  4801. }
  4802. }
  4803. }
  4804. function pruneCacheEntry (
  4805. cache,
  4806. key,
  4807. keys,
  4808. current
  4809. ) {
  4810. var cached$$1 = cache[key];
  4811. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  4812. cached$$1.componentInstance.$destroy();
  4813. }
  4814. cache[key] = null;
  4815. remove(keys, key);
  4816. }
  4817. var patternTypes = [String, RegExp, Array];
  4818. var KeepAlive = {
  4819. name: 'keep-alive',
  4820. abstract: true,
  4821. props: {
  4822. include: patternTypes,
  4823. exclude: patternTypes,
  4824. max: [String, Number]
  4825. },
  4826. created: function created () {
  4827. this.cache = Object.create(null);
  4828. this.keys = [];
  4829. },
  4830. destroyed: function destroyed () {
  4831. for (var key in this.cache) {
  4832. pruneCacheEntry(this.cache, key, this.keys);
  4833. }
  4834. },
  4835. mounted: function mounted () {
  4836. var this$1 = this;
  4837. this.$watch('include', function (val) {
  4838. pruneCache(this$1, function (name) { return matches(val, name); });
  4839. });
  4840. this.$watch('exclude', function (val) {
  4841. pruneCache(this$1, function (name) { return !matches(val, name); });
  4842. });
  4843. },
  4844. render: function render () {
  4845. var slot = this.$slots.default;
  4846. var vnode = getFirstComponentChild(slot);
  4847. var componentOptions = vnode && vnode.componentOptions;
  4848. if (componentOptions) {
  4849. // check pattern
  4850. var name = getComponentName(componentOptions);
  4851. var ref = this;
  4852. var include = ref.include;
  4853. var exclude = ref.exclude;
  4854. if (
  4855. // not included
  4856. (include && (!name || !matches(include, name))) ||
  4857. // excluded
  4858. (exclude && name && matches(exclude, name))
  4859. ) {
  4860. return vnode
  4861. }
  4862. var ref$1 = this;
  4863. var cache = ref$1.cache;
  4864. var keys = ref$1.keys;
  4865. var key = vnode.key == null
  4866. // same constructor may get registered as different local components
  4867. // so cid alone is not enough (#3269)
  4868. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  4869. : vnode.key;
  4870. if (cache[key]) {
  4871. vnode.componentInstance = cache[key].componentInstance;
  4872. // make current key freshest
  4873. remove(keys, key);
  4874. keys.push(key);
  4875. } else {
  4876. cache[key] = vnode;
  4877. keys.push(key);
  4878. // prune oldest entry
  4879. if (this.max && keys.length > parseInt(this.max)) {
  4880. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  4881. }
  4882. }
  4883. vnode.data.keepAlive = true;
  4884. }
  4885. return vnode || (slot && slot[0])
  4886. }
  4887. };
  4888. var builtInComponents = {
  4889. KeepAlive: KeepAlive
  4890. };
  4891. /* */
  4892. function initGlobalAPI (Vue) {
  4893. // config
  4894. var configDef = {};
  4895. configDef.get = function () { return config; };
  4896. if (process.env.NODE_ENV !== 'production') {
  4897. configDef.set = function () {
  4898. warn(
  4899. 'Do not replace the Vue.config object, set individual fields instead.'
  4900. );
  4901. };
  4902. }
  4903. Object.defineProperty(Vue, 'config', configDef);
  4904. // exposed util methods.
  4905. // NOTE: these are not considered part of the public API - avoid relying on
  4906. // them unless you are aware of the risk.
  4907. Vue.util = {
  4908. warn: warn,
  4909. extend: extend,
  4910. mergeOptions: mergeOptions,
  4911. defineReactive: defineReactive$$1
  4912. };
  4913. Vue.set = set;
  4914. Vue.delete = del;
  4915. Vue.nextTick = nextTick;
  4916. // 2.6 explicit observable API
  4917. Vue.observable = function (obj) {
  4918. observe(obj);
  4919. return obj
  4920. };
  4921. Vue.options = Object.create(null);
  4922. ASSET_TYPES.forEach(function (type) {
  4923. Vue.options[type + 's'] = Object.create(null);
  4924. });
  4925. // this is used to identify the "base" constructor to extend all plain-object
  4926. // components with in Weex's multi-instance scenarios.
  4927. Vue.options._base = Vue;
  4928. extend(Vue.options.components, builtInComponents);
  4929. initUse(Vue);
  4930. initMixin$1(Vue);
  4931. initExtend(Vue);
  4932. initAssetRegisters(Vue);
  4933. }
  4934. initGlobalAPI(Vue);
  4935. Object.defineProperty(Vue.prototype, '$isServer', {
  4936. get: isServerRendering
  4937. });
  4938. Object.defineProperty(Vue.prototype, '$ssrContext', {
  4939. get: function get () {
  4940. /* istanbul ignore next */
  4941. return this.$vnode && this.$vnode.ssrContext
  4942. }
  4943. });
  4944. // expose FunctionalRenderContext for ssr runtime helper installation
  4945. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  4946. value: FunctionalRenderContext
  4947. });
  4948. Vue.version = '2.6.12';
  4949. /* */
  4950. // these are reserved for web because they are directly compiled away
  4951. // during template compilation
  4952. var isReservedAttr = makeMap('style,class');
  4953. // attributes that should be using props for binding
  4954. var acceptValue = makeMap('input,textarea,option,select,progress');
  4955. var mustUseProp = function (tag, type, attr) {
  4956. return (
  4957. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  4958. (attr === 'selected' && tag === 'option') ||
  4959. (attr === 'checked' && tag === 'input') ||
  4960. (attr === 'muted' && tag === 'video')
  4961. )
  4962. };
  4963. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  4964. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  4965. var convertEnumeratedValue = function (key, value) {
  4966. return isFalsyAttrValue(value) || value === 'false'
  4967. ? 'false'
  4968. // allow arbitrary string value for contenteditable
  4969. : key === 'contenteditable' && isValidContentEditableValue(value)
  4970. ? value
  4971. : 'true'
  4972. };
  4973. var isBooleanAttr = makeMap(
  4974. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  4975. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  4976. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  4977. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  4978. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  4979. 'truespeed,typemustmatch,visible'
  4980. );
  4981. var xlinkNS = 'http://www.w3.org/1999/xlink';
  4982. var isXlink = function (name) {
  4983. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  4984. };
  4985. var getXlinkProp = function (name) {
  4986. return isXlink(name) ? name.slice(6, name.length) : ''
  4987. };
  4988. var isFalsyAttrValue = function (val) {
  4989. return val == null || val === false
  4990. };
  4991. /* */
  4992. function genClassForVnode (vnode) {
  4993. var data = vnode.data;
  4994. var parentNode = vnode;
  4995. var childNode = vnode;
  4996. while (isDef(childNode.componentInstance)) {
  4997. childNode = childNode.componentInstance._vnode;
  4998. if (childNode && childNode.data) {
  4999. data = mergeClassData(childNode.data, data);
  5000. }
  5001. }
  5002. while (isDef(parentNode = parentNode.parent)) {
  5003. if (parentNode && parentNode.data) {
  5004. data = mergeClassData(data, parentNode.data);
  5005. }
  5006. }
  5007. return renderClass(data.staticClass, data.class)
  5008. }
  5009. function mergeClassData (child, parent) {
  5010. return {
  5011. staticClass: concat(child.staticClass, parent.staticClass),
  5012. class: isDef(child.class)
  5013. ? [child.class, parent.class]
  5014. : parent.class
  5015. }
  5016. }
  5017. function renderClass (
  5018. staticClass,
  5019. dynamicClass
  5020. ) {
  5021. if (isDef(staticClass) || isDef(dynamicClass)) {
  5022. return concat(staticClass, stringifyClass(dynamicClass))
  5023. }
  5024. /* istanbul ignore next */
  5025. return ''
  5026. }
  5027. function concat (a, b) {
  5028. return a ? b ? (a + ' ' + b) : a : (b || '')
  5029. }
  5030. function stringifyClass (value) {
  5031. if (Array.isArray(value)) {
  5032. return stringifyArray(value)
  5033. }
  5034. if (isObject(value)) {
  5035. return stringifyObject(value)
  5036. }
  5037. if (typeof value === 'string') {
  5038. return value
  5039. }
  5040. /* istanbul ignore next */
  5041. return ''
  5042. }
  5043. function stringifyArray (value) {
  5044. var res = '';
  5045. var stringified;
  5046. for (var i = 0, l = value.length; i < l; i++) {
  5047. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  5048. if (res) { res += ' '; }
  5049. res += stringified;
  5050. }
  5051. }
  5052. return res
  5053. }
  5054. function stringifyObject (value) {
  5055. var res = '';
  5056. for (var key in value) {
  5057. if (value[key]) {
  5058. if (res) { res += ' '; }
  5059. res += key;
  5060. }
  5061. }
  5062. return res
  5063. }
  5064. /* */
  5065. var namespaceMap = {
  5066. svg: 'http://www.w3.org/2000/svg',
  5067. math: 'http://www.w3.org/1998/Math/MathML'
  5068. };
  5069. var isHTMLTag = makeMap(
  5070. 'html,body,base,head,link,meta,style,title,' +
  5071. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  5072. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  5073. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  5074. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  5075. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  5076. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  5077. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  5078. 'output,progress,select,textarea,' +
  5079. 'details,dialog,menu,menuitem,summary,' +
  5080. 'content,element,shadow,template,blockquote,iframe,tfoot'
  5081. );
  5082. // this map is intentionally selective, only covering SVG elements that may
  5083. // contain child elements.
  5084. var isSVG = makeMap(
  5085. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  5086. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  5087. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  5088. true
  5089. );
  5090. var isPreTag = function (tag) { return tag === 'pre'; };
  5091. var isReservedTag = function (tag) {
  5092. return isHTMLTag(tag) || isSVG(tag)
  5093. };
  5094. function getTagNamespace (tag) {
  5095. if (isSVG(tag)) {
  5096. return 'svg'
  5097. }
  5098. // basic support for MathML
  5099. // note it doesn't support other MathML elements being component roots
  5100. if (tag === 'math') {
  5101. return 'math'
  5102. }
  5103. }
  5104. var unknownElementCache = Object.create(null);
  5105. function isUnknownElement (tag) {
  5106. /* istanbul ignore if */
  5107. if (!inBrowser) {
  5108. return true
  5109. }
  5110. if (isReservedTag(tag)) {
  5111. return false
  5112. }
  5113. tag = tag.toLowerCase();
  5114. /* istanbul ignore if */
  5115. if (unknownElementCache[tag] != null) {
  5116. return unknownElementCache[tag]
  5117. }
  5118. var el = document.createElement(tag);
  5119. if (tag.indexOf('-') > -1) {
  5120. // http://stackoverflow.com/a/28210364/1070244
  5121. return (unknownElementCache[tag] = (
  5122. el.constructor === window.HTMLUnknownElement ||
  5123. el.constructor === window.HTMLElement
  5124. ))
  5125. } else {
  5126. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  5127. }
  5128. }
  5129. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  5130. /* */
  5131. /**
  5132. * Query an element selector if it's not an element already.
  5133. */
  5134. function query (el) {
  5135. if (typeof el === 'string') {
  5136. var selected = document.querySelector(el);
  5137. if (!selected) {
  5138. process.env.NODE_ENV !== 'production' && warn(
  5139. 'Cannot find element: ' + el
  5140. );
  5141. return document.createElement('div')
  5142. }
  5143. return selected
  5144. } else {
  5145. return el
  5146. }
  5147. }
  5148. /* */
  5149. function createElement$1 (tagName, vnode) {
  5150. var elm = document.createElement(tagName);
  5151. if (tagName !== 'select') {
  5152. return elm
  5153. }
  5154. // false or null will remove the attribute but undefined will not
  5155. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  5156. elm.setAttribute('multiple', 'multiple');
  5157. }
  5158. return elm
  5159. }
  5160. function createElementNS (namespace, tagName) {
  5161. return document.createElementNS(namespaceMap[namespace], tagName)
  5162. }
  5163. function createTextNode (text) {
  5164. return document.createTextNode(text)
  5165. }
  5166. function createComment (text) {
  5167. return document.createComment(text)
  5168. }
  5169. function insertBefore (parentNode, newNode, referenceNode) {
  5170. parentNode.insertBefore(newNode, referenceNode);
  5171. }
  5172. function removeChild (node, child) {
  5173. node.removeChild(child);
  5174. }
  5175. function appendChild (node, child) {
  5176. node.appendChild(child);
  5177. }
  5178. function parentNode (node) {
  5179. return node.parentNode
  5180. }
  5181. function nextSibling (node) {
  5182. return node.nextSibling
  5183. }
  5184. function tagName (node) {
  5185. return node.tagName
  5186. }
  5187. function setTextContent (node, text) {
  5188. node.textContent = text;
  5189. }
  5190. function setStyleScope (node, scopeId) {
  5191. node.setAttribute(scopeId, '');
  5192. }
  5193. var nodeOps = /*#__PURE__*/Object.freeze({
  5194. createElement: createElement$1,
  5195. createElementNS: createElementNS,
  5196. createTextNode: createTextNode,
  5197. createComment: createComment,
  5198. insertBefore: insertBefore,
  5199. removeChild: removeChild,
  5200. appendChild: appendChild,
  5201. parentNode: parentNode,
  5202. nextSibling: nextSibling,
  5203. tagName: tagName,
  5204. setTextContent: setTextContent,
  5205. setStyleScope: setStyleScope
  5206. });
  5207. /* */
  5208. var ref = {
  5209. create: function create (_, vnode) {
  5210. registerRef(vnode);
  5211. },
  5212. update: function update (oldVnode, vnode) {
  5213. if (oldVnode.data.ref !== vnode.data.ref) {
  5214. registerRef(oldVnode, true);
  5215. registerRef(vnode);
  5216. }
  5217. },
  5218. destroy: function destroy (vnode) {
  5219. registerRef(vnode, true);
  5220. }
  5221. };
  5222. function registerRef (vnode, isRemoval) {
  5223. var key = vnode.data.ref;
  5224. if (!isDef(key)) { return }
  5225. var vm = vnode.context;
  5226. var ref = vnode.componentInstance || vnode.elm;
  5227. var refs = vm.$refs;
  5228. if (isRemoval) {
  5229. if (Array.isArray(refs[key])) {
  5230. remove(refs[key], ref);
  5231. } else if (refs[key] === ref) {
  5232. refs[key] = undefined;
  5233. }
  5234. } else {
  5235. if (vnode.data.refInFor) {
  5236. if (!Array.isArray(refs[key])) {
  5237. refs[key] = [ref];
  5238. } else if (refs[key].indexOf(ref) < 0) {
  5239. // $flow-disable-line
  5240. refs[key].push(ref);
  5241. }
  5242. } else {
  5243. refs[key] = ref;
  5244. }
  5245. }
  5246. }
  5247. /**
  5248. * Virtual DOM patching algorithm based on Snabbdom by
  5249. * Simon Friis Vindum (@paldepind)
  5250. * Licensed under the MIT License
  5251. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  5252. *
  5253. * modified by Evan You (@yyx990803)
  5254. *
  5255. * Not type-checking this because this file is perf-critical and the cost
  5256. * of making flow understand it is not worth it.
  5257. */
  5258. var emptyNode = new VNode('', {}, []);
  5259. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  5260. function sameVnode (a, b) {
  5261. return (
  5262. a.key === b.key && (
  5263. (
  5264. a.tag === b.tag &&
  5265. a.isComment === b.isComment &&
  5266. isDef(a.data) === isDef(b.data) &&
  5267. sameInputType(a, b)
  5268. ) || (
  5269. isTrue(a.isAsyncPlaceholder) &&
  5270. a.asyncFactory === b.asyncFactory &&
  5271. isUndef(b.asyncFactory.error)
  5272. )
  5273. )
  5274. )
  5275. }
  5276. function sameInputType (a, b) {
  5277. if (a.tag !== 'input') { return true }
  5278. var i;
  5279. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  5280. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  5281. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  5282. }
  5283. function createKeyToOldIdx (children, beginIdx, endIdx) {
  5284. var i, key;
  5285. var map = {};
  5286. for (i = beginIdx; i <= endIdx; ++i) {
  5287. key = children[i].key;
  5288. if (isDef(key)) { map[key] = i; }
  5289. }
  5290. return map
  5291. }
  5292. function createPatchFunction (backend) {
  5293. var i, j;
  5294. var cbs = {};
  5295. var modules = backend.modules;
  5296. var nodeOps = backend.nodeOps;
  5297. for (i = 0; i < hooks.length; ++i) {
  5298. cbs[hooks[i]] = [];
  5299. for (j = 0; j < modules.length; ++j) {
  5300. if (isDef(modules[j][hooks[i]])) {
  5301. cbs[hooks[i]].push(modules[j][hooks[i]]);
  5302. }
  5303. }
  5304. }
  5305. function emptyNodeAt (elm) {
  5306. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  5307. }
  5308. function createRmCb (childElm, listeners) {
  5309. function remove$$1 () {
  5310. if (--remove$$1.listeners === 0) {
  5311. removeNode(childElm);
  5312. }
  5313. }
  5314. remove$$1.listeners = listeners;
  5315. return remove$$1
  5316. }
  5317. function removeNode (el) {
  5318. var parent = nodeOps.parentNode(el);
  5319. // element may have already been removed due to v-html / v-text
  5320. if (isDef(parent)) {
  5321. nodeOps.removeChild(parent, el);
  5322. }
  5323. }
  5324. function isUnknownElement$$1 (vnode, inVPre) {
  5325. return (
  5326. !inVPre &&
  5327. !vnode.ns &&
  5328. !(
  5329. config.ignoredElements.length &&
  5330. config.ignoredElements.some(function (ignore) {
  5331. return isRegExp(ignore)
  5332. ? ignore.test(vnode.tag)
  5333. : ignore === vnode.tag
  5334. })
  5335. ) &&
  5336. config.isUnknownElement(vnode.tag)
  5337. )
  5338. }
  5339. var creatingElmInVPre = 0;
  5340. function createElm (
  5341. vnode,
  5342. insertedVnodeQueue,
  5343. parentElm,
  5344. refElm,
  5345. nested,
  5346. ownerArray,
  5347. index
  5348. ) {
  5349. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5350. // This vnode was used in a previous render!
  5351. // now it's used as a new node, overwriting its elm would cause
  5352. // potential patch errors down the road when it's used as an insertion
  5353. // reference node. Instead, we clone the node on-demand before creating
  5354. // associated DOM element for it.
  5355. vnode = ownerArray[index] = cloneVNode(vnode);
  5356. }
  5357. vnode.isRootInsert = !nested; // for transition enter check
  5358. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  5359. return
  5360. }
  5361. var data = vnode.data;
  5362. var children = vnode.children;
  5363. var tag = vnode.tag;
  5364. if (isDef(tag)) {
  5365. if (process.env.NODE_ENV !== 'production') {
  5366. if (data && data.pre) {
  5367. creatingElmInVPre++;
  5368. }
  5369. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  5370. warn(
  5371. 'Unknown custom element: <' + tag + '> - did you ' +
  5372. 'register the component correctly? For recursive components, ' +
  5373. 'make sure to provide the "name" option.',
  5374. vnode.context
  5375. );
  5376. }
  5377. }
  5378. vnode.elm = vnode.ns
  5379. ? nodeOps.createElementNS(vnode.ns, tag)
  5380. : nodeOps.createElement(tag, vnode);
  5381. setScope(vnode);
  5382. /* istanbul ignore if */
  5383. {
  5384. createChildren(vnode, children, insertedVnodeQueue);
  5385. if (isDef(data)) {
  5386. invokeCreateHooks(vnode, insertedVnodeQueue);
  5387. }
  5388. insert(parentElm, vnode.elm, refElm);
  5389. }
  5390. if (process.env.NODE_ENV !== 'production' && data && data.pre) {
  5391. creatingElmInVPre--;
  5392. }
  5393. } else if (isTrue(vnode.isComment)) {
  5394. vnode.elm = nodeOps.createComment(vnode.text);
  5395. insert(parentElm, vnode.elm, refElm);
  5396. } else {
  5397. vnode.elm = nodeOps.createTextNode(vnode.text);
  5398. insert(parentElm, vnode.elm, refElm);
  5399. }
  5400. }
  5401. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5402. var i = vnode.data;
  5403. if (isDef(i)) {
  5404. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  5405. if (isDef(i = i.hook) && isDef(i = i.init)) {
  5406. i(vnode, false /* hydrating */);
  5407. }
  5408. // after calling the init hook, if the vnode is a child component
  5409. // it should've created a child instance and mounted it. the child
  5410. // component also has set the placeholder vnode's elm.
  5411. // in that case we can just return the element and be done.
  5412. if (isDef(vnode.componentInstance)) {
  5413. initComponent(vnode, insertedVnodeQueue);
  5414. insert(parentElm, vnode.elm, refElm);
  5415. if (isTrue(isReactivated)) {
  5416. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  5417. }
  5418. return true
  5419. }
  5420. }
  5421. }
  5422. function initComponent (vnode, insertedVnodeQueue) {
  5423. if (isDef(vnode.data.pendingInsert)) {
  5424. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  5425. vnode.data.pendingInsert = null;
  5426. }
  5427. vnode.elm = vnode.componentInstance.$el;
  5428. if (isPatchable(vnode)) {
  5429. invokeCreateHooks(vnode, insertedVnodeQueue);
  5430. setScope(vnode);
  5431. } else {
  5432. // empty component root.
  5433. // skip all element-related modules except for ref (#3455)
  5434. registerRef(vnode);
  5435. // make sure to invoke the insert hook
  5436. insertedVnodeQueue.push(vnode);
  5437. }
  5438. }
  5439. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5440. var i;
  5441. // hack for #4339: a reactivated component with inner transition
  5442. // does not trigger because the inner node's created hooks are not called
  5443. // again. It's not ideal to involve module-specific logic in here but
  5444. // there doesn't seem to be a better way to do it.
  5445. var innerNode = vnode;
  5446. while (innerNode.componentInstance) {
  5447. innerNode = innerNode.componentInstance._vnode;
  5448. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  5449. for (i = 0; i < cbs.activate.length; ++i) {
  5450. cbs.activate[i](emptyNode, innerNode);
  5451. }
  5452. insertedVnodeQueue.push(innerNode);
  5453. break
  5454. }
  5455. }
  5456. // unlike a newly created component,
  5457. // a reactivated keep-alive component doesn't insert itself
  5458. insert(parentElm, vnode.elm, refElm);
  5459. }
  5460. function insert (parent, elm, ref$$1) {
  5461. if (isDef(parent)) {
  5462. if (isDef(ref$$1)) {
  5463. if (nodeOps.parentNode(ref$$1) === parent) {
  5464. nodeOps.insertBefore(parent, elm, ref$$1);
  5465. }
  5466. } else {
  5467. nodeOps.appendChild(parent, elm);
  5468. }
  5469. }
  5470. }
  5471. function createChildren (vnode, children, insertedVnodeQueue) {
  5472. if (Array.isArray(children)) {
  5473. if (process.env.NODE_ENV !== 'production') {
  5474. checkDuplicateKeys(children);
  5475. }
  5476. for (var i = 0; i < children.length; ++i) {
  5477. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  5478. }
  5479. } else if (isPrimitive(vnode.text)) {
  5480. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  5481. }
  5482. }
  5483. function isPatchable (vnode) {
  5484. while (vnode.componentInstance) {
  5485. vnode = vnode.componentInstance._vnode;
  5486. }
  5487. return isDef(vnode.tag)
  5488. }
  5489. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  5490. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5491. cbs.create[i$1](emptyNode, vnode);
  5492. }
  5493. i = vnode.data.hook; // Reuse variable
  5494. if (isDef(i)) {
  5495. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  5496. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  5497. }
  5498. }
  5499. // set scope id attribute for scoped CSS.
  5500. // this is implemented as a special case to avoid the overhead
  5501. // of going through the normal attribute patching process.
  5502. function setScope (vnode) {
  5503. var i;
  5504. if (isDef(i = vnode.fnScopeId)) {
  5505. nodeOps.setStyleScope(vnode.elm, i);
  5506. } else {
  5507. var ancestor = vnode;
  5508. while (ancestor) {
  5509. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  5510. nodeOps.setStyleScope(vnode.elm, i);
  5511. }
  5512. ancestor = ancestor.parent;
  5513. }
  5514. }
  5515. // for slot content they should also get the scopeId from the host instance.
  5516. if (isDef(i = activeInstance) &&
  5517. i !== vnode.context &&
  5518. i !== vnode.fnContext &&
  5519. isDef(i = i.$options._scopeId)
  5520. ) {
  5521. nodeOps.setStyleScope(vnode.elm, i);
  5522. }
  5523. }
  5524. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  5525. for (; startIdx <= endIdx; ++startIdx) {
  5526. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  5527. }
  5528. }
  5529. function invokeDestroyHook (vnode) {
  5530. var i, j;
  5531. var data = vnode.data;
  5532. if (isDef(data)) {
  5533. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  5534. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  5535. }
  5536. if (isDef(i = vnode.children)) {
  5537. for (j = 0; j < vnode.children.length; ++j) {
  5538. invokeDestroyHook(vnode.children[j]);
  5539. }
  5540. }
  5541. }
  5542. function removeVnodes (vnodes, startIdx, endIdx) {
  5543. for (; startIdx <= endIdx; ++startIdx) {
  5544. var ch = vnodes[startIdx];
  5545. if (isDef(ch)) {
  5546. if (isDef(ch.tag)) {
  5547. removeAndInvokeRemoveHook(ch);
  5548. invokeDestroyHook(ch);
  5549. } else { // Text node
  5550. removeNode(ch.elm);
  5551. }
  5552. }
  5553. }
  5554. }
  5555. function removeAndInvokeRemoveHook (vnode, rm) {
  5556. if (isDef(rm) || isDef(vnode.data)) {
  5557. var i;
  5558. var listeners = cbs.remove.length + 1;
  5559. if (isDef(rm)) {
  5560. // we have a recursively passed down rm callback
  5561. // increase the listeners count
  5562. rm.listeners += listeners;
  5563. } else {
  5564. // directly removing
  5565. rm = createRmCb(vnode.elm, listeners);
  5566. }
  5567. // recursively invoke hooks on child component root node
  5568. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  5569. removeAndInvokeRemoveHook(i, rm);
  5570. }
  5571. for (i = 0; i < cbs.remove.length; ++i) {
  5572. cbs.remove[i](vnode, rm);
  5573. }
  5574. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  5575. i(vnode, rm);
  5576. } else {
  5577. rm();
  5578. }
  5579. } else {
  5580. removeNode(vnode.elm);
  5581. }
  5582. }
  5583. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  5584. var oldStartIdx = 0;
  5585. var newStartIdx = 0;
  5586. var oldEndIdx = oldCh.length - 1;
  5587. var oldStartVnode = oldCh[0];
  5588. var oldEndVnode = oldCh[oldEndIdx];
  5589. var newEndIdx = newCh.length - 1;
  5590. var newStartVnode = newCh[0];
  5591. var newEndVnode = newCh[newEndIdx];
  5592. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  5593. // removeOnly is a special flag used only by <transition-group>
  5594. // to ensure removed elements stay in correct relative positions
  5595. // during leaving transitions
  5596. var canMove = !removeOnly;
  5597. if (process.env.NODE_ENV !== 'production') {
  5598. checkDuplicateKeys(newCh);
  5599. }
  5600. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  5601. if (isUndef(oldStartVnode)) {
  5602. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  5603. } else if (isUndef(oldEndVnode)) {
  5604. oldEndVnode = oldCh[--oldEndIdx];
  5605. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  5606. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5607. oldStartVnode = oldCh[++oldStartIdx];
  5608. newStartVnode = newCh[++newStartIdx];
  5609. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  5610. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5611. oldEndVnode = oldCh[--oldEndIdx];
  5612. newEndVnode = newCh[--newEndIdx];
  5613. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  5614. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5615. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  5616. oldStartVnode = oldCh[++oldStartIdx];
  5617. newEndVnode = newCh[--newEndIdx];
  5618. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  5619. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5620. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  5621. oldEndVnode = oldCh[--oldEndIdx];
  5622. newStartVnode = newCh[++newStartIdx];
  5623. } else {
  5624. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  5625. idxInOld = isDef(newStartVnode.key)
  5626. ? oldKeyToIdx[newStartVnode.key]
  5627. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  5628. if (isUndef(idxInOld)) { // New element
  5629. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5630. } else {
  5631. vnodeToMove = oldCh[idxInOld];
  5632. if (sameVnode(vnodeToMove, newStartVnode)) {
  5633. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5634. oldCh[idxInOld] = undefined;
  5635. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  5636. } else {
  5637. // same key but different element. treat as new element
  5638. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5639. }
  5640. }
  5641. newStartVnode = newCh[++newStartIdx];
  5642. }
  5643. }
  5644. if (oldStartIdx > oldEndIdx) {
  5645. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  5646. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  5647. } else if (newStartIdx > newEndIdx) {
  5648. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  5649. }
  5650. }
  5651. function checkDuplicateKeys (children) {
  5652. var seenKeys = {};
  5653. for (var i = 0; i < children.length; i++) {
  5654. var vnode = children[i];
  5655. var key = vnode.key;
  5656. if (isDef(key)) {
  5657. if (seenKeys[key]) {
  5658. warn(
  5659. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  5660. vnode.context
  5661. );
  5662. } else {
  5663. seenKeys[key] = true;
  5664. }
  5665. }
  5666. }
  5667. }
  5668. function findIdxInOld (node, oldCh, start, end) {
  5669. for (var i = start; i < end; i++) {
  5670. var c = oldCh[i];
  5671. if (isDef(c) && sameVnode(node, c)) { return i }
  5672. }
  5673. }
  5674. function patchVnode (
  5675. oldVnode,
  5676. vnode,
  5677. insertedVnodeQueue,
  5678. ownerArray,
  5679. index,
  5680. removeOnly
  5681. ) {
  5682. if (oldVnode === vnode) {
  5683. return
  5684. }
  5685. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5686. // clone reused vnode
  5687. vnode = ownerArray[index] = cloneVNode(vnode);
  5688. }
  5689. var elm = vnode.elm = oldVnode.elm;
  5690. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  5691. if (isDef(vnode.asyncFactory.resolved)) {
  5692. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  5693. } else {
  5694. vnode.isAsyncPlaceholder = true;
  5695. }
  5696. return
  5697. }
  5698. // reuse element for static trees.
  5699. // note we only do this if the vnode is cloned -
  5700. // if the new node is not cloned it means the render functions have been
  5701. // reset by the hot-reload-api and we need to do a proper re-render.
  5702. if (isTrue(vnode.isStatic) &&
  5703. isTrue(oldVnode.isStatic) &&
  5704. vnode.key === oldVnode.key &&
  5705. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  5706. ) {
  5707. vnode.componentInstance = oldVnode.componentInstance;
  5708. return
  5709. }
  5710. var i;
  5711. var data = vnode.data;
  5712. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  5713. i(oldVnode, vnode);
  5714. }
  5715. var oldCh = oldVnode.children;
  5716. var ch = vnode.children;
  5717. if (isDef(data) && isPatchable(vnode)) {
  5718. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  5719. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  5720. }
  5721. if (isUndef(vnode.text)) {
  5722. if (isDef(oldCh) && isDef(ch)) {
  5723. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  5724. } else if (isDef(ch)) {
  5725. if (process.env.NODE_ENV !== 'production') {
  5726. checkDuplicateKeys(ch);
  5727. }
  5728. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  5729. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  5730. } else if (isDef(oldCh)) {
  5731. removeVnodes(oldCh, 0, oldCh.length - 1);
  5732. } else if (isDef(oldVnode.text)) {
  5733. nodeOps.setTextContent(elm, '');
  5734. }
  5735. } else if (oldVnode.text !== vnode.text) {
  5736. nodeOps.setTextContent(elm, vnode.text);
  5737. }
  5738. if (isDef(data)) {
  5739. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  5740. }
  5741. }
  5742. function invokeInsertHook (vnode, queue, initial) {
  5743. // delay insert hooks for component root nodes, invoke them after the
  5744. // element is really inserted
  5745. if (isTrue(initial) && isDef(vnode.parent)) {
  5746. vnode.parent.data.pendingInsert = queue;
  5747. } else {
  5748. for (var i = 0; i < queue.length; ++i) {
  5749. queue[i].data.hook.insert(queue[i]);
  5750. }
  5751. }
  5752. }
  5753. var hydrationBailed = false;
  5754. // list of modules that can skip create hook during hydration because they
  5755. // are already rendered on the client or has no need for initialization
  5756. // Note: style is excluded because it relies on initial clone for future
  5757. // deep updates (#7063).
  5758. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  5759. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  5760. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  5761. var i;
  5762. var tag = vnode.tag;
  5763. var data = vnode.data;
  5764. var children = vnode.children;
  5765. inVPre = inVPre || (data && data.pre);
  5766. vnode.elm = elm;
  5767. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  5768. vnode.isAsyncPlaceholder = true;
  5769. return true
  5770. }
  5771. // assert node match
  5772. if (process.env.NODE_ENV !== 'production') {
  5773. if (!assertNodeMatch(elm, vnode, inVPre)) {
  5774. return false
  5775. }
  5776. }
  5777. if (isDef(data)) {
  5778. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  5779. if (isDef(i = vnode.componentInstance)) {
  5780. // child component. it should have hydrated its own tree.
  5781. initComponent(vnode, insertedVnodeQueue);
  5782. return true
  5783. }
  5784. }
  5785. if (isDef(tag)) {
  5786. if (isDef(children)) {
  5787. // empty element, allow client to pick up and populate children
  5788. if (!elm.hasChildNodes()) {
  5789. createChildren(vnode, children, insertedVnodeQueue);
  5790. } else {
  5791. // v-html and domProps: innerHTML
  5792. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  5793. if (i !== elm.innerHTML) {
  5794. /* istanbul ignore if */
  5795. if (process.env.NODE_ENV !== 'production' &&
  5796. typeof console !== 'undefined' &&
  5797. !hydrationBailed
  5798. ) {
  5799. hydrationBailed = true;
  5800. console.warn('Parent: ', elm);
  5801. console.warn('server innerHTML: ', i);
  5802. console.warn('client innerHTML: ', elm.innerHTML);
  5803. }
  5804. return false
  5805. }
  5806. } else {
  5807. // iterate and compare children lists
  5808. var childrenMatch = true;
  5809. var childNode = elm.firstChild;
  5810. for (var i$1 = 0; i$1 < children.length; i$1++) {
  5811. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  5812. childrenMatch = false;
  5813. break
  5814. }
  5815. childNode = childNode.nextSibling;
  5816. }
  5817. // if childNode is not null, it means the actual childNodes list is
  5818. // longer than the virtual children list.
  5819. if (!childrenMatch || childNode) {
  5820. /* istanbul ignore if */
  5821. if (process.env.NODE_ENV !== 'production' &&
  5822. typeof console !== 'undefined' &&
  5823. !hydrationBailed
  5824. ) {
  5825. hydrationBailed = true;
  5826. console.warn('Parent: ', elm);
  5827. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  5828. }
  5829. return false
  5830. }
  5831. }
  5832. }
  5833. }
  5834. if (isDef(data)) {
  5835. var fullInvoke = false;
  5836. for (var key in data) {
  5837. if (!isRenderedModule(key)) {
  5838. fullInvoke = true;
  5839. invokeCreateHooks(vnode, insertedVnodeQueue);
  5840. break
  5841. }
  5842. }
  5843. if (!fullInvoke && data['class']) {
  5844. // ensure collecting deps for deep class bindings for future updates
  5845. traverse(data['class']);
  5846. }
  5847. }
  5848. } else if (elm.data !== vnode.text) {
  5849. elm.data = vnode.text;
  5850. }
  5851. return true
  5852. }
  5853. function assertNodeMatch (node, vnode, inVPre) {
  5854. if (isDef(vnode.tag)) {
  5855. return vnode.tag.indexOf('vue-component') === 0 || (
  5856. !isUnknownElement$$1(vnode, inVPre) &&
  5857. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  5858. )
  5859. } else {
  5860. return node.nodeType === (vnode.isComment ? 8 : 3)
  5861. }
  5862. }
  5863. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  5864. if (isUndef(vnode)) {
  5865. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  5866. return
  5867. }
  5868. var isInitialPatch = false;
  5869. var insertedVnodeQueue = [];
  5870. if (isUndef(oldVnode)) {
  5871. // empty mount (likely as component), create new root element
  5872. isInitialPatch = true;
  5873. createElm(vnode, insertedVnodeQueue);
  5874. } else {
  5875. var isRealElement = isDef(oldVnode.nodeType);
  5876. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  5877. // patch existing root node
  5878. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  5879. } else {
  5880. if (isRealElement) {
  5881. // mounting to a real element
  5882. // check if this is server-rendered content and if we can perform
  5883. // a successful hydration.
  5884. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  5885. oldVnode.removeAttribute(SSR_ATTR);
  5886. hydrating = true;
  5887. }
  5888. if (isTrue(hydrating)) {
  5889. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  5890. invokeInsertHook(vnode, insertedVnodeQueue, true);
  5891. return oldVnode
  5892. } else if (process.env.NODE_ENV !== 'production') {
  5893. warn(
  5894. 'The client-side rendered virtual DOM tree is not matching ' +
  5895. 'server-rendered content. This is likely caused by incorrect ' +
  5896. 'HTML markup, for example nesting block-level elements inside ' +
  5897. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  5898. 'full client-side render.'
  5899. );
  5900. }
  5901. }
  5902. // either not server-rendered, or hydration failed.
  5903. // create an empty node and replace it
  5904. oldVnode = emptyNodeAt(oldVnode);
  5905. }
  5906. // replacing existing element
  5907. var oldElm = oldVnode.elm;
  5908. var parentElm = nodeOps.parentNode(oldElm);
  5909. // create new node
  5910. createElm(
  5911. vnode,
  5912. insertedVnodeQueue,
  5913. // extremely rare edge case: do not insert if old element is in a
  5914. // leaving transition. Only happens when combining transition +
  5915. // keep-alive + HOCs. (#4590)
  5916. oldElm._leaveCb ? null : parentElm,
  5917. nodeOps.nextSibling(oldElm)
  5918. );
  5919. // update parent placeholder node element, recursively
  5920. if (isDef(vnode.parent)) {
  5921. var ancestor = vnode.parent;
  5922. var patchable = isPatchable(vnode);
  5923. while (ancestor) {
  5924. for (var i = 0; i < cbs.destroy.length; ++i) {
  5925. cbs.destroy[i](ancestor);
  5926. }
  5927. ancestor.elm = vnode.elm;
  5928. if (patchable) {
  5929. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5930. cbs.create[i$1](emptyNode, ancestor);
  5931. }
  5932. // #6513
  5933. // invoke insert hooks that may have been merged by create hooks.
  5934. // e.g. for directives that uses the "inserted" hook.
  5935. var insert = ancestor.data.hook.insert;
  5936. if (insert.merged) {
  5937. // start at index 1 to avoid re-invoking component mounted hook
  5938. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  5939. insert.fns[i$2]();
  5940. }
  5941. }
  5942. } else {
  5943. registerRef(ancestor);
  5944. }
  5945. ancestor = ancestor.parent;
  5946. }
  5947. }
  5948. // destroy old node
  5949. if (isDef(parentElm)) {
  5950. removeVnodes([oldVnode], 0, 0);
  5951. } else if (isDef(oldVnode.tag)) {
  5952. invokeDestroyHook(oldVnode);
  5953. }
  5954. }
  5955. }
  5956. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  5957. return vnode.elm
  5958. }
  5959. }
  5960. /* */
  5961. var directives = {
  5962. create: updateDirectives,
  5963. update: updateDirectives,
  5964. destroy: function unbindDirectives (vnode) {
  5965. updateDirectives(vnode, emptyNode);
  5966. }
  5967. };
  5968. function updateDirectives (oldVnode, vnode) {
  5969. if (oldVnode.data.directives || vnode.data.directives) {
  5970. _update(oldVnode, vnode);
  5971. }
  5972. }
  5973. function _update (oldVnode, vnode) {
  5974. var isCreate = oldVnode === emptyNode;
  5975. var isDestroy = vnode === emptyNode;
  5976. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  5977. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  5978. var dirsWithInsert = [];
  5979. var dirsWithPostpatch = [];
  5980. var key, oldDir, dir;
  5981. for (key in newDirs) {
  5982. oldDir = oldDirs[key];
  5983. dir = newDirs[key];
  5984. if (!oldDir) {
  5985. // new directive, bind
  5986. callHook$1(dir, 'bind', vnode, oldVnode);
  5987. if (dir.def && dir.def.inserted) {
  5988. dirsWithInsert.push(dir);
  5989. }
  5990. } else {
  5991. // existing directive, update
  5992. dir.oldValue = oldDir.value;
  5993. dir.oldArg = oldDir.arg;
  5994. callHook$1(dir, 'update', vnode, oldVnode);
  5995. if (dir.def && dir.def.componentUpdated) {
  5996. dirsWithPostpatch.push(dir);
  5997. }
  5998. }
  5999. }
  6000. if (dirsWithInsert.length) {
  6001. var callInsert = function () {
  6002. for (var i = 0; i < dirsWithInsert.length; i++) {
  6003. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  6004. }
  6005. };
  6006. if (isCreate) {
  6007. mergeVNodeHook(vnode, 'insert', callInsert);
  6008. } else {
  6009. callInsert();
  6010. }
  6011. }
  6012. if (dirsWithPostpatch.length) {
  6013. mergeVNodeHook(vnode, 'postpatch', function () {
  6014. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  6015. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  6016. }
  6017. });
  6018. }
  6019. if (!isCreate) {
  6020. for (key in oldDirs) {
  6021. if (!newDirs[key]) {
  6022. // no longer present, unbind
  6023. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  6024. }
  6025. }
  6026. }
  6027. }
  6028. var emptyModifiers = Object.create(null);
  6029. function normalizeDirectives$1 (
  6030. dirs,
  6031. vm
  6032. ) {
  6033. var res = Object.create(null);
  6034. if (!dirs) {
  6035. // $flow-disable-line
  6036. return res
  6037. }
  6038. var i, dir;
  6039. for (i = 0; i < dirs.length; i++) {
  6040. dir = dirs[i];
  6041. if (!dir.modifiers) {
  6042. // $flow-disable-line
  6043. dir.modifiers = emptyModifiers;
  6044. }
  6045. res[getRawDirName(dir)] = dir;
  6046. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  6047. }
  6048. // $flow-disable-line
  6049. return res
  6050. }
  6051. function getRawDirName (dir) {
  6052. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  6053. }
  6054. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  6055. var fn = dir.def && dir.def[hook];
  6056. if (fn) {
  6057. try {
  6058. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  6059. } catch (e) {
  6060. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  6061. }
  6062. }
  6063. }
  6064. var baseModules = [
  6065. ref,
  6066. directives
  6067. ];
  6068. /* */
  6069. function updateAttrs (oldVnode, vnode) {
  6070. var opts = vnode.componentOptions;
  6071. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  6072. return
  6073. }
  6074. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  6075. return
  6076. }
  6077. var key, cur, old;
  6078. var elm = vnode.elm;
  6079. var oldAttrs = oldVnode.data.attrs || {};
  6080. var attrs = vnode.data.attrs || {};
  6081. // clone observed objects, as the user probably wants to mutate it
  6082. if (isDef(attrs.__ob__)) {
  6083. attrs = vnode.data.attrs = extend({}, attrs);
  6084. }
  6085. for (key in attrs) {
  6086. cur = attrs[key];
  6087. old = oldAttrs[key];
  6088. if (old !== cur) {
  6089. setAttr(elm, key, cur);
  6090. }
  6091. }
  6092. // #4391: in IE9, setting type can reset value for input[type=radio]
  6093. // #6666: IE/Edge forces progress value down to 1 before setting a max
  6094. /* istanbul ignore if */
  6095. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  6096. setAttr(elm, 'value', attrs.value);
  6097. }
  6098. for (key in oldAttrs) {
  6099. if (isUndef(attrs[key])) {
  6100. if (isXlink(key)) {
  6101. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6102. } else if (!isEnumeratedAttr(key)) {
  6103. elm.removeAttribute(key);
  6104. }
  6105. }
  6106. }
  6107. }
  6108. function setAttr (el, key, value) {
  6109. if (el.tagName.indexOf('-') > -1) {
  6110. baseSetAttr(el, key, value);
  6111. } else if (isBooleanAttr(key)) {
  6112. // set attribute for blank value
  6113. // e.g. <option disabled>Select one</option>
  6114. if (isFalsyAttrValue(value)) {
  6115. el.removeAttribute(key);
  6116. } else {
  6117. // technically allowfullscreen is a boolean attribute for <iframe>,
  6118. // but Flash expects a value of "true" when used on <embed> tag
  6119. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  6120. ? 'true'
  6121. : key;
  6122. el.setAttribute(key, value);
  6123. }
  6124. } else if (isEnumeratedAttr(key)) {
  6125. el.setAttribute(key, convertEnumeratedValue(key, value));
  6126. } else if (isXlink(key)) {
  6127. if (isFalsyAttrValue(value)) {
  6128. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6129. } else {
  6130. el.setAttributeNS(xlinkNS, key, value);
  6131. }
  6132. } else {
  6133. baseSetAttr(el, key, value);
  6134. }
  6135. }
  6136. function baseSetAttr (el, key, value) {
  6137. if (isFalsyAttrValue(value)) {
  6138. el.removeAttribute(key);
  6139. } else {
  6140. // #7138: IE10 & 11 fires input event when setting placeholder on
  6141. // <textarea>... block the first input event and remove the blocker
  6142. // immediately.
  6143. /* istanbul ignore if */
  6144. if (
  6145. isIE && !isIE9 &&
  6146. el.tagName === 'TEXTAREA' &&
  6147. key === 'placeholder' && value !== '' && !el.__ieph
  6148. ) {
  6149. var blocker = function (e) {
  6150. e.stopImmediatePropagation();
  6151. el.removeEventListener('input', blocker);
  6152. };
  6153. el.addEventListener('input', blocker);
  6154. // $flow-disable-line
  6155. el.__ieph = true; /* IE placeholder patched */
  6156. }
  6157. el.setAttribute(key, value);
  6158. }
  6159. }
  6160. var attrs = {
  6161. create: updateAttrs,
  6162. update: updateAttrs
  6163. };
  6164. /* */
  6165. function updateClass (oldVnode, vnode) {
  6166. var el = vnode.elm;
  6167. var data = vnode.data;
  6168. var oldData = oldVnode.data;
  6169. if (
  6170. isUndef(data.staticClass) &&
  6171. isUndef(data.class) && (
  6172. isUndef(oldData) || (
  6173. isUndef(oldData.staticClass) &&
  6174. isUndef(oldData.class)
  6175. )
  6176. )
  6177. ) {
  6178. return
  6179. }
  6180. var cls = genClassForVnode(vnode);
  6181. // handle transition classes
  6182. var transitionClass = el._transitionClasses;
  6183. if (isDef(transitionClass)) {
  6184. cls = concat(cls, stringifyClass(transitionClass));
  6185. }
  6186. // set the class
  6187. if (cls !== el._prevClass) {
  6188. el.setAttribute('class', cls);
  6189. el._prevClass = cls;
  6190. }
  6191. }
  6192. var klass = {
  6193. create: updateClass,
  6194. update: updateClass
  6195. };
  6196. /* */
  6197. var validDivisionCharRE = /[\w).+\-_$\]]/;
  6198. function parseFilters (exp) {
  6199. var inSingle = false;
  6200. var inDouble = false;
  6201. var inTemplateString = false;
  6202. var inRegex = false;
  6203. var curly = 0;
  6204. var square = 0;
  6205. var paren = 0;
  6206. var lastFilterIndex = 0;
  6207. var c, prev, i, expression, filters;
  6208. for (i = 0; i < exp.length; i++) {
  6209. prev = c;
  6210. c = exp.charCodeAt(i);
  6211. if (inSingle) {
  6212. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  6213. } else if (inDouble) {
  6214. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  6215. } else if (inTemplateString) {
  6216. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  6217. } else if (inRegex) {
  6218. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  6219. } else if (
  6220. c === 0x7C && // pipe
  6221. exp.charCodeAt(i + 1) !== 0x7C &&
  6222. exp.charCodeAt(i - 1) !== 0x7C &&
  6223. !curly && !square && !paren
  6224. ) {
  6225. if (expression === undefined) {
  6226. // first filter, end of expression
  6227. lastFilterIndex = i + 1;
  6228. expression = exp.slice(0, i).trim();
  6229. } else {
  6230. pushFilter();
  6231. }
  6232. } else {
  6233. switch (c) {
  6234. case 0x22: inDouble = true; break // "
  6235. case 0x27: inSingle = true; break // '
  6236. case 0x60: inTemplateString = true; break // `
  6237. case 0x28: paren++; break // (
  6238. case 0x29: paren--; break // )
  6239. case 0x5B: square++; break // [
  6240. case 0x5D: square--; break // ]
  6241. case 0x7B: curly++; break // {
  6242. case 0x7D: curly--; break // }
  6243. }
  6244. if (c === 0x2f) { // /
  6245. var j = i - 1;
  6246. var p = (void 0);
  6247. // find first non-whitespace prev char
  6248. for (; j >= 0; j--) {
  6249. p = exp.charAt(j);
  6250. if (p !== ' ') { break }
  6251. }
  6252. if (!p || !validDivisionCharRE.test(p)) {
  6253. inRegex = true;
  6254. }
  6255. }
  6256. }
  6257. }
  6258. if (expression === undefined) {
  6259. expression = exp.slice(0, i).trim();
  6260. } else if (lastFilterIndex !== 0) {
  6261. pushFilter();
  6262. }
  6263. function pushFilter () {
  6264. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  6265. lastFilterIndex = i + 1;
  6266. }
  6267. if (filters) {
  6268. for (i = 0; i < filters.length; i++) {
  6269. expression = wrapFilter(expression, filters[i]);
  6270. }
  6271. }
  6272. return expression
  6273. }
  6274. function wrapFilter (exp, filter) {
  6275. var i = filter.indexOf('(');
  6276. if (i < 0) {
  6277. // _f: resolveFilter
  6278. return ("_f(\"" + filter + "\")(" + exp + ")")
  6279. } else {
  6280. var name = filter.slice(0, i);
  6281. var args = filter.slice(i + 1);
  6282. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  6283. }
  6284. }
  6285. /* */
  6286. /* eslint-disable no-unused-vars */
  6287. function baseWarn (msg, range) {
  6288. console.error(("[Vue compiler]: " + msg));
  6289. }
  6290. /* eslint-enable no-unused-vars */
  6291. function pluckModuleFunction (
  6292. modules,
  6293. key
  6294. ) {
  6295. return modules
  6296. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  6297. : []
  6298. }
  6299. function addProp (el, name, value, range, dynamic) {
  6300. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  6301. el.plain = false;
  6302. }
  6303. function addAttr (el, name, value, range, dynamic) {
  6304. var attrs = dynamic
  6305. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  6306. : (el.attrs || (el.attrs = []));
  6307. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  6308. el.plain = false;
  6309. }
  6310. // add a raw attr (use this in preTransforms)
  6311. function addRawAttr (el, name, value, range) {
  6312. el.attrsMap[name] = value;
  6313. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  6314. }
  6315. function addDirective (
  6316. el,
  6317. name,
  6318. rawName,
  6319. value,
  6320. arg,
  6321. isDynamicArg,
  6322. modifiers,
  6323. range
  6324. ) {
  6325. (el.directives || (el.directives = [])).push(rangeSetItem({
  6326. name: name,
  6327. rawName: rawName,
  6328. value: value,
  6329. arg: arg,
  6330. isDynamicArg: isDynamicArg,
  6331. modifiers: modifiers
  6332. }, range));
  6333. el.plain = false;
  6334. }
  6335. function prependModifierMarker (symbol, name, dynamic) {
  6336. return dynamic
  6337. ? ("_p(" + name + ",\"" + symbol + "\")")
  6338. : symbol + name // mark the event as captured
  6339. }
  6340. function addHandler (
  6341. el,
  6342. name,
  6343. value,
  6344. modifiers,
  6345. important,
  6346. warn,
  6347. range,
  6348. dynamic
  6349. ) {
  6350. modifiers = modifiers || emptyObject;
  6351. // warn prevent and passive modifier
  6352. /* istanbul ignore if */
  6353. if (
  6354. process.env.NODE_ENV !== 'production' && warn &&
  6355. modifiers.prevent && modifiers.passive
  6356. ) {
  6357. warn(
  6358. 'passive and prevent can\'t be used together. ' +
  6359. 'Passive handler can\'t prevent default event.',
  6360. range
  6361. );
  6362. }
  6363. // normalize click.right and click.middle since they don't actually fire
  6364. // this is technically browser-specific, but at least for now browsers are
  6365. // the only target envs that have right/middle clicks.
  6366. if (modifiers.right) {
  6367. if (dynamic) {
  6368. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  6369. } else if (name === 'click') {
  6370. name = 'contextmenu';
  6371. delete modifiers.right;
  6372. }
  6373. } else if (modifiers.middle) {
  6374. if (dynamic) {
  6375. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  6376. } else if (name === 'click') {
  6377. name = 'mouseup';
  6378. }
  6379. }
  6380. // check capture modifier
  6381. if (modifiers.capture) {
  6382. delete modifiers.capture;
  6383. name = prependModifierMarker('!', name, dynamic);
  6384. }
  6385. if (modifiers.once) {
  6386. delete modifiers.once;
  6387. name = prependModifierMarker('~', name, dynamic);
  6388. }
  6389. /* istanbul ignore if */
  6390. if (modifiers.passive) {
  6391. delete modifiers.passive;
  6392. name = prependModifierMarker('&', name, dynamic);
  6393. }
  6394. var events;
  6395. if (modifiers.native) {
  6396. delete modifiers.native;
  6397. events = el.nativeEvents || (el.nativeEvents = {});
  6398. } else {
  6399. events = el.events || (el.events = {});
  6400. }
  6401. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  6402. if (modifiers !== emptyObject) {
  6403. newHandler.modifiers = modifiers;
  6404. }
  6405. var handlers = events[name];
  6406. /* istanbul ignore if */
  6407. if (Array.isArray(handlers)) {
  6408. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  6409. } else if (handlers) {
  6410. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  6411. } else {
  6412. events[name] = newHandler;
  6413. }
  6414. el.plain = false;
  6415. }
  6416. function getRawBindingAttr (
  6417. el,
  6418. name
  6419. ) {
  6420. return el.rawAttrsMap[':' + name] ||
  6421. el.rawAttrsMap['v-bind:' + name] ||
  6422. el.rawAttrsMap[name]
  6423. }
  6424. function getBindingAttr (
  6425. el,
  6426. name,
  6427. getStatic
  6428. ) {
  6429. var dynamicValue =
  6430. getAndRemoveAttr(el, ':' + name) ||
  6431. getAndRemoveAttr(el, 'v-bind:' + name);
  6432. if (dynamicValue != null) {
  6433. return parseFilters(dynamicValue)
  6434. } else if (getStatic !== false) {
  6435. var staticValue = getAndRemoveAttr(el, name);
  6436. if (staticValue != null) {
  6437. return JSON.stringify(staticValue)
  6438. }
  6439. }
  6440. }
  6441. // note: this only removes the attr from the Array (attrsList) so that it
  6442. // doesn't get processed by processAttrs.
  6443. // By default it does NOT remove it from the map (attrsMap) because the map is
  6444. // needed during codegen.
  6445. function getAndRemoveAttr (
  6446. el,
  6447. name,
  6448. removeFromMap
  6449. ) {
  6450. var val;
  6451. if ((val = el.attrsMap[name]) != null) {
  6452. var list = el.attrsList;
  6453. for (var i = 0, l = list.length; i < l; i++) {
  6454. if (list[i].name === name) {
  6455. list.splice(i, 1);
  6456. break
  6457. }
  6458. }
  6459. }
  6460. if (removeFromMap) {
  6461. delete el.attrsMap[name];
  6462. }
  6463. return val
  6464. }
  6465. function getAndRemoveAttrByRegex (
  6466. el,
  6467. name
  6468. ) {
  6469. var list = el.attrsList;
  6470. for (var i = 0, l = list.length; i < l; i++) {
  6471. var attr = list[i];
  6472. if (name.test(attr.name)) {
  6473. list.splice(i, 1);
  6474. return attr
  6475. }
  6476. }
  6477. }
  6478. function rangeSetItem (
  6479. item,
  6480. range
  6481. ) {
  6482. if (range) {
  6483. if (range.start != null) {
  6484. item.start = range.start;
  6485. }
  6486. if (range.end != null) {
  6487. item.end = range.end;
  6488. }
  6489. }
  6490. return item
  6491. }
  6492. /* */
  6493. /**
  6494. * Cross-platform code generation for component v-model
  6495. */
  6496. function genComponentModel (
  6497. el,
  6498. value,
  6499. modifiers
  6500. ) {
  6501. var ref = modifiers || {};
  6502. var number = ref.number;
  6503. var trim = ref.trim;
  6504. var baseValueExpression = '$$v';
  6505. var valueExpression = baseValueExpression;
  6506. if (trim) {
  6507. valueExpression =
  6508. "(typeof " + baseValueExpression + " === 'string'" +
  6509. "? " + baseValueExpression + ".trim()" +
  6510. ": " + baseValueExpression + ")";
  6511. }
  6512. if (number) {
  6513. valueExpression = "_n(" + valueExpression + ")";
  6514. }
  6515. var assignment = genAssignmentCode(value, valueExpression);
  6516. el.model = {
  6517. value: ("(" + value + ")"),
  6518. expression: JSON.stringify(value),
  6519. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  6520. };
  6521. }
  6522. /**
  6523. * Cross-platform codegen helper for generating v-model value assignment code.
  6524. */
  6525. function genAssignmentCode (
  6526. value,
  6527. assignment
  6528. ) {
  6529. var res = parseModel(value);
  6530. if (res.key === null) {
  6531. return (value + "=" + assignment)
  6532. } else {
  6533. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  6534. }
  6535. }
  6536. /**
  6537. * Parse a v-model expression into a base path and a final key segment.
  6538. * Handles both dot-path and possible square brackets.
  6539. *
  6540. * Possible cases:
  6541. *
  6542. * - test
  6543. * - test[key]
  6544. * - test[test1[key]]
  6545. * - test["a"][key]
  6546. * - xxx.test[a[a].test1[key]]
  6547. * - test.xxx.a["asa"][test1[key]]
  6548. *
  6549. */
  6550. var len, str, chr, index$1, expressionPos, expressionEndPos;
  6551. function parseModel (val) {
  6552. // Fix https://github.com/vuejs/vue/pull/7730
  6553. // allow v-model="obj.val " (trailing whitespace)
  6554. val = val.trim();
  6555. len = val.length;
  6556. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  6557. index$1 = val.lastIndexOf('.');
  6558. if (index$1 > -1) {
  6559. return {
  6560. exp: val.slice(0, index$1),
  6561. key: '"' + val.slice(index$1 + 1) + '"'
  6562. }
  6563. } else {
  6564. return {
  6565. exp: val,
  6566. key: null
  6567. }
  6568. }
  6569. }
  6570. str = val;
  6571. index$1 = expressionPos = expressionEndPos = 0;
  6572. while (!eof()) {
  6573. chr = next();
  6574. /* istanbul ignore if */
  6575. if (isStringStart(chr)) {
  6576. parseString(chr);
  6577. } else if (chr === 0x5B) {
  6578. parseBracket(chr);
  6579. }
  6580. }
  6581. return {
  6582. exp: val.slice(0, expressionPos),
  6583. key: val.slice(expressionPos + 1, expressionEndPos)
  6584. }
  6585. }
  6586. function next () {
  6587. return str.charCodeAt(++index$1)
  6588. }
  6589. function eof () {
  6590. return index$1 >= len
  6591. }
  6592. function isStringStart (chr) {
  6593. return chr === 0x22 || chr === 0x27
  6594. }
  6595. function parseBracket (chr) {
  6596. var inBracket = 1;
  6597. expressionPos = index$1;
  6598. while (!eof()) {
  6599. chr = next();
  6600. if (isStringStart(chr)) {
  6601. parseString(chr);
  6602. continue
  6603. }
  6604. if (chr === 0x5B) { inBracket++; }
  6605. if (chr === 0x5D) { inBracket--; }
  6606. if (inBracket === 0) {
  6607. expressionEndPos = index$1;
  6608. break
  6609. }
  6610. }
  6611. }
  6612. function parseString (chr) {
  6613. var stringQuote = chr;
  6614. while (!eof()) {
  6615. chr = next();
  6616. if (chr === stringQuote) {
  6617. break
  6618. }
  6619. }
  6620. }
  6621. /* */
  6622. var warn$1;
  6623. // in some cases, the event used has to be determined at runtime
  6624. // so we used some reserved tokens during compile.
  6625. var RANGE_TOKEN = '__r';
  6626. var CHECKBOX_RADIO_TOKEN = '__c';
  6627. function model (
  6628. el,
  6629. dir,
  6630. _warn
  6631. ) {
  6632. warn$1 = _warn;
  6633. var value = dir.value;
  6634. var modifiers = dir.modifiers;
  6635. var tag = el.tag;
  6636. var type = el.attrsMap.type;
  6637. if (process.env.NODE_ENV !== 'production') {
  6638. // inputs with type="file" are read only and setting the input's
  6639. // value will throw an error.
  6640. if (tag === 'input' && type === 'file') {
  6641. warn$1(
  6642. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  6643. "File inputs are read only. Use a v-on:change listener instead.",
  6644. el.rawAttrsMap['v-model']
  6645. );
  6646. }
  6647. }
  6648. if (el.component) {
  6649. genComponentModel(el, value, modifiers);
  6650. // component v-model doesn't need extra runtime
  6651. return false
  6652. } else if (tag === 'select') {
  6653. genSelect(el, value, modifiers);
  6654. } else if (tag === 'input' && type === 'checkbox') {
  6655. genCheckboxModel(el, value, modifiers);
  6656. } else if (tag === 'input' && type === 'radio') {
  6657. genRadioModel(el, value, modifiers);
  6658. } else if (tag === 'input' || tag === 'textarea') {
  6659. genDefaultModel(el, value, modifiers);
  6660. } else if (!config.isReservedTag(tag)) {
  6661. genComponentModel(el, value, modifiers);
  6662. // component v-model doesn't need extra runtime
  6663. return false
  6664. } else if (process.env.NODE_ENV !== 'production') {
  6665. warn$1(
  6666. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  6667. "v-model is not supported on this element type. " +
  6668. 'If you are working with contenteditable, it\'s recommended to ' +
  6669. 'wrap a library dedicated for that purpose inside a custom component.',
  6670. el.rawAttrsMap['v-model']
  6671. );
  6672. }
  6673. // ensure runtime directive metadata
  6674. return true
  6675. }
  6676. function genCheckboxModel (
  6677. el,
  6678. value,
  6679. modifiers
  6680. ) {
  6681. var number = modifiers && modifiers.number;
  6682. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6683. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  6684. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  6685. addProp(el, 'checked',
  6686. "Array.isArray(" + value + ")" +
  6687. "?_i(" + value + "," + valueBinding + ")>-1" + (
  6688. trueValueBinding === 'true'
  6689. ? (":(" + value + ")")
  6690. : (":_q(" + value + "," + trueValueBinding + ")")
  6691. )
  6692. );
  6693. addHandler(el, 'change',
  6694. "var $$a=" + value + "," +
  6695. '$$el=$event.target,' +
  6696. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  6697. 'if(Array.isArray($$a)){' +
  6698. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  6699. '$$i=_i($$a,$$v);' +
  6700. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  6701. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  6702. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  6703. null, true
  6704. );
  6705. }
  6706. function genRadioModel (
  6707. el,
  6708. value,
  6709. modifiers
  6710. ) {
  6711. var number = modifiers && modifiers.number;
  6712. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6713. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  6714. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  6715. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  6716. }
  6717. function genSelect (
  6718. el,
  6719. value,
  6720. modifiers
  6721. ) {
  6722. var number = modifiers && modifiers.number;
  6723. var selectedVal = "Array.prototype.filter" +
  6724. ".call($event.target.options,function(o){return o.selected})" +
  6725. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  6726. "return " + (number ? '_n(val)' : 'val') + "})";
  6727. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  6728. var code = "var $$selectedVal = " + selectedVal + ";";
  6729. code = code + " " + (genAssignmentCode(value, assignment));
  6730. addHandler(el, 'change', code, null, true);
  6731. }
  6732. function genDefaultModel (
  6733. el,
  6734. value,
  6735. modifiers
  6736. ) {
  6737. var type = el.attrsMap.type;
  6738. // warn if v-bind:value conflicts with v-model
  6739. // except for inputs with v-bind:type
  6740. if (process.env.NODE_ENV !== 'production') {
  6741. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  6742. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  6743. if (value$1 && !typeBinding) {
  6744. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  6745. warn$1(
  6746. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  6747. 'because the latter already expands to a value binding internally',
  6748. el.rawAttrsMap[binding]
  6749. );
  6750. }
  6751. }
  6752. var ref = modifiers || {};
  6753. var lazy = ref.lazy;
  6754. var number = ref.number;
  6755. var trim = ref.trim;
  6756. var needCompositionGuard = !lazy && type !== 'range';
  6757. var event = lazy
  6758. ? 'change'
  6759. : type === 'range'
  6760. ? RANGE_TOKEN
  6761. : 'input';
  6762. var valueExpression = '$event.target.value';
  6763. if (trim) {
  6764. valueExpression = "$event.target.value.trim()";
  6765. }
  6766. if (number) {
  6767. valueExpression = "_n(" + valueExpression + ")";
  6768. }
  6769. var code = genAssignmentCode(value, valueExpression);
  6770. if (needCompositionGuard) {
  6771. code = "if($event.target.composing)return;" + code;
  6772. }
  6773. addProp(el, 'value', ("(" + value + ")"));
  6774. addHandler(el, event, code, null, true);
  6775. if (trim || number) {
  6776. addHandler(el, 'blur', '$forceUpdate()');
  6777. }
  6778. }
  6779. /* */
  6780. // normalize v-model event tokens that can only be determined at runtime.
  6781. // it's important to place the event as the first in the array because
  6782. // the whole point is ensuring the v-model callback gets called before
  6783. // user-attached handlers.
  6784. function normalizeEvents (on) {
  6785. /* istanbul ignore if */
  6786. if (isDef(on[RANGE_TOKEN])) {
  6787. // IE input[type=range] only supports `change` event
  6788. var event = isIE ? 'change' : 'input';
  6789. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  6790. delete on[RANGE_TOKEN];
  6791. }
  6792. // This was originally intended to fix #4521 but no longer necessary
  6793. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  6794. /* istanbul ignore if */
  6795. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  6796. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  6797. delete on[CHECKBOX_RADIO_TOKEN];
  6798. }
  6799. }
  6800. var target$1;
  6801. function createOnceHandler$1 (event, handler, capture) {
  6802. var _target = target$1; // save current target element in closure
  6803. return function onceHandler () {
  6804. var res = handler.apply(null, arguments);
  6805. if (res !== null) {
  6806. remove$2(event, onceHandler, capture, _target);
  6807. }
  6808. }
  6809. }
  6810. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  6811. // implementation and does not fire microtasks in between event propagation, so
  6812. // safe to exclude.
  6813. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  6814. function add$1 (
  6815. name,
  6816. handler,
  6817. capture,
  6818. passive
  6819. ) {
  6820. // async edge case #6566: inner click event triggers patch, event handler
  6821. // attached to outer element during patch, and triggered again. This
  6822. // happens because browsers fire microtask ticks between event propagation.
  6823. // the solution is simple: we save the timestamp when a handler is attached,
  6824. // and the handler would only fire if the event passed to it was fired
  6825. // AFTER it was attached.
  6826. if (useMicrotaskFix) {
  6827. var attachedTimestamp = currentFlushTimestamp;
  6828. var original = handler;
  6829. handler = original._wrapper = function (e) {
  6830. if (
  6831. // no bubbling, should always fire.
  6832. // this is just a safety net in case event.timeStamp is unreliable in
  6833. // certain weird environments...
  6834. e.target === e.currentTarget ||
  6835. // event is fired after handler attachment
  6836. e.timeStamp >= attachedTimestamp ||
  6837. // bail for environments that have buggy event.timeStamp implementations
  6838. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  6839. // #9681 QtWebEngine event.timeStamp is negative value
  6840. e.timeStamp <= 0 ||
  6841. // #9448 bail if event is fired in another document in a multi-page
  6842. // electron/nw.js app, since event.timeStamp will be using a different
  6843. // starting reference
  6844. e.target.ownerDocument !== document
  6845. ) {
  6846. return original.apply(this, arguments)
  6847. }
  6848. };
  6849. }
  6850. target$1.addEventListener(
  6851. name,
  6852. handler,
  6853. supportsPassive
  6854. ? { capture: capture, passive: passive }
  6855. : capture
  6856. );
  6857. }
  6858. function remove$2 (
  6859. name,
  6860. handler,
  6861. capture,
  6862. _target
  6863. ) {
  6864. (_target || target$1).removeEventListener(
  6865. name,
  6866. handler._wrapper || handler,
  6867. capture
  6868. );
  6869. }
  6870. function updateDOMListeners (oldVnode, vnode) {
  6871. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  6872. return
  6873. }
  6874. var on = vnode.data.on || {};
  6875. var oldOn = oldVnode.data.on || {};
  6876. target$1 = vnode.elm;
  6877. normalizeEvents(on);
  6878. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  6879. target$1 = undefined;
  6880. }
  6881. var events = {
  6882. create: updateDOMListeners,
  6883. update: updateDOMListeners
  6884. };
  6885. /* */
  6886. var svgContainer;
  6887. function updateDOMProps (oldVnode, vnode) {
  6888. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  6889. return
  6890. }
  6891. var key, cur;
  6892. var elm = vnode.elm;
  6893. var oldProps = oldVnode.data.domProps || {};
  6894. var props = vnode.data.domProps || {};
  6895. // clone observed objects, as the user probably wants to mutate it
  6896. if (isDef(props.__ob__)) {
  6897. props = vnode.data.domProps = extend({}, props);
  6898. }
  6899. for (key in oldProps) {
  6900. if (!(key in props)) {
  6901. elm[key] = '';
  6902. }
  6903. }
  6904. for (key in props) {
  6905. cur = props[key];
  6906. // ignore children if the node has textContent or innerHTML,
  6907. // as these will throw away existing DOM nodes and cause removal errors
  6908. // on subsequent patches (#3360)
  6909. if (key === 'textContent' || key === 'innerHTML') {
  6910. if (vnode.children) { vnode.children.length = 0; }
  6911. if (cur === oldProps[key]) { continue }
  6912. // #6601 work around Chrome version <= 55 bug where single textNode
  6913. // replaced by innerHTML/textContent retains its parentNode property
  6914. if (elm.childNodes.length === 1) {
  6915. elm.removeChild(elm.childNodes[0]);
  6916. }
  6917. }
  6918. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  6919. // store value as _value as well since
  6920. // non-string values will be stringified
  6921. elm._value = cur;
  6922. // avoid resetting cursor position when value is the same
  6923. var strCur = isUndef(cur) ? '' : String(cur);
  6924. if (shouldUpdateValue(elm, strCur)) {
  6925. elm.value = strCur;
  6926. }
  6927. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  6928. // IE doesn't support innerHTML for SVG elements
  6929. svgContainer = svgContainer || document.createElement('div');
  6930. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  6931. var svg = svgContainer.firstChild;
  6932. while (elm.firstChild) {
  6933. elm.removeChild(elm.firstChild);
  6934. }
  6935. while (svg.firstChild) {
  6936. elm.appendChild(svg.firstChild);
  6937. }
  6938. } else if (
  6939. // skip the update if old and new VDOM state is the same.
  6940. // `value` is handled separately because the DOM value may be temporarily
  6941. // out of sync with VDOM state due to focus, composition and modifiers.
  6942. // This #4521 by skipping the unnecessary `checked` update.
  6943. cur !== oldProps[key]
  6944. ) {
  6945. // some property updates can throw
  6946. // e.g. `value` on <progress> w/ non-finite value
  6947. try {
  6948. elm[key] = cur;
  6949. } catch (e) {}
  6950. }
  6951. }
  6952. }
  6953. // check platforms/web/util/attrs.js acceptValue
  6954. function shouldUpdateValue (elm, checkVal) {
  6955. return (!elm.composing && (
  6956. elm.tagName === 'OPTION' ||
  6957. isNotInFocusAndDirty(elm, checkVal) ||
  6958. isDirtyWithModifiers(elm, checkVal)
  6959. ))
  6960. }
  6961. function isNotInFocusAndDirty (elm, checkVal) {
  6962. // return true when textbox (.number and .trim) loses focus and its value is
  6963. // not equal to the updated value
  6964. var notInFocus = true;
  6965. // #6157
  6966. // work around IE bug when accessing document.activeElement in an iframe
  6967. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  6968. return notInFocus && elm.value !== checkVal
  6969. }
  6970. function isDirtyWithModifiers (elm, newVal) {
  6971. var value = elm.value;
  6972. var modifiers = elm._vModifiers; // injected by v-model runtime
  6973. if (isDef(modifiers)) {
  6974. if (modifiers.number) {
  6975. return toNumber(value) !== toNumber(newVal)
  6976. }
  6977. if (modifiers.trim) {
  6978. return value.trim() !== newVal.trim()
  6979. }
  6980. }
  6981. return value !== newVal
  6982. }
  6983. var domProps = {
  6984. create: updateDOMProps,
  6985. update: updateDOMProps
  6986. };
  6987. /* */
  6988. var parseStyleText = cached(function (cssText) {
  6989. var res = {};
  6990. var listDelimiter = /;(?![^(]*\))/g;
  6991. var propertyDelimiter = /:(.+)/;
  6992. cssText.split(listDelimiter).forEach(function (item) {
  6993. if (item) {
  6994. var tmp = item.split(propertyDelimiter);
  6995. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6996. }
  6997. });
  6998. return res
  6999. });
  7000. // merge static and dynamic style data on the same vnode
  7001. function normalizeStyleData (data) {
  7002. var style = normalizeStyleBinding(data.style);
  7003. // static style is pre-processed into an object during compilation
  7004. // and is always a fresh object, so it's safe to merge into it
  7005. return data.staticStyle
  7006. ? extend(data.staticStyle, style)
  7007. : style
  7008. }
  7009. // normalize possible array / string values into Object
  7010. function normalizeStyleBinding (bindingStyle) {
  7011. if (Array.isArray(bindingStyle)) {
  7012. return toObject(bindingStyle)
  7013. }
  7014. if (typeof bindingStyle === 'string') {
  7015. return parseStyleText(bindingStyle)
  7016. }
  7017. return bindingStyle
  7018. }
  7019. /**
  7020. * parent component style should be after child's
  7021. * so that parent component's style could override it
  7022. */
  7023. function getStyle (vnode, checkChild) {
  7024. var res = {};
  7025. var styleData;
  7026. if (checkChild) {
  7027. var childNode = vnode;
  7028. while (childNode.componentInstance) {
  7029. childNode = childNode.componentInstance._vnode;
  7030. if (
  7031. childNode && childNode.data &&
  7032. (styleData = normalizeStyleData(childNode.data))
  7033. ) {
  7034. extend(res, styleData);
  7035. }
  7036. }
  7037. }
  7038. if ((styleData = normalizeStyleData(vnode.data))) {
  7039. extend(res, styleData);
  7040. }
  7041. var parentNode = vnode;
  7042. while ((parentNode = parentNode.parent)) {
  7043. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  7044. extend(res, styleData);
  7045. }
  7046. }
  7047. return res
  7048. }
  7049. /* */
  7050. var cssVarRE = /^--/;
  7051. var importantRE = /\s*!important$/;
  7052. var setProp = function (el, name, val) {
  7053. /* istanbul ignore if */
  7054. if (cssVarRE.test(name)) {
  7055. el.style.setProperty(name, val);
  7056. } else if (importantRE.test(val)) {
  7057. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  7058. } else {
  7059. var normalizedName = normalize(name);
  7060. if (Array.isArray(val)) {
  7061. // Support values array created by autoprefixer, e.g.
  7062. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  7063. // Set them one by one, and the browser will only set those it can recognize
  7064. for (var i = 0, len = val.length; i < len; i++) {
  7065. el.style[normalizedName] = val[i];
  7066. }
  7067. } else {
  7068. el.style[normalizedName] = val;
  7069. }
  7070. }
  7071. };
  7072. var vendorNames = ['Webkit', 'Moz', 'ms'];
  7073. var emptyStyle;
  7074. var normalize = cached(function (prop) {
  7075. emptyStyle = emptyStyle || document.createElement('div').style;
  7076. prop = camelize(prop);
  7077. if (prop !== 'filter' && (prop in emptyStyle)) {
  7078. return prop
  7079. }
  7080. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  7081. for (var i = 0; i < vendorNames.length; i++) {
  7082. var name = vendorNames[i] + capName;
  7083. if (name in emptyStyle) {
  7084. return name
  7085. }
  7086. }
  7087. });
  7088. function updateStyle (oldVnode, vnode) {
  7089. var data = vnode.data;
  7090. var oldData = oldVnode.data;
  7091. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  7092. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  7093. ) {
  7094. return
  7095. }
  7096. var cur, name;
  7097. var el = vnode.elm;
  7098. var oldStaticStyle = oldData.staticStyle;
  7099. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  7100. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  7101. var oldStyle = oldStaticStyle || oldStyleBinding;
  7102. var style = normalizeStyleBinding(vnode.data.style) || {};
  7103. // store normalized style under a different key for next diff
  7104. // make sure to clone it if it's reactive, since the user likely wants
  7105. // to mutate it.
  7106. vnode.data.normalizedStyle = isDef(style.__ob__)
  7107. ? extend({}, style)
  7108. : style;
  7109. var newStyle = getStyle(vnode, true);
  7110. for (name in oldStyle) {
  7111. if (isUndef(newStyle[name])) {
  7112. setProp(el, name, '');
  7113. }
  7114. }
  7115. for (name in newStyle) {
  7116. cur = newStyle[name];
  7117. if (cur !== oldStyle[name]) {
  7118. // ie9 setting to null has no effect, must use empty string
  7119. setProp(el, name, cur == null ? '' : cur);
  7120. }
  7121. }
  7122. }
  7123. var style = {
  7124. create: updateStyle,
  7125. update: updateStyle
  7126. };
  7127. /* */
  7128. var whitespaceRE = /\s+/;
  7129. /**
  7130. * Add class with compatibility for SVG since classList is not supported on
  7131. * SVG elements in IE
  7132. */
  7133. function addClass (el, cls) {
  7134. /* istanbul ignore if */
  7135. if (!cls || !(cls = cls.trim())) {
  7136. return
  7137. }
  7138. /* istanbul ignore else */
  7139. if (el.classList) {
  7140. if (cls.indexOf(' ') > -1) {
  7141. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  7142. } else {
  7143. el.classList.add(cls);
  7144. }
  7145. } else {
  7146. var cur = " " + (el.getAttribute('class') || '') + " ";
  7147. if (cur.indexOf(' ' + cls + ' ') < 0) {
  7148. el.setAttribute('class', (cur + cls).trim());
  7149. }
  7150. }
  7151. }
  7152. /**
  7153. * Remove class with compatibility for SVG since classList is not supported on
  7154. * SVG elements in IE
  7155. */
  7156. function removeClass (el, cls) {
  7157. /* istanbul ignore if */
  7158. if (!cls || !(cls = cls.trim())) {
  7159. return
  7160. }
  7161. /* istanbul ignore else */
  7162. if (el.classList) {
  7163. if (cls.indexOf(' ') > -1) {
  7164. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  7165. } else {
  7166. el.classList.remove(cls);
  7167. }
  7168. if (!el.classList.length) {
  7169. el.removeAttribute('class');
  7170. }
  7171. } else {
  7172. var cur = " " + (el.getAttribute('class') || '') + " ";
  7173. var tar = ' ' + cls + ' ';
  7174. while (cur.indexOf(tar) >= 0) {
  7175. cur = cur.replace(tar, ' ');
  7176. }
  7177. cur = cur.trim();
  7178. if (cur) {
  7179. el.setAttribute('class', cur);
  7180. } else {
  7181. el.removeAttribute('class');
  7182. }
  7183. }
  7184. }
  7185. /* */
  7186. function resolveTransition (def$$1) {
  7187. if (!def$$1) {
  7188. return
  7189. }
  7190. /* istanbul ignore else */
  7191. if (typeof def$$1 === 'object') {
  7192. var res = {};
  7193. if (def$$1.css !== false) {
  7194. extend(res, autoCssTransition(def$$1.name || 'v'));
  7195. }
  7196. extend(res, def$$1);
  7197. return res
  7198. } else if (typeof def$$1 === 'string') {
  7199. return autoCssTransition(def$$1)
  7200. }
  7201. }
  7202. var autoCssTransition = cached(function (name) {
  7203. return {
  7204. enterClass: (name + "-enter"),
  7205. enterToClass: (name + "-enter-to"),
  7206. enterActiveClass: (name + "-enter-active"),
  7207. leaveClass: (name + "-leave"),
  7208. leaveToClass: (name + "-leave-to"),
  7209. leaveActiveClass: (name + "-leave-active")
  7210. }
  7211. });
  7212. var hasTransition = inBrowser && !isIE9;
  7213. var TRANSITION = 'transition';
  7214. var ANIMATION = 'animation';
  7215. // Transition property/event sniffing
  7216. var transitionProp = 'transition';
  7217. var transitionEndEvent = 'transitionend';
  7218. var animationProp = 'animation';
  7219. var animationEndEvent = 'animationend';
  7220. if (hasTransition) {
  7221. /* istanbul ignore if */
  7222. if (window.ontransitionend === undefined &&
  7223. window.onwebkittransitionend !== undefined
  7224. ) {
  7225. transitionProp = 'WebkitTransition';
  7226. transitionEndEvent = 'webkitTransitionEnd';
  7227. }
  7228. if (window.onanimationend === undefined &&
  7229. window.onwebkitanimationend !== undefined
  7230. ) {
  7231. animationProp = 'WebkitAnimation';
  7232. animationEndEvent = 'webkitAnimationEnd';
  7233. }
  7234. }
  7235. // binding to window is necessary to make hot reload work in IE in strict mode
  7236. var raf = inBrowser
  7237. ? window.requestAnimationFrame
  7238. ? window.requestAnimationFrame.bind(window)
  7239. : setTimeout
  7240. : /* istanbul ignore next */ function (fn) { return fn(); };
  7241. function nextFrame (fn) {
  7242. raf(function () {
  7243. raf(fn);
  7244. });
  7245. }
  7246. function addTransitionClass (el, cls) {
  7247. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  7248. if (transitionClasses.indexOf(cls) < 0) {
  7249. transitionClasses.push(cls);
  7250. addClass(el, cls);
  7251. }
  7252. }
  7253. function removeTransitionClass (el, cls) {
  7254. if (el._transitionClasses) {
  7255. remove(el._transitionClasses, cls);
  7256. }
  7257. removeClass(el, cls);
  7258. }
  7259. function whenTransitionEnds (
  7260. el,
  7261. expectedType,
  7262. cb
  7263. ) {
  7264. var ref = getTransitionInfo(el, expectedType);
  7265. var type = ref.type;
  7266. var timeout = ref.timeout;
  7267. var propCount = ref.propCount;
  7268. if (!type) { return cb() }
  7269. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  7270. var ended = 0;
  7271. var end = function () {
  7272. el.removeEventListener(event, onEnd);
  7273. cb();
  7274. };
  7275. var onEnd = function (e) {
  7276. if (e.target === el) {
  7277. if (++ended >= propCount) {
  7278. end();
  7279. }
  7280. }
  7281. };
  7282. setTimeout(function () {
  7283. if (ended < propCount) {
  7284. end();
  7285. }
  7286. }, timeout + 1);
  7287. el.addEventListener(event, onEnd);
  7288. }
  7289. var transformRE = /\b(transform|all)(,|$)/;
  7290. function getTransitionInfo (el, expectedType) {
  7291. var styles = window.getComputedStyle(el);
  7292. // JSDOM may return undefined for transition properties
  7293. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  7294. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  7295. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  7296. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  7297. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  7298. var animationTimeout = getTimeout(animationDelays, animationDurations);
  7299. var type;
  7300. var timeout = 0;
  7301. var propCount = 0;
  7302. /* istanbul ignore if */
  7303. if (expectedType === TRANSITION) {
  7304. if (transitionTimeout > 0) {
  7305. type = TRANSITION;
  7306. timeout = transitionTimeout;
  7307. propCount = transitionDurations.length;
  7308. }
  7309. } else if (expectedType === ANIMATION) {
  7310. if (animationTimeout > 0) {
  7311. type = ANIMATION;
  7312. timeout = animationTimeout;
  7313. propCount = animationDurations.length;
  7314. }
  7315. } else {
  7316. timeout = Math.max(transitionTimeout, animationTimeout);
  7317. type = timeout > 0
  7318. ? transitionTimeout > animationTimeout
  7319. ? TRANSITION
  7320. : ANIMATION
  7321. : null;
  7322. propCount = type
  7323. ? type === TRANSITION
  7324. ? transitionDurations.length
  7325. : animationDurations.length
  7326. : 0;
  7327. }
  7328. var hasTransform =
  7329. type === TRANSITION &&
  7330. transformRE.test(styles[transitionProp + 'Property']);
  7331. return {
  7332. type: type,
  7333. timeout: timeout,
  7334. propCount: propCount,
  7335. hasTransform: hasTransform
  7336. }
  7337. }
  7338. function getTimeout (delays, durations) {
  7339. /* istanbul ignore next */
  7340. while (delays.length < durations.length) {
  7341. delays = delays.concat(delays);
  7342. }
  7343. return Math.max.apply(null, durations.map(function (d, i) {
  7344. return toMs(d) + toMs(delays[i])
  7345. }))
  7346. }
  7347. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  7348. // in a locale-dependent way, using a comma instead of a dot.
  7349. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  7350. // as a floor function) causing unexpected behaviors
  7351. function toMs (s) {
  7352. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  7353. }
  7354. /* */
  7355. function enter (vnode, toggleDisplay) {
  7356. var el = vnode.elm;
  7357. // call leave callback now
  7358. if (isDef(el._leaveCb)) {
  7359. el._leaveCb.cancelled = true;
  7360. el._leaveCb();
  7361. }
  7362. var data = resolveTransition(vnode.data.transition);
  7363. if (isUndef(data)) {
  7364. return
  7365. }
  7366. /* istanbul ignore if */
  7367. if (isDef(el._enterCb) || el.nodeType !== 1) {
  7368. return
  7369. }
  7370. var css = data.css;
  7371. var type = data.type;
  7372. var enterClass = data.enterClass;
  7373. var enterToClass = data.enterToClass;
  7374. var enterActiveClass = data.enterActiveClass;
  7375. var appearClass = data.appearClass;
  7376. var appearToClass = data.appearToClass;
  7377. var appearActiveClass = data.appearActiveClass;
  7378. var beforeEnter = data.beforeEnter;
  7379. var enter = data.enter;
  7380. var afterEnter = data.afterEnter;
  7381. var enterCancelled = data.enterCancelled;
  7382. var beforeAppear = data.beforeAppear;
  7383. var appear = data.appear;
  7384. var afterAppear = data.afterAppear;
  7385. var appearCancelled = data.appearCancelled;
  7386. var duration = data.duration;
  7387. // activeInstance will always be the <transition> component managing this
  7388. // transition. One edge case to check is when the <transition> is placed
  7389. // as the root node of a child component. In that case we need to check
  7390. // <transition>'s parent for appear check.
  7391. var context = activeInstance;
  7392. var transitionNode = activeInstance.$vnode;
  7393. while (transitionNode && transitionNode.parent) {
  7394. context = transitionNode.context;
  7395. transitionNode = transitionNode.parent;
  7396. }
  7397. var isAppear = !context._isMounted || !vnode.isRootInsert;
  7398. if (isAppear && !appear && appear !== '') {
  7399. return
  7400. }
  7401. var startClass = isAppear && appearClass
  7402. ? appearClass
  7403. : enterClass;
  7404. var activeClass = isAppear && appearActiveClass
  7405. ? appearActiveClass
  7406. : enterActiveClass;
  7407. var toClass = isAppear && appearToClass
  7408. ? appearToClass
  7409. : enterToClass;
  7410. var beforeEnterHook = isAppear
  7411. ? (beforeAppear || beforeEnter)
  7412. : beforeEnter;
  7413. var enterHook = isAppear
  7414. ? (typeof appear === 'function' ? appear : enter)
  7415. : enter;
  7416. var afterEnterHook = isAppear
  7417. ? (afterAppear || afterEnter)
  7418. : afterEnter;
  7419. var enterCancelledHook = isAppear
  7420. ? (appearCancelled || enterCancelled)
  7421. : enterCancelled;
  7422. var explicitEnterDuration = toNumber(
  7423. isObject(duration)
  7424. ? duration.enter
  7425. : duration
  7426. );
  7427. if (process.env.NODE_ENV !== 'production' && explicitEnterDuration != null) {
  7428. checkDuration(explicitEnterDuration, 'enter', vnode);
  7429. }
  7430. var expectsCSS = css !== false && !isIE9;
  7431. var userWantsControl = getHookArgumentsLength(enterHook);
  7432. var cb = el._enterCb = once(function () {
  7433. if (expectsCSS) {
  7434. removeTransitionClass(el, toClass);
  7435. removeTransitionClass(el, activeClass);
  7436. }
  7437. if (cb.cancelled) {
  7438. if (expectsCSS) {
  7439. removeTransitionClass(el, startClass);
  7440. }
  7441. enterCancelledHook && enterCancelledHook(el);
  7442. } else {
  7443. afterEnterHook && afterEnterHook(el);
  7444. }
  7445. el._enterCb = null;
  7446. });
  7447. if (!vnode.data.show) {
  7448. // remove pending leave element on enter by injecting an insert hook
  7449. mergeVNodeHook(vnode, 'insert', function () {
  7450. var parent = el.parentNode;
  7451. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  7452. if (pendingNode &&
  7453. pendingNode.tag === vnode.tag &&
  7454. pendingNode.elm._leaveCb
  7455. ) {
  7456. pendingNode.elm._leaveCb();
  7457. }
  7458. enterHook && enterHook(el, cb);
  7459. });
  7460. }
  7461. // start enter transition
  7462. beforeEnterHook && beforeEnterHook(el);
  7463. if (expectsCSS) {
  7464. addTransitionClass(el, startClass);
  7465. addTransitionClass(el, activeClass);
  7466. nextFrame(function () {
  7467. removeTransitionClass(el, startClass);
  7468. if (!cb.cancelled) {
  7469. addTransitionClass(el, toClass);
  7470. if (!userWantsControl) {
  7471. if (isValidDuration(explicitEnterDuration)) {
  7472. setTimeout(cb, explicitEnterDuration);
  7473. } else {
  7474. whenTransitionEnds(el, type, cb);
  7475. }
  7476. }
  7477. }
  7478. });
  7479. }
  7480. if (vnode.data.show) {
  7481. toggleDisplay && toggleDisplay();
  7482. enterHook && enterHook(el, cb);
  7483. }
  7484. if (!expectsCSS && !userWantsControl) {
  7485. cb();
  7486. }
  7487. }
  7488. function leave (vnode, rm) {
  7489. var el = vnode.elm;
  7490. // call enter callback now
  7491. if (isDef(el._enterCb)) {
  7492. el._enterCb.cancelled = true;
  7493. el._enterCb();
  7494. }
  7495. var data = resolveTransition(vnode.data.transition);
  7496. if (isUndef(data) || el.nodeType !== 1) {
  7497. return rm()
  7498. }
  7499. /* istanbul ignore if */
  7500. if (isDef(el._leaveCb)) {
  7501. return
  7502. }
  7503. var css = data.css;
  7504. var type = data.type;
  7505. var leaveClass = data.leaveClass;
  7506. var leaveToClass = data.leaveToClass;
  7507. var leaveActiveClass = data.leaveActiveClass;
  7508. var beforeLeave = data.beforeLeave;
  7509. var leave = data.leave;
  7510. var afterLeave = data.afterLeave;
  7511. var leaveCancelled = data.leaveCancelled;
  7512. var delayLeave = data.delayLeave;
  7513. var duration = data.duration;
  7514. var expectsCSS = css !== false && !isIE9;
  7515. var userWantsControl = getHookArgumentsLength(leave);
  7516. var explicitLeaveDuration = toNumber(
  7517. isObject(duration)
  7518. ? duration.leave
  7519. : duration
  7520. );
  7521. if (process.env.NODE_ENV !== 'production' && isDef(explicitLeaveDuration)) {
  7522. checkDuration(explicitLeaveDuration, 'leave', vnode);
  7523. }
  7524. var cb = el._leaveCb = once(function () {
  7525. if (el.parentNode && el.parentNode._pending) {
  7526. el.parentNode._pending[vnode.key] = null;
  7527. }
  7528. if (expectsCSS) {
  7529. removeTransitionClass(el, leaveToClass);
  7530. removeTransitionClass(el, leaveActiveClass);
  7531. }
  7532. if (cb.cancelled) {
  7533. if (expectsCSS) {
  7534. removeTransitionClass(el, leaveClass);
  7535. }
  7536. leaveCancelled && leaveCancelled(el);
  7537. } else {
  7538. rm();
  7539. afterLeave && afterLeave(el);
  7540. }
  7541. el._leaveCb = null;
  7542. });
  7543. if (delayLeave) {
  7544. delayLeave(performLeave);
  7545. } else {
  7546. performLeave();
  7547. }
  7548. function performLeave () {
  7549. // the delayed leave may have already been cancelled
  7550. if (cb.cancelled) {
  7551. return
  7552. }
  7553. // record leaving element
  7554. if (!vnode.data.show && el.parentNode) {
  7555. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  7556. }
  7557. beforeLeave && beforeLeave(el);
  7558. if (expectsCSS) {
  7559. addTransitionClass(el, leaveClass);
  7560. addTransitionClass(el, leaveActiveClass);
  7561. nextFrame(function () {
  7562. removeTransitionClass(el, leaveClass);
  7563. if (!cb.cancelled) {
  7564. addTransitionClass(el, leaveToClass);
  7565. if (!userWantsControl) {
  7566. if (isValidDuration(explicitLeaveDuration)) {
  7567. setTimeout(cb, explicitLeaveDuration);
  7568. } else {
  7569. whenTransitionEnds(el, type, cb);
  7570. }
  7571. }
  7572. }
  7573. });
  7574. }
  7575. leave && leave(el, cb);
  7576. if (!expectsCSS && !userWantsControl) {
  7577. cb();
  7578. }
  7579. }
  7580. }
  7581. // only used in dev mode
  7582. function checkDuration (val, name, vnode) {
  7583. if (typeof val !== 'number') {
  7584. warn(
  7585. "<transition> explicit " + name + " duration is not a valid number - " +
  7586. "got " + (JSON.stringify(val)) + ".",
  7587. vnode.context
  7588. );
  7589. } else if (isNaN(val)) {
  7590. warn(
  7591. "<transition> explicit " + name + " duration is NaN - " +
  7592. 'the duration expression might be incorrect.',
  7593. vnode.context
  7594. );
  7595. }
  7596. }
  7597. function isValidDuration (val) {
  7598. return typeof val === 'number' && !isNaN(val)
  7599. }
  7600. /**
  7601. * Normalize a transition hook's argument length. The hook may be:
  7602. * - a merged hook (invoker) with the original in .fns
  7603. * - a wrapped component method (check ._length)
  7604. * - a plain function (.length)
  7605. */
  7606. function getHookArgumentsLength (fn) {
  7607. if (isUndef(fn)) {
  7608. return false
  7609. }
  7610. var invokerFns = fn.fns;
  7611. if (isDef(invokerFns)) {
  7612. // invoker
  7613. return getHookArgumentsLength(
  7614. Array.isArray(invokerFns)
  7615. ? invokerFns[0]
  7616. : invokerFns
  7617. )
  7618. } else {
  7619. return (fn._length || fn.length) > 1
  7620. }
  7621. }
  7622. function _enter (_, vnode) {
  7623. if (vnode.data.show !== true) {
  7624. enter(vnode);
  7625. }
  7626. }
  7627. var transition = inBrowser ? {
  7628. create: _enter,
  7629. activate: _enter,
  7630. remove: function remove$$1 (vnode, rm) {
  7631. /* istanbul ignore else */
  7632. if (vnode.data.show !== true) {
  7633. leave(vnode, rm);
  7634. } else {
  7635. rm();
  7636. }
  7637. }
  7638. } : {};
  7639. var platformModules = [
  7640. attrs,
  7641. klass,
  7642. events,
  7643. domProps,
  7644. style,
  7645. transition
  7646. ];
  7647. /* */
  7648. // the directive module should be applied last, after all
  7649. // built-in modules have been applied.
  7650. var modules = platformModules.concat(baseModules);
  7651. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  7652. /**
  7653. * Not type checking this file because flow doesn't like attaching
  7654. * properties to Elements.
  7655. */
  7656. /* istanbul ignore if */
  7657. if (isIE9) {
  7658. // http://www.matts411.com/post/internet-explorer-9-oninput/
  7659. document.addEventListener('selectionchange', function () {
  7660. var el = document.activeElement;
  7661. if (el && el.vmodel) {
  7662. trigger(el, 'input');
  7663. }
  7664. });
  7665. }
  7666. var directive = {
  7667. inserted: function inserted (el, binding, vnode, oldVnode) {
  7668. if (vnode.tag === 'select') {
  7669. // #6903
  7670. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  7671. mergeVNodeHook(vnode, 'postpatch', function () {
  7672. directive.componentUpdated(el, binding, vnode);
  7673. });
  7674. } else {
  7675. setSelected(el, binding, vnode.context);
  7676. }
  7677. el._vOptions = [].map.call(el.options, getValue);
  7678. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  7679. el._vModifiers = binding.modifiers;
  7680. if (!binding.modifiers.lazy) {
  7681. el.addEventListener('compositionstart', onCompositionStart);
  7682. el.addEventListener('compositionend', onCompositionEnd);
  7683. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  7684. // switching focus before confirming composition choice
  7685. // this also fixes the issue where some browsers e.g. iOS Chrome
  7686. // fires "change" instead of "input" on autocomplete.
  7687. el.addEventListener('change', onCompositionEnd);
  7688. /* istanbul ignore if */
  7689. if (isIE9) {
  7690. el.vmodel = true;
  7691. }
  7692. }
  7693. }
  7694. },
  7695. componentUpdated: function componentUpdated (el, binding, vnode) {
  7696. if (vnode.tag === 'select') {
  7697. setSelected(el, binding, vnode.context);
  7698. // in case the options rendered by v-for have changed,
  7699. // it's possible that the value is out-of-sync with the rendered options.
  7700. // detect such cases and filter out values that no longer has a matching
  7701. // option in the DOM.
  7702. var prevOptions = el._vOptions;
  7703. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  7704. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  7705. // trigger change event if
  7706. // no matching option found for at least one value
  7707. var needReset = el.multiple
  7708. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  7709. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  7710. if (needReset) {
  7711. trigger(el, 'change');
  7712. }
  7713. }
  7714. }
  7715. }
  7716. };
  7717. function setSelected (el, binding, vm) {
  7718. actuallySetSelected(el, binding, vm);
  7719. /* istanbul ignore if */
  7720. if (isIE || isEdge) {
  7721. setTimeout(function () {
  7722. actuallySetSelected(el, binding, vm);
  7723. }, 0);
  7724. }
  7725. }
  7726. function actuallySetSelected (el, binding, vm) {
  7727. var value = binding.value;
  7728. var isMultiple = el.multiple;
  7729. if (isMultiple && !Array.isArray(value)) {
  7730. process.env.NODE_ENV !== 'production' && warn(
  7731. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  7732. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  7733. vm
  7734. );
  7735. return
  7736. }
  7737. var selected, option;
  7738. for (var i = 0, l = el.options.length; i < l; i++) {
  7739. option = el.options[i];
  7740. if (isMultiple) {
  7741. selected = looseIndexOf(value, getValue(option)) > -1;
  7742. if (option.selected !== selected) {
  7743. option.selected = selected;
  7744. }
  7745. } else {
  7746. if (looseEqual(getValue(option), value)) {
  7747. if (el.selectedIndex !== i) {
  7748. el.selectedIndex = i;
  7749. }
  7750. return
  7751. }
  7752. }
  7753. }
  7754. if (!isMultiple) {
  7755. el.selectedIndex = -1;
  7756. }
  7757. }
  7758. function hasNoMatchingOption (value, options) {
  7759. return options.every(function (o) { return !looseEqual(o, value); })
  7760. }
  7761. function getValue (option) {
  7762. return '_value' in option
  7763. ? option._value
  7764. : option.value
  7765. }
  7766. function onCompositionStart (e) {
  7767. e.target.composing = true;
  7768. }
  7769. function onCompositionEnd (e) {
  7770. // prevent triggering an input event for no reason
  7771. if (!e.target.composing) { return }
  7772. e.target.composing = false;
  7773. trigger(e.target, 'input');
  7774. }
  7775. function trigger (el, type) {
  7776. var e = document.createEvent('HTMLEvents');
  7777. e.initEvent(type, true, true);
  7778. el.dispatchEvent(e);
  7779. }
  7780. /* */
  7781. // recursively search for possible transition defined inside the component root
  7782. function locateNode (vnode) {
  7783. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  7784. ? locateNode(vnode.componentInstance._vnode)
  7785. : vnode
  7786. }
  7787. var show = {
  7788. bind: function bind (el, ref, vnode) {
  7789. var value = ref.value;
  7790. vnode = locateNode(vnode);
  7791. var transition$$1 = vnode.data && vnode.data.transition;
  7792. var originalDisplay = el.__vOriginalDisplay =
  7793. el.style.display === 'none' ? '' : el.style.display;
  7794. if (value && transition$$1) {
  7795. vnode.data.show = true;
  7796. enter(vnode, function () {
  7797. el.style.display = originalDisplay;
  7798. });
  7799. } else {
  7800. el.style.display = value ? originalDisplay : 'none';
  7801. }
  7802. },
  7803. update: function update (el, ref, vnode) {
  7804. var value = ref.value;
  7805. var oldValue = ref.oldValue;
  7806. /* istanbul ignore if */
  7807. if (!value === !oldValue) { return }
  7808. vnode = locateNode(vnode);
  7809. var transition$$1 = vnode.data && vnode.data.transition;
  7810. if (transition$$1) {
  7811. vnode.data.show = true;
  7812. if (value) {
  7813. enter(vnode, function () {
  7814. el.style.display = el.__vOriginalDisplay;
  7815. });
  7816. } else {
  7817. leave(vnode, function () {
  7818. el.style.display = 'none';
  7819. });
  7820. }
  7821. } else {
  7822. el.style.display = value ? el.__vOriginalDisplay : 'none';
  7823. }
  7824. },
  7825. unbind: function unbind (
  7826. el,
  7827. binding,
  7828. vnode,
  7829. oldVnode,
  7830. isDestroy
  7831. ) {
  7832. if (!isDestroy) {
  7833. el.style.display = el.__vOriginalDisplay;
  7834. }
  7835. }
  7836. };
  7837. var platformDirectives = {
  7838. model: directive,
  7839. show: show
  7840. };
  7841. /* */
  7842. var transitionProps = {
  7843. name: String,
  7844. appear: Boolean,
  7845. css: Boolean,
  7846. mode: String,
  7847. type: String,
  7848. enterClass: String,
  7849. leaveClass: String,
  7850. enterToClass: String,
  7851. leaveToClass: String,
  7852. enterActiveClass: String,
  7853. leaveActiveClass: String,
  7854. appearClass: String,
  7855. appearActiveClass: String,
  7856. appearToClass: String,
  7857. duration: [Number, String, Object]
  7858. };
  7859. // in case the child is also an abstract component, e.g. <keep-alive>
  7860. // we want to recursively retrieve the real component to be rendered
  7861. function getRealChild (vnode) {
  7862. var compOptions = vnode && vnode.componentOptions;
  7863. if (compOptions && compOptions.Ctor.options.abstract) {
  7864. return getRealChild(getFirstComponentChild(compOptions.children))
  7865. } else {
  7866. return vnode
  7867. }
  7868. }
  7869. function extractTransitionData (comp) {
  7870. var data = {};
  7871. var options = comp.$options;
  7872. // props
  7873. for (var key in options.propsData) {
  7874. data[key] = comp[key];
  7875. }
  7876. // events.
  7877. // extract listeners and pass them directly to the transition methods
  7878. var listeners = options._parentListeners;
  7879. for (var key$1 in listeners) {
  7880. data[camelize(key$1)] = listeners[key$1];
  7881. }
  7882. return data
  7883. }
  7884. function placeholder (h, rawChild) {
  7885. if (/\d-keep-alive$/.test(rawChild.tag)) {
  7886. return h('keep-alive', {
  7887. props: rawChild.componentOptions.propsData
  7888. })
  7889. }
  7890. }
  7891. function hasParentTransition (vnode) {
  7892. while ((vnode = vnode.parent)) {
  7893. if (vnode.data.transition) {
  7894. return true
  7895. }
  7896. }
  7897. }
  7898. function isSameChild (child, oldChild) {
  7899. return oldChild.key === child.key && oldChild.tag === child.tag
  7900. }
  7901. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  7902. var isVShowDirective = function (d) { return d.name === 'show'; };
  7903. var Transition = {
  7904. name: 'transition',
  7905. props: transitionProps,
  7906. abstract: true,
  7907. render: function render (h) {
  7908. var this$1 = this;
  7909. var children = this.$slots.default;
  7910. if (!children) {
  7911. return
  7912. }
  7913. // filter out text nodes (possible whitespaces)
  7914. children = children.filter(isNotTextNode);
  7915. /* istanbul ignore if */
  7916. if (!children.length) {
  7917. return
  7918. }
  7919. // warn multiple elements
  7920. if (process.env.NODE_ENV !== 'production' && children.length > 1) {
  7921. warn(
  7922. '<transition> can only be used on a single element. Use ' +
  7923. '<transition-group> for lists.',
  7924. this.$parent
  7925. );
  7926. }
  7927. var mode = this.mode;
  7928. // warn invalid mode
  7929. if (process.env.NODE_ENV !== 'production' &&
  7930. mode && mode !== 'in-out' && mode !== 'out-in'
  7931. ) {
  7932. warn(
  7933. 'invalid <transition> mode: ' + mode,
  7934. this.$parent
  7935. );
  7936. }
  7937. var rawChild = children[0];
  7938. // if this is a component root node and the component's
  7939. // parent container node also has transition, skip.
  7940. if (hasParentTransition(this.$vnode)) {
  7941. return rawChild
  7942. }
  7943. // apply transition data to child
  7944. // use getRealChild() to ignore abstract components e.g. keep-alive
  7945. var child = getRealChild(rawChild);
  7946. /* istanbul ignore if */
  7947. if (!child) {
  7948. return rawChild
  7949. }
  7950. if (this._leaving) {
  7951. return placeholder(h, rawChild)
  7952. }
  7953. // ensure a key that is unique to the vnode type and to this transition
  7954. // component instance. This key will be used to remove pending leaving nodes
  7955. // during entering.
  7956. var id = "__transition-" + (this._uid) + "-";
  7957. child.key = child.key == null
  7958. ? child.isComment
  7959. ? id + 'comment'
  7960. : id + child.tag
  7961. : isPrimitive(child.key)
  7962. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  7963. : child.key;
  7964. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  7965. var oldRawChild = this._vnode;
  7966. var oldChild = getRealChild(oldRawChild);
  7967. // mark v-show
  7968. // so that the transition module can hand over the control to the directive
  7969. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  7970. child.data.show = true;
  7971. }
  7972. if (
  7973. oldChild &&
  7974. oldChild.data &&
  7975. !isSameChild(child, oldChild) &&
  7976. !isAsyncPlaceholder(oldChild) &&
  7977. // #6687 component root is a comment node
  7978. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  7979. ) {
  7980. // replace old child transition data with fresh one
  7981. // important for dynamic transitions!
  7982. var oldData = oldChild.data.transition = extend({}, data);
  7983. // handle transition mode
  7984. if (mode === 'out-in') {
  7985. // return placeholder node and queue update when leave finishes
  7986. this._leaving = true;
  7987. mergeVNodeHook(oldData, 'afterLeave', function () {
  7988. this$1._leaving = false;
  7989. this$1.$forceUpdate();
  7990. });
  7991. return placeholder(h, rawChild)
  7992. } else if (mode === 'in-out') {
  7993. if (isAsyncPlaceholder(child)) {
  7994. return oldRawChild
  7995. }
  7996. var delayedLeave;
  7997. var performLeave = function () { delayedLeave(); };
  7998. mergeVNodeHook(data, 'afterEnter', performLeave);
  7999. mergeVNodeHook(data, 'enterCancelled', performLeave);
  8000. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  8001. }
  8002. }
  8003. return rawChild
  8004. }
  8005. };
  8006. /* */
  8007. var props = extend({
  8008. tag: String,
  8009. moveClass: String
  8010. }, transitionProps);
  8011. delete props.mode;
  8012. var TransitionGroup = {
  8013. props: props,
  8014. beforeMount: function beforeMount () {
  8015. var this$1 = this;
  8016. var update = this._update;
  8017. this._update = function (vnode, hydrating) {
  8018. var restoreActiveInstance = setActiveInstance(this$1);
  8019. // force removing pass
  8020. this$1.__patch__(
  8021. this$1._vnode,
  8022. this$1.kept,
  8023. false, // hydrating
  8024. true // removeOnly (!important, avoids unnecessary moves)
  8025. );
  8026. this$1._vnode = this$1.kept;
  8027. restoreActiveInstance();
  8028. update.call(this$1, vnode, hydrating);
  8029. };
  8030. },
  8031. render: function render (h) {
  8032. var tag = this.tag || this.$vnode.data.tag || 'span';
  8033. var map = Object.create(null);
  8034. var prevChildren = this.prevChildren = this.children;
  8035. var rawChildren = this.$slots.default || [];
  8036. var children = this.children = [];
  8037. var transitionData = extractTransitionData(this);
  8038. for (var i = 0; i < rawChildren.length; i++) {
  8039. var c = rawChildren[i];
  8040. if (c.tag) {
  8041. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  8042. children.push(c);
  8043. map[c.key] = c
  8044. ;(c.data || (c.data = {})).transition = transitionData;
  8045. } else if (process.env.NODE_ENV !== 'production') {
  8046. var opts = c.componentOptions;
  8047. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  8048. warn(("<transition-group> children must be keyed: <" + name + ">"));
  8049. }
  8050. }
  8051. }
  8052. if (prevChildren) {
  8053. var kept = [];
  8054. var removed = [];
  8055. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  8056. var c$1 = prevChildren[i$1];
  8057. c$1.data.transition = transitionData;
  8058. c$1.data.pos = c$1.elm.getBoundingClientRect();
  8059. if (map[c$1.key]) {
  8060. kept.push(c$1);
  8061. } else {
  8062. removed.push(c$1);
  8063. }
  8064. }
  8065. this.kept = h(tag, null, kept);
  8066. this.removed = removed;
  8067. }
  8068. return h(tag, null, children)
  8069. },
  8070. updated: function updated () {
  8071. var children = this.prevChildren;
  8072. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  8073. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  8074. return
  8075. }
  8076. // we divide the work into three loops to avoid mixing DOM reads and writes
  8077. // in each iteration - which helps prevent layout thrashing.
  8078. children.forEach(callPendingCbs);
  8079. children.forEach(recordPosition);
  8080. children.forEach(applyTranslation);
  8081. // force reflow to put everything in position
  8082. // assign to this to avoid being removed in tree-shaking
  8083. // $flow-disable-line
  8084. this._reflow = document.body.offsetHeight;
  8085. children.forEach(function (c) {
  8086. if (c.data.moved) {
  8087. var el = c.elm;
  8088. var s = el.style;
  8089. addTransitionClass(el, moveClass);
  8090. s.transform = s.WebkitTransform = s.transitionDuration = '';
  8091. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  8092. if (e && e.target !== el) {
  8093. return
  8094. }
  8095. if (!e || /transform$/.test(e.propertyName)) {
  8096. el.removeEventListener(transitionEndEvent, cb);
  8097. el._moveCb = null;
  8098. removeTransitionClass(el, moveClass);
  8099. }
  8100. });
  8101. }
  8102. });
  8103. },
  8104. methods: {
  8105. hasMove: function hasMove (el, moveClass) {
  8106. /* istanbul ignore if */
  8107. if (!hasTransition) {
  8108. return false
  8109. }
  8110. /* istanbul ignore if */
  8111. if (this._hasMove) {
  8112. return this._hasMove
  8113. }
  8114. // Detect whether an element with the move class applied has
  8115. // CSS transitions. Since the element may be inside an entering
  8116. // transition at this very moment, we make a clone of it and remove
  8117. // all other transition classes applied to ensure only the move class
  8118. // is applied.
  8119. var clone = el.cloneNode();
  8120. if (el._transitionClasses) {
  8121. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  8122. }
  8123. addClass(clone, moveClass);
  8124. clone.style.display = 'none';
  8125. this.$el.appendChild(clone);
  8126. var info = getTransitionInfo(clone);
  8127. this.$el.removeChild(clone);
  8128. return (this._hasMove = info.hasTransform)
  8129. }
  8130. }
  8131. };
  8132. function callPendingCbs (c) {
  8133. /* istanbul ignore if */
  8134. if (c.elm._moveCb) {
  8135. c.elm._moveCb();
  8136. }
  8137. /* istanbul ignore if */
  8138. if (c.elm._enterCb) {
  8139. c.elm._enterCb();
  8140. }
  8141. }
  8142. function recordPosition (c) {
  8143. c.data.newPos = c.elm.getBoundingClientRect();
  8144. }
  8145. function applyTranslation (c) {
  8146. var oldPos = c.data.pos;
  8147. var newPos = c.data.newPos;
  8148. var dx = oldPos.left - newPos.left;
  8149. var dy = oldPos.top - newPos.top;
  8150. if (dx || dy) {
  8151. c.data.moved = true;
  8152. var s = c.elm.style;
  8153. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  8154. s.transitionDuration = '0s';
  8155. }
  8156. }
  8157. var platformComponents = {
  8158. Transition: Transition,
  8159. TransitionGroup: TransitionGroup
  8160. };
  8161. /* */
  8162. // install platform specific utils
  8163. Vue.config.mustUseProp = mustUseProp;
  8164. Vue.config.isReservedTag = isReservedTag;
  8165. Vue.config.isReservedAttr = isReservedAttr;
  8166. Vue.config.getTagNamespace = getTagNamespace;
  8167. Vue.config.isUnknownElement = isUnknownElement;
  8168. // install platform runtime directives & components
  8169. extend(Vue.options.directives, platformDirectives);
  8170. extend(Vue.options.components, platformComponents);
  8171. // install platform patch function
  8172. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  8173. // public mount method
  8174. Vue.prototype.$mount = function (
  8175. el,
  8176. hydrating
  8177. ) {
  8178. el = el && inBrowser ? query(el) : undefined;
  8179. return mountComponent(this, el, hydrating)
  8180. };
  8181. // devtools global hook
  8182. /* istanbul ignore next */
  8183. if (inBrowser) {
  8184. setTimeout(function () {
  8185. if (config.devtools) {
  8186. if (devtools) {
  8187. devtools.emit('init', Vue);
  8188. } else if (
  8189. process.env.NODE_ENV !== 'production' &&
  8190. process.env.NODE_ENV !== 'test'
  8191. ) {
  8192. console[console.info ? 'info' : 'log'](
  8193. 'Download the Vue Devtools extension for a better development experience:\n' +
  8194. 'https://github.com/vuejs/vue-devtools'
  8195. );
  8196. }
  8197. }
  8198. if (process.env.NODE_ENV !== 'production' &&
  8199. process.env.NODE_ENV !== 'test' &&
  8200. config.productionTip !== false &&
  8201. typeof console !== 'undefined'
  8202. ) {
  8203. console[console.info ? 'info' : 'log'](
  8204. "You are running Vue in development mode.\n" +
  8205. "Make sure to turn on production mode when deploying for production.\n" +
  8206. "See more tips at https://vuejs.org/guide/deployment.html"
  8207. );
  8208. }
  8209. }, 0);
  8210. }
  8211. /* */
  8212. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  8213. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  8214. var buildRegex = cached(function (delimiters) {
  8215. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  8216. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  8217. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  8218. });
  8219. function parseText (
  8220. text,
  8221. delimiters
  8222. ) {
  8223. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  8224. if (!tagRE.test(text)) {
  8225. return
  8226. }
  8227. var tokens = [];
  8228. var rawTokens = [];
  8229. var lastIndex = tagRE.lastIndex = 0;
  8230. var match, index, tokenValue;
  8231. while ((match = tagRE.exec(text))) {
  8232. index = match.index;
  8233. // push text token
  8234. if (index > lastIndex) {
  8235. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  8236. tokens.push(JSON.stringify(tokenValue));
  8237. }
  8238. // tag token
  8239. var exp = parseFilters(match[1].trim());
  8240. tokens.push(("_s(" + exp + ")"));
  8241. rawTokens.push({ '@binding': exp });
  8242. lastIndex = index + match[0].length;
  8243. }
  8244. if (lastIndex < text.length) {
  8245. rawTokens.push(tokenValue = text.slice(lastIndex));
  8246. tokens.push(JSON.stringify(tokenValue));
  8247. }
  8248. return {
  8249. expression: tokens.join('+'),
  8250. tokens: rawTokens
  8251. }
  8252. }
  8253. /* */
  8254. function transformNode (el, options) {
  8255. var warn = options.warn || baseWarn;
  8256. var staticClass = getAndRemoveAttr(el, 'class');
  8257. if (process.env.NODE_ENV !== 'production' && staticClass) {
  8258. var res = parseText(staticClass, options.delimiters);
  8259. if (res) {
  8260. warn(
  8261. "class=\"" + staticClass + "\": " +
  8262. 'Interpolation inside attributes has been removed. ' +
  8263. 'Use v-bind or the colon shorthand instead. For example, ' +
  8264. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  8265. el.rawAttrsMap['class']
  8266. );
  8267. }
  8268. }
  8269. if (staticClass) {
  8270. el.staticClass = JSON.stringify(staticClass);
  8271. }
  8272. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  8273. if (classBinding) {
  8274. el.classBinding = classBinding;
  8275. }
  8276. }
  8277. function genData (el) {
  8278. var data = '';
  8279. if (el.staticClass) {
  8280. data += "staticClass:" + (el.staticClass) + ",";
  8281. }
  8282. if (el.classBinding) {
  8283. data += "class:" + (el.classBinding) + ",";
  8284. }
  8285. return data
  8286. }
  8287. var klass$1 = {
  8288. staticKeys: ['staticClass'],
  8289. transformNode: transformNode,
  8290. genData: genData
  8291. };
  8292. /* */
  8293. function transformNode$1 (el, options) {
  8294. var warn = options.warn || baseWarn;
  8295. var staticStyle = getAndRemoveAttr(el, 'style');
  8296. if (staticStyle) {
  8297. /* istanbul ignore if */
  8298. if (process.env.NODE_ENV !== 'production') {
  8299. var res = parseText(staticStyle, options.delimiters);
  8300. if (res) {
  8301. warn(
  8302. "style=\"" + staticStyle + "\": " +
  8303. 'Interpolation inside attributes has been removed. ' +
  8304. 'Use v-bind or the colon shorthand instead. For example, ' +
  8305. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  8306. el.rawAttrsMap['style']
  8307. );
  8308. }
  8309. }
  8310. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  8311. }
  8312. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  8313. if (styleBinding) {
  8314. el.styleBinding = styleBinding;
  8315. }
  8316. }
  8317. function genData$1 (el) {
  8318. var data = '';
  8319. if (el.staticStyle) {
  8320. data += "staticStyle:" + (el.staticStyle) + ",";
  8321. }
  8322. if (el.styleBinding) {
  8323. data += "style:(" + (el.styleBinding) + "),";
  8324. }
  8325. return data
  8326. }
  8327. var style$1 = {
  8328. staticKeys: ['staticStyle'],
  8329. transformNode: transformNode$1,
  8330. genData: genData$1
  8331. };
  8332. /* */
  8333. var decoder;
  8334. var he = {
  8335. decode: function decode (html) {
  8336. decoder = decoder || document.createElement('div');
  8337. decoder.innerHTML = html;
  8338. return decoder.textContent
  8339. }
  8340. };
  8341. /* */
  8342. var isUnaryTag = makeMap(
  8343. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  8344. 'link,meta,param,source,track,wbr'
  8345. );
  8346. // Elements that you can, intentionally, leave open
  8347. // (and which close themselves)
  8348. var canBeLeftOpenTag = makeMap(
  8349. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  8350. );
  8351. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  8352. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  8353. var isNonPhrasingTag = makeMap(
  8354. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  8355. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  8356. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  8357. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  8358. 'title,tr,track'
  8359. );
  8360. /**
  8361. * Not type-checking this file because it's mostly vendor code.
  8362. */
  8363. // Regular Expressions for parsing tags and attributes
  8364. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  8365. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  8366. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  8367. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  8368. var startTagOpen = new RegExp(("^<" + qnameCapture));
  8369. var startTagClose = /^\s*(\/?)>/;
  8370. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  8371. var doctype = /^<!DOCTYPE [^>]+>/i;
  8372. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  8373. var comment = /^<!\--/;
  8374. var conditionalComment = /^<!\[/;
  8375. // Special Elements (can contain anything)
  8376. var isPlainTextElement = makeMap('script,style,textarea', true);
  8377. var reCache = {};
  8378. var decodingMap = {
  8379. '&lt;': '<',
  8380. '&gt;': '>',
  8381. '&quot;': '"',
  8382. '&amp;': '&',
  8383. '&#10;': '\n',
  8384. '&#9;': '\t',
  8385. '&#39;': "'"
  8386. };
  8387. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  8388. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  8389. // #5992
  8390. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  8391. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  8392. function decodeAttr (value, shouldDecodeNewlines) {
  8393. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  8394. return value.replace(re, function (match) { return decodingMap[match]; })
  8395. }
  8396. function parseHTML (html, options) {
  8397. var stack = [];
  8398. var expectHTML = options.expectHTML;
  8399. var isUnaryTag$$1 = options.isUnaryTag || no;
  8400. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  8401. var index = 0;
  8402. var last, lastTag;
  8403. while (html) {
  8404. last = html;
  8405. // Make sure we're not in a plaintext content element like script/style
  8406. if (!lastTag || !isPlainTextElement(lastTag)) {
  8407. var textEnd = html.indexOf('<');
  8408. if (textEnd === 0) {
  8409. // Comment:
  8410. if (comment.test(html)) {
  8411. var commentEnd = html.indexOf('-->');
  8412. if (commentEnd >= 0) {
  8413. if (options.shouldKeepComment) {
  8414. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  8415. }
  8416. advance(commentEnd + 3);
  8417. continue
  8418. }
  8419. }
  8420. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  8421. if (conditionalComment.test(html)) {
  8422. var conditionalEnd = html.indexOf(']>');
  8423. if (conditionalEnd >= 0) {
  8424. advance(conditionalEnd + 2);
  8425. continue
  8426. }
  8427. }
  8428. // Doctype:
  8429. var doctypeMatch = html.match(doctype);
  8430. if (doctypeMatch) {
  8431. advance(doctypeMatch[0].length);
  8432. continue
  8433. }
  8434. // End tag:
  8435. var endTagMatch = html.match(endTag);
  8436. if (endTagMatch) {
  8437. var curIndex = index;
  8438. advance(endTagMatch[0].length);
  8439. parseEndTag(endTagMatch[1], curIndex, index);
  8440. continue
  8441. }
  8442. // Start tag:
  8443. var startTagMatch = parseStartTag();
  8444. if (startTagMatch) {
  8445. handleStartTag(startTagMatch);
  8446. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  8447. advance(1);
  8448. }
  8449. continue
  8450. }
  8451. }
  8452. var text = (void 0), rest = (void 0), next = (void 0);
  8453. if (textEnd >= 0) {
  8454. rest = html.slice(textEnd);
  8455. while (
  8456. !endTag.test(rest) &&
  8457. !startTagOpen.test(rest) &&
  8458. !comment.test(rest) &&
  8459. !conditionalComment.test(rest)
  8460. ) {
  8461. // < in plain text, be forgiving and treat it as text
  8462. next = rest.indexOf('<', 1);
  8463. if (next < 0) { break }
  8464. textEnd += next;
  8465. rest = html.slice(textEnd);
  8466. }
  8467. text = html.substring(0, textEnd);
  8468. }
  8469. if (textEnd < 0) {
  8470. text = html;
  8471. }
  8472. if (text) {
  8473. advance(text.length);
  8474. }
  8475. if (options.chars && text) {
  8476. options.chars(text, index - text.length, index);
  8477. }
  8478. } else {
  8479. var endTagLength = 0;
  8480. var stackedTag = lastTag.toLowerCase();
  8481. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  8482. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  8483. endTagLength = endTag.length;
  8484. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  8485. text = text
  8486. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  8487. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  8488. }
  8489. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  8490. text = text.slice(1);
  8491. }
  8492. if (options.chars) {
  8493. options.chars(text);
  8494. }
  8495. return ''
  8496. });
  8497. index += html.length - rest$1.length;
  8498. html = rest$1;
  8499. parseEndTag(stackedTag, index - endTagLength, index);
  8500. }
  8501. if (html === last) {
  8502. options.chars && options.chars(html);
  8503. if (process.env.NODE_ENV !== 'production' && !stack.length && options.warn) {
  8504. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  8505. }
  8506. break
  8507. }
  8508. }
  8509. // Clean up any remaining tags
  8510. parseEndTag();
  8511. function advance (n) {
  8512. index += n;
  8513. html = html.substring(n);
  8514. }
  8515. function parseStartTag () {
  8516. var start = html.match(startTagOpen);
  8517. if (start) {
  8518. var match = {
  8519. tagName: start[1],
  8520. attrs: [],
  8521. start: index
  8522. };
  8523. advance(start[0].length);
  8524. var end, attr;
  8525. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  8526. attr.start = index;
  8527. advance(attr[0].length);
  8528. attr.end = index;
  8529. match.attrs.push(attr);
  8530. }
  8531. if (end) {
  8532. match.unarySlash = end[1];
  8533. advance(end[0].length);
  8534. match.end = index;
  8535. return match
  8536. }
  8537. }
  8538. }
  8539. function handleStartTag (match) {
  8540. var tagName = match.tagName;
  8541. var unarySlash = match.unarySlash;
  8542. if (expectHTML) {
  8543. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  8544. parseEndTag(lastTag);
  8545. }
  8546. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  8547. parseEndTag(tagName);
  8548. }
  8549. }
  8550. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  8551. var l = match.attrs.length;
  8552. var attrs = new Array(l);
  8553. for (var i = 0; i < l; i++) {
  8554. var args = match.attrs[i];
  8555. var value = args[3] || args[4] || args[5] || '';
  8556. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  8557. ? options.shouldDecodeNewlinesForHref
  8558. : options.shouldDecodeNewlines;
  8559. attrs[i] = {
  8560. name: args[1],
  8561. value: decodeAttr(value, shouldDecodeNewlines)
  8562. };
  8563. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  8564. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  8565. attrs[i].end = args.end;
  8566. }
  8567. }
  8568. if (!unary) {
  8569. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  8570. lastTag = tagName;
  8571. }
  8572. if (options.start) {
  8573. options.start(tagName, attrs, unary, match.start, match.end);
  8574. }
  8575. }
  8576. function parseEndTag (tagName, start, end) {
  8577. var pos, lowerCasedTagName;
  8578. if (start == null) { start = index; }
  8579. if (end == null) { end = index; }
  8580. // Find the closest opened tag of the same type
  8581. if (tagName) {
  8582. lowerCasedTagName = tagName.toLowerCase();
  8583. for (pos = stack.length - 1; pos >= 0; pos--) {
  8584. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  8585. break
  8586. }
  8587. }
  8588. } else {
  8589. // If no tag name is provided, clean shop
  8590. pos = 0;
  8591. }
  8592. if (pos >= 0) {
  8593. // Close all the open elements, up the stack
  8594. for (var i = stack.length - 1; i >= pos; i--) {
  8595. if (process.env.NODE_ENV !== 'production' &&
  8596. (i > pos || !tagName) &&
  8597. options.warn
  8598. ) {
  8599. options.warn(
  8600. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  8601. { start: stack[i].start, end: stack[i].end }
  8602. );
  8603. }
  8604. if (options.end) {
  8605. options.end(stack[i].tag, start, end);
  8606. }
  8607. }
  8608. // Remove the open elements from the stack
  8609. stack.length = pos;
  8610. lastTag = pos && stack[pos - 1].tag;
  8611. } else if (lowerCasedTagName === 'br') {
  8612. if (options.start) {
  8613. options.start(tagName, [], true, start, end);
  8614. }
  8615. } else if (lowerCasedTagName === 'p') {
  8616. if (options.start) {
  8617. options.start(tagName, [], false, start, end);
  8618. }
  8619. if (options.end) {
  8620. options.end(tagName, start, end);
  8621. }
  8622. }
  8623. }
  8624. }
  8625. /* */
  8626. var onRE = /^@|^v-on:/;
  8627. var dirRE = /^v-|^@|^:|^#/;
  8628. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  8629. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  8630. var stripParensRE = /^\(|\)$/g;
  8631. var dynamicArgRE = /^\[.*\]$/;
  8632. var argRE = /:(.*)$/;
  8633. var bindRE = /^:|^\.|^v-bind:/;
  8634. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  8635. var slotRE = /^v-slot(:|$)|^#/;
  8636. var lineBreakRE = /[\r\n]/;
  8637. var whitespaceRE$1 = /\s+/g;
  8638. var invalidAttributeRE = /[\s"'<>\/=]/;
  8639. var decodeHTMLCached = cached(he.decode);
  8640. var emptySlotScopeToken = "_empty_";
  8641. // configurable state
  8642. var warn$2;
  8643. var delimiters;
  8644. var transforms;
  8645. var preTransforms;
  8646. var postTransforms;
  8647. var platformIsPreTag;
  8648. var platformMustUseProp;
  8649. var platformGetTagNamespace;
  8650. var maybeComponent;
  8651. function createASTElement (
  8652. tag,
  8653. attrs,
  8654. parent
  8655. ) {
  8656. return {
  8657. type: 1,
  8658. tag: tag,
  8659. attrsList: attrs,
  8660. attrsMap: makeAttrsMap(attrs),
  8661. rawAttrsMap: {},
  8662. parent: parent,
  8663. children: []
  8664. }
  8665. }
  8666. /**
  8667. * Convert HTML string to AST.
  8668. */
  8669. function parse (
  8670. template,
  8671. options
  8672. ) {
  8673. warn$2 = options.warn || baseWarn;
  8674. platformIsPreTag = options.isPreTag || no;
  8675. platformMustUseProp = options.mustUseProp || no;
  8676. platformGetTagNamespace = options.getTagNamespace || no;
  8677. var isReservedTag = options.isReservedTag || no;
  8678. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  8679. transforms = pluckModuleFunction(options.modules, 'transformNode');
  8680. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  8681. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  8682. delimiters = options.delimiters;
  8683. var stack = [];
  8684. var preserveWhitespace = options.preserveWhitespace !== false;
  8685. var whitespaceOption = options.whitespace;
  8686. var root;
  8687. var currentParent;
  8688. var inVPre = false;
  8689. var inPre = false;
  8690. var warned = false;
  8691. function warnOnce (msg, range) {
  8692. if (!warned) {
  8693. warned = true;
  8694. warn$2(msg, range);
  8695. }
  8696. }
  8697. function closeElement (element) {
  8698. trimEndingWhitespace(element);
  8699. if (!inVPre && !element.processed) {
  8700. element = processElement(element, options);
  8701. }
  8702. // tree management
  8703. if (!stack.length && element !== root) {
  8704. // allow root elements with v-if, v-else-if and v-else
  8705. if (root.if && (element.elseif || element.else)) {
  8706. if (process.env.NODE_ENV !== 'production') {
  8707. checkRootConstraints(element);
  8708. }
  8709. addIfCondition(root, {
  8710. exp: element.elseif,
  8711. block: element
  8712. });
  8713. } else if (process.env.NODE_ENV !== 'production') {
  8714. warnOnce(
  8715. "Component template should contain exactly one root element. " +
  8716. "If you are using v-if on multiple elements, " +
  8717. "use v-else-if to chain them instead.",
  8718. { start: element.start }
  8719. );
  8720. }
  8721. }
  8722. if (currentParent && !element.forbidden) {
  8723. if (element.elseif || element.else) {
  8724. processIfConditions(element, currentParent);
  8725. } else {
  8726. if (element.slotScope) {
  8727. // scoped slot
  8728. // keep it in the children list so that v-else(-if) conditions can
  8729. // find it as the prev node.
  8730. var name = element.slotTarget || '"default"'
  8731. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  8732. }
  8733. currentParent.children.push(element);
  8734. element.parent = currentParent;
  8735. }
  8736. }
  8737. // final children cleanup
  8738. // filter out scoped slots
  8739. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  8740. // remove trailing whitespace node again
  8741. trimEndingWhitespace(element);
  8742. // check pre state
  8743. if (element.pre) {
  8744. inVPre = false;
  8745. }
  8746. if (platformIsPreTag(element.tag)) {
  8747. inPre = false;
  8748. }
  8749. // apply post-transforms
  8750. for (var i = 0; i < postTransforms.length; i++) {
  8751. postTransforms[i](element, options);
  8752. }
  8753. }
  8754. function trimEndingWhitespace (el) {
  8755. // remove trailing whitespace node
  8756. if (!inPre) {
  8757. var lastNode;
  8758. while (
  8759. (lastNode = el.children[el.children.length - 1]) &&
  8760. lastNode.type === 3 &&
  8761. lastNode.text === ' '
  8762. ) {
  8763. el.children.pop();
  8764. }
  8765. }
  8766. }
  8767. function checkRootConstraints (el) {
  8768. if (el.tag === 'slot' || el.tag === 'template') {
  8769. warnOnce(
  8770. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  8771. 'contain multiple nodes.',
  8772. { start: el.start }
  8773. );
  8774. }
  8775. if (el.attrsMap.hasOwnProperty('v-for')) {
  8776. warnOnce(
  8777. 'Cannot use v-for on stateful component root element because ' +
  8778. 'it renders multiple elements.',
  8779. el.rawAttrsMap['v-for']
  8780. );
  8781. }
  8782. }
  8783. parseHTML(template, {
  8784. warn: warn$2,
  8785. expectHTML: options.expectHTML,
  8786. isUnaryTag: options.isUnaryTag,
  8787. canBeLeftOpenTag: options.canBeLeftOpenTag,
  8788. shouldDecodeNewlines: options.shouldDecodeNewlines,
  8789. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  8790. shouldKeepComment: options.comments,
  8791. outputSourceRange: options.outputSourceRange,
  8792. start: function start (tag, attrs, unary, start$1, end) {
  8793. // check namespace.
  8794. // inherit parent ns if there is one
  8795. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  8796. // handle IE svg bug
  8797. /* istanbul ignore if */
  8798. if (isIE && ns === 'svg') {
  8799. attrs = guardIESVGBug(attrs);
  8800. }
  8801. var element = createASTElement(tag, attrs, currentParent);
  8802. if (ns) {
  8803. element.ns = ns;
  8804. }
  8805. if (process.env.NODE_ENV !== 'production') {
  8806. if (options.outputSourceRange) {
  8807. element.start = start$1;
  8808. element.end = end;
  8809. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  8810. cumulated[attr.name] = attr;
  8811. return cumulated
  8812. }, {});
  8813. }
  8814. attrs.forEach(function (attr) {
  8815. if (invalidAttributeRE.test(attr.name)) {
  8816. warn$2(
  8817. "Invalid dynamic argument expression: attribute names cannot contain " +
  8818. "spaces, quotes, <, >, / or =.",
  8819. {
  8820. start: attr.start + attr.name.indexOf("["),
  8821. end: attr.start + attr.name.length
  8822. }
  8823. );
  8824. }
  8825. });
  8826. }
  8827. if (isForbiddenTag(element) && !isServerRendering()) {
  8828. element.forbidden = true;
  8829. process.env.NODE_ENV !== 'production' && warn$2(
  8830. 'Templates should only be responsible for mapping the state to the ' +
  8831. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  8832. "<" + tag + ">" + ', as they will not be parsed.',
  8833. { start: element.start }
  8834. );
  8835. }
  8836. // apply pre-transforms
  8837. for (var i = 0; i < preTransforms.length; i++) {
  8838. element = preTransforms[i](element, options) || element;
  8839. }
  8840. if (!inVPre) {
  8841. processPre(element);
  8842. if (element.pre) {
  8843. inVPre = true;
  8844. }
  8845. }
  8846. if (platformIsPreTag(element.tag)) {
  8847. inPre = true;
  8848. }
  8849. if (inVPre) {
  8850. processRawAttrs(element);
  8851. } else if (!element.processed) {
  8852. // structural directives
  8853. processFor(element);
  8854. processIf(element);
  8855. processOnce(element);
  8856. }
  8857. if (!root) {
  8858. root = element;
  8859. if (process.env.NODE_ENV !== 'production') {
  8860. checkRootConstraints(root);
  8861. }
  8862. }
  8863. if (!unary) {
  8864. currentParent = element;
  8865. stack.push(element);
  8866. } else {
  8867. closeElement(element);
  8868. }
  8869. },
  8870. end: function end (tag, start, end$1) {
  8871. var element = stack[stack.length - 1];
  8872. // pop stack
  8873. stack.length -= 1;
  8874. currentParent = stack[stack.length - 1];
  8875. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  8876. element.end = end$1;
  8877. }
  8878. closeElement(element);
  8879. },
  8880. chars: function chars (text, start, end) {
  8881. if (!currentParent) {
  8882. if (process.env.NODE_ENV !== 'production') {
  8883. if (text === template) {
  8884. warnOnce(
  8885. 'Component template requires a root element, rather than just text.',
  8886. { start: start }
  8887. );
  8888. } else if ((text = text.trim())) {
  8889. warnOnce(
  8890. ("text \"" + text + "\" outside root element will be ignored."),
  8891. { start: start }
  8892. );
  8893. }
  8894. }
  8895. return
  8896. }
  8897. // IE textarea placeholder bug
  8898. /* istanbul ignore if */
  8899. if (isIE &&
  8900. currentParent.tag === 'textarea' &&
  8901. currentParent.attrsMap.placeholder === text
  8902. ) {
  8903. return
  8904. }
  8905. var children = currentParent.children;
  8906. if (inPre || text.trim()) {
  8907. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  8908. } else if (!children.length) {
  8909. // remove the whitespace-only node right after an opening tag
  8910. text = '';
  8911. } else if (whitespaceOption) {
  8912. if (whitespaceOption === 'condense') {
  8913. // in condense mode, remove the whitespace node if it contains
  8914. // line break, otherwise condense to a single space
  8915. text = lineBreakRE.test(text) ? '' : ' ';
  8916. } else {
  8917. text = ' ';
  8918. }
  8919. } else {
  8920. text = preserveWhitespace ? ' ' : '';
  8921. }
  8922. if (text) {
  8923. if (!inPre && whitespaceOption === 'condense') {
  8924. // condense consecutive whitespaces into single space
  8925. text = text.replace(whitespaceRE$1, ' ');
  8926. }
  8927. var res;
  8928. var child;
  8929. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  8930. child = {
  8931. type: 2,
  8932. expression: res.expression,
  8933. tokens: res.tokens,
  8934. text: text
  8935. };
  8936. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  8937. child = {
  8938. type: 3,
  8939. text: text
  8940. };
  8941. }
  8942. if (child) {
  8943. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  8944. child.start = start;
  8945. child.end = end;
  8946. }
  8947. children.push(child);
  8948. }
  8949. }
  8950. },
  8951. comment: function comment (text, start, end) {
  8952. // adding anything as a sibling to the root node is forbidden
  8953. // comments should still be allowed, but ignored
  8954. if (currentParent) {
  8955. var child = {
  8956. type: 3,
  8957. text: text,
  8958. isComment: true
  8959. };
  8960. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  8961. child.start = start;
  8962. child.end = end;
  8963. }
  8964. currentParent.children.push(child);
  8965. }
  8966. }
  8967. });
  8968. return root
  8969. }
  8970. function processPre (el) {
  8971. if (getAndRemoveAttr(el, 'v-pre') != null) {
  8972. el.pre = true;
  8973. }
  8974. }
  8975. function processRawAttrs (el) {
  8976. var list = el.attrsList;
  8977. var len = list.length;
  8978. if (len) {
  8979. var attrs = el.attrs = new Array(len);
  8980. for (var i = 0; i < len; i++) {
  8981. attrs[i] = {
  8982. name: list[i].name,
  8983. value: JSON.stringify(list[i].value)
  8984. };
  8985. if (list[i].start != null) {
  8986. attrs[i].start = list[i].start;
  8987. attrs[i].end = list[i].end;
  8988. }
  8989. }
  8990. } else if (!el.pre) {
  8991. // non root node in pre blocks with no attributes
  8992. el.plain = true;
  8993. }
  8994. }
  8995. function processElement (
  8996. element,
  8997. options
  8998. ) {
  8999. processKey(element);
  9000. // determine whether this is a plain element after
  9001. // removing structural attributes
  9002. element.plain = (
  9003. !element.key &&
  9004. !element.scopedSlots &&
  9005. !element.attrsList.length
  9006. );
  9007. processRef(element);
  9008. processSlotContent(element);
  9009. processSlotOutlet(element);
  9010. processComponent(element);
  9011. for (var i = 0; i < transforms.length; i++) {
  9012. element = transforms[i](element, options) || element;
  9013. }
  9014. processAttrs(element);
  9015. return element
  9016. }
  9017. function processKey (el) {
  9018. var exp = getBindingAttr(el, 'key');
  9019. if (exp) {
  9020. if (process.env.NODE_ENV !== 'production') {
  9021. if (el.tag === 'template') {
  9022. warn$2(
  9023. "<template> cannot be keyed. Place the key on real elements instead.",
  9024. getRawBindingAttr(el, 'key')
  9025. );
  9026. }
  9027. if (el.for) {
  9028. var iterator = el.iterator2 || el.iterator1;
  9029. var parent = el.parent;
  9030. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  9031. warn$2(
  9032. "Do not use v-for index as key on <transition-group> children, " +
  9033. "this is the same as not using keys.",
  9034. getRawBindingAttr(el, 'key'),
  9035. true /* tip */
  9036. );
  9037. }
  9038. }
  9039. }
  9040. el.key = exp;
  9041. }
  9042. }
  9043. function processRef (el) {
  9044. var ref = getBindingAttr(el, 'ref');
  9045. if (ref) {
  9046. el.ref = ref;
  9047. el.refInFor = checkInFor(el);
  9048. }
  9049. }
  9050. function processFor (el) {
  9051. var exp;
  9052. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  9053. var res = parseFor(exp);
  9054. if (res) {
  9055. extend(el, res);
  9056. } else if (process.env.NODE_ENV !== 'production') {
  9057. warn$2(
  9058. ("Invalid v-for expression: " + exp),
  9059. el.rawAttrsMap['v-for']
  9060. );
  9061. }
  9062. }
  9063. }
  9064. function parseFor (exp) {
  9065. var inMatch = exp.match(forAliasRE);
  9066. if (!inMatch) { return }
  9067. var res = {};
  9068. res.for = inMatch[2].trim();
  9069. var alias = inMatch[1].trim().replace(stripParensRE, '');
  9070. var iteratorMatch = alias.match(forIteratorRE);
  9071. if (iteratorMatch) {
  9072. res.alias = alias.replace(forIteratorRE, '').trim();
  9073. res.iterator1 = iteratorMatch[1].trim();
  9074. if (iteratorMatch[2]) {
  9075. res.iterator2 = iteratorMatch[2].trim();
  9076. }
  9077. } else {
  9078. res.alias = alias;
  9079. }
  9080. return res
  9081. }
  9082. function processIf (el) {
  9083. var exp = getAndRemoveAttr(el, 'v-if');
  9084. if (exp) {
  9085. el.if = exp;
  9086. addIfCondition(el, {
  9087. exp: exp,
  9088. block: el
  9089. });
  9090. } else {
  9091. if (getAndRemoveAttr(el, 'v-else') != null) {
  9092. el.else = true;
  9093. }
  9094. var elseif = getAndRemoveAttr(el, 'v-else-if');
  9095. if (elseif) {
  9096. el.elseif = elseif;
  9097. }
  9098. }
  9099. }
  9100. function processIfConditions (el, parent) {
  9101. var prev = findPrevElement(parent.children);
  9102. if (prev && prev.if) {
  9103. addIfCondition(prev, {
  9104. exp: el.elseif,
  9105. block: el
  9106. });
  9107. } else if (process.env.NODE_ENV !== 'production') {
  9108. warn$2(
  9109. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  9110. "used on element <" + (el.tag) + "> without corresponding v-if.",
  9111. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  9112. );
  9113. }
  9114. }
  9115. function findPrevElement (children) {
  9116. var i = children.length;
  9117. while (i--) {
  9118. if (children[i].type === 1) {
  9119. return children[i]
  9120. } else {
  9121. if (process.env.NODE_ENV !== 'production' && children[i].text !== ' ') {
  9122. warn$2(
  9123. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  9124. "will be ignored.",
  9125. children[i]
  9126. );
  9127. }
  9128. children.pop();
  9129. }
  9130. }
  9131. }
  9132. function addIfCondition (el, condition) {
  9133. if (!el.ifConditions) {
  9134. el.ifConditions = [];
  9135. }
  9136. el.ifConditions.push(condition);
  9137. }
  9138. function processOnce (el) {
  9139. var once$$1 = getAndRemoveAttr(el, 'v-once');
  9140. if (once$$1 != null) {
  9141. el.once = true;
  9142. }
  9143. }
  9144. // handle content being passed to a component as slot,
  9145. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  9146. function processSlotContent (el) {
  9147. var slotScope;
  9148. if (el.tag === 'template') {
  9149. slotScope = getAndRemoveAttr(el, 'scope');
  9150. /* istanbul ignore if */
  9151. if (process.env.NODE_ENV !== 'production' && slotScope) {
  9152. warn$2(
  9153. "the \"scope\" attribute for scoped slots have been deprecated and " +
  9154. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  9155. "can also be used on plain elements in addition to <template> to " +
  9156. "denote scoped slots.",
  9157. el.rawAttrsMap['scope'],
  9158. true
  9159. );
  9160. }
  9161. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  9162. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  9163. /* istanbul ignore if */
  9164. if (process.env.NODE_ENV !== 'production' && el.attrsMap['v-for']) {
  9165. warn$2(
  9166. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  9167. "(v-for takes higher priority). Use a wrapper <template> for the " +
  9168. "scoped slot to make it clearer.",
  9169. el.rawAttrsMap['slot-scope'],
  9170. true
  9171. );
  9172. }
  9173. el.slotScope = slotScope;
  9174. }
  9175. // slot="xxx"
  9176. var slotTarget = getBindingAttr(el, 'slot');
  9177. if (slotTarget) {
  9178. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  9179. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  9180. // preserve slot as an attribute for native shadow DOM compat
  9181. // only for non-scoped slots.
  9182. if (el.tag !== 'template' && !el.slotScope) {
  9183. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  9184. }
  9185. }
  9186. // 2.6 v-slot syntax
  9187. {
  9188. if (el.tag === 'template') {
  9189. // v-slot on <template>
  9190. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  9191. if (slotBinding) {
  9192. if (process.env.NODE_ENV !== 'production') {
  9193. if (el.slotTarget || el.slotScope) {
  9194. warn$2(
  9195. "Unexpected mixed usage of different slot syntaxes.",
  9196. el
  9197. );
  9198. }
  9199. if (el.parent && !maybeComponent(el.parent)) {
  9200. warn$2(
  9201. "<template v-slot> can only appear at the root level inside " +
  9202. "the receiving component",
  9203. el
  9204. );
  9205. }
  9206. }
  9207. var ref = getSlotName(slotBinding);
  9208. var name = ref.name;
  9209. var dynamic = ref.dynamic;
  9210. el.slotTarget = name;
  9211. el.slotTargetDynamic = dynamic;
  9212. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  9213. }
  9214. } else {
  9215. // v-slot on component, denotes default slot
  9216. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  9217. if (slotBinding$1) {
  9218. if (process.env.NODE_ENV !== 'production') {
  9219. if (!maybeComponent(el)) {
  9220. warn$2(
  9221. "v-slot can only be used on components or <template>.",
  9222. slotBinding$1
  9223. );
  9224. }
  9225. if (el.slotScope || el.slotTarget) {
  9226. warn$2(
  9227. "Unexpected mixed usage of different slot syntaxes.",
  9228. el
  9229. );
  9230. }
  9231. if (el.scopedSlots) {
  9232. warn$2(
  9233. "To avoid scope ambiguity, the default slot should also use " +
  9234. "<template> syntax when there are other named slots.",
  9235. slotBinding$1
  9236. );
  9237. }
  9238. }
  9239. // add the component's children to its default slot
  9240. var slots = el.scopedSlots || (el.scopedSlots = {});
  9241. var ref$1 = getSlotName(slotBinding$1);
  9242. var name$1 = ref$1.name;
  9243. var dynamic$1 = ref$1.dynamic;
  9244. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  9245. slotContainer.slotTarget = name$1;
  9246. slotContainer.slotTargetDynamic = dynamic$1;
  9247. slotContainer.children = el.children.filter(function (c) {
  9248. if (!c.slotScope) {
  9249. c.parent = slotContainer;
  9250. return true
  9251. }
  9252. });
  9253. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  9254. // remove children as they are returned from scopedSlots now
  9255. el.children = [];
  9256. // mark el non-plain so data gets generated
  9257. el.plain = false;
  9258. }
  9259. }
  9260. }
  9261. }
  9262. function getSlotName (binding) {
  9263. var name = binding.name.replace(slotRE, '');
  9264. if (!name) {
  9265. if (binding.name[0] !== '#') {
  9266. name = 'default';
  9267. } else if (process.env.NODE_ENV !== 'production') {
  9268. warn$2(
  9269. "v-slot shorthand syntax requires a slot name.",
  9270. binding
  9271. );
  9272. }
  9273. }
  9274. return dynamicArgRE.test(name)
  9275. // dynamic [name]
  9276. ? { name: name.slice(1, -1), dynamic: true }
  9277. // static name
  9278. : { name: ("\"" + name + "\""), dynamic: false }
  9279. }
  9280. // handle <slot/> outlets
  9281. function processSlotOutlet (el) {
  9282. if (el.tag === 'slot') {
  9283. el.slotName = getBindingAttr(el, 'name');
  9284. if (process.env.NODE_ENV !== 'production' && el.key) {
  9285. warn$2(
  9286. "`key` does not work on <slot> because slots are abstract outlets " +
  9287. "and can possibly expand into multiple elements. " +
  9288. "Use the key on a wrapping element instead.",
  9289. getRawBindingAttr(el, 'key')
  9290. );
  9291. }
  9292. }
  9293. }
  9294. function processComponent (el) {
  9295. var binding;
  9296. if ((binding = getBindingAttr(el, 'is'))) {
  9297. el.component = binding;
  9298. }
  9299. if (getAndRemoveAttr(el, 'inline-template') != null) {
  9300. el.inlineTemplate = true;
  9301. }
  9302. }
  9303. function processAttrs (el) {
  9304. var list = el.attrsList;
  9305. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  9306. for (i = 0, l = list.length; i < l; i++) {
  9307. name = rawName = list[i].name;
  9308. value = list[i].value;
  9309. if (dirRE.test(name)) {
  9310. // mark element as dynamic
  9311. el.hasBindings = true;
  9312. // modifiers
  9313. modifiers = parseModifiers(name.replace(dirRE, ''));
  9314. // support .foo shorthand syntax for the .prop modifier
  9315. if (modifiers) {
  9316. name = name.replace(modifierRE, '');
  9317. }
  9318. if (bindRE.test(name)) { // v-bind
  9319. name = name.replace(bindRE, '');
  9320. value = parseFilters(value);
  9321. isDynamic = dynamicArgRE.test(name);
  9322. if (isDynamic) {
  9323. name = name.slice(1, -1);
  9324. }
  9325. if (
  9326. process.env.NODE_ENV !== 'production' &&
  9327. value.trim().length === 0
  9328. ) {
  9329. warn$2(
  9330. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  9331. );
  9332. }
  9333. if (modifiers) {
  9334. if (modifiers.prop && !isDynamic) {
  9335. name = camelize(name);
  9336. if (name === 'innerHtml') { name = 'innerHTML'; }
  9337. }
  9338. if (modifiers.camel && !isDynamic) {
  9339. name = camelize(name);
  9340. }
  9341. if (modifiers.sync) {
  9342. syncGen = genAssignmentCode(value, "$event");
  9343. if (!isDynamic) {
  9344. addHandler(
  9345. el,
  9346. ("update:" + (camelize(name))),
  9347. syncGen,
  9348. null,
  9349. false,
  9350. warn$2,
  9351. list[i]
  9352. );
  9353. if (hyphenate(name) !== camelize(name)) {
  9354. addHandler(
  9355. el,
  9356. ("update:" + (hyphenate(name))),
  9357. syncGen,
  9358. null,
  9359. false,
  9360. warn$2,
  9361. list[i]
  9362. );
  9363. }
  9364. } else {
  9365. // handler w/ dynamic event name
  9366. addHandler(
  9367. el,
  9368. ("\"update:\"+(" + name + ")"),
  9369. syncGen,
  9370. null,
  9371. false,
  9372. warn$2,
  9373. list[i],
  9374. true // dynamic
  9375. );
  9376. }
  9377. }
  9378. }
  9379. if ((modifiers && modifiers.prop) || (
  9380. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  9381. )) {
  9382. addProp(el, name, value, list[i], isDynamic);
  9383. } else {
  9384. addAttr(el, name, value, list[i], isDynamic);
  9385. }
  9386. } else if (onRE.test(name)) { // v-on
  9387. name = name.replace(onRE, '');
  9388. isDynamic = dynamicArgRE.test(name);
  9389. if (isDynamic) {
  9390. name = name.slice(1, -1);
  9391. }
  9392. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  9393. } else { // normal directives
  9394. name = name.replace(dirRE, '');
  9395. // parse arg
  9396. var argMatch = name.match(argRE);
  9397. var arg = argMatch && argMatch[1];
  9398. isDynamic = false;
  9399. if (arg) {
  9400. name = name.slice(0, -(arg.length + 1));
  9401. if (dynamicArgRE.test(arg)) {
  9402. arg = arg.slice(1, -1);
  9403. isDynamic = true;
  9404. }
  9405. }
  9406. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  9407. if (process.env.NODE_ENV !== 'production' && name === 'model') {
  9408. checkForAliasModel(el, value);
  9409. }
  9410. }
  9411. } else {
  9412. // literal attribute
  9413. if (process.env.NODE_ENV !== 'production') {
  9414. var res = parseText(value, delimiters);
  9415. if (res) {
  9416. warn$2(
  9417. name + "=\"" + value + "\": " +
  9418. 'Interpolation inside attributes has been removed. ' +
  9419. 'Use v-bind or the colon shorthand instead. For example, ' +
  9420. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  9421. list[i]
  9422. );
  9423. }
  9424. }
  9425. addAttr(el, name, JSON.stringify(value), list[i]);
  9426. // #6887 firefox doesn't update muted state if set via attribute
  9427. // even immediately after element creation
  9428. if (!el.component &&
  9429. name === 'muted' &&
  9430. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  9431. addProp(el, name, 'true', list[i]);
  9432. }
  9433. }
  9434. }
  9435. }
  9436. function checkInFor (el) {
  9437. var parent = el;
  9438. while (parent) {
  9439. if (parent.for !== undefined) {
  9440. return true
  9441. }
  9442. parent = parent.parent;
  9443. }
  9444. return false
  9445. }
  9446. function parseModifiers (name) {
  9447. var match = name.match(modifierRE);
  9448. if (match) {
  9449. var ret = {};
  9450. match.forEach(function (m) { ret[m.slice(1)] = true; });
  9451. return ret
  9452. }
  9453. }
  9454. function makeAttrsMap (attrs) {
  9455. var map = {};
  9456. for (var i = 0, l = attrs.length; i < l; i++) {
  9457. if (
  9458. process.env.NODE_ENV !== 'production' &&
  9459. map[attrs[i].name] && !isIE && !isEdge
  9460. ) {
  9461. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  9462. }
  9463. map[attrs[i].name] = attrs[i].value;
  9464. }
  9465. return map
  9466. }
  9467. // for script (e.g. type="x/template") or style, do not decode content
  9468. function isTextTag (el) {
  9469. return el.tag === 'script' || el.tag === 'style'
  9470. }
  9471. function isForbiddenTag (el) {
  9472. return (
  9473. el.tag === 'style' ||
  9474. (el.tag === 'script' && (
  9475. !el.attrsMap.type ||
  9476. el.attrsMap.type === 'text/javascript'
  9477. ))
  9478. )
  9479. }
  9480. var ieNSBug = /^xmlns:NS\d+/;
  9481. var ieNSPrefix = /^NS\d+:/;
  9482. /* istanbul ignore next */
  9483. function guardIESVGBug (attrs) {
  9484. var res = [];
  9485. for (var i = 0; i < attrs.length; i++) {
  9486. var attr = attrs[i];
  9487. if (!ieNSBug.test(attr.name)) {
  9488. attr.name = attr.name.replace(ieNSPrefix, '');
  9489. res.push(attr);
  9490. }
  9491. }
  9492. return res
  9493. }
  9494. function checkForAliasModel (el, value) {
  9495. var _el = el;
  9496. while (_el) {
  9497. if (_el.for && _el.alias === value) {
  9498. warn$2(
  9499. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  9500. "You are binding v-model directly to a v-for iteration alias. " +
  9501. "This will not be able to modify the v-for source array because " +
  9502. "writing to the alias is like modifying a function local variable. " +
  9503. "Consider using an array of objects and use v-model on an object property instead.",
  9504. el.rawAttrsMap['v-model']
  9505. );
  9506. }
  9507. _el = _el.parent;
  9508. }
  9509. }
  9510. /* */
  9511. function preTransformNode (el, options) {
  9512. if (el.tag === 'input') {
  9513. var map = el.attrsMap;
  9514. if (!map['v-model']) {
  9515. return
  9516. }
  9517. var typeBinding;
  9518. if (map[':type'] || map['v-bind:type']) {
  9519. typeBinding = getBindingAttr(el, 'type');
  9520. }
  9521. if (!map.type && !typeBinding && map['v-bind']) {
  9522. typeBinding = "(" + (map['v-bind']) + ").type";
  9523. }
  9524. if (typeBinding) {
  9525. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  9526. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  9527. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  9528. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  9529. // 1. checkbox
  9530. var branch0 = cloneASTElement(el);
  9531. // process for on the main node
  9532. processFor(branch0);
  9533. addRawAttr(branch0, 'type', 'checkbox');
  9534. processElement(branch0, options);
  9535. branch0.processed = true; // prevent it from double-processed
  9536. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  9537. addIfCondition(branch0, {
  9538. exp: branch0.if,
  9539. block: branch0
  9540. });
  9541. // 2. add radio else-if condition
  9542. var branch1 = cloneASTElement(el);
  9543. getAndRemoveAttr(branch1, 'v-for', true);
  9544. addRawAttr(branch1, 'type', 'radio');
  9545. processElement(branch1, options);
  9546. addIfCondition(branch0, {
  9547. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  9548. block: branch1
  9549. });
  9550. // 3. other
  9551. var branch2 = cloneASTElement(el);
  9552. getAndRemoveAttr(branch2, 'v-for', true);
  9553. addRawAttr(branch2, ':type', typeBinding);
  9554. processElement(branch2, options);
  9555. addIfCondition(branch0, {
  9556. exp: ifCondition,
  9557. block: branch2
  9558. });
  9559. if (hasElse) {
  9560. branch0.else = true;
  9561. } else if (elseIfCondition) {
  9562. branch0.elseif = elseIfCondition;
  9563. }
  9564. return branch0
  9565. }
  9566. }
  9567. }
  9568. function cloneASTElement (el) {
  9569. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  9570. }
  9571. var model$1 = {
  9572. preTransformNode: preTransformNode
  9573. };
  9574. var modules$1 = [
  9575. klass$1,
  9576. style$1,
  9577. model$1
  9578. ];
  9579. /* */
  9580. function text (el, dir) {
  9581. if (dir.value) {
  9582. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  9583. }
  9584. }
  9585. /* */
  9586. function html (el, dir) {
  9587. if (dir.value) {
  9588. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  9589. }
  9590. }
  9591. var directives$1 = {
  9592. model: model,
  9593. text: text,
  9594. html: html
  9595. };
  9596. /* */
  9597. var baseOptions = {
  9598. expectHTML: true,
  9599. modules: modules$1,
  9600. directives: directives$1,
  9601. isPreTag: isPreTag,
  9602. isUnaryTag: isUnaryTag,
  9603. mustUseProp: mustUseProp,
  9604. canBeLeftOpenTag: canBeLeftOpenTag,
  9605. isReservedTag: isReservedTag,
  9606. getTagNamespace: getTagNamespace,
  9607. staticKeys: genStaticKeys(modules$1)
  9608. };
  9609. /* */
  9610. var isStaticKey;
  9611. var isPlatformReservedTag;
  9612. var genStaticKeysCached = cached(genStaticKeys$1);
  9613. /**
  9614. * Goal of the optimizer: walk the generated template AST tree
  9615. * and detect sub-trees that are purely static, i.e. parts of
  9616. * the DOM that never needs to change.
  9617. *
  9618. * Once we detect these sub-trees, we can:
  9619. *
  9620. * 1. Hoist them into constants, so that we no longer need to
  9621. * create fresh nodes for them on each re-render;
  9622. * 2. Completely skip them in the patching process.
  9623. */
  9624. function optimize (root, options) {
  9625. if (!root) { return }
  9626. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  9627. isPlatformReservedTag = options.isReservedTag || no;
  9628. // first pass: mark all non-static nodes.
  9629. markStatic$1(root);
  9630. // second pass: mark static roots.
  9631. markStaticRoots(root, false);
  9632. }
  9633. function genStaticKeys$1 (keys) {
  9634. return makeMap(
  9635. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  9636. (keys ? ',' + keys : '')
  9637. )
  9638. }
  9639. function markStatic$1 (node) {
  9640. node.static = isStatic(node);
  9641. if (node.type === 1) {
  9642. // do not make component slot content static. this avoids
  9643. // 1. components not able to mutate slot nodes
  9644. // 2. static slot content fails for hot-reloading
  9645. if (
  9646. !isPlatformReservedTag(node.tag) &&
  9647. node.tag !== 'slot' &&
  9648. node.attrsMap['inline-template'] == null
  9649. ) {
  9650. return
  9651. }
  9652. for (var i = 0, l = node.children.length; i < l; i++) {
  9653. var child = node.children[i];
  9654. markStatic$1(child);
  9655. if (!child.static) {
  9656. node.static = false;
  9657. }
  9658. }
  9659. if (node.ifConditions) {
  9660. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  9661. var block = node.ifConditions[i$1].block;
  9662. markStatic$1(block);
  9663. if (!block.static) {
  9664. node.static = false;
  9665. }
  9666. }
  9667. }
  9668. }
  9669. }
  9670. function markStaticRoots (node, isInFor) {
  9671. if (node.type === 1) {
  9672. if (node.static || node.once) {
  9673. node.staticInFor = isInFor;
  9674. }
  9675. // For a node to qualify as a static root, it should have children that
  9676. // are not just static text. Otherwise the cost of hoisting out will
  9677. // outweigh the benefits and it's better off to just always render it fresh.
  9678. if (node.static && node.children.length && !(
  9679. node.children.length === 1 &&
  9680. node.children[0].type === 3
  9681. )) {
  9682. node.staticRoot = true;
  9683. return
  9684. } else {
  9685. node.staticRoot = false;
  9686. }
  9687. if (node.children) {
  9688. for (var i = 0, l = node.children.length; i < l; i++) {
  9689. markStaticRoots(node.children[i], isInFor || !!node.for);
  9690. }
  9691. }
  9692. if (node.ifConditions) {
  9693. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  9694. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  9695. }
  9696. }
  9697. }
  9698. }
  9699. function isStatic (node) {
  9700. if (node.type === 2) { // expression
  9701. return false
  9702. }
  9703. if (node.type === 3) { // text
  9704. return true
  9705. }
  9706. return !!(node.pre || (
  9707. !node.hasBindings && // no dynamic bindings
  9708. !node.if && !node.for && // not v-if or v-for or v-else
  9709. !isBuiltInTag(node.tag) && // not a built-in
  9710. isPlatformReservedTag(node.tag) && // not a component
  9711. !isDirectChildOfTemplateFor(node) &&
  9712. Object.keys(node).every(isStaticKey)
  9713. ))
  9714. }
  9715. function isDirectChildOfTemplateFor (node) {
  9716. while (node.parent) {
  9717. node = node.parent;
  9718. if (node.tag !== 'template') {
  9719. return false
  9720. }
  9721. if (node.for) {
  9722. return true
  9723. }
  9724. }
  9725. return false
  9726. }
  9727. /* */
  9728. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  9729. var fnInvokeRE = /\([^)]*?\);*$/;
  9730. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  9731. // KeyboardEvent.keyCode aliases
  9732. var keyCodes = {
  9733. esc: 27,
  9734. tab: 9,
  9735. enter: 13,
  9736. space: 32,
  9737. up: 38,
  9738. left: 37,
  9739. right: 39,
  9740. down: 40,
  9741. 'delete': [8, 46]
  9742. };
  9743. // KeyboardEvent.key aliases
  9744. var keyNames = {
  9745. // #7880: IE11 and Edge use `Esc` for Escape key name.
  9746. esc: ['Esc', 'Escape'],
  9747. tab: 'Tab',
  9748. enter: 'Enter',
  9749. // #9112: IE11 uses `Spacebar` for Space key name.
  9750. space: [' ', 'Spacebar'],
  9751. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  9752. up: ['Up', 'ArrowUp'],
  9753. left: ['Left', 'ArrowLeft'],
  9754. right: ['Right', 'ArrowRight'],
  9755. down: ['Down', 'ArrowDown'],
  9756. // #9112: IE11 uses `Del` for Delete key name.
  9757. 'delete': ['Backspace', 'Delete', 'Del']
  9758. };
  9759. // #4868: modifiers that prevent the execution of the listener
  9760. // need to explicitly return null so that we can determine whether to remove
  9761. // the listener for .once
  9762. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  9763. var modifierCode = {
  9764. stop: '$event.stopPropagation();',
  9765. prevent: '$event.preventDefault();',
  9766. self: genGuard("$event.target !== $event.currentTarget"),
  9767. ctrl: genGuard("!$event.ctrlKey"),
  9768. shift: genGuard("!$event.shiftKey"),
  9769. alt: genGuard("!$event.altKey"),
  9770. meta: genGuard("!$event.metaKey"),
  9771. left: genGuard("'button' in $event && $event.button !== 0"),
  9772. middle: genGuard("'button' in $event && $event.button !== 1"),
  9773. right: genGuard("'button' in $event && $event.button !== 2")
  9774. };
  9775. function genHandlers (
  9776. events,
  9777. isNative
  9778. ) {
  9779. var prefix = isNative ? 'nativeOn:' : 'on:';
  9780. var staticHandlers = "";
  9781. var dynamicHandlers = "";
  9782. for (var name in events) {
  9783. var handlerCode = genHandler(events[name]);
  9784. if (events[name] && events[name].dynamic) {
  9785. dynamicHandlers += name + "," + handlerCode + ",";
  9786. } else {
  9787. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  9788. }
  9789. }
  9790. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  9791. if (dynamicHandlers) {
  9792. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  9793. } else {
  9794. return prefix + staticHandlers
  9795. }
  9796. }
  9797. function genHandler (handler) {
  9798. if (!handler) {
  9799. return 'function(){}'
  9800. }
  9801. if (Array.isArray(handler)) {
  9802. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  9803. }
  9804. var isMethodPath = simplePathRE.test(handler.value);
  9805. var isFunctionExpression = fnExpRE.test(handler.value);
  9806. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  9807. if (!handler.modifiers) {
  9808. if (isMethodPath || isFunctionExpression) {
  9809. return handler.value
  9810. }
  9811. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  9812. } else {
  9813. var code = '';
  9814. var genModifierCode = '';
  9815. var keys = [];
  9816. for (var key in handler.modifiers) {
  9817. if (modifierCode[key]) {
  9818. genModifierCode += modifierCode[key];
  9819. // left/right
  9820. if (keyCodes[key]) {
  9821. keys.push(key);
  9822. }
  9823. } else if (key === 'exact') {
  9824. var modifiers = (handler.modifiers);
  9825. genModifierCode += genGuard(
  9826. ['ctrl', 'shift', 'alt', 'meta']
  9827. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  9828. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  9829. .join('||')
  9830. );
  9831. } else {
  9832. keys.push(key);
  9833. }
  9834. }
  9835. if (keys.length) {
  9836. code += genKeyFilter(keys);
  9837. }
  9838. // Make sure modifiers like prevent and stop get executed after key filtering
  9839. if (genModifierCode) {
  9840. code += genModifierCode;
  9841. }
  9842. var handlerCode = isMethodPath
  9843. ? ("return " + (handler.value) + "($event)")
  9844. : isFunctionExpression
  9845. ? ("return (" + (handler.value) + ")($event)")
  9846. : isFunctionInvocation
  9847. ? ("return " + (handler.value))
  9848. : handler.value;
  9849. return ("function($event){" + code + handlerCode + "}")
  9850. }
  9851. }
  9852. function genKeyFilter (keys) {
  9853. return (
  9854. // make sure the key filters only apply to KeyboardEvents
  9855. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  9856. // key events that do not have keyCode property...
  9857. "if(!$event.type.indexOf('key')&&" +
  9858. (keys.map(genFilterCode).join('&&')) + ")return null;"
  9859. )
  9860. }
  9861. function genFilterCode (key) {
  9862. var keyVal = parseInt(key, 10);
  9863. if (keyVal) {
  9864. return ("$event.keyCode!==" + keyVal)
  9865. }
  9866. var keyCode = keyCodes[key];
  9867. var keyName = keyNames[key];
  9868. return (
  9869. "_k($event.keyCode," +
  9870. (JSON.stringify(key)) + "," +
  9871. (JSON.stringify(keyCode)) + "," +
  9872. "$event.key," +
  9873. "" + (JSON.stringify(keyName)) +
  9874. ")"
  9875. )
  9876. }
  9877. /* */
  9878. function on (el, dir) {
  9879. if (process.env.NODE_ENV !== 'production' && dir.modifiers) {
  9880. warn("v-on without argument does not support modifiers.");
  9881. }
  9882. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  9883. }
  9884. /* */
  9885. function bind$1 (el, dir) {
  9886. el.wrapData = function (code) {
  9887. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  9888. };
  9889. }
  9890. /* */
  9891. var baseDirectives = {
  9892. on: on,
  9893. bind: bind$1,
  9894. cloak: noop
  9895. };
  9896. /* */
  9897. var CodegenState = function CodegenState (options) {
  9898. this.options = options;
  9899. this.warn = options.warn || baseWarn;
  9900. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  9901. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  9902. this.directives = extend(extend({}, baseDirectives), options.directives);
  9903. var isReservedTag = options.isReservedTag || no;
  9904. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  9905. this.onceId = 0;
  9906. this.staticRenderFns = [];
  9907. this.pre = false;
  9908. };
  9909. function generate (
  9910. ast,
  9911. options
  9912. ) {
  9913. var state = new CodegenState(options);
  9914. var code = ast ? genElement(ast, state) : '_c("div")';
  9915. return {
  9916. render: ("with(this){return " + code + "}"),
  9917. staticRenderFns: state.staticRenderFns
  9918. }
  9919. }
  9920. function genElement (el, state) {
  9921. if (el.parent) {
  9922. el.pre = el.pre || el.parent.pre;
  9923. }
  9924. if (el.staticRoot && !el.staticProcessed) {
  9925. return genStatic(el, state)
  9926. } else if (el.once && !el.onceProcessed) {
  9927. return genOnce(el, state)
  9928. } else if (el.for && !el.forProcessed) {
  9929. return genFor(el, state)
  9930. } else if (el.if && !el.ifProcessed) {
  9931. return genIf(el, state)
  9932. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  9933. return genChildren(el, state) || 'void 0'
  9934. } else if (el.tag === 'slot') {
  9935. return genSlot(el, state)
  9936. } else {
  9937. // component or element
  9938. var code;
  9939. if (el.component) {
  9940. code = genComponent(el.component, el, state);
  9941. } else {
  9942. var data;
  9943. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  9944. data = genData$2(el, state);
  9945. }
  9946. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  9947. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  9948. }
  9949. // module transforms
  9950. for (var i = 0; i < state.transforms.length; i++) {
  9951. code = state.transforms[i](el, code);
  9952. }
  9953. return code
  9954. }
  9955. }
  9956. // hoist static sub-trees out
  9957. function genStatic (el, state) {
  9958. el.staticProcessed = true;
  9959. // Some elements (templates) need to behave differently inside of a v-pre
  9960. // node. All pre nodes are static roots, so we can use this as a location to
  9961. // wrap a state change and reset it upon exiting the pre node.
  9962. var originalPreState = state.pre;
  9963. if (el.pre) {
  9964. state.pre = el.pre;
  9965. }
  9966. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  9967. state.pre = originalPreState;
  9968. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  9969. }
  9970. // v-once
  9971. function genOnce (el, state) {
  9972. el.onceProcessed = true;
  9973. if (el.if && !el.ifProcessed) {
  9974. return genIf(el, state)
  9975. } else if (el.staticInFor) {
  9976. var key = '';
  9977. var parent = el.parent;
  9978. while (parent) {
  9979. if (parent.for) {
  9980. key = parent.key;
  9981. break
  9982. }
  9983. parent = parent.parent;
  9984. }
  9985. if (!key) {
  9986. process.env.NODE_ENV !== 'production' && state.warn(
  9987. "v-once can only be used inside v-for that is keyed. ",
  9988. el.rawAttrsMap['v-once']
  9989. );
  9990. return genElement(el, state)
  9991. }
  9992. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  9993. } else {
  9994. return genStatic(el, state)
  9995. }
  9996. }
  9997. function genIf (
  9998. el,
  9999. state,
  10000. altGen,
  10001. altEmpty
  10002. ) {
  10003. el.ifProcessed = true; // avoid recursion
  10004. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  10005. }
  10006. function genIfConditions (
  10007. conditions,
  10008. state,
  10009. altGen,
  10010. altEmpty
  10011. ) {
  10012. if (!conditions.length) {
  10013. return altEmpty || '_e()'
  10014. }
  10015. var condition = conditions.shift();
  10016. if (condition.exp) {
  10017. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  10018. } else {
  10019. return ("" + (genTernaryExp(condition.block)))
  10020. }
  10021. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  10022. function genTernaryExp (el) {
  10023. return altGen
  10024. ? altGen(el, state)
  10025. : el.once
  10026. ? genOnce(el, state)
  10027. : genElement(el, state)
  10028. }
  10029. }
  10030. function genFor (
  10031. el,
  10032. state,
  10033. altGen,
  10034. altHelper
  10035. ) {
  10036. var exp = el.for;
  10037. var alias = el.alias;
  10038. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  10039. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  10040. if (process.env.NODE_ENV !== 'production' &&
  10041. state.maybeComponent(el) &&
  10042. el.tag !== 'slot' &&
  10043. el.tag !== 'template' &&
  10044. !el.key
  10045. ) {
  10046. state.warn(
  10047. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  10048. "v-for should have explicit keys. " +
  10049. "See https://vuejs.org/guide/list.html#key for more info.",
  10050. el.rawAttrsMap['v-for'],
  10051. true /* tip */
  10052. );
  10053. }
  10054. el.forProcessed = true; // avoid recursion
  10055. return (altHelper || '_l') + "((" + exp + ")," +
  10056. "function(" + alias + iterator1 + iterator2 + "){" +
  10057. "return " + ((altGen || genElement)(el, state)) +
  10058. '})'
  10059. }
  10060. function genData$2 (el, state) {
  10061. var data = '{';
  10062. // directives first.
  10063. // directives may mutate the el's other properties before they are generated.
  10064. var dirs = genDirectives(el, state);
  10065. if (dirs) { data += dirs + ','; }
  10066. // key
  10067. if (el.key) {
  10068. data += "key:" + (el.key) + ",";
  10069. }
  10070. // ref
  10071. if (el.ref) {
  10072. data += "ref:" + (el.ref) + ",";
  10073. }
  10074. if (el.refInFor) {
  10075. data += "refInFor:true,";
  10076. }
  10077. // pre
  10078. if (el.pre) {
  10079. data += "pre:true,";
  10080. }
  10081. // record original tag name for components using "is" attribute
  10082. if (el.component) {
  10083. data += "tag:\"" + (el.tag) + "\",";
  10084. }
  10085. // module data generation functions
  10086. for (var i = 0; i < state.dataGenFns.length; i++) {
  10087. data += state.dataGenFns[i](el);
  10088. }
  10089. // attributes
  10090. if (el.attrs) {
  10091. data += "attrs:" + (genProps(el.attrs)) + ",";
  10092. }
  10093. // DOM props
  10094. if (el.props) {
  10095. data += "domProps:" + (genProps(el.props)) + ",";
  10096. }
  10097. // event handlers
  10098. if (el.events) {
  10099. data += (genHandlers(el.events, false)) + ",";
  10100. }
  10101. if (el.nativeEvents) {
  10102. data += (genHandlers(el.nativeEvents, true)) + ",";
  10103. }
  10104. // slot target
  10105. // only for non-scoped slots
  10106. if (el.slotTarget && !el.slotScope) {
  10107. data += "slot:" + (el.slotTarget) + ",";
  10108. }
  10109. // scoped slots
  10110. if (el.scopedSlots) {
  10111. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  10112. }
  10113. // component v-model
  10114. if (el.model) {
  10115. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  10116. }
  10117. // inline-template
  10118. if (el.inlineTemplate) {
  10119. var inlineTemplate = genInlineTemplate(el, state);
  10120. if (inlineTemplate) {
  10121. data += inlineTemplate + ",";
  10122. }
  10123. }
  10124. data = data.replace(/,$/, '') + '}';
  10125. // v-bind dynamic argument wrap
  10126. // v-bind with dynamic arguments must be applied using the same v-bind object
  10127. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  10128. if (el.dynamicAttrs) {
  10129. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  10130. }
  10131. // v-bind data wrap
  10132. if (el.wrapData) {
  10133. data = el.wrapData(data);
  10134. }
  10135. // v-on data wrap
  10136. if (el.wrapListeners) {
  10137. data = el.wrapListeners(data);
  10138. }
  10139. return data
  10140. }
  10141. function genDirectives (el, state) {
  10142. var dirs = el.directives;
  10143. if (!dirs) { return }
  10144. var res = 'directives:[';
  10145. var hasRuntime = false;
  10146. var i, l, dir, needRuntime;
  10147. for (i = 0, l = dirs.length; i < l; i++) {
  10148. dir = dirs[i];
  10149. needRuntime = true;
  10150. var gen = state.directives[dir.name];
  10151. if (gen) {
  10152. // compile-time directive that manipulates AST.
  10153. // returns true if it also needs a runtime counterpart.
  10154. needRuntime = !!gen(el, dir, state.warn);
  10155. }
  10156. if (needRuntime) {
  10157. hasRuntime = true;
  10158. 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))) : '') + "},";
  10159. }
  10160. }
  10161. if (hasRuntime) {
  10162. return res.slice(0, -1) + ']'
  10163. }
  10164. }
  10165. function genInlineTemplate (el, state) {
  10166. var ast = el.children[0];
  10167. if (process.env.NODE_ENV !== 'production' && (
  10168. el.children.length !== 1 || ast.type !== 1
  10169. )) {
  10170. state.warn(
  10171. 'Inline-template components must have exactly one child element.',
  10172. { start: el.start }
  10173. );
  10174. }
  10175. if (ast && ast.type === 1) {
  10176. var inlineRenderFns = generate(ast, state.options);
  10177. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  10178. }
  10179. }
  10180. function genScopedSlots (
  10181. el,
  10182. slots,
  10183. state
  10184. ) {
  10185. // by default scoped slots are considered "stable", this allows child
  10186. // components with only scoped slots to skip forced updates from parent.
  10187. // but in some cases we have to bail-out of this optimization
  10188. // for example if the slot contains dynamic names, has v-if or v-for on them...
  10189. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  10190. var slot = slots[key];
  10191. return (
  10192. slot.slotTargetDynamic ||
  10193. slot.if ||
  10194. slot.for ||
  10195. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  10196. )
  10197. });
  10198. // #9534: if a component with scoped slots is inside a conditional branch,
  10199. // it's possible for the same component to be reused but with different
  10200. // compiled slot content. To avoid that, we generate a unique key based on
  10201. // the generated code of all the slot contents.
  10202. var needsKey = !!el.if;
  10203. // OR when it is inside another scoped slot or v-for (the reactivity may be
  10204. // disconnected due to the intermediate scope variable)
  10205. // #9438, #9506
  10206. // TODO: this can be further optimized by properly analyzing in-scope bindings
  10207. // and skip force updating ones that do not actually use scope variables.
  10208. if (!needsForceUpdate) {
  10209. var parent = el.parent;
  10210. while (parent) {
  10211. if (
  10212. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  10213. parent.for
  10214. ) {
  10215. needsForceUpdate = true;
  10216. break
  10217. }
  10218. if (parent.if) {
  10219. needsKey = true;
  10220. }
  10221. parent = parent.parent;
  10222. }
  10223. }
  10224. var generatedSlots = Object.keys(slots)
  10225. .map(function (key) { return genScopedSlot(slots[key], state); })
  10226. .join(',');
  10227. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  10228. }
  10229. function hash(str) {
  10230. var hash = 5381;
  10231. var i = str.length;
  10232. while(i) {
  10233. hash = (hash * 33) ^ str.charCodeAt(--i);
  10234. }
  10235. return hash >>> 0
  10236. }
  10237. function containsSlotChild (el) {
  10238. if (el.type === 1) {
  10239. if (el.tag === 'slot') {
  10240. return true
  10241. }
  10242. return el.children.some(containsSlotChild)
  10243. }
  10244. return false
  10245. }
  10246. function genScopedSlot (
  10247. el,
  10248. state
  10249. ) {
  10250. var isLegacySyntax = el.attrsMap['slot-scope'];
  10251. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  10252. return genIf(el, state, genScopedSlot, "null")
  10253. }
  10254. if (el.for && !el.forProcessed) {
  10255. return genFor(el, state, genScopedSlot)
  10256. }
  10257. var slotScope = el.slotScope === emptySlotScopeToken
  10258. ? ""
  10259. : String(el.slotScope);
  10260. var fn = "function(" + slotScope + "){" +
  10261. "return " + (el.tag === 'template'
  10262. ? el.if && isLegacySyntax
  10263. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  10264. : genChildren(el, state) || 'undefined'
  10265. : genElement(el, state)) + "}";
  10266. // reverse proxy v-slot without scope on this.$slots
  10267. var reverseProxy = slotScope ? "" : ",proxy:true";
  10268. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  10269. }
  10270. function genChildren (
  10271. el,
  10272. state,
  10273. checkSkip,
  10274. altGenElement,
  10275. altGenNode
  10276. ) {
  10277. var children = el.children;
  10278. if (children.length) {
  10279. var el$1 = children[0];
  10280. // optimize single v-for
  10281. if (children.length === 1 &&
  10282. el$1.for &&
  10283. el$1.tag !== 'template' &&
  10284. el$1.tag !== 'slot'
  10285. ) {
  10286. var normalizationType = checkSkip
  10287. ? state.maybeComponent(el$1) ? ",1" : ",0"
  10288. : "";
  10289. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  10290. }
  10291. var normalizationType$1 = checkSkip
  10292. ? getNormalizationType(children, state.maybeComponent)
  10293. : 0;
  10294. var gen = altGenNode || genNode;
  10295. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  10296. }
  10297. }
  10298. // determine the normalization needed for the children array.
  10299. // 0: no normalization needed
  10300. // 1: simple normalization needed (possible 1-level deep nested array)
  10301. // 2: full normalization needed
  10302. function getNormalizationType (
  10303. children,
  10304. maybeComponent
  10305. ) {
  10306. var res = 0;
  10307. for (var i = 0; i < children.length; i++) {
  10308. var el = children[i];
  10309. if (el.type !== 1) {
  10310. continue
  10311. }
  10312. if (needsNormalization(el) ||
  10313. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  10314. res = 2;
  10315. break
  10316. }
  10317. if (maybeComponent(el) ||
  10318. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  10319. res = 1;
  10320. }
  10321. }
  10322. return res
  10323. }
  10324. function needsNormalization (el) {
  10325. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  10326. }
  10327. function genNode (node, state) {
  10328. if (node.type === 1) {
  10329. return genElement(node, state)
  10330. } else if (node.type === 3 && node.isComment) {
  10331. return genComment(node)
  10332. } else {
  10333. return genText(node)
  10334. }
  10335. }
  10336. function genText (text) {
  10337. return ("_v(" + (text.type === 2
  10338. ? text.expression // no need for () because already wrapped in _s()
  10339. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  10340. }
  10341. function genComment (comment) {
  10342. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  10343. }
  10344. function genSlot (el, state) {
  10345. var slotName = el.slotName || '"default"';
  10346. var children = genChildren(el, state);
  10347. var res = "_t(" + slotName + (children ? ("," + children) : '');
  10348. var attrs = el.attrs || el.dynamicAttrs
  10349. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  10350. // slot props are camelized
  10351. name: camelize(attr.name),
  10352. value: attr.value,
  10353. dynamic: attr.dynamic
  10354. }); }))
  10355. : null;
  10356. var bind$$1 = el.attrsMap['v-bind'];
  10357. if ((attrs || bind$$1) && !children) {
  10358. res += ",null";
  10359. }
  10360. if (attrs) {
  10361. res += "," + attrs;
  10362. }
  10363. if (bind$$1) {
  10364. res += (attrs ? '' : ',null') + "," + bind$$1;
  10365. }
  10366. return res + ')'
  10367. }
  10368. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  10369. function genComponent (
  10370. componentName,
  10371. el,
  10372. state
  10373. ) {
  10374. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  10375. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  10376. }
  10377. function genProps (props) {
  10378. var staticProps = "";
  10379. var dynamicProps = "";
  10380. for (var i = 0; i < props.length; i++) {
  10381. var prop = props[i];
  10382. var value = transformSpecialNewlines(prop.value);
  10383. if (prop.dynamic) {
  10384. dynamicProps += (prop.name) + "," + value + ",";
  10385. } else {
  10386. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  10387. }
  10388. }
  10389. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  10390. if (dynamicProps) {
  10391. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  10392. } else {
  10393. return staticProps
  10394. }
  10395. }
  10396. // #3895, #4268
  10397. function transformSpecialNewlines (text) {
  10398. return text
  10399. .replace(/\u2028/g, '\\u2028')
  10400. .replace(/\u2029/g, '\\u2029')
  10401. }
  10402. /* */
  10403. // these keywords should not appear inside expressions, but operators like
  10404. // typeof, instanceof and in are allowed
  10405. var prohibitedKeywordRE = new RegExp('\\b' + (
  10406. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  10407. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  10408. 'extends,finally,continue,debugger,function,arguments'
  10409. ).split(',').join('\\b|\\b') + '\\b');
  10410. // these unary operators should not be used as property/method names
  10411. var unaryOperatorsRE = new RegExp('\\b' + (
  10412. 'delete,typeof,void'
  10413. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  10414. // strip strings in expressions
  10415. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  10416. // detect problematic expressions in a template
  10417. function detectErrors (ast, warn) {
  10418. if (ast) {
  10419. checkNode(ast, warn);
  10420. }
  10421. }
  10422. function checkNode (node, warn) {
  10423. if (node.type === 1) {
  10424. for (var name in node.attrsMap) {
  10425. if (dirRE.test(name)) {
  10426. var value = node.attrsMap[name];
  10427. if (value) {
  10428. var range = node.rawAttrsMap[name];
  10429. if (name === 'v-for') {
  10430. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  10431. } else if (name === 'v-slot' || name[0] === '#') {
  10432. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  10433. } else if (onRE.test(name)) {
  10434. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  10435. } else {
  10436. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  10437. }
  10438. }
  10439. }
  10440. }
  10441. if (node.children) {
  10442. for (var i = 0; i < node.children.length; i++) {
  10443. checkNode(node.children[i], warn);
  10444. }
  10445. }
  10446. } else if (node.type === 2) {
  10447. checkExpression(node.expression, node.text, warn, node);
  10448. }
  10449. }
  10450. function checkEvent (exp, text, warn, range) {
  10451. var stripped = exp.replace(stripStringRE, '');
  10452. var keywordMatch = stripped.match(unaryOperatorsRE);
  10453. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  10454. warn(
  10455. "avoid using JavaScript unary operator as property name: " +
  10456. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  10457. range
  10458. );
  10459. }
  10460. checkExpression(exp, text, warn, range);
  10461. }
  10462. function checkFor (node, text, warn, range) {
  10463. checkExpression(node.for || '', text, warn, range);
  10464. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  10465. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  10466. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  10467. }
  10468. function checkIdentifier (
  10469. ident,
  10470. type,
  10471. text,
  10472. warn,
  10473. range
  10474. ) {
  10475. if (typeof ident === 'string') {
  10476. try {
  10477. new Function(("var " + ident + "=_"));
  10478. } catch (e) {
  10479. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  10480. }
  10481. }
  10482. }
  10483. function checkExpression (exp, text, warn, range) {
  10484. try {
  10485. new Function(("return " + exp));
  10486. } catch (e) {
  10487. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  10488. if (keywordMatch) {
  10489. warn(
  10490. "avoid using JavaScript keyword as property name: " +
  10491. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  10492. range
  10493. );
  10494. } else {
  10495. warn(
  10496. "invalid expression: " + (e.message) + " in\n\n" +
  10497. " " + exp + "\n\n" +
  10498. " Raw expression: " + (text.trim()) + "\n",
  10499. range
  10500. );
  10501. }
  10502. }
  10503. }
  10504. function checkFunctionParameterExpression (exp, text, warn, range) {
  10505. try {
  10506. new Function(exp, '');
  10507. } catch (e) {
  10508. warn(
  10509. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  10510. " " + exp + "\n\n" +
  10511. " Raw expression: " + (text.trim()) + "\n",
  10512. range
  10513. );
  10514. }
  10515. }
  10516. /* */
  10517. var range = 2;
  10518. function generateCodeFrame (
  10519. source,
  10520. start,
  10521. end
  10522. ) {
  10523. if ( start === void 0 ) start = 0;
  10524. if ( end === void 0 ) end = source.length;
  10525. var lines = source.split(/\r?\n/);
  10526. var count = 0;
  10527. var res = [];
  10528. for (var i = 0; i < lines.length; i++) {
  10529. count += lines[i].length + 1;
  10530. if (count >= start) {
  10531. for (var j = i - range; j <= i + range || end > count; j++) {
  10532. if (j < 0 || j >= lines.length) { continue }
  10533. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  10534. var lineLength = lines[j].length;
  10535. if (j === i) {
  10536. // push underline
  10537. var pad = start - (count - lineLength) + 1;
  10538. var length = end > count ? lineLength - pad : end - start;
  10539. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  10540. } else if (j > i) {
  10541. if (end > count) {
  10542. var length$1 = Math.min(end - count, lineLength);
  10543. res.push(" | " + repeat$1("^", length$1));
  10544. }
  10545. count += lineLength + 1;
  10546. }
  10547. }
  10548. break
  10549. }
  10550. }
  10551. return res.join('\n')
  10552. }
  10553. function repeat$1 (str, n) {
  10554. var result = '';
  10555. if (n > 0) {
  10556. while (true) { // eslint-disable-line
  10557. if (n & 1) { result += str; }
  10558. n >>>= 1;
  10559. if (n <= 0) { break }
  10560. str += str;
  10561. }
  10562. }
  10563. return result
  10564. }
  10565. /* */
  10566. function createFunction (code, errors) {
  10567. try {
  10568. return new Function(code)
  10569. } catch (err) {
  10570. errors.push({ err: err, code: code });
  10571. return noop
  10572. }
  10573. }
  10574. function createCompileToFunctionFn (compile) {
  10575. var cache = Object.create(null);
  10576. return function compileToFunctions (
  10577. template,
  10578. options,
  10579. vm
  10580. ) {
  10581. options = extend({}, options);
  10582. var warn$$1 = options.warn || warn;
  10583. delete options.warn;
  10584. /* istanbul ignore if */
  10585. if (process.env.NODE_ENV !== 'production') {
  10586. // detect possible CSP restriction
  10587. try {
  10588. new Function('return 1');
  10589. } catch (e) {
  10590. if (e.toString().match(/unsafe-eval|CSP/)) {
  10591. warn$$1(
  10592. 'It seems you are using the standalone build of Vue.js in an ' +
  10593. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  10594. 'The template compiler cannot work in this environment. Consider ' +
  10595. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  10596. 'templates into render functions.'
  10597. );
  10598. }
  10599. }
  10600. }
  10601. // check cache
  10602. var key = options.delimiters
  10603. ? String(options.delimiters) + template
  10604. : template;
  10605. if (cache[key]) {
  10606. return cache[key]
  10607. }
  10608. // compile
  10609. var compiled = compile(template, options);
  10610. // check compilation errors/tips
  10611. if (process.env.NODE_ENV !== 'production') {
  10612. if (compiled.errors && compiled.errors.length) {
  10613. if (options.outputSourceRange) {
  10614. compiled.errors.forEach(function (e) {
  10615. warn$$1(
  10616. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  10617. generateCodeFrame(template, e.start, e.end),
  10618. vm
  10619. );
  10620. });
  10621. } else {
  10622. warn$$1(
  10623. "Error compiling template:\n\n" + template + "\n\n" +
  10624. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  10625. vm
  10626. );
  10627. }
  10628. }
  10629. if (compiled.tips && compiled.tips.length) {
  10630. if (options.outputSourceRange) {
  10631. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  10632. } else {
  10633. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  10634. }
  10635. }
  10636. }
  10637. // turn code into functions
  10638. var res = {};
  10639. var fnGenErrors = [];
  10640. res.render = createFunction(compiled.render, fnGenErrors);
  10641. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  10642. return createFunction(code, fnGenErrors)
  10643. });
  10644. // check function generation errors.
  10645. // this should only happen if there is a bug in the compiler itself.
  10646. // mostly for codegen development use
  10647. /* istanbul ignore if */
  10648. if (process.env.NODE_ENV !== 'production') {
  10649. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  10650. warn$$1(
  10651. "Failed to generate render function:\n\n" +
  10652. fnGenErrors.map(function (ref) {
  10653. var err = ref.err;
  10654. var code = ref.code;
  10655. return ((err.toString()) + " in\n\n" + code + "\n");
  10656. }).join('\n'),
  10657. vm
  10658. );
  10659. }
  10660. }
  10661. return (cache[key] = res)
  10662. }
  10663. }
  10664. /* */
  10665. function createCompilerCreator (baseCompile) {
  10666. return function createCompiler (baseOptions) {
  10667. function compile (
  10668. template,
  10669. options
  10670. ) {
  10671. var finalOptions = Object.create(baseOptions);
  10672. var errors = [];
  10673. var tips = [];
  10674. var warn = function (msg, range, tip) {
  10675. (tip ? tips : errors).push(msg);
  10676. };
  10677. if (options) {
  10678. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  10679. // $flow-disable-line
  10680. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  10681. warn = function (msg, range, tip) {
  10682. var data = { msg: msg };
  10683. if (range) {
  10684. if (range.start != null) {
  10685. data.start = range.start + leadingSpaceLength;
  10686. }
  10687. if (range.end != null) {
  10688. data.end = range.end + leadingSpaceLength;
  10689. }
  10690. }
  10691. (tip ? tips : errors).push(data);
  10692. };
  10693. }
  10694. // merge custom modules
  10695. if (options.modules) {
  10696. finalOptions.modules =
  10697. (baseOptions.modules || []).concat(options.modules);
  10698. }
  10699. // merge custom directives
  10700. if (options.directives) {
  10701. finalOptions.directives = extend(
  10702. Object.create(baseOptions.directives || null),
  10703. options.directives
  10704. );
  10705. }
  10706. // copy other options
  10707. for (var key in options) {
  10708. if (key !== 'modules' && key !== 'directives') {
  10709. finalOptions[key] = options[key];
  10710. }
  10711. }
  10712. }
  10713. finalOptions.warn = warn;
  10714. var compiled = baseCompile(template.trim(), finalOptions);
  10715. if (process.env.NODE_ENV !== 'production') {
  10716. detectErrors(compiled.ast, warn);
  10717. }
  10718. compiled.errors = errors;
  10719. compiled.tips = tips;
  10720. return compiled
  10721. }
  10722. return {
  10723. compile: compile,
  10724. compileToFunctions: createCompileToFunctionFn(compile)
  10725. }
  10726. }
  10727. }
  10728. /* */
  10729. // `createCompilerCreator` allows creating compilers that use alternative
  10730. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  10731. // Here we just export a default compiler using the default parts.
  10732. var createCompiler = createCompilerCreator(function baseCompile (
  10733. template,
  10734. options
  10735. ) {
  10736. var ast = parse(template.trim(), options);
  10737. if (options.optimize !== false) {
  10738. optimize(ast, options);
  10739. }
  10740. var code = generate(ast, options);
  10741. return {
  10742. ast: ast,
  10743. render: code.render,
  10744. staticRenderFns: code.staticRenderFns
  10745. }
  10746. });
  10747. /* */
  10748. var ref$1 = createCompiler(baseOptions);
  10749. var compile = ref$1.compile;
  10750. var compileToFunctions = ref$1.compileToFunctions;
  10751. /* */
  10752. // check whether current browser encodes a char inside attribute values
  10753. var div;
  10754. function getShouldDecode (href) {
  10755. div = div || document.createElement('div');
  10756. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  10757. return div.innerHTML.indexOf('&#10;') > 0
  10758. }
  10759. // #3663: IE encodes newlines inside attribute values while other browsers don't
  10760. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  10761. // #6828: chrome encodes content in a[href]
  10762. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  10763. /* */
  10764. var idToTemplate = cached(function (id) {
  10765. var el = query(id);
  10766. return el && el.innerHTML
  10767. });
  10768. var mount = Vue.prototype.$mount;
  10769. Vue.prototype.$mount = function (
  10770. el,
  10771. hydrating
  10772. ) {
  10773. el = el && query(el);
  10774. /* istanbul ignore if */
  10775. if (el === document.body || el === document.documentElement) {
  10776. process.env.NODE_ENV !== 'production' && warn(
  10777. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  10778. );
  10779. return this
  10780. }
  10781. var options = this.$options;
  10782. // resolve template/el and convert to render function
  10783. if (!options.render) {
  10784. var template = options.template;
  10785. if (template) {
  10786. if (typeof template === 'string') {
  10787. if (template.charAt(0) === '#') {
  10788. template = idToTemplate(template);
  10789. /* istanbul ignore if */
  10790. if (process.env.NODE_ENV !== 'production' && !template) {
  10791. warn(
  10792. ("Template element not found or is empty: " + (options.template)),
  10793. this
  10794. );
  10795. }
  10796. }
  10797. } else if (template.nodeType) {
  10798. template = template.innerHTML;
  10799. } else {
  10800. if (process.env.NODE_ENV !== 'production') {
  10801. warn('invalid template option:' + template, this);
  10802. }
  10803. return this
  10804. }
  10805. } else if (el) {
  10806. template = getOuterHTML(el);
  10807. }
  10808. if (template) {
  10809. /* istanbul ignore if */
  10810. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  10811. mark('compile');
  10812. }
  10813. var ref = compileToFunctions(template, {
  10814. outputSourceRange: process.env.NODE_ENV !== 'production',
  10815. shouldDecodeNewlines: shouldDecodeNewlines,
  10816. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  10817. delimiters: options.delimiters,
  10818. comments: options.comments
  10819. }, this);
  10820. var render = ref.render;
  10821. var staticRenderFns = ref.staticRenderFns;
  10822. options.render = render;
  10823. options.staticRenderFns = staticRenderFns;
  10824. /* istanbul ignore if */
  10825. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  10826. mark('compile end');
  10827. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  10828. }
  10829. }
  10830. }
  10831. return mount.call(this, el, hydrating)
  10832. };
  10833. /**
  10834. * Get outerHTML of elements, taking care
  10835. * of SVG elements in IE as well.
  10836. */
  10837. function getOuterHTML (el) {
  10838. if (el.outerHTML) {
  10839. return el.outerHTML
  10840. } else {
  10841. var container = document.createElement('div');
  10842. container.appendChild(el.cloneNode(true));
  10843. return container.innerHTML
  10844. }
  10845. }
  10846. Vue.compile = compileToFunctions;
  10847. export default Vue;