vue.js 189 KB

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