vue.common.js 290 KB

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