vue.runtime.js 232 KB

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