vue.runtime.js 233 KB

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