vue.runtime.common.js 206 KB

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