vue.runtime.common.js 204 KB

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