vue.runtime.common.dev.js 217 KB

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