vue.runtime.common.dev.js 213 KB

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