vue.esm.js 241 KB

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