vue.runtime.esm.js 222 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445
  1. /*!
  2. * Vue.js v2.6.10
  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 hasNormalSlots = Object.keys(normalSlots).length > 0;
  2307. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  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. var timerLoading = null;
  3300. var timerTimeout = null
  3301. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  3302. var forceRender = function (renderCompleted) {
  3303. for (var i = 0, l = owners.length; i < l; i++) {
  3304. (owners[i]).$forceUpdate();
  3305. }
  3306. if (renderCompleted) {
  3307. owners.length = 0;
  3308. if (timerLoading !== null) {
  3309. clearTimeout(timerLoading);
  3310. timerLoading = null;
  3311. }
  3312. if (timerTimeout !== null) {
  3313. clearTimeout(timerTimeout);
  3314. timerTimeout = null;
  3315. }
  3316. }
  3317. };
  3318. var resolve = once(function (res) {
  3319. // cache resolved
  3320. factory.resolved = ensureCtor(res, baseCtor);
  3321. // invoke callbacks only if this is not a synchronous resolve
  3322. // (async resolves are shimmed as synchronous during SSR)
  3323. if (!sync) {
  3324. forceRender(true);
  3325. } else {
  3326. owners.length = 0;
  3327. }
  3328. });
  3329. var reject = once(function (reason) {
  3330. process.env.NODE_ENV !== 'production' && warn(
  3331. "Failed to resolve async component: " + (String(factory)) +
  3332. (reason ? ("\nReason: " + reason) : '')
  3333. );
  3334. if (isDef(factory.errorComp)) {
  3335. factory.error = true;
  3336. forceRender(true);
  3337. }
  3338. });
  3339. var res = factory(resolve, reject);
  3340. if (isObject(res)) {
  3341. if (isPromise(res)) {
  3342. // () => Promise
  3343. if (isUndef(factory.resolved)) {
  3344. res.then(resolve, reject);
  3345. }
  3346. } else if (isPromise(res.component)) {
  3347. res.component.then(resolve, reject);
  3348. if (isDef(res.error)) {
  3349. factory.errorComp = ensureCtor(res.error, baseCtor);
  3350. }
  3351. if (isDef(res.loading)) {
  3352. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  3353. if (res.delay === 0) {
  3354. factory.loading = true;
  3355. } else {
  3356. timerLoading = setTimeout(function () {
  3357. timerLoading = null;
  3358. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  3359. factory.loading = true;
  3360. forceRender(false);
  3361. }
  3362. }, res.delay || 200);
  3363. }
  3364. }
  3365. if (isDef(res.timeout)) {
  3366. timerTimeout = setTimeout(function () {
  3367. timerTimeout = null;
  3368. if (isUndef(factory.resolved)) {
  3369. reject(
  3370. process.env.NODE_ENV !== 'production'
  3371. ? ("timeout (" + (res.timeout) + "ms)")
  3372. : null
  3373. );
  3374. }
  3375. }, res.timeout);
  3376. }
  3377. }
  3378. }
  3379. sync = false;
  3380. // return in case resolved synchronously
  3381. return factory.loading
  3382. ? factory.loadingComp
  3383. : factory.resolved
  3384. }
  3385. }
  3386. /* */
  3387. function isAsyncPlaceholder (node) {
  3388. return node.isComment && node.asyncFactory
  3389. }
  3390. /* */
  3391. function getFirstComponentChild (children) {
  3392. if (Array.isArray(children)) {
  3393. for (var i = 0; i < children.length; i++) {
  3394. var c = children[i];
  3395. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  3396. return c
  3397. }
  3398. }
  3399. }
  3400. }
  3401. /* */
  3402. /* */
  3403. function initEvents (vm) {
  3404. vm._events = Object.create(null);
  3405. vm._hasHookEvent = false;
  3406. // init parent attached events
  3407. var listeners = vm.$options._parentListeners;
  3408. if (listeners) {
  3409. updateComponentListeners(vm, listeners);
  3410. }
  3411. }
  3412. var target;
  3413. function add (event, fn) {
  3414. target.$on(event, fn);
  3415. }
  3416. function remove$1 (event, fn) {
  3417. target.$off(event, fn);
  3418. }
  3419. function createOnceHandler (event, fn) {
  3420. var _target = target;
  3421. return function onceHandler () {
  3422. var res = fn.apply(null, arguments);
  3423. if (res !== null) {
  3424. _target.$off(event, onceHandler);
  3425. }
  3426. }
  3427. }
  3428. function updateComponentListeners (
  3429. vm,
  3430. listeners,
  3431. oldListeners
  3432. ) {
  3433. target = vm;
  3434. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  3435. target = undefined;
  3436. }
  3437. function eventsMixin (Vue) {
  3438. var hookRE = /^hook:/;
  3439. Vue.prototype.$on = function (event, fn) {
  3440. var vm = this;
  3441. if (Array.isArray(event)) {
  3442. for (var i = 0, l = event.length; i < l; i++) {
  3443. vm.$on(event[i], fn);
  3444. }
  3445. } else {
  3446. (vm._events[event] || (vm._events[event] = [])).push(fn);
  3447. // optimize hook:event cost by using a boolean flag marked at registration
  3448. // instead of a hash lookup
  3449. if (hookRE.test(event)) {
  3450. vm._hasHookEvent = true;
  3451. }
  3452. }
  3453. return vm
  3454. };
  3455. Vue.prototype.$once = function (event, fn) {
  3456. var vm = this;
  3457. function on () {
  3458. vm.$off(event, on);
  3459. fn.apply(vm, arguments);
  3460. }
  3461. on.fn = fn;
  3462. vm.$on(event, on);
  3463. return vm
  3464. };
  3465. Vue.prototype.$off = function (event, fn) {
  3466. var vm = this;
  3467. // all
  3468. if (!arguments.length) {
  3469. vm._events = Object.create(null);
  3470. return vm
  3471. }
  3472. // array of events
  3473. if (Array.isArray(event)) {
  3474. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  3475. vm.$off(event[i$1], fn);
  3476. }
  3477. return vm
  3478. }
  3479. // specific event
  3480. var cbs = vm._events[event];
  3481. if (!cbs) {
  3482. return vm
  3483. }
  3484. if (!fn) {
  3485. vm._events[event] = null;
  3486. return vm
  3487. }
  3488. // specific handler
  3489. var cb;
  3490. var i = cbs.length;
  3491. while (i--) {
  3492. cb = cbs[i];
  3493. if (cb === fn || cb.fn === fn) {
  3494. cbs.splice(i, 1);
  3495. break
  3496. }
  3497. }
  3498. return vm
  3499. };
  3500. Vue.prototype.$emit = function (event) {
  3501. var vm = this;
  3502. if (process.env.NODE_ENV !== 'production') {
  3503. var lowerCaseEvent = event.toLowerCase();
  3504. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  3505. tip(
  3506. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  3507. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  3508. "Note that HTML attributes are case-insensitive and you cannot use " +
  3509. "v-on to listen to camelCase events when using in-DOM templates. " +
  3510. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  3511. );
  3512. }
  3513. }
  3514. var cbs = vm._events[event];
  3515. if (cbs) {
  3516. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  3517. var args = toArray(arguments, 1);
  3518. var info = "event handler for \"" + event + "\"";
  3519. for (var i = 0, l = cbs.length; i < l; i++) {
  3520. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  3521. }
  3522. }
  3523. return vm
  3524. };
  3525. }
  3526. /* */
  3527. var activeInstance = null;
  3528. var isUpdatingChildComponent = false;
  3529. function setActiveInstance(vm) {
  3530. var prevActiveInstance = activeInstance;
  3531. activeInstance = vm;
  3532. return function () {
  3533. activeInstance = prevActiveInstance;
  3534. }
  3535. }
  3536. function initLifecycle (vm) {
  3537. var options = vm.$options;
  3538. // locate first non-abstract parent
  3539. var parent = options.parent;
  3540. if (parent && !options.abstract) {
  3541. while (parent.$options.abstract && parent.$parent) {
  3542. parent = parent.$parent;
  3543. }
  3544. parent.$children.push(vm);
  3545. }
  3546. vm.$parent = parent;
  3547. vm.$root = parent ? parent.$root : vm;
  3548. vm.$children = [];
  3549. vm.$refs = {};
  3550. vm._watcher = null;
  3551. vm._inactive = null;
  3552. vm._directInactive = false;
  3553. vm._isMounted = false;
  3554. vm._isDestroyed = false;
  3555. vm._isBeingDestroyed = false;
  3556. }
  3557. function lifecycleMixin (Vue) {
  3558. Vue.prototype._update = function (vnode, hydrating) {
  3559. var vm = this;
  3560. var prevEl = vm.$el;
  3561. var prevVnode = vm._vnode;
  3562. var restoreActiveInstance = setActiveInstance(vm);
  3563. vm._vnode = vnode;
  3564. // Vue.prototype.__patch__ is injected in entry points
  3565. // based on the rendering backend used.
  3566. if (!prevVnode) {
  3567. // initial render
  3568. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  3569. } else {
  3570. // updates
  3571. vm.$el = vm.__patch__(prevVnode, vnode);
  3572. }
  3573. restoreActiveInstance();
  3574. // update __vue__ reference
  3575. if (prevEl) {
  3576. prevEl.__vue__ = null;
  3577. }
  3578. if (vm.$el) {
  3579. vm.$el.__vue__ = vm;
  3580. }
  3581. // if parent is an HOC, update its $el as well
  3582. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  3583. vm.$parent.$el = vm.$el;
  3584. }
  3585. // updated hook is called by the scheduler to ensure that children are
  3586. // updated in a parent's updated hook.
  3587. };
  3588. Vue.prototype.$forceUpdate = function () {
  3589. var vm = this;
  3590. if (vm._watcher) {
  3591. vm._watcher.update();
  3592. }
  3593. };
  3594. Vue.prototype.$destroy = function () {
  3595. var vm = this;
  3596. if (vm._isBeingDestroyed) {
  3597. return
  3598. }
  3599. callHook(vm, 'beforeDestroy');
  3600. vm._isBeingDestroyed = true;
  3601. // remove self from parent
  3602. var parent = vm.$parent;
  3603. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  3604. remove(parent.$children, vm);
  3605. }
  3606. // teardown watchers
  3607. if (vm._watcher) {
  3608. vm._watcher.teardown();
  3609. }
  3610. var i = vm._watchers.length;
  3611. while (i--) {
  3612. vm._watchers[i].teardown();
  3613. }
  3614. // remove reference from data ob
  3615. // frozen object may not have observer.
  3616. if (vm._data.__ob__) {
  3617. vm._data.__ob__.vmCount--;
  3618. }
  3619. // call the last hook...
  3620. vm._isDestroyed = true;
  3621. // invoke destroy hooks on current rendered tree
  3622. vm.__patch__(vm._vnode, null);
  3623. // fire destroyed hook
  3624. callHook(vm, 'destroyed');
  3625. // turn off all instance listeners.
  3626. vm.$off();
  3627. // remove __vue__ reference
  3628. if (vm.$el) {
  3629. vm.$el.__vue__ = null;
  3630. }
  3631. // release circular reference (#6759)
  3632. if (vm.$vnode) {
  3633. vm.$vnode.parent = null;
  3634. }
  3635. };
  3636. }
  3637. function mountComponent (
  3638. vm,
  3639. el,
  3640. hydrating
  3641. ) {
  3642. vm.$el = el;
  3643. if (!vm.$options.render) {
  3644. vm.$options.render = createEmptyVNode;
  3645. if (process.env.NODE_ENV !== 'production') {
  3646. /* istanbul ignore if */
  3647. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  3648. vm.$options.el || el) {
  3649. warn(
  3650. 'You are using the runtime-only build of Vue where the template ' +
  3651. 'compiler is not available. Either pre-compile the templates into ' +
  3652. 'render functions, or use the compiler-included build.',
  3653. vm
  3654. );
  3655. } else {
  3656. warn(
  3657. 'Failed to mount component: template or render function not defined.',
  3658. vm
  3659. );
  3660. }
  3661. }
  3662. }
  3663. callHook(vm, 'beforeMount');
  3664. var updateComponent;
  3665. /* istanbul ignore if */
  3666. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  3667. updateComponent = function () {
  3668. var name = vm._name;
  3669. var id = vm._uid;
  3670. var startTag = "vue-perf-start:" + id;
  3671. var endTag = "vue-perf-end:" + id;
  3672. mark(startTag);
  3673. var vnode = vm._render();
  3674. mark(endTag);
  3675. measure(("vue " + name + " render"), startTag, endTag);
  3676. mark(startTag);
  3677. vm._update(vnode, hydrating);
  3678. mark(endTag);
  3679. measure(("vue " + name + " patch"), startTag, endTag);
  3680. };
  3681. } else {
  3682. updateComponent = function () {
  3683. vm._update(vm._render(), hydrating);
  3684. };
  3685. }
  3686. // we set this to vm._watcher inside the watcher's constructor
  3687. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  3688. // component's mounted hook), which relies on vm._watcher being already defined
  3689. new Watcher(vm, updateComponent, noop, {
  3690. before: function before () {
  3691. if (vm._isMounted && !vm._isDestroyed) {
  3692. callHook(vm, 'beforeUpdate');
  3693. }
  3694. }
  3695. }, true /* isRenderWatcher */);
  3696. hydrating = false;
  3697. // manually mounted instance, call mounted on self
  3698. // mounted is called for render-created child components in its inserted hook
  3699. if (vm.$vnode == null) {
  3700. vm._isMounted = true;
  3701. callHook(vm, 'mounted');
  3702. }
  3703. return vm
  3704. }
  3705. function updateChildComponent (
  3706. vm,
  3707. propsData,
  3708. listeners,
  3709. parentVnode,
  3710. renderChildren
  3711. ) {
  3712. if (process.env.NODE_ENV !== 'production') {
  3713. isUpdatingChildComponent = true;
  3714. }
  3715. // determine whether component has slot children
  3716. // we need to do this before overwriting $options._renderChildren.
  3717. // check if there are dynamic scopedSlots (hand-written or compiled but with
  3718. // dynamic slot names). Static scoped slots compiled from template has the
  3719. // "$stable" marker.
  3720. var newScopedSlots = parentVnode.data.scopedSlots;
  3721. var oldScopedSlots = vm.$scopedSlots;
  3722. var hasDynamicScopedSlot = !!(
  3723. (newScopedSlots && !newScopedSlots.$stable) ||
  3724. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  3725. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  3726. );
  3727. // Any static slot children from the parent may have changed during parent's
  3728. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  3729. // update is necessary to ensure correctness.
  3730. var needsForceUpdate = !!(
  3731. renderChildren || // has new static slots
  3732. vm.$options._renderChildren || // has old static slots
  3733. hasDynamicScopedSlot
  3734. );
  3735. vm.$options._parentVnode = parentVnode;
  3736. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  3737. if (vm._vnode) { // update child tree's parent
  3738. vm._vnode.parent = parentVnode;
  3739. }
  3740. vm.$options._renderChildren = renderChildren;
  3741. // update $attrs and $listeners hash
  3742. // these are also reactive so they may trigger child update if the child
  3743. // used them during render
  3744. vm.$attrs = parentVnode.data.attrs || emptyObject;
  3745. vm.$listeners = listeners || emptyObject;
  3746. // update props
  3747. if (propsData && vm.$options.props) {
  3748. toggleObserving(false);
  3749. var props = vm._props;
  3750. var propKeys = vm.$options._propKeys || [];
  3751. for (var i = 0; i < propKeys.length; i++) {
  3752. var key = propKeys[i];
  3753. var propOptions = vm.$options.props; // wtf flow?
  3754. props[key] = validateProp(key, propOptions, propsData, vm);
  3755. }
  3756. toggleObserving(true);
  3757. // keep a copy of raw propsData
  3758. vm.$options.propsData = propsData;
  3759. }
  3760. // update listeners
  3761. listeners = listeners || emptyObject;
  3762. var oldListeners = vm.$options._parentListeners;
  3763. vm.$options._parentListeners = listeners;
  3764. updateComponentListeners(vm, listeners, oldListeners);
  3765. // resolve slots + force update if has children
  3766. if (needsForceUpdate) {
  3767. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  3768. vm.$forceUpdate();
  3769. }
  3770. if (process.env.NODE_ENV !== 'production') {
  3771. isUpdatingChildComponent = false;
  3772. }
  3773. }
  3774. function isInInactiveTree (vm) {
  3775. while (vm && (vm = vm.$parent)) {
  3776. if (vm._inactive) { return true }
  3777. }
  3778. return false
  3779. }
  3780. function activateChildComponent (vm, direct) {
  3781. if (direct) {
  3782. vm._directInactive = false;
  3783. if (isInInactiveTree(vm)) {
  3784. return
  3785. }
  3786. } else if (vm._directInactive) {
  3787. return
  3788. }
  3789. if (vm._inactive || vm._inactive === null) {
  3790. vm._inactive = false;
  3791. for (var i = 0; i < vm.$children.length; i++) {
  3792. activateChildComponent(vm.$children[i]);
  3793. }
  3794. callHook(vm, 'activated');
  3795. }
  3796. }
  3797. function deactivateChildComponent (vm, direct) {
  3798. if (direct) {
  3799. vm._directInactive = true;
  3800. if (isInInactiveTree(vm)) {
  3801. return
  3802. }
  3803. }
  3804. if (!vm._inactive) {
  3805. vm._inactive = true;
  3806. for (var i = 0; i < vm.$children.length; i++) {
  3807. deactivateChildComponent(vm.$children[i]);
  3808. }
  3809. callHook(vm, 'deactivated');
  3810. }
  3811. }
  3812. function callHook (vm, hook) {
  3813. // #7573 disable dep collection when invoking lifecycle hooks
  3814. pushTarget();
  3815. var handlers = vm.$options[hook];
  3816. var info = hook + " hook";
  3817. if (handlers) {
  3818. for (var i = 0, j = handlers.length; i < j; i++) {
  3819. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  3820. }
  3821. }
  3822. if (vm._hasHookEvent) {
  3823. vm.$emit('hook:' + hook);
  3824. }
  3825. popTarget();
  3826. }
  3827. /* */
  3828. var MAX_UPDATE_COUNT = 100;
  3829. var queue = [];
  3830. var activatedChildren = [];
  3831. var has = {};
  3832. var circular = {};
  3833. var waiting = false;
  3834. var flushing = false;
  3835. var index = 0;
  3836. /**
  3837. * Reset the scheduler's state.
  3838. */
  3839. function resetSchedulerState () {
  3840. index = queue.length = activatedChildren.length = 0;
  3841. has = {};
  3842. if (process.env.NODE_ENV !== 'production') {
  3843. circular = {};
  3844. }
  3845. waiting = flushing = false;
  3846. }
  3847. // Async edge case #6566 requires saving the timestamp when event listeners are
  3848. // attached. However, calling performance.now() has a perf overhead especially
  3849. // if the page has thousands of event listeners. Instead, we take a timestamp
  3850. // every time the scheduler flushes and use that for all event listeners
  3851. // attached during that flush.
  3852. var currentFlushTimestamp = 0;
  3853. // Async edge case fix requires storing an event listener's attach timestamp.
  3854. var getNow = Date.now;
  3855. // Determine what event timestamp the browser is using. Annoyingly, the
  3856. // timestamp can either be hi-res (relative to page load) or low-res
  3857. // (relative to UNIX epoch), so in order to compare time we have to use the
  3858. // same timestamp type when saving the flush timestamp.
  3859. // All IE versions use low-res event timestamps, and have problematic clock
  3860. // implementations (#9632)
  3861. if (inBrowser && !isIE) {
  3862. var performance = window.performance;
  3863. if (
  3864. performance &&
  3865. typeof performance.now === 'function' &&
  3866. getNow() > document.createEvent('Event').timeStamp
  3867. ) {
  3868. // if the event timestamp, although evaluated AFTER the Date.now(), is
  3869. // smaller than it, it means the event is using a hi-res timestamp,
  3870. // and we need to use the hi-res version for event listener timestamps as
  3871. // well.
  3872. getNow = function () { return performance.now(); };
  3873. }
  3874. }
  3875. /**
  3876. * Flush both queues and run the watchers.
  3877. */
  3878. function flushSchedulerQueue () {
  3879. currentFlushTimestamp = getNow();
  3880. flushing = true;
  3881. var watcher, id;
  3882. // Sort queue before flush.
  3883. // This ensures that:
  3884. // 1. Components are updated from parent to child. (because parent is always
  3885. // created before the child)
  3886. // 2. A component's user watchers are run before its render watcher (because
  3887. // user watchers are created before the render watcher)
  3888. // 3. If a component is destroyed during a parent component's watcher run,
  3889. // its watchers can be skipped.
  3890. queue.sort(function (a, b) { return a.id - b.id; });
  3891. // do not cache length because more watchers might be pushed
  3892. // as we run existing watchers
  3893. for (index = 0; index < queue.length; index++) {
  3894. watcher = queue[index];
  3895. if (watcher.before) {
  3896. watcher.before();
  3897. }
  3898. id = watcher.id;
  3899. has[id] = null;
  3900. watcher.run();
  3901. // in dev build, check and stop circular updates.
  3902. if (process.env.NODE_ENV !== 'production' && has[id] != null) {
  3903. circular[id] = (circular[id] || 0) + 1;
  3904. if (circular[id] > MAX_UPDATE_COUNT) {
  3905. warn(
  3906. 'You may have an infinite update loop ' + (
  3907. watcher.user
  3908. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  3909. : "in a component render function."
  3910. ),
  3911. watcher.vm
  3912. );
  3913. break
  3914. }
  3915. }
  3916. }
  3917. // keep copies of post queues before resetting state
  3918. var activatedQueue = activatedChildren.slice();
  3919. var updatedQueue = queue.slice();
  3920. resetSchedulerState();
  3921. // call component updated and activated hooks
  3922. callActivatedHooks(activatedQueue);
  3923. callUpdatedHooks(updatedQueue);
  3924. // devtool hook
  3925. /* istanbul ignore if */
  3926. if (devtools && config.devtools) {
  3927. devtools.emit('flush');
  3928. }
  3929. }
  3930. function callUpdatedHooks (queue) {
  3931. var i = queue.length;
  3932. while (i--) {
  3933. var watcher = queue[i];
  3934. var vm = watcher.vm;
  3935. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  3936. callHook(vm, 'updated');
  3937. }
  3938. }
  3939. }
  3940. /**
  3941. * Queue a kept-alive component that was activated during patch.
  3942. * The queue will be processed after the entire tree has been patched.
  3943. */
  3944. function queueActivatedComponent (vm) {
  3945. // setting _inactive to false here so that a render function can
  3946. // rely on checking whether it's in an inactive tree (e.g. router-view)
  3947. vm._inactive = false;
  3948. activatedChildren.push(vm);
  3949. }
  3950. function callActivatedHooks (queue) {
  3951. for (var i = 0; i < queue.length; i++) {
  3952. queue[i]._inactive = true;
  3953. activateChildComponent(queue[i], true /* true */);
  3954. }
  3955. }
  3956. /**
  3957. * Push a watcher into the watcher queue.
  3958. * Jobs with duplicate IDs will be skipped unless it's
  3959. * pushed when the queue is being flushed.
  3960. */
  3961. function queueWatcher (watcher) {
  3962. var id = watcher.id;
  3963. if (has[id] == null) {
  3964. has[id] = true;
  3965. if (!flushing) {
  3966. queue.push(watcher);
  3967. } else {
  3968. // if already flushing, splice the watcher based on its id
  3969. // if already past its id, it will be run next immediately.
  3970. var i = queue.length - 1;
  3971. while (i > index && queue[i].id > watcher.id) {
  3972. i--;
  3973. }
  3974. queue.splice(i + 1, 0, watcher);
  3975. }
  3976. // queue the flush
  3977. if (!waiting) {
  3978. waiting = true;
  3979. if (process.env.NODE_ENV !== 'production' && !config.async) {
  3980. flushSchedulerQueue();
  3981. return
  3982. }
  3983. nextTick(flushSchedulerQueue);
  3984. }
  3985. }
  3986. }
  3987. /* */
  3988. var uid$2 = 0;
  3989. /**
  3990. * A watcher parses an expression, collects dependencies,
  3991. * and fires callback when the expression value changes.
  3992. * This is used for both the $watch() api and directives.
  3993. */
  3994. var Watcher = function Watcher (
  3995. vm,
  3996. expOrFn,
  3997. cb,
  3998. options,
  3999. isRenderWatcher
  4000. ) {
  4001. this.vm = vm;
  4002. if (isRenderWatcher) {
  4003. vm._watcher = this;
  4004. }
  4005. vm._watchers.push(this);
  4006. // options
  4007. if (options) {
  4008. this.deep = !!options.deep;
  4009. this.user = !!options.user;
  4010. this.lazy = !!options.lazy;
  4011. this.sync = !!options.sync;
  4012. this.before = options.before;
  4013. } else {
  4014. this.deep = this.user = this.lazy = this.sync = false;
  4015. }
  4016. this.cb = cb;
  4017. this.id = ++uid$2; // uid for batching
  4018. this.active = true;
  4019. this.dirty = this.lazy; // for lazy watchers
  4020. this.deps = [];
  4021. this.newDeps = [];
  4022. this.depIds = new _Set();
  4023. this.newDepIds = new _Set();
  4024. this.expression = process.env.NODE_ENV !== 'production'
  4025. ? expOrFn.toString()
  4026. : '';
  4027. // parse expression for getter
  4028. if (typeof expOrFn === 'function') {
  4029. this.getter = expOrFn;
  4030. } else {
  4031. this.getter = parsePath(expOrFn);
  4032. if (!this.getter) {
  4033. this.getter = noop;
  4034. process.env.NODE_ENV !== 'production' && warn(
  4035. "Failed watching path: \"" + expOrFn + "\" " +
  4036. 'Watcher only accepts simple dot-delimited paths. ' +
  4037. 'For full control, use a function instead.',
  4038. vm
  4039. );
  4040. }
  4041. }
  4042. this.value = this.lazy
  4043. ? undefined
  4044. : this.get();
  4045. };
  4046. /**
  4047. * Evaluate the getter, and re-collect dependencies.
  4048. */
  4049. Watcher.prototype.get = function get () {
  4050. pushTarget(this);
  4051. var value;
  4052. var vm = this.vm;
  4053. try {
  4054. value = this.getter.call(vm, vm);
  4055. } catch (e) {
  4056. if (this.user) {
  4057. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  4058. } else {
  4059. throw e
  4060. }
  4061. } finally {
  4062. // "touch" every property so they are all tracked as
  4063. // dependencies for deep watching
  4064. if (this.deep) {
  4065. traverse(value);
  4066. }
  4067. popTarget();
  4068. this.cleanupDeps();
  4069. }
  4070. return value
  4071. };
  4072. /**
  4073. * Add a dependency to this directive.
  4074. */
  4075. Watcher.prototype.addDep = function addDep (dep) {
  4076. var id = dep.id;
  4077. if (!this.newDepIds.has(id)) {
  4078. this.newDepIds.add(id);
  4079. this.newDeps.push(dep);
  4080. if (!this.depIds.has(id)) {
  4081. dep.addSub(this);
  4082. }
  4083. }
  4084. };
  4085. /**
  4086. * Clean up for dependency collection.
  4087. */
  4088. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  4089. var i = this.deps.length;
  4090. while (i--) {
  4091. var dep = this.deps[i];
  4092. if (!this.newDepIds.has(dep.id)) {
  4093. dep.removeSub(this);
  4094. }
  4095. }
  4096. var tmp = this.depIds;
  4097. this.depIds = this.newDepIds;
  4098. this.newDepIds = tmp;
  4099. this.newDepIds.clear();
  4100. tmp = this.deps;
  4101. this.deps = this.newDeps;
  4102. this.newDeps = tmp;
  4103. this.newDeps.length = 0;
  4104. };
  4105. /**
  4106. * Subscriber interface.
  4107. * Will be called when a dependency changes.
  4108. */
  4109. Watcher.prototype.update = function update () {
  4110. /* istanbul ignore else */
  4111. if (this.lazy) {
  4112. this.dirty = true;
  4113. } else if (this.sync) {
  4114. this.run();
  4115. } else {
  4116. queueWatcher(this);
  4117. }
  4118. };
  4119. /**
  4120. * Scheduler job interface.
  4121. * Will be called by the scheduler.
  4122. */
  4123. Watcher.prototype.run = function run () {
  4124. if (this.active) {
  4125. var value = this.get();
  4126. if (
  4127. value !== this.value ||
  4128. // Deep watchers and watchers on Object/Arrays should fire even
  4129. // when the value is the same, because the value may
  4130. // have mutated.
  4131. isObject(value) ||
  4132. this.deep
  4133. ) {
  4134. // set new value
  4135. var oldValue = this.value;
  4136. this.value = value;
  4137. if (this.user) {
  4138. try {
  4139. this.cb.call(this.vm, value, oldValue);
  4140. } catch (e) {
  4141. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  4142. }
  4143. } else {
  4144. this.cb.call(this.vm, value, oldValue);
  4145. }
  4146. }
  4147. }
  4148. };
  4149. /**
  4150. * Evaluate the value of the watcher.
  4151. * This only gets called for lazy watchers.
  4152. */
  4153. Watcher.prototype.evaluate = function evaluate () {
  4154. this.value = this.get();
  4155. this.dirty = false;
  4156. };
  4157. /**
  4158. * Depend on all deps collected by this watcher.
  4159. */
  4160. Watcher.prototype.depend = function depend () {
  4161. var i = this.deps.length;
  4162. while (i--) {
  4163. this.deps[i].depend();
  4164. }
  4165. };
  4166. /**
  4167. * Remove self from all dependencies' subscriber list.
  4168. */
  4169. Watcher.prototype.teardown = function teardown () {
  4170. if (this.active) {
  4171. // remove self from vm's watcher list
  4172. // this is a somewhat expensive operation so we skip it
  4173. // if the vm is being destroyed.
  4174. if (!this.vm._isBeingDestroyed) {
  4175. remove(this.vm._watchers, this);
  4176. }
  4177. var i = this.deps.length;
  4178. while (i--) {
  4179. this.deps[i].removeSub(this);
  4180. }
  4181. this.active = false;
  4182. }
  4183. };
  4184. /* */
  4185. var sharedPropertyDefinition = {
  4186. enumerable: true,
  4187. configurable: true,
  4188. get: noop,
  4189. set: noop
  4190. };
  4191. function proxy (target, sourceKey, key) {
  4192. sharedPropertyDefinition.get = function proxyGetter () {
  4193. return this[sourceKey][key]
  4194. };
  4195. sharedPropertyDefinition.set = function proxySetter (val) {
  4196. this[sourceKey][key] = val;
  4197. };
  4198. Object.defineProperty(target, key, sharedPropertyDefinition);
  4199. }
  4200. function initState (vm) {
  4201. vm._watchers = [];
  4202. var opts = vm.$options;
  4203. if (opts.props) { initProps(vm, opts.props); }
  4204. if (opts.methods) { initMethods(vm, opts.methods); }
  4205. if (opts.data) {
  4206. initData(vm);
  4207. } else {
  4208. observe(vm._data = {}, true /* asRootData */);
  4209. }
  4210. if (opts.computed) { initComputed(vm, opts.computed); }
  4211. if (opts.watch && opts.watch !== nativeWatch) {
  4212. initWatch(vm, opts.watch);
  4213. }
  4214. }
  4215. function initProps (vm, propsOptions) {
  4216. var propsData = vm.$options.propsData || {};
  4217. var props = vm._props = {};
  4218. // cache prop keys so that future props updates can iterate using Array
  4219. // instead of dynamic object key enumeration.
  4220. var keys = vm.$options._propKeys = [];
  4221. var isRoot = !vm.$parent;
  4222. // root instance props should be converted
  4223. if (!isRoot) {
  4224. toggleObserving(false);
  4225. }
  4226. var loop = function ( key ) {
  4227. keys.push(key);
  4228. var value = validateProp(key, propsOptions, propsData, vm);
  4229. /* istanbul ignore else */
  4230. if (process.env.NODE_ENV !== 'production') {
  4231. var hyphenatedKey = hyphenate(key);
  4232. if (isReservedAttribute(hyphenatedKey) ||
  4233. config.isReservedAttr(hyphenatedKey)) {
  4234. warn(
  4235. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  4236. vm
  4237. );
  4238. }
  4239. defineReactive$$1(props, key, value, function () {
  4240. if (!isRoot && !isUpdatingChildComponent) {
  4241. warn(
  4242. "Avoid mutating a prop directly since the value will be " +
  4243. "overwritten whenever the parent component re-renders. " +
  4244. "Instead, use a data or computed property based on the prop's " +
  4245. "value. Prop being mutated: \"" + key + "\"",
  4246. vm
  4247. );
  4248. }
  4249. });
  4250. } else {
  4251. defineReactive$$1(props, key, value);
  4252. }
  4253. // static props are already proxied on the component's prototype
  4254. // during Vue.extend(). We only need to proxy props defined at
  4255. // instantiation here.
  4256. if (!(key in vm)) {
  4257. proxy(vm, "_props", key);
  4258. }
  4259. };
  4260. for (var key in propsOptions) loop( key );
  4261. toggleObserving(true);
  4262. }
  4263. function initData (vm) {
  4264. var data = vm.$options.data;
  4265. data = vm._data = typeof data === 'function'
  4266. ? getData(data, vm)
  4267. : data || {};
  4268. if (!isPlainObject(data)) {
  4269. data = {};
  4270. process.env.NODE_ENV !== 'production' && warn(
  4271. 'data functions should return an object:\n' +
  4272. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  4273. vm
  4274. );
  4275. }
  4276. // proxy data on instance
  4277. var keys = Object.keys(data);
  4278. var props = vm.$options.props;
  4279. var methods = vm.$options.methods;
  4280. var i = keys.length;
  4281. while (i--) {
  4282. var key = keys[i];
  4283. if (process.env.NODE_ENV !== 'production') {
  4284. if (methods && hasOwn(methods, key)) {
  4285. warn(
  4286. ("Method \"" + key + "\" has already been defined as a data property."),
  4287. vm
  4288. );
  4289. }
  4290. }
  4291. if (props && hasOwn(props, key)) {
  4292. process.env.NODE_ENV !== 'production' && warn(
  4293. "The data property \"" + key + "\" is already declared as a prop. " +
  4294. "Use prop default value instead.",
  4295. vm
  4296. );
  4297. } else if (!isReserved(key)) {
  4298. proxy(vm, "_data", key);
  4299. }
  4300. }
  4301. // observe data
  4302. observe(data, true /* asRootData */);
  4303. }
  4304. function getData (data, vm) {
  4305. // #7573 disable dep collection when invoking data getters
  4306. pushTarget();
  4307. try {
  4308. return data.call(vm, vm)
  4309. } catch (e) {
  4310. handleError(e, vm, "data()");
  4311. return {}
  4312. } finally {
  4313. popTarget();
  4314. }
  4315. }
  4316. var computedWatcherOptions = { lazy: true };
  4317. function initComputed (vm, computed) {
  4318. // $flow-disable-line
  4319. var watchers = vm._computedWatchers = Object.create(null);
  4320. // computed properties are just getters during SSR
  4321. var isSSR = isServerRendering();
  4322. for (var key in computed) {
  4323. var userDef = computed[key];
  4324. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  4325. if (process.env.NODE_ENV !== 'production' && getter == null) {
  4326. warn(
  4327. ("Getter is missing for computed property \"" + key + "\"."),
  4328. vm
  4329. );
  4330. }
  4331. if (!isSSR) {
  4332. // create internal watcher for the computed property.
  4333. watchers[key] = new Watcher(
  4334. vm,
  4335. getter || noop,
  4336. noop,
  4337. computedWatcherOptions
  4338. );
  4339. }
  4340. // component-defined computed properties are already defined on the
  4341. // component prototype. We only need to define computed properties defined
  4342. // at instantiation here.
  4343. if (!(key in vm)) {
  4344. defineComputed(vm, key, userDef);
  4345. } else if (process.env.NODE_ENV !== 'production') {
  4346. if (key in vm.$data) {
  4347. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  4348. } else if (vm.$options.props && key in vm.$options.props) {
  4349. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  4350. }
  4351. }
  4352. }
  4353. }
  4354. function defineComputed (
  4355. target,
  4356. key,
  4357. userDef
  4358. ) {
  4359. var shouldCache = !isServerRendering();
  4360. if (typeof userDef === 'function') {
  4361. sharedPropertyDefinition.get = shouldCache
  4362. ? createComputedGetter(key)
  4363. : createGetterInvoker(userDef);
  4364. sharedPropertyDefinition.set = noop;
  4365. } else {
  4366. sharedPropertyDefinition.get = userDef.get
  4367. ? shouldCache && userDef.cache !== false
  4368. ? createComputedGetter(key)
  4369. : createGetterInvoker(userDef.get)
  4370. : noop;
  4371. sharedPropertyDefinition.set = userDef.set || noop;
  4372. }
  4373. if (process.env.NODE_ENV !== 'production' &&
  4374. sharedPropertyDefinition.set === noop) {
  4375. sharedPropertyDefinition.set = function () {
  4376. warn(
  4377. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  4378. this
  4379. );
  4380. };
  4381. }
  4382. Object.defineProperty(target, key, sharedPropertyDefinition);
  4383. }
  4384. function createComputedGetter (key) {
  4385. return function computedGetter () {
  4386. var watcher = this._computedWatchers && this._computedWatchers[key];
  4387. if (watcher) {
  4388. if (watcher.dirty) {
  4389. watcher.evaluate();
  4390. }
  4391. if (Dep.target) {
  4392. watcher.depend();
  4393. }
  4394. return watcher.value
  4395. }
  4396. }
  4397. }
  4398. function createGetterInvoker(fn) {
  4399. return function computedGetter () {
  4400. return fn.call(this, this)
  4401. }
  4402. }
  4403. function initMethods (vm, methods) {
  4404. var props = vm.$options.props;
  4405. for (var key in methods) {
  4406. if (process.env.NODE_ENV !== 'production') {
  4407. if (typeof methods[key] !== 'function') {
  4408. warn(
  4409. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  4410. "Did you reference the function correctly?",
  4411. vm
  4412. );
  4413. }
  4414. if (props && hasOwn(props, key)) {
  4415. warn(
  4416. ("Method \"" + key + "\" has already been defined as a prop."),
  4417. vm
  4418. );
  4419. }
  4420. if ((key in vm) && isReserved(key)) {
  4421. warn(
  4422. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  4423. "Avoid defining component methods that start with _ or $."
  4424. );
  4425. }
  4426. }
  4427. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  4428. }
  4429. }
  4430. function initWatch (vm, watch) {
  4431. for (var key in watch) {
  4432. var handler = watch[key];
  4433. if (Array.isArray(handler)) {
  4434. for (var i = 0; i < handler.length; i++) {
  4435. createWatcher(vm, key, handler[i]);
  4436. }
  4437. } else {
  4438. createWatcher(vm, key, handler);
  4439. }
  4440. }
  4441. }
  4442. function createWatcher (
  4443. vm,
  4444. expOrFn,
  4445. handler,
  4446. options
  4447. ) {
  4448. if (isPlainObject(handler)) {
  4449. options = handler;
  4450. handler = handler.handler;
  4451. }
  4452. if (typeof handler === 'string') {
  4453. handler = vm[handler];
  4454. }
  4455. return vm.$watch(expOrFn, handler, options)
  4456. }
  4457. function stateMixin (Vue) {
  4458. // flow somehow has problems with directly declared definition object
  4459. // when using Object.defineProperty, so we have to procedurally build up
  4460. // the object here.
  4461. var dataDef = {};
  4462. dataDef.get = function () { return this._data };
  4463. var propsDef = {};
  4464. propsDef.get = function () { return this._props };
  4465. if (process.env.NODE_ENV !== 'production') {
  4466. dataDef.set = function () {
  4467. warn(
  4468. 'Avoid replacing instance root $data. ' +
  4469. 'Use nested data properties instead.',
  4470. this
  4471. );
  4472. };
  4473. propsDef.set = function () {
  4474. warn("$props is readonly.", this);
  4475. };
  4476. }
  4477. Object.defineProperty(Vue.prototype, '$data', dataDef);
  4478. Object.defineProperty(Vue.prototype, '$props', propsDef);
  4479. Vue.prototype.$set = set;
  4480. Vue.prototype.$delete = del;
  4481. Vue.prototype.$watch = function (
  4482. expOrFn,
  4483. cb,
  4484. options
  4485. ) {
  4486. var vm = this;
  4487. if (isPlainObject(cb)) {
  4488. return createWatcher(vm, expOrFn, cb, options)
  4489. }
  4490. options = options || {};
  4491. options.user = true;
  4492. var watcher = new Watcher(vm, expOrFn, cb, options);
  4493. if (options.immediate) {
  4494. try {
  4495. cb.call(vm, watcher.value);
  4496. } catch (error) {
  4497. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  4498. }
  4499. }
  4500. return function unwatchFn () {
  4501. watcher.teardown();
  4502. }
  4503. };
  4504. }
  4505. /* */
  4506. var uid$3 = 0;
  4507. function initMixin (Vue) {
  4508. Vue.prototype._init = function (options) {
  4509. var vm = this;
  4510. // a uid
  4511. vm._uid = uid$3++;
  4512. var startTag, endTag;
  4513. /* istanbul ignore if */
  4514. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  4515. startTag = "vue-perf-start:" + (vm._uid);
  4516. endTag = "vue-perf-end:" + (vm._uid);
  4517. mark(startTag);
  4518. }
  4519. // a flag to avoid this being observed
  4520. vm._isVue = true;
  4521. // merge options
  4522. if (options && options._isComponent) {
  4523. // optimize internal component instantiation
  4524. // since dynamic options merging is pretty slow, and none of the
  4525. // internal component options needs special treatment.
  4526. initInternalComponent(vm, options);
  4527. } else {
  4528. vm.$options = mergeOptions(
  4529. resolveConstructorOptions(vm.constructor),
  4530. options || {},
  4531. vm
  4532. );
  4533. }
  4534. /* istanbul ignore else */
  4535. if (process.env.NODE_ENV !== 'production') {
  4536. initProxy(vm);
  4537. } else {
  4538. vm._renderProxy = vm;
  4539. }
  4540. // expose real self
  4541. vm._self = vm;
  4542. initLifecycle(vm);
  4543. initEvents(vm);
  4544. initRender(vm);
  4545. callHook(vm, 'beforeCreate');
  4546. initInjections(vm); // resolve injections before data/props
  4547. initState(vm);
  4548. initProvide(vm); // resolve provide after data/props
  4549. callHook(vm, 'created');
  4550. /* istanbul ignore if */
  4551. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  4552. vm._name = formatComponentName(vm, false);
  4553. mark(endTag);
  4554. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  4555. }
  4556. if (vm.$options.el) {
  4557. vm.$mount(vm.$options.el);
  4558. }
  4559. };
  4560. }
  4561. function initInternalComponent (vm, options) {
  4562. var opts = vm.$options = Object.create(vm.constructor.options);
  4563. // doing this because it's faster than dynamic enumeration.
  4564. var parentVnode = options._parentVnode;
  4565. opts.parent = options.parent;
  4566. opts._parentVnode = parentVnode;
  4567. var vnodeComponentOptions = parentVnode.componentOptions;
  4568. opts.propsData = vnodeComponentOptions.propsData;
  4569. opts._parentListeners = vnodeComponentOptions.listeners;
  4570. opts._renderChildren = vnodeComponentOptions.children;
  4571. opts._componentTag = vnodeComponentOptions.tag;
  4572. if (options.render) {
  4573. opts.render = options.render;
  4574. opts.staticRenderFns = options.staticRenderFns;
  4575. }
  4576. }
  4577. function resolveConstructorOptions (Ctor) {
  4578. var options = Ctor.options;
  4579. if (Ctor.super) {
  4580. var superOptions = resolveConstructorOptions(Ctor.super);
  4581. var cachedSuperOptions = Ctor.superOptions;
  4582. if (superOptions !== cachedSuperOptions) {
  4583. // super option changed,
  4584. // need to resolve new options.
  4585. Ctor.superOptions = superOptions;
  4586. // check if there are any late-modified/attached options (#4976)
  4587. var modifiedOptions = resolveModifiedOptions(Ctor);
  4588. // update base extend options
  4589. if (modifiedOptions) {
  4590. extend(Ctor.extendOptions, modifiedOptions);
  4591. }
  4592. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4593. if (options.name) {
  4594. options.components[options.name] = Ctor;
  4595. }
  4596. }
  4597. }
  4598. return options
  4599. }
  4600. function resolveModifiedOptions (Ctor) {
  4601. var modified;
  4602. var latest = Ctor.options;
  4603. var sealed = Ctor.sealedOptions;
  4604. for (var key in latest) {
  4605. if (latest[key] !== sealed[key]) {
  4606. if (!modified) { modified = {}; }
  4607. modified[key] = latest[key];
  4608. }
  4609. }
  4610. return modified
  4611. }
  4612. function Vue (options) {
  4613. if (process.env.NODE_ENV !== 'production' &&
  4614. !(this instanceof Vue)
  4615. ) {
  4616. warn('Vue is a constructor and should be called with the `new` keyword');
  4617. }
  4618. this._init(options);
  4619. }
  4620. initMixin(Vue);
  4621. stateMixin(Vue);
  4622. eventsMixin(Vue);
  4623. lifecycleMixin(Vue);
  4624. renderMixin(Vue);
  4625. /* */
  4626. function initUse (Vue) {
  4627. Vue.use = function (plugin) {
  4628. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  4629. if (installedPlugins.indexOf(plugin) > -1) {
  4630. return this
  4631. }
  4632. // additional parameters
  4633. var args = toArray(arguments, 1);
  4634. args.unshift(this);
  4635. if (typeof plugin.install === 'function') {
  4636. plugin.install.apply(plugin, args);
  4637. } else if (typeof plugin === 'function') {
  4638. plugin.apply(null, args);
  4639. }
  4640. installedPlugins.push(plugin);
  4641. return this
  4642. };
  4643. }
  4644. /* */
  4645. function initMixin$1 (Vue) {
  4646. Vue.mixin = function (mixin) {
  4647. this.options = mergeOptions(this.options, mixin);
  4648. return this
  4649. };
  4650. }
  4651. /* */
  4652. function initExtend (Vue) {
  4653. /**
  4654. * Each instance constructor, including Vue, has a unique
  4655. * cid. This enables us to create wrapped "child
  4656. * constructors" for prototypal inheritance and cache them.
  4657. */
  4658. Vue.cid = 0;
  4659. var cid = 1;
  4660. /**
  4661. * Class inheritance
  4662. */
  4663. Vue.extend = function (extendOptions) {
  4664. extendOptions = extendOptions || {};
  4665. var Super = this;
  4666. var SuperId = Super.cid;
  4667. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  4668. if (cachedCtors[SuperId]) {
  4669. return cachedCtors[SuperId]
  4670. }
  4671. var name = extendOptions.name || Super.options.name;
  4672. if (process.env.NODE_ENV !== 'production' && name) {
  4673. validateComponentName(name);
  4674. }
  4675. var Sub = function VueComponent (options) {
  4676. this._init(options);
  4677. };
  4678. Sub.prototype = Object.create(Super.prototype);
  4679. Sub.prototype.constructor = Sub;
  4680. Sub.cid = cid++;
  4681. Sub.options = mergeOptions(
  4682. Super.options,
  4683. extendOptions
  4684. );
  4685. Sub['super'] = Super;
  4686. // For props and computed properties, we define the proxy getters on
  4687. // the Vue instances at extension time, on the extended prototype. This
  4688. // avoids Object.defineProperty calls for each instance created.
  4689. if (Sub.options.props) {
  4690. initProps$1(Sub);
  4691. }
  4692. if (Sub.options.computed) {
  4693. initComputed$1(Sub);
  4694. }
  4695. // allow further extension/mixin/plugin usage
  4696. Sub.extend = Super.extend;
  4697. Sub.mixin = Super.mixin;
  4698. Sub.use = Super.use;
  4699. // create asset registers, so extended classes
  4700. // can have their private assets too.
  4701. ASSET_TYPES.forEach(function (type) {
  4702. Sub[type] = Super[type];
  4703. });
  4704. // enable recursive self-lookup
  4705. if (name) {
  4706. Sub.options.components[name] = Sub;
  4707. }
  4708. // keep a reference to the super options at extension time.
  4709. // later at instantiation we can check if Super's options have
  4710. // been updated.
  4711. Sub.superOptions = Super.options;
  4712. Sub.extendOptions = extendOptions;
  4713. Sub.sealedOptions = extend({}, Sub.options);
  4714. // cache constructor
  4715. cachedCtors[SuperId] = Sub;
  4716. return Sub
  4717. };
  4718. }
  4719. function initProps$1 (Comp) {
  4720. var props = Comp.options.props;
  4721. for (var key in props) {
  4722. proxy(Comp.prototype, "_props", key);
  4723. }
  4724. }
  4725. function initComputed$1 (Comp) {
  4726. var computed = Comp.options.computed;
  4727. for (var key in computed) {
  4728. defineComputed(Comp.prototype, key, computed[key]);
  4729. }
  4730. }
  4731. /* */
  4732. function initAssetRegisters (Vue) {
  4733. /**
  4734. * Create asset registration methods.
  4735. */
  4736. ASSET_TYPES.forEach(function (type) {
  4737. Vue[type] = function (
  4738. id,
  4739. definition
  4740. ) {
  4741. if (!definition) {
  4742. return this.options[type + 's'][id]
  4743. } else {
  4744. /* istanbul ignore if */
  4745. if (process.env.NODE_ENV !== 'production' && type === 'component') {
  4746. validateComponentName(id);
  4747. }
  4748. if (type === 'component' && isPlainObject(definition)) {
  4749. definition.name = definition.name || id;
  4750. definition = this.options._base.extend(definition);
  4751. }
  4752. if (type === 'directive' && typeof definition === 'function') {
  4753. definition = { bind: definition, update: definition };
  4754. }
  4755. this.options[type + 's'][id] = definition;
  4756. return definition
  4757. }
  4758. };
  4759. });
  4760. }
  4761. /* */
  4762. function getComponentName (opts) {
  4763. return opts && (opts.Ctor.options.name || opts.tag)
  4764. }
  4765. function matches (pattern, name) {
  4766. if (Array.isArray(pattern)) {
  4767. return pattern.indexOf(name) > -1
  4768. } else if (typeof pattern === 'string') {
  4769. return pattern.split(',').indexOf(name) > -1
  4770. } else if (isRegExp(pattern)) {
  4771. return pattern.test(name)
  4772. }
  4773. /* istanbul ignore next */
  4774. return false
  4775. }
  4776. function pruneCache (keepAliveInstance, filter) {
  4777. var cache = keepAliveInstance.cache;
  4778. var keys = keepAliveInstance.keys;
  4779. var _vnode = keepAliveInstance._vnode;
  4780. for (var key in cache) {
  4781. var cachedNode = cache[key];
  4782. if (cachedNode) {
  4783. var name = getComponentName(cachedNode.componentOptions);
  4784. if (name && !filter(name)) {
  4785. pruneCacheEntry(cache, key, keys, _vnode);
  4786. }
  4787. }
  4788. }
  4789. }
  4790. function pruneCacheEntry (
  4791. cache,
  4792. key,
  4793. keys,
  4794. current
  4795. ) {
  4796. var cached$$1 = cache[key];
  4797. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  4798. cached$$1.componentInstance.$destroy();
  4799. }
  4800. cache[key] = null;
  4801. remove(keys, key);
  4802. }
  4803. var patternTypes = [String, RegExp, Array];
  4804. var KeepAlive = {
  4805. name: 'keep-alive',
  4806. abstract: true,
  4807. props: {
  4808. include: patternTypes,
  4809. exclude: patternTypes,
  4810. max: [String, Number]
  4811. },
  4812. created: function created () {
  4813. this.cache = Object.create(null);
  4814. this.keys = [];
  4815. },
  4816. destroyed: function destroyed () {
  4817. for (var key in this.cache) {
  4818. pruneCacheEntry(this.cache, key, this.keys);
  4819. }
  4820. },
  4821. mounted: function mounted () {
  4822. var this$1 = this;
  4823. this.$watch('include', function (val) {
  4824. pruneCache(this$1, function (name) { return matches(val, name); });
  4825. });
  4826. this.$watch('exclude', function (val) {
  4827. pruneCache(this$1, function (name) { return !matches(val, name); });
  4828. });
  4829. },
  4830. render: function render () {
  4831. var slot = this.$slots.default;
  4832. var vnode = getFirstComponentChild(slot);
  4833. var componentOptions = vnode && vnode.componentOptions;
  4834. if (componentOptions) {
  4835. // check pattern
  4836. var name = getComponentName(componentOptions);
  4837. var ref = this;
  4838. var include = ref.include;
  4839. var exclude = ref.exclude;
  4840. if (
  4841. // not included
  4842. (include && (!name || !matches(include, name))) ||
  4843. // excluded
  4844. (exclude && name && matches(exclude, name))
  4845. ) {
  4846. return vnode
  4847. }
  4848. var ref$1 = this;
  4849. var cache = ref$1.cache;
  4850. var keys = ref$1.keys;
  4851. var key = vnode.key == null
  4852. // same constructor may get registered as different local components
  4853. // so cid alone is not enough (#3269)
  4854. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  4855. : vnode.key;
  4856. if (cache[key]) {
  4857. vnode.componentInstance = cache[key].componentInstance;
  4858. // make current key freshest
  4859. remove(keys, key);
  4860. keys.push(key);
  4861. } else {
  4862. cache[key] = vnode;
  4863. keys.push(key);
  4864. // prune oldest entry
  4865. if (this.max && keys.length > parseInt(this.max)) {
  4866. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  4867. }
  4868. }
  4869. vnode.data.keepAlive = true;
  4870. }
  4871. return vnode || (slot && slot[0])
  4872. }
  4873. };
  4874. var builtInComponents = {
  4875. KeepAlive: KeepAlive
  4876. };
  4877. /* */
  4878. function initGlobalAPI (Vue) {
  4879. // config
  4880. var configDef = {};
  4881. configDef.get = function () { return config; };
  4882. if (process.env.NODE_ENV !== 'production') {
  4883. configDef.set = function () {
  4884. warn(
  4885. 'Do not replace the Vue.config object, set individual fields instead.'
  4886. );
  4887. };
  4888. }
  4889. Object.defineProperty(Vue, 'config', configDef);
  4890. // exposed util methods.
  4891. // NOTE: these are not considered part of the public API - avoid relying on
  4892. // them unless you are aware of the risk.
  4893. Vue.util = {
  4894. warn: warn,
  4895. extend: extend,
  4896. mergeOptions: mergeOptions,
  4897. defineReactive: defineReactive$$1
  4898. };
  4899. Vue.set = set;
  4900. Vue.delete = del;
  4901. Vue.nextTick = nextTick;
  4902. // 2.6 explicit observable API
  4903. Vue.observable = function (obj) {
  4904. observe(obj);
  4905. return obj
  4906. };
  4907. Vue.options = Object.create(null);
  4908. ASSET_TYPES.forEach(function (type) {
  4909. Vue.options[type + 's'] = Object.create(null);
  4910. });
  4911. // this is used to identify the "base" constructor to extend all plain-object
  4912. // components with in Weex's multi-instance scenarios.
  4913. Vue.options._base = Vue;
  4914. extend(Vue.options.components, builtInComponents);
  4915. initUse(Vue);
  4916. initMixin$1(Vue);
  4917. initExtend(Vue);
  4918. initAssetRegisters(Vue);
  4919. }
  4920. initGlobalAPI(Vue);
  4921. Object.defineProperty(Vue.prototype, '$isServer', {
  4922. get: isServerRendering
  4923. });
  4924. Object.defineProperty(Vue.prototype, '$ssrContext', {
  4925. get: function get () {
  4926. /* istanbul ignore next */
  4927. return this.$vnode && this.$vnode.ssrContext
  4928. }
  4929. });
  4930. // expose FunctionalRenderContext for ssr runtime helper installation
  4931. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  4932. value: FunctionalRenderContext
  4933. });
  4934. Vue.version = '2.6.10';
  4935. /* */
  4936. // these are reserved for web because they are directly compiled away
  4937. // during template compilation
  4938. var isReservedAttr = makeMap('style,class');
  4939. // attributes that should be using props for binding
  4940. var acceptValue = makeMap('input,textarea,option,select,progress');
  4941. var mustUseProp = function (tag, type, attr) {
  4942. return (
  4943. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  4944. (attr === 'selected' && tag === 'option') ||
  4945. (attr === 'checked' && tag === 'input') ||
  4946. (attr === 'muted' && tag === 'video')
  4947. )
  4948. };
  4949. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  4950. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  4951. var convertEnumeratedValue = function (key, value) {
  4952. return isFalsyAttrValue(value) || value === 'false'
  4953. ? 'false'
  4954. // allow arbitrary string value for contenteditable
  4955. : key === 'contenteditable' && isValidContentEditableValue(value)
  4956. ? value
  4957. : 'true'
  4958. };
  4959. var isBooleanAttr = makeMap(
  4960. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  4961. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  4962. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  4963. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  4964. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  4965. 'truespeed,typemustmatch,visible'
  4966. );
  4967. var xlinkNS = 'http://www.w3.org/1999/xlink';
  4968. var isXlink = function (name) {
  4969. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  4970. };
  4971. var getXlinkProp = function (name) {
  4972. return isXlink(name) ? name.slice(6, name.length) : ''
  4973. };
  4974. var isFalsyAttrValue = function (val) {
  4975. return val == null || val === false
  4976. };
  4977. /* */
  4978. function genClassForVnode (vnode) {
  4979. var data = vnode.data;
  4980. var parentNode = vnode;
  4981. var childNode = vnode;
  4982. while (isDef(childNode.componentInstance)) {
  4983. childNode = childNode.componentInstance._vnode;
  4984. if (childNode && childNode.data) {
  4985. data = mergeClassData(childNode.data, data);
  4986. }
  4987. }
  4988. while (isDef(parentNode = parentNode.parent)) {
  4989. if (parentNode && parentNode.data) {
  4990. data = mergeClassData(data, parentNode.data);
  4991. }
  4992. }
  4993. return renderClass(data.staticClass, data.class)
  4994. }
  4995. function mergeClassData (child, parent) {
  4996. return {
  4997. staticClass: concat(child.staticClass, parent.staticClass),
  4998. class: isDef(child.class)
  4999. ? [child.class, parent.class]
  5000. : parent.class
  5001. }
  5002. }
  5003. function renderClass (
  5004. staticClass,
  5005. dynamicClass
  5006. ) {
  5007. if (isDef(staticClass) || isDef(dynamicClass)) {
  5008. return concat(staticClass, stringifyClass(dynamicClass))
  5009. }
  5010. /* istanbul ignore next */
  5011. return ''
  5012. }
  5013. function concat (a, b) {
  5014. return a ? b ? (a + ' ' + b) : a : (b || '')
  5015. }
  5016. function stringifyClass (value) {
  5017. if (Array.isArray(value)) {
  5018. return stringifyArray(value)
  5019. }
  5020. if (isObject(value)) {
  5021. return stringifyObject(value)
  5022. }
  5023. if (typeof value === 'string') {
  5024. return value
  5025. }
  5026. /* istanbul ignore next */
  5027. return ''
  5028. }
  5029. function stringifyArray (value) {
  5030. var res = '';
  5031. var stringified;
  5032. for (var i = 0, l = value.length; i < l; i++) {
  5033. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  5034. if (res) { res += ' '; }
  5035. res += stringified;
  5036. }
  5037. }
  5038. return res
  5039. }
  5040. function stringifyObject (value) {
  5041. var res = '';
  5042. for (var key in value) {
  5043. if (value[key]) {
  5044. if (res) { res += ' '; }
  5045. res += key;
  5046. }
  5047. }
  5048. return res
  5049. }
  5050. /* */
  5051. var namespaceMap = {
  5052. svg: 'http://www.w3.org/2000/svg',
  5053. math: 'http://www.w3.org/1998/Math/MathML'
  5054. };
  5055. var isHTMLTag = makeMap(
  5056. 'html,body,base,head,link,meta,style,title,' +
  5057. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  5058. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  5059. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  5060. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  5061. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  5062. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  5063. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  5064. 'output,progress,select,textarea,' +
  5065. 'details,dialog,menu,menuitem,summary,' +
  5066. 'content,element,shadow,template,blockquote,iframe,tfoot'
  5067. );
  5068. // this map is intentionally selective, only covering SVG elements that may
  5069. // contain child elements.
  5070. var isSVG = makeMap(
  5071. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  5072. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  5073. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  5074. true
  5075. );
  5076. var isReservedTag = function (tag) {
  5077. return isHTMLTag(tag) || isSVG(tag)
  5078. };
  5079. function getTagNamespace (tag) {
  5080. if (isSVG(tag)) {
  5081. return 'svg'
  5082. }
  5083. // basic support for MathML
  5084. // note it doesn't support other MathML elements being component roots
  5085. if (tag === 'math') {
  5086. return 'math'
  5087. }
  5088. }
  5089. var unknownElementCache = Object.create(null);
  5090. function isUnknownElement (tag) {
  5091. /* istanbul ignore if */
  5092. if (!inBrowser) {
  5093. return true
  5094. }
  5095. if (isReservedTag(tag)) {
  5096. return false
  5097. }
  5098. tag = tag.toLowerCase();
  5099. /* istanbul ignore if */
  5100. if (unknownElementCache[tag] != null) {
  5101. return unknownElementCache[tag]
  5102. }
  5103. var el = document.createElement(tag);
  5104. if (tag.indexOf('-') > -1) {
  5105. // http://stackoverflow.com/a/28210364/1070244
  5106. return (unknownElementCache[tag] = (
  5107. el.constructor === window.HTMLUnknownElement ||
  5108. el.constructor === window.HTMLElement
  5109. ))
  5110. } else {
  5111. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  5112. }
  5113. }
  5114. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  5115. /* */
  5116. /**
  5117. * Query an element selector if it's not an element already.
  5118. */
  5119. function query (el) {
  5120. if (typeof el === 'string') {
  5121. var selected = document.querySelector(el);
  5122. if (!selected) {
  5123. process.env.NODE_ENV !== 'production' && warn(
  5124. 'Cannot find element: ' + el
  5125. );
  5126. return document.createElement('div')
  5127. }
  5128. return selected
  5129. } else {
  5130. return el
  5131. }
  5132. }
  5133. /* */
  5134. function createElement$1 (tagName, vnode) {
  5135. var elm = document.createElement(tagName);
  5136. if (tagName !== 'select') {
  5137. return elm
  5138. }
  5139. // false or null will remove the attribute but undefined will not
  5140. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  5141. elm.setAttribute('multiple', 'multiple');
  5142. }
  5143. return elm
  5144. }
  5145. function createElementNS (namespace, tagName) {
  5146. return document.createElementNS(namespaceMap[namespace], tagName)
  5147. }
  5148. function createTextNode (text) {
  5149. return document.createTextNode(text)
  5150. }
  5151. function createComment (text) {
  5152. return document.createComment(text)
  5153. }
  5154. function insertBefore (parentNode, newNode, referenceNode) {
  5155. parentNode.insertBefore(newNode, referenceNode);
  5156. }
  5157. function removeChild (node, child) {
  5158. node.removeChild(child);
  5159. }
  5160. function appendChild (node, child) {
  5161. node.appendChild(child);
  5162. }
  5163. function parentNode (node) {
  5164. return node.parentNode
  5165. }
  5166. function nextSibling (node) {
  5167. return node.nextSibling
  5168. }
  5169. function tagName (node) {
  5170. return node.tagName
  5171. }
  5172. function setTextContent (node, text) {
  5173. node.textContent = text;
  5174. }
  5175. function setStyleScope (node, scopeId) {
  5176. node.setAttribute(scopeId, '');
  5177. }
  5178. var nodeOps = /*#__PURE__*/Object.freeze({
  5179. createElement: createElement$1,
  5180. createElementNS: createElementNS,
  5181. createTextNode: createTextNode,
  5182. createComment: createComment,
  5183. insertBefore: insertBefore,
  5184. removeChild: removeChild,
  5185. appendChild: appendChild,
  5186. parentNode: parentNode,
  5187. nextSibling: nextSibling,
  5188. tagName: tagName,
  5189. setTextContent: setTextContent,
  5190. setStyleScope: setStyleScope
  5191. });
  5192. /* */
  5193. var ref = {
  5194. create: function create (_, vnode) {
  5195. registerRef(vnode);
  5196. },
  5197. update: function update (oldVnode, vnode) {
  5198. if (oldVnode.data.ref !== vnode.data.ref) {
  5199. registerRef(oldVnode, true);
  5200. registerRef(vnode);
  5201. }
  5202. },
  5203. destroy: function destroy (vnode) {
  5204. registerRef(vnode, true);
  5205. }
  5206. };
  5207. function registerRef (vnode, isRemoval) {
  5208. var key = vnode.data.ref;
  5209. if (!isDef(key)) { return }
  5210. var vm = vnode.context;
  5211. var ref = vnode.componentInstance || vnode.elm;
  5212. var refs = vm.$refs;
  5213. if (isRemoval) {
  5214. if (Array.isArray(refs[key])) {
  5215. remove(refs[key], ref);
  5216. } else if (refs[key] === ref) {
  5217. refs[key] = undefined;
  5218. }
  5219. } else {
  5220. if (vnode.data.refInFor) {
  5221. if (!Array.isArray(refs[key])) {
  5222. refs[key] = [ref];
  5223. } else if (refs[key].indexOf(ref) < 0) {
  5224. // $flow-disable-line
  5225. refs[key].push(ref);
  5226. }
  5227. } else {
  5228. refs[key] = ref;
  5229. }
  5230. }
  5231. }
  5232. /**
  5233. * Virtual DOM patching algorithm based on Snabbdom by
  5234. * Simon Friis Vindum (@paldepind)
  5235. * Licensed under the MIT License
  5236. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  5237. *
  5238. * modified by Evan You (@yyx990803)
  5239. *
  5240. * Not type-checking this because this file is perf-critical and the cost
  5241. * of making flow understand it is not worth it.
  5242. */
  5243. var emptyNode = new VNode('', {}, []);
  5244. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  5245. function sameVnode (a, b) {
  5246. return (
  5247. a.key === b.key && (
  5248. (
  5249. a.tag === b.tag &&
  5250. a.isComment === b.isComment &&
  5251. isDef(a.data) === isDef(b.data) &&
  5252. sameInputType(a, b)
  5253. ) || (
  5254. isTrue(a.isAsyncPlaceholder) &&
  5255. a.asyncFactory === b.asyncFactory &&
  5256. isUndef(b.asyncFactory.error)
  5257. )
  5258. )
  5259. )
  5260. }
  5261. function sameInputType (a, b) {
  5262. if (a.tag !== 'input') { return true }
  5263. var i;
  5264. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  5265. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  5266. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  5267. }
  5268. function createKeyToOldIdx (children, beginIdx, endIdx) {
  5269. var i, key;
  5270. var map = {};
  5271. for (i = beginIdx; i <= endIdx; ++i) {
  5272. key = children[i].key;
  5273. if (isDef(key)) { map[key] = i; }
  5274. }
  5275. return map
  5276. }
  5277. function createPatchFunction (backend) {
  5278. var i, j;
  5279. var cbs = {};
  5280. var modules = backend.modules;
  5281. var nodeOps = backend.nodeOps;
  5282. for (i = 0; i < hooks.length; ++i) {
  5283. cbs[hooks[i]] = [];
  5284. for (j = 0; j < modules.length; ++j) {
  5285. if (isDef(modules[j][hooks[i]])) {
  5286. cbs[hooks[i]].push(modules[j][hooks[i]]);
  5287. }
  5288. }
  5289. }
  5290. function emptyNodeAt (elm) {
  5291. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  5292. }
  5293. function createRmCb (childElm, listeners) {
  5294. function remove$$1 () {
  5295. if (--remove$$1.listeners === 0) {
  5296. removeNode(childElm);
  5297. }
  5298. }
  5299. remove$$1.listeners = listeners;
  5300. return remove$$1
  5301. }
  5302. function removeNode (el) {
  5303. var parent = nodeOps.parentNode(el);
  5304. // element may have already been removed due to v-html / v-text
  5305. if (isDef(parent)) {
  5306. nodeOps.removeChild(parent, el);
  5307. }
  5308. }
  5309. function isUnknownElement$$1 (vnode, inVPre) {
  5310. return (
  5311. !inVPre &&
  5312. !vnode.ns &&
  5313. !(
  5314. config.ignoredElements.length &&
  5315. config.ignoredElements.some(function (ignore) {
  5316. return isRegExp(ignore)
  5317. ? ignore.test(vnode.tag)
  5318. : ignore === vnode.tag
  5319. })
  5320. ) &&
  5321. config.isUnknownElement(vnode.tag)
  5322. )
  5323. }
  5324. var creatingElmInVPre = 0;
  5325. function createElm (
  5326. vnode,
  5327. insertedVnodeQueue,
  5328. parentElm,
  5329. refElm,
  5330. nested,
  5331. ownerArray,
  5332. index
  5333. ) {
  5334. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5335. // This vnode was used in a previous render!
  5336. // now it's used as a new node, overwriting its elm would cause
  5337. // potential patch errors down the road when it's used as an insertion
  5338. // reference node. Instead, we clone the node on-demand before creating
  5339. // associated DOM element for it.
  5340. vnode = ownerArray[index] = cloneVNode(vnode);
  5341. }
  5342. vnode.isRootInsert = !nested; // for transition enter check
  5343. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  5344. return
  5345. }
  5346. var data = vnode.data;
  5347. var children = vnode.children;
  5348. var tag = vnode.tag;
  5349. if (isDef(tag)) {
  5350. if (process.env.NODE_ENV !== 'production') {
  5351. if (data && data.pre) {
  5352. creatingElmInVPre++;
  5353. }
  5354. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  5355. warn(
  5356. 'Unknown custom element: <' + tag + '> - did you ' +
  5357. 'register the component correctly? For recursive components, ' +
  5358. 'make sure to provide the "name" option.',
  5359. vnode.context
  5360. );
  5361. }
  5362. }
  5363. vnode.elm = vnode.ns
  5364. ? nodeOps.createElementNS(vnode.ns, tag)
  5365. : nodeOps.createElement(tag, vnode);
  5366. setScope(vnode);
  5367. /* istanbul ignore if */
  5368. {
  5369. createChildren(vnode, children, insertedVnodeQueue);
  5370. if (isDef(data)) {
  5371. invokeCreateHooks(vnode, insertedVnodeQueue);
  5372. }
  5373. insert(parentElm, vnode.elm, refElm);
  5374. }
  5375. if (process.env.NODE_ENV !== 'production' && data && data.pre) {
  5376. creatingElmInVPre--;
  5377. }
  5378. } else if (isTrue(vnode.isComment)) {
  5379. vnode.elm = nodeOps.createComment(vnode.text);
  5380. insert(parentElm, vnode.elm, refElm);
  5381. } else {
  5382. vnode.elm = nodeOps.createTextNode(vnode.text);
  5383. insert(parentElm, vnode.elm, refElm);
  5384. }
  5385. }
  5386. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5387. var i = vnode.data;
  5388. if (isDef(i)) {
  5389. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  5390. if (isDef(i = i.hook) && isDef(i = i.init)) {
  5391. i(vnode, false /* hydrating */);
  5392. }
  5393. // after calling the init hook, if the vnode is a child component
  5394. // it should've created a child instance and mounted it. the child
  5395. // component also has set the placeholder vnode's elm.
  5396. // in that case we can just return the element and be done.
  5397. if (isDef(vnode.componentInstance)) {
  5398. initComponent(vnode, insertedVnodeQueue);
  5399. insert(parentElm, vnode.elm, refElm);
  5400. if (isTrue(isReactivated)) {
  5401. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  5402. }
  5403. return true
  5404. }
  5405. }
  5406. }
  5407. function initComponent (vnode, insertedVnodeQueue) {
  5408. if (isDef(vnode.data.pendingInsert)) {
  5409. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  5410. vnode.data.pendingInsert = null;
  5411. }
  5412. vnode.elm = vnode.componentInstance.$el;
  5413. if (isPatchable(vnode)) {
  5414. invokeCreateHooks(vnode, insertedVnodeQueue);
  5415. setScope(vnode);
  5416. } else {
  5417. // empty component root.
  5418. // skip all element-related modules except for ref (#3455)
  5419. registerRef(vnode);
  5420. // make sure to invoke the insert hook
  5421. insertedVnodeQueue.push(vnode);
  5422. }
  5423. }
  5424. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5425. var i;
  5426. // hack for #4339: a reactivated component with inner transition
  5427. // does not trigger because the inner node's created hooks are not called
  5428. // again. It's not ideal to involve module-specific logic in here but
  5429. // there doesn't seem to be a better way to do it.
  5430. var innerNode = vnode;
  5431. while (innerNode.componentInstance) {
  5432. innerNode = innerNode.componentInstance._vnode;
  5433. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  5434. for (i = 0; i < cbs.activate.length; ++i) {
  5435. cbs.activate[i](emptyNode, innerNode);
  5436. }
  5437. insertedVnodeQueue.push(innerNode);
  5438. break
  5439. }
  5440. }
  5441. // unlike a newly created component,
  5442. // a reactivated keep-alive component doesn't insert itself
  5443. insert(parentElm, vnode.elm, refElm);
  5444. }
  5445. function insert (parent, elm, ref$$1) {
  5446. if (isDef(parent)) {
  5447. if (isDef(ref$$1)) {
  5448. if (nodeOps.parentNode(ref$$1) === parent) {
  5449. nodeOps.insertBefore(parent, elm, ref$$1);
  5450. }
  5451. } else {
  5452. nodeOps.appendChild(parent, elm);
  5453. }
  5454. }
  5455. }
  5456. function createChildren (vnode, children, insertedVnodeQueue) {
  5457. if (Array.isArray(children)) {
  5458. if (process.env.NODE_ENV !== 'production') {
  5459. checkDuplicateKeys(children);
  5460. }
  5461. for (var i = 0; i < children.length; ++i) {
  5462. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  5463. }
  5464. } else if (isPrimitive(vnode.text)) {
  5465. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  5466. }
  5467. }
  5468. function isPatchable (vnode) {
  5469. while (vnode.componentInstance) {
  5470. vnode = vnode.componentInstance._vnode;
  5471. }
  5472. return isDef(vnode.tag)
  5473. }
  5474. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  5475. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5476. cbs.create[i$1](emptyNode, vnode);
  5477. }
  5478. i = vnode.data.hook; // Reuse variable
  5479. if (isDef(i)) {
  5480. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  5481. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  5482. }
  5483. }
  5484. // set scope id attribute for scoped CSS.
  5485. // this is implemented as a special case to avoid the overhead
  5486. // of going through the normal attribute patching process.
  5487. function setScope (vnode) {
  5488. var i;
  5489. if (isDef(i = vnode.fnScopeId)) {
  5490. nodeOps.setStyleScope(vnode.elm, i);
  5491. } else {
  5492. var ancestor = vnode;
  5493. while (ancestor) {
  5494. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  5495. nodeOps.setStyleScope(vnode.elm, i);
  5496. }
  5497. ancestor = ancestor.parent;
  5498. }
  5499. }
  5500. // for slot content they should also get the scopeId from the host instance.
  5501. if (isDef(i = activeInstance) &&
  5502. i !== vnode.context &&
  5503. i !== vnode.fnContext &&
  5504. isDef(i = i.$options._scopeId)
  5505. ) {
  5506. nodeOps.setStyleScope(vnode.elm, i);
  5507. }
  5508. }
  5509. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  5510. for (; startIdx <= endIdx; ++startIdx) {
  5511. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  5512. }
  5513. }
  5514. function invokeDestroyHook (vnode) {
  5515. var i, j;
  5516. var data = vnode.data;
  5517. if (isDef(data)) {
  5518. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  5519. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  5520. }
  5521. if (isDef(i = vnode.children)) {
  5522. for (j = 0; j < vnode.children.length; ++j) {
  5523. invokeDestroyHook(vnode.children[j]);
  5524. }
  5525. }
  5526. }
  5527. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  5528. for (; startIdx <= endIdx; ++startIdx) {
  5529. var ch = vnodes[startIdx];
  5530. if (isDef(ch)) {
  5531. if (isDef(ch.tag)) {
  5532. removeAndInvokeRemoveHook(ch);
  5533. invokeDestroyHook(ch);
  5534. } else { // Text node
  5535. removeNode(ch.elm);
  5536. }
  5537. }
  5538. }
  5539. }
  5540. function removeAndInvokeRemoveHook (vnode, rm) {
  5541. if (isDef(rm) || isDef(vnode.data)) {
  5542. var i;
  5543. var listeners = cbs.remove.length + 1;
  5544. if (isDef(rm)) {
  5545. // we have a recursively passed down rm callback
  5546. // increase the listeners count
  5547. rm.listeners += listeners;
  5548. } else {
  5549. // directly removing
  5550. rm = createRmCb(vnode.elm, listeners);
  5551. }
  5552. // recursively invoke hooks on child component root node
  5553. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  5554. removeAndInvokeRemoveHook(i, rm);
  5555. }
  5556. for (i = 0; i < cbs.remove.length; ++i) {
  5557. cbs.remove[i](vnode, rm);
  5558. }
  5559. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  5560. i(vnode, rm);
  5561. } else {
  5562. rm();
  5563. }
  5564. } else {
  5565. removeNode(vnode.elm);
  5566. }
  5567. }
  5568. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  5569. var oldStartIdx = 0;
  5570. var newStartIdx = 0;
  5571. var oldEndIdx = oldCh.length - 1;
  5572. var oldStartVnode = oldCh[0];
  5573. var oldEndVnode = oldCh[oldEndIdx];
  5574. var newEndIdx = newCh.length - 1;
  5575. var newStartVnode = newCh[0];
  5576. var newEndVnode = newCh[newEndIdx];
  5577. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  5578. // removeOnly is a special flag used only by <transition-group>
  5579. // to ensure removed elements stay in correct relative positions
  5580. // during leaving transitions
  5581. var canMove = !removeOnly;
  5582. if (process.env.NODE_ENV !== 'production') {
  5583. checkDuplicateKeys(newCh);
  5584. }
  5585. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  5586. if (isUndef(oldStartVnode)) {
  5587. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  5588. } else if (isUndef(oldEndVnode)) {
  5589. oldEndVnode = oldCh[--oldEndIdx];
  5590. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  5591. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5592. oldStartVnode = oldCh[++oldStartIdx];
  5593. newStartVnode = newCh[++newStartIdx];
  5594. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  5595. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5596. oldEndVnode = oldCh[--oldEndIdx];
  5597. newEndVnode = newCh[--newEndIdx];
  5598. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  5599. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5600. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  5601. oldStartVnode = oldCh[++oldStartIdx];
  5602. newEndVnode = newCh[--newEndIdx];
  5603. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  5604. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5605. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  5606. oldEndVnode = oldCh[--oldEndIdx];
  5607. newStartVnode = newCh[++newStartIdx];
  5608. } else {
  5609. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  5610. idxInOld = isDef(newStartVnode.key)
  5611. ? oldKeyToIdx[newStartVnode.key]
  5612. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  5613. if (isUndef(idxInOld)) { // New element
  5614. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5615. } else {
  5616. vnodeToMove = oldCh[idxInOld];
  5617. if (sameVnode(vnodeToMove, newStartVnode)) {
  5618. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5619. oldCh[idxInOld] = undefined;
  5620. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  5621. } else {
  5622. // same key but different element. treat as new element
  5623. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5624. }
  5625. }
  5626. newStartVnode = newCh[++newStartIdx];
  5627. }
  5628. }
  5629. if (oldStartIdx > oldEndIdx) {
  5630. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  5631. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  5632. } else if (newStartIdx > newEndIdx) {
  5633. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  5634. }
  5635. }
  5636. function checkDuplicateKeys (children) {
  5637. var seenKeys = {};
  5638. for (var i = 0; i < children.length; i++) {
  5639. var vnode = children[i];
  5640. var key = vnode.key;
  5641. if (isDef(key)) {
  5642. if (seenKeys[key]) {
  5643. warn(
  5644. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  5645. vnode.context
  5646. );
  5647. } else {
  5648. seenKeys[key] = true;
  5649. }
  5650. }
  5651. }
  5652. }
  5653. function findIdxInOld (node, oldCh, start, end) {
  5654. for (var i = start; i < end; i++) {
  5655. var c = oldCh[i];
  5656. if (isDef(c) && sameVnode(node, c)) { return i }
  5657. }
  5658. }
  5659. function patchVnode (
  5660. oldVnode,
  5661. vnode,
  5662. insertedVnodeQueue,
  5663. ownerArray,
  5664. index,
  5665. removeOnly
  5666. ) {
  5667. if (oldVnode === vnode) {
  5668. return
  5669. }
  5670. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5671. // clone reused vnode
  5672. vnode = ownerArray[index] = cloneVNode(vnode);
  5673. }
  5674. var elm = vnode.elm = oldVnode.elm;
  5675. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  5676. if (isDef(vnode.asyncFactory.resolved)) {
  5677. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  5678. } else {
  5679. vnode.isAsyncPlaceholder = true;
  5680. }
  5681. return
  5682. }
  5683. // reuse element for static trees.
  5684. // note we only do this if the vnode is cloned -
  5685. // if the new node is not cloned it means the render functions have been
  5686. // reset by the hot-reload-api and we need to do a proper re-render.
  5687. if (isTrue(vnode.isStatic) &&
  5688. isTrue(oldVnode.isStatic) &&
  5689. vnode.key === oldVnode.key &&
  5690. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  5691. ) {
  5692. vnode.componentInstance = oldVnode.componentInstance;
  5693. return
  5694. }
  5695. var i;
  5696. var data = vnode.data;
  5697. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  5698. i(oldVnode, vnode);
  5699. }
  5700. var oldCh = oldVnode.children;
  5701. var ch = vnode.children;
  5702. if (isDef(data) && isPatchable(vnode)) {
  5703. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  5704. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  5705. }
  5706. if (isUndef(vnode.text)) {
  5707. if (isDef(oldCh) && isDef(ch)) {
  5708. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  5709. } else if (isDef(ch)) {
  5710. if (process.env.NODE_ENV !== 'production') {
  5711. checkDuplicateKeys(ch);
  5712. }
  5713. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  5714. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  5715. } else if (isDef(oldCh)) {
  5716. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  5717. } else if (isDef(oldVnode.text)) {
  5718. nodeOps.setTextContent(elm, '');
  5719. }
  5720. } else if (oldVnode.text !== vnode.text) {
  5721. nodeOps.setTextContent(elm, vnode.text);
  5722. }
  5723. if (isDef(data)) {
  5724. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  5725. }
  5726. }
  5727. function invokeInsertHook (vnode, queue, initial) {
  5728. // delay insert hooks for component root nodes, invoke them after the
  5729. // element is really inserted
  5730. if (isTrue(initial) && isDef(vnode.parent)) {
  5731. vnode.parent.data.pendingInsert = queue;
  5732. } else {
  5733. for (var i = 0; i < queue.length; ++i) {
  5734. queue[i].data.hook.insert(queue[i]);
  5735. }
  5736. }
  5737. }
  5738. var hydrationBailed = false;
  5739. // list of modules that can skip create hook during hydration because they
  5740. // are already rendered on the client or has no need for initialization
  5741. // Note: style is excluded because it relies on initial clone for future
  5742. // deep updates (#7063).
  5743. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  5744. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  5745. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  5746. var i;
  5747. var tag = vnode.tag;
  5748. var data = vnode.data;
  5749. var children = vnode.children;
  5750. inVPre = inVPre || (data && data.pre);
  5751. vnode.elm = elm;
  5752. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  5753. vnode.isAsyncPlaceholder = true;
  5754. return true
  5755. }
  5756. // assert node match
  5757. if (process.env.NODE_ENV !== 'production') {
  5758. if (!assertNodeMatch(elm, vnode, inVPre)) {
  5759. return false
  5760. }
  5761. }
  5762. if (isDef(data)) {
  5763. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  5764. if (isDef(i = vnode.componentInstance)) {
  5765. // child component. it should have hydrated its own tree.
  5766. initComponent(vnode, insertedVnodeQueue);
  5767. return true
  5768. }
  5769. }
  5770. if (isDef(tag)) {
  5771. if (isDef(children)) {
  5772. // empty element, allow client to pick up and populate children
  5773. if (!elm.hasChildNodes()) {
  5774. createChildren(vnode, children, insertedVnodeQueue);
  5775. } else {
  5776. // v-html and domProps: innerHTML
  5777. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  5778. if (i !== elm.innerHTML) {
  5779. /* istanbul ignore if */
  5780. if (process.env.NODE_ENV !== 'production' &&
  5781. typeof console !== 'undefined' &&
  5782. !hydrationBailed
  5783. ) {
  5784. hydrationBailed = true;
  5785. console.warn('Parent: ', elm);
  5786. console.warn('server innerHTML: ', i);
  5787. console.warn('client innerHTML: ', elm.innerHTML);
  5788. }
  5789. return false
  5790. }
  5791. } else {
  5792. // iterate and compare children lists
  5793. var childrenMatch = true;
  5794. var childNode = elm.firstChild;
  5795. for (var i$1 = 0; i$1 < children.length; i$1++) {
  5796. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  5797. childrenMatch = false;
  5798. break
  5799. }
  5800. childNode = childNode.nextSibling;
  5801. }
  5802. // if childNode is not null, it means the actual childNodes list is
  5803. // longer than the virtual children list.
  5804. if (!childrenMatch || childNode) {
  5805. /* istanbul ignore if */
  5806. if (process.env.NODE_ENV !== 'production' &&
  5807. typeof console !== 'undefined' &&
  5808. !hydrationBailed
  5809. ) {
  5810. hydrationBailed = true;
  5811. console.warn('Parent: ', elm);
  5812. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  5813. }
  5814. return false
  5815. }
  5816. }
  5817. }
  5818. }
  5819. if (isDef(data)) {
  5820. var fullInvoke = false;
  5821. for (var key in data) {
  5822. if (!isRenderedModule(key)) {
  5823. fullInvoke = true;
  5824. invokeCreateHooks(vnode, insertedVnodeQueue);
  5825. break
  5826. }
  5827. }
  5828. if (!fullInvoke && data['class']) {
  5829. // ensure collecting deps for deep class bindings for future updates
  5830. traverse(data['class']);
  5831. }
  5832. }
  5833. } else if (elm.data !== vnode.text) {
  5834. elm.data = vnode.text;
  5835. }
  5836. return true
  5837. }
  5838. function assertNodeMatch (node, vnode, inVPre) {
  5839. if (isDef(vnode.tag)) {
  5840. return vnode.tag.indexOf('vue-component') === 0 || (
  5841. !isUnknownElement$$1(vnode, inVPre) &&
  5842. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  5843. )
  5844. } else {
  5845. return node.nodeType === (vnode.isComment ? 8 : 3)
  5846. }
  5847. }
  5848. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  5849. if (isUndef(vnode)) {
  5850. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  5851. return
  5852. }
  5853. var isInitialPatch = false;
  5854. var insertedVnodeQueue = [];
  5855. if (isUndef(oldVnode)) {
  5856. // empty mount (likely as component), create new root element
  5857. isInitialPatch = true;
  5858. createElm(vnode, insertedVnodeQueue);
  5859. } else {
  5860. var isRealElement = isDef(oldVnode.nodeType);
  5861. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  5862. // patch existing root node
  5863. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  5864. } else {
  5865. if (isRealElement) {
  5866. // mounting to a real element
  5867. // check if this is server-rendered content and if we can perform
  5868. // a successful hydration.
  5869. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  5870. oldVnode.removeAttribute(SSR_ATTR);
  5871. hydrating = true;
  5872. }
  5873. if (isTrue(hydrating)) {
  5874. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  5875. invokeInsertHook(vnode, insertedVnodeQueue, true);
  5876. return oldVnode
  5877. } else if (process.env.NODE_ENV !== 'production') {
  5878. warn(
  5879. 'The client-side rendered virtual DOM tree is not matching ' +
  5880. 'server-rendered content. This is likely caused by incorrect ' +
  5881. 'HTML markup, for example nesting block-level elements inside ' +
  5882. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  5883. 'full client-side render.'
  5884. );
  5885. }
  5886. }
  5887. // either not server-rendered, or hydration failed.
  5888. // create an empty node and replace it
  5889. oldVnode = emptyNodeAt(oldVnode);
  5890. }
  5891. // replacing existing element
  5892. var oldElm = oldVnode.elm;
  5893. var parentElm = nodeOps.parentNode(oldElm);
  5894. // create new node
  5895. createElm(
  5896. vnode,
  5897. insertedVnodeQueue,
  5898. // extremely rare edge case: do not insert if old element is in a
  5899. // leaving transition. Only happens when combining transition +
  5900. // keep-alive + HOCs. (#4590)
  5901. oldElm._leaveCb ? null : parentElm,
  5902. nodeOps.nextSibling(oldElm)
  5903. );
  5904. // update parent placeholder node element, recursively
  5905. if (isDef(vnode.parent)) {
  5906. var ancestor = vnode.parent;
  5907. var patchable = isPatchable(vnode);
  5908. while (ancestor) {
  5909. for (var i = 0; i < cbs.destroy.length; ++i) {
  5910. cbs.destroy[i](ancestor);
  5911. }
  5912. ancestor.elm = vnode.elm;
  5913. if (patchable) {
  5914. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5915. cbs.create[i$1](emptyNode, ancestor);
  5916. }
  5917. // #6513
  5918. // invoke insert hooks that may have been merged by create hooks.
  5919. // e.g. for directives that uses the "inserted" hook.
  5920. var insert = ancestor.data.hook.insert;
  5921. if (insert.merged) {
  5922. // start at index 1 to avoid re-invoking component mounted hook
  5923. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  5924. insert.fns[i$2]();
  5925. }
  5926. }
  5927. } else {
  5928. registerRef(ancestor);
  5929. }
  5930. ancestor = ancestor.parent;
  5931. }
  5932. }
  5933. // destroy old node
  5934. if (isDef(parentElm)) {
  5935. removeVnodes(parentElm, [oldVnode], 0, 0);
  5936. } else if (isDef(oldVnode.tag)) {
  5937. invokeDestroyHook(oldVnode);
  5938. }
  5939. }
  5940. }
  5941. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  5942. return vnode.elm
  5943. }
  5944. }
  5945. /* */
  5946. var directives = {
  5947. create: updateDirectives,
  5948. update: updateDirectives,
  5949. destroy: function unbindDirectives (vnode) {
  5950. updateDirectives(vnode, emptyNode);
  5951. }
  5952. };
  5953. function updateDirectives (oldVnode, vnode) {
  5954. if (oldVnode.data.directives || vnode.data.directives) {
  5955. _update(oldVnode, vnode);
  5956. }
  5957. }
  5958. function _update (oldVnode, vnode) {
  5959. var isCreate = oldVnode === emptyNode;
  5960. var isDestroy = vnode === emptyNode;
  5961. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  5962. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  5963. var dirsWithInsert = [];
  5964. var dirsWithPostpatch = [];
  5965. var key, oldDir, dir;
  5966. for (key in newDirs) {
  5967. oldDir = oldDirs[key];
  5968. dir = newDirs[key];
  5969. if (!oldDir) {
  5970. // new directive, bind
  5971. callHook$1(dir, 'bind', vnode, oldVnode);
  5972. if (dir.def && dir.def.inserted) {
  5973. dirsWithInsert.push(dir);
  5974. }
  5975. } else {
  5976. // existing directive, update
  5977. dir.oldValue = oldDir.value;
  5978. dir.oldArg = oldDir.arg;
  5979. callHook$1(dir, 'update', vnode, oldVnode);
  5980. if (dir.def && dir.def.componentUpdated) {
  5981. dirsWithPostpatch.push(dir);
  5982. }
  5983. }
  5984. }
  5985. if (dirsWithInsert.length) {
  5986. var callInsert = function () {
  5987. for (var i = 0; i < dirsWithInsert.length; i++) {
  5988. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  5989. }
  5990. };
  5991. if (isCreate) {
  5992. mergeVNodeHook(vnode, 'insert', callInsert);
  5993. } else {
  5994. callInsert();
  5995. }
  5996. }
  5997. if (dirsWithPostpatch.length) {
  5998. mergeVNodeHook(vnode, 'postpatch', function () {
  5999. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  6000. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  6001. }
  6002. });
  6003. }
  6004. if (!isCreate) {
  6005. for (key in oldDirs) {
  6006. if (!newDirs[key]) {
  6007. // no longer present, unbind
  6008. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  6009. }
  6010. }
  6011. }
  6012. }
  6013. var emptyModifiers = Object.create(null);
  6014. function normalizeDirectives$1 (
  6015. dirs,
  6016. vm
  6017. ) {
  6018. var res = Object.create(null);
  6019. if (!dirs) {
  6020. // $flow-disable-line
  6021. return res
  6022. }
  6023. var i, dir;
  6024. for (i = 0; i < dirs.length; i++) {
  6025. dir = dirs[i];
  6026. if (!dir.modifiers) {
  6027. // $flow-disable-line
  6028. dir.modifiers = emptyModifiers;
  6029. }
  6030. res[getRawDirName(dir)] = dir;
  6031. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  6032. }
  6033. // $flow-disable-line
  6034. return res
  6035. }
  6036. function getRawDirName (dir) {
  6037. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  6038. }
  6039. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  6040. var fn = dir.def && dir.def[hook];
  6041. if (fn) {
  6042. try {
  6043. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  6044. } catch (e) {
  6045. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  6046. }
  6047. }
  6048. }
  6049. var baseModules = [
  6050. ref,
  6051. directives
  6052. ];
  6053. /* */
  6054. function updateAttrs (oldVnode, vnode) {
  6055. var opts = vnode.componentOptions;
  6056. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  6057. return
  6058. }
  6059. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  6060. return
  6061. }
  6062. var key, cur, old;
  6063. var elm = vnode.elm;
  6064. var oldAttrs = oldVnode.data.attrs || {};
  6065. var attrs = vnode.data.attrs || {};
  6066. // clone observed objects, as the user probably wants to mutate it
  6067. if (isDef(attrs.__ob__)) {
  6068. attrs = vnode.data.attrs = extend({}, attrs);
  6069. }
  6070. for (key in attrs) {
  6071. cur = attrs[key];
  6072. old = oldAttrs[key];
  6073. if (old !== cur) {
  6074. setAttr(elm, key, cur);
  6075. }
  6076. }
  6077. // #4391: in IE9, setting type can reset value for input[type=radio]
  6078. // #6666: IE/Edge forces progress value down to 1 before setting a max
  6079. /* istanbul ignore if */
  6080. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  6081. setAttr(elm, 'value', attrs.value);
  6082. }
  6083. for (key in oldAttrs) {
  6084. if (isUndef(attrs[key])) {
  6085. if (isXlink(key)) {
  6086. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6087. } else if (!isEnumeratedAttr(key)) {
  6088. elm.removeAttribute(key);
  6089. }
  6090. }
  6091. }
  6092. }
  6093. function setAttr (el, key, value) {
  6094. if (el.tagName.indexOf('-') > -1) {
  6095. baseSetAttr(el, key, value);
  6096. } else if (isBooleanAttr(key)) {
  6097. // set attribute for blank value
  6098. // e.g. <option disabled>Select one</option>
  6099. if (isFalsyAttrValue(value)) {
  6100. el.removeAttribute(key);
  6101. } else {
  6102. // technically allowfullscreen is a boolean attribute for <iframe>,
  6103. // but Flash expects a value of "true" when used on <embed> tag
  6104. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  6105. ? 'true'
  6106. : key;
  6107. el.setAttribute(key, value);
  6108. }
  6109. } else if (isEnumeratedAttr(key)) {
  6110. el.setAttribute(key, convertEnumeratedValue(key, value));
  6111. } else if (isXlink(key)) {
  6112. if (isFalsyAttrValue(value)) {
  6113. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6114. } else {
  6115. el.setAttributeNS(xlinkNS, key, value);
  6116. }
  6117. } else {
  6118. baseSetAttr(el, key, value);
  6119. }
  6120. }
  6121. function baseSetAttr (el, key, value) {
  6122. if (isFalsyAttrValue(value)) {
  6123. el.removeAttribute(key);
  6124. } else {
  6125. // #7138: IE10 & 11 fires input event when setting placeholder on
  6126. // <textarea>... block the first input event and remove the blocker
  6127. // immediately.
  6128. /* istanbul ignore if */
  6129. if (
  6130. isIE && !isIE9 &&
  6131. el.tagName === 'TEXTAREA' &&
  6132. key === 'placeholder' && value !== '' && !el.__ieph
  6133. ) {
  6134. var blocker = function (e) {
  6135. e.stopImmediatePropagation();
  6136. el.removeEventListener('input', blocker);
  6137. };
  6138. el.addEventListener('input', blocker);
  6139. // $flow-disable-line
  6140. el.__ieph = true; /* IE placeholder patched */
  6141. }
  6142. el.setAttribute(key, value);
  6143. }
  6144. }
  6145. var attrs = {
  6146. create: updateAttrs,
  6147. update: updateAttrs
  6148. };
  6149. /* */
  6150. function updateClass (oldVnode, vnode) {
  6151. var el = vnode.elm;
  6152. var data = vnode.data;
  6153. var oldData = oldVnode.data;
  6154. if (
  6155. isUndef(data.staticClass) &&
  6156. isUndef(data.class) && (
  6157. isUndef(oldData) || (
  6158. isUndef(oldData.staticClass) &&
  6159. isUndef(oldData.class)
  6160. )
  6161. )
  6162. ) {
  6163. return
  6164. }
  6165. var cls = genClassForVnode(vnode);
  6166. // handle transition classes
  6167. var transitionClass = el._transitionClasses;
  6168. if (isDef(transitionClass)) {
  6169. cls = concat(cls, stringifyClass(transitionClass));
  6170. }
  6171. // set the class
  6172. if (cls !== el._prevClass) {
  6173. el.setAttribute('class', cls);
  6174. el._prevClass = cls;
  6175. }
  6176. }
  6177. var klass = {
  6178. create: updateClass,
  6179. update: updateClass
  6180. };
  6181. /* */
  6182. /* */
  6183. /* */
  6184. /* */
  6185. // in some cases, the event used has to be determined at runtime
  6186. // so we used some reserved tokens during compile.
  6187. var RANGE_TOKEN = '__r';
  6188. var CHECKBOX_RADIO_TOKEN = '__c';
  6189. /* */
  6190. // normalize v-model event tokens that can only be determined at runtime.
  6191. // it's important to place the event as the first in the array because
  6192. // the whole point is ensuring the v-model callback gets called before
  6193. // user-attached handlers.
  6194. function normalizeEvents (on) {
  6195. /* istanbul ignore if */
  6196. if (isDef(on[RANGE_TOKEN])) {
  6197. // IE input[type=range] only supports `change` event
  6198. var event = isIE ? 'change' : 'input';
  6199. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  6200. delete on[RANGE_TOKEN];
  6201. }
  6202. // This was originally intended to fix #4521 but no longer necessary
  6203. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  6204. /* istanbul ignore if */
  6205. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  6206. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  6207. delete on[CHECKBOX_RADIO_TOKEN];
  6208. }
  6209. }
  6210. var target$1;
  6211. function createOnceHandler$1 (event, handler, capture) {
  6212. var _target = target$1; // save current target element in closure
  6213. return function onceHandler () {
  6214. var res = handler.apply(null, arguments);
  6215. if (res !== null) {
  6216. remove$2(event, onceHandler, capture, _target);
  6217. }
  6218. }
  6219. }
  6220. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  6221. // implementation and does not fire microtasks in between event propagation, so
  6222. // safe to exclude.
  6223. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  6224. function add$1 (
  6225. name,
  6226. handler,
  6227. capture,
  6228. passive
  6229. ) {
  6230. // async edge case #6566: inner click event triggers patch, event handler
  6231. // attached to outer element during patch, and triggered again. This
  6232. // happens because browsers fire microtask ticks between event propagation.
  6233. // the solution is simple: we save the timestamp when a handler is attached,
  6234. // and the handler would only fire if the event passed to it was fired
  6235. // AFTER it was attached.
  6236. if (useMicrotaskFix) {
  6237. var attachedTimestamp = currentFlushTimestamp;
  6238. var original = handler;
  6239. handler = original._wrapper = function (e) {
  6240. if (
  6241. // no bubbling, should always fire.
  6242. // this is just a safety net in case event.timeStamp is unreliable in
  6243. // certain weird environments...
  6244. e.target === e.currentTarget ||
  6245. // event is fired after handler attachment
  6246. e.timeStamp >= attachedTimestamp ||
  6247. // bail for environments that have buggy event.timeStamp implementations
  6248. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  6249. // #9681 QtWebEngine event.timeStamp is negative value
  6250. e.timeStamp <= 0 ||
  6251. // #9448 bail if event is fired in another document in a multi-page
  6252. // electron/nw.js app, since event.timeStamp will be using a different
  6253. // starting reference
  6254. e.target.ownerDocument !== document
  6255. ) {
  6256. return original.apply(this, arguments)
  6257. }
  6258. };
  6259. }
  6260. target$1.addEventListener(
  6261. name,
  6262. handler,
  6263. supportsPassive
  6264. ? { capture: capture, passive: passive }
  6265. : capture
  6266. );
  6267. }
  6268. function remove$2 (
  6269. name,
  6270. handler,
  6271. capture,
  6272. _target
  6273. ) {
  6274. (_target || target$1).removeEventListener(
  6275. name,
  6276. handler._wrapper || handler,
  6277. capture
  6278. );
  6279. }
  6280. function updateDOMListeners (oldVnode, vnode) {
  6281. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  6282. return
  6283. }
  6284. var on = vnode.data.on || {};
  6285. var oldOn = oldVnode.data.on || {};
  6286. target$1 = vnode.elm;
  6287. normalizeEvents(on);
  6288. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  6289. target$1 = undefined;
  6290. }
  6291. var events = {
  6292. create: updateDOMListeners,
  6293. update: updateDOMListeners
  6294. };
  6295. /* */
  6296. var svgContainer;
  6297. function updateDOMProps (oldVnode, vnode) {
  6298. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  6299. return
  6300. }
  6301. var key, cur;
  6302. var elm = vnode.elm;
  6303. var oldProps = oldVnode.data.domProps || {};
  6304. var props = vnode.data.domProps || {};
  6305. // clone observed objects, as the user probably wants to mutate it
  6306. if (isDef(props.__ob__)) {
  6307. props = vnode.data.domProps = extend({}, props);
  6308. }
  6309. for (key in oldProps) {
  6310. if (!(key in props)) {
  6311. elm[key] = '';
  6312. }
  6313. }
  6314. for (key in props) {
  6315. cur = props[key];
  6316. // ignore children if the node has textContent or innerHTML,
  6317. // as these will throw away existing DOM nodes and cause removal errors
  6318. // on subsequent patches (#3360)
  6319. if (key === 'textContent' || key === 'innerHTML') {
  6320. if (vnode.children) { vnode.children.length = 0; }
  6321. if (cur === oldProps[key]) { continue }
  6322. // #6601 work around Chrome version <= 55 bug where single textNode
  6323. // replaced by innerHTML/textContent retains its parentNode property
  6324. if (elm.childNodes.length === 1) {
  6325. elm.removeChild(elm.childNodes[0]);
  6326. }
  6327. }
  6328. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  6329. // store value as _value as well since
  6330. // non-string values will be stringified
  6331. elm._value = cur;
  6332. // avoid resetting cursor position when value is the same
  6333. var strCur = isUndef(cur) ? '' : String(cur);
  6334. if (shouldUpdateValue(elm, strCur)) {
  6335. elm.value = strCur;
  6336. }
  6337. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  6338. // IE doesn't support innerHTML for SVG elements
  6339. svgContainer = svgContainer || document.createElement('div');
  6340. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  6341. var svg = svgContainer.firstChild;
  6342. while (elm.firstChild) {
  6343. elm.removeChild(elm.firstChild);
  6344. }
  6345. while (svg.firstChild) {
  6346. elm.appendChild(svg.firstChild);
  6347. }
  6348. } else if (
  6349. // skip the update if old and new VDOM state is the same.
  6350. // `value` is handled separately because the DOM value may be temporarily
  6351. // out of sync with VDOM state due to focus, composition and modifiers.
  6352. // This #4521 by skipping the unnecesarry `checked` update.
  6353. cur !== oldProps[key]
  6354. ) {
  6355. // some property updates can throw
  6356. // e.g. `value` on <progress> w/ non-finite value
  6357. try {
  6358. elm[key] = cur;
  6359. } catch (e) {}
  6360. }
  6361. }
  6362. }
  6363. // check platforms/web/util/attrs.js acceptValue
  6364. function shouldUpdateValue (elm, checkVal) {
  6365. return (!elm.composing && (
  6366. elm.tagName === 'OPTION' ||
  6367. isNotInFocusAndDirty(elm, checkVal) ||
  6368. isDirtyWithModifiers(elm, checkVal)
  6369. ))
  6370. }
  6371. function isNotInFocusAndDirty (elm, checkVal) {
  6372. // return true when textbox (.number and .trim) loses focus and its value is
  6373. // not equal to the updated value
  6374. var notInFocus = true;
  6375. // #6157
  6376. // work around IE bug when accessing document.activeElement in an iframe
  6377. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  6378. return notInFocus && elm.value !== checkVal
  6379. }
  6380. function isDirtyWithModifiers (elm, newVal) {
  6381. var value = elm.value;
  6382. var modifiers = elm._vModifiers; // injected by v-model runtime
  6383. if (isDef(modifiers)) {
  6384. if (modifiers.number) {
  6385. return toNumber(value) !== toNumber(newVal)
  6386. }
  6387. if (modifiers.trim) {
  6388. return value.trim() !== newVal.trim()
  6389. }
  6390. }
  6391. return value !== newVal
  6392. }
  6393. var domProps = {
  6394. create: updateDOMProps,
  6395. update: updateDOMProps
  6396. };
  6397. /* */
  6398. var parseStyleText = cached(function (cssText) {
  6399. var res = {};
  6400. var listDelimiter = /;(?![^(]*\))/g;
  6401. var propertyDelimiter = /:(.+)/;
  6402. cssText.split(listDelimiter).forEach(function (item) {
  6403. if (item) {
  6404. var tmp = item.split(propertyDelimiter);
  6405. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6406. }
  6407. });
  6408. return res
  6409. });
  6410. // merge static and dynamic style data on the same vnode
  6411. function normalizeStyleData (data) {
  6412. var style = normalizeStyleBinding(data.style);
  6413. // static style is pre-processed into an object during compilation
  6414. // and is always a fresh object, so it's safe to merge into it
  6415. return data.staticStyle
  6416. ? extend(data.staticStyle, style)
  6417. : style
  6418. }
  6419. // normalize possible array / string values into Object
  6420. function normalizeStyleBinding (bindingStyle) {
  6421. if (Array.isArray(bindingStyle)) {
  6422. return toObject(bindingStyle)
  6423. }
  6424. if (typeof bindingStyle === 'string') {
  6425. return parseStyleText(bindingStyle)
  6426. }
  6427. return bindingStyle
  6428. }
  6429. /**
  6430. * parent component style should be after child's
  6431. * so that parent component's style could override it
  6432. */
  6433. function getStyle (vnode, checkChild) {
  6434. var res = {};
  6435. var styleData;
  6436. if (checkChild) {
  6437. var childNode = vnode;
  6438. while (childNode.componentInstance) {
  6439. childNode = childNode.componentInstance._vnode;
  6440. if (
  6441. childNode && childNode.data &&
  6442. (styleData = normalizeStyleData(childNode.data))
  6443. ) {
  6444. extend(res, styleData);
  6445. }
  6446. }
  6447. }
  6448. if ((styleData = normalizeStyleData(vnode.data))) {
  6449. extend(res, styleData);
  6450. }
  6451. var parentNode = vnode;
  6452. while ((parentNode = parentNode.parent)) {
  6453. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  6454. extend(res, styleData);
  6455. }
  6456. }
  6457. return res
  6458. }
  6459. /* */
  6460. var cssVarRE = /^--/;
  6461. var importantRE = /\s*!important$/;
  6462. var setProp = function (el, name, val) {
  6463. /* istanbul ignore if */
  6464. if (cssVarRE.test(name)) {
  6465. el.style.setProperty(name, val);
  6466. } else if (importantRE.test(val)) {
  6467. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  6468. } else {
  6469. var normalizedName = normalize(name);
  6470. if (Array.isArray(val)) {
  6471. // Support values array created by autoprefixer, e.g.
  6472. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  6473. // Set them one by one, and the browser will only set those it can recognize
  6474. for (var i = 0, len = val.length; i < len; i++) {
  6475. el.style[normalizedName] = val[i];
  6476. }
  6477. } else {
  6478. el.style[normalizedName] = val;
  6479. }
  6480. }
  6481. };
  6482. var vendorNames = ['Webkit', 'Moz', 'ms'];
  6483. var emptyStyle;
  6484. var normalize = cached(function (prop) {
  6485. emptyStyle = emptyStyle || document.createElement('div').style;
  6486. prop = camelize(prop);
  6487. if (prop !== 'filter' && (prop in emptyStyle)) {
  6488. return prop
  6489. }
  6490. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  6491. for (var i = 0; i < vendorNames.length; i++) {
  6492. var name = vendorNames[i] + capName;
  6493. if (name in emptyStyle) {
  6494. return name
  6495. }
  6496. }
  6497. });
  6498. function updateStyle (oldVnode, vnode) {
  6499. var data = vnode.data;
  6500. var oldData = oldVnode.data;
  6501. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  6502. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  6503. ) {
  6504. return
  6505. }
  6506. var cur, name;
  6507. var el = vnode.elm;
  6508. var oldStaticStyle = oldData.staticStyle;
  6509. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  6510. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  6511. var oldStyle = oldStaticStyle || oldStyleBinding;
  6512. var style = normalizeStyleBinding(vnode.data.style) || {};
  6513. // store normalized style under a different key for next diff
  6514. // make sure to clone it if it's reactive, since the user likely wants
  6515. // to mutate it.
  6516. vnode.data.normalizedStyle = isDef(style.__ob__)
  6517. ? extend({}, style)
  6518. : style;
  6519. var newStyle = getStyle(vnode, true);
  6520. for (name in oldStyle) {
  6521. if (isUndef(newStyle[name])) {
  6522. setProp(el, name, '');
  6523. }
  6524. }
  6525. for (name in newStyle) {
  6526. cur = newStyle[name];
  6527. if (cur !== oldStyle[name]) {
  6528. // ie9 setting to null has no effect, must use empty string
  6529. setProp(el, name, cur == null ? '' : cur);
  6530. }
  6531. }
  6532. }
  6533. var style = {
  6534. create: updateStyle,
  6535. update: updateStyle
  6536. };
  6537. /* */
  6538. var whitespaceRE = /\s+/;
  6539. /**
  6540. * Add class with compatibility for SVG since classList is not supported on
  6541. * SVG elements in IE
  6542. */
  6543. function addClass (el, cls) {
  6544. /* istanbul ignore if */
  6545. if (!cls || !(cls = cls.trim())) {
  6546. return
  6547. }
  6548. /* istanbul ignore else */
  6549. if (el.classList) {
  6550. if (cls.indexOf(' ') > -1) {
  6551. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  6552. } else {
  6553. el.classList.add(cls);
  6554. }
  6555. } else {
  6556. var cur = " " + (el.getAttribute('class') || '') + " ";
  6557. if (cur.indexOf(' ' + cls + ' ') < 0) {
  6558. el.setAttribute('class', (cur + cls).trim());
  6559. }
  6560. }
  6561. }
  6562. /**
  6563. * Remove class with compatibility for SVG since classList is not supported on
  6564. * SVG elements in IE
  6565. */
  6566. function removeClass (el, cls) {
  6567. /* istanbul ignore if */
  6568. if (!cls || !(cls = cls.trim())) {
  6569. return
  6570. }
  6571. /* istanbul ignore else */
  6572. if (el.classList) {
  6573. if (cls.indexOf(' ') > -1) {
  6574. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  6575. } else {
  6576. el.classList.remove(cls);
  6577. }
  6578. if (!el.classList.length) {
  6579. el.removeAttribute('class');
  6580. }
  6581. } else {
  6582. var cur = " " + (el.getAttribute('class') || '') + " ";
  6583. var tar = ' ' + cls + ' ';
  6584. while (cur.indexOf(tar) >= 0) {
  6585. cur = cur.replace(tar, ' ');
  6586. }
  6587. cur = cur.trim();
  6588. if (cur) {
  6589. el.setAttribute('class', cur);
  6590. } else {
  6591. el.removeAttribute('class');
  6592. }
  6593. }
  6594. }
  6595. /* */
  6596. function resolveTransition (def$$1) {
  6597. if (!def$$1) {
  6598. return
  6599. }
  6600. /* istanbul ignore else */
  6601. if (typeof def$$1 === 'object') {
  6602. var res = {};
  6603. if (def$$1.css !== false) {
  6604. extend(res, autoCssTransition(def$$1.name || 'v'));
  6605. }
  6606. extend(res, def$$1);
  6607. return res
  6608. } else if (typeof def$$1 === 'string') {
  6609. return autoCssTransition(def$$1)
  6610. }
  6611. }
  6612. var autoCssTransition = cached(function (name) {
  6613. return {
  6614. enterClass: (name + "-enter"),
  6615. enterToClass: (name + "-enter-to"),
  6616. enterActiveClass: (name + "-enter-active"),
  6617. leaveClass: (name + "-leave"),
  6618. leaveToClass: (name + "-leave-to"),
  6619. leaveActiveClass: (name + "-leave-active")
  6620. }
  6621. });
  6622. var hasTransition = inBrowser && !isIE9;
  6623. var TRANSITION = 'transition';
  6624. var ANIMATION = 'animation';
  6625. // Transition property/event sniffing
  6626. var transitionProp = 'transition';
  6627. var transitionEndEvent = 'transitionend';
  6628. var animationProp = 'animation';
  6629. var animationEndEvent = 'animationend';
  6630. if (hasTransition) {
  6631. /* istanbul ignore if */
  6632. if (window.ontransitionend === undefined &&
  6633. window.onwebkittransitionend !== undefined
  6634. ) {
  6635. transitionProp = 'WebkitTransition';
  6636. transitionEndEvent = 'webkitTransitionEnd';
  6637. }
  6638. if (window.onanimationend === undefined &&
  6639. window.onwebkitanimationend !== undefined
  6640. ) {
  6641. animationProp = 'WebkitAnimation';
  6642. animationEndEvent = 'webkitAnimationEnd';
  6643. }
  6644. }
  6645. // binding to window is necessary to make hot reload work in IE in strict mode
  6646. var raf = inBrowser
  6647. ? window.requestAnimationFrame
  6648. ? window.requestAnimationFrame.bind(window)
  6649. : setTimeout
  6650. : /* istanbul ignore next */ function (fn) { return fn(); };
  6651. function nextFrame (fn) {
  6652. raf(function () {
  6653. raf(fn);
  6654. });
  6655. }
  6656. function addTransitionClass (el, cls) {
  6657. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  6658. if (transitionClasses.indexOf(cls) < 0) {
  6659. transitionClasses.push(cls);
  6660. addClass(el, cls);
  6661. }
  6662. }
  6663. function removeTransitionClass (el, cls) {
  6664. if (el._transitionClasses) {
  6665. remove(el._transitionClasses, cls);
  6666. }
  6667. removeClass(el, cls);
  6668. }
  6669. function whenTransitionEnds (
  6670. el,
  6671. expectedType,
  6672. cb
  6673. ) {
  6674. var ref = getTransitionInfo(el, expectedType);
  6675. var type = ref.type;
  6676. var timeout = ref.timeout;
  6677. var propCount = ref.propCount;
  6678. if (!type) { return cb() }
  6679. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  6680. var ended = 0;
  6681. var end = function () {
  6682. el.removeEventListener(event, onEnd);
  6683. cb();
  6684. };
  6685. var onEnd = function (e) {
  6686. if (e.target === el) {
  6687. if (++ended >= propCount) {
  6688. end();
  6689. }
  6690. }
  6691. };
  6692. setTimeout(function () {
  6693. if (ended < propCount) {
  6694. end();
  6695. }
  6696. }, timeout + 1);
  6697. el.addEventListener(event, onEnd);
  6698. }
  6699. var transformRE = /\b(transform|all)(,|$)/;
  6700. function getTransitionInfo (el, expectedType) {
  6701. var styles = window.getComputedStyle(el);
  6702. // JSDOM may return undefined for transition properties
  6703. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  6704. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  6705. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  6706. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  6707. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  6708. var animationTimeout = getTimeout(animationDelays, animationDurations);
  6709. var type;
  6710. var timeout = 0;
  6711. var propCount = 0;
  6712. /* istanbul ignore if */
  6713. if (expectedType === TRANSITION) {
  6714. if (transitionTimeout > 0) {
  6715. type = TRANSITION;
  6716. timeout = transitionTimeout;
  6717. propCount = transitionDurations.length;
  6718. }
  6719. } else if (expectedType === ANIMATION) {
  6720. if (animationTimeout > 0) {
  6721. type = ANIMATION;
  6722. timeout = animationTimeout;
  6723. propCount = animationDurations.length;
  6724. }
  6725. } else {
  6726. timeout = Math.max(transitionTimeout, animationTimeout);
  6727. type = timeout > 0
  6728. ? transitionTimeout > animationTimeout
  6729. ? TRANSITION
  6730. : ANIMATION
  6731. : null;
  6732. propCount = type
  6733. ? type === TRANSITION
  6734. ? transitionDurations.length
  6735. : animationDurations.length
  6736. : 0;
  6737. }
  6738. var hasTransform =
  6739. type === TRANSITION &&
  6740. transformRE.test(styles[transitionProp + 'Property']);
  6741. return {
  6742. type: type,
  6743. timeout: timeout,
  6744. propCount: propCount,
  6745. hasTransform: hasTransform
  6746. }
  6747. }
  6748. function getTimeout (delays, durations) {
  6749. /* istanbul ignore next */
  6750. while (delays.length < durations.length) {
  6751. delays = delays.concat(delays);
  6752. }
  6753. return Math.max.apply(null, durations.map(function (d, i) {
  6754. return toMs(d) + toMs(delays[i])
  6755. }))
  6756. }
  6757. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  6758. // in a locale-dependent way, using a comma instead of a dot.
  6759. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  6760. // as a floor function) causing unexpected behaviors
  6761. function toMs (s) {
  6762. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  6763. }
  6764. /* */
  6765. function enter (vnode, toggleDisplay) {
  6766. var el = vnode.elm;
  6767. // call leave callback now
  6768. if (isDef(el._leaveCb)) {
  6769. el._leaveCb.cancelled = true;
  6770. el._leaveCb();
  6771. }
  6772. var data = resolveTransition(vnode.data.transition);
  6773. if (isUndef(data)) {
  6774. return
  6775. }
  6776. /* istanbul ignore if */
  6777. if (isDef(el._enterCb) || el.nodeType !== 1) {
  6778. return
  6779. }
  6780. var css = data.css;
  6781. var type = data.type;
  6782. var enterClass = data.enterClass;
  6783. var enterToClass = data.enterToClass;
  6784. var enterActiveClass = data.enterActiveClass;
  6785. var appearClass = data.appearClass;
  6786. var appearToClass = data.appearToClass;
  6787. var appearActiveClass = data.appearActiveClass;
  6788. var beforeEnter = data.beforeEnter;
  6789. var enter = data.enter;
  6790. var afterEnter = data.afterEnter;
  6791. var enterCancelled = data.enterCancelled;
  6792. var beforeAppear = data.beforeAppear;
  6793. var appear = data.appear;
  6794. var afterAppear = data.afterAppear;
  6795. var appearCancelled = data.appearCancelled;
  6796. var duration = data.duration;
  6797. // activeInstance will always be the <transition> component managing this
  6798. // transition. One edge case to check is when the <transition> is placed
  6799. // as the root node of a child component. In that case we need to check
  6800. // <transition>'s parent for appear check.
  6801. var context = activeInstance;
  6802. var transitionNode = activeInstance.$vnode;
  6803. while (transitionNode && transitionNode.parent) {
  6804. context = transitionNode.context;
  6805. transitionNode = transitionNode.parent;
  6806. }
  6807. var isAppear = !context._isMounted || !vnode.isRootInsert;
  6808. if (isAppear && !appear && appear !== '') {
  6809. return
  6810. }
  6811. var startClass = isAppear && appearClass
  6812. ? appearClass
  6813. : enterClass;
  6814. var activeClass = isAppear && appearActiveClass
  6815. ? appearActiveClass
  6816. : enterActiveClass;
  6817. var toClass = isAppear && appearToClass
  6818. ? appearToClass
  6819. : enterToClass;
  6820. var beforeEnterHook = isAppear
  6821. ? (beforeAppear || beforeEnter)
  6822. : beforeEnter;
  6823. var enterHook = isAppear
  6824. ? (typeof appear === 'function' ? appear : enter)
  6825. : enter;
  6826. var afterEnterHook = isAppear
  6827. ? (afterAppear || afterEnter)
  6828. : afterEnter;
  6829. var enterCancelledHook = isAppear
  6830. ? (appearCancelled || enterCancelled)
  6831. : enterCancelled;
  6832. var explicitEnterDuration = toNumber(
  6833. isObject(duration)
  6834. ? duration.enter
  6835. : duration
  6836. );
  6837. if (process.env.NODE_ENV !== 'production' && explicitEnterDuration != null) {
  6838. checkDuration(explicitEnterDuration, 'enter', vnode);
  6839. }
  6840. var expectsCSS = css !== false && !isIE9;
  6841. var userWantsControl = getHookArgumentsLength(enterHook);
  6842. var cb = el._enterCb = once(function () {
  6843. if (expectsCSS) {
  6844. removeTransitionClass(el, toClass);
  6845. removeTransitionClass(el, activeClass);
  6846. }
  6847. if (cb.cancelled) {
  6848. if (expectsCSS) {
  6849. removeTransitionClass(el, startClass);
  6850. }
  6851. enterCancelledHook && enterCancelledHook(el);
  6852. } else {
  6853. afterEnterHook && afterEnterHook(el);
  6854. }
  6855. el._enterCb = null;
  6856. });
  6857. if (!vnode.data.show) {
  6858. // remove pending leave element on enter by injecting an insert hook
  6859. mergeVNodeHook(vnode, 'insert', function () {
  6860. var parent = el.parentNode;
  6861. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  6862. if (pendingNode &&
  6863. pendingNode.tag === vnode.tag &&
  6864. pendingNode.elm._leaveCb
  6865. ) {
  6866. pendingNode.elm._leaveCb();
  6867. }
  6868. enterHook && enterHook(el, cb);
  6869. });
  6870. }
  6871. // start enter transition
  6872. beforeEnterHook && beforeEnterHook(el);
  6873. if (expectsCSS) {
  6874. addTransitionClass(el, startClass);
  6875. addTransitionClass(el, activeClass);
  6876. nextFrame(function () {
  6877. removeTransitionClass(el, startClass);
  6878. if (!cb.cancelled) {
  6879. addTransitionClass(el, toClass);
  6880. if (!userWantsControl) {
  6881. if (isValidDuration(explicitEnterDuration)) {
  6882. setTimeout(cb, explicitEnterDuration);
  6883. } else {
  6884. whenTransitionEnds(el, type, cb);
  6885. }
  6886. }
  6887. }
  6888. });
  6889. }
  6890. if (vnode.data.show) {
  6891. toggleDisplay && toggleDisplay();
  6892. enterHook && enterHook(el, cb);
  6893. }
  6894. if (!expectsCSS && !userWantsControl) {
  6895. cb();
  6896. }
  6897. }
  6898. function leave (vnode, rm) {
  6899. var el = vnode.elm;
  6900. // call enter callback now
  6901. if (isDef(el._enterCb)) {
  6902. el._enterCb.cancelled = true;
  6903. el._enterCb();
  6904. }
  6905. var data = resolveTransition(vnode.data.transition);
  6906. if (isUndef(data) || el.nodeType !== 1) {
  6907. return rm()
  6908. }
  6909. /* istanbul ignore if */
  6910. if (isDef(el._leaveCb)) {
  6911. return
  6912. }
  6913. var css = data.css;
  6914. var type = data.type;
  6915. var leaveClass = data.leaveClass;
  6916. var leaveToClass = data.leaveToClass;
  6917. var leaveActiveClass = data.leaveActiveClass;
  6918. var beforeLeave = data.beforeLeave;
  6919. var leave = data.leave;
  6920. var afterLeave = data.afterLeave;
  6921. var leaveCancelled = data.leaveCancelled;
  6922. var delayLeave = data.delayLeave;
  6923. var duration = data.duration;
  6924. var expectsCSS = css !== false && !isIE9;
  6925. var userWantsControl = getHookArgumentsLength(leave);
  6926. var explicitLeaveDuration = toNumber(
  6927. isObject(duration)
  6928. ? duration.leave
  6929. : duration
  6930. );
  6931. if (process.env.NODE_ENV !== 'production' && isDef(explicitLeaveDuration)) {
  6932. checkDuration(explicitLeaveDuration, 'leave', vnode);
  6933. }
  6934. var cb = el._leaveCb = once(function () {
  6935. if (el.parentNode && el.parentNode._pending) {
  6936. el.parentNode._pending[vnode.key] = null;
  6937. }
  6938. if (expectsCSS) {
  6939. removeTransitionClass(el, leaveToClass);
  6940. removeTransitionClass(el, leaveActiveClass);
  6941. }
  6942. if (cb.cancelled) {
  6943. if (expectsCSS) {
  6944. removeTransitionClass(el, leaveClass);
  6945. }
  6946. leaveCancelled && leaveCancelled(el);
  6947. } else {
  6948. rm();
  6949. afterLeave && afterLeave(el);
  6950. }
  6951. el._leaveCb = null;
  6952. });
  6953. if (delayLeave) {
  6954. delayLeave(performLeave);
  6955. } else {
  6956. performLeave();
  6957. }
  6958. function performLeave () {
  6959. // the delayed leave may have already been cancelled
  6960. if (cb.cancelled) {
  6961. return
  6962. }
  6963. // record leaving element
  6964. if (!vnode.data.show && el.parentNode) {
  6965. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  6966. }
  6967. beforeLeave && beforeLeave(el);
  6968. if (expectsCSS) {
  6969. addTransitionClass(el, leaveClass);
  6970. addTransitionClass(el, leaveActiveClass);
  6971. nextFrame(function () {
  6972. removeTransitionClass(el, leaveClass);
  6973. if (!cb.cancelled) {
  6974. addTransitionClass(el, leaveToClass);
  6975. if (!userWantsControl) {
  6976. if (isValidDuration(explicitLeaveDuration)) {
  6977. setTimeout(cb, explicitLeaveDuration);
  6978. } else {
  6979. whenTransitionEnds(el, type, cb);
  6980. }
  6981. }
  6982. }
  6983. });
  6984. }
  6985. leave && leave(el, cb);
  6986. if (!expectsCSS && !userWantsControl) {
  6987. cb();
  6988. }
  6989. }
  6990. }
  6991. // only used in dev mode
  6992. function checkDuration (val, name, vnode) {
  6993. if (typeof val !== 'number') {
  6994. warn(
  6995. "<transition> explicit " + name + " duration is not a valid number - " +
  6996. "got " + (JSON.stringify(val)) + ".",
  6997. vnode.context
  6998. );
  6999. } else if (isNaN(val)) {
  7000. warn(
  7001. "<transition> explicit " + name + " duration is NaN - " +
  7002. 'the duration expression might be incorrect.',
  7003. vnode.context
  7004. );
  7005. }
  7006. }
  7007. function isValidDuration (val) {
  7008. return typeof val === 'number' && !isNaN(val)
  7009. }
  7010. /**
  7011. * Normalize a transition hook's argument length. The hook may be:
  7012. * - a merged hook (invoker) with the original in .fns
  7013. * - a wrapped component method (check ._length)
  7014. * - a plain function (.length)
  7015. */
  7016. function getHookArgumentsLength (fn) {
  7017. if (isUndef(fn)) {
  7018. return false
  7019. }
  7020. var invokerFns = fn.fns;
  7021. if (isDef(invokerFns)) {
  7022. // invoker
  7023. return getHookArgumentsLength(
  7024. Array.isArray(invokerFns)
  7025. ? invokerFns[0]
  7026. : invokerFns
  7027. )
  7028. } else {
  7029. return (fn._length || fn.length) > 1
  7030. }
  7031. }
  7032. function _enter (_, vnode) {
  7033. if (vnode.data.show !== true) {
  7034. enter(vnode);
  7035. }
  7036. }
  7037. var transition = inBrowser ? {
  7038. create: _enter,
  7039. activate: _enter,
  7040. remove: function remove$$1 (vnode, rm) {
  7041. /* istanbul ignore else */
  7042. if (vnode.data.show !== true) {
  7043. leave(vnode, rm);
  7044. } else {
  7045. rm();
  7046. }
  7047. }
  7048. } : {};
  7049. var platformModules = [
  7050. attrs,
  7051. klass,
  7052. events,
  7053. domProps,
  7054. style,
  7055. transition
  7056. ];
  7057. /* */
  7058. // the directive module should be applied last, after all
  7059. // built-in modules have been applied.
  7060. var modules = platformModules.concat(baseModules);
  7061. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  7062. /**
  7063. * Not type checking this file because flow doesn't like attaching
  7064. * properties to Elements.
  7065. */
  7066. /* istanbul ignore if */
  7067. if (isIE9) {
  7068. // http://www.matts411.com/post/internet-explorer-9-oninput/
  7069. document.addEventListener('selectionchange', function () {
  7070. var el = document.activeElement;
  7071. if (el && el.vmodel) {
  7072. trigger(el, 'input');
  7073. }
  7074. });
  7075. }
  7076. var directive = {
  7077. inserted: function inserted (el, binding, vnode, oldVnode) {
  7078. if (vnode.tag === 'select') {
  7079. // #6903
  7080. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  7081. mergeVNodeHook(vnode, 'postpatch', function () {
  7082. directive.componentUpdated(el, binding, vnode);
  7083. });
  7084. } else {
  7085. setSelected(el, binding, vnode.context);
  7086. }
  7087. el._vOptions = [].map.call(el.options, getValue);
  7088. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  7089. el._vModifiers = binding.modifiers;
  7090. if (!binding.modifiers.lazy) {
  7091. el.addEventListener('compositionstart', onCompositionStart);
  7092. el.addEventListener('compositionend', onCompositionEnd);
  7093. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  7094. // switching focus before confirming composition choice
  7095. // this also fixes the issue where some browsers e.g. iOS Chrome
  7096. // fires "change" instead of "input" on autocomplete.
  7097. el.addEventListener('change', onCompositionEnd);
  7098. /* istanbul ignore if */
  7099. if (isIE9) {
  7100. el.vmodel = true;
  7101. }
  7102. }
  7103. }
  7104. },
  7105. componentUpdated: function componentUpdated (el, binding, vnode) {
  7106. if (vnode.tag === 'select') {
  7107. setSelected(el, binding, vnode.context);
  7108. // in case the options rendered by v-for have changed,
  7109. // it's possible that the value is out-of-sync with the rendered options.
  7110. // detect such cases and filter out values that no longer has a matching
  7111. // option in the DOM.
  7112. var prevOptions = el._vOptions;
  7113. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  7114. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  7115. // trigger change event if
  7116. // no matching option found for at least one value
  7117. var needReset = el.multiple
  7118. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  7119. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  7120. if (needReset) {
  7121. trigger(el, 'change');
  7122. }
  7123. }
  7124. }
  7125. }
  7126. };
  7127. function setSelected (el, binding, vm) {
  7128. actuallySetSelected(el, binding, vm);
  7129. /* istanbul ignore if */
  7130. if (isIE || isEdge) {
  7131. setTimeout(function () {
  7132. actuallySetSelected(el, binding, vm);
  7133. }, 0);
  7134. }
  7135. }
  7136. function actuallySetSelected (el, binding, vm) {
  7137. var value = binding.value;
  7138. var isMultiple = el.multiple;
  7139. if (isMultiple && !Array.isArray(value)) {
  7140. process.env.NODE_ENV !== 'production' && warn(
  7141. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  7142. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  7143. vm
  7144. );
  7145. return
  7146. }
  7147. var selected, option;
  7148. for (var i = 0, l = el.options.length; i < l; i++) {
  7149. option = el.options[i];
  7150. if (isMultiple) {
  7151. selected = looseIndexOf(value, getValue(option)) > -1;
  7152. if (option.selected !== selected) {
  7153. option.selected = selected;
  7154. }
  7155. } else {
  7156. if (looseEqual(getValue(option), value)) {
  7157. if (el.selectedIndex !== i) {
  7158. el.selectedIndex = i;
  7159. }
  7160. return
  7161. }
  7162. }
  7163. }
  7164. if (!isMultiple) {
  7165. el.selectedIndex = -1;
  7166. }
  7167. }
  7168. function hasNoMatchingOption (value, options) {
  7169. return options.every(function (o) { return !looseEqual(o, value); })
  7170. }
  7171. function getValue (option) {
  7172. return '_value' in option
  7173. ? option._value
  7174. : option.value
  7175. }
  7176. function onCompositionStart (e) {
  7177. e.target.composing = true;
  7178. }
  7179. function onCompositionEnd (e) {
  7180. // prevent triggering an input event for no reason
  7181. if (!e.target.composing) { return }
  7182. e.target.composing = false;
  7183. trigger(e.target, 'input');
  7184. }
  7185. function trigger (el, type) {
  7186. var e = document.createEvent('HTMLEvents');
  7187. e.initEvent(type, true, true);
  7188. el.dispatchEvent(e);
  7189. }
  7190. /* */
  7191. // recursively search for possible transition defined inside the component root
  7192. function locateNode (vnode) {
  7193. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  7194. ? locateNode(vnode.componentInstance._vnode)
  7195. : vnode
  7196. }
  7197. var show = {
  7198. bind: function bind (el, ref, vnode) {
  7199. var value = ref.value;
  7200. vnode = locateNode(vnode);
  7201. var transition$$1 = vnode.data && vnode.data.transition;
  7202. var originalDisplay = el.__vOriginalDisplay =
  7203. el.style.display === 'none' ? '' : el.style.display;
  7204. if (value && transition$$1) {
  7205. vnode.data.show = true;
  7206. enter(vnode, function () {
  7207. el.style.display = originalDisplay;
  7208. });
  7209. } else {
  7210. el.style.display = value ? originalDisplay : 'none';
  7211. }
  7212. },
  7213. update: function update (el, ref, vnode) {
  7214. var value = ref.value;
  7215. var oldValue = ref.oldValue;
  7216. /* istanbul ignore if */
  7217. if (!value === !oldValue) { return }
  7218. vnode = locateNode(vnode);
  7219. var transition$$1 = vnode.data && vnode.data.transition;
  7220. if (transition$$1) {
  7221. vnode.data.show = true;
  7222. if (value) {
  7223. enter(vnode, function () {
  7224. el.style.display = el.__vOriginalDisplay;
  7225. });
  7226. } else {
  7227. leave(vnode, function () {
  7228. el.style.display = 'none';
  7229. });
  7230. }
  7231. } else {
  7232. el.style.display = value ? el.__vOriginalDisplay : 'none';
  7233. }
  7234. },
  7235. unbind: function unbind (
  7236. el,
  7237. binding,
  7238. vnode,
  7239. oldVnode,
  7240. isDestroy
  7241. ) {
  7242. if (!isDestroy) {
  7243. el.style.display = el.__vOriginalDisplay;
  7244. }
  7245. }
  7246. };
  7247. var platformDirectives = {
  7248. model: directive,
  7249. show: show
  7250. };
  7251. /* */
  7252. var transitionProps = {
  7253. name: String,
  7254. appear: Boolean,
  7255. css: Boolean,
  7256. mode: String,
  7257. type: String,
  7258. enterClass: String,
  7259. leaveClass: String,
  7260. enterToClass: String,
  7261. leaveToClass: String,
  7262. enterActiveClass: String,
  7263. leaveActiveClass: String,
  7264. appearClass: String,
  7265. appearActiveClass: String,
  7266. appearToClass: String,
  7267. duration: [Number, String, Object]
  7268. };
  7269. // in case the child is also an abstract component, e.g. <keep-alive>
  7270. // we want to recursively retrieve the real component to be rendered
  7271. function getRealChild (vnode) {
  7272. var compOptions = vnode && vnode.componentOptions;
  7273. if (compOptions && compOptions.Ctor.options.abstract) {
  7274. return getRealChild(getFirstComponentChild(compOptions.children))
  7275. } else {
  7276. return vnode
  7277. }
  7278. }
  7279. function extractTransitionData (comp) {
  7280. var data = {};
  7281. var options = comp.$options;
  7282. // props
  7283. for (var key in options.propsData) {
  7284. data[key] = comp[key];
  7285. }
  7286. // events.
  7287. // extract listeners and pass them directly to the transition methods
  7288. var listeners = options._parentListeners;
  7289. for (var key$1 in listeners) {
  7290. data[camelize(key$1)] = listeners[key$1];
  7291. }
  7292. return data
  7293. }
  7294. function placeholder (h, rawChild) {
  7295. if (/\d-keep-alive$/.test(rawChild.tag)) {
  7296. return h('keep-alive', {
  7297. props: rawChild.componentOptions.propsData
  7298. })
  7299. }
  7300. }
  7301. function hasParentTransition (vnode) {
  7302. while ((vnode = vnode.parent)) {
  7303. if (vnode.data.transition) {
  7304. return true
  7305. }
  7306. }
  7307. }
  7308. function isSameChild (child, oldChild) {
  7309. return oldChild.key === child.key && oldChild.tag === child.tag
  7310. }
  7311. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  7312. var isVShowDirective = function (d) { return d.name === 'show'; };
  7313. var Transition = {
  7314. name: 'transition',
  7315. props: transitionProps,
  7316. abstract: true,
  7317. render: function render (h) {
  7318. var this$1 = this;
  7319. var children = this.$slots.default;
  7320. if (!children) {
  7321. return
  7322. }
  7323. // filter out text nodes (possible whitespaces)
  7324. children = children.filter(isNotTextNode);
  7325. /* istanbul ignore if */
  7326. if (!children.length) {
  7327. return
  7328. }
  7329. // warn multiple elements
  7330. if (process.env.NODE_ENV !== 'production' && children.length > 1) {
  7331. warn(
  7332. '<transition> can only be used on a single element. Use ' +
  7333. '<transition-group> for lists.',
  7334. this.$parent
  7335. );
  7336. }
  7337. var mode = this.mode;
  7338. // warn invalid mode
  7339. if (process.env.NODE_ENV !== 'production' &&
  7340. mode && mode !== 'in-out' && mode !== 'out-in'
  7341. ) {
  7342. warn(
  7343. 'invalid <transition> mode: ' + mode,
  7344. this.$parent
  7345. );
  7346. }
  7347. var rawChild = children[0];
  7348. // if this is a component root node and the component's
  7349. // parent container node also has transition, skip.
  7350. if (hasParentTransition(this.$vnode)) {
  7351. return rawChild
  7352. }
  7353. // apply transition data to child
  7354. // use getRealChild() to ignore abstract components e.g. keep-alive
  7355. var child = getRealChild(rawChild);
  7356. /* istanbul ignore if */
  7357. if (!child) {
  7358. return rawChild
  7359. }
  7360. if (this._leaving) {
  7361. return placeholder(h, rawChild)
  7362. }
  7363. // ensure a key that is unique to the vnode type and to this transition
  7364. // component instance. This key will be used to remove pending leaving nodes
  7365. // during entering.
  7366. var id = "__transition-" + (this._uid) + "-";
  7367. child.key = child.key == null
  7368. ? child.isComment
  7369. ? id + 'comment'
  7370. : id + child.tag
  7371. : isPrimitive(child.key)
  7372. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  7373. : child.key;
  7374. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  7375. var oldRawChild = this._vnode;
  7376. var oldChild = getRealChild(oldRawChild);
  7377. // mark v-show
  7378. // so that the transition module can hand over the control to the directive
  7379. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  7380. child.data.show = true;
  7381. }
  7382. if (
  7383. oldChild &&
  7384. oldChild.data &&
  7385. !isSameChild(child, oldChild) &&
  7386. !isAsyncPlaceholder(oldChild) &&
  7387. // #6687 component root is a comment node
  7388. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  7389. ) {
  7390. // replace old child transition data with fresh one
  7391. // important for dynamic transitions!
  7392. var oldData = oldChild.data.transition = extend({}, data);
  7393. // handle transition mode
  7394. if (mode === 'out-in') {
  7395. // return placeholder node and queue update when leave finishes
  7396. this._leaving = true;
  7397. mergeVNodeHook(oldData, 'afterLeave', function () {
  7398. this$1._leaving = false;
  7399. this$1.$forceUpdate();
  7400. });
  7401. return placeholder(h, rawChild)
  7402. } else if (mode === 'in-out') {
  7403. if (isAsyncPlaceholder(child)) {
  7404. return oldRawChild
  7405. }
  7406. var delayedLeave;
  7407. var performLeave = function () { delayedLeave(); };
  7408. mergeVNodeHook(data, 'afterEnter', performLeave);
  7409. mergeVNodeHook(data, 'enterCancelled', performLeave);
  7410. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  7411. }
  7412. }
  7413. return rawChild
  7414. }
  7415. };
  7416. /* */
  7417. var props = extend({
  7418. tag: String,
  7419. moveClass: String
  7420. }, transitionProps);
  7421. delete props.mode;
  7422. var TransitionGroup = {
  7423. props: props,
  7424. beforeMount: function beforeMount () {
  7425. var this$1 = this;
  7426. var update = this._update;
  7427. this._update = function (vnode, hydrating) {
  7428. var restoreActiveInstance = setActiveInstance(this$1);
  7429. // force removing pass
  7430. this$1.__patch__(
  7431. this$1._vnode,
  7432. this$1.kept,
  7433. false, // hydrating
  7434. true // removeOnly (!important, avoids unnecessary moves)
  7435. );
  7436. this$1._vnode = this$1.kept;
  7437. restoreActiveInstance();
  7438. update.call(this$1, vnode, hydrating);
  7439. };
  7440. },
  7441. render: function render (h) {
  7442. var tag = this.tag || this.$vnode.data.tag || 'span';
  7443. var map = Object.create(null);
  7444. var prevChildren = this.prevChildren = this.children;
  7445. var rawChildren = this.$slots.default || [];
  7446. var children = this.children = [];
  7447. var transitionData = extractTransitionData(this);
  7448. for (var i = 0; i < rawChildren.length; i++) {
  7449. var c = rawChildren[i];
  7450. if (c.tag) {
  7451. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  7452. children.push(c);
  7453. map[c.key] = c
  7454. ;(c.data || (c.data = {})).transition = transitionData;
  7455. } else if (process.env.NODE_ENV !== 'production') {
  7456. var opts = c.componentOptions;
  7457. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  7458. warn(("<transition-group> children must be keyed: <" + name + ">"));
  7459. }
  7460. }
  7461. }
  7462. if (prevChildren) {
  7463. var kept = [];
  7464. var removed = [];
  7465. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  7466. var c$1 = prevChildren[i$1];
  7467. c$1.data.transition = transitionData;
  7468. c$1.data.pos = c$1.elm.getBoundingClientRect();
  7469. if (map[c$1.key]) {
  7470. kept.push(c$1);
  7471. } else {
  7472. removed.push(c$1);
  7473. }
  7474. }
  7475. this.kept = h(tag, null, kept);
  7476. this.removed = removed;
  7477. }
  7478. return h(tag, null, children)
  7479. },
  7480. updated: function updated () {
  7481. var children = this.prevChildren;
  7482. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  7483. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  7484. return
  7485. }
  7486. // we divide the work into three loops to avoid mixing DOM reads and writes
  7487. // in each iteration - which helps prevent layout thrashing.
  7488. children.forEach(callPendingCbs);
  7489. children.forEach(recordPosition);
  7490. children.forEach(applyTranslation);
  7491. // force reflow to put everything in position
  7492. // assign to this to avoid being removed in tree-shaking
  7493. // $flow-disable-line
  7494. this._reflow = document.body.offsetHeight;
  7495. children.forEach(function (c) {
  7496. if (c.data.moved) {
  7497. var el = c.elm;
  7498. var s = el.style;
  7499. addTransitionClass(el, moveClass);
  7500. s.transform = s.WebkitTransform = s.transitionDuration = '';
  7501. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  7502. if (e && e.target !== el) {
  7503. return
  7504. }
  7505. if (!e || /transform$/.test(e.propertyName)) {
  7506. el.removeEventListener(transitionEndEvent, cb);
  7507. el._moveCb = null;
  7508. removeTransitionClass(el, moveClass);
  7509. }
  7510. });
  7511. }
  7512. });
  7513. },
  7514. methods: {
  7515. hasMove: function hasMove (el, moveClass) {
  7516. /* istanbul ignore if */
  7517. if (!hasTransition) {
  7518. return false
  7519. }
  7520. /* istanbul ignore if */
  7521. if (this._hasMove) {
  7522. return this._hasMove
  7523. }
  7524. // Detect whether an element with the move class applied has
  7525. // CSS transitions. Since the element may be inside an entering
  7526. // transition at this very moment, we make a clone of it and remove
  7527. // all other transition classes applied to ensure only the move class
  7528. // is applied.
  7529. var clone = el.cloneNode();
  7530. if (el._transitionClasses) {
  7531. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  7532. }
  7533. addClass(clone, moveClass);
  7534. clone.style.display = 'none';
  7535. this.$el.appendChild(clone);
  7536. var info = getTransitionInfo(clone);
  7537. this.$el.removeChild(clone);
  7538. return (this._hasMove = info.hasTransform)
  7539. }
  7540. }
  7541. };
  7542. function callPendingCbs (c) {
  7543. /* istanbul ignore if */
  7544. if (c.elm._moveCb) {
  7545. c.elm._moveCb();
  7546. }
  7547. /* istanbul ignore if */
  7548. if (c.elm._enterCb) {
  7549. c.elm._enterCb();
  7550. }
  7551. }
  7552. function recordPosition (c) {
  7553. c.data.newPos = c.elm.getBoundingClientRect();
  7554. }
  7555. function applyTranslation (c) {
  7556. var oldPos = c.data.pos;
  7557. var newPos = c.data.newPos;
  7558. var dx = oldPos.left - newPos.left;
  7559. var dy = oldPos.top - newPos.top;
  7560. if (dx || dy) {
  7561. c.data.moved = true;
  7562. var s = c.elm.style;
  7563. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  7564. s.transitionDuration = '0s';
  7565. }
  7566. }
  7567. var platformComponents = {
  7568. Transition: Transition,
  7569. TransitionGroup: TransitionGroup
  7570. };
  7571. /* */
  7572. // install platform specific utils
  7573. Vue.config.mustUseProp = mustUseProp;
  7574. Vue.config.isReservedTag = isReservedTag;
  7575. Vue.config.isReservedAttr = isReservedAttr;
  7576. Vue.config.getTagNamespace = getTagNamespace;
  7577. Vue.config.isUnknownElement = isUnknownElement;
  7578. // install platform runtime directives & components
  7579. extend(Vue.options.directives, platformDirectives);
  7580. extend(Vue.options.components, platformComponents);
  7581. // install platform patch function
  7582. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  7583. // public mount method
  7584. Vue.prototype.$mount = function (
  7585. el,
  7586. hydrating
  7587. ) {
  7588. el = el && inBrowser ? query(el) : undefined;
  7589. return mountComponent(this, el, hydrating)
  7590. };
  7591. // devtools global hook
  7592. /* istanbul ignore next */
  7593. if (inBrowser) {
  7594. setTimeout(function () {
  7595. if (config.devtools) {
  7596. if (devtools) {
  7597. devtools.emit('init', Vue);
  7598. } else if (
  7599. process.env.NODE_ENV !== 'production' &&
  7600. process.env.NODE_ENV !== 'test'
  7601. ) {
  7602. console[console.info ? 'info' : 'log'](
  7603. 'Download the Vue Devtools extension for a better development experience:\n' +
  7604. 'https://github.com/vuejs/vue-devtools'
  7605. );
  7606. }
  7607. }
  7608. if (process.env.NODE_ENV !== 'production' &&
  7609. process.env.NODE_ENV !== 'test' &&
  7610. config.productionTip !== false &&
  7611. typeof console !== 'undefined'
  7612. ) {
  7613. console[console.info ? 'info' : 'log'](
  7614. "You are running Vue in development mode.\n" +
  7615. "Make sure to turn on production mode when deploying for production.\n" +
  7616. "See more tips at https://vuejs.org/guide/deployment.html"
  7617. );
  7618. }
  7619. }, 0);
  7620. }
  7621. /* */
  7622. export default Vue;