Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vue.esm.js 286KB

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