vue.runtime.esm.js 210 KB

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