vue.js 304 KB

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