vue.esm.js 290 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089
  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. * Generate a string containing static keys from compiler modules.
  234. */
  235. function genStaticKeys (modules) {
  236. return modules.reduce(function (keys, m) {
  237. return keys.concat(m.staticKeys || [])
  238. }, []).join(',')
  239. }
  240. /**
  241. * Check if two values are loosely equal - that is,
  242. * if they are plain objects, do they have the same shape?
  243. */
  244. function looseEqual (a, b) {
  245. if (a === b) { return true }
  246. var isObjectA = isObject(a);
  247. var isObjectB = isObject(b);
  248. if (isObjectA && isObjectB) {
  249. try {
  250. var isArrayA = Array.isArray(a);
  251. var isArrayB = Array.isArray(b);
  252. if (isArrayA && isArrayB) {
  253. return a.length === b.length && a.every(function (e, i) {
  254. return looseEqual(e, b[i])
  255. })
  256. } else if (a instanceof Date && b instanceof Date) {
  257. return a.getTime() === b.getTime()
  258. } else if (!isArrayA && !isArrayB) {
  259. var keysA = Object.keys(a);
  260. var keysB = Object.keys(b);
  261. return keysA.length === keysB.length && keysA.every(function (key) {
  262. return looseEqual(a[key], b[key])
  263. })
  264. } else {
  265. /* istanbul ignore next */
  266. return false
  267. }
  268. } catch (e) {
  269. /* istanbul ignore next */
  270. return false
  271. }
  272. } else if (!isObjectA && !isObjectB) {
  273. return String(a) === String(b)
  274. } else {
  275. return false
  276. }
  277. }
  278. /**
  279. * Return the first index at which a loosely equal value can be
  280. * found in the array (if value is a plain object, the array must
  281. * contain an object of the same shape), or -1 if it is not present.
  282. */
  283. function looseIndexOf (arr, val) {
  284. for (var i = 0; i < arr.length; i++) {
  285. if (looseEqual(arr[i], val)) { return i }
  286. }
  287. return -1
  288. }
  289. /**
  290. * Ensure a function is called only once.
  291. */
  292. function once (fn) {
  293. var called = false;
  294. return function () {
  295. if (!called) {
  296. called = true;
  297. fn.apply(this, arguments);
  298. }
  299. }
  300. }
  301. var SSR_ATTR = 'data-server-rendered';
  302. var ASSET_TYPES = [
  303. 'component',
  304. 'directive',
  305. 'filter'
  306. ];
  307. var LIFECYCLE_HOOKS = [
  308. 'beforeCreate',
  309. 'created',
  310. 'beforeMount',
  311. 'mounted',
  312. 'beforeUpdate',
  313. 'updated',
  314. 'beforeDestroy',
  315. 'destroyed',
  316. 'activated',
  317. 'deactivated',
  318. 'errorCaptured'
  319. ];
  320. /* */
  321. var config = ({
  322. /**
  323. * Option merge strategies (used in core/util/options)
  324. */
  325. // $flow-disable-line
  326. optionMergeStrategies: Object.create(null),
  327. /**
  328. * Whether to suppress warnings.
  329. */
  330. silent: false,
  331. /**
  332. * Show production mode tip message on boot?
  333. */
  334. productionTip: process.env.NODE_ENV !== 'production',
  335. /**
  336. * Whether to enable devtools
  337. */
  338. devtools: process.env.NODE_ENV !== 'production',
  339. /**
  340. * Whether to record perf
  341. */
  342. performance: false,
  343. /**
  344. * Error handler for watcher errors
  345. */
  346. errorHandler: null,
  347. /**
  348. * Warn handler for watcher warns
  349. */
  350. warnHandler: null,
  351. /**
  352. * Ignore certain custom elements
  353. */
  354. ignoredElements: [],
  355. /**
  356. * Custom user key aliases for v-on
  357. */
  358. // $flow-disable-line
  359. keyCodes: Object.create(null),
  360. /**
  361. * Check if a tag is reserved so that it cannot be registered as a
  362. * component. This is platform-dependent and may be overwritten.
  363. */
  364. isReservedTag: no,
  365. /**
  366. * Check if an attribute is reserved so that it cannot be used as a component
  367. * prop. This is platform-dependent and may be overwritten.
  368. */
  369. isReservedAttr: no,
  370. /**
  371. * Check if a tag is an unknown element.
  372. * Platform-dependent.
  373. */
  374. isUnknownElement: no,
  375. /**
  376. * Get the namespace of an element
  377. */
  378. getTagNamespace: noop,
  379. /**
  380. * Parse the real tag name for the specific platform.
  381. */
  382. parsePlatformTagName: identity,
  383. /**
  384. * Check if an attribute must be bound using property, e.g. value
  385. * Platform-dependent.
  386. */
  387. mustUseProp: no,
  388. /**
  389. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  390. * This will significantly reduce performance if set to false.
  391. */
  392. async: true,
  393. /**
  394. * Exposed for legacy reasons
  395. */
  396. _lifecycleHooks: LIFECYCLE_HOOKS
  397. });
  398. /* */
  399. /**
  400. * Check if a string starts with $ or _
  401. */
  402. function isReserved (str) {
  403. var c = (str + '').charCodeAt(0);
  404. return c === 0x24 || c === 0x5F
  405. }
  406. /**
  407. * Define a property.
  408. */
  409. function def (obj, key, val, enumerable) {
  410. Object.defineProperty(obj, key, {
  411. value: val,
  412. enumerable: !!enumerable,
  413. writable: true,
  414. configurable: true
  415. });
  416. }
  417. /**
  418. * Parse simple path.
  419. */
  420. var bailRE = /[^\w.$]/;
  421. function parsePath (path) {
  422. if (bailRE.test(path)) {
  423. return
  424. }
  425. var segments = path.split('.');
  426. return function (obj) {
  427. for (var i = 0; i < segments.length; i++) {
  428. if (!obj) { return }
  429. obj = obj[segments[i]];
  430. }
  431. return obj
  432. }
  433. }
  434. /* */
  435. // can we use __proto__?
  436. var hasProto = '__proto__' in {};
  437. // Browser environment sniffing
  438. var inBrowser = typeof window !== 'undefined';
  439. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  440. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  441. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  442. var isIE = UA && /msie|trident/.test(UA);
  443. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  444. var isEdge = UA && UA.indexOf('edge/') > 0;
  445. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  446. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  447. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  448. // Firefox has a "watch" function on Object.prototype...
  449. var nativeWatch = ({}).watch;
  450. var supportsPassive = false;
  451. if (inBrowser) {
  452. try {
  453. var opts = {};
  454. Object.defineProperty(opts, 'passive', ({
  455. get: function get () {
  456. /* istanbul ignore next */
  457. supportsPassive = true;
  458. }
  459. })); // https://github.com/facebook/flow/issues/285
  460. window.addEventListener('test-passive', null, opts);
  461. } catch (e) {}
  462. }
  463. // this needs to be lazy-evaled because vue may be required before
  464. // vue-server-renderer can set VUE_ENV
  465. var _isServer;
  466. var isServerRendering = function () {
  467. if (_isServer === undefined) {
  468. /* istanbul ignore if */
  469. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  470. // detect presence of vue-server-renderer and avoid
  471. // Webpack shimming the process
  472. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  473. } else {
  474. _isServer = false;
  475. }
  476. }
  477. return _isServer
  478. };
  479. // detect devtools
  480. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  481. /* istanbul ignore next */
  482. function isNative (Ctor) {
  483. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  484. }
  485. var hasSymbol =
  486. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  487. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  488. var _Set;
  489. /* istanbul ignore if */ // $flow-disable-line
  490. if (typeof Set !== 'undefined' && isNative(Set)) {
  491. // use native Set when available.
  492. _Set = Set;
  493. } else {
  494. // a non-standard Set polyfill that only works with primitive keys.
  495. _Set = /*@__PURE__*/(function () {
  496. function Set () {
  497. this.set = Object.create(null);
  498. }
  499. Set.prototype.has = function has (key) {
  500. return this.set[key] === true
  501. };
  502. Set.prototype.add = function add (key) {
  503. this.set[key] = true;
  504. };
  505. Set.prototype.clear = function clear () {
  506. this.set = Object.create(null);
  507. };
  508. return Set;
  509. }());
  510. }
  511. /* */
  512. var warn = noop;
  513. var tip = noop;
  514. var generateComponentTrace = (noop); // work around flow check
  515. var formatComponentName = (noop);
  516. if (process.env.NODE_ENV !== 'production') {
  517. var hasConsole = typeof console !== 'undefined';
  518. var classifyRE = /(?:^|[-_])(\w)/g;
  519. var classify = function (str) { return str
  520. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  521. .replace(/[-_]/g, ''); };
  522. warn = function (msg, vm) {
  523. var trace = vm ? generateComponentTrace(vm) : '';
  524. if (config.warnHandler) {
  525. config.warnHandler.call(null, msg, vm, trace);
  526. } else if (hasConsole && (!config.silent)) {
  527. console.error(("[Vue warn]: " + msg + trace));
  528. }
  529. };
  530. tip = function (msg, vm) {
  531. if (hasConsole && (!config.silent)) {
  532. console.warn("[Vue tip]: " + msg + (
  533. vm ? generateComponentTrace(vm) : ''
  534. ));
  535. }
  536. };
  537. formatComponentName = function (vm, includeFile) {
  538. if (vm.$root === vm) {
  539. return '<Root>'
  540. }
  541. var options = typeof vm === 'function' && vm.cid != null
  542. ? vm.options
  543. : vm._isVue
  544. ? vm.$options || vm.constructor.options
  545. : vm || {};
  546. var name = options.name || options._componentTag;
  547. var file = options.__file;
  548. if (!name && file) {
  549. var match = file.match(/([^/\\]+)\.vue$/);
  550. name = match && match[1];
  551. }
  552. return (
  553. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  554. (file && includeFile !== false ? (" at " + file) : '')
  555. )
  556. };
  557. var repeat = function (str, n) {
  558. var res = '';
  559. while (n) {
  560. if (n % 2 === 1) { res += str; }
  561. if (n > 1) { str += str; }
  562. n >>= 1;
  563. }
  564. return res
  565. };
  566. generateComponentTrace = function (vm) {
  567. if (vm._isVue && vm.$parent) {
  568. var tree = [];
  569. var currentRecursiveSequence = 0;
  570. while (vm) {
  571. if (tree.length > 0) {
  572. var last = tree[tree.length - 1];
  573. if (last.constructor === vm.constructor) {
  574. currentRecursiveSequence++;
  575. vm = vm.$parent;
  576. continue
  577. } else if (currentRecursiveSequence > 0) {
  578. tree[tree.length - 1] = [last, currentRecursiveSequence];
  579. currentRecursiveSequence = 0;
  580. }
  581. }
  582. tree.push(vm);
  583. vm = vm.$parent;
  584. }
  585. return '\n\nfound in\n\n' + tree
  586. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  587. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  588. : formatComponentName(vm))); })
  589. .join('\n')
  590. } else {
  591. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  592. }
  593. };
  594. }
  595. /* */
  596. var uid = 0;
  597. /**
  598. * A dep is an observable that can have multiple
  599. * directives subscribing to it.
  600. */
  601. var Dep = function Dep () {
  602. this.id = uid++;
  603. this.subs = [];
  604. };
  605. Dep.prototype.addSub = function addSub (sub) {
  606. this.subs.push(sub);
  607. };
  608. Dep.prototype.removeSub = function removeSub (sub) {
  609. remove(this.subs, sub);
  610. };
  611. Dep.prototype.depend = function depend () {
  612. if (Dep.target) {
  613. Dep.target.addDep(this);
  614. }
  615. };
  616. Dep.prototype.notify = function notify () {
  617. // stabilize the subscriber list first
  618. var subs = this.subs.slice();
  619. if (process.env.NODE_ENV !== 'production' && !config.async) {
  620. // subs aren't sorted in scheduler if not running async
  621. // we need to sort them now to make sure they fire in correct
  622. // order
  623. subs.sort(function (a, b) { return a.id - b.id; });
  624. }
  625. for (var i = 0, l = subs.length; i < l; i++) {
  626. subs[i].update();
  627. }
  628. };
  629. // the current target watcher being evaluated.
  630. // this is globally unique because there could be only one
  631. // watcher being evaluated at any time.
  632. Dep.target = null;
  633. var targetStack = [];
  634. function pushTarget (target) {
  635. targetStack.push(target);
  636. Dep.target = target;
  637. }
  638. function popTarget () {
  639. targetStack.pop();
  640. Dep.target = targetStack[targetStack.length - 1];
  641. }
  642. /* */
  643. var VNode = function VNode (
  644. tag,
  645. data,
  646. children,
  647. text,
  648. elm,
  649. context,
  650. componentOptions,
  651. asyncFactory
  652. ) {
  653. this.tag = tag;
  654. this.data = data;
  655. this.children = children;
  656. this.text = text;
  657. this.elm = elm;
  658. this.ns = undefined;
  659. this.context = context;
  660. this.fnContext = undefined;
  661. this.fnOptions = undefined;
  662. this.fnScopeId = undefined;
  663. this.key = data && data.key;
  664. this.componentOptions = componentOptions;
  665. this.componentInstance = undefined;
  666. this.parent = undefined;
  667. this.raw = false;
  668. this.isStatic = false;
  669. this.isRootInsert = true;
  670. this.isComment = false;
  671. this.isCloned = false;
  672. this.isOnce = false;
  673. this.asyncFactory = asyncFactory;
  674. this.asyncMeta = undefined;
  675. this.isAsyncPlaceholder = false;
  676. };
  677. var prototypeAccessors = { child: { configurable: true } };
  678. // DEPRECATED: alias for componentInstance for backwards compat.
  679. /* istanbul ignore next */
  680. prototypeAccessors.child.get = function () {
  681. return this.componentInstance
  682. };
  683. Object.defineProperties( VNode.prototype, prototypeAccessors );
  684. var createEmptyVNode = function (text) {
  685. if ( text === void 0 ) text = '';
  686. var node = new VNode();
  687. node.text = text;
  688. node.isComment = true;
  689. return node
  690. };
  691. function createTextVNode (val) {
  692. return new VNode(undefined, undefined, undefined, String(val))
  693. }
  694. // optimized shallow clone
  695. // used for static nodes and slot nodes because they may be reused across
  696. // multiple renders, cloning them avoids errors when DOM manipulations rely
  697. // on their elm reference.
  698. function cloneVNode (vnode) {
  699. var cloned = new VNode(
  700. vnode.tag,
  701. vnode.data,
  702. // #7975
  703. // clone children array to avoid mutating original in case of cloning
  704. // a child.
  705. vnode.children && vnode.children.slice(),
  706. vnode.text,
  707. vnode.elm,
  708. vnode.context,
  709. vnode.componentOptions,
  710. vnode.asyncFactory
  711. );
  712. cloned.ns = vnode.ns;
  713. cloned.isStatic = vnode.isStatic;
  714. cloned.key = vnode.key;
  715. cloned.isComment = vnode.isComment;
  716. cloned.fnContext = vnode.fnContext;
  717. cloned.fnOptions = vnode.fnOptions;
  718. cloned.fnScopeId = vnode.fnScopeId;
  719. cloned.asyncMeta = vnode.asyncMeta;
  720. cloned.isCloned = true;
  721. return cloned
  722. }
  723. /*
  724. * not type checking this file because flow doesn't play well with
  725. * dynamically accessing methods on Array prototype
  726. */
  727. var arrayProto = Array.prototype;
  728. var arrayMethods = Object.create(arrayProto);
  729. var methodsToPatch = [
  730. 'push',
  731. 'pop',
  732. 'shift',
  733. 'unshift',
  734. 'splice',
  735. 'sort',
  736. 'reverse'
  737. ];
  738. /**
  739. * Intercept mutating methods and emit events
  740. */
  741. methodsToPatch.forEach(function (method) {
  742. // cache original method
  743. var original = arrayProto[method];
  744. def(arrayMethods, method, function mutator () {
  745. var args = [], len = arguments.length;
  746. while ( len-- ) args[ len ] = arguments[ len ];
  747. var result = original.apply(this, args);
  748. var ob = this.__ob__;
  749. var inserted;
  750. switch (method) {
  751. case 'push':
  752. case 'unshift':
  753. inserted = args;
  754. break
  755. case 'splice':
  756. inserted = args.slice(2);
  757. break
  758. }
  759. if (inserted) { ob.observeArray(inserted); }
  760. // notify change
  761. ob.dep.notify();
  762. return result
  763. });
  764. });
  765. /* */
  766. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  767. /**
  768. * In some cases we may want to disable observation inside a component's
  769. * update computation.
  770. */
  771. var shouldObserve = true;
  772. function toggleObserving (value) {
  773. shouldObserve = value;
  774. }
  775. /**
  776. * Observer class that is attached to each observed
  777. * object. Once attached, the observer converts the target
  778. * object's property keys into getter/setters that
  779. * collect dependencies and dispatch updates.
  780. */
  781. var Observer = function Observer (value) {
  782. this.value = value;
  783. this.dep = new Dep();
  784. this.vmCount = 0;
  785. def(value, '__ob__', this);
  786. if (Array.isArray(value)) {
  787. if (hasProto) {
  788. protoAugment(value, arrayMethods);
  789. } else {
  790. copyAugment(value, arrayMethods, arrayKeys);
  791. }
  792. this.observeArray(value);
  793. } else {
  794. this.walk(value);
  795. }
  796. };
  797. /**
  798. * Walk through all properties and convert them into
  799. * getter/setters. This method should only be called when
  800. * value type is Object.
  801. */
  802. Observer.prototype.walk = function walk (obj) {
  803. var keys = Object.keys(obj);
  804. for (var i = 0; i < keys.length; i++) {
  805. defineReactive$$1(obj, keys[i]);
  806. }
  807. };
  808. /**
  809. * Observe a list of Array items.
  810. */
  811. Observer.prototype.observeArray = function observeArray (items) {
  812. for (var i = 0, l = items.length; i < l; i++) {
  813. observe(items[i]);
  814. }
  815. };
  816. // helpers
  817. /**
  818. * Augment a target Object or Array by intercepting
  819. * the prototype chain using __proto__
  820. */
  821. function protoAugment (target, src) {
  822. /* eslint-disable no-proto */
  823. target.__proto__ = src;
  824. /* eslint-enable no-proto */
  825. }
  826. /**
  827. * Augment a target Object or Array by defining
  828. * hidden properties.
  829. */
  830. /* istanbul ignore next */
  831. function copyAugment (target, src, keys) {
  832. for (var i = 0, l = keys.length; i < l; i++) {
  833. var key = keys[i];
  834. def(target, key, src[key]);
  835. }
  836. }
  837. /**
  838. * Attempt to create an observer instance for a value,
  839. * returns the new observer if successfully observed,
  840. * or the existing observer if the value already has one.
  841. */
  842. function observe (value, asRootData) {
  843. if (!isObject(value) || value instanceof VNode) {
  844. return
  845. }
  846. var ob;
  847. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  848. ob = value.__ob__;
  849. } else if (
  850. shouldObserve &&
  851. !isServerRendering() &&
  852. (Array.isArray(value) || isPlainObject(value)) &&
  853. Object.isExtensible(value) &&
  854. !value._isVue
  855. ) {
  856. ob = new Observer(value);
  857. }
  858. if (asRootData && ob) {
  859. ob.vmCount++;
  860. }
  861. return ob
  862. }
  863. /**
  864. * Define a reactive property on an Object.
  865. */
  866. function defineReactive$$1 (
  867. obj,
  868. key,
  869. val,
  870. customSetter,
  871. shallow
  872. ) {
  873. var dep = new Dep();
  874. var property = Object.getOwnPropertyDescriptor(obj, key);
  875. if (property && property.configurable === false) {
  876. return
  877. }
  878. // cater for pre-defined getter/setters
  879. var getter = property && property.get;
  880. var setter = property && property.set;
  881. if ((!getter || setter) && arguments.length === 2) {
  882. val = obj[key];
  883. }
  884. var childOb = !shallow && observe(val);
  885. Object.defineProperty(obj, key, {
  886. enumerable: true,
  887. configurable: true,
  888. get: function reactiveGetter () {
  889. var value = getter ? getter.call(obj) : val;
  890. if (Dep.target) {
  891. dep.depend();
  892. if (childOb) {
  893. childOb.dep.depend();
  894. if (Array.isArray(value)) {
  895. dependArray(value);
  896. }
  897. }
  898. }
  899. return value
  900. },
  901. set: function reactiveSetter (newVal) {
  902. var value = getter ? getter.call(obj) : val;
  903. /* eslint-disable no-self-compare */
  904. if (newVal === value || (newVal !== newVal && value !== value)) {
  905. return
  906. }
  907. /* eslint-enable no-self-compare */
  908. if (process.env.NODE_ENV !== 'production' && customSetter) {
  909. customSetter();
  910. }
  911. // #7981: for accessor properties without setter
  912. if (getter && !setter) { return }
  913. if (setter) {
  914. setter.call(obj, newVal);
  915. } else {
  916. val = newVal;
  917. }
  918. childOb = !shallow && observe(newVal);
  919. dep.notify();
  920. }
  921. });
  922. }
  923. /**
  924. * Set a property on an object. Adds the new property and
  925. * triggers change notification if the property doesn't
  926. * already exist.
  927. */
  928. function set (target, key, val) {
  929. if (process.env.NODE_ENV !== 'production' &&
  930. (isUndef(target) || isPrimitive(target))
  931. ) {
  932. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  933. }
  934. if (Array.isArray(target) && isValidArrayIndex(key)) {
  935. target.length = Math.max(target.length, key);
  936. target.splice(key, 1, val);
  937. return val
  938. }
  939. if (key in target && !(key in Object.prototype)) {
  940. target[key] = val;
  941. return val
  942. }
  943. var ob = (target).__ob__;
  944. if (target._isVue || (ob && ob.vmCount)) {
  945. process.env.NODE_ENV !== 'production' && warn(
  946. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  947. 'at runtime - declare it upfront in the data option.'
  948. );
  949. return val
  950. }
  951. if (!ob) {
  952. target[key] = val;
  953. return val
  954. }
  955. defineReactive$$1(ob.value, key, val);
  956. ob.dep.notify();
  957. return val
  958. }
  959. /**
  960. * Delete a property and trigger change if necessary.
  961. */
  962. function del (target, key) {
  963. if (process.env.NODE_ENV !== 'production' &&
  964. (isUndef(target) || isPrimitive(target))
  965. ) {
  966. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  967. }
  968. if (Array.isArray(target) && isValidArrayIndex(key)) {
  969. target.splice(key, 1);
  970. return
  971. }
  972. var ob = (target).__ob__;
  973. if (target._isVue || (ob && ob.vmCount)) {
  974. process.env.NODE_ENV !== 'production' && warn(
  975. 'Avoid deleting properties on a Vue instance or its root $data ' +
  976. '- just set it to null.'
  977. );
  978. return
  979. }
  980. if (!hasOwn(target, key)) {
  981. return
  982. }
  983. delete target[key];
  984. if (!ob) {
  985. return
  986. }
  987. ob.dep.notify();
  988. }
  989. /**
  990. * Collect dependencies on array elements when the array is touched, since
  991. * we cannot intercept array element access like property getters.
  992. */
  993. function dependArray (value) {
  994. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  995. e = value[i];
  996. e && e.__ob__ && e.__ob__.dep.depend();
  997. if (Array.isArray(e)) {
  998. dependArray(e);
  999. }
  1000. }
  1001. }
  1002. /* */
  1003. /**
  1004. * Option overwriting strategies are functions that handle
  1005. * how to merge a parent option value and a child option
  1006. * value into the final value.
  1007. */
  1008. var strats = config.optionMergeStrategies;
  1009. /**
  1010. * Options with restrictions
  1011. */
  1012. if (process.env.NODE_ENV !== 'production') {
  1013. strats.el = strats.propsData = function (parent, child, vm, key) {
  1014. if (!vm) {
  1015. warn(
  1016. "option \"" + key + "\" can only be used during instance " +
  1017. 'creation with the `new` keyword.'
  1018. );
  1019. }
  1020. return defaultStrat(parent, child)
  1021. };
  1022. }
  1023. /**
  1024. * Helper that recursively merges two data objects together.
  1025. */
  1026. function mergeData (to, from) {
  1027. if (!from) { return to }
  1028. var key, toVal, fromVal;
  1029. var keys = Object.keys(from);
  1030. for (var i = 0; i < keys.length; i++) {
  1031. key = keys[i];
  1032. toVal = to[key];
  1033. fromVal = from[key];
  1034. if (!hasOwn(to, key)) {
  1035. set(to, key, fromVal);
  1036. } else if (
  1037. toVal !== fromVal &&
  1038. isPlainObject(toVal) &&
  1039. isPlainObject(fromVal)
  1040. ) {
  1041. mergeData(toVal, fromVal);
  1042. }
  1043. }
  1044. return to
  1045. }
  1046. /**
  1047. * Data
  1048. */
  1049. function mergeDataOrFn (
  1050. parentVal,
  1051. childVal,
  1052. vm
  1053. ) {
  1054. if (!vm) {
  1055. // in a Vue.extend merge, both should be functions
  1056. if (!childVal) {
  1057. return parentVal
  1058. }
  1059. if (!parentVal) {
  1060. return childVal
  1061. }
  1062. // when parentVal & childVal are both present,
  1063. // we need to return a function that returns the
  1064. // merged result of both functions... no need to
  1065. // check if parentVal is a function here because
  1066. // it has to be a function to pass previous merges.
  1067. return function mergedDataFn () {
  1068. return mergeData(
  1069. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  1070. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  1071. )
  1072. }
  1073. } else {
  1074. return function mergedInstanceDataFn () {
  1075. // instance merge
  1076. var instanceData = typeof childVal === 'function'
  1077. ? childVal.call(vm, vm)
  1078. : childVal;
  1079. var defaultData = typeof parentVal === 'function'
  1080. ? parentVal.call(vm, vm)
  1081. : parentVal;
  1082. if (instanceData) {
  1083. return mergeData(instanceData, defaultData)
  1084. } else {
  1085. return defaultData
  1086. }
  1087. }
  1088. }
  1089. }
  1090. strats.data = function (
  1091. parentVal,
  1092. childVal,
  1093. vm
  1094. ) {
  1095. if (!vm) {
  1096. if (childVal && typeof childVal !== 'function') {
  1097. process.env.NODE_ENV !== 'production' && warn(
  1098. 'The "data" option should be a function ' +
  1099. 'that returns a per-instance value in component ' +
  1100. 'definitions.',
  1101. vm
  1102. );
  1103. return parentVal
  1104. }
  1105. return mergeDataOrFn(parentVal, childVal)
  1106. }
  1107. return mergeDataOrFn(parentVal, childVal, vm)
  1108. };
  1109. /**
  1110. * Hooks and props are merged as arrays.
  1111. */
  1112. function mergeHook (
  1113. parentVal,
  1114. childVal
  1115. ) {
  1116. return childVal
  1117. ? parentVal
  1118. ? parentVal.concat(childVal)
  1119. : Array.isArray(childVal)
  1120. ? childVal
  1121. : [childVal]
  1122. : parentVal
  1123. }
  1124. LIFECYCLE_HOOKS.forEach(function (hook) {
  1125. strats[hook] = mergeHook;
  1126. });
  1127. /**
  1128. * Assets
  1129. *
  1130. * When a vm is present (instance creation), we need to do
  1131. * a three-way merge between constructor options, instance
  1132. * options and parent options.
  1133. */
  1134. function mergeAssets (
  1135. parentVal,
  1136. childVal,
  1137. vm,
  1138. key
  1139. ) {
  1140. var res = Object.create(parentVal || null);
  1141. if (childVal) {
  1142. process.env.NODE_ENV !== 'production' && assertObjectType(key, childVal, vm);
  1143. return extend(res, childVal)
  1144. } else {
  1145. return res
  1146. }
  1147. }
  1148. ASSET_TYPES.forEach(function (type) {
  1149. strats[type + 's'] = mergeAssets;
  1150. });
  1151. /**
  1152. * Watchers.
  1153. *
  1154. * Watchers hashes should not overwrite one
  1155. * another, so we merge them as arrays.
  1156. */
  1157. strats.watch = function (
  1158. parentVal,
  1159. childVal,
  1160. vm,
  1161. key
  1162. ) {
  1163. // work around Firefox's Object.prototype.watch...
  1164. if (parentVal === nativeWatch) { parentVal = undefined; }
  1165. if (childVal === nativeWatch) { childVal = undefined; }
  1166. /* istanbul ignore if */
  1167. if (!childVal) { return Object.create(parentVal || null) }
  1168. if (process.env.NODE_ENV !== 'production') {
  1169. assertObjectType(key, childVal, vm);
  1170. }
  1171. if (!parentVal) { return childVal }
  1172. var ret = {};
  1173. extend(ret, parentVal);
  1174. for (var key$1 in childVal) {
  1175. var parent = ret[key$1];
  1176. var child = childVal[key$1];
  1177. if (parent && !Array.isArray(parent)) {
  1178. parent = [parent];
  1179. }
  1180. ret[key$1] = parent
  1181. ? parent.concat(child)
  1182. : Array.isArray(child) ? child : [child];
  1183. }
  1184. return ret
  1185. };
  1186. /**
  1187. * Other object hashes.
  1188. */
  1189. strats.props =
  1190. strats.methods =
  1191. strats.inject =
  1192. strats.computed = function (
  1193. parentVal,
  1194. childVal,
  1195. vm,
  1196. key
  1197. ) {
  1198. if (childVal && process.env.NODE_ENV !== 'production') {
  1199. assertObjectType(key, childVal, vm);
  1200. }
  1201. if (!parentVal) { return childVal }
  1202. var ret = Object.create(null);
  1203. extend(ret, parentVal);
  1204. if (childVal) { extend(ret, childVal); }
  1205. return ret
  1206. };
  1207. strats.provide = mergeDataOrFn;
  1208. /**
  1209. * Default strategy.
  1210. */
  1211. var defaultStrat = function (parentVal, childVal) {
  1212. return childVal === undefined
  1213. ? parentVal
  1214. : childVal
  1215. };
  1216. /**
  1217. * Validate component names
  1218. */
  1219. function checkComponents (options) {
  1220. for (var key in options.components) {
  1221. validateComponentName(key);
  1222. }
  1223. }
  1224. function validateComponentName (name) {
  1225. if (!/^[a-zA-Z][\w-]*$/.test(name)) {
  1226. warn(
  1227. 'Invalid component name: "' + name + '". Component names ' +
  1228. 'can only contain alphanumeric characters and the hyphen, ' +
  1229. 'and must start with a letter.'
  1230. );
  1231. }
  1232. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  1233. warn(
  1234. 'Do not use built-in or reserved HTML elements as component ' +
  1235. 'id: ' + name
  1236. );
  1237. }
  1238. }
  1239. /**
  1240. * Ensure all props option syntax are normalized into the
  1241. * Object-based format.
  1242. */
  1243. function normalizeProps (options, vm) {
  1244. var props = options.props;
  1245. if (!props) { return }
  1246. var res = {};
  1247. var i, val, name;
  1248. if (Array.isArray(props)) {
  1249. i = props.length;
  1250. while (i--) {
  1251. val = props[i];
  1252. if (typeof val === 'string') {
  1253. name = camelize(val);
  1254. res[name] = { type: null };
  1255. } else if (process.env.NODE_ENV !== 'production') {
  1256. warn('props must be strings when using array syntax.');
  1257. }
  1258. }
  1259. } else if (isPlainObject(props)) {
  1260. for (var key in props) {
  1261. val = props[key];
  1262. name = camelize(key);
  1263. res[name] = isPlainObject(val)
  1264. ? val
  1265. : { type: val };
  1266. }
  1267. } else if (process.env.NODE_ENV !== 'production') {
  1268. warn(
  1269. "Invalid value for option \"props\": expected an Array or an Object, " +
  1270. "but got " + (toRawType(props)) + ".",
  1271. vm
  1272. );
  1273. }
  1274. options.props = res;
  1275. }
  1276. /**
  1277. * Normalize all injections into Object-based format
  1278. */
  1279. function normalizeInject (options, vm) {
  1280. var inject = options.inject;
  1281. if (!inject) { return }
  1282. var normalized = options.inject = {};
  1283. if (Array.isArray(inject)) {
  1284. for (var i = 0; i < inject.length; i++) {
  1285. normalized[inject[i]] = { from: inject[i] };
  1286. }
  1287. } else if (isPlainObject(inject)) {
  1288. for (var key in inject) {
  1289. var val = inject[key];
  1290. normalized[key] = isPlainObject(val)
  1291. ? extend({ from: key }, val)
  1292. : { from: val };
  1293. }
  1294. } else if (process.env.NODE_ENV !== 'production') {
  1295. warn(
  1296. "Invalid value for option \"inject\": expected an Array or an Object, " +
  1297. "but got " + (toRawType(inject)) + ".",
  1298. vm
  1299. );
  1300. }
  1301. }
  1302. /**
  1303. * Normalize raw function directives into object format.
  1304. */
  1305. function normalizeDirectives (options) {
  1306. var dirs = options.directives;
  1307. if (dirs) {
  1308. for (var key in dirs) {
  1309. var def = dirs[key];
  1310. if (typeof def === 'function') {
  1311. dirs[key] = { bind: def, update: def };
  1312. }
  1313. }
  1314. }
  1315. }
  1316. function assertObjectType (name, value, vm) {
  1317. if (!isPlainObject(value)) {
  1318. warn(
  1319. "Invalid value for option \"" + name + "\": expected an Object, " +
  1320. "but got " + (toRawType(value)) + ".",
  1321. vm
  1322. );
  1323. }
  1324. }
  1325. /**
  1326. * Merge two option objects into a new one.
  1327. * Core utility used in both instantiation and inheritance.
  1328. */
  1329. function mergeOptions (
  1330. parent,
  1331. child,
  1332. vm
  1333. ) {
  1334. if (process.env.NODE_ENV !== 'production') {
  1335. checkComponents(child);
  1336. }
  1337. if (typeof child === 'function') {
  1338. child = child.options;
  1339. }
  1340. normalizeProps(child, vm);
  1341. normalizeInject(child, vm);
  1342. normalizeDirectives(child);
  1343. // Apply extends and mixins on the child options,
  1344. // but only if it is a raw options object that isn't
  1345. // the result of another mergeOptions call.
  1346. // Only merged options has the _base property.
  1347. if (!child._base) {
  1348. if (child.extends) {
  1349. parent = mergeOptions(parent, child.extends, vm);
  1350. }
  1351. if (child.mixins) {
  1352. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1353. parent = mergeOptions(parent, child.mixins[i], vm);
  1354. }
  1355. }
  1356. }
  1357. var options = {};
  1358. var key;
  1359. for (key in parent) {
  1360. mergeField(key);
  1361. }
  1362. for (key in child) {
  1363. if (!hasOwn(parent, key)) {
  1364. mergeField(key);
  1365. }
  1366. }
  1367. function mergeField (key) {
  1368. var strat = strats[key] || defaultStrat;
  1369. options[key] = strat(parent[key], child[key], vm, key);
  1370. }
  1371. return options
  1372. }
  1373. /**
  1374. * Resolve an asset.
  1375. * This function is used because child instances need access
  1376. * to assets defined in its ancestor chain.
  1377. */
  1378. function resolveAsset (
  1379. options,
  1380. type,
  1381. id,
  1382. warnMissing
  1383. ) {
  1384. /* istanbul ignore if */
  1385. if (typeof id !== 'string') {
  1386. return
  1387. }
  1388. var assets = options[type];
  1389. // check local registration variations first
  1390. if (hasOwn(assets, id)) { return assets[id] }
  1391. var camelizedId = camelize(id);
  1392. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  1393. var PascalCaseId = capitalize(camelizedId);
  1394. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  1395. // fallback to prototype chain
  1396. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  1397. if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {
  1398. warn(
  1399. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  1400. options
  1401. );
  1402. }
  1403. return res
  1404. }
  1405. /* */
  1406. function validateProp (
  1407. key,
  1408. propOptions,
  1409. propsData,
  1410. vm
  1411. ) {
  1412. var prop = propOptions[key];
  1413. var absent = !hasOwn(propsData, key);
  1414. var value = propsData[key];
  1415. // boolean casting
  1416. var booleanIndex = getTypeIndex(Boolean, prop.type);
  1417. if (booleanIndex > -1) {
  1418. if (absent && !hasOwn(prop, 'default')) {
  1419. value = false;
  1420. } else if (value === '' || value === hyphenate(key)) {
  1421. // only cast empty string / same name to boolean if
  1422. // boolean has higher priority
  1423. var stringIndex = getTypeIndex(String, prop.type);
  1424. if (stringIndex < 0 || booleanIndex < stringIndex) {
  1425. value = true;
  1426. }
  1427. }
  1428. }
  1429. // check default value
  1430. if (value === undefined) {
  1431. value = getPropDefaultValue(vm, prop, key);
  1432. // since the default value is a fresh copy,
  1433. // make sure to observe it.
  1434. var prevShouldObserve = shouldObserve;
  1435. toggleObserving(true);
  1436. observe(value);
  1437. toggleObserving(prevShouldObserve);
  1438. }
  1439. if (
  1440. process.env.NODE_ENV !== 'production' &&
  1441. // skip validation for weex recycle-list child component props
  1442. !(false)
  1443. ) {
  1444. assertProp(prop, key, value, vm, absent);
  1445. }
  1446. return value
  1447. }
  1448. /**
  1449. * Get the default value of a prop.
  1450. */
  1451. function getPropDefaultValue (vm, prop, key) {
  1452. // no default, return undefined
  1453. if (!hasOwn(prop, 'default')) {
  1454. return undefined
  1455. }
  1456. var def = prop.default;
  1457. // warn against non-factory defaults for Object & Array
  1458. if (process.env.NODE_ENV !== 'production' && isObject(def)) {
  1459. warn(
  1460. 'Invalid default value for prop "' + key + '": ' +
  1461. 'Props with type Object/Array must use a factory function ' +
  1462. 'to return the default value.',
  1463. vm
  1464. );
  1465. }
  1466. // the raw prop value was also undefined from previous render,
  1467. // return previous default value to avoid unnecessary watcher trigger
  1468. if (vm && vm.$options.propsData &&
  1469. vm.$options.propsData[key] === undefined &&
  1470. vm._props[key] !== undefined
  1471. ) {
  1472. return vm._props[key]
  1473. }
  1474. // call factory function for non-Function types
  1475. // a value is Function if its prototype is function even across different execution context
  1476. return typeof def === 'function' && getType(prop.type) !== 'Function'
  1477. ? def.call(vm)
  1478. : def
  1479. }
  1480. /**
  1481. * Assert whether a prop is valid.
  1482. */
  1483. function assertProp (
  1484. prop,
  1485. name,
  1486. value,
  1487. vm,
  1488. absent
  1489. ) {
  1490. if (prop.required && absent) {
  1491. warn(
  1492. 'Missing required prop: "' + name + '"',
  1493. vm
  1494. );
  1495. return
  1496. }
  1497. if (value == null && !prop.required) {
  1498. return
  1499. }
  1500. var type = prop.type;
  1501. var valid = !type || type === true;
  1502. var expectedTypes = [];
  1503. if (type) {
  1504. if (!Array.isArray(type)) {
  1505. type = [type];
  1506. }
  1507. for (var i = 0; i < type.length && !valid; i++) {
  1508. var assertedType = assertType(value, type[i]);
  1509. expectedTypes.push(assertedType.expectedType || '');
  1510. valid = assertedType.valid;
  1511. }
  1512. }
  1513. if (!valid) {
  1514. warn(
  1515. getInvalidTypeMessage(name, value, expectedTypes),
  1516. vm
  1517. );
  1518. return
  1519. }
  1520. var validator = prop.validator;
  1521. if (validator) {
  1522. if (!validator(value)) {
  1523. warn(
  1524. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  1525. vm
  1526. );
  1527. }
  1528. }
  1529. }
  1530. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  1531. function assertType (value, type) {
  1532. var valid;
  1533. var expectedType = getType(type);
  1534. if (simpleCheckRE.test(expectedType)) {
  1535. var t = typeof value;
  1536. valid = t === expectedType.toLowerCase();
  1537. // for primitive wrapper objects
  1538. if (!valid && t === 'object') {
  1539. valid = value instanceof type;
  1540. }
  1541. } else if (expectedType === 'Object') {
  1542. valid = isPlainObject(value);
  1543. } else if (expectedType === 'Array') {
  1544. valid = Array.isArray(value);
  1545. } else {
  1546. valid = value instanceof type;
  1547. }
  1548. return {
  1549. valid: valid,
  1550. expectedType: expectedType
  1551. }
  1552. }
  1553. /**
  1554. * Use function string name to check built-in types,
  1555. * because a simple equality check will fail when running
  1556. * across different vms / iframes.
  1557. */
  1558. function getType (fn) {
  1559. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  1560. return match ? match[1] : ''
  1561. }
  1562. function isSameType (a, b) {
  1563. return getType(a) === getType(b)
  1564. }
  1565. function getTypeIndex (type, expectedTypes) {
  1566. if (!Array.isArray(expectedTypes)) {
  1567. return isSameType(expectedTypes, type) ? 0 : -1
  1568. }
  1569. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  1570. if (isSameType(expectedTypes[i], type)) {
  1571. return i
  1572. }
  1573. }
  1574. return -1
  1575. }
  1576. function getInvalidTypeMessage (name, value, expectedTypes) {
  1577. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  1578. " Expected " + (expectedTypes.map(capitalize).join(', '));
  1579. var expectedType = expectedTypes[0];
  1580. var receivedType = toRawType(value);
  1581. var expectedValue = styleValue(value, expectedType);
  1582. var receivedValue = styleValue(value, receivedType);
  1583. // check if we need to specify expected value
  1584. if (expectedTypes.length === 1 &&
  1585. isExplicable(expectedType) &&
  1586. !isBoolean(expectedType, receivedType)) {
  1587. message += " with value " + expectedValue;
  1588. }
  1589. message += ", got " + receivedType + " ";
  1590. // check if we need to specify received value
  1591. if (isExplicable(receivedType)) {
  1592. message += "with value " + receivedValue + ".";
  1593. }
  1594. return message
  1595. }
  1596. function styleValue (value, type) {
  1597. if (type === 'String') {
  1598. return ("\"" + value + "\"")
  1599. } else if (type === 'Number') {
  1600. return ("" + (Number(value)))
  1601. } else {
  1602. return ("" + value)
  1603. }
  1604. }
  1605. function isExplicable (value) {
  1606. var explicitTypes = ['string', 'number', 'boolean'];
  1607. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  1608. }
  1609. function isBoolean () {
  1610. var args = [], len = arguments.length;
  1611. while ( len-- ) args[ len ] = arguments[ len ];
  1612. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  1613. }
  1614. /* */
  1615. function handleError (err, vm, info) {
  1616. if (vm) {
  1617. var cur = vm;
  1618. while ((cur = cur.$parent)) {
  1619. var hooks = cur.$options.errorCaptured;
  1620. if (hooks) {
  1621. for (var i = 0; i < hooks.length; i++) {
  1622. try {
  1623. var capture = hooks[i].call(cur, err, vm, info) === false;
  1624. if (capture) { return }
  1625. } catch (e) {
  1626. globalHandleError(e, cur, 'errorCaptured hook');
  1627. }
  1628. }
  1629. }
  1630. }
  1631. }
  1632. globalHandleError(err, vm, info);
  1633. }
  1634. function globalHandleError (err, vm, info) {
  1635. if (config.errorHandler) {
  1636. try {
  1637. return config.errorHandler.call(null, err, vm, info)
  1638. } catch (e) {
  1639. logError(e, null, 'config.errorHandler');
  1640. }
  1641. }
  1642. logError(err, vm, info);
  1643. }
  1644. function logError (err, vm, info) {
  1645. if (process.env.NODE_ENV !== 'production') {
  1646. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  1647. }
  1648. /* istanbul ignore else */
  1649. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  1650. console.error(err);
  1651. } else {
  1652. throw err
  1653. }
  1654. }
  1655. /* */
  1656. var callbacks = [];
  1657. var pending = false;
  1658. function flushCallbacks () {
  1659. pending = false;
  1660. var copies = callbacks.slice(0);
  1661. callbacks.length = 0;
  1662. for (var i = 0; i < copies.length; i++) {
  1663. copies[i]();
  1664. }
  1665. }
  1666. // Here we have async deferring wrappers using both microtasks and (macro) tasks.
  1667. // In < 2.4 we used microtasks everywhere, but there are some scenarios where
  1668. // microtasks have too high a priority and fire in between supposedly
  1669. // sequential events (e.g. #4521, #6690) or even between bubbling of the same
  1670. // event (#6566). However, using (macro) tasks everywhere also has subtle problems
  1671. // when state is changed right before repaint (e.g. #6813, out-in transitions).
  1672. // Here we use microtask by default, but expose a way to force (macro) task when
  1673. // needed (e.g. in event handlers attached by v-on).
  1674. var microTimerFunc;
  1675. var macroTimerFunc;
  1676. var useMacroTask = false;
  1677. // Determine (macro) task defer implementation.
  1678. // Technically setImmediate should be the ideal choice, but it's only available
  1679. // in IE. The only polyfill that consistently queues the callback after all DOM
  1680. // events triggered in the same loop is by using MessageChannel.
  1681. /* istanbul ignore if */
  1682. if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  1683. macroTimerFunc = function () {
  1684. setImmediate(flushCallbacks);
  1685. };
  1686. } else if (typeof MessageChannel !== 'undefined' && (
  1687. isNative(MessageChannel) ||
  1688. // PhantomJS
  1689. MessageChannel.toString() === '[object MessageChannelConstructor]'
  1690. )) {
  1691. var channel = new MessageChannel();
  1692. var port = channel.port2;
  1693. channel.port1.onmessage = flushCallbacks;
  1694. macroTimerFunc = function () {
  1695. port.postMessage(1);
  1696. };
  1697. } else {
  1698. /* istanbul ignore next */
  1699. macroTimerFunc = function () {
  1700. setTimeout(flushCallbacks, 0);
  1701. };
  1702. }
  1703. // Determine microtask defer implementation.
  1704. /* istanbul ignore next, $flow-disable-line */
  1705. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  1706. var p = Promise.resolve();
  1707. microTimerFunc = function () {
  1708. p.then(flushCallbacks);
  1709. // in problematic UIWebViews, Promise.then doesn't completely break, but
  1710. // it can get stuck in a weird state where callbacks are pushed into the
  1711. // microtask queue but the queue isn't being flushed, until the browser
  1712. // needs to do some other work, e.g. handle a timer. Therefore we can
  1713. // "force" the microtask queue to be flushed by adding an empty timer.
  1714. if (isIOS) { setTimeout(noop); }
  1715. };
  1716. } else {
  1717. // fallback to macro
  1718. microTimerFunc = macroTimerFunc;
  1719. }
  1720. /**
  1721. * Wrap a function so that if any code inside triggers state change,
  1722. * the changes are queued using a (macro) task instead of a microtask.
  1723. */
  1724. function withMacroTask (fn) {
  1725. return fn._withTask || (fn._withTask = function () {
  1726. useMacroTask = true;
  1727. try {
  1728. return fn.apply(null, arguments)
  1729. } finally {
  1730. useMacroTask = false;
  1731. }
  1732. })
  1733. }
  1734. function nextTick (cb, ctx) {
  1735. var _resolve;
  1736. callbacks.push(function () {
  1737. if (cb) {
  1738. try {
  1739. cb.call(ctx);
  1740. } catch (e) {
  1741. handleError(e, ctx, 'nextTick');
  1742. }
  1743. } else if (_resolve) {
  1744. _resolve(ctx);
  1745. }
  1746. });
  1747. if (!pending) {
  1748. pending = true;
  1749. if (useMacroTask) {
  1750. macroTimerFunc();
  1751. } else {
  1752. microTimerFunc();
  1753. }
  1754. }
  1755. // $flow-disable-line
  1756. if (!cb && typeof Promise !== 'undefined') {
  1757. return new Promise(function (resolve) {
  1758. _resolve = resolve;
  1759. })
  1760. }
  1761. }
  1762. /* */
  1763. var mark;
  1764. var measure;
  1765. if (process.env.NODE_ENV !== 'production') {
  1766. var perf = inBrowser && window.performance;
  1767. /* istanbul ignore if */
  1768. if (
  1769. perf &&
  1770. perf.mark &&
  1771. perf.measure &&
  1772. perf.clearMarks &&
  1773. perf.clearMeasures
  1774. ) {
  1775. mark = function (tag) { return perf.mark(tag); };
  1776. measure = function (name, startTag, endTag) {
  1777. perf.measure(name, startTag, endTag);
  1778. perf.clearMarks(startTag);
  1779. perf.clearMarks(endTag);
  1780. perf.clearMeasures(name);
  1781. };
  1782. }
  1783. }
  1784. /* not type checking this file because flow doesn't play well with Proxy */
  1785. var initProxy;
  1786. if (process.env.NODE_ENV !== 'production') {
  1787. var allowedGlobals = makeMap(
  1788. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  1789. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  1790. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  1791. 'require' // for Webpack/Browserify
  1792. );
  1793. var warnNonPresent = function (target, key) {
  1794. warn(
  1795. "Property or method \"" + key + "\" is not defined on the instance but " +
  1796. 'referenced during render. Make sure that this property is reactive, ' +
  1797. 'either in the data option, or for class-based components, by ' +
  1798. 'initializing the property. ' +
  1799. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  1800. target
  1801. );
  1802. };
  1803. var warnReservedPrefix = function (target, key) {
  1804. warn(
  1805. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  1806. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  1807. 'prevent conflicts with Vue internals' +
  1808. 'See: https://vuejs.org/v2/api/#data',
  1809. target
  1810. );
  1811. };
  1812. var hasProxy =
  1813. typeof Proxy !== 'undefined' && isNative(Proxy);
  1814. if (hasProxy) {
  1815. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  1816. config.keyCodes = new Proxy(config.keyCodes, {
  1817. set: function set (target, key, value) {
  1818. if (isBuiltInModifier(key)) {
  1819. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  1820. return false
  1821. } else {
  1822. target[key] = value;
  1823. return true
  1824. }
  1825. }
  1826. });
  1827. }
  1828. var hasHandler = {
  1829. has: function has (target, key) {
  1830. var has = key in target;
  1831. var isAllowed = allowedGlobals(key) ||
  1832. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  1833. if (!has && !isAllowed) {
  1834. if (key in target.$data) { warnReservedPrefix(target, key); }
  1835. else { warnNonPresent(target, key); }
  1836. }
  1837. return has || !isAllowed
  1838. }
  1839. };
  1840. var getHandler = {
  1841. get: function get (target, key) {
  1842. if (typeof key === 'string' && !(key in target)) {
  1843. if (key in target.$data) { warnReservedPrefix(target, key); }
  1844. else { warnNonPresent(target, key); }
  1845. }
  1846. return target[key]
  1847. }
  1848. };
  1849. initProxy = function initProxy (vm) {
  1850. if (hasProxy) {
  1851. // determine which proxy handler to use
  1852. var options = vm.$options;
  1853. var handlers = options.render && options.render._withStripped
  1854. ? getHandler
  1855. : hasHandler;
  1856. vm._renderProxy = new Proxy(vm, handlers);
  1857. } else {
  1858. vm._renderProxy = vm;
  1859. }
  1860. };
  1861. }
  1862. /* */
  1863. var seenObjects = new _Set();
  1864. /**
  1865. * Recursively traverse an object to evoke all converted
  1866. * getters, so that every nested property inside the object
  1867. * is collected as a "deep" dependency.
  1868. */
  1869. function traverse (val) {
  1870. _traverse(val, seenObjects);
  1871. seenObjects.clear();
  1872. }
  1873. function _traverse (val, seen) {
  1874. var i, keys;
  1875. var isA = Array.isArray(val);
  1876. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  1877. return
  1878. }
  1879. if (val.__ob__) {
  1880. var depId = val.__ob__.dep.id;
  1881. if (seen.has(depId)) {
  1882. return
  1883. }
  1884. seen.add(depId);
  1885. }
  1886. if (isA) {
  1887. i = val.length;
  1888. while (i--) { _traverse(val[i], seen); }
  1889. } else {
  1890. keys = Object.keys(val);
  1891. i = keys.length;
  1892. while (i--) { _traverse(val[keys[i]], seen); }
  1893. }
  1894. }
  1895. /* */
  1896. var normalizeEvent = cached(function (name) {
  1897. var passive = name.charAt(0) === '&';
  1898. name = passive ? name.slice(1) : name;
  1899. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  1900. name = once$$1 ? name.slice(1) : name;
  1901. var capture = name.charAt(0) === '!';
  1902. name = capture ? name.slice(1) : name;
  1903. return {
  1904. name: name,
  1905. once: once$$1,
  1906. capture: capture,
  1907. passive: passive
  1908. }
  1909. });
  1910. function createFnInvoker (fns) {
  1911. function invoker () {
  1912. var arguments$1 = arguments;
  1913. var fns = invoker.fns;
  1914. if (Array.isArray(fns)) {
  1915. var cloned = fns.slice();
  1916. for (var i = 0; i < cloned.length; i++) {
  1917. cloned[i].apply(null, arguments$1);
  1918. }
  1919. } else {
  1920. // return handler return value for single handlers
  1921. return fns.apply(null, arguments)
  1922. }
  1923. }
  1924. invoker.fns = fns;
  1925. return invoker
  1926. }
  1927. function updateListeners (
  1928. on,
  1929. oldOn,
  1930. add,
  1931. remove$$1,
  1932. createOnceHandler,
  1933. vm
  1934. ) {
  1935. var name, def$$1, cur, old, event;
  1936. for (name in on) {
  1937. def$$1 = cur = on[name];
  1938. old = oldOn[name];
  1939. event = normalizeEvent(name);
  1940. if (isUndef(cur)) {
  1941. process.env.NODE_ENV !== 'production' && warn(
  1942. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  1943. vm
  1944. );
  1945. } else if (isUndef(old)) {
  1946. if (isUndef(cur.fns)) {
  1947. cur = on[name] = createFnInvoker(cur);
  1948. }
  1949. if (isTrue(event.once)) {
  1950. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  1951. }
  1952. add(event.name, cur, event.capture, event.passive, event.params);
  1953. } else if (cur !== old) {
  1954. old.fns = cur;
  1955. on[name] = old;
  1956. }
  1957. }
  1958. for (name in oldOn) {
  1959. if (isUndef(on[name])) {
  1960. event = normalizeEvent(name);
  1961. remove$$1(event.name, oldOn[name], event.capture);
  1962. }
  1963. }
  1964. }
  1965. /* */
  1966. function mergeVNodeHook (def, hookKey, hook) {
  1967. if (def instanceof VNode) {
  1968. def = def.data.hook || (def.data.hook = {});
  1969. }
  1970. var invoker;
  1971. var oldHook = def[hookKey];
  1972. function wrappedHook () {
  1973. hook.apply(this, arguments);
  1974. // important: remove merged hook to ensure it's called only once
  1975. // and prevent memory leak
  1976. remove(invoker.fns, wrappedHook);
  1977. }
  1978. if (isUndef(oldHook)) {
  1979. // no existing hook
  1980. invoker = createFnInvoker([wrappedHook]);
  1981. } else {
  1982. /* istanbul ignore if */
  1983. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  1984. // already a merged invoker
  1985. invoker = oldHook;
  1986. invoker.fns.push(wrappedHook);
  1987. } else {
  1988. // existing plain hook
  1989. invoker = createFnInvoker([oldHook, wrappedHook]);
  1990. }
  1991. }
  1992. invoker.merged = true;
  1993. def[hookKey] = invoker;
  1994. }
  1995. /* */
  1996. function extractPropsFromVNodeData (
  1997. data,
  1998. Ctor,
  1999. tag
  2000. ) {
  2001. // we are only extracting raw values here.
  2002. // validation and default values are handled in the child
  2003. // component itself.
  2004. var propOptions = Ctor.options.props;
  2005. if (isUndef(propOptions)) {
  2006. return
  2007. }
  2008. var res = {};
  2009. var attrs = data.attrs;
  2010. var props = data.props;
  2011. if (isDef(attrs) || isDef(props)) {
  2012. for (var key in propOptions) {
  2013. var altKey = hyphenate(key);
  2014. if (process.env.NODE_ENV !== 'production') {
  2015. var keyInLowerCase = key.toLowerCase();
  2016. if (
  2017. key !== keyInLowerCase &&
  2018. attrs && hasOwn(attrs, keyInLowerCase)
  2019. ) {
  2020. tip(
  2021. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  2022. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  2023. " \"" + key + "\". " +
  2024. "Note that HTML attributes are case-insensitive and camelCased " +
  2025. "props need to use their kebab-case equivalents when using in-DOM " +
  2026. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  2027. );
  2028. }
  2029. }
  2030. checkProp(res, props, key, altKey, true) ||
  2031. checkProp(res, attrs, key, altKey, false);
  2032. }
  2033. }
  2034. return res
  2035. }
  2036. function checkProp (
  2037. res,
  2038. hash,
  2039. key,
  2040. altKey,
  2041. preserve
  2042. ) {
  2043. if (isDef(hash)) {
  2044. if (hasOwn(hash, key)) {
  2045. res[key] = hash[key];
  2046. if (!preserve) {
  2047. delete hash[key];
  2048. }
  2049. return true
  2050. } else if (hasOwn(hash, altKey)) {
  2051. res[key] = hash[altKey];
  2052. if (!preserve) {
  2053. delete hash[altKey];
  2054. }
  2055. return true
  2056. }
  2057. }
  2058. return false
  2059. }
  2060. /* */
  2061. // The template compiler attempts to minimize the need for normalization by
  2062. // statically analyzing the template at compile time.
  2063. //
  2064. // For plain HTML markup, normalization can be completely skipped because the
  2065. // generated render function is guaranteed to return Array<VNode>. There are
  2066. // two cases where extra normalization is needed:
  2067. // 1. When the children contains components - because a functional component
  2068. // may return an Array instead of a single root. In this case, just a simple
  2069. // normalization is needed - if any child is an Array, we flatten the whole
  2070. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  2071. // because functional components already normalize their own children.
  2072. function simpleNormalizeChildren (children) {
  2073. for (var i = 0; i < children.length; i++) {
  2074. if (Array.isArray(children[i])) {
  2075. return Array.prototype.concat.apply([], children)
  2076. }
  2077. }
  2078. return children
  2079. }
  2080. // 2. When the children contains constructs that always generated nested Arrays,
  2081. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  2082. // with hand-written render functions / JSX. In such cases a full normalization
  2083. // is needed to cater to all possible types of children values.
  2084. function normalizeChildren (children) {
  2085. return isPrimitive(children)
  2086. ? [createTextVNode(children)]
  2087. : Array.isArray(children)
  2088. ? normalizeArrayChildren(children)
  2089. : undefined
  2090. }
  2091. function isTextNode (node) {
  2092. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  2093. }
  2094. function normalizeArrayChildren (children, nestedIndex) {
  2095. var res = [];
  2096. var i, c, lastIndex, last;
  2097. for (i = 0; i < children.length; i++) {
  2098. c = children[i];
  2099. if (isUndef(c) || typeof c === 'boolean') { continue }
  2100. lastIndex = res.length - 1;
  2101. last = res[lastIndex];
  2102. // nested
  2103. if (Array.isArray(c)) {
  2104. if (c.length > 0) {
  2105. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  2106. // merge adjacent text nodes
  2107. if (isTextNode(c[0]) && isTextNode(last)) {
  2108. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  2109. c.shift();
  2110. }
  2111. res.push.apply(res, c);
  2112. }
  2113. } else if (isPrimitive(c)) {
  2114. if (isTextNode(last)) {
  2115. // merge adjacent text nodes
  2116. // this is necessary for SSR hydration because text nodes are
  2117. // essentially merged when rendered to HTML strings
  2118. res[lastIndex] = createTextVNode(last.text + c);
  2119. } else if (c !== '') {
  2120. // convert primitive to vnode
  2121. res.push(createTextVNode(c));
  2122. }
  2123. } else {
  2124. if (isTextNode(c) && isTextNode(last)) {
  2125. // merge adjacent text nodes
  2126. res[lastIndex] = createTextVNode(last.text + c.text);
  2127. } else {
  2128. // default key for nested array children (likely generated by v-for)
  2129. if (isTrue(children._isVList) &&
  2130. isDef(c.tag) &&
  2131. isUndef(c.key) &&
  2132. isDef(nestedIndex)) {
  2133. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  2134. }
  2135. res.push(c);
  2136. }
  2137. }
  2138. }
  2139. return res
  2140. }
  2141. /* */
  2142. function ensureCtor (comp, base) {
  2143. if (
  2144. comp.__esModule ||
  2145. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  2146. ) {
  2147. comp = comp.default;
  2148. }
  2149. return isObject(comp)
  2150. ? base.extend(comp)
  2151. : comp
  2152. }
  2153. function createAsyncPlaceholder (
  2154. factory,
  2155. data,
  2156. context,
  2157. children,
  2158. tag
  2159. ) {
  2160. var node = createEmptyVNode();
  2161. node.asyncFactory = factory;
  2162. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  2163. return node
  2164. }
  2165. function resolveAsyncComponent (
  2166. factory,
  2167. baseCtor,
  2168. context
  2169. ) {
  2170. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  2171. return factory.errorComp
  2172. }
  2173. if (isDef(factory.resolved)) {
  2174. return factory.resolved
  2175. }
  2176. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  2177. return factory.loadingComp
  2178. }
  2179. if (isDef(factory.contexts)) {
  2180. // already pending
  2181. factory.contexts.push(context);
  2182. } else {
  2183. var contexts = factory.contexts = [context];
  2184. var sync = true;
  2185. var forceRender = function (renderCompleted) {
  2186. for (var i = 0, l = contexts.length; i < l; i++) {
  2187. contexts[i].$forceUpdate();
  2188. }
  2189. if (renderCompleted) {
  2190. contexts.length = 0;
  2191. }
  2192. };
  2193. var resolve = once(function (res) {
  2194. // cache resolved
  2195. factory.resolved = ensureCtor(res, baseCtor);
  2196. // invoke callbacks only if this is not a synchronous resolve
  2197. // (async resolves are shimmed as synchronous during SSR)
  2198. if (!sync) {
  2199. forceRender(true);
  2200. }
  2201. });
  2202. var reject = once(function (reason) {
  2203. process.env.NODE_ENV !== 'production' && warn(
  2204. "Failed to resolve async component: " + (String(factory)) +
  2205. (reason ? ("\nReason: " + reason) : '')
  2206. );
  2207. if (isDef(factory.errorComp)) {
  2208. factory.error = true;
  2209. forceRender(true);
  2210. }
  2211. });
  2212. var res = factory(resolve, reject);
  2213. if (isObject(res)) {
  2214. if (typeof res.then === 'function') {
  2215. // () => Promise
  2216. if (isUndef(factory.resolved)) {
  2217. res.then(resolve, reject);
  2218. }
  2219. } else if (isDef(res.component) && typeof res.component.then === 'function') {
  2220. res.component.then(resolve, reject);
  2221. if (isDef(res.error)) {
  2222. factory.errorComp = ensureCtor(res.error, baseCtor);
  2223. }
  2224. if (isDef(res.loading)) {
  2225. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  2226. if (res.delay === 0) {
  2227. factory.loading = true;
  2228. } else {
  2229. setTimeout(function () {
  2230. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  2231. factory.loading = true;
  2232. forceRender(false);
  2233. }
  2234. }, res.delay || 200);
  2235. }
  2236. }
  2237. if (isDef(res.timeout)) {
  2238. setTimeout(function () {
  2239. if (isUndef(factory.resolved)) {
  2240. reject(
  2241. process.env.NODE_ENV !== 'production'
  2242. ? ("timeout (" + (res.timeout) + "ms)")
  2243. : null
  2244. );
  2245. }
  2246. }, res.timeout);
  2247. }
  2248. }
  2249. }
  2250. sync = false;
  2251. // return in case resolved synchronously
  2252. return factory.loading
  2253. ? factory.loadingComp
  2254. : factory.resolved
  2255. }
  2256. }
  2257. /* */
  2258. function isAsyncPlaceholder (node) {
  2259. return node.isComment && node.asyncFactory
  2260. }
  2261. /* */
  2262. function getFirstComponentChild (children) {
  2263. if (Array.isArray(children)) {
  2264. for (var i = 0; i < children.length; i++) {
  2265. var c = children[i];
  2266. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  2267. return c
  2268. }
  2269. }
  2270. }
  2271. }
  2272. /* */
  2273. /* */
  2274. function initEvents (vm) {
  2275. vm._events = Object.create(null);
  2276. vm._hasHookEvent = false;
  2277. // init parent attached events
  2278. var listeners = vm.$options._parentListeners;
  2279. if (listeners) {
  2280. updateComponentListeners(vm, listeners);
  2281. }
  2282. }
  2283. var target;
  2284. function add (event, fn) {
  2285. target.$on(event, fn);
  2286. }
  2287. function remove$1 (event, fn) {
  2288. target.$off(event, fn);
  2289. }
  2290. function createOnceHandler (event, fn) {
  2291. var _target = target;
  2292. return function onceHandler () {
  2293. var res = fn.apply(null, arguments);
  2294. if (res !== null) {
  2295. _target.$off(event, onceHandler);
  2296. }
  2297. }
  2298. }
  2299. function updateComponentListeners (
  2300. vm,
  2301. listeners,
  2302. oldListeners
  2303. ) {
  2304. target = vm;
  2305. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  2306. target = undefined;
  2307. }
  2308. function eventsMixin (Vue) {
  2309. var hookRE = /^hook:/;
  2310. Vue.prototype.$on = function (event, fn) {
  2311. var vm = this;
  2312. if (Array.isArray(event)) {
  2313. for (var i = 0, l = event.length; i < l; i++) {
  2314. vm.$on(event[i], fn);
  2315. }
  2316. } else {
  2317. (vm._events[event] || (vm._events[event] = [])).push(fn);
  2318. // optimize hook:event cost by using a boolean flag marked at registration
  2319. // instead of a hash lookup
  2320. if (hookRE.test(event)) {
  2321. vm._hasHookEvent = true;
  2322. }
  2323. }
  2324. return vm
  2325. };
  2326. Vue.prototype.$once = function (event, fn) {
  2327. var vm = this;
  2328. function on () {
  2329. vm.$off(event, on);
  2330. fn.apply(vm, arguments);
  2331. }
  2332. on.fn = fn;
  2333. vm.$on(event, on);
  2334. return vm
  2335. };
  2336. Vue.prototype.$off = function (event, fn) {
  2337. var vm = this;
  2338. // all
  2339. if (!arguments.length) {
  2340. vm._events = Object.create(null);
  2341. return vm
  2342. }
  2343. // array of events
  2344. if (Array.isArray(event)) {
  2345. for (var i = 0, l = event.length; i < l; i++) {
  2346. vm.$off(event[i], fn);
  2347. }
  2348. return vm
  2349. }
  2350. // specific event
  2351. var cbs = vm._events[event];
  2352. if (!cbs) {
  2353. return vm
  2354. }
  2355. if (!fn) {
  2356. vm._events[event] = null;
  2357. return vm
  2358. }
  2359. if (fn) {
  2360. // specific handler
  2361. var cb;
  2362. var i$1 = cbs.length;
  2363. while (i$1--) {
  2364. cb = cbs[i$1];
  2365. if (cb === fn || cb.fn === fn) {
  2366. cbs.splice(i$1, 1);
  2367. break
  2368. }
  2369. }
  2370. }
  2371. return vm
  2372. };
  2373. Vue.prototype.$emit = function (event) {
  2374. var vm = this;
  2375. if (process.env.NODE_ENV !== 'production') {
  2376. var lowerCaseEvent = event.toLowerCase();
  2377. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  2378. tip(
  2379. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  2380. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  2381. "Note that HTML attributes are case-insensitive and you cannot use " +
  2382. "v-on to listen to camelCase events when using in-DOM templates. " +
  2383. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  2384. );
  2385. }
  2386. }
  2387. var cbs = vm._events[event];
  2388. if (cbs) {
  2389. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  2390. var args = toArray(arguments, 1);
  2391. for (var i = 0, l = cbs.length; i < l; i++) {
  2392. try {
  2393. cbs[i].apply(vm, args);
  2394. } catch (e) {
  2395. handleError(e, vm, ("event handler for \"" + event + "\""));
  2396. }
  2397. }
  2398. }
  2399. return vm
  2400. };
  2401. }
  2402. /* */
  2403. /**
  2404. * Runtime helper for resolving raw children VNodes into a slot object.
  2405. */
  2406. function resolveSlots (
  2407. children,
  2408. context
  2409. ) {
  2410. var slots = {};
  2411. if (!children) {
  2412. return slots
  2413. }
  2414. for (var i = 0, l = children.length; i < l; i++) {
  2415. var child = children[i];
  2416. var data = child.data;
  2417. // remove slot attribute if the node is resolved as a Vue slot node
  2418. if (data && data.attrs && data.attrs.slot) {
  2419. delete data.attrs.slot;
  2420. }
  2421. // named slots should only be respected if the vnode was rendered in the
  2422. // same context.
  2423. if ((child.context === context || child.fnContext === context) &&
  2424. data && data.slot != null
  2425. ) {
  2426. var name = data.slot;
  2427. var slot = (slots[name] || (slots[name] = []));
  2428. if (child.tag === 'template') {
  2429. slot.push.apply(slot, child.children || []);
  2430. } else {
  2431. slot.push(child);
  2432. }
  2433. } else {
  2434. (slots.default || (slots.default = [])).push(child);
  2435. }
  2436. }
  2437. // ignore slots that contains only whitespace
  2438. for (var name$1 in slots) {
  2439. if (slots[name$1].every(isWhitespace)) {
  2440. delete slots[name$1];
  2441. }
  2442. }
  2443. return slots
  2444. }
  2445. function isWhitespace (node) {
  2446. return (node.isComment && !node.asyncFactory) || node.text === ' '
  2447. }
  2448. function resolveScopedSlots (
  2449. fns, // see flow/vnode
  2450. res
  2451. ) {
  2452. res = res || {};
  2453. for (var i = 0; i < fns.length; i++) {
  2454. if (Array.isArray(fns[i])) {
  2455. resolveScopedSlots(fns[i], res);
  2456. } else {
  2457. res[fns[i].key] = fns[i].fn;
  2458. }
  2459. }
  2460. return res
  2461. }
  2462. /* */
  2463. var activeInstance = null;
  2464. var isUpdatingChildComponent = false;
  2465. function setActiveInstance(vm) {
  2466. var prevActiveInstance = activeInstance;
  2467. activeInstance = vm;
  2468. return function () {
  2469. activeInstance = prevActiveInstance;
  2470. }
  2471. }
  2472. function initLifecycle (vm) {
  2473. var options = vm.$options;
  2474. // locate first non-abstract parent
  2475. var parent = options.parent;
  2476. if (parent && !options.abstract) {
  2477. while (parent.$options.abstract && parent.$parent) {
  2478. parent = parent.$parent;
  2479. }
  2480. parent.$children.push(vm);
  2481. }
  2482. vm.$parent = parent;
  2483. vm.$root = parent ? parent.$root : vm;
  2484. vm.$children = [];
  2485. vm.$refs = {};
  2486. vm._watcher = null;
  2487. vm._inactive = null;
  2488. vm._directInactive = false;
  2489. vm._isMounted = false;
  2490. vm._isDestroyed = false;
  2491. vm._isBeingDestroyed = false;
  2492. }
  2493. function lifecycleMixin (Vue) {
  2494. Vue.prototype._update = function (vnode, hydrating) {
  2495. var vm = this;
  2496. var prevEl = vm.$el;
  2497. var prevVnode = vm._vnode;
  2498. var restoreActiveInstance = setActiveInstance(vm);
  2499. vm._vnode = vnode;
  2500. // Vue.prototype.__patch__ is injected in entry points
  2501. // based on the rendering backend used.
  2502. if (!prevVnode) {
  2503. // initial render
  2504. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  2505. } else {
  2506. // updates
  2507. vm.$el = vm.__patch__(prevVnode, vnode);
  2508. }
  2509. restoreActiveInstance();
  2510. // update __vue__ reference
  2511. if (prevEl) {
  2512. prevEl.__vue__ = null;
  2513. }
  2514. if (vm.$el) {
  2515. vm.$el.__vue__ = vm;
  2516. }
  2517. // if parent is an HOC, update its $el as well
  2518. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  2519. vm.$parent.$el = vm.$el;
  2520. }
  2521. // updated hook is called by the scheduler to ensure that children are
  2522. // updated in a parent's updated hook.
  2523. };
  2524. Vue.prototype.$forceUpdate = function () {
  2525. var vm = this;
  2526. if (vm._watcher) {
  2527. vm._watcher.update();
  2528. }
  2529. };
  2530. Vue.prototype.$destroy = function () {
  2531. var vm = this;
  2532. if (vm._isBeingDestroyed) {
  2533. return
  2534. }
  2535. callHook(vm, 'beforeDestroy');
  2536. vm._isBeingDestroyed = true;
  2537. // remove self from parent
  2538. var parent = vm.$parent;
  2539. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  2540. remove(parent.$children, vm);
  2541. }
  2542. // teardown watchers
  2543. if (vm._watcher) {
  2544. vm._watcher.teardown();
  2545. }
  2546. var i = vm._watchers.length;
  2547. while (i--) {
  2548. vm._watchers[i].teardown();
  2549. }
  2550. // remove reference from data ob
  2551. // frozen object may not have observer.
  2552. if (vm._data.__ob__) {
  2553. vm._data.__ob__.vmCount--;
  2554. }
  2555. // call the last hook...
  2556. vm._isDestroyed = true;
  2557. // invoke destroy hooks on current rendered tree
  2558. vm.__patch__(vm._vnode, null);
  2559. // fire destroyed hook
  2560. callHook(vm, 'destroyed');
  2561. // turn off all instance listeners.
  2562. vm.$off();
  2563. // remove __vue__ reference
  2564. if (vm.$el) {
  2565. vm.$el.__vue__ = null;
  2566. }
  2567. // release circular reference (#6759)
  2568. if (vm.$vnode) {
  2569. vm.$vnode.parent = null;
  2570. }
  2571. };
  2572. }
  2573. function mountComponent (
  2574. vm,
  2575. el,
  2576. hydrating
  2577. ) {
  2578. vm.$el = el;
  2579. if (!vm.$options.render) {
  2580. vm.$options.render = createEmptyVNode;
  2581. if (process.env.NODE_ENV !== 'production') {
  2582. /* istanbul ignore if */
  2583. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  2584. vm.$options.el || el) {
  2585. warn(
  2586. 'You are using the runtime-only build of Vue where the template ' +
  2587. 'compiler is not available. Either pre-compile the templates into ' +
  2588. 'render functions, or use the compiler-included build.',
  2589. vm
  2590. );
  2591. } else {
  2592. warn(
  2593. 'Failed to mount component: template or render function not defined.',
  2594. vm
  2595. );
  2596. }
  2597. }
  2598. }
  2599. callHook(vm, 'beforeMount');
  2600. var updateComponent;
  2601. /* istanbul ignore if */
  2602. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  2603. updateComponent = function () {
  2604. var name = vm._name;
  2605. var id = vm._uid;
  2606. var startTag = "vue-perf-start:" + id;
  2607. var endTag = "vue-perf-end:" + id;
  2608. mark(startTag);
  2609. var vnode = vm._render();
  2610. mark(endTag);
  2611. measure(("vue " + name + " render"), startTag, endTag);
  2612. mark(startTag);
  2613. vm._update(vnode, hydrating);
  2614. mark(endTag);
  2615. measure(("vue " + name + " patch"), startTag, endTag);
  2616. };
  2617. } else {
  2618. updateComponent = function () {
  2619. vm._update(vm._render(), hydrating);
  2620. };
  2621. }
  2622. // we set this to vm._watcher inside the watcher's constructor
  2623. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  2624. // component's mounted hook), which relies on vm._watcher being already defined
  2625. new Watcher(vm, updateComponent, noop, {
  2626. before: function before () {
  2627. if (vm._isMounted && !vm._isDestroyed) {
  2628. callHook(vm, 'beforeUpdate');
  2629. }
  2630. }
  2631. }, true /* isRenderWatcher */);
  2632. hydrating = false;
  2633. // manually mounted instance, call mounted on self
  2634. // mounted is called for render-created child components in its inserted hook
  2635. if (vm.$vnode == null) {
  2636. vm._isMounted = true;
  2637. callHook(vm, 'mounted');
  2638. }
  2639. return vm
  2640. }
  2641. function updateChildComponent (
  2642. vm,
  2643. propsData,
  2644. listeners,
  2645. parentVnode,
  2646. renderChildren
  2647. ) {
  2648. if (process.env.NODE_ENV !== 'production') {
  2649. isUpdatingChildComponent = true;
  2650. }
  2651. // determine whether component has slot children
  2652. // we need to do this before overwriting $options._renderChildren
  2653. var hasChildren = !!(
  2654. renderChildren || // has new static slots
  2655. vm.$options._renderChildren || // has old static slots
  2656. parentVnode.data.scopedSlots || // has new scoped slots
  2657. vm.$scopedSlots !== emptyObject // has old scoped slots
  2658. );
  2659. vm.$options._parentVnode = parentVnode;
  2660. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  2661. if (vm._vnode) { // update child tree's parent
  2662. vm._vnode.parent = parentVnode;
  2663. }
  2664. vm.$options._renderChildren = renderChildren;
  2665. // update $attrs and $listeners hash
  2666. // these are also reactive so they may trigger child update if the child
  2667. // used them during render
  2668. vm.$attrs = parentVnode.data.attrs || emptyObject;
  2669. vm.$listeners = listeners || emptyObject;
  2670. // update props
  2671. if (propsData && vm.$options.props) {
  2672. toggleObserving(false);
  2673. var props = vm._props;
  2674. var propKeys = vm.$options._propKeys || [];
  2675. for (var i = 0; i < propKeys.length; i++) {
  2676. var key = propKeys[i];
  2677. var propOptions = vm.$options.props; // wtf flow?
  2678. props[key] = validateProp(key, propOptions, propsData, vm);
  2679. }
  2680. toggleObserving(true);
  2681. // keep a copy of raw propsData
  2682. vm.$options.propsData = propsData;
  2683. }
  2684. // update listeners
  2685. listeners = listeners || emptyObject;
  2686. var oldListeners = vm.$options._parentListeners;
  2687. vm.$options._parentListeners = listeners;
  2688. updateComponentListeners(vm, listeners, oldListeners);
  2689. // resolve slots + force update if has children
  2690. if (hasChildren) {
  2691. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  2692. vm.$forceUpdate();
  2693. }
  2694. if (process.env.NODE_ENV !== 'production') {
  2695. isUpdatingChildComponent = false;
  2696. }
  2697. }
  2698. function isInInactiveTree (vm) {
  2699. while (vm && (vm = vm.$parent)) {
  2700. if (vm._inactive) { return true }
  2701. }
  2702. return false
  2703. }
  2704. function activateChildComponent (vm, direct) {
  2705. if (direct) {
  2706. vm._directInactive = false;
  2707. if (isInInactiveTree(vm)) {
  2708. return
  2709. }
  2710. } else if (vm._directInactive) {
  2711. return
  2712. }
  2713. if (vm._inactive || vm._inactive === null) {
  2714. vm._inactive = false;
  2715. for (var i = 0; i < vm.$children.length; i++) {
  2716. activateChildComponent(vm.$children[i]);
  2717. }
  2718. callHook(vm, 'activated');
  2719. }
  2720. }
  2721. function deactivateChildComponent (vm, direct) {
  2722. if (direct) {
  2723. vm._directInactive = true;
  2724. if (isInInactiveTree(vm)) {
  2725. return
  2726. }
  2727. }
  2728. if (!vm._inactive) {
  2729. vm._inactive = true;
  2730. for (var i = 0; i < vm.$children.length; i++) {
  2731. deactivateChildComponent(vm.$children[i]);
  2732. }
  2733. callHook(vm, 'deactivated');
  2734. }
  2735. }
  2736. function callHook (vm, hook) {
  2737. // #7573 disable dep collection when invoking lifecycle hooks
  2738. pushTarget();
  2739. var handlers = vm.$options[hook];
  2740. if (handlers) {
  2741. for (var i = 0, j = handlers.length; i < j; i++) {
  2742. try {
  2743. handlers[i].call(vm);
  2744. } catch (e) {
  2745. handleError(e, vm, (hook + " hook"));
  2746. }
  2747. }
  2748. }
  2749. if (vm._hasHookEvent) {
  2750. vm.$emit('hook:' + hook);
  2751. }
  2752. popTarget();
  2753. }
  2754. /* */
  2755. var MAX_UPDATE_COUNT = 100;
  2756. var queue = [];
  2757. var activatedChildren = [];
  2758. var has = {};
  2759. var circular = {};
  2760. var waiting = false;
  2761. var flushing = false;
  2762. var index = 0;
  2763. /**
  2764. * Reset the scheduler's state.
  2765. */
  2766. function resetSchedulerState () {
  2767. index = queue.length = activatedChildren.length = 0;
  2768. has = {};
  2769. if (process.env.NODE_ENV !== 'production') {
  2770. circular = {};
  2771. }
  2772. waiting = flushing = false;
  2773. }
  2774. /**
  2775. * Flush both queues and run the watchers.
  2776. */
  2777. function flushSchedulerQueue () {
  2778. flushing = true;
  2779. var watcher, id;
  2780. // Sort queue before flush.
  2781. // This ensures that:
  2782. // 1. Components are updated from parent to child. (because parent is always
  2783. // created before the child)
  2784. // 2. A component's user watchers are run before its render watcher (because
  2785. // user watchers are created before the render watcher)
  2786. // 3. If a component is destroyed during a parent component's watcher run,
  2787. // its watchers can be skipped.
  2788. queue.sort(function (a, b) { return a.id - b.id; });
  2789. // do not cache length because more watchers might be pushed
  2790. // as we run existing watchers
  2791. for (index = 0; index < queue.length; index++) {
  2792. watcher = queue[index];
  2793. if (watcher.before) {
  2794. watcher.before();
  2795. }
  2796. id = watcher.id;
  2797. has[id] = null;
  2798. watcher.run();
  2799. // in dev build, check and stop circular updates.
  2800. if (process.env.NODE_ENV !== 'production' && has[id] != null) {
  2801. circular[id] = (circular[id] || 0) + 1;
  2802. if (circular[id] > MAX_UPDATE_COUNT) {
  2803. warn(
  2804. 'You may have an infinite update loop ' + (
  2805. watcher.user
  2806. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  2807. : "in a component render function."
  2808. ),
  2809. watcher.vm
  2810. );
  2811. break
  2812. }
  2813. }
  2814. }
  2815. // keep copies of post queues before resetting state
  2816. var activatedQueue = activatedChildren.slice();
  2817. var updatedQueue = queue.slice();
  2818. resetSchedulerState();
  2819. // call component updated and activated hooks
  2820. callActivatedHooks(activatedQueue);
  2821. callUpdatedHooks(updatedQueue);
  2822. // devtool hook
  2823. /* istanbul ignore if */
  2824. if (devtools && config.devtools) {
  2825. devtools.emit('flush');
  2826. }
  2827. }
  2828. function callUpdatedHooks (queue) {
  2829. var i = queue.length;
  2830. while (i--) {
  2831. var watcher = queue[i];
  2832. var vm = watcher.vm;
  2833. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  2834. callHook(vm, 'updated');
  2835. }
  2836. }
  2837. }
  2838. /**
  2839. * Queue a kept-alive component that was activated during patch.
  2840. * The queue will be processed after the entire tree has been patched.
  2841. */
  2842. function queueActivatedComponent (vm) {
  2843. // setting _inactive to false here so that a render function can
  2844. // rely on checking whether it's in an inactive tree (e.g. router-view)
  2845. vm._inactive = false;
  2846. activatedChildren.push(vm);
  2847. }
  2848. function callActivatedHooks (queue) {
  2849. for (var i = 0; i < queue.length; i++) {
  2850. queue[i]._inactive = true;
  2851. activateChildComponent(queue[i], true /* true */);
  2852. }
  2853. }
  2854. /**
  2855. * Push a watcher into the watcher queue.
  2856. * Jobs with duplicate IDs will be skipped unless it's
  2857. * pushed when the queue is being flushed.
  2858. */
  2859. function queueWatcher (watcher) {
  2860. var id = watcher.id;
  2861. if (has[id] == null) {
  2862. has[id] = true;
  2863. if (!flushing) {
  2864. queue.push(watcher);
  2865. } else {
  2866. // if already flushing, splice the watcher based on its id
  2867. // if already past its id, it will be run next immediately.
  2868. var i = queue.length - 1;
  2869. while (i > index && queue[i].id > watcher.id) {
  2870. i--;
  2871. }
  2872. queue.splice(i + 1, 0, watcher);
  2873. }
  2874. // queue the flush
  2875. if (!waiting) {
  2876. waiting = true;
  2877. if (process.env.NODE_ENV !== 'production' && !config.async) {
  2878. flushSchedulerQueue();
  2879. return
  2880. }
  2881. nextTick(flushSchedulerQueue);
  2882. }
  2883. }
  2884. }
  2885. /* */
  2886. var uid$1 = 0;
  2887. /**
  2888. * A watcher parses an expression, collects dependencies,
  2889. * and fires callback when the expression value changes.
  2890. * This is used for both the $watch() api and directives.
  2891. */
  2892. var Watcher = function Watcher (
  2893. vm,
  2894. expOrFn,
  2895. cb,
  2896. options,
  2897. isRenderWatcher
  2898. ) {
  2899. this.vm = vm;
  2900. if (isRenderWatcher) {
  2901. vm._watcher = this;
  2902. }
  2903. vm._watchers.push(this);
  2904. // options
  2905. if (options) {
  2906. this.deep = !!options.deep;
  2907. this.user = !!options.user;
  2908. this.lazy = !!options.lazy;
  2909. this.sync = !!options.sync;
  2910. this.before = options.before;
  2911. } else {
  2912. this.deep = this.user = this.lazy = this.sync = false;
  2913. }
  2914. this.cb = cb;
  2915. this.id = ++uid$1; // uid for batching
  2916. this.active = true;
  2917. this.dirty = this.lazy; // for lazy watchers
  2918. this.deps = [];
  2919. this.newDeps = [];
  2920. this.depIds = new _Set();
  2921. this.newDepIds = new _Set();
  2922. this.expression = process.env.NODE_ENV !== 'production'
  2923. ? expOrFn.toString()
  2924. : '';
  2925. // parse expression for getter
  2926. if (typeof expOrFn === 'function') {
  2927. this.getter = expOrFn;
  2928. } else {
  2929. this.getter = parsePath(expOrFn);
  2930. if (!this.getter) {
  2931. this.getter = noop;
  2932. process.env.NODE_ENV !== 'production' && warn(
  2933. "Failed watching path: \"" + expOrFn + "\" " +
  2934. 'Watcher only accepts simple dot-delimited paths. ' +
  2935. 'For full control, use a function instead.',
  2936. vm
  2937. );
  2938. }
  2939. }
  2940. this.value = this.lazy
  2941. ? undefined
  2942. : this.get();
  2943. };
  2944. /**
  2945. * Evaluate the getter, and re-collect dependencies.
  2946. */
  2947. Watcher.prototype.get = function get () {
  2948. pushTarget(this);
  2949. var value;
  2950. var vm = this.vm;
  2951. try {
  2952. value = this.getter.call(vm, vm);
  2953. } catch (e) {
  2954. if (this.user) {
  2955. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  2956. } else {
  2957. throw e
  2958. }
  2959. } finally {
  2960. // "touch" every property so they are all tracked as
  2961. // dependencies for deep watching
  2962. if (this.deep) {
  2963. traverse(value);
  2964. }
  2965. popTarget();
  2966. this.cleanupDeps();
  2967. }
  2968. return value
  2969. };
  2970. /**
  2971. * Add a dependency to this directive.
  2972. */
  2973. Watcher.prototype.addDep = function addDep (dep) {
  2974. var id = dep.id;
  2975. if (!this.newDepIds.has(id)) {
  2976. this.newDepIds.add(id);
  2977. this.newDeps.push(dep);
  2978. if (!this.depIds.has(id)) {
  2979. dep.addSub(this);
  2980. }
  2981. }
  2982. };
  2983. /**
  2984. * Clean up for dependency collection.
  2985. */
  2986. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  2987. var i = this.deps.length;
  2988. while (i--) {
  2989. var dep = this.deps[i];
  2990. if (!this.newDepIds.has(dep.id)) {
  2991. dep.removeSub(this);
  2992. }
  2993. }
  2994. var tmp = this.depIds;
  2995. this.depIds = this.newDepIds;
  2996. this.newDepIds = tmp;
  2997. this.newDepIds.clear();
  2998. tmp = this.deps;
  2999. this.deps = this.newDeps;
  3000. this.newDeps = tmp;
  3001. this.newDeps.length = 0;
  3002. };
  3003. /**
  3004. * Subscriber interface.
  3005. * Will be called when a dependency changes.
  3006. */
  3007. Watcher.prototype.update = function update () {
  3008. /* istanbul ignore else */
  3009. if (this.lazy) {
  3010. this.dirty = true;
  3011. } else if (this.sync) {
  3012. this.run();
  3013. } else {
  3014. queueWatcher(this);
  3015. }
  3016. };
  3017. /**
  3018. * Scheduler job interface.
  3019. * Will be called by the scheduler.
  3020. */
  3021. Watcher.prototype.run = function run () {
  3022. if (this.active) {
  3023. var value = this.get();
  3024. if (
  3025. value !== this.value ||
  3026. // Deep watchers and watchers on Object/Arrays should fire even
  3027. // when the value is the same, because the value may
  3028. // have mutated.
  3029. isObject(value) ||
  3030. this.deep
  3031. ) {
  3032. // set new value
  3033. var oldValue = this.value;
  3034. this.value = value;
  3035. if (this.user) {
  3036. try {
  3037. this.cb.call(this.vm, value, oldValue);
  3038. } catch (e) {
  3039. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  3040. }
  3041. } else {
  3042. this.cb.call(this.vm, value, oldValue);
  3043. }
  3044. }
  3045. }
  3046. };
  3047. /**
  3048. * Evaluate the value of the watcher.
  3049. * This only gets called for lazy watchers.
  3050. */
  3051. Watcher.prototype.evaluate = function evaluate () {
  3052. this.value = this.get();
  3053. this.dirty = false;
  3054. };
  3055. /**
  3056. * Depend on all deps collected by this watcher.
  3057. */
  3058. Watcher.prototype.depend = function depend () {
  3059. var i = this.deps.length;
  3060. while (i--) {
  3061. this.deps[i].depend();
  3062. }
  3063. };
  3064. /**
  3065. * Remove self from all dependencies' subscriber list.
  3066. */
  3067. Watcher.prototype.teardown = function teardown () {
  3068. if (this.active) {
  3069. // remove self from vm's watcher list
  3070. // this is a somewhat expensive operation so we skip it
  3071. // if the vm is being destroyed.
  3072. if (!this.vm._isBeingDestroyed) {
  3073. remove(this.vm._watchers, this);
  3074. }
  3075. var i = this.deps.length;
  3076. while (i--) {
  3077. this.deps[i].removeSub(this);
  3078. }
  3079. this.active = false;
  3080. }
  3081. };
  3082. /* */
  3083. var sharedPropertyDefinition = {
  3084. enumerable: true,
  3085. configurable: true,
  3086. get: noop,
  3087. set: noop
  3088. };
  3089. function proxy (target, sourceKey, key) {
  3090. sharedPropertyDefinition.get = function proxyGetter () {
  3091. return this[sourceKey][key]
  3092. };
  3093. sharedPropertyDefinition.set = function proxySetter (val) {
  3094. this[sourceKey][key] = val;
  3095. };
  3096. Object.defineProperty(target, key, sharedPropertyDefinition);
  3097. }
  3098. function initState (vm) {
  3099. vm._watchers = [];
  3100. var opts = vm.$options;
  3101. if (opts.props) { initProps(vm, opts.props); }
  3102. if (opts.methods) { initMethods(vm, opts.methods); }
  3103. if (opts.data) {
  3104. initData(vm);
  3105. } else {
  3106. observe(vm._data = {}, true /* asRootData */);
  3107. }
  3108. if (opts.computed) { initComputed(vm, opts.computed); }
  3109. if (opts.watch && opts.watch !== nativeWatch) {
  3110. initWatch(vm, opts.watch);
  3111. }
  3112. }
  3113. function initProps (vm, propsOptions) {
  3114. var propsData = vm.$options.propsData || {};
  3115. var props = vm._props = {};
  3116. // cache prop keys so that future props updates can iterate using Array
  3117. // instead of dynamic object key enumeration.
  3118. var keys = vm.$options._propKeys = [];
  3119. var isRoot = !vm.$parent;
  3120. // root instance props should be converted
  3121. if (!isRoot) {
  3122. toggleObserving(false);
  3123. }
  3124. var loop = function ( key ) {
  3125. keys.push(key);
  3126. var value = validateProp(key, propsOptions, propsData, vm);
  3127. /* istanbul ignore else */
  3128. if (process.env.NODE_ENV !== 'production') {
  3129. var hyphenatedKey = hyphenate(key);
  3130. if (isReservedAttribute(hyphenatedKey) ||
  3131. config.isReservedAttr(hyphenatedKey)) {
  3132. warn(
  3133. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  3134. vm
  3135. );
  3136. }
  3137. defineReactive$$1(props, key, value, function () {
  3138. if (!isRoot && !isUpdatingChildComponent) {
  3139. warn(
  3140. "Avoid mutating a prop directly since the value will be " +
  3141. "overwritten whenever the parent component re-renders. " +
  3142. "Instead, use a data or computed property based on the prop's " +
  3143. "value. Prop being mutated: \"" + key + "\"",
  3144. vm
  3145. );
  3146. }
  3147. });
  3148. } else {
  3149. defineReactive$$1(props, key, value);
  3150. }
  3151. // static props are already proxied on the component's prototype
  3152. // during Vue.extend(). We only need to proxy props defined at
  3153. // instantiation here.
  3154. if (!(key in vm)) {
  3155. proxy(vm, "_props", key);
  3156. }
  3157. };
  3158. for (var key in propsOptions) loop( key );
  3159. toggleObserving(true);
  3160. }
  3161. function initData (vm) {
  3162. var data = vm.$options.data;
  3163. data = vm._data = typeof data === 'function'
  3164. ? getData(data, vm)
  3165. : data || {};
  3166. if (!isPlainObject(data)) {
  3167. data = {};
  3168. process.env.NODE_ENV !== 'production' && warn(
  3169. 'data functions should return an object:\n' +
  3170. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  3171. vm
  3172. );
  3173. }
  3174. // proxy data on instance
  3175. var keys = Object.keys(data);
  3176. var props = vm.$options.props;
  3177. var methods = vm.$options.methods;
  3178. var i = keys.length;
  3179. while (i--) {
  3180. var key = keys[i];
  3181. if (process.env.NODE_ENV !== 'production') {
  3182. if (methods && hasOwn(methods, key)) {
  3183. warn(
  3184. ("Method \"" + key + "\" has already been defined as a data property."),
  3185. vm
  3186. );
  3187. }
  3188. }
  3189. if (props && hasOwn(props, key)) {
  3190. process.env.NODE_ENV !== 'production' && warn(
  3191. "The data property \"" + key + "\" is already declared as a prop. " +
  3192. "Use prop default value instead.",
  3193. vm
  3194. );
  3195. } else if (!isReserved(key)) {
  3196. proxy(vm, "_data", key);
  3197. }
  3198. }
  3199. // observe data
  3200. observe(data, true /* asRootData */);
  3201. }
  3202. function getData (data, vm) {
  3203. // #7573 disable dep collection when invoking data getters
  3204. pushTarget();
  3205. try {
  3206. return data.call(vm, vm)
  3207. } catch (e) {
  3208. handleError(e, vm, "data()");
  3209. return {}
  3210. } finally {
  3211. popTarget();
  3212. }
  3213. }
  3214. var computedWatcherOptions = { lazy: true };
  3215. function initComputed (vm, computed) {
  3216. // $flow-disable-line
  3217. var watchers = vm._computedWatchers = Object.create(null);
  3218. // computed properties are just getters during SSR
  3219. var isSSR = isServerRendering();
  3220. for (var key in computed) {
  3221. var userDef = computed[key];
  3222. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  3223. if (process.env.NODE_ENV !== 'production' && getter == null) {
  3224. warn(
  3225. ("Getter is missing for computed property \"" + key + "\"."),
  3226. vm
  3227. );
  3228. }
  3229. if (!isSSR) {
  3230. // create internal watcher for the computed property.
  3231. watchers[key] = new Watcher(
  3232. vm,
  3233. getter || noop,
  3234. noop,
  3235. computedWatcherOptions
  3236. );
  3237. }
  3238. // component-defined computed properties are already defined on the
  3239. // component prototype. We only need to define computed properties defined
  3240. // at instantiation here.
  3241. if (!(key in vm)) {
  3242. defineComputed(vm, key, userDef);
  3243. } else if (process.env.NODE_ENV !== 'production') {
  3244. if (key in vm.$data) {
  3245. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  3246. } else if (vm.$options.props && key in vm.$options.props) {
  3247. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  3248. }
  3249. }
  3250. }
  3251. }
  3252. function defineComputed (
  3253. target,
  3254. key,
  3255. userDef
  3256. ) {
  3257. var shouldCache = !isServerRendering();
  3258. if (typeof userDef === 'function') {
  3259. sharedPropertyDefinition.get = shouldCache
  3260. ? createComputedGetter(key)
  3261. : createGetterInvoker(userDef);
  3262. sharedPropertyDefinition.set = noop;
  3263. } else {
  3264. sharedPropertyDefinition.get = userDef.get
  3265. ? shouldCache && userDef.cache !== false
  3266. ? createComputedGetter(key)
  3267. : createGetterInvoker(userDef.get)
  3268. : noop;
  3269. sharedPropertyDefinition.set = userDef.set || noop;
  3270. }
  3271. if (process.env.NODE_ENV !== 'production' &&
  3272. sharedPropertyDefinition.set === noop) {
  3273. sharedPropertyDefinition.set = function () {
  3274. warn(
  3275. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  3276. this
  3277. );
  3278. };
  3279. }
  3280. Object.defineProperty(target, key, sharedPropertyDefinition);
  3281. }
  3282. function createComputedGetter (key) {
  3283. return function computedGetter () {
  3284. var watcher = this._computedWatchers && this._computedWatchers[key];
  3285. if (watcher) {
  3286. if (watcher.dirty) {
  3287. watcher.evaluate();
  3288. }
  3289. if (Dep.target) {
  3290. watcher.depend();
  3291. }
  3292. return watcher.value
  3293. }
  3294. }
  3295. }
  3296. function createGetterInvoker(fn) {
  3297. return function computedGetter () {
  3298. return fn.call(this, this)
  3299. }
  3300. }
  3301. function initMethods (vm, methods) {
  3302. var props = vm.$options.props;
  3303. for (var key in methods) {
  3304. if (process.env.NODE_ENV !== 'production') {
  3305. if (typeof methods[key] !== 'function') {
  3306. warn(
  3307. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  3308. "Did you reference the function correctly?",
  3309. vm
  3310. );
  3311. }
  3312. if (props && hasOwn(props, key)) {
  3313. warn(
  3314. ("Method \"" + key + "\" has already been defined as a prop."),
  3315. vm
  3316. );
  3317. }
  3318. if ((key in vm) && isReserved(key)) {
  3319. warn(
  3320. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  3321. "Avoid defining component methods that start with _ or $."
  3322. );
  3323. }
  3324. }
  3325. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  3326. }
  3327. }
  3328. function initWatch (vm, watch) {
  3329. for (var key in watch) {
  3330. var handler = watch[key];
  3331. if (Array.isArray(handler)) {
  3332. for (var i = 0; i < handler.length; i++) {
  3333. createWatcher(vm, key, handler[i]);
  3334. }
  3335. } else {
  3336. createWatcher(vm, key, handler);
  3337. }
  3338. }
  3339. }
  3340. function createWatcher (
  3341. vm,
  3342. expOrFn,
  3343. handler,
  3344. options
  3345. ) {
  3346. if (isPlainObject(handler)) {
  3347. options = handler;
  3348. handler = handler.handler;
  3349. }
  3350. if (typeof handler === 'string') {
  3351. handler = vm[handler];
  3352. }
  3353. return vm.$watch(expOrFn, handler, options)
  3354. }
  3355. function stateMixin (Vue) {
  3356. // flow somehow has problems with directly declared definition object
  3357. // when using Object.defineProperty, so we have to procedurally build up
  3358. // the object here.
  3359. var dataDef = {};
  3360. dataDef.get = function () { return this._data };
  3361. var propsDef = {};
  3362. propsDef.get = function () { return this._props };
  3363. if (process.env.NODE_ENV !== 'production') {
  3364. dataDef.set = function () {
  3365. warn(
  3366. 'Avoid replacing instance root $data. ' +
  3367. 'Use nested data properties instead.',
  3368. this
  3369. );
  3370. };
  3371. propsDef.set = function () {
  3372. warn("$props is readonly.", this);
  3373. };
  3374. }
  3375. Object.defineProperty(Vue.prototype, '$data', dataDef);
  3376. Object.defineProperty(Vue.prototype, '$props', propsDef);
  3377. Vue.prototype.$set = set;
  3378. Vue.prototype.$delete = del;
  3379. Vue.prototype.$watch = function (
  3380. expOrFn,
  3381. cb,
  3382. options
  3383. ) {
  3384. var vm = this;
  3385. if (isPlainObject(cb)) {
  3386. return createWatcher(vm, expOrFn, cb, options)
  3387. }
  3388. options = options || {};
  3389. options.user = true;
  3390. var watcher = new Watcher(vm, expOrFn, cb, options);
  3391. if (options.immediate) {
  3392. try {
  3393. cb.call(vm, watcher.value);
  3394. } catch (error) {
  3395. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  3396. }
  3397. }
  3398. return function unwatchFn () {
  3399. watcher.teardown();
  3400. }
  3401. };
  3402. }
  3403. /* */
  3404. function initProvide (vm) {
  3405. var provide = vm.$options.provide;
  3406. if (provide) {
  3407. vm._provided = typeof provide === 'function'
  3408. ? provide.call(vm)
  3409. : provide;
  3410. }
  3411. }
  3412. function initInjections (vm) {
  3413. var result = resolveInject(vm.$options.inject, vm);
  3414. if (result) {
  3415. toggleObserving(false);
  3416. Object.keys(result).forEach(function (key) {
  3417. /* istanbul ignore else */
  3418. if (process.env.NODE_ENV !== 'production') {
  3419. defineReactive$$1(vm, key, result[key], function () {
  3420. warn(
  3421. "Avoid mutating an injected value directly since the changes will be " +
  3422. "overwritten whenever the provided component re-renders. " +
  3423. "injection being mutated: \"" + key + "\"",
  3424. vm
  3425. );
  3426. });
  3427. } else {
  3428. defineReactive$$1(vm, key, result[key]);
  3429. }
  3430. });
  3431. toggleObserving(true);
  3432. }
  3433. }
  3434. function resolveInject (inject, vm) {
  3435. if (inject) {
  3436. // inject is :any because flow is not smart enough to figure out cached
  3437. var result = Object.create(null);
  3438. var keys = hasSymbol
  3439. ? Reflect.ownKeys(inject).filter(function (key) {
  3440. /* istanbul ignore next */
  3441. return Object.getOwnPropertyDescriptor(inject, key).enumerable
  3442. })
  3443. : Object.keys(inject);
  3444. for (var i = 0; i < keys.length; i++) {
  3445. var key = keys[i];
  3446. var provideKey = inject[key].from;
  3447. var source = vm;
  3448. while (source) {
  3449. if (source._provided && hasOwn(source._provided, provideKey)) {
  3450. result[key] = source._provided[provideKey];
  3451. break
  3452. }
  3453. source = source.$parent;
  3454. }
  3455. if (!source) {
  3456. if ('default' in inject[key]) {
  3457. var provideDefault = inject[key].default;
  3458. result[key] = typeof provideDefault === 'function'
  3459. ? provideDefault.call(vm)
  3460. : provideDefault;
  3461. } else if (process.env.NODE_ENV !== 'production') {
  3462. warn(("Injection \"" + key + "\" not found"), vm);
  3463. }
  3464. }
  3465. }
  3466. return result
  3467. }
  3468. }
  3469. /* */
  3470. /**
  3471. * Runtime helper for rendering v-for lists.
  3472. */
  3473. function renderList (
  3474. val,
  3475. render
  3476. ) {
  3477. var ret, i, l, keys, key;
  3478. if (Array.isArray(val) || typeof val === 'string') {
  3479. ret = new Array(val.length);
  3480. for (i = 0, l = val.length; i < l; i++) {
  3481. ret[i] = render(val[i], i);
  3482. }
  3483. } else if (typeof val === 'number') {
  3484. ret = new Array(val);
  3485. for (i = 0; i < val; i++) {
  3486. ret[i] = render(i + 1, i);
  3487. }
  3488. } else if (isObject(val)) {
  3489. keys = Object.keys(val);
  3490. ret = new Array(keys.length);
  3491. for (i = 0, l = keys.length; i < l; i++) {
  3492. key = keys[i];
  3493. ret[i] = render(val[key], key, i);
  3494. }
  3495. }
  3496. if (!isDef(ret)) {
  3497. ret = [];
  3498. }
  3499. (ret)._isVList = true;
  3500. return ret
  3501. }
  3502. /* */
  3503. /**
  3504. * Runtime helper for rendering <slot>
  3505. */
  3506. function renderSlot (
  3507. name,
  3508. fallback,
  3509. props,
  3510. bindObject
  3511. ) {
  3512. var scopedSlotFn = this.$scopedSlots[name];
  3513. var nodes;
  3514. if (scopedSlotFn) { // scoped slot
  3515. props = props || {};
  3516. if (bindObject) {
  3517. if (process.env.NODE_ENV !== 'production' && !isObject(bindObject)) {
  3518. warn(
  3519. 'slot v-bind without argument expects an Object',
  3520. this
  3521. );
  3522. }
  3523. props = extend(extend({}, bindObject), props);
  3524. }
  3525. nodes = scopedSlotFn(props) || fallback;
  3526. } else {
  3527. nodes = this.$slots[name] || fallback;
  3528. }
  3529. var target = props && props.slot;
  3530. if (target) {
  3531. return this.$createElement('template', { slot: target }, nodes)
  3532. } else {
  3533. return nodes
  3534. }
  3535. }
  3536. /* */
  3537. /**
  3538. * Runtime helper for resolving filters
  3539. */
  3540. function resolveFilter (id) {
  3541. return resolveAsset(this.$options, 'filters', id, true) || identity
  3542. }
  3543. /* */
  3544. function isKeyNotMatch (expect, actual) {
  3545. if (Array.isArray(expect)) {
  3546. return expect.indexOf(actual) === -1
  3547. } else {
  3548. return expect !== actual
  3549. }
  3550. }
  3551. /**
  3552. * Runtime helper for checking keyCodes from config.
  3553. * exposed as Vue.prototype._k
  3554. * passing in eventKeyName as last argument separately for backwards compat
  3555. */
  3556. function checkKeyCodes (
  3557. eventKeyCode,
  3558. key,
  3559. builtInKeyCode,
  3560. eventKeyName,
  3561. builtInKeyName
  3562. ) {
  3563. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  3564. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  3565. return isKeyNotMatch(builtInKeyName, eventKeyName)
  3566. } else if (mappedKeyCode) {
  3567. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  3568. } else if (eventKeyName) {
  3569. return hyphenate(eventKeyName) !== key
  3570. }
  3571. }
  3572. /* */
  3573. /**
  3574. * Runtime helper for merging v-bind="object" into a VNode's data.
  3575. */
  3576. function bindObjectProps (
  3577. data,
  3578. tag,
  3579. value,
  3580. asProp,
  3581. isSync
  3582. ) {
  3583. if (value) {
  3584. if (!isObject(value)) {
  3585. process.env.NODE_ENV !== 'production' && warn(
  3586. 'v-bind without argument expects an Object or Array value',
  3587. this
  3588. );
  3589. } else {
  3590. if (Array.isArray(value)) {
  3591. value = toObject(value);
  3592. }
  3593. var hash;
  3594. var loop = function ( key ) {
  3595. if (
  3596. key === 'class' ||
  3597. key === 'style' ||
  3598. isReservedAttribute(key)
  3599. ) {
  3600. hash = data;
  3601. } else {
  3602. var type = data.attrs && data.attrs.type;
  3603. hash = asProp || config.mustUseProp(tag, type, key)
  3604. ? data.domProps || (data.domProps = {})
  3605. : data.attrs || (data.attrs = {});
  3606. }
  3607. var camelizedKey = camelize(key);
  3608. if (!(key in hash) && !(camelizedKey in hash)) {
  3609. hash[key] = value[key];
  3610. if (isSync) {
  3611. var on = data.on || (data.on = {});
  3612. on[("update:" + camelizedKey)] = function ($event) {
  3613. value[key] = $event;
  3614. };
  3615. }
  3616. }
  3617. };
  3618. for (var key in value) loop( key );
  3619. }
  3620. }
  3621. return data
  3622. }
  3623. /* */
  3624. /**
  3625. * Runtime helper for rendering static trees.
  3626. */
  3627. function renderStatic (
  3628. index,
  3629. isInFor
  3630. ) {
  3631. var cached = this._staticTrees || (this._staticTrees = []);
  3632. var tree = cached[index];
  3633. // if has already-rendered static tree and not inside v-for,
  3634. // we can reuse the same tree.
  3635. if (tree && !isInFor) {
  3636. return tree
  3637. }
  3638. // otherwise, render a fresh tree.
  3639. tree = cached[index] = this.$options.staticRenderFns[index].call(
  3640. this._renderProxy,
  3641. null,
  3642. this // for render fns generated for functional component templates
  3643. );
  3644. markStatic(tree, ("__static__" + index), false);
  3645. return tree
  3646. }
  3647. /**
  3648. * Runtime helper for v-once.
  3649. * Effectively it means marking the node as static with a unique key.
  3650. */
  3651. function markOnce (
  3652. tree,
  3653. index,
  3654. key
  3655. ) {
  3656. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  3657. return tree
  3658. }
  3659. function markStatic (
  3660. tree,
  3661. key,
  3662. isOnce
  3663. ) {
  3664. if (Array.isArray(tree)) {
  3665. for (var i = 0; i < tree.length; i++) {
  3666. if (tree[i] && typeof tree[i] !== 'string') {
  3667. markStaticNode(tree[i], (key + "_" + i), isOnce);
  3668. }
  3669. }
  3670. } else {
  3671. markStaticNode(tree, key, isOnce);
  3672. }
  3673. }
  3674. function markStaticNode (node, key, isOnce) {
  3675. node.isStatic = true;
  3676. node.key = key;
  3677. node.isOnce = isOnce;
  3678. }
  3679. /* */
  3680. function bindObjectListeners (data, value) {
  3681. if (value) {
  3682. if (!isPlainObject(value)) {
  3683. process.env.NODE_ENV !== 'production' && warn(
  3684. 'v-on without argument expects an Object value',
  3685. this
  3686. );
  3687. } else {
  3688. var on = data.on = data.on ? extend({}, data.on) : {};
  3689. for (var key in value) {
  3690. var existing = on[key];
  3691. var ours = value[key];
  3692. on[key] = existing ? [].concat(existing, ours) : ours;
  3693. }
  3694. }
  3695. }
  3696. return data
  3697. }
  3698. /* */
  3699. function installRenderHelpers (target) {
  3700. target._o = markOnce;
  3701. target._n = toNumber;
  3702. target._s = toString;
  3703. target._l = renderList;
  3704. target._t = renderSlot;
  3705. target._q = looseEqual;
  3706. target._i = looseIndexOf;
  3707. target._m = renderStatic;
  3708. target._f = resolveFilter;
  3709. target._k = checkKeyCodes;
  3710. target._b = bindObjectProps;
  3711. target._v = createTextVNode;
  3712. target._e = createEmptyVNode;
  3713. target._u = resolveScopedSlots;
  3714. target._g = bindObjectListeners;
  3715. }
  3716. /* */
  3717. function FunctionalRenderContext (
  3718. data,
  3719. props,
  3720. children,
  3721. parent,
  3722. Ctor
  3723. ) {
  3724. var options = Ctor.options;
  3725. // ensure the createElement function in functional components
  3726. // gets a unique context - this is necessary for correct named slot check
  3727. var contextVm;
  3728. if (hasOwn(parent, '_uid')) {
  3729. contextVm = Object.create(parent);
  3730. // $flow-disable-line
  3731. contextVm._original = parent;
  3732. } else {
  3733. // the context vm passed in is a functional context as well.
  3734. // in this case we want to make sure we are able to get a hold to the
  3735. // real context instance.
  3736. contextVm = parent;
  3737. // $flow-disable-line
  3738. parent = parent._original;
  3739. }
  3740. var isCompiled = isTrue(options._compiled);
  3741. var needNormalization = !isCompiled;
  3742. this.data = data;
  3743. this.props = props;
  3744. this.children = children;
  3745. this.parent = parent;
  3746. this.listeners = data.on || emptyObject;
  3747. this.injections = resolveInject(options.inject, parent);
  3748. this.slots = function () { return resolveSlots(children, parent); };
  3749. // support for compiled functional template
  3750. if (isCompiled) {
  3751. // exposing $options for renderStatic()
  3752. this.$options = options;
  3753. // pre-resolve slots for renderSlot()
  3754. this.$slots = this.slots();
  3755. this.$scopedSlots = data.scopedSlots || emptyObject;
  3756. }
  3757. if (options._scopeId) {
  3758. this._c = function (a, b, c, d) {
  3759. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  3760. if (vnode && !Array.isArray(vnode)) {
  3761. vnode.fnScopeId = options._scopeId;
  3762. vnode.fnContext = parent;
  3763. }
  3764. return vnode
  3765. };
  3766. } else {
  3767. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  3768. }
  3769. }
  3770. installRenderHelpers(FunctionalRenderContext.prototype);
  3771. function createFunctionalComponent (
  3772. Ctor,
  3773. propsData,
  3774. data,
  3775. contextVm,
  3776. children
  3777. ) {
  3778. var options = Ctor.options;
  3779. var props = {};
  3780. var propOptions = options.props;
  3781. if (isDef(propOptions)) {
  3782. for (var key in propOptions) {
  3783. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  3784. }
  3785. } else {
  3786. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  3787. if (isDef(data.props)) { mergeProps(props, data.props); }
  3788. }
  3789. var renderContext = new FunctionalRenderContext(
  3790. data,
  3791. props,
  3792. children,
  3793. contextVm,
  3794. Ctor
  3795. );
  3796. var vnode = options.render.call(null, renderContext._c, renderContext);
  3797. if (vnode instanceof VNode) {
  3798. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  3799. } else if (Array.isArray(vnode)) {
  3800. var vnodes = normalizeChildren(vnode) || [];
  3801. var res = new Array(vnodes.length);
  3802. for (var i = 0; i < vnodes.length; i++) {
  3803. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  3804. }
  3805. return res
  3806. }
  3807. }
  3808. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  3809. // #7817 clone node before setting fnContext, otherwise if the node is reused
  3810. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  3811. // that should not be matched to match.
  3812. var clone = cloneVNode(vnode);
  3813. clone.fnContext = contextVm;
  3814. clone.fnOptions = options;
  3815. if (process.env.NODE_ENV !== 'production') {
  3816. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  3817. }
  3818. if (data.slot) {
  3819. (clone.data || (clone.data = {})).slot = data.slot;
  3820. }
  3821. return clone
  3822. }
  3823. function mergeProps (to, from) {
  3824. for (var key in from) {
  3825. to[camelize(key)] = from[key];
  3826. }
  3827. }
  3828. /* */
  3829. /* */
  3830. /* */
  3831. /* */
  3832. // inline hooks to be invoked on component VNodes during patch
  3833. var componentVNodeHooks = {
  3834. init: function init (vnode, hydrating) {
  3835. if (
  3836. vnode.componentInstance &&
  3837. !vnode.componentInstance._isDestroyed &&
  3838. vnode.data.keepAlive
  3839. ) {
  3840. // kept-alive components, treat as a patch
  3841. var mountedNode = vnode; // work around flow
  3842. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  3843. } else {
  3844. var child = vnode.componentInstance = createComponentInstanceForVnode(
  3845. vnode,
  3846. activeInstance
  3847. );
  3848. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  3849. }
  3850. },
  3851. prepatch: function prepatch (oldVnode, vnode) {
  3852. var options = vnode.componentOptions;
  3853. var child = vnode.componentInstance = oldVnode.componentInstance;
  3854. updateChildComponent(
  3855. child,
  3856. options.propsData, // updated props
  3857. options.listeners, // updated listeners
  3858. vnode, // new parent vnode
  3859. options.children // new children
  3860. );
  3861. },
  3862. insert: function insert (vnode) {
  3863. var context = vnode.context;
  3864. var componentInstance = vnode.componentInstance;
  3865. if (!componentInstance._isMounted) {
  3866. componentInstance._isMounted = true;
  3867. callHook(componentInstance, 'mounted');
  3868. }
  3869. if (vnode.data.keepAlive) {
  3870. if (context._isMounted) {
  3871. // vue-router#1212
  3872. // During updates, a kept-alive component's child components may
  3873. // change, so directly walking the tree here may call activated hooks
  3874. // on incorrect children. Instead we push them into a queue which will
  3875. // be processed after the whole patch process ended.
  3876. queueActivatedComponent(componentInstance);
  3877. } else {
  3878. activateChildComponent(componentInstance, true /* direct */);
  3879. }
  3880. }
  3881. },
  3882. destroy: function destroy (vnode) {
  3883. var componentInstance = vnode.componentInstance;
  3884. if (!componentInstance._isDestroyed) {
  3885. if (!vnode.data.keepAlive) {
  3886. componentInstance.$destroy();
  3887. } else {
  3888. deactivateChildComponent(componentInstance, true /* direct */);
  3889. }
  3890. }
  3891. }
  3892. };
  3893. var hooksToMerge = Object.keys(componentVNodeHooks);
  3894. function createComponent (
  3895. Ctor,
  3896. data,
  3897. context,
  3898. children,
  3899. tag
  3900. ) {
  3901. if (isUndef(Ctor)) {
  3902. return
  3903. }
  3904. var baseCtor = context.$options._base;
  3905. // plain options object: turn it into a constructor
  3906. if (isObject(Ctor)) {
  3907. Ctor = baseCtor.extend(Ctor);
  3908. }
  3909. // if at this stage it's not a constructor or an async component factory,
  3910. // reject.
  3911. if (typeof Ctor !== 'function') {
  3912. if (process.env.NODE_ENV !== 'production') {
  3913. warn(("Invalid Component definition: " + (String(Ctor))), context);
  3914. }
  3915. return
  3916. }
  3917. // async component
  3918. var asyncFactory;
  3919. if (isUndef(Ctor.cid)) {
  3920. asyncFactory = Ctor;
  3921. Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context);
  3922. if (Ctor === undefined) {
  3923. // return a placeholder node for async component, which is rendered
  3924. // as a comment node but preserves all the raw information for the node.
  3925. // the information will be used for async server-rendering and hydration.
  3926. return createAsyncPlaceholder(
  3927. asyncFactory,
  3928. data,
  3929. context,
  3930. children,
  3931. tag
  3932. )
  3933. }
  3934. }
  3935. data = data || {};
  3936. // resolve constructor options in case global mixins are applied after
  3937. // component constructor creation
  3938. resolveConstructorOptions(Ctor);
  3939. // transform component v-model data into props & events
  3940. if (isDef(data.model)) {
  3941. transformModel(Ctor.options, data);
  3942. }
  3943. // extract props
  3944. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  3945. // functional component
  3946. if (isTrue(Ctor.options.functional)) {
  3947. return createFunctionalComponent(Ctor, propsData, data, context, children)
  3948. }
  3949. // extract listeners, since these needs to be treated as
  3950. // child component listeners instead of DOM listeners
  3951. var listeners = data.on;
  3952. // replace with listeners with .native modifier
  3953. // so it gets processed during parent component patch.
  3954. data.on = data.nativeOn;
  3955. if (isTrue(Ctor.options.abstract)) {
  3956. // abstract components do not keep anything
  3957. // other than props & listeners & slot
  3958. // work around flow
  3959. var slot = data.slot;
  3960. data = {};
  3961. if (slot) {
  3962. data.slot = slot;
  3963. }
  3964. }
  3965. // install component management hooks onto the placeholder node
  3966. installComponentHooks(data);
  3967. // return a placeholder vnode
  3968. var name = Ctor.options.name || tag;
  3969. var vnode = new VNode(
  3970. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  3971. data, undefined, undefined, undefined, context,
  3972. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  3973. asyncFactory
  3974. );
  3975. return vnode
  3976. }
  3977. function createComponentInstanceForVnode (
  3978. vnode, // we know it's MountedComponentVNode but flow doesn't
  3979. parent // activeInstance in lifecycle state
  3980. ) {
  3981. var options = {
  3982. _isComponent: true,
  3983. _parentVnode: vnode,
  3984. parent: parent
  3985. };
  3986. // check inline-template render functions
  3987. var inlineTemplate = vnode.data.inlineTemplate;
  3988. if (isDef(inlineTemplate)) {
  3989. options.render = inlineTemplate.render;
  3990. options.staticRenderFns = inlineTemplate.staticRenderFns;
  3991. }
  3992. return new vnode.componentOptions.Ctor(options)
  3993. }
  3994. function installComponentHooks (data) {
  3995. var hooks = data.hook || (data.hook = {});
  3996. for (var i = 0; i < hooksToMerge.length; i++) {
  3997. var key = hooksToMerge[i];
  3998. var existing = hooks[key];
  3999. var toMerge = componentVNodeHooks[key];
  4000. if (existing !== toMerge && !(existing && existing._merged)) {
  4001. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  4002. }
  4003. }
  4004. }
  4005. function mergeHook$1 (f1, f2) {
  4006. var merged = function (a, b) {
  4007. // flow complains about extra args which is why we use any
  4008. f1(a, b);
  4009. f2(a, b);
  4010. };
  4011. merged._merged = true;
  4012. return merged
  4013. }
  4014. // transform component v-model info (value and callback) into
  4015. // prop and event handler respectively.
  4016. function transformModel (options, data) {
  4017. var prop = (options.model && options.model.prop) || 'value';
  4018. var event = (options.model && options.model.event) || 'input'
  4019. ;(data.props || (data.props = {}))[prop] = data.model.value;
  4020. var on = data.on || (data.on = {});
  4021. var existing = on[event];
  4022. var callback = data.model.callback;
  4023. if (isDef(existing)) {
  4024. if (
  4025. Array.isArray(existing)
  4026. ? existing.indexOf(callback) === -1
  4027. : existing !== callback
  4028. ) {
  4029. on[event] = [callback].concat(existing);
  4030. }
  4031. } else {
  4032. on[event] = callback;
  4033. }
  4034. }
  4035. /* */
  4036. var SIMPLE_NORMALIZE = 1;
  4037. var ALWAYS_NORMALIZE = 2;
  4038. // wrapper function for providing a more flexible interface
  4039. // without getting yelled at by flow
  4040. function createElement (
  4041. context,
  4042. tag,
  4043. data,
  4044. children,
  4045. normalizationType,
  4046. alwaysNormalize
  4047. ) {
  4048. if (Array.isArray(data) || isPrimitive(data)) {
  4049. normalizationType = children;
  4050. children = data;
  4051. data = undefined;
  4052. }
  4053. if (isTrue(alwaysNormalize)) {
  4054. normalizationType = ALWAYS_NORMALIZE;
  4055. }
  4056. return _createElement(context, tag, data, children, normalizationType)
  4057. }
  4058. function _createElement (
  4059. context,
  4060. tag,
  4061. data,
  4062. children,
  4063. normalizationType
  4064. ) {
  4065. if (isDef(data) && isDef((data).__ob__)) {
  4066. process.env.NODE_ENV !== 'production' && warn(
  4067. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  4068. 'Always create fresh vnode data objects in each render!',
  4069. context
  4070. );
  4071. return createEmptyVNode()
  4072. }
  4073. // object syntax in v-bind
  4074. if (isDef(data) && isDef(data.is)) {
  4075. tag = data.is;
  4076. }
  4077. if (!tag) {
  4078. // in case of component :is set to falsy value
  4079. return createEmptyVNode()
  4080. }
  4081. // warn against non-primitive key
  4082. if (process.env.NODE_ENV !== 'production' &&
  4083. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  4084. ) {
  4085. {
  4086. warn(
  4087. 'Avoid using non-primitive value as key, ' +
  4088. 'use string/number value instead.',
  4089. context
  4090. );
  4091. }
  4092. }
  4093. // support single function children as default scoped slot
  4094. if (Array.isArray(children) &&
  4095. typeof children[0] === 'function'
  4096. ) {
  4097. data = data || {};
  4098. data.scopedSlots = { default: children[0] };
  4099. children.length = 0;
  4100. }
  4101. if (normalizationType === ALWAYS_NORMALIZE) {
  4102. children = normalizeChildren(children);
  4103. } else if (normalizationType === SIMPLE_NORMALIZE) {
  4104. children = simpleNormalizeChildren(children);
  4105. }
  4106. var vnode, ns;
  4107. if (typeof tag === 'string') {
  4108. var Ctor;
  4109. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  4110. if (config.isReservedTag(tag)) {
  4111. // platform built-in elements
  4112. vnode = new VNode(
  4113. config.parsePlatformTagName(tag), data, children,
  4114. undefined, undefined, context
  4115. );
  4116. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  4117. // component
  4118. vnode = createComponent(Ctor, data, context, children, tag);
  4119. } else {
  4120. // unknown or unlisted namespaced elements
  4121. // check at runtime because it may get assigned a namespace when its
  4122. // parent normalizes children
  4123. vnode = new VNode(
  4124. tag, data, children,
  4125. undefined, undefined, context
  4126. );
  4127. }
  4128. } else {
  4129. // direct component options / constructor
  4130. vnode = createComponent(tag, data, context, children);
  4131. }
  4132. if (Array.isArray(vnode)) {
  4133. return vnode
  4134. } else if (isDef(vnode)) {
  4135. if (isDef(ns)) { applyNS(vnode, ns); }
  4136. if (isDef(data)) { registerDeepBindings(data); }
  4137. return vnode
  4138. } else {
  4139. return createEmptyVNode()
  4140. }
  4141. }
  4142. function applyNS (vnode, ns, force) {
  4143. vnode.ns = ns;
  4144. if (vnode.tag === 'foreignObject') {
  4145. // use default namespace inside foreignObject
  4146. ns = undefined;
  4147. force = true;
  4148. }
  4149. if (isDef(vnode.children)) {
  4150. for (var i = 0, l = vnode.children.length; i < l; i++) {
  4151. var child = vnode.children[i];
  4152. if (isDef(child.tag) && (
  4153. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  4154. applyNS(child, ns, force);
  4155. }
  4156. }
  4157. }
  4158. }
  4159. // ref #5318
  4160. // necessary to ensure parent re-render when deep bindings like :style and
  4161. // :class are used on slot nodes
  4162. function registerDeepBindings (data) {
  4163. if (isObject(data.style)) {
  4164. traverse(data.style);
  4165. }
  4166. if (isObject(data.class)) {
  4167. traverse(data.class);
  4168. }
  4169. }
  4170. /* */
  4171. function initRender (vm) {
  4172. vm._vnode = null; // the root of the child tree
  4173. vm._staticTrees = null; // v-once cached trees
  4174. var options = vm.$options;
  4175. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  4176. var renderContext = parentVnode && parentVnode.context;
  4177. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  4178. vm.$scopedSlots = emptyObject;
  4179. // bind the createElement fn to this instance
  4180. // so that we get proper render context inside it.
  4181. // args order: tag, data, children, normalizationType, alwaysNormalize
  4182. // internal version is used by render functions compiled from templates
  4183. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  4184. // normalization is always applied for the public version, used in
  4185. // user-written render functions.
  4186. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  4187. // $attrs & $listeners are exposed for easier HOC creation.
  4188. // they need to be reactive so that HOCs using them are always updated
  4189. var parentData = parentVnode && parentVnode.data;
  4190. /* istanbul ignore else */
  4191. if (process.env.NODE_ENV !== 'production') {
  4192. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  4193. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  4194. }, true);
  4195. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  4196. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  4197. }, true);
  4198. } else {
  4199. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true);
  4200. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, null, true);
  4201. }
  4202. }
  4203. function renderMixin (Vue) {
  4204. // install runtime convenience helpers
  4205. installRenderHelpers(Vue.prototype);
  4206. Vue.prototype.$nextTick = function (fn) {
  4207. return nextTick(fn, this)
  4208. };
  4209. Vue.prototype._render = function () {
  4210. var vm = this;
  4211. var ref = vm.$options;
  4212. var render = ref.render;
  4213. var _parentVnode = ref._parentVnode;
  4214. if (_parentVnode) {
  4215. vm.$scopedSlots = _parentVnode.data.scopedSlots || emptyObject;
  4216. }
  4217. // set parent vnode. this allows render functions to have access
  4218. // to the data on the placeholder node.
  4219. vm.$vnode = _parentVnode;
  4220. // render self
  4221. var vnode;
  4222. try {
  4223. vnode = render.call(vm._renderProxy, vm.$createElement);
  4224. } catch (e) {
  4225. handleError(e, vm, "render");
  4226. // return error render result,
  4227. // or previous vnode to prevent render error causing blank component
  4228. /* istanbul ignore else */
  4229. if (process.env.NODE_ENV !== 'production' && vm.$options.renderError) {
  4230. try {
  4231. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  4232. } catch (e) {
  4233. handleError(e, vm, "renderError");
  4234. vnode = vm._vnode;
  4235. }
  4236. } else {
  4237. vnode = vm._vnode;
  4238. }
  4239. }
  4240. // return empty vnode in case the render function errored out
  4241. if (!(vnode instanceof VNode)) {
  4242. if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) {
  4243. warn(
  4244. 'Multiple root nodes returned from render function. Render function ' +
  4245. 'should return a single root node.',
  4246. vm
  4247. );
  4248. }
  4249. vnode = createEmptyVNode();
  4250. }
  4251. // set parent
  4252. vnode.parent = _parentVnode;
  4253. return vnode
  4254. };
  4255. }
  4256. /* */
  4257. var uid$3 = 0;
  4258. function initMixin (Vue) {
  4259. Vue.prototype._init = function (options) {
  4260. var vm = this;
  4261. // a uid
  4262. vm._uid = uid$3++;
  4263. var startTag, endTag;
  4264. /* istanbul ignore if */
  4265. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  4266. startTag = "vue-perf-start:" + (vm._uid);
  4267. endTag = "vue-perf-end:" + (vm._uid);
  4268. mark(startTag);
  4269. }
  4270. // a flag to avoid this being observed
  4271. vm._isVue = true;
  4272. // merge options
  4273. if (options && options._isComponent) {
  4274. // optimize internal component instantiation
  4275. // since dynamic options merging is pretty slow, and none of the
  4276. // internal component options needs special treatment.
  4277. initInternalComponent(vm, options);
  4278. } else {
  4279. vm.$options = mergeOptions(
  4280. resolveConstructorOptions(vm.constructor),
  4281. options || {},
  4282. vm
  4283. );
  4284. }
  4285. /* istanbul ignore else */
  4286. if (process.env.NODE_ENV !== 'production') {
  4287. initProxy(vm);
  4288. } else {
  4289. vm._renderProxy = vm;
  4290. }
  4291. // expose real self
  4292. vm._self = vm;
  4293. initLifecycle(vm);
  4294. initEvents(vm);
  4295. initRender(vm);
  4296. callHook(vm, 'beforeCreate');
  4297. initInjections(vm); // resolve injections before data/props
  4298. initState(vm);
  4299. initProvide(vm); // resolve provide after data/props
  4300. callHook(vm, 'created');
  4301. /* istanbul ignore if */
  4302. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  4303. vm._name = formatComponentName(vm, false);
  4304. mark(endTag);
  4305. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  4306. }
  4307. if (vm.$options.el) {
  4308. vm.$mount(vm.$options.el);
  4309. }
  4310. };
  4311. }
  4312. function initInternalComponent (vm, options) {
  4313. var opts = vm.$options = Object.create(vm.constructor.options);
  4314. // doing this because it's faster than dynamic enumeration.
  4315. var parentVnode = options._parentVnode;
  4316. opts.parent = options.parent;
  4317. opts._parentVnode = parentVnode;
  4318. var vnodeComponentOptions = parentVnode.componentOptions;
  4319. opts.propsData = vnodeComponentOptions.propsData;
  4320. opts._parentListeners = vnodeComponentOptions.listeners;
  4321. opts._renderChildren = vnodeComponentOptions.children;
  4322. opts._componentTag = vnodeComponentOptions.tag;
  4323. if (options.render) {
  4324. opts.render = options.render;
  4325. opts.staticRenderFns = options.staticRenderFns;
  4326. }
  4327. }
  4328. function resolveConstructorOptions (Ctor) {
  4329. var options = Ctor.options;
  4330. if (Ctor.super) {
  4331. var superOptions = resolveConstructorOptions(Ctor.super);
  4332. var cachedSuperOptions = Ctor.superOptions;
  4333. if (superOptions !== cachedSuperOptions) {
  4334. // super option changed,
  4335. // need to resolve new options.
  4336. Ctor.superOptions = superOptions;
  4337. // check if there are any late-modified/attached options (#4976)
  4338. var modifiedOptions = resolveModifiedOptions(Ctor);
  4339. // update base extend options
  4340. if (modifiedOptions) {
  4341. extend(Ctor.extendOptions, modifiedOptions);
  4342. }
  4343. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4344. if (options.name) {
  4345. options.components[options.name] = Ctor;
  4346. }
  4347. }
  4348. }
  4349. return options
  4350. }
  4351. function resolveModifiedOptions (Ctor) {
  4352. var modified;
  4353. var latest = Ctor.options;
  4354. var extended = Ctor.extendOptions;
  4355. var sealed = Ctor.sealedOptions;
  4356. for (var key in latest) {
  4357. if (latest[key] !== sealed[key]) {
  4358. if (!modified) { modified = {}; }
  4359. modified[key] = dedupe(latest[key], extended[key], sealed[key]);
  4360. }
  4361. }
  4362. return modified
  4363. }
  4364. function dedupe (latest, extended, sealed) {
  4365. // compare latest and sealed to ensure lifecycle hooks won't be duplicated
  4366. // between merges
  4367. if (Array.isArray(latest)) {
  4368. var res = [];
  4369. sealed = Array.isArray(sealed) ? sealed : [sealed];
  4370. extended = Array.isArray(extended) ? extended : [extended];
  4371. for (var i = 0; i < latest.length; i++) {
  4372. // push original options and not sealed options to exclude duplicated options
  4373. if (extended.indexOf(latest[i]) >= 0 || sealed.indexOf(latest[i]) < 0) {
  4374. res.push(latest[i]);
  4375. }
  4376. }
  4377. return res
  4378. } else {
  4379. return latest
  4380. }
  4381. }
  4382. function Vue (options) {
  4383. if (process.env.NODE_ENV !== 'production' &&
  4384. !(this instanceof Vue)
  4385. ) {
  4386. warn('Vue is a constructor and should be called with the `new` keyword');
  4387. }
  4388. this._init(options);
  4389. }
  4390. initMixin(Vue);
  4391. stateMixin(Vue);
  4392. eventsMixin(Vue);
  4393. lifecycleMixin(Vue);
  4394. renderMixin(Vue);
  4395. /* */
  4396. function initUse (Vue) {
  4397. Vue.use = function (plugin) {
  4398. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  4399. if (installedPlugins.indexOf(plugin) > -1) {
  4400. return this
  4401. }
  4402. // additional parameters
  4403. var args = toArray(arguments, 1);
  4404. args.unshift(this);
  4405. if (typeof plugin.install === 'function') {
  4406. plugin.install.apply(plugin, args);
  4407. } else if (typeof plugin === 'function') {
  4408. plugin.apply(null, args);
  4409. }
  4410. installedPlugins.push(plugin);
  4411. return this
  4412. };
  4413. }
  4414. /* */
  4415. function initMixin$1 (Vue) {
  4416. Vue.mixin = function (mixin) {
  4417. this.options = mergeOptions(this.options, mixin);
  4418. return this
  4419. };
  4420. }
  4421. /* */
  4422. function initExtend (Vue) {
  4423. /**
  4424. * Each instance constructor, including Vue, has a unique
  4425. * cid. This enables us to create wrapped "child
  4426. * constructors" for prototypal inheritance and cache them.
  4427. */
  4428. Vue.cid = 0;
  4429. var cid = 1;
  4430. /**
  4431. * Class inheritance
  4432. */
  4433. Vue.extend = function (extendOptions) {
  4434. extendOptions = extendOptions || {};
  4435. var Super = this;
  4436. var SuperId = Super.cid;
  4437. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  4438. if (cachedCtors[SuperId]) {
  4439. return cachedCtors[SuperId]
  4440. }
  4441. var name = extendOptions.name || Super.options.name;
  4442. if (process.env.NODE_ENV !== 'production' && name) {
  4443. validateComponentName(name);
  4444. }
  4445. var Sub = function VueComponent (options) {
  4446. this._init(options);
  4447. };
  4448. Sub.prototype = Object.create(Super.prototype);
  4449. Sub.prototype.constructor = Sub;
  4450. Sub.cid = cid++;
  4451. Sub.options = mergeOptions(
  4452. Super.options,
  4453. extendOptions
  4454. );
  4455. Sub['super'] = Super;
  4456. // For props and computed properties, we define the proxy getters on
  4457. // the Vue instances at extension time, on the extended prototype. This
  4458. // avoids Object.defineProperty calls for each instance created.
  4459. if (Sub.options.props) {
  4460. initProps$1(Sub);
  4461. }
  4462. if (Sub.options.computed) {
  4463. initComputed$1(Sub);
  4464. }
  4465. // allow further extension/mixin/plugin usage
  4466. Sub.extend = Super.extend;
  4467. Sub.mixin = Super.mixin;
  4468. Sub.use = Super.use;
  4469. // create asset registers, so extended classes
  4470. // can have their private assets too.
  4471. ASSET_TYPES.forEach(function (type) {
  4472. Sub[type] = Super[type];
  4473. });
  4474. // enable recursive self-lookup
  4475. if (name) {
  4476. Sub.options.components[name] = Sub;
  4477. }
  4478. // keep a reference to the super options at extension time.
  4479. // later at instantiation we can check if Super's options have
  4480. // been updated.
  4481. Sub.superOptions = Super.options;
  4482. Sub.extendOptions = extendOptions;
  4483. Sub.sealedOptions = extend({}, Sub.options);
  4484. // cache constructor
  4485. cachedCtors[SuperId] = Sub;
  4486. return Sub
  4487. };
  4488. }
  4489. function initProps$1 (Comp) {
  4490. var props = Comp.options.props;
  4491. for (var key in props) {
  4492. proxy(Comp.prototype, "_props", key);
  4493. }
  4494. }
  4495. function initComputed$1 (Comp) {
  4496. var computed = Comp.options.computed;
  4497. for (var key in computed) {
  4498. defineComputed(Comp.prototype, key, computed[key]);
  4499. }
  4500. }
  4501. /* */
  4502. function initAssetRegisters (Vue) {
  4503. /**
  4504. * Create asset registration methods.
  4505. */
  4506. ASSET_TYPES.forEach(function (type) {
  4507. Vue[type] = function (
  4508. id,
  4509. definition
  4510. ) {
  4511. if (!definition) {
  4512. return this.options[type + 's'][id]
  4513. } else {
  4514. /* istanbul ignore if */
  4515. if (process.env.NODE_ENV !== 'production' && type === 'component') {
  4516. validateComponentName(id);
  4517. }
  4518. if (type === 'component' && isPlainObject(definition)) {
  4519. definition.name = definition.name || id;
  4520. definition = this.options._base.extend(definition);
  4521. }
  4522. if (type === 'directive' && typeof definition === 'function') {
  4523. definition = { bind: definition, update: definition };
  4524. }
  4525. this.options[type + 's'][id] = definition;
  4526. return definition
  4527. }
  4528. };
  4529. });
  4530. }
  4531. /* */
  4532. function getComponentName (opts) {
  4533. return opts && (opts.Ctor.options.name || opts.tag)
  4534. }
  4535. function matches (pattern, name) {
  4536. if (Array.isArray(pattern)) {
  4537. return pattern.indexOf(name) > -1
  4538. } else if (typeof pattern === 'string') {
  4539. return pattern.split(',').indexOf(name) > -1
  4540. } else if (isRegExp(pattern)) {
  4541. return pattern.test(name)
  4542. }
  4543. /* istanbul ignore next */
  4544. return false
  4545. }
  4546. function pruneCache (keepAliveInstance, filter) {
  4547. var cache = keepAliveInstance.cache;
  4548. var keys = keepAliveInstance.keys;
  4549. var _vnode = keepAliveInstance._vnode;
  4550. for (var key in cache) {
  4551. var cachedNode = cache[key];
  4552. if (cachedNode) {
  4553. var name = getComponentName(cachedNode.componentOptions);
  4554. if (name && !filter(name)) {
  4555. pruneCacheEntry(cache, key, keys, _vnode);
  4556. }
  4557. }
  4558. }
  4559. }
  4560. function pruneCacheEntry (
  4561. cache,
  4562. key,
  4563. keys,
  4564. current
  4565. ) {
  4566. var cached$$1 = cache[key];
  4567. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  4568. cached$$1.componentInstance.$destroy();
  4569. }
  4570. cache[key] = null;
  4571. remove(keys, key);
  4572. }
  4573. var patternTypes = [String, RegExp, Array];
  4574. var KeepAlive = {
  4575. name: 'keep-alive',
  4576. abstract: true,
  4577. props: {
  4578. include: patternTypes,
  4579. exclude: patternTypes,
  4580. max: [String, Number]
  4581. },
  4582. created: function created () {
  4583. this.cache = Object.create(null);
  4584. this.keys = [];
  4585. },
  4586. destroyed: function destroyed () {
  4587. for (var key in this.cache) {
  4588. pruneCacheEntry(this.cache, key, this.keys);
  4589. }
  4590. },
  4591. mounted: function mounted () {
  4592. var this$1 = this;
  4593. this.$watch('include', function (val) {
  4594. pruneCache(this$1, function (name) { return matches(val, name); });
  4595. });
  4596. this.$watch('exclude', function (val) {
  4597. pruneCache(this$1, function (name) { return !matches(val, name); });
  4598. });
  4599. },
  4600. render: function render () {
  4601. var slot = this.$slots.default;
  4602. var vnode = getFirstComponentChild(slot);
  4603. var componentOptions = vnode && vnode.componentOptions;
  4604. if (componentOptions) {
  4605. // check pattern
  4606. var name = getComponentName(componentOptions);
  4607. var ref = this;
  4608. var include = ref.include;
  4609. var exclude = ref.exclude;
  4610. if (
  4611. // not included
  4612. (include && (!name || !matches(include, name))) ||
  4613. // excluded
  4614. (exclude && name && matches(exclude, name))
  4615. ) {
  4616. return vnode
  4617. }
  4618. var ref$1 = this;
  4619. var cache = ref$1.cache;
  4620. var keys = ref$1.keys;
  4621. var key = vnode.key == null
  4622. // same constructor may get registered as different local components
  4623. // so cid alone is not enough (#3269)
  4624. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  4625. : vnode.key;
  4626. if (cache[key]) {
  4627. vnode.componentInstance = cache[key].componentInstance;
  4628. // make current key freshest
  4629. remove(keys, key);
  4630. keys.push(key);
  4631. } else {
  4632. cache[key] = vnode;
  4633. keys.push(key);
  4634. // prune oldest entry
  4635. if (this.max && keys.length > parseInt(this.max)) {
  4636. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  4637. }
  4638. }
  4639. vnode.data.keepAlive = true;
  4640. }
  4641. return vnode || (slot && slot[0])
  4642. }
  4643. };
  4644. var builtInComponents = {
  4645. KeepAlive: KeepAlive
  4646. };
  4647. /* */
  4648. function initGlobalAPI (Vue) {
  4649. // config
  4650. var configDef = {};
  4651. configDef.get = function () { return config; };
  4652. if (process.env.NODE_ENV !== 'production') {
  4653. configDef.set = function () {
  4654. warn(
  4655. 'Do not replace the Vue.config object, set individual fields instead.'
  4656. );
  4657. };
  4658. }
  4659. Object.defineProperty(Vue, 'config', configDef);
  4660. // exposed util methods.
  4661. // NOTE: these are not considered part of the public API - avoid relying on
  4662. // them unless you are aware of the risk.
  4663. Vue.util = {
  4664. warn: warn,
  4665. extend: extend,
  4666. mergeOptions: mergeOptions,
  4667. defineReactive: defineReactive$$1
  4668. };
  4669. Vue.set = set;
  4670. Vue.delete = del;
  4671. Vue.nextTick = nextTick;
  4672. Vue.options = Object.create(null);
  4673. ASSET_TYPES.forEach(function (type) {
  4674. Vue.options[type + 's'] = Object.create(null);
  4675. });
  4676. // this is used to identify the "base" constructor to extend all plain-object
  4677. // components with in Weex's multi-instance scenarios.
  4678. Vue.options._base = Vue;
  4679. extend(Vue.options.components, builtInComponents);
  4680. initUse(Vue);
  4681. initMixin$1(Vue);
  4682. initExtend(Vue);
  4683. initAssetRegisters(Vue);
  4684. }
  4685. initGlobalAPI(Vue);
  4686. Object.defineProperty(Vue.prototype, '$isServer', {
  4687. get: isServerRendering
  4688. });
  4689. Object.defineProperty(Vue.prototype, '$ssrContext', {
  4690. get: function get () {
  4691. /* istanbul ignore next */
  4692. return this.$vnode && this.$vnode.ssrContext
  4693. }
  4694. });
  4695. // expose FunctionalRenderContext for ssr runtime helper installation
  4696. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  4697. value: FunctionalRenderContext
  4698. });
  4699. Vue.version = '2.5.21';
  4700. /* */
  4701. // these are reserved for web because they are directly compiled away
  4702. // during template compilation
  4703. var isReservedAttr = makeMap('style,class');
  4704. // attributes that should be using props for binding
  4705. var acceptValue = makeMap('input,textarea,option,select,progress');
  4706. var mustUseProp = function (tag, type, attr) {
  4707. return (
  4708. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  4709. (attr === 'selected' && tag === 'option') ||
  4710. (attr === 'checked' && tag === 'input') ||
  4711. (attr === 'muted' && tag === 'video')
  4712. )
  4713. };
  4714. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  4715. var isBooleanAttr = makeMap(
  4716. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  4717. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  4718. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  4719. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  4720. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  4721. 'truespeed,typemustmatch,visible'
  4722. );
  4723. var xlinkNS = 'http://www.w3.org/1999/xlink';
  4724. var isXlink = function (name) {
  4725. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  4726. };
  4727. var getXlinkProp = function (name) {
  4728. return isXlink(name) ? name.slice(6, name.length) : ''
  4729. };
  4730. var isFalsyAttrValue = function (val) {
  4731. return val == null || val === false
  4732. };
  4733. /* */
  4734. function genClassForVnode (vnode) {
  4735. var data = vnode.data;
  4736. var parentNode = vnode;
  4737. var childNode = vnode;
  4738. while (isDef(childNode.componentInstance)) {
  4739. childNode = childNode.componentInstance._vnode;
  4740. if (childNode && childNode.data) {
  4741. data = mergeClassData(childNode.data, data);
  4742. }
  4743. }
  4744. while (isDef(parentNode = parentNode.parent)) {
  4745. if (parentNode && parentNode.data) {
  4746. data = mergeClassData(data, parentNode.data);
  4747. }
  4748. }
  4749. return renderClass(data.staticClass, data.class)
  4750. }
  4751. function mergeClassData (child, parent) {
  4752. return {
  4753. staticClass: concat(child.staticClass, parent.staticClass),
  4754. class: isDef(child.class)
  4755. ? [child.class, parent.class]
  4756. : parent.class
  4757. }
  4758. }
  4759. function renderClass (
  4760. staticClass,
  4761. dynamicClass
  4762. ) {
  4763. if (isDef(staticClass) || isDef(dynamicClass)) {
  4764. return concat(staticClass, stringifyClass(dynamicClass))
  4765. }
  4766. /* istanbul ignore next */
  4767. return ''
  4768. }
  4769. function concat (a, b) {
  4770. return a ? b ? (a + ' ' + b) : a : (b || '')
  4771. }
  4772. function stringifyClass (value) {
  4773. if (Array.isArray(value)) {
  4774. return stringifyArray(value)
  4775. }
  4776. if (isObject(value)) {
  4777. return stringifyObject(value)
  4778. }
  4779. if (typeof value === 'string') {
  4780. return value
  4781. }
  4782. /* istanbul ignore next */
  4783. return ''
  4784. }
  4785. function stringifyArray (value) {
  4786. var res = '';
  4787. var stringified;
  4788. for (var i = 0, l = value.length; i < l; i++) {
  4789. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  4790. if (res) { res += ' '; }
  4791. res += stringified;
  4792. }
  4793. }
  4794. return res
  4795. }
  4796. function stringifyObject (value) {
  4797. var res = '';
  4798. for (var key in value) {
  4799. if (value[key]) {
  4800. if (res) { res += ' '; }
  4801. res += key;
  4802. }
  4803. }
  4804. return res
  4805. }
  4806. /* */
  4807. var namespaceMap = {
  4808. svg: 'http://www.w3.org/2000/svg',
  4809. math: 'http://www.w3.org/1998/Math/MathML'
  4810. };
  4811. var isHTMLTag = makeMap(
  4812. 'html,body,base,head,link,meta,style,title,' +
  4813. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  4814. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  4815. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  4816. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  4817. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  4818. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  4819. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  4820. 'output,progress,select,textarea,' +
  4821. 'details,dialog,menu,menuitem,summary,' +
  4822. 'content,element,shadow,template,blockquote,iframe,tfoot'
  4823. );
  4824. // this map is intentionally selective, only covering SVG elements that may
  4825. // contain child elements.
  4826. var isSVG = makeMap(
  4827. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  4828. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  4829. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  4830. true
  4831. );
  4832. var isPreTag = function (tag) { return tag === 'pre'; };
  4833. var isReservedTag = function (tag) {
  4834. return isHTMLTag(tag) || isSVG(tag)
  4835. };
  4836. function getTagNamespace (tag) {
  4837. if (isSVG(tag)) {
  4838. return 'svg'
  4839. }
  4840. // basic support for MathML
  4841. // note it doesn't support other MathML elements being component roots
  4842. if (tag === 'math') {
  4843. return 'math'
  4844. }
  4845. }
  4846. var unknownElementCache = Object.create(null);
  4847. function isUnknownElement (tag) {
  4848. /* istanbul ignore if */
  4849. if (!inBrowser) {
  4850. return true
  4851. }
  4852. if (isReservedTag(tag)) {
  4853. return false
  4854. }
  4855. tag = tag.toLowerCase();
  4856. /* istanbul ignore if */
  4857. if (unknownElementCache[tag] != null) {
  4858. return unknownElementCache[tag]
  4859. }
  4860. var el = document.createElement(tag);
  4861. if (tag.indexOf('-') > -1) {
  4862. // http://stackoverflow.com/a/28210364/1070244
  4863. return (unknownElementCache[tag] = (
  4864. el.constructor === window.HTMLUnknownElement ||
  4865. el.constructor === window.HTMLElement
  4866. ))
  4867. } else {
  4868. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  4869. }
  4870. }
  4871. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  4872. /* */
  4873. /**
  4874. * Query an element selector if it's not an element already.
  4875. */
  4876. function query (el) {
  4877. if (typeof el === 'string') {
  4878. var selected = document.querySelector(el);
  4879. if (!selected) {
  4880. process.env.NODE_ENV !== 'production' && warn(
  4881. 'Cannot find element: ' + el
  4882. );
  4883. return document.createElement('div')
  4884. }
  4885. return selected
  4886. } else {
  4887. return el
  4888. }
  4889. }
  4890. /* */
  4891. function createElement$1 (tagName, vnode) {
  4892. var elm = document.createElement(tagName);
  4893. if (tagName !== 'select') {
  4894. return elm
  4895. }
  4896. // false or null will remove the attribute but undefined will not
  4897. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  4898. elm.setAttribute('multiple', 'multiple');
  4899. }
  4900. return elm
  4901. }
  4902. function createElementNS (namespace, tagName) {
  4903. return document.createElementNS(namespaceMap[namespace], tagName)
  4904. }
  4905. function createTextNode (text) {
  4906. return document.createTextNode(text)
  4907. }
  4908. function createComment (text) {
  4909. return document.createComment(text)
  4910. }
  4911. function insertBefore (parentNode, newNode, referenceNode) {
  4912. parentNode.insertBefore(newNode, referenceNode);
  4913. }
  4914. function removeChild (node, child) {
  4915. node.removeChild(child);
  4916. }
  4917. function appendChild (node, child) {
  4918. node.appendChild(child);
  4919. }
  4920. function parentNode (node) {
  4921. return node.parentNode
  4922. }
  4923. function nextSibling (node) {
  4924. return node.nextSibling
  4925. }
  4926. function tagName (node) {
  4927. return node.tagName
  4928. }
  4929. function setTextContent (node, text) {
  4930. node.textContent = text;
  4931. }
  4932. function setStyleScope (node, scopeId) {
  4933. node.setAttribute(scopeId, '');
  4934. }
  4935. var nodeOps = /*#__PURE__*/Object.freeze({
  4936. createElement: createElement$1,
  4937. createElementNS: createElementNS,
  4938. createTextNode: createTextNode,
  4939. createComment: createComment,
  4940. insertBefore: insertBefore,
  4941. removeChild: removeChild,
  4942. appendChild: appendChild,
  4943. parentNode: parentNode,
  4944. nextSibling: nextSibling,
  4945. tagName: tagName,
  4946. setTextContent: setTextContent,
  4947. setStyleScope: setStyleScope
  4948. });
  4949. /* */
  4950. var ref = {
  4951. create: function create (_, vnode) {
  4952. registerRef(vnode);
  4953. },
  4954. update: function update (oldVnode, vnode) {
  4955. if (oldVnode.data.ref !== vnode.data.ref) {
  4956. registerRef(oldVnode, true);
  4957. registerRef(vnode);
  4958. }
  4959. },
  4960. destroy: function destroy (vnode) {
  4961. registerRef(vnode, true);
  4962. }
  4963. };
  4964. function registerRef (vnode, isRemoval) {
  4965. var key = vnode.data.ref;
  4966. if (!isDef(key)) { return }
  4967. var vm = vnode.context;
  4968. var ref = vnode.componentInstance || vnode.elm;
  4969. var refs = vm.$refs;
  4970. if (isRemoval) {
  4971. if (Array.isArray(refs[key])) {
  4972. remove(refs[key], ref);
  4973. } else if (refs[key] === ref) {
  4974. refs[key] = undefined;
  4975. }
  4976. } else {
  4977. if (vnode.data.refInFor) {
  4978. if (!Array.isArray(refs[key])) {
  4979. refs[key] = [ref];
  4980. } else if (refs[key].indexOf(ref) < 0) {
  4981. // $flow-disable-line
  4982. refs[key].push(ref);
  4983. }
  4984. } else {
  4985. refs[key] = ref;
  4986. }
  4987. }
  4988. }
  4989. /**
  4990. * Virtual DOM patching algorithm based on Snabbdom by
  4991. * Simon Friis Vindum (@paldepind)
  4992. * Licensed under the MIT License
  4993. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  4994. *
  4995. * modified by Evan You (@yyx990803)
  4996. *
  4997. * Not type-checking this because this file is perf-critical and the cost
  4998. * of making flow understand it is not worth it.
  4999. */
  5000. var emptyNode = new VNode('', {}, []);
  5001. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  5002. function sameVnode (a, b) {
  5003. return (
  5004. a.key === b.key && (
  5005. (
  5006. a.tag === b.tag &&
  5007. a.isComment === b.isComment &&
  5008. isDef(a.data) === isDef(b.data) &&
  5009. sameInputType(a, b)
  5010. ) || (
  5011. isTrue(a.isAsyncPlaceholder) &&
  5012. a.asyncFactory === b.asyncFactory &&
  5013. isUndef(b.asyncFactory.error)
  5014. )
  5015. )
  5016. )
  5017. }
  5018. function sameInputType (a, b) {
  5019. if (a.tag !== 'input') { return true }
  5020. var i;
  5021. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  5022. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  5023. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  5024. }
  5025. function createKeyToOldIdx (children, beginIdx, endIdx) {
  5026. var i, key;
  5027. var map = {};
  5028. for (i = beginIdx; i <= endIdx; ++i) {
  5029. key = children[i].key;
  5030. if (isDef(key)) { map[key] = i; }
  5031. }
  5032. return map
  5033. }
  5034. function createPatchFunction (backend) {
  5035. var i, j;
  5036. var cbs = {};
  5037. var modules = backend.modules;
  5038. var nodeOps = backend.nodeOps;
  5039. for (i = 0; i < hooks.length; ++i) {
  5040. cbs[hooks[i]] = [];
  5041. for (j = 0; j < modules.length; ++j) {
  5042. if (isDef(modules[j][hooks[i]])) {
  5043. cbs[hooks[i]].push(modules[j][hooks[i]]);
  5044. }
  5045. }
  5046. }
  5047. function emptyNodeAt (elm) {
  5048. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  5049. }
  5050. function createRmCb (childElm, listeners) {
  5051. function remove$$1 () {
  5052. if (--remove$$1.listeners === 0) {
  5053. removeNode(childElm);
  5054. }
  5055. }
  5056. remove$$1.listeners = listeners;
  5057. return remove$$1
  5058. }
  5059. function removeNode (el) {
  5060. var parent = nodeOps.parentNode(el);
  5061. // element may have already been removed due to v-html / v-text
  5062. if (isDef(parent)) {
  5063. nodeOps.removeChild(parent, el);
  5064. }
  5065. }
  5066. function isUnknownElement$$1 (vnode, inVPre) {
  5067. return (
  5068. !inVPre &&
  5069. !vnode.ns &&
  5070. !(
  5071. config.ignoredElements.length &&
  5072. config.ignoredElements.some(function (ignore) {
  5073. return isRegExp(ignore)
  5074. ? ignore.test(vnode.tag)
  5075. : ignore === vnode.tag
  5076. })
  5077. ) &&
  5078. config.isUnknownElement(vnode.tag)
  5079. )
  5080. }
  5081. var creatingElmInVPre = 0;
  5082. function createElm (
  5083. vnode,
  5084. insertedVnodeQueue,
  5085. parentElm,
  5086. refElm,
  5087. nested,
  5088. ownerArray,
  5089. index
  5090. ) {
  5091. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5092. // This vnode was used in a previous render!
  5093. // now it's used as a new node, overwriting its elm would cause
  5094. // potential patch errors down the road when it's used as an insertion
  5095. // reference node. Instead, we clone the node on-demand before creating
  5096. // associated DOM element for it.
  5097. vnode = ownerArray[index] = cloneVNode(vnode);
  5098. }
  5099. vnode.isRootInsert = !nested; // for transition enter check
  5100. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  5101. return
  5102. }
  5103. var data = vnode.data;
  5104. var children = vnode.children;
  5105. var tag = vnode.tag;
  5106. if (isDef(tag)) {
  5107. if (process.env.NODE_ENV !== 'production') {
  5108. if (data && data.pre) {
  5109. creatingElmInVPre++;
  5110. }
  5111. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  5112. warn(
  5113. 'Unknown custom element: <' + tag + '> - did you ' +
  5114. 'register the component correctly? For recursive components, ' +
  5115. 'make sure to provide the "name" option.',
  5116. vnode.context
  5117. );
  5118. }
  5119. }
  5120. vnode.elm = vnode.ns
  5121. ? nodeOps.createElementNS(vnode.ns, tag)
  5122. : nodeOps.createElement(tag, vnode);
  5123. setScope(vnode);
  5124. /* istanbul ignore if */
  5125. {
  5126. createChildren(vnode, children, insertedVnodeQueue);
  5127. if (isDef(data)) {
  5128. invokeCreateHooks(vnode, insertedVnodeQueue);
  5129. }
  5130. insert(parentElm, vnode.elm, refElm);
  5131. }
  5132. if (process.env.NODE_ENV !== 'production' && data && data.pre) {
  5133. creatingElmInVPre--;
  5134. }
  5135. } else if (isTrue(vnode.isComment)) {
  5136. vnode.elm = nodeOps.createComment(vnode.text);
  5137. insert(parentElm, vnode.elm, refElm);
  5138. } else {
  5139. vnode.elm = nodeOps.createTextNode(vnode.text);
  5140. insert(parentElm, vnode.elm, refElm);
  5141. }
  5142. }
  5143. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5144. var i = vnode.data;
  5145. if (isDef(i)) {
  5146. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  5147. if (isDef(i = i.hook) && isDef(i = i.init)) {
  5148. i(vnode, false /* hydrating */);
  5149. }
  5150. // after calling the init hook, if the vnode is a child component
  5151. // it should've created a child instance and mounted it. the child
  5152. // component also has set the placeholder vnode's elm.
  5153. // in that case we can just return the element and be done.
  5154. if (isDef(vnode.componentInstance)) {
  5155. initComponent(vnode, insertedVnodeQueue);
  5156. insert(parentElm, vnode.elm, refElm);
  5157. if (isTrue(isReactivated)) {
  5158. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  5159. }
  5160. return true
  5161. }
  5162. }
  5163. }
  5164. function initComponent (vnode, insertedVnodeQueue) {
  5165. if (isDef(vnode.data.pendingInsert)) {
  5166. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  5167. vnode.data.pendingInsert = null;
  5168. }
  5169. vnode.elm = vnode.componentInstance.$el;
  5170. if (isPatchable(vnode)) {
  5171. invokeCreateHooks(vnode, insertedVnodeQueue);
  5172. setScope(vnode);
  5173. } else {
  5174. // empty component root.
  5175. // skip all element-related modules except for ref (#3455)
  5176. registerRef(vnode);
  5177. // make sure to invoke the insert hook
  5178. insertedVnodeQueue.push(vnode);
  5179. }
  5180. }
  5181. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5182. var i;
  5183. // hack for #4339: a reactivated component with inner transition
  5184. // does not trigger because the inner node's created hooks are not called
  5185. // again. It's not ideal to involve module-specific logic in here but
  5186. // there doesn't seem to be a better way to do it.
  5187. var innerNode = vnode;
  5188. while (innerNode.componentInstance) {
  5189. innerNode = innerNode.componentInstance._vnode;
  5190. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  5191. for (i = 0; i < cbs.activate.length; ++i) {
  5192. cbs.activate[i](emptyNode, innerNode);
  5193. }
  5194. insertedVnodeQueue.push(innerNode);
  5195. break
  5196. }
  5197. }
  5198. // unlike a newly created component,
  5199. // a reactivated keep-alive component doesn't insert itself
  5200. insert(parentElm, vnode.elm, refElm);
  5201. }
  5202. function insert (parent, elm, ref$$1) {
  5203. if (isDef(parent)) {
  5204. if (isDef(ref$$1)) {
  5205. if (nodeOps.parentNode(ref$$1) === parent) {
  5206. nodeOps.insertBefore(parent, elm, ref$$1);
  5207. }
  5208. } else {
  5209. nodeOps.appendChild(parent, elm);
  5210. }
  5211. }
  5212. }
  5213. function createChildren (vnode, children, insertedVnodeQueue) {
  5214. if (Array.isArray(children)) {
  5215. if (process.env.NODE_ENV !== 'production') {
  5216. checkDuplicateKeys(children);
  5217. }
  5218. for (var i = 0; i < children.length; ++i) {
  5219. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  5220. }
  5221. } else if (isPrimitive(vnode.text)) {
  5222. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  5223. }
  5224. }
  5225. function isPatchable (vnode) {
  5226. while (vnode.componentInstance) {
  5227. vnode = vnode.componentInstance._vnode;
  5228. }
  5229. return isDef(vnode.tag)
  5230. }
  5231. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  5232. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5233. cbs.create[i$1](emptyNode, vnode);
  5234. }
  5235. i = vnode.data.hook; // Reuse variable
  5236. if (isDef(i)) {
  5237. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  5238. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  5239. }
  5240. }
  5241. // set scope id attribute for scoped CSS.
  5242. // this is implemented as a special case to avoid the overhead
  5243. // of going through the normal attribute patching process.
  5244. function setScope (vnode) {
  5245. var i;
  5246. if (isDef(i = vnode.fnScopeId)) {
  5247. nodeOps.setStyleScope(vnode.elm, i);
  5248. } else {
  5249. var ancestor = vnode;
  5250. while (ancestor) {
  5251. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  5252. nodeOps.setStyleScope(vnode.elm, i);
  5253. }
  5254. ancestor = ancestor.parent;
  5255. }
  5256. }
  5257. // for slot content they should also get the scopeId from the host instance.
  5258. if (isDef(i = activeInstance) &&
  5259. i !== vnode.context &&
  5260. i !== vnode.fnContext &&
  5261. isDef(i = i.$options._scopeId)
  5262. ) {
  5263. nodeOps.setStyleScope(vnode.elm, i);
  5264. }
  5265. }
  5266. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  5267. for (; startIdx <= endIdx; ++startIdx) {
  5268. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  5269. }
  5270. }
  5271. function invokeDestroyHook (vnode) {
  5272. var i, j;
  5273. var data = vnode.data;
  5274. if (isDef(data)) {
  5275. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  5276. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  5277. }
  5278. if (isDef(i = vnode.children)) {
  5279. for (j = 0; j < vnode.children.length; ++j) {
  5280. invokeDestroyHook(vnode.children[j]);
  5281. }
  5282. }
  5283. }
  5284. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  5285. for (; startIdx <= endIdx; ++startIdx) {
  5286. var ch = vnodes[startIdx];
  5287. if (isDef(ch)) {
  5288. if (isDef(ch.tag)) {
  5289. removeAndInvokeRemoveHook(ch);
  5290. invokeDestroyHook(ch);
  5291. } else { // Text node
  5292. removeNode(ch.elm);
  5293. }
  5294. }
  5295. }
  5296. }
  5297. function removeAndInvokeRemoveHook (vnode, rm) {
  5298. if (isDef(rm) || isDef(vnode.data)) {
  5299. var i;
  5300. var listeners = cbs.remove.length + 1;
  5301. if (isDef(rm)) {
  5302. // we have a recursively passed down rm callback
  5303. // increase the listeners count
  5304. rm.listeners += listeners;
  5305. } else {
  5306. // directly removing
  5307. rm = createRmCb(vnode.elm, listeners);
  5308. }
  5309. // recursively invoke hooks on child component root node
  5310. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  5311. removeAndInvokeRemoveHook(i, rm);
  5312. }
  5313. for (i = 0; i < cbs.remove.length; ++i) {
  5314. cbs.remove[i](vnode, rm);
  5315. }
  5316. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  5317. i(vnode, rm);
  5318. } else {
  5319. rm();
  5320. }
  5321. } else {
  5322. removeNode(vnode.elm);
  5323. }
  5324. }
  5325. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  5326. var oldStartIdx = 0;
  5327. var newStartIdx = 0;
  5328. var oldEndIdx = oldCh.length - 1;
  5329. var oldStartVnode = oldCh[0];
  5330. var oldEndVnode = oldCh[oldEndIdx];
  5331. var newEndIdx = newCh.length - 1;
  5332. var newStartVnode = newCh[0];
  5333. var newEndVnode = newCh[newEndIdx];
  5334. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  5335. // removeOnly is a special flag used only by <transition-group>
  5336. // to ensure removed elements stay in correct relative positions
  5337. // during leaving transitions
  5338. var canMove = !removeOnly;
  5339. if (process.env.NODE_ENV !== 'production') {
  5340. checkDuplicateKeys(newCh);
  5341. }
  5342. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  5343. if (isUndef(oldStartVnode)) {
  5344. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  5345. } else if (isUndef(oldEndVnode)) {
  5346. oldEndVnode = oldCh[--oldEndIdx];
  5347. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  5348. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5349. oldStartVnode = oldCh[++oldStartIdx];
  5350. newStartVnode = newCh[++newStartIdx];
  5351. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  5352. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5353. oldEndVnode = oldCh[--oldEndIdx];
  5354. newEndVnode = newCh[--newEndIdx];
  5355. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  5356. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5357. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  5358. oldStartVnode = oldCh[++oldStartIdx];
  5359. newEndVnode = newCh[--newEndIdx];
  5360. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  5361. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5362. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  5363. oldEndVnode = oldCh[--oldEndIdx];
  5364. newStartVnode = newCh[++newStartIdx];
  5365. } else {
  5366. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  5367. idxInOld = isDef(newStartVnode.key)
  5368. ? oldKeyToIdx[newStartVnode.key]
  5369. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  5370. if (isUndef(idxInOld)) { // New element
  5371. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5372. } else {
  5373. vnodeToMove = oldCh[idxInOld];
  5374. if (sameVnode(vnodeToMove, newStartVnode)) {
  5375. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5376. oldCh[idxInOld] = undefined;
  5377. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  5378. } else {
  5379. // same key but different element. treat as new element
  5380. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5381. }
  5382. }
  5383. newStartVnode = newCh[++newStartIdx];
  5384. }
  5385. }
  5386. if (oldStartIdx > oldEndIdx) {
  5387. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  5388. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  5389. } else if (newStartIdx > newEndIdx) {
  5390. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  5391. }
  5392. }
  5393. function checkDuplicateKeys (children) {
  5394. var seenKeys = {};
  5395. for (var i = 0; i < children.length; i++) {
  5396. var vnode = children[i];
  5397. var key = vnode.key;
  5398. if (isDef(key)) {
  5399. if (seenKeys[key]) {
  5400. warn(
  5401. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  5402. vnode.context
  5403. );
  5404. } else {
  5405. seenKeys[key] = true;
  5406. }
  5407. }
  5408. }
  5409. }
  5410. function findIdxInOld (node, oldCh, start, end) {
  5411. for (var i = start; i < end; i++) {
  5412. var c = oldCh[i];
  5413. if (isDef(c) && sameVnode(node, c)) { return i }
  5414. }
  5415. }
  5416. function patchVnode (
  5417. oldVnode,
  5418. vnode,
  5419. insertedVnodeQueue,
  5420. ownerArray,
  5421. index,
  5422. removeOnly
  5423. ) {
  5424. if (oldVnode === vnode) {
  5425. return
  5426. }
  5427. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5428. // clone reused vnode
  5429. vnode = ownerArray[index] = cloneVNode(vnode);
  5430. }
  5431. var elm = vnode.elm = oldVnode.elm;
  5432. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  5433. if (isDef(vnode.asyncFactory.resolved)) {
  5434. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  5435. } else {
  5436. vnode.isAsyncPlaceholder = true;
  5437. }
  5438. return
  5439. }
  5440. // reuse element for static trees.
  5441. // note we only do this if the vnode is cloned -
  5442. // if the new node is not cloned it means the render functions have been
  5443. // reset by the hot-reload-api and we need to do a proper re-render.
  5444. if (isTrue(vnode.isStatic) &&
  5445. isTrue(oldVnode.isStatic) &&
  5446. vnode.key === oldVnode.key &&
  5447. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  5448. ) {
  5449. vnode.componentInstance = oldVnode.componentInstance;
  5450. return
  5451. }
  5452. var i;
  5453. var data = vnode.data;
  5454. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  5455. i(oldVnode, vnode);
  5456. }
  5457. var oldCh = oldVnode.children;
  5458. var ch = vnode.children;
  5459. if (isDef(data) && isPatchable(vnode)) {
  5460. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  5461. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  5462. }
  5463. if (isUndef(vnode.text)) {
  5464. if (isDef(oldCh) && isDef(ch)) {
  5465. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  5466. } else if (isDef(ch)) {
  5467. if (process.env.NODE_ENV !== 'production') {
  5468. checkDuplicateKeys(ch);
  5469. }
  5470. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  5471. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  5472. } else if (isDef(oldCh)) {
  5473. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  5474. } else if (isDef(oldVnode.text)) {
  5475. nodeOps.setTextContent(elm, '');
  5476. }
  5477. } else if (oldVnode.text !== vnode.text) {
  5478. nodeOps.setTextContent(elm, vnode.text);
  5479. }
  5480. if (isDef(data)) {
  5481. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  5482. }
  5483. }
  5484. function invokeInsertHook (vnode, queue, initial) {
  5485. // delay insert hooks for component root nodes, invoke them after the
  5486. // element is really inserted
  5487. if (isTrue(initial) && isDef(vnode.parent)) {
  5488. vnode.parent.data.pendingInsert = queue;
  5489. } else {
  5490. for (var i = 0; i < queue.length; ++i) {
  5491. queue[i].data.hook.insert(queue[i]);
  5492. }
  5493. }
  5494. }
  5495. var hydrationBailed = false;
  5496. // list of modules that can skip create hook during hydration because they
  5497. // are already rendered on the client or has no need for initialization
  5498. // Note: style is excluded because it relies on initial clone for future
  5499. // deep updates (#7063).
  5500. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  5501. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  5502. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  5503. var i;
  5504. var tag = vnode.tag;
  5505. var data = vnode.data;
  5506. var children = vnode.children;
  5507. inVPre = inVPre || (data && data.pre);
  5508. vnode.elm = elm;
  5509. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  5510. vnode.isAsyncPlaceholder = true;
  5511. return true
  5512. }
  5513. // assert node match
  5514. if (process.env.NODE_ENV !== 'production') {
  5515. if (!assertNodeMatch(elm, vnode, inVPre)) {
  5516. return false
  5517. }
  5518. }
  5519. if (isDef(data)) {
  5520. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  5521. if (isDef(i = vnode.componentInstance)) {
  5522. // child component. it should have hydrated its own tree.
  5523. initComponent(vnode, insertedVnodeQueue);
  5524. return true
  5525. }
  5526. }
  5527. if (isDef(tag)) {
  5528. if (isDef(children)) {
  5529. // empty element, allow client to pick up and populate children
  5530. if (!elm.hasChildNodes()) {
  5531. createChildren(vnode, children, insertedVnodeQueue);
  5532. } else {
  5533. // v-html and domProps: innerHTML
  5534. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  5535. if (i !== elm.innerHTML) {
  5536. /* istanbul ignore if */
  5537. if (process.env.NODE_ENV !== 'production' &&
  5538. typeof console !== 'undefined' &&
  5539. !hydrationBailed
  5540. ) {
  5541. hydrationBailed = true;
  5542. console.warn('Parent: ', elm);
  5543. console.warn('server innerHTML: ', i);
  5544. console.warn('client innerHTML: ', elm.innerHTML);
  5545. }
  5546. return false
  5547. }
  5548. } else {
  5549. // iterate and compare children lists
  5550. var childrenMatch = true;
  5551. var childNode = elm.firstChild;
  5552. for (var i$1 = 0; i$1 < children.length; i$1++) {
  5553. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  5554. childrenMatch = false;
  5555. break
  5556. }
  5557. childNode = childNode.nextSibling;
  5558. }
  5559. // if childNode is not null, it means the actual childNodes list is
  5560. // longer than the virtual children list.
  5561. if (!childrenMatch || childNode) {
  5562. /* istanbul ignore if */
  5563. if (process.env.NODE_ENV !== 'production' &&
  5564. typeof console !== 'undefined' &&
  5565. !hydrationBailed
  5566. ) {
  5567. hydrationBailed = true;
  5568. console.warn('Parent: ', elm);
  5569. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  5570. }
  5571. return false
  5572. }
  5573. }
  5574. }
  5575. }
  5576. if (isDef(data)) {
  5577. var fullInvoke = false;
  5578. for (var key in data) {
  5579. if (!isRenderedModule(key)) {
  5580. fullInvoke = true;
  5581. invokeCreateHooks(vnode, insertedVnodeQueue);
  5582. break
  5583. }
  5584. }
  5585. if (!fullInvoke && data['class']) {
  5586. // ensure collecting deps for deep class bindings for future updates
  5587. traverse(data['class']);
  5588. }
  5589. }
  5590. } else if (elm.data !== vnode.text) {
  5591. elm.data = vnode.text;
  5592. }
  5593. return true
  5594. }
  5595. function assertNodeMatch (node, vnode, inVPre) {
  5596. if (isDef(vnode.tag)) {
  5597. return vnode.tag.indexOf('vue-component') === 0 || (
  5598. !isUnknownElement$$1(vnode, inVPre) &&
  5599. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  5600. )
  5601. } else {
  5602. return node.nodeType === (vnode.isComment ? 8 : 3)
  5603. }
  5604. }
  5605. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  5606. if (isUndef(vnode)) {
  5607. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  5608. return
  5609. }
  5610. var isInitialPatch = false;
  5611. var insertedVnodeQueue = [];
  5612. if (isUndef(oldVnode)) {
  5613. // empty mount (likely as component), create new root element
  5614. isInitialPatch = true;
  5615. createElm(vnode, insertedVnodeQueue);
  5616. } else {
  5617. var isRealElement = isDef(oldVnode.nodeType);
  5618. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  5619. // patch existing root node
  5620. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  5621. } else {
  5622. if (isRealElement) {
  5623. // mounting to a real element
  5624. // check if this is server-rendered content and if we can perform
  5625. // a successful hydration.
  5626. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  5627. oldVnode.removeAttribute(SSR_ATTR);
  5628. hydrating = true;
  5629. }
  5630. if (isTrue(hydrating)) {
  5631. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  5632. invokeInsertHook(vnode, insertedVnodeQueue, true);
  5633. return oldVnode
  5634. } else if (process.env.NODE_ENV !== 'production') {
  5635. warn(
  5636. 'The client-side rendered virtual DOM tree is not matching ' +
  5637. 'server-rendered content. This is likely caused by incorrect ' +
  5638. 'HTML markup, for example nesting block-level elements inside ' +
  5639. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  5640. 'full client-side render.'
  5641. );
  5642. }
  5643. }
  5644. // either not server-rendered, or hydration failed.
  5645. // create an empty node and replace it
  5646. oldVnode = emptyNodeAt(oldVnode);
  5647. }
  5648. // replacing existing element
  5649. var oldElm = oldVnode.elm;
  5650. var parentElm = nodeOps.parentNode(oldElm);
  5651. // create new node
  5652. createElm(
  5653. vnode,
  5654. insertedVnodeQueue,
  5655. // extremely rare edge case: do not insert if old element is in a
  5656. // leaving transition. Only happens when combining transition +
  5657. // keep-alive + HOCs. (#4590)
  5658. oldElm._leaveCb ? null : parentElm,
  5659. nodeOps.nextSibling(oldElm)
  5660. );
  5661. // update parent placeholder node element, recursively
  5662. if (isDef(vnode.parent)) {
  5663. var ancestor = vnode.parent;
  5664. var patchable = isPatchable(vnode);
  5665. while (ancestor) {
  5666. for (var i = 0; i < cbs.destroy.length; ++i) {
  5667. cbs.destroy[i](ancestor);
  5668. }
  5669. ancestor.elm = vnode.elm;
  5670. if (patchable) {
  5671. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5672. cbs.create[i$1](emptyNode, ancestor);
  5673. }
  5674. // #6513
  5675. // invoke insert hooks that may have been merged by create hooks.
  5676. // e.g. for directives that uses the "inserted" hook.
  5677. var insert = ancestor.data.hook.insert;
  5678. if (insert.merged) {
  5679. // start at index 1 to avoid re-invoking component mounted hook
  5680. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  5681. insert.fns[i$2]();
  5682. }
  5683. }
  5684. } else {
  5685. registerRef(ancestor);
  5686. }
  5687. ancestor = ancestor.parent;
  5688. }
  5689. }
  5690. // destroy old node
  5691. if (isDef(parentElm)) {
  5692. removeVnodes(parentElm, [oldVnode], 0, 0);
  5693. } else if (isDef(oldVnode.tag)) {
  5694. invokeDestroyHook(oldVnode);
  5695. }
  5696. }
  5697. }
  5698. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  5699. return vnode.elm
  5700. }
  5701. }
  5702. /* */
  5703. var directives = {
  5704. create: updateDirectives,
  5705. update: updateDirectives,
  5706. destroy: function unbindDirectives (vnode) {
  5707. updateDirectives(vnode, emptyNode);
  5708. }
  5709. };
  5710. function updateDirectives (oldVnode, vnode) {
  5711. if (oldVnode.data.directives || vnode.data.directives) {
  5712. _update(oldVnode, vnode);
  5713. }
  5714. }
  5715. function _update (oldVnode, vnode) {
  5716. var isCreate = oldVnode === emptyNode;
  5717. var isDestroy = vnode === emptyNode;
  5718. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  5719. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  5720. var dirsWithInsert = [];
  5721. var dirsWithPostpatch = [];
  5722. var key, oldDir, dir;
  5723. for (key in newDirs) {
  5724. oldDir = oldDirs[key];
  5725. dir = newDirs[key];
  5726. if (!oldDir) {
  5727. // new directive, bind
  5728. callHook$1(dir, 'bind', vnode, oldVnode);
  5729. if (dir.def && dir.def.inserted) {
  5730. dirsWithInsert.push(dir);
  5731. }
  5732. } else {
  5733. // existing directive, update
  5734. dir.oldValue = oldDir.value;
  5735. callHook$1(dir, 'update', vnode, oldVnode);
  5736. if (dir.def && dir.def.componentUpdated) {
  5737. dirsWithPostpatch.push(dir);
  5738. }
  5739. }
  5740. }
  5741. if (dirsWithInsert.length) {
  5742. var callInsert = function () {
  5743. for (var i = 0; i < dirsWithInsert.length; i++) {
  5744. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  5745. }
  5746. };
  5747. if (isCreate) {
  5748. mergeVNodeHook(vnode, 'insert', callInsert);
  5749. } else {
  5750. callInsert();
  5751. }
  5752. }
  5753. if (dirsWithPostpatch.length) {
  5754. mergeVNodeHook(vnode, 'postpatch', function () {
  5755. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  5756. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  5757. }
  5758. });
  5759. }
  5760. if (!isCreate) {
  5761. for (key in oldDirs) {
  5762. if (!newDirs[key]) {
  5763. // no longer present, unbind
  5764. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  5765. }
  5766. }
  5767. }
  5768. }
  5769. var emptyModifiers = Object.create(null);
  5770. function normalizeDirectives$1 (
  5771. dirs,
  5772. vm
  5773. ) {
  5774. var res = Object.create(null);
  5775. if (!dirs) {
  5776. // $flow-disable-line
  5777. return res
  5778. }
  5779. var i, dir;
  5780. for (i = 0; i < dirs.length; i++) {
  5781. dir = dirs[i];
  5782. if (!dir.modifiers) {
  5783. // $flow-disable-line
  5784. dir.modifiers = emptyModifiers;
  5785. }
  5786. res[getRawDirName(dir)] = dir;
  5787. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  5788. }
  5789. // $flow-disable-line
  5790. return res
  5791. }
  5792. function getRawDirName (dir) {
  5793. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  5794. }
  5795. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  5796. var fn = dir.def && dir.def[hook];
  5797. if (fn) {
  5798. try {
  5799. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  5800. } catch (e) {
  5801. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  5802. }
  5803. }
  5804. }
  5805. var baseModules = [
  5806. ref,
  5807. directives
  5808. ];
  5809. /* */
  5810. function updateAttrs (oldVnode, vnode) {
  5811. var opts = vnode.componentOptions;
  5812. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  5813. return
  5814. }
  5815. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  5816. return
  5817. }
  5818. var key, cur, old;
  5819. var elm = vnode.elm;
  5820. var oldAttrs = oldVnode.data.attrs || {};
  5821. var attrs = vnode.data.attrs || {};
  5822. // clone observed objects, as the user probably wants to mutate it
  5823. if (isDef(attrs.__ob__)) {
  5824. attrs = vnode.data.attrs = extend({}, attrs);
  5825. }
  5826. for (key in attrs) {
  5827. cur = attrs[key];
  5828. old = oldAttrs[key];
  5829. if (old !== cur) {
  5830. setAttr(elm, key, cur);
  5831. }
  5832. }
  5833. // #4391: in IE9, setting type can reset value for input[type=radio]
  5834. // #6666: IE/Edge forces progress value down to 1 before setting a max
  5835. /* istanbul ignore if */
  5836. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  5837. setAttr(elm, 'value', attrs.value);
  5838. }
  5839. for (key in oldAttrs) {
  5840. if (isUndef(attrs[key])) {
  5841. if (isXlink(key)) {
  5842. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  5843. } else if (!isEnumeratedAttr(key)) {
  5844. elm.removeAttribute(key);
  5845. }
  5846. }
  5847. }
  5848. }
  5849. function setAttr (el, key, value) {
  5850. if (el.tagName.indexOf('-') > -1) {
  5851. baseSetAttr(el, key, value);
  5852. } else if (isBooleanAttr(key)) {
  5853. // set attribute for blank value
  5854. // e.g. <option disabled>Select one</option>
  5855. if (isFalsyAttrValue(value)) {
  5856. el.removeAttribute(key);
  5857. } else {
  5858. // technically allowfullscreen is a boolean attribute for <iframe>,
  5859. // but Flash expects a value of "true" when used on <embed> tag
  5860. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  5861. ? 'true'
  5862. : key;
  5863. el.setAttribute(key, value);
  5864. }
  5865. } else if (isEnumeratedAttr(key)) {
  5866. el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
  5867. } else if (isXlink(key)) {
  5868. if (isFalsyAttrValue(value)) {
  5869. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  5870. } else {
  5871. el.setAttributeNS(xlinkNS, key, value);
  5872. }
  5873. } else {
  5874. baseSetAttr(el, key, value);
  5875. }
  5876. }
  5877. function baseSetAttr (el, key, value) {
  5878. if (isFalsyAttrValue(value)) {
  5879. el.removeAttribute(key);
  5880. } else {
  5881. // #7138: IE10 & 11 fires input event when setting placeholder on
  5882. // <textarea>... block the first input event and remove the blocker
  5883. // immediately.
  5884. /* istanbul ignore if */
  5885. if (
  5886. isIE && !isIE9 &&
  5887. (el.tagName === 'TEXTAREA' || el.tagName === 'INPUT') &&
  5888. key === 'placeholder' && !el.__ieph
  5889. ) {
  5890. var blocker = function (e) {
  5891. e.stopImmediatePropagation();
  5892. el.removeEventListener('input', blocker);
  5893. };
  5894. el.addEventListener('input', blocker);
  5895. // $flow-disable-line
  5896. el.__ieph = true; /* IE placeholder patched */
  5897. }
  5898. el.setAttribute(key, value);
  5899. }
  5900. }
  5901. var attrs = {
  5902. create: updateAttrs,
  5903. update: updateAttrs
  5904. };
  5905. /* */
  5906. function updateClass (oldVnode, vnode) {
  5907. var el = vnode.elm;
  5908. var data = vnode.data;
  5909. var oldData = oldVnode.data;
  5910. if (
  5911. isUndef(data.staticClass) &&
  5912. isUndef(data.class) && (
  5913. isUndef(oldData) || (
  5914. isUndef(oldData.staticClass) &&
  5915. isUndef(oldData.class)
  5916. )
  5917. )
  5918. ) {
  5919. return
  5920. }
  5921. var cls = genClassForVnode(vnode);
  5922. // handle transition classes
  5923. var transitionClass = el._transitionClasses;
  5924. if (isDef(transitionClass)) {
  5925. cls = concat(cls, stringifyClass(transitionClass));
  5926. }
  5927. // set the class
  5928. if (cls !== el._prevClass) {
  5929. el.setAttribute('class', cls);
  5930. el._prevClass = cls;
  5931. }
  5932. }
  5933. var klass = {
  5934. create: updateClass,
  5935. update: updateClass
  5936. };
  5937. /* */
  5938. var validDivisionCharRE = /[\w).+\-_$\]]/;
  5939. function parseFilters (exp) {
  5940. var inSingle = false;
  5941. var inDouble = false;
  5942. var inTemplateString = false;
  5943. var inRegex = false;
  5944. var curly = 0;
  5945. var square = 0;
  5946. var paren = 0;
  5947. var lastFilterIndex = 0;
  5948. var c, prev, i, expression, filters;
  5949. for (i = 0; i < exp.length; i++) {
  5950. prev = c;
  5951. c = exp.charCodeAt(i);
  5952. if (inSingle) {
  5953. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  5954. } else if (inDouble) {
  5955. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  5956. } else if (inTemplateString) {
  5957. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  5958. } else if (inRegex) {
  5959. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  5960. } else if (
  5961. c === 0x7C && // pipe
  5962. exp.charCodeAt(i + 1) !== 0x7C &&
  5963. exp.charCodeAt(i - 1) !== 0x7C &&
  5964. !curly && !square && !paren
  5965. ) {
  5966. if (expression === undefined) {
  5967. // first filter, end of expression
  5968. lastFilterIndex = i + 1;
  5969. expression = exp.slice(0, i).trim();
  5970. } else {
  5971. pushFilter();
  5972. }
  5973. } else {
  5974. switch (c) {
  5975. case 0x22: inDouble = true; break // "
  5976. case 0x27: inSingle = true; break // '
  5977. case 0x60: inTemplateString = true; break // `
  5978. case 0x28: paren++; break // (
  5979. case 0x29: paren--; break // )
  5980. case 0x5B: square++; break // [
  5981. case 0x5D: square--; break // ]
  5982. case 0x7B: curly++; break // {
  5983. case 0x7D: curly--; break // }
  5984. }
  5985. if (c === 0x2f) { // /
  5986. var j = i - 1;
  5987. var p = (void 0);
  5988. // find first non-whitespace prev char
  5989. for (; j >= 0; j--) {
  5990. p = exp.charAt(j);
  5991. if (p !== ' ') { break }
  5992. }
  5993. if (!p || !validDivisionCharRE.test(p)) {
  5994. inRegex = true;
  5995. }
  5996. }
  5997. }
  5998. }
  5999. if (expression === undefined) {
  6000. expression = exp.slice(0, i).trim();
  6001. } else if (lastFilterIndex !== 0) {
  6002. pushFilter();
  6003. }
  6004. function pushFilter () {
  6005. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  6006. lastFilterIndex = i + 1;
  6007. }
  6008. if (filters) {
  6009. for (i = 0; i < filters.length; i++) {
  6010. expression = wrapFilter(expression, filters[i]);
  6011. }
  6012. }
  6013. return expression
  6014. }
  6015. function wrapFilter (exp, filter) {
  6016. var i = filter.indexOf('(');
  6017. if (i < 0) {
  6018. // _f: resolveFilter
  6019. return ("_f(\"" + filter + "\")(" + exp + ")")
  6020. } else {
  6021. var name = filter.slice(0, i);
  6022. var args = filter.slice(i + 1);
  6023. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  6024. }
  6025. }
  6026. /* */
  6027. function baseWarn (msg) {
  6028. console.error(("[Vue compiler]: " + msg));
  6029. }
  6030. function pluckModuleFunction (
  6031. modules,
  6032. key
  6033. ) {
  6034. return modules
  6035. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  6036. : []
  6037. }
  6038. function addProp (el, name, value) {
  6039. (el.props || (el.props = [])).push({ name: name, value: value });
  6040. el.plain = false;
  6041. }
  6042. function addAttr (el, name, value) {
  6043. (el.attrs || (el.attrs = [])).push({ name: name, value: value });
  6044. el.plain = false;
  6045. }
  6046. // add a raw attr (use this in preTransforms)
  6047. function addRawAttr (el, name, value) {
  6048. el.attrsMap[name] = value;
  6049. el.attrsList.push({ name: name, value: value });
  6050. }
  6051. function addDirective (
  6052. el,
  6053. name,
  6054. rawName,
  6055. value,
  6056. arg,
  6057. modifiers
  6058. ) {
  6059. (el.directives || (el.directives = [])).push({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers });
  6060. el.plain = false;
  6061. }
  6062. function addHandler (
  6063. el,
  6064. name,
  6065. value,
  6066. modifiers,
  6067. important,
  6068. warn
  6069. ) {
  6070. modifiers = modifiers || emptyObject;
  6071. // warn prevent and passive modifier
  6072. /* istanbul ignore if */
  6073. if (
  6074. process.env.NODE_ENV !== 'production' && warn &&
  6075. modifiers.prevent && modifiers.passive
  6076. ) {
  6077. warn(
  6078. 'passive and prevent can\'t be used together. ' +
  6079. 'Passive handler can\'t prevent default event.'
  6080. );
  6081. }
  6082. // normalize click.right and click.middle since they don't actually fire
  6083. // this is technically browser-specific, but at least for now browsers are
  6084. // the only target envs that have right/middle clicks.
  6085. if (name === 'click') {
  6086. if (modifiers.right) {
  6087. name = 'contextmenu';
  6088. delete modifiers.right;
  6089. } else if (modifiers.middle) {
  6090. name = 'mouseup';
  6091. }
  6092. }
  6093. // check capture modifier
  6094. if (modifiers.capture) {
  6095. delete modifiers.capture;
  6096. name = '!' + name; // mark the event as captured
  6097. }
  6098. if (modifiers.once) {
  6099. delete modifiers.once;
  6100. name = '~' + name; // mark the event as once
  6101. }
  6102. /* istanbul ignore if */
  6103. if (modifiers.passive) {
  6104. delete modifiers.passive;
  6105. name = '&' + name; // mark the event as passive
  6106. }
  6107. var events;
  6108. if (modifiers.native) {
  6109. delete modifiers.native;
  6110. events = el.nativeEvents || (el.nativeEvents = {});
  6111. } else {
  6112. events = el.events || (el.events = {});
  6113. }
  6114. var newHandler = {
  6115. value: value.trim()
  6116. };
  6117. if (modifiers !== emptyObject) {
  6118. newHandler.modifiers = modifiers;
  6119. }
  6120. var handlers = events[name];
  6121. /* istanbul ignore if */
  6122. if (Array.isArray(handlers)) {
  6123. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  6124. } else if (handlers) {
  6125. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  6126. } else {
  6127. events[name] = newHandler;
  6128. }
  6129. el.plain = false;
  6130. }
  6131. function getBindingAttr (
  6132. el,
  6133. name,
  6134. getStatic
  6135. ) {
  6136. var dynamicValue =
  6137. getAndRemoveAttr(el, ':' + name) ||
  6138. getAndRemoveAttr(el, 'v-bind:' + name);
  6139. if (dynamicValue != null) {
  6140. return parseFilters(dynamicValue)
  6141. } else if (getStatic !== false) {
  6142. var staticValue = getAndRemoveAttr(el, name);
  6143. if (staticValue != null) {
  6144. return JSON.stringify(staticValue)
  6145. }
  6146. }
  6147. }
  6148. // note: this only removes the attr from the Array (attrsList) so that it
  6149. // doesn't get processed by processAttrs.
  6150. // By default it does NOT remove it from the map (attrsMap) because the map is
  6151. // needed during codegen.
  6152. function getAndRemoveAttr (
  6153. el,
  6154. name,
  6155. removeFromMap
  6156. ) {
  6157. var val;
  6158. if ((val = el.attrsMap[name]) != null) {
  6159. var list = el.attrsList;
  6160. for (var i = 0, l = list.length; i < l; i++) {
  6161. if (list[i].name === name) {
  6162. list.splice(i, 1);
  6163. break
  6164. }
  6165. }
  6166. }
  6167. if (removeFromMap) {
  6168. delete el.attrsMap[name];
  6169. }
  6170. return val
  6171. }
  6172. /* */
  6173. /**
  6174. * Cross-platform code generation for component v-model
  6175. */
  6176. function genComponentModel (
  6177. el,
  6178. value,
  6179. modifiers
  6180. ) {
  6181. var ref = modifiers || {};
  6182. var number = ref.number;
  6183. var trim = ref.trim;
  6184. var baseValueExpression = '$$v';
  6185. var valueExpression = baseValueExpression;
  6186. if (trim) {
  6187. valueExpression =
  6188. "(typeof " + baseValueExpression + " === 'string'" +
  6189. "? " + baseValueExpression + ".trim()" +
  6190. ": " + baseValueExpression + ")";
  6191. }
  6192. if (number) {
  6193. valueExpression = "_n(" + valueExpression + ")";
  6194. }
  6195. var assignment = genAssignmentCode(value, valueExpression);
  6196. el.model = {
  6197. value: ("(" + value + ")"),
  6198. expression: JSON.stringify(value),
  6199. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  6200. };
  6201. }
  6202. /**
  6203. * Cross-platform codegen helper for generating v-model value assignment code.
  6204. */
  6205. function genAssignmentCode (
  6206. value,
  6207. assignment
  6208. ) {
  6209. var res = parseModel(value);
  6210. if (res.key === null) {
  6211. return (value + "=" + assignment)
  6212. } else {
  6213. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  6214. }
  6215. }
  6216. /**
  6217. * Parse a v-model expression into a base path and a final key segment.
  6218. * Handles both dot-path and possible square brackets.
  6219. *
  6220. * Possible cases:
  6221. *
  6222. * - test
  6223. * - test[key]
  6224. * - test[test1[key]]
  6225. * - test["a"][key]
  6226. * - xxx.test[a[a].test1[key]]
  6227. * - test.xxx.a["asa"][test1[key]]
  6228. *
  6229. */
  6230. var len, str, chr, index$1, expressionPos, expressionEndPos;
  6231. function parseModel (val) {
  6232. // Fix https://github.com/vuejs/vue/pull/7730
  6233. // allow v-model="obj.val " (trailing whitespace)
  6234. val = val.trim();
  6235. len = val.length;
  6236. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  6237. index$1 = val.lastIndexOf('.');
  6238. if (index$1 > -1) {
  6239. return {
  6240. exp: val.slice(0, index$1),
  6241. key: '"' + val.slice(index$1 + 1) + '"'
  6242. }
  6243. } else {
  6244. return {
  6245. exp: val,
  6246. key: null
  6247. }
  6248. }
  6249. }
  6250. str = val;
  6251. index$1 = expressionPos = expressionEndPos = 0;
  6252. while (!eof()) {
  6253. chr = next();
  6254. /* istanbul ignore if */
  6255. if (isStringStart(chr)) {
  6256. parseString(chr);
  6257. } else if (chr === 0x5B) {
  6258. parseBracket(chr);
  6259. }
  6260. }
  6261. return {
  6262. exp: val.slice(0, expressionPos),
  6263. key: val.slice(expressionPos + 1, expressionEndPos)
  6264. }
  6265. }
  6266. function next () {
  6267. return str.charCodeAt(++index$1)
  6268. }
  6269. function eof () {
  6270. return index$1 >= len
  6271. }
  6272. function isStringStart (chr) {
  6273. return chr === 0x22 || chr === 0x27
  6274. }
  6275. function parseBracket (chr) {
  6276. var inBracket = 1;
  6277. expressionPos = index$1;
  6278. while (!eof()) {
  6279. chr = next();
  6280. if (isStringStart(chr)) {
  6281. parseString(chr);
  6282. continue
  6283. }
  6284. if (chr === 0x5B) { inBracket++; }
  6285. if (chr === 0x5D) { inBracket--; }
  6286. if (inBracket === 0) {
  6287. expressionEndPos = index$1;
  6288. break
  6289. }
  6290. }
  6291. }
  6292. function parseString (chr) {
  6293. var stringQuote = chr;
  6294. while (!eof()) {
  6295. chr = next();
  6296. if (chr === stringQuote) {
  6297. break
  6298. }
  6299. }
  6300. }
  6301. /* */
  6302. var warn$1;
  6303. // in some cases, the event used has to be determined at runtime
  6304. // so we used some reserved tokens during compile.
  6305. var RANGE_TOKEN = '__r';
  6306. var CHECKBOX_RADIO_TOKEN = '__c';
  6307. function model (
  6308. el,
  6309. dir,
  6310. _warn
  6311. ) {
  6312. warn$1 = _warn;
  6313. var value = dir.value;
  6314. var modifiers = dir.modifiers;
  6315. var tag = el.tag;
  6316. var type = el.attrsMap.type;
  6317. if (process.env.NODE_ENV !== 'production') {
  6318. // inputs with type="file" are read only and setting the input's
  6319. // value will throw an error.
  6320. if (tag === 'input' && type === 'file') {
  6321. warn$1(
  6322. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  6323. "File inputs are read only. Use a v-on:change listener instead."
  6324. );
  6325. }
  6326. }
  6327. if (el.component) {
  6328. genComponentModel(el, value, modifiers);
  6329. // component v-model doesn't need extra runtime
  6330. return false
  6331. } else if (tag === 'select') {
  6332. genSelect(el, value, modifiers);
  6333. } else if (tag === 'input' && type === 'checkbox') {
  6334. genCheckboxModel(el, value, modifiers);
  6335. } else if (tag === 'input' && type === 'radio') {
  6336. genRadioModel(el, value, modifiers);
  6337. } else if (tag === 'input' || tag === 'textarea') {
  6338. genDefaultModel(el, value, modifiers);
  6339. } else if (!config.isReservedTag(tag)) {
  6340. genComponentModel(el, value, modifiers);
  6341. // component v-model doesn't need extra runtime
  6342. return false
  6343. } else if (process.env.NODE_ENV !== 'production') {
  6344. warn$1(
  6345. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  6346. "v-model is not supported on this element type. " +
  6347. 'If you are working with contenteditable, it\'s recommended to ' +
  6348. 'wrap a library dedicated for that purpose inside a custom component.'
  6349. );
  6350. }
  6351. // ensure runtime directive metadata
  6352. return true
  6353. }
  6354. function genCheckboxModel (
  6355. el,
  6356. value,
  6357. modifiers
  6358. ) {
  6359. var number = modifiers && modifiers.number;
  6360. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6361. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  6362. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  6363. addProp(el, 'checked',
  6364. "Array.isArray(" + value + ")" +
  6365. "?_i(" + value + "," + valueBinding + ")>-1" + (
  6366. trueValueBinding === 'true'
  6367. ? (":(" + value + ")")
  6368. : (":_q(" + value + "," + trueValueBinding + ")")
  6369. )
  6370. );
  6371. addHandler(el, 'change',
  6372. "var $$a=" + value + "," +
  6373. '$$el=$event.target,' +
  6374. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  6375. 'if(Array.isArray($$a)){' +
  6376. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  6377. '$$i=_i($$a,$$v);' +
  6378. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  6379. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  6380. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  6381. null, true
  6382. );
  6383. }
  6384. function genRadioModel (
  6385. el,
  6386. value,
  6387. modifiers
  6388. ) {
  6389. var number = modifiers && modifiers.number;
  6390. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6391. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  6392. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  6393. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  6394. }
  6395. function genSelect (
  6396. el,
  6397. value,
  6398. modifiers
  6399. ) {
  6400. var number = modifiers && modifiers.number;
  6401. var selectedVal = "Array.prototype.filter" +
  6402. ".call($event.target.options,function(o){return o.selected})" +
  6403. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  6404. "return " + (number ? '_n(val)' : 'val') + "})";
  6405. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  6406. var code = "var $$selectedVal = " + selectedVal + ";";
  6407. code = code + " " + (genAssignmentCode(value, assignment));
  6408. addHandler(el, 'change', code, null, true);
  6409. }
  6410. function genDefaultModel (
  6411. el,
  6412. value,
  6413. modifiers
  6414. ) {
  6415. var type = el.attrsMap.type;
  6416. // warn if v-bind:value conflicts with v-model
  6417. // except for inputs with v-bind:type
  6418. if (process.env.NODE_ENV !== 'production') {
  6419. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  6420. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  6421. if (value$1 && !typeBinding) {
  6422. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  6423. warn$1(
  6424. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  6425. 'because the latter already expands to a value binding internally'
  6426. );
  6427. }
  6428. }
  6429. var ref = modifiers || {};
  6430. var lazy = ref.lazy;
  6431. var number = ref.number;
  6432. var trim = ref.trim;
  6433. var needCompositionGuard = !lazy && type !== 'range';
  6434. var event = lazy
  6435. ? 'change'
  6436. : type === 'range'
  6437. ? RANGE_TOKEN
  6438. : 'input';
  6439. var valueExpression = '$event.target.value';
  6440. if (trim) {
  6441. valueExpression = "$event.target.value.trim()";
  6442. }
  6443. if (number) {
  6444. valueExpression = "_n(" + valueExpression + ")";
  6445. }
  6446. var code = genAssignmentCode(value, valueExpression);
  6447. if (needCompositionGuard) {
  6448. code = "if($event.target.composing)return;" + code;
  6449. }
  6450. addProp(el, 'value', ("(" + value + ")"));
  6451. addHandler(el, event, code, null, true);
  6452. if (trim || number) {
  6453. addHandler(el, 'blur', '$forceUpdate()');
  6454. }
  6455. }
  6456. /* */
  6457. // normalize v-model event tokens that can only be determined at runtime.
  6458. // it's important to place the event as the first in the array because
  6459. // the whole point is ensuring the v-model callback gets called before
  6460. // user-attached handlers.
  6461. function normalizeEvents (on) {
  6462. /* istanbul ignore if */
  6463. if (isDef(on[RANGE_TOKEN])) {
  6464. // IE input[type=range] only supports `change` event
  6465. var event = isIE ? 'change' : 'input';
  6466. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  6467. delete on[RANGE_TOKEN];
  6468. }
  6469. // This was originally intended to fix #4521 but no longer necessary
  6470. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  6471. /* istanbul ignore if */
  6472. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  6473. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  6474. delete on[CHECKBOX_RADIO_TOKEN];
  6475. }
  6476. }
  6477. var target$1;
  6478. function createOnceHandler$1 (event, handler, capture) {
  6479. var _target = target$1; // save current target element in closure
  6480. return function onceHandler () {
  6481. var res = handler.apply(null, arguments);
  6482. if (res !== null) {
  6483. remove$2(event, onceHandler, capture, _target);
  6484. }
  6485. }
  6486. }
  6487. function add$1 (
  6488. event,
  6489. handler,
  6490. capture,
  6491. passive
  6492. ) {
  6493. handler = withMacroTask(handler);
  6494. target$1.addEventListener(
  6495. event,
  6496. handler,
  6497. supportsPassive
  6498. ? { capture: capture, passive: passive }
  6499. : capture
  6500. );
  6501. }
  6502. function remove$2 (
  6503. event,
  6504. handler,
  6505. capture,
  6506. _target
  6507. ) {
  6508. (_target || target$1).removeEventListener(
  6509. event,
  6510. handler._withTask || handler,
  6511. capture
  6512. );
  6513. }
  6514. function updateDOMListeners (oldVnode, vnode) {
  6515. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  6516. return
  6517. }
  6518. var on = vnode.data.on || {};
  6519. var oldOn = oldVnode.data.on || {};
  6520. target$1 = vnode.elm;
  6521. normalizeEvents(on);
  6522. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  6523. target$1 = undefined;
  6524. }
  6525. var events = {
  6526. create: updateDOMListeners,
  6527. update: updateDOMListeners
  6528. };
  6529. /* */
  6530. function updateDOMProps (oldVnode, vnode) {
  6531. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  6532. return
  6533. }
  6534. var key, cur;
  6535. var elm = vnode.elm;
  6536. var oldProps = oldVnode.data.domProps || {};
  6537. var props = vnode.data.domProps || {};
  6538. // clone observed objects, as the user probably wants to mutate it
  6539. if (isDef(props.__ob__)) {
  6540. props = vnode.data.domProps = extend({}, props);
  6541. }
  6542. for (key in oldProps) {
  6543. if (isUndef(props[key])) {
  6544. elm[key] = '';
  6545. }
  6546. }
  6547. for (key in props) {
  6548. cur = props[key];
  6549. // ignore children if the node has textContent or innerHTML,
  6550. // as these will throw away existing DOM nodes and cause removal errors
  6551. // on subsequent patches (#3360)
  6552. if (key === 'textContent' || key === 'innerHTML') {
  6553. if (vnode.children) { vnode.children.length = 0; }
  6554. if (cur === oldProps[key]) { continue }
  6555. // #6601 work around Chrome version <= 55 bug where single textNode
  6556. // replaced by innerHTML/textContent retains its parentNode property
  6557. if (elm.childNodes.length === 1) {
  6558. elm.removeChild(elm.childNodes[0]);
  6559. }
  6560. }
  6561. if (key === 'value') {
  6562. // store value as _value as well since
  6563. // non-string values will be stringified
  6564. elm._value = cur;
  6565. // avoid resetting cursor position when value is the same
  6566. var strCur = isUndef(cur) ? '' : String(cur);
  6567. if (shouldUpdateValue(elm, strCur)) {
  6568. elm.value = strCur;
  6569. }
  6570. } else {
  6571. elm[key] = cur;
  6572. }
  6573. }
  6574. }
  6575. // check platforms/web/util/attrs.js acceptValue
  6576. function shouldUpdateValue (elm, checkVal) {
  6577. return (!elm.composing && (
  6578. elm.tagName === 'OPTION' ||
  6579. isNotInFocusAndDirty(elm, checkVal) ||
  6580. isDirtyWithModifiers(elm, checkVal)
  6581. ))
  6582. }
  6583. function isNotInFocusAndDirty (elm, checkVal) {
  6584. // return true when textbox (.number and .trim) loses focus and its value is
  6585. // not equal to the updated value
  6586. var notInFocus = true;
  6587. // #6157
  6588. // work around IE bug when accessing document.activeElement in an iframe
  6589. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  6590. return notInFocus && elm.value !== checkVal
  6591. }
  6592. function isDirtyWithModifiers (elm, newVal) {
  6593. var value = elm.value;
  6594. var modifiers = elm._vModifiers; // injected by v-model runtime
  6595. if (isDef(modifiers)) {
  6596. if (modifiers.lazy) {
  6597. // inputs with lazy should only be updated when not in focus
  6598. return false
  6599. }
  6600. if (modifiers.number) {
  6601. return toNumber(value) !== toNumber(newVal)
  6602. }
  6603. if (modifiers.trim) {
  6604. return value.trim() !== newVal.trim()
  6605. }
  6606. }
  6607. return value !== newVal
  6608. }
  6609. var domProps = {
  6610. create: updateDOMProps,
  6611. update: updateDOMProps
  6612. };
  6613. /* */
  6614. var parseStyleText = cached(function (cssText) {
  6615. var res = {};
  6616. var listDelimiter = /;(?![^(]*\))/g;
  6617. var propertyDelimiter = /:(.+)/;
  6618. cssText.split(listDelimiter).forEach(function (item) {
  6619. if (item) {
  6620. var tmp = item.split(propertyDelimiter);
  6621. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6622. }
  6623. });
  6624. return res
  6625. });
  6626. // merge static and dynamic style data on the same vnode
  6627. function normalizeStyleData (data) {
  6628. var style = normalizeStyleBinding(data.style);
  6629. // static style is pre-processed into an object during compilation
  6630. // and is always a fresh object, so it's safe to merge into it
  6631. return data.staticStyle
  6632. ? extend(data.staticStyle, style)
  6633. : style
  6634. }
  6635. // normalize possible array / string values into Object
  6636. function normalizeStyleBinding (bindingStyle) {
  6637. if (Array.isArray(bindingStyle)) {
  6638. return toObject(bindingStyle)
  6639. }
  6640. if (typeof bindingStyle === 'string') {
  6641. return parseStyleText(bindingStyle)
  6642. }
  6643. return bindingStyle
  6644. }
  6645. /**
  6646. * parent component style should be after child's
  6647. * so that parent component's style could override it
  6648. */
  6649. function getStyle (vnode, checkChild) {
  6650. var res = {};
  6651. var styleData;
  6652. if (checkChild) {
  6653. var childNode = vnode;
  6654. while (childNode.componentInstance) {
  6655. childNode = childNode.componentInstance._vnode;
  6656. if (
  6657. childNode && childNode.data &&
  6658. (styleData = normalizeStyleData(childNode.data))
  6659. ) {
  6660. extend(res, styleData);
  6661. }
  6662. }
  6663. }
  6664. if ((styleData = normalizeStyleData(vnode.data))) {
  6665. extend(res, styleData);
  6666. }
  6667. var parentNode = vnode;
  6668. while ((parentNode = parentNode.parent)) {
  6669. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  6670. extend(res, styleData);
  6671. }
  6672. }
  6673. return res
  6674. }
  6675. /* */
  6676. var cssVarRE = /^--/;
  6677. var importantRE = /\s*!important$/;
  6678. var setProp = function (el, name, val) {
  6679. /* istanbul ignore if */
  6680. if (cssVarRE.test(name)) {
  6681. el.style.setProperty(name, val);
  6682. } else if (importantRE.test(val)) {
  6683. el.style.setProperty(name, val.replace(importantRE, ''), 'important');
  6684. } else {
  6685. var normalizedName = normalize(name);
  6686. if (Array.isArray(val)) {
  6687. // Support values array created by autoprefixer, e.g.
  6688. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  6689. // Set them one by one, and the browser will only set those it can recognize
  6690. for (var i = 0, len = val.length; i < len; i++) {
  6691. el.style[normalizedName] = val[i];
  6692. }
  6693. } else {
  6694. el.style[normalizedName] = val;
  6695. }
  6696. }
  6697. };
  6698. var vendorNames = ['Webkit', 'Moz', 'ms'];
  6699. var emptyStyle;
  6700. var normalize = cached(function (prop) {
  6701. emptyStyle = emptyStyle || document.createElement('div').style;
  6702. prop = camelize(prop);
  6703. if (prop !== 'filter' && (prop in emptyStyle)) {
  6704. return prop
  6705. }
  6706. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  6707. for (var i = 0; i < vendorNames.length; i++) {
  6708. var name = vendorNames[i] + capName;
  6709. if (name in emptyStyle) {
  6710. return name
  6711. }
  6712. }
  6713. });
  6714. function updateStyle (oldVnode, vnode) {
  6715. var data = vnode.data;
  6716. var oldData = oldVnode.data;
  6717. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  6718. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  6719. ) {
  6720. return
  6721. }
  6722. var cur, name;
  6723. var el = vnode.elm;
  6724. var oldStaticStyle = oldData.staticStyle;
  6725. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  6726. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  6727. var oldStyle = oldStaticStyle || oldStyleBinding;
  6728. var style = normalizeStyleBinding(vnode.data.style) || {};
  6729. // store normalized style under a different key for next diff
  6730. // make sure to clone it if it's reactive, since the user likely wants
  6731. // to mutate it.
  6732. vnode.data.normalizedStyle = isDef(style.__ob__)
  6733. ? extend({}, style)
  6734. : style;
  6735. var newStyle = getStyle(vnode, true);
  6736. for (name in oldStyle) {
  6737. if (isUndef(newStyle[name])) {
  6738. setProp(el, name, '');
  6739. }
  6740. }
  6741. for (name in newStyle) {
  6742. cur = newStyle[name];
  6743. if (cur !== oldStyle[name]) {
  6744. // ie9 setting to null has no effect, must use empty string
  6745. setProp(el, name, cur == null ? '' : cur);
  6746. }
  6747. }
  6748. }
  6749. var style = {
  6750. create: updateStyle,
  6751. update: updateStyle
  6752. };
  6753. /* */
  6754. var whitespaceRE = /\s+/;
  6755. /**
  6756. * Add class with compatibility for SVG since classList is not supported on
  6757. * SVG elements in IE
  6758. */
  6759. function addClass (el, cls) {
  6760. /* istanbul ignore if */
  6761. if (!cls || !(cls = cls.trim())) {
  6762. return
  6763. }
  6764. /* istanbul ignore else */
  6765. if (el.classList) {
  6766. if (cls.indexOf(' ') > -1) {
  6767. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  6768. } else {
  6769. el.classList.add(cls);
  6770. }
  6771. } else {
  6772. var cur = " " + (el.getAttribute('class') || '') + " ";
  6773. if (cur.indexOf(' ' + cls + ' ') < 0) {
  6774. el.setAttribute('class', (cur + cls).trim());
  6775. }
  6776. }
  6777. }
  6778. /**
  6779. * Remove class with compatibility for SVG since classList is not supported on
  6780. * SVG elements in IE
  6781. */
  6782. function removeClass (el, cls) {
  6783. /* istanbul ignore if */
  6784. if (!cls || !(cls = cls.trim())) {
  6785. return
  6786. }
  6787. /* istanbul ignore else */
  6788. if (el.classList) {
  6789. if (cls.indexOf(' ') > -1) {
  6790. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  6791. } else {
  6792. el.classList.remove(cls);
  6793. }
  6794. if (!el.classList.length) {
  6795. el.removeAttribute('class');
  6796. }
  6797. } else {
  6798. var cur = " " + (el.getAttribute('class') || '') + " ";
  6799. var tar = ' ' + cls + ' ';
  6800. while (cur.indexOf(tar) >= 0) {
  6801. cur = cur.replace(tar, ' ');
  6802. }
  6803. cur = cur.trim();
  6804. if (cur) {
  6805. el.setAttribute('class', cur);
  6806. } else {
  6807. el.removeAttribute('class');
  6808. }
  6809. }
  6810. }
  6811. /* */
  6812. function resolveTransition (def$$1) {
  6813. if (!def$$1) {
  6814. return
  6815. }
  6816. /* istanbul ignore else */
  6817. if (typeof def$$1 === 'object') {
  6818. var res = {};
  6819. if (def$$1.css !== false) {
  6820. extend(res, autoCssTransition(def$$1.name || 'v'));
  6821. }
  6822. extend(res, def$$1);
  6823. return res
  6824. } else if (typeof def$$1 === 'string') {
  6825. return autoCssTransition(def$$1)
  6826. }
  6827. }
  6828. var autoCssTransition = cached(function (name) {
  6829. return {
  6830. enterClass: (name + "-enter"),
  6831. enterToClass: (name + "-enter-to"),
  6832. enterActiveClass: (name + "-enter-active"),
  6833. leaveClass: (name + "-leave"),
  6834. leaveToClass: (name + "-leave-to"),
  6835. leaveActiveClass: (name + "-leave-active")
  6836. }
  6837. });
  6838. var hasTransition = inBrowser && !isIE9;
  6839. var TRANSITION = 'transition';
  6840. var ANIMATION = 'animation';
  6841. // Transition property/event sniffing
  6842. var transitionProp = 'transition';
  6843. var transitionEndEvent = 'transitionend';
  6844. var animationProp = 'animation';
  6845. var animationEndEvent = 'animationend';
  6846. if (hasTransition) {
  6847. /* istanbul ignore if */
  6848. if (window.ontransitionend === undefined &&
  6849. window.onwebkittransitionend !== undefined
  6850. ) {
  6851. transitionProp = 'WebkitTransition';
  6852. transitionEndEvent = 'webkitTransitionEnd';
  6853. }
  6854. if (window.onanimationend === undefined &&
  6855. window.onwebkitanimationend !== undefined
  6856. ) {
  6857. animationProp = 'WebkitAnimation';
  6858. animationEndEvent = 'webkitAnimationEnd';
  6859. }
  6860. }
  6861. // binding to window is necessary to make hot reload work in IE in strict mode
  6862. var raf = inBrowser
  6863. ? window.requestAnimationFrame
  6864. ? window.requestAnimationFrame.bind(window)
  6865. : setTimeout
  6866. : /* istanbul ignore next */ function (fn) { return fn(); };
  6867. function nextFrame (fn) {
  6868. raf(function () {
  6869. raf(fn);
  6870. });
  6871. }
  6872. function addTransitionClass (el, cls) {
  6873. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  6874. if (transitionClasses.indexOf(cls) < 0) {
  6875. transitionClasses.push(cls);
  6876. addClass(el, cls);
  6877. }
  6878. }
  6879. function removeTransitionClass (el, cls) {
  6880. if (el._transitionClasses) {
  6881. remove(el._transitionClasses, cls);
  6882. }
  6883. removeClass(el, cls);
  6884. }
  6885. function whenTransitionEnds (
  6886. el,
  6887. expectedType,
  6888. cb
  6889. ) {
  6890. var ref = getTransitionInfo(el, expectedType);
  6891. var type = ref.type;
  6892. var timeout = ref.timeout;
  6893. var propCount = ref.propCount;
  6894. if (!type) { return cb() }
  6895. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  6896. var ended = 0;
  6897. var end = function () {
  6898. el.removeEventListener(event, onEnd);
  6899. cb();
  6900. };
  6901. var onEnd = function (e) {
  6902. if (e.target === el) {
  6903. if (++ended >= propCount) {
  6904. end();
  6905. }
  6906. }
  6907. };
  6908. setTimeout(function () {
  6909. if (ended < propCount) {
  6910. end();
  6911. }
  6912. }, timeout + 1);
  6913. el.addEventListener(event, onEnd);
  6914. }
  6915. var transformRE = /\b(transform|all)(,|$)/;
  6916. function getTransitionInfo (el, expectedType) {
  6917. var styles = window.getComputedStyle(el);
  6918. // JSDOM may return undefined for transition properties
  6919. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  6920. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  6921. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  6922. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  6923. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  6924. var animationTimeout = getTimeout(animationDelays, animationDurations);
  6925. var type;
  6926. var timeout = 0;
  6927. var propCount = 0;
  6928. /* istanbul ignore if */
  6929. if (expectedType === TRANSITION) {
  6930. if (transitionTimeout > 0) {
  6931. type = TRANSITION;
  6932. timeout = transitionTimeout;
  6933. propCount = transitionDurations.length;
  6934. }
  6935. } else if (expectedType === ANIMATION) {
  6936. if (animationTimeout > 0) {
  6937. type = ANIMATION;
  6938. timeout = animationTimeout;
  6939. propCount = animationDurations.length;
  6940. }
  6941. } else {
  6942. timeout = Math.max(transitionTimeout, animationTimeout);
  6943. type = timeout > 0
  6944. ? transitionTimeout > animationTimeout
  6945. ? TRANSITION
  6946. : ANIMATION
  6947. : null;
  6948. propCount = type
  6949. ? type === TRANSITION
  6950. ? transitionDurations.length
  6951. : animationDurations.length
  6952. : 0;
  6953. }
  6954. var hasTransform =
  6955. type === TRANSITION &&
  6956. transformRE.test(styles[transitionProp + 'Property']);
  6957. return {
  6958. type: type,
  6959. timeout: timeout,
  6960. propCount: propCount,
  6961. hasTransform: hasTransform
  6962. }
  6963. }
  6964. function getTimeout (delays, durations) {
  6965. /* istanbul ignore next */
  6966. while (delays.length < durations.length) {
  6967. delays = delays.concat(delays);
  6968. }
  6969. return Math.max.apply(null, durations.map(function (d, i) {
  6970. return toMs(d) + toMs(delays[i])
  6971. }))
  6972. }
  6973. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  6974. // in a locale-dependent way, using a comma instead of a dot.
  6975. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  6976. // as a floor function) causing unexpected behaviors
  6977. function toMs (s) {
  6978. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  6979. }
  6980. /* */
  6981. function enter (vnode, toggleDisplay) {
  6982. var el = vnode.elm;
  6983. // call leave callback now
  6984. if (isDef(el._leaveCb)) {
  6985. el._leaveCb.cancelled = true;
  6986. el._leaveCb();
  6987. }
  6988. var data = resolveTransition(vnode.data.transition);
  6989. if (isUndef(data)) {
  6990. return
  6991. }
  6992. /* istanbul ignore if */
  6993. if (isDef(el._enterCb) || el.nodeType !== 1) {
  6994. return
  6995. }
  6996. var css = data.css;
  6997. var type = data.type;
  6998. var enterClass = data.enterClass;
  6999. var enterToClass = data.enterToClass;
  7000. var enterActiveClass = data.enterActiveClass;
  7001. var appearClass = data.appearClass;
  7002. var appearToClass = data.appearToClass;
  7003. var appearActiveClass = data.appearActiveClass;
  7004. var beforeEnter = data.beforeEnter;
  7005. var enter = data.enter;
  7006. var afterEnter = data.afterEnter;
  7007. var enterCancelled = data.enterCancelled;
  7008. var beforeAppear = data.beforeAppear;
  7009. var appear = data.appear;
  7010. var afterAppear = data.afterAppear;
  7011. var appearCancelled = data.appearCancelled;
  7012. var duration = data.duration;
  7013. // activeInstance will always be the <transition> component managing this
  7014. // transition. One edge case to check is when the <transition> is placed
  7015. // as the root node of a child component. In that case we need to check
  7016. // <transition>'s parent for appear check.
  7017. var context = activeInstance;
  7018. var transitionNode = activeInstance.$vnode;
  7019. while (transitionNode && transitionNode.parent) {
  7020. transitionNode = transitionNode.parent;
  7021. context = transitionNode.context;
  7022. }
  7023. var isAppear = !context._isMounted || !vnode.isRootInsert;
  7024. if (isAppear && !appear && appear !== '') {
  7025. return
  7026. }
  7027. var startClass = isAppear && appearClass
  7028. ? appearClass
  7029. : enterClass;
  7030. var activeClass = isAppear && appearActiveClass
  7031. ? appearActiveClass
  7032. : enterActiveClass;
  7033. var toClass = isAppear && appearToClass
  7034. ? appearToClass
  7035. : enterToClass;
  7036. var beforeEnterHook = isAppear
  7037. ? (beforeAppear || beforeEnter)
  7038. : beforeEnter;
  7039. var enterHook = isAppear
  7040. ? (typeof appear === 'function' ? appear : enter)
  7041. : enter;
  7042. var afterEnterHook = isAppear
  7043. ? (afterAppear || afterEnter)
  7044. : afterEnter;
  7045. var enterCancelledHook = isAppear
  7046. ? (appearCancelled || enterCancelled)
  7047. : enterCancelled;
  7048. var explicitEnterDuration = toNumber(
  7049. isObject(duration)
  7050. ? duration.enter
  7051. : duration
  7052. );
  7053. if (process.env.NODE_ENV !== 'production' && explicitEnterDuration != null) {
  7054. checkDuration(explicitEnterDuration, 'enter', vnode);
  7055. }
  7056. var expectsCSS = css !== false && !isIE9;
  7057. var userWantsControl = getHookArgumentsLength(enterHook);
  7058. var cb = el._enterCb = once(function () {
  7059. if (expectsCSS) {
  7060. removeTransitionClass(el, toClass);
  7061. removeTransitionClass(el, activeClass);
  7062. }
  7063. if (cb.cancelled) {
  7064. if (expectsCSS) {
  7065. removeTransitionClass(el, startClass);
  7066. }
  7067. enterCancelledHook && enterCancelledHook(el);
  7068. } else {
  7069. afterEnterHook && afterEnterHook(el);
  7070. }
  7071. el._enterCb = null;
  7072. });
  7073. if (!vnode.data.show) {
  7074. // remove pending leave element on enter by injecting an insert hook
  7075. mergeVNodeHook(vnode, 'insert', function () {
  7076. var parent = el.parentNode;
  7077. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  7078. if (pendingNode &&
  7079. pendingNode.tag === vnode.tag &&
  7080. pendingNode.elm._leaveCb
  7081. ) {
  7082. pendingNode.elm._leaveCb();
  7083. }
  7084. enterHook && enterHook(el, cb);
  7085. });
  7086. }
  7087. // start enter transition
  7088. beforeEnterHook && beforeEnterHook(el);
  7089. if (expectsCSS) {
  7090. addTransitionClass(el, startClass);
  7091. addTransitionClass(el, activeClass);
  7092. nextFrame(function () {
  7093. removeTransitionClass(el, startClass);
  7094. if (!cb.cancelled) {
  7095. addTransitionClass(el, toClass);
  7096. if (!userWantsControl) {
  7097. if (isValidDuration(explicitEnterDuration)) {
  7098. setTimeout(cb, explicitEnterDuration);
  7099. } else {
  7100. whenTransitionEnds(el, type, cb);
  7101. }
  7102. }
  7103. }
  7104. });
  7105. }
  7106. if (vnode.data.show) {
  7107. toggleDisplay && toggleDisplay();
  7108. enterHook && enterHook(el, cb);
  7109. }
  7110. if (!expectsCSS && !userWantsControl) {
  7111. cb();
  7112. }
  7113. }
  7114. function leave (vnode, rm) {
  7115. var el = vnode.elm;
  7116. // call enter callback now
  7117. if (isDef(el._enterCb)) {
  7118. el._enterCb.cancelled = true;
  7119. el._enterCb();
  7120. }
  7121. var data = resolveTransition(vnode.data.transition);
  7122. if (isUndef(data) || el.nodeType !== 1) {
  7123. return rm()
  7124. }
  7125. /* istanbul ignore if */
  7126. if (isDef(el._leaveCb)) {
  7127. return
  7128. }
  7129. var css = data.css;
  7130. var type = data.type;
  7131. var leaveClass = data.leaveClass;
  7132. var leaveToClass = data.leaveToClass;
  7133. var leaveActiveClass = data.leaveActiveClass;
  7134. var beforeLeave = data.beforeLeave;
  7135. var leave = data.leave;
  7136. var afterLeave = data.afterLeave;
  7137. var leaveCancelled = data.leaveCancelled;
  7138. var delayLeave = data.delayLeave;
  7139. var duration = data.duration;
  7140. var expectsCSS = css !== false && !isIE9;
  7141. var userWantsControl = getHookArgumentsLength(leave);
  7142. var explicitLeaveDuration = toNumber(
  7143. isObject(duration)
  7144. ? duration.leave
  7145. : duration
  7146. );
  7147. if (process.env.NODE_ENV !== 'production' && isDef(explicitLeaveDuration)) {
  7148. checkDuration(explicitLeaveDuration, 'leave', vnode);
  7149. }
  7150. var cb = el._leaveCb = once(function () {
  7151. if (el.parentNode && el.parentNode._pending) {
  7152. el.parentNode._pending[vnode.key] = null;
  7153. }
  7154. if (expectsCSS) {
  7155. removeTransitionClass(el, leaveToClass);
  7156. removeTransitionClass(el, leaveActiveClass);
  7157. }
  7158. if (cb.cancelled) {
  7159. if (expectsCSS) {
  7160. removeTransitionClass(el, leaveClass);
  7161. }
  7162. leaveCancelled && leaveCancelled(el);
  7163. } else {
  7164. rm();
  7165. afterLeave && afterLeave(el);
  7166. }
  7167. el._leaveCb = null;
  7168. });
  7169. if (delayLeave) {
  7170. delayLeave(performLeave);
  7171. } else {
  7172. performLeave();
  7173. }
  7174. function performLeave () {
  7175. // the delayed leave may have already been cancelled
  7176. if (cb.cancelled) {
  7177. return
  7178. }
  7179. // record leaving element
  7180. if (!vnode.data.show && el.parentNode) {
  7181. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  7182. }
  7183. beforeLeave && beforeLeave(el);
  7184. if (expectsCSS) {
  7185. addTransitionClass(el, leaveClass);
  7186. addTransitionClass(el, leaveActiveClass);
  7187. nextFrame(function () {
  7188. removeTransitionClass(el, leaveClass);
  7189. if (!cb.cancelled) {
  7190. addTransitionClass(el, leaveToClass);
  7191. if (!userWantsControl) {
  7192. if (isValidDuration(explicitLeaveDuration)) {
  7193. setTimeout(cb, explicitLeaveDuration);
  7194. } else {
  7195. whenTransitionEnds(el, type, cb);
  7196. }
  7197. }
  7198. }
  7199. });
  7200. }
  7201. leave && leave(el, cb);
  7202. if (!expectsCSS && !userWantsControl) {
  7203. cb();
  7204. }
  7205. }
  7206. }
  7207. // only used in dev mode
  7208. function checkDuration (val, name, vnode) {
  7209. if (typeof val !== 'number') {
  7210. warn(
  7211. "<transition> explicit " + name + " duration is not a valid number - " +
  7212. "got " + (JSON.stringify(val)) + ".",
  7213. vnode.context
  7214. );
  7215. } else if (isNaN(val)) {
  7216. warn(
  7217. "<transition> explicit " + name + " duration is NaN - " +
  7218. 'the duration expression might be incorrect.',
  7219. vnode.context
  7220. );
  7221. }
  7222. }
  7223. function isValidDuration (val) {
  7224. return typeof val === 'number' && !isNaN(val)
  7225. }
  7226. /**
  7227. * Normalize a transition hook's argument length. The hook may be:
  7228. * - a merged hook (invoker) with the original in .fns
  7229. * - a wrapped component method (check ._length)
  7230. * - a plain function (.length)
  7231. */
  7232. function getHookArgumentsLength (fn) {
  7233. if (isUndef(fn)) {
  7234. return false
  7235. }
  7236. var invokerFns = fn.fns;
  7237. if (isDef(invokerFns)) {
  7238. // invoker
  7239. return getHookArgumentsLength(
  7240. Array.isArray(invokerFns)
  7241. ? invokerFns[0]
  7242. : invokerFns
  7243. )
  7244. } else {
  7245. return (fn._length || fn.length) > 1
  7246. }
  7247. }
  7248. function _enter (_, vnode) {
  7249. if (vnode.data.show !== true) {
  7250. enter(vnode);
  7251. }
  7252. }
  7253. var transition = inBrowser ? {
  7254. create: _enter,
  7255. activate: _enter,
  7256. remove: function remove$$1 (vnode, rm) {
  7257. /* istanbul ignore else */
  7258. if (vnode.data.show !== true) {
  7259. leave(vnode, rm);
  7260. } else {
  7261. rm();
  7262. }
  7263. }
  7264. } : {};
  7265. var platformModules = [
  7266. attrs,
  7267. klass,
  7268. events,
  7269. domProps,
  7270. style,
  7271. transition
  7272. ];
  7273. /* */
  7274. // the directive module should be applied last, after all
  7275. // built-in modules have been applied.
  7276. var modules = platformModules.concat(baseModules);
  7277. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  7278. /**
  7279. * Not type checking this file because flow doesn't like attaching
  7280. * properties to Elements.
  7281. */
  7282. /* istanbul ignore if */
  7283. if (isIE9) {
  7284. // http://www.matts411.com/post/internet-explorer-9-oninput/
  7285. document.addEventListener('selectionchange', function () {
  7286. var el = document.activeElement;
  7287. if (el && el.vmodel) {
  7288. trigger(el, 'input');
  7289. }
  7290. });
  7291. }
  7292. var directive = {
  7293. inserted: function inserted (el, binding, vnode, oldVnode) {
  7294. if (vnode.tag === 'select') {
  7295. // #6903
  7296. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  7297. mergeVNodeHook(vnode, 'postpatch', function () {
  7298. directive.componentUpdated(el, binding, vnode);
  7299. });
  7300. } else {
  7301. setSelected(el, binding, vnode.context);
  7302. }
  7303. el._vOptions = [].map.call(el.options, getValue);
  7304. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  7305. el._vModifiers = binding.modifiers;
  7306. if (!binding.modifiers.lazy) {
  7307. el.addEventListener('compositionstart', onCompositionStart);
  7308. el.addEventListener('compositionend', onCompositionEnd);
  7309. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  7310. // switching focus before confirming composition choice
  7311. // this also fixes the issue where some browsers e.g. iOS Chrome
  7312. // fires "change" instead of "input" on autocomplete.
  7313. el.addEventListener('change', onCompositionEnd);
  7314. /* istanbul ignore if */
  7315. if (isIE9) {
  7316. el.vmodel = true;
  7317. }
  7318. }
  7319. }
  7320. },
  7321. componentUpdated: function componentUpdated (el, binding, vnode) {
  7322. if (vnode.tag === 'select') {
  7323. setSelected(el, binding, vnode.context);
  7324. // in case the options rendered by v-for have changed,
  7325. // it's possible that the value is out-of-sync with the rendered options.
  7326. // detect such cases and filter out values that no longer has a matching
  7327. // option in the DOM.
  7328. var prevOptions = el._vOptions;
  7329. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  7330. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  7331. // trigger change event if
  7332. // no matching option found for at least one value
  7333. var needReset = el.multiple
  7334. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  7335. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  7336. if (needReset) {
  7337. trigger(el, 'change');
  7338. }
  7339. }
  7340. }
  7341. }
  7342. };
  7343. function setSelected (el, binding, vm) {
  7344. actuallySetSelected(el, binding, vm);
  7345. /* istanbul ignore if */
  7346. if (isIE || isEdge) {
  7347. setTimeout(function () {
  7348. actuallySetSelected(el, binding, vm);
  7349. }, 0);
  7350. }
  7351. }
  7352. function actuallySetSelected (el, binding, vm) {
  7353. var value = binding.value;
  7354. var isMultiple = el.multiple;
  7355. if (isMultiple && !Array.isArray(value)) {
  7356. process.env.NODE_ENV !== 'production' && warn(
  7357. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  7358. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  7359. vm
  7360. );
  7361. return
  7362. }
  7363. var selected, option;
  7364. for (var i = 0, l = el.options.length; i < l; i++) {
  7365. option = el.options[i];
  7366. if (isMultiple) {
  7367. selected = looseIndexOf(value, getValue(option)) > -1;
  7368. if (option.selected !== selected) {
  7369. option.selected = selected;
  7370. }
  7371. } else {
  7372. if (looseEqual(getValue(option), value)) {
  7373. if (el.selectedIndex !== i) {
  7374. el.selectedIndex = i;
  7375. }
  7376. return
  7377. }
  7378. }
  7379. }
  7380. if (!isMultiple) {
  7381. el.selectedIndex = -1;
  7382. }
  7383. }
  7384. function hasNoMatchingOption (value, options) {
  7385. return options.every(function (o) { return !looseEqual(o, value); })
  7386. }
  7387. function getValue (option) {
  7388. return '_value' in option
  7389. ? option._value
  7390. : option.value
  7391. }
  7392. function onCompositionStart (e) {
  7393. e.target.composing = true;
  7394. }
  7395. function onCompositionEnd (e) {
  7396. // prevent triggering an input event for no reason
  7397. if (!e.target.composing) { return }
  7398. e.target.composing = false;
  7399. trigger(e.target, 'input');
  7400. }
  7401. function trigger (el, type) {
  7402. var e = document.createEvent('HTMLEvents');
  7403. e.initEvent(type, true, true);
  7404. el.dispatchEvent(e);
  7405. }
  7406. /* */
  7407. // recursively search for possible transition defined inside the component root
  7408. function locateNode (vnode) {
  7409. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  7410. ? locateNode(vnode.componentInstance._vnode)
  7411. : vnode
  7412. }
  7413. var show = {
  7414. bind: function bind (el, ref, vnode) {
  7415. var value = ref.value;
  7416. vnode = locateNode(vnode);
  7417. var transition$$1 = vnode.data && vnode.data.transition;
  7418. var originalDisplay = el.__vOriginalDisplay =
  7419. el.style.display === 'none' ? '' : el.style.display;
  7420. if (value && transition$$1) {
  7421. vnode.data.show = true;
  7422. enter(vnode, function () {
  7423. el.style.display = originalDisplay;
  7424. });
  7425. } else {
  7426. el.style.display = value ? originalDisplay : 'none';
  7427. }
  7428. },
  7429. update: function update (el, ref, vnode) {
  7430. var value = ref.value;
  7431. var oldValue = ref.oldValue;
  7432. /* istanbul ignore if */
  7433. if (!value === !oldValue) { return }
  7434. vnode = locateNode(vnode);
  7435. var transition$$1 = vnode.data && vnode.data.transition;
  7436. if (transition$$1) {
  7437. vnode.data.show = true;
  7438. if (value) {
  7439. enter(vnode, function () {
  7440. el.style.display = el.__vOriginalDisplay;
  7441. });
  7442. } else {
  7443. leave(vnode, function () {
  7444. el.style.display = 'none';
  7445. });
  7446. }
  7447. } else {
  7448. el.style.display = value ? el.__vOriginalDisplay : 'none';
  7449. }
  7450. },
  7451. unbind: function unbind (
  7452. el,
  7453. binding,
  7454. vnode,
  7455. oldVnode,
  7456. isDestroy
  7457. ) {
  7458. if (!isDestroy) {
  7459. el.style.display = el.__vOriginalDisplay;
  7460. }
  7461. }
  7462. };
  7463. var platformDirectives = {
  7464. model: directive,
  7465. show: show
  7466. };
  7467. /* */
  7468. var transitionProps = {
  7469. name: String,
  7470. appear: Boolean,
  7471. css: Boolean,
  7472. mode: String,
  7473. type: String,
  7474. enterClass: String,
  7475. leaveClass: String,
  7476. enterToClass: String,
  7477. leaveToClass: String,
  7478. enterActiveClass: String,
  7479. leaveActiveClass: String,
  7480. appearClass: String,
  7481. appearActiveClass: String,
  7482. appearToClass: String,
  7483. duration: [Number, String, Object]
  7484. };
  7485. // in case the child is also an abstract component, e.g. <keep-alive>
  7486. // we want to recursively retrieve the real component to be rendered
  7487. function getRealChild (vnode) {
  7488. var compOptions = vnode && vnode.componentOptions;
  7489. if (compOptions && compOptions.Ctor.options.abstract) {
  7490. return getRealChild(getFirstComponentChild(compOptions.children))
  7491. } else {
  7492. return vnode
  7493. }
  7494. }
  7495. function extractTransitionData (comp) {
  7496. var data = {};
  7497. var options = comp.$options;
  7498. // props
  7499. for (var key in options.propsData) {
  7500. data[key] = comp[key];
  7501. }
  7502. // events.
  7503. // extract listeners and pass them directly to the transition methods
  7504. var listeners = options._parentListeners;
  7505. for (var key$1 in listeners) {
  7506. data[camelize(key$1)] = listeners[key$1];
  7507. }
  7508. return data
  7509. }
  7510. function placeholder (h, rawChild) {
  7511. if (/\d-keep-alive$/.test(rawChild.tag)) {
  7512. return h('keep-alive', {
  7513. props: rawChild.componentOptions.propsData
  7514. })
  7515. }
  7516. }
  7517. function hasParentTransition (vnode) {
  7518. while ((vnode = vnode.parent)) {
  7519. if (vnode.data.transition) {
  7520. return true
  7521. }
  7522. }
  7523. }
  7524. function isSameChild (child, oldChild) {
  7525. return oldChild.key === child.key && oldChild.tag === child.tag
  7526. }
  7527. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  7528. var isVShowDirective = function (d) { return d.name === 'show'; };
  7529. var Transition = {
  7530. name: 'transition',
  7531. props: transitionProps,
  7532. abstract: true,
  7533. render: function render (h) {
  7534. var this$1 = this;
  7535. var children = this.$slots.default;
  7536. if (!children) {
  7537. return
  7538. }
  7539. // filter out text nodes (possible whitespaces)
  7540. children = children.filter(isNotTextNode);
  7541. /* istanbul ignore if */
  7542. if (!children.length) {
  7543. return
  7544. }
  7545. // warn multiple elements
  7546. if (process.env.NODE_ENV !== 'production' && children.length > 1) {
  7547. warn(
  7548. '<transition> can only be used on a single element. Use ' +
  7549. '<transition-group> for lists.',
  7550. this.$parent
  7551. );
  7552. }
  7553. var mode = this.mode;
  7554. // warn invalid mode
  7555. if (process.env.NODE_ENV !== 'production' &&
  7556. mode && mode !== 'in-out' && mode !== 'out-in'
  7557. ) {
  7558. warn(
  7559. 'invalid <transition> mode: ' + mode,
  7560. this.$parent
  7561. );
  7562. }
  7563. var rawChild = children[0];
  7564. // if this is a component root node and the component's
  7565. // parent container node also has transition, skip.
  7566. if (hasParentTransition(this.$vnode)) {
  7567. return rawChild
  7568. }
  7569. // apply transition data to child
  7570. // use getRealChild() to ignore abstract components e.g. keep-alive
  7571. var child = getRealChild(rawChild);
  7572. /* istanbul ignore if */
  7573. if (!child) {
  7574. return rawChild
  7575. }
  7576. if (this._leaving) {
  7577. return placeholder(h, rawChild)
  7578. }
  7579. // ensure a key that is unique to the vnode type and to this transition
  7580. // component instance. This key will be used to remove pending leaving nodes
  7581. // during entering.
  7582. var id = "__transition-" + (this._uid) + "-";
  7583. child.key = child.key == null
  7584. ? child.isComment
  7585. ? id + 'comment'
  7586. : id + child.tag
  7587. : isPrimitive(child.key)
  7588. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  7589. : child.key;
  7590. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  7591. var oldRawChild = this._vnode;
  7592. var oldChild = getRealChild(oldRawChild);
  7593. // mark v-show
  7594. // so that the transition module can hand over the control to the directive
  7595. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  7596. child.data.show = true;
  7597. }
  7598. if (
  7599. oldChild &&
  7600. oldChild.data &&
  7601. !isSameChild(child, oldChild) &&
  7602. !isAsyncPlaceholder(oldChild) &&
  7603. // #6687 component root is a comment node
  7604. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  7605. ) {
  7606. // replace old child transition data with fresh one
  7607. // important for dynamic transitions!
  7608. var oldData = oldChild.data.transition = extend({}, data);
  7609. // handle transition mode
  7610. if (mode === 'out-in') {
  7611. // return placeholder node and queue update when leave finishes
  7612. this._leaving = true;
  7613. mergeVNodeHook(oldData, 'afterLeave', function () {
  7614. this$1._leaving = false;
  7615. this$1.$forceUpdate();
  7616. });
  7617. return placeholder(h, rawChild)
  7618. } else if (mode === 'in-out') {
  7619. if (isAsyncPlaceholder(child)) {
  7620. return oldRawChild
  7621. }
  7622. var delayedLeave;
  7623. var performLeave = function () { delayedLeave(); };
  7624. mergeVNodeHook(data, 'afterEnter', performLeave);
  7625. mergeVNodeHook(data, 'enterCancelled', performLeave);
  7626. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  7627. }
  7628. }
  7629. return rawChild
  7630. }
  7631. };
  7632. /* */
  7633. var props = extend({
  7634. tag: String,
  7635. moveClass: String
  7636. }, transitionProps);
  7637. delete props.mode;
  7638. var TransitionGroup = {
  7639. props: props,
  7640. beforeMount: function beforeMount () {
  7641. var this$1 = this;
  7642. var update = this._update;
  7643. this._update = function (vnode, hydrating) {
  7644. var restoreActiveInstance = setActiveInstance(this$1);
  7645. // force removing pass
  7646. this$1.__patch__(
  7647. this$1._vnode,
  7648. this$1.kept,
  7649. false, // hydrating
  7650. true // removeOnly (!important, avoids unnecessary moves)
  7651. );
  7652. this$1._vnode = this$1.kept;
  7653. restoreActiveInstance();
  7654. update.call(this$1, vnode, hydrating);
  7655. };
  7656. },
  7657. render: function render (h) {
  7658. var tag = this.tag || this.$vnode.data.tag || 'span';
  7659. var map = Object.create(null);
  7660. var prevChildren = this.prevChildren = this.children;
  7661. var rawChildren = this.$slots.default || [];
  7662. var children = this.children = [];
  7663. var transitionData = extractTransitionData(this);
  7664. for (var i = 0; i < rawChildren.length; i++) {
  7665. var c = rawChildren[i];
  7666. if (c.tag) {
  7667. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  7668. children.push(c);
  7669. map[c.key] = c
  7670. ;(c.data || (c.data = {})).transition = transitionData;
  7671. } else if (process.env.NODE_ENV !== 'production') {
  7672. var opts = c.componentOptions;
  7673. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  7674. warn(("<transition-group> children must be keyed: <" + name + ">"));
  7675. }
  7676. }
  7677. }
  7678. if (prevChildren) {
  7679. var kept = [];
  7680. var removed = [];
  7681. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  7682. var c$1 = prevChildren[i$1];
  7683. c$1.data.transition = transitionData;
  7684. c$1.data.pos = c$1.elm.getBoundingClientRect();
  7685. if (map[c$1.key]) {
  7686. kept.push(c$1);
  7687. } else {
  7688. removed.push(c$1);
  7689. }
  7690. }
  7691. this.kept = h(tag, null, kept);
  7692. this.removed = removed;
  7693. }
  7694. return h(tag, null, children)
  7695. },
  7696. updated: function updated () {
  7697. var children = this.prevChildren;
  7698. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  7699. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  7700. return
  7701. }
  7702. // we divide the work into three loops to avoid mixing DOM reads and writes
  7703. // in each iteration - which helps prevent layout thrashing.
  7704. children.forEach(callPendingCbs);
  7705. children.forEach(recordPosition);
  7706. children.forEach(applyTranslation);
  7707. // force reflow to put everything in position
  7708. // assign to this to avoid being removed in tree-shaking
  7709. // $flow-disable-line
  7710. this._reflow = document.body.offsetHeight;
  7711. children.forEach(function (c) {
  7712. if (c.data.moved) {
  7713. var el = c.elm;
  7714. var s = el.style;
  7715. addTransitionClass(el, moveClass);
  7716. s.transform = s.WebkitTransform = s.transitionDuration = '';
  7717. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  7718. if (e && e.target !== el) {
  7719. return
  7720. }
  7721. if (!e || /transform$/.test(e.propertyName)) {
  7722. el.removeEventListener(transitionEndEvent, cb);
  7723. el._moveCb = null;
  7724. removeTransitionClass(el, moveClass);
  7725. }
  7726. });
  7727. }
  7728. });
  7729. },
  7730. methods: {
  7731. hasMove: function hasMove (el, moveClass) {
  7732. /* istanbul ignore if */
  7733. if (!hasTransition) {
  7734. return false
  7735. }
  7736. /* istanbul ignore if */
  7737. if (this._hasMove) {
  7738. return this._hasMove
  7739. }
  7740. // Detect whether an element with the move class applied has
  7741. // CSS transitions. Since the element may be inside an entering
  7742. // transition at this very moment, we make a clone of it and remove
  7743. // all other transition classes applied to ensure only the move class
  7744. // is applied.
  7745. var clone = el.cloneNode();
  7746. if (el._transitionClasses) {
  7747. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  7748. }
  7749. addClass(clone, moveClass);
  7750. clone.style.display = 'none';
  7751. this.$el.appendChild(clone);
  7752. var info = getTransitionInfo(clone);
  7753. this.$el.removeChild(clone);
  7754. return (this._hasMove = info.hasTransform)
  7755. }
  7756. }
  7757. };
  7758. function callPendingCbs (c) {
  7759. /* istanbul ignore if */
  7760. if (c.elm._moveCb) {
  7761. c.elm._moveCb();
  7762. }
  7763. /* istanbul ignore if */
  7764. if (c.elm._enterCb) {
  7765. c.elm._enterCb();
  7766. }
  7767. }
  7768. function recordPosition (c) {
  7769. c.data.newPos = c.elm.getBoundingClientRect();
  7770. }
  7771. function applyTranslation (c) {
  7772. var oldPos = c.data.pos;
  7773. var newPos = c.data.newPos;
  7774. var dx = oldPos.left - newPos.left;
  7775. var dy = oldPos.top - newPos.top;
  7776. if (dx || dy) {
  7777. c.data.moved = true;
  7778. var s = c.elm.style;
  7779. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  7780. s.transitionDuration = '0s';
  7781. }
  7782. }
  7783. var platformComponents = {
  7784. Transition: Transition,
  7785. TransitionGroup: TransitionGroup
  7786. };
  7787. /* */
  7788. // install platform specific utils
  7789. Vue.config.mustUseProp = mustUseProp;
  7790. Vue.config.isReservedTag = isReservedTag;
  7791. Vue.config.isReservedAttr = isReservedAttr;
  7792. Vue.config.getTagNamespace = getTagNamespace;
  7793. Vue.config.isUnknownElement = isUnknownElement;
  7794. // install platform runtime directives & components
  7795. extend(Vue.options.directives, platformDirectives);
  7796. extend(Vue.options.components, platformComponents);
  7797. // install platform patch function
  7798. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  7799. // public mount method
  7800. Vue.prototype.$mount = function (
  7801. el,
  7802. hydrating
  7803. ) {
  7804. el = el && inBrowser ? query(el) : undefined;
  7805. return mountComponent(this, el, hydrating)
  7806. };
  7807. // devtools global hook
  7808. /* istanbul ignore next */
  7809. if (inBrowser) {
  7810. setTimeout(function () {
  7811. if (config.devtools) {
  7812. if (devtools) {
  7813. devtools.emit('init', Vue);
  7814. } else if (
  7815. process.env.NODE_ENV !== 'production' &&
  7816. process.env.NODE_ENV !== 'test' &&
  7817. isChrome
  7818. ) {
  7819. console[console.info ? 'info' : 'log'](
  7820. 'Download the Vue Devtools extension for a better development experience:\n' +
  7821. 'https://github.com/vuejs/vue-devtools'
  7822. );
  7823. }
  7824. }
  7825. if (process.env.NODE_ENV !== 'production' &&
  7826. process.env.NODE_ENV !== 'test' &&
  7827. config.productionTip !== false &&
  7828. typeof console !== 'undefined'
  7829. ) {
  7830. console[console.info ? 'info' : 'log'](
  7831. "You are running Vue in development mode.\n" +
  7832. "Make sure to turn on production mode when deploying for production.\n" +
  7833. "See more tips at https://vuejs.org/guide/deployment.html"
  7834. );
  7835. }
  7836. }, 0);
  7837. }
  7838. /* */
  7839. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  7840. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  7841. var buildRegex = cached(function (delimiters) {
  7842. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  7843. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  7844. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  7845. });
  7846. function parseText (
  7847. text,
  7848. delimiters
  7849. ) {
  7850. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  7851. if (!tagRE.test(text)) {
  7852. return
  7853. }
  7854. var tokens = [];
  7855. var rawTokens = [];
  7856. var lastIndex = tagRE.lastIndex = 0;
  7857. var match, index, tokenValue;
  7858. while ((match = tagRE.exec(text))) {
  7859. index = match.index;
  7860. // push text token
  7861. if (index > lastIndex) {
  7862. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  7863. tokens.push(JSON.stringify(tokenValue));
  7864. }
  7865. // tag token
  7866. var exp = parseFilters(match[1].trim());
  7867. tokens.push(("_s(" + exp + ")"));
  7868. rawTokens.push({ '@binding': exp });
  7869. lastIndex = index + match[0].length;
  7870. }
  7871. if (lastIndex < text.length) {
  7872. rawTokens.push(tokenValue = text.slice(lastIndex));
  7873. tokens.push(JSON.stringify(tokenValue));
  7874. }
  7875. return {
  7876. expression: tokens.join('+'),
  7877. tokens: rawTokens
  7878. }
  7879. }
  7880. /* */
  7881. function transformNode (el, options) {
  7882. var warn = options.warn || baseWarn;
  7883. var staticClass = getAndRemoveAttr(el, 'class');
  7884. if (process.env.NODE_ENV !== 'production' && staticClass) {
  7885. var res = parseText(staticClass, options.delimiters);
  7886. if (res) {
  7887. warn(
  7888. "class=\"" + staticClass + "\": " +
  7889. 'Interpolation inside attributes has been removed. ' +
  7890. 'Use v-bind or the colon shorthand instead. For example, ' +
  7891. 'instead of <div class="{{ val }}">, use <div :class="val">.'
  7892. );
  7893. }
  7894. }
  7895. if (staticClass) {
  7896. el.staticClass = JSON.stringify(staticClass);
  7897. }
  7898. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  7899. if (classBinding) {
  7900. el.classBinding = classBinding;
  7901. }
  7902. }
  7903. function genData (el) {
  7904. var data = '';
  7905. if (el.staticClass) {
  7906. data += "staticClass:" + (el.staticClass) + ",";
  7907. }
  7908. if (el.classBinding) {
  7909. data += "class:" + (el.classBinding) + ",";
  7910. }
  7911. return data
  7912. }
  7913. var klass$1 = {
  7914. staticKeys: ['staticClass'],
  7915. transformNode: transformNode,
  7916. genData: genData
  7917. };
  7918. /* */
  7919. function transformNode$1 (el, options) {
  7920. var warn = options.warn || baseWarn;
  7921. var staticStyle = getAndRemoveAttr(el, 'style');
  7922. if (staticStyle) {
  7923. /* istanbul ignore if */
  7924. if (process.env.NODE_ENV !== 'production') {
  7925. var res = parseText(staticStyle, options.delimiters);
  7926. if (res) {
  7927. warn(
  7928. "style=\"" + staticStyle + "\": " +
  7929. 'Interpolation inside attributes has been removed. ' +
  7930. 'Use v-bind or the colon shorthand instead. For example, ' +
  7931. 'instead of <div style="{{ val }}">, use <div :style="val">.'
  7932. );
  7933. }
  7934. }
  7935. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  7936. }
  7937. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  7938. if (styleBinding) {
  7939. el.styleBinding = styleBinding;
  7940. }
  7941. }
  7942. function genData$1 (el) {
  7943. var data = '';
  7944. if (el.staticStyle) {
  7945. data += "staticStyle:" + (el.staticStyle) + ",";
  7946. }
  7947. if (el.styleBinding) {
  7948. data += "style:(" + (el.styleBinding) + "),";
  7949. }
  7950. return data
  7951. }
  7952. var style$1 = {
  7953. staticKeys: ['staticStyle'],
  7954. transformNode: transformNode$1,
  7955. genData: genData$1
  7956. };
  7957. /* */
  7958. var decoder;
  7959. var he = {
  7960. decode: function decode (html) {
  7961. decoder = decoder || document.createElement('div');
  7962. decoder.innerHTML = html;
  7963. return decoder.textContent
  7964. }
  7965. };
  7966. /* */
  7967. var isUnaryTag = makeMap(
  7968. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  7969. 'link,meta,param,source,track,wbr'
  7970. );
  7971. // Elements that you can, intentionally, leave open
  7972. // (and which close themselves)
  7973. var canBeLeftOpenTag = makeMap(
  7974. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  7975. );
  7976. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  7977. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  7978. var isNonPhrasingTag = makeMap(
  7979. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  7980. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  7981. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  7982. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  7983. 'title,tr,track'
  7984. );
  7985. /**
  7986. * Not type-checking this file because it's mostly vendor code.
  7987. */
  7988. // Regular Expressions for parsing tags and attributes
  7989. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  7990. // could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName
  7991. // but for Vue templates we can enforce a simple charset
  7992. var ncname = '[a-zA-Z_][\\w\\-\\.]*';
  7993. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  7994. var startTagOpen = new RegExp(("^<" + qnameCapture));
  7995. var startTagClose = /^\s*(\/?)>/;
  7996. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  7997. var doctype = /^<!DOCTYPE [^>]+>/i;
  7998. // #7298: escape - to avoid being pased as HTML comment when inlined in page
  7999. var comment = /^<!\--/;
  8000. var conditionalComment = /^<!\[/;
  8001. // Special Elements (can contain anything)
  8002. var isPlainTextElement = makeMap('script,style,textarea', true);
  8003. var reCache = {};
  8004. var decodingMap = {
  8005. '&lt;': '<',
  8006. '&gt;': '>',
  8007. '&quot;': '"',
  8008. '&amp;': '&',
  8009. '&#10;': '\n',
  8010. '&#9;': '\t'
  8011. };
  8012. var encodedAttr = /&(?:lt|gt|quot|amp);/g;
  8013. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#10|#9);/g;
  8014. // #5992
  8015. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  8016. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  8017. function decodeAttr (value, shouldDecodeNewlines) {
  8018. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  8019. return value.replace(re, function (match) { return decodingMap[match]; })
  8020. }
  8021. function parseHTML (html, options) {
  8022. var stack = [];
  8023. var expectHTML = options.expectHTML;
  8024. var isUnaryTag$$1 = options.isUnaryTag || no;
  8025. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  8026. var index = 0;
  8027. var last, lastTag;
  8028. while (html) {
  8029. last = html;
  8030. // Make sure we're not in a plaintext content element like script/style
  8031. if (!lastTag || !isPlainTextElement(lastTag)) {
  8032. var textEnd = html.indexOf('<');
  8033. if (textEnd === 0) {
  8034. // Comment:
  8035. if (comment.test(html)) {
  8036. var commentEnd = html.indexOf('-->');
  8037. if (commentEnd >= 0) {
  8038. if (options.shouldKeepComment) {
  8039. options.comment(html.substring(4, commentEnd));
  8040. }
  8041. advance(commentEnd + 3);
  8042. continue
  8043. }
  8044. }
  8045. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  8046. if (conditionalComment.test(html)) {
  8047. var conditionalEnd = html.indexOf(']>');
  8048. if (conditionalEnd >= 0) {
  8049. advance(conditionalEnd + 2);
  8050. continue
  8051. }
  8052. }
  8053. // Doctype:
  8054. var doctypeMatch = html.match(doctype);
  8055. if (doctypeMatch) {
  8056. advance(doctypeMatch[0].length);
  8057. continue
  8058. }
  8059. // End tag:
  8060. var endTagMatch = html.match(endTag);
  8061. if (endTagMatch) {
  8062. var curIndex = index;
  8063. advance(endTagMatch[0].length);
  8064. parseEndTag(endTagMatch[1], curIndex, index);
  8065. continue
  8066. }
  8067. // Start tag:
  8068. var startTagMatch = parseStartTag();
  8069. if (startTagMatch) {
  8070. handleStartTag(startTagMatch);
  8071. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  8072. advance(1);
  8073. }
  8074. continue
  8075. }
  8076. }
  8077. var text = (void 0), rest = (void 0), next = (void 0);
  8078. if (textEnd >= 0) {
  8079. rest = html.slice(textEnd);
  8080. while (
  8081. !endTag.test(rest) &&
  8082. !startTagOpen.test(rest) &&
  8083. !comment.test(rest) &&
  8084. !conditionalComment.test(rest)
  8085. ) {
  8086. // < in plain text, be forgiving and treat it as text
  8087. next = rest.indexOf('<', 1);
  8088. if (next < 0) { break }
  8089. textEnd += next;
  8090. rest = html.slice(textEnd);
  8091. }
  8092. text = html.substring(0, textEnd);
  8093. advance(textEnd);
  8094. }
  8095. if (textEnd < 0) {
  8096. text = html;
  8097. html = '';
  8098. }
  8099. if (options.chars && text) {
  8100. options.chars(text);
  8101. }
  8102. } else {
  8103. var endTagLength = 0;
  8104. var stackedTag = lastTag.toLowerCase();
  8105. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  8106. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  8107. endTagLength = endTag.length;
  8108. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  8109. text = text
  8110. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  8111. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  8112. }
  8113. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  8114. text = text.slice(1);
  8115. }
  8116. if (options.chars) {
  8117. options.chars(text);
  8118. }
  8119. return ''
  8120. });
  8121. index += html.length - rest$1.length;
  8122. html = rest$1;
  8123. parseEndTag(stackedTag, index - endTagLength, index);
  8124. }
  8125. if (html === last) {
  8126. options.chars && options.chars(html);
  8127. if (process.env.NODE_ENV !== 'production' && !stack.length && options.warn) {
  8128. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""));
  8129. }
  8130. break
  8131. }
  8132. }
  8133. // Clean up any remaining tags
  8134. parseEndTag();
  8135. function advance (n) {
  8136. index += n;
  8137. html = html.substring(n);
  8138. }
  8139. function parseStartTag () {
  8140. var start = html.match(startTagOpen);
  8141. if (start) {
  8142. var match = {
  8143. tagName: start[1],
  8144. attrs: [],
  8145. start: index
  8146. };
  8147. advance(start[0].length);
  8148. var end, attr;
  8149. while (!(end = html.match(startTagClose)) && (attr = html.match(attribute))) {
  8150. advance(attr[0].length);
  8151. match.attrs.push(attr);
  8152. }
  8153. if (end) {
  8154. match.unarySlash = end[1];
  8155. advance(end[0].length);
  8156. match.end = index;
  8157. return match
  8158. }
  8159. }
  8160. }
  8161. function handleStartTag (match) {
  8162. var tagName = match.tagName;
  8163. var unarySlash = match.unarySlash;
  8164. if (expectHTML) {
  8165. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  8166. parseEndTag(lastTag);
  8167. }
  8168. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  8169. parseEndTag(tagName);
  8170. }
  8171. }
  8172. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  8173. var l = match.attrs.length;
  8174. var attrs = new Array(l);
  8175. for (var i = 0; i < l; i++) {
  8176. var args = match.attrs[i];
  8177. var value = args[3] || args[4] || args[5] || '';
  8178. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  8179. ? options.shouldDecodeNewlinesForHref
  8180. : options.shouldDecodeNewlines;
  8181. attrs[i] = {
  8182. name: args[1],
  8183. value: decodeAttr(value, shouldDecodeNewlines)
  8184. };
  8185. }
  8186. if (!unary) {
  8187. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs });
  8188. lastTag = tagName;
  8189. }
  8190. if (options.start) {
  8191. options.start(tagName, attrs, unary, match.start, match.end);
  8192. }
  8193. }
  8194. function parseEndTag (tagName, start, end) {
  8195. var pos, lowerCasedTagName;
  8196. if (start == null) { start = index; }
  8197. if (end == null) { end = index; }
  8198. // Find the closest opened tag of the same type
  8199. if (tagName) {
  8200. lowerCasedTagName = tagName.toLowerCase();
  8201. for (pos = stack.length - 1; pos >= 0; pos--) {
  8202. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  8203. break
  8204. }
  8205. }
  8206. } else {
  8207. // If no tag name is provided, clean shop
  8208. pos = 0;
  8209. }
  8210. if (pos >= 0) {
  8211. // Close all the open elements, up the stack
  8212. for (var i = stack.length - 1; i >= pos; i--) {
  8213. if (process.env.NODE_ENV !== 'production' &&
  8214. (i > pos || !tagName) &&
  8215. options.warn
  8216. ) {
  8217. options.warn(
  8218. ("tag <" + (stack[i].tag) + "> has no matching end tag.")
  8219. );
  8220. }
  8221. if (options.end) {
  8222. options.end(stack[i].tag, start, end);
  8223. }
  8224. }
  8225. // Remove the open elements from the stack
  8226. stack.length = pos;
  8227. lastTag = pos && stack[pos - 1].tag;
  8228. } else if (lowerCasedTagName === 'br') {
  8229. if (options.start) {
  8230. options.start(tagName, [], true, start, end);
  8231. }
  8232. } else if (lowerCasedTagName === 'p') {
  8233. if (options.start) {
  8234. options.start(tagName, [], false, start, end);
  8235. }
  8236. if (options.end) {
  8237. options.end(tagName, start, end);
  8238. }
  8239. }
  8240. }
  8241. }
  8242. /* */
  8243. var onRE = /^@|^v-on:/;
  8244. var dirRE = /^v-|^@|^:/;
  8245. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  8246. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  8247. var stripParensRE = /^\(|\)$/g;
  8248. var argRE = /:(.*)$/;
  8249. var bindRE = /^:|^v-bind:/;
  8250. var modifierRE = /\.[^.]+/g;
  8251. var decodeHTMLCached = cached(he.decode);
  8252. // configurable state
  8253. var warn$2;
  8254. var delimiters;
  8255. var transforms;
  8256. var preTransforms;
  8257. var postTransforms;
  8258. var platformIsPreTag;
  8259. var platformMustUseProp;
  8260. var platformGetTagNamespace;
  8261. function createASTElement (
  8262. tag,
  8263. attrs,
  8264. parent
  8265. ) {
  8266. return {
  8267. type: 1,
  8268. tag: tag,
  8269. attrsList: attrs,
  8270. attrsMap: makeAttrsMap(attrs),
  8271. parent: parent,
  8272. children: []
  8273. }
  8274. }
  8275. /**
  8276. * Convert HTML string to AST.
  8277. */
  8278. function parse (
  8279. template,
  8280. options
  8281. ) {
  8282. warn$2 = options.warn || baseWarn;
  8283. platformIsPreTag = options.isPreTag || no;
  8284. platformMustUseProp = options.mustUseProp || no;
  8285. platformGetTagNamespace = options.getTagNamespace || no;
  8286. transforms = pluckModuleFunction(options.modules, 'transformNode');
  8287. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  8288. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  8289. delimiters = options.delimiters;
  8290. var stack = [];
  8291. var preserveWhitespace = options.preserveWhitespace !== false;
  8292. var root;
  8293. var currentParent;
  8294. var inVPre = false;
  8295. var inPre = false;
  8296. var warned = false;
  8297. function warnOnce (msg) {
  8298. if (!warned) {
  8299. warned = true;
  8300. warn$2(msg);
  8301. }
  8302. }
  8303. function closeElement (element) {
  8304. // check pre state
  8305. if (element.pre) {
  8306. inVPre = false;
  8307. }
  8308. if (platformIsPreTag(element.tag)) {
  8309. inPre = false;
  8310. }
  8311. // apply post-transforms
  8312. for (var i = 0; i < postTransforms.length; i++) {
  8313. postTransforms[i](element, options);
  8314. }
  8315. }
  8316. parseHTML(template, {
  8317. warn: warn$2,
  8318. expectHTML: options.expectHTML,
  8319. isUnaryTag: options.isUnaryTag,
  8320. canBeLeftOpenTag: options.canBeLeftOpenTag,
  8321. shouldDecodeNewlines: options.shouldDecodeNewlines,
  8322. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  8323. shouldKeepComment: options.comments,
  8324. start: function start (tag, attrs, unary) {
  8325. // check namespace.
  8326. // inherit parent ns if there is one
  8327. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  8328. // handle IE svg bug
  8329. /* istanbul ignore if */
  8330. if (isIE && ns === 'svg') {
  8331. attrs = guardIESVGBug(attrs);
  8332. }
  8333. var element = createASTElement(tag, attrs, currentParent);
  8334. if (ns) {
  8335. element.ns = ns;
  8336. }
  8337. if (isForbiddenTag(element) && !isServerRendering()) {
  8338. element.forbidden = true;
  8339. process.env.NODE_ENV !== 'production' && warn$2(
  8340. 'Templates should only be responsible for mapping the state to the ' +
  8341. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  8342. "<" + tag + ">" + ', as they will not be parsed.'
  8343. );
  8344. }
  8345. // apply pre-transforms
  8346. for (var i = 0; i < preTransforms.length; i++) {
  8347. element = preTransforms[i](element, options) || element;
  8348. }
  8349. if (!inVPre) {
  8350. processPre(element);
  8351. if (element.pre) {
  8352. inVPre = true;
  8353. }
  8354. }
  8355. if (platformIsPreTag(element.tag)) {
  8356. inPre = true;
  8357. }
  8358. if (inVPre) {
  8359. processRawAttrs(element);
  8360. } else if (!element.processed) {
  8361. // structural directives
  8362. processFor(element);
  8363. processIf(element);
  8364. processOnce(element);
  8365. // element-scope stuff
  8366. processElement(element, options);
  8367. }
  8368. function checkRootConstraints (el) {
  8369. if (process.env.NODE_ENV !== 'production') {
  8370. if (el.tag === 'slot' || el.tag === 'template') {
  8371. warnOnce(
  8372. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  8373. 'contain multiple nodes.'
  8374. );
  8375. }
  8376. if (el.attrsMap.hasOwnProperty('v-for')) {
  8377. warnOnce(
  8378. 'Cannot use v-for on stateful component root element because ' +
  8379. 'it renders multiple elements.'
  8380. );
  8381. }
  8382. }
  8383. }
  8384. // tree management
  8385. if (!root) {
  8386. root = element;
  8387. checkRootConstraints(root);
  8388. } else if (!stack.length) {
  8389. // allow root elements with v-if, v-else-if and v-else
  8390. if (root.if && (element.elseif || element.else)) {
  8391. checkRootConstraints(element);
  8392. addIfCondition(root, {
  8393. exp: element.elseif,
  8394. block: element
  8395. });
  8396. } else if (process.env.NODE_ENV !== 'production') {
  8397. warnOnce(
  8398. "Component template should contain exactly one root element. " +
  8399. "If you are using v-if on multiple elements, " +
  8400. "use v-else-if to chain them instead."
  8401. );
  8402. }
  8403. }
  8404. if (currentParent && !element.forbidden) {
  8405. if (element.elseif || element.else) {
  8406. processIfConditions(element, currentParent);
  8407. } else if (element.slotScope) { // scoped slot
  8408. currentParent.plain = false;
  8409. var name = element.slotTarget || '"default"'
  8410. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  8411. } else {
  8412. currentParent.children.push(element);
  8413. element.parent = currentParent;
  8414. }
  8415. }
  8416. if (!unary) {
  8417. currentParent = element;
  8418. stack.push(element);
  8419. } else {
  8420. closeElement(element);
  8421. }
  8422. },
  8423. end: function end () {
  8424. // remove trailing whitespace
  8425. var element = stack[stack.length - 1];
  8426. var lastNode = element.children[element.children.length - 1];
  8427. if (lastNode && lastNode.type === 3 && lastNode.text === ' ' && !inPre) {
  8428. element.children.pop();
  8429. }
  8430. // pop stack
  8431. stack.length -= 1;
  8432. currentParent = stack[stack.length - 1];
  8433. closeElement(element);
  8434. },
  8435. chars: function chars (text) {
  8436. if (!currentParent) {
  8437. if (process.env.NODE_ENV !== 'production') {
  8438. if (text === template) {
  8439. warnOnce(
  8440. 'Component template requires a root element, rather than just text.'
  8441. );
  8442. } else if ((text = text.trim())) {
  8443. warnOnce(
  8444. ("text \"" + text + "\" outside root element will be ignored.")
  8445. );
  8446. }
  8447. }
  8448. return
  8449. }
  8450. // IE textarea placeholder bug
  8451. /* istanbul ignore if */
  8452. if (isIE &&
  8453. currentParent.tag === 'textarea' &&
  8454. currentParent.attrsMap.placeholder === text
  8455. ) {
  8456. return
  8457. }
  8458. var children = currentParent.children;
  8459. text = inPre || text.trim()
  8460. ? isTextTag(currentParent) ? text : decodeHTMLCached(text)
  8461. // only preserve whitespace if its not right after a starting tag
  8462. : preserveWhitespace && children.length ? ' ' : '';
  8463. if (text) {
  8464. var res;
  8465. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  8466. children.push({
  8467. type: 2,
  8468. expression: res.expression,
  8469. tokens: res.tokens,
  8470. text: text
  8471. });
  8472. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  8473. children.push({
  8474. type: 3,
  8475. text: text
  8476. });
  8477. }
  8478. }
  8479. },
  8480. comment: function comment (text) {
  8481. currentParent.children.push({
  8482. type: 3,
  8483. text: text,
  8484. isComment: true
  8485. });
  8486. }
  8487. });
  8488. return root
  8489. }
  8490. function processPre (el) {
  8491. if (getAndRemoveAttr(el, 'v-pre') != null) {
  8492. el.pre = true;
  8493. }
  8494. }
  8495. function processRawAttrs (el) {
  8496. var l = el.attrsList.length;
  8497. if (l) {
  8498. var attrs = el.attrs = new Array(l);
  8499. for (var i = 0; i < l; i++) {
  8500. attrs[i] = {
  8501. name: el.attrsList[i].name,
  8502. value: JSON.stringify(el.attrsList[i].value)
  8503. };
  8504. }
  8505. } else if (!el.pre) {
  8506. // non root node in pre blocks with no attributes
  8507. el.plain = true;
  8508. }
  8509. }
  8510. function processElement (element, options) {
  8511. processKey(element);
  8512. // determine whether this is a plain element after
  8513. // removing structural attributes
  8514. element.plain = !element.key && !element.attrsList.length;
  8515. processRef(element);
  8516. processSlot(element);
  8517. processComponent(element);
  8518. for (var i = 0; i < transforms.length; i++) {
  8519. element = transforms[i](element, options) || element;
  8520. }
  8521. processAttrs(element);
  8522. }
  8523. function processKey (el) {
  8524. var exp = getBindingAttr(el, 'key');
  8525. if (exp) {
  8526. if (process.env.NODE_ENV !== 'production') {
  8527. if (el.tag === 'template') {
  8528. warn$2("<template> cannot be keyed. Place the key on real elements instead.");
  8529. }
  8530. if (el.for) {
  8531. var iterator = el.iterator2 || el.iterator1;
  8532. var parent = el.parent;
  8533. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  8534. warn$2(
  8535. "Do not use v-for index as key on <transition-group> children, " +
  8536. "this is the same as not using keys."
  8537. );
  8538. }
  8539. }
  8540. }
  8541. el.key = exp;
  8542. }
  8543. }
  8544. function processRef (el) {
  8545. var ref = getBindingAttr(el, 'ref');
  8546. if (ref) {
  8547. el.ref = ref;
  8548. el.refInFor = checkInFor(el);
  8549. }
  8550. }
  8551. function processFor (el) {
  8552. var exp;
  8553. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  8554. var res = parseFor(exp);
  8555. if (res) {
  8556. extend(el, res);
  8557. } else if (process.env.NODE_ENV !== 'production') {
  8558. warn$2(
  8559. ("Invalid v-for expression: " + exp)
  8560. );
  8561. }
  8562. }
  8563. }
  8564. function parseFor (exp) {
  8565. var inMatch = exp.match(forAliasRE);
  8566. if (!inMatch) { return }
  8567. var res = {};
  8568. res.for = inMatch[2].trim();
  8569. var alias = inMatch[1].trim().replace(stripParensRE, '');
  8570. var iteratorMatch = alias.match(forIteratorRE);
  8571. if (iteratorMatch) {
  8572. res.alias = alias.replace(forIteratorRE, '').trim();
  8573. res.iterator1 = iteratorMatch[1].trim();
  8574. if (iteratorMatch[2]) {
  8575. res.iterator2 = iteratorMatch[2].trim();
  8576. }
  8577. } else {
  8578. res.alias = alias;
  8579. }
  8580. return res
  8581. }
  8582. function processIf (el) {
  8583. var exp = getAndRemoveAttr(el, 'v-if');
  8584. if (exp) {
  8585. el.if = exp;
  8586. addIfCondition(el, {
  8587. exp: exp,
  8588. block: el
  8589. });
  8590. } else {
  8591. if (getAndRemoveAttr(el, 'v-else') != null) {
  8592. el.else = true;
  8593. }
  8594. var elseif = getAndRemoveAttr(el, 'v-else-if');
  8595. if (elseif) {
  8596. el.elseif = elseif;
  8597. }
  8598. }
  8599. }
  8600. function processIfConditions (el, parent) {
  8601. var prev = findPrevElement(parent.children);
  8602. if (prev && prev.if) {
  8603. addIfCondition(prev, {
  8604. exp: el.elseif,
  8605. block: el
  8606. });
  8607. } else if (process.env.NODE_ENV !== 'production') {
  8608. warn$2(
  8609. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  8610. "used on element <" + (el.tag) + "> without corresponding v-if."
  8611. );
  8612. }
  8613. }
  8614. function findPrevElement (children) {
  8615. var i = children.length;
  8616. while (i--) {
  8617. if (children[i].type === 1) {
  8618. return children[i]
  8619. } else {
  8620. if (process.env.NODE_ENV !== 'production' && children[i].text !== ' ') {
  8621. warn$2(
  8622. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  8623. "will be ignored."
  8624. );
  8625. }
  8626. children.pop();
  8627. }
  8628. }
  8629. }
  8630. function addIfCondition (el, condition) {
  8631. if (!el.ifConditions) {
  8632. el.ifConditions = [];
  8633. }
  8634. el.ifConditions.push(condition);
  8635. }
  8636. function processOnce (el) {
  8637. var once$$1 = getAndRemoveAttr(el, 'v-once');
  8638. if (once$$1 != null) {
  8639. el.once = true;
  8640. }
  8641. }
  8642. function processSlot (el) {
  8643. if (el.tag === 'slot') {
  8644. el.slotName = getBindingAttr(el, 'name');
  8645. if (process.env.NODE_ENV !== 'production' && el.key) {
  8646. warn$2(
  8647. "`key` does not work on <slot> because slots are abstract outlets " +
  8648. "and can possibly expand into multiple elements. " +
  8649. "Use the key on a wrapping element instead."
  8650. );
  8651. }
  8652. } else {
  8653. var slotScope;
  8654. if (el.tag === 'template') {
  8655. slotScope = getAndRemoveAttr(el, 'scope');
  8656. /* istanbul ignore if */
  8657. if (process.env.NODE_ENV !== 'production' && slotScope) {
  8658. warn$2(
  8659. "the \"scope\" attribute for scoped slots have been deprecated and " +
  8660. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  8661. "can also be used on plain elements in addition to <template> to " +
  8662. "denote scoped slots.",
  8663. true
  8664. );
  8665. }
  8666. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  8667. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  8668. /* istanbul ignore if */
  8669. if (process.env.NODE_ENV !== 'production' && el.attrsMap['v-for']) {
  8670. warn$2(
  8671. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  8672. "(v-for takes higher priority). Use a wrapper <template> for the " +
  8673. "scoped slot to make it clearer.",
  8674. true
  8675. );
  8676. }
  8677. el.slotScope = slotScope;
  8678. }
  8679. var slotTarget = getBindingAttr(el, 'slot');
  8680. if (slotTarget) {
  8681. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  8682. // preserve slot as an attribute for native shadow DOM compat
  8683. // only for non-scoped slots.
  8684. if (el.tag !== 'template' && !el.slotScope) {
  8685. addAttr(el, 'slot', slotTarget);
  8686. }
  8687. }
  8688. }
  8689. }
  8690. function processComponent (el) {
  8691. var binding;
  8692. if ((binding = getBindingAttr(el, 'is'))) {
  8693. el.component = binding;
  8694. }
  8695. if (getAndRemoveAttr(el, 'inline-template') != null) {
  8696. el.inlineTemplate = true;
  8697. }
  8698. }
  8699. function processAttrs (el) {
  8700. var list = el.attrsList;
  8701. var i, l, name, rawName, value, modifiers, isProp;
  8702. for (i = 0, l = list.length; i < l; i++) {
  8703. name = rawName = list[i].name;
  8704. value = list[i].value;
  8705. if (dirRE.test(name)) {
  8706. // mark element as dynamic
  8707. el.hasBindings = true;
  8708. // modifiers
  8709. modifiers = parseModifiers(name);
  8710. if (modifiers) {
  8711. name = name.replace(modifierRE, '');
  8712. }
  8713. if (bindRE.test(name)) { // v-bind
  8714. name = name.replace(bindRE, '');
  8715. value = parseFilters(value);
  8716. isProp = false;
  8717. if (
  8718. process.env.NODE_ENV !== 'production' &&
  8719. value.trim().length === 0
  8720. ) {
  8721. warn$2(
  8722. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  8723. );
  8724. }
  8725. if (modifiers) {
  8726. if (modifiers.prop) {
  8727. isProp = true;
  8728. name = camelize(name);
  8729. if (name === 'innerHtml') { name = 'innerHTML'; }
  8730. }
  8731. if (modifiers.camel) {
  8732. name = camelize(name);
  8733. }
  8734. if (modifiers.sync) {
  8735. addHandler(
  8736. el,
  8737. ("update:" + (camelize(name))),
  8738. genAssignmentCode(value, "$event")
  8739. );
  8740. }
  8741. }
  8742. if (isProp || (
  8743. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  8744. )) {
  8745. addProp(el, name, value);
  8746. } else {
  8747. addAttr(el, name, value);
  8748. }
  8749. } else if (onRE.test(name)) { // v-on
  8750. name = name.replace(onRE, '');
  8751. addHandler(el, name, value, modifiers, false, warn$2);
  8752. } else { // normal directives
  8753. name = name.replace(dirRE, '');
  8754. // parse arg
  8755. var argMatch = name.match(argRE);
  8756. var arg = argMatch && argMatch[1];
  8757. if (arg) {
  8758. name = name.slice(0, -(arg.length + 1));
  8759. }
  8760. addDirective(el, name, rawName, value, arg, modifiers);
  8761. if (process.env.NODE_ENV !== 'production' && name === 'model') {
  8762. checkForAliasModel(el, value);
  8763. }
  8764. }
  8765. } else {
  8766. // literal attribute
  8767. if (process.env.NODE_ENV !== 'production') {
  8768. var res = parseText(value, delimiters);
  8769. if (res) {
  8770. warn$2(
  8771. name + "=\"" + value + "\": " +
  8772. 'Interpolation inside attributes has been removed. ' +
  8773. 'Use v-bind or the colon shorthand instead. For example, ' +
  8774. 'instead of <div id="{{ val }}">, use <div :id="val">.'
  8775. );
  8776. }
  8777. }
  8778. addAttr(el, name, JSON.stringify(value));
  8779. // #6887 firefox doesn't update muted state if set via attribute
  8780. // even immediately after element creation
  8781. if (!el.component &&
  8782. name === 'muted' &&
  8783. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  8784. addProp(el, name, 'true');
  8785. }
  8786. }
  8787. }
  8788. }
  8789. function checkInFor (el) {
  8790. var parent = el;
  8791. while (parent) {
  8792. if (parent.for !== undefined) {
  8793. return true
  8794. }
  8795. parent = parent.parent;
  8796. }
  8797. return false
  8798. }
  8799. function parseModifiers (name) {
  8800. var match = name.match(modifierRE);
  8801. if (match) {
  8802. var ret = {};
  8803. match.forEach(function (m) { ret[m.slice(1)] = true; });
  8804. return ret
  8805. }
  8806. }
  8807. function makeAttrsMap (attrs) {
  8808. var map = {};
  8809. for (var i = 0, l = attrs.length; i < l; i++) {
  8810. if (
  8811. process.env.NODE_ENV !== 'production' &&
  8812. map[attrs[i].name] && !isIE && !isEdge
  8813. ) {
  8814. warn$2('duplicate attribute: ' + attrs[i].name);
  8815. }
  8816. map[attrs[i].name] = attrs[i].value;
  8817. }
  8818. return map
  8819. }
  8820. // for script (e.g. type="x/template") or style, do not decode content
  8821. function isTextTag (el) {
  8822. return el.tag === 'script' || el.tag === 'style'
  8823. }
  8824. function isForbiddenTag (el) {
  8825. return (
  8826. el.tag === 'style' ||
  8827. (el.tag === 'script' && (
  8828. !el.attrsMap.type ||
  8829. el.attrsMap.type === 'text/javascript'
  8830. ))
  8831. )
  8832. }
  8833. var ieNSBug = /^xmlns:NS\d+/;
  8834. var ieNSPrefix = /^NS\d+:/;
  8835. /* istanbul ignore next */
  8836. function guardIESVGBug (attrs) {
  8837. var res = [];
  8838. for (var i = 0; i < attrs.length; i++) {
  8839. var attr = attrs[i];
  8840. if (!ieNSBug.test(attr.name)) {
  8841. attr.name = attr.name.replace(ieNSPrefix, '');
  8842. res.push(attr);
  8843. }
  8844. }
  8845. return res
  8846. }
  8847. function checkForAliasModel (el, value) {
  8848. var _el = el;
  8849. while (_el) {
  8850. if (_el.for && _el.alias === value) {
  8851. warn$2(
  8852. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  8853. "You are binding v-model directly to a v-for iteration alias. " +
  8854. "This will not be able to modify the v-for source array because " +
  8855. "writing to the alias is like modifying a function local variable. " +
  8856. "Consider using an array of objects and use v-model on an object property instead."
  8857. );
  8858. }
  8859. _el = _el.parent;
  8860. }
  8861. }
  8862. /* */
  8863. function preTransformNode (el, options) {
  8864. if (el.tag === 'input') {
  8865. var map = el.attrsMap;
  8866. if (!map['v-model']) {
  8867. return
  8868. }
  8869. var typeBinding;
  8870. if (map[':type'] || map['v-bind:type']) {
  8871. typeBinding = getBindingAttr(el, 'type');
  8872. }
  8873. if (!map.type && !typeBinding && map['v-bind']) {
  8874. typeBinding = "(" + (map['v-bind']) + ").type";
  8875. }
  8876. if (typeBinding) {
  8877. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  8878. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  8879. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  8880. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  8881. // 1. checkbox
  8882. var branch0 = cloneASTElement(el);
  8883. // process for on the main node
  8884. processFor(branch0);
  8885. addRawAttr(branch0, 'type', 'checkbox');
  8886. processElement(branch0, options);
  8887. branch0.processed = true; // prevent it from double-processed
  8888. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  8889. addIfCondition(branch0, {
  8890. exp: branch0.if,
  8891. block: branch0
  8892. });
  8893. // 2. add radio else-if condition
  8894. var branch1 = cloneASTElement(el);
  8895. getAndRemoveAttr(branch1, 'v-for', true);
  8896. addRawAttr(branch1, 'type', 'radio');
  8897. processElement(branch1, options);
  8898. addIfCondition(branch0, {
  8899. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  8900. block: branch1
  8901. });
  8902. // 3. other
  8903. var branch2 = cloneASTElement(el);
  8904. getAndRemoveAttr(branch2, 'v-for', true);
  8905. addRawAttr(branch2, ':type', typeBinding);
  8906. processElement(branch2, options);
  8907. addIfCondition(branch0, {
  8908. exp: ifCondition,
  8909. block: branch2
  8910. });
  8911. if (hasElse) {
  8912. branch0.else = true;
  8913. } else if (elseIfCondition) {
  8914. branch0.elseif = elseIfCondition;
  8915. }
  8916. return branch0
  8917. }
  8918. }
  8919. }
  8920. function cloneASTElement (el) {
  8921. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  8922. }
  8923. var model$1 = {
  8924. preTransformNode: preTransformNode
  8925. };
  8926. var modules$1 = [
  8927. klass$1,
  8928. style$1,
  8929. model$1
  8930. ];
  8931. /* */
  8932. function text (el, dir) {
  8933. if (dir.value) {
  8934. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"));
  8935. }
  8936. }
  8937. /* */
  8938. function html (el, dir) {
  8939. if (dir.value) {
  8940. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"));
  8941. }
  8942. }
  8943. var directives$1 = {
  8944. model: model,
  8945. text: text,
  8946. html: html
  8947. };
  8948. /* */
  8949. var baseOptions = {
  8950. expectHTML: true,
  8951. modules: modules$1,
  8952. directives: directives$1,
  8953. isPreTag: isPreTag,
  8954. isUnaryTag: isUnaryTag,
  8955. mustUseProp: mustUseProp,
  8956. canBeLeftOpenTag: canBeLeftOpenTag,
  8957. isReservedTag: isReservedTag,
  8958. getTagNamespace: getTagNamespace,
  8959. staticKeys: genStaticKeys(modules$1)
  8960. };
  8961. /* */
  8962. var isStaticKey;
  8963. var isPlatformReservedTag;
  8964. var genStaticKeysCached = cached(genStaticKeys$1);
  8965. /**
  8966. * Goal of the optimizer: walk the generated template AST tree
  8967. * and detect sub-trees that are purely static, i.e. parts of
  8968. * the DOM that never needs to change.
  8969. *
  8970. * Once we detect these sub-trees, we can:
  8971. *
  8972. * 1. Hoist them into constants, so that we no longer need to
  8973. * create fresh nodes for them on each re-render;
  8974. * 2. Completely skip them in the patching process.
  8975. */
  8976. function optimize (root, options) {
  8977. if (!root) { return }
  8978. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  8979. isPlatformReservedTag = options.isReservedTag || no;
  8980. // first pass: mark all non-static nodes.
  8981. markStatic$1(root);
  8982. // second pass: mark static roots.
  8983. markStaticRoots(root, false);
  8984. }
  8985. function genStaticKeys$1 (keys) {
  8986. return makeMap(
  8987. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs' +
  8988. (keys ? ',' + keys : '')
  8989. )
  8990. }
  8991. function markStatic$1 (node) {
  8992. node.static = isStatic(node);
  8993. if (node.type === 1) {
  8994. // do not make component slot content static. this avoids
  8995. // 1. components not able to mutate slot nodes
  8996. // 2. static slot content fails for hot-reloading
  8997. if (
  8998. !isPlatformReservedTag(node.tag) &&
  8999. node.tag !== 'slot' &&
  9000. node.attrsMap['inline-template'] == null
  9001. ) {
  9002. return
  9003. }
  9004. for (var i = 0, l = node.children.length; i < l; i++) {
  9005. var child = node.children[i];
  9006. markStatic$1(child);
  9007. if (!child.static) {
  9008. node.static = false;
  9009. }
  9010. }
  9011. if (node.ifConditions) {
  9012. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  9013. var block = node.ifConditions[i$1].block;
  9014. markStatic$1(block);
  9015. if (!block.static) {
  9016. node.static = false;
  9017. }
  9018. }
  9019. }
  9020. }
  9021. }
  9022. function markStaticRoots (node, isInFor) {
  9023. if (node.type === 1) {
  9024. if (node.static || node.once) {
  9025. node.staticInFor = isInFor;
  9026. }
  9027. // For a node to qualify as a static root, it should have children that
  9028. // are not just static text. Otherwise the cost of hoisting out will
  9029. // outweigh the benefits and it's better off to just always render it fresh.
  9030. if (node.static && node.children.length && !(
  9031. node.children.length === 1 &&
  9032. node.children[0].type === 3
  9033. )) {
  9034. node.staticRoot = true;
  9035. return
  9036. } else {
  9037. node.staticRoot = false;
  9038. }
  9039. if (node.children) {
  9040. for (var i = 0, l = node.children.length; i < l; i++) {
  9041. markStaticRoots(node.children[i], isInFor || !!node.for);
  9042. }
  9043. }
  9044. if (node.ifConditions) {
  9045. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  9046. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  9047. }
  9048. }
  9049. }
  9050. }
  9051. function isStatic (node) {
  9052. if (node.type === 2) { // expression
  9053. return false
  9054. }
  9055. if (node.type === 3) { // text
  9056. return true
  9057. }
  9058. return !!(node.pre || (
  9059. !node.hasBindings && // no dynamic bindings
  9060. !node.if && !node.for && // not v-if or v-for or v-else
  9061. !isBuiltInTag(node.tag) && // not a built-in
  9062. isPlatformReservedTag(node.tag) && // not a component
  9063. !isDirectChildOfTemplateFor(node) &&
  9064. Object.keys(node).every(isStaticKey)
  9065. ))
  9066. }
  9067. function isDirectChildOfTemplateFor (node) {
  9068. while (node.parent) {
  9069. node = node.parent;
  9070. if (node.tag !== 'template') {
  9071. return false
  9072. }
  9073. if (node.for) {
  9074. return true
  9075. }
  9076. }
  9077. return false
  9078. }
  9079. /* */
  9080. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
  9081. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  9082. // KeyboardEvent.keyCode aliases
  9083. var keyCodes = {
  9084. esc: 27,
  9085. tab: 9,
  9086. enter: 13,
  9087. space: 32,
  9088. up: 38,
  9089. left: 37,
  9090. right: 39,
  9091. down: 40,
  9092. 'delete': [8, 46]
  9093. };
  9094. // KeyboardEvent.key aliases
  9095. var keyNames = {
  9096. // #7880: IE11 and Edge use `Esc` for Escape key name.
  9097. esc: ['Esc', 'Escape'],
  9098. tab: 'Tab',
  9099. enter: 'Enter',
  9100. // #9112: IE11 uses `Spacebar` for Space key name.
  9101. space: [' ', 'Spacebar'],
  9102. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  9103. up: ['Up', 'ArrowUp'],
  9104. left: ['Left', 'ArrowLeft'],
  9105. right: ['Right', 'ArrowRight'],
  9106. down: ['Down', 'ArrowDown'],
  9107. // #9112: IE11 uses `Del` for Delete key name.
  9108. 'delete': ['Backspace', 'Delete', 'Del']
  9109. };
  9110. // #4868: modifiers that prevent the execution of the listener
  9111. // need to explicitly return null so that we can determine whether to remove
  9112. // the listener for .once
  9113. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  9114. var modifierCode = {
  9115. stop: '$event.stopPropagation();',
  9116. prevent: '$event.preventDefault();',
  9117. self: genGuard("$event.target !== $event.currentTarget"),
  9118. ctrl: genGuard("!$event.ctrlKey"),
  9119. shift: genGuard("!$event.shiftKey"),
  9120. alt: genGuard("!$event.altKey"),
  9121. meta: genGuard("!$event.metaKey"),
  9122. left: genGuard("'button' in $event && $event.button !== 0"),
  9123. middle: genGuard("'button' in $event && $event.button !== 1"),
  9124. right: genGuard("'button' in $event && $event.button !== 2")
  9125. };
  9126. function genHandlers (
  9127. events,
  9128. isNative
  9129. ) {
  9130. var res = isNative ? 'nativeOn:{' : 'on:{';
  9131. for (var name in events) {
  9132. res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
  9133. }
  9134. return res.slice(0, -1) + '}'
  9135. }
  9136. function genHandler (
  9137. name,
  9138. handler
  9139. ) {
  9140. if (!handler) {
  9141. return 'function(){}'
  9142. }
  9143. if (Array.isArray(handler)) {
  9144. return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
  9145. }
  9146. var isMethodPath = simplePathRE.test(handler.value);
  9147. var isFunctionExpression = fnExpRE.test(handler.value);
  9148. if (!handler.modifiers) {
  9149. if (isMethodPath || isFunctionExpression) {
  9150. return handler.value
  9151. }
  9152. return ("function($event){" + (handler.value) + "}") // inline statement
  9153. } else {
  9154. var code = '';
  9155. var genModifierCode = '';
  9156. var keys = [];
  9157. for (var key in handler.modifiers) {
  9158. if (modifierCode[key]) {
  9159. genModifierCode += modifierCode[key];
  9160. // left/right
  9161. if (keyCodes[key]) {
  9162. keys.push(key);
  9163. }
  9164. } else if (key === 'exact') {
  9165. var modifiers = (handler.modifiers);
  9166. genModifierCode += genGuard(
  9167. ['ctrl', 'shift', 'alt', 'meta']
  9168. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  9169. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  9170. .join('||')
  9171. );
  9172. } else {
  9173. keys.push(key);
  9174. }
  9175. }
  9176. if (keys.length) {
  9177. code += genKeyFilter(keys);
  9178. }
  9179. // Make sure modifiers like prevent and stop get executed after key filtering
  9180. if (genModifierCode) {
  9181. code += genModifierCode;
  9182. }
  9183. var handlerCode = isMethodPath
  9184. ? ("return " + (handler.value) + "($event)")
  9185. : isFunctionExpression
  9186. ? ("return (" + (handler.value) + ")($event)")
  9187. : handler.value;
  9188. return ("function($event){" + code + handlerCode + "}")
  9189. }
  9190. }
  9191. function genKeyFilter (keys) {
  9192. return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
  9193. }
  9194. function genFilterCode (key) {
  9195. var keyVal = parseInt(key, 10);
  9196. if (keyVal) {
  9197. return ("$event.keyCode!==" + keyVal)
  9198. }
  9199. var keyCode = keyCodes[key];
  9200. var keyName = keyNames[key];
  9201. return (
  9202. "_k($event.keyCode," +
  9203. (JSON.stringify(key)) + "," +
  9204. (JSON.stringify(keyCode)) + "," +
  9205. "$event.key," +
  9206. "" + (JSON.stringify(keyName)) +
  9207. ")"
  9208. )
  9209. }
  9210. /* */
  9211. function on (el, dir) {
  9212. if (process.env.NODE_ENV !== 'production' && dir.modifiers) {
  9213. warn("v-on without argument does not support modifiers.");
  9214. }
  9215. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  9216. }
  9217. /* */
  9218. function bind$1 (el, dir) {
  9219. el.wrapData = function (code) {
  9220. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  9221. };
  9222. }
  9223. /* */
  9224. var baseDirectives = {
  9225. on: on,
  9226. bind: bind$1,
  9227. cloak: noop
  9228. };
  9229. /* */
  9230. var CodegenState = function CodegenState (options) {
  9231. this.options = options;
  9232. this.warn = options.warn || baseWarn;
  9233. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  9234. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  9235. this.directives = extend(extend({}, baseDirectives), options.directives);
  9236. var isReservedTag = options.isReservedTag || no;
  9237. this.maybeComponent = function (el) { return !(isReservedTag(el.tag) && !el.component); };
  9238. this.onceId = 0;
  9239. this.staticRenderFns = [];
  9240. this.pre = false;
  9241. };
  9242. function generate (
  9243. ast,
  9244. options
  9245. ) {
  9246. var state = new CodegenState(options);
  9247. var code = ast ? genElement(ast, state) : '_c("div")';
  9248. return {
  9249. render: ("with(this){return " + code + "}"),
  9250. staticRenderFns: state.staticRenderFns
  9251. }
  9252. }
  9253. function genElement (el, state) {
  9254. if (el.parent) {
  9255. el.pre = el.pre || el.parent.pre;
  9256. }
  9257. if (el.staticRoot && !el.staticProcessed) {
  9258. return genStatic(el, state)
  9259. } else if (el.once && !el.onceProcessed) {
  9260. return genOnce(el, state)
  9261. } else if (el.for && !el.forProcessed) {
  9262. return genFor(el, state)
  9263. } else if (el.if && !el.ifProcessed) {
  9264. return genIf(el, state)
  9265. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  9266. return genChildren(el, state) || 'void 0'
  9267. } else if (el.tag === 'slot') {
  9268. return genSlot(el, state)
  9269. } else {
  9270. // component or element
  9271. var code;
  9272. if (el.component) {
  9273. code = genComponent(el.component, el, state);
  9274. } else {
  9275. var data;
  9276. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  9277. data = genData$2(el, state);
  9278. }
  9279. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  9280. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  9281. }
  9282. // module transforms
  9283. for (var i = 0; i < state.transforms.length; i++) {
  9284. code = state.transforms[i](el, code);
  9285. }
  9286. return code
  9287. }
  9288. }
  9289. // hoist static sub-trees out
  9290. function genStatic (el, state) {
  9291. el.staticProcessed = true;
  9292. // Some elements (templates) need to behave differently inside of a v-pre
  9293. // node. All pre nodes are static roots, so we can use this as a location to
  9294. // wrap a state change and reset it upon exiting the pre node.
  9295. var originalPreState = state.pre;
  9296. if (el.pre) {
  9297. state.pre = el.pre;
  9298. }
  9299. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  9300. state.pre = originalPreState;
  9301. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  9302. }
  9303. // v-once
  9304. function genOnce (el, state) {
  9305. el.onceProcessed = true;
  9306. if (el.if && !el.ifProcessed) {
  9307. return genIf(el, state)
  9308. } else if (el.staticInFor) {
  9309. var key = '';
  9310. var parent = el.parent;
  9311. while (parent) {
  9312. if (parent.for) {
  9313. key = parent.key;
  9314. break
  9315. }
  9316. parent = parent.parent;
  9317. }
  9318. if (!key) {
  9319. process.env.NODE_ENV !== 'production' && state.warn(
  9320. "v-once can only be used inside v-for that is keyed. "
  9321. );
  9322. return genElement(el, state)
  9323. }
  9324. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  9325. } else {
  9326. return genStatic(el, state)
  9327. }
  9328. }
  9329. function genIf (
  9330. el,
  9331. state,
  9332. altGen,
  9333. altEmpty
  9334. ) {
  9335. el.ifProcessed = true; // avoid recursion
  9336. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  9337. }
  9338. function genIfConditions (
  9339. conditions,
  9340. state,
  9341. altGen,
  9342. altEmpty
  9343. ) {
  9344. if (!conditions.length) {
  9345. return altEmpty || '_e()'
  9346. }
  9347. var condition = conditions.shift();
  9348. if (condition.exp) {
  9349. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  9350. } else {
  9351. return ("" + (genTernaryExp(condition.block)))
  9352. }
  9353. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  9354. function genTernaryExp (el) {
  9355. return altGen
  9356. ? altGen(el, state)
  9357. : el.once
  9358. ? genOnce(el, state)
  9359. : genElement(el, state)
  9360. }
  9361. }
  9362. function genFor (
  9363. el,
  9364. state,
  9365. altGen,
  9366. altHelper
  9367. ) {
  9368. var exp = el.for;
  9369. var alias = el.alias;
  9370. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  9371. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  9372. if (process.env.NODE_ENV !== 'production' &&
  9373. state.maybeComponent(el) &&
  9374. el.tag !== 'slot' &&
  9375. el.tag !== 'template' &&
  9376. !el.key
  9377. ) {
  9378. state.warn(
  9379. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  9380. "v-for should have explicit keys. " +
  9381. "See https://vuejs.org/guide/list.html#key for more info.",
  9382. true /* tip */
  9383. );
  9384. }
  9385. el.forProcessed = true; // avoid recursion
  9386. return (altHelper || '_l') + "((" + exp + ")," +
  9387. "function(" + alias + iterator1 + iterator2 + "){" +
  9388. "return " + ((altGen || genElement)(el, state)) +
  9389. '})'
  9390. }
  9391. function genData$2 (el, state) {
  9392. var data = '{';
  9393. // directives first.
  9394. // directives may mutate the el's other properties before they are generated.
  9395. var dirs = genDirectives(el, state);
  9396. if (dirs) { data += dirs + ','; }
  9397. // key
  9398. if (el.key) {
  9399. data += "key:" + (el.key) + ",";
  9400. }
  9401. // ref
  9402. if (el.ref) {
  9403. data += "ref:" + (el.ref) + ",";
  9404. }
  9405. if (el.refInFor) {
  9406. data += "refInFor:true,";
  9407. }
  9408. // pre
  9409. if (el.pre) {
  9410. data += "pre:true,";
  9411. }
  9412. // record original tag name for components using "is" attribute
  9413. if (el.component) {
  9414. data += "tag:\"" + (el.tag) + "\",";
  9415. }
  9416. // module data generation functions
  9417. for (var i = 0; i < state.dataGenFns.length; i++) {
  9418. data += state.dataGenFns[i](el);
  9419. }
  9420. // attributes
  9421. if (el.attrs) {
  9422. data += "attrs:{" + (genProps(el.attrs)) + "},";
  9423. }
  9424. // DOM props
  9425. if (el.props) {
  9426. data += "domProps:{" + (genProps(el.props)) + "},";
  9427. }
  9428. // event handlers
  9429. if (el.events) {
  9430. data += (genHandlers(el.events, false)) + ",";
  9431. }
  9432. if (el.nativeEvents) {
  9433. data += (genHandlers(el.nativeEvents, true)) + ",";
  9434. }
  9435. // slot target
  9436. // only for non-scoped slots
  9437. if (el.slotTarget && !el.slotScope) {
  9438. data += "slot:" + (el.slotTarget) + ",";
  9439. }
  9440. // scoped slots
  9441. if (el.scopedSlots) {
  9442. data += (genScopedSlots(el.scopedSlots, state)) + ",";
  9443. }
  9444. // component v-model
  9445. if (el.model) {
  9446. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  9447. }
  9448. // inline-template
  9449. if (el.inlineTemplate) {
  9450. var inlineTemplate = genInlineTemplate(el, state);
  9451. if (inlineTemplate) {
  9452. data += inlineTemplate + ",";
  9453. }
  9454. }
  9455. data = data.replace(/,$/, '') + '}';
  9456. // v-bind data wrap
  9457. if (el.wrapData) {
  9458. data = el.wrapData(data);
  9459. }
  9460. // v-on data wrap
  9461. if (el.wrapListeners) {
  9462. data = el.wrapListeners(data);
  9463. }
  9464. return data
  9465. }
  9466. function genDirectives (el, state) {
  9467. var dirs = el.directives;
  9468. if (!dirs) { return }
  9469. var res = 'directives:[';
  9470. var hasRuntime = false;
  9471. var i, l, dir, needRuntime;
  9472. for (i = 0, l = dirs.length; i < l; i++) {
  9473. dir = dirs[i];
  9474. needRuntime = true;
  9475. var gen = state.directives[dir.name];
  9476. if (gen) {
  9477. // compile-time directive that manipulates AST.
  9478. // returns true if it also needs a runtime counterpart.
  9479. needRuntime = !!gen(el, dir, state.warn);
  9480. }
  9481. if (needRuntime) {
  9482. hasRuntime = true;
  9483. res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:\"" + (dir.arg) + "\"") : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
  9484. }
  9485. }
  9486. if (hasRuntime) {
  9487. return res.slice(0, -1) + ']'
  9488. }
  9489. }
  9490. function genInlineTemplate (el, state) {
  9491. var ast = el.children[0];
  9492. if (process.env.NODE_ENV !== 'production' && (
  9493. el.children.length !== 1 || ast.type !== 1
  9494. )) {
  9495. state.warn('Inline-template components must have exactly one child element.');
  9496. }
  9497. if (ast.type === 1) {
  9498. var inlineRenderFns = generate(ast, state.options);
  9499. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  9500. }
  9501. }
  9502. function genScopedSlots (
  9503. slots,
  9504. state
  9505. ) {
  9506. return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
  9507. return genScopedSlot(key, slots[key], state)
  9508. }).join(',')) + "])")
  9509. }
  9510. function genScopedSlot (
  9511. key,
  9512. el,
  9513. state
  9514. ) {
  9515. if (el.for && !el.forProcessed) {
  9516. return genForScopedSlot(key, el, state)
  9517. }
  9518. var fn = "function(" + (String(el.slotScope)) + "){" +
  9519. "return " + (el.tag === 'template'
  9520. ? el.if
  9521. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  9522. : genChildren(el, state) || 'undefined'
  9523. : genElement(el, state)) + "}";
  9524. return ("{key:" + key + ",fn:" + fn + "}")
  9525. }
  9526. function genForScopedSlot (
  9527. key,
  9528. el,
  9529. state
  9530. ) {
  9531. var exp = el.for;
  9532. var alias = el.alias;
  9533. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  9534. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  9535. el.forProcessed = true; // avoid recursion
  9536. return "_l((" + exp + ")," +
  9537. "function(" + alias + iterator1 + iterator2 + "){" +
  9538. "return " + (genScopedSlot(key, el, state)) +
  9539. '})'
  9540. }
  9541. function genChildren (
  9542. el,
  9543. state,
  9544. checkSkip,
  9545. altGenElement,
  9546. altGenNode
  9547. ) {
  9548. var children = el.children;
  9549. if (children.length) {
  9550. var el$1 = children[0];
  9551. // optimize single v-for
  9552. if (children.length === 1 &&
  9553. el$1.for &&
  9554. el$1.tag !== 'template' &&
  9555. el$1.tag !== 'slot'
  9556. ) {
  9557. var normalizationType = checkSkip
  9558. ? state.maybeComponent(el$1) ? ",1" : ",0"
  9559. : "";
  9560. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  9561. }
  9562. var normalizationType$1 = checkSkip
  9563. ? getNormalizationType(children, state.maybeComponent)
  9564. : 0;
  9565. var gen = altGenNode || genNode;
  9566. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  9567. }
  9568. }
  9569. // determine the normalization needed for the children array.
  9570. // 0: no normalization needed
  9571. // 1: simple normalization needed (possible 1-level deep nested array)
  9572. // 2: full normalization needed
  9573. function getNormalizationType (
  9574. children,
  9575. maybeComponent
  9576. ) {
  9577. var res = 0;
  9578. for (var i = 0; i < children.length; i++) {
  9579. var el = children[i];
  9580. if (el.type !== 1) {
  9581. continue
  9582. }
  9583. if (needsNormalization(el) ||
  9584. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  9585. res = 2;
  9586. break
  9587. }
  9588. if (maybeComponent(el) ||
  9589. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  9590. res = 1;
  9591. }
  9592. }
  9593. return res
  9594. }
  9595. function needsNormalization (el) {
  9596. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  9597. }
  9598. function genNode (node, state) {
  9599. if (node.type === 1) {
  9600. return genElement(node, state)
  9601. } else if (node.type === 3 && node.isComment) {
  9602. return genComment(node)
  9603. } else {
  9604. return genText(node)
  9605. }
  9606. }
  9607. function genText (text) {
  9608. return ("_v(" + (text.type === 2
  9609. ? text.expression // no need for () because already wrapped in _s()
  9610. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  9611. }
  9612. function genComment (comment) {
  9613. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  9614. }
  9615. function genSlot (el, state) {
  9616. var slotName = el.slotName || '"default"';
  9617. var children = genChildren(el, state);
  9618. var res = "_t(" + slotName + (children ? ("," + children) : '');
  9619. var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}");
  9620. var bind$$1 = el.attrsMap['v-bind'];
  9621. if ((attrs || bind$$1) && !children) {
  9622. res += ",null";
  9623. }
  9624. if (attrs) {
  9625. res += "," + attrs;
  9626. }
  9627. if (bind$$1) {
  9628. res += (attrs ? '' : ',null') + "," + bind$$1;
  9629. }
  9630. return res + ')'
  9631. }
  9632. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  9633. function genComponent (
  9634. componentName,
  9635. el,
  9636. state
  9637. ) {
  9638. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  9639. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  9640. }
  9641. function genProps (props) {
  9642. var res = '';
  9643. for (var i = 0; i < props.length; i++) {
  9644. var prop = props[i];
  9645. /* istanbul ignore if */
  9646. {
  9647. res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
  9648. }
  9649. }
  9650. return res.slice(0, -1)
  9651. }
  9652. // #3895, #4268
  9653. function transformSpecialNewlines (text) {
  9654. return text
  9655. .replace(/\u2028/g, '\\u2028')
  9656. .replace(/\u2029/g, '\\u2029')
  9657. }
  9658. /* */
  9659. // these keywords should not appear inside expressions, but operators like
  9660. // typeof, instanceof and in are allowed
  9661. var prohibitedKeywordRE = new RegExp('\\b' + (
  9662. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  9663. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  9664. 'extends,finally,continue,debugger,function,arguments'
  9665. ).split(',').join('\\b|\\b') + '\\b');
  9666. // these unary operators should not be used as property/method names
  9667. var unaryOperatorsRE = new RegExp('\\b' + (
  9668. 'delete,typeof,void'
  9669. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  9670. // strip strings in expressions
  9671. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  9672. // detect problematic expressions in a template
  9673. function detectErrors (ast) {
  9674. var errors = [];
  9675. if (ast) {
  9676. checkNode(ast, errors);
  9677. }
  9678. return errors
  9679. }
  9680. function checkNode (node, errors) {
  9681. if (node.type === 1) {
  9682. for (var name in node.attrsMap) {
  9683. if (dirRE.test(name)) {
  9684. var value = node.attrsMap[name];
  9685. if (value) {
  9686. if (name === 'v-for') {
  9687. checkFor(node, ("v-for=\"" + value + "\""), errors);
  9688. } else if (onRE.test(name)) {
  9689. checkEvent(value, (name + "=\"" + value + "\""), errors);
  9690. } else {
  9691. checkExpression(value, (name + "=\"" + value + "\""), errors);
  9692. }
  9693. }
  9694. }
  9695. }
  9696. if (node.children) {
  9697. for (var i = 0; i < node.children.length; i++) {
  9698. checkNode(node.children[i], errors);
  9699. }
  9700. }
  9701. } else if (node.type === 2) {
  9702. checkExpression(node.expression, node.text, errors);
  9703. }
  9704. }
  9705. function checkEvent (exp, text, errors) {
  9706. var stipped = exp.replace(stripStringRE, '');
  9707. var keywordMatch = stipped.match(unaryOperatorsRE);
  9708. if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
  9709. errors.push(
  9710. "avoid using JavaScript unary operator as property name: " +
  9711. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
  9712. );
  9713. }
  9714. checkExpression(exp, text, errors);
  9715. }
  9716. function checkFor (node, text, errors) {
  9717. checkExpression(node.for || '', text, errors);
  9718. checkIdentifier(node.alias, 'v-for alias', text, errors);
  9719. checkIdentifier(node.iterator1, 'v-for iterator', text, errors);
  9720. checkIdentifier(node.iterator2, 'v-for iterator', text, errors);
  9721. }
  9722. function checkIdentifier (
  9723. ident,
  9724. type,
  9725. text,
  9726. errors
  9727. ) {
  9728. if (typeof ident === 'string') {
  9729. try {
  9730. new Function(("var " + ident + "=_"));
  9731. } catch (e) {
  9732. errors.push(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())));
  9733. }
  9734. }
  9735. }
  9736. function checkExpression (exp, text, errors) {
  9737. try {
  9738. new Function(("return " + exp));
  9739. } catch (e) {
  9740. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  9741. if (keywordMatch) {
  9742. errors.push(
  9743. "avoid using JavaScript keyword as property name: " +
  9744. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim())
  9745. );
  9746. } else {
  9747. errors.push(
  9748. "invalid expression: " + (e.message) + " in\n\n" +
  9749. " " + exp + "\n\n" +
  9750. " Raw expression: " + (text.trim()) + "\n"
  9751. );
  9752. }
  9753. }
  9754. }
  9755. /* */
  9756. function createFunction (code, errors) {
  9757. try {
  9758. return new Function(code)
  9759. } catch (err) {
  9760. errors.push({ err: err, code: code });
  9761. return noop
  9762. }
  9763. }
  9764. function createCompileToFunctionFn (compile) {
  9765. var cache = Object.create(null);
  9766. return function compileToFunctions (
  9767. template,
  9768. options,
  9769. vm
  9770. ) {
  9771. options = extend({}, options);
  9772. var warn$$1 = options.warn || warn;
  9773. delete options.warn;
  9774. /* istanbul ignore if */
  9775. if (process.env.NODE_ENV !== 'production') {
  9776. // detect possible CSP restriction
  9777. try {
  9778. new Function('return 1');
  9779. } catch (e) {
  9780. if (e.toString().match(/unsafe-eval|CSP/)) {
  9781. warn$$1(
  9782. 'It seems you are using the standalone build of Vue.js in an ' +
  9783. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  9784. 'The template compiler cannot work in this environment. Consider ' +
  9785. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  9786. 'templates into render functions.'
  9787. );
  9788. }
  9789. }
  9790. }
  9791. // check cache
  9792. var key = options.delimiters
  9793. ? String(options.delimiters) + template
  9794. : template;
  9795. if (cache[key]) {
  9796. return cache[key]
  9797. }
  9798. // compile
  9799. var compiled = compile(template, options);
  9800. // check compilation errors/tips
  9801. if (process.env.NODE_ENV !== 'production') {
  9802. if (compiled.errors && compiled.errors.length) {
  9803. warn$$1(
  9804. "Error compiling template:\n\n" + template + "\n\n" +
  9805. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  9806. vm
  9807. );
  9808. }
  9809. if (compiled.tips && compiled.tips.length) {
  9810. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  9811. }
  9812. }
  9813. // turn code into functions
  9814. var res = {};
  9815. var fnGenErrors = [];
  9816. res.render = createFunction(compiled.render, fnGenErrors);
  9817. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  9818. return createFunction(code, fnGenErrors)
  9819. });
  9820. // check function generation errors.
  9821. // this should only happen if there is a bug in the compiler itself.
  9822. // mostly for codegen development use
  9823. /* istanbul ignore if */
  9824. if (process.env.NODE_ENV !== 'production') {
  9825. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  9826. warn$$1(
  9827. "Failed to generate render function:\n\n" +
  9828. fnGenErrors.map(function (ref) {
  9829. var err = ref.err;
  9830. var code = ref.code;
  9831. return ((err.toString()) + " in\n\n" + code + "\n");
  9832. }).join('\n'),
  9833. vm
  9834. );
  9835. }
  9836. }
  9837. return (cache[key] = res)
  9838. }
  9839. }
  9840. /* */
  9841. function createCompilerCreator (baseCompile) {
  9842. return function createCompiler (baseOptions) {
  9843. function compile (
  9844. template,
  9845. options
  9846. ) {
  9847. var finalOptions = Object.create(baseOptions);
  9848. var errors = [];
  9849. var tips = [];
  9850. finalOptions.warn = function (msg, tip) {
  9851. (tip ? tips : errors).push(msg);
  9852. };
  9853. if (options) {
  9854. // merge custom modules
  9855. if (options.modules) {
  9856. finalOptions.modules =
  9857. (baseOptions.modules || []).concat(options.modules);
  9858. }
  9859. // merge custom directives
  9860. if (options.directives) {
  9861. finalOptions.directives = extend(
  9862. Object.create(baseOptions.directives || null),
  9863. options.directives
  9864. );
  9865. }
  9866. // copy other options
  9867. for (var key in options) {
  9868. if (key !== 'modules' && key !== 'directives') {
  9869. finalOptions[key] = options[key];
  9870. }
  9871. }
  9872. }
  9873. var compiled = baseCompile(template, finalOptions);
  9874. if (process.env.NODE_ENV !== 'production') {
  9875. errors.push.apply(errors, detectErrors(compiled.ast));
  9876. }
  9877. compiled.errors = errors;
  9878. compiled.tips = tips;
  9879. return compiled
  9880. }
  9881. return {
  9882. compile: compile,
  9883. compileToFunctions: createCompileToFunctionFn(compile)
  9884. }
  9885. }
  9886. }
  9887. /* */
  9888. // `createCompilerCreator` allows creating compilers that use alternative
  9889. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  9890. // Here we just export a default compiler using the default parts.
  9891. var createCompiler = createCompilerCreator(function baseCompile (
  9892. template,
  9893. options
  9894. ) {
  9895. var ast = parse(template.trim(), options);
  9896. if (options.optimize !== false) {
  9897. optimize(ast, options);
  9898. }
  9899. var code = generate(ast, options);
  9900. return {
  9901. ast: ast,
  9902. render: code.render,
  9903. staticRenderFns: code.staticRenderFns
  9904. }
  9905. });
  9906. /* */
  9907. var ref$1 = createCompiler(baseOptions);
  9908. var compile = ref$1.compile;
  9909. var compileToFunctions = ref$1.compileToFunctions;
  9910. /* */
  9911. // check whether current browser encodes a char inside attribute values
  9912. var div;
  9913. function getShouldDecode (href) {
  9914. div = div || document.createElement('div');
  9915. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  9916. return div.innerHTML.indexOf('&#10;') > 0
  9917. }
  9918. // #3663: IE encodes newlines inside attribute values while other browsers don't
  9919. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  9920. // #6828: chrome encodes content in a[href]
  9921. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  9922. /* */
  9923. var idToTemplate = cached(function (id) {
  9924. var el = query(id);
  9925. return el && el.innerHTML
  9926. });
  9927. var mount = Vue.prototype.$mount;
  9928. Vue.prototype.$mount = function (
  9929. el,
  9930. hydrating
  9931. ) {
  9932. el = el && query(el);
  9933. /* istanbul ignore if */
  9934. if (el === document.body || el === document.documentElement) {
  9935. process.env.NODE_ENV !== 'production' && warn(
  9936. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  9937. );
  9938. return this
  9939. }
  9940. var options = this.$options;
  9941. // resolve template/el and convert to render function
  9942. if (!options.render) {
  9943. var template = options.template;
  9944. if (template) {
  9945. if (typeof template === 'string') {
  9946. if (template.charAt(0) === '#') {
  9947. template = idToTemplate(template);
  9948. /* istanbul ignore if */
  9949. if (process.env.NODE_ENV !== 'production' && !template) {
  9950. warn(
  9951. ("Template element not found or is empty: " + (options.template)),
  9952. this
  9953. );
  9954. }
  9955. }
  9956. } else if (template.nodeType) {
  9957. template = template.innerHTML;
  9958. } else {
  9959. if (process.env.NODE_ENV !== 'production') {
  9960. warn('invalid template option:' + template, this);
  9961. }
  9962. return this
  9963. }
  9964. } else if (el) {
  9965. template = getOuterHTML(el);
  9966. }
  9967. if (template) {
  9968. /* istanbul ignore if */
  9969. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  9970. mark('compile');
  9971. }
  9972. var ref = compileToFunctions(template, {
  9973. shouldDecodeNewlines: shouldDecodeNewlines,
  9974. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  9975. delimiters: options.delimiters,
  9976. comments: options.comments
  9977. }, this);
  9978. var render = ref.render;
  9979. var staticRenderFns = ref.staticRenderFns;
  9980. options.render = render;
  9981. options.staticRenderFns = staticRenderFns;
  9982. /* istanbul ignore if */
  9983. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  9984. mark('compile end');
  9985. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  9986. }
  9987. }
  9988. }
  9989. return mount.call(this, el, hydrating)
  9990. };
  9991. /**
  9992. * Get outerHTML of elements, taking care
  9993. * of SVG elements in IE as well.
  9994. */
  9995. function getOuterHTML (el) {
  9996. if (el.outerHTML) {
  9997. return el.outerHTML
  9998. } else {
  9999. var container = document.createElement('div');
  10000. container.appendChild(el.cloneNode(true));
  10001. return container.innerHTML
  10002. }
  10003. }
  10004. Vue.compile = compileToFunctions;
  10005. export default Vue;