vue.runtime.esm.js 221 KB

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