vue.runtime.common.dev.js 218 KB

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