vue.js 336 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014
  1. /*!
  2. * Vue.js v2.6.14
  3. * (c) 2014-2021 Evan You
  4. * Released under the MIT License.
  5. */
  6. (function (global, factory) {
  7. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  8. typeof define === 'function' && define.amd ? define(factory) :
  9. (global = global || self, global.Vue = factory());
  10. }(this, function () { 'use strict';
  11. /* */
  12. var emptyObject = Object.freeze({});
  13. // These helpers produce better VM code in JS engines due to their
  14. // explicitness and function inlining.
  15. function isUndef (v) {
  16. return v === undefined || v === null
  17. }
  18. function isDef (v) {
  19. return v !== undefined && v !== null
  20. }
  21. function isTrue (v) {
  22. return v === true
  23. }
  24. function isFalse (v) {
  25. return v === false
  26. }
  27. /**
  28. * Check if value is primitive.
  29. */
  30. function isPrimitive (value) {
  31. return (
  32. typeof value === 'string' ||
  33. typeof value === 'number' ||
  34. // $flow-disable-line
  35. typeof value === 'symbol' ||
  36. typeof value === 'boolean'
  37. )
  38. }
  39. /**
  40. * Quick object check - this is primarily used to tell
  41. * Objects from primitive values when we know the value
  42. * is a JSON-compliant type.
  43. */
  44. function isObject (obj) {
  45. return obj !== null && typeof obj === 'object'
  46. }
  47. /**
  48. * Get the raw type string of a value, e.g., [object Object].
  49. */
  50. var _toString = Object.prototype.toString;
  51. function toRawType (value) {
  52. return _toString.call(value).slice(8, -1)
  53. }
  54. /**
  55. * Strict object type check. Only returns true
  56. * for plain JavaScript objects.
  57. */
  58. function isPlainObject (obj) {
  59. return _toString.call(obj) === '[object Object]'
  60. }
  61. function isRegExp (v) {
  62. return _toString.call(v) === '[object RegExp]'
  63. }
  64. /**
  65. * Check if val is a valid array index.
  66. */
  67. function isValidArrayIndex (val) {
  68. var n = parseFloat(String(val));
  69. return n >= 0 && Math.floor(n) === n && isFinite(val)
  70. }
  71. function isPromise (val) {
  72. return (
  73. isDef(val) &&
  74. typeof val.then === 'function' &&
  75. typeof val.catch === 'function'
  76. )
  77. }
  78. /**
  79. * Convert a value to a string that is actually rendered.
  80. */
  81. function toString (val) {
  82. return val == null
  83. ? ''
  84. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  85. ? JSON.stringify(val, null, 2)
  86. : String(val)
  87. }
  88. /**
  89. * Convert an input value to a number for persistence.
  90. * If the conversion fails, return original string.
  91. */
  92. function toNumber (val) {
  93. var n = parseFloat(val);
  94. return isNaN(n) ? val : n
  95. }
  96. /**
  97. * Make a map and return a function for checking if a key
  98. * is in that map.
  99. */
  100. function makeMap (
  101. str,
  102. expectsLowerCase
  103. ) {
  104. var map = Object.create(null);
  105. var list = str.split(',');
  106. for (var i = 0; i < list.length; i++) {
  107. map[list[i]] = true;
  108. }
  109. return expectsLowerCase
  110. ? function (val) { return map[val.toLowerCase()]; }
  111. : function (val) { return map[val]; }
  112. }
  113. /**
  114. * Check if a tag is a built-in tag.
  115. */
  116. var isBuiltInTag = makeMap('slot,component', true);
  117. /**
  118. * Check if an attribute is a reserved attribute.
  119. */
  120. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  121. /**
  122. * Remove an item from an array.
  123. */
  124. function remove (arr, item) {
  125. if (arr.length) {
  126. var index = arr.indexOf(item);
  127. if (index > -1) {
  128. return arr.splice(index, 1)
  129. }
  130. }
  131. }
  132. /**
  133. * Check whether an object has the property.
  134. */
  135. var hasOwnProperty = Object.prototype.hasOwnProperty;
  136. function hasOwn (obj, key) {
  137. return hasOwnProperty.call(obj, key)
  138. }
  139. /**
  140. * Create a cached version of a pure function.
  141. */
  142. function cached (fn) {
  143. var cache = Object.create(null);
  144. return (function cachedFn (str) {
  145. var hit = cache[str];
  146. return hit || (cache[str] = fn(str))
  147. })
  148. }
  149. /**
  150. * Camelize a hyphen-delimited string.
  151. */
  152. var camelizeRE = /-(\w)/g;
  153. var camelize = cached(function (str) {
  154. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  155. });
  156. /**
  157. * Capitalize a string.
  158. */
  159. var capitalize = cached(function (str) {
  160. return str.charAt(0).toUpperCase() + str.slice(1)
  161. });
  162. /**
  163. * Hyphenate a camelCase string.
  164. */
  165. var hyphenateRE = /\B([A-Z])/g;
  166. var hyphenate = cached(function (str) {
  167. return str.replace(hyphenateRE, '-$1').toLowerCase()
  168. });
  169. /**
  170. * Simple bind polyfill for environments that do not support it,
  171. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  172. * since native bind is now performant enough in most browsers.
  173. * But removing it would mean breaking code that was able to run in
  174. * PhantomJS 1.x, so this must be kept for backward compatibility.
  175. */
  176. /* istanbul ignore next */
  177. function polyfillBind (fn, ctx) {
  178. function boundFn (a) {
  179. var l = arguments.length;
  180. return l
  181. ? l > 1
  182. ? fn.apply(ctx, arguments)
  183. : fn.call(ctx, a)
  184. : fn.call(ctx)
  185. }
  186. boundFn._length = fn.length;
  187. return boundFn
  188. }
  189. function nativeBind (fn, ctx) {
  190. return fn.bind(ctx)
  191. }
  192. var bind = Function.prototype.bind
  193. ? nativeBind
  194. : polyfillBind;
  195. /**
  196. * Convert an Array-like object to a real Array.
  197. */
  198. function toArray (list, start) {
  199. start = start || 0;
  200. var i = list.length - start;
  201. var ret = new Array(i);
  202. while (i--) {
  203. ret[i] = list[i + start];
  204. }
  205. return ret
  206. }
  207. /**
  208. * Mix properties into target object.
  209. */
  210. function extend (to, _from) {
  211. for (var key in _from) {
  212. to[key] = _from[key];
  213. }
  214. return to
  215. }
  216. /**
  217. * Merge an Array of Objects into a single Object.
  218. */
  219. function toObject (arr) {
  220. var res = {};
  221. for (var i = 0; i < arr.length; i++) {
  222. if (arr[i]) {
  223. extend(res, arr[i]);
  224. }
  225. }
  226. return res
  227. }
  228. /* eslint-disable no-unused-vars */
  229. /**
  230. * Perform no operation.
  231. * Stubbing args to make Flow happy without leaving useless transpiled code
  232. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  233. */
  234. function noop (a, b, c) {}
  235. /**
  236. * Always return false.
  237. */
  238. var no = function (a, b, c) { return false; };
  239. /* eslint-enable no-unused-vars */
  240. /**
  241. * Return the same value.
  242. */
  243. var identity = function (_) { return _; };
  244. /**
  245. * Generate a string containing static keys from compiler modules.
  246. */
  247. function genStaticKeys (modules) {
  248. return modules.reduce(function (keys, m) {
  249. return keys.concat(m.staticKeys || [])
  250. }, []).join(',')
  251. }
  252. /**
  253. * Check if two values are loosely equal - that is,
  254. * if they are plain objects, do they have the same shape?
  255. */
  256. function looseEqual (a, b) {
  257. if (a === b) { return true }
  258. var isObjectA = isObject(a);
  259. var isObjectB = isObject(b);
  260. if (isObjectA && isObjectB) {
  261. try {
  262. var isArrayA = Array.isArray(a);
  263. var isArrayB = Array.isArray(b);
  264. if (isArrayA && isArrayB) {
  265. return a.length === b.length && a.every(function (e, i) {
  266. return looseEqual(e, b[i])
  267. })
  268. } else if (a instanceof Date && b instanceof Date) {
  269. return a.getTime() === b.getTime()
  270. } else if (!isArrayA && !isArrayB) {
  271. var keysA = Object.keys(a);
  272. var keysB = Object.keys(b);
  273. return keysA.length === keysB.length && keysA.every(function (key) {
  274. return looseEqual(a[key], b[key])
  275. })
  276. } else {
  277. /* istanbul ignore next */
  278. return false
  279. }
  280. } catch (e) {
  281. /* istanbul ignore next */
  282. return false
  283. }
  284. } else if (!isObjectA && !isObjectB) {
  285. return String(a) === String(b)
  286. } else {
  287. return false
  288. }
  289. }
  290. /**
  291. * Return the first index at which a loosely equal value can be
  292. * found in the array (if value is a plain object, the array must
  293. * contain an object of the same shape), or -1 if it is not present.
  294. */
  295. function looseIndexOf (arr, val) {
  296. for (var i = 0; i < arr.length; i++) {
  297. if (looseEqual(arr[i], val)) { return i }
  298. }
  299. return -1
  300. }
  301. /**
  302. * Ensure a function is called only once.
  303. */
  304. function once (fn) {
  305. var called = false;
  306. return function () {
  307. if (!called) {
  308. called = true;
  309. fn.apply(this, arguments);
  310. }
  311. }
  312. }
  313. var SSR_ATTR = 'data-server-rendered';
  314. var ASSET_TYPES = [
  315. 'component',
  316. 'directive',
  317. 'filter'
  318. ];
  319. var LIFECYCLE_HOOKS = [
  320. 'beforeCreate',
  321. 'created',
  322. 'beforeMount',
  323. 'mounted',
  324. 'beforeUpdate',
  325. 'updated',
  326. 'beforeDestroy',
  327. 'destroyed',
  328. 'activated',
  329. 'deactivated',
  330. 'errorCaptured',
  331. 'serverPrefetch'
  332. ];
  333. /* */
  334. var config = ({
  335. /**
  336. * Option merge strategies (used in core/util/options)
  337. */
  338. // $flow-disable-line
  339. optionMergeStrategies: Object.create(null),
  340. /**
  341. * Whether to suppress warnings.
  342. */
  343. silent: false,
  344. /**
  345. * Show production mode tip message on boot?
  346. */
  347. productionTip: "development" !== 'production',
  348. /**
  349. * Whether to enable devtools
  350. */
  351. devtools: "development" !== 'production',
  352. /**
  353. * Whether to record perf
  354. */
  355. performance: false,
  356. /**
  357. * Error handler for watcher errors
  358. */
  359. errorHandler: null,
  360. /**
  361. * Warn handler for watcher warns
  362. */
  363. warnHandler: null,
  364. /**
  365. * Ignore certain custom elements
  366. */
  367. ignoredElements: [],
  368. /**
  369. * Custom user key aliases for v-on
  370. */
  371. // $flow-disable-line
  372. keyCodes: Object.create(null),
  373. /**
  374. * Check if a tag is reserved so that it cannot be registered as a
  375. * component. This is platform-dependent and may be overwritten.
  376. */
  377. isReservedTag: no,
  378. /**
  379. * Check if an attribute is reserved so that it cannot be used as a component
  380. * prop. This is platform-dependent and may be overwritten.
  381. */
  382. isReservedAttr: no,
  383. /**
  384. * Check if a tag is an unknown element.
  385. * Platform-dependent.
  386. */
  387. isUnknownElement: no,
  388. /**
  389. * Get the namespace of an element
  390. */
  391. getTagNamespace: noop,
  392. /**
  393. * Parse the real tag name for the specific platform.
  394. */
  395. parsePlatformTagName: identity,
  396. /**
  397. * Check if an attribute must be bound using property, e.g. value
  398. * Platform-dependent.
  399. */
  400. mustUseProp: no,
  401. /**
  402. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  403. * This will significantly reduce performance if set to false.
  404. */
  405. async: true,
  406. /**
  407. * Exposed for legacy reasons
  408. */
  409. _lifecycleHooks: LIFECYCLE_HOOKS
  410. });
  411. /* */
  412. /**
  413. * unicode letters used for parsing html tags, component names and property paths.
  414. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  415. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  416. */
  417. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  418. /**
  419. * Check if a string starts with $ or _
  420. */
  421. function isReserved (str) {
  422. var c = (str + '').charCodeAt(0);
  423. return c === 0x24 || c === 0x5F
  424. }
  425. /**
  426. * Define a property.
  427. */
  428. function def (obj, key, val, enumerable) {
  429. Object.defineProperty(obj, key, {
  430. value: val,
  431. enumerable: !!enumerable,
  432. writable: true,
  433. configurable: true
  434. });
  435. }
  436. /**
  437. * Parse simple path.
  438. */
  439. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  440. function parsePath (path) {
  441. if (bailRE.test(path)) {
  442. return
  443. }
  444. var segments = path.split('.');
  445. return function (obj) {
  446. for (var i = 0; i < segments.length; i++) {
  447. if (!obj) { return }
  448. obj = obj[segments[i]];
  449. }
  450. return obj
  451. }
  452. }
  453. /* */
  454. // can we use __proto__?
  455. var hasProto = '__proto__' in {};
  456. // Browser environment sniffing
  457. var inBrowser = typeof window !== 'undefined';
  458. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  459. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  460. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  461. var isIE = UA && /msie|trident/.test(UA);
  462. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  463. var isEdge = UA && UA.indexOf('edge/') > 0;
  464. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  465. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  466. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  467. var isPhantomJS = UA && /phantomjs/.test(UA);
  468. var isFF = UA && UA.match(/firefox\/(\d+)/);
  469. // Firefox has a "watch" function on Object.prototype...
  470. var nativeWatch = ({}).watch;
  471. var supportsPassive = false;
  472. if (inBrowser) {
  473. try {
  474. var opts = {};
  475. Object.defineProperty(opts, 'passive', ({
  476. get: function get () {
  477. /* istanbul ignore next */
  478. supportsPassive = true;
  479. }
  480. })); // https://github.com/facebook/flow/issues/285
  481. window.addEventListener('test-passive', null, opts);
  482. } catch (e) {}
  483. }
  484. // this needs to be lazy-evaled because vue may be required before
  485. // vue-server-renderer can set VUE_ENV
  486. var _isServer;
  487. var isServerRendering = function () {
  488. if (_isServer === undefined) {
  489. /* istanbul ignore if */
  490. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  491. // detect presence of vue-server-renderer and avoid
  492. // Webpack shimming the process
  493. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  494. } else {
  495. _isServer = false;
  496. }
  497. }
  498. return _isServer
  499. };
  500. // detect devtools
  501. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  502. /* istanbul ignore next */
  503. function isNative (Ctor) {
  504. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  505. }
  506. var hasSymbol =
  507. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  508. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  509. var _Set;
  510. /* istanbul ignore if */ // $flow-disable-line
  511. if (typeof Set !== 'undefined' && isNative(Set)) {
  512. // use native Set when available.
  513. _Set = Set;
  514. } else {
  515. // a non-standard Set polyfill that only works with primitive keys.
  516. _Set = /*@__PURE__*/(function () {
  517. function Set () {
  518. this.set = Object.create(null);
  519. }
  520. Set.prototype.has = function has (key) {
  521. return this.set[key] === true
  522. };
  523. Set.prototype.add = function add (key) {
  524. this.set[key] = true;
  525. };
  526. Set.prototype.clear = function clear () {
  527. this.set = Object.create(null);
  528. };
  529. return Set;
  530. }());
  531. }
  532. /* */
  533. var warn = noop;
  534. var tip = noop;
  535. var generateComponentTrace = (noop); // work around flow check
  536. var formatComponentName = (noop);
  537. {
  538. var hasConsole = typeof console !== 'undefined';
  539. var classifyRE = /(?:^|[-_])(\w)/g;
  540. var classify = function (str) { return str
  541. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  542. .replace(/[-_]/g, ''); };
  543. warn = function (msg, vm) {
  544. var trace = vm ? generateComponentTrace(vm) : '';
  545. if (config.warnHandler) {
  546. config.warnHandler.call(null, msg, vm, trace);
  547. } else if (hasConsole && (!config.silent)) {
  548. console.error(("[Vue warn]: " + msg + trace));
  549. }
  550. };
  551. tip = function (msg, vm) {
  552. if (hasConsole && (!config.silent)) {
  553. console.warn("[Vue tip]: " + msg + (
  554. vm ? generateComponentTrace(vm) : ''
  555. ));
  556. }
  557. };
  558. formatComponentName = function (vm, includeFile) {
  559. if (vm.$root === vm) {
  560. return '<Root>'
  561. }
  562. var options = typeof vm === 'function' && vm.cid != null
  563. ? vm.options
  564. : vm._isVue
  565. ? vm.$options || vm.constructor.options
  566. : vm;
  567. var name = options.name || options._componentTag;
  568. var file = options.__file;
  569. if (!name && file) {
  570. var match = file.match(/([^/\\]+)\.vue$/);
  571. name = match && match[1];
  572. }
  573. return (
  574. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  575. (file && includeFile !== false ? (" at " + file) : '')
  576. )
  577. };
  578. var repeat = function (str, n) {
  579. var res = '';
  580. while (n) {
  581. if (n % 2 === 1) { res += str; }
  582. if (n > 1) { str += str; }
  583. n >>= 1;
  584. }
  585. return res
  586. };
  587. generateComponentTrace = function (vm) {
  588. if (vm._isVue && vm.$parent) {
  589. var tree = [];
  590. var currentRecursiveSequence = 0;
  591. while (vm) {
  592. if (tree.length > 0) {
  593. var last = tree[tree.length - 1];
  594. if (last.constructor === vm.constructor) {
  595. currentRecursiveSequence++;
  596. vm = vm.$parent;
  597. continue
  598. } else if (currentRecursiveSequence > 0) {
  599. tree[tree.length - 1] = [last, currentRecursiveSequence];
  600. currentRecursiveSequence = 0;
  601. }
  602. }
  603. tree.push(vm);
  604. vm = vm.$parent;
  605. }
  606. return '\n\nfound in\n\n' + tree
  607. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  608. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  609. : formatComponentName(vm))); })
  610. .join('\n')
  611. } else {
  612. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  613. }
  614. };
  615. }
  616. /* */
  617. var uid = 0;
  618. /**
  619. * A dep is an observable that can have multiple
  620. * directives subscribing to it.
  621. */
  622. var Dep = function Dep () {
  623. this.id = uid++;
  624. this.subs = [];
  625. };
  626. Dep.prototype.addSub = function addSub (sub) {
  627. this.subs.push(sub);
  628. };
  629. Dep.prototype.removeSub = function removeSub (sub) {
  630. remove(this.subs, sub);
  631. };
  632. Dep.prototype.depend = function depend () {
  633. if (Dep.target) {
  634. Dep.target.addDep(this);
  635. }
  636. };
  637. Dep.prototype.notify = function notify () {
  638. // stabilize the subscriber list first
  639. var subs = this.subs.slice();
  640. if (!config.async) {
  641. // subs aren't sorted in scheduler if not running async
  642. // we need to sort them now to make sure they fire in correct
  643. // order
  644. subs.sort(function (a, b) { return a.id - b.id; });
  645. }
  646. for (var i = 0, l = subs.length; i < l; i++) {
  647. subs[i].update();
  648. }
  649. };
  650. // The current target watcher being evaluated.
  651. // This is globally unique because only one watcher
  652. // can be evaluated at a time.
  653. Dep.target = null;
  654. var targetStack = [];
  655. function pushTarget (target) {
  656. targetStack.push(target);
  657. Dep.target = target;
  658. }
  659. function popTarget () {
  660. targetStack.pop();
  661. Dep.target = targetStack[targetStack.length - 1];
  662. }
  663. /* */
  664. var VNode = function VNode (
  665. tag,
  666. data,
  667. children,
  668. text,
  669. elm,
  670. context,
  671. componentOptions,
  672. asyncFactory
  673. ) {
  674. this.tag = tag;
  675. this.data = data;
  676. this.children = children;
  677. this.text = text;
  678. this.elm = elm;
  679. this.ns = undefined;
  680. this.context = context;
  681. this.fnContext = undefined;
  682. this.fnOptions = undefined;
  683. this.fnScopeId = undefined;
  684. this.key = data && data.key;
  685. this.componentOptions = componentOptions;
  686. this.componentInstance = undefined;
  687. this.parent = undefined;
  688. this.raw = false;
  689. this.isStatic = false;
  690. this.isRootInsert = true;
  691. this.isComment = false;
  692. this.isCloned = false;
  693. this.isOnce = false;
  694. this.asyncFactory = asyncFactory;
  695. this.asyncMeta = undefined;
  696. this.isAsyncPlaceholder = false;
  697. };
  698. var prototypeAccessors = { child: { configurable: true } };
  699. // DEPRECATED: alias for componentInstance for backwards compat.
  700. /* istanbul ignore next */
  701. prototypeAccessors.child.get = function () {
  702. return this.componentInstance
  703. };
  704. Object.defineProperties( VNode.prototype, prototypeAccessors );
  705. var createEmptyVNode = function (text) {
  706. if ( text === void 0 ) text = '';
  707. var node = new VNode();
  708. node.text = text;
  709. node.isComment = true;
  710. return node
  711. };
  712. function createTextVNode (val) {
  713. return new VNode(undefined, undefined, undefined, String(val))
  714. }
  715. // optimized shallow clone
  716. // used for static nodes and slot nodes because they may be reused across
  717. // multiple renders, cloning them avoids errors when DOM manipulations rely
  718. // on their elm reference.
  719. function cloneVNode (vnode) {
  720. var cloned = new VNode(
  721. vnode.tag,
  722. vnode.data,
  723. // #7975
  724. // clone children array to avoid mutating original in case of cloning
  725. // a child.
  726. vnode.children && vnode.children.slice(),
  727. vnode.text,
  728. vnode.elm,
  729. vnode.context,
  730. vnode.componentOptions,
  731. vnode.asyncFactory
  732. );
  733. cloned.ns = vnode.ns;
  734. cloned.isStatic = vnode.isStatic;
  735. cloned.key = vnode.key;
  736. cloned.isComment = vnode.isComment;
  737. cloned.fnContext = vnode.fnContext;
  738. cloned.fnOptions = vnode.fnOptions;
  739. cloned.fnScopeId = vnode.fnScopeId;
  740. cloned.asyncMeta = vnode.asyncMeta;
  741. cloned.isCloned = true;
  742. return cloned
  743. }
  744. /*
  745. * not type checking this file because flow doesn't play well with
  746. * dynamically accessing methods on Array prototype
  747. */
  748. var arrayProto = Array.prototype;
  749. var arrayMethods = Object.create(arrayProto);
  750. var methodsToPatch = [
  751. 'push',
  752. 'pop',
  753. 'shift',
  754. 'unshift',
  755. 'splice',
  756. 'sort',
  757. 'reverse'
  758. ];
  759. /**
  760. * Intercept mutating methods and emit events
  761. */
  762. methodsToPatch.forEach(function (method) {
  763. // cache original method
  764. var original = arrayProto[method];
  765. def(arrayMethods, method, function mutator () {
  766. var args = [], len = arguments.length;
  767. while ( len-- ) args[ len ] = arguments[ len ];
  768. var result = original.apply(this, args);
  769. var ob = this.__ob__;
  770. var inserted;
  771. switch (method) {
  772. case 'push':
  773. case 'unshift':
  774. inserted = args;
  775. break
  776. case 'splice':
  777. inserted = args.slice(2);
  778. break
  779. }
  780. if (inserted) { ob.observeArray(inserted); }
  781. // notify change
  782. ob.dep.notify();
  783. return result
  784. });
  785. });
  786. /* */
  787. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  788. /**
  789. * In some cases we may want to disable observation inside a component's
  790. * update computation.
  791. */
  792. var shouldObserve = true;
  793. function toggleObserving (value) {
  794. shouldObserve = value;
  795. }
  796. /**
  797. * Observer class that is attached to each observed
  798. * object. Once attached, the observer converts the target
  799. * object's property keys into getter/setters that
  800. * collect dependencies and dispatch updates.
  801. */
  802. var Observer = function Observer (value) {
  803. this.value = value;
  804. this.dep = new Dep();
  805. this.vmCount = 0;
  806. def(value, '__ob__', this);
  807. if (Array.isArray(value)) {
  808. if (hasProto) {
  809. protoAugment(value, arrayMethods);
  810. } else {
  811. copyAugment(value, arrayMethods, arrayKeys);
  812. }
  813. this.observeArray(value);
  814. } else {
  815. this.walk(value);
  816. }
  817. };
  818. /**
  819. * Walk through all properties and convert them into
  820. * getter/setters. This method should only be called when
  821. * value type is Object.
  822. */
  823. Observer.prototype.walk = function walk (obj) {
  824. var keys = Object.keys(obj);
  825. for (var i = 0; i < keys.length; i++) {
  826. defineReactive$$1(obj, keys[i]);
  827. }
  828. };
  829. /**
  830. * Observe a list of Array items.
  831. */
  832. Observer.prototype.observeArray = function observeArray (items) {
  833. for (var i = 0, l = items.length; i < l; i++) {
  834. observe(items[i]);
  835. }
  836. };
  837. // helpers
  838. /**
  839. * Augment a target Object or Array by intercepting
  840. * the prototype chain using __proto__
  841. */
  842. function protoAugment (target, src) {
  843. /* eslint-disable no-proto */
  844. target.__proto__ = src;
  845. /* eslint-enable no-proto */
  846. }
  847. /**
  848. * Augment a target Object or Array by defining
  849. * hidden properties.
  850. */
  851. /* istanbul ignore next */
  852. function copyAugment (target, src, keys) {
  853. for (var i = 0, l = keys.length; i < l; i++) {
  854. var key = keys[i];
  855. def(target, key, src[key]);
  856. }
  857. }
  858. /**
  859. * Attempt to create an observer instance for a value,
  860. * returns the new observer if successfully observed,
  861. * or the existing observer if the value already has one.
  862. */
  863. function observe (value, asRootData) {
  864. if (!isObject(value) || value instanceof VNode) {
  865. return
  866. }
  867. var ob;
  868. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  869. ob = value.__ob__;
  870. } else if (
  871. shouldObserve &&
  872. !isServerRendering() &&
  873. (Array.isArray(value) || isPlainObject(value)) &&
  874. Object.isExtensible(value) &&
  875. !value._isVue
  876. ) {
  877. ob = new Observer(value);
  878. }
  879. if (asRootData && ob) {
  880. ob.vmCount++;
  881. }
  882. return ob
  883. }
  884. /**
  885. * Define a reactive property on an Object.
  886. */
  887. function defineReactive$$1 (
  888. obj,
  889. key,
  890. val,
  891. customSetter,
  892. shallow
  893. ) {
  894. var dep = new Dep();
  895. var property = Object.getOwnPropertyDescriptor(obj, key);
  896. if (property && property.configurable === false) {
  897. return
  898. }
  899. // cater for pre-defined getter/setters
  900. var getter = property && property.get;
  901. var setter = property && property.set;
  902. if ((!getter || setter) && arguments.length === 2) {
  903. val = obj[key];
  904. }
  905. var childOb = !shallow && observe(val);
  906. Object.defineProperty(obj, key, {
  907. enumerable: true,
  908. configurable: true,
  909. get: function reactiveGetter () {
  910. var value = getter ? getter.call(obj) : val;
  911. if (Dep.target) {
  912. dep.depend();
  913. if (childOb) {
  914. childOb.dep.depend();
  915. if (Array.isArray(value)) {
  916. dependArray(value);
  917. }
  918. }
  919. }
  920. return value
  921. },
  922. set: function reactiveSetter (newVal) {
  923. var value = getter ? getter.call(obj) : val;
  924. /* eslint-disable no-self-compare */
  925. if (newVal === value || (newVal !== newVal && value !== value)) {
  926. return
  927. }
  928. /* eslint-enable no-self-compare */
  929. if (customSetter) {
  930. customSetter();
  931. }
  932. // #7981: for accessor properties without setter
  933. if (getter && !setter) { return }
  934. if (setter) {
  935. setter.call(obj, newVal);
  936. } else {
  937. val = newVal;
  938. }
  939. childOb = !shallow && observe(newVal);
  940. dep.notify();
  941. }
  942. });
  943. }
  944. /**
  945. * Set a property on an object. Adds the new property and
  946. * triggers change notification if the property doesn't
  947. * already exist.
  948. */
  949. function set (target, key, val) {
  950. if (isUndef(target) || isPrimitive(target)
  951. ) {
  952. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  953. }
  954. if (Array.isArray(target) && isValidArrayIndex(key)) {
  955. target.length = Math.max(target.length, key);
  956. target.splice(key, 1, val);
  957. return val
  958. }
  959. if (key in target && !(key in Object.prototype)) {
  960. target[key] = val;
  961. return val
  962. }
  963. var ob = (target).__ob__;
  964. if (target._isVue || (ob && ob.vmCount)) {
  965. warn(
  966. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  967. 'at runtime - declare it upfront in the data option.'
  968. );
  969. return val
  970. }
  971. if (!ob) {
  972. target[key] = val;
  973. return val
  974. }
  975. defineReactive$$1(ob.value, key, val);
  976. ob.dep.notify();
  977. return val
  978. }
  979. /**
  980. * Delete a property and trigger change if necessary.
  981. */
  982. function del (target, key) {
  983. if (isUndef(target) || isPrimitive(target)
  984. ) {
  985. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  986. }
  987. if (Array.isArray(target) && isValidArrayIndex(key)) {
  988. target.splice(key, 1);
  989. return
  990. }
  991. var ob = (target).__ob__;
  992. if (target._isVue || (ob && ob.vmCount)) {
  993. warn(
  994. 'Avoid deleting properties on a Vue instance or its root $data ' +
  995. '- just set it to null.'
  996. );
  997. return
  998. }
  999. if (!hasOwn(target, key)) {
  1000. return
  1001. }
  1002. delete target[key];
  1003. if (!ob) {
  1004. return
  1005. }
  1006. ob.dep.notify();
  1007. }
  1008. /**
  1009. * Collect dependencies on array elements when the array is touched, since
  1010. * we cannot intercept array element access like property getters.
  1011. */
  1012. function dependArray (value) {
  1013. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  1014. e = value[i];
  1015. e && e.__ob__ && e.__ob__.dep.depend();
  1016. if (Array.isArray(e)) {
  1017. dependArray(e);
  1018. }
  1019. }
  1020. }
  1021. /* */
  1022. /**
  1023. * Option overwriting strategies are functions that handle
  1024. * how to merge a parent option value and a child option
  1025. * value into the final value.
  1026. */
  1027. var strats = config.optionMergeStrategies;
  1028. /**
  1029. * Options with restrictions
  1030. */
  1031. {
  1032. strats.el = strats.propsData = function (parent, child, vm, key) {
  1033. if (!vm) {
  1034. warn(
  1035. "option \"" + key + "\" can only be used during instance " +
  1036. 'creation with the `new` keyword.'
  1037. );
  1038. }
  1039. return defaultStrat(parent, child)
  1040. };
  1041. }
  1042. /**
  1043. * Helper that recursively merges two data objects together.
  1044. */
  1045. function mergeData (to, from) {
  1046. if (!from) { return to }
  1047. var key, toVal, fromVal;
  1048. var keys = hasSymbol
  1049. ? Reflect.ownKeys(from)
  1050. : Object.keys(from);
  1051. for (var i = 0; i < keys.length; i++) {
  1052. key = keys[i];
  1053. // in case the object is already observed...
  1054. if (key === '__ob__') { continue }
  1055. toVal = to[key];
  1056. fromVal = from[key];
  1057. if (!hasOwn(to, key)) {
  1058. set(to, key, fromVal);
  1059. } else if (
  1060. toVal !== fromVal &&
  1061. isPlainObject(toVal) &&
  1062. isPlainObject(fromVal)
  1063. ) {
  1064. mergeData(toVal, fromVal);
  1065. }
  1066. }
  1067. return to
  1068. }
  1069. /**
  1070. * Data
  1071. */
  1072. function mergeDataOrFn (
  1073. parentVal,
  1074. childVal,
  1075. vm
  1076. ) {
  1077. if (!vm) {
  1078. // in a Vue.extend merge, both should be functions
  1079. if (!childVal) {
  1080. return parentVal
  1081. }
  1082. if (!parentVal) {
  1083. return childVal
  1084. }
  1085. // when parentVal & childVal are both present,
  1086. // we need to return a function that returns the
  1087. // merged result of both functions... no need to
  1088. // check if parentVal is a function here because
  1089. // it has to be a function to pass previous merges.
  1090. return function mergedDataFn () {
  1091. return mergeData(
  1092. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  1093. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  1094. )
  1095. }
  1096. } else {
  1097. return function mergedInstanceDataFn () {
  1098. // instance merge
  1099. var instanceData = typeof childVal === 'function'
  1100. ? childVal.call(vm, vm)
  1101. : childVal;
  1102. var defaultData = typeof parentVal === 'function'
  1103. ? parentVal.call(vm, vm)
  1104. : parentVal;
  1105. if (instanceData) {
  1106. return mergeData(instanceData, defaultData)
  1107. } else {
  1108. return defaultData
  1109. }
  1110. }
  1111. }
  1112. }
  1113. strats.data = function (
  1114. parentVal,
  1115. childVal,
  1116. vm
  1117. ) {
  1118. if (!vm) {
  1119. if (childVal && typeof childVal !== 'function') {
  1120. warn(
  1121. 'The "data" option should be a function ' +
  1122. 'that returns a per-instance value in component ' +
  1123. 'definitions.',
  1124. vm
  1125. );
  1126. return parentVal
  1127. }
  1128. return mergeDataOrFn(parentVal, childVal)
  1129. }
  1130. return mergeDataOrFn(parentVal, childVal, vm)
  1131. };
  1132. /**
  1133. * Hooks and props are merged as arrays.
  1134. */
  1135. function mergeHook (
  1136. parentVal,
  1137. childVal
  1138. ) {
  1139. var res = childVal
  1140. ? parentVal
  1141. ? parentVal.concat(childVal)
  1142. : Array.isArray(childVal)
  1143. ? childVal
  1144. : [childVal]
  1145. : parentVal;
  1146. return res
  1147. ? dedupeHooks(res)
  1148. : res
  1149. }
  1150. function dedupeHooks (hooks) {
  1151. var res = [];
  1152. for (var i = 0; i < hooks.length; i++) {
  1153. if (res.indexOf(hooks[i]) === -1) {
  1154. res.push(hooks[i]);
  1155. }
  1156. }
  1157. return res
  1158. }
  1159. LIFECYCLE_HOOKS.forEach(function (hook) {
  1160. strats[hook] = mergeHook;
  1161. });
  1162. /**
  1163. * Assets
  1164. *
  1165. * When a vm is present (instance creation), we need to do
  1166. * a three-way merge between constructor options, instance
  1167. * options and parent options.
  1168. */
  1169. function mergeAssets (
  1170. parentVal,
  1171. childVal,
  1172. vm,
  1173. key
  1174. ) {
  1175. var res = Object.create(parentVal || null);
  1176. if (childVal) {
  1177. assertObjectType(key, childVal, vm);
  1178. return extend(res, childVal)
  1179. } else {
  1180. return res
  1181. }
  1182. }
  1183. ASSET_TYPES.forEach(function (type) {
  1184. strats[type + 's'] = mergeAssets;
  1185. });
  1186. /**
  1187. * Watchers.
  1188. *
  1189. * Watchers hashes should not overwrite one
  1190. * another, so we merge them as arrays.
  1191. */
  1192. strats.watch = function (
  1193. parentVal,
  1194. childVal,
  1195. vm,
  1196. key
  1197. ) {
  1198. // work around Firefox's Object.prototype.watch...
  1199. if (parentVal === nativeWatch) { parentVal = undefined; }
  1200. if (childVal === nativeWatch) { childVal = undefined; }
  1201. /* istanbul ignore if */
  1202. if (!childVal) { return Object.create(parentVal || null) }
  1203. {
  1204. assertObjectType(key, childVal, vm);
  1205. }
  1206. if (!parentVal) { return childVal }
  1207. var ret = {};
  1208. extend(ret, parentVal);
  1209. for (var key$1 in childVal) {
  1210. var parent = ret[key$1];
  1211. var child = childVal[key$1];
  1212. if (parent && !Array.isArray(parent)) {
  1213. parent = [parent];
  1214. }
  1215. ret[key$1] = parent
  1216. ? parent.concat(child)
  1217. : Array.isArray(child) ? child : [child];
  1218. }
  1219. return ret
  1220. };
  1221. /**
  1222. * Other object hashes.
  1223. */
  1224. strats.props =
  1225. strats.methods =
  1226. strats.inject =
  1227. strats.computed = function (
  1228. parentVal,
  1229. childVal,
  1230. vm,
  1231. key
  1232. ) {
  1233. if (childVal && "development" !== 'production') {
  1234. assertObjectType(key, childVal, vm);
  1235. }
  1236. if (!parentVal) { return childVal }
  1237. var ret = Object.create(null);
  1238. extend(ret, parentVal);
  1239. if (childVal) { extend(ret, childVal); }
  1240. return ret
  1241. };
  1242. strats.provide = mergeDataOrFn;
  1243. /**
  1244. * Default strategy.
  1245. */
  1246. var defaultStrat = function (parentVal, childVal) {
  1247. return childVal === undefined
  1248. ? parentVal
  1249. : childVal
  1250. };
  1251. /**
  1252. * Validate component names
  1253. */
  1254. function checkComponents (options) {
  1255. for (var key in options.components) {
  1256. validateComponentName(key);
  1257. }
  1258. }
  1259. function validateComponentName (name) {
  1260. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  1261. warn(
  1262. 'Invalid component name: "' + name + '". Component names ' +
  1263. 'should conform to valid custom element name in html5 specification.'
  1264. );
  1265. }
  1266. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  1267. warn(
  1268. 'Do not use built-in or reserved HTML elements as component ' +
  1269. 'id: ' + name
  1270. );
  1271. }
  1272. }
  1273. /**
  1274. * Ensure all props option syntax are normalized into the
  1275. * Object-based format.
  1276. */
  1277. function normalizeProps (options, vm) {
  1278. var props = options.props;
  1279. if (!props) { return }
  1280. var res = {};
  1281. var i, val, name;
  1282. if (Array.isArray(props)) {
  1283. i = props.length;
  1284. while (i--) {
  1285. val = props[i];
  1286. if (typeof val === 'string') {
  1287. name = camelize(val);
  1288. res[name] = { type: null };
  1289. } else {
  1290. warn('props must be strings when using array syntax.');
  1291. }
  1292. }
  1293. } else if (isPlainObject(props)) {
  1294. for (var key in props) {
  1295. val = props[key];
  1296. name = camelize(key);
  1297. res[name] = isPlainObject(val)
  1298. ? val
  1299. : { type: val };
  1300. }
  1301. } else {
  1302. warn(
  1303. "Invalid value for option \"props\": expected an Array or an Object, " +
  1304. "but got " + (toRawType(props)) + ".",
  1305. vm
  1306. );
  1307. }
  1308. options.props = res;
  1309. }
  1310. /**
  1311. * Normalize all injections into Object-based format
  1312. */
  1313. function normalizeInject (options, vm) {
  1314. var inject = options.inject;
  1315. if (!inject) { return }
  1316. var normalized = options.inject = {};
  1317. if (Array.isArray(inject)) {
  1318. for (var i = 0; i < inject.length; i++) {
  1319. normalized[inject[i]] = { from: inject[i] };
  1320. }
  1321. } else if (isPlainObject(inject)) {
  1322. for (var key in inject) {
  1323. var val = inject[key];
  1324. normalized[key] = isPlainObject(val)
  1325. ? extend({ from: key }, val)
  1326. : { from: val };
  1327. }
  1328. } else {
  1329. warn(
  1330. "Invalid value for option \"inject\": expected an Array or an Object, " +
  1331. "but got " + (toRawType(inject)) + ".",
  1332. vm
  1333. );
  1334. }
  1335. }
  1336. /**
  1337. * Normalize raw function directives into object format.
  1338. */
  1339. function normalizeDirectives (options) {
  1340. var dirs = options.directives;
  1341. if (dirs) {
  1342. for (var key in dirs) {
  1343. var def$$1 = dirs[key];
  1344. if (typeof def$$1 === 'function') {
  1345. dirs[key] = { bind: def$$1, update: def$$1 };
  1346. }
  1347. }
  1348. }
  1349. }
  1350. function assertObjectType (name, value, vm) {
  1351. if (!isPlainObject(value)) {
  1352. warn(
  1353. "Invalid value for option \"" + name + "\": expected an Object, " +
  1354. "but got " + (toRawType(value)) + ".",
  1355. vm
  1356. );
  1357. }
  1358. }
  1359. /**
  1360. * Merge two option objects into a new one.
  1361. * Core utility used in both instantiation and inheritance.
  1362. */
  1363. function mergeOptions (
  1364. parent,
  1365. child,
  1366. vm
  1367. ) {
  1368. {
  1369. checkComponents(child);
  1370. }
  1371. if (typeof child === 'function') {
  1372. child = child.options;
  1373. }
  1374. normalizeProps(child, vm);
  1375. normalizeInject(child, vm);
  1376. normalizeDirectives(child);
  1377. // Apply extends and mixins on the child options,
  1378. // but only if it is a raw options object that isn't
  1379. // the result of another mergeOptions call.
  1380. // Only merged options has the _base property.
  1381. if (!child._base) {
  1382. if (child.extends) {
  1383. parent = mergeOptions(parent, child.extends, vm);
  1384. }
  1385. if (child.mixins) {
  1386. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1387. parent = mergeOptions(parent, child.mixins[i], vm);
  1388. }
  1389. }
  1390. }
  1391. var options = {};
  1392. var key;
  1393. for (key in parent) {
  1394. mergeField(key);
  1395. }
  1396. for (key in child) {
  1397. if (!hasOwn(parent, key)) {
  1398. mergeField(key);
  1399. }
  1400. }
  1401. function mergeField (key) {
  1402. var strat = strats[key] || defaultStrat;
  1403. options[key] = strat(parent[key], child[key], vm, key);
  1404. }
  1405. return options
  1406. }
  1407. /**
  1408. * Resolve an asset.
  1409. * This function is used because child instances need access
  1410. * to assets defined in its ancestor chain.
  1411. */
  1412. function resolveAsset (
  1413. options,
  1414. type,
  1415. id,
  1416. warnMissing
  1417. ) {
  1418. /* istanbul ignore if */
  1419. if (typeof id !== 'string') {
  1420. return
  1421. }
  1422. var assets = options[type];
  1423. // check local registration variations first
  1424. if (hasOwn(assets, id)) { return assets[id] }
  1425. var camelizedId = camelize(id);
  1426. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  1427. var PascalCaseId = capitalize(camelizedId);
  1428. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  1429. // fallback to prototype chain
  1430. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  1431. if (warnMissing && !res) {
  1432. warn(
  1433. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  1434. options
  1435. );
  1436. }
  1437. return res
  1438. }
  1439. /* */
  1440. function validateProp (
  1441. key,
  1442. propOptions,
  1443. propsData,
  1444. vm
  1445. ) {
  1446. var prop = propOptions[key];
  1447. var absent = !hasOwn(propsData, key);
  1448. var value = propsData[key];
  1449. // boolean casting
  1450. var booleanIndex = getTypeIndex(Boolean, prop.type);
  1451. if (booleanIndex > -1) {
  1452. if (absent && !hasOwn(prop, 'default')) {
  1453. value = false;
  1454. } else if (value === '' || value === hyphenate(key)) {
  1455. // only cast empty string / same name to boolean if
  1456. // boolean has higher priority
  1457. var stringIndex = getTypeIndex(String, prop.type);
  1458. if (stringIndex < 0 || booleanIndex < stringIndex) {
  1459. value = true;
  1460. }
  1461. }
  1462. }
  1463. // check default value
  1464. if (value === undefined) {
  1465. value = getPropDefaultValue(vm, prop, key);
  1466. // since the default value is a fresh copy,
  1467. // make sure to observe it.
  1468. var prevShouldObserve = shouldObserve;
  1469. toggleObserving(true);
  1470. observe(value);
  1471. toggleObserving(prevShouldObserve);
  1472. }
  1473. {
  1474. assertProp(prop, key, value, vm, absent);
  1475. }
  1476. return value
  1477. }
  1478. /**
  1479. * Get the default value of a prop.
  1480. */
  1481. function getPropDefaultValue (vm, prop, key) {
  1482. // no default, return undefined
  1483. if (!hasOwn(prop, 'default')) {
  1484. return undefined
  1485. }
  1486. var def = prop.default;
  1487. // warn against non-factory defaults for Object & Array
  1488. if (isObject(def)) {
  1489. warn(
  1490. 'Invalid default value for prop "' + key + '": ' +
  1491. 'Props with type Object/Array must use a factory function ' +
  1492. 'to return the default value.',
  1493. vm
  1494. );
  1495. }
  1496. // the raw prop value was also undefined from previous render,
  1497. // return previous default value to avoid unnecessary watcher trigger
  1498. if (vm && vm.$options.propsData &&
  1499. vm.$options.propsData[key] === undefined &&
  1500. vm._props[key] !== undefined
  1501. ) {
  1502. return vm._props[key]
  1503. }
  1504. // call factory function for non-Function types
  1505. // a value is Function if its prototype is function even across different execution context
  1506. return typeof def === 'function' && getType(prop.type) !== 'Function'
  1507. ? def.call(vm)
  1508. : def
  1509. }
  1510. /**
  1511. * Assert whether a prop is valid.
  1512. */
  1513. function assertProp (
  1514. prop,
  1515. name,
  1516. value,
  1517. vm,
  1518. absent
  1519. ) {
  1520. if (prop.required && absent) {
  1521. warn(
  1522. 'Missing required prop: "' + name + '"',
  1523. vm
  1524. );
  1525. return
  1526. }
  1527. if (value == null && !prop.required) {
  1528. return
  1529. }
  1530. var type = prop.type;
  1531. var valid = !type || type === true;
  1532. var expectedTypes = [];
  1533. if (type) {
  1534. if (!Array.isArray(type)) {
  1535. type = [type];
  1536. }
  1537. for (var i = 0; i < type.length && !valid; i++) {
  1538. var assertedType = assertType(value, type[i], vm);
  1539. expectedTypes.push(assertedType.expectedType || '');
  1540. valid = assertedType.valid;
  1541. }
  1542. }
  1543. var haveExpectedTypes = expectedTypes.some(function (t) { return t; });
  1544. if (!valid && haveExpectedTypes) {
  1545. warn(
  1546. getInvalidTypeMessage(name, value, expectedTypes),
  1547. vm
  1548. );
  1549. return
  1550. }
  1551. var validator = prop.validator;
  1552. if (validator) {
  1553. if (!validator(value)) {
  1554. warn(
  1555. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  1556. vm
  1557. );
  1558. }
  1559. }
  1560. }
  1561. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/;
  1562. function assertType (value, type, vm) {
  1563. var valid;
  1564. var expectedType = getType(type);
  1565. if (simpleCheckRE.test(expectedType)) {
  1566. var t = typeof value;
  1567. valid = t === expectedType.toLowerCase();
  1568. // for primitive wrapper objects
  1569. if (!valid && t === 'object') {
  1570. valid = value instanceof type;
  1571. }
  1572. } else if (expectedType === 'Object') {
  1573. valid = isPlainObject(value);
  1574. } else if (expectedType === 'Array') {
  1575. valid = Array.isArray(value);
  1576. } else {
  1577. try {
  1578. valid = value instanceof type;
  1579. } catch (e) {
  1580. warn('Invalid prop type: "' + String(type) + '" is not a constructor', vm);
  1581. valid = false;
  1582. }
  1583. }
  1584. return {
  1585. valid: valid,
  1586. expectedType: expectedType
  1587. }
  1588. }
  1589. var functionTypeCheckRE = /^\s*function (\w+)/;
  1590. /**
  1591. * Use function string name to check built-in types,
  1592. * because a simple equality check will fail when running
  1593. * across different vms / iframes.
  1594. */
  1595. function getType (fn) {
  1596. var match = fn && fn.toString().match(functionTypeCheckRE);
  1597. return match ? match[1] : ''
  1598. }
  1599. function isSameType (a, b) {
  1600. return getType(a) === getType(b)
  1601. }
  1602. function getTypeIndex (type, expectedTypes) {
  1603. if (!Array.isArray(expectedTypes)) {
  1604. return isSameType(expectedTypes, type) ? 0 : -1
  1605. }
  1606. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  1607. if (isSameType(expectedTypes[i], type)) {
  1608. return i
  1609. }
  1610. }
  1611. return -1
  1612. }
  1613. function getInvalidTypeMessage (name, value, expectedTypes) {
  1614. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  1615. " Expected " + (expectedTypes.map(capitalize).join(', '));
  1616. var expectedType = expectedTypes[0];
  1617. var receivedType = toRawType(value);
  1618. // check if we need to specify expected value
  1619. if (
  1620. expectedTypes.length === 1 &&
  1621. isExplicable(expectedType) &&
  1622. isExplicable(typeof value) &&
  1623. !isBoolean(expectedType, receivedType)
  1624. ) {
  1625. message += " with value " + (styleValue(value, expectedType));
  1626. }
  1627. message += ", got " + receivedType + " ";
  1628. // check if we need to specify received value
  1629. if (isExplicable(receivedType)) {
  1630. message += "with value " + (styleValue(value, receivedType)) + ".";
  1631. }
  1632. return message
  1633. }
  1634. function styleValue (value, type) {
  1635. if (type === 'String') {
  1636. return ("\"" + value + "\"")
  1637. } else if (type === 'Number') {
  1638. return ("" + (Number(value)))
  1639. } else {
  1640. return ("" + value)
  1641. }
  1642. }
  1643. var EXPLICABLE_TYPES = ['string', 'number', 'boolean'];
  1644. function isExplicable (value) {
  1645. return EXPLICABLE_TYPES.some(function (elem) { return value.toLowerCase() === elem; })
  1646. }
  1647. function isBoolean () {
  1648. var args = [], len = arguments.length;
  1649. while ( len-- ) args[ len ] = arguments[ len ];
  1650. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  1651. }
  1652. /* */
  1653. function handleError (err, vm, info) {
  1654. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  1655. // See: https://github.com/vuejs/vuex/issues/1505
  1656. pushTarget();
  1657. try {
  1658. if (vm) {
  1659. var cur = vm;
  1660. while ((cur = cur.$parent)) {
  1661. var hooks = cur.$options.errorCaptured;
  1662. if (hooks) {
  1663. for (var i = 0; i < hooks.length; i++) {
  1664. try {
  1665. var capture = hooks[i].call(cur, err, vm, info) === false;
  1666. if (capture) { return }
  1667. } catch (e) {
  1668. globalHandleError(e, cur, 'errorCaptured hook');
  1669. }
  1670. }
  1671. }
  1672. }
  1673. }
  1674. globalHandleError(err, vm, info);
  1675. } finally {
  1676. popTarget();
  1677. }
  1678. }
  1679. function invokeWithErrorHandling (
  1680. handler,
  1681. context,
  1682. args,
  1683. vm,
  1684. info
  1685. ) {
  1686. var res;
  1687. try {
  1688. res = args ? handler.apply(context, args) : handler.call(context);
  1689. if (res && !res._isVue && isPromise(res) && !res._handled) {
  1690. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  1691. // issue #9511
  1692. // avoid catch triggering multiple times when nested calls
  1693. res._handled = true;
  1694. }
  1695. } catch (e) {
  1696. handleError(e, vm, info);
  1697. }
  1698. return res
  1699. }
  1700. function globalHandleError (err, vm, info) {
  1701. if (config.errorHandler) {
  1702. try {
  1703. return config.errorHandler.call(null, err, vm, info)
  1704. } catch (e) {
  1705. // if the user intentionally throws the original error in the handler,
  1706. // do not log it twice
  1707. if (e !== err) {
  1708. logError(e, null, 'config.errorHandler');
  1709. }
  1710. }
  1711. }
  1712. logError(err, vm, info);
  1713. }
  1714. function logError (err, vm, info) {
  1715. {
  1716. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  1717. }
  1718. /* istanbul ignore else */
  1719. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  1720. console.error(err);
  1721. } else {
  1722. throw err
  1723. }
  1724. }
  1725. /* */
  1726. var isUsingMicroTask = false;
  1727. var callbacks = [];
  1728. var pending = false;
  1729. function flushCallbacks () {
  1730. pending = false;
  1731. var copies = callbacks.slice(0);
  1732. callbacks.length = 0;
  1733. for (var i = 0; i < copies.length; i++) {
  1734. copies[i]();
  1735. }
  1736. }
  1737. // Here we have async deferring wrappers using microtasks.
  1738. // In 2.5 we used (macro) tasks (in combination with microtasks).
  1739. // However, it has subtle problems when state is changed right before repaint
  1740. // (e.g. #6813, out-in transitions).
  1741. // Also, using (macro) tasks in event handler would cause some weird behaviors
  1742. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  1743. // So we now use microtasks everywhere, again.
  1744. // A major drawback of this tradeoff is that there are some scenarios
  1745. // where microtasks have too high a priority and fire in between supposedly
  1746. // sequential events (e.g. #4521, #6690, which have workarounds)
  1747. // or even between bubbling of the same event (#6566).
  1748. var timerFunc;
  1749. // The nextTick behavior leverages the microtask queue, which can be accessed
  1750. // via either native Promise.then or MutationObserver.
  1751. // MutationObserver has wider support, however it is seriously bugged in
  1752. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  1753. // completely stops working after triggering a few times... so, if native
  1754. // Promise is available, we will use it:
  1755. /* istanbul ignore next, $flow-disable-line */
  1756. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  1757. var p = Promise.resolve();
  1758. timerFunc = function () {
  1759. p.then(flushCallbacks);
  1760. // In problematic UIWebViews, Promise.then doesn't completely break, but
  1761. // it can get stuck in a weird state where callbacks are pushed into the
  1762. // microtask queue but the queue isn't being flushed, until the browser
  1763. // needs to do some other work, e.g. handle a timer. Therefore we can
  1764. // "force" the microtask queue to be flushed by adding an empty timer.
  1765. if (isIOS) { setTimeout(noop); }
  1766. };
  1767. isUsingMicroTask = true;
  1768. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  1769. isNative(MutationObserver) ||
  1770. // PhantomJS and iOS 7.x
  1771. MutationObserver.toString() === '[object MutationObserverConstructor]'
  1772. )) {
  1773. // Use MutationObserver where native Promise is not available,
  1774. // e.g. PhantomJS, iOS7, Android 4.4
  1775. // (#6466 MutationObserver is unreliable in IE11)
  1776. var counter = 1;
  1777. var observer = new MutationObserver(flushCallbacks);
  1778. var textNode = document.createTextNode(String(counter));
  1779. observer.observe(textNode, {
  1780. characterData: true
  1781. });
  1782. timerFunc = function () {
  1783. counter = (counter + 1) % 2;
  1784. textNode.data = String(counter);
  1785. };
  1786. isUsingMicroTask = true;
  1787. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  1788. // Fallback to setImmediate.
  1789. // Technically it leverages the (macro) task queue,
  1790. // but it is still a better choice than setTimeout.
  1791. timerFunc = function () {
  1792. setImmediate(flushCallbacks);
  1793. };
  1794. } else {
  1795. // Fallback to setTimeout.
  1796. timerFunc = function () {
  1797. setTimeout(flushCallbacks, 0);
  1798. };
  1799. }
  1800. function nextTick (cb, ctx) {
  1801. var _resolve;
  1802. callbacks.push(function () {
  1803. if (cb) {
  1804. try {
  1805. cb.call(ctx);
  1806. } catch (e) {
  1807. handleError(e, ctx, 'nextTick');
  1808. }
  1809. } else if (_resolve) {
  1810. _resolve(ctx);
  1811. }
  1812. });
  1813. if (!pending) {
  1814. pending = true;
  1815. timerFunc();
  1816. }
  1817. // $flow-disable-line
  1818. if (!cb && typeof Promise !== 'undefined') {
  1819. return new Promise(function (resolve) {
  1820. _resolve = resolve;
  1821. })
  1822. }
  1823. }
  1824. /* */
  1825. var mark;
  1826. var measure;
  1827. {
  1828. var perf = inBrowser && window.performance;
  1829. /* istanbul ignore if */
  1830. if (
  1831. perf &&
  1832. perf.mark &&
  1833. perf.measure &&
  1834. perf.clearMarks &&
  1835. perf.clearMeasures
  1836. ) {
  1837. mark = function (tag) { return perf.mark(tag); };
  1838. measure = function (name, startTag, endTag) {
  1839. perf.measure(name, startTag, endTag);
  1840. perf.clearMarks(startTag);
  1841. perf.clearMarks(endTag);
  1842. // perf.clearMeasures(name)
  1843. };
  1844. }
  1845. }
  1846. /* not type checking this file because flow doesn't play well with Proxy */
  1847. var initProxy;
  1848. {
  1849. var allowedGlobals = makeMap(
  1850. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  1851. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  1852. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' +
  1853. 'require' // for Webpack/Browserify
  1854. );
  1855. var warnNonPresent = function (target, key) {
  1856. warn(
  1857. "Property or method \"" + key + "\" is not defined on the instance but " +
  1858. 'referenced during render. Make sure that this property is reactive, ' +
  1859. 'either in the data option, or for class-based components, by ' +
  1860. 'initializing the property. ' +
  1861. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  1862. target
  1863. );
  1864. };
  1865. var warnReservedPrefix = function (target, key) {
  1866. warn(
  1867. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  1868. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  1869. 'prevent conflicts with Vue internals. ' +
  1870. 'See: https://vuejs.org/v2/api/#data',
  1871. target
  1872. );
  1873. };
  1874. var hasProxy =
  1875. typeof Proxy !== 'undefined' && isNative(Proxy);
  1876. if (hasProxy) {
  1877. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  1878. config.keyCodes = new Proxy(config.keyCodes, {
  1879. set: function set (target, key, value) {
  1880. if (isBuiltInModifier(key)) {
  1881. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  1882. return false
  1883. } else {
  1884. target[key] = value;
  1885. return true
  1886. }
  1887. }
  1888. });
  1889. }
  1890. var hasHandler = {
  1891. has: function has (target, key) {
  1892. var has = key in target;
  1893. var isAllowed = allowedGlobals(key) ||
  1894. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  1895. if (!has && !isAllowed) {
  1896. if (key in target.$data) { warnReservedPrefix(target, key); }
  1897. else { warnNonPresent(target, key); }
  1898. }
  1899. return has || !isAllowed
  1900. }
  1901. };
  1902. var getHandler = {
  1903. get: function get (target, key) {
  1904. if (typeof key === 'string' && !(key in target)) {
  1905. if (key in target.$data) { warnReservedPrefix(target, key); }
  1906. else { warnNonPresent(target, key); }
  1907. }
  1908. return target[key]
  1909. }
  1910. };
  1911. initProxy = function initProxy (vm) {
  1912. if (hasProxy) {
  1913. // determine which proxy handler to use
  1914. var options = vm.$options;
  1915. var handlers = options.render && options.render._withStripped
  1916. ? getHandler
  1917. : hasHandler;
  1918. vm._renderProxy = new Proxy(vm, handlers);
  1919. } else {
  1920. vm._renderProxy = vm;
  1921. }
  1922. };
  1923. }
  1924. /* */
  1925. var seenObjects = new _Set();
  1926. /**
  1927. * Recursively traverse an object to evoke all converted
  1928. * getters, so that every nested property inside the object
  1929. * is collected as a "deep" dependency.
  1930. */
  1931. function traverse (val) {
  1932. _traverse(val, seenObjects);
  1933. seenObjects.clear();
  1934. }
  1935. function _traverse (val, seen) {
  1936. var i, keys;
  1937. var isA = Array.isArray(val);
  1938. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  1939. return
  1940. }
  1941. if (val.__ob__) {
  1942. var depId = val.__ob__.dep.id;
  1943. if (seen.has(depId)) {
  1944. return
  1945. }
  1946. seen.add(depId);
  1947. }
  1948. if (isA) {
  1949. i = val.length;
  1950. while (i--) { _traverse(val[i], seen); }
  1951. } else {
  1952. keys = Object.keys(val);
  1953. i = keys.length;
  1954. while (i--) { _traverse(val[keys[i]], seen); }
  1955. }
  1956. }
  1957. /* */
  1958. var normalizeEvent = cached(function (name) {
  1959. var passive = name.charAt(0) === '&';
  1960. name = passive ? name.slice(1) : name;
  1961. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  1962. name = once$$1 ? name.slice(1) : name;
  1963. var capture = name.charAt(0) === '!';
  1964. name = capture ? name.slice(1) : name;
  1965. return {
  1966. name: name,
  1967. once: once$$1,
  1968. capture: capture,
  1969. passive: passive
  1970. }
  1971. });
  1972. function createFnInvoker (fns, vm) {
  1973. function invoker () {
  1974. var arguments$1 = arguments;
  1975. var fns = invoker.fns;
  1976. if (Array.isArray(fns)) {
  1977. var cloned = fns.slice();
  1978. for (var i = 0; i < cloned.length; i++) {
  1979. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  1980. }
  1981. } else {
  1982. // return handler return value for single handlers
  1983. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  1984. }
  1985. }
  1986. invoker.fns = fns;
  1987. return invoker
  1988. }
  1989. function updateListeners (
  1990. on,
  1991. oldOn,
  1992. add,
  1993. remove$$1,
  1994. createOnceHandler,
  1995. vm
  1996. ) {
  1997. var name, def$$1, cur, old, event;
  1998. for (name in on) {
  1999. def$$1 = cur = on[name];
  2000. old = oldOn[name];
  2001. event = normalizeEvent(name);
  2002. if (isUndef(cur)) {
  2003. warn(
  2004. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  2005. vm
  2006. );
  2007. } else if (isUndef(old)) {
  2008. if (isUndef(cur.fns)) {
  2009. cur = on[name] = createFnInvoker(cur, vm);
  2010. }
  2011. if (isTrue(event.once)) {
  2012. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  2013. }
  2014. add(event.name, cur, event.capture, event.passive, event.params);
  2015. } else if (cur !== old) {
  2016. old.fns = cur;
  2017. on[name] = old;
  2018. }
  2019. }
  2020. for (name in oldOn) {
  2021. if (isUndef(on[name])) {
  2022. event = normalizeEvent(name);
  2023. remove$$1(event.name, oldOn[name], event.capture);
  2024. }
  2025. }
  2026. }
  2027. /* */
  2028. function mergeVNodeHook (def, hookKey, hook) {
  2029. if (def instanceof VNode) {
  2030. def = def.data.hook || (def.data.hook = {});
  2031. }
  2032. var invoker;
  2033. var oldHook = def[hookKey];
  2034. function wrappedHook () {
  2035. hook.apply(this, arguments);
  2036. // important: remove merged hook to ensure it's called only once
  2037. // and prevent memory leak
  2038. remove(invoker.fns, wrappedHook);
  2039. }
  2040. if (isUndef(oldHook)) {
  2041. // no existing hook
  2042. invoker = createFnInvoker([wrappedHook]);
  2043. } else {
  2044. /* istanbul ignore if */
  2045. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  2046. // already a merged invoker
  2047. invoker = oldHook;
  2048. invoker.fns.push(wrappedHook);
  2049. } else {
  2050. // existing plain hook
  2051. invoker = createFnInvoker([oldHook, wrappedHook]);
  2052. }
  2053. }
  2054. invoker.merged = true;
  2055. def[hookKey] = invoker;
  2056. }
  2057. /* */
  2058. function extractPropsFromVNodeData (
  2059. data,
  2060. Ctor,
  2061. tag
  2062. ) {
  2063. // we are only extracting raw values here.
  2064. // validation and default values are handled in the child
  2065. // component itself.
  2066. var propOptions = Ctor.options.props;
  2067. if (isUndef(propOptions)) {
  2068. return
  2069. }
  2070. var res = {};
  2071. var attrs = data.attrs;
  2072. var props = data.props;
  2073. if (isDef(attrs) || isDef(props)) {
  2074. for (var key in propOptions) {
  2075. var altKey = hyphenate(key);
  2076. {
  2077. var keyInLowerCase = key.toLowerCase();
  2078. if (
  2079. key !== keyInLowerCase &&
  2080. attrs && hasOwn(attrs, keyInLowerCase)
  2081. ) {
  2082. tip(
  2083. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  2084. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  2085. " \"" + key + "\". " +
  2086. "Note that HTML attributes are case-insensitive and camelCased " +
  2087. "props need to use their kebab-case equivalents when using in-DOM " +
  2088. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  2089. );
  2090. }
  2091. }
  2092. checkProp(res, props, key, altKey, true) ||
  2093. checkProp(res, attrs, key, altKey, false);
  2094. }
  2095. }
  2096. return res
  2097. }
  2098. function checkProp (
  2099. res,
  2100. hash,
  2101. key,
  2102. altKey,
  2103. preserve
  2104. ) {
  2105. if (isDef(hash)) {
  2106. if (hasOwn(hash, key)) {
  2107. res[key] = hash[key];
  2108. if (!preserve) {
  2109. delete hash[key];
  2110. }
  2111. return true
  2112. } else if (hasOwn(hash, altKey)) {
  2113. res[key] = hash[altKey];
  2114. if (!preserve) {
  2115. delete hash[altKey];
  2116. }
  2117. return true
  2118. }
  2119. }
  2120. return false
  2121. }
  2122. /* */
  2123. // The template compiler attempts to minimize the need for normalization by
  2124. // statically analyzing the template at compile time.
  2125. //
  2126. // For plain HTML markup, normalization can be completely skipped because the
  2127. // generated render function is guaranteed to return Array<VNode>. There are
  2128. // two cases where extra normalization is needed:
  2129. // 1. When the children contains components - because a functional component
  2130. // may return an Array instead of a single root. In this case, just a simple
  2131. // normalization is needed - if any child is an Array, we flatten the whole
  2132. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  2133. // because functional components already normalize their own children.
  2134. function simpleNormalizeChildren (children) {
  2135. for (var i = 0; i < children.length; i++) {
  2136. if (Array.isArray(children[i])) {
  2137. return Array.prototype.concat.apply([], children)
  2138. }
  2139. }
  2140. return children
  2141. }
  2142. // 2. When the children contains constructs that always generated nested Arrays,
  2143. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  2144. // with hand-written render functions / JSX. In such cases a full normalization
  2145. // is needed to cater to all possible types of children values.
  2146. function normalizeChildren (children) {
  2147. return isPrimitive(children)
  2148. ? [createTextVNode(children)]
  2149. : Array.isArray(children)
  2150. ? normalizeArrayChildren(children)
  2151. : undefined
  2152. }
  2153. function isTextNode (node) {
  2154. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  2155. }
  2156. function normalizeArrayChildren (children, nestedIndex) {
  2157. var res = [];
  2158. var i, c, lastIndex, last;
  2159. for (i = 0; i < children.length; i++) {
  2160. c = children[i];
  2161. if (isUndef(c) || typeof c === 'boolean') { continue }
  2162. lastIndex = res.length - 1;
  2163. last = res[lastIndex];
  2164. // nested
  2165. if (Array.isArray(c)) {
  2166. if (c.length > 0) {
  2167. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  2168. // merge adjacent text nodes
  2169. if (isTextNode(c[0]) && isTextNode(last)) {
  2170. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  2171. c.shift();
  2172. }
  2173. res.push.apply(res, c);
  2174. }
  2175. } else if (isPrimitive(c)) {
  2176. if (isTextNode(last)) {
  2177. // merge adjacent text nodes
  2178. // this is necessary for SSR hydration because text nodes are
  2179. // essentially merged when rendered to HTML strings
  2180. res[lastIndex] = createTextVNode(last.text + c);
  2181. } else if (c !== '') {
  2182. // convert primitive to vnode
  2183. res.push(createTextVNode(c));
  2184. }
  2185. } else {
  2186. if (isTextNode(c) && isTextNode(last)) {
  2187. // merge adjacent text nodes
  2188. res[lastIndex] = createTextVNode(last.text + c.text);
  2189. } else {
  2190. // default key for nested array children (likely generated by v-for)
  2191. if (isTrue(children._isVList) &&
  2192. isDef(c.tag) &&
  2193. isUndef(c.key) &&
  2194. isDef(nestedIndex)) {
  2195. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  2196. }
  2197. res.push(c);
  2198. }
  2199. }
  2200. }
  2201. return res
  2202. }
  2203. /* */
  2204. function initProvide (vm) {
  2205. var provide = vm.$options.provide;
  2206. if (provide) {
  2207. vm._provided = typeof provide === 'function'
  2208. ? provide.call(vm)
  2209. : provide;
  2210. }
  2211. }
  2212. function initInjections (vm) {
  2213. var result = resolveInject(vm.$options.inject, vm);
  2214. if (result) {
  2215. toggleObserving(false);
  2216. Object.keys(result).forEach(function (key) {
  2217. /* istanbul ignore else */
  2218. {
  2219. defineReactive$$1(vm, key, result[key], function () {
  2220. warn(
  2221. "Avoid mutating an injected value directly since the changes will be " +
  2222. "overwritten whenever the provided component re-renders. " +
  2223. "injection being mutated: \"" + key + "\"",
  2224. vm
  2225. );
  2226. });
  2227. }
  2228. });
  2229. toggleObserving(true);
  2230. }
  2231. }
  2232. function resolveInject (inject, vm) {
  2233. if (inject) {
  2234. // inject is :any because flow is not smart enough to figure out cached
  2235. var result = Object.create(null);
  2236. var keys = hasSymbol
  2237. ? Reflect.ownKeys(inject)
  2238. : Object.keys(inject);
  2239. for (var i = 0; i < keys.length; i++) {
  2240. var key = keys[i];
  2241. // #6574 in case the inject object is observed...
  2242. if (key === '__ob__') { continue }
  2243. var provideKey = inject[key].from;
  2244. var source = vm;
  2245. while (source) {
  2246. if (source._provided && hasOwn(source._provided, provideKey)) {
  2247. result[key] = source._provided[provideKey];
  2248. break
  2249. }
  2250. source = source.$parent;
  2251. }
  2252. if (!source) {
  2253. if ('default' in inject[key]) {
  2254. var provideDefault = inject[key].default;
  2255. result[key] = typeof provideDefault === 'function'
  2256. ? provideDefault.call(vm)
  2257. : provideDefault;
  2258. } else {
  2259. warn(("Injection \"" + key + "\" not found"), vm);
  2260. }
  2261. }
  2262. }
  2263. return result
  2264. }
  2265. }
  2266. /* */
  2267. /**
  2268. * Runtime helper for resolving raw children VNodes into a slot object.
  2269. */
  2270. function resolveSlots (
  2271. children,
  2272. context
  2273. ) {
  2274. if (!children || !children.length) {
  2275. return {}
  2276. }
  2277. var slots = {};
  2278. for (var i = 0, l = children.length; i < l; i++) {
  2279. var child = children[i];
  2280. var data = child.data;
  2281. // remove slot attribute if the node is resolved as a Vue slot node
  2282. if (data && data.attrs && data.attrs.slot) {
  2283. delete data.attrs.slot;
  2284. }
  2285. // named slots should only be respected if the vnode was rendered in the
  2286. // same context.
  2287. if ((child.context === context || child.fnContext === context) &&
  2288. data && data.slot != null
  2289. ) {
  2290. var name = data.slot;
  2291. var slot = (slots[name] || (slots[name] = []));
  2292. if (child.tag === 'template') {
  2293. slot.push.apply(slot, child.children || []);
  2294. } else {
  2295. slot.push(child);
  2296. }
  2297. } else {
  2298. (slots.default || (slots.default = [])).push(child);
  2299. }
  2300. }
  2301. // ignore slots that contains only whitespace
  2302. for (var name$1 in slots) {
  2303. if (slots[name$1].every(isWhitespace)) {
  2304. delete slots[name$1];
  2305. }
  2306. }
  2307. return slots
  2308. }
  2309. function isWhitespace (node) {
  2310. return (node.isComment && !node.asyncFactory) || node.text === ' '
  2311. }
  2312. /* */
  2313. function isAsyncPlaceholder (node) {
  2314. return node.isComment && node.asyncFactory
  2315. }
  2316. /* */
  2317. function normalizeScopedSlots (
  2318. slots,
  2319. normalSlots,
  2320. prevSlots
  2321. ) {
  2322. var res;
  2323. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  2324. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  2325. var key = slots && slots.$key;
  2326. if (!slots) {
  2327. res = {};
  2328. } else if (slots._normalized) {
  2329. // fast path 1: child component re-render only, parent did not change
  2330. return slots._normalized
  2331. } else if (
  2332. isStable &&
  2333. prevSlots &&
  2334. prevSlots !== emptyObject &&
  2335. key === prevSlots.$key &&
  2336. !hasNormalSlots &&
  2337. !prevSlots.$hasNormal
  2338. ) {
  2339. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  2340. // only need to normalize once
  2341. return prevSlots
  2342. } else {
  2343. res = {};
  2344. for (var key$1 in slots) {
  2345. if (slots[key$1] && key$1[0] !== '$') {
  2346. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  2347. }
  2348. }
  2349. }
  2350. // expose normal slots on scopedSlots
  2351. for (var key$2 in normalSlots) {
  2352. if (!(key$2 in res)) {
  2353. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  2354. }
  2355. }
  2356. // avoriaz seems to mock a non-extensible $scopedSlots object
  2357. // and when that is passed down this would cause an error
  2358. if (slots && Object.isExtensible(slots)) {
  2359. (slots)._normalized = res;
  2360. }
  2361. def(res, '$stable', isStable);
  2362. def(res, '$key', key);
  2363. def(res, '$hasNormal', hasNormalSlots);
  2364. return res
  2365. }
  2366. function normalizeScopedSlot(normalSlots, key, fn) {
  2367. var normalized = function () {
  2368. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  2369. res = res && typeof res === 'object' && !Array.isArray(res)
  2370. ? [res] // single vnode
  2371. : normalizeChildren(res);
  2372. var vnode = res && res[0];
  2373. return res && (
  2374. !vnode ||
  2375. (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
  2376. ) ? undefined
  2377. : res
  2378. };
  2379. // this is a slot using the new v-slot syntax without scope. although it is
  2380. // compiled as a scoped slot, render fn users would expect it to be present
  2381. // on this.$slots because the usage is semantically a normal slot.
  2382. if (fn.proxy) {
  2383. Object.defineProperty(normalSlots, key, {
  2384. get: normalized,
  2385. enumerable: true,
  2386. configurable: true
  2387. });
  2388. }
  2389. return normalized
  2390. }
  2391. function proxyNormalSlot(slots, key) {
  2392. return function () { return slots[key]; }
  2393. }
  2394. /* */
  2395. /**
  2396. * Runtime helper for rendering v-for lists.
  2397. */
  2398. function renderList (
  2399. val,
  2400. render
  2401. ) {
  2402. var ret, i, l, keys, key;
  2403. if (Array.isArray(val) || typeof val === 'string') {
  2404. ret = new Array(val.length);
  2405. for (i = 0, l = val.length; i < l; i++) {
  2406. ret[i] = render(val[i], i);
  2407. }
  2408. } else if (typeof val === 'number') {
  2409. ret = new Array(val);
  2410. for (i = 0; i < val; i++) {
  2411. ret[i] = render(i + 1, i);
  2412. }
  2413. } else if (isObject(val)) {
  2414. if (hasSymbol && val[Symbol.iterator]) {
  2415. ret = [];
  2416. var iterator = val[Symbol.iterator]();
  2417. var result = iterator.next();
  2418. while (!result.done) {
  2419. ret.push(render(result.value, ret.length));
  2420. result = iterator.next();
  2421. }
  2422. } else {
  2423. keys = Object.keys(val);
  2424. ret = new Array(keys.length);
  2425. for (i = 0, l = keys.length; i < l; i++) {
  2426. key = keys[i];
  2427. ret[i] = render(val[key], key, i);
  2428. }
  2429. }
  2430. }
  2431. if (!isDef(ret)) {
  2432. ret = [];
  2433. }
  2434. (ret)._isVList = true;
  2435. return ret
  2436. }
  2437. /* */
  2438. /**
  2439. * Runtime helper for rendering <slot>
  2440. */
  2441. function renderSlot (
  2442. name,
  2443. fallbackRender,
  2444. props,
  2445. bindObject
  2446. ) {
  2447. var scopedSlotFn = this.$scopedSlots[name];
  2448. var nodes;
  2449. if (scopedSlotFn) {
  2450. // scoped slot
  2451. props = props || {};
  2452. if (bindObject) {
  2453. if (!isObject(bindObject)) {
  2454. warn('slot v-bind without argument expects an Object', this);
  2455. }
  2456. props = extend(extend({}, bindObject), props);
  2457. }
  2458. nodes =
  2459. scopedSlotFn(props) ||
  2460. (typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender);
  2461. } else {
  2462. nodes =
  2463. this.$slots[name] ||
  2464. (typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender);
  2465. }
  2466. var target = props && props.slot;
  2467. if (target) {
  2468. return this.$createElement('template', { slot: target }, nodes)
  2469. } else {
  2470. return nodes
  2471. }
  2472. }
  2473. /* */
  2474. /**
  2475. * Runtime helper for resolving filters
  2476. */
  2477. function resolveFilter (id) {
  2478. return resolveAsset(this.$options, 'filters', id, true) || identity
  2479. }
  2480. /* */
  2481. function isKeyNotMatch (expect, actual) {
  2482. if (Array.isArray(expect)) {
  2483. return expect.indexOf(actual) === -1
  2484. } else {
  2485. return expect !== actual
  2486. }
  2487. }
  2488. /**
  2489. * Runtime helper for checking keyCodes from config.
  2490. * exposed as Vue.prototype._k
  2491. * passing in eventKeyName as last argument separately for backwards compat
  2492. */
  2493. function checkKeyCodes (
  2494. eventKeyCode,
  2495. key,
  2496. builtInKeyCode,
  2497. eventKeyName,
  2498. builtInKeyName
  2499. ) {
  2500. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  2501. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  2502. return isKeyNotMatch(builtInKeyName, eventKeyName)
  2503. } else if (mappedKeyCode) {
  2504. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  2505. } else if (eventKeyName) {
  2506. return hyphenate(eventKeyName) !== key
  2507. }
  2508. return eventKeyCode === undefined
  2509. }
  2510. /* */
  2511. /**
  2512. * Runtime helper for merging v-bind="object" into a VNode's data.
  2513. */
  2514. function bindObjectProps (
  2515. data,
  2516. tag,
  2517. value,
  2518. asProp,
  2519. isSync
  2520. ) {
  2521. if (value) {
  2522. if (!isObject(value)) {
  2523. warn(
  2524. 'v-bind without argument expects an Object or Array value',
  2525. this
  2526. );
  2527. } else {
  2528. if (Array.isArray(value)) {
  2529. value = toObject(value);
  2530. }
  2531. var hash;
  2532. var loop = function ( key ) {
  2533. if (
  2534. key === 'class' ||
  2535. key === 'style' ||
  2536. isReservedAttribute(key)
  2537. ) {
  2538. hash = data;
  2539. } else {
  2540. var type = data.attrs && data.attrs.type;
  2541. hash = asProp || config.mustUseProp(tag, type, key)
  2542. ? data.domProps || (data.domProps = {})
  2543. : data.attrs || (data.attrs = {});
  2544. }
  2545. var camelizedKey = camelize(key);
  2546. var hyphenatedKey = hyphenate(key);
  2547. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  2548. hash[key] = value[key];
  2549. if (isSync) {
  2550. var on = data.on || (data.on = {});
  2551. on[("update:" + key)] = function ($event) {
  2552. value[key] = $event;
  2553. };
  2554. }
  2555. }
  2556. };
  2557. for (var key in value) loop( key );
  2558. }
  2559. }
  2560. return data
  2561. }
  2562. /* */
  2563. /**
  2564. * Runtime helper for rendering static trees.
  2565. */
  2566. function renderStatic (
  2567. index,
  2568. isInFor
  2569. ) {
  2570. var cached = this._staticTrees || (this._staticTrees = []);
  2571. var tree = cached[index];
  2572. // if has already-rendered static tree and not inside v-for,
  2573. // we can reuse the same tree.
  2574. if (tree && !isInFor) {
  2575. return tree
  2576. }
  2577. // otherwise, render a fresh tree.
  2578. tree = cached[index] = this.$options.staticRenderFns[index].call(
  2579. this._renderProxy,
  2580. null,
  2581. this // for render fns generated for functional component templates
  2582. );
  2583. markStatic(tree, ("__static__" + index), false);
  2584. return tree
  2585. }
  2586. /**
  2587. * Runtime helper for v-once.
  2588. * Effectively it means marking the node as static with a unique key.
  2589. */
  2590. function markOnce (
  2591. tree,
  2592. index,
  2593. key
  2594. ) {
  2595. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  2596. return tree
  2597. }
  2598. function markStatic (
  2599. tree,
  2600. key,
  2601. isOnce
  2602. ) {
  2603. if (Array.isArray(tree)) {
  2604. for (var i = 0; i < tree.length; i++) {
  2605. if (tree[i] && typeof tree[i] !== 'string') {
  2606. markStaticNode(tree[i], (key + "_" + i), isOnce);
  2607. }
  2608. }
  2609. } else {
  2610. markStaticNode(tree, key, isOnce);
  2611. }
  2612. }
  2613. function markStaticNode (node, key, isOnce) {
  2614. node.isStatic = true;
  2615. node.key = key;
  2616. node.isOnce = isOnce;
  2617. }
  2618. /* */
  2619. function bindObjectListeners (data, value) {
  2620. if (value) {
  2621. if (!isPlainObject(value)) {
  2622. warn(
  2623. 'v-on without argument expects an Object value',
  2624. this
  2625. );
  2626. } else {
  2627. var on = data.on = data.on ? extend({}, data.on) : {};
  2628. for (var key in value) {
  2629. var existing = on[key];
  2630. var ours = value[key];
  2631. on[key] = existing ? [].concat(existing, ours) : ours;
  2632. }
  2633. }
  2634. }
  2635. return data
  2636. }
  2637. /* */
  2638. function resolveScopedSlots (
  2639. fns, // see flow/vnode
  2640. res,
  2641. // the following are added in 2.6
  2642. hasDynamicKeys,
  2643. contentHashKey
  2644. ) {
  2645. res = res || { $stable: !hasDynamicKeys };
  2646. for (var i = 0; i < fns.length; i++) {
  2647. var slot = fns[i];
  2648. if (Array.isArray(slot)) {
  2649. resolveScopedSlots(slot, res, hasDynamicKeys);
  2650. } else if (slot) {
  2651. // marker for reverse proxying v-slot without scope on this.$slots
  2652. if (slot.proxy) {
  2653. slot.fn.proxy = true;
  2654. }
  2655. res[slot.key] = slot.fn;
  2656. }
  2657. }
  2658. if (contentHashKey) {
  2659. (res).$key = contentHashKey;
  2660. }
  2661. return res
  2662. }
  2663. /* */
  2664. function bindDynamicKeys (baseObj, values) {
  2665. for (var i = 0; i < values.length; i += 2) {
  2666. var key = values[i];
  2667. if (typeof key === 'string' && key) {
  2668. baseObj[values[i]] = values[i + 1];
  2669. } else if (key !== '' && key !== null) {
  2670. // null is a special value for explicitly removing a binding
  2671. warn(
  2672. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  2673. this
  2674. );
  2675. }
  2676. }
  2677. return baseObj
  2678. }
  2679. // helper to dynamically append modifier runtime markers to event names.
  2680. // ensure only append when value is already string, otherwise it will be cast
  2681. // to string and cause the type check to miss.
  2682. function prependModifier (value, symbol) {
  2683. return typeof value === 'string' ? symbol + value : value
  2684. }
  2685. /* */
  2686. function installRenderHelpers (target) {
  2687. target._o = markOnce;
  2688. target._n = toNumber;
  2689. target._s = toString;
  2690. target._l = renderList;
  2691. target._t = renderSlot;
  2692. target._q = looseEqual;
  2693. target._i = looseIndexOf;
  2694. target._m = renderStatic;
  2695. target._f = resolveFilter;
  2696. target._k = checkKeyCodes;
  2697. target._b = bindObjectProps;
  2698. target._v = createTextVNode;
  2699. target._e = createEmptyVNode;
  2700. target._u = resolveScopedSlots;
  2701. target._g = bindObjectListeners;
  2702. target._d = bindDynamicKeys;
  2703. target._p = prependModifier;
  2704. }
  2705. /* */
  2706. function FunctionalRenderContext (
  2707. data,
  2708. props,
  2709. children,
  2710. parent,
  2711. Ctor
  2712. ) {
  2713. var this$1 = this;
  2714. var options = Ctor.options;
  2715. // ensure the createElement function in functional components
  2716. // gets a unique context - this is necessary for correct named slot check
  2717. var contextVm;
  2718. if (hasOwn(parent, '_uid')) {
  2719. contextVm = Object.create(parent);
  2720. // $flow-disable-line
  2721. contextVm._original = parent;
  2722. } else {
  2723. // the context vm passed in is a functional context as well.
  2724. // in this case we want to make sure we are able to get a hold to the
  2725. // real context instance.
  2726. contextVm = parent;
  2727. // $flow-disable-line
  2728. parent = parent._original;
  2729. }
  2730. var isCompiled = isTrue(options._compiled);
  2731. var needNormalization = !isCompiled;
  2732. this.data = data;
  2733. this.props = props;
  2734. this.children = children;
  2735. this.parent = parent;
  2736. this.listeners = data.on || emptyObject;
  2737. this.injections = resolveInject(options.inject, parent);
  2738. this.slots = function () {
  2739. if (!this$1.$slots) {
  2740. normalizeScopedSlots(
  2741. data.scopedSlots,
  2742. this$1.$slots = resolveSlots(children, parent)
  2743. );
  2744. }
  2745. return this$1.$slots
  2746. };
  2747. Object.defineProperty(this, 'scopedSlots', ({
  2748. enumerable: true,
  2749. get: function get () {
  2750. return normalizeScopedSlots(data.scopedSlots, this.slots())
  2751. }
  2752. }));
  2753. // support for compiled functional template
  2754. if (isCompiled) {
  2755. // exposing $options for renderStatic()
  2756. this.$options = options;
  2757. // pre-resolve slots for renderSlot()
  2758. this.$slots = this.slots();
  2759. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  2760. }
  2761. if (options._scopeId) {
  2762. this._c = function (a, b, c, d) {
  2763. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  2764. if (vnode && !Array.isArray(vnode)) {
  2765. vnode.fnScopeId = options._scopeId;
  2766. vnode.fnContext = parent;
  2767. }
  2768. return vnode
  2769. };
  2770. } else {
  2771. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  2772. }
  2773. }
  2774. installRenderHelpers(FunctionalRenderContext.prototype);
  2775. function createFunctionalComponent (
  2776. Ctor,
  2777. propsData,
  2778. data,
  2779. contextVm,
  2780. children
  2781. ) {
  2782. var options = Ctor.options;
  2783. var props = {};
  2784. var propOptions = options.props;
  2785. if (isDef(propOptions)) {
  2786. for (var key in propOptions) {
  2787. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  2788. }
  2789. } else {
  2790. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  2791. if (isDef(data.props)) { mergeProps(props, data.props); }
  2792. }
  2793. var renderContext = new FunctionalRenderContext(
  2794. data,
  2795. props,
  2796. children,
  2797. contextVm,
  2798. Ctor
  2799. );
  2800. var vnode = options.render.call(null, renderContext._c, renderContext);
  2801. if (vnode instanceof VNode) {
  2802. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  2803. } else if (Array.isArray(vnode)) {
  2804. var vnodes = normalizeChildren(vnode) || [];
  2805. var res = new Array(vnodes.length);
  2806. for (var i = 0; i < vnodes.length; i++) {
  2807. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  2808. }
  2809. return res
  2810. }
  2811. }
  2812. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  2813. // #7817 clone node before setting fnContext, otherwise if the node is reused
  2814. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  2815. // that should not be matched to match.
  2816. var clone = cloneVNode(vnode);
  2817. clone.fnContext = contextVm;
  2818. clone.fnOptions = options;
  2819. {
  2820. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  2821. }
  2822. if (data.slot) {
  2823. (clone.data || (clone.data = {})).slot = data.slot;
  2824. }
  2825. return clone
  2826. }
  2827. function mergeProps (to, from) {
  2828. for (var key in from) {
  2829. to[camelize(key)] = from[key];
  2830. }
  2831. }
  2832. /* */
  2833. /* */
  2834. /* */
  2835. /* */
  2836. // inline hooks to be invoked on component VNodes during patch
  2837. var componentVNodeHooks = {
  2838. init: function init (vnode, hydrating) {
  2839. if (
  2840. vnode.componentInstance &&
  2841. !vnode.componentInstance._isDestroyed &&
  2842. vnode.data.keepAlive
  2843. ) {
  2844. // kept-alive components, treat as a patch
  2845. var mountedNode = vnode; // work around flow
  2846. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  2847. } else {
  2848. var child = vnode.componentInstance = createComponentInstanceForVnode(
  2849. vnode,
  2850. activeInstance
  2851. );
  2852. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  2853. }
  2854. },
  2855. prepatch: function prepatch (oldVnode, vnode) {
  2856. var options = vnode.componentOptions;
  2857. var child = vnode.componentInstance = oldVnode.componentInstance;
  2858. updateChildComponent(
  2859. child,
  2860. options.propsData, // updated props
  2861. options.listeners, // updated listeners
  2862. vnode, // new parent vnode
  2863. options.children // new children
  2864. );
  2865. },
  2866. insert: function insert (vnode) {
  2867. var context = vnode.context;
  2868. var componentInstance = vnode.componentInstance;
  2869. if (!componentInstance._isMounted) {
  2870. componentInstance._isMounted = true;
  2871. callHook(componentInstance, 'mounted');
  2872. }
  2873. if (vnode.data.keepAlive) {
  2874. if (context._isMounted) {
  2875. // vue-router#1212
  2876. // During updates, a kept-alive component's child components may
  2877. // change, so directly walking the tree here may call activated hooks
  2878. // on incorrect children. Instead we push them into a queue which will
  2879. // be processed after the whole patch process ended.
  2880. queueActivatedComponent(componentInstance);
  2881. } else {
  2882. activateChildComponent(componentInstance, true /* direct */);
  2883. }
  2884. }
  2885. },
  2886. destroy: function destroy (vnode) {
  2887. var componentInstance = vnode.componentInstance;
  2888. if (!componentInstance._isDestroyed) {
  2889. if (!vnode.data.keepAlive) {
  2890. componentInstance.$destroy();
  2891. } else {
  2892. deactivateChildComponent(componentInstance, true /* direct */);
  2893. }
  2894. }
  2895. }
  2896. };
  2897. var hooksToMerge = Object.keys(componentVNodeHooks);
  2898. function createComponent (
  2899. Ctor,
  2900. data,
  2901. context,
  2902. children,
  2903. tag
  2904. ) {
  2905. if (isUndef(Ctor)) {
  2906. return
  2907. }
  2908. var baseCtor = context.$options._base;
  2909. // plain options object: turn it into a constructor
  2910. if (isObject(Ctor)) {
  2911. Ctor = baseCtor.extend(Ctor);
  2912. }
  2913. // if at this stage it's not a constructor or an async component factory,
  2914. // reject.
  2915. if (typeof Ctor !== 'function') {
  2916. {
  2917. warn(("Invalid Component definition: " + (String(Ctor))), context);
  2918. }
  2919. return
  2920. }
  2921. // async component
  2922. var asyncFactory;
  2923. if (isUndef(Ctor.cid)) {
  2924. asyncFactory = Ctor;
  2925. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  2926. if (Ctor === undefined) {
  2927. // return a placeholder node for async component, which is rendered
  2928. // as a comment node but preserves all the raw information for the node.
  2929. // the information will be used for async server-rendering and hydration.
  2930. return createAsyncPlaceholder(
  2931. asyncFactory,
  2932. data,
  2933. context,
  2934. children,
  2935. tag
  2936. )
  2937. }
  2938. }
  2939. data = data || {};
  2940. // resolve constructor options in case global mixins are applied after
  2941. // component constructor creation
  2942. resolveConstructorOptions(Ctor);
  2943. // transform component v-model data into props & events
  2944. if (isDef(data.model)) {
  2945. transformModel(Ctor.options, data);
  2946. }
  2947. // extract props
  2948. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  2949. // functional component
  2950. if (isTrue(Ctor.options.functional)) {
  2951. return createFunctionalComponent(Ctor, propsData, data, context, children)
  2952. }
  2953. // extract listeners, since these needs to be treated as
  2954. // child component listeners instead of DOM listeners
  2955. var listeners = data.on;
  2956. // replace with listeners with .native modifier
  2957. // so it gets processed during parent component patch.
  2958. data.on = data.nativeOn;
  2959. if (isTrue(Ctor.options.abstract)) {
  2960. // abstract components do not keep anything
  2961. // other than props & listeners & slot
  2962. // work around flow
  2963. var slot = data.slot;
  2964. data = {};
  2965. if (slot) {
  2966. data.slot = slot;
  2967. }
  2968. }
  2969. // install component management hooks onto the placeholder node
  2970. installComponentHooks(data);
  2971. // return a placeholder vnode
  2972. var name = Ctor.options.name || tag;
  2973. var vnode = new VNode(
  2974. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  2975. data, undefined, undefined, undefined, context,
  2976. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  2977. asyncFactory
  2978. );
  2979. return vnode
  2980. }
  2981. function createComponentInstanceForVnode (
  2982. // we know it's MountedComponentVNode but flow doesn't
  2983. vnode,
  2984. // activeInstance in lifecycle state
  2985. parent
  2986. ) {
  2987. var options = {
  2988. _isComponent: true,
  2989. _parentVnode: vnode,
  2990. parent: parent
  2991. };
  2992. // check inline-template render functions
  2993. var inlineTemplate = vnode.data.inlineTemplate;
  2994. if (isDef(inlineTemplate)) {
  2995. options.render = inlineTemplate.render;
  2996. options.staticRenderFns = inlineTemplate.staticRenderFns;
  2997. }
  2998. return new vnode.componentOptions.Ctor(options)
  2999. }
  3000. function installComponentHooks (data) {
  3001. var hooks = data.hook || (data.hook = {});
  3002. for (var i = 0; i < hooksToMerge.length; i++) {
  3003. var key = hooksToMerge[i];
  3004. var existing = hooks[key];
  3005. var toMerge = componentVNodeHooks[key];
  3006. if (existing !== toMerge && !(existing && existing._merged)) {
  3007. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  3008. }
  3009. }
  3010. }
  3011. function mergeHook$1 (f1, f2) {
  3012. var merged = function (a, b) {
  3013. // flow complains about extra args which is why we use any
  3014. f1(a, b);
  3015. f2(a, b);
  3016. };
  3017. merged._merged = true;
  3018. return merged
  3019. }
  3020. // transform component v-model info (value and callback) into
  3021. // prop and event handler respectively.
  3022. function transformModel (options, data) {
  3023. var prop = (options.model && options.model.prop) || 'value';
  3024. var event = (options.model && options.model.event) || 'input'
  3025. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  3026. var on = data.on || (data.on = {});
  3027. var existing = on[event];
  3028. var callback = data.model.callback;
  3029. if (isDef(existing)) {
  3030. if (
  3031. Array.isArray(existing)
  3032. ? existing.indexOf(callback) === -1
  3033. : existing !== callback
  3034. ) {
  3035. on[event] = [callback].concat(existing);
  3036. }
  3037. } else {
  3038. on[event] = callback;
  3039. }
  3040. }
  3041. /* */
  3042. var SIMPLE_NORMALIZE = 1;
  3043. var ALWAYS_NORMALIZE = 2;
  3044. // wrapper function for providing a more flexible interface
  3045. // without getting yelled at by flow
  3046. function createElement (
  3047. context,
  3048. tag,
  3049. data,
  3050. children,
  3051. normalizationType,
  3052. alwaysNormalize
  3053. ) {
  3054. if (Array.isArray(data) || isPrimitive(data)) {
  3055. normalizationType = children;
  3056. children = data;
  3057. data = undefined;
  3058. }
  3059. if (isTrue(alwaysNormalize)) {
  3060. normalizationType = ALWAYS_NORMALIZE;
  3061. }
  3062. return _createElement(context, tag, data, children, normalizationType)
  3063. }
  3064. function _createElement (
  3065. context,
  3066. tag,
  3067. data,
  3068. children,
  3069. normalizationType
  3070. ) {
  3071. if (isDef(data) && isDef((data).__ob__)) {
  3072. warn(
  3073. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  3074. 'Always create fresh vnode data objects in each render!',
  3075. context
  3076. );
  3077. return createEmptyVNode()
  3078. }
  3079. // object syntax in v-bind
  3080. if (isDef(data) && isDef(data.is)) {
  3081. tag = data.is;
  3082. }
  3083. if (!tag) {
  3084. // in case of component :is set to falsy value
  3085. return createEmptyVNode()
  3086. }
  3087. // warn against non-primitive key
  3088. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  3089. ) {
  3090. {
  3091. warn(
  3092. 'Avoid using non-primitive value as key, ' +
  3093. 'use string/number value instead.',
  3094. context
  3095. );
  3096. }
  3097. }
  3098. // support single function children as default scoped slot
  3099. if (Array.isArray(children) &&
  3100. typeof children[0] === 'function'
  3101. ) {
  3102. data = data || {};
  3103. data.scopedSlots = { default: children[0] };
  3104. children.length = 0;
  3105. }
  3106. if (normalizationType === ALWAYS_NORMALIZE) {
  3107. children = normalizeChildren(children);
  3108. } else if (normalizationType === SIMPLE_NORMALIZE) {
  3109. children = simpleNormalizeChildren(children);
  3110. }
  3111. var vnode, ns;
  3112. if (typeof tag === 'string') {
  3113. var Ctor;
  3114. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  3115. if (config.isReservedTag(tag)) {
  3116. // platform built-in elements
  3117. if (isDef(data) && isDef(data.nativeOn) && data.tag !== 'component') {
  3118. warn(
  3119. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  3120. context
  3121. );
  3122. }
  3123. vnode = new VNode(
  3124. config.parsePlatformTagName(tag), data, children,
  3125. undefined, undefined, context
  3126. );
  3127. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  3128. // component
  3129. vnode = createComponent(Ctor, data, context, children, tag);
  3130. } else {
  3131. // unknown or unlisted namespaced elements
  3132. // check at runtime because it may get assigned a namespace when its
  3133. // parent normalizes children
  3134. vnode = new VNode(
  3135. tag, data, children,
  3136. undefined, undefined, context
  3137. );
  3138. }
  3139. } else {
  3140. // direct component options / constructor
  3141. vnode = createComponent(tag, data, context, children);
  3142. }
  3143. if (Array.isArray(vnode)) {
  3144. return vnode
  3145. } else if (isDef(vnode)) {
  3146. if (isDef(ns)) { applyNS(vnode, ns); }
  3147. if (isDef(data)) { registerDeepBindings(data); }
  3148. return vnode
  3149. } else {
  3150. return createEmptyVNode()
  3151. }
  3152. }
  3153. function applyNS (vnode, ns, force) {
  3154. vnode.ns = ns;
  3155. if (vnode.tag === 'foreignObject') {
  3156. // use default namespace inside foreignObject
  3157. ns = undefined;
  3158. force = true;
  3159. }
  3160. if (isDef(vnode.children)) {
  3161. for (var i = 0, l = vnode.children.length; i < l; i++) {
  3162. var child = vnode.children[i];
  3163. if (isDef(child.tag) && (
  3164. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  3165. applyNS(child, ns, force);
  3166. }
  3167. }
  3168. }
  3169. }
  3170. // ref #5318
  3171. // necessary to ensure parent re-render when deep bindings like :style and
  3172. // :class are used on slot nodes
  3173. function registerDeepBindings (data) {
  3174. if (isObject(data.style)) {
  3175. traverse(data.style);
  3176. }
  3177. if (isObject(data.class)) {
  3178. traverse(data.class);
  3179. }
  3180. }
  3181. /* */
  3182. function initRender (vm) {
  3183. vm._vnode = null; // the root of the child tree
  3184. vm._staticTrees = null; // v-once cached trees
  3185. var options = vm.$options;
  3186. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  3187. var renderContext = parentVnode && parentVnode.context;
  3188. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  3189. vm.$scopedSlots = emptyObject;
  3190. // bind the createElement fn to this instance
  3191. // so that we get proper render context inside it.
  3192. // args order: tag, data, children, normalizationType, alwaysNormalize
  3193. // internal version is used by render functions compiled from templates
  3194. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  3195. // normalization is always applied for the public version, used in
  3196. // user-written render functions.
  3197. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  3198. // $attrs & $listeners are exposed for easier HOC creation.
  3199. // they need to be reactive so that HOCs using them are always updated
  3200. var parentData = parentVnode && parentVnode.data;
  3201. /* istanbul ignore else */
  3202. {
  3203. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  3204. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  3205. }, true);
  3206. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  3207. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  3208. }, true);
  3209. }
  3210. }
  3211. var currentRenderingInstance = null;
  3212. function renderMixin (Vue) {
  3213. // install runtime convenience helpers
  3214. installRenderHelpers(Vue.prototype);
  3215. Vue.prototype.$nextTick = function (fn) {
  3216. return nextTick(fn, this)
  3217. };
  3218. Vue.prototype._render = function () {
  3219. var vm = this;
  3220. var ref = vm.$options;
  3221. var render = ref.render;
  3222. var _parentVnode = ref._parentVnode;
  3223. if (_parentVnode) {
  3224. vm.$scopedSlots = normalizeScopedSlots(
  3225. _parentVnode.data.scopedSlots,
  3226. vm.$slots,
  3227. vm.$scopedSlots
  3228. );
  3229. }
  3230. // set parent vnode. this allows render functions to have access
  3231. // to the data on the placeholder node.
  3232. vm.$vnode = _parentVnode;
  3233. // render self
  3234. var vnode;
  3235. try {
  3236. // There's no need to maintain a stack because all render fns are called
  3237. // separately from one another. Nested component's render fns are called
  3238. // when parent component is patched.
  3239. currentRenderingInstance = vm;
  3240. vnode = render.call(vm._renderProxy, vm.$createElement);
  3241. } catch (e) {
  3242. handleError(e, vm, "render");
  3243. // return error render result,
  3244. // or previous vnode to prevent render error causing blank component
  3245. /* istanbul ignore else */
  3246. if (vm.$options.renderError) {
  3247. try {
  3248. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  3249. } catch (e) {
  3250. handleError(e, vm, "renderError");
  3251. vnode = vm._vnode;
  3252. }
  3253. } else {
  3254. vnode = vm._vnode;
  3255. }
  3256. } finally {
  3257. currentRenderingInstance = null;
  3258. }
  3259. // if the returned array contains only a single node, allow it
  3260. if (Array.isArray(vnode) && vnode.length === 1) {
  3261. vnode = vnode[0];
  3262. }
  3263. // return empty vnode in case the render function errored out
  3264. if (!(vnode instanceof VNode)) {
  3265. if (Array.isArray(vnode)) {
  3266. warn(
  3267. 'Multiple root nodes returned from render function. Render function ' +
  3268. 'should return a single root node.',
  3269. vm
  3270. );
  3271. }
  3272. vnode = createEmptyVNode();
  3273. }
  3274. // set parent
  3275. vnode.parent = _parentVnode;
  3276. return vnode
  3277. };
  3278. }
  3279. /* */
  3280. function ensureCtor (comp, base) {
  3281. if (
  3282. comp.__esModule ||
  3283. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  3284. ) {
  3285. comp = comp.default;
  3286. }
  3287. return isObject(comp)
  3288. ? base.extend(comp)
  3289. : comp
  3290. }
  3291. function createAsyncPlaceholder (
  3292. factory,
  3293. data,
  3294. context,
  3295. children,
  3296. tag
  3297. ) {
  3298. var node = createEmptyVNode();
  3299. node.asyncFactory = factory;
  3300. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  3301. return node
  3302. }
  3303. function resolveAsyncComponent (
  3304. factory,
  3305. baseCtor
  3306. ) {
  3307. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  3308. return factory.errorComp
  3309. }
  3310. if (isDef(factory.resolved)) {
  3311. return factory.resolved
  3312. }
  3313. var owner = currentRenderingInstance;
  3314. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  3315. // already pending
  3316. factory.owners.push(owner);
  3317. }
  3318. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  3319. return factory.loadingComp
  3320. }
  3321. if (owner && !isDef(factory.owners)) {
  3322. var owners = factory.owners = [owner];
  3323. var sync = true;
  3324. var timerLoading = null;
  3325. var timerTimeout = null
  3326. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  3327. var forceRender = function (renderCompleted) {
  3328. for (var i = 0, l = owners.length; i < l; i++) {
  3329. (owners[i]).$forceUpdate();
  3330. }
  3331. if (renderCompleted) {
  3332. owners.length = 0;
  3333. if (timerLoading !== null) {
  3334. clearTimeout(timerLoading);
  3335. timerLoading = null;
  3336. }
  3337. if (timerTimeout !== null) {
  3338. clearTimeout(timerTimeout);
  3339. timerTimeout = null;
  3340. }
  3341. }
  3342. };
  3343. var resolve = once(function (res) {
  3344. // cache resolved
  3345. factory.resolved = ensureCtor(res, baseCtor);
  3346. // invoke callbacks only if this is not a synchronous resolve
  3347. // (async resolves are shimmed as synchronous during SSR)
  3348. if (!sync) {
  3349. forceRender(true);
  3350. } else {
  3351. owners.length = 0;
  3352. }
  3353. });
  3354. var reject = once(function (reason) {
  3355. warn(
  3356. "Failed to resolve async component: " + (String(factory)) +
  3357. (reason ? ("\nReason: " + reason) : '')
  3358. );
  3359. if (isDef(factory.errorComp)) {
  3360. factory.error = true;
  3361. forceRender(true);
  3362. }
  3363. });
  3364. var res = factory(resolve, reject);
  3365. if (isObject(res)) {
  3366. if (isPromise(res)) {
  3367. // () => Promise
  3368. if (isUndef(factory.resolved)) {
  3369. res.then(resolve, reject);
  3370. }
  3371. } else if (isPromise(res.component)) {
  3372. res.component.then(resolve, reject);
  3373. if (isDef(res.error)) {
  3374. factory.errorComp = ensureCtor(res.error, baseCtor);
  3375. }
  3376. if (isDef(res.loading)) {
  3377. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  3378. if (res.delay === 0) {
  3379. factory.loading = true;
  3380. } else {
  3381. timerLoading = setTimeout(function () {
  3382. timerLoading = null;
  3383. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  3384. factory.loading = true;
  3385. forceRender(false);
  3386. }
  3387. }, res.delay || 200);
  3388. }
  3389. }
  3390. if (isDef(res.timeout)) {
  3391. timerTimeout = setTimeout(function () {
  3392. timerTimeout = null;
  3393. if (isUndef(factory.resolved)) {
  3394. reject(
  3395. "timeout (" + (res.timeout) + "ms)"
  3396. );
  3397. }
  3398. }, res.timeout);
  3399. }
  3400. }
  3401. }
  3402. sync = false;
  3403. // return in case resolved synchronously
  3404. return factory.loading
  3405. ? factory.loadingComp
  3406. : factory.resolved
  3407. }
  3408. }
  3409. /* */
  3410. function getFirstComponentChild (children) {
  3411. if (Array.isArray(children)) {
  3412. for (var i = 0; i < children.length; i++) {
  3413. var c = children[i];
  3414. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  3415. return c
  3416. }
  3417. }
  3418. }
  3419. }
  3420. /* */
  3421. /* */
  3422. function initEvents (vm) {
  3423. vm._events = Object.create(null);
  3424. vm._hasHookEvent = false;
  3425. // init parent attached events
  3426. var listeners = vm.$options._parentListeners;
  3427. if (listeners) {
  3428. updateComponentListeners(vm, listeners);
  3429. }
  3430. }
  3431. var target;
  3432. function add (event, fn) {
  3433. target.$on(event, fn);
  3434. }
  3435. function remove$1 (event, fn) {
  3436. target.$off(event, fn);
  3437. }
  3438. function createOnceHandler (event, fn) {
  3439. var _target = target;
  3440. return function onceHandler () {
  3441. var res = fn.apply(null, arguments);
  3442. if (res !== null) {
  3443. _target.$off(event, onceHandler);
  3444. }
  3445. }
  3446. }
  3447. function updateComponentListeners (
  3448. vm,
  3449. listeners,
  3450. oldListeners
  3451. ) {
  3452. target = vm;
  3453. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  3454. target = undefined;
  3455. }
  3456. function eventsMixin (Vue) {
  3457. var hookRE = /^hook:/;
  3458. Vue.prototype.$on = function (event, fn) {
  3459. var vm = this;
  3460. if (Array.isArray(event)) {
  3461. for (var i = 0, l = event.length; i < l; i++) {
  3462. vm.$on(event[i], fn);
  3463. }
  3464. } else {
  3465. (vm._events[event] || (vm._events[event] = [])).push(fn);
  3466. // optimize hook:event cost by using a boolean flag marked at registration
  3467. // instead of a hash lookup
  3468. if (hookRE.test(event)) {
  3469. vm._hasHookEvent = true;
  3470. }
  3471. }
  3472. return vm
  3473. };
  3474. Vue.prototype.$once = function (event, fn) {
  3475. var vm = this;
  3476. function on () {
  3477. vm.$off(event, on);
  3478. fn.apply(vm, arguments);
  3479. }
  3480. on.fn = fn;
  3481. vm.$on(event, on);
  3482. return vm
  3483. };
  3484. Vue.prototype.$off = function (event, fn) {
  3485. var vm = this;
  3486. // all
  3487. if (!arguments.length) {
  3488. vm._events = Object.create(null);
  3489. return vm
  3490. }
  3491. // array of events
  3492. if (Array.isArray(event)) {
  3493. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  3494. vm.$off(event[i$1], fn);
  3495. }
  3496. return vm
  3497. }
  3498. // specific event
  3499. var cbs = vm._events[event];
  3500. if (!cbs) {
  3501. return vm
  3502. }
  3503. if (!fn) {
  3504. vm._events[event] = null;
  3505. return vm
  3506. }
  3507. // specific handler
  3508. var cb;
  3509. var i = cbs.length;
  3510. while (i--) {
  3511. cb = cbs[i];
  3512. if (cb === fn || cb.fn === fn) {
  3513. cbs.splice(i, 1);
  3514. break
  3515. }
  3516. }
  3517. return vm
  3518. };
  3519. Vue.prototype.$emit = function (event) {
  3520. var vm = this;
  3521. {
  3522. var lowerCaseEvent = event.toLowerCase();
  3523. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  3524. tip(
  3525. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  3526. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  3527. "Note that HTML attributes are case-insensitive and you cannot use " +
  3528. "v-on to listen to camelCase events when using in-DOM templates. " +
  3529. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  3530. );
  3531. }
  3532. }
  3533. var cbs = vm._events[event];
  3534. if (cbs) {
  3535. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  3536. var args = toArray(arguments, 1);
  3537. var info = "event handler for \"" + event + "\"";
  3538. for (var i = 0, l = cbs.length; i < l; i++) {
  3539. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  3540. }
  3541. }
  3542. return vm
  3543. };
  3544. }
  3545. /* */
  3546. var activeInstance = null;
  3547. var isUpdatingChildComponent = false;
  3548. function setActiveInstance(vm) {
  3549. var prevActiveInstance = activeInstance;
  3550. activeInstance = vm;
  3551. return function () {
  3552. activeInstance = prevActiveInstance;
  3553. }
  3554. }
  3555. function initLifecycle (vm) {
  3556. var options = vm.$options;
  3557. // locate first non-abstract parent
  3558. var parent = options.parent;
  3559. if (parent && !options.abstract) {
  3560. while (parent.$options.abstract && parent.$parent) {
  3561. parent = parent.$parent;
  3562. }
  3563. parent.$children.push(vm);
  3564. }
  3565. vm.$parent = parent;
  3566. vm.$root = parent ? parent.$root : vm;
  3567. vm.$children = [];
  3568. vm.$refs = {};
  3569. vm._watcher = null;
  3570. vm._inactive = null;
  3571. vm._directInactive = false;
  3572. vm._isMounted = false;
  3573. vm._isDestroyed = false;
  3574. vm._isBeingDestroyed = false;
  3575. }
  3576. function lifecycleMixin (Vue) {
  3577. Vue.prototype._update = function (vnode, hydrating) {
  3578. var vm = this;
  3579. var prevEl = vm.$el;
  3580. var prevVnode = vm._vnode;
  3581. var restoreActiveInstance = setActiveInstance(vm);
  3582. vm._vnode = vnode;
  3583. // Vue.prototype.__patch__ is injected in entry points
  3584. // based on the rendering backend used.
  3585. if (!prevVnode) {
  3586. // initial render
  3587. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  3588. } else {
  3589. // updates
  3590. vm.$el = vm.__patch__(prevVnode, vnode);
  3591. }
  3592. restoreActiveInstance();
  3593. // update __vue__ reference
  3594. if (prevEl) {
  3595. prevEl.__vue__ = null;
  3596. }
  3597. if (vm.$el) {
  3598. vm.$el.__vue__ = vm;
  3599. }
  3600. // if parent is an HOC, update its $el as well
  3601. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  3602. vm.$parent.$el = vm.$el;
  3603. }
  3604. // updated hook is called by the scheduler to ensure that children are
  3605. // updated in a parent's updated hook.
  3606. };
  3607. Vue.prototype.$forceUpdate = function () {
  3608. var vm = this;
  3609. if (vm._watcher) {
  3610. vm._watcher.update();
  3611. }
  3612. };
  3613. Vue.prototype.$destroy = function () {
  3614. var vm = this;
  3615. if (vm._isBeingDestroyed) {
  3616. return
  3617. }
  3618. callHook(vm, 'beforeDestroy');
  3619. vm._isBeingDestroyed = true;
  3620. // remove self from parent
  3621. var parent = vm.$parent;
  3622. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  3623. remove(parent.$children, vm);
  3624. }
  3625. // teardown watchers
  3626. if (vm._watcher) {
  3627. vm._watcher.teardown();
  3628. }
  3629. var i = vm._watchers.length;
  3630. while (i--) {
  3631. vm._watchers[i].teardown();
  3632. }
  3633. // remove reference from data ob
  3634. // frozen object may not have observer.
  3635. if (vm._data.__ob__) {
  3636. vm._data.__ob__.vmCount--;
  3637. }
  3638. // call the last hook...
  3639. vm._isDestroyed = true;
  3640. // invoke destroy hooks on current rendered tree
  3641. vm.__patch__(vm._vnode, null);
  3642. // fire destroyed hook
  3643. callHook(vm, 'destroyed');
  3644. // turn off all instance listeners.
  3645. vm.$off();
  3646. // remove __vue__ reference
  3647. if (vm.$el) {
  3648. vm.$el.__vue__ = null;
  3649. }
  3650. // release circular reference (#6759)
  3651. if (vm.$vnode) {
  3652. vm.$vnode.parent = null;
  3653. }
  3654. };
  3655. }
  3656. function mountComponent (
  3657. vm,
  3658. el,
  3659. hydrating
  3660. ) {
  3661. vm.$el = el;
  3662. if (!vm.$options.render) {
  3663. vm.$options.render = createEmptyVNode;
  3664. {
  3665. /* istanbul ignore if */
  3666. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  3667. vm.$options.el || el) {
  3668. warn(
  3669. 'You are using the runtime-only build of Vue where the template ' +
  3670. 'compiler is not available. Either pre-compile the templates into ' +
  3671. 'render functions, or use the compiler-included build.',
  3672. vm
  3673. );
  3674. } else {
  3675. warn(
  3676. 'Failed to mount component: template or render function not defined.',
  3677. vm
  3678. );
  3679. }
  3680. }
  3681. }
  3682. callHook(vm, 'beforeMount');
  3683. var updateComponent;
  3684. /* istanbul ignore if */
  3685. if (config.performance && mark) {
  3686. updateComponent = function () {
  3687. var name = vm._name;
  3688. var id = vm._uid;
  3689. var startTag = "vue-perf-start:" + id;
  3690. var endTag = "vue-perf-end:" + id;
  3691. mark(startTag);
  3692. var vnode = vm._render();
  3693. mark(endTag);
  3694. measure(("vue " + name + " render"), startTag, endTag);
  3695. mark(startTag);
  3696. vm._update(vnode, hydrating);
  3697. mark(endTag);
  3698. measure(("vue " + name + " patch"), startTag, endTag);
  3699. };
  3700. } else {
  3701. updateComponent = function () {
  3702. vm._update(vm._render(), hydrating);
  3703. };
  3704. }
  3705. // we set this to vm._watcher inside the watcher's constructor
  3706. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  3707. // component's mounted hook), which relies on vm._watcher being already defined
  3708. new Watcher(vm, updateComponent, noop, {
  3709. before: function before () {
  3710. if (vm._isMounted && !vm._isDestroyed) {
  3711. callHook(vm, 'beforeUpdate');
  3712. }
  3713. }
  3714. }, true /* isRenderWatcher */);
  3715. hydrating = false;
  3716. // manually mounted instance, call mounted on self
  3717. // mounted is called for render-created child components in its inserted hook
  3718. if (vm.$vnode == null) {
  3719. vm._isMounted = true;
  3720. callHook(vm, 'mounted');
  3721. }
  3722. return vm
  3723. }
  3724. function updateChildComponent (
  3725. vm,
  3726. propsData,
  3727. listeners,
  3728. parentVnode,
  3729. renderChildren
  3730. ) {
  3731. {
  3732. isUpdatingChildComponent = true;
  3733. }
  3734. // determine whether component has slot children
  3735. // we need to do this before overwriting $options._renderChildren.
  3736. // check if there are dynamic scopedSlots (hand-written or compiled but with
  3737. // dynamic slot names). Static scoped slots compiled from template has the
  3738. // "$stable" marker.
  3739. var newScopedSlots = parentVnode.data.scopedSlots;
  3740. var oldScopedSlots = vm.$scopedSlots;
  3741. var hasDynamicScopedSlot = !!(
  3742. (newScopedSlots && !newScopedSlots.$stable) ||
  3743. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  3744. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
  3745. (!newScopedSlots && vm.$scopedSlots.$key)
  3746. );
  3747. // Any static slot children from the parent may have changed during parent's
  3748. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  3749. // update is necessary to ensure correctness.
  3750. var needsForceUpdate = !!(
  3751. renderChildren || // has new static slots
  3752. vm.$options._renderChildren || // has old static slots
  3753. hasDynamicScopedSlot
  3754. );
  3755. vm.$options._parentVnode = parentVnode;
  3756. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  3757. if (vm._vnode) { // update child tree's parent
  3758. vm._vnode.parent = parentVnode;
  3759. }
  3760. vm.$options._renderChildren = renderChildren;
  3761. // update $attrs and $listeners hash
  3762. // these are also reactive so they may trigger child update if the child
  3763. // used them during render
  3764. vm.$attrs = parentVnode.data.attrs || emptyObject;
  3765. vm.$listeners = listeners || emptyObject;
  3766. // update props
  3767. if (propsData && vm.$options.props) {
  3768. toggleObserving(false);
  3769. var props = vm._props;
  3770. var propKeys = vm.$options._propKeys || [];
  3771. for (var i = 0; i < propKeys.length; i++) {
  3772. var key = propKeys[i];
  3773. var propOptions = vm.$options.props; // wtf flow?
  3774. props[key] = validateProp(key, propOptions, propsData, vm);
  3775. }
  3776. toggleObserving(true);
  3777. // keep a copy of raw propsData
  3778. vm.$options.propsData = propsData;
  3779. }
  3780. // update listeners
  3781. listeners = listeners || emptyObject;
  3782. var oldListeners = vm.$options._parentListeners;
  3783. vm.$options._parentListeners = listeners;
  3784. updateComponentListeners(vm, listeners, oldListeners);
  3785. // resolve slots + force update if has children
  3786. if (needsForceUpdate) {
  3787. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  3788. vm.$forceUpdate();
  3789. }
  3790. {
  3791. isUpdatingChildComponent = false;
  3792. }
  3793. }
  3794. function isInInactiveTree (vm) {
  3795. while (vm && (vm = vm.$parent)) {
  3796. if (vm._inactive) { return true }
  3797. }
  3798. return false
  3799. }
  3800. function activateChildComponent (vm, direct) {
  3801. if (direct) {
  3802. vm._directInactive = false;
  3803. if (isInInactiveTree(vm)) {
  3804. return
  3805. }
  3806. } else if (vm._directInactive) {
  3807. return
  3808. }
  3809. if (vm._inactive || vm._inactive === null) {
  3810. vm._inactive = false;
  3811. for (var i = 0; i < vm.$children.length; i++) {
  3812. activateChildComponent(vm.$children[i]);
  3813. }
  3814. callHook(vm, 'activated');
  3815. }
  3816. }
  3817. function deactivateChildComponent (vm, direct) {
  3818. if (direct) {
  3819. vm._directInactive = true;
  3820. if (isInInactiveTree(vm)) {
  3821. return
  3822. }
  3823. }
  3824. if (!vm._inactive) {
  3825. vm._inactive = true;
  3826. for (var i = 0; i < vm.$children.length; i++) {
  3827. deactivateChildComponent(vm.$children[i]);
  3828. }
  3829. callHook(vm, 'deactivated');
  3830. }
  3831. }
  3832. function callHook (vm, hook) {
  3833. // #7573 disable dep collection when invoking lifecycle hooks
  3834. pushTarget();
  3835. var handlers = vm.$options[hook];
  3836. var info = hook + " hook";
  3837. if (handlers) {
  3838. for (var i = 0, j = handlers.length; i < j; i++) {
  3839. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  3840. }
  3841. }
  3842. if (vm._hasHookEvent) {
  3843. vm.$emit('hook:' + hook);
  3844. }
  3845. popTarget();
  3846. }
  3847. /* */
  3848. var MAX_UPDATE_COUNT = 100;
  3849. var queue = [];
  3850. var activatedChildren = [];
  3851. var has = {};
  3852. var circular = {};
  3853. var waiting = false;
  3854. var flushing = false;
  3855. var index = 0;
  3856. /**
  3857. * Reset the scheduler's state.
  3858. */
  3859. function resetSchedulerState () {
  3860. index = queue.length = activatedChildren.length = 0;
  3861. has = {};
  3862. {
  3863. circular = {};
  3864. }
  3865. waiting = flushing = false;
  3866. }
  3867. // Async edge case #6566 requires saving the timestamp when event listeners are
  3868. // attached. However, calling performance.now() has a perf overhead especially
  3869. // if the page has thousands of event listeners. Instead, we take a timestamp
  3870. // every time the scheduler flushes and use that for all event listeners
  3871. // attached during that flush.
  3872. var currentFlushTimestamp = 0;
  3873. // Async edge case fix requires storing an event listener's attach timestamp.
  3874. var getNow = Date.now;
  3875. // Determine what event timestamp the browser is using. Annoyingly, the
  3876. // timestamp can either be hi-res (relative to page load) or low-res
  3877. // (relative to UNIX epoch), so in order to compare time we have to use the
  3878. // same timestamp type when saving the flush timestamp.
  3879. // All IE versions use low-res event timestamps, and have problematic clock
  3880. // implementations (#9632)
  3881. if (inBrowser && !isIE) {
  3882. var performance = window.performance;
  3883. if (
  3884. performance &&
  3885. typeof performance.now === 'function' &&
  3886. getNow() > document.createEvent('Event').timeStamp
  3887. ) {
  3888. // if the event timestamp, although evaluated AFTER the Date.now(), is
  3889. // smaller than it, it means the event is using a hi-res timestamp,
  3890. // and we need to use the hi-res version for event listener timestamps as
  3891. // well.
  3892. getNow = function () { return performance.now(); };
  3893. }
  3894. }
  3895. /**
  3896. * Flush both queues and run the watchers.
  3897. */
  3898. function flushSchedulerQueue () {
  3899. currentFlushTimestamp = getNow();
  3900. flushing = true;
  3901. var watcher, id;
  3902. // Sort queue before flush.
  3903. // This ensures that:
  3904. // 1. Components are updated from parent to child. (because parent is always
  3905. // created before the child)
  3906. // 2. A component's user watchers are run before its render watcher (because
  3907. // user watchers are created before the render watcher)
  3908. // 3. If a component is destroyed during a parent component's watcher run,
  3909. // its watchers can be skipped.
  3910. queue.sort(function (a, b) { return a.id - b.id; });
  3911. // do not cache length because more watchers might be pushed
  3912. // as we run existing watchers
  3913. for (index = 0; index < queue.length; index++) {
  3914. watcher = queue[index];
  3915. if (watcher.before) {
  3916. watcher.before();
  3917. }
  3918. id = watcher.id;
  3919. has[id] = null;
  3920. watcher.run();
  3921. // in dev build, check and stop circular updates.
  3922. if (has[id] != null) {
  3923. circular[id] = (circular[id] || 0) + 1;
  3924. if (circular[id] > MAX_UPDATE_COUNT) {
  3925. warn(
  3926. 'You may have an infinite update loop ' + (
  3927. watcher.user
  3928. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  3929. : "in a component render function."
  3930. ),
  3931. watcher.vm
  3932. );
  3933. break
  3934. }
  3935. }
  3936. }
  3937. // keep copies of post queues before resetting state
  3938. var activatedQueue = activatedChildren.slice();
  3939. var updatedQueue = queue.slice();
  3940. resetSchedulerState();
  3941. // call component updated and activated hooks
  3942. callActivatedHooks(activatedQueue);
  3943. callUpdatedHooks(updatedQueue);
  3944. // devtool hook
  3945. /* istanbul ignore if */
  3946. if (devtools && config.devtools) {
  3947. devtools.emit('flush');
  3948. }
  3949. }
  3950. function callUpdatedHooks (queue) {
  3951. var i = queue.length;
  3952. while (i--) {
  3953. var watcher = queue[i];
  3954. var vm = watcher.vm;
  3955. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  3956. callHook(vm, 'updated');
  3957. }
  3958. }
  3959. }
  3960. /**
  3961. * Queue a kept-alive component that was activated during patch.
  3962. * The queue will be processed after the entire tree has been patched.
  3963. */
  3964. function queueActivatedComponent (vm) {
  3965. // setting _inactive to false here so that a render function can
  3966. // rely on checking whether it's in an inactive tree (e.g. router-view)
  3967. vm._inactive = false;
  3968. activatedChildren.push(vm);
  3969. }
  3970. function callActivatedHooks (queue) {
  3971. for (var i = 0; i < queue.length; i++) {
  3972. queue[i]._inactive = true;
  3973. activateChildComponent(queue[i], true /* true */);
  3974. }
  3975. }
  3976. /**
  3977. * Push a watcher into the watcher queue.
  3978. * Jobs with duplicate IDs will be skipped unless it's
  3979. * pushed when the queue is being flushed.
  3980. */
  3981. function queueWatcher (watcher) {
  3982. var id = watcher.id;
  3983. if (has[id] == null) {
  3984. has[id] = true;
  3985. if (!flushing) {
  3986. queue.push(watcher);
  3987. } else {
  3988. // if already flushing, splice the watcher based on its id
  3989. // if already past its id, it will be run next immediately.
  3990. var i = queue.length - 1;
  3991. while (i > index && queue[i].id > watcher.id) {
  3992. i--;
  3993. }
  3994. queue.splice(i + 1, 0, watcher);
  3995. }
  3996. // queue the flush
  3997. if (!waiting) {
  3998. waiting = true;
  3999. if (!config.async) {
  4000. flushSchedulerQueue();
  4001. return
  4002. }
  4003. nextTick(flushSchedulerQueue);
  4004. }
  4005. }
  4006. }
  4007. /* */
  4008. var uid$2 = 0;
  4009. /**
  4010. * A watcher parses an expression, collects dependencies,
  4011. * and fires callback when the expression value changes.
  4012. * This is used for both the $watch() api and directives.
  4013. */
  4014. var Watcher = function Watcher (
  4015. vm,
  4016. expOrFn,
  4017. cb,
  4018. options,
  4019. isRenderWatcher
  4020. ) {
  4021. this.vm = vm;
  4022. if (isRenderWatcher) {
  4023. vm._watcher = this;
  4024. }
  4025. vm._watchers.push(this);
  4026. // options
  4027. if (options) {
  4028. this.deep = !!options.deep;
  4029. this.user = !!options.user;
  4030. this.lazy = !!options.lazy;
  4031. this.sync = !!options.sync;
  4032. this.before = options.before;
  4033. } else {
  4034. this.deep = this.user = this.lazy = this.sync = false;
  4035. }
  4036. this.cb = cb;
  4037. this.id = ++uid$2; // uid for batching
  4038. this.active = true;
  4039. this.dirty = this.lazy; // for lazy watchers
  4040. this.deps = [];
  4041. this.newDeps = [];
  4042. this.depIds = new _Set();
  4043. this.newDepIds = new _Set();
  4044. this.expression = expOrFn.toString();
  4045. // parse expression for getter
  4046. if (typeof expOrFn === 'function') {
  4047. this.getter = expOrFn;
  4048. } else {
  4049. this.getter = parsePath(expOrFn);
  4050. if (!this.getter) {
  4051. this.getter = noop;
  4052. warn(
  4053. "Failed watching path: \"" + expOrFn + "\" " +
  4054. 'Watcher only accepts simple dot-delimited paths. ' +
  4055. 'For full control, use a function instead.',
  4056. vm
  4057. );
  4058. }
  4059. }
  4060. this.value = this.lazy
  4061. ? undefined
  4062. : this.get();
  4063. };
  4064. /**
  4065. * Evaluate the getter, and re-collect dependencies.
  4066. */
  4067. Watcher.prototype.get = function get () {
  4068. pushTarget(this);
  4069. var value;
  4070. var vm = this.vm;
  4071. try {
  4072. value = this.getter.call(vm, vm);
  4073. } catch (e) {
  4074. if (this.user) {
  4075. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  4076. } else {
  4077. throw e
  4078. }
  4079. } finally {
  4080. // "touch" every property so they are all tracked as
  4081. // dependencies for deep watching
  4082. if (this.deep) {
  4083. traverse(value);
  4084. }
  4085. popTarget();
  4086. this.cleanupDeps();
  4087. }
  4088. return value
  4089. };
  4090. /**
  4091. * Add a dependency to this directive.
  4092. */
  4093. Watcher.prototype.addDep = function addDep (dep) {
  4094. var id = dep.id;
  4095. if (!this.newDepIds.has(id)) {
  4096. this.newDepIds.add(id);
  4097. this.newDeps.push(dep);
  4098. if (!this.depIds.has(id)) {
  4099. dep.addSub(this);
  4100. }
  4101. }
  4102. };
  4103. /**
  4104. * Clean up for dependency collection.
  4105. */
  4106. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  4107. var i = this.deps.length;
  4108. while (i--) {
  4109. var dep = this.deps[i];
  4110. if (!this.newDepIds.has(dep.id)) {
  4111. dep.removeSub(this);
  4112. }
  4113. }
  4114. var tmp = this.depIds;
  4115. this.depIds = this.newDepIds;
  4116. this.newDepIds = tmp;
  4117. this.newDepIds.clear();
  4118. tmp = this.deps;
  4119. this.deps = this.newDeps;
  4120. this.newDeps = tmp;
  4121. this.newDeps.length = 0;
  4122. };
  4123. /**
  4124. * Subscriber interface.
  4125. * Will be called when a dependency changes.
  4126. */
  4127. Watcher.prototype.update = function update () {
  4128. /* istanbul ignore else */
  4129. if (this.lazy) {
  4130. this.dirty = true;
  4131. } else if (this.sync) {
  4132. this.run();
  4133. } else {
  4134. queueWatcher(this);
  4135. }
  4136. };
  4137. /**
  4138. * Scheduler job interface.
  4139. * Will be called by the scheduler.
  4140. */
  4141. Watcher.prototype.run = function run () {
  4142. if (this.active) {
  4143. var value = this.get();
  4144. if (
  4145. value !== this.value ||
  4146. // Deep watchers and watchers on Object/Arrays should fire even
  4147. // when the value is the same, because the value may
  4148. // have mutated.
  4149. isObject(value) ||
  4150. this.deep
  4151. ) {
  4152. // set new value
  4153. var oldValue = this.value;
  4154. this.value = value;
  4155. if (this.user) {
  4156. var info = "callback for watcher \"" + (this.expression) + "\"";
  4157. invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info);
  4158. } else {
  4159. this.cb.call(this.vm, value, oldValue);
  4160. }
  4161. }
  4162. }
  4163. };
  4164. /**
  4165. * Evaluate the value of the watcher.
  4166. * This only gets called for lazy watchers.
  4167. */
  4168. Watcher.prototype.evaluate = function evaluate () {
  4169. this.value = this.get();
  4170. this.dirty = false;
  4171. };
  4172. /**
  4173. * Depend on all deps collected by this watcher.
  4174. */
  4175. Watcher.prototype.depend = function depend () {
  4176. var i = this.deps.length;
  4177. while (i--) {
  4178. this.deps[i].depend();
  4179. }
  4180. };
  4181. /**
  4182. * Remove self from all dependencies' subscriber list.
  4183. */
  4184. Watcher.prototype.teardown = function teardown () {
  4185. if (this.active) {
  4186. // remove self from vm's watcher list
  4187. // this is a somewhat expensive operation so we skip it
  4188. // if the vm is being destroyed.
  4189. if (!this.vm._isBeingDestroyed) {
  4190. remove(this.vm._watchers, this);
  4191. }
  4192. var i = this.deps.length;
  4193. while (i--) {
  4194. this.deps[i].removeSub(this);
  4195. }
  4196. this.active = false;
  4197. }
  4198. };
  4199. /* */
  4200. var sharedPropertyDefinition = {
  4201. enumerable: true,
  4202. configurable: true,
  4203. get: noop,
  4204. set: noop
  4205. };
  4206. function proxy (target, sourceKey, key) {
  4207. sharedPropertyDefinition.get = function proxyGetter () {
  4208. return this[sourceKey][key]
  4209. };
  4210. sharedPropertyDefinition.set = function proxySetter (val) {
  4211. this[sourceKey][key] = val;
  4212. };
  4213. Object.defineProperty(target, key, sharedPropertyDefinition);
  4214. }
  4215. function initState (vm) {
  4216. vm._watchers = [];
  4217. var opts = vm.$options;
  4218. if (opts.props) { initProps(vm, opts.props); }
  4219. if (opts.methods) { initMethods(vm, opts.methods); }
  4220. if (opts.data) {
  4221. initData(vm);
  4222. } else {
  4223. observe(vm._data = {}, true /* asRootData */);
  4224. }
  4225. if (opts.computed) { initComputed(vm, opts.computed); }
  4226. if (opts.watch && opts.watch !== nativeWatch) {
  4227. initWatch(vm, opts.watch);
  4228. }
  4229. }
  4230. function initProps (vm, propsOptions) {
  4231. var propsData = vm.$options.propsData || {};
  4232. var props = vm._props = {};
  4233. // cache prop keys so that future props updates can iterate using Array
  4234. // instead of dynamic object key enumeration.
  4235. var keys = vm.$options._propKeys = [];
  4236. var isRoot = !vm.$parent;
  4237. // root instance props should be converted
  4238. if (!isRoot) {
  4239. toggleObserving(false);
  4240. }
  4241. var loop = function ( key ) {
  4242. keys.push(key);
  4243. var value = validateProp(key, propsOptions, propsData, vm);
  4244. /* istanbul ignore else */
  4245. {
  4246. var hyphenatedKey = hyphenate(key);
  4247. if (isReservedAttribute(hyphenatedKey) ||
  4248. config.isReservedAttr(hyphenatedKey)) {
  4249. warn(
  4250. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  4251. vm
  4252. );
  4253. }
  4254. defineReactive$$1(props, key, value, function () {
  4255. if (!isRoot && !isUpdatingChildComponent) {
  4256. warn(
  4257. "Avoid mutating a prop directly since the value will be " +
  4258. "overwritten whenever the parent component re-renders. " +
  4259. "Instead, use a data or computed property based on the prop's " +
  4260. "value. Prop being mutated: \"" + key + "\"",
  4261. vm
  4262. );
  4263. }
  4264. });
  4265. }
  4266. // static props are already proxied on the component's prototype
  4267. // during Vue.extend(). We only need to proxy props defined at
  4268. // instantiation here.
  4269. if (!(key in vm)) {
  4270. proxy(vm, "_props", key);
  4271. }
  4272. };
  4273. for (var key in propsOptions) loop( key );
  4274. toggleObserving(true);
  4275. }
  4276. function initData (vm) {
  4277. var data = vm.$options.data;
  4278. data = vm._data = typeof data === 'function'
  4279. ? getData(data, vm)
  4280. : data || {};
  4281. if (!isPlainObject(data)) {
  4282. data = {};
  4283. warn(
  4284. 'data functions should return an object:\n' +
  4285. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  4286. vm
  4287. );
  4288. }
  4289. // proxy data on instance
  4290. var keys = Object.keys(data);
  4291. var props = vm.$options.props;
  4292. var methods = vm.$options.methods;
  4293. var i = keys.length;
  4294. while (i--) {
  4295. var key = keys[i];
  4296. {
  4297. if (methods && hasOwn(methods, key)) {
  4298. warn(
  4299. ("Method \"" + key + "\" has already been defined as a data property."),
  4300. vm
  4301. );
  4302. }
  4303. }
  4304. if (props && hasOwn(props, key)) {
  4305. warn(
  4306. "The data property \"" + key + "\" is already declared as a prop. " +
  4307. "Use prop default value instead.",
  4308. vm
  4309. );
  4310. } else if (!isReserved(key)) {
  4311. proxy(vm, "_data", key);
  4312. }
  4313. }
  4314. // observe data
  4315. observe(data, true /* asRootData */);
  4316. }
  4317. function getData (data, vm) {
  4318. // #7573 disable dep collection when invoking data getters
  4319. pushTarget();
  4320. try {
  4321. return data.call(vm, vm)
  4322. } catch (e) {
  4323. handleError(e, vm, "data()");
  4324. return {}
  4325. } finally {
  4326. popTarget();
  4327. }
  4328. }
  4329. var computedWatcherOptions = { lazy: true };
  4330. function initComputed (vm, computed) {
  4331. // $flow-disable-line
  4332. var watchers = vm._computedWatchers = Object.create(null);
  4333. // computed properties are just getters during SSR
  4334. var isSSR = isServerRendering();
  4335. for (var key in computed) {
  4336. var userDef = computed[key];
  4337. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  4338. if (getter == null) {
  4339. warn(
  4340. ("Getter is missing for computed property \"" + key + "\"."),
  4341. vm
  4342. );
  4343. }
  4344. if (!isSSR) {
  4345. // create internal watcher for the computed property.
  4346. watchers[key] = new Watcher(
  4347. vm,
  4348. getter || noop,
  4349. noop,
  4350. computedWatcherOptions
  4351. );
  4352. }
  4353. // component-defined computed properties are already defined on the
  4354. // component prototype. We only need to define computed properties defined
  4355. // at instantiation here.
  4356. if (!(key in vm)) {
  4357. defineComputed(vm, key, userDef);
  4358. } else {
  4359. if (key in vm.$data) {
  4360. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  4361. } else if (vm.$options.props && key in vm.$options.props) {
  4362. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  4363. } else if (vm.$options.methods && key in vm.$options.methods) {
  4364. warn(("The computed property \"" + key + "\" is already defined as a method."), vm);
  4365. }
  4366. }
  4367. }
  4368. }
  4369. function defineComputed (
  4370. target,
  4371. key,
  4372. userDef
  4373. ) {
  4374. var shouldCache = !isServerRendering();
  4375. if (typeof userDef === 'function') {
  4376. sharedPropertyDefinition.get = shouldCache
  4377. ? createComputedGetter(key)
  4378. : createGetterInvoker(userDef);
  4379. sharedPropertyDefinition.set = noop;
  4380. } else {
  4381. sharedPropertyDefinition.get = userDef.get
  4382. ? shouldCache && userDef.cache !== false
  4383. ? createComputedGetter(key)
  4384. : createGetterInvoker(userDef.get)
  4385. : noop;
  4386. sharedPropertyDefinition.set = userDef.set || noop;
  4387. }
  4388. if (sharedPropertyDefinition.set === noop) {
  4389. sharedPropertyDefinition.set = function () {
  4390. warn(
  4391. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  4392. this
  4393. );
  4394. };
  4395. }
  4396. Object.defineProperty(target, key, sharedPropertyDefinition);
  4397. }
  4398. function createComputedGetter (key) {
  4399. return function computedGetter () {
  4400. var watcher = this._computedWatchers && this._computedWatchers[key];
  4401. if (watcher) {
  4402. if (watcher.dirty) {
  4403. watcher.evaluate();
  4404. }
  4405. if (Dep.target) {
  4406. watcher.depend();
  4407. }
  4408. return watcher.value
  4409. }
  4410. }
  4411. }
  4412. function createGetterInvoker(fn) {
  4413. return function computedGetter () {
  4414. return fn.call(this, this)
  4415. }
  4416. }
  4417. function initMethods (vm, methods) {
  4418. var props = vm.$options.props;
  4419. for (var key in methods) {
  4420. {
  4421. if (typeof methods[key] !== 'function') {
  4422. warn(
  4423. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  4424. "Did you reference the function correctly?",
  4425. vm
  4426. );
  4427. }
  4428. if (props && hasOwn(props, key)) {
  4429. warn(
  4430. ("Method \"" + key + "\" has already been defined as a prop."),
  4431. vm
  4432. );
  4433. }
  4434. if ((key in vm) && isReserved(key)) {
  4435. warn(
  4436. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  4437. "Avoid defining component methods that start with _ or $."
  4438. );
  4439. }
  4440. }
  4441. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  4442. }
  4443. }
  4444. function initWatch (vm, watch) {
  4445. for (var key in watch) {
  4446. var handler = watch[key];
  4447. if (Array.isArray(handler)) {
  4448. for (var i = 0; i < handler.length; i++) {
  4449. createWatcher(vm, key, handler[i]);
  4450. }
  4451. } else {
  4452. createWatcher(vm, key, handler);
  4453. }
  4454. }
  4455. }
  4456. function createWatcher (
  4457. vm,
  4458. expOrFn,
  4459. handler,
  4460. options
  4461. ) {
  4462. if (isPlainObject(handler)) {
  4463. options = handler;
  4464. handler = handler.handler;
  4465. }
  4466. if (typeof handler === 'string') {
  4467. handler = vm[handler];
  4468. }
  4469. return vm.$watch(expOrFn, handler, options)
  4470. }
  4471. function stateMixin (Vue) {
  4472. // flow somehow has problems with directly declared definition object
  4473. // when using Object.defineProperty, so we have to procedurally build up
  4474. // the object here.
  4475. var dataDef = {};
  4476. dataDef.get = function () { return this._data };
  4477. var propsDef = {};
  4478. propsDef.get = function () { return this._props };
  4479. {
  4480. dataDef.set = function () {
  4481. warn(
  4482. 'Avoid replacing instance root $data. ' +
  4483. 'Use nested data properties instead.',
  4484. this
  4485. );
  4486. };
  4487. propsDef.set = function () {
  4488. warn("$props is readonly.", this);
  4489. };
  4490. }
  4491. Object.defineProperty(Vue.prototype, '$data', dataDef);
  4492. Object.defineProperty(Vue.prototype, '$props', propsDef);
  4493. Vue.prototype.$set = set;
  4494. Vue.prototype.$delete = del;
  4495. Vue.prototype.$watch = function (
  4496. expOrFn,
  4497. cb,
  4498. options
  4499. ) {
  4500. var vm = this;
  4501. if (isPlainObject(cb)) {
  4502. return createWatcher(vm, expOrFn, cb, options)
  4503. }
  4504. options = options || {};
  4505. options.user = true;
  4506. var watcher = new Watcher(vm, expOrFn, cb, options);
  4507. if (options.immediate) {
  4508. var info = "callback for immediate watcher \"" + (watcher.expression) + "\"";
  4509. pushTarget();
  4510. invokeWithErrorHandling(cb, vm, [watcher.value], vm, info);
  4511. popTarget();
  4512. }
  4513. return function unwatchFn () {
  4514. watcher.teardown();
  4515. }
  4516. };
  4517. }
  4518. /* */
  4519. var uid$3 = 0;
  4520. function initMixin (Vue) {
  4521. Vue.prototype._init = function (options) {
  4522. var vm = this;
  4523. // a uid
  4524. vm._uid = uid$3++;
  4525. var startTag, endTag;
  4526. /* istanbul ignore if */
  4527. if (config.performance && mark) {
  4528. startTag = "vue-perf-start:" + (vm._uid);
  4529. endTag = "vue-perf-end:" + (vm._uid);
  4530. mark(startTag);
  4531. }
  4532. // a flag to avoid this being observed
  4533. vm._isVue = true;
  4534. // merge options
  4535. if (options && options._isComponent) {
  4536. // optimize internal component instantiation
  4537. // since dynamic options merging is pretty slow, and none of the
  4538. // internal component options needs special treatment.
  4539. initInternalComponent(vm, options);
  4540. } else {
  4541. vm.$options = mergeOptions(
  4542. resolveConstructorOptions(vm.constructor),
  4543. options || {},
  4544. vm
  4545. );
  4546. }
  4547. /* istanbul ignore else */
  4548. {
  4549. initProxy(vm);
  4550. }
  4551. // expose real self
  4552. vm._self = vm;
  4553. initLifecycle(vm);
  4554. initEvents(vm);
  4555. initRender(vm);
  4556. callHook(vm, 'beforeCreate');
  4557. initInjections(vm); // resolve injections before data/props
  4558. initState(vm);
  4559. initProvide(vm); // resolve provide after data/props
  4560. callHook(vm, 'created');
  4561. /* istanbul ignore if */
  4562. if (config.performance && mark) {
  4563. vm._name = formatComponentName(vm, false);
  4564. mark(endTag);
  4565. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  4566. }
  4567. if (vm.$options.el) {
  4568. vm.$mount(vm.$options.el);
  4569. }
  4570. };
  4571. }
  4572. function initInternalComponent (vm, options) {
  4573. var opts = vm.$options = Object.create(vm.constructor.options);
  4574. // doing this because it's faster than dynamic enumeration.
  4575. var parentVnode = options._parentVnode;
  4576. opts.parent = options.parent;
  4577. opts._parentVnode = parentVnode;
  4578. var vnodeComponentOptions = parentVnode.componentOptions;
  4579. opts.propsData = vnodeComponentOptions.propsData;
  4580. opts._parentListeners = vnodeComponentOptions.listeners;
  4581. opts._renderChildren = vnodeComponentOptions.children;
  4582. opts._componentTag = vnodeComponentOptions.tag;
  4583. if (options.render) {
  4584. opts.render = options.render;
  4585. opts.staticRenderFns = options.staticRenderFns;
  4586. }
  4587. }
  4588. function resolveConstructorOptions (Ctor) {
  4589. var options = Ctor.options;
  4590. if (Ctor.super) {
  4591. var superOptions = resolveConstructorOptions(Ctor.super);
  4592. var cachedSuperOptions = Ctor.superOptions;
  4593. if (superOptions !== cachedSuperOptions) {
  4594. // super option changed,
  4595. // need to resolve new options.
  4596. Ctor.superOptions = superOptions;
  4597. // check if there are any late-modified/attached options (#4976)
  4598. var modifiedOptions = resolveModifiedOptions(Ctor);
  4599. // update base extend options
  4600. if (modifiedOptions) {
  4601. extend(Ctor.extendOptions, modifiedOptions);
  4602. }
  4603. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4604. if (options.name) {
  4605. options.components[options.name] = Ctor;
  4606. }
  4607. }
  4608. }
  4609. return options
  4610. }
  4611. function resolveModifiedOptions (Ctor) {
  4612. var modified;
  4613. var latest = Ctor.options;
  4614. var sealed = Ctor.sealedOptions;
  4615. for (var key in latest) {
  4616. if (latest[key] !== sealed[key]) {
  4617. if (!modified) { modified = {}; }
  4618. modified[key] = latest[key];
  4619. }
  4620. }
  4621. return modified
  4622. }
  4623. function Vue (options) {
  4624. if (!(this instanceof Vue)
  4625. ) {
  4626. warn('Vue is a constructor and should be called with the `new` keyword');
  4627. }
  4628. this._init(options);
  4629. }
  4630. initMixin(Vue);
  4631. stateMixin(Vue);
  4632. eventsMixin(Vue);
  4633. lifecycleMixin(Vue);
  4634. renderMixin(Vue);
  4635. /* */
  4636. function initUse (Vue) {
  4637. Vue.use = function (plugin) {
  4638. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  4639. if (installedPlugins.indexOf(plugin) > -1) {
  4640. return this
  4641. }
  4642. // additional parameters
  4643. var args = toArray(arguments, 1);
  4644. args.unshift(this);
  4645. if (typeof plugin.install === 'function') {
  4646. plugin.install.apply(plugin, args);
  4647. } else if (typeof plugin === 'function') {
  4648. plugin.apply(null, args);
  4649. }
  4650. installedPlugins.push(plugin);
  4651. return this
  4652. };
  4653. }
  4654. /* */
  4655. function initMixin$1 (Vue) {
  4656. Vue.mixin = function (mixin) {
  4657. this.options = mergeOptions(this.options, mixin);
  4658. return this
  4659. };
  4660. }
  4661. /* */
  4662. function initExtend (Vue) {
  4663. /**
  4664. * Each instance constructor, including Vue, has a unique
  4665. * cid. This enables us to create wrapped "child
  4666. * constructors" for prototypal inheritance and cache them.
  4667. */
  4668. Vue.cid = 0;
  4669. var cid = 1;
  4670. /**
  4671. * Class inheritance
  4672. */
  4673. Vue.extend = function (extendOptions) {
  4674. extendOptions = extendOptions || {};
  4675. var Super = this;
  4676. var SuperId = Super.cid;
  4677. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  4678. if (cachedCtors[SuperId]) {
  4679. return cachedCtors[SuperId]
  4680. }
  4681. var name = extendOptions.name || Super.options.name;
  4682. if (name) {
  4683. validateComponentName(name);
  4684. }
  4685. var Sub = function VueComponent (options) {
  4686. this._init(options);
  4687. };
  4688. Sub.prototype = Object.create(Super.prototype);
  4689. Sub.prototype.constructor = Sub;
  4690. Sub.cid = cid++;
  4691. Sub.options = mergeOptions(
  4692. Super.options,
  4693. extendOptions
  4694. );
  4695. Sub['super'] = Super;
  4696. // For props and computed properties, we define the proxy getters on
  4697. // the Vue instances at extension time, on the extended prototype. This
  4698. // avoids Object.defineProperty calls for each instance created.
  4699. if (Sub.options.props) {
  4700. initProps$1(Sub);
  4701. }
  4702. if (Sub.options.computed) {
  4703. initComputed$1(Sub);
  4704. }
  4705. // allow further extension/mixin/plugin usage
  4706. Sub.extend = Super.extend;
  4707. Sub.mixin = Super.mixin;
  4708. Sub.use = Super.use;
  4709. // create asset registers, so extended classes
  4710. // can have their private assets too.
  4711. ASSET_TYPES.forEach(function (type) {
  4712. Sub[type] = Super[type];
  4713. });
  4714. // enable recursive self-lookup
  4715. if (name) {
  4716. Sub.options.components[name] = Sub;
  4717. }
  4718. // keep a reference to the super options at extension time.
  4719. // later at instantiation we can check if Super's options have
  4720. // been updated.
  4721. Sub.superOptions = Super.options;
  4722. Sub.extendOptions = extendOptions;
  4723. Sub.sealedOptions = extend({}, Sub.options);
  4724. // cache constructor
  4725. cachedCtors[SuperId] = Sub;
  4726. return Sub
  4727. };
  4728. }
  4729. function initProps$1 (Comp) {
  4730. var props = Comp.options.props;
  4731. for (var key in props) {
  4732. proxy(Comp.prototype, "_props", key);
  4733. }
  4734. }
  4735. function initComputed$1 (Comp) {
  4736. var computed = Comp.options.computed;
  4737. for (var key in computed) {
  4738. defineComputed(Comp.prototype, key, computed[key]);
  4739. }
  4740. }
  4741. /* */
  4742. function initAssetRegisters (Vue) {
  4743. /**
  4744. * Create asset registration methods.
  4745. */
  4746. ASSET_TYPES.forEach(function (type) {
  4747. Vue[type] = function (
  4748. id,
  4749. definition
  4750. ) {
  4751. if (!definition) {
  4752. return this.options[type + 's'][id]
  4753. } else {
  4754. /* istanbul ignore if */
  4755. if (type === 'component') {
  4756. validateComponentName(id);
  4757. }
  4758. if (type === 'component' && isPlainObject(definition)) {
  4759. definition.name = definition.name || id;
  4760. definition = this.options._base.extend(definition);
  4761. }
  4762. if (type === 'directive' && typeof definition === 'function') {
  4763. definition = { bind: definition, update: definition };
  4764. }
  4765. this.options[type + 's'][id] = definition;
  4766. return definition
  4767. }
  4768. };
  4769. });
  4770. }
  4771. /* */
  4772. function getComponentName (opts) {
  4773. return opts && (opts.Ctor.options.name || opts.tag)
  4774. }
  4775. function matches (pattern, name) {
  4776. if (Array.isArray(pattern)) {
  4777. return pattern.indexOf(name) > -1
  4778. } else if (typeof pattern === 'string') {
  4779. return pattern.split(',').indexOf(name) > -1
  4780. } else if (isRegExp(pattern)) {
  4781. return pattern.test(name)
  4782. }
  4783. /* istanbul ignore next */
  4784. return false
  4785. }
  4786. function pruneCache (keepAliveInstance, filter) {
  4787. var cache = keepAliveInstance.cache;
  4788. var keys = keepAliveInstance.keys;
  4789. var _vnode = keepAliveInstance._vnode;
  4790. for (var key in cache) {
  4791. var entry = cache[key];
  4792. if (entry) {
  4793. var name = entry.name;
  4794. if (name && !filter(name)) {
  4795. pruneCacheEntry(cache, key, keys, _vnode);
  4796. }
  4797. }
  4798. }
  4799. }
  4800. function pruneCacheEntry (
  4801. cache,
  4802. key,
  4803. keys,
  4804. current
  4805. ) {
  4806. var entry = cache[key];
  4807. if (entry && (!current || entry.tag !== current.tag)) {
  4808. entry.componentInstance.$destroy();
  4809. }
  4810. cache[key] = null;
  4811. remove(keys, key);
  4812. }
  4813. var patternTypes = [String, RegExp, Array];
  4814. var KeepAlive = {
  4815. name: 'keep-alive',
  4816. abstract: true,
  4817. props: {
  4818. include: patternTypes,
  4819. exclude: patternTypes,
  4820. max: [String, Number]
  4821. },
  4822. methods: {
  4823. cacheVNode: function cacheVNode() {
  4824. var ref = this;
  4825. var cache = ref.cache;
  4826. var keys = ref.keys;
  4827. var vnodeToCache = ref.vnodeToCache;
  4828. var keyToCache = ref.keyToCache;
  4829. if (vnodeToCache) {
  4830. var tag = vnodeToCache.tag;
  4831. var componentInstance = vnodeToCache.componentInstance;
  4832. var componentOptions = vnodeToCache.componentOptions;
  4833. cache[keyToCache] = {
  4834. name: getComponentName(componentOptions),
  4835. tag: tag,
  4836. componentInstance: componentInstance,
  4837. };
  4838. keys.push(keyToCache);
  4839. // prune oldest entry
  4840. if (this.max && keys.length > parseInt(this.max)) {
  4841. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  4842. }
  4843. this.vnodeToCache = null;
  4844. }
  4845. }
  4846. },
  4847. created: function created () {
  4848. this.cache = Object.create(null);
  4849. this.keys = [];
  4850. },
  4851. destroyed: function destroyed () {
  4852. for (var key in this.cache) {
  4853. pruneCacheEntry(this.cache, key, this.keys);
  4854. }
  4855. },
  4856. mounted: function mounted () {
  4857. var this$1 = this;
  4858. this.cacheVNode();
  4859. this.$watch('include', function (val) {
  4860. pruneCache(this$1, function (name) { return matches(val, name); });
  4861. });
  4862. this.$watch('exclude', function (val) {
  4863. pruneCache(this$1, function (name) { return !matches(val, name); });
  4864. });
  4865. },
  4866. updated: function updated () {
  4867. this.cacheVNode();
  4868. },
  4869. render: function render () {
  4870. var slot = this.$slots.default;
  4871. var vnode = getFirstComponentChild(slot);
  4872. var componentOptions = vnode && vnode.componentOptions;
  4873. if (componentOptions) {
  4874. // check pattern
  4875. var name = getComponentName(componentOptions);
  4876. var ref = this;
  4877. var include = ref.include;
  4878. var exclude = ref.exclude;
  4879. if (
  4880. // not included
  4881. (include && (!name || !matches(include, name))) ||
  4882. // excluded
  4883. (exclude && name && matches(exclude, name))
  4884. ) {
  4885. return vnode
  4886. }
  4887. var ref$1 = this;
  4888. var cache = ref$1.cache;
  4889. var keys = ref$1.keys;
  4890. var key = vnode.key == null
  4891. // same constructor may get registered as different local components
  4892. // so cid alone is not enough (#3269)
  4893. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  4894. : vnode.key;
  4895. if (cache[key]) {
  4896. vnode.componentInstance = cache[key].componentInstance;
  4897. // make current key freshest
  4898. remove(keys, key);
  4899. keys.push(key);
  4900. } else {
  4901. // delay setting the cache until update
  4902. this.vnodeToCache = vnode;
  4903. this.keyToCache = key;
  4904. }
  4905. vnode.data.keepAlive = true;
  4906. }
  4907. return vnode || (slot && slot[0])
  4908. }
  4909. };
  4910. var builtInComponents = {
  4911. KeepAlive: KeepAlive
  4912. };
  4913. /* */
  4914. function initGlobalAPI (Vue) {
  4915. // config
  4916. var configDef = {};
  4917. configDef.get = function () { return config; };
  4918. {
  4919. configDef.set = function () {
  4920. warn(
  4921. 'Do not replace the Vue.config object, set individual fields instead.'
  4922. );
  4923. };
  4924. }
  4925. Object.defineProperty(Vue, 'config', configDef);
  4926. // exposed util methods.
  4927. // NOTE: these are not considered part of the public API - avoid relying on
  4928. // them unless you are aware of the risk.
  4929. Vue.util = {
  4930. warn: warn,
  4931. extend: extend,
  4932. mergeOptions: mergeOptions,
  4933. defineReactive: defineReactive$$1
  4934. };
  4935. Vue.set = set;
  4936. Vue.delete = del;
  4937. Vue.nextTick = nextTick;
  4938. // 2.6 explicit observable API
  4939. Vue.observable = function (obj) {
  4940. observe(obj);
  4941. return obj
  4942. };
  4943. Vue.options = Object.create(null);
  4944. ASSET_TYPES.forEach(function (type) {
  4945. Vue.options[type + 's'] = Object.create(null);
  4946. });
  4947. // this is used to identify the "base" constructor to extend all plain-object
  4948. // components with in Weex's multi-instance scenarios.
  4949. Vue.options._base = Vue;
  4950. extend(Vue.options.components, builtInComponents);
  4951. initUse(Vue);
  4952. initMixin$1(Vue);
  4953. initExtend(Vue);
  4954. initAssetRegisters(Vue);
  4955. }
  4956. initGlobalAPI(Vue);
  4957. Object.defineProperty(Vue.prototype, '$isServer', {
  4958. get: isServerRendering
  4959. });
  4960. Object.defineProperty(Vue.prototype, '$ssrContext', {
  4961. get: function get () {
  4962. /* istanbul ignore next */
  4963. return this.$vnode && this.$vnode.ssrContext
  4964. }
  4965. });
  4966. // expose FunctionalRenderContext for ssr runtime helper installation
  4967. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  4968. value: FunctionalRenderContext
  4969. });
  4970. Vue.version = '2.6.14';
  4971. /* */
  4972. // these are reserved for web because they are directly compiled away
  4973. // during template compilation
  4974. var isReservedAttr = makeMap('style,class');
  4975. // attributes that should be using props for binding
  4976. var acceptValue = makeMap('input,textarea,option,select,progress');
  4977. var mustUseProp = function (tag, type, attr) {
  4978. return (
  4979. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  4980. (attr === 'selected' && tag === 'option') ||
  4981. (attr === 'checked' && tag === 'input') ||
  4982. (attr === 'muted' && tag === 'video')
  4983. )
  4984. };
  4985. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  4986. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  4987. var convertEnumeratedValue = function (key, value) {
  4988. return isFalsyAttrValue(value) || value === 'false'
  4989. ? 'false'
  4990. // allow arbitrary string value for contenteditable
  4991. : key === 'contenteditable' && isValidContentEditableValue(value)
  4992. ? value
  4993. : 'true'
  4994. };
  4995. var isBooleanAttr = makeMap(
  4996. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  4997. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  4998. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  4999. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  5000. 'required,reversed,scoped,seamless,selected,sortable,' +
  5001. 'truespeed,typemustmatch,visible'
  5002. );
  5003. var xlinkNS = 'http://www.w3.org/1999/xlink';
  5004. var isXlink = function (name) {
  5005. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  5006. };
  5007. var getXlinkProp = function (name) {
  5008. return isXlink(name) ? name.slice(6, name.length) : ''
  5009. };
  5010. var isFalsyAttrValue = function (val) {
  5011. return val == null || val === false
  5012. };
  5013. /* */
  5014. function genClassForVnode (vnode) {
  5015. var data = vnode.data;
  5016. var parentNode = vnode;
  5017. var childNode = vnode;
  5018. while (isDef(childNode.componentInstance)) {
  5019. childNode = childNode.componentInstance._vnode;
  5020. if (childNode && childNode.data) {
  5021. data = mergeClassData(childNode.data, data);
  5022. }
  5023. }
  5024. while (isDef(parentNode = parentNode.parent)) {
  5025. if (parentNode && parentNode.data) {
  5026. data = mergeClassData(data, parentNode.data);
  5027. }
  5028. }
  5029. return renderClass(data.staticClass, data.class)
  5030. }
  5031. function mergeClassData (child, parent) {
  5032. return {
  5033. staticClass: concat(child.staticClass, parent.staticClass),
  5034. class: isDef(child.class)
  5035. ? [child.class, parent.class]
  5036. : parent.class
  5037. }
  5038. }
  5039. function renderClass (
  5040. staticClass,
  5041. dynamicClass
  5042. ) {
  5043. if (isDef(staticClass) || isDef(dynamicClass)) {
  5044. return concat(staticClass, stringifyClass(dynamicClass))
  5045. }
  5046. /* istanbul ignore next */
  5047. return ''
  5048. }
  5049. function concat (a, b) {
  5050. return a ? b ? (a + ' ' + b) : a : (b || '')
  5051. }
  5052. function stringifyClass (value) {
  5053. if (Array.isArray(value)) {
  5054. return stringifyArray(value)
  5055. }
  5056. if (isObject(value)) {
  5057. return stringifyObject(value)
  5058. }
  5059. if (typeof value === 'string') {
  5060. return value
  5061. }
  5062. /* istanbul ignore next */
  5063. return ''
  5064. }
  5065. function stringifyArray (value) {
  5066. var res = '';
  5067. var stringified;
  5068. for (var i = 0, l = value.length; i < l; i++) {
  5069. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  5070. if (res) { res += ' '; }
  5071. res += stringified;
  5072. }
  5073. }
  5074. return res
  5075. }
  5076. function stringifyObject (value) {
  5077. var res = '';
  5078. for (var key in value) {
  5079. if (value[key]) {
  5080. if (res) { res += ' '; }
  5081. res += key;
  5082. }
  5083. }
  5084. return res
  5085. }
  5086. /* */
  5087. var namespaceMap = {
  5088. svg: 'http://www.w3.org/2000/svg',
  5089. math: 'http://www.w3.org/1998/Math/MathML'
  5090. };
  5091. var isHTMLTag = makeMap(
  5092. 'html,body,base,head,link,meta,style,title,' +
  5093. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  5094. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  5095. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  5096. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  5097. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  5098. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  5099. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  5100. 'output,progress,select,textarea,' +
  5101. 'details,dialog,menu,menuitem,summary,' +
  5102. 'content,element,shadow,template,blockquote,iframe,tfoot'
  5103. );
  5104. // this map is intentionally selective, only covering SVG elements that may
  5105. // contain child elements.
  5106. var isSVG = makeMap(
  5107. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  5108. 'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  5109. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  5110. true
  5111. );
  5112. var isPreTag = function (tag) { return tag === 'pre'; };
  5113. var isReservedTag = function (tag) {
  5114. return isHTMLTag(tag) || isSVG(tag)
  5115. };
  5116. function getTagNamespace (tag) {
  5117. if (isSVG(tag)) {
  5118. return 'svg'
  5119. }
  5120. // basic support for MathML
  5121. // note it doesn't support other MathML elements being component roots
  5122. if (tag === 'math') {
  5123. return 'math'
  5124. }
  5125. }
  5126. var unknownElementCache = Object.create(null);
  5127. function isUnknownElement (tag) {
  5128. /* istanbul ignore if */
  5129. if (!inBrowser) {
  5130. return true
  5131. }
  5132. if (isReservedTag(tag)) {
  5133. return false
  5134. }
  5135. tag = tag.toLowerCase();
  5136. /* istanbul ignore if */
  5137. if (unknownElementCache[tag] != null) {
  5138. return unknownElementCache[tag]
  5139. }
  5140. var el = document.createElement(tag);
  5141. if (tag.indexOf('-') > -1) {
  5142. // http://stackoverflow.com/a/28210364/1070244
  5143. return (unknownElementCache[tag] = (
  5144. el.constructor === window.HTMLUnknownElement ||
  5145. el.constructor === window.HTMLElement
  5146. ))
  5147. } else {
  5148. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  5149. }
  5150. }
  5151. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  5152. /* */
  5153. /**
  5154. * Query an element selector if it's not an element already.
  5155. */
  5156. function query (el) {
  5157. if (typeof el === 'string') {
  5158. var selected = document.querySelector(el);
  5159. if (!selected) {
  5160. warn(
  5161. 'Cannot find element: ' + el
  5162. );
  5163. return document.createElement('div')
  5164. }
  5165. return selected
  5166. } else {
  5167. return el
  5168. }
  5169. }
  5170. /* */
  5171. function createElement$1 (tagName, vnode) {
  5172. var elm = document.createElement(tagName);
  5173. if (tagName !== 'select') {
  5174. return elm
  5175. }
  5176. // false or null will remove the attribute but undefined will not
  5177. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  5178. elm.setAttribute('multiple', 'multiple');
  5179. }
  5180. return elm
  5181. }
  5182. function createElementNS (namespace, tagName) {
  5183. return document.createElementNS(namespaceMap[namespace], tagName)
  5184. }
  5185. function createTextNode (text) {
  5186. return document.createTextNode(text)
  5187. }
  5188. function createComment (text) {
  5189. return document.createComment(text)
  5190. }
  5191. function insertBefore (parentNode, newNode, referenceNode) {
  5192. parentNode.insertBefore(newNode, referenceNode);
  5193. }
  5194. function removeChild (node, child) {
  5195. node.removeChild(child);
  5196. }
  5197. function appendChild (node, child) {
  5198. node.appendChild(child);
  5199. }
  5200. function parentNode (node) {
  5201. return node.parentNode
  5202. }
  5203. function nextSibling (node) {
  5204. return node.nextSibling
  5205. }
  5206. function tagName (node) {
  5207. return node.tagName
  5208. }
  5209. function setTextContent (node, text) {
  5210. node.textContent = text;
  5211. }
  5212. function setStyleScope (node, scopeId) {
  5213. node.setAttribute(scopeId, '');
  5214. }
  5215. var nodeOps = /*#__PURE__*/Object.freeze({
  5216. createElement: createElement$1,
  5217. createElementNS: createElementNS,
  5218. createTextNode: createTextNode,
  5219. createComment: createComment,
  5220. insertBefore: insertBefore,
  5221. removeChild: removeChild,
  5222. appendChild: appendChild,
  5223. parentNode: parentNode,
  5224. nextSibling: nextSibling,
  5225. tagName: tagName,
  5226. setTextContent: setTextContent,
  5227. setStyleScope: setStyleScope
  5228. });
  5229. /* */
  5230. var ref = {
  5231. create: function create (_, vnode) {
  5232. registerRef(vnode);
  5233. },
  5234. update: function update (oldVnode, vnode) {
  5235. if (oldVnode.data.ref !== vnode.data.ref) {
  5236. registerRef(oldVnode, true);
  5237. registerRef(vnode);
  5238. }
  5239. },
  5240. destroy: function destroy (vnode) {
  5241. registerRef(vnode, true);
  5242. }
  5243. };
  5244. function registerRef (vnode, isRemoval) {
  5245. var key = vnode.data.ref;
  5246. if (!isDef(key)) { return }
  5247. var vm = vnode.context;
  5248. var ref = vnode.componentInstance || vnode.elm;
  5249. var refs = vm.$refs;
  5250. if (isRemoval) {
  5251. if (Array.isArray(refs[key])) {
  5252. remove(refs[key], ref);
  5253. } else if (refs[key] === ref) {
  5254. refs[key] = undefined;
  5255. }
  5256. } else {
  5257. if (vnode.data.refInFor) {
  5258. if (!Array.isArray(refs[key])) {
  5259. refs[key] = [ref];
  5260. } else if (refs[key].indexOf(ref) < 0) {
  5261. // $flow-disable-line
  5262. refs[key].push(ref);
  5263. }
  5264. } else {
  5265. refs[key] = ref;
  5266. }
  5267. }
  5268. }
  5269. /**
  5270. * Virtual DOM patching algorithm based on Snabbdom by
  5271. * Simon Friis Vindum (@paldepind)
  5272. * Licensed under the MIT License
  5273. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  5274. *
  5275. * modified by Evan You (@yyx990803)
  5276. *
  5277. * Not type-checking this because this file is perf-critical and the cost
  5278. * of making flow understand it is not worth it.
  5279. */
  5280. var emptyNode = new VNode('', {}, []);
  5281. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  5282. function sameVnode (a, b) {
  5283. return (
  5284. a.key === b.key &&
  5285. a.asyncFactory === b.asyncFactory && (
  5286. (
  5287. a.tag === b.tag &&
  5288. a.isComment === b.isComment &&
  5289. isDef(a.data) === isDef(b.data) &&
  5290. sameInputType(a, b)
  5291. ) || (
  5292. isTrue(a.isAsyncPlaceholder) &&
  5293. isUndef(b.asyncFactory.error)
  5294. )
  5295. )
  5296. )
  5297. }
  5298. function sameInputType (a, b) {
  5299. if (a.tag !== 'input') { return true }
  5300. var i;
  5301. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  5302. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  5303. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  5304. }
  5305. function createKeyToOldIdx (children, beginIdx, endIdx) {
  5306. var i, key;
  5307. var map = {};
  5308. for (i = beginIdx; i <= endIdx; ++i) {
  5309. key = children[i].key;
  5310. if (isDef(key)) { map[key] = i; }
  5311. }
  5312. return map
  5313. }
  5314. function createPatchFunction (backend) {
  5315. var i, j;
  5316. var cbs = {};
  5317. var modules = backend.modules;
  5318. var nodeOps = backend.nodeOps;
  5319. for (i = 0; i < hooks.length; ++i) {
  5320. cbs[hooks[i]] = [];
  5321. for (j = 0; j < modules.length; ++j) {
  5322. if (isDef(modules[j][hooks[i]])) {
  5323. cbs[hooks[i]].push(modules[j][hooks[i]]);
  5324. }
  5325. }
  5326. }
  5327. function emptyNodeAt (elm) {
  5328. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  5329. }
  5330. function createRmCb (childElm, listeners) {
  5331. function remove$$1 () {
  5332. if (--remove$$1.listeners === 0) {
  5333. removeNode(childElm);
  5334. }
  5335. }
  5336. remove$$1.listeners = listeners;
  5337. return remove$$1
  5338. }
  5339. function removeNode (el) {
  5340. var parent = nodeOps.parentNode(el);
  5341. // element may have already been removed due to v-html / v-text
  5342. if (isDef(parent)) {
  5343. nodeOps.removeChild(parent, el);
  5344. }
  5345. }
  5346. function isUnknownElement$$1 (vnode, inVPre) {
  5347. return (
  5348. !inVPre &&
  5349. !vnode.ns &&
  5350. !(
  5351. config.ignoredElements.length &&
  5352. config.ignoredElements.some(function (ignore) {
  5353. return isRegExp(ignore)
  5354. ? ignore.test(vnode.tag)
  5355. : ignore === vnode.tag
  5356. })
  5357. ) &&
  5358. config.isUnknownElement(vnode.tag)
  5359. )
  5360. }
  5361. var creatingElmInVPre = 0;
  5362. function createElm (
  5363. vnode,
  5364. insertedVnodeQueue,
  5365. parentElm,
  5366. refElm,
  5367. nested,
  5368. ownerArray,
  5369. index
  5370. ) {
  5371. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5372. // This vnode was used in a previous render!
  5373. // now it's used as a new node, overwriting its elm would cause
  5374. // potential patch errors down the road when it's used as an insertion
  5375. // reference node. Instead, we clone the node on-demand before creating
  5376. // associated DOM element for it.
  5377. vnode = ownerArray[index] = cloneVNode(vnode);
  5378. }
  5379. vnode.isRootInsert = !nested; // for transition enter check
  5380. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  5381. return
  5382. }
  5383. var data = vnode.data;
  5384. var children = vnode.children;
  5385. var tag = vnode.tag;
  5386. if (isDef(tag)) {
  5387. {
  5388. if (data && data.pre) {
  5389. creatingElmInVPre++;
  5390. }
  5391. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  5392. warn(
  5393. 'Unknown custom element: <' + tag + '> - did you ' +
  5394. 'register the component correctly? For recursive components, ' +
  5395. 'make sure to provide the "name" option.',
  5396. vnode.context
  5397. );
  5398. }
  5399. }
  5400. vnode.elm = vnode.ns
  5401. ? nodeOps.createElementNS(vnode.ns, tag)
  5402. : nodeOps.createElement(tag, vnode);
  5403. setScope(vnode);
  5404. /* istanbul ignore if */
  5405. {
  5406. createChildren(vnode, children, insertedVnodeQueue);
  5407. if (isDef(data)) {
  5408. invokeCreateHooks(vnode, insertedVnodeQueue);
  5409. }
  5410. insert(parentElm, vnode.elm, refElm);
  5411. }
  5412. if (data && data.pre) {
  5413. creatingElmInVPre--;
  5414. }
  5415. } else if (isTrue(vnode.isComment)) {
  5416. vnode.elm = nodeOps.createComment(vnode.text);
  5417. insert(parentElm, vnode.elm, refElm);
  5418. } else {
  5419. vnode.elm = nodeOps.createTextNode(vnode.text);
  5420. insert(parentElm, vnode.elm, refElm);
  5421. }
  5422. }
  5423. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5424. var i = vnode.data;
  5425. if (isDef(i)) {
  5426. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  5427. if (isDef(i = i.hook) && isDef(i = i.init)) {
  5428. i(vnode, false /* hydrating */);
  5429. }
  5430. // after calling the init hook, if the vnode is a child component
  5431. // it should've created a child instance and mounted it. the child
  5432. // component also has set the placeholder vnode's elm.
  5433. // in that case we can just return the element and be done.
  5434. if (isDef(vnode.componentInstance)) {
  5435. initComponent(vnode, insertedVnodeQueue);
  5436. insert(parentElm, vnode.elm, refElm);
  5437. if (isTrue(isReactivated)) {
  5438. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  5439. }
  5440. return true
  5441. }
  5442. }
  5443. }
  5444. function initComponent (vnode, insertedVnodeQueue) {
  5445. if (isDef(vnode.data.pendingInsert)) {
  5446. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  5447. vnode.data.pendingInsert = null;
  5448. }
  5449. vnode.elm = vnode.componentInstance.$el;
  5450. if (isPatchable(vnode)) {
  5451. invokeCreateHooks(vnode, insertedVnodeQueue);
  5452. setScope(vnode);
  5453. } else {
  5454. // empty component root.
  5455. // skip all element-related modules except for ref (#3455)
  5456. registerRef(vnode);
  5457. // make sure to invoke the insert hook
  5458. insertedVnodeQueue.push(vnode);
  5459. }
  5460. }
  5461. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5462. var i;
  5463. // hack for #4339: a reactivated component with inner transition
  5464. // does not trigger because the inner node's created hooks are not called
  5465. // again. It's not ideal to involve module-specific logic in here but
  5466. // there doesn't seem to be a better way to do it.
  5467. var innerNode = vnode;
  5468. while (innerNode.componentInstance) {
  5469. innerNode = innerNode.componentInstance._vnode;
  5470. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  5471. for (i = 0; i < cbs.activate.length; ++i) {
  5472. cbs.activate[i](emptyNode, innerNode);
  5473. }
  5474. insertedVnodeQueue.push(innerNode);
  5475. break
  5476. }
  5477. }
  5478. // unlike a newly created component,
  5479. // a reactivated keep-alive component doesn't insert itself
  5480. insert(parentElm, vnode.elm, refElm);
  5481. }
  5482. function insert (parent, elm, ref$$1) {
  5483. if (isDef(parent)) {
  5484. if (isDef(ref$$1)) {
  5485. if (nodeOps.parentNode(ref$$1) === parent) {
  5486. nodeOps.insertBefore(parent, elm, ref$$1);
  5487. }
  5488. } else {
  5489. nodeOps.appendChild(parent, elm);
  5490. }
  5491. }
  5492. }
  5493. function createChildren (vnode, children, insertedVnodeQueue) {
  5494. if (Array.isArray(children)) {
  5495. {
  5496. checkDuplicateKeys(children);
  5497. }
  5498. for (var i = 0; i < children.length; ++i) {
  5499. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  5500. }
  5501. } else if (isPrimitive(vnode.text)) {
  5502. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  5503. }
  5504. }
  5505. function isPatchable (vnode) {
  5506. while (vnode.componentInstance) {
  5507. vnode = vnode.componentInstance._vnode;
  5508. }
  5509. return isDef(vnode.tag)
  5510. }
  5511. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  5512. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5513. cbs.create[i$1](emptyNode, vnode);
  5514. }
  5515. i = vnode.data.hook; // Reuse variable
  5516. if (isDef(i)) {
  5517. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  5518. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  5519. }
  5520. }
  5521. // set scope id attribute for scoped CSS.
  5522. // this is implemented as a special case to avoid the overhead
  5523. // of going through the normal attribute patching process.
  5524. function setScope (vnode) {
  5525. var i;
  5526. if (isDef(i = vnode.fnScopeId)) {
  5527. nodeOps.setStyleScope(vnode.elm, i);
  5528. } else {
  5529. var ancestor = vnode;
  5530. while (ancestor) {
  5531. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  5532. nodeOps.setStyleScope(vnode.elm, i);
  5533. }
  5534. ancestor = ancestor.parent;
  5535. }
  5536. }
  5537. // for slot content they should also get the scopeId from the host instance.
  5538. if (isDef(i = activeInstance) &&
  5539. i !== vnode.context &&
  5540. i !== vnode.fnContext &&
  5541. isDef(i = i.$options._scopeId)
  5542. ) {
  5543. nodeOps.setStyleScope(vnode.elm, i);
  5544. }
  5545. }
  5546. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  5547. for (; startIdx <= endIdx; ++startIdx) {
  5548. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  5549. }
  5550. }
  5551. function invokeDestroyHook (vnode) {
  5552. var i, j;
  5553. var data = vnode.data;
  5554. if (isDef(data)) {
  5555. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  5556. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  5557. }
  5558. if (isDef(i = vnode.children)) {
  5559. for (j = 0; j < vnode.children.length; ++j) {
  5560. invokeDestroyHook(vnode.children[j]);
  5561. }
  5562. }
  5563. }
  5564. function removeVnodes (vnodes, startIdx, endIdx) {
  5565. for (; startIdx <= endIdx; ++startIdx) {
  5566. var ch = vnodes[startIdx];
  5567. if (isDef(ch)) {
  5568. if (isDef(ch.tag)) {
  5569. removeAndInvokeRemoveHook(ch);
  5570. invokeDestroyHook(ch);
  5571. } else { // Text node
  5572. removeNode(ch.elm);
  5573. }
  5574. }
  5575. }
  5576. }
  5577. function removeAndInvokeRemoveHook (vnode, rm) {
  5578. if (isDef(rm) || isDef(vnode.data)) {
  5579. var i;
  5580. var listeners = cbs.remove.length + 1;
  5581. if (isDef(rm)) {
  5582. // we have a recursively passed down rm callback
  5583. // increase the listeners count
  5584. rm.listeners += listeners;
  5585. } else {
  5586. // directly removing
  5587. rm = createRmCb(vnode.elm, listeners);
  5588. }
  5589. // recursively invoke hooks on child component root node
  5590. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  5591. removeAndInvokeRemoveHook(i, rm);
  5592. }
  5593. for (i = 0; i < cbs.remove.length; ++i) {
  5594. cbs.remove[i](vnode, rm);
  5595. }
  5596. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  5597. i(vnode, rm);
  5598. } else {
  5599. rm();
  5600. }
  5601. } else {
  5602. removeNode(vnode.elm);
  5603. }
  5604. }
  5605. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  5606. var oldStartIdx = 0;
  5607. var newStartIdx = 0;
  5608. var oldEndIdx = oldCh.length - 1;
  5609. var oldStartVnode = oldCh[0];
  5610. var oldEndVnode = oldCh[oldEndIdx];
  5611. var newEndIdx = newCh.length - 1;
  5612. var newStartVnode = newCh[0];
  5613. var newEndVnode = newCh[newEndIdx];
  5614. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  5615. // removeOnly is a special flag used only by <transition-group>
  5616. // to ensure removed elements stay in correct relative positions
  5617. // during leaving transitions
  5618. var canMove = !removeOnly;
  5619. {
  5620. checkDuplicateKeys(newCh);
  5621. }
  5622. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  5623. if (isUndef(oldStartVnode)) {
  5624. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  5625. } else if (isUndef(oldEndVnode)) {
  5626. oldEndVnode = oldCh[--oldEndIdx];
  5627. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  5628. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5629. oldStartVnode = oldCh[++oldStartIdx];
  5630. newStartVnode = newCh[++newStartIdx];
  5631. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  5632. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5633. oldEndVnode = oldCh[--oldEndIdx];
  5634. newEndVnode = newCh[--newEndIdx];
  5635. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  5636. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5637. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  5638. oldStartVnode = oldCh[++oldStartIdx];
  5639. newEndVnode = newCh[--newEndIdx];
  5640. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  5641. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5642. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  5643. oldEndVnode = oldCh[--oldEndIdx];
  5644. newStartVnode = newCh[++newStartIdx];
  5645. } else {
  5646. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  5647. idxInOld = isDef(newStartVnode.key)
  5648. ? oldKeyToIdx[newStartVnode.key]
  5649. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  5650. if (isUndef(idxInOld)) { // New element
  5651. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5652. } else {
  5653. vnodeToMove = oldCh[idxInOld];
  5654. if (sameVnode(vnodeToMove, newStartVnode)) {
  5655. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5656. oldCh[idxInOld] = undefined;
  5657. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  5658. } else {
  5659. // same key but different element. treat as new element
  5660. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5661. }
  5662. }
  5663. newStartVnode = newCh[++newStartIdx];
  5664. }
  5665. }
  5666. if (oldStartIdx > oldEndIdx) {
  5667. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  5668. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  5669. } else if (newStartIdx > newEndIdx) {
  5670. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  5671. }
  5672. }
  5673. function checkDuplicateKeys (children) {
  5674. var seenKeys = {};
  5675. for (var i = 0; i < children.length; i++) {
  5676. var vnode = children[i];
  5677. var key = vnode.key;
  5678. if (isDef(key)) {
  5679. if (seenKeys[key]) {
  5680. warn(
  5681. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  5682. vnode.context
  5683. );
  5684. } else {
  5685. seenKeys[key] = true;
  5686. }
  5687. }
  5688. }
  5689. }
  5690. function findIdxInOld (node, oldCh, start, end) {
  5691. for (var i = start; i < end; i++) {
  5692. var c = oldCh[i];
  5693. if (isDef(c) && sameVnode(node, c)) { return i }
  5694. }
  5695. }
  5696. function patchVnode (
  5697. oldVnode,
  5698. vnode,
  5699. insertedVnodeQueue,
  5700. ownerArray,
  5701. index,
  5702. removeOnly
  5703. ) {
  5704. if (oldVnode === vnode) {
  5705. return
  5706. }
  5707. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5708. // clone reused vnode
  5709. vnode = ownerArray[index] = cloneVNode(vnode);
  5710. }
  5711. var elm = vnode.elm = oldVnode.elm;
  5712. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  5713. if (isDef(vnode.asyncFactory.resolved)) {
  5714. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  5715. } else {
  5716. vnode.isAsyncPlaceholder = true;
  5717. }
  5718. return
  5719. }
  5720. // reuse element for static trees.
  5721. // note we only do this if the vnode is cloned -
  5722. // if the new node is not cloned it means the render functions have been
  5723. // reset by the hot-reload-api and we need to do a proper re-render.
  5724. if (isTrue(vnode.isStatic) &&
  5725. isTrue(oldVnode.isStatic) &&
  5726. vnode.key === oldVnode.key &&
  5727. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  5728. ) {
  5729. vnode.componentInstance = oldVnode.componentInstance;
  5730. return
  5731. }
  5732. var i;
  5733. var data = vnode.data;
  5734. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  5735. i(oldVnode, vnode);
  5736. }
  5737. var oldCh = oldVnode.children;
  5738. var ch = vnode.children;
  5739. if (isDef(data) && isPatchable(vnode)) {
  5740. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  5741. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  5742. }
  5743. if (isUndef(vnode.text)) {
  5744. if (isDef(oldCh) && isDef(ch)) {
  5745. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  5746. } else if (isDef(ch)) {
  5747. {
  5748. checkDuplicateKeys(ch);
  5749. }
  5750. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  5751. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  5752. } else if (isDef(oldCh)) {
  5753. removeVnodes(oldCh, 0, oldCh.length - 1);
  5754. } else if (isDef(oldVnode.text)) {
  5755. nodeOps.setTextContent(elm, '');
  5756. }
  5757. } else if (oldVnode.text !== vnode.text) {
  5758. nodeOps.setTextContent(elm, vnode.text);
  5759. }
  5760. if (isDef(data)) {
  5761. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  5762. }
  5763. }
  5764. function invokeInsertHook (vnode, queue, initial) {
  5765. // delay insert hooks for component root nodes, invoke them after the
  5766. // element is really inserted
  5767. if (isTrue(initial) && isDef(vnode.parent)) {
  5768. vnode.parent.data.pendingInsert = queue;
  5769. } else {
  5770. for (var i = 0; i < queue.length; ++i) {
  5771. queue[i].data.hook.insert(queue[i]);
  5772. }
  5773. }
  5774. }
  5775. var hydrationBailed = false;
  5776. // list of modules that can skip create hook during hydration because they
  5777. // are already rendered on the client or has no need for initialization
  5778. // Note: style is excluded because it relies on initial clone for future
  5779. // deep updates (#7063).
  5780. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  5781. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  5782. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  5783. var i;
  5784. var tag = vnode.tag;
  5785. var data = vnode.data;
  5786. var children = vnode.children;
  5787. inVPre = inVPre || (data && data.pre);
  5788. vnode.elm = elm;
  5789. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  5790. vnode.isAsyncPlaceholder = true;
  5791. return true
  5792. }
  5793. // assert node match
  5794. {
  5795. if (!assertNodeMatch(elm, vnode, inVPre)) {
  5796. return false
  5797. }
  5798. }
  5799. if (isDef(data)) {
  5800. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  5801. if (isDef(i = vnode.componentInstance)) {
  5802. // child component. it should have hydrated its own tree.
  5803. initComponent(vnode, insertedVnodeQueue);
  5804. return true
  5805. }
  5806. }
  5807. if (isDef(tag)) {
  5808. if (isDef(children)) {
  5809. // empty element, allow client to pick up and populate children
  5810. if (!elm.hasChildNodes()) {
  5811. createChildren(vnode, children, insertedVnodeQueue);
  5812. } else {
  5813. // v-html and domProps: innerHTML
  5814. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  5815. if (i !== elm.innerHTML) {
  5816. /* istanbul ignore if */
  5817. if (typeof console !== 'undefined' &&
  5818. !hydrationBailed
  5819. ) {
  5820. hydrationBailed = true;
  5821. console.warn('Parent: ', elm);
  5822. console.warn('server innerHTML: ', i);
  5823. console.warn('client innerHTML: ', elm.innerHTML);
  5824. }
  5825. return false
  5826. }
  5827. } else {
  5828. // iterate and compare children lists
  5829. var childrenMatch = true;
  5830. var childNode = elm.firstChild;
  5831. for (var i$1 = 0; i$1 < children.length; i$1++) {
  5832. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  5833. childrenMatch = false;
  5834. break
  5835. }
  5836. childNode = childNode.nextSibling;
  5837. }
  5838. // if childNode is not null, it means the actual childNodes list is
  5839. // longer than the virtual children list.
  5840. if (!childrenMatch || childNode) {
  5841. /* istanbul ignore if */
  5842. if (typeof console !== 'undefined' &&
  5843. !hydrationBailed
  5844. ) {
  5845. hydrationBailed = true;
  5846. console.warn('Parent: ', elm);
  5847. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  5848. }
  5849. return false
  5850. }
  5851. }
  5852. }
  5853. }
  5854. if (isDef(data)) {
  5855. var fullInvoke = false;
  5856. for (var key in data) {
  5857. if (!isRenderedModule(key)) {
  5858. fullInvoke = true;
  5859. invokeCreateHooks(vnode, insertedVnodeQueue);
  5860. break
  5861. }
  5862. }
  5863. if (!fullInvoke && data['class']) {
  5864. // ensure collecting deps for deep class bindings for future updates
  5865. traverse(data['class']);
  5866. }
  5867. }
  5868. } else if (elm.data !== vnode.text) {
  5869. elm.data = vnode.text;
  5870. }
  5871. return true
  5872. }
  5873. function assertNodeMatch (node, vnode, inVPre) {
  5874. if (isDef(vnode.tag)) {
  5875. return vnode.tag.indexOf('vue-component') === 0 || (
  5876. !isUnknownElement$$1(vnode, inVPre) &&
  5877. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  5878. )
  5879. } else {
  5880. return node.nodeType === (vnode.isComment ? 8 : 3)
  5881. }
  5882. }
  5883. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  5884. if (isUndef(vnode)) {
  5885. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  5886. return
  5887. }
  5888. var isInitialPatch = false;
  5889. var insertedVnodeQueue = [];
  5890. if (isUndef(oldVnode)) {
  5891. // empty mount (likely as component), create new root element
  5892. isInitialPatch = true;
  5893. createElm(vnode, insertedVnodeQueue);
  5894. } else {
  5895. var isRealElement = isDef(oldVnode.nodeType);
  5896. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  5897. // patch existing root node
  5898. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  5899. } else {
  5900. if (isRealElement) {
  5901. // mounting to a real element
  5902. // check if this is server-rendered content and if we can perform
  5903. // a successful hydration.
  5904. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  5905. oldVnode.removeAttribute(SSR_ATTR);
  5906. hydrating = true;
  5907. }
  5908. if (isTrue(hydrating)) {
  5909. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  5910. invokeInsertHook(vnode, insertedVnodeQueue, true);
  5911. return oldVnode
  5912. } else {
  5913. warn(
  5914. 'The client-side rendered virtual DOM tree is not matching ' +
  5915. 'server-rendered content. This is likely caused by incorrect ' +
  5916. 'HTML markup, for example nesting block-level elements inside ' +
  5917. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  5918. 'full client-side render.'
  5919. );
  5920. }
  5921. }
  5922. // either not server-rendered, or hydration failed.
  5923. // create an empty node and replace it
  5924. oldVnode = emptyNodeAt(oldVnode);
  5925. }
  5926. // replacing existing element
  5927. var oldElm = oldVnode.elm;
  5928. var parentElm = nodeOps.parentNode(oldElm);
  5929. // create new node
  5930. createElm(
  5931. vnode,
  5932. insertedVnodeQueue,
  5933. // extremely rare edge case: do not insert if old element is in a
  5934. // leaving transition. Only happens when combining transition +
  5935. // keep-alive + HOCs. (#4590)
  5936. oldElm._leaveCb ? null : parentElm,
  5937. nodeOps.nextSibling(oldElm)
  5938. );
  5939. // update parent placeholder node element, recursively
  5940. if (isDef(vnode.parent)) {
  5941. var ancestor = vnode.parent;
  5942. var patchable = isPatchable(vnode);
  5943. while (ancestor) {
  5944. for (var i = 0; i < cbs.destroy.length; ++i) {
  5945. cbs.destroy[i](ancestor);
  5946. }
  5947. ancestor.elm = vnode.elm;
  5948. if (patchable) {
  5949. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5950. cbs.create[i$1](emptyNode, ancestor);
  5951. }
  5952. // #6513
  5953. // invoke insert hooks that may have been merged by create hooks.
  5954. // e.g. for directives that uses the "inserted" hook.
  5955. var insert = ancestor.data.hook.insert;
  5956. if (insert.merged) {
  5957. // start at index 1 to avoid re-invoking component mounted hook
  5958. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  5959. insert.fns[i$2]();
  5960. }
  5961. }
  5962. } else {
  5963. registerRef(ancestor);
  5964. }
  5965. ancestor = ancestor.parent;
  5966. }
  5967. }
  5968. // destroy old node
  5969. if (isDef(parentElm)) {
  5970. removeVnodes([oldVnode], 0, 0);
  5971. } else if (isDef(oldVnode.tag)) {
  5972. invokeDestroyHook(oldVnode);
  5973. }
  5974. }
  5975. }
  5976. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  5977. return vnode.elm
  5978. }
  5979. }
  5980. /* */
  5981. var directives = {
  5982. create: updateDirectives,
  5983. update: updateDirectives,
  5984. destroy: function unbindDirectives (vnode) {
  5985. updateDirectives(vnode, emptyNode);
  5986. }
  5987. };
  5988. function updateDirectives (oldVnode, vnode) {
  5989. if (oldVnode.data.directives || vnode.data.directives) {
  5990. _update(oldVnode, vnode);
  5991. }
  5992. }
  5993. function _update (oldVnode, vnode) {
  5994. var isCreate = oldVnode === emptyNode;
  5995. var isDestroy = vnode === emptyNode;
  5996. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  5997. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  5998. var dirsWithInsert = [];
  5999. var dirsWithPostpatch = [];
  6000. var key, oldDir, dir;
  6001. for (key in newDirs) {
  6002. oldDir = oldDirs[key];
  6003. dir = newDirs[key];
  6004. if (!oldDir) {
  6005. // new directive, bind
  6006. callHook$1(dir, 'bind', vnode, oldVnode);
  6007. if (dir.def && dir.def.inserted) {
  6008. dirsWithInsert.push(dir);
  6009. }
  6010. } else {
  6011. // existing directive, update
  6012. dir.oldValue = oldDir.value;
  6013. dir.oldArg = oldDir.arg;
  6014. callHook$1(dir, 'update', vnode, oldVnode);
  6015. if (dir.def && dir.def.componentUpdated) {
  6016. dirsWithPostpatch.push(dir);
  6017. }
  6018. }
  6019. }
  6020. if (dirsWithInsert.length) {
  6021. var callInsert = function () {
  6022. for (var i = 0; i < dirsWithInsert.length; i++) {
  6023. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  6024. }
  6025. };
  6026. if (isCreate) {
  6027. mergeVNodeHook(vnode, 'insert', callInsert);
  6028. } else {
  6029. callInsert();
  6030. }
  6031. }
  6032. if (dirsWithPostpatch.length) {
  6033. mergeVNodeHook(vnode, 'postpatch', function () {
  6034. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  6035. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  6036. }
  6037. });
  6038. }
  6039. if (!isCreate) {
  6040. for (key in oldDirs) {
  6041. if (!newDirs[key]) {
  6042. // no longer present, unbind
  6043. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  6044. }
  6045. }
  6046. }
  6047. }
  6048. var emptyModifiers = Object.create(null);
  6049. function normalizeDirectives$1 (
  6050. dirs,
  6051. vm
  6052. ) {
  6053. var res = Object.create(null);
  6054. if (!dirs) {
  6055. // $flow-disable-line
  6056. return res
  6057. }
  6058. var i, dir;
  6059. for (i = 0; i < dirs.length; i++) {
  6060. dir = dirs[i];
  6061. if (!dir.modifiers) {
  6062. // $flow-disable-line
  6063. dir.modifiers = emptyModifiers;
  6064. }
  6065. res[getRawDirName(dir)] = dir;
  6066. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  6067. }
  6068. // $flow-disable-line
  6069. return res
  6070. }
  6071. function getRawDirName (dir) {
  6072. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  6073. }
  6074. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  6075. var fn = dir.def && dir.def[hook];
  6076. if (fn) {
  6077. try {
  6078. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  6079. } catch (e) {
  6080. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  6081. }
  6082. }
  6083. }
  6084. var baseModules = [
  6085. ref,
  6086. directives
  6087. ];
  6088. /* */
  6089. function updateAttrs (oldVnode, vnode) {
  6090. var opts = vnode.componentOptions;
  6091. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  6092. return
  6093. }
  6094. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  6095. return
  6096. }
  6097. var key, cur, old;
  6098. var elm = vnode.elm;
  6099. var oldAttrs = oldVnode.data.attrs || {};
  6100. var attrs = vnode.data.attrs || {};
  6101. // clone observed objects, as the user probably wants to mutate it
  6102. if (isDef(attrs.__ob__)) {
  6103. attrs = vnode.data.attrs = extend({}, attrs);
  6104. }
  6105. for (key in attrs) {
  6106. cur = attrs[key];
  6107. old = oldAttrs[key];
  6108. if (old !== cur) {
  6109. setAttr(elm, key, cur, vnode.data.pre);
  6110. }
  6111. }
  6112. // #4391: in IE9, setting type can reset value for input[type=radio]
  6113. // #6666: IE/Edge forces progress value down to 1 before setting a max
  6114. /* istanbul ignore if */
  6115. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  6116. setAttr(elm, 'value', attrs.value);
  6117. }
  6118. for (key in oldAttrs) {
  6119. if (isUndef(attrs[key])) {
  6120. if (isXlink(key)) {
  6121. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6122. } else if (!isEnumeratedAttr(key)) {
  6123. elm.removeAttribute(key);
  6124. }
  6125. }
  6126. }
  6127. }
  6128. function setAttr (el, key, value, isInPre) {
  6129. if (isInPre || el.tagName.indexOf('-') > -1) {
  6130. baseSetAttr(el, key, value);
  6131. } else if (isBooleanAttr(key)) {
  6132. // set attribute for blank value
  6133. // e.g. <option disabled>Select one</option>
  6134. if (isFalsyAttrValue(value)) {
  6135. el.removeAttribute(key);
  6136. } else {
  6137. // technically allowfullscreen is a boolean attribute for <iframe>,
  6138. // but Flash expects a value of "true" when used on <embed> tag
  6139. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  6140. ? 'true'
  6141. : key;
  6142. el.setAttribute(key, value);
  6143. }
  6144. } else if (isEnumeratedAttr(key)) {
  6145. el.setAttribute(key, convertEnumeratedValue(key, value));
  6146. } else if (isXlink(key)) {
  6147. if (isFalsyAttrValue(value)) {
  6148. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6149. } else {
  6150. el.setAttributeNS(xlinkNS, key, value);
  6151. }
  6152. } else {
  6153. baseSetAttr(el, key, value);
  6154. }
  6155. }
  6156. function baseSetAttr (el, key, value) {
  6157. if (isFalsyAttrValue(value)) {
  6158. el.removeAttribute(key);
  6159. } else {
  6160. // #7138: IE10 & 11 fires input event when setting placeholder on
  6161. // <textarea>... block the first input event and remove the blocker
  6162. // immediately.
  6163. /* istanbul ignore if */
  6164. if (
  6165. isIE && !isIE9 &&
  6166. el.tagName === 'TEXTAREA' &&
  6167. key === 'placeholder' && value !== '' && !el.__ieph
  6168. ) {
  6169. var blocker = function (e) {
  6170. e.stopImmediatePropagation();
  6171. el.removeEventListener('input', blocker);
  6172. };
  6173. el.addEventListener('input', blocker);
  6174. // $flow-disable-line
  6175. el.__ieph = true; /* IE placeholder patched */
  6176. }
  6177. el.setAttribute(key, value);
  6178. }
  6179. }
  6180. var attrs = {
  6181. create: updateAttrs,
  6182. update: updateAttrs
  6183. };
  6184. /* */
  6185. function updateClass (oldVnode, vnode) {
  6186. var el = vnode.elm;
  6187. var data = vnode.data;
  6188. var oldData = oldVnode.data;
  6189. if (
  6190. isUndef(data.staticClass) &&
  6191. isUndef(data.class) && (
  6192. isUndef(oldData) || (
  6193. isUndef(oldData.staticClass) &&
  6194. isUndef(oldData.class)
  6195. )
  6196. )
  6197. ) {
  6198. return
  6199. }
  6200. var cls = genClassForVnode(vnode);
  6201. // handle transition classes
  6202. var transitionClass = el._transitionClasses;
  6203. if (isDef(transitionClass)) {
  6204. cls = concat(cls, stringifyClass(transitionClass));
  6205. }
  6206. // set the class
  6207. if (cls !== el._prevClass) {
  6208. el.setAttribute('class', cls);
  6209. el._prevClass = cls;
  6210. }
  6211. }
  6212. var klass = {
  6213. create: updateClass,
  6214. update: updateClass
  6215. };
  6216. /* */
  6217. var validDivisionCharRE = /[\w).+\-_$\]]/;
  6218. function parseFilters (exp) {
  6219. var inSingle = false;
  6220. var inDouble = false;
  6221. var inTemplateString = false;
  6222. var inRegex = false;
  6223. var curly = 0;
  6224. var square = 0;
  6225. var paren = 0;
  6226. var lastFilterIndex = 0;
  6227. var c, prev, i, expression, filters;
  6228. for (i = 0; i < exp.length; i++) {
  6229. prev = c;
  6230. c = exp.charCodeAt(i);
  6231. if (inSingle) {
  6232. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  6233. } else if (inDouble) {
  6234. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  6235. } else if (inTemplateString) {
  6236. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  6237. } else if (inRegex) {
  6238. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  6239. } else if (
  6240. c === 0x7C && // pipe
  6241. exp.charCodeAt(i + 1) !== 0x7C &&
  6242. exp.charCodeAt(i - 1) !== 0x7C &&
  6243. !curly && !square && !paren
  6244. ) {
  6245. if (expression === undefined) {
  6246. // first filter, end of expression
  6247. lastFilterIndex = i + 1;
  6248. expression = exp.slice(0, i).trim();
  6249. } else {
  6250. pushFilter();
  6251. }
  6252. } else {
  6253. switch (c) {
  6254. case 0x22: inDouble = true; break // "
  6255. case 0x27: inSingle = true; break // '
  6256. case 0x60: inTemplateString = true; break // `
  6257. case 0x28: paren++; break // (
  6258. case 0x29: paren--; break // )
  6259. case 0x5B: square++; break // [
  6260. case 0x5D: square--; break // ]
  6261. case 0x7B: curly++; break // {
  6262. case 0x7D: curly--; break // }
  6263. }
  6264. if (c === 0x2f) { // /
  6265. var j = i - 1;
  6266. var p = (void 0);
  6267. // find first non-whitespace prev char
  6268. for (; j >= 0; j--) {
  6269. p = exp.charAt(j);
  6270. if (p !== ' ') { break }
  6271. }
  6272. if (!p || !validDivisionCharRE.test(p)) {
  6273. inRegex = true;
  6274. }
  6275. }
  6276. }
  6277. }
  6278. if (expression === undefined) {
  6279. expression = exp.slice(0, i).trim();
  6280. } else if (lastFilterIndex !== 0) {
  6281. pushFilter();
  6282. }
  6283. function pushFilter () {
  6284. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  6285. lastFilterIndex = i + 1;
  6286. }
  6287. if (filters) {
  6288. for (i = 0; i < filters.length; i++) {
  6289. expression = wrapFilter(expression, filters[i]);
  6290. }
  6291. }
  6292. return expression
  6293. }
  6294. function wrapFilter (exp, filter) {
  6295. var i = filter.indexOf('(');
  6296. if (i < 0) {
  6297. // _f: resolveFilter
  6298. return ("_f(\"" + filter + "\")(" + exp + ")")
  6299. } else {
  6300. var name = filter.slice(0, i);
  6301. var args = filter.slice(i + 1);
  6302. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  6303. }
  6304. }
  6305. /* */
  6306. /* eslint-disable no-unused-vars */
  6307. function baseWarn (msg, range) {
  6308. console.error(("[Vue compiler]: " + msg));
  6309. }
  6310. /* eslint-enable no-unused-vars */
  6311. function pluckModuleFunction (
  6312. modules,
  6313. key
  6314. ) {
  6315. return modules
  6316. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  6317. : []
  6318. }
  6319. function addProp (el, name, value, range, dynamic) {
  6320. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  6321. el.plain = false;
  6322. }
  6323. function addAttr (el, name, value, range, dynamic) {
  6324. var attrs = dynamic
  6325. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  6326. : (el.attrs || (el.attrs = []));
  6327. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  6328. el.plain = false;
  6329. }
  6330. // add a raw attr (use this in preTransforms)
  6331. function addRawAttr (el, name, value, range) {
  6332. el.attrsMap[name] = value;
  6333. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  6334. }
  6335. function addDirective (
  6336. el,
  6337. name,
  6338. rawName,
  6339. value,
  6340. arg,
  6341. isDynamicArg,
  6342. modifiers,
  6343. range
  6344. ) {
  6345. (el.directives || (el.directives = [])).push(rangeSetItem({
  6346. name: name,
  6347. rawName: rawName,
  6348. value: value,
  6349. arg: arg,
  6350. isDynamicArg: isDynamicArg,
  6351. modifiers: modifiers
  6352. }, range));
  6353. el.plain = false;
  6354. }
  6355. function prependModifierMarker (symbol, name, dynamic) {
  6356. return dynamic
  6357. ? ("_p(" + name + ",\"" + symbol + "\")")
  6358. : symbol + name // mark the event as captured
  6359. }
  6360. function addHandler (
  6361. el,
  6362. name,
  6363. value,
  6364. modifiers,
  6365. important,
  6366. warn,
  6367. range,
  6368. dynamic
  6369. ) {
  6370. modifiers = modifiers || emptyObject;
  6371. // warn prevent and passive modifier
  6372. /* istanbul ignore if */
  6373. if (
  6374. warn &&
  6375. modifiers.prevent && modifiers.passive
  6376. ) {
  6377. warn(
  6378. 'passive and prevent can\'t be used together. ' +
  6379. 'Passive handler can\'t prevent default event.',
  6380. range
  6381. );
  6382. }
  6383. // normalize click.right and click.middle since they don't actually fire
  6384. // this is technically browser-specific, but at least for now browsers are
  6385. // the only target envs that have right/middle clicks.
  6386. if (modifiers.right) {
  6387. if (dynamic) {
  6388. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  6389. } else if (name === 'click') {
  6390. name = 'contextmenu';
  6391. delete modifiers.right;
  6392. }
  6393. } else if (modifiers.middle) {
  6394. if (dynamic) {
  6395. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  6396. } else if (name === 'click') {
  6397. name = 'mouseup';
  6398. }
  6399. }
  6400. // check capture modifier
  6401. if (modifiers.capture) {
  6402. delete modifiers.capture;
  6403. name = prependModifierMarker('!', name, dynamic);
  6404. }
  6405. if (modifiers.once) {
  6406. delete modifiers.once;
  6407. name = prependModifierMarker('~', name, dynamic);
  6408. }
  6409. /* istanbul ignore if */
  6410. if (modifiers.passive) {
  6411. delete modifiers.passive;
  6412. name = prependModifierMarker('&', name, dynamic);
  6413. }
  6414. var events;
  6415. if (modifiers.native) {
  6416. delete modifiers.native;
  6417. events = el.nativeEvents || (el.nativeEvents = {});
  6418. } else {
  6419. events = el.events || (el.events = {});
  6420. }
  6421. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  6422. if (modifiers !== emptyObject) {
  6423. newHandler.modifiers = modifiers;
  6424. }
  6425. var handlers = events[name];
  6426. /* istanbul ignore if */
  6427. if (Array.isArray(handlers)) {
  6428. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  6429. } else if (handlers) {
  6430. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  6431. } else {
  6432. events[name] = newHandler;
  6433. }
  6434. el.plain = false;
  6435. }
  6436. function getRawBindingAttr (
  6437. el,
  6438. name
  6439. ) {
  6440. return el.rawAttrsMap[':' + name] ||
  6441. el.rawAttrsMap['v-bind:' + name] ||
  6442. el.rawAttrsMap[name]
  6443. }
  6444. function getBindingAttr (
  6445. el,
  6446. name,
  6447. getStatic
  6448. ) {
  6449. var dynamicValue =
  6450. getAndRemoveAttr(el, ':' + name) ||
  6451. getAndRemoveAttr(el, 'v-bind:' + name);
  6452. if (dynamicValue != null) {
  6453. return parseFilters(dynamicValue)
  6454. } else if (getStatic !== false) {
  6455. var staticValue = getAndRemoveAttr(el, name);
  6456. if (staticValue != null) {
  6457. return JSON.stringify(staticValue)
  6458. }
  6459. }
  6460. }
  6461. // note: this only removes the attr from the Array (attrsList) so that it
  6462. // doesn't get processed by processAttrs.
  6463. // By default it does NOT remove it from the map (attrsMap) because the map is
  6464. // needed during codegen.
  6465. function getAndRemoveAttr (
  6466. el,
  6467. name,
  6468. removeFromMap
  6469. ) {
  6470. var val;
  6471. if ((val = el.attrsMap[name]) != null) {
  6472. var list = el.attrsList;
  6473. for (var i = 0, l = list.length; i < l; i++) {
  6474. if (list[i].name === name) {
  6475. list.splice(i, 1);
  6476. break
  6477. }
  6478. }
  6479. }
  6480. if (removeFromMap) {
  6481. delete el.attrsMap[name];
  6482. }
  6483. return val
  6484. }
  6485. function getAndRemoveAttrByRegex (
  6486. el,
  6487. name
  6488. ) {
  6489. var list = el.attrsList;
  6490. for (var i = 0, l = list.length; i < l; i++) {
  6491. var attr = list[i];
  6492. if (name.test(attr.name)) {
  6493. list.splice(i, 1);
  6494. return attr
  6495. }
  6496. }
  6497. }
  6498. function rangeSetItem (
  6499. item,
  6500. range
  6501. ) {
  6502. if (range) {
  6503. if (range.start != null) {
  6504. item.start = range.start;
  6505. }
  6506. if (range.end != null) {
  6507. item.end = range.end;
  6508. }
  6509. }
  6510. return item
  6511. }
  6512. /* */
  6513. /**
  6514. * Cross-platform code generation for component v-model
  6515. */
  6516. function genComponentModel (
  6517. el,
  6518. value,
  6519. modifiers
  6520. ) {
  6521. var ref = modifiers || {};
  6522. var number = ref.number;
  6523. var trim = ref.trim;
  6524. var baseValueExpression = '$$v';
  6525. var valueExpression = baseValueExpression;
  6526. if (trim) {
  6527. valueExpression =
  6528. "(typeof " + baseValueExpression + " === 'string'" +
  6529. "? " + baseValueExpression + ".trim()" +
  6530. ": " + baseValueExpression + ")";
  6531. }
  6532. if (number) {
  6533. valueExpression = "_n(" + valueExpression + ")";
  6534. }
  6535. var assignment = genAssignmentCode(value, valueExpression);
  6536. el.model = {
  6537. value: ("(" + value + ")"),
  6538. expression: JSON.stringify(value),
  6539. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  6540. };
  6541. }
  6542. /**
  6543. * Cross-platform codegen helper for generating v-model value assignment code.
  6544. */
  6545. function genAssignmentCode (
  6546. value,
  6547. assignment
  6548. ) {
  6549. var res = parseModel(value);
  6550. if (res.key === null) {
  6551. return (value + "=" + assignment)
  6552. } else {
  6553. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  6554. }
  6555. }
  6556. /**
  6557. * Parse a v-model expression into a base path and a final key segment.
  6558. * Handles both dot-path and possible square brackets.
  6559. *
  6560. * Possible cases:
  6561. *
  6562. * - test
  6563. * - test[key]
  6564. * - test[test1[key]]
  6565. * - test["a"][key]
  6566. * - xxx.test[a[a].test1[key]]
  6567. * - test.xxx.a["asa"][test1[key]]
  6568. *
  6569. */
  6570. var len, str, chr, index$1, expressionPos, expressionEndPos;
  6571. function parseModel (val) {
  6572. // Fix https://github.com/vuejs/vue/pull/7730
  6573. // allow v-model="obj.val " (trailing whitespace)
  6574. val = val.trim();
  6575. len = val.length;
  6576. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  6577. index$1 = val.lastIndexOf('.');
  6578. if (index$1 > -1) {
  6579. return {
  6580. exp: val.slice(0, index$1),
  6581. key: '"' + val.slice(index$1 + 1) + '"'
  6582. }
  6583. } else {
  6584. return {
  6585. exp: val,
  6586. key: null
  6587. }
  6588. }
  6589. }
  6590. str = val;
  6591. index$1 = expressionPos = expressionEndPos = 0;
  6592. while (!eof()) {
  6593. chr = next();
  6594. /* istanbul ignore if */
  6595. if (isStringStart(chr)) {
  6596. parseString(chr);
  6597. } else if (chr === 0x5B) {
  6598. parseBracket(chr);
  6599. }
  6600. }
  6601. return {
  6602. exp: val.slice(0, expressionPos),
  6603. key: val.slice(expressionPos + 1, expressionEndPos)
  6604. }
  6605. }
  6606. function next () {
  6607. return str.charCodeAt(++index$1)
  6608. }
  6609. function eof () {
  6610. return index$1 >= len
  6611. }
  6612. function isStringStart (chr) {
  6613. return chr === 0x22 || chr === 0x27
  6614. }
  6615. function parseBracket (chr) {
  6616. var inBracket = 1;
  6617. expressionPos = index$1;
  6618. while (!eof()) {
  6619. chr = next();
  6620. if (isStringStart(chr)) {
  6621. parseString(chr);
  6622. continue
  6623. }
  6624. if (chr === 0x5B) { inBracket++; }
  6625. if (chr === 0x5D) { inBracket--; }
  6626. if (inBracket === 0) {
  6627. expressionEndPos = index$1;
  6628. break
  6629. }
  6630. }
  6631. }
  6632. function parseString (chr) {
  6633. var stringQuote = chr;
  6634. while (!eof()) {
  6635. chr = next();
  6636. if (chr === stringQuote) {
  6637. break
  6638. }
  6639. }
  6640. }
  6641. /* */
  6642. var warn$1;
  6643. // in some cases, the event used has to be determined at runtime
  6644. // so we used some reserved tokens during compile.
  6645. var RANGE_TOKEN = '__r';
  6646. var CHECKBOX_RADIO_TOKEN = '__c';
  6647. function model (
  6648. el,
  6649. dir,
  6650. _warn
  6651. ) {
  6652. warn$1 = _warn;
  6653. var value = dir.value;
  6654. var modifiers = dir.modifiers;
  6655. var tag = el.tag;
  6656. var type = el.attrsMap.type;
  6657. {
  6658. // inputs with type="file" are read only and setting the input's
  6659. // value will throw an error.
  6660. if (tag === 'input' && type === 'file') {
  6661. warn$1(
  6662. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  6663. "File inputs are read only. Use a v-on:change listener instead.",
  6664. el.rawAttrsMap['v-model']
  6665. );
  6666. }
  6667. }
  6668. if (el.component) {
  6669. genComponentModel(el, value, modifiers);
  6670. // component v-model doesn't need extra runtime
  6671. return false
  6672. } else if (tag === 'select') {
  6673. genSelect(el, value, modifiers);
  6674. } else if (tag === 'input' && type === 'checkbox') {
  6675. genCheckboxModel(el, value, modifiers);
  6676. } else if (tag === 'input' && type === 'radio') {
  6677. genRadioModel(el, value, modifiers);
  6678. } else if (tag === 'input' || tag === 'textarea') {
  6679. genDefaultModel(el, value, modifiers);
  6680. } else if (!config.isReservedTag(tag)) {
  6681. genComponentModel(el, value, modifiers);
  6682. // component v-model doesn't need extra runtime
  6683. return false
  6684. } else {
  6685. warn$1(
  6686. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  6687. "v-model is not supported on this element type. " +
  6688. 'If you are working with contenteditable, it\'s recommended to ' +
  6689. 'wrap a library dedicated for that purpose inside a custom component.',
  6690. el.rawAttrsMap['v-model']
  6691. );
  6692. }
  6693. // ensure runtime directive metadata
  6694. return true
  6695. }
  6696. function genCheckboxModel (
  6697. el,
  6698. value,
  6699. modifiers
  6700. ) {
  6701. var number = modifiers && modifiers.number;
  6702. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6703. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  6704. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  6705. addProp(el, 'checked',
  6706. "Array.isArray(" + value + ")" +
  6707. "?_i(" + value + "," + valueBinding + ")>-1" + (
  6708. trueValueBinding === 'true'
  6709. ? (":(" + value + ")")
  6710. : (":_q(" + value + "," + trueValueBinding + ")")
  6711. )
  6712. );
  6713. addHandler(el, 'change',
  6714. "var $$a=" + value + "," +
  6715. '$$el=$event.target,' +
  6716. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  6717. 'if(Array.isArray($$a)){' +
  6718. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  6719. '$$i=_i($$a,$$v);' +
  6720. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  6721. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  6722. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  6723. null, true
  6724. );
  6725. }
  6726. function genRadioModel (
  6727. el,
  6728. value,
  6729. modifiers
  6730. ) {
  6731. var number = modifiers && modifiers.number;
  6732. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6733. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  6734. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  6735. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  6736. }
  6737. function genSelect (
  6738. el,
  6739. value,
  6740. modifiers
  6741. ) {
  6742. var number = modifiers && modifiers.number;
  6743. var selectedVal = "Array.prototype.filter" +
  6744. ".call($event.target.options,function(o){return o.selected})" +
  6745. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  6746. "return " + (number ? '_n(val)' : 'val') + "})";
  6747. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  6748. var code = "var $$selectedVal = " + selectedVal + ";";
  6749. code = code + " " + (genAssignmentCode(value, assignment));
  6750. addHandler(el, 'change', code, null, true);
  6751. }
  6752. function genDefaultModel (
  6753. el,
  6754. value,
  6755. modifiers
  6756. ) {
  6757. var type = el.attrsMap.type;
  6758. // warn if v-bind:value conflicts with v-model
  6759. // except for inputs with v-bind:type
  6760. {
  6761. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  6762. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  6763. if (value$1 && !typeBinding) {
  6764. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  6765. warn$1(
  6766. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  6767. 'because the latter already expands to a value binding internally',
  6768. el.rawAttrsMap[binding]
  6769. );
  6770. }
  6771. }
  6772. var ref = modifiers || {};
  6773. var lazy = ref.lazy;
  6774. var number = ref.number;
  6775. var trim = ref.trim;
  6776. var needCompositionGuard = !lazy && type !== 'range';
  6777. var event = lazy
  6778. ? 'change'
  6779. : type === 'range'
  6780. ? RANGE_TOKEN
  6781. : 'input';
  6782. var valueExpression = '$event.target.value';
  6783. if (trim) {
  6784. valueExpression = "$event.target.value.trim()";
  6785. }
  6786. if (number) {
  6787. valueExpression = "_n(" + valueExpression + ")";
  6788. }
  6789. var code = genAssignmentCode(value, valueExpression);
  6790. if (needCompositionGuard) {
  6791. code = "if($event.target.composing)return;" + code;
  6792. }
  6793. addProp(el, 'value', ("(" + value + ")"));
  6794. addHandler(el, event, code, null, true);
  6795. if (trim || number) {
  6796. addHandler(el, 'blur', '$forceUpdate()');
  6797. }
  6798. }
  6799. /* */
  6800. // normalize v-model event tokens that can only be determined at runtime.
  6801. // it's important to place the event as the first in the array because
  6802. // the whole point is ensuring the v-model callback gets called before
  6803. // user-attached handlers.
  6804. function normalizeEvents (on) {
  6805. /* istanbul ignore if */
  6806. if (isDef(on[RANGE_TOKEN])) {
  6807. // IE input[type=range] only supports `change` event
  6808. var event = isIE ? 'change' : 'input';
  6809. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  6810. delete on[RANGE_TOKEN];
  6811. }
  6812. // This was originally intended to fix #4521 but no longer necessary
  6813. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  6814. /* istanbul ignore if */
  6815. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  6816. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  6817. delete on[CHECKBOX_RADIO_TOKEN];
  6818. }
  6819. }
  6820. var target$1;
  6821. function createOnceHandler$1 (event, handler, capture) {
  6822. var _target = target$1; // save current target element in closure
  6823. return function onceHandler () {
  6824. var res = handler.apply(null, arguments);
  6825. if (res !== null) {
  6826. remove$2(event, onceHandler, capture, _target);
  6827. }
  6828. }
  6829. }
  6830. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  6831. // implementation and does not fire microtasks in between event propagation, so
  6832. // safe to exclude.
  6833. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  6834. function add$1 (
  6835. name,
  6836. handler,
  6837. capture,
  6838. passive
  6839. ) {
  6840. // async edge case #6566: inner click event triggers patch, event handler
  6841. // attached to outer element during patch, and triggered again. This
  6842. // happens because browsers fire microtask ticks between event propagation.
  6843. // the solution is simple: we save the timestamp when a handler is attached,
  6844. // and the handler would only fire if the event passed to it was fired
  6845. // AFTER it was attached.
  6846. if (useMicrotaskFix) {
  6847. var attachedTimestamp = currentFlushTimestamp;
  6848. var original = handler;
  6849. handler = original._wrapper = function (e) {
  6850. if (
  6851. // no bubbling, should always fire.
  6852. // this is just a safety net in case event.timeStamp is unreliable in
  6853. // certain weird environments...
  6854. e.target === e.currentTarget ||
  6855. // event is fired after handler attachment
  6856. e.timeStamp >= attachedTimestamp ||
  6857. // bail for environments that have buggy event.timeStamp implementations
  6858. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  6859. // #9681 QtWebEngine event.timeStamp is negative value
  6860. e.timeStamp <= 0 ||
  6861. // #9448 bail if event is fired in another document in a multi-page
  6862. // electron/nw.js app, since event.timeStamp will be using a different
  6863. // starting reference
  6864. e.target.ownerDocument !== document
  6865. ) {
  6866. return original.apply(this, arguments)
  6867. }
  6868. };
  6869. }
  6870. target$1.addEventListener(
  6871. name,
  6872. handler,
  6873. supportsPassive
  6874. ? { capture: capture, passive: passive }
  6875. : capture
  6876. );
  6877. }
  6878. function remove$2 (
  6879. name,
  6880. handler,
  6881. capture,
  6882. _target
  6883. ) {
  6884. (_target || target$1).removeEventListener(
  6885. name,
  6886. handler._wrapper || handler,
  6887. capture
  6888. );
  6889. }
  6890. function updateDOMListeners (oldVnode, vnode) {
  6891. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  6892. return
  6893. }
  6894. var on = vnode.data.on || {};
  6895. var oldOn = oldVnode.data.on || {};
  6896. target$1 = vnode.elm;
  6897. normalizeEvents(on);
  6898. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  6899. target$1 = undefined;
  6900. }
  6901. var events = {
  6902. create: updateDOMListeners,
  6903. update: updateDOMListeners
  6904. };
  6905. /* */
  6906. var svgContainer;
  6907. function updateDOMProps (oldVnode, vnode) {
  6908. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  6909. return
  6910. }
  6911. var key, cur;
  6912. var elm = vnode.elm;
  6913. var oldProps = oldVnode.data.domProps || {};
  6914. var props = vnode.data.domProps || {};
  6915. // clone observed objects, as the user probably wants to mutate it
  6916. if (isDef(props.__ob__)) {
  6917. props = vnode.data.domProps = extend({}, props);
  6918. }
  6919. for (key in oldProps) {
  6920. if (!(key in props)) {
  6921. elm[key] = '';
  6922. }
  6923. }
  6924. for (key in props) {
  6925. cur = props[key];
  6926. // ignore children if the node has textContent or innerHTML,
  6927. // as these will throw away existing DOM nodes and cause removal errors
  6928. // on subsequent patches (#3360)
  6929. if (key === 'textContent' || key === 'innerHTML') {
  6930. if (vnode.children) { vnode.children.length = 0; }
  6931. if (cur === oldProps[key]) { continue }
  6932. // #6601 work around Chrome version <= 55 bug where single textNode
  6933. // replaced by innerHTML/textContent retains its parentNode property
  6934. if (elm.childNodes.length === 1) {
  6935. elm.removeChild(elm.childNodes[0]);
  6936. }
  6937. }
  6938. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  6939. // store value as _value as well since
  6940. // non-string values will be stringified
  6941. elm._value = cur;
  6942. // avoid resetting cursor position when value is the same
  6943. var strCur = isUndef(cur) ? '' : String(cur);
  6944. if (shouldUpdateValue(elm, strCur)) {
  6945. elm.value = strCur;
  6946. }
  6947. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  6948. // IE doesn't support innerHTML for SVG elements
  6949. svgContainer = svgContainer || document.createElement('div');
  6950. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  6951. var svg = svgContainer.firstChild;
  6952. while (elm.firstChild) {
  6953. elm.removeChild(elm.firstChild);
  6954. }
  6955. while (svg.firstChild) {
  6956. elm.appendChild(svg.firstChild);
  6957. }
  6958. } else if (
  6959. // skip the update if old and new VDOM state is the same.
  6960. // `value` is handled separately because the DOM value may be temporarily
  6961. // out of sync with VDOM state due to focus, composition and modifiers.
  6962. // This #4521 by skipping the unnecessary `checked` update.
  6963. cur !== oldProps[key]
  6964. ) {
  6965. // some property updates can throw
  6966. // e.g. `value` on <progress> w/ non-finite value
  6967. try {
  6968. elm[key] = cur;
  6969. } catch (e) {}
  6970. }
  6971. }
  6972. }
  6973. // check platforms/web/util/attrs.js acceptValue
  6974. function shouldUpdateValue (elm, checkVal) {
  6975. return (!elm.composing && (
  6976. elm.tagName === 'OPTION' ||
  6977. isNotInFocusAndDirty(elm, checkVal) ||
  6978. isDirtyWithModifiers(elm, checkVal)
  6979. ))
  6980. }
  6981. function isNotInFocusAndDirty (elm, checkVal) {
  6982. // return true when textbox (.number and .trim) loses focus and its value is
  6983. // not equal to the updated value
  6984. var notInFocus = true;
  6985. // #6157
  6986. // work around IE bug when accessing document.activeElement in an iframe
  6987. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  6988. return notInFocus && elm.value !== checkVal
  6989. }
  6990. function isDirtyWithModifiers (elm, newVal) {
  6991. var value = elm.value;
  6992. var modifiers = elm._vModifiers; // injected by v-model runtime
  6993. if (isDef(modifiers)) {
  6994. if (modifiers.number) {
  6995. return toNumber(value) !== toNumber(newVal)
  6996. }
  6997. if (modifiers.trim) {
  6998. return value.trim() !== newVal.trim()
  6999. }
  7000. }
  7001. return value !== newVal
  7002. }
  7003. var domProps = {
  7004. create: updateDOMProps,
  7005. update: updateDOMProps
  7006. };
  7007. /* */
  7008. var parseStyleText = cached(function (cssText) {
  7009. var res = {};
  7010. var listDelimiter = /;(?![^(]*\))/g;
  7011. var propertyDelimiter = /:(.+)/;
  7012. cssText.split(listDelimiter).forEach(function (item) {
  7013. if (item) {
  7014. var tmp = item.split(propertyDelimiter);
  7015. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  7016. }
  7017. });
  7018. return res
  7019. });
  7020. // merge static and dynamic style data on the same vnode
  7021. function normalizeStyleData (data) {
  7022. var style = normalizeStyleBinding(data.style);
  7023. // static style is pre-processed into an object during compilation
  7024. // and is always a fresh object, so it's safe to merge into it
  7025. return data.staticStyle
  7026. ? extend(data.staticStyle, style)
  7027. : style
  7028. }
  7029. // normalize possible array / string values into Object
  7030. function normalizeStyleBinding (bindingStyle) {
  7031. if (Array.isArray(bindingStyle)) {
  7032. return toObject(bindingStyle)
  7033. }
  7034. if (typeof bindingStyle === 'string') {
  7035. return parseStyleText(bindingStyle)
  7036. }
  7037. return bindingStyle
  7038. }
  7039. /**
  7040. * parent component style should be after child's
  7041. * so that parent component's style could override it
  7042. */
  7043. function getStyle (vnode, checkChild) {
  7044. var res = {};
  7045. var styleData;
  7046. if (checkChild) {
  7047. var childNode = vnode;
  7048. while (childNode.componentInstance) {
  7049. childNode = childNode.componentInstance._vnode;
  7050. if (
  7051. childNode && childNode.data &&
  7052. (styleData = normalizeStyleData(childNode.data))
  7053. ) {
  7054. extend(res, styleData);
  7055. }
  7056. }
  7057. }
  7058. if ((styleData = normalizeStyleData(vnode.data))) {
  7059. extend(res, styleData);
  7060. }
  7061. var parentNode = vnode;
  7062. while ((parentNode = parentNode.parent)) {
  7063. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  7064. extend(res, styleData);
  7065. }
  7066. }
  7067. return res
  7068. }
  7069. /* */
  7070. var cssVarRE = /^--/;
  7071. var importantRE = /\s*!important$/;
  7072. var setProp = function (el, name, val) {
  7073. /* istanbul ignore if */
  7074. if (cssVarRE.test(name)) {
  7075. el.style.setProperty(name, val);
  7076. } else if (importantRE.test(val)) {
  7077. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  7078. } else {
  7079. var normalizedName = normalize(name);
  7080. if (Array.isArray(val)) {
  7081. // Support values array created by autoprefixer, e.g.
  7082. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  7083. // Set them one by one, and the browser will only set those it can recognize
  7084. for (var i = 0, len = val.length; i < len; i++) {
  7085. el.style[normalizedName] = val[i];
  7086. }
  7087. } else {
  7088. el.style[normalizedName] = val;
  7089. }
  7090. }
  7091. };
  7092. var vendorNames = ['Webkit', 'Moz', 'ms'];
  7093. var emptyStyle;
  7094. var normalize = cached(function (prop) {
  7095. emptyStyle = emptyStyle || document.createElement('div').style;
  7096. prop = camelize(prop);
  7097. if (prop !== 'filter' && (prop in emptyStyle)) {
  7098. return prop
  7099. }
  7100. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  7101. for (var i = 0; i < vendorNames.length; i++) {
  7102. var name = vendorNames[i] + capName;
  7103. if (name in emptyStyle) {
  7104. return name
  7105. }
  7106. }
  7107. });
  7108. function updateStyle (oldVnode, vnode) {
  7109. var data = vnode.data;
  7110. var oldData = oldVnode.data;
  7111. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  7112. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  7113. ) {
  7114. return
  7115. }
  7116. var cur, name;
  7117. var el = vnode.elm;
  7118. var oldStaticStyle = oldData.staticStyle;
  7119. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  7120. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  7121. var oldStyle = oldStaticStyle || oldStyleBinding;
  7122. var style = normalizeStyleBinding(vnode.data.style) || {};
  7123. // store normalized style under a different key for next diff
  7124. // make sure to clone it if it's reactive, since the user likely wants
  7125. // to mutate it.
  7126. vnode.data.normalizedStyle = isDef(style.__ob__)
  7127. ? extend({}, style)
  7128. : style;
  7129. var newStyle = getStyle(vnode, true);
  7130. for (name in oldStyle) {
  7131. if (isUndef(newStyle[name])) {
  7132. setProp(el, name, '');
  7133. }
  7134. }
  7135. for (name in newStyle) {
  7136. cur = newStyle[name];
  7137. if (cur !== oldStyle[name]) {
  7138. // ie9 setting to null has no effect, must use empty string
  7139. setProp(el, name, cur == null ? '' : cur);
  7140. }
  7141. }
  7142. }
  7143. var style = {
  7144. create: updateStyle,
  7145. update: updateStyle
  7146. };
  7147. /* */
  7148. var whitespaceRE = /\s+/;
  7149. /**
  7150. * Add class with compatibility for SVG since classList is not supported on
  7151. * SVG elements in IE
  7152. */
  7153. function addClass (el, cls) {
  7154. /* istanbul ignore if */
  7155. if (!cls || !(cls = cls.trim())) {
  7156. return
  7157. }
  7158. /* istanbul ignore else */
  7159. if (el.classList) {
  7160. if (cls.indexOf(' ') > -1) {
  7161. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  7162. } else {
  7163. el.classList.add(cls);
  7164. }
  7165. } else {
  7166. var cur = " " + (el.getAttribute('class') || '') + " ";
  7167. if (cur.indexOf(' ' + cls + ' ') < 0) {
  7168. el.setAttribute('class', (cur + cls).trim());
  7169. }
  7170. }
  7171. }
  7172. /**
  7173. * Remove class with compatibility for SVG since classList is not supported on
  7174. * SVG elements in IE
  7175. */
  7176. function removeClass (el, cls) {
  7177. /* istanbul ignore if */
  7178. if (!cls || !(cls = cls.trim())) {
  7179. return
  7180. }
  7181. /* istanbul ignore else */
  7182. if (el.classList) {
  7183. if (cls.indexOf(' ') > -1) {
  7184. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  7185. } else {
  7186. el.classList.remove(cls);
  7187. }
  7188. if (!el.classList.length) {
  7189. el.removeAttribute('class');
  7190. }
  7191. } else {
  7192. var cur = " " + (el.getAttribute('class') || '') + " ";
  7193. var tar = ' ' + cls + ' ';
  7194. while (cur.indexOf(tar) >= 0) {
  7195. cur = cur.replace(tar, ' ');
  7196. }
  7197. cur = cur.trim();
  7198. if (cur) {
  7199. el.setAttribute('class', cur);
  7200. } else {
  7201. el.removeAttribute('class');
  7202. }
  7203. }
  7204. }
  7205. /* */
  7206. function resolveTransition (def$$1) {
  7207. if (!def$$1) {
  7208. return
  7209. }
  7210. /* istanbul ignore else */
  7211. if (typeof def$$1 === 'object') {
  7212. var res = {};
  7213. if (def$$1.css !== false) {
  7214. extend(res, autoCssTransition(def$$1.name || 'v'));
  7215. }
  7216. extend(res, def$$1);
  7217. return res
  7218. } else if (typeof def$$1 === 'string') {
  7219. return autoCssTransition(def$$1)
  7220. }
  7221. }
  7222. var autoCssTransition = cached(function (name) {
  7223. return {
  7224. enterClass: (name + "-enter"),
  7225. enterToClass: (name + "-enter-to"),
  7226. enterActiveClass: (name + "-enter-active"),
  7227. leaveClass: (name + "-leave"),
  7228. leaveToClass: (name + "-leave-to"),
  7229. leaveActiveClass: (name + "-leave-active")
  7230. }
  7231. });
  7232. var hasTransition = inBrowser && !isIE9;
  7233. var TRANSITION = 'transition';
  7234. var ANIMATION = 'animation';
  7235. // Transition property/event sniffing
  7236. var transitionProp = 'transition';
  7237. var transitionEndEvent = 'transitionend';
  7238. var animationProp = 'animation';
  7239. var animationEndEvent = 'animationend';
  7240. if (hasTransition) {
  7241. /* istanbul ignore if */
  7242. if (window.ontransitionend === undefined &&
  7243. window.onwebkittransitionend !== undefined
  7244. ) {
  7245. transitionProp = 'WebkitTransition';
  7246. transitionEndEvent = 'webkitTransitionEnd';
  7247. }
  7248. if (window.onanimationend === undefined &&
  7249. window.onwebkitanimationend !== undefined
  7250. ) {
  7251. animationProp = 'WebkitAnimation';
  7252. animationEndEvent = 'webkitAnimationEnd';
  7253. }
  7254. }
  7255. // binding to window is necessary to make hot reload work in IE in strict mode
  7256. var raf = inBrowser
  7257. ? window.requestAnimationFrame
  7258. ? window.requestAnimationFrame.bind(window)
  7259. : setTimeout
  7260. : /* istanbul ignore next */ function (fn) { return fn(); };
  7261. function nextFrame (fn) {
  7262. raf(function () {
  7263. raf(fn);
  7264. });
  7265. }
  7266. function addTransitionClass (el, cls) {
  7267. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  7268. if (transitionClasses.indexOf(cls) < 0) {
  7269. transitionClasses.push(cls);
  7270. addClass(el, cls);
  7271. }
  7272. }
  7273. function removeTransitionClass (el, cls) {
  7274. if (el._transitionClasses) {
  7275. remove(el._transitionClasses, cls);
  7276. }
  7277. removeClass(el, cls);
  7278. }
  7279. function whenTransitionEnds (
  7280. el,
  7281. expectedType,
  7282. cb
  7283. ) {
  7284. var ref = getTransitionInfo(el, expectedType);
  7285. var type = ref.type;
  7286. var timeout = ref.timeout;
  7287. var propCount = ref.propCount;
  7288. if (!type) { return cb() }
  7289. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  7290. var ended = 0;
  7291. var end = function () {
  7292. el.removeEventListener(event, onEnd);
  7293. cb();
  7294. };
  7295. var onEnd = function (e) {
  7296. if (e.target === el) {
  7297. if (++ended >= propCount) {
  7298. end();
  7299. }
  7300. }
  7301. };
  7302. setTimeout(function () {
  7303. if (ended < propCount) {
  7304. end();
  7305. }
  7306. }, timeout + 1);
  7307. el.addEventListener(event, onEnd);
  7308. }
  7309. var transformRE = /\b(transform|all)(,|$)/;
  7310. function getTransitionInfo (el, expectedType) {
  7311. var styles = window.getComputedStyle(el);
  7312. // JSDOM may return undefined for transition properties
  7313. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  7314. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  7315. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  7316. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  7317. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  7318. var animationTimeout = getTimeout(animationDelays, animationDurations);
  7319. var type;
  7320. var timeout = 0;
  7321. var propCount = 0;
  7322. /* istanbul ignore if */
  7323. if (expectedType === TRANSITION) {
  7324. if (transitionTimeout > 0) {
  7325. type = TRANSITION;
  7326. timeout = transitionTimeout;
  7327. propCount = transitionDurations.length;
  7328. }
  7329. } else if (expectedType === ANIMATION) {
  7330. if (animationTimeout > 0) {
  7331. type = ANIMATION;
  7332. timeout = animationTimeout;
  7333. propCount = animationDurations.length;
  7334. }
  7335. } else {
  7336. timeout = Math.max(transitionTimeout, animationTimeout);
  7337. type = timeout > 0
  7338. ? transitionTimeout > animationTimeout
  7339. ? TRANSITION
  7340. : ANIMATION
  7341. : null;
  7342. propCount = type
  7343. ? type === TRANSITION
  7344. ? transitionDurations.length
  7345. : animationDurations.length
  7346. : 0;
  7347. }
  7348. var hasTransform =
  7349. type === TRANSITION &&
  7350. transformRE.test(styles[transitionProp + 'Property']);
  7351. return {
  7352. type: type,
  7353. timeout: timeout,
  7354. propCount: propCount,
  7355. hasTransform: hasTransform
  7356. }
  7357. }
  7358. function getTimeout (delays, durations) {
  7359. /* istanbul ignore next */
  7360. while (delays.length < durations.length) {
  7361. delays = delays.concat(delays);
  7362. }
  7363. return Math.max.apply(null, durations.map(function (d, i) {
  7364. return toMs(d) + toMs(delays[i])
  7365. }))
  7366. }
  7367. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  7368. // in a locale-dependent way, using a comma instead of a dot.
  7369. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  7370. // as a floor function) causing unexpected behaviors
  7371. function toMs (s) {
  7372. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  7373. }
  7374. /* */
  7375. function enter (vnode, toggleDisplay) {
  7376. var el = vnode.elm;
  7377. // call leave callback now
  7378. if (isDef(el._leaveCb)) {
  7379. el._leaveCb.cancelled = true;
  7380. el._leaveCb();
  7381. }
  7382. var data = resolveTransition(vnode.data.transition);
  7383. if (isUndef(data)) {
  7384. return
  7385. }
  7386. /* istanbul ignore if */
  7387. if (isDef(el._enterCb) || el.nodeType !== 1) {
  7388. return
  7389. }
  7390. var css = data.css;
  7391. var type = data.type;
  7392. var enterClass = data.enterClass;
  7393. var enterToClass = data.enterToClass;
  7394. var enterActiveClass = data.enterActiveClass;
  7395. var appearClass = data.appearClass;
  7396. var appearToClass = data.appearToClass;
  7397. var appearActiveClass = data.appearActiveClass;
  7398. var beforeEnter = data.beforeEnter;
  7399. var enter = data.enter;
  7400. var afterEnter = data.afterEnter;
  7401. var enterCancelled = data.enterCancelled;
  7402. var beforeAppear = data.beforeAppear;
  7403. var appear = data.appear;
  7404. var afterAppear = data.afterAppear;
  7405. var appearCancelled = data.appearCancelled;
  7406. var duration = data.duration;
  7407. // activeInstance will always be the <transition> component managing this
  7408. // transition. One edge case to check is when the <transition> is placed
  7409. // as the root node of a child component. In that case we need to check
  7410. // <transition>'s parent for appear check.
  7411. var context = activeInstance;
  7412. var transitionNode = activeInstance.$vnode;
  7413. while (transitionNode && transitionNode.parent) {
  7414. context = transitionNode.context;
  7415. transitionNode = transitionNode.parent;
  7416. }
  7417. var isAppear = !context._isMounted || !vnode.isRootInsert;
  7418. if (isAppear && !appear && appear !== '') {
  7419. return
  7420. }
  7421. var startClass = isAppear && appearClass
  7422. ? appearClass
  7423. : enterClass;
  7424. var activeClass = isAppear && appearActiveClass
  7425. ? appearActiveClass
  7426. : enterActiveClass;
  7427. var toClass = isAppear && appearToClass
  7428. ? appearToClass
  7429. : enterToClass;
  7430. var beforeEnterHook = isAppear
  7431. ? (beforeAppear || beforeEnter)
  7432. : beforeEnter;
  7433. var enterHook = isAppear
  7434. ? (typeof appear === 'function' ? appear : enter)
  7435. : enter;
  7436. var afterEnterHook = isAppear
  7437. ? (afterAppear || afterEnter)
  7438. : afterEnter;
  7439. var enterCancelledHook = isAppear
  7440. ? (appearCancelled || enterCancelled)
  7441. : enterCancelled;
  7442. var explicitEnterDuration = toNumber(
  7443. isObject(duration)
  7444. ? duration.enter
  7445. : duration
  7446. );
  7447. if (explicitEnterDuration != null) {
  7448. checkDuration(explicitEnterDuration, 'enter', vnode);
  7449. }
  7450. var expectsCSS = css !== false && !isIE9;
  7451. var userWantsControl = getHookArgumentsLength(enterHook);
  7452. var cb = el._enterCb = once(function () {
  7453. if (expectsCSS) {
  7454. removeTransitionClass(el, toClass);
  7455. removeTransitionClass(el, activeClass);
  7456. }
  7457. if (cb.cancelled) {
  7458. if (expectsCSS) {
  7459. removeTransitionClass(el, startClass);
  7460. }
  7461. enterCancelledHook && enterCancelledHook(el);
  7462. } else {
  7463. afterEnterHook && afterEnterHook(el);
  7464. }
  7465. el._enterCb = null;
  7466. });
  7467. if (!vnode.data.show) {
  7468. // remove pending leave element on enter by injecting an insert hook
  7469. mergeVNodeHook(vnode, 'insert', function () {
  7470. var parent = el.parentNode;
  7471. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  7472. if (pendingNode &&
  7473. pendingNode.tag === vnode.tag &&
  7474. pendingNode.elm._leaveCb
  7475. ) {
  7476. pendingNode.elm._leaveCb();
  7477. }
  7478. enterHook && enterHook(el, cb);
  7479. });
  7480. }
  7481. // start enter transition
  7482. beforeEnterHook && beforeEnterHook(el);
  7483. if (expectsCSS) {
  7484. addTransitionClass(el, startClass);
  7485. addTransitionClass(el, activeClass);
  7486. nextFrame(function () {
  7487. removeTransitionClass(el, startClass);
  7488. if (!cb.cancelled) {
  7489. addTransitionClass(el, toClass);
  7490. if (!userWantsControl) {
  7491. if (isValidDuration(explicitEnterDuration)) {
  7492. setTimeout(cb, explicitEnterDuration);
  7493. } else {
  7494. whenTransitionEnds(el, type, cb);
  7495. }
  7496. }
  7497. }
  7498. });
  7499. }
  7500. if (vnode.data.show) {
  7501. toggleDisplay && toggleDisplay();
  7502. enterHook && enterHook(el, cb);
  7503. }
  7504. if (!expectsCSS && !userWantsControl) {
  7505. cb();
  7506. }
  7507. }
  7508. function leave (vnode, rm) {
  7509. var el = vnode.elm;
  7510. // call enter callback now
  7511. if (isDef(el._enterCb)) {
  7512. el._enterCb.cancelled = true;
  7513. el._enterCb();
  7514. }
  7515. var data = resolveTransition(vnode.data.transition);
  7516. if (isUndef(data) || el.nodeType !== 1) {
  7517. return rm()
  7518. }
  7519. /* istanbul ignore if */
  7520. if (isDef(el._leaveCb)) {
  7521. return
  7522. }
  7523. var css = data.css;
  7524. var type = data.type;
  7525. var leaveClass = data.leaveClass;
  7526. var leaveToClass = data.leaveToClass;
  7527. var leaveActiveClass = data.leaveActiveClass;
  7528. var beforeLeave = data.beforeLeave;
  7529. var leave = data.leave;
  7530. var afterLeave = data.afterLeave;
  7531. var leaveCancelled = data.leaveCancelled;
  7532. var delayLeave = data.delayLeave;
  7533. var duration = data.duration;
  7534. var expectsCSS = css !== false && !isIE9;
  7535. var userWantsControl = getHookArgumentsLength(leave);
  7536. var explicitLeaveDuration = toNumber(
  7537. isObject(duration)
  7538. ? duration.leave
  7539. : duration
  7540. );
  7541. if (isDef(explicitLeaveDuration)) {
  7542. checkDuration(explicitLeaveDuration, 'leave', vnode);
  7543. }
  7544. var cb = el._leaveCb = once(function () {
  7545. if (el.parentNode && el.parentNode._pending) {
  7546. el.parentNode._pending[vnode.key] = null;
  7547. }
  7548. if (expectsCSS) {
  7549. removeTransitionClass(el, leaveToClass);
  7550. removeTransitionClass(el, leaveActiveClass);
  7551. }
  7552. if (cb.cancelled) {
  7553. if (expectsCSS) {
  7554. removeTransitionClass(el, leaveClass);
  7555. }
  7556. leaveCancelled && leaveCancelled(el);
  7557. } else {
  7558. rm();
  7559. afterLeave && afterLeave(el);
  7560. }
  7561. el._leaveCb = null;
  7562. });
  7563. if (delayLeave) {
  7564. delayLeave(performLeave);
  7565. } else {
  7566. performLeave();
  7567. }
  7568. function performLeave () {
  7569. // the delayed leave may have already been cancelled
  7570. if (cb.cancelled) {
  7571. return
  7572. }
  7573. // record leaving element
  7574. if (!vnode.data.show && el.parentNode) {
  7575. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  7576. }
  7577. beforeLeave && beforeLeave(el);
  7578. if (expectsCSS) {
  7579. addTransitionClass(el, leaveClass);
  7580. addTransitionClass(el, leaveActiveClass);
  7581. nextFrame(function () {
  7582. removeTransitionClass(el, leaveClass);
  7583. if (!cb.cancelled) {
  7584. addTransitionClass(el, leaveToClass);
  7585. if (!userWantsControl) {
  7586. if (isValidDuration(explicitLeaveDuration)) {
  7587. setTimeout(cb, explicitLeaveDuration);
  7588. } else {
  7589. whenTransitionEnds(el, type, cb);
  7590. }
  7591. }
  7592. }
  7593. });
  7594. }
  7595. leave && leave(el, cb);
  7596. if (!expectsCSS && !userWantsControl) {
  7597. cb();
  7598. }
  7599. }
  7600. }
  7601. // only used in dev mode
  7602. function checkDuration (val, name, vnode) {
  7603. if (typeof val !== 'number') {
  7604. warn(
  7605. "<transition> explicit " + name + " duration is not a valid number - " +
  7606. "got " + (JSON.stringify(val)) + ".",
  7607. vnode.context
  7608. );
  7609. } else if (isNaN(val)) {
  7610. warn(
  7611. "<transition> explicit " + name + " duration is NaN - " +
  7612. 'the duration expression might be incorrect.',
  7613. vnode.context
  7614. );
  7615. }
  7616. }
  7617. function isValidDuration (val) {
  7618. return typeof val === 'number' && !isNaN(val)
  7619. }
  7620. /**
  7621. * Normalize a transition hook's argument length. The hook may be:
  7622. * - a merged hook (invoker) with the original in .fns
  7623. * - a wrapped component method (check ._length)
  7624. * - a plain function (.length)
  7625. */
  7626. function getHookArgumentsLength (fn) {
  7627. if (isUndef(fn)) {
  7628. return false
  7629. }
  7630. var invokerFns = fn.fns;
  7631. if (isDef(invokerFns)) {
  7632. // invoker
  7633. return getHookArgumentsLength(
  7634. Array.isArray(invokerFns)
  7635. ? invokerFns[0]
  7636. : invokerFns
  7637. )
  7638. } else {
  7639. return (fn._length || fn.length) > 1
  7640. }
  7641. }
  7642. function _enter (_, vnode) {
  7643. if (vnode.data.show !== true) {
  7644. enter(vnode);
  7645. }
  7646. }
  7647. var transition = inBrowser ? {
  7648. create: _enter,
  7649. activate: _enter,
  7650. remove: function remove$$1 (vnode, rm) {
  7651. /* istanbul ignore else */
  7652. if (vnode.data.show !== true) {
  7653. leave(vnode, rm);
  7654. } else {
  7655. rm();
  7656. }
  7657. }
  7658. } : {};
  7659. var platformModules = [
  7660. attrs,
  7661. klass,
  7662. events,
  7663. domProps,
  7664. style,
  7665. transition
  7666. ];
  7667. /* */
  7668. // the directive module should be applied last, after all
  7669. // built-in modules have been applied.
  7670. var modules = platformModules.concat(baseModules);
  7671. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  7672. /**
  7673. * Not type checking this file because flow doesn't like attaching
  7674. * properties to Elements.
  7675. */
  7676. /* istanbul ignore if */
  7677. if (isIE9) {
  7678. // http://www.matts411.com/post/internet-explorer-9-oninput/
  7679. document.addEventListener('selectionchange', function () {
  7680. var el = document.activeElement;
  7681. if (el && el.vmodel) {
  7682. trigger(el, 'input');
  7683. }
  7684. });
  7685. }
  7686. var directive = {
  7687. inserted: function inserted (el, binding, vnode, oldVnode) {
  7688. if (vnode.tag === 'select') {
  7689. // #6903
  7690. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  7691. mergeVNodeHook(vnode, 'postpatch', function () {
  7692. directive.componentUpdated(el, binding, vnode);
  7693. });
  7694. } else {
  7695. setSelected(el, binding, vnode.context);
  7696. }
  7697. el._vOptions = [].map.call(el.options, getValue);
  7698. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  7699. el._vModifiers = binding.modifiers;
  7700. if (!binding.modifiers.lazy) {
  7701. el.addEventListener('compositionstart', onCompositionStart);
  7702. el.addEventListener('compositionend', onCompositionEnd);
  7703. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  7704. // switching focus before confirming composition choice
  7705. // this also fixes the issue where some browsers e.g. iOS Chrome
  7706. // fires "change" instead of "input" on autocomplete.
  7707. el.addEventListener('change', onCompositionEnd);
  7708. /* istanbul ignore if */
  7709. if (isIE9) {
  7710. el.vmodel = true;
  7711. }
  7712. }
  7713. }
  7714. },
  7715. componentUpdated: function componentUpdated (el, binding, vnode) {
  7716. if (vnode.tag === 'select') {
  7717. setSelected(el, binding, vnode.context);
  7718. // in case the options rendered by v-for have changed,
  7719. // it's possible that the value is out-of-sync with the rendered options.
  7720. // detect such cases and filter out values that no longer has a matching
  7721. // option in the DOM.
  7722. var prevOptions = el._vOptions;
  7723. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  7724. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  7725. // trigger change event if
  7726. // no matching option found for at least one value
  7727. var needReset = el.multiple
  7728. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  7729. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  7730. if (needReset) {
  7731. trigger(el, 'change');
  7732. }
  7733. }
  7734. }
  7735. }
  7736. };
  7737. function setSelected (el, binding, vm) {
  7738. actuallySetSelected(el, binding, vm);
  7739. /* istanbul ignore if */
  7740. if (isIE || isEdge) {
  7741. setTimeout(function () {
  7742. actuallySetSelected(el, binding, vm);
  7743. }, 0);
  7744. }
  7745. }
  7746. function actuallySetSelected (el, binding, vm) {
  7747. var value = binding.value;
  7748. var isMultiple = el.multiple;
  7749. if (isMultiple && !Array.isArray(value)) {
  7750. warn(
  7751. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  7752. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  7753. vm
  7754. );
  7755. return
  7756. }
  7757. var selected, option;
  7758. for (var i = 0, l = el.options.length; i < l; i++) {
  7759. option = el.options[i];
  7760. if (isMultiple) {
  7761. selected = looseIndexOf(value, getValue(option)) > -1;
  7762. if (option.selected !== selected) {
  7763. option.selected = selected;
  7764. }
  7765. } else {
  7766. if (looseEqual(getValue(option), value)) {
  7767. if (el.selectedIndex !== i) {
  7768. el.selectedIndex = i;
  7769. }
  7770. return
  7771. }
  7772. }
  7773. }
  7774. if (!isMultiple) {
  7775. el.selectedIndex = -1;
  7776. }
  7777. }
  7778. function hasNoMatchingOption (value, options) {
  7779. return options.every(function (o) { return !looseEqual(o, value); })
  7780. }
  7781. function getValue (option) {
  7782. return '_value' in option
  7783. ? option._value
  7784. : option.value
  7785. }
  7786. function onCompositionStart (e) {
  7787. e.target.composing = true;
  7788. }
  7789. function onCompositionEnd (e) {
  7790. // prevent triggering an input event for no reason
  7791. if (!e.target.composing) { return }
  7792. e.target.composing = false;
  7793. trigger(e.target, 'input');
  7794. }
  7795. function trigger (el, type) {
  7796. var e = document.createEvent('HTMLEvents');
  7797. e.initEvent(type, true, true);
  7798. el.dispatchEvent(e);
  7799. }
  7800. /* */
  7801. // recursively search for possible transition defined inside the component root
  7802. function locateNode (vnode) {
  7803. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  7804. ? locateNode(vnode.componentInstance._vnode)
  7805. : vnode
  7806. }
  7807. var show = {
  7808. bind: function bind (el, ref, vnode) {
  7809. var value = ref.value;
  7810. vnode = locateNode(vnode);
  7811. var transition$$1 = vnode.data && vnode.data.transition;
  7812. var originalDisplay = el.__vOriginalDisplay =
  7813. el.style.display === 'none' ? '' : el.style.display;
  7814. if (value && transition$$1) {
  7815. vnode.data.show = true;
  7816. enter(vnode, function () {
  7817. el.style.display = originalDisplay;
  7818. });
  7819. } else {
  7820. el.style.display = value ? originalDisplay : 'none';
  7821. }
  7822. },
  7823. update: function update (el, ref, vnode) {
  7824. var value = ref.value;
  7825. var oldValue = ref.oldValue;
  7826. /* istanbul ignore if */
  7827. if (!value === !oldValue) { return }
  7828. vnode = locateNode(vnode);
  7829. var transition$$1 = vnode.data && vnode.data.transition;
  7830. if (transition$$1) {
  7831. vnode.data.show = true;
  7832. if (value) {
  7833. enter(vnode, function () {
  7834. el.style.display = el.__vOriginalDisplay;
  7835. });
  7836. } else {
  7837. leave(vnode, function () {
  7838. el.style.display = 'none';
  7839. });
  7840. }
  7841. } else {
  7842. el.style.display = value ? el.__vOriginalDisplay : 'none';
  7843. }
  7844. },
  7845. unbind: function unbind (
  7846. el,
  7847. binding,
  7848. vnode,
  7849. oldVnode,
  7850. isDestroy
  7851. ) {
  7852. if (!isDestroy) {
  7853. el.style.display = el.__vOriginalDisplay;
  7854. }
  7855. }
  7856. };
  7857. var platformDirectives = {
  7858. model: directive,
  7859. show: show
  7860. };
  7861. /* */
  7862. var transitionProps = {
  7863. name: String,
  7864. appear: Boolean,
  7865. css: Boolean,
  7866. mode: String,
  7867. type: String,
  7868. enterClass: String,
  7869. leaveClass: String,
  7870. enterToClass: String,
  7871. leaveToClass: String,
  7872. enterActiveClass: String,
  7873. leaveActiveClass: String,
  7874. appearClass: String,
  7875. appearActiveClass: String,
  7876. appearToClass: String,
  7877. duration: [Number, String, Object]
  7878. };
  7879. // in case the child is also an abstract component, e.g. <keep-alive>
  7880. // we want to recursively retrieve the real component to be rendered
  7881. function getRealChild (vnode) {
  7882. var compOptions = vnode && vnode.componentOptions;
  7883. if (compOptions && compOptions.Ctor.options.abstract) {
  7884. return getRealChild(getFirstComponentChild(compOptions.children))
  7885. } else {
  7886. return vnode
  7887. }
  7888. }
  7889. function extractTransitionData (comp) {
  7890. var data = {};
  7891. var options = comp.$options;
  7892. // props
  7893. for (var key in options.propsData) {
  7894. data[key] = comp[key];
  7895. }
  7896. // events.
  7897. // extract listeners and pass them directly to the transition methods
  7898. var listeners = options._parentListeners;
  7899. for (var key$1 in listeners) {
  7900. data[camelize(key$1)] = listeners[key$1];
  7901. }
  7902. return data
  7903. }
  7904. function placeholder (h, rawChild) {
  7905. if (/\d-keep-alive$/.test(rawChild.tag)) {
  7906. return h('keep-alive', {
  7907. props: rawChild.componentOptions.propsData
  7908. })
  7909. }
  7910. }
  7911. function hasParentTransition (vnode) {
  7912. while ((vnode = vnode.parent)) {
  7913. if (vnode.data.transition) {
  7914. return true
  7915. }
  7916. }
  7917. }
  7918. function isSameChild (child, oldChild) {
  7919. return oldChild.key === child.key && oldChild.tag === child.tag
  7920. }
  7921. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  7922. var isVShowDirective = function (d) { return d.name === 'show'; };
  7923. var Transition = {
  7924. name: 'transition',
  7925. props: transitionProps,
  7926. abstract: true,
  7927. render: function render (h) {
  7928. var this$1 = this;
  7929. var children = this.$slots.default;
  7930. if (!children) {
  7931. return
  7932. }
  7933. // filter out text nodes (possible whitespaces)
  7934. children = children.filter(isNotTextNode);
  7935. /* istanbul ignore if */
  7936. if (!children.length) {
  7937. return
  7938. }
  7939. // warn multiple elements
  7940. if (children.length > 1) {
  7941. warn(
  7942. '<transition> can only be used on a single element. Use ' +
  7943. '<transition-group> for lists.',
  7944. this.$parent
  7945. );
  7946. }
  7947. var mode = this.mode;
  7948. // warn invalid mode
  7949. if (mode && mode !== 'in-out' && mode !== 'out-in'
  7950. ) {
  7951. warn(
  7952. 'invalid <transition> mode: ' + mode,
  7953. this.$parent
  7954. );
  7955. }
  7956. var rawChild = children[0];
  7957. // if this is a component root node and the component's
  7958. // parent container node also has transition, skip.
  7959. if (hasParentTransition(this.$vnode)) {
  7960. return rawChild
  7961. }
  7962. // apply transition data to child
  7963. // use getRealChild() to ignore abstract components e.g. keep-alive
  7964. var child = getRealChild(rawChild);
  7965. /* istanbul ignore if */
  7966. if (!child) {
  7967. return rawChild
  7968. }
  7969. if (this._leaving) {
  7970. return placeholder(h, rawChild)
  7971. }
  7972. // ensure a key that is unique to the vnode type and to this transition
  7973. // component instance. This key will be used to remove pending leaving nodes
  7974. // during entering.
  7975. var id = "__transition-" + (this._uid) + "-";
  7976. child.key = child.key == null
  7977. ? child.isComment
  7978. ? id + 'comment'
  7979. : id + child.tag
  7980. : isPrimitive(child.key)
  7981. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  7982. : child.key;
  7983. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  7984. var oldRawChild = this._vnode;
  7985. var oldChild = getRealChild(oldRawChild);
  7986. // mark v-show
  7987. // so that the transition module can hand over the control to the directive
  7988. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  7989. child.data.show = true;
  7990. }
  7991. if (
  7992. oldChild &&
  7993. oldChild.data &&
  7994. !isSameChild(child, oldChild) &&
  7995. !isAsyncPlaceholder(oldChild) &&
  7996. // #6687 component root is a comment node
  7997. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  7998. ) {
  7999. // replace old child transition data with fresh one
  8000. // important for dynamic transitions!
  8001. var oldData = oldChild.data.transition = extend({}, data);
  8002. // handle transition mode
  8003. if (mode === 'out-in') {
  8004. // return placeholder node and queue update when leave finishes
  8005. this._leaving = true;
  8006. mergeVNodeHook(oldData, 'afterLeave', function () {
  8007. this$1._leaving = false;
  8008. this$1.$forceUpdate();
  8009. });
  8010. return placeholder(h, rawChild)
  8011. } else if (mode === 'in-out') {
  8012. if (isAsyncPlaceholder(child)) {
  8013. return oldRawChild
  8014. }
  8015. var delayedLeave;
  8016. var performLeave = function () { delayedLeave(); };
  8017. mergeVNodeHook(data, 'afterEnter', performLeave);
  8018. mergeVNodeHook(data, 'enterCancelled', performLeave);
  8019. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  8020. }
  8021. }
  8022. return rawChild
  8023. }
  8024. };
  8025. /* */
  8026. var props = extend({
  8027. tag: String,
  8028. moveClass: String
  8029. }, transitionProps);
  8030. delete props.mode;
  8031. var TransitionGroup = {
  8032. props: props,
  8033. beforeMount: function beforeMount () {
  8034. var this$1 = this;
  8035. var update = this._update;
  8036. this._update = function (vnode, hydrating) {
  8037. var restoreActiveInstance = setActiveInstance(this$1);
  8038. // force removing pass
  8039. this$1.__patch__(
  8040. this$1._vnode,
  8041. this$1.kept,
  8042. false, // hydrating
  8043. true // removeOnly (!important, avoids unnecessary moves)
  8044. );
  8045. this$1._vnode = this$1.kept;
  8046. restoreActiveInstance();
  8047. update.call(this$1, vnode, hydrating);
  8048. };
  8049. },
  8050. render: function render (h) {
  8051. var tag = this.tag || this.$vnode.data.tag || 'span';
  8052. var map = Object.create(null);
  8053. var prevChildren = this.prevChildren = this.children;
  8054. var rawChildren = this.$slots.default || [];
  8055. var children = this.children = [];
  8056. var transitionData = extractTransitionData(this);
  8057. for (var i = 0; i < rawChildren.length; i++) {
  8058. var c = rawChildren[i];
  8059. if (c.tag) {
  8060. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  8061. children.push(c);
  8062. map[c.key] = c
  8063. ;(c.data || (c.data = {})).transition = transitionData;
  8064. } else {
  8065. var opts = c.componentOptions;
  8066. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  8067. warn(("<transition-group> children must be keyed: <" + name + ">"));
  8068. }
  8069. }
  8070. }
  8071. if (prevChildren) {
  8072. var kept = [];
  8073. var removed = [];
  8074. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  8075. var c$1 = prevChildren[i$1];
  8076. c$1.data.transition = transitionData;
  8077. c$1.data.pos = c$1.elm.getBoundingClientRect();
  8078. if (map[c$1.key]) {
  8079. kept.push(c$1);
  8080. } else {
  8081. removed.push(c$1);
  8082. }
  8083. }
  8084. this.kept = h(tag, null, kept);
  8085. this.removed = removed;
  8086. }
  8087. return h(tag, null, children)
  8088. },
  8089. updated: function updated () {
  8090. var children = this.prevChildren;
  8091. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  8092. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  8093. return
  8094. }
  8095. // we divide the work into three loops to avoid mixing DOM reads and writes
  8096. // in each iteration - which helps prevent layout thrashing.
  8097. children.forEach(callPendingCbs);
  8098. children.forEach(recordPosition);
  8099. children.forEach(applyTranslation);
  8100. // force reflow to put everything in position
  8101. // assign to this to avoid being removed in tree-shaking
  8102. // $flow-disable-line
  8103. this._reflow = document.body.offsetHeight;
  8104. children.forEach(function (c) {
  8105. if (c.data.moved) {
  8106. var el = c.elm;
  8107. var s = el.style;
  8108. addTransitionClass(el, moveClass);
  8109. s.transform = s.WebkitTransform = s.transitionDuration = '';
  8110. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  8111. if (e && e.target !== el) {
  8112. return
  8113. }
  8114. if (!e || /transform$/.test(e.propertyName)) {
  8115. el.removeEventListener(transitionEndEvent, cb);
  8116. el._moveCb = null;
  8117. removeTransitionClass(el, moveClass);
  8118. }
  8119. });
  8120. }
  8121. });
  8122. },
  8123. methods: {
  8124. hasMove: function hasMove (el, moveClass) {
  8125. /* istanbul ignore if */
  8126. if (!hasTransition) {
  8127. return false
  8128. }
  8129. /* istanbul ignore if */
  8130. if (this._hasMove) {
  8131. return this._hasMove
  8132. }
  8133. // Detect whether an element with the move class applied has
  8134. // CSS transitions. Since the element may be inside an entering
  8135. // transition at this very moment, we make a clone of it and remove
  8136. // all other transition classes applied to ensure only the move class
  8137. // is applied.
  8138. var clone = el.cloneNode();
  8139. if (el._transitionClasses) {
  8140. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  8141. }
  8142. addClass(clone, moveClass);
  8143. clone.style.display = 'none';
  8144. this.$el.appendChild(clone);
  8145. var info = getTransitionInfo(clone);
  8146. this.$el.removeChild(clone);
  8147. return (this._hasMove = info.hasTransform)
  8148. }
  8149. }
  8150. };
  8151. function callPendingCbs (c) {
  8152. /* istanbul ignore if */
  8153. if (c.elm._moveCb) {
  8154. c.elm._moveCb();
  8155. }
  8156. /* istanbul ignore if */
  8157. if (c.elm._enterCb) {
  8158. c.elm._enterCb();
  8159. }
  8160. }
  8161. function recordPosition (c) {
  8162. c.data.newPos = c.elm.getBoundingClientRect();
  8163. }
  8164. function applyTranslation (c) {
  8165. var oldPos = c.data.pos;
  8166. var newPos = c.data.newPos;
  8167. var dx = oldPos.left - newPos.left;
  8168. var dy = oldPos.top - newPos.top;
  8169. if (dx || dy) {
  8170. c.data.moved = true;
  8171. var s = c.elm.style;
  8172. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  8173. s.transitionDuration = '0s';
  8174. }
  8175. }
  8176. var platformComponents = {
  8177. Transition: Transition,
  8178. TransitionGroup: TransitionGroup
  8179. };
  8180. /* */
  8181. // install platform specific utils
  8182. Vue.config.mustUseProp = mustUseProp;
  8183. Vue.config.isReservedTag = isReservedTag;
  8184. Vue.config.isReservedAttr = isReservedAttr;
  8185. Vue.config.getTagNamespace = getTagNamespace;
  8186. Vue.config.isUnknownElement = isUnknownElement;
  8187. // install platform runtime directives & components
  8188. extend(Vue.options.directives, platformDirectives);
  8189. extend(Vue.options.components, platformComponents);
  8190. // install platform patch function
  8191. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  8192. // public mount method
  8193. Vue.prototype.$mount = function (
  8194. el,
  8195. hydrating
  8196. ) {
  8197. el = el && inBrowser ? query(el) : undefined;
  8198. return mountComponent(this, el, hydrating)
  8199. };
  8200. // devtools global hook
  8201. /* istanbul ignore next */
  8202. if (inBrowser) {
  8203. setTimeout(function () {
  8204. if (config.devtools) {
  8205. if (devtools) {
  8206. devtools.emit('init', Vue);
  8207. } else {
  8208. console[console.info ? 'info' : 'log'](
  8209. 'Download the Vue Devtools extension for a better development experience:\n' +
  8210. 'https://github.com/vuejs/vue-devtools'
  8211. );
  8212. }
  8213. }
  8214. if (config.productionTip !== false &&
  8215. typeof console !== 'undefined'
  8216. ) {
  8217. console[console.info ? 'info' : 'log'](
  8218. "You are running Vue in development mode.\n" +
  8219. "Make sure to turn on production mode when deploying for production.\n" +
  8220. "See more tips at https://vuejs.org/guide/deployment.html"
  8221. );
  8222. }
  8223. }, 0);
  8224. }
  8225. /* */
  8226. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  8227. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  8228. var buildRegex = cached(function (delimiters) {
  8229. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  8230. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  8231. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  8232. });
  8233. function parseText (
  8234. text,
  8235. delimiters
  8236. ) {
  8237. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  8238. if (!tagRE.test(text)) {
  8239. return
  8240. }
  8241. var tokens = [];
  8242. var rawTokens = [];
  8243. var lastIndex = tagRE.lastIndex = 0;
  8244. var match, index, tokenValue;
  8245. while ((match = tagRE.exec(text))) {
  8246. index = match.index;
  8247. // push text token
  8248. if (index > lastIndex) {
  8249. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  8250. tokens.push(JSON.stringify(tokenValue));
  8251. }
  8252. // tag token
  8253. var exp = parseFilters(match[1].trim());
  8254. tokens.push(("_s(" + exp + ")"));
  8255. rawTokens.push({ '@binding': exp });
  8256. lastIndex = index + match[0].length;
  8257. }
  8258. if (lastIndex < text.length) {
  8259. rawTokens.push(tokenValue = text.slice(lastIndex));
  8260. tokens.push(JSON.stringify(tokenValue));
  8261. }
  8262. return {
  8263. expression: tokens.join('+'),
  8264. tokens: rawTokens
  8265. }
  8266. }
  8267. /* */
  8268. function transformNode (el, options) {
  8269. var warn = options.warn || baseWarn;
  8270. var staticClass = getAndRemoveAttr(el, 'class');
  8271. if (staticClass) {
  8272. var res = parseText(staticClass, options.delimiters);
  8273. if (res) {
  8274. warn(
  8275. "class=\"" + staticClass + "\": " +
  8276. 'Interpolation inside attributes has been removed. ' +
  8277. 'Use v-bind or the colon shorthand instead. For example, ' +
  8278. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  8279. el.rawAttrsMap['class']
  8280. );
  8281. }
  8282. }
  8283. if (staticClass) {
  8284. el.staticClass = JSON.stringify(staticClass);
  8285. }
  8286. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  8287. if (classBinding) {
  8288. el.classBinding = classBinding;
  8289. }
  8290. }
  8291. function genData (el) {
  8292. var data = '';
  8293. if (el.staticClass) {
  8294. data += "staticClass:" + (el.staticClass) + ",";
  8295. }
  8296. if (el.classBinding) {
  8297. data += "class:" + (el.classBinding) + ",";
  8298. }
  8299. return data
  8300. }
  8301. var klass$1 = {
  8302. staticKeys: ['staticClass'],
  8303. transformNode: transformNode,
  8304. genData: genData
  8305. };
  8306. /* */
  8307. function transformNode$1 (el, options) {
  8308. var warn = options.warn || baseWarn;
  8309. var staticStyle = getAndRemoveAttr(el, 'style');
  8310. if (staticStyle) {
  8311. /* istanbul ignore if */
  8312. {
  8313. var res = parseText(staticStyle, options.delimiters);
  8314. if (res) {
  8315. warn(
  8316. "style=\"" + staticStyle + "\": " +
  8317. 'Interpolation inside attributes has been removed. ' +
  8318. 'Use v-bind or the colon shorthand instead. For example, ' +
  8319. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  8320. el.rawAttrsMap['style']
  8321. );
  8322. }
  8323. }
  8324. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  8325. }
  8326. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  8327. if (styleBinding) {
  8328. el.styleBinding = styleBinding;
  8329. }
  8330. }
  8331. function genData$1 (el) {
  8332. var data = '';
  8333. if (el.staticStyle) {
  8334. data += "staticStyle:" + (el.staticStyle) + ",";
  8335. }
  8336. if (el.styleBinding) {
  8337. data += "style:(" + (el.styleBinding) + "),";
  8338. }
  8339. return data
  8340. }
  8341. var style$1 = {
  8342. staticKeys: ['staticStyle'],
  8343. transformNode: transformNode$1,
  8344. genData: genData$1
  8345. };
  8346. /* */
  8347. var decoder;
  8348. var he = {
  8349. decode: function decode (html) {
  8350. decoder = decoder || document.createElement('div');
  8351. decoder.innerHTML = html;
  8352. return decoder.textContent
  8353. }
  8354. };
  8355. /* */
  8356. var isUnaryTag = makeMap(
  8357. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  8358. 'link,meta,param,source,track,wbr'
  8359. );
  8360. // Elements that you can, intentionally, leave open
  8361. // (and which close themselves)
  8362. var canBeLeftOpenTag = makeMap(
  8363. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  8364. );
  8365. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  8366. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  8367. var isNonPhrasingTag = makeMap(
  8368. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  8369. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  8370. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  8371. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  8372. 'title,tr,track'
  8373. );
  8374. /**
  8375. * Not type-checking this file because it's mostly vendor code.
  8376. */
  8377. // Regular Expressions for parsing tags and attributes
  8378. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  8379. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  8380. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  8381. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  8382. var startTagOpen = new RegExp(("^<" + qnameCapture));
  8383. var startTagClose = /^\s*(\/?)>/;
  8384. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  8385. var doctype = /^<!DOCTYPE [^>]+>/i;
  8386. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  8387. var comment = /^<!\--/;
  8388. var conditionalComment = /^<!\[/;
  8389. // Special Elements (can contain anything)
  8390. var isPlainTextElement = makeMap('script,style,textarea', true);
  8391. var reCache = {};
  8392. var decodingMap = {
  8393. '&lt;': '<',
  8394. '&gt;': '>',
  8395. '&quot;': '"',
  8396. '&amp;': '&',
  8397. '&#10;': '\n',
  8398. '&#9;': '\t',
  8399. '&#39;': "'"
  8400. };
  8401. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  8402. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  8403. // #5992
  8404. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  8405. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  8406. function decodeAttr (value, shouldDecodeNewlines) {
  8407. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  8408. return value.replace(re, function (match) { return decodingMap[match]; })
  8409. }
  8410. function parseHTML (html, options) {
  8411. var stack = [];
  8412. var expectHTML = options.expectHTML;
  8413. var isUnaryTag$$1 = options.isUnaryTag || no;
  8414. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  8415. var index = 0;
  8416. var last, lastTag;
  8417. while (html) {
  8418. last = html;
  8419. // Make sure we're not in a plaintext content element like script/style
  8420. if (!lastTag || !isPlainTextElement(lastTag)) {
  8421. var textEnd = html.indexOf('<');
  8422. if (textEnd === 0) {
  8423. // Comment:
  8424. if (comment.test(html)) {
  8425. var commentEnd = html.indexOf('-->');
  8426. if (commentEnd >= 0) {
  8427. if (options.shouldKeepComment) {
  8428. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  8429. }
  8430. advance(commentEnd + 3);
  8431. continue
  8432. }
  8433. }
  8434. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  8435. if (conditionalComment.test(html)) {
  8436. var conditionalEnd = html.indexOf(']>');
  8437. if (conditionalEnd >= 0) {
  8438. advance(conditionalEnd + 2);
  8439. continue
  8440. }
  8441. }
  8442. // Doctype:
  8443. var doctypeMatch = html.match(doctype);
  8444. if (doctypeMatch) {
  8445. advance(doctypeMatch[0].length);
  8446. continue
  8447. }
  8448. // End tag:
  8449. var endTagMatch = html.match(endTag);
  8450. if (endTagMatch) {
  8451. var curIndex = index;
  8452. advance(endTagMatch[0].length);
  8453. parseEndTag(endTagMatch[1], curIndex, index);
  8454. continue
  8455. }
  8456. // Start tag:
  8457. var startTagMatch = parseStartTag();
  8458. if (startTagMatch) {
  8459. handleStartTag(startTagMatch);
  8460. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  8461. advance(1);
  8462. }
  8463. continue
  8464. }
  8465. }
  8466. var text = (void 0), rest = (void 0), next = (void 0);
  8467. if (textEnd >= 0) {
  8468. rest = html.slice(textEnd);
  8469. while (
  8470. !endTag.test(rest) &&
  8471. !startTagOpen.test(rest) &&
  8472. !comment.test(rest) &&
  8473. !conditionalComment.test(rest)
  8474. ) {
  8475. // < in plain text, be forgiving and treat it as text
  8476. next = rest.indexOf('<', 1);
  8477. if (next < 0) { break }
  8478. textEnd += next;
  8479. rest = html.slice(textEnd);
  8480. }
  8481. text = html.substring(0, textEnd);
  8482. }
  8483. if (textEnd < 0) {
  8484. text = html;
  8485. }
  8486. if (text) {
  8487. advance(text.length);
  8488. }
  8489. if (options.chars && text) {
  8490. options.chars(text, index - text.length, index);
  8491. }
  8492. } else {
  8493. var endTagLength = 0;
  8494. var stackedTag = lastTag.toLowerCase();
  8495. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  8496. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  8497. endTagLength = endTag.length;
  8498. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  8499. text = text
  8500. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  8501. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  8502. }
  8503. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  8504. text = text.slice(1);
  8505. }
  8506. if (options.chars) {
  8507. options.chars(text);
  8508. }
  8509. return ''
  8510. });
  8511. index += html.length - rest$1.length;
  8512. html = rest$1;
  8513. parseEndTag(stackedTag, index - endTagLength, index);
  8514. }
  8515. if (html === last) {
  8516. options.chars && options.chars(html);
  8517. if (!stack.length && options.warn) {
  8518. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  8519. }
  8520. break
  8521. }
  8522. }
  8523. // Clean up any remaining tags
  8524. parseEndTag();
  8525. function advance (n) {
  8526. index += n;
  8527. html = html.substring(n);
  8528. }
  8529. function parseStartTag () {
  8530. var start = html.match(startTagOpen);
  8531. if (start) {
  8532. var match = {
  8533. tagName: start[1],
  8534. attrs: [],
  8535. start: index
  8536. };
  8537. advance(start[0].length);
  8538. var end, attr;
  8539. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  8540. attr.start = index;
  8541. advance(attr[0].length);
  8542. attr.end = index;
  8543. match.attrs.push(attr);
  8544. }
  8545. if (end) {
  8546. match.unarySlash = end[1];
  8547. advance(end[0].length);
  8548. match.end = index;
  8549. return match
  8550. }
  8551. }
  8552. }
  8553. function handleStartTag (match) {
  8554. var tagName = match.tagName;
  8555. var unarySlash = match.unarySlash;
  8556. if (expectHTML) {
  8557. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  8558. parseEndTag(lastTag);
  8559. }
  8560. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  8561. parseEndTag(tagName);
  8562. }
  8563. }
  8564. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  8565. var l = match.attrs.length;
  8566. var attrs = new Array(l);
  8567. for (var i = 0; i < l; i++) {
  8568. var args = match.attrs[i];
  8569. var value = args[3] || args[4] || args[5] || '';
  8570. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  8571. ? options.shouldDecodeNewlinesForHref
  8572. : options.shouldDecodeNewlines;
  8573. attrs[i] = {
  8574. name: args[1],
  8575. value: decodeAttr(value, shouldDecodeNewlines)
  8576. };
  8577. if (options.outputSourceRange) {
  8578. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  8579. attrs[i].end = args.end;
  8580. }
  8581. }
  8582. if (!unary) {
  8583. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  8584. lastTag = tagName;
  8585. }
  8586. if (options.start) {
  8587. options.start(tagName, attrs, unary, match.start, match.end);
  8588. }
  8589. }
  8590. function parseEndTag (tagName, start, end) {
  8591. var pos, lowerCasedTagName;
  8592. if (start == null) { start = index; }
  8593. if (end == null) { end = index; }
  8594. // Find the closest opened tag of the same type
  8595. if (tagName) {
  8596. lowerCasedTagName = tagName.toLowerCase();
  8597. for (pos = stack.length - 1; pos >= 0; pos--) {
  8598. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  8599. break
  8600. }
  8601. }
  8602. } else {
  8603. // If no tag name is provided, clean shop
  8604. pos = 0;
  8605. }
  8606. if (pos >= 0) {
  8607. // Close all the open elements, up the stack
  8608. for (var i = stack.length - 1; i >= pos; i--) {
  8609. if (i > pos || !tagName &&
  8610. options.warn
  8611. ) {
  8612. options.warn(
  8613. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  8614. { start: stack[i].start, end: stack[i].end }
  8615. );
  8616. }
  8617. if (options.end) {
  8618. options.end(stack[i].tag, start, end);
  8619. }
  8620. }
  8621. // Remove the open elements from the stack
  8622. stack.length = pos;
  8623. lastTag = pos && stack[pos - 1].tag;
  8624. } else if (lowerCasedTagName === 'br') {
  8625. if (options.start) {
  8626. options.start(tagName, [], true, start, end);
  8627. }
  8628. } else if (lowerCasedTagName === 'p') {
  8629. if (options.start) {
  8630. options.start(tagName, [], false, start, end);
  8631. }
  8632. if (options.end) {
  8633. options.end(tagName, start, end);
  8634. }
  8635. }
  8636. }
  8637. }
  8638. /* */
  8639. var onRE = /^@|^v-on:/;
  8640. var dirRE = /^v-|^@|^:|^#/;
  8641. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  8642. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  8643. var stripParensRE = /^\(|\)$/g;
  8644. var dynamicArgRE = /^\[.*\]$/;
  8645. var argRE = /:(.*)$/;
  8646. var bindRE = /^:|^\.|^v-bind:/;
  8647. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  8648. var slotRE = /^v-slot(:|$)|^#/;
  8649. var lineBreakRE = /[\r\n]/;
  8650. var whitespaceRE$1 = /[ \f\t\r\n]+/g;
  8651. var invalidAttributeRE = /[\s"'<>\/=]/;
  8652. var decodeHTMLCached = cached(he.decode);
  8653. var emptySlotScopeToken = "_empty_";
  8654. // configurable state
  8655. var warn$2;
  8656. var delimiters;
  8657. var transforms;
  8658. var preTransforms;
  8659. var postTransforms;
  8660. var platformIsPreTag;
  8661. var platformMustUseProp;
  8662. var platformGetTagNamespace;
  8663. var maybeComponent;
  8664. function createASTElement (
  8665. tag,
  8666. attrs,
  8667. parent
  8668. ) {
  8669. return {
  8670. type: 1,
  8671. tag: tag,
  8672. attrsList: attrs,
  8673. attrsMap: makeAttrsMap(attrs),
  8674. rawAttrsMap: {},
  8675. parent: parent,
  8676. children: []
  8677. }
  8678. }
  8679. /**
  8680. * Convert HTML string to AST.
  8681. */
  8682. function parse (
  8683. template,
  8684. options
  8685. ) {
  8686. warn$2 = options.warn || baseWarn;
  8687. platformIsPreTag = options.isPreTag || no;
  8688. platformMustUseProp = options.mustUseProp || no;
  8689. platformGetTagNamespace = options.getTagNamespace || no;
  8690. var isReservedTag = options.isReservedTag || no;
  8691. maybeComponent = function (el) { return !!(
  8692. el.component ||
  8693. el.attrsMap[':is'] ||
  8694. el.attrsMap['v-bind:is'] ||
  8695. !(el.attrsMap.is ? isReservedTag(el.attrsMap.is) : isReservedTag(el.tag))
  8696. ); };
  8697. transforms = pluckModuleFunction(options.modules, 'transformNode');
  8698. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  8699. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  8700. delimiters = options.delimiters;
  8701. var stack = [];
  8702. var preserveWhitespace = options.preserveWhitespace !== false;
  8703. var whitespaceOption = options.whitespace;
  8704. var root;
  8705. var currentParent;
  8706. var inVPre = false;
  8707. var inPre = false;
  8708. var warned = false;
  8709. function warnOnce (msg, range) {
  8710. if (!warned) {
  8711. warned = true;
  8712. warn$2(msg, range);
  8713. }
  8714. }
  8715. function closeElement (element) {
  8716. trimEndingWhitespace(element);
  8717. if (!inVPre && !element.processed) {
  8718. element = processElement(element, options);
  8719. }
  8720. // tree management
  8721. if (!stack.length && element !== root) {
  8722. // allow root elements with v-if, v-else-if and v-else
  8723. if (root.if && (element.elseif || element.else)) {
  8724. {
  8725. checkRootConstraints(element);
  8726. }
  8727. addIfCondition(root, {
  8728. exp: element.elseif,
  8729. block: element
  8730. });
  8731. } else {
  8732. warnOnce(
  8733. "Component template should contain exactly one root element. " +
  8734. "If you are using v-if on multiple elements, " +
  8735. "use v-else-if to chain them instead.",
  8736. { start: element.start }
  8737. );
  8738. }
  8739. }
  8740. if (currentParent && !element.forbidden) {
  8741. if (element.elseif || element.else) {
  8742. processIfConditions(element, currentParent);
  8743. } else {
  8744. if (element.slotScope) {
  8745. // scoped slot
  8746. // keep it in the children list so that v-else(-if) conditions can
  8747. // find it as the prev node.
  8748. var name = element.slotTarget || '"default"'
  8749. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  8750. }
  8751. currentParent.children.push(element);
  8752. element.parent = currentParent;
  8753. }
  8754. }
  8755. // final children cleanup
  8756. // filter out scoped slots
  8757. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  8758. // remove trailing whitespace node again
  8759. trimEndingWhitespace(element);
  8760. // check pre state
  8761. if (element.pre) {
  8762. inVPre = false;
  8763. }
  8764. if (platformIsPreTag(element.tag)) {
  8765. inPre = false;
  8766. }
  8767. // apply post-transforms
  8768. for (var i = 0; i < postTransforms.length; i++) {
  8769. postTransforms[i](element, options);
  8770. }
  8771. }
  8772. function trimEndingWhitespace (el) {
  8773. // remove trailing whitespace node
  8774. if (!inPre) {
  8775. var lastNode;
  8776. while (
  8777. (lastNode = el.children[el.children.length - 1]) &&
  8778. lastNode.type === 3 &&
  8779. lastNode.text === ' '
  8780. ) {
  8781. el.children.pop();
  8782. }
  8783. }
  8784. }
  8785. function checkRootConstraints (el) {
  8786. if (el.tag === 'slot' || el.tag === 'template') {
  8787. warnOnce(
  8788. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  8789. 'contain multiple nodes.',
  8790. { start: el.start }
  8791. );
  8792. }
  8793. if (el.attrsMap.hasOwnProperty('v-for')) {
  8794. warnOnce(
  8795. 'Cannot use v-for on stateful component root element because ' +
  8796. 'it renders multiple elements.',
  8797. el.rawAttrsMap['v-for']
  8798. );
  8799. }
  8800. }
  8801. parseHTML(template, {
  8802. warn: warn$2,
  8803. expectHTML: options.expectHTML,
  8804. isUnaryTag: options.isUnaryTag,
  8805. canBeLeftOpenTag: options.canBeLeftOpenTag,
  8806. shouldDecodeNewlines: options.shouldDecodeNewlines,
  8807. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  8808. shouldKeepComment: options.comments,
  8809. outputSourceRange: options.outputSourceRange,
  8810. start: function start (tag, attrs, unary, start$1, end) {
  8811. // check namespace.
  8812. // inherit parent ns if there is one
  8813. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  8814. // handle IE svg bug
  8815. /* istanbul ignore if */
  8816. if (isIE && ns === 'svg') {
  8817. attrs = guardIESVGBug(attrs);
  8818. }
  8819. var element = createASTElement(tag, attrs, currentParent);
  8820. if (ns) {
  8821. element.ns = ns;
  8822. }
  8823. {
  8824. if (options.outputSourceRange) {
  8825. element.start = start$1;
  8826. element.end = end;
  8827. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  8828. cumulated[attr.name] = attr;
  8829. return cumulated
  8830. }, {});
  8831. }
  8832. attrs.forEach(function (attr) {
  8833. if (invalidAttributeRE.test(attr.name)) {
  8834. warn$2(
  8835. "Invalid dynamic argument expression: attribute names cannot contain " +
  8836. "spaces, quotes, <, >, / or =.",
  8837. {
  8838. start: attr.start + attr.name.indexOf("["),
  8839. end: attr.start + attr.name.length
  8840. }
  8841. );
  8842. }
  8843. });
  8844. }
  8845. if (isForbiddenTag(element) && !isServerRendering()) {
  8846. element.forbidden = true;
  8847. warn$2(
  8848. 'Templates should only be responsible for mapping the state to the ' +
  8849. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  8850. "<" + tag + ">" + ', as they will not be parsed.',
  8851. { start: element.start }
  8852. );
  8853. }
  8854. // apply pre-transforms
  8855. for (var i = 0; i < preTransforms.length; i++) {
  8856. element = preTransforms[i](element, options) || element;
  8857. }
  8858. if (!inVPre) {
  8859. processPre(element);
  8860. if (element.pre) {
  8861. inVPre = true;
  8862. }
  8863. }
  8864. if (platformIsPreTag(element.tag)) {
  8865. inPre = true;
  8866. }
  8867. if (inVPre) {
  8868. processRawAttrs(element);
  8869. } else if (!element.processed) {
  8870. // structural directives
  8871. processFor(element);
  8872. processIf(element);
  8873. processOnce(element);
  8874. }
  8875. if (!root) {
  8876. root = element;
  8877. {
  8878. checkRootConstraints(root);
  8879. }
  8880. }
  8881. if (!unary) {
  8882. currentParent = element;
  8883. stack.push(element);
  8884. } else {
  8885. closeElement(element);
  8886. }
  8887. },
  8888. end: function end (tag, start, end$1) {
  8889. var element = stack[stack.length - 1];
  8890. // pop stack
  8891. stack.length -= 1;
  8892. currentParent = stack[stack.length - 1];
  8893. if (options.outputSourceRange) {
  8894. element.end = end$1;
  8895. }
  8896. closeElement(element);
  8897. },
  8898. chars: function chars (text, start, end) {
  8899. if (!currentParent) {
  8900. {
  8901. if (text === template) {
  8902. warnOnce(
  8903. 'Component template requires a root element, rather than just text.',
  8904. { start: start }
  8905. );
  8906. } else if ((text = text.trim())) {
  8907. warnOnce(
  8908. ("text \"" + text + "\" outside root element will be ignored."),
  8909. { start: start }
  8910. );
  8911. }
  8912. }
  8913. return
  8914. }
  8915. // IE textarea placeholder bug
  8916. /* istanbul ignore if */
  8917. if (isIE &&
  8918. currentParent.tag === 'textarea' &&
  8919. currentParent.attrsMap.placeholder === text
  8920. ) {
  8921. return
  8922. }
  8923. var children = currentParent.children;
  8924. if (inPre || text.trim()) {
  8925. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  8926. } else if (!children.length) {
  8927. // remove the whitespace-only node right after an opening tag
  8928. text = '';
  8929. } else if (whitespaceOption) {
  8930. if (whitespaceOption === 'condense') {
  8931. // in condense mode, remove the whitespace node if it contains
  8932. // line break, otherwise condense to a single space
  8933. text = lineBreakRE.test(text) ? '' : ' ';
  8934. } else {
  8935. text = ' ';
  8936. }
  8937. } else {
  8938. text = preserveWhitespace ? ' ' : '';
  8939. }
  8940. if (text) {
  8941. if (!inPre && whitespaceOption === 'condense') {
  8942. // condense consecutive whitespaces into single space
  8943. text = text.replace(whitespaceRE$1, ' ');
  8944. }
  8945. var res;
  8946. var child;
  8947. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  8948. child = {
  8949. type: 2,
  8950. expression: res.expression,
  8951. tokens: res.tokens,
  8952. text: text
  8953. };
  8954. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  8955. child = {
  8956. type: 3,
  8957. text: text
  8958. };
  8959. }
  8960. if (child) {
  8961. if (options.outputSourceRange) {
  8962. child.start = start;
  8963. child.end = end;
  8964. }
  8965. children.push(child);
  8966. }
  8967. }
  8968. },
  8969. comment: function comment (text, start, end) {
  8970. // adding anything as a sibling to the root node is forbidden
  8971. // comments should still be allowed, but ignored
  8972. if (currentParent) {
  8973. var child = {
  8974. type: 3,
  8975. text: text,
  8976. isComment: true
  8977. };
  8978. if (options.outputSourceRange) {
  8979. child.start = start;
  8980. child.end = end;
  8981. }
  8982. currentParent.children.push(child);
  8983. }
  8984. }
  8985. });
  8986. return root
  8987. }
  8988. function processPre (el) {
  8989. if (getAndRemoveAttr(el, 'v-pre') != null) {
  8990. el.pre = true;
  8991. }
  8992. }
  8993. function processRawAttrs (el) {
  8994. var list = el.attrsList;
  8995. var len = list.length;
  8996. if (len) {
  8997. var attrs = el.attrs = new Array(len);
  8998. for (var i = 0; i < len; i++) {
  8999. attrs[i] = {
  9000. name: list[i].name,
  9001. value: JSON.stringify(list[i].value)
  9002. };
  9003. if (list[i].start != null) {
  9004. attrs[i].start = list[i].start;
  9005. attrs[i].end = list[i].end;
  9006. }
  9007. }
  9008. } else if (!el.pre) {
  9009. // non root node in pre blocks with no attributes
  9010. el.plain = true;
  9011. }
  9012. }
  9013. function processElement (
  9014. element,
  9015. options
  9016. ) {
  9017. processKey(element);
  9018. // determine whether this is a plain element after
  9019. // removing structural attributes
  9020. element.plain = (
  9021. !element.key &&
  9022. !element.scopedSlots &&
  9023. !element.attrsList.length
  9024. );
  9025. processRef(element);
  9026. processSlotContent(element);
  9027. processSlotOutlet(element);
  9028. processComponent(element);
  9029. for (var i = 0; i < transforms.length; i++) {
  9030. element = transforms[i](element, options) || element;
  9031. }
  9032. processAttrs(element);
  9033. return element
  9034. }
  9035. function processKey (el) {
  9036. var exp = getBindingAttr(el, 'key');
  9037. if (exp) {
  9038. {
  9039. if (el.tag === 'template') {
  9040. warn$2(
  9041. "<template> cannot be keyed. Place the key on real elements instead.",
  9042. getRawBindingAttr(el, 'key')
  9043. );
  9044. }
  9045. if (el.for) {
  9046. var iterator = el.iterator2 || el.iterator1;
  9047. var parent = el.parent;
  9048. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  9049. warn$2(
  9050. "Do not use v-for index as key on <transition-group> children, " +
  9051. "this is the same as not using keys.",
  9052. getRawBindingAttr(el, 'key'),
  9053. true /* tip */
  9054. );
  9055. }
  9056. }
  9057. }
  9058. el.key = exp;
  9059. }
  9060. }
  9061. function processRef (el) {
  9062. var ref = getBindingAttr(el, 'ref');
  9063. if (ref) {
  9064. el.ref = ref;
  9065. el.refInFor = checkInFor(el);
  9066. }
  9067. }
  9068. function processFor (el) {
  9069. var exp;
  9070. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  9071. var res = parseFor(exp);
  9072. if (res) {
  9073. extend(el, res);
  9074. } else {
  9075. warn$2(
  9076. ("Invalid v-for expression: " + exp),
  9077. el.rawAttrsMap['v-for']
  9078. );
  9079. }
  9080. }
  9081. }
  9082. function parseFor (exp) {
  9083. var inMatch = exp.match(forAliasRE);
  9084. if (!inMatch) { return }
  9085. var res = {};
  9086. res.for = inMatch[2].trim();
  9087. var alias = inMatch[1].trim().replace(stripParensRE, '');
  9088. var iteratorMatch = alias.match(forIteratorRE);
  9089. if (iteratorMatch) {
  9090. res.alias = alias.replace(forIteratorRE, '').trim();
  9091. res.iterator1 = iteratorMatch[1].trim();
  9092. if (iteratorMatch[2]) {
  9093. res.iterator2 = iteratorMatch[2].trim();
  9094. }
  9095. } else {
  9096. res.alias = alias;
  9097. }
  9098. return res
  9099. }
  9100. function processIf (el) {
  9101. var exp = getAndRemoveAttr(el, 'v-if');
  9102. if (exp) {
  9103. el.if = exp;
  9104. addIfCondition(el, {
  9105. exp: exp,
  9106. block: el
  9107. });
  9108. } else {
  9109. if (getAndRemoveAttr(el, 'v-else') != null) {
  9110. el.else = true;
  9111. }
  9112. var elseif = getAndRemoveAttr(el, 'v-else-if');
  9113. if (elseif) {
  9114. el.elseif = elseif;
  9115. }
  9116. }
  9117. }
  9118. function processIfConditions (el, parent) {
  9119. var prev = findPrevElement(parent.children);
  9120. if (prev && prev.if) {
  9121. addIfCondition(prev, {
  9122. exp: el.elseif,
  9123. block: el
  9124. });
  9125. } else {
  9126. warn$2(
  9127. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  9128. "used on element <" + (el.tag) + "> without corresponding v-if.",
  9129. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  9130. );
  9131. }
  9132. }
  9133. function findPrevElement (children) {
  9134. var i = children.length;
  9135. while (i--) {
  9136. if (children[i].type === 1) {
  9137. return children[i]
  9138. } else {
  9139. if (children[i].text !== ' ') {
  9140. warn$2(
  9141. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  9142. "will be ignored.",
  9143. children[i]
  9144. );
  9145. }
  9146. children.pop();
  9147. }
  9148. }
  9149. }
  9150. function addIfCondition (el, condition) {
  9151. if (!el.ifConditions) {
  9152. el.ifConditions = [];
  9153. }
  9154. el.ifConditions.push(condition);
  9155. }
  9156. function processOnce (el) {
  9157. var once$$1 = getAndRemoveAttr(el, 'v-once');
  9158. if (once$$1 != null) {
  9159. el.once = true;
  9160. }
  9161. }
  9162. // handle content being passed to a component as slot,
  9163. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  9164. function processSlotContent (el) {
  9165. var slotScope;
  9166. if (el.tag === 'template') {
  9167. slotScope = getAndRemoveAttr(el, 'scope');
  9168. /* istanbul ignore if */
  9169. if (slotScope) {
  9170. warn$2(
  9171. "the \"scope\" attribute for scoped slots have been deprecated and " +
  9172. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  9173. "can also be used on plain elements in addition to <template> to " +
  9174. "denote scoped slots.",
  9175. el.rawAttrsMap['scope'],
  9176. true
  9177. );
  9178. }
  9179. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  9180. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  9181. /* istanbul ignore if */
  9182. if (el.attrsMap['v-for']) {
  9183. warn$2(
  9184. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  9185. "(v-for takes higher priority). Use a wrapper <template> for the " +
  9186. "scoped slot to make it clearer.",
  9187. el.rawAttrsMap['slot-scope'],
  9188. true
  9189. );
  9190. }
  9191. el.slotScope = slotScope;
  9192. }
  9193. // slot="xxx"
  9194. var slotTarget = getBindingAttr(el, 'slot');
  9195. if (slotTarget) {
  9196. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  9197. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  9198. // preserve slot as an attribute for native shadow DOM compat
  9199. // only for non-scoped slots.
  9200. if (el.tag !== 'template' && !el.slotScope) {
  9201. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  9202. }
  9203. }
  9204. // 2.6 v-slot syntax
  9205. {
  9206. if (el.tag === 'template') {
  9207. // v-slot on <template>
  9208. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  9209. if (slotBinding) {
  9210. {
  9211. if (el.slotTarget || el.slotScope) {
  9212. warn$2(
  9213. "Unexpected mixed usage of different slot syntaxes.",
  9214. el
  9215. );
  9216. }
  9217. if (el.parent && !maybeComponent(el.parent)) {
  9218. warn$2(
  9219. "<template v-slot> can only appear at the root level inside " +
  9220. "the receiving component",
  9221. el
  9222. );
  9223. }
  9224. }
  9225. var ref = getSlotName(slotBinding);
  9226. var name = ref.name;
  9227. var dynamic = ref.dynamic;
  9228. el.slotTarget = name;
  9229. el.slotTargetDynamic = dynamic;
  9230. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  9231. }
  9232. } else {
  9233. // v-slot on component, denotes default slot
  9234. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  9235. if (slotBinding$1) {
  9236. {
  9237. if (!maybeComponent(el)) {
  9238. warn$2(
  9239. "v-slot can only be used on components or <template>.",
  9240. slotBinding$1
  9241. );
  9242. }
  9243. if (el.slotScope || el.slotTarget) {
  9244. warn$2(
  9245. "Unexpected mixed usage of different slot syntaxes.",
  9246. el
  9247. );
  9248. }
  9249. if (el.scopedSlots) {
  9250. warn$2(
  9251. "To avoid scope ambiguity, the default slot should also use " +
  9252. "<template> syntax when there are other named slots.",
  9253. slotBinding$1
  9254. );
  9255. }
  9256. }
  9257. // add the component's children to its default slot
  9258. var slots = el.scopedSlots || (el.scopedSlots = {});
  9259. var ref$1 = getSlotName(slotBinding$1);
  9260. var name$1 = ref$1.name;
  9261. var dynamic$1 = ref$1.dynamic;
  9262. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  9263. slotContainer.slotTarget = name$1;
  9264. slotContainer.slotTargetDynamic = dynamic$1;
  9265. slotContainer.children = el.children.filter(function (c) {
  9266. if (!c.slotScope) {
  9267. c.parent = slotContainer;
  9268. return true
  9269. }
  9270. });
  9271. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  9272. // remove children as they are returned from scopedSlots now
  9273. el.children = [];
  9274. // mark el non-plain so data gets generated
  9275. el.plain = false;
  9276. }
  9277. }
  9278. }
  9279. }
  9280. function getSlotName (binding) {
  9281. var name = binding.name.replace(slotRE, '');
  9282. if (!name) {
  9283. if (binding.name[0] !== '#') {
  9284. name = 'default';
  9285. } else {
  9286. warn$2(
  9287. "v-slot shorthand syntax requires a slot name.",
  9288. binding
  9289. );
  9290. }
  9291. }
  9292. return dynamicArgRE.test(name)
  9293. // dynamic [name]
  9294. ? { name: name.slice(1, -1), dynamic: true }
  9295. // static name
  9296. : { name: ("\"" + name + "\""), dynamic: false }
  9297. }
  9298. // handle <slot/> outlets
  9299. function processSlotOutlet (el) {
  9300. if (el.tag === 'slot') {
  9301. el.slotName = getBindingAttr(el, 'name');
  9302. if (el.key) {
  9303. warn$2(
  9304. "`key` does not work on <slot> because slots are abstract outlets " +
  9305. "and can possibly expand into multiple elements. " +
  9306. "Use the key on a wrapping element instead.",
  9307. getRawBindingAttr(el, 'key')
  9308. );
  9309. }
  9310. }
  9311. }
  9312. function processComponent (el) {
  9313. var binding;
  9314. if ((binding = getBindingAttr(el, 'is'))) {
  9315. el.component = binding;
  9316. }
  9317. if (getAndRemoveAttr(el, 'inline-template') != null) {
  9318. el.inlineTemplate = true;
  9319. }
  9320. }
  9321. function processAttrs (el) {
  9322. var list = el.attrsList;
  9323. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  9324. for (i = 0, l = list.length; i < l; i++) {
  9325. name = rawName = list[i].name;
  9326. value = list[i].value;
  9327. if (dirRE.test(name)) {
  9328. // mark element as dynamic
  9329. el.hasBindings = true;
  9330. // modifiers
  9331. modifiers = parseModifiers(name.replace(dirRE, ''));
  9332. // support .foo shorthand syntax for the .prop modifier
  9333. if (modifiers) {
  9334. name = name.replace(modifierRE, '');
  9335. }
  9336. if (bindRE.test(name)) { // v-bind
  9337. name = name.replace(bindRE, '');
  9338. value = parseFilters(value);
  9339. isDynamic = dynamicArgRE.test(name);
  9340. if (isDynamic) {
  9341. name = name.slice(1, -1);
  9342. }
  9343. if (
  9344. value.trim().length === 0
  9345. ) {
  9346. warn$2(
  9347. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  9348. );
  9349. }
  9350. if (modifiers) {
  9351. if (modifiers.prop && !isDynamic) {
  9352. name = camelize(name);
  9353. if (name === 'innerHtml') { name = 'innerHTML'; }
  9354. }
  9355. if (modifiers.camel && !isDynamic) {
  9356. name = camelize(name);
  9357. }
  9358. if (modifiers.sync) {
  9359. syncGen = genAssignmentCode(value, "$event");
  9360. if (!isDynamic) {
  9361. addHandler(
  9362. el,
  9363. ("update:" + (camelize(name))),
  9364. syncGen,
  9365. null,
  9366. false,
  9367. warn$2,
  9368. list[i]
  9369. );
  9370. if (hyphenate(name) !== camelize(name)) {
  9371. addHandler(
  9372. el,
  9373. ("update:" + (hyphenate(name))),
  9374. syncGen,
  9375. null,
  9376. false,
  9377. warn$2,
  9378. list[i]
  9379. );
  9380. }
  9381. } else {
  9382. // handler w/ dynamic event name
  9383. addHandler(
  9384. el,
  9385. ("\"update:\"+(" + name + ")"),
  9386. syncGen,
  9387. null,
  9388. false,
  9389. warn$2,
  9390. list[i],
  9391. true // dynamic
  9392. );
  9393. }
  9394. }
  9395. }
  9396. if ((modifiers && modifiers.prop) || (
  9397. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  9398. )) {
  9399. addProp(el, name, value, list[i], isDynamic);
  9400. } else {
  9401. addAttr(el, name, value, list[i], isDynamic);
  9402. }
  9403. } else if (onRE.test(name)) { // v-on
  9404. name = name.replace(onRE, '');
  9405. isDynamic = dynamicArgRE.test(name);
  9406. if (isDynamic) {
  9407. name = name.slice(1, -1);
  9408. }
  9409. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  9410. } else { // normal directives
  9411. name = name.replace(dirRE, '');
  9412. // parse arg
  9413. var argMatch = name.match(argRE);
  9414. var arg = argMatch && argMatch[1];
  9415. isDynamic = false;
  9416. if (arg) {
  9417. name = name.slice(0, -(arg.length + 1));
  9418. if (dynamicArgRE.test(arg)) {
  9419. arg = arg.slice(1, -1);
  9420. isDynamic = true;
  9421. }
  9422. }
  9423. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  9424. if (name === 'model') {
  9425. checkForAliasModel(el, value);
  9426. }
  9427. }
  9428. } else {
  9429. // literal attribute
  9430. {
  9431. var res = parseText(value, delimiters);
  9432. if (res) {
  9433. warn$2(
  9434. name + "=\"" + value + "\": " +
  9435. 'Interpolation inside attributes has been removed. ' +
  9436. 'Use v-bind or the colon shorthand instead. For example, ' +
  9437. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  9438. list[i]
  9439. );
  9440. }
  9441. }
  9442. addAttr(el, name, JSON.stringify(value), list[i]);
  9443. // #6887 firefox doesn't update muted state if set via attribute
  9444. // even immediately after element creation
  9445. if (!el.component &&
  9446. name === 'muted' &&
  9447. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  9448. addProp(el, name, 'true', list[i]);
  9449. }
  9450. }
  9451. }
  9452. }
  9453. function checkInFor (el) {
  9454. var parent = el;
  9455. while (parent) {
  9456. if (parent.for !== undefined) {
  9457. return true
  9458. }
  9459. parent = parent.parent;
  9460. }
  9461. return false
  9462. }
  9463. function parseModifiers (name) {
  9464. var match = name.match(modifierRE);
  9465. if (match) {
  9466. var ret = {};
  9467. match.forEach(function (m) { ret[m.slice(1)] = true; });
  9468. return ret
  9469. }
  9470. }
  9471. function makeAttrsMap (attrs) {
  9472. var map = {};
  9473. for (var i = 0, l = attrs.length; i < l; i++) {
  9474. if (
  9475. map[attrs[i].name] && !isIE && !isEdge
  9476. ) {
  9477. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  9478. }
  9479. map[attrs[i].name] = attrs[i].value;
  9480. }
  9481. return map
  9482. }
  9483. // for script (e.g. type="x/template") or style, do not decode content
  9484. function isTextTag (el) {
  9485. return el.tag === 'script' || el.tag === 'style'
  9486. }
  9487. function isForbiddenTag (el) {
  9488. return (
  9489. el.tag === 'style' ||
  9490. (el.tag === 'script' && (
  9491. !el.attrsMap.type ||
  9492. el.attrsMap.type === 'text/javascript'
  9493. ))
  9494. )
  9495. }
  9496. var ieNSBug = /^xmlns:NS\d+/;
  9497. var ieNSPrefix = /^NS\d+:/;
  9498. /* istanbul ignore next */
  9499. function guardIESVGBug (attrs) {
  9500. var res = [];
  9501. for (var i = 0; i < attrs.length; i++) {
  9502. var attr = attrs[i];
  9503. if (!ieNSBug.test(attr.name)) {
  9504. attr.name = attr.name.replace(ieNSPrefix, '');
  9505. res.push(attr);
  9506. }
  9507. }
  9508. return res
  9509. }
  9510. function checkForAliasModel (el, value) {
  9511. var _el = el;
  9512. while (_el) {
  9513. if (_el.for && _el.alias === value) {
  9514. warn$2(
  9515. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  9516. "You are binding v-model directly to a v-for iteration alias. " +
  9517. "This will not be able to modify the v-for source array because " +
  9518. "writing to the alias is like modifying a function local variable. " +
  9519. "Consider using an array of objects and use v-model on an object property instead.",
  9520. el.rawAttrsMap['v-model']
  9521. );
  9522. }
  9523. _el = _el.parent;
  9524. }
  9525. }
  9526. /* */
  9527. function preTransformNode (el, options) {
  9528. if (el.tag === 'input') {
  9529. var map = el.attrsMap;
  9530. if (!map['v-model']) {
  9531. return
  9532. }
  9533. var typeBinding;
  9534. if (map[':type'] || map['v-bind:type']) {
  9535. typeBinding = getBindingAttr(el, 'type');
  9536. }
  9537. if (!map.type && !typeBinding && map['v-bind']) {
  9538. typeBinding = "(" + (map['v-bind']) + ").type";
  9539. }
  9540. if (typeBinding) {
  9541. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  9542. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  9543. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  9544. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  9545. // 1. checkbox
  9546. var branch0 = cloneASTElement(el);
  9547. // process for on the main node
  9548. processFor(branch0);
  9549. addRawAttr(branch0, 'type', 'checkbox');
  9550. processElement(branch0, options);
  9551. branch0.processed = true; // prevent it from double-processed
  9552. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  9553. addIfCondition(branch0, {
  9554. exp: branch0.if,
  9555. block: branch0
  9556. });
  9557. // 2. add radio else-if condition
  9558. var branch1 = cloneASTElement(el);
  9559. getAndRemoveAttr(branch1, 'v-for', true);
  9560. addRawAttr(branch1, 'type', 'radio');
  9561. processElement(branch1, options);
  9562. addIfCondition(branch0, {
  9563. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  9564. block: branch1
  9565. });
  9566. // 3. other
  9567. var branch2 = cloneASTElement(el);
  9568. getAndRemoveAttr(branch2, 'v-for', true);
  9569. addRawAttr(branch2, ':type', typeBinding);
  9570. processElement(branch2, options);
  9571. addIfCondition(branch0, {
  9572. exp: ifCondition,
  9573. block: branch2
  9574. });
  9575. if (hasElse) {
  9576. branch0.else = true;
  9577. } else if (elseIfCondition) {
  9578. branch0.elseif = elseIfCondition;
  9579. }
  9580. return branch0
  9581. }
  9582. }
  9583. }
  9584. function cloneASTElement (el) {
  9585. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  9586. }
  9587. var model$1 = {
  9588. preTransformNode: preTransformNode
  9589. };
  9590. var modules$1 = [
  9591. klass$1,
  9592. style$1,
  9593. model$1
  9594. ];
  9595. /* */
  9596. function text (el, dir) {
  9597. if (dir.value) {
  9598. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  9599. }
  9600. }
  9601. /* */
  9602. function html (el, dir) {
  9603. if (dir.value) {
  9604. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  9605. }
  9606. }
  9607. var directives$1 = {
  9608. model: model,
  9609. text: text,
  9610. html: html
  9611. };
  9612. /* */
  9613. var baseOptions = {
  9614. expectHTML: true,
  9615. modules: modules$1,
  9616. directives: directives$1,
  9617. isPreTag: isPreTag,
  9618. isUnaryTag: isUnaryTag,
  9619. mustUseProp: mustUseProp,
  9620. canBeLeftOpenTag: canBeLeftOpenTag,
  9621. isReservedTag: isReservedTag,
  9622. getTagNamespace: getTagNamespace,
  9623. staticKeys: genStaticKeys(modules$1)
  9624. };
  9625. /* */
  9626. var isStaticKey;
  9627. var isPlatformReservedTag;
  9628. var genStaticKeysCached = cached(genStaticKeys$1);
  9629. /**
  9630. * Goal of the optimizer: walk the generated template AST tree
  9631. * and detect sub-trees that are purely static, i.e. parts of
  9632. * the DOM that never needs to change.
  9633. *
  9634. * Once we detect these sub-trees, we can:
  9635. *
  9636. * 1. Hoist them into constants, so that we no longer need to
  9637. * create fresh nodes for them on each re-render;
  9638. * 2. Completely skip them in the patching process.
  9639. */
  9640. function optimize (root, options) {
  9641. if (!root) { return }
  9642. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  9643. isPlatformReservedTag = options.isReservedTag || no;
  9644. // first pass: mark all non-static nodes.
  9645. markStatic$1(root);
  9646. // second pass: mark static roots.
  9647. markStaticRoots(root, false);
  9648. }
  9649. function genStaticKeys$1 (keys) {
  9650. return makeMap(
  9651. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  9652. (keys ? ',' + keys : '')
  9653. )
  9654. }
  9655. function markStatic$1 (node) {
  9656. node.static = isStatic(node);
  9657. if (node.type === 1) {
  9658. // do not make component slot content static. this avoids
  9659. // 1. components not able to mutate slot nodes
  9660. // 2. static slot content fails for hot-reloading
  9661. if (
  9662. !isPlatformReservedTag(node.tag) &&
  9663. node.tag !== 'slot' &&
  9664. node.attrsMap['inline-template'] == null
  9665. ) {
  9666. return
  9667. }
  9668. for (var i = 0, l = node.children.length; i < l; i++) {
  9669. var child = node.children[i];
  9670. markStatic$1(child);
  9671. if (!child.static) {
  9672. node.static = false;
  9673. }
  9674. }
  9675. if (node.ifConditions) {
  9676. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  9677. var block = node.ifConditions[i$1].block;
  9678. markStatic$1(block);
  9679. if (!block.static) {
  9680. node.static = false;
  9681. }
  9682. }
  9683. }
  9684. }
  9685. }
  9686. function markStaticRoots (node, isInFor) {
  9687. if (node.type === 1) {
  9688. if (node.static || node.once) {
  9689. node.staticInFor = isInFor;
  9690. }
  9691. // For a node to qualify as a static root, it should have children that
  9692. // are not just static text. Otherwise the cost of hoisting out will
  9693. // outweigh the benefits and it's better off to just always render it fresh.
  9694. if (node.static && node.children.length && !(
  9695. node.children.length === 1 &&
  9696. node.children[0].type === 3
  9697. )) {
  9698. node.staticRoot = true;
  9699. return
  9700. } else {
  9701. node.staticRoot = false;
  9702. }
  9703. if (node.children) {
  9704. for (var i = 0, l = node.children.length; i < l; i++) {
  9705. markStaticRoots(node.children[i], isInFor || !!node.for);
  9706. }
  9707. }
  9708. if (node.ifConditions) {
  9709. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  9710. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  9711. }
  9712. }
  9713. }
  9714. }
  9715. function isStatic (node) {
  9716. if (node.type === 2) { // expression
  9717. return false
  9718. }
  9719. if (node.type === 3) { // text
  9720. return true
  9721. }
  9722. return !!(node.pre || (
  9723. !node.hasBindings && // no dynamic bindings
  9724. !node.if && !node.for && // not v-if or v-for or v-else
  9725. !isBuiltInTag(node.tag) && // not a built-in
  9726. isPlatformReservedTag(node.tag) && // not a component
  9727. !isDirectChildOfTemplateFor(node) &&
  9728. Object.keys(node).every(isStaticKey)
  9729. ))
  9730. }
  9731. function isDirectChildOfTemplateFor (node) {
  9732. while (node.parent) {
  9733. node = node.parent;
  9734. if (node.tag !== 'template') {
  9735. return false
  9736. }
  9737. if (node.for) {
  9738. return true
  9739. }
  9740. }
  9741. return false
  9742. }
  9743. /* */
  9744. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  9745. var fnInvokeRE = /\([^)]*?\);*$/;
  9746. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  9747. // KeyboardEvent.keyCode aliases
  9748. var keyCodes = {
  9749. esc: 27,
  9750. tab: 9,
  9751. enter: 13,
  9752. space: 32,
  9753. up: 38,
  9754. left: 37,
  9755. right: 39,
  9756. down: 40,
  9757. 'delete': [8, 46]
  9758. };
  9759. // KeyboardEvent.key aliases
  9760. var keyNames = {
  9761. // #7880: IE11 and Edge use `Esc` for Escape key name.
  9762. esc: ['Esc', 'Escape'],
  9763. tab: 'Tab',
  9764. enter: 'Enter',
  9765. // #9112: IE11 uses `Spacebar` for Space key name.
  9766. space: [' ', 'Spacebar'],
  9767. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  9768. up: ['Up', 'ArrowUp'],
  9769. left: ['Left', 'ArrowLeft'],
  9770. right: ['Right', 'ArrowRight'],
  9771. down: ['Down', 'ArrowDown'],
  9772. // #9112: IE11 uses `Del` for Delete key name.
  9773. 'delete': ['Backspace', 'Delete', 'Del']
  9774. };
  9775. // #4868: modifiers that prevent the execution of the listener
  9776. // need to explicitly return null so that we can determine whether to remove
  9777. // the listener for .once
  9778. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  9779. var modifierCode = {
  9780. stop: '$event.stopPropagation();',
  9781. prevent: '$event.preventDefault();',
  9782. self: genGuard("$event.target !== $event.currentTarget"),
  9783. ctrl: genGuard("!$event.ctrlKey"),
  9784. shift: genGuard("!$event.shiftKey"),
  9785. alt: genGuard("!$event.altKey"),
  9786. meta: genGuard("!$event.metaKey"),
  9787. left: genGuard("'button' in $event && $event.button !== 0"),
  9788. middle: genGuard("'button' in $event && $event.button !== 1"),
  9789. right: genGuard("'button' in $event && $event.button !== 2")
  9790. };
  9791. function genHandlers (
  9792. events,
  9793. isNative
  9794. ) {
  9795. var prefix = isNative ? 'nativeOn:' : 'on:';
  9796. var staticHandlers = "";
  9797. var dynamicHandlers = "";
  9798. for (var name in events) {
  9799. var handlerCode = genHandler(events[name]);
  9800. if (events[name] && events[name].dynamic) {
  9801. dynamicHandlers += name + "," + handlerCode + ",";
  9802. } else {
  9803. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  9804. }
  9805. }
  9806. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  9807. if (dynamicHandlers) {
  9808. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  9809. } else {
  9810. return prefix + staticHandlers
  9811. }
  9812. }
  9813. function genHandler (handler) {
  9814. if (!handler) {
  9815. return 'function(){}'
  9816. }
  9817. if (Array.isArray(handler)) {
  9818. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  9819. }
  9820. var isMethodPath = simplePathRE.test(handler.value);
  9821. var isFunctionExpression = fnExpRE.test(handler.value);
  9822. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  9823. if (!handler.modifiers) {
  9824. if (isMethodPath || isFunctionExpression) {
  9825. return handler.value
  9826. }
  9827. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  9828. } else {
  9829. var code = '';
  9830. var genModifierCode = '';
  9831. var keys = [];
  9832. for (var key in handler.modifiers) {
  9833. if (modifierCode[key]) {
  9834. genModifierCode += modifierCode[key];
  9835. // left/right
  9836. if (keyCodes[key]) {
  9837. keys.push(key);
  9838. }
  9839. } else if (key === 'exact') {
  9840. var modifiers = (handler.modifiers);
  9841. genModifierCode += genGuard(
  9842. ['ctrl', 'shift', 'alt', 'meta']
  9843. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  9844. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  9845. .join('||')
  9846. );
  9847. } else {
  9848. keys.push(key);
  9849. }
  9850. }
  9851. if (keys.length) {
  9852. code += genKeyFilter(keys);
  9853. }
  9854. // Make sure modifiers like prevent and stop get executed after key filtering
  9855. if (genModifierCode) {
  9856. code += genModifierCode;
  9857. }
  9858. var handlerCode = isMethodPath
  9859. ? ("return " + (handler.value) + ".apply(null, arguments)")
  9860. : isFunctionExpression
  9861. ? ("return (" + (handler.value) + ").apply(null, arguments)")
  9862. : isFunctionInvocation
  9863. ? ("return " + (handler.value))
  9864. : handler.value;
  9865. return ("function($event){" + code + handlerCode + "}")
  9866. }
  9867. }
  9868. function genKeyFilter (keys) {
  9869. return (
  9870. // make sure the key filters only apply to KeyboardEvents
  9871. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  9872. // key events that do not have keyCode property...
  9873. "if(!$event.type.indexOf('key')&&" +
  9874. (keys.map(genFilterCode).join('&&')) + ")return null;"
  9875. )
  9876. }
  9877. function genFilterCode (key) {
  9878. var keyVal = parseInt(key, 10);
  9879. if (keyVal) {
  9880. return ("$event.keyCode!==" + keyVal)
  9881. }
  9882. var keyCode = keyCodes[key];
  9883. var keyName = keyNames[key];
  9884. return (
  9885. "_k($event.keyCode," +
  9886. (JSON.stringify(key)) + "," +
  9887. (JSON.stringify(keyCode)) + "," +
  9888. "$event.key," +
  9889. "" + (JSON.stringify(keyName)) +
  9890. ")"
  9891. )
  9892. }
  9893. /* */
  9894. function on (el, dir) {
  9895. if (dir.modifiers) {
  9896. warn("v-on without argument does not support modifiers.");
  9897. }
  9898. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  9899. }
  9900. /* */
  9901. function bind$1 (el, dir) {
  9902. el.wrapData = function (code) {
  9903. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  9904. };
  9905. }
  9906. /* */
  9907. var baseDirectives = {
  9908. on: on,
  9909. bind: bind$1,
  9910. cloak: noop
  9911. };
  9912. /* */
  9913. var CodegenState = function CodegenState (options) {
  9914. this.options = options;
  9915. this.warn = options.warn || baseWarn;
  9916. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  9917. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  9918. this.directives = extend(extend({}, baseDirectives), options.directives);
  9919. var isReservedTag = options.isReservedTag || no;
  9920. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  9921. this.onceId = 0;
  9922. this.staticRenderFns = [];
  9923. this.pre = false;
  9924. };
  9925. function generate (
  9926. ast,
  9927. options
  9928. ) {
  9929. var state = new CodegenState(options);
  9930. // fix #11483, Root level <script> tags should not be rendered.
  9931. var code = ast ? (ast.tag === 'script' ? 'null' : genElement(ast, state)) : '_c("div")';
  9932. return {
  9933. render: ("with(this){return " + code + "}"),
  9934. staticRenderFns: state.staticRenderFns
  9935. }
  9936. }
  9937. function genElement (el, state) {
  9938. if (el.parent) {
  9939. el.pre = el.pre || el.parent.pre;
  9940. }
  9941. if (el.staticRoot && !el.staticProcessed) {
  9942. return genStatic(el, state)
  9943. } else if (el.once && !el.onceProcessed) {
  9944. return genOnce(el, state)
  9945. } else if (el.for && !el.forProcessed) {
  9946. return genFor(el, state)
  9947. } else if (el.if && !el.ifProcessed) {
  9948. return genIf(el, state)
  9949. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  9950. return genChildren(el, state) || 'void 0'
  9951. } else if (el.tag === 'slot') {
  9952. return genSlot(el, state)
  9953. } else {
  9954. // component or element
  9955. var code;
  9956. if (el.component) {
  9957. code = genComponent(el.component, el, state);
  9958. } else {
  9959. var data;
  9960. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  9961. data = genData$2(el, state);
  9962. }
  9963. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  9964. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  9965. }
  9966. // module transforms
  9967. for (var i = 0; i < state.transforms.length; i++) {
  9968. code = state.transforms[i](el, code);
  9969. }
  9970. return code
  9971. }
  9972. }
  9973. // hoist static sub-trees out
  9974. function genStatic (el, state) {
  9975. el.staticProcessed = true;
  9976. // Some elements (templates) need to behave differently inside of a v-pre
  9977. // node. All pre nodes are static roots, so we can use this as a location to
  9978. // wrap a state change and reset it upon exiting the pre node.
  9979. var originalPreState = state.pre;
  9980. if (el.pre) {
  9981. state.pre = el.pre;
  9982. }
  9983. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  9984. state.pre = originalPreState;
  9985. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  9986. }
  9987. // v-once
  9988. function genOnce (el, state) {
  9989. el.onceProcessed = true;
  9990. if (el.if && !el.ifProcessed) {
  9991. return genIf(el, state)
  9992. } else if (el.staticInFor) {
  9993. var key = '';
  9994. var parent = el.parent;
  9995. while (parent) {
  9996. if (parent.for) {
  9997. key = parent.key;
  9998. break
  9999. }
  10000. parent = parent.parent;
  10001. }
  10002. if (!key) {
  10003. state.warn(
  10004. "v-once can only be used inside v-for that is keyed. ",
  10005. el.rawAttrsMap['v-once']
  10006. );
  10007. return genElement(el, state)
  10008. }
  10009. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  10010. } else {
  10011. return genStatic(el, state)
  10012. }
  10013. }
  10014. function genIf (
  10015. el,
  10016. state,
  10017. altGen,
  10018. altEmpty
  10019. ) {
  10020. el.ifProcessed = true; // avoid recursion
  10021. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  10022. }
  10023. function genIfConditions (
  10024. conditions,
  10025. state,
  10026. altGen,
  10027. altEmpty
  10028. ) {
  10029. if (!conditions.length) {
  10030. return altEmpty || '_e()'
  10031. }
  10032. var condition = conditions.shift();
  10033. if (condition.exp) {
  10034. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  10035. } else {
  10036. return ("" + (genTernaryExp(condition.block)))
  10037. }
  10038. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  10039. function genTernaryExp (el) {
  10040. return altGen
  10041. ? altGen(el, state)
  10042. : el.once
  10043. ? genOnce(el, state)
  10044. : genElement(el, state)
  10045. }
  10046. }
  10047. function genFor (
  10048. el,
  10049. state,
  10050. altGen,
  10051. altHelper
  10052. ) {
  10053. var exp = el.for;
  10054. var alias = el.alias;
  10055. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  10056. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  10057. if (state.maybeComponent(el) &&
  10058. el.tag !== 'slot' &&
  10059. el.tag !== 'template' &&
  10060. !el.key
  10061. ) {
  10062. state.warn(
  10063. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  10064. "v-for should have explicit keys. " +
  10065. "See https://vuejs.org/guide/list.html#key for more info.",
  10066. el.rawAttrsMap['v-for'],
  10067. true /* tip */
  10068. );
  10069. }
  10070. el.forProcessed = true; // avoid recursion
  10071. return (altHelper || '_l') + "((" + exp + ")," +
  10072. "function(" + alias + iterator1 + iterator2 + "){" +
  10073. "return " + ((altGen || genElement)(el, state)) +
  10074. '})'
  10075. }
  10076. function genData$2 (el, state) {
  10077. var data = '{';
  10078. // directives first.
  10079. // directives may mutate the el's other properties before they are generated.
  10080. var dirs = genDirectives(el, state);
  10081. if (dirs) { data += dirs + ','; }
  10082. // key
  10083. if (el.key) {
  10084. data += "key:" + (el.key) + ",";
  10085. }
  10086. // ref
  10087. if (el.ref) {
  10088. data += "ref:" + (el.ref) + ",";
  10089. }
  10090. if (el.refInFor) {
  10091. data += "refInFor:true,";
  10092. }
  10093. // pre
  10094. if (el.pre) {
  10095. data += "pre:true,";
  10096. }
  10097. // record original tag name for components using "is" attribute
  10098. if (el.component) {
  10099. data += "tag:\"" + (el.tag) + "\",";
  10100. }
  10101. // module data generation functions
  10102. for (var i = 0; i < state.dataGenFns.length; i++) {
  10103. data += state.dataGenFns[i](el);
  10104. }
  10105. // attributes
  10106. if (el.attrs) {
  10107. data += "attrs:" + (genProps(el.attrs)) + ",";
  10108. }
  10109. // DOM props
  10110. if (el.props) {
  10111. data += "domProps:" + (genProps(el.props)) + ",";
  10112. }
  10113. // event handlers
  10114. if (el.events) {
  10115. data += (genHandlers(el.events, false)) + ",";
  10116. }
  10117. if (el.nativeEvents) {
  10118. data += (genHandlers(el.nativeEvents, true)) + ",";
  10119. }
  10120. // slot target
  10121. // only for non-scoped slots
  10122. if (el.slotTarget && !el.slotScope) {
  10123. data += "slot:" + (el.slotTarget) + ",";
  10124. }
  10125. // scoped slots
  10126. if (el.scopedSlots) {
  10127. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  10128. }
  10129. // component v-model
  10130. if (el.model) {
  10131. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  10132. }
  10133. // inline-template
  10134. if (el.inlineTemplate) {
  10135. var inlineTemplate = genInlineTemplate(el, state);
  10136. if (inlineTemplate) {
  10137. data += inlineTemplate + ",";
  10138. }
  10139. }
  10140. data = data.replace(/,$/, '') + '}';
  10141. // v-bind dynamic argument wrap
  10142. // v-bind with dynamic arguments must be applied using the same v-bind object
  10143. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  10144. if (el.dynamicAttrs) {
  10145. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  10146. }
  10147. // v-bind data wrap
  10148. if (el.wrapData) {
  10149. data = el.wrapData(data);
  10150. }
  10151. // v-on data wrap
  10152. if (el.wrapListeners) {
  10153. data = el.wrapListeners(data);
  10154. }
  10155. return data
  10156. }
  10157. function genDirectives (el, state) {
  10158. var dirs = el.directives;
  10159. if (!dirs) { return }
  10160. var res = 'directives:[';
  10161. var hasRuntime = false;
  10162. var i, l, dir, needRuntime;
  10163. for (i = 0, l = dirs.length; i < l; i++) {
  10164. dir = dirs[i];
  10165. needRuntime = true;
  10166. var gen = state.directives[dir.name];
  10167. if (gen) {
  10168. // compile-time directive that manipulates AST.
  10169. // returns true if it also needs a runtime counterpart.
  10170. needRuntime = !!gen(el, dir, state.warn);
  10171. }
  10172. if (needRuntime) {
  10173. hasRuntime = true;
  10174. res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
  10175. }
  10176. }
  10177. if (hasRuntime) {
  10178. return res.slice(0, -1) + ']'
  10179. }
  10180. }
  10181. function genInlineTemplate (el, state) {
  10182. var ast = el.children[0];
  10183. if (el.children.length !== 1 || ast.type !== 1) {
  10184. state.warn(
  10185. 'Inline-template components must have exactly one child element.',
  10186. { start: el.start }
  10187. );
  10188. }
  10189. if (ast && ast.type === 1) {
  10190. var inlineRenderFns = generate(ast, state.options);
  10191. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  10192. }
  10193. }
  10194. function genScopedSlots (
  10195. el,
  10196. slots,
  10197. state
  10198. ) {
  10199. // by default scoped slots are considered "stable", this allows child
  10200. // components with only scoped slots to skip forced updates from parent.
  10201. // but in some cases we have to bail-out of this optimization
  10202. // for example if the slot contains dynamic names, has v-if or v-for on them...
  10203. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  10204. var slot = slots[key];
  10205. return (
  10206. slot.slotTargetDynamic ||
  10207. slot.if ||
  10208. slot.for ||
  10209. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  10210. )
  10211. });
  10212. // #9534: if a component with scoped slots is inside a conditional branch,
  10213. // it's possible for the same component to be reused but with different
  10214. // compiled slot content. To avoid that, we generate a unique key based on
  10215. // the generated code of all the slot contents.
  10216. var needsKey = !!el.if;
  10217. // OR when it is inside another scoped slot or v-for (the reactivity may be
  10218. // disconnected due to the intermediate scope variable)
  10219. // #9438, #9506
  10220. // TODO: this can be further optimized by properly analyzing in-scope bindings
  10221. // and skip force updating ones that do not actually use scope variables.
  10222. if (!needsForceUpdate) {
  10223. var parent = el.parent;
  10224. while (parent) {
  10225. if (
  10226. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  10227. parent.for
  10228. ) {
  10229. needsForceUpdate = true;
  10230. break
  10231. }
  10232. if (parent.if) {
  10233. needsKey = true;
  10234. }
  10235. parent = parent.parent;
  10236. }
  10237. }
  10238. var generatedSlots = Object.keys(slots)
  10239. .map(function (key) { return genScopedSlot(slots[key], state); })
  10240. .join(',');
  10241. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  10242. }
  10243. function hash(str) {
  10244. var hash = 5381;
  10245. var i = str.length;
  10246. while(i) {
  10247. hash = (hash * 33) ^ str.charCodeAt(--i);
  10248. }
  10249. return hash >>> 0
  10250. }
  10251. function containsSlotChild (el) {
  10252. if (el.type === 1) {
  10253. if (el.tag === 'slot') {
  10254. return true
  10255. }
  10256. return el.children.some(containsSlotChild)
  10257. }
  10258. return false
  10259. }
  10260. function genScopedSlot (
  10261. el,
  10262. state
  10263. ) {
  10264. var isLegacySyntax = el.attrsMap['slot-scope'];
  10265. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  10266. return genIf(el, state, genScopedSlot, "null")
  10267. }
  10268. if (el.for && !el.forProcessed) {
  10269. return genFor(el, state, genScopedSlot)
  10270. }
  10271. var slotScope = el.slotScope === emptySlotScopeToken
  10272. ? ""
  10273. : String(el.slotScope);
  10274. var fn = "function(" + slotScope + "){" +
  10275. "return " + (el.tag === 'template'
  10276. ? el.if && isLegacySyntax
  10277. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  10278. : genChildren(el, state) || 'undefined'
  10279. : genElement(el, state)) + "}";
  10280. // reverse proxy v-slot without scope on this.$slots
  10281. var reverseProxy = slotScope ? "" : ",proxy:true";
  10282. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  10283. }
  10284. function genChildren (
  10285. el,
  10286. state,
  10287. checkSkip,
  10288. altGenElement,
  10289. altGenNode
  10290. ) {
  10291. var children = el.children;
  10292. if (children.length) {
  10293. var el$1 = children[0];
  10294. // optimize single v-for
  10295. if (children.length === 1 &&
  10296. el$1.for &&
  10297. el$1.tag !== 'template' &&
  10298. el$1.tag !== 'slot'
  10299. ) {
  10300. var normalizationType = checkSkip
  10301. ? state.maybeComponent(el$1) ? ",1" : ",0"
  10302. : "";
  10303. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  10304. }
  10305. var normalizationType$1 = checkSkip
  10306. ? getNormalizationType(children, state.maybeComponent)
  10307. : 0;
  10308. var gen = altGenNode || genNode;
  10309. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  10310. }
  10311. }
  10312. // determine the normalization needed for the children array.
  10313. // 0: no normalization needed
  10314. // 1: simple normalization needed (possible 1-level deep nested array)
  10315. // 2: full normalization needed
  10316. function getNormalizationType (
  10317. children,
  10318. maybeComponent
  10319. ) {
  10320. var res = 0;
  10321. for (var i = 0; i < children.length; i++) {
  10322. var el = children[i];
  10323. if (el.type !== 1) {
  10324. continue
  10325. }
  10326. if (needsNormalization(el) ||
  10327. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  10328. res = 2;
  10329. break
  10330. }
  10331. if (maybeComponent(el) ||
  10332. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  10333. res = 1;
  10334. }
  10335. }
  10336. return res
  10337. }
  10338. function needsNormalization (el) {
  10339. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  10340. }
  10341. function genNode (node, state) {
  10342. if (node.type === 1) {
  10343. return genElement(node, state)
  10344. } else if (node.type === 3 && node.isComment) {
  10345. return genComment(node)
  10346. } else {
  10347. return genText(node)
  10348. }
  10349. }
  10350. function genText (text) {
  10351. return ("_v(" + (text.type === 2
  10352. ? text.expression // no need for () because already wrapped in _s()
  10353. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  10354. }
  10355. function genComment (comment) {
  10356. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  10357. }
  10358. function genSlot (el, state) {
  10359. var slotName = el.slotName || '"default"';
  10360. var children = genChildren(el, state);
  10361. var res = "_t(" + slotName + (children ? (",function(){return " + children + "}") : '');
  10362. var attrs = el.attrs || el.dynamicAttrs
  10363. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  10364. // slot props are camelized
  10365. name: camelize(attr.name),
  10366. value: attr.value,
  10367. dynamic: attr.dynamic
  10368. }); }))
  10369. : null;
  10370. var bind$$1 = el.attrsMap['v-bind'];
  10371. if ((attrs || bind$$1) && !children) {
  10372. res += ",null";
  10373. }
  10374. if (attrs) {
  10375. res += "," + attrs;
  10376. }
  10377. if (bind$$1) {
  10378. res += (attrs ? '' : ',null') + "," + bind$$1;
  10379. }
  10380. return res + ')'
  10381. }
  10382. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  10383. function genComponent (
  10384. componentName,
  10385. el,
  10386. state
  10387. ) {
  10388. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  10389. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  10390. }
  10391. function genProps (props) {
  10392. var staticProps = "";
  10393. var dynamicProps = "";
  10394. for (var i = 0; i < props.length; i++) {
  10395. var prop = props[i];
  10396. var value = transformSpecialNewlines(prop.value);
  10397. if (prop.dynamic) {
  10398. dynamicProps += (prop.name) + "," + value + ",";
  10399. } else {
  10400. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  10401. }
  10402. }
  10403. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  10404. if (dynamicProps) {
  10405. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  10406. } else {
  10407. return staticProps
  10408. }
  10409. }
  10410. // #3895, #4268
  10411. function transformSpecialNewlines (text) {
  10412. return text
  10413. .replace(/\u2028/g, '\\u2028')
  10414. .replace(/\u2029/g, '\\u2029')
  10415. }
  10416. /* */
  10417. // these keywords should not appear inside expressions, but operators like
  10418. // typeof, instanceof and in are allowed
  10419. var prohibitedKeywordRE = new RegExp('\\b' + (
  10420. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  10421. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  10422. 'extends,finally,continue,debugger,function,arguments'
  10423. ).split(',').join('\\b|\\b') + '\\b');
  10424. // these unary operators should not be used as property/method names
  10425. var unaryOperatorsRE = new RegExp('\\b' + (
  10426. 'delete,typeof,void'
  10427. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  10428. // strip strings in expressions
  10429. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  10430. // detect problematic expressions in a template
  10431. function detectErrors (ast, warn) {
  10432. if (ast) {
  10433. checkNode(ast, warn);
  10434. }
  10435. }
  10436. function checkNode (node, warn) {
  10437. if (node.type === 1) {
  10438. for (var name in node.attrsMap) {
  10439. if (dirRE.test(name)) {
  10440. var value = node.attrsMap[name];
  10441. if (value) {
  10442. var range = node.rawAttrsMap[name];
  10443. if (name === 'v-for') {
  10444. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  10445. } else if (name === 'v-slot' || name[0] === '#') {
  10446. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  10447. } else if (onRE.test(name)) {
  10448. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  10449. } else {
  10450. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  10451. }
  10452. }
  10453. }
  10454. }
  10455. if (node.children) {
  10456. for (var i = 0; i < node.children.length; i++) {
  10457. checkNode(node.children[i], warn);
  10458. }
  10459. }
  10460. } else if (node.type === 2) {
  10461. checkExpression(node.expression, node.text, warn, node);
  10462. }
  10463. }
  10464. function checkEvent (exp, text, warn, range) {
  10465. var stripped = exp.replace(stripStringRE, '');
  10466. var keywordMatch = stripped.match(unaryOperatorsRE);
  10467. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  10468. warn(
  10469. "avoid using JavaScript unary operator as property name: " +
  10470. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  10471. range
  10472. );
  10473. }
  10474. checkExpression(exp, text, warn, range);
  10475. }
  10476. function checkFor (node, text, warn, range) {
  10477. checkExpression(node.for || '', text, warn, range);
  10478. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  10479. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  10480. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  10481. }
  10482. function checkIdentifier (
  10483. ident,
  10484. type,
  10485. text,
  10486. warn,
  10487. range
  10488. ) {
  10489. if (typeof ident === 'string') {
  10490. try {
  10491. new Function(("var " + ident + "=_"));
  10492. } catch (e) {
  10493. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  10494. }
  10495. }
  10496. }
  10497. function checkExpression (exp, text, warn, range) {
  10498. try {
  10499. new Function(("return " + exp));
  10500. } catch (e) {
  10501. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  10502. if (keywordMatch) {
  10503. warn(
  10504. "avoid using JavaScript keyword as property name: " +
  10505. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  10506. range
  10507. );
  10508. } else {
  10509. warn(
  10510. "invalid expression: " + (e.message) + " in\n\n" +
  10511. " " + exp + "\n\n" +
  10512. " Raw expression: " + (text.trim()) + "\n",
  10513. range
  10514. );
  10515. }
  10516. }
  10517. }
  10518. function checkFunctionParameterExpression (exp, text, warn, range) {
  10519. try {
  10520. new Function(exp, '');
  10521. } catch (e) {
  10522. warn(
  10523. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  10524. " " + exp + "\n\n" +
  10525. " Raw expression: " + (text.trim()) + "\n",
  10526. range
  10527. );
  10528. }
  10529. }
  10530. /* */
  10531. var range = 2;
  10532. function generateCodeFrame (
  10533. source,
  10534. start,
  10535. end
  10536. ) {
  10537. if ( start === void 0 ) start = 0;
  10538. if ( end === void 0 ) end = source.length;
  10539. var lines = source.split(/\r?\n/);
  10540. var count = 0;
  10541. var res = [];
  10542. for (var i = 0; i < lines.length; i++) {
  10543. count += lines[i].length + 1;
  10544. if (count >= start) {
  10545. for (var j = i - range; j <= i + range || end > count; j++) {
  10546. if (j < 0 || j >= lines.length) { continue }
  10547. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  10548. var lineLength = lines[j].length;
  10549. if (j === i) {
  10550. // push underline
  10551. var pad = start - (count - lineLength) + 1;
  10552. var length = end > count ? lineLength - pad : end - start;
  10553. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  10554. } else if (j > i) {
  10555. if (end > count) {
  10556. var length$1 = Math.min(end - count, lineLength);
  10557. res.push(" | " + repeat$1("^", length$1));
  10558. }
  10559. count += lineLength + 1;
  10560. }
  10561. }
  10562. break
  10563. }
  10564. }
  10565. return res.join('\n')
  10566. }
  10567. function repeat$1 (str, n) {
  10568. var result = '';
  10569. if (n > 0) {
  10570. while (true) { // eslint-disable-line
  10571. if (n & 1) { result += str; }
  10572. n >>>= 1;
  10573. if (n <= 0) { break }
  10574. str += str;
  10575. }
  10576. }
  10577. return result
  10578. }
  10579. /* */
  10580. function createFunction (code, errors) {
  10581. try {
  10582. return new Function(code)
  10583. } catch (err) {
  10584. errors.push({ err: err, code: code });
  10585. return noop
  10586. }
  10587. }
  10588. function createCompileToFunctionFn (compile) {
  10589. var cache = Object.create(null);
  10590. return function compileToFunctions (
  10591. template,
  10592. options,
  10593. vm
  10594. ) {
  10595. options = extend({}, options);
  10596. var warn$$1 = options.warn || warn;
  10597. delete options.warn;
  10598. /* istanbul ignore if */
  10599. {
  10600. // detect possible CSP restriction
  10601. try {
  10602. new Function('return 1');
  10603. } catch (e) {
  10604. if (e.toString().match(/unsafe-eval|CSP/)) {
  10605. warn$$1(
  10606. 'It seems you are using the standalone build of Vue.js in an ' +
  10607. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  10608. 'The template compiler cannot work in this environment. Consider ' +
  10609. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  10610. 'templates into render functions.'
  10611. );
  10612. }
  10613. }
  10614. }
  10615. // check cache
  10616. var key = options.delimiters
  10617. ? String(options.delimiters) + template
  10618. : template;
  10619. if (cache[key]) {
  10620. return cache[key]
  10621. }
  10622. // compile
  10623. var compiled = compile(template, options);
  10624. // check compilation errors/tips
  10625. {
  10626. if (compiled.errors && compiled.errors.length) {
  10627. if (options.outputSourceRange) {
  10628. compiled.errors.forEach(function (e) {
  10629. warn$$1(
  10630. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  10631. generateCodeFrame(template, e.start, e.end),
  10632. vm
  10633. );
  10634. });
  10635. } else {
  10636. warn$$1(
  10637. "Error compiling template:\n\n" + template + "\n\n" +
  10638. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  10639. vm
  10640. );
  10641. }
  10642. }
  10643. if (compiled.tips && compiled.tips.length) {
  10644. if (options.outputSourceRange) {
  10645. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  10646. } else {
  10647. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  10648. }
  10649. }
  10650. }
  10651. // turn code into functions
  10652. var res = {};
  10653. var fnGenErrors = [];
  10654. res.render = createFunction(compiled.render, fnGenErrors);
  10655. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  10656. return createFunction(code, fnGenErrors)
  10657. });
  10658. // check function generation errors.
  10659. // this should only happen if there is a bug in the compiler itself.
  10660. // mostly for codegen development use
  10661. /* istanbul ignore if */
  10662. {
  10663. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  10664. warn$$1(
  10665. "Failed to generate render function:\n\n" +
  10666. fnGenErrors.map(function (ref) {
  10667. var err = ref.err;
  10668. var code = ref.code;
  10669. return ((err.toString()) + " in\n\n" + code + "\n");
  10670. }).join('\n'),
  10671. vm
  10672. );
  10673. }
  10674. }
  10675. return (cache[key] = res)
  10676. }
  10677. }
  10678. /* */
  10679. function createCompilerCreator (baseCompile) {
  10680. return function createCompiler (baseOptions) {
  10681. function compile (
  10682. template,
  10683. options
  10684. ) {
  10685. var finalOptions = Object.create(baseOptions);
  10686. var errors = [];
  10687. var tips = [];
  10688. var warn = function (msg, range, tip) {
  10689. (tip ? tips : errors).push(msg);
  10690. };
  10691. if (options) {
  10692. if (options.outputSourceRange) {
  10693. // $flow-disable-line
  10694. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  10695. warn = function (msg, range, tip) {
  10696. var data = { msg: msg };
  10697. if (range) {
  10698. if (range.start != null) {
  10699. data.start = range.start + leadingSpaceLength;
  10700. }
  10701. if (range.end != null) {
  10702. data.end = range.end + leadingSpaceLength;
  10703. }
  10704. }
  10705. (tip ? tips : errors).push(data);
  10706. };
  10707. }
  10708. // merge custom modules
  10709. if (options.modules) {
  10710. finalOptions.modules =
  10711. (baseOptions.modules || []).concat(options.modules);
  10712. }
  10713. // merge custom directives
  10714. if (options.directives) {
  10715. finalOptions.directives = extend(
  10716. Object.create(baseOptions.directives || null),
  10717. options.directives
  10718. );
  10719. }
  10720. // copy other options
  10721. for (var key in options) {
  10722. if (key !== 'modules' && key !== 'directives') {
  10723. finalOptions[key] = options[key];
  10724. }
  10725. }
  10726. }
  10727. finalOptions.warn = warn;
  10728. var compiled = baseCompile(template.trim(), finalOptions);
  10729. {
  10730. detectErrors(compiled.ast, warn);
  10731. }
  10732. compiled.errors = errors;
  10733. compiled.tips = tips;
  10734. return compiled
  10735. }
  10736. return {
  10737. compile: compile,
  10738. compileToFunctions: createCompileToFunctionFn(compile)
  10739. }
  10740. }
  10741. }
  10742. /* */
  10743. // `createCompilerCreator` allows creating compilers that use alternative
  10744. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  10745. // Here we just export a default compiler using the default parts.
  10746. var createCompiler = createCompilerCreator(function baseCompile (
  10747. template,
  10748. options
  10749. ) {
  10750. var ast = parse(template.trim(), options);
  10751. if (options.optimize !== false) {
  10752. optimize(ast, options);
  10753. }
  10754. var code = generate(ast, options);
  10755. return {
  10756. ast: ast,
  10757. render: code.render,
  10758. staticRenderFns: code.staticRenderFns
  10759. }
  10760. });
  10761. /* */
  10762. var ref$1 = createCompiler(baseOptions);
  10763. var compile = ref$1.compile;
  10764. var compileToFunctions = ref$1.compileToFunctions;
  10765. /* */
  10766. // check whether current browser encodes a char inside attribute values
  10767. var div;
  10768. function getShouldDecode (href) {
  10769. div = div || document.createElement('div');
  10770. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  10771. return div.innerHTML.indexOf('&#10;') > 0
  10772. }
  10773. // #3663: IE encodes newlines inside attribute values while other browsers don't
  10774. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  10775. // #6828: chrome encodes content in a[href]
  10776. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  10777. /* */
  10778. var idToTemplate = cached(function (id) {
  10779. var el = query(id);
  10780. return el && el.innerHTML
  10781. });
  10782. var mount = Vue.prototype.$mount;
  10783. Vue.prototype.$mount = function (
  10784. el,
  10785. hydrating
  10786. ) {
  10787. el = el && query(el);
  10788. /* istanbul ignore if */
  10789. if (el === document.body || el === document.documentElement) {
  10790. warn(
  10791. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  10792. );
  10793. return this
  10794. }
  10795. var options = this.$options;
  10796. // resolve template/el and convert to render function
  10797. if (!options.render) {
  10798. var template = options.template;
  10799. if (template) {
  10800. if (typeof template === 'string') {
  10801. if (template.charAt(0) === '#') {
  10802. template = idToTemplate(template);
  10803. /* istanbul ignore if */
  10804. if (!template) {
  10805. warn(
  10806. ("Template element not found or is empty: " + (options.template)),
  10807. this
  10808. );
  10809. }
  10810. }
  10811. } else if (template.nodeType) {
  10812. template = template.innerHTML;
  10813. } else {
  10814. {
  10815. warn('invalid template option:' + template, this);
  10816. }
  10817. return this
  10818. }
  10819. } else if (el) {
  10820. template = getOuterHTML(el);
  10821. }
  10822. if (template) {
  10823. /* istanbul ignore if */
  10824. if (config.performance && mark) {
  10825. mark('compile');
  10826. }
  10827. var ref = compileToFunctions(template, {
  10828. outputSourceRange: "development" !== 'production',
  10829. shouldDecodeNewlines: shouldDecodeNewlines,
  10830. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  10831. delimiters: options.delimiters,
  10832. comments: options.comments
  10833. }, this);
  10834. var render = ref.render;
  10835. var staticRenderFns = ref.staticRenderFns;
  10836. options.render = render;
  10837. options.staticRenderFns = staticRenderFns;
  10838. /* istanbul ignore if */
  10839. if (config.performance && mark) {
  10840. mark('compile end');
  10841. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  10842. }
  10843. }
  10844. }
  10845. return mount.call(this, el, hydrating)
  10846. };
  10847. /**
  10848. * Get outerHTML of elements, taking care
  10849. * of SVG elements in IE as well.
  10850. */
  10851. function getOuterHTML (el) {
  10852. if (el.outerHTML) {
  10853. return el.outerHTML
  10854. } else {
  10855. var container = document.createElement('div');
  10856. container.appendChild(el.cloneNode(true));
  10857. return container.innerHTML
  10858. }
  10859. }
  10860. Vue.compile = compileToFunctions;
  10861. return Vue;
  10862. }));