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

vue.runtime.js 233KB

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