vue.runtime.js 202 KB

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