vue.js 234 KB

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