vue.runtime.js 192 KB

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