city_vue.js 356 KB

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