vue.common.dev.js 284 KB

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