vue.runtime.common.js 194 KB

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