You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

vue.js 224 kB

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