vue.runtime.common.js 208 KB

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