vue.esm.js 320 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042
  1. /*!
  2. * Vue.js v2.6.14
  3. * (c) 2014-2021 Evan You
  4. * Released under the MIT License.
  5. */
  6. /* */
  7. var emptyObject = Object.freeze({});
  8. // These helpers produce better VM code in JS engines due to their
  9. // explicitness and function inlining.
  10. function isUndef (v) {
  11. return v === undefined || v === null
  12. }
  13. function isDef (v) {
  14. return v !== undefined && v !== null
  15. }
  16. function isTrue (v) {
  17. return v === true
  18. }
  19. function isFalse (v) {
  20. return v === false
  21. }
  22. /**
  23. * Check if value is primitive.
  24. */
  25. function isPrimitive (value) {
  26. return (
  27. typeof value === 'string' ||
  28. typeof value === 'number' ||
  29. // $flow-disable-line
  30. typeof value === 'symbol' ||
  31. typeof value === 'boolean'
  32. )
  33. }
  34. /**
  35. * Quick object check - this is primarily used to tell
  36. * Objects from primitive values when we know the value
  37. * is a JSON-compliant type.
  38. */
  39. function isObject (obj) {
  40. return obj !== null && typeof obj === 'object'
  41. }
  42. /**
  43. * Get the raw type string of a value, e.g., [object Object].
  44. */
  45. var _toString = Object.prototype.toString;
  46. function toRawType (value) {
  47. return _toString.call(value).slice(8, -1)
  48. }
  49. /**
  50. * Strict object type check. Only returns true
  51. * for plain JavaScript objects.
  52. */
  53. function isPlainObject (obj) {
  54. return _toString.call(obj) === '[object Object]'
  55. }
  56. function isRegExp (v) {
  57. return _toString.call(v) === '[object RegExp]'
  58. }
  59. /**
  60. * Check if val is a valid array index.
  61. */
  62. function isValidArrayIndex (val) {
  63. var n = parseFloat(String(val));
  64. return n >= 0 && Math.floor(n) === n && isFinite(val)
  65. }
  66. function isPromise (val) {
  67. return (
  68. isDef(val) &&
  69. typeof val.then === 'function' &&
  70. typeof val.catch === 'function'
  71. )
  72. }
  73. /**
  74. * Convert a value to a string that is actually rendered.
  75. */
  76. function toString (val) {
  77. return val == null
  78. ? ''
  79. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  80. ? JSON.stringify(val, null, 2)
  81. : String(val)
  82. }
  83. /**
  84. * Convert an input value to a number for persistence.
  85. * If the conversion fails, return original string.
  86. */
  87. function toNumber (val) {
  88. var n = parseFloat(val);
  89. return isNaN(n) ? val : n
  90. }
  91. /**
  92. * Make a map and return a function for checking if a key
  93. * is in that map.
  94. */
  95. function makeMap (
  96. str,
  97. expectsLowerCase
  98. ) {
  99. var map = Object.create(null);
  100. var list = str.split(',');
  101. for (var i = 0; i < list.length; i++) {
  102. map[list[i]] = true;
  103. }
  104. return expectsLowerCase
  105. ? function (val) { return map[val.toLowerCase()]; }
  106. : function (val) { return map[val]; }
  107. }
  108. /**
  109. * Check if a tag is a built-in tag.
  110. */
  111. var isBuiltInTag = makeMap('slot,component', true);
  112. /**
  113. * Check if an attribute is a reserved attribute.
  114. */
  115. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  116. /**
  117. * Remove an item from an array.
  118. */
  119. function remove (arr, item) {
  120. if (arr.length) {
  121. var index = arr.indexOf(item);
  122. if (index > -1) {
  123. return arr.splice(index, 1)
  124. }
  125. }
  126. }
  127. /**
  128. * Check whether an object has the property.
  129. */
  130. var hasOwnProperty = Object.prototype.hasOwnProperty;
  131. function hasOwn (obj, key) {
  132. return hasOwnProperty.call(obj, key)
  133. }
  134. /**
  135. * Create a cached version of a pure function.
  136. */
  137. function cached (fn) {
  138. var cache = Object.create(null);
  139. return (function cachedFn (str) {
  140. var hit = cache[str];
  141. return hit || (cache[str] = fn(str))
  142. })
  143. }
  144. /**
  145. * Camelize a hyphen-delimited string.
  146. */
  147. var camelizeRE = /-(\w)/g;
  148. var camelize = cached(function (str) {
  149. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  150. });
  151. /**
  152. * Capitalize a string.
  153. */
  154. var capitalize = cached(function (str) {
  155. return str.charAt(0).toUpperCase() + str.slice(1)
  156. });
  157. /**
  158. * Hyphenate a camelCase string.
  159. */
  160. var hyphenateRE = /\B([A-Z])/g;
  161. var hyphenate = cached(function (str) {
  162. return str.replace(hyphenateRE, '-$1').toLowerCase()
  163. });
  164. /**
  165. * Simple bind polyfill for environments that do not support it,
  166. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  167. * since native bind is now performant enough in most browsers.
  168. * But removing it would mean breaking code that was able to run in
  169. * PhantomJS 1.x, so this must be kept for backward compatibility.
  170. */
  171. /* istanbul ignore next */
  172. function polyfillBind (fn, ctx) {
  173. function boundFn (a) {
  174. var l = arguments.length;
  175. return l
  176. ? l > 1
  177. ? fn.apply(ctx, arguments)
  178. : fn.call(ctx, a)
  179. : fn.call(ctx)
  180. }
  181. boundFn._length = fn.length;
  182. return boundFn
  183. }
  184. function nativeBind (fn, ctx) {
  185. return fn.bind(ctx)
  186. }
  187. var bind = Function.prototype.bind
  188. ? nativeBind
  189. : polyfillBind;
  190. /**
  191. * Convert an Array-like object to a real Array.
  192. */
  193. function toArray (list, start) {
  194. start = start || 0;
  195. var i = list.length - start;
  196. var ret = new Array(i);
  197. while (i--) {
  198. ret[i] = list[i + start];
  199. }
  200. return ret
  201. }
  202. /**
  203. * Mix properties into target object.
  204. */
  205. function extend (to, _from) {
  206. for (var key in _from) {
  207. to[key] = _from[key];
  208. }
  209. return to
  210. }
  211. /**
  212. * Merge an Array of Objects into a single Object.
  213. */
  214. function toObject (arr) {
  215. var res = {};
  216. for (var i = 0; i < arr.length; i++) {
  217. if (arr[i]) {
  218. extend(res, arr[i]);
  219. }
  220. }
  221. return res
  222. }
  223. /* eslint-disable no-unused-vars */
  224. /**
  225. * Perform no operation.
  226. * Stubbing args to make Flow happy without leaving useless transpiled code
  227. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  228. */
  229. function noop (a, b, c) {}
  230. /**
  231. * Always return false.
  232. */
  233. var no = function (a, b, c) { return false; };
  234. /* eslint-enable no-unused-vars */
  235. /**
  236. * Return the same value.
  237. */
  238. var identity = function (_) { return _; };
  239. /**
  240. * Generate a string containing static keys from compiler modules.
  241. */
  242. function genStaticKeys (modules) {
  243. return modules.reduce(function (keys, m) {
  244. return keys.concat(m.staticKeys || [])
  245. }, []).join(',')
  246. }
  247. /**
  248. * Check if two values are loosely equal - that is,
  249. * if they are plain objects, do they have the same shape?
  250. */
  251. function looseEqual (a, b) {
  252. if (a === b) { return true }
  253. var isObjectA = isObject(a);
  254. var isObjectB = isObject(b);
  255. if (isObjectA && isObjectB) {
  256. try {
  257. var isArrayA = Array.isArray(a);
  258. var isArrayB = Array.isArray(b);
  259. if (isArrayA && isArrayB) {
  260. return a.length === b.length && a.every(function (e, i) {
  261. return looseEqual(e, b[i])
  262. })
  263. } else if (a instanceof Date && b instanceof Date) {
  264. return a.getTime() === b.getTime()
  265. } else if (!isArrayA && !isArrayB) {
  266. var keysA = Object.keys(a);
  267. var keysB = Object.keys(b);
  268. return keysA.length === keysB.length && keysA.every(function (key) {
  269. return looseEqual(a[key], b[key])
  270. })
  271. } else {
  272. /* istanbul ignore next */
  273. return false
  274. }
  275. } catch (e) {
  276. /* istanbul ignore next */
  277. return false
  278. }
  279. } else if (!isObjectA && !isObjectB) {
  280. return String(a) === String(b)
  281. } else {
  282. return false
  283. }
  284. }
  285. /**
  286. * Return the first index at which a loosely equal value can be
  287. * found in the array (if value is a plain object, the array must
  288. * contain an object of the same shape), or -1 if it is not present.
  289. */
  290. function looseIndexOf (arr, val) {
  291. for (var i = 0; i < arr.length; i++) {
  292. if (looseEqual(arr[i], val)) { return i }
  293. }
  294. return -1
  295. }
  296. /**
  297. * Ensure a function is called only once.
  298. */
  299. function once (fn) {
  300. var called = false;
  301. return function () {
  302. if (!called) {
  303. called = true;
  304. fn.apply(this, arguments);
  305. }
  306. }
  307. }
  308. var SSR_ATTR = 'data-server-rendered';
  309. var ASSET_TYPES = [
  310. 'component',
  311. 'directive',
  312. 'filter'
  313. ];
  314. var LIFECYCLE_HOOKS = [
  315. 'beforeCreate',
  316. 'created',
  317. 'beforeMount',
  318. 'mounted',
  319. 'beforeUpdate',
  320. 'updated',
  321. 'beforeDestroy',
  322. 'destroyed',
  323. 'activated',
  324. 'deactivated',
  325. 'errorCaptured',
  326. 'serverPrefetch'
  327. ];
  328. /* */
  329. var config = ({
  330. /**
  331. * Option merge strategies (used in core/util/options)
  332. */
  333. // $flow-disable-line
  334. optionMergeStrategies: Object.create(null),
  335. /**
  336. * Whether to suppress warnings.
  337. */
  338. silent: false,
  339. /**
  340. * Show production mode tip message on boot?
  341. */
  342. productionTip: process.env.NODE_ENV !== 'production',
  343. /**
  344. * Whether to enable devtools
  345. */
  346. devtools: process.env.NODE_ENV !== 'production',
  347. /**
  348. * Whether to record perf
  349. */
  350. performance: false,
  351. /**
  352. * Error handler for watcher errors
  353. */
  354. errorHandler: null,
  355. /**
  356. * Warn handler for watcher warns
  357. */
  358. warnHandler: null,
  359. /**
  360. * Ignore certain custom elements
  361. */
  362. ignoredElements: [],
  363. /**
  364. * Custom user key aliases for v-on
  365. */
  366. // $flow-disable-line
  367. keyCodes: Object.create(null),
  368. /**
  369. * Check if a tag is reserved so that it cannot be registered as a
  370. * component. This is platform-dependent and may be overwritten.
  371. */
  372. isReservedTag: no,
  373. /**
  374. * Check if an attribute is reserved so that it cannot be used as a component
  375. * prop. This is platform-dependent and may be overwritten.
  376. */
  377. isReservedAttr: no,
  378. /**
  379. * Check if a tag is an unknown element.
  380. * Platform-dependent.
  381. */
  382. isUnknownElement: no,
  383. /**
  384. * Get the namespace of an element
  385. */
  386. getTagNamespace: noop,
  387. /**
  388. * Parse the real tag name for the specific platform.
  389. */
  390. parsePlatformTagName: identity,
  391. /**
  392. * Check if an attribute must be bound using property, e.g. value
  393. * Platform-dependent.
  394. */
  395. mustUseProp: no,
  396. /**
  397. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  398. * This will significantly reduce performance if set to false.
  399. */
  400. async: true,
  401. /**
  402. * Exposed for legacy reasons
  403. */
  404. _lifecycleHooks: LIFECYCLE_HOOKS
  405. });
  406. /* */
  407. /**
  408. * unicode letters used for parsing html tags, component names and property paths.
  409. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  410. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  411. */
  412. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  413. /**
  414. * Check if a string starts with $ or _
  415. */
  416. function isReserved (str) {
  417. var c = (str + '').charCodeAt(0);
  418. return c === 0x24 || c === 0x5F
  419. }
  420. /**
  421. * Define a property.
  422. */
  423. function def (obj, key, val, enumerable) {
  424. Object.defineProperty(obj, key, {
  425. value: val,
  426. enumerable: !!enumerable,
  427. writable: true,
  428. configurable: true
  429. });
  430. }
  431. /**
  432. * Parse simple path.
  433. */
  434. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  435. function parsePath (path) {
  436. if (bailRE.test(path)) {
  437. return
  438. }
  439. var segments = path.split('.');
  440. return function (obj) {
  441. for (var i = 0; i < segments.length; i++) {
  442. if (!obj) { return }
  443. obj = obj[segments[i]];
  444. }
  445. return obj
  446. }
  447. }
  448. /* */
  449. // can we use __proto__?
  450. var hasProto = '__proto__' in {};
  451. // Browser environment sniffing
  452. var inBrowser = typeof window !== 'undefined';
  453. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  454. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  455. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  456. var isIE = UA && /msie|trident/.test(UA);
  457. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  458. var isEdge = UA && UA.indexOf('edge/') > 0;
  459. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  460. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  461. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  462. var isPhantomJS = UA && /phantomjs/.test(UA);
  463. var isFF = UA && UA.match(/firefox\/(\d+)/);
  464. // Firefox has a "watch" function on Object.prototype...
  465. var nativeWatch = ({}).watch;
  466. var supportsPassive = false;
  467. if (inBrowser) {
  468. try {
  469. var opts = {};
  470. Object.defineProperty(opts, 'passive', ({
  471. get: function get () {
  472. /* istanbul ignore next */
  473. supportsPassive = true;
  474. }
  475. })); // https://github.com/facebook/flow/issues/285
  476. window.addEventListener('test-passive', null, opts);
  477. } catch (e) {}
  478. }
  479. // this needs to be lazy-evaled because vue may be required before
  480. // vue-server-renderer can set VUE_ENV
  481. var _isServer;
  482. var isServerRendering = function () {
  483. if (_isServer === undefined) {
  484. /* istanbul ignore if */
  485. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  486. // detect presence of vue-server-renderer and avoid
  487. // Webpack shimming the process
  488. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  489. } else {
  490. _isServer = false;
  491. }
  492. }
  493. return _isServer
  494. };
  495. // detect devtools
  496. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  497. /* istanbul ignore next */
  498. function isNative (Ctor) {
  499. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  500. }
  501. var hasSymbol =
  502. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  503. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  504. var _Set;
  505. /* istanbul ignore if */ // $flow-disable-line
  506. if (typeof Set !== 'undefined' && isNative(Set)) {
  507. // use native Set when available.
  508. _Set = Set;
  509. } else {
  510. // a non-standard Set polyfill that only works with primitive keys.
  511. _Set = /*@__PURE__*/(function () {
  512. function Set () {
  513. this.set = Object.create(null);
  514. }
  515. Set.prototype.has = function has (key) {
  516. return this.set[key] === true
  517. };
  518. Set.prototype.add = function add (key) {
  519. this.set[key] = true;
  520. };
  521. Set.prototype.clear = function clear () {
  522. this.set = Object.create(null);
  523. };
  524. return Set;
  525. }());
  526. }
  527. /* */
  528. var warn = noop;
  529. var tip = noop;
  530. var generateComponentTrace = (noop); // work around flow check
  531. var formatComponentName = (noop);
  532. if (process.env.NODE_ENV !== 'production') {
  533. var hasConsole = typeof console !== 'undefined';
  534. var classifyRE = /(?:^|[-_])(\w)/g;
  535. var classify = function (str) { return str
  536. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  537. .replace(/[-_]/g, ''); };
  538. warn = function (msg, vm) {
  539. var trace = vm ? generateComponentTrace(vm) : '';
  540. if (config.warnHandler) {
  541. config.warnHandler.call(null, msg, vm, trace);
  542. } else if (hasConsole && (!config.silent)) {
  543. console.error(("[Vue warn]: " + msg + trace));
  544. }
  545. };
  546. tip = function (msg, vm) {
  547. if (hasConsole && (!config.silent)) {
  548. console.warn("[Vue tip]: " + msg + (
  549. vm ? generateComponentTrace(vm) : ''
  550. ));
  551. }
  552. };
  553. formatComponentName = function (vm, includeFile) {
  554. if (vm.$root === vm) {
  555. return '<Root>'
  556. }
  557. var options = typeof vm === 'function' && vm.cid != null
  558. ? vm.options
  559. : vm._isVue
  560. ? vm.$options || vm.constructor.options
  561. : vm;
  562. var name = options.name || options._componentTag;
  563. var file = options.__file;
  564. if (!name && file) {
  565. var match = file.match(/([^/\\]+)\.vue$/);
  566. name = match && match[1];
  567. }
  568. return (
  569. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  570. (file && includeFile !== false ? (" at " + file) : '')
  571. )
  572. };
  573. var repeat = function (str, n) {
  574. var res = '';
  575. while (n) {
  576. if (n % 2 === 1) { res += str; }
  577. if (n > 1) { str += str; }
  578. n >>= 1;
  579. }
  580. return res
  581. };
  582. generateComponentTrace = function (vm) {
  583. if (vm._isVue && vm.$parent) {
  584. var tree = [];
  585. var currentRecursiveSequence = 0;
  586. while (vm) {
  587. if (tree.length > 0) {
  588. var last = tree[tree.length - 1];
  589. if (last.constructor === vm.constructor) {
  590. currentRecursiveSequence++;
  591. vm = vm.$parent;
  592. continue
  593. } else if (currentRecursiveSequence > 0) {
  594. tree[tree.length - 1] = [last, currentRecursiveSequence];
  595. currentRecursiveSequence = 0;
  596. }
  597. }
  598. tree.push(vm);
  599. vm = vm.$parent;
  600. }
  601. return '\n\nfound in\n\n' + tree
  602. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  603. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  604. : formatComponentName(vm))); })
  605. .join('\n')
  606. } else {
  607. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  608. }
  609. };
  610. }
  611. /* */
  612. var uid = 0;
  613. /**
  614. * A dep is an observable that can have multiple
  615. * directives subscribing to it.
  616. */
  617. var Dep = function Dep () {
  618. this.id = uid++;
  619. this.subs = [];
  620. };
  621. Dep.prototype.addSub = function addSub (sub) {
  622. this.subs.push(sub);
  623. };
  624. Dep.prototype.removeSub = function removeSub (sub) {
  625. remove(this.subs, sub);
  626. };
  627. Dep.prototype.depend = function depend () {
  628. if (Dep.target) {
  629. Dep.target.addDep(this);
  630. }
  631. };
  632. Dep.prototype.notify = function notify () {
  633. // stabilize the subscriber list first
  634. var subs = this.subs.slice();
  635. if (process.env.NODE_ENV !== 'production' && !config.async) {
  636. // subs aren't sorted in scheduler if not running async
  637. // we need to sort them now to make sure they fire in correct
  638. // order
  639. subs.sort(function (a, b) { return a.id - b.id; });
  640. }
  641. for (var i = 0, l = subs.length; i < l; i++) {
  642. subs[i].update();
  643. }
  644. };
  645. // The current target watcher being evaluated.
  646. // This is globally unique because only one watcher
  647. // can be evaluated at a time.
  648. Dep.target = null;
  649. var targetStack = [];
  650. function pushTarget (target) {
  651. targetStack.push(target);
  652. Dep.target = target;
  653. }
  654. function popTarget () {
  655. targetStack.pop();
  656. Dep.target = targetStack[targetStack.length - 1];
  657. }
  658. /* */
  659. var VNode = function VNode (
  660. tag,
  661. data,
  662. children,
  663. text,
  664. elm,
  665. context,
  666. componentOptions,
  667. asyncFactory
  668. ) {
  669. this.tag = tag;
  670. this.data = data;
  671. this.children = children;
  672. this.text = text;
  673. this.elm = elm;
  674. this.ns = undefined;
  675. this.context = context;
  676. this.fnContext = undefined;
  677. this.fnOptions = undefined;
  678. this.fnScopeId = undefined;
  679. this.key = data && data.key;
  680. this.componentOptions = componentOptions;
  681. this.componentInstance = undefined;
  682. this.parent = undefined;
  683. this.raw = false;
  684. this.isStatic = false;
  685. this.isRootInsert = true;
  686. this.isComment = false;
  687. this.isCloned = false;
  688. this.isOnce = false;
  689. this.asyncFactory = asyncFactory;
  690. this.asyncMeta = undefined;
  691. this.isAsyncPlaceholder = false;
  692. };
  693. var prototypeAccessors = { child: { configurable: true } };
  694. // DEPRECATED: alias for componentInstance for backwards compat.
  695. /* istanbul ignore next */
  696. prototypeAccessors.child.get = function () {
  697. return this.componentInstance
  698. };
  699. Object.defineProperties( VNode.prototype, prototypeAccessors );
  700. var createEmptyVNode = function (text) {
  701. if ( text === void 0 ) text = '';
  702. var node = new VNode();
  703. node.text = text;
  704. node.isComment = true;
  705. return node
  706. };
  707. function createTextVNode (val) {
  708. return new VNode(undefined, undefined, undefined, String(val))
  709. }
  710. // optimized shallow clone
  711. // used for static nodes and slot nodes because they may be reused across
  712. // multiple renders, cloning them avoids errors when DOM manipulations rely
  713. // on their elm reference.
  714. function cloneVNode (vnode) {
  715. var cloned = new VNode(
  716. vnode.tag,
  717. vnode.data,
  718. // #7975
  719. // clone children array to avoid mutating original in case of cloning
  720. // a child.
  721. vnode.children && vnode.children.slice(),
  722. vnode.text,
  723. vnode.elm,
  724. vnode.context,
  725. vnode.componentOptions,
  726. vnode.asyncFactory
  727. );
  728. cloned.ns = vnode.ns;
  729. cloned.isStatic = vnode.isStatic;
  730. cloned.key = vnode.key;
  731. cloned.isComment = vnode.isComment;
  732. cloned.fnContext = vnode.fnContext;
  733. cloned.fnOptions = vnode.fnOptions;
  734. cloned.fnScopeId = vnode.fnScopeId;
  735. cloned.asyncMeta = vnode.asyncMeta;
  736. cloned.isCloned = true;
  737. return cloned
  738. }
  739. /*
  740. * not type checking this file because flow doesn't play well with
  741. * dynamically accessing methods on Array prototype
  742. */
  743. var arrayProto = Array.prototype;
  744. var arrayMethods = Object.create(arrayProto);
  745. var methodsToPatch = [
  746. 'push',
  747. 'pop',
  748. 'shift',
  749. 'unshift',
  750. 'splice',
  751. 'sort',
  752. 'reverse'
  753. ];
  754. /**
  755. * Intercept mutating methods and emit events
  756. */
  757. methodsToPatch.forEach(function (method) {
  758. // cache original method
  759. var original = arrayProto[method];
  760. def(arrayMethods, method, function mutator () {
  761. var args = [], len = arguments.length;
  762. while ( len-- ) args[ len ] = arguments[ len ];
  763. var result = original.apply(this, args);
  764. var ob = this.__ob__;
  765. var inserted;
  766. switch (method) {
  767. case 'push':
  768. case 'unshift':
  769. inserted = args;
  770. break
  771. case 'splice':
  772. inserted = args.slice(2);
  773. break
  774. }
  775. if (inserted) { ob.observeArray(inserted); }
  776. // notify change
  777. ob.dep.notify();
  778. return result
  779. });
  780. });
  781. /* */
  782. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  783. /**
  784. * In some cases we may want to disable observation inside a component's
  785. * update computation.
  786. */
  787. var shouldObserve = true;
  788. function toggleObserving (value) {
  789. shouldObserve = value;
  790. }
  791. /**
  792. * Observer class that is attached to each observed
  793. * object. Once attached, the observer converts the target
  794. * object's property keys into getter/setters that
  795. * collect dependencies and dispatch updates.
  796. */
  797. var Observer = function Observer (value) {
  798. this.value = value;
  799. this.dep = new Dep();
  800. this.vmCount = 0;
  801. def(value, '__ob__', this);
  802. if (Array.isArray(value)) {
  803. if (hasProto) {
  804. protoAugment(value, arrayMethods);
  805. } else {
  806. copyAugment(value, arrayMethods, arrayKeys);
  807. }
  808. this.observeArray(value);
  809. } else {
  810. this.walk(value);
  811. }
  812. };
  813. /**
  814. * Walk through all properties and convert them into
  815. * getter/setters. This method should only be called when
  816. * value type is Object.
  817. */
  818. Observer.prototype.walk = function walk (obj) {
  819. var keys = Object.keys(obj);
  820. for (var i = 0; i < keys.length; i++) {
  821. defineReactive$$1(obj, keys[i]);
  822. }
  823. };
  824. /**
  825. * Observe a list of Array items.
  826. */
  827. Observer.prototype.observeArray = function observeArray (items) {
  828. for (var i = 0, l = items.length; i < l; i++) {
  829. observe(items[i]);
  830. }
  831. };
  832. // helpers
  833. /**
  834. * Augment a target Object or Array by intercepting
  835. * the prototype chain using __proto__
  836. */
  837. function protoAugment (target, src) {
  838. /* eslint-disable no-proto */
  839. target.__proto__ = src;
  840. /* eslint-enable no-proto */
  841. }
  842. /**
  843. * Augment a target Object or Array by defining
  844. * hidden properties.
  845. */
  846. /* istanbul ignore next */
  847. function copyAugment (target, src, keys) {
  848. for (var i = 0, l = keys.length; i < l; i++) {
  849. var key = keys[i];
  850. def(target, key, src[key]);
  851. }
  852. }
  853. /**
  854. * Attempt to create an observer instance for a value,
  855. * returns the new observer if successfully observed,
  856. * or the existing observer if the value already has one.
  857. */
  858. function observe (value, asRootData) {
  859. if (!isObject(value) || value instanceof VNode) {
  860. return
  861. }
  862. var ob;
  863. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  864. ob = value.__ob__;
  865. } else if (
  866. shouldObserve &&
  867. !isServerRendering() &&
  868. (Array.isArray(value) || isPlainObject(value)) &&
  869. Object.isExtensible(value) &&
  870. !value._isVue
  871. ) {
  872. ob = new Observer(value);
  873. }
  874. if (asRootData && ob) {
  875. ob.vmCount++;
  876. }
  877. return ob
  878. }
  879. /**
  880. * Define a reactive property on an Object.
  881. */
  882. function defineReactive$$1 (
  883. obj,
  884. key,
  885. val,
  886. customSetter,
  887. shallow
  888. ) {
  889. var dep = new Dep();
  890. var property = Object.getOwnPropertyDescriptor(obj, key);
  891. if (property && property.configurable === false) {
  892. return
  893. }
  894. // cater for pre-defined getter/setters
  895. var getter = property && property.get;
  896. var setter = property && property.set;
  897. if ((!getter || setter) && arguments.length === 2) {
  898. val = obj[key];
  899. }
  900. var childOb = !shallow && observe(val);
  901. Object.defineProperty(obj, key, {
  902. enumerable: true,
  903. configurable: true,
  904. get: function reactiveGetter () {
  905. var value = getter ? getter.call(obj) : val;
  906. if (Dep.target) {
  907. dep.depend();
  908. if (childOb) {
  909. childOb.dep.depend();
  910. if (Array.isArray(value)) {
  911. dependArray(value);
  912. }
  913. }
  914. }
  915. return value
  916. },
  917. set: function reactiveSetter (newVal) {
  918. var value = getter ? getter.call(obj) : val;
  919. /* eslint-disable no-self-compare */
  920. if (newVal === value || (newVal !== newVal && value !== value)) {
  921. return
  922. }
  923. /* eslint-enable no-self-compare */
  924. if (process.env.NODE_ENV !== 'production' && customSetter) {
  925. customSetter();
  926. }
  927. // #7981: for accessor properties without setter
  928. if (getter && !setter) { return }
  929. if (setter) {
  930. setter.call(obj, newVal);
  931. } else {
  932. val = newVal;
  933. }
  934. childOb = !shallow && observe(newVal);
  935. dep.notify();
  936. }
  937. });
  938. }
  939. /**
  940. * Set a property on an object. Adds the new property and
  941. * triggers change notification if the property doesn't
  942. * already exist.
  943. */
  944. function set (target, key, val) {
  945. if (process.env.NODE_ENV !== 'production' &&
  946. (isUndef(target) || isPrimitive(target))
  947. ) {
  948. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  949. }
  950. if (Array.isArray(target) && isValidArrayIndex(key)) {
  951. target.length = Math.max(target.length, key);
  952. target.splice(key, 1, val);
  953. return val
  954. }
  955. if (key in target && !(key in Object.prototype)) {
  956. target[key] = val;
  957. return val
  958. }
  959. var ob = (target).__ob__;
  960. if (target._isVue || (ob && ob.vmCount)) {
  961. process.env.NODE_ENV !== 'production' && warn(
  962. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  963. 'at runtime - declare it upfront in the data option.'
  964. );
  965. return val
  966. }
  967. if (!ob) {
  968. target[key] = val;
  969. return val
  970. }
  971. defineReactive$$1(ob.value, key, val);
  972. ob.dep.notify();
  973. return val
  974. }
  975. /**
  976. * Delete a property and trigger change if necessary.
  977. */
  978. function del (target, key) {
  979. if (process.env.NODE_ENV !== 'production' &&
  980. (isUndef(target) || isPrimitive(target))
  981. ) {
  982. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  983. }
  984. if (Array.isArray(target) && isValidArrayIndex(key)) {
  985. target.splice(key, 1);
  986. return
  987. }
  988. var ob = (target).__ob__;
  989. if (target._isVue || (ob && ob.vmCount)) {
  990. process.env.NODE_ENV !== 'production' && warn(
  991. 'Avoid deleting properties on a Vue instance or its root $data ' +
  992. '- just set it to null.'
  993. );
  994. return
  995. }
  996. if (!hasOwn(target, key)) {
  997. return
  998. }
  999. delete target[key];
  1000. if (!ob) {
  1001. return
  1002. }
  1003. ob.dep.notify();
  1004. }
  1005. /**
  1006. * Collect dependencies on array elements when the array is touched, since
  1007. * we cannot intercept array element access like property getters.
  1008. */
  1009. function dependArray (value) {
  1010. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  1011. e = value[i];
  1012. e && e.__ob__ && e.__ob__.dep.depend();
  1013. if (Array.isArray(e)) {
  1014. dependArray(e);
  1015. }
  1016. }
  1017. }
  1018. /* */
  1019. /**
  1020. * Option overwriting strategies are functions that handle
  1021. * how to merge a parent option value and a child option
  1022. * value into the final value.
  1023. */
  1024. var strats = config.optionMergeStrategies;
  1025. /**
  1026. * Options with restrictions
  1027. */
  1028. if (process.env.NODE_ENV !== 'production') {
  1029. strats.el = strats.propsData = function (parent, child, vm, key) {
  1030. if (!vm) {
  1031. warn(
  1032. "option \"" + key + "\" can only be used during instance " +
  1033. 'creation with the `new` keyword.'
  1034. );
  1035. }
  1036. return defaultStrat(parent, child)
  1037. };
  1038. }
  1039. /**
  1040. * Helper that recursively merges two data objects together.
  1041. */
  1042. function mergeData (to, from) {
  1043. if (!from) { return to }
  1044. var key, toVal, fromVal;
  1045. var keys = hasSymbol
  1046. ? Reflect.ownKeys(from)
  1047. : Object.keys(from);
  1048. for (var i = 0; i < keys.length; i++) {
  1049. key = keys[i];
  1050. // in case the object is already observed...
  1051. if (key === '__ob__') { continue }
  1052. toVal = to[key];
  1053. fromVal = from[key];
  1054. if (!hasOwn(to, key)) {
  1055. set(to, key, fromVal);
  1056. } else if (
  1057. toVal !== fromVal &&
  1058. isPlainObject(toVal) &&
  1059. isPlainObject(fromVal)
  1060. ) {
  1061. mergeData(toVal, fromVal);
  1062. }
  1063. }
  1064. return to
  1065. }
  1066. /**
  1067. * Data
  1068. */
  1069. function mergeDataOrFn (
  1070. parentVal,
  1071. childVal,
  1072. vm
  1073. ) {
  1074. if (!vm) {
  1075. // in a Vue.extend merge, both should be functions
  1076. if (!childVal) {
  1077. return parentVal
  1078. }
  1079. if (!parentVal) {
  1080. return childVal
  1081. }
  1082. // when parentVal & childVal are both present,
  1083. // we need to return a function that returns the
  1084. // merged result of both functions... no need to
  1085. // check if parentVal is a function here because
  1086. // it has to be a function to pass previous merges.
  1087. return function mergedDataFn () {
  1088. return mergeData(
  1089. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  1090. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  1091. )
  1092. }
  1093. } else {
  1094. return function mergedInstanceDataFn () {
  1095. // instance merge
  1096. var instanceData = typeof childVal === 'function'
  1097. ? childVal.call(vm, vm)
  1098. : childVal;
  1099. var defaultData = typeof parentVal === 'function'
  1100. ? parentVal.call(vm, vm)
  1101. : parentVal;
  1102. if (instanceData) {
  1103. return mergeData(instanceData, defaultData)
  1104. } else {
  1105. return defaultData
  1106. }
  1107. }
  1108. }
  1109. }
  1110. strats.data = function (
  1111. parentVal,
  1112. childVal,
  1113. vm
  1114. ) {
  1115. if (!vm) {
  1116. if (childVal && typeof childVal !== 'function') {
  1117. process.env.NODE_ENV !== 'production' && warn(
  1118. 'The "data" option should be a function ' +
  1119. 'that returns a per-instance value in component ' +
  1120. 'definitions.',
  1121. vm
  1122. );
  1123. return parentVal
  1124. }
  1125. return mergeDataOrFn(parentVal, childVal)
  1126. }
  1127. return mergeDataOrFn(parentVal, childVal, vm)
  1128. };
  1129. /**
  1130. * Hooks and props are merged as arrays.
  1131. */
  1132. function mergeHook (
  1133. parentVal,
  1134. childVal
  1135. ) {
  1136. var res = childVal
  1137. ? parentVal
  1138. ? parentVal.concat(childVal)
  1139. : Array.isArray(childVal)
  1140. ? childVal
  1141. : [childVal]
  1142. : parentVal;
  1143. return res
  1144. ? dedupeHooks(res)
  1145. : res
  1146. }
  1147. function dedupeHooks (hooks) {
  1148. var res = [];
  1149. for (var i = 0; i < hooks.length; i++) {
  1150. if (res.indexOf(hooks[i]) === -1) {
  1151. res.push(hooks[i]);
  1152. }
  1153. }
  1154. return res
  1155. }
  1156. LIFECYCLE_HOOKS.forEach(function (hook) {
  1157. strats[hook] = mergeHook;
  1158. });
  1159. /**
  1160. * Assets
  1161. *
  1162. * When a vm is present (instance creation), we need to do
  1163. * a three-way merge between constructor options, instance
  1164. * options and parent options.
  1165. */
  1166. function mergeAssets (
  1167. parentVal,
  1168. childVal,
  1169. vm,
  1170. key
  1171. ) {
  1172. var res = Object.create(parentVal || null);
  1173. if (childVal) {
  1174. process.env.NODE_ENV !== 'production' && assertObjectType(key, childVal, vm);
  1175. return extend(res, childVal)
  1176. } else {
  1177. return res
  1178. }
  1179. }
  1180. ASSET_TYPES.forEach(function (type) {
  1181. strats[type + 's'] = mergeAssets;
  1182. });
  1183. /**
  1184. * Watchers.
  1185. *
  1186. * Watchers hashes should not overwrite one
  1187. * another, so we merge them as arrays.
  1188. */
  1189. strats.watch = function (
  1190. parentVal,
  1191. childVal,
  1192. vm,
  1193. key
  1194. ) {
  1195. // work around Firefox's Object.prototype.watch...
  1196. if (parentVal === nativeWatch) { parentVal = undefined; }
  1197. if (childVal === nativeWatch) { childVal = undefined; }
  1198. /* istanbul ignore if */
  1199. if (!childVal) { return Object.create(parentVal || null) }
  1200. if (process.env.NODE_ENV !== 'production') {
  1201. assertObjectType(key, childVal, vm);
  1202. }
  1203. if (!parentVal) { return childVal }
  1204. var ret = {};
  1205. extend(ret, parentVal);
  1206. for (var key$1 in childVal) {
  1207. var parent = ret[key$1];
  1208. var child = childVal[key$1];
  1209. if (parent && !Array.isArray(parent)) {
  1210. parent = [parent];
  1211. }
  1212. ret[key$1] = parent
  1213. ? parent.concat(child)
  1214. : Array.isArray(child) ? child : [child];
  1215. }
  1216. return ret
  1217. };
  1218. /**
  1219. * Other object hashes.
  1220. */
  1221. strats.props =
  1222. strats.methods =
  1223. strats.inject =
  1224. strats.computed = function (
  1225. parentVal,
  1226. childVal,
  1227. vm,
  1228. key
  1229. ) {
  1230. if (childVal && process.env.NODE_ENV !== 'production') {
  1231. assertObjectType(key, childVal, vm);
  1232. }
  1233. if (!parentVal) { return childVal }
  1234. var ret = Object.create(null);
  1235. extend(ret, parentVal);
  1236. if (childVal) { extend(ret, childVal); }
  1237. return ret
  1238. };
  1239. strats.provide = mergeDataOrFn;
  1240. /**
  1241. * Default strategy.
  1242. */
  1243. var defaultStrat = function (parentVal, childVal) {
  1244. return childVal === undefined
  1245. ? parentVal
  1246. : childVal
  1247. };
  1248. /**
  1249. * Validate component names
  1250. */
  1251. function checkComponents (options) {
  1252. for (var key in options.components) {
  1253. validateComponentName(key);
  1254. }
  1255. }
  1256. function validateComponentName (name) {
  1257. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  1258. warn(
  1259. 'Invalid component name: "' + name + '". Component names ' +
  1260. 'should conform to valid custom element name in html5 specification.'
  1261. );
  1262. }
  1263. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  1264. warn(
  1265. 'Do not use built-in or reserved HTML elements as component ' +
  1266. 'id: ' + name
  1267. );
  1268. }
  1269. }
  1270. /**
  1271. * Ensure all props option syntax are normalized into the
  1272. * Object-based format.
  1273. */
  1274. function normalizeProps (options, vm) {
  1275. var props = options.props;
  1276. if (!props) { return }
  1277. var res = {};
  1278. var i, val, name;
  1279. if (Array.isArray(props)) {
  1280. i = props.length;
  1281. while (i--) {
  1282. val = props[i];
  1283. if (typeof val === 'string') {
  1284. name = camelize(val);
  1285. res[name] = { type: null };
  1286. } else if (process.env.NODE_ENV !== 'production') {
  1287. warn('props must be strings when using array syntax.');
  1288. }
  1289. }
  1290. } else if (isPlainObject(props)) {
  1291. for (var key in props) {
  1292. val = props[key];
  1293. name = camelize(key);
  1294. res[name] = isPlainObject(val)
  1295. ? val
  1296. : { type: val };
  1297. }
  1298. } else if (process.env.NODE_ENV !== 'production') {
  1299. warn(
  1300. "Invalid value for option \"props\": expected an Array or an Object, " +
  1301. "but got " + (toRawType(props)) + ".",
  1302. vm
  1303. );
  1304. }
  1305. options.props = res;
  1306. }
  1307. /**
  1308. * Normalize all injections into Object-based format
  1309. */
  1310. function normalizeInject (options, vm) {
  1311. var inject = options.inject;
  1312. if (!inject) { return }
  1313. var normalized = options.inject = {};
  1314. if (Array.isArray(inject)) {
  1315. for (var i = 0; i < inject.length; i++) {
  1316. normalized[inject[i]] = { from: inject[i] };
  1317. }
  1318. } else if (isPlainObject(inject)) {
  1319. for (var key in inject) {
  1320. var val = inject[key];
  1321. normalized[key] = isPlainObject(val)
  1322. ? extend({ from: key }, val)
  1323. : { from: val };
  1324. }
  1325. } else if (process.env.NODE_ENV !== 'production') {
  1326. warn(
  1327. "Invalid value for option \"inject\": expected an Array or an Object, " +
  1328. "but got " + (toRawType(inject)) + ".",
  1329. vm
  1330. );
  1331. }
  1332. }
  1333. /**
  1334. * Normalize raw function directives into object format.
  1335. */
  1336. function normalizeDirectives (options) {
  1337. var dirs = options.directives;
  1338. if (dirs) {
  1339. for (var key in dirs) {
  1340. var def$$1 = dirs[key];
  1341. if (typeof def$$1 === 'function') {
  1342. dirs[key] = { bind: def$$1, update: def$$1 };
  1343. }
  1344. }
  1345. }
  1346. }
  1347. function assertObjectType (name, value, vm) {
  1348. if (!isPlainObject(value)) {
  1349. warn(
  1350. "Invalid value for option \"" + name + "\": expected an Object, " +
  1351. "but got " + (toRawType(value)) + ".",
  1352. vm
  1353. );
  1354. }
  1355. }
  1356. /**
  1357. * Merge two option objects into a new one.
  1358. * Core utility used in both instantiation and inheritance.
  1359. */
  1360. function mergeOptions (
  1361. parent,
  1362. child,
  1363. vm
  1364. ) {
  1365. if (process.env.NODE_ENV !== 'production') {
  1366. checkComponents(child);
  1367. }
  1368. if (typeof child === 'function') {
  1369. child = child.options;
  1370. }
  1371. normalizeProps(child, vm);
  1372. normalizeInject(child, vm);
  1373. normalizeDirectives(child);
  1374. // Apply extends and mixins on the child options,
  1375. // but only if it is a raw options object that isn't
  1376. // the result of another mergeOptions call.
  1377. // Only merged options has the _base property.
  1378. if (!child._base) {
  1379. if (child.extends) {
  1380. parent = mergeOptions(parent, child.extends, vm);
  1381. }
  1382. if (child.mixins) {
  1383. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1384. parent = mergeOptions(parent, child.mixins[i], vm);
  1385. }
  1386. }
  1387. }
  1388. var options = {};
  1389. var key;
  1390. for (key in parent) {
  1391. mergeField(key);
  1392. }
  1393. for (key in child) {
  1394. if (!hasOwn(parent, key)) {
  1395. mergeField(key);
  1396. }
  1397. }
  1398. function mergeField (key) {
  1399. var strat = strats[key] || defaultStrat;
  1400. options[key] = strat(parent[key], child[key], vm, key);
  1401. }
  1402. return options
  1403. }
  1404. /**
  1405. * Resolve an asset.
  1406. * This function is used because child instances need access
  1407. * to assets defined in its ancestor chain.
  1408. */
  1409. function resolveAsset (
  1410. options,
  1411. type,
  1412. id,
  1413. warnMissing
  1414. ) {
  1415. /* istanbul ignore if */
  1416. if (typeof id !== 'string') {
  1417. return
  1418. }
  1419. var assets = options[type];
  1420. // check local registration variations first
  1421. if (hasOwn(assets, id)) { return assets[id] }
  1422. var camelizedId = camelize(id);
  1423. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  1424. var PascalCaseId = capitalize(camelizedId);
  1425. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  1426. // fallback to prototype chain
  1427. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  1428. if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {
  1429. warn(
  1430. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  1431. options
  1432. );
  1433. }
  1434. return res
  1435. }
  1436. /* */
  1437. function validateProp (
  1438. key,
  1439. propOptions,
  1440. propsData,
  1441. vm
  1442. ) {
  1443. var prop = propOptions[key];
  1444. var absent = !hasOwn(propsData, key);
  1445. var value = propsData[key];
  1446. // boolean casting
  1447. var booleanIndex = getTypeIndex(Boolean, prop.type);
  1448. if (booleanIndex > -1) {
  1449. if (absent && !hasOwn(prop, 'default')) {
  1450. value = false;
  1451. } else if (value === '' || value === hyphenate(key)) {
  1452. // only cast empty string / same name to boolean if
  1453. // boolean has higher priority
  1454. var stringIndex = getTypeIndex(String, prop.type);
  1455. if (stringIndex < 0 || booleanIndex < stringIndex) {
  1456. value = true;
  1457. }
  1458. }
  1459. }
  1460. // check default value
  1461. if (value === undefined) {
  1462. value = getPropDefaultValue(vm, prop, key);
  1463. // since the default value is a fresh copy,
  1464. // make sure to observe it.
  1465. var prevShouldObserve = shouldObserve;
  1466. toggleObserving(true);
  1467. observe(value);
  1468. toggleObserving(prevShouldObserve);
  1469. }
  1470. if (
  1471. process.env.NODE_ENV !== 'production' &&
  1472. // skip validation for weex recycle-list child component props
  1473. !(false)
  1474. ) {
  1475. assertProp(prop, key, value, vm, absent);
  1476. }
  1477. return value
  1478. }
  1479. /**
  1480. * Get the default value of a prop.
  1481. */
  1482. function getPropDefaultValue (vm, prop, key) {
  1483. // no default, return undefined
  1484. if (!hasOwn(prop, 'default')) {
  1485. return undefined
  1486. }
  1487. var def = prop.default;
  1488. // warn against non-factory defaults for Object & Array
  1489. if (process.env.NODE_ENV !== 'production' && isObject(def)) {
  1490. warn(
  1491. 'Invalid default value for prop "' + key + '": ' +
  1492. 'Props with type Object/Array must use a factory function ' +
  1493. 'to return the default value.',
  1494. vm
  1495. );
  1496. }
  1497. // the raw prop value was also undefined from previous render,
  1498. // return previous default value to avoid unnecessary watcher trigger
  1499. if (vm && vm.$options.propsData &&
  1500. vm.$options.propsData[key] === undefined &&
  1501. vm._props[key] !== undefined
  1502. ) {
  1503. return vm._props[key]
  1504. }
  1505. // call factory function for non-Function types
  1506. // a value is Function if its prototype is function even across different execution context
  1507. return typeof def === 'function' && getType(prop.type) !== 'Function'
  1508. ? def.call(vm)
  1509. : def
  1510. }
  1511. /**
  1512. * Assert whether a prop is valid.
  1513. */
  1514. function assertProp (
  1515. prop,
  1516. name,
  1517. value,
  1518. vm,
  1519. absent
  1520. ) {
  1521. if (prop.required && absent) {
  1522. warn(
  1523. 'Missing required prop: "' + name + '"',
  1524. vm
  1525. );
  1526. return
  1527. }
  1528. if (value == null && !prop.required) {
  1529. return
  1530. }
  1531. var type = prop.type;
  1532. var valid = !type || type === true;
  1533. var expectedTypes = [];
  1534. if (type) {
  1535. if (!Array.isArray(type)) {
  1536. type = [type];
  1537. }
  1538. for (var i = 0; i < type.length && !valid; i++) {
  1539. var assertedType = assertType(value, type[i], vm);
  1540. expectedTypes.push(assertedType.expectedType || '');
  1541. valid = assertedType.valid;
  1542. }
  1543. }
  1544. var haveExpectedTypes = expectedTypes.some(function (t) { return t; });
  1545. if (!valid && haveExpectedTypes) {
  1546. warn(
  1547. getInvalidTypeMessage(name, value, expectedTypes),
  1548. vm
  1549. );
  1550. return
  1551. }
  1552. var validator = prop.validator;
  1553. if (validator) {
  1554. if (!validator(value)) {
  1555. warn(
  1556. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  1557. vm
  1558. );
  1559. }
  1560. }
  1561. }
  1562. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/;
  1563. function assertType (value, type, vm) {
  1564. var valid;
  1565. var expectedType = getType(type);
  1566. if (simpleCheckRE.test(expectedType)) {
  1567. var t = typeof value;
  1568. valid = t === expectedType.toLowerCase();
  1569. // for primitive wrapper objects
  1570. if (!valid && t === 'object') {
  1571. valid = value instanceof type;
  1572. }
  1573. } else if (expectedType === 'Object') {
  1574. valid = isPlainObject(value);
  1575. } else if (expectedType === 'Array') {
  1576. valid = Array.isArray(value);
  1577. } else {
  1578. try {
  1579. valid = value instanceof type;
  1580. } catch (e) {
  1581. warn('Invalid prop type: "' + String(type) + '" is not a constructor', vm);
  1582. valid = false;
  1583. }
  1584. }
  1585. return {
  1586. valid: valid,
  1587. expectedType: expectedType
  1588. }
  1589. }
  1590. var functionTypeCheckRE = /^\s*function (\w+)/;
  1591. /**
  1592. * Use function string name to check built-in types,
  1593. * because a simple equality check will fail when running
  1594. * across different vms / iframes.
  1595. */
  1596. function getType (fn) {
  1597. var match = fn && fn.toString().match(functionTypeCheckRE);
  1598. return match ? match[1] : ''
  1599. }
  1600. function isSameType (a, b) {
  1601. return getType(a) === getType(b)
  1602. }
  1603. function getTypeIndex (type, expectedTypes) {
  1604. if (!Array.isArray(expectedTypes)) {
  1605. return isSameType(expectedTypes, type) ? 0 : -1
  1606. }
  1607. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  1608. if (isSameType(expectedTypes[i], type)) {
  1609. return i
  1610. }
  1611. }
  1612. return -1
  1613. }
  1614. function getInvalidTypeMessage (name, value, expectedTypes) {
  1615. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  1616. " Expected " + (expectedTypes.map(capitalize).join(', '));
  1617. var expectedType = expectedTypes[0];
  1618. var receivedType = toRawType(value);
  1619. // check if we need to specify expected value
  1620. if (
  1621. expectedTypes.length === 1 &&
  1622. isExplicable(expectedType) &&
  1623. isExplicable(typeof value) &&
  1624. !isBoolean(expectedType, receivedType)
  1625. ) {
  1626. message += " with value " + (styleValue(value, expectedType));
  1627. }
  1628. message += ", got " + receivedType + " ";
  1629. // check if we need to specify received value
  1630. if (isExplicable(receivedType)) {
  1631. message += "with value " + (styleValue(value, receivedType)) + ".";
  1632. }
  1633. return message
  1634. }
  1635. function styleValue (value, type) {
  1636. if (type === 'String') {
  1637. return ("\"" + value + "\"")
  1638. } else if (type === 'Number') {
  1639. return ("" + (Number(value)))
  1640. } else {
  1641. return ("" + value)
  1642. }
  1643. }
  1644. var EXPLICABLE_TYPES = ['string', 'number', 'boolean'];
  1645. function isExplicable (value) {
  1646. return EXPLICABLE_TYPES.some(function (elem) { return value.toLowerCase() === elem; })
  1647. }
  1648. function isBoolean () {
  1649. var args = [], len = arguments.length;
  1650. while ( len-- ) args[ len ] = arguments[ len ];
  1651. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  1652. }
  1653. /* */
  1654. function handleError (err, vm, info) {
  1655. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  1656. // See: https://github.com/vuejs/vuex/issues/1505
  1657. pushTarget();
  1658. try {
  1659. if (vm) {
  1660. var cur = vm;
  1661. while ((cur = cur.$parent)) {
  1662. var hooks = cur.$options.errorCaptured;
  1663. if (hooks) {
  1664. for (var i = 0; i < hooks.length; i++) {
  1665. try {
  1666. var capture = hooks[i].call(cur, err, vm, info) === false;
  1667. if (capture) { return }
  1668. } catch (e) {
  1669. globalHandleError(e, cur, 'errorCaptured hook');
  1670. }
  1671. }
  1672. }
  1673. }
  1674. }
  1675. globalHandleError(err, vm, info);
  1676. } finally {
  1677. popTarget();
  1678. }
  1679. }
  1680. function invokeWithErrorHandling (
  1681. handler,
  1682. context,
  1683. args,
  1684. vm,
  1685. info
  1686. ) {
  1687. var res;
  1688. try {
  1689. res = args ? handler.apply(context, args) : handler.call(context);
  1690. if (res && !res._isVue && isPromise(res) && !res._handled) {
  1691. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  1692. // issue #9511
  1693. // avoid catch triggering multiple times when nested calls
  1694. res._handled = true;
  1695. }
  1696. } catch (e) {
  1697. handleError(e, vm, info);
  1698. }
  1699. return res
  1700. }
  1701. function globalHandleError (err, vm, info) {
  1702. if (config.errorHandler) {
  1703. try {
  1704. return config.errorHandler.call(null, err, vm, info)
  1705. } catch (e) {
  1706. // if the user intentionally throws the original error in the handler,
  1707. // do not log it twice
  1708. if (e !== err) {
  1709. logError(e, null, 'config.errorHandler');
  1710. }
  1711. }
  1712. }
  1713. logError(err, vm, info);
  1714. }
  1715. function logError (err, vm, info) {
  1716. if (process.env.NODE_ENV !== 'production') {
  1717. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  1718. }
  1719. /* istanbul ignore else */
  1720. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  1721. console.error(err);
  1722. } else {
  1723. throw err
  1724. }
  1725. }
  1726. /* */
  1727. var isUsingMicroTask = false;
  1728. var callbacks = [];
  1729. var pending = false;
  1730. function flushCallbacks () {
  1731. pending = false;
  1732. var copies = callbacks.slice(0);
  1733. callbacks.length = 0;
  1734. for (var i = 0; i < copies.length; i++) {
  1735. copies[i]();
  1736. }
  1737. }
  1738. // Here we have async deferring wrappers using microtasks.
  1739. // In 2.5 we used (macro) tasks (in combination with microtasks).
  1740. // However, it has subtle problems when state is changed right before repaint
  1741. // (e.g. #6813, out-in transitions).
  1742. // Also, using (macro) tasks in event handler would cause some weird behaviors
  1743. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  1744. // So we now use microtasks everywhere, again.
  1745. // A major drawback of this tradeoff is that there are some scenarios
  1746. // where microtasks have too high a priority and fire in between supposedly
  1747. // sequential events (e.g. #4521, #6690, which have workarounds)
  1748. // or even between bubbling of the same event (#6566).
  1749. var timerFunc;
  1750. // The nextTick behavior leverages the microtask queue, which can be accessed
  1751. // via either native Promise.then or MutationObserver.
  1752. // MutationObserver has wider support, however it is seriously bugged in
  1753. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  1754. // completely stops working after triggering a few times... so, if native
  1755. // Promise is available, we will use it:
  1756. /* istanbul ignore next, $flow-disable-line */
  1757. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  1758. var p = Promise.resolve();
  1759. timerFunc = function () {
  1760. p.then(flushCallbacks);
  1761. // In problematic UIWebViews, Promise.then doesn't completely break, but
  1762. // it can get stuck in a weird state where callbacks are pushed into the
  1763. // microtask queue but the queue isn't being flushed, until the browser
  1764. // needs to do some other work, e.g. handle a timer. Therefore we can
  1765. // "force" the microtask queue to be flushed by adding an empty timer.
  1766. if (isIOS) { setTimeout(noop); }
  1767. };
  1768. isUsingMicroTask = true;
  1769. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  1770. isNative(MutationObserver) ||
  1771. // PhantomJS and iOS 7.x
  1772. MutationObserver.toString() === '[object MutationObserverConstructor]'
  1773. )) {
  1774. // Use MutationObserver where native Promise is not available,
  1775. // e.g. PhantomJS, iOS7, Android 4.4
  1776. // (#6466 MutationObserver is unreliable in IE11)
  1777. var counter = 1;
  1778. var observer = new MutationObserver(flushCallbacks);
  1779. var textNode = document.createTextNode(String(counter));
  1780. observer.observe(textNode, {
  1781. characterData: true
  1782. });
  1783. timerFunc = function () {
  1784. counter = (counter + 1) % 2;
  1785. textNode.data = String(counter);
  1786. };
  1787. isUsingMicroTask = true;
  1788. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  1789. // Fallback to setImmediate.
  1790. // Technically it leverages the (macro) task queue,
  1791. // but it is still a better choice than setTimeout.
  1792. timerFunc = function () {
  1793. setImmediate(flushCallbacks);
  1794. };
  1795. } else {
  1796. // Fallback to setTimeout.
  1797. timerFunc = function () {
  1798. setTimeout(flushCallbacks, 0);
  1799. };
  1800. }
  1801. function nextTick (cb, ctx) {
  1802. var _resolve;
  1803. callbacks.push(function () {
  1804. if (cb) {
  1805. try {
  1806. cb.call(ctx);
  1807. } catch (e) {
  1808. handleError(e, ctx, 'nextTick');
  1809. }
  1810. } else if (_resolve) {
  1811. _resolve(ctx);
  1812. }
  1813. });
  1814. if (!pending) {
  1815. pending = true;
  1816. timerFunc();
  1817. }
  1818. // $flow-disable-line
  1819. if (!cb && typeof Promise !== 'undefined') {
  1820. return new Promise(function (resolve) {
  1821. _resolve = resolve;
  1822. })
  1823. }
  1824. }
  1825. /* */
  1826. var mark;
  1827. var measure;
  1828. if (process.env.NODE_ENV !== 'production') {
  1829. var perf = inBrowser && window.performance;
  1830. /* istanbul ignore if */
  1831. if (
  1832. perf &&
  1833. perf.mark &&
  1834. perf.measure &&
  1835. perf.clearMarks &&
  1836. perf.clearMeasures
  1837. ) {
  1838. mark = function (tag) { return perf.mark(tag); };
  1839. measure = function (name, startTag, endTag) {
  1840. perf.measure(name, startTag, endTag);
  1841. perf.clearMarks(startTag);
  1842. perf.clearMarks(endTag);
  1843. // perf.clearMeasures(name)
  1844. };
  1845. }
  1846. }
  1847. /* not type checking this file because flow doesn't play well with Proxy */
  1848. var initProxy;
  1849. if (process.env.NODE_ENV !== 'production') {
  1850. var allowedGlobals = makeMap(
  1851. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  1852. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  1853. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' +
  1854. 'require' // for Webpack/Browserify
  1855. );
  1856. var warnNonPresent = function (target, key) {
  1857. warn(
  1858. "Property or method \"" + key + "\" is not defined on the instance but " +
  1859. 'referenced during render. Make sure that this property is reactive, ' +
  1860. 'either in the data option, or for class-based components, by ' +
  1861. 'initializing the property. ' +
  1862. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  1863. target
  1864. );
  1865. };
  1866. var warnReservedPrefix = function (target, key) {
  1867. warn(
  1868. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  1869. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  1870. 'prevent conflicts with Vue internals. ' +
  1871. 'See: https://vuejs.org/v2/api/#data',
  1872. target
  1873. );
  1874. };
  1875. var hasProxy =
  1876. typeof Proxy !== 'undefined' && isNative(Proxy);
  1877. if (hasProxy) {
  1878. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  1879. config.keyCodes = new Proxy(config.keyCodes, {
  1880. set: function set (target, key, value) {
  1881. if (isBuiltInModifier(key)) {
  1882. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  1883. return false
  1884. } else {
  1885. target[key] = value;
  1886. return true
  1887. }
  1888. }
  1889. });
  1890. }
  1891. var hasHandler = {
  1892. has: function has (target, key) {
  1893. var has = key in target;
  1894. var isAllowed = allowedGlobals(key) ||
  1895. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  1896. if (!has && !isAllowed) {
  1897. if (key in target.$data) { warnReservedPrefix(target, key); }
  1898. else { warnNonPresent(target, key); }
  1899. }
  1900. return has || !isAllowed
  1901. }
  1902. };
  1903. var getHandler = {
  1904. get: function get (target, key) {
  1905. if (typeof key === 'string' && !(key in target)) {
  1906. if (key in target.$data) { warnReservedPrefix(target, key); }
  1907. else { warnNonPresent(target, key); }
  1908. }
  1909. return target[key]
  1910. }
  1911. };
  1912. initProxy = function initProxy (vm) {
  1913. if (hasProxy) {
  1914. // determine which proxy handler to use
  1915. var options = vm.$options;
  1916. var handlers = options.render && options.render._withStripped
  1917. ? getHandler
  1918. : hasHandler;
  1919. vm._renderProxy = new Proxy(vm, handlers);
  1920. } else {
  1921. vm._renderProxy = vm;
  1922. }
  1923. };
  1924. }
  1925. /* */
  1926. var seenObjects = new _Set();
  1927. /**
  1928. * Recursively traverse an object to evoke all converted
  1929. * getters, so that every nested property inside the object
  1930. * is collected as a "deep" dependency.
  1931. */
  1932. function traverse (val) {
  1933. _traverse(val, seenObjects);
  1934. seenObjects.clear();
  1935. }
  1936. function _traverse (val, seen) {
  1937. var i, keys;
  1938. var isA = Array.isArray(val);
  1939. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  1940. return
  1941. }
  1942. if (val.__ob__) {
  1943. var depId = val.__ob__.dep.id;
  1944. if (seen.has(depId)) {
  1945. return
  1946. }
  1947. seen.add(depId);
  1948. }
  1949. if (isA) {
  1950. i = val.length;
  1951. while (i--) { _traverse(val[i], seen); }
  1952. } else {
  1953. keys = Object.keys(val);
  1954. i = keys.length;
  1955. while (i--) { _traverse(val[keys[i]], seen); }
  1956. }
  1957. }
  1958. /* */
  1959. var normalizeEvent = cached(function (name) {
  1960. var passive = name.charAt(0) === '&';
  1961. name = passive ? name.slice(1) : name;
  1962. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  1963. name = once$$1 ? name.slice(1) : name;
  1964. var capture = name.charAt(0) === '!';
  1965. name = capture ? name.slice(1) : name;
  1966. return {
  1967. name: name,
  1968. once: once$$1,
  1969. capture: capture,
  1970. passive: passive
  1971. }
  1972. });
  1973. function createFnInvoker (fns, vm) {
  1974. function invoker () {
  1975. var arguments$1 = arguments;
  1976. var fns = invoker.fns;
  1977. if (Array.isArray(fns)) {
  1978. var cloned = fns.slice();
  1979. for (var i = 0; i < cloned.length; i++) {
  1980. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  1981. }
  1982. } else {
  1983. // return handler return value for single handlers
  1984. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  1985. }
  1986. }
  1987. invoker.fns = fns;
  1988. return invoker
  1989. }
  1990. function updateListeners (
  1991. on,
  1992. oldOn,
  1993. add,
  1994. remove$$1,
  1995. createOnceHandler,
  1996. vm
  1997. ) {
  1998. var name, def$$1, cur, old, event;
  1999. for (name in on) {
  2000. def$$1 = cur = on[name];
  2001. old = oldOn[name];
  2002. event = normalizeEvent(name);
  2003. if (isUndef(cur)) {
  2004. process.env.NODE_ENV !== 'production' && warn(
  2005. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  2006. vm
  2007. );
  2008. } else if (isUndef(old)) {
  2009. if (isUndef(cur.fns)) {
  2010. cur = on[name] = createFnInvoker(cur, vm);
  2011. }
  2012. if (isTrue(event.once)) {
  2013. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  2014. }
  2015. add(event.name, cur, event.capture, event.passive, event.params);
  2016. } else if (cur !== old) {
  2017. old.fns = cur;
  2018. on[name] = old;
  2019. }
  2020. }
  2021. for (name in oldOn) {
  2022. if (isUndef(on[name])) {
  2023. event = normalizeEvent(name);
  2024. remove$$1(event.name, oldOn[name], event.capture);
  2025. }
  2026. }
  2027. }
  2028. /* */
  2029. function mergeVNodeHook (def, hookKey, hook) {
  2030. if (def instanceof VNode) {
  2031. def = def.data.hook || (def.data.hook = {});
  2032. }
  2033. var invoker;
  2034. var oldHook = def[hookKey];
  2035. function wrappedHook () {
  2036. hook.apply(this, arguments);
  2037. // important: remove merged hook to ensure it's called only once
  2038. // and prevent memory leak
  2039. remove(invoker.fns, wrappedHook);
  2040. }
  2041. if (isUndef(oldHook)) {
  2042. // no existing hook
  2043. invoker = createFnInvoker([wrappedHook]);
  2044. } else {
  2045. /* istanbul ignore if */
  2046. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  2047. // already a merged invoker
  2048. invoker = oldHook;
  2049. invoker.fns.push(wrappedHook);
  2050. } else {
  2051. // existing plain hook
  2052. invoker = createFnInvoker([oldHook, wrappedHook]);
  2053. }
  2054. }
  2055. invoker.merged = true;
  2056. def[hookKey] = invoker;
  2057. }
  2058. /* */
  2059. function extractPropsFromVNodeData (
  2060. data,
  2061. Ctor,
  2062. tag
  2063. ) {
  2064. // we are only extracting raw values here.
  2065. // validation and default values are handled in the child
  2066. // component itself.
  2067. var propOptions = Ctor.options.props;
  2068. if (isUndef(propOptions)) {
  2069. return
  2070. }
  2071. var res = {};
  2072. var attrs = data.attrs;
  2073. var props = data.props;
  2074. if (isDef(attrs) || isDef(props)) {
  2075. for (var key in propOptions) {
  2076. var altKey = hyphenate(key);
  2077. if (process.env.NODE_ENV !== 'production') {
  2078. var keyInLowerCase = key.toLowerCase();
  2079. if (
  2080. key !== keyInLowerCase &&
  2081. attrs && hasOwn(attrs, keyInLowerCase)
  2082. ) {
  2083. tip(
  2084. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  2085. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  2086. " \"" + key + "\". " +
  2087. "Note that HTML attributes are case-insensitive and camelCased " +
  2088. "props need to use their kebab-case equivalents when using in-DOM " +
  2089. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  2090. );
  2091. }
  2092. }
  2093. checkProp(res, props, key, altKey, true) ||
  2094. checkProp(res, attrs, key, altKey, false);
  2095. }
  2096. }
  2097. return res
  2098. }
  2099. function checkProp (
  2100. res,
  2101. hash,
  2102. key,
  2103. altKey,
  2104. preserve
  2105. ) {
  2106. if (isDef(hash)) {
  2107. if (hasOwn(hash, key)) {
  2108. res[key] = hash[key];
  2109. if (!preserve) {
  2110. delete hash[key];
  2111. }
  2112. return true
  2113. } else if (hasOwn(hash, altKey)) {
  2114. res[key] = hash[altKey];
  2115. if (!preserve) {
  2116. delete hash[altKey];
  2117. }
  2118. return true
  2119. }
  2120. }
  2121. return false
  2122. }
  2123. /* */
  2124. // The template compiler attempts to minimize the need for normalization by
  2125. // statically analyzing the template at compile time.
  2126. //
  2127. // For plain HTML markup, normalization can be completely skipped because the
  2128. // generated render function is guaranteed to return Array<VNode>. There are
  2129. // two cases where extra normalization is needed:
  2130. // 1. When the children contains components - because a functional component
  2131. // may return an Array instead of a single root. In this case, just a simple
  2132. // normalization is needed - if any child is an Array, we flatten the whole
  2133. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  2134. // because functional components already normalize their own children.
  2135. function simpleNormalizeChildren (children) {
  2136. for (var i = 0; i < children.length; i++) {
  2137. if (Array.isArray(children[i])) {
  2138. return Array.prototype.concat.apply([], children)
  2139. }
  2140. }
  2141. return children
  2142. }
  2143. // 2. When the children contains constructs that always generated nested Arrays,
  2144. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  2145. // with hand-written render functions / JSX. In such cases a full normalization
  2146. // is needed to cater to all possible types of children values.
  2147. function normalizeChildren (children) {
  2148. return isPrimitive(children)
  2149. ? [createTextVNode(children)]
  2150. : Array.isArray(children)
  2151. ? normalizeArrayChildren(children)
  2152. : undefined
  2153. }
  2154. function isTextNode (node) {
  2155. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  2156. }
  2157. function normalizeArrayChildren (children, nestedIndex) {
  2158. var res = [];
  2159. var i, c, lastIndex, last;
  2160. for (i = 0; i < children.length; i++) {
  2161. c = children[i];
  2162. if (isUndef(c) || typeof c === 'boolean') { continue }
  2163. lastIndex = res.length - 1;
  2164. last = res[lastIndex];
  2165. // nested
  2166. if (Array.isArray(c)) {
  2167. if (c.length > 0) {
  2168. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  2169. // merge adjacent text nodes
  2170. if (isTextNode(c[0]) && isTextNode(last)) {
  2171. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  2172. c.shift();
  2173. }
  2174. res.push.apply(res, c);
  2175. }
  2176. } else if (isPrimitive(c)) {
  2177. if (isTextNode(last)) {
  2178. // merge adjacent text nodes
  2179. // this is necessary for SSR hydration because text nodes are
  2180. // essentially merged when rendered to HTML strings
  2181. res[lastIndex] = createTextVNode(last.text + c);
  2182. } else if (c !== '') {
  2183. // convert primitive to vnode
  2184. res.push(createTextVNode(c));
  2185. }
  2186. } else {
  2187. if (isTextNode(c) && isTextNode(last)) {
  2188. // merge adjacent text nodes
  2189. res[lastIndex] = createTextVNode(last.text + c.text);
  2190. } else {
  2191. // default key for nested array children (likely generated by v-for)
  2192. if (isTrue(children._isVList) &&
  2193. isDef(c.tag) &&
  2194. isUndef(c.key) &&
  2195. isDef(nestedIndex)) {
  2196. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  2197. }
  2198. res.push(c);
  2199. }
  2200. }
  2201. }
  2202. return res
  2203. }
  2204. /* */
  2205. function initProvide (vm) {
  2206. var provide = vm.$options.provide;
  2207. if (provide) {
  2208. vm._provided = typeof provide === 'function'
  2209. ? provide.call(vm)
  2210. : provide;
  2211. }
  2212. }
  2213. function initInjections (vm) {
  2214. var result = resolveInject(vm.$options.inject, vm);
  2215. if (result) {
  2216. toggleObserving(false);
  2217. Object.keys(result).forEach(function (key) {
  2218. /* istanbul ignore else */
  2219. if (process.env.NODE_ENV !== 'production') {
  2220. defineReactive$$1(vm, key, result[key], function () {
  2221. warn(
  2222. "Avoid mutating an injected value directly since the changes will be " +
  2223. "overwritten whenever the provided component re-renders. " +
  2224. "injection being mutated: \"" + key + "\"",
  2225. vm
  2226. );
  2227. });
  2228. } else {
  2229. defineReactive$$1(vm, key, result[key]);
  2230. }
  2231. });
  2232. toggleObserving(true);
  2233. }
  2234. }
  2235. function resolveInject (inject, vm) {
  2236. if (inject) {
  2237. // inject is :any because flow is not smart enough to figure out cached
  2238. var result = Object.create(null);
  2239. var keys = hasSymbol
  2240. ? Reflect.ownKeys(inject)
  2241. : Object.keys(inject);
  2242. for (var i = 0; i < keys.length; i++) {
  2243. var key = keys[i];
  2244. // #6574 in case the inject object is observed...
  2245. if (key === '__ob__') { continue }
  2246. var provideKey = inject[key].from;
  2247. var source = vm;
  2248. while (source) {
  2249. if (source._provided && hasOwn(source._provided, provideKey)) {
  2250. result[key] = source._provided[provideKey];
  2251. break
  2252. }
  2253. source = source.$parent;
  2254. }
  2255. if (!source) {
  2256. if ('default' in inject[key]) {
  2257. var provideDefault = inject[key].default;
  2258. result[key] = typeof provideDefault === 'function'
  2259. ? provideDefault.call(vm)
  2260. : provideDefault;
  2261. } else if (process.env.NODE_ENV !== 'production') {
  2262. warn(("Injection \"" + key + "\" not found"), vm);
  2263. }
  2264. }
  2265. }
  2266. return result
  2267. }
  2268. }
  2269. /* */
  2270. /**
  2271. * Runtime helper for resolving raw children VNodes into a slot object.
  2272. */
  2273. function resolveSlots (
  2274. children,
  2275. context
  2276. ) {
  2277. if (!children || !children.length) {
  2278. return {}
  2279. }
  2280. var slots = {};
  2281. for (var i = 0, l = children.length; i < l; i++) {
  2282. var child = children[i];
  2283. var data = child.data;
  2284. // remove slot attribute if the node is resolved as a Vue slot node
  2285. if (data && data.attrs && data.attrs.slot) {
  2286. delete data.attrs.slot;
  2287. }
  2288. // named slots should only be respected if the vnode was rendered in the
  2289. // same context.
  2290. if ((child.context === context || child.fnContext === context) &&
  2291. data && data.slot != null
  2292. ) {
  2293. var name = data.slot;
  2294. var slot = (slots[name] || (slots[name] = []));
  2295. if (child.tag === 'template') {
  2296. slot.push.apply(slot, child.children || []);
  2297. } else {
  2298. slot.push(child);
  2299. }
  2300. } else {
  2301. (slots.default || (slots.default = [])).push(child);
  2302. }
  2303. }
  2304. // ignore slots that contains only whitespace
  2305. for (var name$1 in slots) {
  2306. if (slots[name$1].every(isWhitespace)) {
  2307. delete slots[name$1];
  2308. }
  2309. }
  2310. return slots
  2311. }
  2312. function isWhitespace (node) {
  2313. return (node.isComment && !node.asyncFactory) || node.text === ' '
  2314. }
  2315. /* */
  2316. function isAsyncPlaceholder (node) {
  2317. return node.isComment && node.asyncFactory
  2318. }
  2319. /* */
  2320. function normalizeScopedSlots (
  2321. slots,
  2322. normalSlots,
  2323. prevSlots
  2324. ) {
  2325. var res;
  2326. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  2327. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  2328. var key = slots && slots.$key;
  2329. if (!slots) {
  2330. res = {};
  2331. } else if (slots._normalized) {
  2332. // fast path 1: child component re-render only, parent did not change
  2333. return slots._normalized
  2334. } else if (
  2335. isStable &&
  2336. prevSlots &&
  2337. prevSlots !== emptyObject &&
  2338. key === prevSlots.$key &&
  2339. !hasNormalSlots &&
  2340. !prevSlots.$hasNormal
  2341. ) {
  2342. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  2343. // only need to normalize once
  2344. return prevSlots
  2345. } else {
  2346. res = {};
  2347. for (var key$1 in slots) {
  2348. if (slots[key$1] && key$1[0] !== '$') {
  2349. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  2350. }
  2351. }
  2352. }
  2353. // expose normal slots on scopedSlots
  2354. for (var key$2 in normalSlots) {
  2355. if (!(key$2 in res)) {
  2356. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  2357. }
  2358. }
  2359. // avoriaz seems to mock a non-extensible $scopedSlots object
  2360. // and when that is passed down this would cause an error
  2361. if (slots && Object.isExtensible(slots)) {
  2362. (slots)._normalized = res;
  2363. }
  2364. def(res, '$stable', isStable);
  2365. def(res, '$key', key);
  2366. def(res, '$hasNormal', hasNormalSlots);
  2367. return res
  2368. }
  2369. function normalizeScopedSlot(normalSlots, key, fn) {
  2370. var normalized = function () {
  2371. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  2372. res = res && typeof res === 'object' && !Array.isArray(res)
  2373. ? [res] // single vnode
  2374. : normalizeChildren(res);
  2375. var vnode = res && res[0];
  2376. return res && (
  2377. !vnode ||
  2378. (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
  2379. ) ? undefined
  2380. : res
  2381. };
  2382. // this is a slot using the new v-slot syntax without scope. although it is
  2383. // compiled as a scoped slot, render fn users would expect it to be present
  2384. // on this.$slots because the usage is semantically a normal slot.
  2385. if (fn.proxy) {
  2386. Object.defineProperty(normalSlots, key, {
  2387. get: normalized,
  2388. enumerable: true,
  2389. configurable: true
  2390. });
  2391. }
  2392. return normalized
  2393. }
  2394. function proxyNormalSlot(slots, key) {
  2395. return function () { return slots[key]; }
  2396. }
  2397. /* */
  2398. /**
  2399. * Runtime helper for rendering v-for lists.
  2400. */
  2401. function renderList (
  2402. val,
  2403. render
  2404. ) {
  2405. var ret, i, l, keys, key;
  2406. if (Array.isArray(val) || typeof val === 'string') {
  2407. ret = new Array(val.length);
  2408. for (i = 0, l = val.length; i < l; i++) {
  2409. ret[i] = render(val[i], i);
  2410. }
  2411. } else if (typeof val === 'number') {
  2412. ret = new Array(val);
  2413. for (i = 0; i < val; i++) {
  2414. ret[i] = render(i + 1, i);
  2415. }
  2416. } else if (isObject(val)) {
  2417. if (hasSymbol && val[Symbol.iterator]) {
  2418. ret = [];
  2419. var iterator = val[Symbol.iterator]();
  2420. var result = iterator.next();
  2421. while (!result.done) {
  2422. ret.push(render(result.value, ret.length));
  2423. result = iterator.next();
  2424. }
  2425. } else {
  2426. keys = Object.keys(val);
  2427. ret = new Array(keys.length);
  2428. for (i = 0, l = keys.length; i < l; i++) {
  2429. key = keys[i];
  2430. ret[i] = render(val[key], key, i);
  2431. }
  2432. }
  2433. }
  2434. if (!isDef(ret)) {
  2435. ret = [];
  2436. }
  2437. (ret)._isVList = true;
  2438. return ret
  2439. }
  2440. /* */
  2441. /**
  2442. * Runtime helper for rendering <slot>
  2443. */
  2444. function renderSlot (
  2445. name,
  2446. fallbackRender,
  2447. props,
  2448. bindObject
  2449. ) {
  2450. var scopedSlotFn = this.$scopedSlots[name];
  2451. var nodes;
  2452. if (scopedSlotFn) {
  2453. // scoped slot
  2454. props = props || {};
  2455. if (bindObject) {
  2456. if (process.env.NODE_ENV !== 'production' && !isObject(bindObject)) {
  2457. warn('slot v-bind without argument expects an Object', this);
  2458. }
  2459. props = extend(extend({}, bindObject), props);
  2460. }
  2461. nodes =
  2462. scopedSlotFn(props) ||
  2463. (typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender);
  2464. } else {
  2465. nodes =
  2466. this.$slots[name] ||
  2467. (typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender);
  2468. }
  2469. var target = props && props.slot;
  2470. if (target) {
  2471. return this.$createElement('template', { slot: target }, nodes)
  2472. } else {
  2473. return nodes
  2474. }
  2475. }
  2476. /* */
  2477. /**
  2478. * Runtime helper for resolving filters
  2479. */
  2480. function resolveFilter (id) {
  2481. return resolveAsset(this.$options, 'filters', id, true) || identity
  2482. }
  2483. /* */
  2484. function isKeyNotMatch (expect, actual) {
  2485. if (Array.isArray(expect)) {
  2486. return expect.indexOf(actual) === -1
  2487. } else {
  2488. return expect !== actual
  2489. }
  2490. }
  2491. /**
  2492. * Runtime helper for checking keyCodes from config.
  2493. * exposed as Vue.prototype._k
  2494. * passing in eventKeyName as last argument separately for backwards compat
  2495. */
  2496. function checkKeyCodes (
  2497. eventKeyCode,
  2498. key,
  2499. builtInKeyCode,
  2500. eventKeyName,
  2501. builtInKeyName
  2502. ) {
  2503. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  2504. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  2505. return isKeyNotMatch(builtInKeyName, eventKeyName)
  2506. } else if (mappedKeyCode) {
  2507. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  2508. } else if (eventKeyName) {
  2509. return hyphenate(eventKeyName) !== key
  2510. }
  2511. return eventKeyCode === undefined
  2512. }
  2513. /* */
  2514. /**
  2515. * Runtime helper for merging v-bind="object" into a VNode's data.
  2516. */
  2517. function bindObjectProps (
  2518. data,
  2519. tag,
  2520. value,
  2521. asProp,
  2522. isSync
  2523. ) {
  2524. if (value) {
  2525. if (!isObject(value)) {
  2526. process.env.NODE_ENV !== 'production' && warn(
  2527. 'v-bind without argument expects an Object or Array value',
  2528. this
  2529. );
  2530. } else {
  2531. if (Array.isArray(value)) {
  2532. value = toObject(value);
  2533. }
  2534. var hash;
  2535. var loop = function ( key ) {
  2536. if (
  2537. key === 'class' ||
  2538. key === 'style' ||
  2539. isReservedAttribute(key)
  2540. ) {
  2541. hash = data;
  2542. } else {
  2543. var type = data.attrs && data.attrs.type;
  2544. hash = asProp || config.mustUseProp(tag, type, key)
  2545. ? data.domProps || (data.domProps = {})
  2546. : data.attrs || (data.attrs = {});
  2547. }
  2548. var camelizedKey = camelize(key);
  2549. var hyphenatedKey = hyphenate(key);
  2550. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  2551. hash[key] = value[key];
  2552. if (isSync) {
  2553. var on = data.on || (data.on = {});
  2554. on[("update:" + key)] = function ($event) {
  2555. value[key] = $event;
  2556. };
  2557. }
  2558. }
  2559. };
  2560. for (var key in value) loop( key );
  2561. }
  2562. }
  2563. return data
  2564. }
  2565. /* */
  2566. /**
  2567. * Runtime helper for rendering static trees.
  2568. */
  2569. function renderStatic (
  2570. index,
  2571. isInFor
  2572. ) {
  2573. var cached = this._staticTrees || (this._staticTrees = []);
  2574. var tree = cached[index];
  2575. // if has already-rendered static tree and not inside v-for,
  2576. // we can reuse the same tree.
  2577. if (tree && !isInFor) {
  2578. return tree
  2579. }
  2580. // otherwise, render a fresh tree.
  2581. tree = cached[index] = this.$options.staticRenderFns[index].call(
  2582. this._renderProxy,
  2583. null,
  2584. this // for render fns generated for functional component templates
  2585. );
  2586. markStatic(tree, ("__static__" + index), false);
  2587. return tree
  2588. }
  2589. /**
  2590. * Runtime helper for v-once.
  2591. * Effectively it means marking the node as static with a unique key.
  2592. */
  2593. function markOnce (
  2594. tree,
  2595. index,
  2596. key
  2597. ) {
  2598. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  2599. return tree
  2600. }
  2601. function markStatic (
  2602. tree,
  2603. key,
  2604. isOnce
  2605. ) {
  2606. if (Array.isArray(tree)) {
  2607. for (var i = 0; i < tree.length; i++) {
  2608. if (tree[i] && typeof tree[i] !== 'string') {
  2609. markStaticNode(tree[i], (key + "_" + i), isOnce);
  2610. }
  2611. }
  2612. } else {
  2613. markStaticNode(tree, key, isOnce);
  2614. }
  2615. }
  2616. function markStaticNode (node, key, isOnce) {
  2617. node.isStatic = true;
  2618. node.key = key;
  2619. node.isOnce = isOnce;
  2620. }
  2621. /* */
  2622. function bindObjectListeners (data, value) {
  2623. if (value) {
  2624. if (!isPlainObject(value)) {
  2625. process.env.NODE_ENV !== 'production' && warn(
  2626. 'v-on without argument expects an Object value',
  2627. this
  2628. );
  2629. } else {
  2630. var on = data.on = data.on ? extend({}, data.on) : {};
  2631. for (var key in value) {
  2632. var existing = on[key];
  2633. var ours = value[key];
  2634. on[key] = existing ? [].concat(existing, ours) : ours;
  2635. }
  2636. }
  2637. }
  2638. return data
  2639. }
  2640. /* */
  2641. function resolveScopedSlots (
  2642. fns, // see flow/vnode
  2643. res,
  2644. // the following are added in 2.6
  2645. hasDynamicKeys,
  2646. contentHashKey
  2647. ) {
  2648. res = res || { $stable: !hasDynamicKeys };
  2649. for (var i = 0; i < fns.length; i++) {
  2650. var slot = fns[i];
  2651. if (Array.isArray(slot)) {
  2652. resolveScopedSlots(slot, res, hasDynamicKeys);
  2653. } else if (slot) {
  2654. // marker for reverse proxying v-slot without scope on this.$slots
  2655. if (slot.proxy) {
  2656. slot.fn.proxy = true;
  2657. }
  2658. res[slot.key] = slot.fn;
  2659. }
  2660. }
  2661. if (contentHashKey) {
  2662. (res).$key = contentHashKey;
  2663. }
  2664. return res
  2665. }
  2666. /* */
  2667. function bindDynamicKeys (baseObj, values) {
  2668. for (var i = 0; i < values.length; i += 2) {
  2669. var key = values[i];
  2670. if (typeof key === 'string' && key) {
  2671. baseObj[values[i]] = values[i + 1];
  2672. } else if (process.env.NODE_ENV !== 'production' && key !== '' && key !== null) {
  2673. // null is a special value for explicitly removing a binding
  2674. warn(
  2675. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  2676. this
  2677. );
  2678. }
  2679. }
  2680. return baseObj
  2681. }
  2682. // helper to dynamically append modifier runtime markers to event names.
  2683. // ensure only append when value is already string, otherwise it will be cast
  2684. // to string and cause the type check to miss.
  2685. function prependModifier (value, symbol) {
  2686. return typeof value === 'string' ? symbol + value : value
  2687. }
  2688. /* */
  2689. function installRenderHelpers (target) {
  2690. target._o = markOnce;
  2691. target._n = toNumber;
  2692. target._s = toString;
  2693. target._l = renderList;
  2694. target._t = renderSlot;
  2695. target._q = looseEqual;
  2696. target._i = looseIndexOf;
  2697. target._m = renderStatic;
  2698. target._f = resolveFilter;
  2699. target._k = checkKeyCodes;
  2700. target._b = bindObjectProps;
  2701. target._v = createTextVNode;
  2702. target._e = createEmptyVNode;
  2703. target._u = resolveScopedSlots;
  2704. target._g = bindObjectListeners;
  2705. target._d = bindDynamicKeys;
  2706. target._p = prependModifier;
  2707. }
  2708. /* */
  2709. function FunctionalRenderContext (
  2710. data,
  2711. props,
  2712. children,
  2713. parent,
  2714. Ctor
  2715. ) {
  2716. var this$1 = this;
  2717. var options = Ctor.options;
  2718. // ensure the createElement function in functional components
  2719. // gets a unique context - this is necessary for correct named slot check
  2720. var contextVm;
  2721. if (hasOwn(parent, '_uid')) {
  2722. contextVm = Object.create(parent);
  2723. // $flow-disable-line
  2724. contextVm._original = parent;
  2725. } else {
  2726. // the context vm passed in is a functional context as well.
  2727. // in this case we want to make sure we are able to get a hold to the
  2728. // real context instance.
  2729. contextVm = parent;
  2730. // $flow-disable-line
  2731. parent = parent._original;
  2732. }
  2733. var isCompiled = isTrue(options._compiled);
  2734. var needNormalization = !isCompiled;
  2735. this.data = data;
  2736. this.props = props;
  2737. this.children = children;
  2738. this.parent = parent;
  2739. this.listeners = data.on || emptyObject;
  2740. this.injections = resolveInject(options.inject, parent);
  2741. this.slots = function () {
  2742. if (!this$1.$slots) {
  2743. normalizeScopedSlots(
  2744. data.scopedSlots,
  2745. this$1.$slots = resolveSlots(children, parent)
  2746. );
  2747. }
  2748. return this$1.$slots
  2749. };
  2750. Object.defineProperty(this, 'scopedSlots', ({
  2751. enumerable: true,
  2752. get: function get () {
  2753. return normalizeScopedSlots(data.scopedSlots, this.slots())
  2754. }
  2755. }));
  2756. // support for compiled functional template
  2757. if (isCompiled) {
  2758. // exposing $options for renderStatic()
  2759. this.$options = options;
  2760. // pre-resolve slots for renderSlot()
  2761. this.$slots = this.slots();
  2762. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  2763. }
  2764. if (options._scopeId) {
  2765. this._c = function (a, b, c, d) {
  2766. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  2767. if (vnode && !Array.isArray(vnode)) {
  2768. vnode.fnScopeId = options._scopeId;
  2769. vnode.fnContext = parent;
  2770. }
  2771. return vnode
  2772. };
  2773. } else {
  2774. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  2775. }
  2776. }
  2777. installRenderHelpers(FunctionalRenderContext.prototype);
  2778. function createFunctionalComponent (
  2779. Ctor,
  2780. propsData,
  2781. data,
  2782. contextVm,
  2783. children
  2784. ) {
  2785. var options = Ctor.options;
  2786. var props = {};
  2787. var propOptions = options.props;
  2788. if (isDef(propOptions)) {
  2789. for (var key in propOptions) {
  2790. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  2791. }
  2792. } else {
  2793. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  2794. if (isDef(data.props)) { mergeProps(props, data.props); }
  2795. }
  2796. var renderContext = new FunctionalRenderContext(
  2797. data,
  2798. props,
  2799. children,
  2800. contextVm,
  2801. Ctor
  2802. );
  2803. var vnode = options.render.call(null, renderContext._c, renderContext);
  2804. if (vnode instanceof VNode) {
  2805. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  2806. } else if (Array.isArray(vnode)) {
  2807. var vnodes = normalizeChildren(vnode) || [];
  2808. var res = new Array(vnodes.length);
  2809. for (var i = 0; i < vnodes.length; i++) {
  2810. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  2811. }
  2812. return res
  2813. }
  2814. }
  2815. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  2816. // #7817 clone node before setting fnContext, otherwise if the node is reused
  2817. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  2818. // that should not be matched to match.
  2819. var clone = cloneVNode(vnode);
  2820. clone.fnContext = contextVm;
  2821. clone.fnOptions = options;
  2822. if (process.env.NODE_ENV !== 'production') {
  2823. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  2824. }
  2825. if (data.slot) {
  2826. (clone.data || (clone.data = {})).slot = data.slot;
  2827. }
  2828. return clone
  2829. }
  2830. function mergeProps (to, from) {
  2831. for (var key in from) {
  2832. to[camelize(key)] = from[key];
  2833. }
  2834. }
  2835. /* */
  2836. /* */
  2837. /* */
  2838. /* */
  2839. // inline hooks to be invoked on component VNodes during patch
  2840. var componentVNodeHooks = {
  2841. init: function init (vnode, hydrating) {
  2842. if (
  2843. vnode.componentInstance &&
  2844. !vnode.componentInstance._isDestroyed &&
  2845. vnode.data.keepAlive
  2846. ) {
  2847. // kept-alive components, treat as a patch
  2848. var mountedNode = vnode; // work around flow
  2849. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  2850. } else {
  2851. var child = vnode.componentInstance = createComponentInstanceForVnode(
  2852. vnode,
  2853. activeInstance
  2854. );
  2855. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  2856. }
  2857. },
  2858. prepatch: function prepatch (oldVnode, vnode) {
  2859. var options = vnode.componentOptions;
  2860. var child = vnode.componentInstance = oldVnode.componentInstance;
  2861. updateChildComponent(
  2862. child,
  2863. options.propsData, // updated props
  2864. options.listeners, // updated listeners
  2865. vnode, // new parent vnode
  2866. options.children // new children
  2867. );
  2868. },
  2869. insert: function insert (vnode) {
  2870. var context = vnode.context;
  2871. var componentInstance = vnode.componentInstance;
  2872. if (!componentInstance._isMounted) {
  2873. componentInstance._isMounted = true;
  2874. callHook(componentInstance, 'mounted');
  2875. }
  2876. if (vnode.data.keepAlive) {
  2877. if (context._isMounted) {
  2878. // vue-router#1212
  2879. // During updates, a kept-alive component's child components may
  2880. // change, so directly walking the tree here may call activated hooks
  2881. // on incorrect children. Instead we push them into a queue which will
  2882. // be processed after the whole patch process ended.
  2883. queueActivatedComponent(componentInstance);
  2884. } else {
  2885. activateChildComponent(componentInstance, true /* direct */);
  2886. }
  2887. }
  2888. },
  2889. destroy: function destroy (vnode) {
  2890. var componentInstance = vnode.componentInstance;
  2891. if (!componentInstance._isDestroyed) {
  2892. if (!vnode.data.keepAlive) {
  2893. componentInstance.$destroy();
  2894. } else {
  2895. deactivateChildComponent(componentInstance, true /* direct */);
  2896. }
  2897. }
  2898. }
  2899. };
  2900. var hooksToMerge = Object.keys(componentVNodeHooks);
  2901. function createComponent (
  2902. Ctor,
  2903. data,
  2904. context,
  2905. children,
  2906. tag
  2907. ) {
  2908. if (isUndef(Ctor)) {
  2909. return
  2910. }
  2911. var baseCtor = context.$options._base;
  2912. // plain options object: turn it into a constructor
  2913. if (isObject(Ctor)) {
  2914. Ctor = baseCtor.extend(Ctor);
  2915. }
  2916. // if at this stage it's not a constructor or an async component factory,
  2917. // reject.
  2918. if (typeof Ctor !== 'function') {
  2919. if (process.env.NODE_ENV !== 'production') {
  2920. warn(("Invalid Component definition: " + (String(Ctor))), context);
  2921. }
  2922. return
  2923. }
  2924. // async component
  2925. var asyncFactory;
  2926. if (isUndef(Ctor.cid)) {
  2927. asyncFactory = Ctor;
  2928. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  2929. if (Ctor === undefined) {
  2930. // return a placeholder node for async component, which is rendered
  2931. // as a comment node but preserves all the raw information for the node.
  2932. // the information will be used for async server-rendering and hydration.
  2933. return createAsyncPlaceholder(
  2934. asyncFactory,
  2935. data,
  2936. context,
  2937. children,
  2938. tag
  2939. )
  2940. }
  2941. }
  2942. data = data || {};
  2943. // resolve constructor options in case global mixins are applied after
  2944. // component constructor creation
  2945. resolveConstructorOptions(Ctor);
  2946. // transform component v-model data into props & events
  2947. if (isDef(data.model)) {
  2948. transformModel(Ctor.options, data);
  2949. }
  2950. // extract props
  2951. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  2952. // functional component
  2953. if (isTrue(Ctor.options.functional)) {
  2954. return createFunctionalComponent(Ctor, propsData, data, context, children)
  2955. }
  2956. // extract listeners, since these needs to be treated as
  2957. // child component listeners instead of DOM listeners
  2958. var listeners = data.on;
  2959. // replace with listeners with .native modifier
  2960. // so it gets processed during parent component patch.
  2961. data.on = data.nativeOn;
  2962. if (isTrue(Ctor.options.abstract)) {
  2963. // abstract components do not keep anything
  2964. // other than props & listeners & slot
  2965. // work around flow
  2966. var slot = data.slot;
  2967. data = {};
  2968. if (slot) {
  2969. data.slot = slot;
  2970. }
  2971. }
  2972. // install component management hooks onto the placeholder node
  2973. installComponentHooks(data);
  2974. // return a placeholder vnode
  2975. var name = Ctor.options.name || tag;
  2976. var vnode = new VNode(
  2977. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  2978. data, undefined, undefined, undefined, context,
  2979. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  2980. asyncFactory
  2981. );
  2982. return vnode
  2983. }
  2984. function createComponentInstanceForVnode (
  2985. // we know it's MountedComponentVNode but flow doesn't
  2986. vnode,
  2987. // activeInstance in lifecycle state
  2988. parent
  2989. ) {
  2990. var options = {
  2991. _isComponent: true,
  2992. _parentVnode: vnode,
  2993. parent: parent
  2994. };
  2995. // check inline-template render functions
  2996. var inlineTemplate = vnode.data.inlineTemplate;
  2997. if (isDef(inlineTemplate)) {
  2998. options.render = inlineTemplate.render;
  2999. options.staticRenderFns = inlineTemplate.staticRenderFns;
  3000. }
  3001. return new vnode.componentOptions.Ctor(options)
  3002. }
  3003. function installComponentHooks (data) {
  3004. var hooks = data.hook || (data.hook = {});
  3005. for (var i = 0; i < hooksToMerge.length; i++) {
  3006. var key = hooksToMerge[i];
  3007. var existing = hooks[key];
  3008. var toMerge = componentVNodeHooks[key];
  3009. if (existing !== toMerge && !(existing && existing._merged)) {
  3010. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  3011. }
  3012. }
  3013. }
  3014. function mergeHook$1 (f1, f2) {
  3015. var merged = function (a, b) {
  3016. // flow complains about extra args which is why we use any
  3017. f1(a, b);
  3018. f2(a, b);
  3019. };
  3020. merged._merged = true;
  3021. return merged
  3022. }
  3023. // transform component v-model info (value and callback) into
  3024. // prop and event handler respectively.
  3025. function transformModel (options, data) {
  3026. var prop = (options.model && options.model.prop) || 'value';
  3027. var event = (options.model && options.model.event) || 'input'
  3028. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  3029. var on = data.on || (data.on = {});
  3030. var existing = on[event];
  3031. var callback = data.model.callback;
  3032. if (isDef(existing)) {
  3033. if (
  3034. Array.isArray(existing)
  3035. ? existing.indexOf(callback) === -1
  3036. : existing !== callback
  3037. ) {
  3038. on[event] = [callback].concat(existing);
  3039. }
  3040. } else {
  3041. on[event] = callback;
  3042. }
  3043. }
  3044. /* */
  3045. var SIMPLE_NORMALIZE = 1;
  3046. var ALWAYS_NORMALIZE = 2;
  3047. // wrapper function for providing a more flexible interface
  3048. // without getting yelled at by flow
  3049. function createElement (
  3050. context,
  3051. tag,
  3052. data,
  3053. children,
  3054. normalizationType,
  3055. alwaysNormalize
  3056. ) {
  3057. if (Array.isArray(data) || isPrimitive(data)) {
  3058. normalizationType = children;
  3059. children = data;
  3060. data = undefined;
  3061. }
  3062. if (isTrue(alwaysNormalize)) {
  3063. normalizationType = ALWAYS_NORMALIZE;
  3064. }
  3065. return _createElement(context, tag, data, children, normalizationType)
  3066. }
  3067. function _createElement (
  3068. context,
  3069. tag,
  3070. data,
  3071. children,
  3072. normalizationType
  3073. ) {
  3074. if (isDef(data) && isDef((data).__ob__)) {
  3075. process.env.NODE_ENV !== 'production' && warn(
  3076. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  3077. 'Always create fresh vnode data objects in each render!',
  3078. context
  3079. );
  3080. return createEmptyVNode()
  3081. }
  3082. // object syntax in v-bind
  3083. if (isDef(data) && isDef(data.is)) {
  3084. tag = data.is;
  3085. }
  3086. if (!tag) {
  3087. // in case of component :is set to falsy value
  3088. return createEmptyVNode()
  3089. }
  3090. // warn against non-primitive key
  3091. if (process.env.NODE_ENV !== 'production' &&
  3092. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  3093. ) {
  3094. {
  3095. warn(
  3096. 'Avoid using non-primitive value as key, ' +
  3097. 'use string/number value instead.',
  3098. context
  3099. );
  3100. }
  3101. }
  3102. // support single function children as default scoped slot
  3103. if (Array.isArray(children) &&
  3104. typeof children[0] === 'function'
  3105. ) {
  3106. data = data || {};
  3107. data.scopedSlots = { default: children[0] };
  3108. children.length = 0;
  3109. }
  3110. if (normalizationType === ALWAYS_NORMALIZE) {
  3111. children = normalizeChildren(children);
  3112. } else if (normalizationType === SIMPLE_NORMALIZE) {
  3113. children = simpleNormalizeChildren(children);
  3114. }
  3115. var vnode, ns;
  3116. if (typeof tag === 'string') {
  3117. var Ctor;
  3118. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  3119. if (config.isReservedTag(tag)) {
  3120. // platform built-in elements
  3121. if (process.env.NODE_ENV !== 'production' && isDef(data) && isDef(data.nativeOn) && data.tag !== 'component') {
  3122. warn(
  3123. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  3124. context
  3125. );
  3126. }
  3127. vnode = new VNode(
  3128. config.parsePlatformTagName(tag), data, children,
  3129. undefined, undefined, context
  3130. );
  3131. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  3132. // component
  3133. vnode = createComponent(Ctor, data, context, children, tag);
  3134. } else {
  3135. // unknown or unlisted namespaced elements
  3136. // check at runtime because it may get assigned a namespace when its
  3137. // parent normalizes children
  3138. vnode = new VNode(
  3139. tag, data, children,
  3140. undefined, undefined, context
  3141. );
  3142. }
  3143. } else {
  3144. // direct component options / constructor
  3145. vnode = createComponent(tag, data, context, children);
  3146. }
  3147. if (Array.isArray(vnode)) {
  3148. return vnode
  3149. } else if (isDef(vnode)) {
  3150. if (isDef(ns)) { applyNS(vnode, ns); }
  3151. if (isDef(data)) { registerDeepBindings(data); }
  3152. return vnode
  3153. } else {
  3154. return createEmptyVNode()
  3155. }
  3156. }
  3157. function applyNS (vnode, ns, force) {
  3158. vnode.ns = ns;
  3159. if (vnode.tag === 'foreignObject') {
  3160. // use default namespace inside foreignObject
  3161. ns = undefined;
  3162. force = true;
  3163. }
  3164. if (isDef(vnode.children)) {
  3165. for (var i = 0, l = vnode.children.length; i < l; i++) {
  3166. var child = vnode.children[i];
  3167. if (isDef(child.tag) && (
  3168. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  3169. applyNS(child, ns, force);
  3170. }
  3171. }
  3172. }
  3173. }
  3174. // ref #5318
  3175. // necessary to ensure parent re-render when deep bindings like :style and
  3176. // :class are used on slot nodes
  3177. function registerDeepBindings (data) {
  3178. if (isObject(data.style)) {
  3179. traverse(data.style);
  3180. }
  3181. if (isObject(data.class)) {
  3182. traverse(data.class);
  3183. }
  3184. }
  3185. /* */
  3186. function initRender (vm) {
  3187. vm._vnode = null; // the root of the child tree
  3188. vm._staticTrees = null; // v-once cached trees
  3189. var options = vm.$options;
  3190. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  3191. var renderContext = parentVnode && parentVnode.context;
  3192. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  3193. vm.$scopedSlots = emptyObject;
  3194. // bind the createElement fn to this instance
  3195. // so that we get proper render context inside it.
  3196. // args order: tag, data, children, normalizationType, alwaysNormalize
  3197. // internal version is used by render functions compiled from templates
  3198. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  3199. // normalization is always applied for the public version, used in
  3200. // user-written render functions.
  3201. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  3202. // $attrs & $listeners are exposed for easier HOC creation.
  3203. // they need to be reactive so that HOCs using them are always updated
  3204. var parentData = parentVnode && parentVnode.data;
  3205. /* istanbul ignore else */
  3206. if (process.env.NODE_ENV !== 'production') {
  3207. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  3208. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  3209. }, true);
  3210. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  3211. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  3212. }, true);
  3213. } else {
  3214. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true);
  3215. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, null, true);
  3216. }
  3217. }
  3218. var currentRenderingInstance = null;
  3219. function renderMixin (Vue) {
  3220. // install runtime convenience helpers
  3221. installRenderHelpers(Vue.prototype);
  3222. Vue.prototype.$nextTick = function (fn) {
  3223. return nextTick(fn, this)
  3224. };
  3225. Vue.prototype._render = function () {
  3226. var vm = this;
  3227. var ref = vm.$options;
  3228. var render = ref.render;
  3229. var _parentVnode = ref._parentVnode;
  3230. if (_parentVnode) {
  3231. vm.$scopedSlots = normalizeScopedSlots(
  3232. _parentVnode.data.scopedSlots,
  3233. vm.$slots,
  3234. vm.$scopedSlots
  3235. );
  3236. }
  3237. // set parent vnode. this allows render functions to have access
  3238. // to the data on the placeholder node.
  3239. vm.$vnode = _parentVnode;
  3240. // render self
  3241. var vnode;
  3242. try {
  3243. // There's no need to maintain a stack because all render fns are called
  3244. // separately from one another. Nested component's render fns are called
  3245. // when parent component is patched.
  3246. currentRenderingInstance = vm;
  3247. vnode = render.call(vm._renderProxy, vm.$createElement);
  3248. } catch (e) {
  3249. handleError(e, vm, "render");
  3250. // return error render result,
  3251. // or previous vnode to prevent render error causing blank component
  3252. /* istanbul ignore else */
  3253. if (process.env.NODE_ENV !== 'production' && vm.$options.renderError) {
  3254. try {
  3255. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  3256. } catch (e) {
  3257. handleError(e, vm, "renderError");
  3258. vnode = vm._vnode;
  3259. }
  3260. } else {
  3261. vnode = vm._vnode;
  3262. }
  3263. } finally {
  3264. currentRenderingInstance = null;
  3265. }
  3266. // if the returned array contains only a single node, allow it
  3267. if (Array.isArray(vnode) && vnode.length === 1) {
  3268. vnode = vnode[0];
  3269. }
  3270. // return empty vnode in case the render function errored out
  3271. if (!(vnode instanceof VNode)) {
  3272. if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) {
  3273. warn(
  3274. 'Multiple root nodes returned from render function. Render function ' +
  3275. 'should return a single root node.',
  3276. vm
  3277. );
  3278. }
  3279. vnode = createEmptyVNode();
  3280. }
  3281. // set parent
  3282. vnode.parent = _parentVnode;
  3283. return vnode
  3284. };
  3285. }
  3286. /* */
  3287. function ensureCtor (comp, base) {
  3288. if (
  3289. comp.__esModule ||
  3290. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  3291. ) {
  3292. comp = comp.default;
  3293. }
  3294. return isObject(comp)
  3295. ? base.extend(comp)
  3296. : comp
  3297. }
  3298. function createAsyncPlaceholder (
  3299. factory,
  3300. data,
  3301. context,
  3302. children,
  3303. tag
  3304. ) {
  3305. var node = createEmptyVNode();
  3306. node.asyncFactory = factory;
  3307. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  3308. return node
  3309. }
  3310. function resolveAsyncComponent (
  3311. factory,
  3312. baseCtor
  3313. ) {
  3314. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  3315. return factory.errorComp
  3316. }
  3317. if (isDef(factory.resolved)) {
  3318. return factory.resolved
  3319. }
  3320. var owner = currentRenderingInstance;
  3321. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  3322. // already pending
  3323. factory.owners.push(owner);
  3324. }
  3325. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  3326. return factory.loadingComp
  3327. }
  3328. if (owner && !isDef(factory.owners)) {
  3329. var owners = factory.owners = [owner];
  3330. var sync = true;
  3331. var timerLoading = null;
  3332. var timerTimeout = null
  3333. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  3334. var forceRender = function (renderCompleted) {
  3335. for (var i = 0, l = owners.length; i < l; i++) {
  3336. (owners[i]).$forceUpdate();
  3337. }
  3338. if (renderCompleted) {
  3339. owners.length = 0;
  3340. if (timerLoading !== null) {
  3341. clearTimeout(timerLoading);
  3342. timerLoading = null;
  3343. }
  3344. if (timerTimeout !== null) {
  3345. clearTimeout(timerTimeout);
  3346. timerTimeout = null;
  3347. }
  3348. }
  3349. };
  3350. var resolve = once(function (res) {
  3351. // cache resolved
  3352. factory.resolved = ensureCtor(res, baseCtor);
  3353. // invoke callbacks only if this is not a synchronous resolve
  3354. // (async resolves are shimmed as synchronous during SSR)
  3355. if (!sync) {
  3356. forceRender(true);
  3357. } else {
  3358. owners.length = 0;
  3359. }
  3360. });
  3361. var reject = once(function (reason) {
  3362. process.env.NODE_ENV !== 'production' && warn(
  3363. "Failed to resolve async component: " + (String(factory)) +
  3364. (reason ? ("\nReason: " + reason) : '')
  3365. );
  3366. if (isDef(factory.errorComp)) {
  3367. factory.error = true;
  3368. forceRender(true);
  3369. }
  3370. });
  3371. var res = factory(resolve, reject);
  3372. if (isObject(res)) {
  3373. if (isPromise(res)) {
  3374. // () => Promise
  3375. if (isUndef(factory.resolved)) {
  3376. res.then(resolve, reject);
  3377. }
  3378. } else if (isPromise(res.component)) {
  3379. res.component.then(resolve, reject);
  3380. if (isDef(res.error)) {
  3381. factory.errorComp = ensureCtor(res.error, baseCtor);
  3382. }
  3383. if (isDef(res.loading)) {
  3384. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  3385. if (res.delay === 0) {
  3386. factory.loading = true;
  3387. } else {
  3388. timerLoading = setTimeout(function () {
  3389. timerLoading = null;
  3390. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  3391. factory.loading = true;
  3392. forceRender(false);
  3393. }
  3394. }, res.delay || 200);
  3395. }
  3396. }
  3397. if (isDef(res.timeout)) {
  3398. timerTimeout = setTimeout(function () {
  3399. timerTimeout = null;
  3400. if (isUndef(factory.resolved)) {
  3401. reject(
  3402. process.env.NODE_ENV !== 'production'
  3403. ? ("timeout (" + (res.timeout) + "ms)")
  3404. : null
  3405. );
  3406. }
  3407. }, res.timeout);
  3408. }
  3409. }
  3410. }
  3411. sync = false;
  3412. // return in case resolved synchronously
  3413. return factory.loading
  3414. ? factory.loadingComp
  3415. : factory.resolved
  3416. }
  3417. }
  3418. /* */
  3419. function getFirstComponentChild (children) {
  3420. if (Array.isArray(children)) {
  3421. for (var i = 0; i < children.length; i++) {
  3422. var c = children[i];
  3423. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  3424. return c
  3425. }
  3426. }
  3427. }
  3428. }
  3429. /* */
  3430. /* */
  3431. function initEvents (vm) {
  3432. vm._events = Object.create(null);
  3433. vm._hasHookEvent = false;
  3434. // init parent attached events
  3435. var listeners = vm.$options._parentListeners;
  3436. if (listeners) {
  3437. updateComponentListeners(vm, listeners);
  3438. }
  3439. }
  3440. var target;
  3441. function add (event, fn) {
  3442. target.$on(event, fn);
  3443. }
  3444. function remove$1 (event, fn) {
  3445. target.$off(event, fn);
  3446. }
  3447. function createOnceHandler (event, fn) {
  3448. var _target = target;
  3449. return function onceHandler () {
  3450. var res = fn.apply(null, arguments);
  3451. if (res !== null) {
  3452. _target.$off(event, onceHandler);
  3453. }
  3454. }
  3455. }
  3456. function updateComponentListeners (
  3457. vm,
  3458. listeners,
  3459. oldListeners
  3460. ) {
  3461. target = vm;
  3462. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  3463. target = undefined;
  3464. }
  3465. function eventsMixin (Vue) {
  3466. var hookRE = /^hook:/;
  3467. Vue.prototype.$on = function (event, fn) {
  3468. var vm = this;
  3469. if (Array.isArray(event)) {
  3470. for (var i = 0, l = event.length; i < l; i++) {
  3471. vm.$on(event[i], fn);
  3472. }
  3473. } else {
  3474. (vm._events[event] || (vm._events[event] = [])).push(fn);
  3475. // optimize hook:event cost by using a boolean flag marked at registration
  3476. // instead of a hash lookup
  3477. if (hookRE.test(event)) {
  3478. vm._hasHookEvent = true;
  3479. }
  3480. }
  3481. return vm
  3482. };
  3483. Vue.prototype.$once = function (event, fn) {
  3484. var vm = this;
  3485. function on () {
  3486. vm.$off(event, on);
  3487. fn.apply(vm, arguments);
  3488. }
  3489. on.fn = fn;
  3490. vm.$on(event, on);
  3491. return vm
  3492. };
  3493. Vue.prototype.$off = function (event, fn) {
  3494. var vm = this;
  3495. // all
  3496. if (!arguments.length) {
  3497. vm._events = Object.create(null);
  3498. return vm
  3499. }
  3500. // array of events
  3501. if (Array.isArray(event)) {
  3502. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  3503. vm.$off(event[i$1], fn);
  3504. }
  3505. return vm
  3506. }
  3507. // specific event
  3508. var cbs = vm._events[event];
  3509. if (!cbs) {
  3510. return vm
  3511. }
  3512. if (!fn) {
  3513. vm._events[event] = null;
  3514. return vm
  3515. }
  3516. // specific handler
  3517. var cb;
  3518. var i = cbs.length;
  3519. while (i--) {
  3520. cb = cbs[i];
  3521. if (cb === fn || cb.fn === fn) {
  3522. cbs.splice(i, 1);
  3523. break
  3524. }
  3525. }
  3526. return vm
  3527. };
  3528. Vue.prototype.$emit = function (event) {
  3529. var vm = this;
  3530. if (process.env.NODE_ENV !== 'production') {
  3531. var lowerCaseEvent = event.toLowerCase();
  3532. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  3533. tip(
  3534. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  3535. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  3536. "Note that HTML attributes are case-insensitive and you cannot use " +
  3537. "v-on to listen to camelCase events when using in-DOM templates. " +
  3538. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  3539. );
  3540. }
  3541. }
  3542. var cbs = vm._events[event];
  3543. if (cbs) {
  3544. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  3545. var args = toArray(arguments, 1);
  3546. var info = "event handler for \"" + event + "\"";
  3547. for (var i = 0, l = cbs.length; i < l; i++) {
  3548. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  3549. }
  3550. }
  3551. return vm
  3552. };
  3553. }
  3554. /* */
  3555. var activeInstance = null;
  3556. var isUpdatingChildComponent = false;
  3557. function setActiveInstance(vm) {
  3558. var prevActiveInstance = activeInstance;
  3559. activeInstance = vm;
  3560. return function () {
  3561. activeInstance = prevActiveInstance;
  3562. }
  3563. }
  3564. function initLifecycle (vm) {
  3565. var options = vm.$options;
  3566. // locate first non-abstract parent
  3567. var parent = options.parent;
  3568. if (parent && !options.abstract) {
  3569. while (parent.$options.abstract && parent.$parent) {
  3570. parent = parent.$parent;
  3571. }
  3572. parent.$children.push(vm);
  3573. }
  3574. vm.$parent = parent;
  3575. vm.$root = parent ? parent.$root : vm;
  3576. vm.$children = [];
  3577. vm.$refs = {};
  3578. vm._watcher = null;
  3579. vm._inactive = null;
  3580. vm._directInactive = false;
  3581. vm._isMounted = false;
  3582. vm._isDestroyed = false;
  3583. vm._isBeingDestroyed = false;
  3584. }
  3585. function lifecycleMixin (Vue) {
  3586. Vue.prototype._update = function (vnode, hydrating) {
  3587. var vm = this;
  3588. var prevEl = vm.$el;
  3589. var prevVnode = vm._vnode;
  3590. var restoreActiveInstance = setActiveInstance(vm);
  3591. vm._vnode = vnode;
  3592. // Vue.prototype.__patch__ is injected in entry points
  3593. // based on the rendering backend used.
  3594. if (!prevVnode) {
  3595. // initial render
  3596. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  3597. } else {
  3598. // updates
  3599. vm.$el = vm.__patch__(prevVnode, vnode);
  3600. }
  3601. restoreActiveInstance();
  3602. // update __vue__ reference
  3603. if (prevEl) {
  3604. prevEl.__vue__ = null;
  3605. }
  3606. if (vm.$el) {
  3607. vm.$el.__vue__ = vm;
  3608. }
  3609. // if parent is an HOC, update its $el as well
  3610. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  3611. vm.$parent.$el = vm.$el;
  3612. }
  3613. // updated hook is called by the scheduler to ensure that children are
  3614. // updated in a parent's updated hook.
  3615. };
  3616. Vue.prototype.$forceUpdate = function () {
  3617. var vm = this;
  3618. if (vm._watcher) {
  3619. vm._watcher.update();
  3620. }
  3621. };
  3622. Vue.prototype.$destroy = function () {
  3623. var vm = this;
  3624. if (vm._isBeingDestroyed) {
  3625. return
  3626. }
  3627. callHook(vm, 'beforeDestroy');
  3628. vm._isBeingDestroyed = true;
  3629. // remove self from parent
  3630. var parent = vm.$parent;
  3631. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  3632. remove(parent.$children, vm);
  3633. }
  3634. // teardown watchers
  3635. if (vm._watcher) {
  3636. vm._watcher.teardown();
  3637. }
  3638. var i = vm._watchers.length;
  3639. while (i--) {
  3640. vm._watchers[i].teardown();
  3641. }
  3642. // remove reference from data ob
  3643. // frozen object may not have observer.
  3644. if (vm._data.__ob__) {
  3645. vm._data.__ob__.vmCount--;
  3646. }
  3647. // call the last hook...
  3648. vm._isDestroyed = true;
  3649. // invoke destroy hooks on current rendered tree
  3650. vm.__patch__(vm._vnode, null);
  3651. // fire destroyed hook
  3652. callHook(vm, 'destroyed');
  3653. // turn off all instance listeners.
  3654. vm.$off();
  3655. // remove __vue__ reference
  3656. if (vm.$el) {
  3657. vm.$el.__vue__ = null;
  3658. }
  3659. // release circular reference (#6759)
  3660. if (vm.$vnode) {
  3661. vm.$vnode.parent = null;
  3662. }
  3663. };
  3664. }
  3665. function mountComponent (
  3666. vm,
  3667. el,
  3668. hydrating
  3669. ) {
  3670. vm.$el = el;
  3671. if (!vm.$options.render) {
  3672. vm.$options.render = createEmptyVNode;
  3673. if (process.env.NODE_ENV !== 'production') {
  3674. /* istanbul ignore if */
  3675. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  3676. vm.$options.el || el) {
  3677. warn(
  3678. 'You are using the runtime-only build of Vue where the template ' +
  3679. 'compiler is not available. Either pre-compile the templates into ' +
  3680. 'render functions, or use the compiler-included build.',
  3681. vm
  3682. );
  3683. } else {
  3684. warn(
  3685. 'Failed to mount component: template or render function not defined.',
  3686. vm
  3687. );
  3688. }
  3689. }
  3690. }
  3691. callHook(vm, 'beforeMount');
  3692. var updateComponent;
  3693. /* istanbul ignore if */
  3694. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  3695. updateComponent = function () {
  3696. var name = vm._name;
  3697. var id = vm._uid;
  3698. var startTag = "vue-perf-start:" + id;
  3699. var endTag = "vue-perf-end:" + id;
  3700. mark(startTag);
  3701. var vnode = vm._render();
  3702. mark(endTag);
  3703. measure(("vue " + name + " render"), startTag, endTag);
  3704. mark(startTag);
  3705. vm._update(vnode, hydrating);
  3706. mark(endTag);
  3707. measure(("vue " + name + " patch"), startTag, endTag);
  3708. };
  3709. } else {
  3710. updateComponent = function () {
  3711. vm._update(vm._render(), hydrating);
  3712. };
  3713. }
  3714. // we set this to vm._watcher inside the watcher's constructor
  3715. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  3716. // component's mounted hook), which relies on vm._watcher being already defined
  3717. new Watcher(vm, updateComponent, noop, {
  3718. before: function before () {
  3719. if (vm._isMounted && !vm._isDestroyed) {
  3720. callHook(vm, 'beforeUpdate');
  3721. }
  3722. }
  3723. }, true /* isRenderWatcher */);
  3724. hydrating = false;
  3725. // manually mounted instance, call mounted on self
  3726. // mounted is called for render-created child components in its inserted hook
  3727. if (vm.$vnode == null) {
  3728. vm._isMounted = true;
  3729. callHook(vm, 'mounted');
  3730. }
  3731. return vm
  3732. }
  3733. function updateChildComponent (
  3734. vm,
  3735. propsData,
  3736. listeners,
  3737. parentVnode,
  3738. renderChildren
  3739. ) {
  3740. if (process.env.NODE_ENV !== 'production') {
  3741. isUpdatingChildComponent = true;
  3742. }
  3743. // determine whether component has slot children
  3744. // we need to do this before overwriting $options._renderChildren.
  3745. // check if there are dynamic scopedSlots (hand-written or compiled but with
  3746. // dynamic slot names). Static scoped slots compiled from template has the
  3747. // "$stable" marker.
  3748. var newScopedSlots = parentVnode.data.scopedSlots;
  3749. var oldScopedSlots = vm.$scopedSlots;
  3750. var hasDynamicScopedSlot = !!(
  3751. (newScopedSlots && !newScopedSlots.$stable) ||
  3752. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  3753. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
  3754. (!newScopedSlots && vm.$scopedSlots.$key)
  3755. );
  3756. // Any static slot children from the parent may have changed during parent's
  3757. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  3758. // update is necessary to ensure correctness.
  3759. var needsForceUpdate = !!(
  3760. renderChildren || // has new static slots
  3761. vm.$options._renderChildren || // has old static slots
  3762. hasDynamicScopedSlot
  3763. );
  3764. vm.$options._parentVnode = parentVnode;
  3765. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  3766. if (vm._vnode) { // update child tree's parent
  3767. vm._vnode.parent = parentVnode;
  3768. }
  3769. vm.$options._renderChildren = renderChildren;
  3770. // update $attrs and $listeners hash
  3771. // these are also reactive so they may trigger child update if the child
  3772. // used them during render
  3773. vm.$attrs = parentVnode.data.attrs || emptyObject;
  3774. vm.$listeners = listeners || emptyObject;
  3775. // update props
  3776. if (propsData && vm.$options.props) {
  3777. toggleObserving(false);
  3778. var props = vm._props;
  3779. var propKeys = vm.$options._propKeys || [];
  3780. for (var i = 0; i < propKeys.length; i++) {
  3781. var key = propKeys[i];
  3782. var propOptions = vm.$options.props; // wtf flow?
  3783. props[key] = validateProp(key, propOptions, propsData, vm);
  3784. }
  3785. toggleObserving(true);
  3786. // keep a copy of raw propsData
  3787. vm.$options.propsData = propsData;
  3788. }
  3789. // update listeners
  3790. listeners = listeners || emptyObject;
  3791. var oldListeners = vm.$options._parentListeners;
  3792. vm.$options._parentListeners = listeners;
  3793. updateComponentListeners(vm, listeners, oldListeners);
  3794. // resolve slots + force update if has children
  3795. if (needsForceUpdate) {
  3796. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  3797. vm.$forceUpdate();
  3798. }
  3799. if (process.env.NODE_ENV !== 'production') {
  3800. isUpdatingChildComponent = false;
  3801. }
  3802. }
  3803. function isInInactiveTree (vm) {
  3804. while (vm && (vm = vm.$parent)) {
  3805. if (vm._inactive) { return true }
  3806. }
  3807. return false
  3808. }
  3809. function activateChildComponent (vm, direct) {
  3810. if (direct) {
  3811. vm._directInactive = false;
  3812. if (isInInactiveTree(vm)) {
  3813. return
  3814. }
  3815. } else if (vm._directInactive) {
  3816. return
  3817. }
  3818. if (vm._inactive || vm._inactive === null) {
  3819. vm._inactive = false;
  3820. for (var i = 0; i < vm.$children.length; i++) {
  3821. activateChildComponent(vm.$children[i]);
  3822. }
  3823. callHook(vm, 'activated');
  3824. }
  3825. }
  3826. function deactivateChildComponent (vm, direct) {
  3827. if (direct) {
  3828. vm._directInactive = true;
  3829. if (isInInactiveTree(vm)) {
  3830. return
  3831. }
  3832. }
  3833. if (!vm._inactive) {
  3834. vm._inactive = true;
  3835. for (var i = 0; i < vm.$children.length; i++) {
  3836. deactivateChildComponent(vm.$children[i]);
  3837. }
  3838. callHook(vm, 'deactivated');
  3839. }
  3840. }
  3841. function callHook (vm, hook) {
  3842. // #7573 disable dep collection when invoking lifecycle hooks
  3843. pushTarget();
  3844. var handlers = vm.$options[hook];
  3845. var info = hook + " hook";
  3846. if (handlers) {
  3847. for (var i = 0, j = handlers.length; i < j; i++) {
  3848. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  3849. }
  3850. }
  3851. if (vm._hasHookEvent) {
  3852. vm.$emit('hook:' + hook);
  3853. }
  3854. popTarget();
  3855. }
  3856. /* */
  3857. var MAX_UPDATE_COUNT = 100;
  3858. var queue = [];
  3859. var activatedChildren = [];
  3860. var has = {};
  3861. var circular = {};
  3862. var waiting = false;
  3863. var flushing = false;
  3864. var index = 0;
  3865. /**
  3866. * Reset the scheduler's state.
  3867. */
  3868. function resetSchedulerState () {
  3869. index = queue.length = activatedChildren.length = 0;
  3870. has = {};
  3871. if (process.env.NODE_ENV !== 'production') {
  3872. circular = {};
  3873. }
  3874. waiting = flushing = false;
  3875. }
  3876. // Async edge case #6566 requires saving the timestamp when event listeners are
  3877. // attached. However, calling performance.now() has a perf overhead especially
  3878. // if the page has thousands of event listeners. Instead, we take a timestamp
  3879. // every time the scheduler flushes and use that for all event listeners
  3880. // attached during that flush.
  3881. var currentFlushTimestamp = 0;
  3882. // Async edge case fix requires storing an event listener's attach timestamp.
  3883. var getNow = Date.now;
  3884. // Determine what event timestamp the browser is using. Annoyingly, the
  3885. // timestamp can either be hi-res (relative to page load) or low-res
  3886. // (relative to UNIX epoch), so in order to compare time we have to use the
  3887. // same timestamp type when saving the flush timestamp.
  3888. // All IE versions use low-res event timestamps, and have problematic clock
  3889. // implementations (#9632)
  3890. if (inBrowser && !isIE) {
  3891. var performance = window.performance;
  3892. if (
  3893. performance &&
  3894. typeof performance.now === 'function' &&
  3895. getNow() > document.createEvent('Event').timeStamp
  3896. ) {
  3897. // if the event timestamp, although evaluated AFTER the Date.now(), is
  3898. // smaller than it, it means the event is using a hi-res timestamp,
  3899. // and we need to use the hi-res version for event listener timestamps as
  3900. // well.
  3901. getNow = function () { return performance.now(); };
  3902. }
  3903. }
  3904. /**
  3905. * Flush both queues and run the watchers.
  3906. */
  3907. function flushSchedulerQueue () {
  3908. currentFlushTimestamp = getNow();
  3909. flushing = true;
  3910. var watcher, id;
  3911. // Sort queue before flush.
  3912. // This ensures that:
  3913. // 1. Components are updated from parent to child. (because parent is always
  3914. // created before the child)
  3915. // 2. A component's user watchers are run before its render watcher (because
  3916. // user watchers are created before the render watcher)
  3917. // 3. If a component is destroyed during a parent component's watcher run,
  3918. // its watchers can be skipped.
  3919. queue.sort(function (a, b) { return a.id - b.id; });
  3920. // do not cache length because more watchers might be pushed
  3921. // as we run existing watchers
  3922. for (index = 0; index < queue.length; index++) {
  3923. watcher = queue[index];
  3924. if (watcher.before) {
  3925. watcher.before();
  3926. }
  3927. id = watcher.id;
  3928. has[id] = null;
  3929. watcher.run();
  3930. // in dev build, check and stop circular updates.
  3931. if (process.env.NODE_ENV !== 'production' && has[id] != null) {
  3932. circular[id] = (circular[id] || 0) + 1;
  3933. if (circular[id] > MAX_UPDATE_COUNT) {
  3934. warn(
  3935. 'You may have an infinite update loop ' + (
  3936. watcher.user
  3937. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  3938. : "in a component render function."
  3939. ),
  3940. watcher.vm
  3941. );
  3942. break
  3943. }
  3944. }
  3945. }
  3946. // keep copies of post queues before resetting state
  3947. var activatedQueue = activatedChildren.slice();
  3948. var updatedQueue = queue.slice();
  3949. resetSchedulerState();
  3950. // call component updated and activated hooks
  3951. callActivatedHooks(activatedQueue);
  3952. callUpdatedHooks(updatedQueue);
  3953. // devtool hook
  3954. /* istanbul ignore if */
  3955. if (devtools && config.devtools) {
  3956. devtools.emit('flush');
  3957. }
  3958. }
  3959. function callUpdatedHooks (queue) {
  3960. var i = queue.length;
  3961. while (i--) {
  3962. var watcher = queue[i];
  3963. var vm = watcher.vm;
  3964. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  3965. callHook(vm, 'updated');
  3966. }
  3967. }
  3968. }
  3969. /**
  3970. * Queue a kept-alive component that was activated during patch.
  3971. * The queue will be processed after the entire tree has been patched.
  3972. */
  3973. function queueActivatedComponent (vm) {
  3974. // setting _inactive to false here so that a render function can
  3975. // rely on checking whether it's in an inactive tree (e.g. router-view)
  3976. vm._inactive = false;
  3977. activatedChildren.push(vm);
  3978. }
  3979. function callActivatedHooks (queue) {
  3980. for (var i = 0; i < queue.length; i++) {
  3981. queue[i]._inactive = true;
  3982. activateChildComponent(queue[i], true /* true */);
  3983. }
  3984. }
  3985. /**
  3986. * Push a watcher into the watcher queue.
  3987. * Jobs with duplicate IDs will be skipped unless it's
  3988. * pushed when the queue is being flushed.
  3989. */
  3990. function queueWatcher (watcher) {
  3991. var id = watcher.id;
  3992. if (has[id] == null) {
  3993. has[id] = true;
  3994. if (!flushing) {
  3995. queue.push(watcher);
  3996. } else {
  3997. // if already flushing, splice the watcher based on its id
  3998. // if already past its id, it will be run next immediately.
  3999. var i = queue.length - 1;
  4000. while (i > index && queue[i].id > watcher.id) {
  4001. i--;
  4002. }
  4003. queue.splice(i + 1, 0, watcher);
  4004. }
  4005. // queue the flush
  4006. if (!waiting) {
  4007. waiting = true;
  4008. if (process.env.NODE_ENV !== 'production' && !config.async) {
  4009. flushSchedulerQueue();
  4010. return
  4011. }
  4012. nextTick(flushSchedulerQueue);
  4013. }
  4014. }
  4015. }
  4016. /* */
  4017. var uid$2 = 0;
  4018. /**
  4019. * A watcher parses an expression, collects dependencies,
  4020. * and fires callback when the expression value changes.
  4021. * This is used for both the $watch() api and directives.
  4022. */
  4023. var Watcher = function Watcher (
  4024. vm,
  4025. expOrFn,
  4026. cb,
  4027. options,
  4028. isRenderWatcher
  4029. ) {
  4030. this.vm = vm;
  4031. if (isRenderWatcher) {
  4032. vm._watcher = this;
  4033. }
  4034. vm._watchers.push(this);
  4035. // options
  4036. if (options) {
  4037. this.deep = !!options.deep;
  4038. this.user = !!options.user;
  4039. this.lazy = !!options.lazy;
  4040. this.sync = !!options.sync;
  4041. this.before = options.before;
  4042. } else {
  4043. this.deep = this.user = this.lazy = this.sync = false;
  4044. }
  4045. this.cb = cb;
  4046. this.id = ++uid$2; // uid for batching
  4047. this.active = true;
  4048. this.dirty = this.lazy; // for lazy watchers
  4049. this.deps = [];
  4050. this.newDeps = [];
  4051. this.depIds = new _Set();
  4052. this.newDepIds = new _Set();
  4053. this.expression = process.env.NODE_ENV !== 'production'
  4054. ? expOrFn.toString()
  4055. : '';
  4056. // parse expression for getter
  4057. if (typeof expOrFn === 'function') {
  4058. this.getter = expOrFn;
  4059. } else {
  4060. this.getter = parsePath(expOrFn);
  4061. if (!this.getter) {
  4062. this.getter = noop;
  4063. process.env.NODE_ENV !== 'production' && warn(
  4064. "Failed watching path: \"" + expOrFn + "\" " +
  4065. 'Watcher only accepts simple dot-delimited paths. ' +
  4066. 'For full control, use a function instead.',
  4067. vm
  4068. );
  4069. }
  4070. }
  4071. this.value = this.lazy
  4072. ? undefined
  4073. : this.get();
  4074. };
  4075. /**
  4076. * Evaluate the getter, and re-collect dependencies.
  4077. */
  4078. Watcher.prototype.get = function get () {
  4079. pushTarget(this);
  4080. var value;
  4081. var vm = this.vm;
  4082. try {
  4083. value = this.getter.call(vm, vm);
  4084. } catch (e) {
  4085. if (this.user) {
  4086. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  4087. } else {
  4088. throw e
  4089. }
  4090. } finally {
  4091. // "touch" every property so they are all tracked as
  4092. // dependencies for deep watching
  4093. if (this.deep) {
  4094. traverse(value);
  4095. }
  4096. popTarget();
  4097. this.cleanupDeps();
  4098. }
  4099. return value
  4100. };
  4101. /**
  4102. * Add a dependency to this directive.
  4103. */
  4104. Watcher.prototype.addDep = function addDep (dep) {
  4105. var id = dep.id;
  4106. if (!this.newDepIds.has(id)) {
  4107. this.newDepIds.add(id);
  4108. this.newDeps.push(dep);
  4109. if (!this.depIds.has(id)) {
  4110. dep.addSub(this);
  4111. }
  4112. }
  4113. };
  4114. /**
  4115. * Clean up for dependency collection.
  4116. */
  4117. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  4118. var i = this.deps.length;
  4119. while (i--) {
  4120. var dep = this.deps[i];
  4121. if (!this.newDepIds.has(dep.id)) {
  4122. dep.removeSub(this);
  4123. }
  4124. }
  4125. var tmp = this.depIds;
  4126. this.depIds = this.newDepIds;
  4127. this.newDepIds = tmp;
  4128. this.newDepIds.clear();
  4129. tmp = this.deps;
  4130. this.deps = this.newDeps;
  4131. this.newDeps = tmp;
  4132. this.newDeps.length = 0;
  4133. };
  4134. /**
  4135. * Subscriber interface.
  4136. * Will be called when a dependency changes.
  4137. */
  4138. Watcher.prototype.update = function update () {
  4139. /* istanbul ignore else */
  4140. if (this.lazy) {
  4141. this.dirty = true;
  4142. } else if (this.sync) {
  4143. this.run();
  4144. } else {
  4145. queueWatcher(this);
  4146. }
  4147. };
  4148. /**
  4149. * Scheduler job interface.
  4150. * Will be called by the scheduler.
  4151. */
  4152. Watcher.prototype.run = function run () {
  4153. if (this.active) {
  4154. var value = this.get();
  4155. if (
  4156. value !== this.value ||
  4157. // Deep watchers and watchers on Object/Arrays should fire even
  4158. // when the value is the same, because the value may
  4159. // have mutated.
  4160. isObject(value) ||
  4161. this.deep
  4162. ) {
  4163. // set new value
  4164. var oldValue = this.value;
  4165. this.value = value;
  4166. if (this.user) {
  4167. var info = "callback for watcher \"" + (this.expression) + "\"";
  4168. invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info);
  4169. } else {
  4170. this.cb.call(this.vm, value, oldValue);
  4171. }
  4172. }
  4173. }
  4174. };
  4175. /**
  4176. * Evaluate the value of the watcher.
  4177. * This only gets called for lazy watchers.
  4178. */
  4179. Watcher.prototype.evaluate = function evaluate () {
  4180. this.value = this.get();
  4181. this.dirty = false;
  4182. };
  4183. /**
  4184. * Depend on all deps collected by this watcher.
  4185. */
  4186. Watcher.prototype.depend = function depend () {
  4187. var i = this.deps.length;
  4188. while (i--) {
  4189. this.deps[i].depend();
  4190. }
  4191. };
  4192. /**
  4193. * Remove self from all dependencies' subscriber list.
  4194. */
  4195. Watcher.prototype.teardown = function teardown () {
  4196. if (this.active) {
  4197. // remove self from vm's watcher list
  4198. // this is a somewhat expensive operation so we skip it
  4199. // if the vm is being destroyed.
  4200. if (!this.vm._isBeingDestroyed) {
  4201. remove(this.vm._watchers, this);
  4202. }
  4203. var i = this.deps.length;
  4204. while (i--) {
  4205. this.deps[i].removeSub(this);
  4206. }
  4207. this.active = false;
  4208. }
  4209. };
  4210. /* */
  4211. var sharedPropertyDefinition = {
  4212. enumerable: true,
  4213. configurable: true,
  4214. get: noop,
  4215. set: noop
  4216. };
  4217. function proxy (target, sourceKey, key) {
  4218. sharedPropertyDefinition.get = function proxyGetter () {
  4219. return this[sourceKey][key]
  4220. };
  4221. sharedPropertyDefinition.set = function proxySetter (val) {
  4222. this[sourceKey][key] = val;
  4223. };
  4224. Object.defineProperty(target, key, sharedPropertyDefinition);
  4225. }
  4226. function initState (vm) {
  4227. vm._watchers = [];
  4228. var opts = vm.$options;
  4229. if (opts.props) { initProps(vm, opts.props); }
  4230. if (opts.methods) { initMethods(vm, opts.methods); }
  4231. if (opts.data) {
  4232. initData(vm);
  4233. } else {
  4234. observe(vm._data = {}, true /* asRootData */);
  4235. }
  4236. if (opts.computed) { initComputed(vm, opts.computed); }
  4237. if (opts.watch && opts.watch !== nativeWatch) {
  4238. initWatch(vm, opts.watch);
  4239. }
  4240. }
  4241. function initProps (vm, propsOptions) {
  4242. var propsData = vm.$options.propsData || {};
  4243. var props = vm._props = {};
  4244. // cache prop keys so that future props updates can iterate using Array
  4245. // instead of dynamic object key enumeration.
  4246. var keys = vm.$options._propKeys = [];
  4247. var isRoot = !vm.$parent;
  4248. // root instance props should be converted
  4249. if (!isRoot) {
  4250. toggleObserving(false);
  4251. }
  4252. var loop = function ( key ) {
  4253. keys.push(key);
  4254. var value = validateProp(key, propsOptions, propsData, vm);
  4255. /* istanbul ignore else */
  4256. if (process.env.NODE_ENV !== 'production') {
  4257. var hyphenatedKey = hyphenate(key);
  4258. if (isReservedAttribute(hyphenatedKey) ||
  4259. config.isReservedAttr(hyphenatedKey)) {
  4260. warn(
  4261. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  4262. vm
  4263. );
  4264. }
  4265. defineReactive$$1(props, key, value, function () {
  4266. if (!isRoot && !isUpdatingChildComponent) {
  4267. warn(
  4268. "Avoid mutating a prop directly since the value will be " +
  4269. "overwritten whenever the parent component re-renders. " +
  4270. "Instead, use a data or computed property based on the prop's " +
  4271. "value. Prop being mutated: \"" + key + "\"",
  4272. vm
  4273. );
  4274. }
  4275. });
  4276. } else {
  4277. defineReactive$$1(props, key, value);
  4278. }
  4279. // static props are already proxied on the component's prototype
  4280. // during Vue.extend(). We only need to proxy props defined at
  4281. // instantiation here.
  4282. if (!(key in vm)) {
  4283. proxy(vm, "_props", key);
  4284. }
  4285. };
  4286. for (var key in propsOptions) loop( key );
  4287. toggleObserving(true);
  4288. }
  4289. function initData (vm) {
  4290. var data = vm.$options.data;
  4291. data = vm._data = typeof data === 'function'
  4292. ? getData(data, vm)
  4293. : data || {};
  4294. if (!isPlainObject(data)) {
  4295. data = {};
  4296. process.env.NODE_ENV !== 'production' && warn(
  4297. 'data functions should return an object:\n' +
  4298. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  4299. vm
  4300. );
  4301. }
  4302. // proxy data on instance
  4303. var keys = Object.keys(data);
  4304. var props = vm.$options.props;
  4305. var methods = vm.$options.methods;
  4306. var i = keys.length;
  4307. while (i--) {
  4308. var key = keys[i];
  4309. if (process.env.NODE_ENV !== 'production') {
  4310. if (methods && hasOwn(methods, key)) {
  4311. warn(
  4312. ("Method \"" + key + "\" has already been defined as a data property."),
  4313. vm
  4314. );
  4315. }
  4316. }
  4317. if (props && hasOwn(props, key)) {
  4318. process.env.NODE_ENV !== 'production' && warn(
  4319. "The data property \"" + key + "\" is already declared as a prop. " +
  4320. "Use prop default value instead.",
  4321. vm
  4322. );
  4323. } else if (!isReserved(key)) {
  4324. proxy(vm, "_data", key);
  4325. }
  4326. }
  4327. // observe data
  4328. observe(data, true /* asRootData */);
  4329. }
  4330. function getData (data, vm) {
  4331. // #7573 disable dep collection when invoking data getters
  4332. pushTarget();
  4333. try {
  4334. return data.call(vm, vm)
  4335. } catch (e) {
  4336. handleError(e, vm, "data()");
  4337. return {}
  4338. } finally {
  4339. popTarget();
  4340. }
  4341. }
  4342. var computedWatcherOptions = { lazy: true };
  4343. function initComputed (vm, computed) {
  4344. // $flow-disable-line
  4345. var watchers = vm._computedWatchers = Object.create(null);
  4346. // computed properties are just getters during SSR
  4347. var isSSR = isServerRendering();
  4348. for (var key in computed) {
  4349. var userDef = computed[key];
  4350. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  4351. if (process.env.NODE_ENV !== 'production' && getter == null) {
  4352. warn(
  4353. ("Getter is missing for computed property \"" + key + "\"."),
  4354. vm
  4355. );
  4356. }
  4357. if (!isSSR) {
  4358. // create internal watcher for the computed property.
  4359. watchers[key] = new Watcher(
  4360. vm,
  4361. getter || noop,
  4362. noop,
  4363. computedWatcherOptions
  4364. );
  4365. }
  4366. // component-defined computed properties are already defined on the
  4367. // component prototype. We only need to define computed properties defined
  4368. // at instantiation here.
  4369. if (!(key in vm)) {
  4370. defineComputed(vm, key, userDef);
  4371. } else if (process.env.NODE_ENV !== 'production') {
  4372. if (key in vm.$data) {
  4373. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  4374. } else if (vm.$options.props && key in vm.$options.props) {
  4375. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  4376. } else if (vm.$options.methods && key in vm.$options.methods) {
  4377. warn(("The computed property \"" + key + "\" is already defined as a method."), vm);
  4378. }
  4379. }
  4380. }
  4381. }
  4382. function defineComputed (
  4383. target,
  4384. key,
  4385. userDef
  4386. ) {
  4387. var shouldCache = !isServerRendering();
  4388. if (typeof userDef === 'function') {
  4389. sharedPropertyDefinition.get = shouldCache
  4390. ? createComputedGetter(key)
  4391. : createGetterInvoker(userDef);
  4392. sharedPropertyDefinition.set = noop;
  4393. } else {
  4394. sharedPropertyDefinition.get = userDef.get
  4395. ? shouldCache && userDef.cache !== false
  4396. ? createComputedGetter(key)
  4397. : createGetterInvoker(userDef.get)
  4398. : noop;
  4399. sharedPropertyDefinition.set = userDef.set || noop;
  4400. }
  4401. if (process.env.NODE_ENV !== 'production' &&
  4402. sharedPropertyDefinition.set === noop) {
  4403. sharedPropertyDefinition.set = function () {
  4404. warn(
  4405. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  4406. this
  4407. );
  4408. };
  4409. }
  4410. Object.defineProperty(target, key, sharedPropertyDefinition);
  4411. }
  4412. function createComputedGetter (key) {
  4413. return function computedGetter () {
  4414. var watcher = this._computedWatchers && this._computedWatchers[key];
  4415. if (watcher) {
  4416. if (watcher.dirty) {
  4417. watcher.evaluate();
  4418. }
  4419. if (Dep.target) {
  4420. watcher.depend();
  4421. }
  4422. return watcher.value
  4423. }
  4424. }
  4425. }
  4426. function createGetterInvoker(fn) {
  4427. return function computedGetter () {
  4428. return fn.call(this, this)
  4429. }
  4430. }
  4431. function initMethods (vm, methods) {
  4432. var props = vm.$options.props;
  4433. for (var key in methods) {
  4434. if (process.env.NODE_ENV !== 'production') {
  4435. if (typeof methods[key] !== 'function') {
  4436. warn(
  4437. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  4438. "Did you reference the function correctly?",
  4439. vm
  4440. );
  4441. }
  4442. if (props && hasOwn(props, key)) {
  4443. warn(
  4444. ("Method \"" + key + "\" has already been defined as a prop."),
  4445. vm
  4446. );
  4447. }
  4448. if ((key in vm) && isReserved(key)) {
  4449. warn(
  4450. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  4451. "Avoid defining component methods that start with _ or $."
  4452. );
  4453. }
  4454. }
  4455. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  4456. }
  4457. }
  4458. function initWatch (vm, watch) {
  4459. for (var key in watch) {
  4460. var handler = watch[key];
  4461. if (Array.isArray(handler)) {
  4462. for (var i = 0; i < handler.length; i++) {
  4463. createWatcher(vm, key, handler[i]);
  4464. }
  4465. } else {
  4466. createWatcher(vm, key, handler);
  4467. }
  4468. }
  4469. }
  4470. function createWatcher (
  4471. vm,
  4472. expOrFn,
  4473. handler,
  4474. options
  4475. ) {
  4476. if (isPlainObject(handler)) {
  4477. options = handler;
  4478. handler = handler.handler;
  4479. }
  4480. if (typeof handler === 'string') {
  4481. handler = vm[handler];
  4482. }
  4483. return vm.$watch(expOrFn, handler, options)
  4484. }
  4485. function stateMixin (Vue) {
  4486. // flow somehow has problems with directly declared definition object
  4487. // when using Object.defineProperty, so we have to procedurally build up
  4488. // the object here.
  4489. var dataDef = {};
  4490. dataDef.get = function () { return this._data };
  4491. var propsDef = {};
  4492. propsDef.get = function () { return this._props };
  4493. if (process.env.NODE_ENV !== 'production') {
  4494. dataDef.set = function () {
  4495. warn(
  4496. 'Avoid replacing instance root $data. ' +
  4497. 'Use nested data properties instead.',
  4498. this
  4499. );
  4500. };
  4501. propsDef.set = function () {
  4502. warn("$props is readonly.", this);
  4503. };
  4504. }
  4505. Object.defineProperty(Vue.prototype, '$data', dataDef);
  4506. Object.defineProperty(Vue.prototype, '$props', propsDef);
  4507. Vue.prototype.$set = set;
  4508. Vue.prototype.$delete = del;
  4509. Vue.prototype.$watch = function (
  4510. expOrFn,
  4511. cb,
  4512. options
  4513. ) {
  4514. var vm = this;
  4515. if (isPlainObject(cb)) {
  4516. return createWatcher(vm, expOrFn, cb, options)
  4517. }
  4518. options = options || {};
  4519. options.user = true;
  4520. var watcher = new Watcher(vm, expOrFn, cb, options);
  4521. if (options.immediate) {
  4522. var info = "callback for immediate watcher \"" + (watcher.expression) + "\"";
  4523. pushTarget();
  4524. invokeWithErrorHandling(cb, vm, [watcher.value], vm, info);
  4525. popTarget();
  4526. }
  4527. return function unwatchFn () {
  4528. watcher.teardown();
  4529. }
  4530. };
  4531. }
  4532. /* */
  4533. var uid$3 = 0;
  4534. function initMixin (Vue) {
  4535. Vue.prototype._init = function (options) {
  4536. var vm = this;
  4537. // a uid
  4538. vm._uid = uid$3++;
  4539. var startTag, endTag;
  4540. /* istanbul ignore if */
  4541. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  4542. startTag = "vue-perf-start:" + (vm._uid);
  4543. endTag = "vue-perf-end:" + (vm._uid);
  4544. mark(startTag);
  4545. }
  4546. // a flag to avoid this being observed
  4547. vm._isVue = true;
  4548. // merge options
  4549. if (options && options._isComponent) {
  4550. // optimize internal component instantiation
  4551. // since dynamic options merging is pretty slow, and none of the
  4552. // internal component options needs special treatment.
  4553. initInternalComponent(vm, options);
  4554. } else {
  4555. vm.$options = mergeOptions(
  4556. resolveConstructorOptions(vm.constructor),
  4557. options || {},
  4558. vm
  4559. );
  4560. }
  4561. /* istanbul ignore else */
  4562. if (process.env.NODE_ENV !== 'production') {
  4563. initProxy(vm);
  4564. } else {
  4565. vm._renderProxy = vm;
  4566. }
  4567. // expose real self
  4568. vm._self = vm;
  4569. initLifecycle(vm);
  4570. initEvents(vm);
  4571. initRender(vm);
  4572. callHook(vm, 'beforeCreate');
  4573. initInjections(vm); // resolve injections before data/props
  4574. initState(vm);
  4575. initProvide(vm); // resolve provide after data/props
  4576. callHook(vm, 'created');
  4577. /* istanbul ignore if */
  4578. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  4579. vm._name = formatComponentName(vm, false);
  4580. mark(endTag);
  4581. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  4582. }
  4583. if (vm.$options.el) {
  4584. vm.$mount(vm.$options.el);
  4585. }
  4586. };
  4587. }
  4588. function initInternalComponent (vm, options) {
  4589. var opts = vm.$options = Object.create(vm.constructor.options);
  4590. // doing this because it's faster than dynamic enumeration.
  4591. var parentVnode = options._parentVnode;
  4592. opts.parent = options.parent;
  4593. opts._parentVnode = parentVnode;
  4594. var vnodeComponentOptions = parentVnode.componentOptions;
  4595. opts.propsData = vnodeComponentOptions.propsData;
  4596. opts._parentListeners = vnodeComponentOptions.listeners;
  4597. opts._renderChildren = vnodeComponentOptions.children;
  4598. opts._componentTag = vnodeComponentOptions.tag;
  4599. if (options.render) {
  4600. opts.render = options.render;
  4601. opts.staticRenderFns = options.staticRenderFns;
  4602. }
  4603. }
  4604. function resolveConstructorOptions (Ctor) {
  4605. var options = Ctor.options;
  4606. if (Ctor.super) {
  4607. var superOptions = resolveConstructorOptions(Ctor.super);
  4608. var cachedSuperOptions = Ctor.superOptions;
  4609. if (superOptions !== cachedSuperOptions) {
  4610. // super option changed,
  4611. // need to resolve new options.
  4612. Ctor.superOptions = superOptions;
  4613. // check if there are any late-modified/attached options (#4976)
  4614. var modifiedOptions = resolveModifiedOptions(Ctor);
  4615. // update base extend options
  4616. if (modifiedOptions) {
  4617. extend(Ctor.extendOptions, modifiedOptions);
  4618. }
  4619. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4620. if (options.name) {
  4621. options.components[options.name] = Ctor;
  4622. }
  4623. }
  4624. }
  4625. return options
  4626. }
  4627. function resolveModifiedOptions (Ctor) {
  4628. var modified;
  4629. var latest = Ctor.options;
  4630. var sealed = Ctor.sealedOptions;
  4631. for (var key in latest) {
  4632. if (latest[key] !== sealed[key]) {
  4633. if (!modified) { modified = {}; }
  4634. modified[key] = latest[key];
  4635. }
  4636. }
  4637. return modified
  4638. }
  4639. function Vue (options) {
  4640. if (process.env.NODE_ENV !== 'production' &&
  4641. !(this instanceof Vue)
  4642. ) {
  4643. warn('Vue is a constructor and should be called with the `new` keyword');
  4644. }
  4645. this._init(options);
  4646. }
  4647. initMixin(Vue);
  4648. stateMixin(Vue);
  4649. eventsMixin(Vue);
  4650. lifecycleMixin(Vue);
  4651. renderMixin(Vue);
  4652. /* */
  4653. function initUse (Vue) {
  4654. Vue.use = function (plugin) {
  4655. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  4656. if (installedPlugins.indexOf(plugin) > -1) {
  4657. return this
  4658. }
  4659. // additional parameters
  4660. var args = toArray(arguments, 1);
  4661. args.unshift(this);
  4662. if (typeof plugin.install === 'function') {
  4663. plugin.install.apply(plugin, args);
  4664. } else if (typeof plugin === 'function') {
  4665. plugin.apply(null, args);
  4666. }
  4667. installedPlugins.push(plugin);
  4668. return this
  4669. };
  4670. }
  4671. /* */
  4672. function initMixin$1 (Vue) {
  4673. Vue.mixin = function (mixin) {
  4674. this.options = mergeOptions(this.options, mixin);
  4675. return this
  4676. };
  4677. }
  4678. /* */
  4679. function initExtend (Vue) {
  4680. /**
  4681. * Each instance constructor, including Vue, has a unique
  4682. * cid. This enables us to create wrapped "child
  4683. * constructors" for prototypal inheritance and cache them.
  4684. */
  4685. Vue.cid = 0;
  4686. var cid = 1;
  4687. /**
  4688. * Class inheritance
  4689. */
  4690. Vue.extend = function (extendOptions) {
  4691. extendOptions = extendOptions || {};
  4692. var Super = this;
  4693. var SuperId = Super.cid;
  4694. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  4695. if (cachedCtors[SuperId]) {
  4696. return cachedCtors[SuperId]
  4697. }
  4698. var name = extendOptions.name || Super.options.name;
  4699. if (process.env.NODE_ENV !== 'production' && name) {
  4700. validateComponentName(name);
  4701. }
  4702. var Sub = function VueComponent (options) {
  4703. this._init(options);
  4704. };
  4705. Sub.prototype = Object.create(Super.prototype);
  4706. Sub.prototype.constructor = Sub;
  4707. Sub.cid = cid++;
  4708. Sub.options = mergeOptions(
  4709. Super.options,
  4710. extendOptions
  4711. );
  4712. Sub['super'] = Super;
  4713. // For props and computed properties, we define the proxy getters on
  4714. // the Vue instances at extension time, on the extended prototype. This
  4715. // avoids Object.defineProperty calls for each instance created.
  4716. if (Sub.options.props) {
  4717. initProps$1(Sub);
  4718. }
  4719. if (Sub.options.computed) {
  4720. initComputed$1(Sub);
  4721. }
  4722. // allow further extension/mixin/plugin usage
  4723. Sub.extend = Super.extend;
  4724. Sub.mixin = Super.mixin;
  4725. Sub.use = Super.use;
  4726. // create asset registers, so extended classes
  4727. // can have their private assets too.
  4728. ASSET_TYPES.forEach(function (type) {
  4729. Sub[type] = Super[type];
  4730. });
  4731. // enable recursive self-lookup
  4732. if (name) {
  4733. Sub.options.components[name] = Sub;
  4734. }
  4735. // keep a reference to the super options at extension time.
  4736. // later at instantiation we can check if Super's options have
  4737. // been updated.
  4738. Sub.superOptions = Super.options;
  4739. Sub.extendOptions = extendOptions;
  4740. Sub.sealedOptions = extend({}, Sub.options);
  4741. // cache constructor
  4742. cachedCtors[SuperId] = Sub;
  4743. return Sub
  4744. };
  4745. }
  4746. function initProps$1 (Comp) {
  4747. var props = Comp.options.props;
  4748. for (var key in props) {
  4749. proxy(Comp.prototype, "_props", key);
  4750. }
  4751. }
  4752. function initComputed$1 (Comp) {
  4753. var computed = Comp.options.computed;
  4754. for (var key in computed) {
  4755. defineComputed(Comp.prototype, key, computed[key]);
  4756. }
  4757. }
  4758. /* */
  4759. function initAssetRegisters (Vue) {
  4760. /**
  4761. * Create asset registration methods.
  4762. */
  4763. ASSET_TYPES.forEach(function (type) {
  4764. Vue[type] = function (
  4765. id,
  4766. definition
  4767. ) {
  4768. if (!definition) {
  4769. return this.options[type + 's'][id]
  4770. } else {
  4771. /* istanbul ignore if */
  4772. if (process.env.NODE_ENV !== 'production' && type === 'component') {
  4773. validateComponentName(id);
  4774. }
  4775. if (type === 'component' && isPlainObject(definition)) {
  4776. definition.name = definition.name || id;
  4777. definition = this.options._base.extend(definition);
  4778. }
  4779. if (type === 'directive' && typeof definition === 'function') {
  4780. definition = { bind: definition, update: definition };
  4781. }
  4782. this.options[type + 's'][id] = definition;
  4783. return definition
  4784. }
  4785. };
  4786. });
  4787. }
  4788. /* */
  4789. function getComponentName (opts) {
  4790. return opts && (opts.Ctor.options.name || opts.tag)
  4791. }
  4792. function matches (pattern, name) {
  4793. if (Array.isArray(pattern)) {
  4794. return pattern.indexOf(name) > -1
  4795. } else if (typeof pattern === 'string') {
  4796. return pattern.split(',').indexOf(name) > -1
  4797. } else if (isRegExp(pattern)) {
  4798. return pattern.test(name)
  4799. }
  4800. /* istanbul ignore next */
  4801. return false
  4802. }
  4803. function pruneCache (keepAliveInstance, filter) {
  4804. var cache = keepAliveInstance.cache;
  4805. var keys = keepAliveInstance.keys;
  4806. var _vnode = keepAliveInstance._vnode;
  4807. for (var key in cache) {
  4808. var entry = cache[key];
  4809. if (entry) {
  4810. var name = entry.name;
  4811. if (name && !filter(name)) {
  4812. pruneCacheEntry(cache, key, keys, _vnode);
  4813. }
  4814. }
  4815. }
  4816. }
  4817. function pruneCacheEntry (
  4818. cache,
  4819. key,
  4820. keys,
  4821. current
  4822. ) {
  4823. var entry = cache[key];
  4824. if (entry && (!current || entry.tag !== current.tag)) {
  4825. entry.componentInstance.$destroy();
  4826. }
  4827. cache[key] = null;
  4828. remove(keys, key);
  4829. }
  4830. var patternTypes = [String, RegExp, Array];
  4831. var KeepAlive = {
  4832. name: 'keep-alive',
  4833. abstract: true,
  4834. props: {
  4835. include: patternTypes,
  4836. exclude: patternTypes,
  4837. max: [String, Number]
  4838. },
  4839. methods: {
  4840. cacheVNode: function cacheVNode() {
  4841. var ref = this;
  4842. var cache = ref.cache;
  4843. var keys = ref.keys;
  4844. var vnodeToCache = ref.vnodeToCache;
  4845. var keyToCache = ref.keyToCache;
  4846. if (vnodeToCache) {
  4847. var tag = vnodeToCache.tag;
  4848. var componentInstance = vnodeToCache.componentInstance;
  4849. var componentOptions = vnodeToCache.componentOptions;
  4850. cache[keyToCache] = {
  4851. name: getComponentName(componentOptions),
  4852. tag: tag,
  4853. componentInstance: componentInstance,
  4854. };
  4855. keys.push(keyToCache);
  4856. // prune oldest entry
  4857. if (this.max && keys.length > parseInt(this.max)) {
  4858. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  4859. }
  4860. this.vnodeToCache = null;
  4861. }
  4862. }
  4863. },
  4864. created: function created () {
  4865. this.cache = Object.create(null);
  4866. this.keys = [];
  4867. },
  4868. destroyed: function destroyed () {
  4869. for (var key in this.cache) {
  4870. pruneCacheEntry(this.cache, key, this.keys);
  4871. }
  4872. },
  4873. mounted: function mounted () {
  4874. var this$1 = this;
  4875. this.cacheVNode();
  4876. this.$watch('include', function (val) {
  4877. pruneCache(this$1, function (name) { return matches(val, name); });
  4878. });
  4879. this.$watch('exclude', function (val) {
  4880. pruneCache(this$1, function (name) { return !matches(val, name); });
  4881. });
  4882. },
  4883. updated: function updated () {
  4884. this.cacheVNode();
  4885. },
  4886. render: function render () {
  4887. var slot = this.$slots.default;
  4888. var vnode = getFirstComponentChild(slot);
  4889. var componentOptions = vnode && vnode.componentOptions;
  4890. if (componentOptions) {
  4891. // check pattern
  4892. var name = getComponentName(componentOptions);
  4893. var ref = this;
  4894. var include = ref.include;
  4895. var exclude = ref.exclude;
  4896. if (
  4897. // not included
  4898. (include && (!name || !matches(include, name))) ||
  4899. // excluded
  4900. (exclude && name && matches(exclude, name))
  4901. ) {
  4902. return vnode
  4903. }
  4904. var ref$1 = this;
  4905. var cache = ref$1.cache;
  4906. var keys = ref$1.keys;
  4907. var key = vnode.key == null
  4908. // same constructor may get registered as different local components
  4909. // so cid alone is not enough (#3269)
  4910. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  4911. : vnode.key;
  4912. if (cache[key]) {
  4913. vnode.componentInstance = cache[key].componentInstance;
  4914. // make current key freshest
  4915. remove(keys, key);
  4916. keys.push(key);
  4917. } else {
  4918. // delay setting the cache until update
  4919. this.vnodeToCache = vnode;
  4920. this.keyToCache = key;
  4921. }
  4922. vnode.data.keepAlive = true;
  4923. }
  4924. return vnode || (slot && slot[0])
  4925. }
  4926. };
  4927. var builtInComponents = {
  4928. KeepAlive: KeepAlive
  4929. };
  4930. /* */
  4931. function initGlobalAPI (Vue) {
  4932. // config
  4933. var configDef = {};
  4934. configDef.get = function () { return config; };
  4935. if (process.env.NODE_ENV !== 'production') {
  4936. configDef.set = function () {
  4937. warn(
  4938. 'Do not replace the Vue.config object, set individual fields instead.'
  4939. );
  4940. };
  4941. }
  4942. Object.defineProperty(Vue, 'config', configDef);
  4943. // exposed util methods.
  4944. // NOTE: these are not considered part of the public API - avoid relying on
  4945. // them unless you are aware of the risk.
  4946. Vue.util = {
  4947. warn: warn,
  4948. extend: extend,
  4949. mergeOptions: mergeOptions,
  4950. defineReactive: defineReactive$$1
  4951. };
  4952. Vue.set = set;
  4953. Vue.delete = del;
  4954. Vue.nextTick = nextTick;
  4955. // 2.6 explicit observable API
  4956. Vue.observable = function (obj) {
  4957. observe(obj);
  4958. return obj
  4959. };
  4960. Vue.options = Object.create(null);
  4961. ASSET_TYPES.forEach(function (type) {
  4962. Vue.options[type + 's'] = Object.create(null);
  4963. });
  4964. // this is used to identify the "base" constructor to extend all plain-object
  4965. // components with in Weex's multi-instance scenarios.
  4966. Vue.options._base = Vue;
  4967. extend(Vue.options.components, builtInComponents);
  4968. initUse(Vue);
  4969. initMixin$1(Vue);
  4970. initExtend(Vue);
  4971. initAssetRegisters(Vue);
  4972. }
  4973. initGlobalAPI(Vue);
  4974. Object.defineProperty(Vue.prototype, '$isServer', {
  4975. get: isServerRendering
  4976. });
  4977. Object.defineProperty(Vue.prototype, '$ssrContext', {
  4978. get: function get () {
  4979. /* istanbul ignore next */
  4980. return this.$vnode && this.$vnode.ssrContext
  4981. }
  4982. });
  4983. // expose FunctionalRenderContext for ssr runtime helper installation
  4984. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  4985. value: FunctionalRenderContext
  4986. });
  4987. Vue.version = '2.6.14';
  4988. /* */
  4989. // these are reserved for web because they are directly compiled away
  4990. // during template compilation
  4991. var isReservedAttr = makeMap('style,class');
  4992. // attributes that should be using props for binding
  4993. var acceptValue = makeMap('input,textarea,option,select,progress');
  4994. var mustUseProp = function (tag, type, attr) {
  4995. return (
  4996. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  4997. (attr === 'selected' && tag === 'option') ||
  4998. (attr === 'checked' && tag === 'input') ||
  4999. (attr === 'muted' && tag === 'video')
  5000. )
  5001. };
  5002. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  5003. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  5004. var convertEnumeratedValue = function (key, value) {
  5005. return isFalsyAttrValue(value) || value === 'false'
  5006. ? 'false'
  5007. // allow arbitrary string value for contenteditable
  5008. : key === 'contenteditable' && isValidContentEditableValue(value)
  5009. ? value
  5010. : 'true'
  5011. };
  5012. var isBooleanAttr = makeMap(
  5013. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  5014. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  5015. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  5016. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  5017. 'required,reversed,scoped,seamless,selected,sortable,' +
  5018. 'truespeed,typemustmatch,visible'
  5019. );
  5020. var xlinkNS = 'http://www.w3.org/1999/xlink';
  5021. var isXlink = function (name) {
  5022. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  5023. };
  5024. var getXlinkProp = function (name) {
  5025. return isXlink(name) ? name.slice(6, name.length) : ''
  5026. };
  5027. var isFalsyAttrValue = function (val) {
  5028. return val == null || val === false
  5029. };
  5030. /* */
  5031. function genClassForVnode (vnode) {
  5032. var data = vnode.data;
  5033. var parentNode = vnode;
  5034. var childNode = vnode;
  5035. while (isDef(childNode.componentInstance)) {
  5036. childNode = childNode.componentInstance._vnode;
  5037. if (childNode && childNode.data) {
  5038. data = mergeClassData(childNode.data, data);
  5039. }
  5040. }
  5041. while (isDef(parentNode = parentNode.parent)) {
  5042. if (parentNode && parentNode.data) {
  5043. data = mergeClassData(data, parentNode.data);
  5044. }
  5045. }
  5046. return renderClass(data.staticClass, data.class)
  5047. }
  5048. function mergeClassData (child, parent) {
  5049. return {
  5050. staticClass: concat(child.staticClass, parent.staticClass),
  5051. class: isDef(child.class)
  5052. ? [child.class, parent.class]
  5053. : parent.class
  5054. }
  5055. }
  5056. function renderClass (
  5057. staticClass,
  5058. dynamicClass
  5059. ) {
  5060. if (isDef(staticClass) || isDef(dynamicClass)) {
  5061. return concat(staticClass, stringifyClass(dynamicClass))
  5062. }
  5063. /* istanbul ignore next */
  5064. return ''
  5065. }
  5066. function concat (a, b) {
  5067. return a ? b ? (a + ' ' + b) : a : (b || '')
  5068. }
  5069. function stringifyClass (value) {
  5070. if (Array.isArray(value)) {
  5071. return stringifyArray(value)
  5072. }
  5073. if (isObject(value)) {
  5074. return stringifyObject(value)
  5075. }
  5076. if (typeof value === 'string') {
  5077. return value
  5078. }
  5079. /* istanbul ignore next */
  5080. return ''
  5081. }
  5082. function stringifyArray (value) {
  5083. var res = '';
  5084. var stringified;
  5085. for (var i = 0, l = value.length; i < l; i++) {
  5086. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  5087. if (res) { res += ' '; }
  5088. res += stringified;
  5089. }
  5090. }
  5091. return res
  5092. }
  5093. function stringifyObject (value) {
  5094. var res = '';
  5095. for (var key in value) {
  5096. if (value[key]) {
  5097. if (res) { res += ' '; }
  5098. res += key;
  5099. }
  5100. }
  5101. return res
  5102. }
  5103. /* */
  5104. var namespaceMap = {
  5105. svg: 'http://www.w3.org/2000/svg',
  5106. math: 'http://www.w3.org/1998/Math/MathML'
  5107. };
  5108. var isHTMLTag = makeMap(
  5109. 'html,body,base,head,link,meta,style,title,' +
  5110. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  5111. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  5112. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  5113. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  5114. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  5115. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  5116. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  5117. 'output,progress,select,textarea,' +
  5118. 'details,dialog,menu,menuitem,summary,' +
  5119. 'content,element,shadow,template,blockquote,iframe,tfoot'
  5120. );
  5121. // this map is intentionally selective, only covering SVG elements that may
  5122. // contain child elements.
  5123. var isSVG = makeMap(
  5124. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  5125. 'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  5126. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  5127. true
  5128. );
  5129. var isPreTag = function (tag) { return tag === 'pre'; };
  5130. var isReservedTag = function (tag) {
  5131. return isHTMLTag(tag) || isSVG(tag)
  5132. };
  5133. function getTagNamespace (tag) {
  5134. if (isSVG(tag)) {
  5135. return 'svg'
  5136. }
  5137. // basic support for MathML
  5138. // note it doesn't support other MathML elements being component roots
  5139. if (tag === 'math') {
  5140. return 'math'
  5141. }
  5142. }
  5143. var unknownElementCache = Object.create(null);
  5144. function isUnknownElement (tag) {
  5145. /* istanbul ignore if */
  5146. if (!inBrowser) {
  5147. return true
  5148. }
  5149. if (isReservedTag(tag)) {
  5150. return false
  5151. }
  5152. tag = tag.toLowerCase();
  5153. /* istanbul ignore if */
  5154. if (unknownElementCache[tag] != null) {
  5155. return unknownElementCache[tag]
  5156. }
  5157. var el = document.createElement(tag);
  5158. if (tag.indexOf('-') > -1) {
  5159. // http://stackoverflow.com/a/28210364/1070244
  5160. return (unknownElementCache[tag] = (
  5161. el.constructor === window.HTMLUnknownElement ||
  5162. el.constructor === window.HTMLElement
  5163. ))
  5164. } else {
  5165. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  5166. }
  5167. }
  5168. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  5169. /* */
  5170. /**
  5171. * Query an element selector if it's not an element already.
  5172. */
  5173. function query (el) {
  5174. if (typeof el === 'string') {
  5175. var selected = document.querySelector(el);
  5176. if (!selected) {
  5177. process.env.NODE_ENV !== 'production' && warn(
  5178. 'Cannot find element: ' + el
  5179. );
  5180. return document.createElement('div')
  5181. }
  5182. return selected
  5183. } else {
  5184. return el
  5185. }
  5186. }
  5187. /* */
  5188. function createElement$1 (tagName, vnode) {
  5189. var elm = document.createElement(tagName);
  5190. if (tagName !== 'select') {
  5191. return elm
  5192. }
  5193. // false or null will remove the attribute but undefined will not
  5194. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  5195. elm.setAttribute('multiple', 'multiple');
  5196. }
  5197. return elm
  5198. }
  5199. function createElementNS (namespace, tagName) {
  5200. return document.createElementNS(namespaceMap[namespace], tagName)
  5201. }
  5202. function createTextNode (text) {
  5203. return document.createTextNode(text)
  5204. }
  5205. function createComment (text) {
  5206. return document.createComment(text)
  5207. }
  5208. function insertBefore (parentNode, newNode, referenceNode) {
  5209. parentNode.insertBefore(newNode, referenceNode);
  5210. }
  5211. function removeChild (node, child) {
  5212. node.removeChild(child);
  5213. }
  5214. function appendChild (node, child) {
  5215. node.appendChild(child);
  5216. }
  5217. function parentNode (node) {
  5218. return node.parentNode
  5219. }
  5220. function nextSibling (node) {
  5221. return node.nextSibling
  5222. }
  5223. function tagName (node) {
  5224. return node.tagName
  5225. }
  5226. function setTextContent (node, text) {
  5227. node.textContent = text;
  5228. }
  5229. function setStyleScope (node, scopeId) {
  5230. node.setAttribute(scopeId, '');
  5231. }
  5232. var nodeOps = /*#__PURE__*/Object.freeze({
  5233. createElement: createElement$1,
  5234. createElementNS: createElementNS,
  5235. createTextNode: createTextNode,
  5236. createComment: createComment,
  5237. insertBefore: insertBefore,
  5238. removeChild: removeChild,
  5239. appendChild: appendChild,
  5240. parentNode: parentNode,
  5241. nextSibling: nextSibling,
  5242. tagName: tagName,
  5243. setTextContent: setTextContent,
  5244. setStyleScope: setStyleScope
  5245. });
  5246. /* */
  5247. var ref = {
  5248. create: function create (_, vnode) {
  5249. registerRef(vnode);
  5250. },
  5251. update: function update (oldVnode, vnode) {
  5252. if (oldVnode.data.ref !== vnode.data.ref) {
  5253. registerRef(oldVnode, true);
  5254. registerRef(vnode);
  5255. }
  5256. },
  5257. destroy: function destroy (vnode) {
  5258. registerRef(vnode, true);
  5259. }
  5260. };
  5261. function registerRef (vnode, isRemoval) {
  5262. var key = vnode.data.ref;
  5263. if (!isDef(key)) { return }
  5264. var vm = vnode.context;
  5265. var ref = vnode.componentInstance || vnode.elm;
  5266. var refs = vm.$refs;
  5267. if (isRemoval) {
  5268. if (Array.isArray(refs[key])) {
  5269. remove(refs[key], ref);
  5270. } else if (refs[key] === ref) {
  5271. refs[key] = undefined;
  5272. }
  5273. } else {
  5274. if (vnode.data.refInFor) {
  5275. if (!Array.isArray(refs[key])) {
  5276. refs[key] = [ref];
  5277. } else if (refs[key].indexOf(ref) < 0) {
  5278. // $flow-disable-line
  5279. refs[key].push(ref);
  5280. }
  5281. } else {
  5282. refs[key] = ref;
  5283. }
  5284. }
  5285. }
  5286. /**
  5287. * Virtual DOM patching algorithm based on Snabbdom by
  5288. * Simon Friis Vindum (@paldepind)
  5289. * Licensed under the MIT License
  5290. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  5291. *
  5292. * modified by Evan You (@yyx990803)
  5293. *
  5294. * Not type-checking this because this file is perf-critical and the cost
  5295. * of making flow understand it is not worth it.
  5296. */
  5297. var emptyNode = new VNode('', {}, []);
  5298. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  5299. function sameVnode (a, b) {
  5300. return (
  5301. a.key === b.key &&
  5302. a.asyncFactory === b.asyncFactory && (
  5303. (
  5304. a.tag === b.tag &&
  5305. a.isComment === b.isComment &&
  5306. isDef(a.data) === isDef(b.data) &&
  5307. sameInputType(a, b)
  5308. ) || (
  5309. isTrue(a.isAsyncPlaceholder) &&
  5310. isUndef(b.asyncFactory.error)
  5311. )
  5312. )
  5313. )
  5314. }
  5315. function sameInputType (a, b) {
  5316. if (a.tag !== 'input') { return true }
  5317. var i;
  5318. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  5319. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  5320. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  5321. }
  5322. function createKeyToOldIdx (children, beginIdx, endIdx) {
  5323. var i, key;
  5324. var map = {};
  5325. for (i = beginIdx; i <= endIdx; ++i) {
  5326. key = children[i].key;
  5327. if (isDef(key)) { map[key] = i; }
  5328. }
  5329. return map
  5330. }
  5331. function createPatchFunction (backend) {
  5332. var i, j;
  5333. var cbs = {};
  5334. var modules = backend.modules;
  5335. var nodeOps = backend.nodeOps;
  5336. for (i = 0; i < hooks.length; ++i) {
  5337. cbs[hooks[i]] = [];
  5338. for (j = 0; j < modules.length; ++j) {
  5339. if (isDef(modules[j][hooks[i]])) {
  5340. cbs[hooks[i]].push(modules[j][hooks[i]]);
  5341. }
  5342. }
  5343. }
  5344. function emptyNodeAt (elm) {
  5345. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  5346. }
  5347. function createRmCb (childElm, listeners) {
  5348. function remove$$1 () {
  5349. if (--remove$$1.listeners === 0) {
  5350. removeNode(childElm);
  5351. }
  5352. }
  5353. remove$$1.listeners = listeners;
  5354. return remove$$1
  5355. }
  5356. function removeNode (el) {
  5357. var parent = nodeOps.parentNode(el);
  5358. // element may have already been removed due to v-html / v-text
  5359. if (isDef(parent)) {
  5360. nodeOps.removeChild(parent, el);
  5361. }
  5362. }
  5363. function isUnknownElement$$1 (vnode, inVPre) {
  5364. return (
  5365. !inVPre &&
  5366. !vnode.ns &&
  5367. !(
  5368. config.ignoredElements.length &&
  5369. config.ignoredElements.some(function (ignore) {
  5370. return isRegExp(ignore)
  5371. ? ignore.test(vnode.tag)
  5372. : ignore === vnode.tag
  5373. })
  5374. ) &&
  5375. config.isUnknownElement(vnode.tag)
  5376. )
  5377. }
  5378. var creatingElmInVPre = 0;
  5379. function createElm (
  5380. vnode,
  5381. insertedVnodeQueue,
  5382. parentElm,
  5383. refElm,
  5384. nested,
  5385. ownerArray,
  5386. index
  5387. ) {
  5388. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5389. // This vnode was used in a previous render!
  5390. // now it's used as a new node, overwriting its elm would cause
  5391. // potential patch errors down the road when it's used as an insertion
  5392. // reference node. Instead, we clone the node on-demand before creating
  5393. // associated DOM element for it.
  5394. vnode = ownerArray[index] = cloneVNode(vnode);
  5395. }
  5396. vnode.isRootInsert = !nested; // for transition enter check
  5397. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  5398. return
  5399. }
  5400. var data = vnode.data;
  5401. var children = vnode.children;
  5402. var tag = vnode.tag;
  5403. if (isDef(tag)) {
  5404. if (process.env.NODE_ENV !== 'production') {
  5405. if (data && data.pre) {
  5406. creatingElmInVPre++;
  5407. }
  5408. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  5409. warn(
  5410. 'Unknown custom element: <' + tag + '> - did you ' +
  5411. 'register the component correctly? For recursive components, ' +
  5412. 'make sure to provide the "name" option.',
  5413. vnode.context
  5414. );
  5415. }
  5416. }
  5417. vnode.elm = vnode.ns
  5418. ? nodeOps.createElementNS(vnode.ns, tag)
  5419. : nodeOps.createElement(tag, vnode);
  5420. setScope(vnode);
  5421. /* istanbul ignore if */
  5422. {
  5423. createChildren(vnode, children, insertedVnodeQueue);
  5424. if (isDef(data)) {
  5425. invokeCreateHooks(vnode, insertedVnodeQueue);
  5426. }
  5427. insert(parentElm, vnode.elm, refElm);
  5428. }
  5429. if (process.env.NODE_ENV !== 'production' && data && data.pre) {
  5430. creatingElmInVPre--;
  5431. }
  5432. } else if (isTrue(vnode.isComment)) {
  5433. vnode.elm = nodeOps.createComment(vnode.text);
  5434. insert(parentElm, vnode.elm, refElm);
  5435. } else {
  5436. vnode.elm = nodeOps.createTextNode(vnode.text);
  5437. insert(parentElm, vnode.elm, refElm);
  5438. }
  5439. }
  5440. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5441. var i = vnode.data;
  5442. if (isDef(i)) {
  5443. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  5444. if (isDef(i = i.hook) && isDef(i = i.init)) {
  5445. i(vnode, false /* hydrating */);
  5446. }
  5447. // after calling the init hook, if the vnode is a child component
  5448. // it should've created a child instance and mounted it. the child
  5449. // component also has set the placeholder vnode's elm.
  5450. // in that case we can just return the element and be done.
  5451. if (isDef(vnode.componentInstance)) {
  5452. initComponent(vnode, insertedVnodeQueue);
  5453. insert(parentElm, vnode.elm, refElm);
  5454. if (isTrue(isReactivated)) {
  5455. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  5456. }
  5457. return true
  5458. }
  5459. }
  5460. }
  5461. function initComponent (vnode, insertedVnodeQueue) {
  5462. if (isDef(vnode.data.pendingInsert)) {
  5463. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  5464. vnode.data.pendingInsert = null;
  5465. }
  5466. vnode.elm = vnode.componentInstance.$el;
  5467. if (isPatchable(vnode)) {
  5468. invokeCreateHooks(vnode, insertedVnodeQueue);
  5469. setScope(vnode);
  5470. } else {
  5471. // empty component root.
  5472. // skip all element-related modules except for ref (#3455)
  5473. registerRef(vnode);
  5474. // make sure to invoke the insert hook
  5475. insertedVnodeQueue.push(vnode);
  5476. }
  5477. }
  5478. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5479. var i;
  5480. // hack for #4339: a reactivated component with inner transition
  5481. // does not trigger because the inner node's created hooks are not called
  5482. // again. It's not ideal to involve module-specific logic in here but
  5483. // there doesn't seem to be a better way to do it.
  5484. var innerNode = vnode;
  5485. while (innerNode.componentInstance) {
  5486. innerNode = innerNode.componentInstance._vnode;
  5487. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  5488. for (i = 0; i < cbs.activate.length; ++i) {
  5489. cbs.activate[i](emptyNode, innerNode);
  5490. }
  5491. insertedVnodeQueue.push(innerNode);
  5492. break
  5493. }
  5494. }
  5495. // unlike a newly created component,
  5496. // a reactivated keep-alive component doesn't insert itself
  5497. insert(parentElm, vnode.elm, refElm);
  5498. }
  5499. function insert (parent, elm, ref$$1) {
  5500. if (isDef(parent)) {
  5501. if (isDef(ref$$1)) {
  5502. if (nodeOps.parentNode(ref$$1) === parent) {
  5503. nodeOps.insertBefore(parent, elm, ref$$1);
  5504. }
  5505. } else {
  5506. nodeOps.appendChild(parent, elm);
  5507. }
  5508. }
  5509. }
  5510. function createChildren (vnode, children, insertedVnodeQueue) {
  5511. if (Array.isArray(children)) {
  5512. if (process.env.NODE_ENV !== 'production') {
  5513. checkDuplicateKeys(children);
  5514. }
  5515. for (var i = 0; i < children.length; ++i) {
  5516. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  5517. }
  5518. } else if (isPrimitive(vnode.text)) {
  5519. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  5520. }
  5521. }
  5522. function isPatchable (vnode) {
  5523. while (vnode.componentInstance) {
  5524. vnode = vnode.componentInstance._vnode;
  5525. }
  5526. return isDef(vnode.tag)
  5527. }
  5528. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  5529. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5530. cbs.create[i$1](emptyNode, vnode);
  5531. }
  5532. i = vnode.data.hook; // Reuse variable
  5533. if (isDef(i)) {
  5534. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  5535. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  5536. }
  5537. }
  5538. // set scope id attribute for scoped CSS.
  5539. // this is implemented as a special case to avoid the overhead
  5540. // of going through the normal attribute patching process.
  5541. function setScope (vnode) {
  5542. var i;
  5543. if (isDef(i = vnode.fnScopeId)) {
  5544. nodeOps.setStyleScope(vnode.elm, i);
  5545. } else {
  5546. var ancestor = vnode;
  5547. while (ancestor) {
  5548. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  5549. nodeOps.setStyleScope(vnode.elm, i);
  5550. }
  5551. ancestor = ancestor.parent;
  5552. }
  5553. }
  5554. // for slot content they should also get the scopeId from the host instance.
  5555. if (isDef(i = activeInstance) &&
  5556. i !== vnode.context &&
  5557. i !== vnode.fnContext &&
  5558. isDef(i = i.$options._scopeId)
  5559. ) {
  5560. nodeOps.setStyleScope(vnode.elm, i);
  5561. }
  5562. }
  5563. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  5564. for (; startIdx <= endIdx; ++startIdx) {
  5565. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  5566. }
  5567. }
  5568. function invokeDestroyHook (vnode) {
  5569. var i, j;
  5570. var data = vnode.data;
  5571. if (isDef(data)) {
  5572. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  5573. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  5574. }
  5575. if (isDef(i = vnode.children)) {
  5576. for (j = 0; j < vnode.children.length; ++j) {
  5577. invokeDestroyHook(vnode.children[j]);
  5578. }
  5579. }
  5580. }
  5581. function removeVnodes (vnodes, startIdx, endIdx) {
  5582. for (; startIdx <= endIdx; ++startIdx) {
  5583. var ch = vnodes[startIdx];
  5584. if (isDef(ch)) {
  5585. if (isDef(ch.tag)) {
  5586. removeAndInvokeRemoveHook(ch);
  5587. invokeDestroyHook(ch);
  5588. } else { // Text node
  5589. removeNode(ch.elm);
  5590. }
  5591. }
  5592. }
  5593. }
  5594. function removeAndInvokeRemoveHook (vnode, rm) {
  5595. if (isDef(rm) || isDef(vnode.data)) {
  5596. var i;
  5597. var listeners = cbs.remove.length + 1;
  5598. if (isDef(rm)) {
  5599. // we have a recursively passed down rm callback
  5600. // increase the listeners count
  5601. rm.listeners += listeners;
  5602. } else {
  5603. // directly removing
  5604. rm = createRmCb(vnode.elm, listeners);
  5605. }
  5606. // recursively invoke hooks on child component root node
  5607. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  5608. removeAndInvokeRemoveHook(i, rm);
  5609. }
  5610. for (i = 0; i < cbs.remove.length; ++i) {
  5611. cbs.remove[i](vnode, rm);
  5612. }
  5613. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  5614. i(vnode, rm);
  5615. } else {
  5616. rm();
  5617. }
  5618. } else {
  5619. removeNode(vnode.elm);
  5620. }
  5621. }
  5622. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  5623. var oldStartIdx = 0;
  5624. var newStartIdx = 0;
  5625. var oldEndIdx = oldCh.length - 1;
  5626. var oldStartVnode = oldCh[0];
  5627. var oldEndVnode = oldCh[oldEndIdx];
  5628. var newEndIdx = newCh.length - 1;
  5629. var newStartVnode = newCh[0];
  5630. var newEndVnode = newCh[newEndIdx];
  5631. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  5632. // removeOnly is a special flag used only by <transition-group>
  5633. // to ensure removed elements stay in correct relative positions
  5634. // during leaving transitions
  5635. var canMove = !removeOnly;
  5636. if (process.env.NODE_ENV !== 'production') {
  5637. checkDuplicateKeys(newCh);
  5638. }
  5639. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  5640. if (isUndef(oldStartVnode)) {
  5641. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  5642. } else if (isUndef(oldEndVnode)) {
  5643. oldEndVnode = oldCh[--oldEndIdx];
  5644. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  5645. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5646. oldStartVnode = oldCh[++oldStartIdx];
  5647. newStartVnode = newCh[++newStartIdx];
  5648. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  5649. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5650. oldEndVnode = oldCh[--oldEndIdx];
  5651. newEndVnode = newCh[--newEndIdx];
  5652. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  5653. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5654. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  5655. oldStartVnode = oldCh[++oldStartIdx];
  5656. newEndVnode = newCh[--newEndIdx];
  5657. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  5658. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5659. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  5660. oldEndVnode = oldCh[--oldEndIdx];
  5661. newStartVnode = newCh[++newStartIdx];
  5662. } else {
  5663. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  5664. idxInOld = isDef(newStartVnode.key)
  5665. ? oldKeyToIdx[newStartVnode.key]
  5666. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  5667. if (isUndef(idxInOld)) { // New element
  5668. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5669. } else {
  5670. vnodeToMove = oldCh[idxInOld];
  5671. if (sameVnode(vnodeToMove, newStartVnode)) {
  5672. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5673. oldCh[idxInOld] = undefined;
  5674. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  5675. } else {
  5676. // same key but different element. treat as new element
  5677. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5678. }
  5679. }
  5680. newStartVnode = newCh[++newStartIdx];
  5681. }
  5682. }
  5683. if (oldStartIdx > oldEndIdx) {
  5684. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  5685. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  5686. } else if (newStartIdx > newEndIdx) {
  5687. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  5688. }
  5689. }
  5690. function checkDuplicateKeys (children) {
  5691. var seenKeys = {};
  5692. for (var i = 0; i < children.length; i++) {
  5693. var vnode = children[i];
  5694. var key = vnode.key;
  5695. if (isDef(key)) {
  5696. if (seenKeys[key]) {
  5697. warn(
  5698. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  5699. vnode.context
  5700. );
  5701. } else {
  5702. seenKeys[key] = true;
  5703. }
  5704. }
  5705. }
  5706. }
  5707. function findIdxInOld (node, oldCh, start, end) {
  5708. for (var i = start; i < end; i++) {
  5709. var c = oldCh[i];
  5710. if (isDef(c) && sameVnode(node, c)) { return i }
  5711. }
  5712. }
  5713. function patchVnode (
  5714. oldVnode,
  5715. vnode,
  5716. insertedVnodeQueue,
  5717. ownerArray,
  5718. index,
  5719. removeOnly
  5720. ) {
  5721. if (oldVnode === vnode) {
  5722. return
  5723. }
  5724. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5725. // clone reused vnode
  5726. vnode = ownerArray[index] = cloneVNode(vnode);
  5727. }
  5728. var elm = vnode.elm = oldVnode.elm;
  5729. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  5730. if (isDef(vnode.asyncFactory.resolved)) {
  5731. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  5732. } else {
  5733. vnode.isAsyncPlaceholder = true;
  5734. }
  5735. return
  5736. }
  5737. // reuse element for static trees.
  5738. // note we only do this if the vnode is cloned -
  5739. // if the new node is not cloned it means the render functions have been
  5740. // reset by the hot-reload-api and we need to do a proper re-render.
  5741. if (isTrue(vnode.isStatic) &&
  5742. isTrue(oldVnode.isStatic) &&
  5743. vnode.key === oldVnode.key &&
  5744. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  5745. ) {
  5746. vnode.componentInstance = oldVnode.componentInstance;
  5747. return
  5748. }
  5749. var i;
  5750. var data = vnode.data;
  5751. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  5752. i(oldVnode, vnode);
  5753. }
  5754. var oldCh = oldVnode.children;
  5755. var ch = vnode.children;
  5756. if (isDef(data) && isPatchable(vnode)) {
  5757. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  5758. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  5759. }
  5760. if (isUndef(vnode.text)) {
  5761. if (isDef(oldCh) && isDef(ch)) {
  5762. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  5763. } else if (isDef(ch)) {
  5764. if (process.env.NODE_ENV !== 'production') {
  5765. checkDuplicateKeys(ch);
  5766. }
  5767. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  5768. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  5769. } else if (isDef(oldCh)) {
  5770. removeVnodes(oldCh, 0, oldCh.length - 1);
  5771. } else if (isDef(oldVnode.text)) {
  5772. nodeOps.setTextContent(elm, '');
  5773. }
  5774. } else if (oldVnode.text !== vnode.text) {
  5775. nodeOps.setTextContent(elm, vnode.text);
  5776. }
  5777. if (isDef(data)) {
  5778. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  5779. }
  5780. }
  5781. function invokeInsertHook (vnode, queue, initial) {
  5782. // delay insert hooks for component root nodes, invoke them after the
  5783. // element is really inserted
  5784. if (isTrue(initial) && isDef(vnode.parent)) {
  5785. vnode.parent.data.pendingInsert = queue;
  5786. } else {
  5787. for (var i = 0; i < queue.length; ++i) {
  5788. queue[i].data.hook.insert(queue[i]);
  5789. }
  5790. }
  5791. }
  5792. var hydrationBailed = false;
  5793. // list of modules that can skip create hook during hydration because they
  5794. // are already rendered on the client or has no need for initialization
  5795. // Note: style is excluded because it relies on initial clone for future
  5796. // deep updates (#7063).
  5797. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  5798. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  5799. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  5800. var i;
  5801. var tag = vnode.tag;
  5802. var data = vnode.data;
  5803. var children = vnode.children;
  5804. inVPre = inVPre || (data && data.pre);
  5805. vnode.elm = elm;
  5806. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  5807. vnode.isAsyncPlaceholder = true;
  5808. return true
  5809. }
  5810. // assert node match
  5811. if (process.env.NODE_ENV !== 'production') {
  5812. if (!assertNodeMatch(elm, vnode, inVPre)) {
  5813. return false
  5814. }
  5815. }
  5816. if (isDef(data)) {
  5817. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  5818. if (isDef(i = vnode.componentInstance)) {
  5819. // child component. it should have hydrated its own tree.
  5820. initComponent(vnode, insertedVnodeQueue);
  5821. return true
  5822. }
  5823. }
  5824. if (isDef(tag)) {
  5825. if (isDef(children)) {
  5826. // empty element, allow client to pick up and populate children
  5827. if (!elm.hasChildNodes()) {
  5828. createChildren(vnode, children, insertedVnodeQueue);
  5829. } else {
  5830. // v-html and domProps: innerHTML
  5831. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  5832. if (i !== elm.innerHTML) {
  5833. /* istanbul ignore if */
  5834. if (process.env.NODE_ENV !== 'production' &&
  5835. typeof console !== 'undefined' &&
  5836. !hydrationBailed
  5837. ) {
  5838. hydrationBailed = true;
  5839. console.warn('Parent: ', elm);
  5840. console.warn('server innerHTML: ', i);
  5841. console.warn('client innerHTML: ', elm.innerHTML);
  5842. }
  5843. return false
  5844. }
  5845. } else {
  5846. // iterate and compare children lists
  5847. var childrenMatch = true;
  5848. var childNode = elm.firstChild;
  5849. for (var i$1 = 0; i$1 < children.length; i$1++) {
  5850. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  5851. childrenMatch = false;
  5852. break
  5853. }
  5854. childNode = childNode.nextSibling;
  5855. }
  5856. // if childNode is not null, it means the actual childNodes list is
  5857. // longer than the virtual children list.
  5858. if (!childrenMatch || childNode) {
  5859. /* istanbul ignore if */
  5860. if (process.env.NODE_ENV !== 'production' &&
  5861. typeof console !== 'undefined' &&
  5862. !hydrationBailed
  5863. ) {
  5864. hydrationBailed = true;
  5865. console.warn('Parent: ', elm);
  5866. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  5867. }
  5868. return false
  5869. }
  5870. }
  5871. }
  5872. }
  5873. if (isDef(data)) {
  5874. var fullInvoke = false;
  5875. for (var key in data) {
  5876. if (!isRenderedModule(key)) {
  5877. fullInvoke = true;
  5878. invokeCreateHooks(vnode, insertedVnodeQueue);
  5879. break
  5880. }
  5881. }
  5882. if (!fullInvoke && data['class']) {
  5883. // ensure collecting deps for deep class bindings for future updates
  5884. traverse(data['class']);
  5885. }
  5886. }
  5887. } else if (elm.data !== vnode.text) {
  5888. elm.data = vnode.text;
  5889. }
  5890. return true
  5891. }
  5892. function assertNodeMatch (node, vnode, inVPre) {
  5893. if (isDef(vnode.tag)) {
  5894. return vnode.tag.indexOf('vue-component') === 0 || (
  5895. !isUnknownElement$$1(vnode, inVPre) &&
  5896. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  5897. )
  5898. } else {
  5899. return node.nodeType === (vnode.isComment ? 8 : 3)
  5900. }
  5901. }
  5902. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  5903. if (isUndef(vnode)) {
  5904. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  5905. return
  5906. }
  5907. var isInitialPatch = false;
  5908. var insertedVnodeQueue = [];
  5909. if (isUndef(oldVnode)) {
  5910. // empty mount (likely as component), create new root element
  5911. isInitialPatch = true;
  5912. createElm(vnode, insertedVnodeQueue);
  5913. } else {
  5914. var isRealElement = isDef(oldVnode.nodeType);
  5915. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  5916. // patch existing root node
  5917. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  5918. } else {
  5919. if (isRealElement) {
  5920. // mounting to a real element
  5921. // check if this is server-rendered content and if we can perform
  5922. // a successful hydration.
  5923. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  5924. oldVnode.removeAttribute(SSR_ATTR);
  5925. hydrating = true;
  5926. }
  5927. if (isTrue(hydrating)) {
  5928. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  5929. invokeInsertHook(vnode, insertedVnodeQueue, true);
  5930. return oldVnode
  5931. } else if (process.env.NODE_ENV !== 'production') {
  5932. warn(
  5933. 'The client-side rendered virtual DOM tree is not matching ' +
  5934. 'server-rendered content. This is likely caused by incorrect ' +
  5935. 'HTML markup, for example nesting block-level elements inside ' +
  5936. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  5937. 'full client-side render.'
  5938. );
  5939. }
  5940. }
  5941. // either not server-rendered, or hydration failed.
  5942. // create an empty node and replace it
  5943. oldVnode = emptyNodeAt(oldVnode);
  5944. }
  5945. // replacing existing element
  5946. var oldElm = oldVnode.elm;
  5947. var parentElm = nodeOps.parentNode(oldElm);
  5948. // create new node
  5949. createElm(
  5950. vnode,
  5951. insertedVnodeQueue,
  5952. // extremely rare edge case: do not insert if old element is in a
  5953. // leaving transition. Only happens when combining transition +
  5954. // keep-alive + HOCs. (#4590)
  5955. oldElm._leaveCb ? null : parentElm,
  5956. nodeOps.nextSibling(oldElm)
  5957. );
  5958. // update parent placeholder node element, recursively
  5959. if (isDef(vnode.parent)) {
  5960. var ancestor = vnode.parent;
  5961. var patchable = isPatchable(vnode);
  5962. while (ancestor) {
  5963. for (var i = 0; i < cbs.destroy.length; ++i) {
  5964. cbs.destroy[i](ancestor);
  5965. }
  5966. ancestor.elm = vnode.elm;
  5967. if (patchable) {
  5968. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5969. cbs.create[i$1](emptyNode, ancestor);
  5970. }
  5971. // #6513
  5972. // invoke insert hooks that may have been merged by create hooks.
  5973. // e.g. for directives that uses the "inserted" hook.
  5974. var insert = ancestor.data.hook.insert;
  5975. if (insert.merged) {
  5976. // start at index 1 to avoid re-invoking component mounted hook
  5977. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  5978. insert.fns[i$2]();
  5979. }
  5980. }
  5981. } else {
  5982. registerRef(ancestor);
  5983. }
  5984. ancestor = ancestor.parent;
  5985. }
  5986. }
  5987. // destroy old node
  5988. if (isDef(parentElm)) {
  5989. removeVnodes([oldVnode], 0, 0);
  5990. } else if (isDef(oldVnode.tag)) {
  5991. invokeDestroyHook(oldVnode);
  5992. }
  5993. }
  5994. }
  5995. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  5996. return vnode.elm
  5997. }
  5998. }
  5999. /* */
  6000. var directives = {
  6001. create: updateDirectives,
  6002. update: updateDirectives,
  6003. destroy: function unbindDirectives (vnode) {
  6004. updateDirectives(vnode, emptyNode);
  6005. }
  6006. };
  6007. function updateDirectives (oldVnode, vnode) {
  6008. if (oldVnode.data.directives || vnode.data.directives) {
  6009. _update(oldVnode, vnode);
  6010. }
  6011. }
  6012. function _update (oldVnode, vnode) {
  6013. var isCreate = oldVnode === emptyNode;
  6014. var isDestroy = vnode === emptyNode;
  6015. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  6016. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  6017. var dirsWithInsert = [];
  6018. var dirsWithPostpatch = [];
  6019. var key, oldDir, dir;
  6020. for (key in newDirs) {
  6021. oldDir = oldDirs[key];
  6022. dir = newDirs[key];
  6023. if (!oldDir) {
  6024. // new directive, bind
  6025. callHook$1(dir, 'bind', vnode, oldVnode);
  6026. if (dir.def && dir.def.inserted) {
  6027. dirsWithInsert.push(dir);
  6028. }
  6029. } else {
  6030. // existing directive, update
  6031. dir.oldValue = oldDir.value;
  6032. dir.oldArg = oldDir.arg;
  6033. callHook$1(dir, 'update', vnode, oldVnode);
  6034. if (dir.def && dir.def.componentUpdated) {
  6035. dirsWithPostpatch.push(dir);
  6036. }
  6037. }
  6038. }
  6039. if (dirsWithInsert.length) {
  6040. var callInsert = function () {
  6041. for (var i = 0; i < dirsWithInsert.length; i++) {
  6042. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  6043. }
  6044. };
  6045. if (isCreate) {
  6046. mergeVNodeHook(vnode, 'insert', callInsert);
  6047. } else {
  6048. callInsert();
  6049. }
  6050. }
  6051. if (dirsWithPostpatch.length) {
  6052. mergeVNodeHook(vnode, 'postpatch', function () {
  6053. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  6054. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  6055. }
  6056. });
  6057. }
  6058. if (!isCreate) {
  6059. for (key in oldDirs) {
  6060. if (!newDirs[key]) {
  6061. // no longer present, unbind
  6062. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  6063. }
  6064. }
  6065. }
  6066. }
  6067. var emptyModifiers = Object.create(null);
  6068. function normalizeDirectives$1 (
  6069. dirs,
  6070. vm
  6071. ) {
  6072. var res = Object.create(null);
  6073. if (!dirs) {
  6074. // $flow-disable-line
  6075. return res
  6076. }
  6077. var i, dir;
  6078. for (i = 0; i < dirs.length; i++) {
  6079. dir = dirs[i];
  6080. if (!dir.modifiers) {
  6081. // $flow-disable-line
  6082. dir.modifiers = emptyModifiers;
  6083. }
  6084. res[getRawDirName(dir)] = dir;
  6085. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  6086. }
  6087. // $flow-disable-line
  6088. return res
  6089. }
  6090. function getRawDirName (dir) {
  6091. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  6092. }
  6093. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  6094. var fn = dir.def && dir.def[hook];
  6095. if (fn) {
  6096. try {
  6097. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  6098. } catch (e) {
  6099. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  6100. }
  6101. }
  6102. }
  6103. var baseModules = [
  6104. ref,
  6105. directives
  6106. ];
  6107. /* */
  6108. function updateAttrs (oldVnode, vnode) {
  6109. var opts = vnode.componentOptions;
  6110. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  6111. return
  6112. }
  6113. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  6114. return
  6115. }
  6116. var key, cur, old;
  6117. var elm = vnode.elm;
  6118. var oldAttrs = oldVnode.data.attrs || {};
  6119. var attrs = vnode.data.attrs || {};
  6120. // clone observed objects, as the user probably wants to mutate it
  6121. if (isDef(attrs.__ob__)) {
  6122. attrs = vnode.data.attrs = extend({}, attrs);
  6123. }
  6124. for (key in attrs) {
  6125. cur = attrs[key];
  6126. old = oldAttrs[key];
  6127. if (old !== cur) {
  6128. setAttr(elm, key, cur, vnode.data.pre);
  6129. }
  6130. }
  6131. // #4391: in IE9, setting type can reset value for input[type=radio]
  6132. // #6666: IE/Edge forces progress value down to 1 before setting a max
  6133. /* istanbul ignore if */
  6134. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  6135. setAttr(elm, 'value', attrs.value);
  6136. }
  6137. for (key in oldAttrs) {
  6138. if (isUndef(attrs[key])) {
  6139. if (isXlink(key)) {
  6140. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6141. } else if (!isEnumeratedAttr(key)) {
  6142. elm.removeAttribute(key);
  6143. }
  6144. }
  6145. }
  6146. }
  6147. function setAttr (el, key, value, isInPre) {
  6148. if (isInPre || el.tagName.indexOf('-') > -1) {
  6149. baseSetAttr(el, key, value);
  6150. } else if (isBooleanAttr(key)) {
  6151. // set attribute for blank value
  6152. // e.g. <option disabled>Select one</option>
  6153. if (isFalsyAttrValue(value)) {
  6154. el.removeAttribute(key);
  6155. } else {
  6156. // technically allowfullscreen is a boolean attribute for <iframe>,
  6157. // but Flash expects a value of "true" when used on <embed> tag
  6158. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  6159. ? 'true'
  6160. : key;
  6161. el.setAttribute(key, value);
  6162. }
  6163. } else if (isEnumeratedAttr(key)) {
  6164. el.setAttribute(key, convertEnumeratedValue(key, value));
  6165. } else if (isXlink(key)) {
  6166. if (isFalsyAttrValue(value)) {
  6167. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6168. } else {
  6169. el.setAttributeNS(xlinkNS, key, value);
  6170. }
  6171. } else {
  6172. baseSetAttr(el, key, value);
  6173. }
  6174. }
  6175. function baseSetAttr (el, key, value) {
  6176. if (isFalsyAttrValue(value)) {
  6177. el.removeAttribute(key);
  6178. } else {
  6179. // #7138: IE10 & 11 fires input event when setting placeholder on
  6180. // <textarea>... block the first input event and remove the blocker
  6181. // immediately.
  6182. /* istanbul ignore if */
  6183. if (
  6184. isIE && !isIE9 &&
  6185. el.tagName === 'TEXTAREA' &&
  6186. key === 'placeholder' && value !== '' && !el.__ieph
  6187. ) {
  6188. var blocker = function (e) {
  6189. e.stopImmediatePropagation();
  6190. el.removeEventListener('input', blocker);
  6191. };
  6192. el.addEventListener('input', blocker);
  6193. // $flow-disable-line
  6194. el.__ieph = true; /* IE placeholder patched */
  6195. }
  6196. el.setAttribute(key, value);
  6197. }
  6198. }
  6199. var attrs = {
  6200. create: updateAttrs,
  6201. update: updateAttrs
  6202. };
  6203. /* */
  6204. function updateClass (oldVnode, vnode) {
  6205. var el = vnode.elm;
  6206. var data = vnode.data;
  6207. var oldData = oldVnode.data;
  6208. if (
  6209. isUndef(data.staticClass) &&
  6210. isUndef(data.class) && (
  6211. isUndef(oldData) || (
  6212. isUndef(oldData.staticClass) &&
  6213. isUndef(oldData.class)
  6214. )
  6215. )
  6216. ) {
  6217. return
  6218. }
  6219. var cls = genClassForVnode(vnode);
  6220. // handle transition classes
  6221. var transitionClass = el._transitionClasses;
  6222. if (isDef(transitionClass)) {
  6223. cls = concat(cls, stringifyClass(transitionClass));
  6224. }
  6225. // set the class
  6226. if (cls !== el._prevClass) {
  6227. el.setAttribute('class', cls);
  6228. el._prevClass = cls;
  6229. }
  6230. }
  6231. var klass = {
  6232. create: updateClass,
  6233. update: updateClass
  6234. };
  6235. /* */
  6236. var validDivisionCharRE = /[\w).+\-_$\]]/;
  6237. function parseFilters (exp) {
  6238. var inSingle = false;
  6239. var inDouble = false;
  6240. var inTemplateString = false;
  6241. var inRegex = false;
  6242. var curly = 0;
  6243. var square = 0;
  6244. var paren = 0;
  6245. var lastFilterIndex = 0;
  6246. var c, prev, i, expression, filters;
  6247. for (i = 0; i < exp.length; i++) {
  6248. prev = c;
  6249. c = exp.charCodeAt(i);
  6250. if (inSingle) {
  6251. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  6252. } else if (inDouble) {
  6253. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  6254. } else if (inTemplateString) {
  6255. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  6256. } else if (inRegex) {
  6257. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  6258. } else if (
  6259. c === 0x7C && // pipe
  6260. exp.charCodeAt(i + 1) !== 0x7C &&
  6261. exp.charCodeAt(i - 1) !== 0x7C &&
  6262. !curly && !square && !paren
  6263. ) {
  6264. if (expression === undefined) {
  6265. // first filter, end of expression
  6266. lastFilterIndex = i + 1;
  6267. expression = exp.slice(0, i).trim();
  6268. } else {
  6269. pushFilter();
  6270. }
  6271. } else {
  6272. switch (c) {
  6273. case 0x22: inDouble = true; break // "
  6274. case 0x27: inSingle = true; break // '
  6275. case 0x60: inTemplateString = true; break // `
  6276. case 0x28: paren++; break // (
  6277. case 0x29: paren--; break // )
  6278. case 0x5B: square++; break // [
  6279. case 0x5D: square--; break // ]
  6280. case 0x7B: curly++; break // {
  6281. case 0x7D: curly--; break // }
  6282. }
  6283. if (c === 0x2f) { // /
  6284. var j = i - 1;
  6285. var p = (void 0);
  6286. // find first non-whitespace prev char
  6287. for (; j >= 0; j--) {
  6288. p = exp.charAt(j);
  6289. if (p !== ' ') { break }
  6290. }
  6291. if (!p || !validDivisionCharRE.test(p)) {
  6292. inRegex = true;
  6293. }
  6294. }
  6295. }
  6296. }
  6297. if (expression === undefined) {
  6298. expression = exp.slice(0, i).trim();
  6299. } else if (lastFilterIndex !== 0) {
  6300. pushFilter();
  6301. }
  6302. function pushFilter () {
  6303. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  6304. lastFilterIndex = i + 1;
  6305. }
  6306. if (filters) {
  6307. for (i = 0; i < filters.length; i++) {
  6308. expression = wrapFilter(expression, filters[i]);
  6309. }
  6310. }
  6311. return expression
  6312. }
  6313. function wrapFilter (exp, filter) {
  6314. var i = filter.indexOf('(');
  6315. if (i < 0) {
  6316. // _f: resolveFilter
  6317. return ("_f(\"" + filter + "\")(" + exp + ")")
  6318. } else {
  6319. var name = filter.slice(0, i);
  6320. var args = filter.slice(i + 1);
  6321. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  6322. }
  6323. }
  6324. /* */
  6325. /* eslint-disable no-unused-vars */
  6326. function baseWarn (msg, range) {
  6327. console.error(("[Vue compiler]: " + msg));
  6328. }
  6329. /* eslint-enable no-unused-vars */
  6330. function pluckModuleFunction (
  6331. modules,
  6332. key
  6333. ) {
  6334. return modules
  6335. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  6336. : []
  6337. }
  6338. function addProp (el, name, value, range, dynamic) {
  6339. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  6340. el.plain = false;
  6341. }
  6342. function addAttr (el, name, value, range, dynamic) {
  6343. var attrs = dynamic
  6344. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  6345. : (el.attrs || (el.attrs = []));
  6346. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  6347. el.plain = false;
  6348. }
  6349. // add a raw attr (use this in preTransforms)
  6350. function addRawAttr (el, name, value, range) {
  6351. el.attrsMap[name] = value;
  6352. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  6353. }
  6354. function addDirective (
  6355. el,
  6356. name,
  6357. rawName,
  6358. value,
  6359. arg,
  6360. isDynamicArg,
  6361. modifiers,
  6362. range
  6363. ) {
  6364. (el.directives || (el.directives = [])).push(rangeSetItem({
  6365. name: name,
  6366. rawName: rawName,
  6367. value: value,
  6368. arg: arg,
  6369. isDynamicArg: isDynamicArg,
  6370. modifiers: modifiers
  6371. }, range));
  6372. el.plain = false;
  6373. }
  6374. function prependModifierMarker (symbol, name, dynamic) {
  6375. return dynamic
  6376. ? ("_p(" + name + ",\"" + symbol + "\")")
  6377. : symbol + name // mark the event as captured
  6378. }
  6379. function addHandler (
  6380. el,
  6381. name,
  6382. value,
  6383. modifiers,
  6384. important,
  6385. warn,
  6386. range,
  6387. dynamic
  6388. ) {
  6389. modifiers = modifiers || emptyObject;
  6390. // warn prevent and passive modifier
  6391. /* istanbul ignore if */
  6392. if (
  6393. process.env.NODE_ENV !== 'production' && warn &&
  6394. modifiers.prevent && modifiers.passive
  6395. ) {
  6396. warn(
  6397. 'passive and prevent can\'t be used together. ' +
  6398. 'Passive handler can\'t prevent default event.',
  6399. range
  6400. );
  6401. }
  6402. // normalize click.right and click.middle since they don't actually fire
  6403. // this is technically browser-specific, but at least for now browsers are
  6404. // the only target envs that have right/middle clicks.
  6405. if (modifiers.right) {
  6406. if (dynamic) {
  6407. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  6408. } else if (name === 'click') {
  6409. name = 'contextmenu';
  6410. delete modifiers.right;
  6411. }
  6412. } else if (modifiers.middle) {
  6413. if (dynamic) {
  6414. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  6415. } else if (name === 'click') {
  6416. name = 'mouseup';
  6417. }
  6418. }
  6419. // check capture modifier
  6420. if (modifiers.capture) {
  6421. delete modifiers.capture;
  6422. name = prependModifierMarker('!', name, dynamic);
  6423. }
  6424. if (modifiers.once) {
  6425. delete modifiers.once;
  6426. name = prependModifierMarker('~', name, dynamic);
  6427. }
  6428. /* istanbul ignore if */
  6429. if (modifiers.passive) {
  6430. delete modifiers.passive;
  6431. name = prependModifierMarker('&', name, dynamic);
  6432. }
  6433. var events;
  6434. if (modifiers.native) {
  6435. delete modifiers.native;
  6436. events = el.nativeEvents || (el.nativeEvents = {});
  6437. } else {
  6438. events = el.events || (el.events = {});
  6439. }
  6440. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  6441. if (modifiers !== emptyObject) {
  6442. newHandler.modifiers = modifiers;
  6443. }
  6444. var handlers = events[name];
  6445. /* istanbul ignore if */
  6446. if (Array.isArray(handlers)) {
  6447. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  6448. } else if (handlers) {
  6449. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  6450. } else {
  6451. events[name] = newHandler;
  6452. }
  6453. el.plain = false;
  6454. }
  6455. function getRawBindingAttr (
  6456. el,
  6457. name
  6458. ) {
  6459. return el.rawAttrsMap[':' + name] ||
  6460. el.rawAttrsMap['v-bind:' + name] ||
  6461. el.rawAttrsMap[name]
  6462. }
  6463. function getBindingAttr (
  6464. el,
  6465. name,
  6466. getStatic
  6467. ) {
  6468. var dynamicValue =
  6469. getAndRemoveAttr(el, ':' + name) ||
  6470. getAndRemoveAttr(el, 'v-bind:' + name);
  6471. if (dynamicValue != null) {
  6472. return parseFilters(dynamicValue)
  6473. } else if (getStatic !== false) {
  6474. var staticValue = getAndRemoveAttr(el, name);
  6475. if (staticValue != null) {
  6476. return JSON.stringify(staticValue)
  6477. }
  6478. }
  6479. }
  6480. // note: this only removes the attr from the Array (attrsList) so that it
  6481. // doesn't get processed by processAttrs.
  6482. // By default it does NOT remove it from the map (attrsMap) because the map is
  6483. // needed during codegen.
  6484. function getAndRemoveAttr (
  6485. el,
  6486. name,
  6487. removeFromMap
  6488. ) {
  6489. var val;
  6490. if ((val = el.attrsMap[name]) != null) {
  6491. var list = el.attrsList;
  6492. for (var i = 0, l = list.length; i < l; i++) {
  6493. if (list[i].name === name) {
  6494. list.splice(i, 1);
  6495. break
  6496. }
  6497. }
  6498. }
  6499. if (removeFromMap) {
  6500. delete el.attrsMap[name];
  6501. }
  6502. return val
  6503. }
  6504. function getAndRemoveAttrByRegex (
  6505. el,
  6506. name
  6507. ) {
  6508. var list = el.attrsList;
  6509. for (var i = 0, l = list.length; i < l; i++) {
  6510. var attr = list[i];
  6511. if (name.test(attr.name)) {
  6512. list.splice(i, 1);
  6513. return attr
  6514. }
  6515. }
  6516. }
  6517. function rangeSetItem (
  6518. item,
  6519. range
  6520. ) {
  6521. if (range) {
  6522. if (range.start != null) {
  6523. item.start = range.start;
  6524. }
  6525. if (range.end != null) {
  6526. item.end = range.end;
  6527. }
  6528. }
  6529. return item
  6530. }
  6531. /* */
  6532. /**
  6533. * Cross-platform code generation for component v-model
  6534. */
  6535. function genComponentModel (
  6536. el,
  6537. value,
  6538. modifiers
  6539. ) {
  6540. var ref = modifiers || {};
  6541. var number = ref.number;
  6542. var trim = ref.trim;
  6543. var baseValueExpression = '$$v';
  6544. var valueExpression = baseValueExpression;
  6545. if (trim) {
  6546. valueExpression =
  6547. "(typeof " + baseValueExpression + " === 'string'" +
  6548. "? " + baseValueExpression + ".trim()" +
  6549. ": " + baseValueExpression + ")";
  6550. }
  6551. if (number) {
  6552. valueExpression = "_n(" + valueExpression + ")";
  6553. }
  6554. var assignment = genAssignmentCode(value, valueExpression);
  6555. el.model = {
  6556. value: ("(" + value + ")"),
  6557. expression: JSON.stringify(value),
  6558. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  6559. };
  6560. }
  6561. /**
  6562. * Cross-platform codegen helper for generating v-model value assignment code.
  6563. */
  6564. function genAssignmentCode (
  6565. value,
  6566. assignment
  6567. ) {
  6568. var res = parseModel(value);
  6569. if (res.key === null) {
  6570. return (value + "=" + assignment)
  6571. } else {
  6572. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  6573. }
  6574. }
  6575. /**
  6576. * Parse a v-model expression into a base path and a final key segment.
  6577. * Handles both dot-path and possible square brackets.
  6578. *
  6579. * Possible cases:
  6580. *
  6581. * - test
  6582. * - test[key]
  6583. * - test[test1[key]]
  6584. * - test["a"][key]
  6585. * - xxx.test[a[a].test1[key]]
  6586. * - test.xxx.a["asa"][test1[key]]
  6587. *
  6588. */
  6589. var len, str, chr, index$1, expressionPos, expressionEndPos;
  6590. function parseModel (val) {
  6591. // Fix https://github.com/vuejs/vue/pull/7730
  6592. // allow v-model="obj.val " (trailing whitespace)
  6593. val = val.trim();
  6594. len = val.length;
  6595. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  6596. index$1 = val.lastIndexOf('.');
  6597. if (index$1 > -1) {
  6598. return {
  6599. exp: val.slice(0, index$1),
  6600. key: '"' + val.slice(index$1 + 1) + '"'
  6601. }
  6602. } else {
  6603. return {
  6604. exp: val,
  6605. key: null
  6606. }
  6607. }
  6608. }
  6609. str = val;
  6610. index$1 = expressionPos = expressionEndPos = 0;
  6611. while (!eof()) {
  6612. chr = next();
  6613. /* istanbul ignore if */
  6614. if (isStringStart(chr)) {
  6615. parseString(chr);
  6616. } else if (chr === 0x5B) {
  6617. parseBracket(chr);
  6618. }
  6619. }
  6620. return {
  6621. exp: val.slice(0, expressionPos),
  6622. key: val.slice(expressionPos + 1, expressionEndPos)
  6623. }
  6624. }
  6625. function next () {
  6626. return str.charCodeAt(++index$1)
  6627. }
  6628. function eof () {
  6629. return index$1 >= len
  6630. }
  6631. function isStringStart (chr) {
  6632. return chr === 0x22 || chr === 0x27
  6633. }
  6634. function parseBracket (chr) {
  6635. var inBracket = 1;
  6636. expressionPos = index$1;
  6637. while (!eof()) {
  6638. chr = next();
  6639. if (isStringStart(chr)) {
  6640. parseString(chr);
  6641. continue
  6642. }
  6643. if (chr === 0x5B) { inBracket++; }
  6644. if (chr === 0x5D) { inBracket--; }
  6645. if (inBracket === 0) {
  6646. expressionEndPos = index$1;
  6647. break
  6648. }
  6649. }
  6650. }
  6651. function parseString (chr) {
  6652. var stringQuote = chr;
  6653. while (!eof()) {
  6654. chr = next();
  6655. if (chr === stringQuote) {
  6656. break
  6657. }
  6658. }
  6659. }
  6660. /* */
  6661. var warn$1;
  6662. // in some cases, the event used has to be determined at runtime
  6663. // so we used some reserved tokens during compile.
  6664. var RANGE_TOKEN = '__r';
  6665. var CHECKBOX_RADIO_TOKEN = '__c';
  6666. function model (
  6667. el,
  6668. dir,
  6669. _warn
  6670. ) {
  6671. warn$1 = _warn;
  6672. var value = dir.value;
  6673. var modifiers = dir.modifiers;
  6674. var tag = el.tag;
  6675. var type = el.attrsMap.type;
  6676. if (process.env.NODE_ENV !== 'production') {
  6677. // inputs with type="file" are read only and setting the input's
  6678. // value will throw an error.
  6679. if (tag === 'input' && type === 'file') {
  6680. warn$1(
  6681. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  6682. "File inputs are read only. Use a v-on:change listener instead.",
  6683. el.rawAttrsMap['v-model']
  6684. );
  6685. }
  6686. }
  6687. if (el.component) {
  6688. genComponentModel(el, value, modifiers);
  6689. // component v-model doesn't need extra runtime
  6690. return false
  6691. } else if (tag === 'select') {
  6692. genSelect(el, value, modifiers);
  6693. } else if (tag === 'input' && type === 'checkbox') {
  6694. genCheckboxModel(el, value, modifiers);
  6695. } else if (tag === 'input' && type === 'radio') {
  6696. genRadioModel(el, value, modifiers);
  6697. } else if (tag === 'input' || tag === 'textarea') {
  6698. genDefaultModel(el, value, modifiers);
  6699. } else if (!config.isReservedTag(tag)) {
  6700. genComponentModel(el, value, modifiers);
  6701. // component v-model doesn't need extra runtime
  6702. return false
  6703. } else if (process.env.NODE_ENV !== 'production') {
  6704. warn$1(
  6705. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  6706. "v-model is not supported on this element type. " +
  6707. 'If you are working with contenteditable, it\'s recommended to ' +
  6708. 'wrap a library dedicated for that purpose inside a custom component.',
  6709. el.rawAttrsMap['v-model']
  6710. );
  6711. }
  6712. // ensure runtime directive metadata
  6713. return true
  6714. }
  6715. function genCheckboxModel (
  6716. el,
  6717. value,
  6718. modifiers
  6719. ) {
  6720. var number = modifiers && modifiers.number;
  6721. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6722. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  6723. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  6724. addProp(el, 'checked',
  6725. "Array.isArray(" + value + ")" +
  6726. "?_i(" + value + "," + valueBinding + ")>-1" + (
  6727. trueValueBinding === 'true'
  6728. ? (":(" + value + ")")
  6729. : (":_q(" + value + "," + trueValueBinding + ")")
  6730. )
  6731. );
  6732. addHandler(el, 'change',
  6733. "var $$a=" + value + "," +
  6734. '$$el=$event.target,' +
  6735. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  6736. 'if(Array.isArray($$a)){' +
  6737. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  6738. '$$i=_i($$a,$$v);' +
  6739. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  6740. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  6741. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  6742. null, true
  6743. );
  6744. }
  6745. function genRadioModel (
  6746. el,
  6747. value,
  6748. modifiers
  6749. ) {
  6750. var number = modifiers && modifiers.number;
  6751. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6752. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  6753. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  6754. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  6755. }
  6756. function genSelect (
  6757. el,
  6758. value,
  6759. modifiers
  6760. ) {
  6761. var number = modifiers && modifiers.number;
  6762. var selectedVal = "Array.prototype.filter" +
  6763. ".call($event.target.options,function(o){return o.selected})" +
  6764. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  6765. "return " + (number ? '_n(val)' : 'val') + "})";
  6766. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  6767. var code = "var $$selectedVal = " + selectedVal + ";";
  6768. code = code + " " + (genAssignmentCode(value, assignment));
  6769. addHandler(el, 'change', code, null, true);
  6770. }
  6771. function genDefaultModel (
  6772. el,
  6773. value,
  6774. modifiers
  6775. ) {
  6776. var type = el.attrsMap.type;
  6777. // warn if v-bind:value conflicts with v-model
  6778. // except for inputs with v-bind:type
  6779. if (process.env.NODE_ENV !== 'production') {
  6780. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  6781. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  6782. if (value$1 && !typeBinding) {
  6783. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  6784. warn$1(
  6785. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  6786. 'because the latter already expands to a value binding internally',
  6787. el.rawAttrsMap[binding]
  6788. );
  6789. }
  6790. }
  6791. var ref = modifiers || {};
  6792. var lazy = ref.lazy;
  6793. var number = ref.number;
  6794. var trim = ref.trim;
  6795. var needCompositionGuard = !lazy && type !== 'range';
  6796. var event = lazy
  6797. ? 'change'
  6798. : type === 'range'
  6799. ? RANGE_TOKEN
  6800. : 'input';
  6801. var valueExpression = '$event.target.value';
  6802. if (trim) {
  6803. valueExpression = "$event.target.value.trim()";
  6804. }
  6805. if (number) {
  6806. valueExpression = "_n(" + valueExpression + ")";
  6807. }
  6808. var code = genAssignmentCode(value, valueExpression);
  6809. if (needCompositionGuard) {
  6810. code = "if($event.target.composing)return;" + code;
  6811. }
  6812. addProp(el, 'value', ("(" + value + ")"));
  6813. addHandler(el, event, code, null, true);
  6814. if (trim || number) {
  6815. addHandler(el, 'blur', '$forceUpdate()');
  6816. }
  6817. }
  6818. /* */
  6819. // normalize v-model event tokens that can only be determined at runtime.
  6820. // it's important to place the event as the first in the array because
  6821. // the whole point is ensuring the v-model callback gets called before
  6822. // user-attached handlers.
  6823. function normalizeEvents (on) {
  6824. /* istanbul ignore if */
  6825. if (isDef(on[RANGE_TOKEN])) {
  6826. // IE input[type=range] only supports `change` event
  6827. var event = isIE ? 'change' : 'input';
  6828. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  6829. delete on[RANGE_TOKEN];
  6830. }
  6831. // This was originally intended to fix #4521 but no longer necessary
  6832. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  6833. /* istanbul ignore if */
  6834. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  6835. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  6836. delete on[CHECKBOX_RADIO_TOKEN];
  6837. }
  6838. }
  6839. var target$1;
  6840. function createOnceHandler$1 (event, handler, capture) {
  6841. var _target = target$1; // save current target element in closure
  6842. return function onceHandler () {
  6843. var res = handler.apply(null, arguments);
  6844. if (res !== null) {
  6845. remove$2(event, onceHandler, capture, _target);
  6846. }
  6847. }
  6848. }
  6849. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  6850. // implementation and does not fire microtasks in between event propagation, so
  6851. // safe to exclude.
  6852. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  6853. function add$1 (
  6854. name,
  6855. handler,
  6856. capture,
  6857. passive
  6858. ) {
  6859. // async edge case #6566: inner click event triggers patch, event handler
  6860. // attached to outer element during patch, and triggered again. This
  6861. // happens because browsers fire microtask ticks between event propagation.
  6862. // the solution is simple: we save the timestamp when a handler is attached,
  6863. // and the handler would only fire if the event passed to it was fired
  6864. // AFTER it was attached.
  6865. if (useMicrotaskFix) {
  6866. var attachedTimestamp = currentFlushTimestamp;
  6867. var original = handler;
  6868. handler = original._wrapper = function (e) {
  6869. if (
  6870. // no bubbling, should always fire.
  6871. // this is just a safety net in case event.timeStamp is unreliable in
  6872. // certain weird environments...
  6873. e.target === e.currentTarget ||
  6874. // event is fired after handler attachment
  6875. e.timeStamp >= attachedTimestamp ||
  6876. // bail for environments that have buggy event.timeStamp implementations
  6877. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  6878. // #9681 QtWebEngine event.timeStamp is negative value
  6879. e.timeStamp <= 0 ||
  6880. // #9448 bail if event is fired in another document in a multi-page
  6881. // electron/nw.js app, since event.timeStamp will be using a different
  6882. // starting reference
  6883. e.target.ownerDocument !== document
  6884. ) {
  6885. return original.apply(this, arguments)
  6886. }
  6887. };
  6888. }
  6889. target$1.addEventListener(
  6890. name,
  6891. handler,
  6892. supportsPassive
  6893. ? { capture: capture, passive: passive }
  6894. : capture
  6895. );
  6896. }
  6897. function remove$2 (
  6898. name,
  6899. handler,
  6900. capture,
  6901. _target
  6902. ) {
  6903. (_target || target$1).removeEventListener(
  6904. name,
  6905. handler._wrapper || handler,
  6906. capture
  6907. );
  6908. }
  6909. function updateDOMListeners (oldVnode, vnode) {
  6910. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  6911. return
  6912. }
  6913. var on = vnode.data.on || {};
  6914. var oldOn = oldVnode.data.on || {};
  6915. target$1 = vnode.elm;
  6916. normalizeEvents(on);
  6917. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  6918. target$1 = undefined;
  6919. }
  6920. var events = {
  6921. create: updateDOMListeners,
  6922. update: updateDOMListeners
  6923. };
  6924. /* */
  6925. var svgContainer;
  6926. function updateDOMProps (oldVnode, vnode) {
  6927. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  6928. return
  6929. }
  6930. var key, cur;
  6931. var elm = vnode.elm;
  6932. var oldProps = oldVnode.data.domProps || {};
  6933. var props = vnode.data.domProps || {};
  6934. // clone observed objects, as the user probably wants to mutate it
  6935. if (isDef(props.__ob__)) {
  6936. props = vnode.data.domProps = extend({}, props);
  6937. }
  6938. for (key in oldProps) {
  6939. if (!(key in props)) {
  6940. elm[key] = '';
  6941. }
  6942. }
  6943. for (key in props) {
  6944. cur = props[key];
  6945. // ignore children if the node has textContent or innerHTML,
  6946. // as these will throw away existing DOM nodes and cause removal errors
  6947. // on subsequent patches (#3360)
  6948. if (key === 'textContent' || key === 'innerHTML') {
  6949. if (vnode.children) { vnode.children.length = 0; }
  6950. if (cur === oldProps[key]) { continue }
  6951. // #6601 work around Chrome version <= 55 bug where single textNode
  6952. // replaced by innerHTML/textContent retains its parentNode property
  6953. if (elm.childNodes.length === 1) {
  6954. elm.removeChild(elm.childNodes[0]);
  6955. }
  6956. }
  6957. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  6958. // store value as _value as well since
  6959. // non-string values will be stringified
  6960. elm._value = cur;
  6961. // avoid resetting cursor position when value is the same
  6962. var strCur = isUndef(cur) ? '' : String(cur);
  6963. if (shouldUpdateValue(elm, strCur)) {
  6964. elm.value = strCur;
  6965. }
  6966. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  6967. // IE doesn't support innerHTML for SVG elements
  6968. svgContainer = svgContainer || document.createElement('div');
  6969. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  6970. var svg = svgContainer.firstChild;
  6971. while (elm.firstChild) {
  6972. elm.removeChild(elm.firstChild);
  6973. }
  6974. while (svg.firstChild) {
  6975. elm.appendChild(svg.firstChild);
  6976. }
  6977. } else if (
  6978. // skip the update if old and new VDOM state is the same.
  6979. // `value` is handled separately because the DOM value may be temporarily
  6980. // out of sync with VDOM state due to focus, composition and modifiers.
  6981. // This #4521 by skipping the unnecessary `checked` update.
  6982. cur !== oldProps[key]
  6983. ) {
  6984. // some property updates can throw
  6985. // e.g. `value` on <progress> w/ non-finite value
  6986. try {
  6987. elm[key] = cur;
  6988. } catch (e) {}
  6989. }
  6990. }
  6991. }
  6992. // check platforms/web/util/attrs.js acceptValue
  6993. function shouldUpdateValue (elm, checkVal) {
  6994. return (!elm.composing && (
  6995. elm.tagName === 'OPTION' ||
  6996. isNotInFocusAndDirty(elm, checkVal) ||
  6997. isDirtyWithModifiers(elm, checkVal)
  6998. ))
  6999. }
  7000. function isNotInFocusAndDirty (elm, checkVal) {
  7001. // return true when textbox (.number and .trim) loses focus and its value is
  7002. // not equal to the updated value
  7003. var notInFocus = true;
  7004. // #6157
  7005. // work around IE bug when accessing document.activeElement in an iframe
  7006. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  7007. return notInFocus && elm.value !== checkVal
  7008. }
  7009. function isDirtyWithModifiers (elm, newVal) {
  7010. var value = elm.value;
  7011. var modifiers = elm._vModifiers; // injected by v-model runtime
  7012. if (isDef(modifiers)) {
  7013. if (modifiers.number) {
  7014. return toNumber(value) !== toNumber(newVal)
  7015. }
  7016. if (modifiers.trim) {
  7017. return value.trim() !== newVal.trim()
  7018. }
  7019. }
  7020. return value !== newVal
  7021. }
  7022. var domProps = {
  7023. create: updateDOMProps,
  7024. update: updateDOMProps
  7025. };
  7026. /* */
  7027. var parseStyleText = cached(function (cssText) {
  7028. var res = {};
  7029. var listDelimiter = /;(?![^(]*\))/g;
  7030. var propertyDelimiter = /:(.+)/;
  7031. cssText.split(listDelimiter).forEach(function (item) {
  7032. if (item) {
  7033. var tmp = item.split(propertyDelimiter);
  7034. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  7035. }
  7036. });
  7037. return res
  7038. });
  7039. // merge static and dynamic style data on the same vnode
  7040. function normalizeStyleData (data) {
  7041. var style = normalizeStyleBinding(data.style);
  7042. // static style is pre-processed into an object during compilation
  7043. // and is always a fresh object, so it's safe to merge into it
  7044. return data.staticStyle
  7045. ? extend(data.staticStyle, style)
  7046. : style
  7047. }
  7048. // normalize possible array / string values into Object
  7049. function normalizeStyleBinding (bindingStyle) {
  7050. if (Array.isArray(bindingStyle)) {
  7051. return toObject(bindingStyle)
  7052. }
  7053. if (typeof bindingStyle === 'string') {
  7054. return parseStyleText(bindingStyle)
  7055. }
  7056. return bindingStyle
  7057. }
  7058. /**
  7059. * parent component style should be after child's
  7060. * so that parent component's style could override it
  7061. */
  7062. function getStyle (vnode, checkChild) {
  7063. var res = {};
  7064. var styleData;
  7065. if (checkChild) {
  7066. var childNode = vnode;
  7067. while (childNode.componentInstance) {
  7068. childNode = childNode.componentInstance._vnode;
  7069. if (
  7070. childNode && childNode.data &&
  7071. (styleData = normalizeStyleData(childNode.data))
  7072. ) {
  7073. extend(res, styleData);
  7074. }
  7075. }
  7076. }
  7077. if ((styleData = normalizeStyleData(vnode.data))) {
  7078. extend(res, styleData);
  7079. }
  7080. var parentNode = vnode;
  7081. while ((parentNode = parentNode.parent)) {
  7082. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  7083. extend(res, styleData);
  7084. }
  7085. }
  7086. return res
  7087. }
  7088. /* */
  7089. var cssVarRE = /^--/;
  7090. var importantRE = /\s*!important$/;
  7091. var setProp = function (el, name, val) {
  7092. /* istanbul ignore if */
  7093. if (cssVarRE.test(name)) {
  7094. el.style.setProperty(name, val);
  7095. } else if (importantRE.test(val)) {
  7096. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  7097. } else {
  7098. var normalizedName = normalize(name);
  7099. if (Array.isArray(val)) {
  7100. // Support values array created by autoprefixer, e.g.
  7101. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  7102. // Set them one by one, and the browser will only set those it can recognize
  7103. for (var i = 0, len = val.length; i < len; i++) {
  7104. el.style[normalizedName] = val[i];
  7105. }
  7106. } else {
  7107. el.style[normalizedName] = val;
  7108. }
  7109. }
  7110. };
  7111. var vendorNames = ['Webkit', 'Moz', 'ms'];
  7112. var emptyStyle;
  7113. var normalize = cached(function (prop) {
  7114. emptyStyle = emptyStyle || document.createElement('div').style;
  7115. prop = camelize(prop);
  7116. if (prop !== 'filter' && (prop in emptyStyle)) {
  7117. return prop
  7118. }
  7119. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  7120. for (var i = 0; i < vendorNames.length; i++) {
  7121. var name = vendorNames[i] + capName;
  7122. if (name in emptyStyle) {
  7123. return name
  7124. }
  7125. }
  7126. });
  7127. function updateStyle (oldVnode, vnode) {
  7128. var data = vnode.data;
  7129. var oldData = oldVnode.data;
  7130. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  7131. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  7132. ) {
  7133. return
  7134. }
  7135. var cur, name;
  7136. var el = vnode.elm;
  7137. var oldStaticStyle = oldData.staticStyle;
  7138. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  7139. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  7140. var oldStyle = oldStaticStyle || oldStyleBinding;
  7141. var style = normalizeStyleBinding(vnode.data.style) || {};
  7142. // store normalized style under a different key for next diff
  7143. // make sure to clone it if it's reactive, since the user likely wants
  7144. // to mutate it.
  7145. vnode.data.normalizedStyle = isDef(style.__ob__)
  7146. ? extend({}, style)
  7147. : style;
  7148. var newStyle = getStyle(vnode, true);
  7149. for (name in oldStyle) {
  7150. if (isUndef(newStyle[name])) {
  7151. setProp(el, name, '');
  7152. }
  7153. }
  7154. for (name in newStyle) {
  7155. cur = newStyle[name];
  7156. if (cur !== oldStyle[name]) {
  7157. // ie9 setting to null has no effect, must use empty string
  7158. setProp(el, name, cur == null ? '' : cur);
  7159. }
  7160. }
  7161. }
  7162. var style = {
  7163. create: updateStyle,
  7164. update: updateStyle
  7165. };
  7166. /* */
  7167. var whitespaceRE = /\s+/;
  7168. /**
  7169. * Add class with compatibility for SVG since classList is not supported on
  7170. * SVG elements in IE
  7171. */
  7172. function addClass (el, cls) {
  7173. /* istanbul ignore if */
  7174. if (!cls || !(cls = cls.trim())) {
  7175. return
  7176. }
  7177. /* istanbul ignore else */
  7178. if (el.classList) {
  7179. if (cls.indexOf(' ') > -1) {
  7180. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  7181. } else {
  7182. el.classList.add(cls);
  7183. }
  7184. } else {
  7185. var cur = " " + (el.getAttribute('class') || '') + " ";
  7186. if (cur.indexOf(' ' + cls + ' ') < 0) {
  7187. el.setAttribute('class', (cur + cls).trim());
  7188. }
  7189. }
  7190. }
  7191. /**
  7192. * Remove class with compatibility for SVG since classList is not supported on
  7193. * SVG elements in IE
  7194. */
  7195. function removeClass (el, cls) {
  7196. /* istanbul ignore if */
  7197. if (!cls || !(cls = cls.trim())) {
  7198. return
  7199. }
  7200. /* istanbul ignore else */
  7201. if (el.classList) {
  7202. if (cls.indexOf(' ') > -1) {
  7203. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  7204. } else {
  7205. el.classList.remove(cls);
  7206. }
  7207. if (!el.classList.length) {
  7208. el.removeAttribute('class');
  7209. }
  7210. } else {
  7211. var cur = " " + (el.getAttribute('class') || '') + " ";
  7212. var tar = ' ' + cls + ' ';
  7213. while (cur.indexOf(tar) >= 0) {
  7214. cur = cur.replace(tar, ' ');
  7215. }
  7216. cur = cur.trim();
  7217. if (cur) {
  7218. el.setAttribute('class', cur);
  7219. } else {
  7220. el.removeAttribute('class');
  7221. }
  7222. }
  7223. }
  7224. /* */
  7225. function resolveTransition (def$$1) {
  7226. if (!def$$1) {
  7227. return
  7228. }
  7229. /* istanbul ignore else */
  7230. if (typeof def$$1 === 'object') {
  7231. var res = {};
  7232. if (def$$1.css !== false) {
  7233. extend(res, autoCssTransition(def$$1.name || 'v'));
  7234. }
  7235. extend(res, def$$1);
  7236. return res
  7237. } else if (typeof def$$1 === 'string') {
  7238. return autoCssTransition(def$$1)
  7239. }
  7240. }
  7241. var autoCssTransition = cached(function (name) {
  7242. return {
  7243. enterClass: (name + "-enter"),
  7244. enterToClass: (name + "-enter-to"),
  7245. enterActiveClass: (name + "-enter-active"),
  7246. leaveClass: (name + "-leave"),
  7247. leaveToClass: (name + "-leave-to"),
  7248. leaveActiveClass: (name + "-leave-active")
  7249. }
  7250. });
  7251. var hasTransition = inBrowser && !isIE9;
  7252. var TRANSITION = 'transition';
  7253. var ANIMATION = 'animation';
  7254. // Transition property/event sniffing
  7255. var transitionProp = 'transition';
  7256. var transitionEndEvent = 'transitionend';
  7257. var animationProp = 'animation';
  7258. var animationEndEvent = 'animationend';
  7259. if (hasTransition) {
  7260. /* istanbul ignore if */
  7261. if (window.ontransitionend === undefined &&
  7262. window.onwebkittransitionend !== undefined
  7263. ) {
  7264. transitionProp = 'WebkitTransition';
  7265. transitionEndEvent = 'webkitTransitionEnd';
  7266. }
  7267. if (window.onanimationend === undefined &&
  7268. window.onwebkitanimationend !== undefined
  7269. ) {
  7270. animationProp = 'WebkitAnimation';
  7271. animationEndEvent = 'webkitAnimationEnd';
  7272. }
  7273. }
  7274. // binding to window is necessary to make hot reload work in IE in strict mode
  7275. var raf = inBrowser
  7276. ? window.requestAnimationFrame
  7277. ? window.requestAnimationFrame.bind(window)
  7278. : setTimeout
  7279. : /* istanbul ignore next */ function (fn) { return fn(); };
  7280. function nextFrame (fn) {
  7281. raf(function () {
  7282. raf(fn);
  7283. });
  7284. }
  7285. function addTransitionClass (el, cls) {
  7286. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  7287. if (transitionClasses.indexOf(cls) < 0) {
  7288. transitionClasses.push(cls);
  7289. addClass(el, cls);
  7290. }
  7291. }
  7292. function removeTransitionClass (el, cls) {
  7293. if (el._transitionClasses) {
  7294. remove(el._transitionClasses, cls);
  7295. }
  7296. removeClass(el, cls);
  7297. }
  7298. function whenTransitionEnds (
  7299. el,
  7300. expectedType,
  7301. cb
  7302. ) {
  7303. var ref = getTransitionInfo(el, expectedType);
  7304. var type = ref.type;
  7305. var timeout = ref.timeout;
  7306. var propCount = ref.propCount;
  7307. if (!type) { return cb() }
  7308. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  7309. var ended = 0;
  7310. var end = function () {
  7311. el.removeEventListener(event, onEnd);
  7312. cb();
  7313. };
  7314. var onEnd = function (e) {
  7315. if (e.target === el) {
  7316. if (++ended >= propCount) {
  7317. end();
  7318. }
  7319. }
  7320. };
  7321. setTimeout(function () {
  7322. if (ended < propCount) {
  7323. end();
  7324. }
  7325. }, timeout + 1);
  7326. el.addEventListener(event, onEnd);
  7327. }
  7328. var transformRE = /\b(transform|all)(,|$)/;
  7329. function getTransitionInfo (el, expectedType) {
  7330. var styles = window.getComputedStyle(el);
  7331. // JSDOM may return undefined for transition properties
  7332. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  7333. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  7334. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  7335. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  7336. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  7337. var animationTimeout = getTimeout(animationDelays, animationDurations);
  7338. var type;
  7339. var timeout = 0;
  7340. var propCount = 0;
  7341. /* istanbul ignore if */
  7342. if (expectedType === TRANSITION) {
  7343. if (transitionTimeout > 0) {
  7344. type = TRANSITION;
  7345. timeout = transitionTimeout;
  7346. propCount = transitionDurations.length;
  7347. }
  7348. } else if (expectedType === ANIMATION) {
  7349. if (animationTimeout > 0) {
  7350. type = ANIMATION;
  7351. timeout = animationTimeout;
  7352. propCount = animationDurations.length;
  7353. }
  7354. } else {
  7355. timeout = Math.max(transitionTimeout, animationTimeout);
  7356. type = timeout > 0
  7357. ? transitionTimeout > animationTimeout
  7358. ? TRANSITION
  7359. : ANIMATION
  7360. : null;
  7361. propCount = type
  7362. ? type === TRANSITION
  7363. ? transitionDurations.length
  7364. : animationDurations.length
  7365. : 0;
  7366. }
  7367. var hasTransform =
  7368. type === TRANSITION &&
  7369. transformRE.test(styles[transitionProp + 'Property']);
  7370. return {
  7371. type: type,
  7372. timeout: timeout,
  7373. propCount: propCount,
  7374. hasTransform: hasTransform
  7375. }
  7376. }
  7377. function getTimeout (delays, durations) {
  7378. /* istanbul ignore next */
  7379. while (delays.length < durations.length) {
  7380. delays = delays.concat(delays);
  7381. }
  7382. return Math.max.apply(null, durations.map(function (d, i) {
  7383. return toMs(d) + toMs(delays[i])
  7384. }))
  7385. }
  7386. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  7387. // in a locale-dependent way, using a comma instead of a dot.
  7388. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  7389. // as a floor function) causing unexpected behaviors
  7390. function toMs (s) {
  7391. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  7392. }
  7393. /* */
  7394. function enter (vnode, toggleDisplay) {
  7395. var el = vnode.elm;
  7396. // call leave callback now
  7397. if (isDef(el._leaveCb)) {
  7398. el._leaveCb.cancelled = true;
  7399. el._leaveCb();
  7400. }
  7401. var data = resolveTransition(vnode.data.transition);
  7402. if (isUndef(data)) {
  7403. return
  7404. }
  7405. /* istanbul ignore if */
  7406. if (isDef(el._enterCb) || el.nodeType !== 1) {
  7407. return
  7408. }
  7409. var css = data.css;
  7410. var type = data.type;
  7411. var enterClass = data.enterClass;
  7412. var enterToClass = data.enterToClass;
  7413. var enterActiveClass = data.enterActiveClass;
  7414. var appearClass = data.appearClass;
  7415. var appearToClass = data.appearToClass;
  7416. var appearActiveClass = data.appearActiveClass;
  7417. var beforeEnter = data.beforeEnter;
  7418. var enter = data.enter;
  7419. var afterEnter = data.afterEnter;
  7420. var enterCancelled = data.enterCancelled;
  7421. var beforeAppear = data.beforeAppear;
  7422. var appear = data.appear;
  7423. var afterAppear = data.afterAppear;
  7424. var appearCancelled = data.appearCancelled;
  7425. var duration = data.duration;
  7426. // activeInstance will always be the <transition> component managing this
  7427. // transition. One edge case to check is when the <transition> is placed
  7428. // as the root node of a child component. In that case we need to check
  7429. // <transition>'s parent for appear check.
  7430. var context = activeInstance;
  7431. var transitionNode = activeInstance.$vnode;
  7432. while (transitionNode && transitionNode.parent) {
  7433. context = transitionNode.context;
  7434. transitionNode = transitionNode.parent;
  7435. }
  7436. var isAppear = !context._isMounted || !vnode.isRootInsert;
  7437. if (isAppear && !appear && appear !== '') {
  7438. return
  7439. }
  7440. var startClass = isAppear && appearClass
  7441. ? appearClass
  7442. : enterClass;
  7443. var activeClass = isAppear && appearActiveClass
  7444. ? appearActiveClass
  7445. : enterActiveClass;
  7446. var toClass = isAppear && appearToClass
  7447. ? appearToClass
  7448. : enterToClass;
  7449. var beforeEnterHook = isAppear
  7450. ? (beforeAppear || beforeEnter)
  7451. : beforeEnter;
  7452. var enterHook = isAppear
  7453. ? (typeof appear === 'function' ? appear : enter)
  7454. : enter;
  7455. var afterEnterHook = isAppear
  7456. ? (afterAppear || afterEnter)
  7457. : afterEnter;
  7458. var enterCancelledHook = isAppear
  7459. ? (appearCancelled || enterCancelled)
  7460. : enterCancelled;
  7461. var explicitEnterDuration = toNumber(
  7462. isObject(duration)
  7463. ? duration.enter
  7464. : duration
  7465. );
  7466. if (process.env.NODE_ENV !== 'production' && explicitEnterDuration != null) {
  7467. checkDuration(explicitEnterDuration, 'enter', vnode);
  7468. }
  7469. var expectsCSS = css !== false && !isIE9;
  7470. var userWantsControl = getHookArgumentsLength(enterHook);
  7471. var cb = el._enterCb = once(function () {
  7472. if (expectsCSS) {
  7473. removeTransitionClass(el, toClass);
  7474. removeTransitionClass(el, activeClass);
  7475. }
  7476. if (cb.cancelled) {
  7477. if (expectsCSS) {
  7478. removeTransitionClass(el, startClass);
  7479. }
  7480. enterCancelledHook && enterCancelledHook(el);
  7481. } else {
  7482. afterEnterHook && afterEnterHook(el);
  7483. }
  7484. el._enterCb = null;
  7485. });
  7486. if (!vnode.data.show) {
  7487. // remove pending leave element on enter by injecting an insert hook
  7488. mergeVNodeHook(vnode, 'insert', function () {
  7489. var parent = el.parentNode;
  7490. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  7491. if (pendingNode &&
  7492. pendingNode.tag === vnode.tag &&
  7493. pendingNode.elm._leaveCb
  7494. ) {
  7495. pendingNode.elm._leaveCb();
  7496. }
  7497. enterHook && enterHook(el, cb);
  7498. });
  7499. }
  7500. // start enter transition
  7501. beforeEnterHook && beforeEnterHook(el);
  7502. if (expectsCSS) {
  7503. addTransitionClass(el, startClass);
  7504. addTransitionClass(el, activeClass);
  7505. nextFrame(function () {
  7506. removeTransitionClass(el, startClass);
  7507. if (!cb.cancelled) {
  7508. addTransitionClass(el, toClass);
  7509. if (!userWantsControl) {
  7510. if (isValidDuration(explicitEnterDuration)) {
  7511. setTimeout(cb, explicitEnterDuration);
  7512. } else {
  7513. whenTransitionEnds(el, type, cb);
  7514. }
  7515. }
  7516. }
  7517. });
  7518. }
  7519. if (vnode.data.show) {
  7520. toggleDisplay && toggleDisplay();
  7521. enterHook && enterHook(el, cb);
  7522. }
  7523. if (!expectsCSS && !userWantsControl) {
  7524. cb();
  7525. }
  7526. }
  7527. function leave (vnode, rm) {
  7528. var el = vnode.elm;
  7529. // call enter callback now
  7530. if (isDef(el._enterCb)) {
  7531. el._enterCb.cancelled = true;
  7532. el._enterCb();
  7533. }
  7534. var data = resolveTransition(vnode.data.transition);
  7535. if (isUndef(data) || el.nodeType !== 1) {
  7536. return rm()
  7537. }
  7538. /* istanbul ignore if */
  7539. if (isDef(el._leaveCb)) {
  7540. return
  7541. }
  7542. var css = data.css;
  7543. var type = data.type;
  7544. var leaveClass = data.leaveClass;
  7545. var leaveToClass = data.leaveToClass;
  7546. var leaveActiveClass = data.leaveActiveClass;
  7547. var beforeLeave = data.beforeLeave;
  7548. var leave = data.leave;
  7549. var afterLeave = data.afterLeave;
  7550. var leaveCancelled = data.leaveCancelled;
  7551. var delayLeave = data.delayLeave;
  7552. var duration = data.duration;
  7553. var expectsCSS = css !== false && !isIE9;
  7554. var userWantsControl = getHookArgumentsLength(leave);
  7555. var explicitLeaveDuration = toNumber(
  7556. isObject(duration)
  7557. ? duration.leave
  7558. : duration
  7559. );
  7560. if (process.env.NODE_ENV !== 'production' && isDef(explicitLeaveDuration)) {
  7561. checkDuration(explicitLeaveDuration, 'leave', vnode);
  7562. }
  7563. var cb = el._leaveCb = once(function () {
  7564. if (el.parentNode && el.parentNode._pending) {
  7565. el.parentNode._pending[vnode.key] = null;
  7566. }
  7567. if (expectsCSS) {
  7568. removeTransitionClass(el, leaveToClass);
  7569. removeTransitionClass(el, leaveActiveClass);
  7570. }
  7571. if (cb.cancelled) {
  7572. if (expectsCSS) {
  7573. removeTransitionClass(el, leaveClass);
  7574. }
  7575. leaveCancelled && leaveCancelled(el);
  7576. } else {
  7577. rm();
  7578. afterLeave && afterLeave(el);
  7579. }
  7580. el._leaveCb = null;
  7581. });
  7582. if (delayLeave) {
  7583. delayLeave(performLeave);
  7584. } else {
  7585. performLeave();
  7586. }
  7587. function performLeave () {
  7588. // the delayed leave may have already been cancelled
  7589. if (cb.cancelled) {
  7590. return
  7591. }
  7592. // record leaving element
  7593. if (!vnode.data.show && el.parentNode) {
  7594. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  7595. }
  7596. beforeLeave && beforeLeave(el);
  7597. if (expectsCSS) {
  7598. addTransitionClass(el, leaveClass);
  7599. addTransitionClass(el, leaveActiveClass);
  7600. nextFrame(function () {
  7601. removeTransitionClass(el, leaveClass);
  7602. if (!cb.cancelled) {
  7603. addTransitionClass(el, leaveToClass);
  7604. if (!userWantsControl) {
  7605. if (isValidDuration(explicitLeaveDuration)) {
  7606. setTimeout(cb, explicitLeaveDuration);
  7607. } else {
  7608. whenTransitionEnds(el, type, cb);
  7609. }
  7610. }
  7611. }
  7612. });
  7613. }
  7614. leave && leave(el, cb);
  7615. if (!expectsCSS && !userWantsControl) {
  7616. cb();
  7617. }
  7618. }
  7619. }
  7620. // only used in dev mode
  7621. function checkDuration (val, name, vnode) {
  7622. if (typeof val !== 'number') {
  7623. warn(
  7624. "<transition> explicit " + name + " duration is not a valid number - " +
  7625. "got " + (JSON.stringify(val)) + ".",
  7626. vnode.context
  7627. );
  7628. } else if (isNaN(val)) {
  7629. warn(
  7630. "<transition> explicit " + name + " duration is NaN - " +
  7631. 'the duration expression might be incorrect.',
  7632. vnode.context
  7633. );
  7634. }
  7635. }
  7636. function isValidDuration (val) {
  7637. return typeof val === 'number' && !isNaN(val)
  7638. }
  7639. /**
  7640. * Normalize a transition hook's argument length. The hook may be:
  7641. * - a merged hook (invoker) with the original in .fns
  7642. * - a wrapped component method (check ._length)
  7643. * - a plain function (.length)
  7644. */
  7645. function getHookArgumentsLength (fn) {
  7646. if (isUndef(fn)) {
  7647. return false
  7648. }
  7649. var invokerFns = fn.fns;
  7650. if (isDef(invokerFns)) {
  7651. // invoker
  7652. return getHookArgumentsLength(
  7653. Array.isArray(invokerFns)
  7654. ? invokerFns[0]
  7655. : invokerFns
  7656. )
  7657. } else {
  7658. return (fn._length || fn.length) > 1
  7659. }
  7660. }
  7661. function _enter (_, vnode) {
  7662. if (vnode.data.show !== true) {
  7663. enter(vnode);
  7664. }
  7665. }
  7666. var transition = inBrowser ? {
  7667. create: _enter,
  7668. activate: _enter,
  7669. remove: function remove$$1 (vnode, rm) {
  7670. /* istanbul ignore else */
  7671. if (vnode.data.show !== true) {
  7672. leave(vnode, rm);
  7673. } else {
  7674. rm();
  7675. }
  7676. }
  7677. } : {};
  7678. var platformModules = [
  7679. attrs,
  7680. klass,
  7681. events,
  7682. domProps,
  7683. style,
  7684. transition
  7685. ];
  7686. /* */
  7687. // the directive module should be applied last, after all
  7688. // built-in modules have been applied.
  7689. var modules = platformModules.concat(baseModules);
  7690. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  7691. /**
  7692. * Not type checking this file because flow doesn't like attaching
  7693. * properties to Elements.
  7694. */
  7695. /* istanbul ignore if */
  7696. if (isIE9) {
  7697. // http://www.matts411.com/post/internet-explorer-9-oninput/
  7698. document.addEventListener('selectionchange', function () {
  7699. var el = document.activeElement;
  7700. if (el && el.vmodel) {
  7701. trigger(el, 'input');
  7702. }
  7703. });
  7704. }
  7705. var directive = {
  7706. inserted: function inserted (el, binding, vnode, oldVnode) {
  7707. if (vnode.tag === 'select') {
  7708. // #6903
  7709. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  7710. mergeVNodeHook(vnode, 'postpatch', function () {
  7711. directive.componentUpdated(el, binding, vnode);
  7712. });
  7713. } else {
  7714. setSelected(el, binding, vnode.context);
  7715. }
  7716. el._vOptions = [].map.call(el.options, getValue);
  7717. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  7718. el._vModifiers = binding.modifiers;
  7719. if (!binding.modifiers.lazy) {
  7720. el.addEventListener('compositionstart', onCompositionStart);
  7721. el.addEventListener('compositionend', onCompositionEnd);
  7722. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  7723. // switching focus before confirming composition choice
  7724. // this also fixes the issue where some browsers e.g. iOS Chrome
  7725. // fires "change" instead of "input" on autocomplete.
  7726. el.addEventListener('change', onCompositionEnd);
  7727. /* istanbul ignore if */
  7728. if (isIE9) {
  7729. el.vmodel = true;
  7730. }
  7731. }
  7732. }
  7733. },
  7734. componentUpdated: function componentUpdated (el, binding, vnode) {
  7735. if (vnode.tag === 'select') {
  7736. setSelected(el, binding, vnode.context);
  7737. // in case the options rendered by v-for have changed,
  7738. // it's possible that the value is out-of-sync with the rendered options.
  7739. // detect such cases and filter out values that no longer has a matching
  7740. // option in the DOM.
  7741. var prevOptions = el._vOptions;
  7742. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  7743. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  7744. // trigger change event if
  7745. // no matching option found for at least one value
  7746. var needReset = el.multiple
  7747. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  7748. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  7749. if (needReset) {
  7750. trigger(el, 'change');
  7751. }
  7752. }
  7753. }
  7754. }
  7755. };
  7756. function setSelected (el, binding, vm) {
  7757. actuallySetSelected(el, binding, vm);
  7758. /* istanbul ignore if */
  7759. if (isIE || isEdge) {
  7760. setTimeout(function () {
  7761. actuallySetSelected(el, binding, vm);
  7762. }, 0);
  7763. }
  7764. }
  7765. function actuallySetSelected (el, binding, vm) {
  7766. var value = binding.value;
  7767. var isMultiple = el.multiple;
  7768. if (isMultiple && !Array.isArray(value)) {
  7769. process.env.NODE_ENV !== 'production' && warn(
  7770. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  7771. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  7772. vm
  7773. );
  7774. return
  7775. }
  7776. var selected, option;
  7777. for (var i = 0, l = el.options.length; i < l; i++) {
  7778. option = el.options[i];
  7779. if (isMultiple) {
  7780. selected = looseIndexOf(value, getValue(option)) > -1;
  7781. if (option.selected !== selected) {
  7782. option.selected = selected;
  7783. }
  7784. } else {
  7785. if (looseEqual(getValue(option), value)) {
  7786. if (el.selectedIndex !== i) {
  7787. el.selectedIndex = i;
  7788. }
  7789. return
  7790. }
  7791. }
  7792. }
  7793. if (!isMultiple) {
  7794. el.selectedIndex = -1;
  7795. }
  7796. }
  7797. function hasNoMatchingOption (value, options) {
  7798. return options.every(function (o) { return !looseEqual(o, value); })
  7799. }
  7800. function getValue (option) {
  7801. return '_value' in option
  7802. ? option._value
  7803. : option.value
  7804. }
  7805. function onCompositionStart (e) {
  7806. e.target.composing = true;
  7807. }
  7808. function onCompositionEnd (e) {
  7809. // prevent triggering an input event for no reason
  7810. if (!e.target.composing) { return }
  7811. e.target.composing = false;
  7812. trigger(e.target, 'input');
  7813. }
  7814. function trigger (el, type) {
  7815. var e = document.createEvent('HTMLEvents');
  7816. e.initEvent(type, true, true);
  7817. el.dispatchEvent(e);
  7818. }
  7819. /* */
  7820. // recursively search for possible transition defined inside the component root
  7821. function locateNode (vnode) {
  7822. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  7823. ? locateNode(vnode.componentInstance._vnode)
  7824. : vnode
  7825. }
  7826. var show = {
  7827. bind: function bind (el, ref, vnode) {
  7828. var value = ref.value;
  7829. vnode = locateNode(vnode);
  7830. var transition$$1 = vnode.data && vnode.data.transition;
  7831. var originalDisplay = el.__vOriginalDisplay =
  7832. el.style.display === 'none' ? '' : el.style.display;
  7833. if (value && transition$$1) {
  7834. vnode.data.show = true;
  7835. enter(vnode, function () {
  7836. el.style.display = originalDisplay;
  7837. });
  7838. } else {
  7839. el.style.display = value ? originalDisplay : 'none';
  7840. }
  7841. },
  7842. update: function update (el, ref, vnode) {
  7843. var value = ref.value;
  7844. var oldValue = ref.oldValue;
  7845. /* istanbul ignore if */
  7846. if (!value === !oldValue) { return }
  7847. vnode = locateNode(vnode);
  7848. var transition$$1 = vnode.data && vnode.data.transition;
  7849. if (transition$$1) {
  7850. vnode.data.show = true;
  7851. if (value) {
  7852. enter(vnode, function () {
  7853. el.style.display = el.__vOriginalDisplay;
  7854. });
  7855. } else {
  7856. leave(vnode, function () {
  7857. el.style.display = 'none';
  7858. });
  7859. }
  7860. } else {
  7861. el.style.display = value ? el.__vOriginalDisplay : 'none';
  7862. }
  7863. },
  7864. unbind: function unbind (
  7865. el,
  7866. binding,
  7867. vnode,
  7868. oldVnode,
  7869. isDestroy
  7870. ) {
  7871. if (!isDestroy) {
  7872. el.style.display = el.__vOriginalDisplay;
  7873. }
  7874. }
  7875. };
  7876. var platformDirectives = {
  7877. model: directive,
  7878. show: show
  7879. };
  7880. /* */
  7881. var transitionProps = {
  7882. name: String,
  7883. appear: Boolean,
  7884. css: Boolean,
  7885. mode: String,
  7886. type: String,
  7887. enterClass: String,
  7888. leaveClass: String,
  7889. enterToClass: String,
  7890. leaveToClass: String,
  7891. enterActiveClass: String,
  7892. leaveActiveClass: String,
  7893. appearClass: String,
  7894. appearActiveClass: String,
  7895. appearToClass: String,
  7896. duration: [Number, String, Object]
  7897. };
  7898. // in case the child is also an abstract component, e.g. <keep-alive>
  7899. // we want to recursively retrieve the real component to be rendered
  7900. function getRealChild (vnode) {
  7901. var compOptions = vnode && vnode.componentOptions;
  7902. if (compOptions && compOptions.Ctor.options.abstract) {
  7903. return getRealChild(getFirstComponentChild(compOptions.children))
  7904. } else {
  7905. return vnode
  7906. }
  7907. }
  7908. function extractTransitionData (comp) {
  7909. var data = {};
  7910. var options = comp.$options;
  7911. // props
  7912. for (var key in options.propsData) {
  7913. data[key] = comp[key];
  7914. }
  7915. // events.
  7916. // extract listeners and pass them directly to the transition methods
  7917. var listeners = options._parentListeners;
  7918. for (var key$1 in listeners) {
  7919. data[camelize(key$1)] = listeners[key$1];
  7920. }
  7921. return data
  7922. }
  7923. function placeholder (h, rawChild) {
  7924. if (/\d-keep-alive$/.test(rawChild.tag)) {
  7925. return h('keep-alive', {
  7926. props: rawChild.componentOptions.propsData
  7927. })
  7928. }
  7929. }
  7930. function hasParentTransition (vnode) {
  7931. while ((vnode = vnode.parent)) {
  7932. if (vnode.data.transition) {
  7933. return true
  7934. }
  7935. }
  7936. }
  7937. function isSameChild (child, oldChild) {
  7938. return oldChild.key === child.key && oldChild.tag === child.tag
  7939. }
  7940. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  7941. var isVShowDirective = function (d) { return d.name === 'show'; };
  7942. var Transition = {
  7943. name: 'transition',
  7944. props: transitionProps,
  7945. abstract: true,
  7946. render: function render (h) {
  7947. var this$1 = this;
  7948. var children = this.$slots.default;
  7949. if (!children) {
  7950. return
  7951. }
  7952. // filter out text nodes (possible whitespaces)
  7953. children = children.filter(isNotTextNode);
  7954. /* istanbul ignore if */
  7955. if (!children.length) {
  7956. return
  7957. }
  7958. // warn multiple elements
  7959. if (process.env.NODE_ENV !== 'production' && children.length > 1) {
  7960. warn(
  7961. '<transition> can only be used on a single element. Use ' +
  7962. '<transition-group> for lists.',
  7963. this.$parent
  7964. );
  7965. }
  7966. var mode = this.mode;
  7967. // warn invalid mode
  7968. if (process.env.NODE_ENV !== 'production' &&
  7969. mode && mode !== 'in-out' && mode !== 'out-in'
  7970. ) {
  7971. warn(
  7972. 'invalid <transition> mode: ' + mode,
  7973. this.$parent
  7974. );
  7975. }
  7976. var rawChild = children[0];
  7977. // if this is a component root node and the component's
  7978. // parent container node also has transition, skip.
  7979. if (hasParentTransition(this.$vnode)) {
  7980. return rawChild
  7981. }
  7982. // apply transition data to child
  7983. // use getRealChild() to ignore abstract components e.g. keep-alive
  7984. var child = getRealChild(rawChild);
  7985. /* istanbul ignore if */
  7986. if (!child) {
  7987. return rawChild
  7988. }
  7989. if (this._leaving) {
  7990. return placeholder(h, rawChild)
  7991. }
  7992. // ensure a key that is unique to the vnode type and to this transition
  7993. // component instance. This key will be used to remove pending leaving nodes
  7994. // during entering.
  7995. var id = "__transition-" + (this._uid) + "-";
  7996. child.key = child.key == null
  7997. ? child.isComment
  7998. ? id + 'comment'
  7999. : id + child.tag
  8000. : isPrimitive(child.key)
  8001. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  8002. : child.key;
  8003. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  8004. var oldRawChild = this._vnode;
  8005. var oldChild = getRealChild(oldRawChild);
  8006. // mark v-show
  8007. // so that the transition module can hand over the control to the directive
  8008. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  8009. child.data.show = true;
  8010. }
  8011. if (
  8012. oldChild &&
  8013. oldChild.data &&
  8014. !isSameChild(child, oldChild) &&
  8015. !isAsyncPlaceholder(oldChild) &&
  8016. // #6687 component root is a comment node
  8017. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  8018. ) {
  8019. // replace old child transition data with fresh one
  8020. // important for dynamic transitions!
  8021. var oldData = oldChild.data.transition = extend({}, data);
  8022. // handle transition mode
  8023. if (mode === 'out-in') {
  8024. // return placeholder node and queue update when leave finishes
  8025. this._leaving = true;
  8026. mergeVNodeHook(oldData, 'afterLeave', function () {
  8027. this$1._leaving = false;
  8028. this$1.$forceUpdate();
  8029. });
  8030. return placeholder(h, rawChild)
  8031. } else if (mode === 'in-out') {
  8032. if (isAsyncPlaceholder(child)) {
  8033. return oldRawChild
  8034. }
  8035. var delayedLeave;
  8036. var performLeave = function () { delayedLeave(); };
  8037. mergeVNodeHook(data, 'afterEnter', performLeave);
  8038. mergeVNodeHook(data, 'enterCancelled', performLeave);
  8039. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  8040. }
  8041. }
  8042. return rawChild
  8043. }
  8044. };
  8045. /* */
  8046. var props = extend({
  8047. tag: String,
  8048. moveClass: String
  8049. }, transitionProps);
  8050. delete props.mode;
  8051. var TransitionGroup = {
  8052. props: props,
  8053. beforeMount: function beforeMount () {
  8054. var this$1 = this;
  8055. var update = this._update;
  8056. this._update = function (vnode, hydrating) {
  8057. var restoreActiveInstance = setActiveInstance(this$1);
  8058. // force removing pass
  8059. this$1.__patch__(
  8060. this$1._vnode,
  8061. this$1.kept,
  8062. false, // hydrating
  8063. true // removeOnly (!important, avoids unnecessary moves)
  8064. );
  8065. this$1._vnode = this$1.kept;
  8066. restoreActiveInstance();
  8067. update.call(this$1, vnode, hydrating);
  8068. };
  8069. },
  8070. render: function render (h) {
  8071. var tag = this.tag || this.$vnode.data.tag || 'span';
  8072. var map = Object.create(null);
  8073. var prevChildren = this.prevChildren = this.children;
  8074. var rawChildren = this.$slots.default || [];
  8075. var children = this.children = [];
  8076. var transitionData = extractTransitionData(this);
  8077. for (var i = 0; i < rawChildren.length; i++) {
  8078. var c = rawChildren[i];
  8079. if (c.tag) {
  8080. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  8081. children.push(c);
  8082. map[c.key] = c
  8083. ;(c.data || (c.data = {})).transition = transitionData;
  8084. } else if (process.env.NODE_ENV !== 'production') {
  8085. var opts = c.componentOptions;
  8086. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  8087. warn(("<transition-group> children must be keyed: <" + name + ">"));
  8088. }
  8089. }
  8090. }
  8091. if (prevChildren) {
  8092. var kept = [];
  8093. var removed = [];
  8094. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  8095. var c$1 = prevChildren[i$1];
  8096. c$1.data.transition = transitionData;
  8097. c$1.data.pos = c$1.elm.getBoundingClientRect();
  8098. if (map[c$1.key]) {
  8099. kept.push(c$1);
  8100. } else {
  8101. removed.push(c$1);
  8102. }
  8103. }
  8104. this.kept = h(tag, null, kept);
  8105. this.removed = removed;
  8106. }
  8107. return h(tag, null, children)
  8108. },
  8109. updated: function updated () {
  8110. var children = this.prevChildren;
  8111. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  8112. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  8113. return
  8114. }
  8115. // we divide the work into three loops to avoid mixing DOM reads and writes
  8116. // in each iteration - which helps prevent layout thrashing.
  8117. children.forEach(callPendingCbs);
  8118. children.forEach(recordPosition);
  8119. children.forEach(applyTranslation);
  8120. // force reflow to put everything in position
  8121. // assign to this to avoid being removed in tree-shaking
  8122. // $flow-disable-line
  8123. this._reflow = document.body.offsetHeight;
  8124. children.forEach(function (c) {
  8125. if (c.data.moved) {
  8126. var el = c.elm;
  8127. var s = el.style;
  8128. addTransitionClass(el, moveClass);
  8129. s.transform = s.WebkitTransform = s.transitionDuration = '';
  8130. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  8131. if (e && e.target !== el) {
  8132. return
  8133. }
  8134. if (!e || /transform$/.test(e.propertyName)) {
  8135. el.removeEventListener(transitionEndEvent, cb);
  8136. el._moveCb = null;
  8137. removeTransitionClass(el, moveClass);
  8138. }
  8139. });
  8140. }
  8141. });
  8142. },
  8143. methods: {
  8144. hasMove: function hasMove (el, moveClass) {
  8145. /* istanbul ignore if */
  8146. if (!hasTransition) {
  8147. return false
  8148. }
  8149. /* istanbul ignore if */
  8150. if (this._hasMove) {
  8151. return this._hasMove
  8152. }
  8153. // Detect whether an element with the move class applied has
  8154. // CSS transitions. Since the element may be inside an entering
  8155. // transition at this very moment, we make a clone of it and remove
  8156. // all other transition classes applied to ensure only the move class
  8157. // is applied.
  8158. var clone = el.cloneNode();
  8159. if (el._transitionClasses) {
  8160. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  8161. }
  8162. addClass(clone, moveClass);
  8163. clone.style.display = 'none';
  8164. this.$el.appendChild(clone);
  8165. var info = getTransitionInfo(clone);
  8166. this.$el.removeChild(clone);
  8167. return (this._hasMove = info.hasTransform)
  8168. }
  8169. }
  8170. };
  8171. function callPendingCbs (c) {
  8172. /* istanbul ignore if */
  8173. if (c.elm._moveCb) {
  8174. c.elm._moveCb();
  8175. }
  8176. /* istanbul ignore if */
  8177. if (c.elm._enterCb) {
  8178. c.elm._enterCb();
  8179. }
  8180. }
  8181. function recordPosition (c) {
  8182. c.data.newPos = c.elm.getBoundingClientRect();
  8183. }
  8184. function applyTranslation (c) {
  8185. var oldPos = c.data.pos;
  8186. var newPos = c.data.newPos;
  8187. var dx = oldPos.left - newPos.left;
  8188. var dy = oldPos.top - newPos.top;
  8189. if (dx || dy) {
  8190. c.data.moved = true;
  8191. var s = c.elm.style;
  8192. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  8193. s.transitionDuration = '0s';
  8194. }
  8195. }
  8196. var platformComponents = {
  8197. Transition: Transition,
  8198. TransitionGroup: TransitionGroup
  8199. };
  8200. /* */
  8201. // install platform specific utils
  8202. Vue.config.mustUseProp = mustUseProp;
  8203. Vue.config.isReservedTag = isReservedTag;
  8204. Vue.config.isReservedAttr = isReservedAttr;
  8205. Vue.config.getTagNamespace = getTagNamespace;
  8206. Vue.config.isUnknownElement = isUnknownElement;
  8207. // install platform runtime directives & components
  8208. extend(Vue.options.directives, platformDirectives);
  8209. extend(Vue.options.components, platformComponents);
  8210. // install platform patch function
  8211. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  8212. // public mount method
  8213. Vue.prototype.$mount = function (
  8214. el,
  8215. hydrating
  8216. ) {
  8217. el = el && inBrowser ? query(el) : undefined;
  8218. return mountComponent(this, el, hydrating)
  8219. };
  8220. // devtools global hook
  8221. /* istanbul ignore next */
  8222. if (inBrowser) {
  8223. setTimeout(function () {
  8224. if (config.devtools) {
  8225. if (devtools) {
  8226. devtools.emit('init', Vue);
  8227. } else if (
  8228. process.env.NODE_ENV !== 'production' &&
  8229. process.env.NODE_ENV !== 'test'
  8230. ) {
  8231. console[console.info ? 'info' : 'log'](
  8232. 'Download the Vue Devtools extension for a better development experience:\n' +
  8233. 'https://github.com/vuejs/vue-devtools'
  8234. );
  8235. }
  8236. }
  8237. if (process.env.NODE_ENV !== 'production' &&
  8238. process.env.NODE_ENV !== 'test' &&
  8239. config.productionTip !== false &&
  8240. typeof console !== 'undefined'
  8241. ) {
  8242. console[console.info ? 'info' : 'log'](
  8243. "You are running Vue in development mode.\n" +
  8244. "Make sure to turn on production mode when deploying for production.\n" +
  8245. "See more tips at https://vuejs.org/guide/deployment.html"
  8246. );
  8247. }
  8248. }, 0);
  8249. }
  8250. /* */
  8251. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  8252. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  8253. var buildRegex = cached(function (delimiters) {
  8254. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  8255. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  8256. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  8257. });
  8258. function parseText (
  8259. text,
  8260. delimiters
  8261. ) {
  8262. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  8263. if (!tagRE.test(text)) {
  8264. return
  8265. }
  8266. var tokens = [];
  8267. var rawTokens = [];
  8268. var lastIndex = tagRE.lastIndex = 0;
  8269. var match, index, tokenValue;
  8270. while ((match = tagRE.exec(text))) {
  8271. index = match.index;
  8272. // push text token
  8273. if (index > lastIndex) {
  8274. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  8275. tokens.push(JSON.stringify(tokenValue));
  8276. }
  8277. // tag token
  8278. var exp = parseFilters(match[1].trim());
  8279. tokens.push(("_s(" + exp + ")"));
  8280. rawTokens.push({ '@binding': exp });
  8281. lastIndex = index + match[0].length;
  8282. }
  8283. if (lastIndex < text.length) {
  8284. rawTokens.push(tokenValue = text.slice(lastIndex));
  8285. tokens.push(JSON.stringify(tokenValue));
  8286. }
  8287. return {
  8288. expression: tokens.join('+'),
  8289. tokens: rawTokens
  8290. }
  8291. }
  8292. /* */
  8293. function transformNode (el, options) {
  8294. var warn = options.warn || baseWarn;
  8295. var staticClass = getAndRemoveAttr(el, 'class');
  8296. if (process.env.NODE_ENV !== 'production' && staticClass) {
  8297. var res = parseText(staticClass, options.delimiters);
  8298. if (res) {
  8299. warn(
  8300. "class=\"" + staticClass + "\": " +
  8301. 'Interpolation inside attributes has been removed. ' +
  8302. 'Use v-bind or the colon shorthand instead. For example, ' +
  8303. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  8304. el.rawAttrsMap['class']
  8305. );
  8306. }
  8307. }
  8308. if (staticClass) {
  8309. el.staticClass = JSON.stringify(staticClass);
  8310. }
  8311. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  8312. if (classBinding) {
  8313. el.classBinding = classBinding;
  8314. }
  8315. }
  8316. function genData (el) {
  8317. var data = '';
  8318. if (el.staticClass) {
  8319. data += "staticClass:" + (el.staticClass) + ",";
  8320. }
  8321. if (el.classBinding) {
  8322. data += "class:" + (el.classBinding) + ",";
  8323. }
  8324. return data
  8325. }
  8326. var klass$1 = {
  8327. staticKeys: ['staticClass'],
  8328. transformNode: transformNode,
  8329. genData: genData
  8330. };
  8331. /* */
  8332. function transformNode$1 (el, options) {
  8333. var warn = options.warn || baseWarn;
  8334. var staticStyle = getAndRemoveAttr(el, 'style');
  8335. if (staticStyle) {
  8336. /* istanbul ignore if */
  8337. if (process.env.NODE_ENV !== 'production') {
  8338. var res = parseText(staticStyle, options.delimiters);
  8339. if (res) {
  8340. warn(
  8341. "style=\"" + staticStyle + "\": " +
  8342. 'Interpolation inside attributes has been removed. ' +
  8343. 'Use v-bind or the colon shorthand instead. For example, ' +
  8344. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  8345. el.rawAttrsMap['style']
  8346. );
  8347. }
  8348. }
  8349. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  8350. }
  8351. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  8352. if (styleBinding) {
  8353. el.styleBinding = styleBinding;
  8354. }
  8355. }
  8356. function genData$1 (el) {
  8357. var data = '';
  8358. if (el.staticStyle) {
  8359. data += "staticStyle:" + (el.staticStyle) + ",";
  8360. }
  8361. if (el.styleBinding) {
  8362. data += "style:(" + (el.styleBinding) + "),";
  8363. }
  8364. return data
  8365. }
  8366. var style$1 = {
  8367. staticKeys: ['staticStyle'],
  8368. transformNode: transformNode$1,
  8369. genData: genData$1
  8370. };
  8371. /* */
  8372. var decoder;
  8373. var he = {
  8374. decode: function decode (html) {
  8375. decoder = decoder || document.createElement('div');
  8376. decoder.innerHTML = html;
  8377. return decoder.textContent
  8378. }
  8379. };
  8380. /* */
  8381. var isUnaryTag = makeMap(
  8382. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  8383. 'link,meta,param,source,track,wbr'
  8384. );
  8385. // Elements that you can, intentionally, leave open
  8386. // (and which close themselves)
  8387. var canBeLeftOpenTag = makeMap(
  8388. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  8389. );
  8390. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  8391. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  8392. var isNonPhrasingTag = makeMap(
  8393. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  8394. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  8395. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  8396. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  8397. 'title,tr,track'
  8398. );
  8399. /**
  8400. * Not type-checking this file because it's mostly vendor code.
  8401. */
  8402. // Regular Expressions for parsing tags and attributes
  8403. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  8404. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  8405. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  8406. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  8407. var startTagOpen = new RegExp(("^<" + qnameCapture));
  8408. var startTagClose = /^\s*(\/?)>/;
  8409. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  8410. var doctype = /^<!DOCTYPE [^>]+>/i;
  8411. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  8412. var comment = /^<!\--/;
  8413. var conditionalComment = /^<!\[/;
  8414. // Special Elements (can contain anything)
  8415. var isPlainTextElement = makeMap('script,style,textarea', true);
  8416. var reCache = {};
  8417. var decodingMap = {
  8418. '&lt;': '<',
  8419. '&gt;': '>',
  8420. '&quot;': '"',
  8421. '&amp;': '&',
  8422. '&#10;': '\n',
  8423. '&#9;': '\t',
  8424. '&#39;': "'"
  8425. };
  8426. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  8427. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  8428. // #5992
  8429. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  8430. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  8431. function decodeAttr (value, shouldDecodeNewlines) {
  8432. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  8433. return value.replace(re, function (match) { return decodingMap[match]; })
  8434. }
  8435. function parseHTML (html, options) {
  8436. var stack = [];
  8437. var expectHTML = options.expectHTML;
  8438. var isUnaryTag$$1 = options.isUnaryTag || no;
  8439. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  8440. var index = 0;
  8441. var last, lastTag;
  8442. while (html) {
  8443. last = html;
  8444. // Make sure we're not in a plaintext content element like script/style
  8445. if (!lastTag || !isPlainTextElement(lastTag)) {
  8446. var textEnd = html.indexOf('<');
  8447. if (textEnd === 0) {
  8448. // Comment:
  8449. if (comment.test(html)) {
  8450. var commentEnd = html.indexOf('-->');
  8451. if (commentEnd >= 0) {
  8452. if (options.shouldKeepComment) {
  8453. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  8454. }
  8455. advance(commentEnd + 3);
  8456. continue
  8457. }
  8458. }
  8459. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  8460. if (conditionalComment.test(html)) {
  8461. var conditionalEnd = html.indexOf(']>');
  8462. if (conditionalEnd >= 0) {
  8463. advance(conditionalEnd + 2);
  8464. continue
  8465. }
  8466. }
  8467. // Doctype:
  8468. var doctypeMatch = html.match(doctype);
  8469. if (doctypeMatch) {
  8470. advance(doctypeMatch[0].length);
  8471. continue
  8472. }
  8473. // End tag:
  8474. var endTagMatch = html.match(endTag);
  8475. if (endTagMatch) {
  8476. var curIndex = index;
  8477. advance(endTagMatch[0].length);
  8478. parseEndTag(endTagMatch[1], curIndex, index);
  8479. continue
  8480. }
  8481. // Start tag:
  8482. var startTagMatch = parseStartTag();
  8483. if (startTagMatch) {
  8484. handleStartTag(startTagMatch);
  8485. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  8486. advance(1);
  8487. }
  8488. continue
  8489. }
  8490. }
  8491. var text = (void 0), rest = (void 0), next = (void 0);
  8492. if (textEnd >= 0) {
  8493. rest = html.slice(textEnd);
  8494. while (
  8495. !endTag.test(rest) &&
  8496. !startTagOpen.test(rest) &&
  8497. !comment.test(rest) &&
  8498. !conditionalComment.test(rest)
  8499. ) {
  8500. // < in plain text, be forgiving and treat it as text
  8501. next = rest.indexOf('<', 1);
  8502. if (next < 0) { break }
  8503. textEnd += next;
  8504. rest = html.slice(textEnd);
  8505. }
  8506. text = html.substring(0, textEnd);
  8507. }
  8508. if (textEnd < 0) {
  8509. text = html;
  8510. }
  8511. if (text) {
  8512. advance(text.length);
  8513. }
  8514. if (options.chars && text) {
  8515. options.chars(text, index - text.length, index);
  8516. }
  8517. } else {
  8518. var endTagLength = 0;
  8519. var stackedTag = lastTag.toLowerCase();
  8520. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  8521. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  8522. endTagLength = endTag.length;
  8523. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  8524. text = text
  8525. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  8526. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  8527. }
  8528. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  8529. text = text.slice(1);
  8530. }
  8531. if (options.chars) {
  8532. options.chars(text);
  8533. }
  8534. return ''
  8535. });
  8536. index += html.length - rest$1.length;
  8537. html = rest$1;
  8538. parseEndTag(stackedTag, index - endTagLength, index);
  8539. }
  8540. if (html === last) {
  8541. options.chars && options.chars(html);
  8542. if (process.env.NODE_ENV !== 'production' && !stack.length && options.warn) {
  8543. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  8544. }
  8545. break
  8546. }
  8547. }
  8548. // Clean up any remaining tags
  8549. parseEndTag();
  8550. function advance (n) {
  8551. index += n;
  8552. html = html.substring(n);
  8553. }
  8554. function parseStartTag () {
  8555. var start = html.match(startTagOpen);
  8556. if (start) {
  8557. var match = {
  8558. tagName: start[1],
  8559. attrs: [],
  8560. start: index
  8561. };
  8562. advance(start[0].length);
  8563. var end, attr;
  8564. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  8565. attr.start = index;
  8566. advance(attr[0].length);
  8567. attr.end = index;
  8568. match.attrs.push(attr);
  8569. }
  8570. if (end) {
  8571. match.unarySlash = end[1];
  8572. advance(end[0].length);
  8573. match.end = index;
  8574. return match
  8575. }
  8576. }
  8577. }
  8578. function handleStartTag (match) {
  8579. var tagName = match.tagName;
  8580. var unarySlash = match.unarySlash;
  8581. if (expectHTML) {
  8582. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  8583. parseEndTag(lastTag);
  8584. }
  8585. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  8586. parseEndTag(tagName);
  8587. }
  8588. }
  8589. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  8590. var l = match.attrs.length;
  8591. var attrs = new Array(l);
  8592. for (var i = 0; i < l; i++) {
  8593. var args = match.attrs[i];
  8594. var value = args[3] || args[4] || args[5] || '';
  8595. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  8596. ? options.shouldDecodeNewlinesForHref
  8597. : options.shouldDecodeNewlines;
  8598. attrs[i] = {
  8599. name: args[1],
  8600. value: decodeAttr(value, shouldDecodeNewlines)
  8601. };
  8602. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  8603. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  8604. attrs[i].end = args.end;
  8605. }
  8606. }
  8607. if (!unary) {
  8608. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  8609. lastTag = tagName;
  8610. }
  8611. if (options.start) {
  8612. options.start(tagName, attrs, unary, match.start, match.end);
  8613. }
  8614. }
  8615. function parseEndTag (tagName, start, end) {
  8616. var pos, lowerCasedTagName;
  8617. if (start == null) { start = index; }
  8618. if (end == null) { end = index; }
  8619. // Find the closest opened tag of the same type
  8620. if (tagName) {
  8621. lowerCasedTagName = tagName.toLowerCase();
  8622. for (pos = stack.length - 1; pos >= 0; pos--) {
  8623. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  8624. break
  8625. }
  8626. }
  8627. } else {
  8628. // If no tag name is provided, clean shop
  8629. pos = 0;
  8630. }
  8631. if (pos >= 0) {
  8632. // Close all the open elements, up the stack
  8633. for (var i = stack.length - 1; i >= pos; i--) {
  8634. if (process.env.NODE_ENV !== 'production' &&
  8635. (i > pos || !tagName) &&
  8636. options.warn
  8637. ) {
  8638. options.warn(
  8639. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  8640. { start: stack[i].start, end: stack[i].end }
  8641. );
  8642. }
  8643. if (options.end) {
  8644. options.end(stack[i].tag, start, end);
  8645. }
  8646. }
  8647. // Remove the open elements from the stack
  8648. stack.length = pos;
  8649. lastTag = pos && stack[pos - 1].tag;
  8650. } else if (lowerCasedTagName === 'br') {
  8651. if (options.start) {
  8652. options.start(tagName, [], true, start, end);
  8653. }
  8654. } else if (lowerCasedTagName === 'p') {
  8655. if (options.start) {
  8656. options.start(tagName, [], false, start, end);
  8657. }
  8658. if (options.end) {
  8659. options.end(tagName, start, end);
  8660. }
  8661. }
  8662. }
  8663. }
  8664. /* */
  8665. var onRE = /^@|^v-on:/;
  8666. var dirRE = /^v-|^@|^:|^#/;
  8667. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  8668. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  8669. var stripParensRE = /^\(|\)$/g;
  8670. var dynamicArgRE = /^\[.*\]$/;
  8671. var argRE = /:(.*)$/;
  8672. var bindRE = /^:|^\.|^v-bind:/;
  8673. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  8674. var slotRE = /^v-slot(:|$)|^#/;
  8675. var lineBreakRE = /[\r\n]/;
  8676. var whitespaceRE$1 = /[ \f\t\r\n]+/g;
  8677. var invalidAttributeRE = /[\s"'<>\/=]/;
  8678. var decodeHTMLCached = cached(he.decode);
  8679. var emptySlotScopeToken = "_empty_";
  8680. // configurable state
  8681. var warn$2;
  8682. var delimiters;
  8683. var transforms;
  8684. var preTransforms;
  8685. var postTransforms;
  8686. var platformIsPreTag;
  8687. var platformMustUseProp;
  8688. var platformGetTagNamespace;
  8689. var maybeComponent;
  8690. function createASTElement (
  8691. tag,
  8692. attrs,
  8693. parent
  8694. ) {
  8695. return {
  8696. type: 1,
  8697. tag: tag,
  8698. attrsList: attrs,
  8699. attrsMap: makeAttrsMap(attrs),
  8700. rawAttrsMap: {},
  8701. parent: parent,
  8702. children: []
  8703. }
  8704. }
  8705. /**
  8706. * Convert HTML string to AST.
  8707. */
  8708. function parse (
  8709. template,
  8710. options
  8711. ) {
  8712. warn$2 = options.warn || baseWarn;
  8713. platformIsPreTag = options.isPreTag || no;
  8714. platformMustUseProp = options.mustUseProp || no;
  8715. platformGetTagNamespace = options.getTagNamespace || no;
  8716. var isReservedTag = options.isReservedTag || no;
  8717. maybeComponent = function (el) { return !!(
  8718. el.component ||
  8719. el.attrsMap[':is'] ||
  8720. el.attrsMap['v-bind:is'] ||
  8721. !(el.attrsMap.is ? isReservedTag(el.attrsMap.is) : isReservedTag(el.tag))
  8722. ); };
  8723. transforms = pluckModuleFunction(options.modules, 'transformNode');
  8724. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  8725. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  8726. delimiters = options.delimiters;
  8727. var stack = [];
  8728. var preserveWhitespace = options.preserveWhitespace !== false;
  8729. var whitespaceOption = options.whitespace;
  8730. var root;
  8731. var currentParent;
  8732. var inVPre = false;
  8733. var inPre = false;
  8734. var warned = false;
  8735. function warnOnce (msg, range) {
  8736. if (!warned) {
  8737. warned = true;
  8738. warn$2(msg, range);
  8739. }
  8740. }
  8741. function closeElement (element) {
  8742. trimEndingWhitespace(element);
  8743. if (!inVPre && !element.processed) {
  8744. element = processElement(element, options);
  8745. }
  8746. // tree management
  8747. if (!stack.length && element !== root) {
  8748. // allow root elements with v-if, v-else-if and v-else
  8749. if (root.if && (element.elseif || element.else)) {
  8750. if (process.env.NODE_ENV !== 'production') {
  8751. checkRootConstraints(element);
  8752. }
  8753. addIfCondition(root, {
  8754. exp: element.elseif,
  8755. block: element
  8756. });
  8757. } else if (process.env.NODE_ENV !== 'production') {
  8758. warnOnce(
  8759. "Component template should contain exactly one root element. " +
  8760. "If you are using v-if on multiple elements, " +
  8761. "use v-else-if to chain them instead.",
  8762. { start: element.start }
  8763. );
  8764. }
  8765. }
  8766. if (currentParent && !element.forbidden) {
  8767. if (element.elseif || element.else) {
  8768. processIfConditions(element, currentParent);
  8769. } else {
  8770. if (element.slotScope) {
  8771. // scoped slot
  8772. // keep it in the children list so that v-else(-if) conditions can
  8773. // find it as the prev node.
  8774. var name = element.slotTarget || '"default"'
  8775. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  8776. }
  8777. currentParent.children.push(element);
  8778. element.parent = currentParent;
  8779. }
  8780. }
  8781. // final children cleanup
  8782. // filter out scoped slots
  8783. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  8784. // remove trailing whitespace node again
  8785. trimEndingWhitespace(element);
  8786. // check pre state
  8787. if (element.pre) {
  8788. inVPre = false;
  8789. }
  8790. if (platformIsPreTag(element.tag)) {
  8791. inPre = false;
  8792. }
  8793. // apply post-transforms
  8794. for (var i = 0; i < postTransforms.length; i++) {
  8795. postTransforms[i](element, options);
  8796. }
  8797. }
  8798. function trimEndingWhitespace (el) {
  8799. // remove trailing whitespace node
  8800. if (!inPre) {
  8801. var lastNode;
  8802. while (
  8803. (lastNode = el.children[el.children.length - 1]) &&
  8804. lastNode.type === 3 &&
  8805. lastNode.text === ' '
  8806. ) {
  8807. el.children.pop();
  8808. }
  8809. }
  8810. }
  8811. function checkRootConstraints (el) {
  8812. if (el.tag === 'slot' || el.tag === 'template') {
  8813. warnOnce(
  8814. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  8815. 'contain multiple nodes.',
  8816. { start: el.start }
  8817. );
  8818. }
  8819. if (el.attrsMap.hasOwnProperty('v-for')) {
  8820. warnOnce(
  8821. 'Cannot use v-for on stateful component root element because ' +
  8822. 'it renders multiple elements.',
  8823. el.rawAttrsMap['v-for']
  8824. );
  8825. }
  8826. }
  8827. parseHTML(template, {
  8828. warn: warn$2,
  8829. expectHTML: options.expectHTML,
  8830. isUnaryTag: options.isUnaryTag,
  8831. canBeLeftOpenTag: options.canBeLeftOpenTag,
  8832. shouldDecodeNewlines: options.shouldDecodeNewlines,
  8833. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  8834. shouldKeepComment: options.comments,
  8835. outputSourceRange: options.outputSourceRange,
  8836. start: function start (tag, attrs, unary, start$1, end) {
  8837. // check namespace.
  8838. // inherit parent ns if there is one
  8839. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  8840. // handle IE svg bug
  8841. /* istanbul ignore if */
  8842. if (isIE && ns === 'svg') {
  8843. attrs = guardIESVGBug(attrs);
  8844. }
  8845. var element = createASTElement(tag, attrs, currentParent);
  8846. if (ns) {
  8847. element.ns = ns;
  8848. }
  8849. if (process.env.NODE_ENV !== 'production') {
  8850. if (options.outputSourceRange) {
  8851. element.start = start$1;
  8852. element.end = end;
  8853. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  8854. cumulated[attr.name] = attr;
  8855. return cumulated
  8856. }, {});
  8857. }
  8858. attrs.forEach(function (attr) {
  8859. if (invalidAttributeRE.test(attr.name)) {
  8860. warn$2(
  8861. "Invalid dynamic argument expression: attribute names cannot contain " +
  8862. "spaces, quotes, <, >, / or =.",
  8863. {
  8864. start: attr.start + attr.name.indexOf("["),
  8865. end: attr.start + attr.name.length
  8866. }
  8867. );
  8868. }
  8869. });
  8870. }
  8871. if (isForbiddenTag(element) && !isServerRendering()) {
  8872. element.forbidden = true;
  8873. process.env.NODE_ENV !== 'production' && warn$2(
  8874. 'Templates should only be responsible for mapping the state to the ' +
  8875. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  8876. "<" + tag + ">" + ', as they will not be parsed.',
  8877. { start: element.start }
  8878. );
  8879. }
  8880. // apply pre-transforms
  8881. for (var i = 0; i < preTransforms.length; i++) {
  8882. element = preTransforms[i](element, options) || element;
  8883. }
  8884. if (!inVPre) {
  8885. processPre(element);
  8886. if (element.pre) {
  8887. inVPre = true;
  8888. }
  8889. }
  8890. if (platformIsPreTag(element.tag)) {
  8891. inPre = true;
  8892. }
  8893. if (inVPre) {
  8894. processRawAttrs(element);
  8895. } else if (!element.processed) {
  8896. // structural directives
  8897. processFor(element);
  8898. processIf(element);
  8899. processOnce(element);
  8900. }
  8901. if (!root) {
  8902. root = element;
  8903. if (process.env.NODE_ENV !== 'production') {
  8904. checkRootConstraints(root);
  8905. }
  8906. }
  8907. if (!unary) {
  8908. currentParent = element;
  8909. stack.push(element);
  8910. } else {
  8911. closeElement(element);
  8912. }
  8913. },
  8914. end: function end (tag, start, end$1) {
  8915. var element = stack[stack.length - 1];
  8916. // pop stack
  8917. stack.length -= 1;
  8918. currentParent = stack[stack.length - 1];
  8919. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  8920. element.end = end$1;
  8921. }
  8922. closeElement(element);
  8923. },
  8924. chars: function chars (text, start, end) {
  8925. if (!currentParent) {
  8926. if (process.env.NODE_ENV !== 'production') {
  8927. if (text === template) {
  8928. warnOnce(
  8929. 'Component template requires a root element, rather than just text.',
  8930. { start: start }
  8931. );
  8932. } else if ((text = text.trim())) {
  8933. warnOnce(
  8934. ("text \"" + text + "\" outside root element will be ignored."),
  8935. { start: start }
  8936. );
  8937. }
  8938. }
  8939. return
  8940. }
  8941. // IE textarea placeholder bug
  8942. /* istanbul ignore if */
  8943. if (isIE &&
  8944. currentParent.tag === 'textarea' &&
  8945. currentParent.attrsMap.placeholder === text
  8946. ) {
  8947. return
  8948. }
  8949. var children = currentParent.children;
  8950. if (inPre || text.trim()) {
  8951. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  8952. } else if (!children.length) {
  8953. // remove the whitespace-only node right after an opening tag
  8954. text = '';
  8955. } else if (whitespaceOption) {
  8956. if (whitespaceOption === 'condense') {
  8957. // in condense mode, remove the whitespace node if it contains
  8958. // line break, otherwise condense to a single space
  8959. text = lineBreakRE.test(text) ? '' : ' ';
  8960. } else {
  8961. text = ' ';
  8962. }
  8963. } else {
  8964. text = preserveWhitespace ? ' ' : '';
  8965. }
  8966. if (text) {
  8967. if (!inPre && whitespaceOption === 'condense') {
  8968. // condense consecutive whitespaces into single space
  8969. text = text.replace(whitespaceRE$1, ' ');
  8970. }
  8971. var res;
  8972. var child;
  8973. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  8974. child = {
  8975. type: 2,
  8976. expression: res.expression,
  8977. tokens: res.tokens,
  8978. text: text
  8979. };
  8980. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  8981. child = {
  8982. type: 3,
  8983. text: text
  8984. };
  8985. }
  8986. if (child) {
  8987. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  8988. child.start = start;
  8989. child.end = end;
  8990. }
  8991. children.push(child);
  8992. }
  8993. }
  8994. },
  8995. comment: function comment (text, start, end) {
  8996. // adding anything as a sibling to the root node is forbidden
  8997. // comments should still be allowed, but ignored
  8998. if (currentParent) {
  8999. var child = {
  9000. type: 3,
  9001. text: text,
  9002. isComment: true
  9003. };
  9004. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  9005. child.start = start;
  9006. child.end = end;
  9007. }
  9008. currentParent.children.push(child);
  9009. }
  9010. }
  9011. });
  9012. return root
  9013. }
  9014. function processPre (el) {
  9015. if (getAndRemoveAttr(el, 'v-pre') != null) {
  9016. el.pre = true;
  9017. }
  9018. }
  9019. function processRawAttrs (el) {
  9020. var list = el.attrsList;
  9021. var len = list.length;
  9022. if (len) {
  9023. var attrs = el.attrs = new Array(len);
  9024. for (var i = 0; i < len; i++) {
  9025. attrs[i] = {
  9026. name: list[i].name,
  9027. value: JSON.stringify(list[i].value)
  9028. };
  9029. if (list[i].start != null) {
  9030. attrs[i].start = list[i].start;
  9031. attrs[i].end = list[i].end;
  9032. }
  9033. }
  9034. } else if (!el.pre) {
  9035. // non root node in pre blocks with no attributes
  9036. el.plain = true;
  9037. }
  9038. }
  9039. function processElement (
  9040. element,
  9041. options
  9042. ) {
  9043. processKey(element);
  9044. // determine whether this is a plain element after
  9045. // removing structural attributes
  9046. element.plain = (
  9047. !element.key &&
  9048. !element.scopedSlots &&
  9049. !element.attrsList.length
  9050. );
  9051. processRef(element);
  9052. processSlotContent(element);
  9053. processSlotOutlet(element);
  9054. processComponent(element);
  9055. for (var i = 0; i < transforms.length; i++) {
  9056. element = transforms[i](element, options) || element;
  9057. }
  9058. processAttrs(element);
  9059. return element
  9060. }
  9061. function processKey (el) {
  9062. var exp = getBindingAttr(el, 'key');
  9063. if (exp) {
  9064. if (process.env.NODE_ENV !== 'production') {
  9065. if (el.tag === 'template') {
  9066. warn$2(
  9067. "<template> cannot be keyed. Place the key on real elements instead.",
  9068. getRawBindingAttr(el, 'key')
  9069. );
  9070. }
  9071. if (el.for) {
  9072. var iterator = el.iterator2 || el.iterator1;
  9073. var parent = el.parent;
  9074. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  9075. warn$2(
  9076. "Do not use v-for index as key on <transition-group> children, " +
  9077. "this is the same as not using keys.",
  9078. getRawBindingAttr(el, 'key'),
  9079. true /* tip */
  9080. );
  9081. }
  9082. }
  9083. }
  9084. el.key = exp;
  9085. }
  9086. }
  9087. function processRef (el) {
  9088. var ref = getBindingAttr(el, 'ref');
  9089. if (ref) {
  9090. el.ref = ref;
  9091. el.refInFor = checkInFor(el);
  9092. }
  9093. }
  9094. function processFor (el) {
  9095. var exp;
  9096. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  9097. var res = parseFor(exp);
  9098. if (res) {
  9099. extend(el, res);
  9100. } else if (process.env.NODE_ENV !== 'production') {
  9101. warn$2(
  9102. ("Invalid v-for expression: " + exp),
  9103. el.rawAttrsMap['v-for']
  9104. );
  9105. }
  9106. }
  9107. }
  9108. function parseFor (exp) {
  9109. var inMatch = exp.match(forAliasRE);
  9110. if (!inMatch) { return }
  9111. var res = {};
  9112. res.for = inMatch[2].trim();
  9113. var alias = inMatch[1].trim().replace(stripParensRE, '');
  9114. var iteratorMatch = alias.match(forIteratorRE);
  9115. if (iteratorMatch) {
  9116. res.alias = alias.replace(forIteratorRE, '').trim();
  9117. res.iterator1 = iteratorMatch[1].trim();
  9118. if (iteratorMatch[2]) {
  9119. res.iterator2 = iteratorMatch[2].trim();
  9120. }
  9121. } else {
  9122. res.alias = alias;
  9123. }
  9124. return res
  9125. }
  9126. function processIf (el) {
  9127. var exp = getAndRemoveAttr(el, 'v-if');
  9128. if (exp) {
  9129. el.if = exp;
  9130. addIfCondition(el, {
  9131. exp: exp,
  9132. block: el
  9133. });
  9134. } else {
  9135. if (getAndRemoveAttr(el, 'v-else') != null) {
  9136. el.else = true;
  9137. }
  9138. var elseif = getAndRemoveAttr(el, 'v-else-if');
  9139. if (elseif) {
  9140. el.elseif = elseif;
  9141. }
  9142. }
  9143. }
  9144. function processIfConditions (el, parent) {
  9145. var prev = findPrevElement(parent.children);
  9146. if (prev && prev.if) {
  9147. addIfCondition(prev, {
  9148. exp: el.elseif,
  9149. block: el
  9150. });
  9151. } else if (process.env.NODE_ENV !== 'production') {
  9152. warn$2(
  9153. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  9154. "used on element <" + (el.tag) + "> without corresponding v-if.",
  9155. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  9156. );
  9157. }
  9158. }
  9159. function findPrevElement (children) {
  9160. var i = children.length;
  9161. while (i--) {
  9162. if (children[i].type === 1) {
  9163. return children[i]
  9164. } else {
  9165. if (process.env.NODE_ENV !== 'production' && children[i].text !== ' ') {
  9166. warn$2(
  9167. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  9168. "will be ignored.",
  9169. children[i]
  9170. );
  9171. }
  9172. children.pop();
  9173. }
  9174. }
  9175. }
  9176. function addIfCondition (el, condition) {
  9177. if (!el.ifConditions) {
  9178. el.ifConditions = [];
  9179. }
  9180. el.ifConditions.push(condition);
  9181. }
  9182. function processOnce (el) {
  9183. var once$$1 = getAndRemoveAttr(el, 'v-once');
  9184. if (once$$1 != null) {
  9185. el.once = true;
  9186. }
  9187. }
  9188. // handle content being passed to a component as slot,
  9189. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  9190. function processSlotContent (el) {
  9191. var slotScope;
  9192. if (el.tag === 'template') {
  9193. slotScope = getAndRemoveAttr(el, 'scope');
  9194. /* istanbul ignore if */
  9195. if (process.env.NODE_ENV !== 'production' && slotScope) {
  9196. warn$2(
  9197. "the \"scope\" attribute for scoped slots have been deprecated and " +
  9198. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  9199. "can also be used on plain elements in addition to <template> to " +
  9200. "denote scoped slots.",
  9201. el.rawAttrsMap['scope'],
  9202. true
  9203. );
  9204. }
  9205. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  9206. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  9207. /* istanbul ignore if */
  9208. if (process.env.NODE_ENV !== 'production' && el.attrsMap['v-for']) {
  9209. warn$2(
  9210. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  9211. "(v-for takes higher priority). Use a wrapper <template> for the " +
  9212. "scoped slot to make it clearer.",
  9213. el.rawAttrsMap['slot-scope'],
  9214. true
  9215. );
  9216. }
  9217. el.slotScope = slotScope;
  9218. }
  9219. // slot="xxx"
  9220. var slotTarget = getBindingAttr(el, 'slot');
  9221. if (slotTarget) {
  9222. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  9223. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  9224. // preserve slot as an attribute for native shadow DOM compat
  9225. // only for non-scoped slots.
  9226. if (el.tag !== 'template' && !el.slotScope) {
  9227. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  9228. }
  9229. }
  9230. // 2.6 v-slot syntax
  9231. {
  9232. if (el.tag === 'template') {
  9233. // v-slot on <template>
  9234. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  9235. if (slotBinding) {
  9236. if (process.env.NODE_ENV !== 'production') {
  9237. if (el.slotTarget || el.slotScope) {
  9238. warn$2(
  9239. "Unexpected mixed usage of different slot syntaxes.",
  9240. el
  9241. );
  9242. }
  9243. if (el.parent && !maybeComponent(el.parent)) {
  9244. warn$2(
  9245. "<template v-slot> can only appear at the root level inside " +
  9246. "the receiving component",
  9247. el
  9248. );
  9249. }
  9250. }
  9251. var ref = getSlotName(slotBinding);
  9252. var name = ref.name;
  9253. var dynamic = ref.dynamic;
  9254. el.slotTarget = name;
  9255. el.slotTargetDynamic = dynamic;
  9256. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  9257. }
  9258. } else {
  9259. // v-slot on component, denotes default slot
  9260. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  9261. if (slotBinding$1) {
  9262. if (process.env.NODE_ENV !== 'production') {
  9263. if (!maybeComponent(el)) {
  9264. warn$2(
  9265. "v-slot can only be used on components or <template>.",
  9266. slotBinding$1
  9267. );
  9268. }
  9269. if (el.slotScope || el.slotTarget) {
  9270. warn$2(
  9271. "Unexpected mixed usage of different slot syntaxes.",
  9272. el
  9273. );
  9274. }
  9275. if (el.scopedSlots) {
  9276. warn$2(
  9277. "To avoid scope ambiguity, the default slot should also use " +
  9278. "<template> syntax when there are other named slots.",
  9279. slotBinding$1
  9280. );
  9281. }
  9282. }
  9283. // add the component's children to its default slot
  9284. var slots = el.scopedSlots || (el.scopedSlots = {});
  9285. var ref$1 = getSlotName(slotBinding$1);
  9286. var name$1 = ref$1.name;
  9287. var dynamic$1 = ref$1.dynamic;
  9288. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  9289. slotContainer.slotTarget = name$1;
  9290. slotContainer.slotTargetDynamic = dynamic$1;
  9291. slotContainer.children = el.children.filter(function (c) {
  9292. if (!c.slotScope) {
  9293. c.parent = slotContainer;
  9294. return true
  9295. }
  9296. });
  9297. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  9298. // remove children as they are returned from scopedSlots now
  9299. el.children = [];
  9300. // mark el non-plain so data gets generated
  9301. el.plain = false;
  9302. }
  9303. }
  9304. }
  9305. }
  9306. function getSlotName (binding) {
  9307. var name = binding.name.replace(slotRE, '');
  9308. if (!name) {
  9309. if (binding.name[0] !== '#') {
  9310. name = 'default';
  9311. } else if (process.env.NODE_ENV !== 'production') {
  9312. warn$2(
  9313. "v-slot shorthand syntax requires a slot name.",
  9314. binding
  9315. );
  9316. }
  9317. }
  9318. return dynamicArgRE.test(name)
  9319. // dynamic [name]
  9320. ? { name: name.slice(1, -1), dynamic: true }
  9321. // static name
  9322. : { name: ("\"" + name + "\""), dynamic: false }
  9323. }
  9324. // handle <slot/> outlets
  9325. function processSlotOutlet (el) {
  9326. if (el.tag === 'slot') {
  9327. el.slotName = getBindingAttr(el, 'name');
  9328. if (process.env.NODE_ENV !== 'production' && el.key) {
  9329. warn$2(
  9330. "`key` does not work on <slot> because slots are abstract outlets " +
  9331. "and can possibly expand into multiple elements. " +
  9332. "Use the key on a wrapping element instead.",
  9333. getRawBindingAttr(el, 'key')
  9334. );
  9335. }
  9336. }
  9337. }
  9338. function processComponent (el) {
  9339. var binding;
  9340. if ((binding = getBindingAttr(el, 'is'))) {
  9341. el.component = binding;
  9342. }
  9343. if (getAndRemoveAttr(el, 'inline-template') != null) {
  9344. el.inlineTemplate = true;
  9345. }
  9346. }
  9347. function processAttrs (el) {
  9348. var list = el.attrsList;
  9349. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  9350. for (i = 0, l = list.length; i < l; i++) {
  9351. name = rawName = list[i].name;
  9352. value = list[i].value;
  9353. if (dirRE.test(name)) {
  9354. // mark element as dynamic
  9355. el.hasBindings = true;
  9356. // modifiers
  9357. modifiers = parseModifiers(name.replace(dirRE, ''));
  9358. // support .foo shorthand syntax for the .prop modifier
  9359. if (modifiers) {
  9360. name = name.replace(modifierRE, '');
  9361. }
  9362. if (bindRE.test(name)) { // v-bind
  9363. name = name.replace(bindRE, '');
  9364. value = parseFilters(value);
  9365. isDynamic = dynamicArgRE.test(name);
  9366. if (isDynamic) {
  9367. name = name.slice(1, -1);
  9368. }
  9369. if (
  9370. process.env.NODE_ENV !== 'production' &&
  9371. value.trim().length === 0
  9372. ) {
  9373. warn$2(
  9374. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  9375. );
  9376. }
  9377. if (modifiers) {
  9378. if (modifiers.prop && !isDynamic) {
  9379. name = camelize(name);
  9380. if (name === 'innerHtml') { name = 'innerHTML'; }
  9381. }
  9382. if (modifiers.camel && !isDynamic) {
  9383. name = camelize(name);
  9384. }
  9385. if (modifiers.sync) {
  9386. syncGen = genAssignmentCode(value, "$event");
  9387. if (!isDynamic) {
  9388. addHandler(
  9389. el,
  9390. ("update:" + (camelize(name))),
  9391. syncGen,
  9392. null,
  9393. false,
  9394. warn$2,
  9395. list[i]
  9396. );
  9397. if (hyphenate(name) !== camelize(name)) {
  9398. addHandler(
  9399. el,
  9400. ("update:" + (hyphenate(name))),
  9401. syncGen,
  9402. null,
  9403. false,
  9404. warn$2,
  9405. list[i]
  9406. );
  9407. }
  9408. } else {
  9409. // handler w/ dynamic event name
  9410. addHandler(
  9411. el,
  9412. ("\"update:\"+(" + name + ")"),
  9413. syncGen,
  9414. null,
  9415. false,
  9416. warn$2,
  9417. list[i],
  9418. true // dynamic
  9419. );
  9420. }
  9421. }
  9422. }
  9423. if ((modifiers && modifiers.prop) || (
  9424. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  9425. )) {
  9426. addProp(el, name, value, list[i], isDynamic);
  9427. } else {
  9428. addAttr(el, name, value, list[i], isDynamic);
  9429. }
  9430. } else if (onRE.test(name)) { // v-on
  9431. name = name.replace(onRE, '');
  9432. isDynamic = dynamicArgRE.test(name);
  9433. if (isDynamic) {
  9434. name = name.slice(1, -1);
  9435. }
  9436. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  9437. } else { // normal directives
  9438. name = name.replace(dirRE, '');
  9439. // parse arg
  9440. var argMatch = name.match(argRE);
  9441. var arg = argMatch && argMatch[1];
  9442. isDynamic = false;
  9443. if (arg) {
  9444. name = name.slice(0, -(arg.length + 1));
  9445. if (dynamicArgRE.test(arg)) {
  9446. arg = arg.slice(1, -1);
  9447. isDynamic = true;
  9448. }
  9449. }
  9450. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  9451. if (process.env.NODE_ENV !== 'production' && name === 'model') {
  9452. checkForAliasModel(el, value);
  9453. }
  9454. }
  9455. } else {
  9456. // literal attribute
  9457. if (process.env.NODE_ENV !== 'production') {
  9458. var res = parseText(value, delimiters);
  9459. if (res) {
  9460. warn$2(
  9461. name + "=\"" + value + "\": " +
  9462. 'Interpolation inside attributes has been removed. ' +
  9463. 'Use v-bind or the colon shorthand instead. For example, ' +
  9464. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  9465. list[i]
  9466. );
  9467. }
  9468. }
  9469. addAttr(el, name, JSON.stringify(value), list[i]);
  9470. // #6887 firefox doesn't update muted state if set via attribute
  9471. // even immediately after element creation
  9472. if (!el.component &&
  9473. name === 'muted' &&
  9474. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  9475. addProp(el, name, 'true', list[i]);
  9476. }
  9477. }
  9478. }
  9479. }
  9480. function checkInFor (el) {
  9481. var parent = el;
  9482. while (parent) {
  9483. if (parent.for !== undefined) {
  9484. return true
  9485. }
  9486. parent = parent.parent;
  9487. }
  9488. return false
  9489. }
  9490. function parseModifiers (name) {
  9491. var match = name.match(modifierRE);
  9492. if (match) {
  9493. var ret = {};
  9494. match.forEach(function (m) { ret[m.slice(1)] = true; });
  9495. return ret
  9496. }
  9497. }
  9498. function makeAttrsMap (attrs) {
  9499. var map = {};
  9500. for (var i = 0, l = attrs.length; i < l; i++) {
  9501. if (
  9502. process.env.NODE_ENV !== 'production' &&
  9503. map[attrs[i].name] && !isIE && !isEdge
  9504. ) {
  9505. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  9506. }
  9507. map[attrs[i].name] = attrs[i].value;
  9508. }
  9509. return map
  9510. }
  9511. // for script (e.g. type="x/template") or style, do not decode content
  9512. function isTextTag (el) {
  9513. return el.tag === 'script' || el.tag === 'style'
  9514. }
  9515. function isForbiddenTag (el) {
  9516. return (
  9517. el.tag === 'style' ||
  9518. (el.tag === 'script' && (
  9519. !el.attrsMap.type ||
  9520. el.attrsMap.type === 'text/javascript'
  9521. ))
  9522. )
  9523. }
  9524. var ieNSBug = /^xmlns:NS\d+/;
  9525. var ieNSPrefix = /^NS\d+:/;
  9526. /* istanbul ignore next */
  9527. function guardIESVGBug (attrs) {
  9528. var res = [];
  9529. for (var i = 0; i < attrs.length; i++) {
  9530. var attr = attrs[i];
  9531. if (!ieNSBug.test(attr.name)) {
  9532. attr.name = attr.name.replace(ieNSPrefix, '');
  9533. res.push(attr);
  9534. }
  9535. }
  9536. return res
  9537. }
  9538. function checkForAliasModel (el, value) {
  9539. var _el = el;
  9540. while (_el) {
  9541. if (_el.for && _el.alias === value) {
  9542. warn$2(
  9543. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  9544. "You are binding v-model directly to a v-for iteration alias. " +
  9545. "This will not be able to modify the v-for source array because " +
  9546. "writing to the alias is like modifying a function local variable. " +
  9547. "Consider using an array of objects and use v-model on an object property instead.",
  9548. el.rawAttrsMap['v-model']
  9549. );
  9550. }
  9551. _el = _el.parent;
  9552. }
  9553. }
  9554. /* */
  9555. function preTransformNode (el, options) {
  9556. if (el.tag === 'input') {
  9557. var map = el.attrsMap;
  9558. if (!map['v-model']) {
  9559. return
  9560. }
  9561. var typeBinding;
  9562. if (map[':type'] || map['v-bind:type']) {
  9563. typeBinding = getBindingAttr(el, 'type');
  9564. }
  9565. if (!map.type && !typeBinding && map['v-bind']) {
  9566. typeBinding = "(" + (map['v-bind']) + ").type";
  9567. }
  9568. if (typeBinding) {
  9569. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  9570. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  9571. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  9572. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  9573. // 1. checkbox
  9574. var branch0 = cloneASTElement(el);
  9575. // process for on the main node
  9576. processFor(branch0);
  9577. addRawAttr(branch0, 'type', 'checkbox');
  9578. processElement(branch0, options);
  9579. branch0.processed = true; // prevent it from double-processed
  9580. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  9581. addIfCondition(branch0, {
  9582. exp: branch0.if,
  9583. block: branch0
  9584. });
  9585. // 2. add radio else-if condition
  9586. var branch1 = cloneASTElement(el);
  9587. getAndRemoveAttr(branch1, 'v-for', true);
  9588. addRawAttr(branch1, 'type', 'radio');
  9589. processElement(branch1, options);
  9590. addIfCondition(branch0, {
  9591. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  9592. block: branch1
  9593. });
  9594. // 3. other
  9595. var branch2 = cloneASTElement(el);
  9596. getAndRemoveAttr(branch2, 'v-for', true);
  9597. addRawAttr(branch2, ':type', typeBinding);
  9598. processElement(branch2, options);
  9599. addIfCondition(branch0, {
  9600. exp: ifCondition,
  9601. block: branch2
  9602. });
  9603. if (hasElse) {
  9604. branch0.else = true;
  9605. } else if (elseIfCondition) {
  9606. branch0.elseif = elseIfCondition;
  9607. }
  9608. return branch0
  9609. }
  9610. }
  9611. }
  9612. function cloneASTElement (el) {
  9613. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  9614. }
  9615. var model$1 = {
  9616. preTransformNode: preTransformNode
  9617. };
  9618. var modules$1 = [
  9619. klass$1,
  9620. style$1,
  9621. model$1
  9622. ];
  9623. /* */
  9624. function text (el, dir) {
  9625. if (dir.value) {
  9626. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  9627. }
  9628. }
  9629. /* */
  9630. function html (el, dir) {
  9631. if (dir.value) {
  9632. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  9633. }
  9634. }
  9635. var directives$1 = {
  9636. model: model,
  9637. text: text,
  9638. html: html
  9639. };
  9640. /* */
  9641. var baseOptions = {
  9642. expectHTML: true,
  9643. modules: modules$1,
  9644. directives: directives$1,
  9645. isPreTag: isPreTag,
  9646. isUnaryTag: isUnaryTag,
  9647. mustUseProp: mustUseProp,
  9648. canBeLeftOpenTag: canBeLeftOpenTag,
  9649. isReservedTag: isReservedTag,
  9650. getTagNamespace: getTagNamespace,
  9651. staticKeys: genStaticKeys(modules$1)
  9652. };
  9653. /* */
  9654. var isStaticKey;
  9655. var isPlatformReservedTag;
  9656. var genStaticKeysCached = cached(genStaticKeys$1);
  9657. /**
  9658. * Goal of the optimizer: walk the generated template AST tree
  9659. * and detect sub-trees that are purely static, i.e. parts of
  9660. * the DOM that never needs to change.
  9661. *
  9662. * Once we detect these sub-trees, we can:
  9663. *
  9664. * 1. Hoist them into constants, so that we no longer need to
  9665. * create fresh nodes for them on each re-render;
  9666. * 2. Completely skip them in the patching process.
  9667. */
  9668. function optimize (root, options) {
  9669. if (!root) { return }
  9670. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  9671. isPlatformReservedTag = options.isReservedTag || no;
  9672. // first pass: mark all non-static nodes.
  9673. markStatic$1(root);
  9674. // second pass: mark static roots.
  9675. markStaticRoots(root, false);
  9676. }
  9677. function genStaticKeys$1 (keys) {
  9678. return makeMap(
  9679. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  9680. (keys ? ',' + keys : '')
  9681. )
  9682. }
  9683. function markStatic$1 (node) {
  9684. node.static = isStatic(node);
  9685. if (node.type === 1) {
  9686. // do not make component slot content static. this avoids
  9687. // 1. components not able to mutate slot nodes
  9688. // 2. static slot content fails for hot-reloading
  9689. if (
  9690. !isPlatformReservedTag(node.tag) &&
  9691. node.tag !== 'slot' &&
  9692. node.attrsMap['inline-template'] == null
  9693. ) {
  9694. return
  9695. }
  9696. for (var i = 0, l = node.children.length; i < l; i++) {
  9697. var child = node.children[i];
  9698. markStatic$1(child);
  9699. if (!child.static) {
  9700. node.static = false;
  9701. }
  9702. }
  9703. if (node.ifConditions) {
  9704. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  9705. var block = node.ifConditions[i$1].block;
  9706. markStatic$1(block);
  9707. if (!block.static) {
  9708. node.static = false;
  9709. }
  9710. }
  9711. }
  9712. }
  9713. }
  9714. function markStaticRoots (node, isInFor) {
  9715. if (node.type === 1) {
  9716. if (node.static || node.once) {
  9717. node.staticInFor = isInFor;
  9718. }
  9719. // For a node to qualify as a static root, it should have children that
  9720. // are not just static text. Otherwise the cost of hoisting out will
  9721. // outweigh the benefits and it's better off to just always render it fresh.
  9722. if (node.static && node.children.length && !(
  9723. node.children.length === 1 &&
  9724. node.children[0].type === 3
  9725. )) {
  9726. node.staticRoot = true;
  9727. return
  9728. } else {
  9729. node.staticRoot = false;
  9730. }
  9731. if (node.children) {
  9732. for (var i = 0, l = node.children.length; i < l; i++) {
  9733. markStaticRoots(node.children[i], isInFor || !!node.for);
  9734. }
  9735. }
  9736. if (node.ifConditions) {
  9737. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  9738. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  9739. }
  9740. }
  9741. }
  9742. }
  9743. function isStatic (node) {
  9744. if (node.type === 2) { // expression
  9745. return false
  9746. }
  9747. if (node.type === 3) { // text
  9748. return true
  9749. }
  9750. return !!(node.pre || (
  9751. !node.hasBindings && // no dynamic bindings
  9752. !node.if && !node.for && // not v-if or v-for or v-else
  9753. !isBuiltInTag(node.tag) && // not a built-in
  9754. isPlatformReservedTag(node.tag) && // not a component
  9755. !isDirectChildOfTemplateFor(node) &&
  9756. Object.keys(node).every(isStaticKey)
  9757. ))
  9758. }
  9759. function isDirectChildOfTemplateFor (node) {
  9760. while (node.parent) {
  9761. node = node.parent;
  9762. if (node.tag !== 'template') {
  9763. return false
  9764. }
  9765. if (node.for) {
  9766. return true
  9767. }
  9768. }
  9769. return false
  9770. }
  9771. /* */
  9772. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  9773. var fnInvokeRE = /\([^)]*?\);*$/;
  9774. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  9775. // KeyboardEvent.keyCode aliases
  9776. var keyCodes = {
  9777. esc: 27,
  9778. tab: 9,
  9779. enter: 13,
  9780. space: 32,
  9781. up: 38,
  9782. left: 37,
  9783. right: 39,
  9784. down: 40,
  9785. 'delete': [8, 46]
  9786. };
  9787. // KeyboardEvent.key aliases
  9788. var keyNames = {
  9789. // #7880: IE11 and Edge use `Esc` for Escape key name.
  9790. esc: ['Esc', 'Escape'],
  9791. tab: 'Tab',
  9792. enter: 'Enter',
  9793. // #9112: IE11 uses `Spacebar` for Space key name.
  9794. space: [' ', 'Spacebar'],
  9795. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  9796. up: ['Up', 'ArrowUp'],
  9797. left: ['Left', 'ArrowLeft'],
  9798. right: ['Right', 'ArrowRight'],
  9799. down: ['Down', 'ArrowDown'],
  9800. // #9112: IE11 uses `Del` for Delete key name.
  9801. 'delete': ['Backspace', 'Delete', 'Del']
  9802. };
  9803. // #4868: modifiers that prevent the execution of the listener
  9804. // need to explicitly return null so that we can determine whether to remove
  9805. // the listener for .once
  9806. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  9807. var modifierCode = {
  9808. stop: '$event.stopPropagation();',
  9809. prevent: '$event.preventDefault();',
  9810. self: genGuard("$event.target !== $event.currentTarget"),
  9811. ctrl: genGuard("!$event.ctrlKey"),
  9812. shift: genGuard("!$event.shiftKey"),
  9813. alt: genGuard("!$event.altKey"),
  9814. meta: genGuard("!$event.metaKey"),
  9815. left: genGuard("'button' in $event && $event.button !== 0"),
  9816. middle: genGuard("'button' in $event && $event.button !== 1"),
  9817. right: genGuard("'button' in $event && $event.button !== 2")
  9818. };
  9819. function genHandlers (
  9820. events,
  9821. isNative
  9822. ) {
  9823. var prefix = isNative ? 'nativeOn:' : 'on:';
  9824. var staticHandlers = "";
  9825. var dynamicHandlers = "";
  9826. for (var name in events) {
  9827. var handlerCode = genHandler(events[name]);
  9828. if (events[name] && events[name].dynamic) {
  9829. dynamicHandlers += name + "," + handlerCode + ",";
  9830. } else {
  9831. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  9832. }
  9833. }
  9834. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  9835. if (dynamicHandlers) {
  9836. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  9837. } else {
  9838. return prefix + staticHandlers
  9839. }
  9840. }
  9841. function genHandler (handler) {
  9842. if (!handler) {
  9843. return 'function(){}'
  9844. }
  9845. if (Array.isArray(handler)) {
  9846. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  9847. }
  9848. var isMethodPath = simplePathRE.test(handler.value);
  9849. var isFunctionExpression = fnExpRE.test(handler.value);
  9850. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  9851. if (!handler.modifiers) {
  9852. if (isMethodPath || isFunctionExpression) {
  9853. return handler.value
  9854. }
  9855. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  9856. } else {
  9857. var code = '';
  9858. var genModifierCode = '';
  9859. var keys = [];
  9860. for (var key in handler.modifiers) {
  9861. if (modifierCode[key]) {
  9862. genModifierCode += modifierCode[key];
  9863. // left/right
  9864. if (keyCodes[key]) {
  9865. keys.push(key);
  9866. }
  9867. } else if (key === 'exact') {
  9868. var modifiers = (handler.modifiers);
  9869. genModifierCode += genGuard(
  9870. ['ctrl', 'shift', 'alt', 'meta']
  9871. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  9872. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  9873. .join('||')
  9874. );
  9875. } else {
  9876. keys.push(key);
  9877. }
  9878. }
  9879. if (keys.length) {
  9880. code += genKeyFilter(keys);
  9881. }
  9882. // Make sure modifiers like prevent and stop get executed after key filtering
  9883. if (genModifierCode) {
  9884. code += genModifierCode;
  9885. }
  9886. var handlerCode = isMethodPath
  9887. ? ("return " + (handler.value) + ".apply(null, arguments)")
  9888. : isFunctionExpression
  9889. ? ("return (" + (handler.value) + ").apply(null, arguments)")
  9890. : isFunctionInvocation
  9891. ? ("return " + (handler.value))
  9892. : handler.value;
  9893. return ("function($event){" + code + handlerCode + "}")
  9894. }
  9895. }
  9896. function genKeyFilter (keys) {
  9897. return (
  9898. // make sure the key filters only apply to KeyboardEvents
  9899. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  9900. // key events that do not have keyCode property...
  9901. "if(!$event.type.indexOf('key')&&" +
  9902. (keys.map(genFilterCode).join('&&')) + ")return null;"
  9903. )
  9904. }
  9905. function genFilterCode (key) {
  9906. var keyVal = parseInt(key, 10);
  9907. if (keyVal) {
  9908. return ("$event.keyCode!==" + keyVal)
  9909. }
  9910. var keyCode = keyCodes[key];
  9911. var keyName = keyNames[key];
  9912. return (
  9913. "_k($event.keyCode," +
  9914. (JSON.stringify(key)) + "," +
  9915. (JSON.stringify(keyCode)) + "," +
  9916. "$event.key," +
  9917. "" + (JSON.stringify(keyName)) +
  9918. ")"
  9919. )
  9920. }
  9921. /* */
  9922. function on (el, dir) {
  9923. if (process.env.NODE_ENV !== 'production' && dir.modifiers) {
  9924. warn("v-on without argument does not support modifiers.");
  9925. }
  9926. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  9927. }
  9928. /* */
  9929. function bind$1 (el, dir) {
  9930. el.wrapData = function (code) {
  9931. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  9932. };
  9933. }
  9934. /* */
  9935. var baseDirectives = {
  9936. on: on,
  9937. bind: bind$1,
  9938. cloak: noop
  9939. };
  9940. /* */
  9941. var CodegenState = function CodegenState (options) {
  9942. this.options = options;
  9943. this.warn = options.warn || baseWarn;
  9944. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  9945. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  9946. this.directives = extend(extend({}, baseDirectives), options.directives);
  9947. var isReservedTag = options.isReservedTag || no;
  9948. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  9949. this.onceId = 0;
  9950. this.staticRenderFns = [];
  9951. this.pre = false;
  9952. };
  9953. function generate (
  9954. ast,
  9955. options
  9956. ) {
  9957. var state = new CodegenState(options);
  9958. // fix #11483, Root level <script> tags should not be rendered.
  9959. var code = ast ? (ast.tag === 'script' ? 'null' : genElement(ast, state)) : '_c("div")';
  9960. return {
  9961. render: ("with(this){return " + code + "}"),
  9962. staticRenderFns: state.staticRenderFns
  9963. }
  9964. }
  9965. function genElement (el, state) {
  9966. if (el.parent) {
  9967. el.pre = el.pre || el.parent.pre;
  9968. }
  9969. if (el.staticRoot && !el.staticProcessed) {
  9970. return genStatic(el, state)
  9971. } else if (el.once && !el.onceProcessed) {
  9972. return genOnce(el, state)
  9973. } else if (el.for && !el.forProcessed) {
  9974. return genFor(el, state)
  9975. } else if (el.if && !el.ifProcessed) {
  9976. return genIf(el, state)
  9977. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  9978. return genChildren(el, state) || 'void 0'
  9979. } else if (el.tag === 'slot') {
  9980. return genSlot(el, state)
  9981. } else {
  9982. // component or element
  9983. var code;
  9984. if (el.component) {
  9985. code = genComponent(el.component, el, state);
  9986. } else {
  9987. var data;
  9988. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  9989. data = genData$2(el, state);
  9990. }
  9991. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  9992. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  9993. }
  9994. // module transforms
  9995. for (var i = 0; i < state.transforms.length; i++) {
  9996. code = state.transforms[i](el, code);
  9997. }
  9998. return code
  9999. }
  10000. }
  10001. // hoist static sub-trees out
  10002. function genStatic (el, state) {
  10003. el.staticProcessed = true;
  10004. // Some elements (templates) need to behave differently inside of a v-pre
  10005. // node. All pre nodes are static roots, so we can use this as a location to
  10006. // wrap a state change and reset it upon exiting the pre node.
  10007. var originalPreState = state.pre;
  10008. if (el.pre) {
  10009. state.pre = el.pre;
  10010. }
  10011. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  10012. state.pre = originalPreState;
  10013. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  10014. }
  10015. // v-once
  10016. function genOnce (el, state) {
  10017. el.onceProcessed = true;
  10018. if (el.if && !el.ifProcessed) {
  10019. return genIf(el, state)
  10020. } else if (el.staticInFor) {
  10021. var key = '';
  10022. var parent = el.parent;
  10023. while (parent) {
  10024. if (parent.for) {
  10025. key = parent.key;
  10026. break
  10027. }
  10028. parent = parent.parent;
  10029. }
  10030. if (!key) {
  10031. process.env.NODE_ENV !== 'production' && state.warn(
  10032. "v-once can only be used inside v-for that is keyed. ",
  10033. el.rawAttrsMap['v-once']
  10034. );
  10035. return genElement(el, state)
  10036. }
  10037. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  10038. } else {
  10039. return genStatic(el, state)
  10040. }
  10041. }
  10042. function genIf (
  10043. el,
  10044. state,
  10045. altGen,
  10046. altEmpty
  10047. ) {
  10048. el.ifProcessed = true; // avoid recursion
  10049. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  10050. }
  10051. function genIfConditions (
  10052. conditions,
  10053. state,
  10054. altGen,
  10055. altEmpty
  10056. ) {
  10057. if (!conditions.length) {
  10058. return altEmpty || '_e()'
  10059. }
  10060. var condition = conditions.shift();
  10061. if (condition.exp) {
  10062. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  10063. } else {
  10064. return ("" + (genTernaryExp(condition.block)))
  10065. }
  10066. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  10067. function genTernaryExp (el) {
  10068. return altGen
  10069. ? altGen(el, state)
  10070. : el.once
  10071. ? genOnce(el, state)
  10072. : genElement(el, state)
  10073. }
  10074. }
  10075. function genFor (
  10076. el,
  10077. state,
  10078. altGen,
  10079. altHelper
  10080. ) {
  10081. var exp = el.for;
  10082. var alias = el.alias;
  10083. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  10084. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  10085. if (process.env.NODE_ENV !== 'production' &&
  10086. state.maybeComponent(el) &&
  10087. el.tag !== 'slot' &&
  10088. el.tag !== 'template' &&
  10089. !el.key
  10090. ) {
  10091. state.warn(
  10092. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  10093. "v-for should have explicit keys. " +
  10094. "See https://vuejs.org/guide/list.html#key for more info.",
  10095. el.rawAttrsMap['v-for'],
  10096. true /* tip */
  10097. );
  10098. }
  10099. el.forProcessed = true; // avoid recursion
  10100. return (altHelper || '_l') + "((" + exp + ")," +
  10101. "function(" + alias + iterator1 + iterator2 + "){" +
  10102. "return " + ((altGen || genElement)(el, state)) +
  10103. '})'
  10104. }
  10105. function genData$2 (el, state) {
  10106. var data = '{';
  10107. // directives first.
  10108. // directives may mutate the el's other properties before they are generated.
  10109. var dirs = genDirectives(el, state);
  10110. if (dirs) { data += dirs + ','; }
  10111. // key
  10112. if (el.key) {
  10113. data += "key:" + (el.key) + ",";
  10114. }
  10115. // ref
  10116. if (el.ref) {
  10117. data += "ref:" + (el.ref) + ",";
  10118. }
  10119. if (el.refInFor) {
  10120. data += "refInFor:true,";
  10121. }
  10122. // pre
  10123. if (el.pre) {
  10124. data += "pre:true,";
  10125. }
  10126. // record original tag name for components using "is" attribute
  10127. if (el.component) {
  10128. data += "tag:\"" + (el.tag) + "\",";
  10129. }
  10130. // module data generation functions
  10131. for (var i = 0; i < state.dataGenFns.length; i++) {
  10132. data += state.dataGenFns[i](el);
  10133. }
  10134. // attributes
  10135. if (el.attrs) {
  10136. data += "attrs:" + (genProps(el.attrs)) + ",";
  10137. }
  10138. // DOM props
  10139. if (el.props) {
  10140. data += "domProps:" + (genProps(el.props)) + ",";
  10141. }
  10142. // event handlers
  10143. if (el.events) {
  10144. data += (genHandlers(el.events, false)) + ",";
  10145. }
  10146. if (el.nativeEvents) {
  10147. data += (genHandlers(el.nativeEvents, true)) + ",";
  10148. }
  10149. // slot target
  10150. // only for non-scoped slots
  10151. if (el.slotTarget && !el.slotScope) {
  10152. data += "slot:" + (el.slotTarget) + ",";
  10153. }
  10154. // scoped slots
  10155. if (el.scopedSlots) {
  10156. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  10157. }
  10158. // component v-model
  10159. if (el.model) {
  10160. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  10161. }
  10162. // inline-template
  10163. if (el.inlineTemplate) {
  10164. var inlineTemplate = genInlineTemplate(el, state);
  10165. if (inlineTemplate) {
  10166. data += inlineTemplate + ",";
  10167. }
  10168. }
  10169. data = data.replace(/,$/, '') + '}';
  10170. // v-bind dynamic argument wrap
  10171. // v-bind with dynamic arguments must be applied using the same v-bind object
  10172. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  10173. if (el.dynamicAttrs) {
  10174. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  10175. }
  10176. // v-bind data wrap
  10177. if (el.wrapData) {
  10178. data = el.wrapData(data);
  10179. }
  10180. // v-on data wrap
  10181. if (el.wrapListeners) {
  10182. data = el.wrapListeners(data);
  10183. }
  10184. return data
  10185. }
  10186. function genDirectives (el, state) {
  10187. var dirs = el.directives;
  10188. if (!dirs) { return }
  10189. var res = 'directives:[';
  10190. var hasRuntime = false;
  10191. var i, l, dir, needRuntime;
  10192. for (i = 0, l = dirs.length; i < l; i++) {
  10193. dir = dirs[i];
  10194. needRuntime = true;
  10195. var gen = state.directives[dir.name];
  10196. if (gen) {
  10197. // compile-time directive that manipulates AST.
  10198. // returns true if it also needs a runtime counterpart.
  10199. needRuntime = !!gen(el, dir, state.warn);
  10200. }
  10201. if (needRuntime) {
  10202. hasRuntime = true;
  10203. res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
  10204. }
  10205. }
  10206. if (hasRuntime) {
  10207. return res.slice(0, -1) + ']'
  10208. }
  10209. }
  10210. function genInlineTemplate (el, state) {
  10211. var ast = el.children[0];
  10212. if (process.env.NODE_ENV !== 'production' && (
  10213. el.children.length !== 1 || ast.type !== 1
  10214. )) {
  10215. state.warn(
  10216. 'Inline-template components must have exactly one child element.',
  10217. { start: el.start }
  10218. );
  10219. }
  10220. if (ast && ast.type === 1) {
  10221. var inlineRenderFns = generate(ast, state.options);
  10222. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  10223. }
  10224. }
  10225. function genScopedSlots (
  10226. el,
  10227. slots,
  10228. state
  10229. ) {
  10230. // by default scoped slots are considered "stable", this allows child
  10231. // components with only scoped slots to skip forced updates from parent.
  10232. // but in some cases we have to bail-out of this optimization
  10233. // for example if the slot contains dynamic names, has v-if or v-for on them...
  10234. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  10235. var slot = slots[key];
  10236. return (
  10237. slot.slotTargetDynamic ||
  10238. slot.if ||
  10239. slot.for ||
  10240. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  10241. )
  10242. });
  10243. // #9534: if a component with scoped slots is inside a conditional branch,
  10244. // it's possible for the same component to be reused but with different
  10245. // compiled slot content. To avoid that, we generate a unique key based on
  10246. // the generated code of all the slot contents.
  10247. var needsKey = !!el.if;
  10248. // OR when it is inside another scoped slot or v-for (the reactivity may be
  10249. // disconnected due to the intermediate scope variable)
  10250. // #9438, #9506
  10251. // TODO: this can be further optimized by properly analyzing in-scope bindings
  10252. // and skip force updating ones that do not actually use scope variables.
  10253. if (!needsForceUpdate) {
  10254. var parent = el.parent;
  10255. while (parent) {
  10256. if (
  10257. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  10258. parent.for
  10259. ) {
  10260. needsForceUpdate = true;
  10261. break
  10262. }
  10263. if (parent.if) {
  10264. needsKey = true;
  10265. }
  10266. parent = parent.parent;
  10267. }
  10268. }
  10269. var generatedSlots = Object.keys(slots)
  10270. .map(function (key) { return genScopedSlot(slots[key], state); })
  10271. .join(',');
  10272. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  10273. }
  10274. function hash(str) {
  10275. var hash = 5381;
  10276. var i = str.length;
  10277. while(i) {
  10278. hash = (hash * 33) ^ str.charCodeAt(--i);
  10279. }
  10280. return hash >>> 0
  10281. }
  10282. function containsSlotChild (el) {
  10283. if (el.type === 1) {
  10284. if (el.tag === 'slot') {
  10285. return true
  10286. }
  10287. return el.children.some(containsSlotChild)
  10288. }
  10289. return false
  10290. }
  10291. function genScopedSlot (
  10292. el,
  10293. state
  10294. ) {
  10295. var isLegacySyntax = el.attrsMap['slot-scope'];
  10296. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  10297. return genIf(el, state, genScopedSlot, "null")
  10298. }
  10299. if (el.for && !el.forProcessed) {
  10300. return genFor(el, state, genScopedSlot)
  10301. }
  10302. var slotScope = el.slotScope === emptySlotScopeToken
  10303. ? ""
  10304. : String(el.slotScope);
  10305. var fn = "function(" + slotScope + "){" +
  10306. "return " + (el.tag === 'template'
  10307. ? el.if && isLegacySyntax
  10308. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  10309. : genChildren(el, state) || 'undefined'
  10310. : genElement(el, state)) + "}";
  10311. // reverse proxy v-slot without scope on this.$slots
  10312. var reverseProxy = slotScope ? "" : ",proxy:true";
  10313. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  10314. }
  10315. function genChildren (
  10316. el,
  10317. state,
  10318. checkSkip,
  10319. altGenElement,
  10320. altGenNode
  10321. ) {
  10322. var children = el.children;
  10323. if (children.length) {
  10324. var el$1 = children[0];
  10325. // optimize single v-for
  10326. if (children.length === 1 &&
  10327. el$1.for &&
  10328. el$1.tag !== 'template' &&
  10329. el$1.tag !== 'slot'
  10330. ) {
  10331. var normalizationType = checkSkip
  10332. ? state.maybeComponent(el$1) ? ",1" : ",0"
  10333. : "";
  10334. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  10335. }
  10336. var normalizationType$1 = checkSkip
  10337. ? getNormalizationType(children, state.maybeComponent)
  10338. : 0;
  10339. var gen = altGenNode || genNode;
  10340. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  10341. }
  10342. }
  10343. // determine the normalization needed for the children array.
  10344. // 0: no normalization needed
  10345. // 1: simple normalization needed (possible 1-level deep nested array)
  10346. // 2: full normalization needed
  10347. function getNormalizationType (
  10348. children,
  10349. maybeComponent
  10350. ) {
  10351. var res = 0;
  10352. for (var i = 0; i < children.length; i++) {
  10353. var el = children[i];
  10354. if (el.type !== 1) {
  10355. continue
  10356. }
  10357. if (needsNormalization(el) ||
  10358. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  10359. res = 2;
  10360. break
  10361. }
  10362. if (maybeComponent(el) ||
  10363. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  10364. res = 1;
  10365. }
  10366. }
  10367. return res
  10368. }
  10369. function needsNormalization (el) {
  10370. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  10371. }
  10372. function genNode (node, state) {
  10373. if (node.type === 1) {
  10374. return genElement(node, state)
  10375. } else if (node.type === 3 && node.isComment) {
  10376. return genComment(node)
  10377. } else {
  10378. return genText(node)
  10379. }
  10380. }
  10381. function genText (text) {
  10382. return ("_v(" + (text.type === 2
  10383. ? text.expression // no need for () because already wrapped in _s()
  10384. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  10385. }
  10386. function genComment (comment) {
  10387. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  10388. }
  10389. function genSlot (el, state) {
  10390. var slotName = el.slotName || '"default"';
  10391. var children = genChildren(el, state);
  10392. var res = "_t(" + slotName + (children ? (",function(){return " + children + "}") : '');
  10393. var attrs = el.attrs || el.dynamicAttrs
  10394. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  10395. // slot props are camelized
  10396. name: camelize(attr.name),
  10397. value: attr.value,
  10398. dynamic: attr.dynamic
  10399. }); }))
  10400. : null;
  10401. var bind$$1 = el.attrsMap['v-bind'];
  10402. if ((attrs || bind$$1) && !children) {
  10403. res += ",null";
  10404. }
  10405. if (attrs) {
  10406. res += "," + attrs;
  10407. }
  10408. if (bind$$1) {
  10409. res += (attrs ? '' : ',null') + "," + bind$$1;
  10410. }
  10411. return res + ')'
  10412. }
  10413. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  10414. function genComponent (
  10415. componentName,
  10416. el,
  10417. state
  10418. ) {
  10419. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  10420. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  10421. }
  10422. function genProps (props) {
  10423. var staticProps = "";
  10424. var dynamicProps = "";
  10425. for (var i = 0; i < props.length; i++) {
  10426. var prop = props[i];
  10427. var value = transformSpecialNewlines(prop.value);
  10428. if (prop.dynamic) {
  10429. dynamicProps += (prop.name) + "," + value + ",";
  10430. } else {
  10431. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  10432. }
  10433. }
  10434. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  10435. if (dynamicProps) {
  10436. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  10437. } else {
  10438. return staticProps
  10439. }
  10440. }
  10441. // #3895, #4268
  10442. function transformSpecialNewlines (text) {
  10443. return text
  10444. .replace(/\u2028/g, '\\u2028')
  10445. .replace(/\u2029/g, '\\u2029')
  10446. }
  10447. /* */
  10448. // these keywords should not appear inside expressions, but operators like
  10449. // typeof, instanceof and in are allowed
  10450. var prohibitedKeywordRE = new RegExp('\\b' + (
  10451. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  10452. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  10453. 'extends,finally,continue,debugger,function,arguments'
  10454. ).split(',').join('\\b|\\b') + '\\b');
  10455. // these unary operators should not be used as property/method names
  10456. var unaryOperatorsRE = new RegExp('\\b' + (
  10457. 'delete,typeof,void'
  10458. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  10459. // strip strings in expressions
  10460. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  10461. // detect problematic expressions in a template
  10462. function detectErrors (ast, warn) {
  10463. if (ast) {
  10464. checkNode(ast, warn);
  10465. }
  10466. }
  10467. function checkNode (node, warn) {
  10468. if (node.type === 1) {
  10469. for (var name in node.attrsMap) {
  10470. if (dirRE.test(name)) {
  10471. var value = node.attrsMap[name];
  10472. if (value) {
  10473. var range = node.rawAttrsMap[name];
  10474. if (name === 'v-for') {
  10475. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  10476. } else if (name === 'v-slot' || name[0] === '#') {
  10477. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  10478. } else if (onRE.test(name)) {
  10479. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  10480. } else {
  10481. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  10482. }
  10483. }
  10484. }
  10485. }
  10486. if (node.children) {
  10487. for (var i = 0; i < node.children.length; i++) {
  10488. checkNode(node.children[i], warn);
  10489. }
  10490. }
  10491. } else if (node.type === 2) {
  10492. checkExpression(node.expression, node.text, warn, node);
  10493. }
  10494. }
  10495. function checkEvent (exp, text, warn, range) {
  10496. var stripped = exp.replace(stripStringRE, '');
  10497. var keywordMatch = stripped.match(unaryOperatorsRE);
  10498. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  10499. warn(
  10500. "avoid using JavaScript unary operator as property name: " +
  10501. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  10502. range
  10503. );
  10504. }
  10505. checkExpression(exp, text, warn, range);
  10506. }
  10507. function checkFor (node, text, warn, range) {
  10508. checkExpression(node.for || '', text, warn, range);
  10509. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  10510. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  10511. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  10512. }
  10513. function checkIdentifier (
  10514. ident,
  10515. type,
  10516. text,
  10517. warn,
  10518. range
  10519. ) {
  10520. if (typeof ident === 'string') {
  10521. try {
  10522. new Function(("var " + ident + "=_"));
  10523. } catch (e) {
  10524. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  10525. }
  10526. }
  10527. }
  10528. function checkExpression (exp, text, warn, range) {
  10529. try {
  10530. new Function(("return " + exp));
  10531. } catch (e) {
  10532. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  10533. if (keywordMatch) {
  10534. warn(
  10535. "avoid using JavaScript keyword as property name: " +
  10536. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  10537. range
  10538. );
  10539. } else {
  10540. warn(
  10541. "invalid expression: " + (e.message) + " in\n\n" +
  10542. " " + exp + "\n\n" +
  10543. " Raw expression: " + (text.trim()) + "\n",
  10544. range
  10545. );
  10546. }
  10547. }
  10548. }
  10549. function checkFunctionParameterExpression (exp, text, warn, range) {
  10550. try {
  10551. new Function(exp, '');
  10552. } catch (e) {
  10553. warn(
  10554. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  10555. " " + exp + "\n\n" +
  10556. " Raw expression: " + (text.trim()) + "\n",
  10557. range
  10558. );
  10559. }
  10560. }
  10561. /* */
  10562. var range = 2;
  10563. function generateCodeFrame (
  10564. source,
  10565. start,
  10566. end
  10567. ) {
  10568. if ( start === void 0 ) start = 0;
  10569. if ( end === void 0 ) end = source.length;
  10570. var lines = source.split(/\r?\n/);
  10571. var count = 0;
  10572. var res = [];
  10573. for (var i = 0; i < lines.length; i++) {
  10574. count += lines[i].length + 1;
  10575. if (count >= start) {
  10576. for (var j = i - range; j <= i + range || end > count; j++) {
  10577. if (j < 0 || j >= lines.length) { continue }
  10578. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  10579. var lineLength = lines[j].length;
  10580. if (j === i) {
  10581. // push underline
  10582. var pad = start - (count - lineLength) + 1;
  10583. var length = end > count ? lineLength - pad : end - start;
  10584. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  10585. } else if (j > i) {
  10586. if (end > count) {
  10587. var length$1 = Math.min(end - count, lineLength);
  10588. res.push(" | " + repeat$1("^", length$1));
  10589. }
  10590. count += lineLength + 1;
  10591. }
  10592. }
  10593. break
  10594. }
  10595. }
  10596. return res.join('\n')
  10597. }
  10598. function repeat$1 (str, n) {
  10599. var result = '';
  10600. if (n > 0) {
  10601. while (true) { // eslint-disable-line
  10602. if (n & 1) { result += str; }
  10603. n >>>= 1;
  10604. if (n <= 0) { break }
  10605. str += str;
  10606. }
  10607. }
  10608. return result
  10609. }
  10610. /* */
  10611. function createFunction (code, errors) {
  10612. try {
  10613. return new Function(code)
  10614. } catch (err) {
  10615. errors.push({ err: err, code: code });
  10616. return noop
  10617. }
  10618. }
  10619. function createCompileToFunctionFn (compile) {
  10620. var cache = Object.create(null);
  10621. return function compileToFunctions (
  10622. template,
  10623. options,
  10624. vm
  10625. ) {
  10626. options = extend({}, options);
  10627. var warn$$1 = options.warn || warn;
  10628. delete options.warn;
  10629. /* istanbul ignore if */
  10630. if (process.env.NODE_ENV !== 'production') {
  10631. // detect possible CSP restriction
  10632. try {
  10633. new Function('return 1');
  10634. } catch (e) {
  10635. if (e.toString().match(/unsafe-eval|CSP/)) {
  10636. warn$$1(
  10637. 'It seems you are using the standalone build of Vue.js in an ' +
  10638. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  10639. 'The template compiler cannot work in this environment. Consider ' +
  10640. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  10641. 'templates into render functions.'
  10642. );
  10643. }
  10644. }
  10645. }
  10646. // check cache
  10647. var key = options.delimiters
  10648. ? String(options.delimiters) + template
  10649. : template;
  10650. if (cache[key]) {
  10651. return cache[key]
  10652. }
  10653. // compile
  10654. var compiled = compile(template, options);
  10655. // check compilation errors/tips
  10656. if (process.env.NODE_ENV !== 'production') {
  10657. if (compiled.errors && compiled.errors.length) {
  10658. if (options.outputSourceRange) {
  10659. compiled.errors.forEach(function (e) {
  10660. warn$$1(
  10661. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  10662. generateCodeFrame(template, e.start, e.end),
  10663. vm
  10664. );
  10665. });
  10666. } else {
  10667. warn$$1(
  10668. "Error compiling template:\n\n" + template + "\n\n" +
  10669. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  10670. vm
  10671. );
  10672. }
  10673. }
  10674. if (compiled.tips && compiled.tips.length) {
  10675. if (options.outputSourceRange) {
  10676. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  10677. } else {
  10678. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  10679. }
  10680. }
  10681. }
  10682. // turn code into functions
  10683. var res = {};
  10684. var fnGenErrors = [];
  10685. res.render = createFunction(compiled.render, fnGenErrors);
  10686. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  10687. return createFunction(code, fnGenErrors)
  10688. });
  10689. // check function generation errors.
  10690. // this should only happen if there is a bug in the compiler itself.
  10691. // mostly for codegen development use
  10692. /* istanbul ignore if */
  10693. if (process.env.NODE_ENV !== 'production') {
  10694. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  10695. warn$$1(
  10696. "Failed to generate render function:\n\n" +
  10697. fnGenErrors.map(function (ref) {
  10698. var err = ref.err;
  10699. var code = ref.code;
  10700. return ((err.toString()) + " in\n\n" + code + "\n");
  10701. }).join('\n'),
  10702. vm
  10703. );
  10704. }
  10705. }
  10706. return (cache[key] = res)
  10707. }
  10708. }
  10709. /* */
  10710. function createCompilerCreator (baseCompile) {
  10711. return function createCompiler (baseOptions) {
  10712. function compile (
  10713. template,
  10714. options
  10715. ) {
  10716. var finalOptions = Object.create(baseOptions);
  10717. var errors = [];
  10718. var tips = [];
  10719. var warn = function (msg, range, tip) {
  10720. (tip ? tips : errors).push(msg);
  10721. };
  10722. if (options) {
  10723. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  10724. // $flow-disable-line
  10725. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  10726. warn = function (msg, range, tip) {
  10727. var data = { msg: msg };
  10728. if (range) {
  10729. if (range.start != null) {
  10730. data.start = range.start + leadingSpaceLength;
  10731. }
  10732. if (range.end != null) {
  10733. data.end = range.end + leadingSpaceLength;
  10734. }
  10735. }
  10736. (tip ? tips : errors).push(data);
  10737. };
  10738. }
  10739. // merge custom modules
  10740. if (options.modules) {
  10741. finalOptions.modules =
  10742. (baseOptions.modules || []).concat(options.modules);
  10743. }
  10744. // merge custom directives
  10745. if (options.directives) {
  10746. finalOptions.directives = extend(
  10747. Object.create(baseOptions.directives || null),
  10748. options.directives
  10749. );
  10750. }
  10751. // copy other options
  10752. for (var key in options) {
  10753. if (key !== 'modules' && key !== 'directives') {
  10754. finalOptions[key] = options[key];
  10755. }
  10756. }
  10757. }
  10758. finalOptions.warn = warn;
  10759. var compiled = baseCompile(template.trim(), finalOptions);
  10760. if (process.env.NODE_ENV !== 'production') {
  10761. detectErrors(compiled.ast, warn);
  10762. }
  10763. compiled.errors = errors;
  10764. compiled.tips = tips;
  10765. return compiled
  10766. }
  10767. return {
  10768. compile: compile,
  10769. compileToFunctions: createCompileToFunctionFn(compile)
  10770. }
  10771. }
  10772. }
  10773. /* */
  10774. // `createCompilerCreator` allows creating compilers that use alternative
  10775. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  10776. // Here we just export a default compiler using the default parts.
  10777. var createCompiler = createCompilerCreator(function baseCompile (
  10778. template,
  10779. options
  10780. ) {
  10781. var ast = parse(template.trim(), options);
  10782. if (options.optimize !== false) {
  10783. optimize(ast, options);
  10784. }
  10785. var code = generate(ast, options);
  10786. return {
  10787. ast: ast,
  10788. render: code.render,
  10789. staticRenderFns: code.staticRenderFns
  10790. }
  10791. });
  10792. /* */
  10793. var ref$1 = createCompiler(baseOptions);
  10794. var compile = ref$1.compile;
  10795. var compileToFunctions = ref$1.compileToFunctions;
  10796. /* */
  10797. // check whether current browser encodes a char inside attribute values
  10798. var div;
  10799. function getShouldDecode (href) {
  10800. div = div || document.createElement('div');
  10801. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  10802. return div.innerHTML.indexOf('&#10;') > 0
  10803. }
  10804. // #3663: IE encodes newlines inside attribute values while other browsers don't
  10805. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  10806. // #6828: chrome encodes content in a[href]
  10807. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  10808. /* */
  10809. var idToTemplate = cached(function (id) {
  10810. var el = query(id);
  10811. return el && el.innerHTML
  10812. });
  10813. var mount = Vue.prototype.$mount;
  10814. Vue.prototype.$mount = function (
  10815. el,
  10816. hydrating
  10817. ) {
  10818. el = el && query(el);
  10819. /* istanbul ignore if */
  10820. if (el === document.body || el === document.documentElement) {
  10821. process.env.NODE_ENV !== 'production' && warn(
  10822. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  10823. );
  10824. return this
  10825. }
  10826. var options = this.$options;
  10827. // resolve template/el and convert to render function
  10828. if (!options.render) {
  10829. var template = options.template;
  10830. if (template) {
  10831. if (typeof template === 'string') {
  10832. if (template.charAt(0) === '#') {
  10833. template = idToTemplate(template);
  10834. /* istanbul ignore if */
  10835. if (process.env.NODE_ENV !== 'production' && !template) {
  10836. warn(
  10837. ("Template element not found or is empty: " + (options.template)),
  10838. this
  10839. );
  10840. }
  10841. }
  10842. } else if (template.nodeType) {
  10843. template = template.innerHTML;
  10844. } else {
  10845. if (process.env.NODE_ENV !== 'production') {
  10846. warn('invalid template option:' + template, this);
  10847. }
  10848. return this
  10849. }
  10850. } else if (el) {
  10851. template = getOuterHTML(el);
  10852. }
  10853. if (template) {
  10854. /* istanbul ignore if */
  10855. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  10856. mark('compile');
  10857. }
  10858. var ref = compileToFunctions(template, {
  10859. outputSourceRange: process.env.NODE_ENV !== 'production',
  10860. shouldDecodeNewlines: shouldDecodeNewlines,
  10861. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  10862. delimiters: options.delimiters,
  10863. comments: options.comments
  10864. }, this);
  10865. var render = ref.render;
  10866. var staticRenderFns = ref.staticRenderFns;
  10867. options.render = render;
  10868. options.staticRenderFns = staticRenderFns;
  10869. /* istanbul ignore if */
  10870. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  10871. mark('compile end');
  10872. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  10873. }
  10874. }
  10875. }
  10876. return mount.call(this, el, hydrating)
  10877. };
  10878. /**
  10879. * Get outerHTML of elements, taking care
  10880. * of SVG elements in IE as well.
  10881. */
  10882. function getOuterHTML (el) {
  10883. if (el.outerHTML) {
  10884. return el.outerHTML
  10885. } else {
  10886. var container = document.createElement('div');
  10887. container.appendChild(el.cloneNode(true));
  10888. return container.innerHTML
  10889. }
  10890. }
  10891. Vue.compile = compileToFunctions;
  10892. export default Vue;