vue.runtime.common.dev.js 218 KB

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