vue.js 333 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944
  1. /*!
  2. * Vue.js v2.6.10
  3. * (c) 2014-2019 Evan You
  4. * Released under the MIT License.
  5. */
  6. (function(global, factory) {
  7. global = global || self;
  8. global.Vue = factory()
  9. }(this, function() {
  10. 'use strict';
  11. /* */
  12. var emptyObject = Object.freeze({});
  13. // These helpers produce better VM code in JS engines due to their
  14. // explicitness and function inlining.
  15. function isUndef (v) {
  16. return v === undefined || v === null
  17. }
  18. function isDef (v) {
  19. return v !== undefined && v !== null
  20. }
  21. function isTrue (v) {
  22. return v === true
  23. }
  24. function isFalse (v) {
  25. return v === false
  26. }
  27. /**
  28. * Check if value is primitive.
  29. */
  30. function isPrimitive (value) {
  31. return (
  32. typeof value === 'string' ||
  33. typeof value === 'number' ||
  34. // $flow-disable-line
  35. typeof value === 'symbol' ||
  36. typeof value === 'boolean'
  37. )
  38. }
  39. /**
  40. * Quick object check - this is primarily used to tell
  41. * Objects from primitive values when we know the value
  42. * is a JSON-compliant type.
  43. */
  44. function isObject (obj) {
  45. return obj !== null && typeof obj === 'object'
  46. }
  47. /**
  48. * Get the raw type string of a value, e.g., [object Object].
  49. */
  50. var _toString = Object.prototype.toString;
  51. function toRawType (value) {
  52. return _toString.call(value).slice(8, -1)
  53. }
  54. /**
  55. * Strict object type check. Only returns true
  56. * for plain JavaScript objects.
  57. */
  58. function isPlainObject (obj) {
  59. return _toString.call(obj) === '[object Object]'
  60. }
  61. function isRegExp (v) {
  62. return _toString.call(v) === '[object RegExp]'
  63. }
  64. /**
  65. * Check if val is a valid array index.
  66. */
  67. function isValidArrayIndex (val) {
  68. var n = parseFloat(String(val));
  69. return n >= 0 && Math.floor(n) === n && isFinite(val)
  70. }
  71. function isPromise (val) {
  72. return (
  73. isDef(val) &&
  74. typeof val.then === 'function' &&
  75. typeof val.catch === 'function'
  76. )
  77. }
  78. /**
  79. * Convert a value to a string that is actually rendered.
  80. */
  81. function toString (val) {
  82. return val == null
  83. ? ''
  84. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  85. ? JSON.stringify(val, null, 2)
  86. : String(val)
  87. }
  88. /**
  89. * Convert an input value to a number for persistence.
  90. * If the conversion fails, return original string.
  91. */
  92. function toNumber (val) {
  93. var n = parseFloat(val);
  94. return isNaN(n) ? val : n
  95. }
  96. /**
  97. * Make a map and return a function for checking if a key
  98. * is in that map.
  99. */
  100. function makeMap (
  101. str,
  102. expectsLowerCase
  103. ) {
  104. var map = Object.create(null);
  105. var list = str.split(',');
  106. for (var i = 0; i < list.length; i++) {
  107. map[list[i]] = true;
  108. }
  109. return expectsLowerCase
  110. ? function (val) { return map[val.toLowerCase()]; }
  111. : function (val) { return map[val]; }
  112. }
  113. /**
  114. * Check if a tag is a built-in tag.
  115. */
  116. var isBuiltInTag = makeMap('slot,component', true);
  117. /**
  118. * Check if an attribute is a reserved attribute.
  119. */
  120. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  121. /**
  122. * Remove an item from an array.
  123. */
  124. function remove (arr, item) {
  125. if (arr.length) {
  126. var index = arr.indexOf(item);
  127. if (index > -1) {
  128. return arr.splice(index, 1)
  129. }
  130. }
  131. }
  132. /**
  133. * Check whether an object has the property.
  134. */
  135. var hasOwnProperty = Object.prototype.hasOwnProperty;
  136. function hasOwn (obj, key) {
  137. return hasOwnProperty.call(obj, key)
  138. }
  139. /**
  140. * Create a cached version of a pure function.
  141. */
  142. function cached (fn) {
  143. var cache = Object.create(null);
  144. return (function cachedFn (str) {
  145. var hit = cache[str];
  146. return hit || (cache[str] = fn(str))
  147. })
  148. }
  149. /**
  150. * Camelize a hyphen-delimited string.
  151. */
  152. var camelizeRE = /-(\w)/g;
  153. var camelize = cached(function (str) {
  154. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  155. });
  156. /**
  157. * Capitalize a string.
  158. */
  159. var capitalize = cached(function (str) {
  160. return str.charAt(0).toUpperCase() + str.slice(1)
  161. });
  162. /**
  163. * Hyphenate a camelCase string.
  164. */
  165. var hyphenateRE = /\B([A-Z])/g;
  166. var hyphenate = cached(function (str) {
  167. return str.replace(hyphenateRE, '-$1').toLowerCase()
  168. });
  169. /**
  170. * Simple bind polyfill for environments that do not support it,
  171. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  172. * since native bind is now performant enough in most browsers.
  173. * But removing it would mean breaking code that was able to run in
  174. * PhantomJS 1.x, so this must be kept for backward compatibility.
  175. */
  176. /* istanbul ignore next */
  177. function polyfillBind (fn, ctx) {
  178. function boundFn (a) {
  179. var l = arguments.length;
  180. return l
  181. ? l > 1
  182. ? fn.apply(ctx, arguments)
  183. : fn.call(ctx, a)
  184. : fn.call(ctx)
  185. }
  186. boundFn._length = fn.length;
  187. return boundFn
  188. }
  189. function nativeBind (fn, ctx) {
  190. return fn.bind(ctx)
  191. }
  192. var bind = Function.prototype.bind
  193. ? nativeBind
  194. : polyfillBind;
  195. /**
  196. * Convert an Array-like object to a real Array.
  197. */
  198. function toArray (list, start) {
  199. start = start || 0;
  200. var i = list.length - start;
  201. var ret = new Array(i);
  202. while (i--) {
  203. ret[i] = list[i + start];
  204. }
  205. return ret
  206. }
  207. /**
  208. * Mix properties into target object.
  209. */
  210. function extend (to, _from) {
  211. for (var key in _from) {
  212. to[key] = _from[key];
  213. }
  214. return to
  215. }
  216. /**
  217. * Merge an Array of Objects into a single Object.
  218. */
  219. function toObject (arr) {
  220. var res = {};
  221. for (var i = 0; i < arr.length; i++) {
  222. if (arr[i]) {
  223. extend(res, arr[i]);
  224. }
  225. }
  226. return res
  227. }
  228. /* eslint-disable no-unused-vars */
  229. /**
  230. * Perform no operation.
  231. * Stubbing args to make Flow happy without leaving useless transpiled code
  232. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  233. */
  234. function noop (a, b, c) {}
  235. /**
  236. * Always return false.
  237. */
  238. var no = function (a, b, c) { return false; };
  239. /* eslint-enable no-unused-vars */
  240. /**
  241. * Return the same value.
  242. */
  243. var identity = function (_) { return _; };
  244. /**
  245. * Generate a string containing static keys from compiler modules.
  246. */
  247. function genStaticKeys (modules) {
  248. return modules.reduce(function (keys, m) {
  249. return keys.concat(m.staticKeys || [])
  250. }, []).join(',')
  251. }
  252. /**
  253. * Check if two values are loosely equal - that is,
  254. * if they are plain objects, do they have the same shape?
  255. */
  256. function looseEqual (a, b) {
  257. if (a === b) { return true }
  258. var isObjectA = isObject(a);
  259. var isObjectB = isObject(b);
  260. if (isObjectA && isObjectB) {
  261. try {
  262. var isArrayA = Array.isArray(a);
  263. var isArrayB = Array.isArray(b);
  264. if (isArrayA && isArrayB) {
  265. return a.length === b.length && a.every(function (e, i) {
  266. return looseEqual(e, b[i])
  267. })
  268. } else if (a instanceof Date && b instanceof Date) {
  269. return a.getTime() === b.getTime()
  270. } else if (!isArrayA && !isArrayB) {
  271. var keysA = Object.keys(a);
  272. var keysB = Object.keys(b);
  273. return keysA.length === keysB.length && keysA.every(function (key) {
  274. return looseEqual(a[key], b[key])
  275. })
  276. } else {
  277. /* istanbul ignore next */
  278. return false
  279. }
  280. } catch (e) {
  281. /* istanbul ignore next */
  282. return false
  283. }
  284. } else if (!isObjectA && !isObjectB) {
  285. return String(a) === String(b)
  286. } else {
  287. return false
  288. }
  289. }
  290. /**
  291. * Return the first index at which a loosely equal value can be
  292. * found in the array (if value is a plain object, the array must
  293. * contain an object of the same shape), or -1 if it is not present.
  294. */
  295. function looseIndexOf (arr, val) {
  296. for (var i = 0; i < arr.length; i++) {
  297. if (looseEqual(arr[i], val)) { return i }
  298. }
  299. return -1
  300. }
  301. /**
  302. * Ensure a function is called only once.
  303. */
  304. function once (fn) {
  305. var called = false;
  306. return function () {
  307. if (!called) {
  308. called = true;
  309. fn.apply(this, arguments);
  310. }
  311. }
  312. }
  313. var SSR_ATTR = 'data-server-rendered';
  314. var ASSET_TYPES = [
  315. 'component',
  316. 'directive',
  317. 'filter'
  318. ];
  319. var LIFECYCLE_HOOKS = [
  320. 'beforeCreate',
  321. 'created',
  322. 'beforeMount',
  323. 'mounted',
  324. 'beforeUpdate',
  325. 'updated',
  326. 'beforeDestroy',
  327. 'destroyed',
  328. 'activated',
  329. 'deactivated',
  330. 'errorCaptured',
  331. 'serverPrefetch'
  332. ];
  333. /* */
  334. var config = ({
  335. /**
  336. * Option merge strategies (used in core/util/options)
  337. */
  338. // $flow-disable-line
  339. optionMergeStrategies: Object.create(null),
  340. /**
  341. * Whether to suppress warnings.
  342. */
  343. silent: false,
  344. /**
  345. * Show production mode tip message on boot?
  346. */
  347. productionTip: "development" !== 'production',
  348. /**
  349. * Whether to enable devtools
  350. */
  351. devtools: "development" !== 'production',
  352. /**
  353. * Whether to record perf
  354. */
  355. performance: false,
  356. /**
  357. * Error handler for watcher errors
  358. */
  359. errorHandler: null,
  360. /**
  361. * Warn handler for watcher warns
  362. */
  363. warnHandler: null,
  364. /**
  365. * Ignore certain custom elements
  366. */
  367. ignoredElements: [],
  368. /**
  369. * Custom user key aliases for v-on
  370. */
  371. // $flow-disable-line
  372. keyCodes: Object.create(null),
  373. /**
  374. * Check if a tag is reserved so that it cannot be registered as a
  375. * component. This is platform-dependent and may be overwritten.
  376. */
  377. isReservedTag: no,
  378. /**
  379. * Check if an attribute is reserved so that it cannot be used as a component
  380. * prop. This is platform-dependent and may be overwritten.
  381. */
  382. isReservedAttr: no,
  383. /**
  384. * Check if a tag is an unknown element.
  385. * Platform-dependent.
  386. */
  387. isUnknownElement: no,
  388. /**
  389. * Get the namespace of an element
  390. */
  391. getTagNamespace: noop,
  392. /**
  393. * Parse the real tag name for the specific platform.
  394. */
  395. parsePlatformTagName: identity,
  396. /**
  397. * Check if an attribute must be bound using property, e.g. value
  398. * Platform-dependent.
  399. */
  400. mustUseProp: no,
  401. /**
  402. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  403. * This will significantly reduce performance if set to false.
  404. */
  405. async: true,
  406. /**
  407. * Exposed for legacy reasons
  408. */
  409. _lifecycleHooks: LIFECYCLE_HOOKS
  410. });
  411. /* */
  412. /**
  413. * unicode letters used for parsing html tags, component names and property paths.
  414. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  415. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  416. */
  417. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  418. /**
  419. * Check if a string starts with $ or _
  420. */
  421. function isReserved (str) {
  422. var c = (str + '').charCodeAt(0);
  423. return c === 0x24 || c === 0x5F
  424. }
  425. /**
  426. * Define a property.
  427. */
  428. function def (obj, key, val, enumerable) {
  429. Object.defineProperty(obj, key, {
  430. value: val,
  431. enumerable: !!enumerable,
  432. writable: true,
  433. configurable: true
  434. });
  435. }
  436. /**
  437. * Parse simple path.
  438. */
  439. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  440. function parsePath (path) {
  441. if (bailRE.test(path)) {
  442. return
  443. }
  444. var segments = path.split('.');
  445. return function (obj) {
  446. for (var i = 0; i < segments.length; i++) {
  447. if (!obj) { return }
  448. obj = obj[segments[i]];
  449. }
  450. return obj
  451. }
  452. }
  453. /* */
  454. // can we use __proto__?
  455. var hasProto = '__proto__' in {};
  456. // Browser environment sniffing
  457. var inBrowser = typeof window !== 'undefined';
  458. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  459. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  460. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  461. var isIE = UA && /msie|trident/.test(UA);
  462. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  463. var isEdge = UA && UA.indexOf('edge/') > 0;
  464. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  465. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  466. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  467. var isPhantomJS = UA && /phantomjs/.test(UA);
  468. var isFF = UA && UA.match(/firefox\/(\d+)/);
  469. // Firefox has a "watch" function on Object.prototype...
  470. var nativeWatch = ({}).watch;
  471. var supportsPassive = false;
  472. if (inBrowser) {
  473. try {
  474. var opts = {};
  475. Object.defineProperty(opts, 'passive', ({
  476. get: function get () {
  477. /* istanbul ignore next */
  478. supportsPassive = true;
  479. }
  480. })); // https://github.com/facebook/flow/issues/285
  481. window.addEventListener('test-passive', null, opts);
  482. } catch (e) {}
  483. }
  484. // this needs to be lazy-evaled because vue may be required before
  485. // vue-server-renderer can set VUE_ENV
  486. var _isServer;
  487. var isServerRendering = function () {
  488. if (_isServer === undefined) {
  489. /* istanbul ignore if */
  490. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  491. // detect presence of vue-server-renderer and avoid
  492. // Webpack shimming the process
  493. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  494. } else {
  495. _isServer = false;
  496. }
  497. }
  498. return _isServer
  499. };
  500. // detect devtools
  501. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  502. /* istanbul ignore next */
  503. function isNative (Ctor) {
  504. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  505. }
  506. var hasSymbol =
  507. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  508. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  509. var _Set;
  510. /* istanbul ignore if */ // $flow-disable-line
  511. if (typeof Set !== 'undefined' && isNative(Set)) {
  512. // use native Set when available.
  513. _Set = Set;
  514. } else {
  515. // a non-standard Set polyfill that only works with primitive keys.
  516. _Set = /*@__PURE__*/(function () {
  517. function Set () {
  518. this.set = Object.create(null);
  519. }
  520. Set.prototype.has = function has (key) {
  521. return this.set[key] === true
  522. };
  523. Set.prototype.add = function add (key) {
  524. this.set[key] = true;
  525. };
  526. Set.prototype.clear = function clear () {
  527. this.set = Object.create(null);
  528. };
  529. return Set;
  530. }());
  531. }
  532. /* */
  533. var warn = noop;
  534. var tip = noop;
  535. var generateComponentTrace = (noop); // work around flow check
  536. var formatComponentName = (noop);
  537. {
  538. var hasConsole = typeof console !== 'undefined';
  539. var classifyRE = /(?:^|[-_])(\w)/g;
  540. var classify = function (str) { return str
  541. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  542. .replace(/[-_]/g, ''); };
  543. warn = function (msg, vm) {
  544. var trace = vm ? generateComponentTrace(vm) : '';
  545. if (config.warnHandler) {
  546. config.warnHandler.call(null, msg, vm, trace);
  547. } else if (hasConsole && (!config.silent)) {
  548. console.error(("[Vue warn]: " + msg + trace));
  549. }
  550. };
  551. tip = function (msg, vm) {
  552. if (hasConsole && (!config.silent)) {
  553. console.warn("[Vue tip]: " + msg + (
  554. vm ? generateComponentTrace(vm) : ''
  555. ));
  556. }
  557. };
  558. formatComponentName = function (vm, includeFile) {
  559. if (vm.$root === vm) {
  560. return '<Root>'
  561. }
  562. var options = typeof vm === 'function' && vm.cid != null
  563. ? vm.options
  564. : vm._isVue
  565. ? vm.$options || vm.constructor.options
  566. : vm;
  567. var name = options.name || options._componentTag;
  568. var file = options.__file;
  569. if (!name && file) {
  570. var match = file.match(/([^/\\]+)\.vue$/);
  571. name = match && match[1];
  572. }
  573. return (
  574. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  575. (file && includeFile !== false ? (" at " + file) : '')
  576. )
  577. };
  578. var repeat = function (str, n) {
  579. var res = '';
  580. while (n) {
  581. if (n % 2 === 1) { res += str; }
  582. if (n > 1) { str += str; }
  583. n >>= 1;
  584. }
  585. return res
  586. };
  587. generateComponentTrace = function (vm) {
  588. if (vm._isVue && vm.$parent) {
  589. var tree = [];
  590. var currentRecursiveSequence = 0;
  591. while (vm) {
  592. if (tree.length > 0) {
  593. var last = tree[tree.length - 1];
  594. if (last.constructor === vm.constructor) {
  595. currentRecursiveSequence++;
  596. vm = vm.$parent;
  597. continue
  598. } else if (currentRecursiveSequence > 0) {
  599. tree[tree.length - 1] = [last, currentRecursiveSequence];
  600. currentRecursiveSequence = 0;
  601. }
  602. }
  603. tree.push(vm);
  604. vm = vm.$parent;
  605. }
  606. return '\n\nfound in\n\n' + tree
  607. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  608. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  609. : formatComponentName(vm))); })
  610. .join('\n')
  611. } else {
  612. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  613. }
  614. };
  615. }
  616. /* */
  617. var uid = 0;
  618. /**
  619. * A dep is an observable that can have multiple
  620. * directives subscribing to it.
  621. */
  622. var Dep = function Dep () {
  623. this.id = uid++;
  624. this.subs = [];
  625. };
  626. Dep.prototype.addSub = function addSub (sub) {
  627. this.subs.push(sub);
  628. };
  629. Dep.prototype.removeSub = function removeSub (sub) {
  630. remove(this.subs, sub);
  631. };
  632. Dep.prototype.depend = function depend () {
  633. if (Dep.target) {
  634. Dep.target.addDep(this);
  635. }
  636. };
  637. Dep.prototype.notify = function notify () {
  638. // stabilize the subscriber list first
  639. var subs = this.subs.slice();
  640. if (!config.async) {
  641. // subs aren't sorted in scheduler if not running async
  642. // we need to sort them now to make sure they fire in correct
  643. // order
  644. subs.sort(function (a, b) { return a.id - b.id; });
  645. }
  646. for (var i = 0, l = subs.length; i < l; i++) {
  647. subs[i].update();
  648. }
  649. };
  650. // The current target watcher being evaluated.
  651. // This is globally unique because only one watcher
  652. // can be evaluated at a time.
  653. Dep.target = null;
  654. var targetStack = [];
  655. function pushTarget (target) {
  656. targetStack.push(target);
  657. Dep.target = target;
  658. }
  659. function popTarget () {
  660. targetStack.pop();
  661. Dep.target = targetStack[targetStack.length - 1];
  662. }
  663. /* */
  664. var VNode = function VNode (
  665. tag,
  666. data,
  667. children,
  668. text,
  669. elm,
  670. context,
  671. componentOptions,
  672. asyncFactory
  673. ) {
  674. this.tag = tag;
  675. this.data = data;
  676. this.children = children;
  677. this.text = text;
  678. this.elm = elm;
  679. this.ns = undefined;
  680. this.context = context;
  681. this.fnContext = undefined;
  682. this.fnOptions = undefined;
  683. this.fnScopeId = undefined;
  684. this.key = data && data.key;
  685. this.componentOptions = componentOptions;
  686. this.componentInstance = undefined;
  687. this.parent = undefined;
  688. this.raw = false;
  689. this.isStatic = false;
  690. this.isRootInsert = true;
  691. this.isComment = false;
  692. this.isCloned = false;
  693. this.isOnce = false;
  694. this.asyncFactory = asyncFactory;
  695. this.asyncMeta = undefined;
  696. this.isAsyncPlaceholder = false;
  697. };
  698. var prototypeAccessors = { child: { configurable: true } };
  699. // DEPRECATED: alias for componentInstance for backwards compat.
  700. /* istanbul ignore next */
  701. prototypeAccessors.child.get = function () {
  702. return this.componentInstance
  703. };
  704. Object.defineProperties( VNode.prototype, prototypeAccessors );
  705. var createEmptyVNode = function (text) {
  706. if ( text === void 0 ) text = '';
  707. var node = new VNode();
  708. node.text = text;
  709. node.isComment = true;
  710. return node
  711. };
  712. function createTextVNode (val) {
  713. return new VNode(undefined, undefined, undefined, String(val))
  714. }
  715. // optimized shallow clone
  716. // used for static nodes and slot nodes because they may be reused across
  717. // multiple renders, cloning them avoids errors when DOM manipulations rely
  718. // on their elm reference.
  719. function cloneVNode (vnode) {
  720. var cloned = new VNode(
  721. vnode.tag,
  722. vnode.data,
  723. // #7975
  724. // clone children array to avoid mutating original in case of cloning
  725. // a child.
  726. vnode.children && vnode.children.slice(),
  727. vnode.text,
  728. vnode.elm,
  729. vnode.context,
  730. vnode.componentOptions,
  731. vnode.asyncFactory
  732. );
  733. cloned.ns = vnode.ns;
  734. cloned.isStatic = vnode.isStatic;
  735. cloned.key = vnode.key;
  736. cloned.isComment = vnode.isComment;
  737. cloned.fnContext = vnode.fnContext;
  738. cloned.fnOptions = vnode.fnOptions;
  739. cloned.fnScopeId = vnode.fnScopeId;
  740. cloned.asyncMeta = vnode.asyncMeta;
  741. cloned.isCloned = true;
  742. return cloned
  743. }
  744. /*
  745. * not type checking this file because flow doesn't play well with
  746. * dynamically accessing methods on Array prototype
  747. */
  748. var arrayProto = Array.prototype;
  749. var arrayMethods = Object.create(arrayProto);
  750. var methodsToPatch = [
  751. 'push',
  752. 'pop',
  753. 'shift',
  754. 'unshift',
  755. 'splice',
  756. 'sort',
  757. 'reverse'
  758. ];
  759. /**
  760. * Intercept mutating methods and emit events
  761. */
  762. methodsToPatch.forEach(function (method) {
  763. // cache original method
  764. var original = arrayProto[method];
  765. def(arrayMethods, method, function mutator () {
  766. var args = [], len = arguments.length;
  767. while ( len-- ) args[ len ] = arguments[ len ];
  768. var result = original.apply(this, args);
  769. var ob = this.__ob__;
  770. var inserted;
  771. switch (method) {
  772. case 'push':
  773. case 'unshift':
  774. inserted = args;
  775. break
  776. case 'splice':
  777. inserted = args.slice(2);
  778. break
  779. }
  780. if (inserted) { ob.observeArray(inserted); }
  781. // notify change
  782. ob.dep.notify();
  783. return result
  784. });
  785. });
  786. /* */
  787. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  788. /**
  789. * In some cases we may want to disable observation inside a component's
  790. * update computation.
  791. */
  792. var shouldObserve = true;
  793. function toggleObserving (value) {
  794. shouldObserve = value;
  795. }
  796. /**
  797. * Observer class that is attached to each observed
  798. * object. Once attached, the observer converts the target
  799. * object's property keys into getter/setters that
  800. * collect dependencies and dispatch updates.
  801. */
  802. var Observer = function Observer (value) {
  803. this.value = value;
  804. this.dep = new Dep();
  805. this.vmCount = 0;
  806. def(value, '__ob__', this);
  807. if (Array.isArray(value)) {
  808. if (hasProto) {
  809. protoAugment(value, arrayMethods);
  810. } else {
  811. copyAugment(value, arrayMethods, arrayKeys);
  812. }
  813. this.observeArray(value);
  814. } else {
  815. this.walk(value);
  816. }
  817. };
  818. /**
  819. * Walk through all properties and convert them into
  820. * getter/setters. This method should only be called when
  821. * value type is Object.
  822. */
  823. Observer.prototype.walk = function walk (obj) {
  824. var keys = Object.keys(obj);
  825. for (var i = 0; i < keys.length; i++) {
  826. defineReactive$$1(obj, keys[i]);
  827. }
  828. };
  829. /**
  830. * Observe a list of Array items.
  831. */
  832. Observer.prototype.observeArray = function observeArray (items) {
  833. for (var i = 0, l = items.length; i < l; i++) {
  834. observe(items[i]);
  835. }
  836. };
  837. // helpers
  838. /**
  839. * Augment a target Object or Array by intercepting
  840. * the prototype chain using __proto__
  841. */
  842. function protoAugment (target, src) {
  843. /* eslint-disable no-proto */
  844. target.__proto__ = src;
  845. /* eslint-enable no-proto */
  846. }
  847. /**
  848. * Augment a target Object or Array by defining
  849. * hidden properties.
  850. */
  851. /* istanbul ignore next */
  852. function copyAugment (target, src, keys) {
  853. for (var i = 0, l = keys.length; i < l; i++) {
  854. var key = keys[i];
  855. def(target, key, src[key]);
  856. }
  857. }
  858. /**
  859. * Attempt to create an observer instance for a value,
  860. * returns the new observer if successfully observed,
  861. * or the existing observer if the value already has one.
  862. */
  863. function observe (value, asRootData) {
  864. if (!isObject(value) || value instanceof VNode) {
  865. return
  866. }
  867. var ob;
  868. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  869. ob = value.__ob__;
  870. } else if (
  871. shouldObserve &&
  872. !isServerRendering() &&
  873. (Array.isArray(value) || isPlainObject(value)) &&
  874. Object.isExtensible(value) &&
  875. !value._isVue
  876. ) {
  877. ob = new Observer(value);
  878. }
  879. if (asRootData && ob) {
  880. ob.vmCount++;
  881. }
  882. return ob
  883. }
  884. /**
  885. * Define a reactive property on an Object.
  886. */
  887. function defineReactive$$1 (
  888. obj,
  889. key,
  890. val,
  891. customSetter,
  892. shallow
  893. ) {
  894. var dep = new Dep();
  895. var property = Object.getOwnPropertyDescriptor(obj, key);
  896. if (property && property.configurable === false) {
  897. return
  898. }
  899. // cater for pre-defined getter/setters
  900. var getter = property && property.get;
  901. var setter = property && property.set;
  902. if ((!getter || setter) && arguments.length === 2) {
  903. val = obj[key];
  904. }
  905. var childOb = !shallow && observe(val);
  906. Object.defineProperty(obj, key, {
  907. enumerable: true,
  908. configurable: true,
  909. get: function reactiveGetter () {
  910. var value = getter ? getter.call(obj) : val;
  911. if (Dep.target) {
  912. dep.depend();
  913. if (childOb) {
  914. childOb.dep.depend();
  915. if (Array.isArray(value)) {
  916. dependArray(value);
  917. }
  918. }
  919. }
  920. return value
  921. },
  922. set: function reactiveSetter (newVal) {
  923. var value = getter ? getter.call(obj) : val;
  924. /* eslint-disable no-self-compare */
  925. if (newVal === value || (newVal !== newVal && value !== value)) {
  926. return
  927. }
  928. /* eslint-enable no-self-compare */
  929. if (customSetter) {
  930. customSetter();
  931. }
  932. // #7981: for accessor properties without setter
  933. if (getter && !setter) { return }
  934. if (setter) {
  935. setter.call(obj, newVal);
  936. } else {
  937. val = newVal;
  938. }
  939. childOb = !shallow && observe(newVal);
  940. dep.notify();
  941. }
  942. });
  943. }
  944. /**
  945. * Set a property on an object. Adds the new property and
  946. * triggers change notification if the property doesn't
  947. * already exist.
  948. */
  949. function set (target, key, val) {
  950. if (isUndef(target) || isPrimitive(target)
  951. ) {
  952. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  953. }
  954. if (Array.isArray(target) && isValidArrayIndex(key)) {
  955. target.length = Math.max(target.length, key);
  956. target.splice(key, 1, val);
  957. return val
  958. }
  959. if (key in target && !(key in Object.prototype)) {
  960. target[key] = val;
  961. return val
  962. }
  963. var ob = (target).__ob__;
  964. if (target._isVue || (ob && ob.vmCount)) {
  965. warn(
  966. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  967. 'at runtime - declare it upfront in the data option.'
  968. );
  969. return val
  970. }
  971. if (!ob) {
  972. target[key] = val;
  973. return val
  974. }
  975. defineReactive$$1(ob.value, key, val);
  976. ob.dep.notify();
  977. return val
  978. }
  979. /**
  980. * Delete a property and trigger change if necessary.
  981. */
  982. function del (target, key) {
  983. if (isUndef(target) || isPrimitive(target)
  984. ) {
  985. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  986. }
  987. if (Array.isArray(target) && isValidArrayIndex(key)) {
  988. target.splice(key, 1);
  989. return
  990. }
  991. var ob = (target).__ob__;
  992. if (target._isVue || (ob && ob.vmCount)) {
  993. warn(
  994. 'Avoid deleting properties on a Vue instance or its root $data ' +
  995. '- just set it to null.'
  996. );
  997. return
  998. }
  999. if (!hasOwn(target, key)) {
  1000. return
  1001. }
  1002. delete target[key];
  1003. if (!ob) {
  1004. return
  1005. }
  1006. ob.dep.notify();
  1007. }
  1008. /**
  1009. * Collect dependencies on array elements when the array is touched, since
  1010. * we cannot intercept array element access like property getters.
  1011. */
  1012. function dependArray (value) {
  1013. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  1014. e = value[i];
  1015. e && e.__ob__ && e.__ob__.dep.depend();
  1016. if (Array.isArray(e)) {
  1017. dependArray(e);
  1018. }
  1019. }
  1020. }
  1021. /* */
  1022. /**
  1023. * Option overwriting strategies are functions that handle
  1024. * how to merge a parent option value and a child option
  1025. * value into the final value.
  1026. */
  1027. var strats = config.optionMergeStrategies;
  1028. /**
  1029. * Options with restrictions
  1030. */
  1031. {
  1032. strats.el = strats.propsData = function (parent, child, vm, key) {
  1033. if (!vm) {
  1034. warn(
  1035. "option \"" + key + "\" can only be used during instance " +
  1036. 'creation with the `new` keyword.'
  1037. );
  1038. }
  1039. return defaultStrat(parent, child)
  1040. };
  1041. }
  1042. /**
  1043. * Helper that recursively merges two data objects together.
  1044. */
  1045. function mergeData (to, from) {
  1046. if (!from) { return to }
  1047. var key, toVal, fromVal;
  1048. var keys = hasSymbol
  1049. ? Reflect.ownKeys(from)
  1050. : Object.keys(from);
  1051. for (var i = 0; i < keys.length; i++) {
  1052. key = keys[i];
  1053. // in case the object is already observed...
  1054. if (key === '__ob__') { continue }
  1055. toVal = to[key];
  1056. fromVal = from[key];
  1057. if (!hasOwn(to, key)) {
  1058. set(to, key, fromVal);
  1059. } else if (
  1060. toVal !== fromVal &&
  1061. isPlainObject(toVal) &&
  1062. isPlainObject(fromVal)
  1063. ) {
  1064. mergeData(toVal, fromVal);
  1065. }
  1066. }
  1067. return to
  1068. }
  1069. /**
  1070. * Data
  1071. */
  1072. function mergeDataOrFn (
  1073. parentVal,
  1074. childVal,
  1075. vm
  1076. ) {
  1077. if (!vm) {
  1078. // in a Vue.extend merge, both should be functions
  1079. if (!childVal) {
  1080. return parentVal
  1081. }
  1082. if (!parentVal) {
  1083. return childVal
  1084. }
  1085. // when parentVal & childVal are both present,
  1086. // we need to return a function that returns the
  1087. // merged result of both functions... no need to
  1088. // check if parentVal is a function here because
  1089. // it has to be a function to pass previous merges.
  1090. return function mergedDataFn () {
  1091. return mergeData(
  1092. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  1093. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  1094. )
  1095. }
  1096. } else {
  1097. return function mergedInstanceDataFn () {
  1098. // instance merge
  1099. var instanceData = typeof childVal === 'function'
  1100. ? childVal.call(vm, vm)
  1101. : childVal;
  1102. var defaultData = typeof parentVal === 'function'
  1103. ? parentVal.call(vm, vm)
  1104. : parentVal;
  1105. if (instanceData) {
  1106. return mergeData(instanceData, defaultData)
  1107. } else {
  1108. return defaultData
  1109. }
  1110. }
  1111. }
  1112. }
  1113. strats.data = function (
  1114. parentVal,
  1115. childVal,
  1116. vm
  1117. ) {
  1118. if (!vm) {
  1119. if (childVal && typeof childVal !== 'function') {
  1120. warn(
  1121. 'The "data" option should be a function ' +
  1122. 'that returns a per-instance value in component ' +
  1123. 'definitions.',
  1124. vm
  1125. );
  1126. return parentVal
  1127. }
  1128. return mergeDataOrFn(parentVal, childVal)
  1129. }
  1130. return mergeDataOrFn(parentVal, childVal, vm)
  1131. };
  1132. /**
  1133. * Hooks and props are merged as arrays.
  1134. */
  1135. function mergeHook (
  1136. parentVal,
  1137. childVal
  1138. ) {
  1139. var res = childVal
  1140. ? parentVal
  1141. ? parentVal.concat(childVal)
  1142. : Array.isArray(childVal)
  1143. ? childVal
  1144. : [childVal]
  1145. : parentVal;
  1146. return res
  1147. ? dedupeHooks(res)
  1148. : res
  1149. }
  1150. function dedupeHooks (hooks) {
  1151. var res = [];
  1152. for (var i = 0; i < hooks.length; i++) {
  1153. if (res.indexOf(hooks[i]) === -1) {
  1154. res.push(hooks[i]);
  1155. }
  1156. }
  1157. return res
  1158. }
  1159. LIFECYCLE_HOOKS.forEach(function (hook) {
  1160. strats[hook] = mergeHook;
  1161. });
  1162. /**
  1163. * Assets
  1164. *
  1165. * When a vm is present (instance creation), we need to do
  1166. * a three-way merge between constructor options, instance
  1167. * options and parent options.
  1168. */
  1169. function mergeAssets (
  1170. parentVal,
  1171. childVal,
  1172. vm,
  1173. key
  1174. ) {
  1175. var res = Object.create(parentVal || null);
  1176. if (childVal) {
  1177. assertObjectType(key, childVal, vm);
  1178. return extend(res, childVal)
  1179. } else {
  1180. return res
  1181. }
  1182. }
  1183. ASSET_TYPES.forEach(function (type) {
  1184. strats[type + 's'] = mergeAssets;
  1185. });
  1186. /**
  1187. * Watchers.
  1188. *
  1189. * Watchers hashes should not overwrite one
  1190. * another, so we merge them as arrays.
  1191. */
  1192. strats.watch = function (
  1193. parentVal,
  1194. childVal,
  1195. vm,
  1196. key
  1197. ) {
  1198. // work around Firefox's Object.prototype.watch...
  1199. if (parentVal === nativeWatch) { parentVal = undefined; }
  1200. if (childVal === nativeWatch) { childVal = undefined; }
  1201. /* istanbul ignore if */
  1202. if (!childVal) { return Object.create(parentVal || null) }
  1203. {
  1204. assertObjectType(key, childVal, vm);
  1205. }
  1206. if (!parentVal) { return childVal }
  1207. var ret = {};
  1208. extend(ret, parentVal);
  1209. for (var key$1 in childVal) {
  1210. var parent = ret[key$1];
  1211. var child = childVal[key$1];
  1212. if (parent && !Array.isArray(parent)) {
  1213. parent = [parent];
  1214. }
  1215. ret[key$1] = parent
  1216. ? parent.concat(child)
  1217. : Array.isArray(child) ? child : [child];
  1218. }
  1219. return ret
  1220. };
  1221. /**
  1222. * Other object hashes.
  1223. */
  1224. strats.props =
  1225. strats.methods =
  1226. strats.inject =
  1227. strats.computed = function (
  1228. parentVal,
  1229. childVal,
  1230. vm,
  1231. key
  1232. ) {
  1233. if (childVal && "development" !== 'production') {
  1234. assertObjectType(key, childVal, vm);
  1235. }
  1236. if (!parentVal) { return childVal }
  1237. var ret = Object.create(null);
  1238. extend(ret, parentVal);
  1239. if (childVal) { extend(ret, childVal); }
  1240. return ret
  1241. };
  1242. strats.provide = mergeDataOrFn;
  1243. /**
  1244. * Default strategy.
  1245. */
  1246. var defaultStrat = function (parentVal, childVal) {
  1247. return childVal === undefined
  1248. ? parentVal
  1249. : childVal
  1250. };
  1251. /**
  1252. * Validate component names
  1253. */
  1254. function checkComponents (options) {
  1255. for (var key in options.components) {
  1256. validateComponentName(key);
  1257. }
  1258. }
  1259. function validateComponentName (name) {
  1260. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  1261. warn(
  1262. 'Invalid component name: "' + name + '". Component names ' +
  1263. 'should conform to valid custom element name in html5 specification.'
  1264. );
  1265. }
  1266. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  1267. warn(
  1268. 'Do not use built-in or reserved HTML elements as component ' +
  1269. 'id: ' + name
  1270. );
  1271. }
  1272. }
  1273. /**
  1274. * Ensure all props option syntax are normalized into the
  1275. * Object-based format.
  1276. */
  1277. function normalizeProps (options, vm) {
  1278. var props = options.props;
  1279. if (!props) { return }
  1280. var res = {};
  1281. var i, val, name;
  1282. if (Array.isArray(props)) {
  1283. i = props.length;
  1284. while (i--) {
  1285. val = props[i];
  1286. if (typeof val === 'string') {
  1287. name = camelize(val);
  1288. res[name] = { type: null };
  1289. } else {
  1290. warn('props must be strings when using array syntax.');
  1291. }
  1292. }
  1293. } else if (isPlainObject(props)) {
  1294. for (var key in props) {
  1295. val = props[key];
  1296. name = camelize(key);
  1297. res[name] = isPlainObject(val)
  1298. ? val
  1299. : { type: val };
  1300. }
  1301. } else {
  1302. warn(
  1303. "Invalid value for option \"props\": expected an Array or an Object, " +
  1304. "but got " + (toRawType(props)) + ".",
  1305. vm
  1306. );
  1307. }
  1308. options.props = res;
  1309. }
  1310. /**
  1311. * Normalize all injections into Object-based format
  1312. */
  1313. function normalizeInject (options, vm) {
  1314. var inject = options.inject;
  1315. if (!inject) { return }
  1316. var normalized = options.inject = {};
  1317. if (Array.isArray(inject)) {
  1318. for (var i = 0; i < inject.length; i++) {
  1319. normalized[inject[i]] = { from: inject[i] };
  1320. }
  1321. } else if (isPlainObject(inject)) {
  1322. for (var key in inject) {
  1323. var val = inject[key];
  1324. normalized[key] = isPlainObject(val)
  1325. ? extend({ from: key }, val)
  1326. : { from: val };
  1327. }
  1328. } else {
  1329. warn(
  1330. "Invalid value for option \"inject\": expected an Array or an Object, " +
  1331. "but got " + (toRawType(inject)) + ".",
  1332. vm
  1333. );
  1334. }
  1335. }
  1336. /**
  1337. * Normalize raw function directives into object format.
  1338. */
  1339. function normalizeDirectives (options) {
  1340. var dirs = options.directives;
  1341. if (dirs) {
  1342. for (var key in dirs) {
  1343. var def$$1 = dirs[key];
  1344. if (typeof def$$1 === 'function') {
  1345. dirs[key] = { bind: def$$1, update: def$$1 };
  1346. }
  1347. }
  1348. }
  1349. }
  1350. function assertObjectType (name, value, vm) {
  1351. if (!isPlainObject(value)) {
  1352. warn(
  1353. "Invalid value for option \"" + name + "\": expected an Object, " +
  1354. "but got " + (toRawType(value)) + ".",
  1355. vm
  1356. );
  1357. }
  1358. }
  1359. /**
  1360. * Merge two option objects into a new one.
  1361. * Core utility used in both instantiation and inheritance.
  1362. */
  1363. function mergeOptions (
  1364. parent,
  1365. child,
  1366. vm
  1367. ) {
  1368. {
  1369. checkComponents(child);
  1370. }
  1371. if (typeof child === 'function') {
  1372. child = child.options;
  1373. }
  1374. normalizeProps(child, vm);
  1375. normalizeInject(child, vm);
  1376. normalizeDirectives(child);
  1377. // Apply extends and mixins on the child options,
  1378. // but only if it is a raw options object that isn't
  1379. // the result of another mergeOptions call.
  1380. // Only merged options has the _base property.
  1381. if (!child._base) {
  1382. if (child.extends) {
  1383. parent = mergeOptions(parent, child.extends, vm);
  1384. }
  1385. if (child.mixins) {
  1386. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1387. parent = mergeOptions(parent, child.mixins[i], vm);
  1388. }
  1389. }
  1390. }
  1391. var options = {};
  1392. var key;
  1393. for (key in parent) {
  1394. mergeField(key);
  1395. }
  1396. for (key in child) {
  1397. if (!hasOwn(parent, key)) {
  1398. mergeField(key);
  1399. }
  1400. }
  1401. function mergeField (key) {
  1402. var strat = strats[key] || defaultStrat;
  1403. options[key] = strat(parent[key], child[key], vm, key);
  1404. }
  1405. return options
  1406. }
  1407. /**
  1408. * Resolve an asset.
  1409. * This function is used because child instances need access
  1410. * to assets defined in its ancestor chain.
  1411. */
  1412. function resolveAsset (
  1413. options,
  1414. type,
  1415. id,
  1416. warnMissing
  1417. ) {
  1418. /* istanbul ignore if */
  1419. if (typeof id !== 'string') {
  1420. return
  1421. }
  1422. var assets = options[type];
  1423. // check local registration variations first
  1424. if (hasOwn(assets, id)) { return assets[id] }
  1425. var camelizedId = camelize(id);
  1426. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  1427. var PascalCaseId = capitalize(camelizedId);
  1428. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  1429. // fallback to prototype chain
  1430. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  1431. if (warnMissing && !res) {
  1432. warn(
  1433. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  1434. options
  1435. );
  1436. }
  1437. return res
  1438. }
  1439. /* */
  1440. function validateProp (
  1441. key,
  1442. propOptions,
  1443. propsData,
  1444. vm
  1445. ) {
  1446. var prop = propOptions[key];
  1447. var absent = !hasOwn(propsData, key);
  1448. var value = propsData[key];
  1449. // boolean casting
  1450. var booleanIndex = getTypeIndex(Boolean, prop.type);
  1451. if (booleanIndex > -1) {
  1452. if (absent && !hasOwn(prop, 'default')) {
  1453. value = false;
  1454. } else if (value === '' || value === hyphenate(key)) {
  1455. // only cast empty string / same name to boolean if
  1456. // boolean has higher priority
  1457. var stringIndex = getTypeIndex(String, prop.type);
  1458. if (stringIndex < 0 || booleanIndex < stringIndex) {
  1459. value = true;
  1460. }
  1461. }
  1462. }
  1463. // check default value
  1464. if (value === undefined) {
  1465. value = getPropDefaultValue(vm, prop, key);
  1466. // since the default value is a fresh copy,
  1467. // make sure to observe it.
  1468. var prevShouldObserve = shouldObserve;
  1469. toggleObserving(true);
  1470. observe(value);
  1471. toggleObserving(prevShouldObserve);
  1472. }
  1473. {
  1474. assertProp(prop, key, value, vm, absent);
  1475. }
  1476. return value
  1477. }
  1478. /**
  1479. * Get the default value of a prop.
  1480. */
  1481. function getPropDefaultValue (vm, prop, key) {
  1482. // no default, return undefined
  1483. if (!hasOwn(prop, 'default')) {
  1484. return undefined
  1485. }
  1486. var def = prop.default;
  1487. // warn against non-factory defaults for Object & Array
  1488. if (isObject(def)) {
  1489. warn(
  1490. 'Invalid default value for prop "' + key + '": ' +
  1491. 'Props with type Object/Array must use a factory function ' +
  1492. 'to return the default value.',
  1493. vm
  1494. );
  1495. }
  1496. // the raw prop value was also undefined from previous render,
  1497. // return previous default value to avoid unnecessary watcher trigger
  1498. if (vm && vm.$options.propsData &&
  1499. vm.$options.propsData[key] === undefined &&
  1500. vm._props[key] !== undefined
  1501. ) {
  1502. return vm._props[key]
  1503. }
  1504. // call factory function for non-Function types
  1505. // a value is Function if its prototype is function even across different execution context
  1506. return typeof def === 'function' && getType(prop.type) !== 'Function'
  1507. ? def.call(vm)
  1508. : def
  1509. }
  1510. /**
  1511. * Assert whether a prop is valid.
  1512. */
  1513. function assertProp (
  1514. prop,
  1515. name,
  1516. value,
  1517. vm,
  1518. absent
  1519. ) {
  1520. if (prop.required && absent) {
  1521. warn(
  1522. 'Missing required prop: "' + name + '"',
  1523. vm
  1524. );
  1525. return
  1526. }
  1527. if (value == null && !prop.required) {
  1528. return
  1529. }
  1530. var type = prop.type;
  1531. var valid = !type || type === true;
  1532. var expectedTypes = [];
  1533. if (type) {
  1534. if (!Array.isArray(type)) {
  1535. type = [type];
  1536. }
  1537. for (var i = 0; i < type.length && !valid; i++) {
  1538. var assertedType = assertType(value, type[i]);
  1539. expectedTypes.push(assertedType.expectedType || '');
  1540. valid = assertedType.valid;
  1541. }
  1542. }
  1543. if (!valid) {
  1544. warn(
  1545. getInvalidTypeMessage(name, value, expectedTypes),
  1546. vm
  1547. );
  1548. return
  1549. }
  1550. var validator = prop.validator;
  1551. if (validator) {
  1552. if (!validator(value)) {
  1553. warn(
  1554. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  1555. vm
  1556. );
  1557. }
  1558. }
  1559. }
  1560. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  1561. function assertType (value, type) {
  1562. var valid;
  1563. var expectedType = getType(type);
  1564. if (simpleCheckRE.test(expectedType)) {
  1565. var t = typeof value;
  1566. valid = t === expectedType.toLowerCase();
  1567. // for primitive wrapper objects
  1568. if (!valid && t === 'object') {
  1569. valid = value instanceof type;
  1570. }
  1571. } else if (expectedType === 'Object') {
  1572. valid = isPlainObject(value);
  1573. } else if (expectedType === 'Array') {
  1574. valid = Array.isArray(value);
  1575. } else {
  1576. valid = value instanceof type;
  1577. }
  1578. return {
  1579. valid: valid,
  1580. expectedType: expectedType
  1581. }
  1582. }
  1583. /**
  1584. * Use function string name to check built-in types,
  1585. * because a simple equality check will fail when running
  1586. * across different vms / iframes.
  1587. */
  1588. function getType (fn) {
  1589. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  1590. return match ? match[1] : ''
  1591. }
  1592. function isSameType (a, b) {
  1593. return getType(a) === getType(b)
  1594. }
  1595. function getTypeIndex (type, expectedTypes) {
  1596. if (!Array.isArray(expectedTypes)) {
  1597. return isSameType(expectedTypes, type) ? 0 : -1
  1598. }
  1599. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  1600. if (isSameType(expectedTypes[i], type)) {
  1601. return i
  1602. }
  1603. }
  1604. return -1
  1605. }
  1606. function getInvalidTypeMessage (name, value, expectedTypes) {
  1607. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  1608. " Expected " + (expectedTypes.map(capitalize).join(', '));
  1609. var expectedType = expectedTypes[0];
  1610. var receivedType = toRawType(value);
  1611. var expectedValue = styleValue(value, expectedType);
  1612. var receivedValue = styleValue(value, receivedType);
  1613. // check if we need to specify expected value
  1614. if (expectedTypes.length === 1 &&
  1615. isExplicable(expectedType) &&
  1616. !isBoolean(expectedType, receivedType)) {
  1617. message += " with value " + expectedValue;
  1618. }
  1619. message += ", got " + receivedType + " ";
  1620. // check if we need to specify received value
  1621. if (isExplicable(receivedType)) {
  1622. message += "with value " + receivedValue + ".";
  1623. }
  1624. return message
  1625. }
  1626. function styleValue (value, type) {
  1627. if (type === 'String') {
  1628. return ("\"" + value + "\"")
  1629. } else if (type === 'Number') {
  1630. return ("" + (Number(value)))
  1631. } else {
  1632. return ("" + value)
  1633. }
  1634. }
  1635. function isExplicable (value) {
  1636. var explicitTypes = ['string', 'number', 'boolean'];
  1637. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  1638. }
  1639. function isBoolean () {
  1640. var args = [], len = arguments.length;
  1641. while ( len-- ) args[ len ] = arguments[ len ];
  1642. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  1643. }
  1644. /* */
  1645. function handleError (err, vm, info) {
  1646. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  1647. // See: https://github.com/vuejs/vuex/issues/1505
  1648. pushTarget();
  1649. try {
  1650. if (vm) {
  1651. var cur = vm;
  1652. while ((cur = cur.$parent)) {
  1653. var hooks = cur.$options.errorCaptured;
  1654. if (hooks) {
  1655. for (var i = 0; i < hooks.length; i++) {
  1656. try {
  1657. var capture = hooks[i].call(cur, err, vm, info) === false;
  1658. if (capture) { return }
  1659. } catch (e) {
  1660. globalHandleError(e, cur, 'errorCaptured hook');
  1661. }
  1662. }
  1663. }
  1664. }
  1665. }
  1666. globalHandleError(err, vm, info);
  1667. } finally {
  1668. popTarget();
  1669. }
  1670. }
  1671. function invokeWithErrorHandling (
  1672. handler,
  1673. context,
  1674. args,
  1675. vm,
  1676. info
  1677. ) {
  1678. var res;
  1679. try {
  1680. res = args ? handler.apply(context, args) : handler.call(context);
  1681. if (res && !res._isVue && isPromise(res) && !res._handled) {
  1682. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  1683. // issue #9511
  1684. // avoid catch triggering multiple times when nested calls
  1685. res._handled = true;
  1686. }
  1687. } catch (e) {
  1688. handleError(e, vm, info);
  1689. }
  1690. return res
  1691. }
  1692. function globalHandleError (err, vm, info) {
  1693. if (config.errorHandler) {
  1694. try {
  1695. return config.errorHandler.call(null, err, vm, info)
  1696. } catch (e) {
  1697. // if the user intentionally throws the original error in the handler,
  1698. // do not log it twice
  1699. if (e !== err) {
  1700. logError(e, null, 'config.errorHandler');
  1701. }
  1702. }
  1703. }
  1704. logError(err, vm, info);
  1705. }
  1706. function logError (err, vm, info) {
  1707. {
  1708. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  1709. }
  1710. /* istanbul ignore else */
  1711. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  1712. console.error(err);
  1713. } else {
  1714. throw err
  1715. }
  1716. }
  1717. /* */
  1718. var isUsingMicroTask = false;
  1719. var callbacks = [];
  1720. var pending = false;
  1721. function flushCallbacks () {
  1722. pending = false;
  1723. var copies = callbacks.slice(0);
  1724. callbacks.length = 0;
  1725. for (var i = 0; i < copies.length; i++) {
  1726. copies[i]();
  1727. }
  1728. }
  1729. // Here we have async deferring wrappers using microtasks.
  1730. // In 2.5 we used (macro) tasks (in combination with microtasks).
  1731. // However, it has subtle problems when state is changed right before repaint
  1732. // (e.g. #6813, out-in transitions).
  1733. // Also, using (macro) tasks in event handler would cause some weird behaviors
  1734. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  1735. // So we now use microtasks everywhere, again.
  1736. // A major drawback of this tradeoff is that there are some scenarios
  1737. // where microtasks have too high a priority and fire in between supposedly
  1738. // sequential events (e.g. #4521, #6690, which have workarounds)
  1739. // or even between bubbling of the same event (#6566).
  1740. var timerFunc;
  1741. // The nextTick behavior leverages the microtask queue, which can be accessed
  1742. // via either native Promise.then or MutationObserver.
  1743. // MutationObserver has wider support, however it is seriously bugged in
  1744. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  1745. // completely stops working after triggering a few times... so, if native
  1746. // Promise is available, we will use it:
  1747. /* istanbul ignore next, $flow-disable-line */
  1748. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  1749. var p = Promise.resolve();
  1750. timerFunc = function () {
  1751. p.then(flushCallbacks);
  1752. // In problematic UIWebViews, Promise.then doesn't completely break, but
  1753. // it can get stuck in a weird state where callbacks are pushed into the
  1754. // microtask queue but the queue isn't being flushed, until the browser
  1755. // needs to do some other work, e.g. handle a timer. Therefore we can
  1756. // "force" the microtask queue to be flushed by adding an empty timer.
  1757. if (isIOS) { setTimeout(noop); }
  1758. };
  1759. isUsingMicroTask = true;
  1760. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  1761. isNative(MutationObserver) ||
  1762. // PhantomJS and iOS 7.x
  1763. MutationObserver.toString() === '[object MutationObserverConstructor]'
  1764. )) {
  1765. // Use MutationObserver where native Promise is not available,
  1766. // e.g. PhantomJS, iOS7, Android 4.4
  1767. // (#6466 MutationObserver is unreliable in IE11)
  1768. var counter = 1;
  1769. var observer = new MutationObserver(flushCallbacks);
  1770. var textNode = document.createTextNode(String(counter));
  1771. observer.observe(textNode, {
  1772. characterData: true
  1773. });
  1774. timerFunc = function () {
  1775. counter = (counter + 1) % 2;
  1776. textNode.data = String(counter);
  1777. };
  1778. isUsingMicroTask = true;
  1779. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  1780. // Fallback to setImmediate.
  1781. // Techinically it leverages the (macro) task queue,
  1782. // but it is still a better choice than setTimeout.
  1783. timerFunc = function () {
  1784. setImmediate(flushCallbacks);
  1785. };
  1786. } else {
  1787. // Fallback to setTimeout.
  1788. timerFunc = function () {
  1789. setTimeout(flushCallbacks, 0);
  1790. };
  1791. }
  1792. function nextTick (cb, ctx) {
  1793. var _resolve;
  1794. callbacks.push(function () {
  1795. if (cb) {
  1796. try {
  1797. cb.call(ctx);
  1798. } catch (e) {
  1799. handleError(e, ctx, 'nextTick');
  1800. }
  1801. } else if (_resolve) {
  1802. _resolve(ctx);
  1803. }
  1804. });
  1805. if (!pending) {
  1806. pending = true;
  1807. timerFunc();
  1808. }
  1809. // $flow-disable-line
  1810. if (!cb && typeof Promise !== 'undefined') {
  1811. return new Promise(function (resolve) {
  1812. _resolve = resolve;
  1813. })
  1814. }
  1815. }
  1816. /* */
  1817. var mark;
  1818. var measure;
  1819. {
  1820. var perf = inBrowser && window.performance;
  1821. /* istanbul ignore if */
  1822. if (
  1823. perf &&
  1824. perf.mark &&
  1825. perf.measure &&
  1826. perf.clearMarks &&
  1827. perf.clearMeasures
  1828. ) {
  1829. mark = function (tag) { return perf.mark(tag); };
  1830. measure = function (name, startTag, endTag) {
  1831. perf.measure(name, startTag, endTag);
  1832. perf.clearMarks(startTag);
  1833. perf.clearMarks(endTag);
  1834. // perf.clearMeasures(name)
  1835. };
  1836. }
  1837. }
  1838. /* not type checking this file because flow doesn't play well with Proxy */
  1839. var initProxy;
  1840. {
  1841. var allowedGlobals = makeMap(
  1842. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  1843. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  1844. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  1845. 'require' // for Webpack/Browserify
  1846. );
  1847. var warnNonPresent = function (target, key) {
  1848. warn(
  1849. "Property or method \"" + key + "\" is not defined on the instance but " +
  1850. 'referenced during render. Make sure that this property is reactive, ' +
  1851. 'either in the data option, or for class-based components, by ' +
  1852. 'initializing the property. ' +
  1853. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  1854. target
  1855. );
  1856. };
  1857. var warnReservedPrefix = function (target, key) {
  1858. warn(
  1859. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  1860. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  1861. 'prevent conflicts with Vue internals' +
  1862. 'See: https://vuejs.org/v2/api/#data',
  1863. target
  1864. );
  1865. };
  1866. var hasProxy =
  1867. typeof Proxy !== 'undefined' && isNative(Proxy);
  1868. if (hasProxy) {
  1869. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  1870. config.keyCodes = new Proxy(config.keyCodes, {
  1871. set: function set (target, key, value) {
  1872. if (isBuiltInModifier(key)) {
  1873. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  1874. return false
  1875. } else {
  1876. target[key] = value;
  1877. return true
  1878. }
  1879. }
  1880. });
  1881. }
  1882. var hasHandler = {
  1883. has: function has (target, key) {
  1884. var has = key in target;
  1885. var isAllowed = allowedGlobals(key) ||
  1886. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  1887. if (!has && !isAllowed) {
  1888. if (key in target.$data) { warnReservedPrefix(target, key); }
  1889. else { warnNonPresent(target, key); }
  1890. }
  1891. return has || !isAllowed
  1892. }
  1893. };
  1894. var getHandler = {
  1895. get: function get (target, key) {
  1896. if (typeof key === 'string' && !(key in target)) {
  1897. if (key in target.$data) { warnReservedPrefix(target, key); }
  1898. else { warnNonPresent(target, key); }
  1899. }
  1900. return target[key]
  1901. }
  1902. };
  1903. initProxy = function initProxy (vm) {
  1904. if (hasProxy) {
  1905. // determine which proxy handler to use
  1906. var options = vm.$options;
  1907. var handlers = options.render && options.render._withStripped
  1908. ? getHandler
  1909. : hasHandler;
  1910. vm._renderProxy = new Proxy(vm, handlers);
  1911. } else {
  1912. vm._renderProxy = vm;
  1913. }
  1914. };
  1915. }
  1916. /* */
  1917. var seenObjects = new _Set();
  1918. /**
  1919. * Recursively traverse an object to evoke all converted
  1920. * getters, so that every nested property inside the object
  1921. * is collected as a "deep" dependency.
  1922. */
  1923. function traverse (val) {
  1924. _traverse(val, seenObjects);
  1925. seenObjects.clear();
  1926. }
  1927. function _traverse (val, seen) {
  1928. var i, keys;
  1929. var isA = Array.isArray(val);
  1930. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  1931. return
  1932. }
  1933. if (val.__ob__) {
  1934. var depId = val.__ob__.dep.id;
  1935. if (seen.has(depId)) {
  1936. return
  1937. }
  1938. seen.add(depId);
  1939. }
  1940. if (isA) {
  1941. i = val.length;
  1942. while (i--) { _traverse(val[i], seen); }
  1943. } else {
  1944. keys = Object.keys(val);
  1945. i = keys.length;
  1946. while (i--) { _traverse(val[keys[i]], seen); }
  1947. }
  1948. }
  1949. /* */
  1950. var normalizeEvent = cached(function (name) {
  1951. var passive = name.charAt(0) === '&';
  1952. name = passive ? name.slice(1) : name;
  1953. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  1954. name = once$$1 ? name.slice(1) : name;
  1955. var capture = name.charAt(0) === '!';
  1956. name = capture ? name.slice(1) : name;
  1957. return {
  1958. name: name,
  1959. once: once$$1,
  1960. capture: capture,
  1961. passive: passive
  1962. }
  1963. });
  1964. function createFnInvoker (fns, vm) {
  1965. function invoker () {
  1966. var arguments$1 = arguments;
  1967. var fns = invoker.fns;
  1968. if (Array.isArray(fns)) {
  1969. var cloned = fns.slice();
  1970. for (var i = 0; i < cloned.length; i++) {
  1971. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  1972. }
  1973. } else {
  1974. // return handler return value for single handlers
  1975. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  1976. }
  1977. }
  1978. invoker.fns = fns;
  1979. return invoker
  1980. }
  1981. function updateListeners (
  1982. on,
  1983. oldOn,
  1984. add,
  1985. remove$$1,
  1986. createOnceHandler,
  1987. vm
  1988. ) {
  1989. var name, def$$1, cur, old, event;
  1990. for (name in on) {
  1991. def$$1 = cur = on[name];
  1992. old = oldOn[name];
  1993. event = normalizeEvent(name);
  1994. if (isUndef(cur)) {
  1995. warn(
  1996. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  1997. vm
  1998. );
  1999. } else if (isUndef(old)) {
  2000. if (isUndef(cur.fns)) {
  2001. cur = on[name] = createFnInvoker(cur, vm);
  2002. }
  2003. if (isTrue(event.once)) {
  2004. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  2005. }
  2006. add(event.name, cur, event.capture, event.passive, event.params);
  2007. } else if (cur !== old) {
  2008. old.fns = cur;
  2009. on[name] = old;
  2010. }
  2011. }
  2012. for (name in oldOn) {
  2013. if (isUndef(on[name])) {
  2014. event = normalizeEvent(name);
  2015. remove$$1(event.name, oldOn[name], event.capture);
  2016. }
  2017. }
  2018. }
  2019. /* */
  2020. function mergeVNodeHook (def, hookKey, hook) {
  2021. if (def instanceof VNode) {
  2022. def = def.data.hook || (def.data.hook = {});
  2023. }
  2024. var invoker;
  2025. var oldHook = def[hookKey];
  2026. function wrappedHook () {
  2027. hook.apply(this, arguments);
  2028. // important: remove merged hook to ensure it's called only once
  2029. // and prevent memory leak
  2030. remove(invoker.fns, wrappedHook);
  2031. }
  2032. if (isUndef(oldHook)) {
  2033. // no existing hook
  2034. invoker = createFnInvoker([wrappedHook]);
  2035. } else {
  2036. /* istanbul ignore if */
  2037. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  2038. // already a merged invoker
  2039. invoker = oldHook;
  2040. invoker.fns.push(wrappedHook);
  2041. } else {
  2042. // existing plain hook
  2043. invoker = createFnInvoker([oldHook, wrappedHook]);
  2044. }
  2045. }
  2046. invoker.merged = true;
  2047. def[hookKey] = invoker;
  2048. }
  2049. /* */
  2050. function extractPropsFromVNodeData (
  2051. data,
  2052. Ctor,
  2053. tag
  2054. ) {
  2055. // we are only extracting raw values here.
  2056. // validation and default values are handled in the child
  2057. // component itself.
  2058. var propOptions = Ctor.options.props;
  2059. if (isUndef(propOptions)) {
  2060. return
  2061. }
  2062. var res = {};
  2063. var attrs = data.attrs;
  2064. var props = data.props;
  2065. if (isDef(attrs) || isDef(props)) {
  2066. for (var key in propOptions) {
  2067. var altKey = hyphenate(key);
  2068. {
  2069. var keyInLowerCase = key.toLowerCase();
  2070. if (
  2071. key !== keyInLowerCase &&
  2072. attrs && hasOwn(attrs, keyInLowerCase)
  2073. ) {
  2074. tip(
  2075. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  2076. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  2077. " \"" + key + "\". " +
  2078. "Note that HTML attributes are case-insensitive and camelCased " +
  2079. "props need to use their kebab-case equivalents when using in-DOM " +
  2080. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  2081. );
  2082. }
  2083. }
  2084. checkProp(res, props, key, altKey, true) ||
  2085. checkProp(res, attrs, key, altKey, false);
  2086. }
  2087. }
  2088. return res
  2089. }
  2090. function checkProp (
  2091. res,
  2092. hash,
  2093. key,
  2094. altKey,
  2095. preserve
  2096. ) {
  2097. if (isDef(hash)) {
  2098. if (hasOwn(hash, key)) {
  2099. res[key] = hash[key];
  2100. if (!preserve) {
  2101. delete hash[key];
  2102. }
  2103. return true
  2104. } else if (hasOwn(hash, altKey)) {
  2105. res[key] = hash[altKey];
  2106. if (!preserve) {
  2107. delete hash[altKey];
  2108. }
  2109. return true
  2110. }
  2111. }
  2112. return false
  2113. }
  2114. /* */
  2115. // The template compiler attempts to minimize the need for normalization by
  2116. // statically analyzing the template at compile time.
  2117. //
  2118. // For plain HTML markup, normalization can be completely skipped because the
  2119. // generated render function is guaranteed to return Array<VNode>. There are
  2120. // two cases where extra normalization is needed:
  2121. // 1. When the children contains components - because a functional component
  2122. // may return an Array instead of a single root. In this case, just a simple
  2123. // normalization is needed - if any child is an Array, we flatten the whole
  2124. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  2125. // because functional components already normalize their own children.
  2126. function simpleNormalizeChildren (children) {
  2127. for (var i = 0; i < children.length; i++) {
  2128. if (Array.isArray(children[i])) {
  2129. return Array.prototype.concat.apply([], children)
  2130. }
  2131. }
  2132. return children
  2133. }
  2134. // 2. When the children contains constructs that always generated nested Arrays,
  2135. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  2136. // with hand-written render functions / JSX. In such cases a full normalization
  2137. // is needed to cater to all possible types of children values.
  2138. function normalizeChildren (children) {
  2139. return isPrimitive(children)
  2140. ? [createTextVNode(children)]
  2141. : Array.isArray(children)
  2142. ? normalizeArrayChildren(children)
  2143. : undefined
  2144. }
  2145. function isTextNode (node) {
  2146. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  2147. }
  2148. function normalizeArrayChildren (children, nestedIndex) {
  2149. var res = [];
  2150. var i, c, lastIndex, last;
  2151. for (i = 0; i < children.length; i++) {
  2152. c = children[i];
  2153. if (isUndef(c) || typeof c === 'boolean') { continue }
  2154. lastIndex = res.length - 1;
  2155. last = res[lastIndex];
  2156. // nested
  2157. if (Array.isArray(c)) {
  2158. if (c.length > 0) {
  2159. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  2160. // merge adjacent text nodes
  2161. if (isTextNode(c[0]) && isTextNode(last)) {
  2162. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  2163. c.shift();
  2164. }
  2165. res.push.apply(res, c);
  2166. }
  2167. } else if (isPrimitive(c)) {
  2168. if (isTextNode(last)) {
  2169. // merge adjacent text nodes
  2170. // this is necessary for SSR hydration because text nodes are
  2171. // essentially merged when rendered to HTML strings
  2172. res[lastIndex] = createTextVNode(last.text + c);
  2173. } else if (c !== '') {
  2174. // convert primitive to vnode
  2175. res.push(createTextVNode(c));
  2176. }
  2177. } else {
  2178. if (isTextNode(c) && isTextNode(last)) {
  2179. // merge adjacent text nodes
  2180. res[lastIndex] = createTextVNode(last.text + c.text);
  2181. } else {
  2182. // default key for nested array children (likely generated by v-for)
  2183. if (isTrue(children._isVList) &&
  2184. isDef(c.tag) &&
  2185. isUndef(c.key) &&
  2186. isDef(nestedIndex)) {
  2187. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  2188. }
  2189. res.push(c);
  2190. }
  2191. }
  2192. }
  2193. return res
  2194. }
  2195. /* */
  2196. function initProvide (vm) {
  2197. var provide = vm.$options.provide;
  2198. if (provide) {
  2199. vm._provided = typeof provide === 'function'
  2200. ? provide.call(vm)
  2201. : provide;
  2202. }
  2203. }
  2204. function initInjections (vm) {
  2205. var result = resolveInject(vm.$options.inject, vm);
  2206. if (result) {
  2207. toggleObserving(false);
  2208. Object.keys(result).forEach(function (key) {
  2209. /* istanbul ignore else */
  2210. {
  2211. defineReactive$$1(vm, key, result[key], function () {
  2212. warn(
  2213. "Avoid mutating an injected value directly since the changes will be " +
  2214. "overwritten whenever the provided component re-renders. " +
  2215. "injection being mutated: \"" + key + "\"",
  2216. vm
  2217. );
  2218. });
  2219. }
  2220. });
  2221. toggleObserving(true);
  2222. }
  2223. }
  2224. function resolveInject (inject, vm) {
  2225. if (inject) {
  2226. // inject is :any because flow is not smart enough to figure out cached
  2227. var result = Object.create(null);
  2228. var keys = hasSymbol
  2229. ? Reflect.ownKeys(inject)
  2230. : Object.keys(inject);
  2231. for (var i = 0; i < keys.length; i++) {
  2232. var key = keys[i];
  2233. // #6574 in case the inject object is observed...
  2234. if (key === '__ob__') { continue }
  2235. var provideKey = inject[key].from;
  2236. var source = vm;
  2237. while (source) {
  2238. if (source._provided && hasOwn(source._provided, provideKey)) {
  2239. result[key] = source._provided[provideKey];
  2240. break
  2241. }
  2242. source = source.$parent;
  2243. }
  2244. if (!source) {
  2245. if ('default' in inject[key]) {
  2246. var provideDefault = inject[key].default;
  2247. result[key] = typeof provideDefault === 'function'
  2248. ? provideDefault.call(vm)
  2249. : provideDefault;
  2250. } else {
  2251. warn(("Injection \"" + key + "\" not found"), vm);
  2252. }
  2253. }
  2254. }
  2255. return result
  2256. }
  2257. }
  2258. /* */
  2259. /**
  2260. * Runtime helper for resolving raw children VNodes into a slot object.
  2261. */
  2262. function resolveSlots (
  2263. children,
  2264. context
  2265. ) {
  2266. if (!children || !children.length) {
  2267. return {}
  2268. }
  2269. var slots = {};
  2270. for (var i = 0, l = children.length; i < l; i++) {
  2271. var child = children[i];
  2272. var data = child.data;
  2273. // remove slot attribute if the node is resolved as a Vue slot node
  2274. if (data && data.attrs && data.attrs.slot) {
  2275. delete data.attrs.slot;
  2276. }
  2277. // named slots should only be respected if the vnode was rendered in the
  2278. // same context.
  2279. if ((child.context === context || child.fnContext === context) &&
  2280. data && data.slot != null
  2281. ) {
  2282. var name = data.slot;
  2283. var slot = (slots[name] || (slots[name] = []));
  2284. if (child.tag === 'template') {
  2285. slot.push.apply(slot, child.children || []);
  2286. } else {
  2287. slot.push(child);
  2288. }
  2289. } else {
  2290. (slots.default || (slots.default = [])).push(child);
  2291. }
  2292. }
  2293. // ignore slots that contains only whitespace
  2294. for (var name$1 in slots) {
  2295. if (slots[name$1].every(isWhitespace)) {
  2296. delete slots[name$1];
  2297. }
  2298. }
  2299. return slots
  2300. }
  2301. function isWhitespace (node) {
  2302. return (node.isComment && !node.asyncFactory) || node.text === ' '
  2303. }
  2304. /* */
  2305. function normalizeScopedSlots (
  2306. slots,
  2307. normalSlots,
  2308. prevSlots
  2309. ) {
  2310. var res;
  2311. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  2312. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  2313. var key = slots && slots.$key;
  2314. if (!slots) {
  2315. res = {};
  2316. } else if (slots._normalized) {
  2317. // fast path 1: child component re-render only, parent did not change
  2318. return slots._normalized
  2319. } else if (
  2320. isStable &&
  2321. prevSlots &&
  2322. prevSlots !== emptyObject &&
  2323. key === prevSlots.$key &&
  2324. !hasNormalSlots &&
  2325. !prevSlots.$hasNormal
  2326. ) {
  2327. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  2328. // only need to normalize once
  2329. return prevSlots
  2330. } else {
  2331. res = {};
  2332. for (var key$1 in slots) {
  2333. if (slots[key$1] && key$1[0] !== '$') {
  2334. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  2335. }
  2336. }
  2337. }
  2338. // expose normal slots on scopedSlots
  2339. for (var key$2 in normalSlots) {
  2340. if (!(key$2 in res)) {
  2341. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  2342. }
  2343. }
  2344. // avoriaz seems to mock a non-extensible $scopedSlots object
  2345. // and when that is passed down this would cause an error
  2346. if (slots && Object.isExtensible(slots)) {
  2347. (slots)._normalized = res;
  2348. }
  2349. def(res, '$stable', isStable);
  2350. def(res, '$key', key);
  2351. def(res, '$hasNormal', hasNormalSlots);
  2352. return res
  2353. }
  2354. function normalizeScopedSlot(normalSlots, key, fn) {
  2355. var normalized = function () {
  2356. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  2357. res = res && typeof res === 'object' && !Array.isArray(res)
  2358. ? [res] // single vnode
  2359. : normalizeChildren(res);
  2360. return res && (
  2361. res.length === 0 ||
  2362. (res.length === 1 && res[0].isComment) // #9658
  2363. ) ? undefined
  2364. : res
  2365. };
  2366. // this is a slot using the new v-slot syntax without scope. although it is
  2367. // compiled as a scoped slot, render fn users would expect it to be present
  2368. // on this.$slots because the usage is semantically a normal slot.
  2369. if (fn.proxy) {
  2370. Object.defineProperty(normalSlots, key, {
  2371. get: normalized,
  2372. enumerable: true,
  2373. configurable: true
  2374. });
  2375. }
  2376. return normalized
  2377. }
  2378. function proxyNormalSlot(slots, key) {
  2379. return function () { return slots[key]; }
  2380. }
  2381. /* */
  2382. /**
  2383. * Runtime helper for rendering v-for lists.
  2384. */
  2385. function renderList (
  2386. val,
  2387. render
  2388. ) {
  2389. var ret, i, l, keys, key;
  2390. if (Array.isArray(val) || typeof val === 'string') {
  2391. ret = new Array(val.length);
  2392. for (i = 0, l = val.length; i < l; i++) {
  2393. ret[i] = render(val[i], i);
  2394. }
  2395. } else if (typeof val === 'number') {
  2396. ret = new Array(val);
  2397. for (i = 0; i < val; i++) {
  2398. ret[i] = render(i + 1, i);
  2399. }
  2400. } else if (isObject(val)) {
  2401. if (hasSymbol && val[Symbol.iterator]) {
  2402. ret = [];
  2403. var iterator = val[Symbol.iterator]();
  2404. var result = iterator.next();
  2405. while (!result.done) {
  2406. ret.push(render(result.value, ret.length));
  2407. result = iterator.next();
  2408. }
  2409. } else {
  2410. keys = Object.keys(val);
  2411. ret = new Array(keys.length);
  2412. for (i = 0, l = keys.length; i < l; i++) {
  2413. key = keys[i];
  2414. ret[i] = render(val[key], key, i);
  2415. }
  2416. }
  2417. }
  2418. if (!isDef(ret)) {
  2419. ret = [];
  2420. }
  2421. (ret)._isVList = true;
  2422. return ret
  2423. }
  2424. /* */
  2425. /**
  2426. * Runtime helper for rendering <slot>
  2427. */
  2428. function renderSlot (
  2429. name,
  2430. fallback,
  2431. props,
  2432. bindObject
  2433. ) {
  2434. var scopedSlotFn = this.$scopedSlots[name];
  2435. var nodes;
  2436. if (scopedSlotFn) { // scoped slot
  2437. props = props || {};
  2438. if (bindObject) {
  2439. if (!isObject(bindObject)) {
  2440. warn(
  2441. 'slot v-bind without argument expects an Object',
  2442. this
  2443. );
  2444. }
  2445. props = extend(extend({}, bindObject), props);
  2446. }
  2447. nodes = scopedSlotFn(props) || fallback;
  2448. } else {
  2449. nodes = this.$slots[name] || fallback;
  2450. }
  2451. var target = props && props.slot;
  2452. if (target) {
  2453. return this.$createElement('template', { slot: target }, nodes)
  2454. } else {
  2455. return nodes
  2456. }
  2457. }
  2458. /* */
  2459. /**
  2460. * Runtime helper for resolving filters
  2461. */
  2462. function resolveFilter (id) {
  2463. return resolveAsset(this.$options, 'filters', id, true) || identity
  2464. }
  2465. /* */
  2466. function isKeyNotMatch (expect, actual) {
  2467. if (Array.isArray(expect)) {
  2468. return expect.indexOf(actual) === -1
  2469. } else {
  2470. return expect !== actual
  2471. }
  2472. }
  2473. /**
  2474. * Runtime helper for checking keyCodes from config.
  2475. * exposed as Vue.prototype._k
  2476. * passing in eventKeyName as last argument separately for backwards compat
  2477. */
  2478. function checkKeyCodes (
  2479. eventKeyCode,
  2480. key,
  2481. builtInKeyCode,
  2482. eventKeyName,
  2483. builtInKeyName
  2484. ) {
  2485. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  2486. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  2487. return isKeyNotMatch(builtInKeyName, eventKeyName)
  2488. } else if (mappedKeyCode) {
  2489. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  2490. } else if (eventKeyName) {
  2491. return hyphenate(eventKeyName) !== key
  2492. }
  2493. }
  2494. /* */
  2495. /**
  2496. * Runtime helper for merging v-bind="object" into a VNode's data.
  2497. */
  2498. function bindObjectProps (
  2499. data,
  2500. tag,
  2501. value,
  2502. asProp,
  2503. isSync
  2504. ) {
  2505. if (value) {
  2506. if (!isObject(value)) {
  2507. warn(
  2508. 'v-bind without argument expects an Object or Array value',
  2509. this
  2510. );
  2511. } else {
  2512. if (Array.isArray(value)) {
  2513. value = toObject(value);
  2514. }
  2515. var hash;
  2516. var loop = function ( key ) {
  2517. if (
  2518. key === 'class' ||
  2519. key === 'style' ||
  2520. isReservedAttribute(key)
  2521. ) {
  2522. hash = data;
  2523. } else {
  2524. var type = data.attrs && data.attrs.type;
  2525. hash = asProp || config.mustUseProp(tag, type, key)
  2526. ? data.domProps || (data.domProps = {})
  2527. : data.attrs || (data.attrs = {});
  2528. }
  2529. var camelizedKey = camelize(key);
  2530. var hyphenatedKey = hyphenate(key);
  2531. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  2532. hash[key] = value[key];
  2533. if (isSync) {
  2534. var on = data.on || (data.on = {});
  2535. on[("update:" + key)] = function ($event) {
  2536. value[key] = $event;
  2537. };
  2538. }
  2539. }
  2540. };
  2541. for (var key in value) loop( key );
  2542. }
  2543. }
  2544. return data
  2545. }
  2546. /* */
  2547. /**
  2548. * Runtime helper for rendering static trees.
  2549. */
  2550. function renderStatic (
  2551. index,
  2552. isInFor
  2553. ) {
  2554. var cached = this._staticTrees || (this._staticTrees = []);
  2555. var tree = cached[index];
  2556. // if has already-rendered static tree and not inside v-for,
  2557. // we can reuse the same tree.
  2558. if (tree && !isInFor) {
  2559. return tree
  2560. }
  2561. // otherwise, render a fresh tree.
  2562. tree = cached[index] = this.$options.staticRenderFns[index].call(
  2563. this._renderProxy,
  2564. null,
  2565. this // for render fns generated for functional component templates
  2566. );
  2567. markStatic(tree, ("__static__" + index), false);
  2568. return tree
  2569. }
  2570. /**
  2571. * Runtime helper for v-once.
  2572. * Effectively it means marking the node as static with a unique key.
  2573. */
  2574. function markOnce (
  2575. tree,
  2576. index,
  2577. key
  2578. ) {
  2579. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  2580. return tree
  2581. }
  2582. function markStatic (
  2583. tree,
  2584. key,
  2585. isOnce
  2586. ) {
  2587. if (Array.isArray(tree)) {
  2588. for (var i = 0; i < tree.length; i++) {
  2589. if (tree[i] && typeof tree[i] !== 'string') {
  2590. markStaticNode(tree[i], (key + "_" + i), isOnce);
  2591. }
  2592. }
  2593. } else {
  2594. markStaticNode(tree, key, isOnce);
  2595. }
  2596. }
  2597. function markStaticNode (node, key, isOnce) {
  2598. node.isStatic = true;
  2599. node.key = key;
  2600. node.isOnce = isOnce;
  2601. }
  2602. /* */
  2603. function bindObjectListeners (data, value) {
  2604. if (value) {
  2605. if (!isPlainObject(value)) {
  2606. warn(
  2607. 'v-on without argument expects an Object value',
  2608. this
  2609. );
  2610. } else {
  2611. var on = data.on = data.on ? extend({}, data.on) : {};
  2612. for (var key in value) {
  2613. var existing = on[key];
  2614. var ours = value[key];
  2615. on[key] = existing ? [].concat(existing, ours) : ours;
  2616. }
  2617. }
  2618. }
  2619. return data
  2620. }
  2621. /* */
  2622. function resolveScopedSlots (
  2623. fns, // see flow/vnode
  2624. res,
  2625. // the following are added in 2.6
  2626. hasDynamicKeys,
  2627. contentHashKey
  2628. ) {
  2629. res = res || { $stable: !hasDynamicKeys };
  2630. for (var i = 0; i < fns.length; i++) {
  2631. var slot = fns[i];
  2632. if (Array.isArray(slot)) {
  2633. resolveScopedSlots(slot, res, hasDynamicKeys);
  2634. } else if (slot) {
  2635. // marker for reverse proxying v-slot without scope on this.$slots
  2636. if (slot.proxy) {
  2637. slot.fn.proxy = true;
  2638. }
  2639. res[slot.key] = slot.fn;
  2640. }
  2641. }
  2642. if (contentHashKey) {
  2643. (res).$key = contentHashKey;
  2644. }
  2645. return res
  2646. }
  2647. /* */
  2648. function bindDynamicKeys (baseObj, values) {
  2649. for (var i = 0; i < values.length; i += 2) {
  2650. var key = values[i];
  2651. if (typeof key === 'string' && key) {
  2652. baseObj[values[i]] = values[i + 1];
  2653. } else if (key !== '' && key !== null) {
  2654. // null is a speical value for explicitly removing a binding
  2655. warn(
  2656. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  2657. this
  2658. );
  2659. }
  2660. }
  2661. return baseObj
  2662. }
  2663. // helper to dynamically append modifier runtime markers to event names.
  2664. // ensure only append when value is already string, otherwise it will be cast
  2665. // to string and cause the type check to miss.
  2666. function prependModifier (value, symbol) {
  2667. return typeof value === 'string' ? symbol + value : value
  2668. }
  2669. /* */
  2670. function installRenderHelpers (target) {
  2671. target._o = markOnce;
  2672. target._n = toNumber;
  2673. target._s = toString;
  2674. target._l = renderList;
  2675. target._t = renderSlot;
  2676. target._q = looseEqual;
  2677. target._i = looseIndexOf;
  2678. target._m = renderStatic;
  2679. target._f = resolveFilter;
  2680. target._k = checkKeyCodes;
  2681. target._b = bindObjectProps;
  2682. target._v = createTextVNode;
  2683. target._e = createEmptyVNode;
  2684. target._u = resolveScopedSlots;
  2685. target._g = bindObjectListeners;
  2686. target._d = bindDynamicKeys;
  2687. target._p = prependModifier;
  2688. }
  2689. /* */
  2690. function FunctionalRenderContext (
  2691. data,
  2692. props,
  2693. children,
  2694. parent,
  2695. Ctor
  2696. ) {
  2697. var this$1 = this;
  2698. var options = Ctor.options;
  2699. // ensure the createElement function in functional components
  2700. // gets a unique context - this is necessary for correct named slot check
  2701. var contextVm;
  2702. if (hasOwn(parent, '_uid')) {
  2703. contextVm = Object.create(parent);
  2704. // $flow-disable-line
  2705. contextVm._original = parent;
  2706. } else {
  2707. // the context vm passed in is a functional context as well.
  2708. // in this case we want to make sure we are able to get a hold to the
  2709. // real context instance.
  2710. contextVm = parent;
  2711. // $flow-disable-line
  2712. parent = parent._original;
  2713. }
  2714. var isCompiled = isTrue(options._compiled);
  2715. var needNormalization = !isCompiled;
  2716. this.data = data;
  2717. this.props = props;
  2718. this.children = children;
  2719. this.parent = parent;
  2720. this.listeners = data.on || emptyObject;
  2721. this.injections = resolveInject(options.inject, parent);
  2722. this.slots = function () {
  2723. if (!this$1.$slots) {
  2724. normalizeScopedSlots(
  2725. data.scopedSlots,
  2726. this$1.$slots = resolveSlots(children, parent)
  2727. );
  2728. }
  2729. return this$1.$slots
  2730. };
  2731. Object.defineProperty(this, 'scopedSlots', ({
  2732. enumerable: true,
  2733. get: function get () {
  2734. return normalizeScopedSlots(data.scopedSlots, this.slots())
  2735. }
  2736. }));
  2737. // support for compiled functional template
  2738. if (isCompiled) {
  2739. // exposing $options for renderStatic()
  2740. this.$options = options;
  2741. // pre-resolve slots for renderSlot()
  2742. this.$slots = this.slots();
  2743. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  2744. }
  2745. if (options._scopeId) {
  2746. this._c = function (a, b, c, d) {
  2747. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  2748. if (vnode && !Array.isArray(vnode)) {
  2749. vnode.fnScopeId = options._scopeId;
  2750. vnode.fnContext = parent;
  2751. }
  2752. return vnode
  2753. };
  2754. } else {
  2755. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  2756. }
  2757. }
  2758. installRenderHelpers(FunctionalRenderContext.prototype);
  2759. function createFunctionalComponent (
  2760. Ctor,
  2761. propsData,
  2762. data,
  2763. contextVm,
  2764. children
  2765. ) {
  2766. var options = Ctor.options;
  2767. var props = {};
  2768. var propOptions = options.props;
  2769. if (isDef(propOptions)) {
  2770. for (var key in propOptions) {
  2771. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  2772. }
  2773. } else {
  2774. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  2775. if (isDef(data.props)) { mergeProps(props, data.props); }
  2776. }
  2777. var renderContext = new FunctionalRenderContext(
  2778. data,
  2779. props,
  2780. children,
  2781. contextVm,
  2782. Ctor
  2783. );
  2784. var vnode = options.render.call(null, renderContext._c, renderContext);
  2785. if (vnode instanceof VNode) {
  2786. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  2787. } else if (Array.isArray(vnode)) {
  2788. var vnodes = normalizeChildren(vnode) || [];
  2789. var res = new Array(vnodes.length);
  2790. for (var i = 0; i < vnodes.length; i++) {
  2791. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  2792. }
  2793. return res
  2794. }
  2795. }
  2796. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  2797. // #7817 clone node before setting fnContext, otherwise if the node is reused
  2798. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  2799. // that should not be matched to match.
  2800. var clone = cloneVNode(vnode);
  2801. clone.fnContext = contextVm;
  2802. clone.fnOptions = options;
  2803. {
  2804. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  2805. }
  2806. if (data.slot) {
  2807. (clone.data || (clone.data = {})).slot = data.slot;
  2808. }
  2809. return clone
  2810. }
  2811. function mergeProps (to, from) {
  2812. for (var key in from) {
  2813. to[camelize(key)] = from[key];
  2814. }
  2815. }
  2816. /* */
  2817. /* */
  2818. /* */
  2819. /* */
  2820. // inline hooks to be invoked on component VNodes during patch
  2821. var componentVNodeHooks = {
  2822. init: function init (vnode, hydrating) {
  2823. if (
  2824. vnode.componentInstance &&
  2825. !vnode.componentInstance._isDestroyed &&
  2826. vnode.data.keepAlive
  2827. ) {
  2828. // kept-alive components, treat as a patch
  2829. var mountedNode = vnode; // work around flow
  2830. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  2831. } else {
  2832. var child = vnode.componentInstance = createComponentInstanceForVnode(
  2833. vnode,
  2834. activeInstance
  2835. );
  2836. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  2837. }
  2838. },
  2839. prepatch: function prepatch (oldVnode, vnode) {
  2840. var options = vnode.componentOptions;
  2841. var child = vnode.componentInstance = oldVnode.componentInstance;
  2842. updateChildComponent(
  2843. child,
  2844. options.propsData, // updated props
  2845. options.listeners, // updated listeners
  2846. vnode, // new parent vnode
  2847. options.children // new children
  2848. );
  2849. },
  2850. insert: function insert (vnode) {
  2851. var context = vnode.context;
  2852. var componentInstance = vnode.componentInstance;
  2853. if (!componentInstance._isMounted) {
  2854. componentInstance._isMounted = true;
  2855. callHook(componentInstance, 'mounted');
  2856. }
  2857. if (vnode.data.keepAlive) {
  2858. if (context._isMounted) {
  2859. // vue-router#1212
  2860. // During updates, a kept-alive component's child components may
  2861. // change, so directly walking the tree here may call activated hooks
  2862. // on incorrect children. Instead we push them into a queue which will
  2863. // be processed after the whole patch process ended.
  2864. queueActivatedComponent(componentInstance);
  2865. } else {
  2866. activateChildComponent(componentInstance, true /* direct */);
  2867. }
  2868. }
  2869. },
  2870. destroy: function destroy (vnode) {
  2871. var componentInstance = vnode.componentInstance;
  2872. if (!componentInstance._isDestroyed) {
  2873. if (!vnode.data.keepAlive) {
  2874. componentInstance.$destroy();
  2875. } else {
  2876. deactivateChildComponent(componentInstance, true /* direct */);
  2877. }
  2878. }
  2879. }
  2880. };
  2881. var hooksToMerge = Object.keys(componentVNodeHooks);
  2882. function createComponent (
  2883. Ctor,
  2884. data,
  2885. context,
  2886. children,
  2887. tag
  2888. ) {
  2889. if (isUndef(Ctor)) {
  2890. return
  2891. }
  2892. var baseCtor = context.$options._base;
  2893. // plain options object: turn it into a constructor
  2894. if (isObject(Ctor)) {
  2895. Ctor = baseCtor.extend(Ctor);
  2896. }
  2897. // if at this stage it's not a constructor or an async component factory,
  2898. // reject.
  2899. if (typeof Ctor !== 'function') {
  2900. {
  2901. warn(("Invalid Component definition: " + (String(Ctor))), context);
  2902. }
  2903. return
  2904. }
  2905. // async component
  2906. var asyncFactory;
  2907. if (isUndef(Ctor.cid)) {
  2908. asyncFactory = Ctor;
  2909. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  2910. if (Ctor === undefined) {
  2911. // return a placeholder node for async component, which is rendered
  2912. // as a comment node but preserves all the raw information for the node.
  2913. // the information will be used for async server-rendering and hydration.
  2914. return createAsyncPlaceholder(
  2915. asyncFactory,
  2916. data,
  2917. context,
  2918. children,
  2919. tag
  2920. )
  2921. }
  2922. }
  2923. data = data || {};
  2924. // resolve constructor options in case global mixins are applied after
  2925. // component constructor creation
  2926. resolveConstructorOptions(Ctor);
  2927. // transform component v-model data into props & events
  2928. if (isDef(data.model)) {
  2929. transformModel(Ctor.options, data);
  2930. }
  2931. // extract props
  2932. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  2933. // functional component
  2934. if (isTrue(Ctor.options.functional)) {
  2935. return createFunctionalComponent(Ctor, propsData, data, context, children)
  2936. }
  2937. // extract listeners, since these needs to be treated as
  2938. // child component listeners instead of DOM listeners
  2939. var listeners = data.on;
  2940. // replace with listeners with .native modifier
  2941. // so it gets processed during parent component patch.
  2942. data.on = data.nativeOn;
  2943. if (isTrue(Ctor.options.abstract)) {
  2944. // abstract components do not keep anything
  2945. // other than props & listeners & slot
  2946. // work around flow
  2947. var slot = data.slot;
  2948. data = {};
  2949. if (slot) {
  2950. data.slot = slot;
  2951. }
  2952. }
  2953. // install component management hooks onto the placeholder node
  2954. installComponentHooks(data);
  2955. // return a placeholder vnode
  2956. var name = Ctor.options.name || tag;
  2957. var vnode = new VNode(
  2958. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  2959. data, undefined, undefined, undefined, context,
  2960. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  2961. asyncFactory
  2962. );
  2963. return vnode
  2964. }
  2965. function createComponentInstanceForVnode (
  2966. vnode, // we know it's MountedComponentVNode but flow doesn't
  2967. parent // activeInstance in lifecycle state
  2968. ) {
  2969. var options = {
  2970. _isComponent: true,
  2971. _parentVnode: vnode,
  2972. parent: parent
  2973. };
  2974. // check inline-template render functions
  2975. var inlineTemplate = vnode.data.inlineTemplate;
  2976. if (isDef(inlineTemplate)) {
  2977. options.render = inlineTemplate.render;
  2978. options.staticRenderFns = inlineTemplate.staticRenderFns;
  2979. }
  2980. return new vnode.componentOptions.Ctor(options)
  2981. }
  2982. function installComponentHooks (data) {
  2983. var hooks = data.hook || (data.hook = {});
  2984. for (var i = 0; i < hooksToMerge.length; i++) {
  2985. var key = hooksToMerge[i];
  2986. var existing = hooks[key];
  2987. var toMerge = componentVNodeHooks[key];
  2988. if (existing !== toMerge && !(existing && existing._merged)) {
  2989. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  2990. }
  2991. }
  2992. }
  2993. function mergeHook$1 (f1, f2) {
  2994. var merged = function (a, b) {
  2995. // flow complains about extra args which is why we use any
  2996. f1(a, b);
  2997. f2(a, b);
  2998. };
  2999. merged._merged = true;
  3000. return merged
  3001. }
  3002. // transform component v-model info (value and callback) into
  3003. // prop and event handler respectively.
  3004. function transformModel (options, data) {
  3005. var prop = (options.model && options.model.prop) || 'value';
  3006. var event = (options.model && options.model.event) || 'input'
  3007. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  3008. var on = data.on || (data.on = {});
  3009. var existing = on[event];
  3010. var callback = data.model.callback;
  3011. if (isDef(existing)) {
  3012. if (
  3013. Array.isArray(existing)
  3014. ? existing.indexOf(callback) === -1
  3015. : existing !== callback
  3016. ) {
  3017. on[event] = [callback].concat(existing);
  3018. }
  3019. } else {
  3020. on[event] = callback;
  3021. }
  3022. }
  3023. /* */
  3024. var SIMPLE_NORMALIZE = 1;
  3025. var ALWAYS_NORMALIZE = 2;
  3026. // wrapper function for providing a more flexible interface
  3027. // without getting yelled at by flow
  3028. function createElement (
  3029. context,
  3030. tag,
  3031. data,
  3032. children,
  3033. normalizationType,
  3034. alwaysNormalize
  3035. ) {
  3036. if (Array.isArray(data) || isPrimitive(data)) {
  3037. normalizationType = children;
  3038. children = data;
  3039. data = undefined;
  3040. }
  3041. if (isTrue(alwaysNormalize)) {
  3042. normalizationType = ALWAYS_NORMALIZE;
  3043. }
  3044. return _createElement(context, tag, data, children, normalizationType)
  3045. }
  3046. function _createElement (
  3047. context,
  3048. tag,
  3049. data,
  3050. children,
  3051. normalizationType
  3052. ) {
  3053. if (isDef(data) && isDef((data).__ob__)) {
  3054. warn(
  3055. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  3056. 'Always create fresh vnode data objects in each render!',
  3057. context
  3058. );
  3059. return createEmptyVNode()
  3060. }
  3061. // object syntax in v-bind
  3062. if (isDef(data) && isDef(data.is)) {
  3063. tag = data.is;
  3064. }
  3065. if (!tag) {
  3066. // in case of component :is set to falsy value
  3067. return createEmptyVNode()
  3068. }
  3069. // warn against non-primitive key
  3070. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  3071. ) {
  3072. {
  3073. warn(
  3074. 'Avoid using non-primitive value as key, ' +
  3075. 'use string/number value instead.',
  3076. context
  3077. );
  3078. }
  3079. }
  3080. // support single function children as default scoped slot
  3081. if (Array.isArray(children) &&
  3082. typeof children[0] === 'function'
  3083. ) {
  3084. data = data || {};
  3085. data.scopedSlots = { default: children[0] };
  3086. children.length = 0;
  3087. }
  3088. if (normalizationType === ALWAYS_NORMALIZE) {
  3089. children = normalizeChildren(children);
  3090. } else if (normalizationType === SIMPLE_NORMALIZE) {
  3091. children = simpleNormalizeChildren(children);
  3092. }
  3093. var vnode, ns;
  3094. if (typeof tag === 'string') {
  3095. var Ctor;
  3096. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  3097. if (config.isReservedTag(tag)) {
  3098. // platform built-in elements
  3099. vnode = new VNode(
  3100. config.parsePlatformTagName(tag), data, children,
  3101. undefined, undefined, context
  3102. );
  3103. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  3104. // component
  3105. vnode = createComponent(Ctor, data, context, children, tag);
  3106. } else {
  3107. // unknown or unlisted namespaced elements
  3108. // check at runtime because it may get assigned a namespace when its
  3109. // parent normalizes children
  3110. vnode = new VNode(
  3111. tag, data, children,
  3112. undefined, undefined, context
  3113. );
  3114. }
  3115. } else {
  3116. // direct component options / constructor
  3117. vnode = createComponent(tag, data, context, children);
  3118. }
  3119. if (Array.isArray(vnode)) {
  3120. return vnode
  3121. } else if (isDef(vnode)) {
  3122. if (isDef(ns)) { applyNS(vnode, ns); }
  3123. if (isDef(data)) { registerDeepBindings(data); }
  3124. return vnode
  3125. } else {
  3126. return createEmptyVNode()
  3127. }
  3128. }
  3129. function applyNS (vnode, ns, force) {
  3130. vnode.ns = ns;
  3131. if (vnode.tag === 'foreignObject') {
  3132. // use default namespace inside foreignObject
  3133. ns = undefined;
  3134. force = true;
  3135. }
  3136. if (isDef(vnode.children)) {
  3137. for (var i = 0, l = vnode.children.length; i < l; i++) {
  3138. var child = vnode.children[i];
  3139. if (isDef(child.tag) && (
  3140. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  3141. applyNS(child, ns, force);
  3142. }
  3143. }
  3144. }
  3145. }
  3146. // ref #5318
  3147. // necessary to ensure parent re-render when deep bindings like :style and
  3148. // :class are used on slot nodes
  3149. function registerDeepBindings (data) {
  3150. if (isObject(data.style)) {
  3151. traverse(data.style);
  3152. }
  3153. if (isObject(data.class)) {
  3154. traverse(data.class);
  3155. }
  3156. }
  3157. /* */
  3158. function initRender (vm) {
  3159. vm._vnode = null; // the root of the child tree
  3160. vm._staticTrees = null; // v-once cached trees
  3161. var options = vm.$options;
  3162. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  3163. var renderContext = parentVnode && parentVnode.context;
  3164. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  3165. vm.$scopedSlots = emptyObject;
  3166. // bind the createElement fn to this instance
  3167. // so that we get proper render context inside it.
  3168. // args order: tag, data, children, normalizationType, alwaysNormalize
  3169. // internal version is used by render functions compiled from templates
  3170. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  3171. // normalization is always applied for the public version, used in
  3172. // user-written render functions.
  3173. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  3174. // $attrs & $listeners are exposed for easier HOC creation.
  3175. // they need to be reactive so that HOCs using them are always updated
  3176. var parentData = parentVnode && parentVnode.data;
  3177. /* istanbul ignore else */
  3178. {
  3179. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  3180. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  3181. }, true);
  3182. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  3183. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  3184. }, true);
  3185. }
  3186. }
  3187. var currentRenderingInstance = null;
  3188. function renderMixin (Vue) {
  3189. // install runtime convenience helpers
  3190. installRenderHelpers(Vue.prototype);
  3191. Vue.prototype.$nextTick = function (fn) {
  3192. return nextTick(fn, this)
  3193. };
  3194. Vue.prototype._render = function () {
  3195. var vm = this;
  3196. var ref = vm.$options;
  3197. var render = ref.render;
  3198. var _parentVnode = ref._parentVnode;
  3199. if (_parentVnode) {
  3200. vm.$scopedSlots = normalizeScopedSlots(
  3201. _parentVnode.data.scopedSlots,
  3202. vm.$slots,
  3203. vm.$scopedSlots
  3204. );
  3205. }
  3206. // set parent vnode. this allows render functions to have access
  3207. // to the data on the placeholder node.
  3208. vm.$vnode = _parentVnode;
  3209. // render self
  3210. var vnode;
  3211. try {
  3212. // There's no need to maintain a stack becaues all render fns are called
  3213. // separately from one another. Nested component's render fns are called
  3214. // when parent component is patched.
  3215. currentRenderingInstance = vm;
  3216. vnode = render.call(vm._renderProxy, vm.$createElement);
  3217. } catch (e) {
  3218. handleError(e, vm, "render");
  3219. // return error render result,
  3220. // or previous vnode to prevent render error causing blank component
  3221. /* istanbul ignore else */
  3222. if (vm.$options.renderError) {
  3223. try {
  3224. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  3225. } catch (e) {
  3226. handleError(e, vm, "renderError");
  3227. vnode = vm._vnode;
  3228. }
  3229. } else {
  3230. vnode = vm._vnode;
  3231. }
  3232. } finally {
  3233. currentRenderingInstance = null;
  3234. }
  3235. // if the returned array contains only a single node, allow it
  3236. if (Array.isArray(vnode) && vnode.length === 1) {
  3237. vnode = vnode[0];
  3238. }
  3239. // return empty vnode in case the render function errored out
  3240. if (!(vnode instanceof VNode)) {
  3241. if (Array.isArray(vnode)) {
  3242. warn(
  3243. 'Multiple root nodes returned from render function. Render function ' +
  3244. 'should return a single root node.',
  3245. vm
  3246. );
  3247. }
  3248. vnode = createEmptyVNode();
  3249. }
  3250. // set parent
  3251. vnode.parent = _parentVnode;
  3252. return vnode
  3253. };
  3254. }
  3255. /* */
  3256. function ensureCtor (comp, base) {
  3257. if (
  3258. comp.__esModule ||
  3259. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  3260. ) {
  3261. comp = comp.default;
  3262. }
  3263. return isObject(comp)
  3264. ? base.extend(comp)
  3265. : comp
  3266. }
  3267. function createAsyncPlaceholder (
  3268. factory,
  3269. data,
  3270. context,
  3271. children,
  3272. tag
  3273. ) {
  3274. var node = createEmptyVNode();
  3275. node.asyncFactory = factory;
  3276. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  3277. return node
  3278. }
  3279. function resolveAsyncComponent (
  3280. factory,
  3281. baseCtor
  3282. ) {
  3283. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  3284. return factory.errorComp
  3285. }
  3286. if (isDef(factory.resolved)) {
  3287. return factory.resolved
  3288. }
  3289. var owner = currentRenderingInstance;
  3290. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  3291. // already pending
  3292. factory.owners.push(owner);
  3293. }
  3294. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  3295. return factory.loadingComp
  3296. }
  3297. if (owner && !isDef(factory.owners)) {
  3298. var owners = factory.owners = [owner];
  3299. var sync = true;
  3300. var timerLoading = null;
  3301. var timerTimeout = null
  3302. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  3303. var forceRender = function (renderCompleted) {
  3304. for (var i = 0, l = owners.length; i < l; i++) {
  3305. (owners[i]).$forceUpdate();
  3306. }
  3307. if (renderCompleted) {
  3308. owners.length = 0;
  3309. if (timerLoading !== null) {
  3310. clearTimeout(timerLoading);
  3311. timerLoading = null;
  3312. }
  3313. if (timerTimeout !== null) {
  3314. clearTimeout(timerTimeout);
  3315. timerTimeout = null;
  3316. }
  3317. }
  3318. };
  3319. var resolve = once(function (res) {
  3320. // cache resolved
  3321. factory.resolved = ensureCtor(res, baseCtor);
  3322. // invoke callbacks only if this is not a synchronous resolve
  3323. // (async resolves are shimmed as synchronous during SSR)
  3324. if (!sync) {
  3325. forceRender(true);
  3326. } else {
  3327. owners.length = 0;
  3328. }
  3329. });
  3330. var reject = once(function (reason) {
  3331. warn(
  3332. "Failed to resolve async component: " + (String(factory)) +
  3333. (reason ? ("\nReason: " + reason) : '')
  3334. );
  3335. if (isDef(factory.errorComp)) {
  3336. factory.error = true;
  3337. forceRender(true);
  3338. }
  3339. });
  3340. var res = factory(resolve, reject);
  3341. if (isObject(res)) {
  3342. if (isPromise(res)) {
  3343. // () => Promise
  3344. if (isUndef(factory.resolved)) {
  3345. res.then(resolve, reject);
  3346. }
  3347. } else if (isPromise(res.component)) {
  3348. res.component.then(resolve, reject);
  3349. if (isDef(res.error)) {
  3350. factory.errorComp = ensureCtor(res.error, baseCtor);
  3351. }
  3352. if (isDef(res.loading)) {
  3353. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  3354. if (res.delay === 0) {
  3355. factory.loading = true;
  3356. } else {
  3357. timerLoading = setTimeout(function () {
  3358. timerLoading = null;
  3359. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  3360. factory.loading = true;
  3361. forceRender(false);
  3362. }
  3363. }, res.delay || 200);
  3364. }
  3365. }
  3366. if (isDef(res.timeout)) {
  3367. timerTimeout = setTimeout(function () {
  3368. timerTimeout = null;
  3369. if (isUndef(factory.resolved)) {
  3370. reject(
  3371. "timeout (" + (res.timeout) + "ms)"
  3372. );
  3373. }
  3374. }, res.timeout);
  3375. }
  3376. }
  3377. }
  3378. sync = false;
  3379. // return in case resolved synchronously
  3380. return factory.loading
  3381. ? factory.loadingComp
  3382. : factory.resolved
  3383. }
  3384. }
  3385. /* */
  3386. function isAsyncPlaceholder (node) {
  3387. return node.isComment && node.asyncFactory
  3388. }
  3389. /* */
  3390. function getFirstComponentChild (children) {
  3391. if (Array.isArray(children)) {
  3392. for (var i = 0; i < children.length; i++) {
  3393. var c = children[i];
  3394. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  3395. return c
  3396. }
  3397. }
  3398. }
  3399. }
  3400. /* */
  3401. /* */
  3402. function initEvents (vm) {
  3403. vm._events = Object.create(null);
  3404. vm._hasHookEvent = false;
  3405. // init parent attached events
  3406. var listeners = vm.$options._parentListeners;
  3407. if (listeners) {
  3408. updateComponentListeners(vm, listeners);
  3409. }
  3410. }
  3411. var target;
  3412. function add (event, fn) {
  3413. target.$on(event, fn);
  3414. }
  3415. function remove$1 (event, fn) {
  3416. target.$off(event, fn);
  3417. }
  3418. function createOnceHandler (event, fn) {
  3419. var _target = target;
  3420. return function onceHandler () {
  3421. var res = fn.apply(null, arguments);
  3422. if (res !== null) {
  3423. _target.$off(event, onceHandler);
  3424. }
  3425. }
  3426. }
  3427. function updateComponentListeners (
  3428. vm,
  3429. listeners,
  3430. oldListeners
  3431. ) {
  3432. target = vm;
  3433. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  3434. target = undefined;
  3435. }
  3436. function eventsMixin (Vue) {
  3437. var hookRE = /^hook:/;
  3438. Vue.prototype.$on = function (event, fn) {
  3439. var vm = this;
  3440. if (Array.isArray(event)) {
  3441. for (var i = 0, l = event.length; i < l; i++) {
  3442. vm.$on(event[i], fn);
  3443. }
  3444. } else {
  3445. (vm._events[event] || (vm._events[event] = [])).push(fn);
  3446. // optimize hook:event cost by using a boolean flag marked at registration
  3447. // instead of a hash lookup
  3448. if (hookRE.test(event)) {
  3449. vm._hasHookEvent = true;
  3450. }
  3451. }
  3452. return vm
  3453. };
  3454. Vue.prototype.$once = function (event, fn) {
  3455. var vm = this;
  3456. function on () {
  3457. vm.$off(event, on);
  3458. fn.apply(vm, arguments);
  3459. }
  3460. on.fn = fn;
  3461. vm.$on(event, on);
  3462. return vm
  3463. };
  3464. Vue.prototype.$off = function (event, fn) {
  3465. var vm = this;
  3466. // all
  3467. if (!arguments.length) {
  3468. vm._events = Object.create(null);
  3469. return vm
  3470. }
  3471. // array of events
  3472. if (Array.isArray(event)) {
  3473. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  3474. vm.$off(event[i$1], fn);
  3475. }
  3476. return vm
  3477. }
  3478. // specific event
  3479. var cbs = vm._events[event];
  3480. if (!cbs) {
  3481. return vm
  3482. }
  3483. if (!fn) {
  3484. vm._events[event] = null;
  3485. return vm
  3486. }
  3487. // specific handler
  3488. var cb;
  3489. var i = cbs.length;
  3490. while (i--) {
  3491. cb = cbs[i];
  3492. if (cb === fn || cb.fn === fn) {
  3493. cbs.splice(i, 1);
  3494. break
  3495. }
  3496. }
  3497. return vm
  3498. };
  3499. Vue.prototype.$emit = function (event) {
  3500. var vm = this;
  3501. {
  3502. var lowerCaseEvent = event.toLowerCase();
  3503. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  3504. tip(
  3505. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  3506. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  3507. "Note that HTML attributes are case-insensitive and you cannot use " +
  3508. "v-on to listen to camelCase events when using in-DOM templates. " +
  3509. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  3510. );
  3511. }
  3512. }
  3513. var cbs = vm._events[event];
  3514. if (cbs) {
  3515. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  3516. var args = toArray(arguments, 1);
  3517. var info = "event handler for \"" + event + "\"";
  3518. for (var i = 0, l = cbs.length; i < l; i++) {
  3519. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  3520. }
  3521. }
  3522. return vm
  3523. };
  3524. }
  3525. /* */
  3526. var activeInstance = null;
  3527. var isUpdatingChildComponent = false;
  3528. function setActiveInstance(vm) {
  3529. var prevActiveInstance = activeInstance;
  3530. activeInstance = vm;
  3531. return function () {
  3532. activeInstance = prevActiveInstance;
  3533. }
  3534. }
  3535. function initLifecycle (vm) {
  3536. var options = vm.$options;
  3537. // locate first non-abstract parent
  3538. var parent = options.parent;
  3539. if (parent && !options.abstract) {
  3540. while (parent.$options.abstract && parent.$parent) {
  3541. parent = parent.$parent;
  3542. }
  3543. parent.$children.push(vm);
  3544. }
  3545. vm.$parent = parent;
  3546. vm.$root = parent ? parent.$root : vm;
  3547. vm.$children = [];
  3548. vm.$refs = {};
  3549. vm._watcher = null;
  3550. vm._inactive = null;
  3551. vm._directInactive = false;
  3552. vm._isMounted = false;
  3553. vm._isDestroyed = false;
  3554. vm._isBeingDestroyed = false;
  3555. }
  3556. function lifecycleMixin (Vue) {
  3557. Vue.prototype._update = function (vnode, hydrating) {
  3558. var vm = this;
  3559. var prevEl = vm.$el;
  3560. var prevVnode = vm._vnode;
  3561. var restoreActiveInstance = setActiveInstance(vm);
  3562. vm._vnode = vnode;
  3563. // Vue.prototype.__patch__ is injected in entry points
  3564. // based on the rendering backend used.
  3565. if (!prevVnode) {
  3566. // initial render
  3567. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  3568. } else {
  3569. // updates
  3570. vm.$el = vm.__patch__(prevVnode, vnode);
  3571. }
  3572. restoreActiveInstance();
  3573. // update __vue__ reference
  3574. if (prevEl) {
  3575. prevEl.__vue__ = null;
  3576. }
  3577. if (vm.$el) {
  3578. vm.$el.__vue__ = vm;
  3579. }
  3580. // if parent is an HOC, update its $el as well
  3581. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  3582. vm.$parent.$el = vm.$el;
  3583. }
  3584. // updated hook is called by the scheduler to ensure that children are
  3585. // updated in a parent's updated hook.
  3586. };
  3587. Vue.prototype.$forceUpdate = function () {
  3588. var vm = this;
  3589. if (vm._watcher) {
  3590. vm._watcher.update();
  3591. }
  3592. };
  3593. Vue.prototype.$destroy = function () {
  3594. var vm = this;
  3595. if (vm._isBeingDestroyed) {
  3596. return
  3597. }
  3598. callHook(vm, 'beforeDestroy');
  3599. vm._isBeingDestroyed = true;
  3600. // remove self from parent
  3601. var parent = vm.$parent;
  3602. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  3603. remove(parent.$children, vm);
  3604. }
  3605. // teardown watchers
  3606. if (vm._watcher) {
  3607. vm._watcher.teardown();
  3608. }
  3609. var i = vm._watchers.length;
  3610. while (i--) {
  3611. vm._watchers[i].teardown();
  3612. }
  3613. // remove reference from data ob
  3614. // frozen object may not have observer.
  3615. if (vm._data.__ob__) {
  3616. vm._data.__ob__.vmCount--;
  3617. }
  3618. // call the last hook...
  3619. vm._isDestroyed = true;
  3620. // invoke destroy hooks on current rendered tree
  3621. vm.__patch__(vm._vnode, null);
  3622. // fire destroyed hook
  3623. callHook(vm, 'destroyed');
  3624. // turn off all instance listeners.
  3625. vm.$off();
  3626. // remove __vue__ reference
  3627. if (vm.$el) {
  3628. vm.$el.__vue__ = null;
  3629. }
  3630. // release circular reference (#6759)
  3631. if (vm.$vnode) {
  3632. vm.$vnode.parent = null;
  3633. }
  3634. };
  3635. }
  3636. function mountComponent (
  3637. vm,
  3638. el,
  3639. hydrating
  3640. ) {
  3641. vm.$el = el;
  3642. if (!vm.$options.render) {
  3643. vm.$options.render = createEmptyVNode;
  3644. {
  3645. /* istanbul ignore if */
  3646. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  3647. vm.$options.el || el) {
  3648. warn(
  3649. 'You are using the runtime-only build of Vue where the template ' +
  3650. 'compiler is not available. Either pre-compile the templates into ' +
  3651. 'render functions, or use the compiler-included build.',
  3652. vm
  3653. );
  3654. } else {
  3655. warn(
  3656. 'Failed to mount component: template or render function not defined.',
  3657. vm
  3658. );
  3659. }
  3660. }
  3661. }
  3662. callHook(vm, 'beforeMount');
  3663. var updateComponent;
  3664. /* istanbul ignore if */
  3665. if (config.performance && mark) {
  3666. updateComponent = function () {
  3667. var name = vm._name;
  3668. var id = vm._uid;
  3669. var startTag = "vue-perf-start:" + id;
  3670. var endTag = "vue-perf-end:" + id;
  3671. mark(startTag);
  3672. var vnode = vm._render();
  3673. mark(endTag);
  3674. measure(("vue " + name + " render"), startTag, endTag);
  3675. mark(startTag);
  3676. vm._update(vnode, hydrating);
  3677. mark(endTag);
  3678. measure(("vue " + name + " patch"), startTag, endTag);
  3679. };
  3680. } else {
  3681. updateComponent = function () {
  3682. vm._update(vm._render(), hydrating);
  3683. };
  3684. }
  3685. // we set this to vm._watcher inside the watcher's constructor
  3686. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  3687. // component's mounted hook), which relies on vm._watcher being already defined
  3688. new Watcher(vm, updateComponent, noop, {
  3689. before: function before () {
  3690. if (vm._isMounted && !vm._isDestroyed) {
  3691. callHook(vm, 'beforeUpdate');
  3692. }
  3693. }
  3694. }, true /* isRenderWatcher */);
  3695. hydrating = false;
  3696. // manually mounted instance, call mounted on self
  3697. // mounted is called for render-created child components in its inserted hook
  3698. if (vm.$vnode == null) {
  3699. vm._isMounted = true;
  3700. callHook(vm, 'mounted');
  3701. }
  3702. return vm
  3703. }
  3704. function updateChildComponent (
  3705. vm,
  3706. propsData,
  3707. listeners,
  3708. parentVnode,
  3709. renderChildren
  3710. ) {
  3711. {
  3712. isUpdatingChildComponent = true;
  3713. }
  3714. // determine whether component has slot children
  3715. // we need to do this before overwriting $options._renderChildren.
  3716. // check if there are dynamic scopedSlots (hand-written or compiled but with
  3717. // dynamic slot names). Static scoped slots compiled from template has the
  3718. // "$stable" marker.
  3719. var newScopedSlots = parentVnode.data.scopedSlots;
  3720. var oldScopedSlots = vm.$scopedSlots;
  3721. var hasDynamicScopedSlot = !!(
  3722. (newScopedSlots && !newScopedSlots.$stable) ||
  3723. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  3724. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  3725. );
  3726. // Any static slot children from the parent may have changed during parent's
  3727. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  3728. // update is necessary to ensure correctness.
  3729. var needsForceUpdate = !!(
  3730. renderChildren || // has new static slots
  3731. vm.$options._renderChildren || // has old static slots
  3732. hasDynamicScopedSlot
  3733. );
  3734. vm.$options._parentVnode = parentVnode;
  3735. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  3736. if (vm._vnode) { // update child tree's parent
  3737. vm._vnode.parent = parentVnode;
  3738. }
  3739. vm.$options._renderChildren = renderChildren;
  3740. // update $attrs and $listeners hash
  3741. // these are also reactive so they may trigger child update if the child
  3742. // used them during render
  3743. vm.$attrs = parentVnode.data.attrs || emptyObject;
  3744. vm.$listeners = listeners || emptyObject;
  3745. // update props
  3746. if (propsData && vm.$options.props) {
  3747. toggleObserving(false);
  3748. var props = vm._props;
  3749. var propKeys = vm.$options._propKeys || [];
  3750. for (var i = 0; i < propKeys.length; i++) {
  3751. var key = propKeys[i];
  3752. var propOptions = vm.$options.props; // wtf flow?
  3753. props[key] = validateProp(key, propOptions, propsData, vm);
  3754. }
  3755. toggleObserving(true);
  3756. // keep a copy of raw propsData
  3757. vm.$options.propsData = propsData;
  3758. }
  3759. // update listeners
  3760. listeners = listeners || emptyObject;
  3761. var oldListeners = vm.$options._parentListeners;
  3762. vm.$options._parentListeners = listeners;
  3763. updateComponentListeners(vm, listeners, oldListeners);
  3764. // resolve slots + force update if has children
  3765. if (needsForceUpdate) {
  3766. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  3767. vm.$forceUpdate();
  3768. }
  3769. {
  3770. isUpdatingChildComponent = false;
  3771. }
  3772. }
  3773. function isInInactiveTree (vm) {
  3774. while (vm && (vm = vm.$parent)) {
  3775. if (vm._inactive) { return true }
  3776. }
  3777. return false
  3778. }
  3779. function activateChildComponent (vm, direct) {
  3780. if (direct) {
  3781. vm._directInactive = false;
  3782. if (isInInactiveTree(vm)) {
  3783. return
  3784. }
  3785. } else if (vm._directInactive) {
  3786. return
  3787. }
  3788. if (vm._inactive || vm._inactive === null) {
  3789. vm._inactive = false;
  3790. for (var i = 0; i < vm.$children.length; i++) {
  3791. activateChildComponent(vm.$children[i]);
  3792. }
  3793. callHook(vm, 'activated');
  3794. }
  3795. }
  3796. function deactivateChildComponent (vm, direct) {
  3797. if (direct) {
  3798. vm._directInactive = true;
  3799. if (isInInactiveTree(vm)) {
  3800. return
  3801. }
  3802. }
  3803. if (!vm._inactive) {
  3804. vm._inactive = true;
  3805. for (var i = 0; i < vm.$children.length; i++) {
  3806. deactivateChildComponent(vm.$children[i]);
  3807. }
  3808. callHook(vm, 'deactivated');
  3809. }
  3810. }
  3811. function callHook (vm, hook) {
  3812. // #7573 disable dep collection when invoking lifecycle hooks
  3813. pushTarget();
  3814. var handlers = vm.$options[hook];
  3815. var info = hook + " hook";
  3816. if (handlers) {
  3817. for (var i = 0, j = handlers.length; i < j; i++) {
  3818. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  3819. }
  3820. }
  3821. if (vm._hasHookEvent) {
  3822. vm.$emit('hook:' + hook);
  3823. }
  3824. popTarget();
  3825. }
  3826. /* */
  3827. var MAX_UPDATE_COUNT = 100;
  3828. var queue = [];
  3829. var activatedChildren = [];
  3830. var has = {};
  3831. var circular = {};
  3832. var waiting = false;
  3833. var flushing = false;
  3834. var index = 0;
  3835. /**
  3836. * Reset the scheduler's state.
  3837. */
  3838. function resetSchedulerState () {
  3839. index = queue.length = activatedChildren.length = 0;
  3840. has = {};
  3841. {
  3842. circular = {};
  3843. }
  3844. waiting = flushing = false;
  3845. }
  3846. // Async edge case #6566 requires saving the timestamp when event listeners are
  3847. // attached. However, calling performance.now() has a perf overhead especially
  3848. // if the page has thousands of event listeners. Instead, we take a timestamp
  3849. // every time the scheduler flushes and use that for all event listeners
  3850. // attached during that flush.
  3851. var currentFlushTimestamp = 0;
  3852. // Async edge case fix requires storing an event listener's attach timestamp.
  3853. var getNow = Date.now;
  3854. // Determine what event timestamp the browser is using. Annoyingly, the
  3855. // timestamp can either be hi-res (relative to page load) or low-res
  3856. // (relative to UNIX epoch), so in order to compare time we have to use the
  3857. // same timestamp type when saving the flush timestamp.
  3858. // All IE versions use low-res event timestamps, and have problematic clock
  3859. // implementations (#9632)
  3860. if (inBrowser && !isIE) {
  3861. var performance = window.performance;
  3862. if (
  3863. performance &&
  3864. typeof performance.now === 'function' &&
  3865. getNow() > document.createEvent('Event').timeStamp
  3866. ) {
  3867. // if the event timestamp, although evaluated AFTER the Date.now(), is
  3868. // smaller than it, it means the event is using a hi-res timestamp,
  3869. // and we need to use the hi-res version for event listener timestamps as
  3870. // well.
  3871. getNow = function () { return performance.now(); };
  3872. }
  3873. }
  3874. /**
  3875. * Flush both queues and run the watchers.
  3876. */
  3877. function flushSchedulerQueue () {
  3878. currentFlushTimestamp = getNow();
  3879. flushing = true;
  3880. var watcher, id;
  3881. // Sort queue before flush.
  3882. // This ensures that:
  3883. // 1. Components are updated from parent to child. (because parent is always
  3884. // created before the child)
  3885. // 2. A component's user watchers are run before its render watcher (because
  3886. // user watchers are created before the render watcher)
  3887. // 3. If a component is destroyed during a parent component's watcher run,
  3888. // its watchers can be skipped.
  3889. queue.sort(function (a, b) { return a.id - b.id; });
  3890. // do not cache length because more watchers might be pushed
  3891. // as we run existing watchers
  3892. for (index = 0; index < queue.length; index++) {
  3893. watcher = queue[index];
  3894. if (watcher.before) {
  3895. watcher.before();
  3896. }
  3897. id = watcher.id;
  3898. has[id] = null;
  3899. watcher.run();
  3900. // in dev build, check and stop circular updates.
  3901. if (has[id] != null) {
  3902. circular[id] = (circular[id] || 0) + 1;
  3903. if (circular[id] > MAX_UPDATE_COUNT) {
  3904. warn(
  3905. 'You may have an infinite update loop ' + (
  3906. watcher.user
  3907. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  3908. : "in a component render function."
  3909. ),
  3910. watcher.vm
  3911. );
  3912. break
  3913. }
  3914. }
  3915. }
  3916. // keep copies of post queues before resetting state
  3917. var activatedQueue = activatedChildren.slice();
  3918. var updatedQueue = queue.slice();
  3919. resetSchedulerState();
  3920. // call component updated and activated hooks
  3921. callActivatedHooks(activatedQueue);
  3922. callUpdatedHooks(updatedQueue);
  3923. // devtool hook
  3924. /* istanbul ignore if */
  3925. if (devtools && config.devtools) {
  3926. devtools.emit('flush');
  3927. }
  3928. }
  3929. function callUpdatedHooks (queue) {
  3930. var i = queue.length;
  3931. while (i--) {
  3932. var watcher = queue[i];
  3933. var vm = watcher.vm;
  3934. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  3935. callHook(vm, 'updated');
  3936. }
  3937. }
  3938. }
  3939. /**
  3940. * Queue a kept-alive component that was activated during patch.
  3941. * The queue will be processed after the entire tree has been patched.
  3942. */
  3943. function queueActivatedComponent (vm) {
  3944. // setting _inactive to false here so that a render function can
  3945. // rely on checking whether it's in an inactive tree (e.g. router-view)
  3946. vm._inactive = false;
  3947. activatedChildren.push(vm);
  3948. }
  3949. function callActivatedHooks (queue) {
  3950. for (var i = 0; i < queue.length; i++) {
  3951. queue[i]._inactive = true;
  3952. activateChildComponent(queue[i], true /* true */);
  3953. }
  3954. }
  3955. /**
  3956. * Push a watcher into the watcher queue.
  3957. * Jobs with duplicate IDs will be skipped unless it's
  3958. * pushed when the queue is being flushed.
  3959. */
  3960. function queueWatcher (watcher) {
  3961. var id = watcher.id;
  3962. if (has[id] == null) {
  3963. has[id] = true;
  3964. if (!flushing) {
  3965. queue.push(watcher);
  3966. } else {
  3967. // if already flushing, splice the watcher based on its id
  3968. // if already past its id, it will be run next immediately.
  3969. var i = queue.length - 1;
  3970. while (i > index && queue[i].id > watcher.id) {
  3971. i--;
  3972. }
  3973. queue.splice(i + 1, 0, watcher);
  3974. }
  3975. // queue the flush
  3976. if (!waiting) {
  3977. waiting = true;
  3978. if (!config.async) {
  3979. flushSchedulerQueue();
  3980. return
  3981. }
  3982. nextTick(flushSchedulerQueue);
  3983. }
  3984. }
  3985. }
  3986. /* */
  3987. var uid$2 = 0;
  3988. /**
  3989. * A watcher parses an expression, collects dependencies,
  3990. * and fires callback when the expression value changes.
  3991. * This is used for both the $watch() api and directives.
  3992. */
  3993. var Watcher = function Watcher (
  3994. vm,
  3995. expOrFn,
  3996. cb,
  3997. options,
  3998. isRenderWatcher
  3999. ) {
  4000. this.vm = vm;
  4001. if (isRenderWatcher) {
  4002. vm._watcher = this;
  4003. }
  4004. vm._watchers.push(this);
  4005. // options
  4006. if (options) {
  4007. this.deep = !!options.deep;
  4008. this.user = !!options.user;
  4009. this.lazy = !!options.lazy;
  4010. this.sync = !!options.sync;
  4011. this.before = options.before;
  4012. } else {
  4013. this.deep = this.user = this.lazy = this.sync = false;
  4014. }
  4015. this.cb = cb;
  4016. this.id = ++uid$2; // uid for batching
  4017. this.active = true;
  4018. this.dirty = this.lazy; // for lazy watchers
  4019. this.deps = [];
  4020. this.newDeps = [];
  4021. this.depIds = new _Set();
  4022. this.newDepIds = new _Set();
  4023. this.expression = expOrFn.toString();
  4024. // parse expression for getter
  4025. if (typeof expOrFn === 'function') {
  4026. this.getter = expOrFn;
  4027. } else {
  4028. this.getter = parsePath(expOrFn);
  4029. if (!this.getter) {
  4030. this.getter = noop;
  4031. warn(
  4032. "Failed watching path: \"" + expOrFn + "\" " +
  4033. 'Watcher only accepts simple dot-delimited paths. ' +
  4034. 'For full control, use a function instead.',
  4035. vm
  4036. );
  4037. }
  4038. }
  4039. this.value = this.lazy
  4040. ? undefined
  4041. : this.get();
  4042. };
  4043. /**
  4044. * Evaluate the getter, and re-collect dependencies.
  4045. */
  4046. Watcher.prototype.get = function get () {
  4047. pushTarget(this);
  4048. var value;
  4049. var vm = this.vm;
  4050. try {
  4051. value = this.getter.call(vm, vm);
  4052. } catch (e) {
  4053. if (this.user) {
  4054. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  4055. } else {
  4056. throw e
  4057. }
  4058. } finally {
  4059. // "touch" every property so they are all tracked as
  4060. // dependencies for deep watching
  4061. if (this.deep) {
  4062. traverse(value);
  4063. }
  4064. popTarget();
  4065. this.cleanupDeps();
  4066. }
  4067. return value
  4068. };
  4069. /**
  4070. * Add a dependency to this directive.
  4071. */
  4072. Watcher.prototype.addDep = function addDep (dep) {
  4073. var id = dep.id;
  4074. if (!this.newDepIds.has(id)) {
  4075. this.newDepIds.add(id);
  4076. this.newDeps.push(dep);
  4077. if (!this.depIds.has(id)) {
  4078. dep.addSub(this);
  4079. }
  4080. }
  4081. };
  4082. /**
  4083. * Clean up for dependency collection.
  4084. */
  4085. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  4086. var i = this.deps.length;
  4087. while (i--) {
  4088. var dep = this.deps[i];
  4089. if (!this.newDepIds.has(dep.id)) {
  4090. dep.removeSub(this);
  4091. }
  4092. }
  4093. var tmp = this.depIds;
  4094. this.depIds = this.newDepIds;
  4095. this.newDepIds = tmp;
  4096. this.newDepIds.clear();
  4097. tmp = this.deps;
  4098. this.deps = this.newDeps;
  4099. this.newDeps = tmp;
  4100. this.newDeps.length = 0;
  4101. };
  4102. /**
  4103. * Subscriber interface.
  4104. * Will be called when a dependency changes.
  4105. */
  4106. Watcher.prototype.update = function update () {
  4107. /* istanbul ignore else */
  4108. if (this.lazy) {
  4109. this.dirty = true;
  4110. } else if (this.sync) {
  4111. this.run();
  4112. } else {
  4113. queueWatcher(this);
  4114. }
  4115. };
  4116. /**
  4117. * Scheduler job interface.
  4118. * Will be called by the scheduler.
  4119. */
  4120. Watcher.prototype.run = function run () {
  4121. if (this.active) {
  4122. var value = this.get();
  4123. if (
  4124. value !== this.value ||
  4125. // Deep watchers and watchers on Object/Arrays should fire even
  4126. // when the value is the same, because the value may
  4127. // have mutated.
  4128. isObject(value) ||
  4129. this.deep
  4130. ) {
  4131. // set new value
  4132. var oldValue = this.value;
  4133. this.value = value;
  4134. if (this.user) {
  4135. try {
  4136. this.cb.call(this.vm, value, oldValue);
  4137. } catch (e) {
  4138. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  4139. }
  4140. } else {
  4141. this.cb.call(this.vm, value, oldValue);
  4142. }
  4143. }
  4144. }
  4145. };
  4146. /**
  4147. * Evaluate the value of the watcher.
  4148. * This only gets called for lazy watchers.
  4149. */
  4150. Watcher.prototype.evaluate = function evaluate () {
  4151. this.value = this.get();
  4152. this.dirty = false;
  4153. };
  4154. /**
  4155. * Depend on all deps collected by this watcher.
  4156. */
  4157. Watcher.prototype.depend = function depend () {
  4158. var i = this.deps.length;
  4159. while (i--) {
  4160. this.deps[i].depend();
  4161. }
  4162. };
  4163. /**
  4164. * Remove self from all dependencies' subscriber list.
  4165. */
  4166. Watcher.prototype.teardown = function teardown () {
  4167. if (this.active) {
  4168. // remove self from vm's watcher list
  4169. // this is a somewhat expensive operation so we skip it
  4170. // if the vm is being destroyed.
  4171. if (!this.vm._isBeingDestroyed) {
  4172. remove(this.vm._watchers, this);
  4173. }
  4174. var i = this.deps.length;
  4175. while (i--) {
  4176. this.deps[i].removeSub(this);
  4177. }
  4178. this.active = false;
  4179. }
  4180. };
  4181. /* */
  4182. var sharedPropertyDefinition = {
  4183. enumerable: true,
  4184. configurable: true,
  4185. get: noop,
  4186. set: noop
  4187. };
  4188. function proxy (target, sourceKey, key) {
  4189. sharedPropertyDefinition.get = function proxyGetter () {
  4190. return this[sourceKey][key]
  4191. };
  4192. sharedPropertyDefinition.set = function proxySetter (val) {
  4193. this[sourceKey][key] = val;
  4194. };
  4195. Object.defineProperty(target, key, sharedPropertyDefinition);
  4196. }
  4197. function initState (vm) {
  4198. vm._watchers = [];
  4199. var opts = vm.$options;
  4200. if (opts.props) { initProps(vm, opts.props); }
  4201. if (opts.methods) { initMethods(vm, opts.methods); }
  4202. if (opts.data) {
  4203. initData(vm);
  4204. } else {
  4205. observe(vm._data = {}, true /* asRootData */);
  4206. }
  4207. if (opts.computed) { initComputed(vm, opts.computed); }
  4208. if (opts.watch && opts.watch !== nativeWatch) {
  4209. initWatch(vm, opts.watch);
  4210. }
  4211. }
  4212. function initProps (vm, propsOptions) {
  4213. var propsData = vm.$options.propsData || {};
  4214. var props = vm._props = {};
  4215. // cache prop keys so that future props updates can iterate using Array
  4216. // instead of dynamic object key enumeration.
  4217. var keys = vm.$options._propKeys = [];
  4218. var isRoot = !vm.$parent;
  4219. // root instance props should be converted
  4220. if (!isRoot) {
  4221. toggleObserving(false);
  4222. }
  4223. var loop = function ( key ) {
  4224. keys.push(key);
  4225. var value = validateProp(key, propsOptions, propsData, vm);
  4226. /* istanbul ignore else */
  4227. {
  4228. var hyphenatedKey = hyphenate(key);
  4229. if (isReservedAttribute(hyphenatedKey) ||
  4230. config.isReservedAttr(hyphenatedKey)) {
  4231. warn(
  4232. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  4233. vm
  4234. );
  4235. }
  4236. defineReactive$$1(props, key, value, function () {
  4237. if (!isRoot && !isUpdatingChildComponent) {
  4238. warn(
  4239. "Avoid mutating a prop directly since the value will be " +
  4240. "overwritten whenever the parent component re-renders. " +
  4241. "Instead, use a data or computed property based on the prop's " +
  4242. "value. Prop being mutated: \"" + key + "\"",
  4243. vm
  4244. );
  4245. }
  4246. });
  4247. }
  4248. // static props are already proxied on the component's prototype
  4249. // during Vue.extend(). We only need to proxy props defined at
  4250. // instantiation here.
  4251. if (!(key in vm)) {
  4252. proxy(vm, "_props", key);
  4253. }
  4254. };
  4255. for (var key in propsOptions) loop( key );
  4256. toggleObserving(true);
  4257. }
  4258. function initData (vm) {
  4259. var data = vm.$options.data;
  4260. data = vm._data = typeof data === 'function'
  4261. ? getData(data, vm)
  4262. : data || {};
  4263. if (!isPlainObject(data)) {
  4264. data = {};
  4265. warn(
  4266. 'data functions should return an object:\n' +
  4267. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  4268. vm
  4269. );
  4270. }
  4271. // proxy data on instance
  4272. var keys = Object.keys(data);
  4273. var props = vm.$options.props;
  4274. var methods = vm.$options.methods;
  4275. var i = keys.length;
  4276. while (i--) {
  4277. var key = keys[i];
  4278. {
  4279. if (methods && hasOwn(methods, key)) {
  4280. warn(
  4281. ("Method \"" + key + "\" has already been defined as a data property."),
  4282. vm
  4283. );
  4284. }
  4285. }
  4286. if (props && hasOwn(props, key)) {
  4287. warn(
  4288. "The data property \"" + key + "\" is already declared as a prop. " +
  4289. "Use prop default value instead.",
  4290. vm
  4291. );
  4292. } else if (!isReserved(key)) {
  4293. proxy(vm, "_data", key);
  4294. }
  4295. }
  4296. // observe data
  4297. observe(data, true /* asRootData */);
  4298. }
  4299. function getData (data, vm) {
  4300. // #7573 disable dep collection when invoking data getters
  4301. pushTarget();
  4302. try {
  4303. return data.call(vm, vm)
  4304. } catch (e) {
  4305. handleError(e, vm, "data()");
  4306. return {}
  4307. } finally {
  4308. popTarget();
  4309. }
  4310. }
  4311. var computedWatcherOptions = { lazy: true };
  4312. function initComputed (vm, computed) {
  4313. // $flow-disable-line
  4314. var watchers = vm._computedWatchers = Object.create(null);
  4315. // computed properties are just getters during SSR
  4316. var isSSR = isServerRendering();
  4317. for (var key in computed) {
  4318. var userDef = computed[key];
  4319. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  4320. if (getter == null) {
  4321. warn(
  4322. ("Getter is missing for computed property \"" + key + "\"."),
  4323. vm
  4324. );
  4325. }
  4326. if (!isSSR) {
  4327. // create internal watcher for the computed property.
  4328. watchers[key] = new Watcher(
  4329. vm,
  4330. getter || noop,
  4331. noop,
  4332. computedWatcherOptions
  4333. );
  4334. }
  4335. // component-defined computed properties are already defined on the
  4336. // component prototype. We only need to define computed properties defined
  4337. // at instantiation here.
  4338. if (!(key in vm)) {
  4339. defineComputed(vm, key, userDef);
  4340. } else {
  4341. if (key in vm.$data) {
  4342. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  4343. } else if (vm.$options.props && key in vm.$options.props) {
  4344. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  4345. }
  4346. }
  4347. }
  4348. }
  4349. function defineComputed (
  4350. target,
  4351. key,
  4352. userDef
  4353. ) {
  4354. var shouldCache = !isServerRendering();
  4355. if (typeof userDef === 'function') {
  4356. sharedPropertyDefinition.get = shouldCache
  4357. ? createComputedGetter(key)
  4358. : createGetterInvoker(userDef);
  4359. sharedPropertyDefinition.set = noop;
  4360. } else {
  4361. sharedPropertyDefinition.get = userDef.get
  4362. ? shouldCache && userDef.cache !== false
  4363. ? createComputedGetter(key)
  4364. : createGetterInvoker(userDef.get)
  4365. : noop;
  4366. sharedPropertyDefinition.set = userDef.set || noop;
  4367. }
  4368. if (sharedPropertyDefinition.set === noop) {
  4369. sharedPropertyDefinition.set = function () {
  4370. warn(
  4371. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  4372. this
  4373. );
  4374. };
  4375. }
  4376. Object.defineProperty(target, key, sharedPropertyDefinition);
  4377. }
  4378. function createComputedGetter (key) {
  4379. return function computedGetter () {
  4380. var watcher = this._computedWatchers && this._computedWatchers[key];
  4381. if (watcher) {
  4382. if (watcher.dirty) {
  4383. watcher.evaluate();
  4384. }
  4385. if (Dep.target) {
  4386. watcher.depend();
  4387. }
  4388. return watcher.value
  4389. }
  4390. }
  4391. }
  4392. function createGetterInvoker(fn) {
  4393. return function computedGetter () {
  4394. return fn.call(this, this)
  4395. }
  4396. }
  4397. function initMethods (vm, methods) {
  4398. var props = vm.$options.props;
  4399. for (var key in methods) {
  4400. {
  4401. if (typeof methods[key] !== 'function') {
  4402. warn(
  4403. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  4404. "Did you reference the function correctly?",
  4405. vm
  4406. );
  4407. }
  4408. if (props && hasOwn(props, key)) {
  4409. warn(
  4410. ("Method \"" + key + "\" has already been defined as a prop."),
  4411. vm
  4412. );
  4413. }
  4414. if ((key in vm) && isReserved(key)) {
  4415. warn(
  4416. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  4417. "Avoid defining component methods that start with _ or $."
  4418. );
  4419. }
  4420. }
  4421. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  4422. }
  4423. }
  4424. function initWatch (vm, watch) {
  4425. for (var key in watch) {
  4426. var handler = watch[key];
  4427. if (Array.isArray(handler)) {
  4428. for (var i = 0; i < handler.length; i++) {
  4429. createWatcher(vm, key, handler[i]);
  4430. }
  4431. } else {
  4432. createWatcher(vm, key, handler);
  4433. }
  4434. }
  4435. }
  4436. function createWatcher (
  4437. vm,
  4438. expOrFn,
  4439. handler,
  4440. options
  4441. ) {
  4442. if (isPlainObject(handler)) {
  4443. options = handler;
  4444. handler = handler.handler;
  4445. }
  4446. if (typeof handler === 'string') {
  4447. handler = vm[handler];
  4448. }
  4449. return vm.$watch(expOrFn, handler, options)
  4450. }
  4451. function stateMixin (Vue) {
  4452. // flow somehow has problems with directly declared definition object
  4453. // when using Object.defineProperty, so we have to procedurally build up
  4454. // the object here.
  4455. var dataDef = {};
  4456. dataDef.get = function () { return this._data };
  4457. var propsDef = {};
  4458. propsDef.get = function () { return this._props };
  4459. {
  4460. dataDef.set = function () {
  4461. warn(
  4462. 'Avoid replacing instance root $data. ' +
  4463. 'Use nested data properties instead.',
  4464. this
  4465. );
  4466. };
  4467. propsDef.set = function () {
  4468. warn("$props is readonly.", this);
  4469. };
  4470. }
  4471. Object.defineProperty(Vue.prototype, '$data', dataDef);
  4472. Object.defineProperty(Vue.prototype, '$props', propsDef);
  4473. Vue.prototype.$set = set;
  4474. Vue.prototype.$delete = del;
  4475. Vue.prototype.$watch = function (
  4476. expOrFn,
  4477. cb,
  4478. options
  4479. ) {
  4480. var vm = this;
  4481. if (isPlainObject(cb)) {
  4482. return createWatcher(vm, expOrFn, cb, options)
  4483. }
  4484. options = options || {};
  4485. options.user = true;
  4486. var watcher = new Watcher(vm, expOrFn, cb, options);
  4487. if (options.immediate) {
  4488. try {
  4489. cb.call(vm, watcher.value);
  4490. } catch (error) {
  4491. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  4492. }
  4493. }
  4494. return function unwatchFn () {
  4495. watcher.teardown();
  4496. }
  4497. };
  4498. }
  4499. /* */
  4500. var uid$3 = 0;
  4501. function initMixin (Vue) {
  4502. Vue.prototype._init = function (options) {
  4503. var vm = this;
  4504. // a uid
  4505. vm._uid = uid$3++;
  4506. var startTag, endTag;
  4507. /* istanbul ignore if */
  4508. if (config.performance && mark) {
  4509. startTag = "vue-perf-start:" + (vm._uid);
  4510. endTag = "vue-perf-end:" + (vm._uid);
  4511. mark(startTag);
  4512. }
  4513. // a flag to avoid this being observed
  4514. vm._isVue = true;
  4515. // merge options
  4516. if (options && options._isComponent) {
  4517. // optimize internal component instantiation
  4518. // since dynamic options merging is pretty slow, and none of the
  4519. // internal component options needs special treatment.
  4520. initInternalComponent(vm, options);
  4521. } else {
  4522. vm.$options = mergeOptions(
  4523. resolveConstructorOptions(vm.constructor),
  4524. options || {},
  4525. vm
  4526. );
  4527. }
  4528. /* istanbul ignore else */
  4529. {
  4530. initProxy(vm);
  4531. }
  4532. // expose real self
  4533. vm._self = vm;
  4534. initLifecycle(vm);
  4535. initEvents(vm);
  4536. initRender(vm);
  4537. callHook(vm, 'beforeCreate');
  4538. initInjections(vm); // resolve injections before data/props
  4539. initState(vm);
  4540. initProvide(vm); // resolve provide after data/props
  4541. callHook(vm, 'created');
  4542. /* istanbul ignore if */
  4543. if (config.performance && mark) {
  4544. vm._name = formatComponentName(vm, false);
  4545. mark(endTag);
  4546. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  4547. }
  4548. if (vm.$options.el) {
  4549. vm.$mount(vm.$options.el);
  4550. }
  4551. };
  4552. }
  4553. function initInternalComponent (vm, options) {
  4554. var opts = vm.$options = Object.create(vm.constructor.options);
  4555. // doing this because it's faster than dynamic enumeration.
  4556. var parentVnode = options._parentVnode;
  4557. opts.parent = options.parent;
  4558. opts._parentVnode = parentVnode;
  4559. var vnodeComponentOptions = parentVnode.componentOptions;
  4560. opts.propsData = vnodeComponentOptions.propsData;
  4561. opts._parentListeners = vnodeComponentOptions.listeners;
  4562. opts._renderChildren = vnodeComponentOptions.children;
  4563. opts._componentTag = vnodeComponentOptions.tag;
  4564. if (options.render) {
  4565. opts.render = options.render;
  4566. opts.staticRenderFns = options.staticRenderFns;
  4567. }
  4568. }
  4569. function resolveConstructorOptions (Ctor) {
  4570. var options = Ctor.options;
  4571. if (Ctor.super) {
  4572. var superOptions = resolveConstructorOptions(Ctor.super);
  4573. var cachedSuperOptions = Ctor.superOptions;
  4574. if (superOptions !== cachedSuperOptions) {
  4575. // super option changed,
  4576. // need to resolve new options.
  4577. Ctor.superOptions = superOptions;
  4578. // check if there are any late-modified/attached options (#4976)
  4579. var modifiedOptions = resolveModifiedOptions(Ctor);
  4580. // update base extend options
  4581. if (modifiedOptions) {
  4582. extend(Ctor.extendOptions, modifiedOptions);
  4583. }
  4584. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4585. if (options.name) {
  4586. options.components[options.name] = Ctor;
  4587. }
  4588. }
  4589. }
  4590. return options
  4591. }
  4592. function resolveModifiedOptions (Ctor) {
  4593. var modified;
  4594. var latest = Ctor.options;
  4595. var sealed = Ctor.sealedOptions;
  4596. for (var key in latest) {
  4597. if (latest[key] !== sealed[key]) {
  4598. if (!modified) { modified = {}; }
  4599. modified[key] = latest[key];
  4600. }
  4601. }
  4602. return modified
  4603. }
  4604. function Vue (options) {
  4605. if (!(this instanceof Vue)
  4606. ) {
  4607. warn('Vue is a constructor and should be called with the `new` keyword');
  4608. }
  4609. this._init(options);
  4610. }
  4611. initMixin(Vue);
  4612. stateMixin(Vue);
  4613. eventsMixin(Vue);
  4614. lifecycleMixin(Vue);
  4615. renderMixin(Vue);
  4616. /* */
  4617. function initUse (Vue) {
  4618. Vue.use = function (plugin) {
  4619. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  4620. if (installedPlugins.indexOf(plugin) > -1) {
  4621. return this
  4622. }
  4623. // additional parameters
  4624. var args = toArray(arguments, 1);
  4625. args.unshift(this);
  4626. if (typeof plugin.install === 'function') {
  4627. plugin.install.apply(plugin, args);
  4628. } else if (typeof plugin === 'function') {
  4629. plugin.apply(null, args);
  4630. }
  4631. installedPlugins.push(plugin);
  4632. return this
  4633. };
  4634. }
  4635. /* */
  4636. function initMixin$1 (Vue) {
  4637. Vue.mixin = function (mixin) {
  4638. this.options = mergeOptions(this.options, mixin);
  4639. return this
  4640. };
  4641. }
  4642. /* */
  4643. function initExtend (Vue) {
  4644. /**
  4645. * Each instance constructor, including Vue, has a unique
  4646. * cid. This enables us to create wrapped "child
  4647. * constructors" for prototypal inheritance and cache them.
  4648. */
  4649. Vue.cid = 0;
  4650. var cid = 1;
  4651. /**
  4652. * Class inheritance
  4653. */
  4654. Vue.extend = function (extendOptions) {
  4655. extendOptions = extendOptions || {};
  4656. var Super = this;
  4657. var SuperId = Super.cid;
  4658. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  4659. if (cachedCtors[SuperId]) {
  4660. return cachedCtors[SuperId]
  4661. }
  4662. var name = extendOptions.name || Super.options.name;
  4663. if (name) {
  4664. validateComponentName(name);
  4665. }
  4666. var Sub = function VueComponent (options) {
  4667. this._init(options);
  4668. };
  4669. Sub.prototype = Object.create(Super.prototype);
  4670. Sub.prototype.constructor = Sub;
  4671. Sub.cid = cid++;
  4672. Sub.options = mergeOptions(
  4673. Super.options,
  4674. extendOptions
  4675. );
  4676. Sub['super'] = Super;
  4677. // For props and computed properties, we define the proxy getters on
  4678. // the Vue instances at extension time, on the extended prototype. This
  4679. // avoids Object.defineProperty calls for each instance created.
  4680. if (Sub.options.props) {
  4681. initProps$1(Sub);
  4682. }
  4683. if (Sub.options.computed) {
  4684. initComputed$1(Sub);
  4685. }
  4686. // allow further extension/mixin/plugin usage
  4687. Sub.extend = Super.extend;
  4688. Sub.mixin = Super.mixin;
  4689. Sub.use = Super.use;
  4690. // create asset registers, so extended classes
  4691. // can have their private assets too.
  4692. ASSET_TYPES.forEach(function (type) {
  4693. Sub[type] = Super[type];
  4694. });
  4695. // enable recursive self-lookup
  4696. if (name) {
  4697. Sub.options.components[name] = Sub;
  4698. }
  4699. // keep a reference to the super options at extension time.
  4700. // later at instantiation we can check if Super's options have
  4701. // been updated.
  4702. Sub.superOptions = Super.options;
  4703. Sub.extendOptions = extendOptions;
  4704. Sub.sealedOptions = extend({}, Sub.options);
  4705. // cache constructor
  4706. cachedCtors[SuperId] = Sub;
  4707. return Sub
  4708. };
  4709. }
  4710. function initProps$1 (Comp) {
  4711. var props = Comp.options.props;
  4712. for (var key in props) {
  4713. proxy(Comp.prototype, "_props", key);
  4714. }
  4715. }
  4716. function initComputed$1 (Comp) {
  4717. var computed = Comp.options.computed;
  4718. for (var key in computed) {
  4719. defineComputed(Comp.prototype, key, computed[key]);
  4720. }
  4721. }
  4722. /* */
  4723. function initAssetRegisters (Vue) {
  4724. /**
  4725. * Create asset registration methods.
  4726. */
  4727. ASSET_TYPES.forEach(function (type) {
  4728. Vue[type] = function (
  4729. id,
  4730. definition
  4731. ) {
  4732. if (!definition) {
  4733. return this.options[type + 's'][id]
  4734. } else {
  4735. /* istanbul ignore if */
  4736. if (type === 'component') {
  4737. validateComponentName(id);
  4738. }
  4739. if (type === 'component' && isPlainObject(definition)) {
  4740. definition.name = definition.name || id;
  4741. definition = this.options._base.extend(definition);
  4742. }
  4743. if (type === 'directive' && typeof definition === 'function') {
  4744. definition = { bind: definition, update: definition };
  4745. }
  4746. this.options[type + 's'][id] = definition;
  4747. return definition
  4748. }
  4749. };
  4750. });
  4751. }
  4752. /* */
  4753. function getComponentName (opts) {
  4754. return opts && (opts.Ctor.options.name || opts.tag)
  4755. }
  4756. function matches (pattern, name) {
  4757. if (Array.isArray(pattern)) {
  4758. return pattern.indexOf(name) > -1
  4759. } else if (typeof pattern === 'string') {
  4760. return pattern.split(',').indexOf(name) > -1
  4761. } else if (isRegExp(pattern)) {
  4762. return pattern.test(name)
  4763. }
  4764. /* istanbul ignore next */
  4765. return false
  4766. }
  4767. function pruneCache (keepAliveInstance, filter) {
  4768. var cache = keepAliveInstance.cache;
  4769. var keys = keepAliveInstance.keys;
  4770. var _vnode = keepAliveInstance._vnode;
  4771. for (var key in cache) {
  4772. var cachedNode = cache[key];
  4773. if (cachedNode) {
  4774. var name = getComponentName(cachedNode.componentOptions);
  4775. if (name && !filter(name)) {
  4776. pruneCacheEntry(cache, key, keys, _vnode);
  4777. }
  4778. }
  4779. }
  4780. }
  4781. function pruneCacheEntry (
  4782. cache,
  4783. key,
  4784. keys,
  4785. current
  4786. ) {
  4787. var cached$$1 = cache[key];
  4788. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  4789. cached$$1.componentInstance.$destroy();
  4790. }
  4791. cache[key] = null;
  4792. remove(keys, key);
  4793. }
  4794. var patternTypes = [String, RegExp, Array];
  4795. var KeepAlive = {
  4796. name: 'keep-alive',
  4797. abstract: true,
  4798. props: {
  4799. include: patternTypes,
  4800. exclude: patternTypes,
  4801. max: [String, Number]
  4802. },
  4803. created: function created () {
  4804. this.cache = Object.create(null);
  4805. this.keys = [];
  4806. },
  4807. destroyed: function destroyed () {
  4808. for (var key in this.cache) {
  4809. pruneCacheEntry(this.cache, key, this.keys);
  4810. }
  4811. },
  4812. mounted: function mounted () {
  4813. var this$1 = this;
  4814. this.$watch('include', function (val) {
  4815. pruneCache(this$1, function (name) { return matches(val, name); });
  4816. });
  4817. this.$watch('exclude', function (val) {
  4818. pruneCache(this$1, function (name) { return !matches(val, name); });
  4819. });
  4820. },
  4821. render: function render () {
  4822. var slot = this.$slots.default;
  4823. var vnode = getFirstComponentChild(slot);
  4824. var componentOptions = vnode && vnode.componentOptions;
  4825. if (componentOptions) {
  4826. // check pattern
  4827. var name = getComponentName(componentOptions);
  4828. var ref = this;
  4829. var include = ref.include;
  4830. var exclude = ref.exclude;
  4831. if (
  4832. // not included
  4833. (include && (!name || !matches(include, name))) ||
  4834. // excluded
  4835. (exclude && name && matches(exclude, name))
  4836. ) {
  4837. return vnode
  4838. }
  4839. var ref$1 = this;
  4840. var cache = ref$1.cache;
  4841. var keys = ref$1.keys;
  4842. var key = vnode.key == null
  4843. // same constructor may get registered as different local components
  4844. // so cid alone is not enough (#3269)
  4845. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  4846. : vnode.key;
  4847. if (cache[key]) {
  4848. vnode.componentInstance = cache[key].componentInstance;
  4849. // make current key freshest
  4850. remove(keys, key);
  4851. keys.push(key);
  4852. } else {
  4853. cache[key] = vnode;
  4854. keys.push(key);
  4855. // prune oldest entry
  4856. if (this.max && keys.length > parseInt(this.max)) {
  4857. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  4858. }
  4859. }
  4860. vnode.data.keepAlive = true;
  4861. }
  4862. return vnode || (slot && slot[0])
  4863. }
  4864. };
  4865. var builtInComponents = {
  4866. KeepAlive: KeepAlive
  4867. };
  4868. /* */
  4869. function initGlobalAPI (Vue) {
  4870. // config
  4871. var configDef = {};
  4872. configDef.get = function () { return config; };
  4873. {
  4874. configDef.set = function () {
  4875. warn(
  4876. 'Do not replace the Vue.config object, set individual fields instead.'
  4877. );
  4878. };
  4879. }
  4880. Object.defineProperty(Vue, 'config', configDef);
  4881. // exposed util methods.
  4882. // NOTE: these are not considered part of the public API - avoid relying on
  4883. // them unless you are aware of the risk.
  4884. Vue.util = {
  4885. warn: warn,
  4886. extend: extend,
  4887. mergeOptions: mergeOptions,
  4888. defineReactive: defineReactive$$1
  4889. };
  4890. Vue.set = set;
  4891. Vue.delete = del;
  4892. Vue.nextTick = nextTick;
  4893. // 2.6 explicit observable API
  4894. Vue.observable = function (obj) {
  4895. observe(obj);
  4896. return obj
  4897. };
  4898. Vue.options = Object.create(null);
  4899. ASSET_TYPES.forEach(function (type) {
  4900. Vue.options[type + 's'] = Object.create(null);
  4901. });
  4902. // this is used to identify the "base" constructor to extend all plain-object
  4903. // components with in Weex's multi-instance scenarios.
  4904. Vue.options._base = Vue;
  4905. extend(Vue.options.components, builtInComponents);
  4906. initUse(Vue);
  4907. initMixin$1(Vue);
  4908. initExtend(Vue);
  4909. initAssetRegisters(Vue);
  4910. }
  4911. initGlobalAPI(Vue);
  4912. Object.defineProperty(Vue.prototype, '$isServer', {
  4913. get: isServerRendering
  4914. });
  4915. Object.defineProperty(Vue.prototype, '$ssrContext', {
  4916. get: function get () {
  4917. /* istanbul ignore next */
  4918. return this.$vnode && this.$vnode.ssrContext
  4919. }
  4920. });
  4921. // expose FunctionalRenderContext for ssr runtime helper installation
  4922. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  4923. value: FunctionalRenderContext
  4924. });
  4925. Vue.version = '2.6.10';
  4926. /* */
  4927. // these are reserved for web because they are directly compiled away
  4928. // during template compilation
  4929. var isReservedAttr = makeMap('style,class');
  4930. // attributes that should be using props for binding
  4931. var acceptValue = makeMap('input,textarea,option,select,progress');
  4932. var mustUseProp = function (tag, type, attr) {
  4933. return (
  4934. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  4935. (attr === 'selected' && tag === 'option') ||
  4936. (attr === 'checked' && tag === 'input') ||
  4937. (attr === 'muted' && tag === 'video')
  4938. )
  4939. };
  4940. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  4941. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  4942. var convertEnumeratedValue = function (key, value) {
  4943. return isFalsyAttrValue(value) || value === 'false'
  4944. ? 'false'
  4945. // allow arbitrary string value for contenteditable
  4946. : key === 'contenteditable' && isValidContentEditableValue(value)
  4947. ? value
  4948. : 'true'
  4949. };
  4950. var isBooleanAttr = makeMap(
  4951. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  4952. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  4953. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  4954. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  4955. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  4956. 'truespeed,typemustmatch,visible'
  4957. );
  4958. var xlinkNS = 'http://www.w3.org/1999/xlink';
  4959. var isXlink = function (name) {
  4960. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  4961. };
  4962. var getXlinkProp = function (name) {
  4963. return isXlink(name) ? name.slice(6, name.length) : ''
  4964. };
  4965. var isFalsyAttrValue = function (val) {
  4966. return val == null || val === false
  4967. };
  4968. /* */
  4969. function genClassForVnode (vnode) {
  4970. var data = vnode.data;
  4971. var parentNode = vnode;
  4972. var childNode = vnode;
  4973. while (isDef(childNode.componentInstance)) {
  4974. childNode = childNode.componentInstance._vnode;
  4975. if (childNode && childNode.data) {
  4976. data = mergeClassData(childNode.data, data);
  4977. }
  4978. }
  4979. while (isDef(parentNode = parentNode.parent)) {
  4980. if (parentNode && parentNode.data) {
  4981. data = mergeClassData(data, parentNode.data);
  4982. }
  4983. }
  4984. return renderClass(data.staticClass, data.class)
  4985. }
  4986. function mergeClassData (child, parent) {
  4987. return {
  4988. staticClass: concat(child.staticClass, parent.staticClass),
  4989. class: isDef(child.class)
  4990. ? [child.class, parent.class]
  4991. : parent.class
  4992. }
  4993. }
  4994. function renderClass (
  4995. staticClass,
  4996. dynamicClass
  4997. ) {
  4998. if (isDef(staticClass) || isDef(dynamicClass)) {
  4999. return concat(staticClass, stringifyClass(dynamicClass))
  5000. }
  5001. /* istanbul ignore next */
  5002. return ''
  5003. }
  5004. function concat (a, b) {
  5005. return a ? b ? (a + ' ' + b) : a : (b || '')
  5006. }
  5007. function stringifyClass (value) {
  5008. if (Array.isArray(value)) {
  5009. return stringifyArray(value)
  5010. }
  5011. if (isObject(value)) {
  5012. return stringifyObject(value)
  5013. }
  5014. if (typeof value === 'string') {
  5015. return value
  5016. }
  5017. /* istanbul ignore next */
  5018. return ''
  5019. }
  5020. function stringifyArray (value) {
  5021. var res = '';
  5022. var stringified;
  5023. for (var i = 0, l = value.length; i < l; i++) {
  5024. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  5025. if (res) { res += ' '; }
  5026. res += stringified;
  5027. }
  5028. }
  5029. return res
  5030. }
  5031. function stringifyObject (value) {
  5032. var res = '';
  5033. for (var key in value) {
  5034. if (value[key]) {
  5035. if (res) { res += ' '; }
  5036. res += key;
  5037. }
  5038. }
  5039. return res
  5040. }
  5041. /* */
  5042. var namespaceMap = {
  5043. svg: 'http://www.w3.org/2000/svg',
  5044. math: 'http://www.w3.org/1998/Math/MathML'
  5045. };
  5046. var isHTMLTag = makeMap(
  5047. 'html,body,base,head,link,meta,style,title,' +
  5048. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  5049. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  5050. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  5051. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  5052. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  5053. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  5054. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  5055. 'output,progress,select,textarea,' +
  5056. 'details,dialog,menu,menuitem,summary,' +
  5057. 'content,element,shadow,template,blockquote,iframe,tfoot'
  5058. );
  5059. // this map is intentionally selective, only covering SVG elements that may
  5060. // contain child elements.
  5061. var isSVG = makeMap(
  5062. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  5063. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  5064. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  5065. true
  5066. );
  5067. var isPreTag = function (tag) { return tag === 'pre'; };
  5068. var isReservedTag = function (tag) {
  5069. return isHTMLTag(tag) || isSVG(tag)
  5070. };
  5071. function getTagNamespace (tag) {
  5072. if (isSVG(tag)) {
  5073. return 'svg'
  5074. }
  5075. // basic support for MathML
  5076. // note it doesn't support other MathML elements being component roots
  5077. if (tag === 'math') {
  5078. return 'math'
  5079. }
  5080. }
  5081. var unknownElementCache = Object.create(null);
  5082. function isUnknownElement (tag) {
  5083. /* istanbul ignore if */
  5084. if (!inBrowser) {
  5085. return true
  5086. }
  5087. if (isReservedTag(tag)) {
  5088. return false
  5089. }
  5090. tag = tag.toLowerCase();
  5091. /* istanbul ignore if */
  5092. if (unknownElementCache[tag] != null) {
  5093. return unknownElementCache[tag]
  5094. }
  5095. var el = document.createElement(tag);
  5096. if (tag.indexOf('-') > -1) {
  5097. // http://stackoverflow.com/a/28210364/1070244
  5098. return (unknownElementCache[tag] = (
  5099. el.constructor === window.HTMLUnknownElement ||
  5100. el.constructor === window.HTMLElement
  5101. ))
  5102. } else {
  5103. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  5104. }
  5105. }
  5106. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  5107. /* */
  5108. /**
  5109. * Query an element selector if it's not an element already.
  5110. */
  5111. function query (el) {
  5112. if (typeof el === 'string') {
  5113. var selected = document.querySelector(el);
  5114. if (!selected) {
  5115. warn(
  5116. 'Cannot find element: ' + el
  5117. );
  5118. return document.createElement('div')
  5119. }
  5120. return selected
  5121. } else {
  5122. return el
  5123. }
  5124. }
  5125. /* */
  5126. function createElement$1 (tagName, vnode) {
  5127. var elm = document.createElement(tagName);
  5128. if (tagName !== 'select') {
  5129. return elm
  5130. }
  5131. // false or null will remove the attribute but undefined will not
  5132. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  5133. elm.setAttribute('multiple', 'multiple');
  5134. }
  5135. return elm
  5136. }
  5137. function createElementNS (namespace, tagName) {
  5138. return document.createElementNS(namespaceMap[namespace], tagName)
  5139. }
  5140. function createTextNode (text) {
  5141. return document.createTextNode(text)
  5142. }
  5143. function createComment (text) {
  5144. return document.createComment(text)
  5145. }
  5146. function insertBefore (parentNode, newNode, referenceNode) {
  5147. parentNode.insertBefore(newNode, referenceNode);
  5148. }
  5149. function removeChild (node, child) {
  5150. node.removeChild(child);
  5151. }
  5152. function appendChild (node, child) {
  5153. node.appendChild(child);
  5154. }
  5155. function parentNode (node) {
  5156. return node.parentNode
  5157. }
  5158. function nextSibling (node) {
  5159. return node.nextSibling
  5160. }
  5161. function tagName (node) {
  5162. return node.tagName
  5163. }
  5164. function setTextContent (node, text) {
  5165. node.textContent = text;
  5166. }
  5167. function setStyleScope (node, scopeId) {
  5168. node.setAttribute(scopeId, '');
  5169. }
  5170. var nodeOps = /*#__PURE__*/Object.freeze({
  5171. createElement: createElement$1,
  5172. createElementNS: createElementNS,
  5173. createTextNode: createTextNode,
  5174. createComment: createComment,
  5175. insertBefore: insertBefore,
  5176. removeChild: removeChild,
  5177. appendChild: appendChild,
  5178. parentNode: parentNode,
  5179. nextSibling: nextSibling,
  5180. tagName: tagName,
  5181. setTextContent: setTextContent,
  5182. setStyleScope: setStyleScope
  5183. });
  5184. /* */
  5185. var ref = {
  5186. create: function create (_, vnode) {
  5187. registerRef(vnode);
  5188. },
  5189. update: function update (oldVnode, vnode) {
  5190. if (oldVnode.data.ref !== vnode.data.ref) {
  5191. registerRef(oldVnode, true);
  5192. registerRef(vnode);
  5193. }
  5194. },
  5195. destroy: function destroy (vnode) {
  5196. registerRef(vnode, true);
  5197. }
  5198. };
  5199. function registerRef (vnode, isRemoval) {
  5200. var key = vnode.data.ref;
  5201. if (!isDef(key)) { return }
  5202. var vm = vnode.context;
  5203. var ref = vnode.componentInstance || vnode.elm;
  5204. var refs = vm.$refs;
  5205. if (isRemoval) {
  5206. if (Array.isArray(refs[key])) {
  5207. remove(refs[key], ref);
  5208. } else if (refs[key] === ref) {
  5209. refs[key] = undefined;
  5210. }
  5211. } else {
  5212. if (vnode.data.refInFor) {
  5213. if (!Array.isArray(refs[key])) {
  5214. refs[key] = [ref];
  5215. } else if (refs[key].indexOf(ref) < 0) {
  5216. // $flow-disable-line
  5217. refs[key].push(ref);
  5218. }
  5219. } else {
  5220. refs[key] = ref;
  5221. }
  5222. }
  5223. }
  5224. /**
  5225. * Virtual DOM patching algorithm based on Snabbdom by
  5226. * Simon Friis Vindum (@paldepind)
  5227. * Licensed under the MIT License
  5228. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  5229. *
  5230. * modified by Evan You (@yyx990803)
  5231. *
  5232. * Not type-checking this because this file is perf-critical and the cost
  5233. * of making flow understand it is not worth it.
  5234. */
  5235. var emptyNode = new VNode('', {}, []);
  5236. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  5237. function sameVnode (a, b) {
  5238. return (
  5239. a.key === b.key && (
  5240. (
  5241. a.tag === b.tag &&
  5242. a.isComment === b.isComment &&
  5243. isDef(a.data) === isDef(b.data) &&
  5244. sameInputType(a, b)
  5245. ) || (
  5246. isTrue(a.isAsyncPlaceholder) &&
  5247. a.asyncFactory === b.asyncFactory &&
  5248. isUndef(b.asyncFactory.error)
  5249. )
  5250. )
  5251. )
  5252. }
  5253. function sameInputType (a, b) {
  5254. if (a.tag !== 'input') { return true }
  5255. var i;
  5256. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  5257. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  5258. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  5259. }
  5260. function createKeyToOldIdx (children, beginIdx, endIdx) {
  5261. var i, key;
  5262. var map = {};
  5263. for (i = beginIdx; i <= endIdx; ++i) {
  5264. key = children[i].key;
  5265. if (isDef(key)) { map[key] = i; }
  5266. }
  5267. return map
  5268. }
  5269. function createPatchFunction (backend) {
  5270. var i, j;
  5271. var cbs = {};
  5272. var modules = backend.modules;
  5273. var nodeOps = backend.nodeOps;
  5274. for (i = 0; i < hooks.length; ++i) {
  5275. cbs[hooks[i]] = [];
  5276. for (j = 0; j < modules.length; ++j) {
  5277. if (isDef(modules[j][hooks[i]])) {
  5278. cbs[hooks[i]].push(modules[j][hooks[i]]);
  5279. }
  5280. }
  5281. }
  5282. function emptyNodeAt (elm) {
  5283. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  5284. }
  5285. function createRmCb (childElm, listeners) {
  5286. function remove$$1 () {
  5287. if (--remove$$1.listeners === 0) {
  5288. removeNode(childElm);
  5289. }
  5290. }
  5291. remove$$1.listeners = listeners;
  5292. return remove$$1
  5293. }
  5294. function removeNode (el) {
  5295. var parent = nodeOps.parentNode(el);
  5296. // element may have already been removed due to v-html / v-text
  5297. if (isDef(parent)) {
  5298. nodeOps.removeChild(parent, el);
  5299. }
  5300. }
  5301. function isUnknownElement$$1 (vnode, inVPre) {
  5302. return (
  5303. !inVPre &&
  5304. !vnode.ns &&
  5305. !(
  5306. config.ignoredElements.length &&
  5307. config.ignoredElements.some(function (ignore) {
  5308. return isRegExp(ignore)
  5309. ? ignore.test(vnode.tag)
  5310. : ignore === vnode.tag
  5311. })
  5312. ) &&
  5313. config.isUnknownElement(vnode.tag)
  5314. )
  5315. }
  5316. var creatingElmInVPre = 0;
  5317. function createElm (
  5318. vnode,
  5319. insertedVnodeQueue,
  5320. parentElm,
  5321. refElm,
  5322. nested,
  5323. ownerArray,
  5324. index
  5325. ) {
  5326. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5327. // This vnode was used in a previous render!
  5328. // now it's used as a new node, overwriting its elm would cause
  5329. // potential patch errors down the road when it's used as an insertion
  5330. // reference node. Instead, we clone the node on-demand before creating
  5331. // associated DOM element for it.
  5332. vnode = ownerArray[index] = cloneVNode(vnode);
  5333. }
  5334. vnode.isRootInsert = !nested; // for transition enter check
  5335. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  5336. return
  5337. }
  5338. var data = vnode.data;
  5339. var children = vnode.children;
  5340. var tag = vnode.tag;
  5341. if (isDef(tag)) {
  5342. {
  5343. if (data && data.pre) {
  5344. creatingElmInVPre++;
  5345. }
  5346. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  5347. warn(
  5348. 'Unknown custom element: <' + tag + '> - did you ' +
  5349. 'register the component correctly? For recursive components, ' +
  5350. 'make sure to provide the "name" option.',
  5351. vnode.context
  5352. );
  5353. }
  5354. }
  5355. vnode.elm = vnode.ns
  5356. ? nodeOps.createElementNS(vnode.ns, tag)
  5357. : nodeOps.createElement(tag, vnode);
  5358. setScope(vnode);
  5359. /* istanbul ignore if */
  5360. {
  5361. createChildren(vnode, children, insertedVnodeQueue);
  5362. if (isDef(data)) {
  5363. invokeCreateHooks(vnode, insertedVnodeQueue);
  5364. }
  5365. insert(parentElm, vnode.elm, refElm);
  5366. }
  5367. if (data && data.pre) {
  5368. creatingElmInVPre--;
  5369. }
  5370. } else if (isTrue(vnode.isComment)) {
  5371. vnode.elm = nodeOps.createComment(vnode.text);
  5372. insert(parentElm, vnode.elm, refElm);
  5373. } else {
  5374. vnode.elm = nodeOps.createTextNode(vnode.text);
  5375. insert(parentElm, vnode.elm, refElm);
  5376. }
  5377. }
  5378. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5379. var i = vnode.data;
  5380. if (isDef(i)) {
  5381. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  5382. if (isDef(i = i.hook) && isDef(i = i.init)) {
  5383. i(vnode, false /* hydrating */);
  5384. }
  5385. // after calling the init hook, if the vnode is a child component
  5386. // it should've created a child instance and mounted it. the child
  5387. // component also has set the placeholder vnode's elm.
  5388. // in that case we can just return the element and be done.
  5389. if (isDef(vnode.componentInstance)) {
  5390. initComponent(vnode, insertedVnodeQueue);
  5391. insert(parentElm, vnode.elm, refElm);
  5392. if (isTrue(isReactivated)) {
  5393. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  5394. }
  5395. return true
  5396. }
  5397. }
  5398. }
  5399. function initComponent (vnode, insertedVnodeQueue) {
  5400. if (isDef(vnode.data.pendingInsert)) {
  5401. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  5402. vnode.data.pendingInsert = null;
  5403. }
  5404. vnode.elm = vnode.componentInstance.$el;
  5405. if (isPatchable(vnode)) {
  5406. invokeCreateHooks(vnode, insertedVnodeQueue);
  5407. setScope(vnode);
  5408. } else {
  5409. // empty component root.
  5410. // skip all element-related modules except for ref (#3455)
  5411. registerRef(vnode);
  5412. // make sure to invoke the insert hook
  5413. insertedVnodeQueue.push(vnode);
  5414. }
  5415. }
  5416. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5417. var i;
  5418. // hack for #4339: a reactivated component with inner transition
  5419. // does not trigger because the inner node's created hooks are not called
  5420. // again. It's not ideal to involve module-specific logic in here but
  5421. // there doesn't seem to be a better way to do it.
  5422. var innerNode = vnode;
  5423. while (innerNode.componentInstance) {
  5424. innerNode = innerNode.componentInstance._vnode;
  5425. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  5426. for (i = 0; i < cbs.activate.length; ++i) {
  5427. cbs.activate[i](emptyNode, innerNode);
  5428. }
  5429. insertedVnodeQueue.push(innerNode);
  5430. break
  5431. }
  5432. }
  5433. // unlike a newly created component,
  5434. // a reactivated keep-alive component doesn't insert itself
  5435. insert(parentElm, vnode.elm, refElm);
  5436. }
  5437. function insert (parent, elm, ref$$1) {
  5438. if (isDef(parent)) {
  5439. if (isDef(ref$$1)) {
  5440. if (nodeOps.parentNode(ref$$1) === parent) {
  5441. nodeOps.insertBefore(parent, elm, ref$$1);
  5442. }
  5443. } else {
  5444. nodeOps.appendChild(parent, elm);
  5445. }
  5446. }
  5447. }
  5448. function createChildren (vnode, children, insertedVnodeQueue) {
  5449. if (Array.isArray(children)) {
  5450. {
  5451. checkDuplicateKeys(children);
  5452. }
  5453. for (var i = 0; i < children.length; ++i) {
  5454. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  5455. }
  5456. } else if (isPrimitive(vnode.text)) {
  5457. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  5458. }
  5459. }
  5460. function isPatchable (vnode) {
  5461. while (vnode.componentInstance) {
  5462. vnode = vnode.componentInstance._vnode;
  5463. }
  5464. return isDef(vnode.tag)
  5465. }
  5466. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  5467. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5468. cbs.create[i$1](emptyNode, vnode);
  5469. }
  5470. i = vnode.data.hook; // Reuse variable
  5471. if (isDef(i)) {
  5472. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  5473. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  5474. }
  5475. }
  5476. // set scope id attribute for scoped CSS.
  5477. // this is implemented as a special case to avoid the overhead
  5478. // of going through the normal attribute patching process.
  5479. function setScope (vnode) {
  5480. var i;
  5481. if (isDef(i = vnode.fnScopeId)) {
  5482. nodeOps.setStyleScope(vnode.elm, i);
  5483. } else {
  5484. var ancestor = vnode;
  5485. while (ancestor) {
  5486. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  5487. nodeOps.setStyleScope(vnode.elm, i);
  5488. }
  5489. ancestor = ancestor.parent;
  5490. }
  5491. }
  5492. // for slot content they should also get the scopeId from the host instance.
  5493. if (isDef(i = activeInstance) &&
  5494. i !== vnode.context &&
  5495. i !== vnode.fnContext &&
  5496. isDef(i = i.$options._scopeId)
  5497. ) {
  5498. nodeOps.setStyleScope(vnode.elm, i);
  5499. }
  5500. }
  5501. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  5502. for (; startIdx <= endIdx; ++startIdx) {
  5503. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  5504. }
  5505. }
  5506. function invokeDestroyHook (vnode) {
  5507. var i, j;
  5508. var data = vnode.data;
  5509. if (isDef(data)) {
  5510. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  5511. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  5512. }
  5513. if (isDef(i = vnode.children)) {
  5514. for (j = 0; j < vnode.children.length; ++j) {
  5515. invokeDestroyHook(vnode.children[j]);
  5516. }
  5517. }
  5518. }
  5519. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  5520. for (; startIdx <= endIdx; ++startIdx) {
  5521. var ch = vnodes[startIdx];
  5522. if (isDef(ch)) {
  5523. if (isDef(ch.tag)) {
  5524. removeAndInvokeRemoveHook(ch);
  5525. invokeDestroyHook(ch);
  5526. } else { // Text node
  5527. removeNode(ch.elm);
  5528. }
  5529. }
  5530. }
  5531. }
  5532. function removeAndInvokeRemoveHook (vnode, rm) {
  5533. if (isDef(rm) || isDef(vnode.data)) {
  5534. var i;
  5535. var listeners = cbs.remove.length + 1;
  5536. if (isDef(rm)) {
  5537. // we have a recursively passed down rm callback
  5538. // increase the listeners count
  5539. rm.listeners += listeners;
  5540. } else {
  5541. // directly removing
  5542. rm = createRmCb(vnode.elm, listeners);
  5543. }
  5544. // recursively invoke hooks on child component root node
  5545. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  5546. removeAndInvokeRemoveHook(i, rm);
  5547. }
  5548. for (i = 0; i < cbs.remove.length; ++i) {
  5549. cbs.remove[i](vnode, rm);
  5550. }
  5551. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  5552. i(vnode, rm);
  5553. } else {
  5554. rm();
  5555. }
  5556. } else {
  5557. removeNode(vnode.elm);
  5558. }
  5559. }
  5560. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  5561. var oldStartIdx = 0;
  5562. var newStartIdx = 0;
  5563. var oldEndIdx = oldCh.length - 1;
  5564. var oldStartVnode = oldCh[0];
  5565. var oldEndVnode = oldCh[oldEndIdx];
  5566. var newEndIdx = newCh.length - 1;
  5567. var newStartVnode = newCh[0];
  5568. var newEndVnode = newCh[newEndIdx];
  5569. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  5570. // removeOnly is a special flag used only by <transition-group>
  5571. // to ensure removed elements stay in correct relative positions
  5572. // during leaving transitions
  5573. var canMove = !removeOnly;
  5574. {
  5575. checkDuplicateKeys(newCh);
  5576. }
  5577. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  5578. if (isUndef(oldStartVnode)) {
  5579. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  5580. } else if (isUndef(oldEndVnode)) {
  5581. oldEndVnode = oldCh[--oldEndIdx];
  5582. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  5583. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5584. oldStartVnode = oldCh[++oldStartIdx];
  5585. newStartVnode = newCh[++newStartIdx];
  5586. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  5587. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5588. oldEndVnode = oldCh[--oldEndIdx];
  5589. newEndVnode = newCh[--newEndIdx];
  5590. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  5591. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5592. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  5593. oldStartVnode = oldCh[++oldStartIdx];
  5594. newEndVnode = newCh[--newEndIdx];
  5595. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  5596. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5597. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  5598. oldEndVnode = oldCh[--oldEndIdx];
  5599. newStartVnode = newCh[++newStartIdx];
  5600. } else {
  5601. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  5602. idxInOld = isDef(newStartVnode.key)
  5603. ? oldKeyToIdx[newStartVnode.key]
  5604. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  5605. if (isUndef(idxInOld)) { // New element
  5606. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5607. } else {
  5608. vnodeToMove = oldCh[idxInOld];
  5609. if (sameVnode(vnodeToMove, newStartVnode)) {
  5610. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5611. oldCh[idxInOld] = undefined;
  5612. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  5613. } else {
  5614. // same key but different element. treat as new element
  5615. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5616. }
  5617. }
  5618. newStartVnode = newCh[++newStartIdx];
  5619. }
  5620. }
  5621. if (oldStartIdx > oldEndIdx) {
  5622. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  5623. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  5624. } else if (newStartIdx > newEndIdx) {
  5625. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  5626. }
  5627. }
  5628. function checkDuplicateKeys (children) {
  5629. var seenKeys = {};
  5630. for (var i = 0; i < children.length; i++) {
  5631. var vnode = children[i];
  5632. var key = vnode.key;
  5633. if (isDef(key)) {
  5634. if (seenKeys[key]) {
  5635. warn(
  5636. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  5637. vnode.context
  5638. );
  5639. } else {
  5640. seenKeys[key] = true;
  5641. }
  5642. }
  5643. }
  5644. }
  5645. function findIdxInOld (node, oldCh, start, end) {
  5646. for (var i = start; i < end; i++) {
  5647. var c = oldCh[i];
  5648. if (isDef(c) && sameVnode(node, c)) { return i }
  5649. }
  5650. }
  5651. function patchVnode (
  5652. oldVnode,
  5653. vnode,
  5654. insertedVnodeQueue,
  5655. ownerArray,
  5656. index,
  5657. removeOnly
  5658. ) {
  5659. if (oldVnode === vnode) {
  5660. return
  5661. }
  5662. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5663. // clone reused vnode
  5664. vnode = ownerArray[index] = cloneVNode(vnode);
  5665. }
  5666. var elm = vnode.elm = oldVnode.elm;
  5667. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  5668. if (isDef(vnode.asyncFactory.resolved)) {
  5669. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  5670. } else {
  5671. vnode.isAsyncPlaceholder = true;
  5672. }
  5673. return
  5674. }
  5675. // reuse element for static trees.
  5676. // note we only do this if the vnode is cloned -
  5677. // if the new node is not cloned it means the render functions have been
  5678. // reset by the hot-reload-api and we need to do a proper re-render.
  5679. if (isTrue(vnode.isStatic) &&
  5680. isTrue(oldVnode.isStatic) &&
  5681. vnode.key === oldVnode.key &&
  5682. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  5683. ) {
  5684. vnode.componentInstance = oldVnode.componentInstance;
  5685. return
  5686. }
  5687. var i;
  5688. var data = vnode.data;
  5689. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  5690. i(oldVnode, vnode);
  5691. }
  5692. var oldCh = oldVnode.children;
  5693. var ch = vnode.children;
  5694. if (isDef(data) && isPatchable(vnode)) {
  5695. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  5696. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  5697. }
  5698. if (isUndef(vnode.text)) {
  5699. if (isDef(oldCh) && isDef(ch)) {
  5700. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  5701. } else if (isDef(ch)) {
  5702. {
  5703. checkDuplicateKeys(ch);
  5704. }
  5705. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  5706. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  5707. } else if (isDef(oldCh)) {
  5708. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  5709. } else if (isDef(oldVnode.text)) {
  5710. nodeOps.setTextContent(elm, '');
  5711. }
  5712. } else if (oldVnode.text !== vnode.text) {
  5713. nodeOps.setTextContent(elm, vnode.text);
  5714. }
  5715. if (isDef(data)) {
  5716. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  5717. }
  5718. }
  5719. function invokeInsertHook (vnode, queue, initial) {
  5720. // delay insert hooks for component root nodes, invoke them after the
  5721. // element is really inserted
  5722. if (isTrue(initial) && isDef(vnode.parent)) {
  5723. vnode.parent.data.pendingInsert = queue;
  5724. } else {
  5725. for (var i = 0; i < queue.length; ++i) {
  5726. queue[i].data.hook.insert(queue[i]);
  5727. }
  5728. }
  5729. }
  5730. var hydrationBailed = false;
  5731. // list of modules that can skip create hook during hydration because they
  5732. // are already rendered on the client or has no need for initialization
  5733. // Note: style is excluded because it relies on initial clone for future
  5734. // deep updates (#7063).
  5735. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  5736. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  5737. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  5738. var i;
  5739. var tag = vnode.tag;
  5740. var data = vnode.data;
  5741. var children = vnode.children;
  5742. inVPre = inVPre || (data && data.pre);
  5743. vnode.elm = elm;
  5744. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  5745. vnode.isAsyncPlaceholder = true;
  5746. return true
  5747. }
  5748. // assert node match
  5749. {
  5750. if (!assertNodeMatch(elm, vnode, inVPre)) {
  5751. return false
  5752. }
  5753. }
  5754. if (isDef(data)) {
  5755. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  5756. if (isDef(i = vnode.componentInstance)) {
  5757. // child component. it should have hydrated its own tree.
  5758. initComponent(vnode, insertedVnodeQueue);
  5759. return true
  5760. }
  5761. }
  5762. if (isDef(tag)) {
  5763. if (isDef(children)) {
  5764. // empty element, allow client to pick up and populate children
  5765. if (!elm.hasChildNodes()) {
  5766. createChildren(vnode, children, insertedVnodeQueue);
  5767. } else {
  5768. // v-html and domProps: innerHTML
  5769. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  5770. if (i !== elm.innerHTML) {
  5771. /* istanbul ignore if */
  5772. if (typeof console !== 'undefined' &&
  5773. !hydrationBailed
  5774. ) {
  5775. hydrationBailed = true;
  5776. console.warn('Parent: ', elm);
  5777. console.warn('server innerHTML: ', i);
  5778. console.warn('client innerHTML: ', elm.innerHTML);
  5779. }
  5780. return false
  5781. }
  5782. } else {
  5783. // iterate and compare children lists
  5784. var childrenMatch = true;
  5785. var childNode = elm.firstChild;
  5786. for (var i$1 = 0; i$1 < children.length; i$1++) {
  5787. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  5788. childrenMatch = false;
  5789. break
  5790. }
  5791. childNode = childNode.nextSibling;
  5792. }
  5793. // if childNode is not null, it means the actual childNodes list is
  5794. // longer than the virtual children list.
  5795. if (!childrenMatch || childNode) {
  5796. /* istanbul ignore if */
  5797. if (typeof console !== 'undefined' &&
  5798. !hydrationBailed
  5799. ) {
  5800. hydrationBailed = true;
  5801. console.warn('Parent: ', elm);
  5802. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  5803. }
  5804. return false
  5805. }
  5806. }
  5807. }
  5808. }
  5809. if (isDef(data)) {
  5810. var fullInvoke = false;
  5811. for (var key in data) {
  5812. if (!isRenderedModule(key)) {
  5813. fullInvoke = true;
  5814. invokeCreateHooks(vnode, insertedVnodeQueue);
  5815. break
  5816. }
  5817. }
  5818. if (!fullInvoke && data['class']) {
  5819. // ensure collecting deps for deep class bindings for future updates
  5820. traverse(data['class']);
  5821. }
  5822. }
  5823. } else if (elm.data !== vnode.text) {
  5824. elm.data = vnode.text;
  5825. }
  5826. return true
  5827. }
  5828. function assertNodeMatch (node, vnode, inVPre) {
  5829. if (isDef(vnode.tag)) {
  5830. return vnode.tag.indexOf('vue-component') === 0 || (
  5831. !isUnknownElement$$1(vnode, inVPre) &&
  5832. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  5833. )
  5834. } else {
  5835. return node.nodeType === (vnode.isComment ? 8 : 3)
  5836. }
  5837. }
  5838. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  5839. if (isUndef(vnode)) {
  5840. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  5841. return
  5842. }
  5843. var isInitialPatch = false;
  5844. var insertedVnodeQueue = [];
  5845. if (isUndef(oldVnode)) {
  5846. // empty mount (likely as component), create new root element
  5847. isInitialPatch = true;
  5848. createElm(vnode, insertedVnodeQueue);
  5849. } else {
  5850. var isRealElement = isDef(oldVnode.nodeType);
  5851. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  5852. // patch existing root node
  5853. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  5854. } else {
  5855. if (isRealElement) {
  5856. // mounting to a real element
  5857. // check if this is server-rendered content and if we can perform
  5858. // a successful hydration.
  5859. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  5860. oldVnode.removeAttribute(SSR_ATTR);
  5861. hydrating = true;
  5862. }
  5863. if (isTrue(hydrating)) {
  5864. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  5865. invokeInsertHook(vnode, insertedVnodeQueue, true);
  5866. return oldVnode
  5867. } else {
  5868. warn(
  5869. 'The client-side rendered virtual DOM tree is not matching ' +
  5870. 'server-rendered content. This is likely caused by incorrect ' +
  5871. 'HTML markup, for example nesting block-level elements inside ' +
  5872. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  5873. 'full client-side render.'
  5874. );
  5875. }
  5876. }
  5877. // either not server-rendered, or hydration failed.
  5878. // create an empty node and replace it
  5879. oldVnode = emptyNodeAt(oldVnode);
  5880. }
  5881. // replacing existing element
  5882. var oldElm = oldVnode.elm;
  5883. var parentElm = nodeOps.parentNode(oldElm);
  5884. // create new node
  5885. createElm(
  5886. vnode,
  5887. insertedVnodeQueue,
  5888. // extremely rare edge case: do not insert if old element is in a
  5889. // leaving transition. Only happens when combining transition +
  5890. // keep-alive + HOCs. (#4590)
  5891. oldElm._leaveCb ? null : parentElm,
  5892. nodeOps.nextSibling(oldElm)
  5893. );
  5894. // update parent placeholder node element, recursively
  5895. if (isDef(vnode.parent)) {
  5896. var ancestor = vnode.parent;
  5897. var patchable = isPatchable(vnode);
  5898. while (ancestor) {
  5899. for (var i = 0; i < cbs.destroy.length; ++i) {
  5900. cbs.destroy[i](ancestor);
  5901. }
  5902. ancestor.elm = vnode.elm;
  5903. if (patchable) {
  5904. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5905. cbs.create[i$1](emptyNode, ancestor);
  5906. }
  5907. // #6513
  5908. // invoke insert hooks that may have been merged by create hooks.
  5909. // e.g. for directives that uses the "inserted" hook.
  5910. var insert = ancestor.data.hook.insert;
  5911. if (insert.merged) {
  5912. // start at index 1 to avoid re-invoking component mounted hook
  5913. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  5914. insert.fns[i$2]();
  5915. }
  5916. }
  5917. } else {
  5918. registerRef(ancestor);
  5919. }
  5920. ancestor = ancestor.parent;
  5921. }
  5922. }
  5923. // destroy old node
  5924. if (isDef(parentElm)) {
  5925. removeVnodes(parentElm, [oldVnode], 0, 0);
  5926. } else if (isDef(oldVnode.tag)) {
  5927. invokeDestroyHook(oldVnode);
  5928. }
  5929. }
  5930. }
  5931. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  5932. return vnode.elm
  5933. }
  5934. }
  5935. /* */
  5936. var directives = {
  5937. create: updateDirectives,
  5938. update: updateDirectives,
  5939. destroy: function unbindDirectives (vnode) {
  5940. updateDirectives(vnode, emptyNode);
  5941. }
  5942. };
  5943. function updateDirectives (oldVnode, vnode) {
  5944. if (oldVnode.data.directives || vnode.data.directives) {
  5945. _update(oldVnode, vnode);
  5946. }
  5947. }
  5948. function _update (oldVnode, vnode) {
  5949. var isCreate = oldVnode === emptyNode;
  5950. var isDestroy = vnode === emptyNode;
  5951. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  5952. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  5953. var dirsWithInsert = [];
  5954. var dirsWithPostpatch = [];
  5955. var key, oldDir, dir;
  5956. for (key in newDirs) {
  5957. oldDir = oldDirs[key];
  5958. dir = newDirs[key];
  5959. if (!oldDir) {
  5960. // new directive, bind
  5961. callHook$1(dir, 'bind', vnode, oldVnode);
  5962. if (dir.def && dir.def.inserted) {
  5963. dirsWithInsert.push(dir);
  5964. }
  5965. } else {
  5966. // existing directive, update
  5967. dir.oldValue = oldDir.value;
  5968. dir.oldArg = oldDir.arg;
  5969. callHook$1(dir, 'update', vnode, oldVnode);
  5970. if (dir.def && dir.def.componentUpdated) {
  5971. dirsWithPostpatch.push(dir);
  5972. }
  5973. }
  5974. }
  5975. if (dirsWithInsert.length) {
  5976. var callInsert = function () {
  5977. for (var i = 0; i < dirsWithInsert.length; i++) {
  5978. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  5979. }
  5980. };
  5981. if (isCreate) {
  5982. mergeVNodeHook(vnode, 'insert', callInsert);
  5983. } else {
  5984. callInsert();
  5985. }
  5986. }
  5987. if (dirsWithPostpatch.length) {
  5988. mergeVNodeHook(vnode, 'postpatch', function () {
  5989. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  5990. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  5991. }
  5992. });
  5993. }
  5994. if (!isCreate) {
  5995. for (key in oldDirs) {
  5996. if (!newDirs[key]) {
  5997. // no longer present, unbind
  5998. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  5999. }
  6000. }
  6001. }
  6002. }
  6003. var emptyModifiers = Object.create(null);
  6004. function normalizeDirectives$1 (
  6005. dirs,
  6006. vm
  6007. ) {
  6008. var res = Object.create(null);
  6009. if (!dirs) {
  6010. // $flow-disable-line
  6011. return res
  6012. }
  6013. var i, dir;
  6014. for (i = 0; i < dirs.length; i++) {
  6015. dir = dirs[i];
  6016. if (!dir.modifiers) {
  6017. // $flow-disable-line
  6018. dir.modifiers = emptyModifiers;
  6019. }
  6020. res[getRawDirName(dir)] = dir;
  6021. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  6022. }
  6023. // $flow-disable-line
  6024. return res
  6025. }
  6026. function getRawDirName (dir) {
  6027. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  6028. }
  6029. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  6030. var fn = dir.def && dir.def[hook];
  6031. if (fn) {
  6032. try {
  6033. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  6034. } catch (e) {
  6035. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  6036. }
  6037. }
  6038. }
  6039. var baseModules = [
  6040. ref,
  6041. directives
  6042. ];
  6043. /* */
  6044. function updateAttrs (oldVnode, vnode) {
  6045. var opts = vnode.componentOptions;
  6046. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  6047. return
  6048. }
  6049. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  6050. return
  6051. }
  6052. var key, cur, old;
  6053. var elm = vnode.elm;
  6054. var oldAttrs = oldVnode.data.attrs || {};
  6055. var attrs = vnode.data.attrs || {};
  6056. // clone observed objects, as the user probably wants to mutate it
  6057. if (isDef(attrs.__ob__)) {
  6058. attrs = vnode.data.attrs = extend({}, attrs);
  6059. }
  6060. for (key in attrs) {
  6061. cur = attrs[key];
  6062. old = oldAttrs[key];
  6063. if (old !== cur) {
  6064. setAttr(elm, key, cur);
  6065. }
  6066. }
  6067. // #4391: in IE9, setting type can reset value for input[type=radio]
  6068. // #6666: IE/Edge forces progress value down to 1 before setting a max
  6069. /* istanbul ignore if */
  6070. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  6071. setAttr(elm, 'value', attrs.value);
  6072. }
  6073. for (key in oldAttrs) {
  6074. if (isUndef(attrs[key])) {
  6075. if (isXlink(key)) {
  6076. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6077. } else if (!isEnumeratedAttr(key)) {
  6078. elm.removeAttribute(key);
  6079. }
  6080. }
  6081. }
  6082. }
  6083. function setAttr (el, key, value) {
  6084. if (el.tagName.indexOf('-') > -1) {
  6085. baseSetAttr(el, key, value);
  6086. } else if (isBooleanAttr(key)) {
  6087. // set attribute for blank value
  6088. // e.g. <option disabled>Select one</option>
  6089. if (isFalsyAttrValue(value)) {
  6090. el.removeAttribute(key);
  6091. } else {
  6092. // technically allowfullscreen is a boolean attribute for <iframe>,
  6093. // but Flash expects a value of "true" when used on <embed> tag
  6094. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  6095. ? 'true'
  6096. : key;
  6097. el.setAttribute(key, value);
  6098. }
  6099. } else if (isEnumeratedAttr(key)) {
  6100. el.setAttribute(key, convertEnumeratedValue(key, value));
  6101. } else if (isXlink(key)) {
  6102. if (isFalsyAttrValue(value)) {
  6103. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6104. } else {
  6105. el.setAttributeNS(xlinkNS, key, value);
  6106. }
  6107. } else {
  6108. baseSetAttr(el, key, value);
  6109. }
  6110. }
  6111. function baseSetAttr (el, key, value) {
  6112. if (isFalsyAttrValue(value)) {
  6113. el.removeAttribute(key);
  6114. } else {
  6115. // #7138: IE10 & 11 fires input event when setting placeholder on
  6116. // <textarea>... block the first input event and remove the blocker
  6117. // immediately.
  6118. /* istanbul ignore if */
  6119. if (
  6120. isIE && !isIE9 &&
  6121. el.tagName === 'TEXTAREA' &&
  6122. key === 'placeholder' && value !== '' && !el.__ieph
  6123. ) {
  6124. var blocker = function (e) {
  6125. e.stopImmediatePropagation();
  6126. el.removeEventListener('input', blocker);
  6127. };
  6128. el.addEventListener('input', blocker);
  6129. // $flow-disable-line
  6130. el.__ieph = true; /* IE placeholder patched */
  6131. }
  6132. el.setAttribute(key, value);
  6133. }
  6134. }
  6135. var attrs = {
  6136. create: updateAttrs,
  6137. update: updateAttrs
  6138. };
  6139. /* */
  6140. function updateClass (oldVnode, vnode) {
  6141. var el = vnode.elm;
  6142. var data = vnode.data;
  6143. var oldData = oldVnode.data;
  6144. if (
  6145. isUndef(data.staticClass) &&
  6146. isUndef(data.class) && (
  6147. isUndef(oldData) || (
  6148. isUndef(oldData.staticClass) &&
  6149. isUndef(oldData.class)
  6150. )
  6151. )
  6152. ) {
  6153. return
  6154. }
  6155. var cls = genClassForVnode(vnode);
  6156. // handle transition classes
  6157. var transitionClass = el._transitionClasses;
  6158. if (isDef(transitionClass)) {
  6159. cls = concat(cls, stringifyClass(transitionClass));
  6160. }
  6161. // set the class
  6162. if (cls !== el._prevClass) {
  6163. el.setAttribute('class', cls);
  6164. el._prevClass = cls;
  6165. }
  6166. }
  6167. var klass = {
  6168. create: updateClass,
  6169. update: updateClass
  6170. };
  6171. /* */
  6172. var validDivisionCharRE = /[\w).+\-_$\]]/;
  6173. function parseFilters (exp) {
  6174. var inSingle = false;
  6175. var inDouble = false;
  6176. var inTemplateString = false;
  6177. var inRegex = false;
  6178. var curly = 0;
  6179. var square = 0;
  6180. var paren = 0;
  6181. var lastFilterIndex = 0;
  6182. var c, prev, i, expression, filters;
  6183. for (i = 0; i < exp.length; i++) {
  6184. prev = c;
  6185. c = exp.charCodeAt(i);
  6186. if (inSingle) {
  6187. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  6188. } else if (inDouble) {
  6189. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  6190. } else if (inTemplateString) {
  6191. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  6192. } else if (inRegex) {
  6193. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  6194. } else if (
  6195. c === 0x7C && // pipe
  6196. exp.charCodeAt(i + 1) !== 0x7C &&
  6197. exp.charCodeAt(i - 1) !== 0x7C &&
  6198. !curly && !square && !paren
  6199. ) {
  6200. if (expression === undefined) {
  6201. // first filter, end of expression
  6202. lastFilterIndex = i + 1;
  6203. expression = exp.slice(0, i).trim();
  6204. } else {
  6205. pushFilter();
  6206. }
  6207. } else {
  6208. switch (c) {
  6209. case 0x22: inDouble = true; break // "
  6210. case 0x27: inSingle = true; break // '
  6211. case 0x60: inTemplateString = true; break // `
  6212. case 0x28: paren++; break // (
  6213. case 0x29: paren--; break // )
  6214. case 0x5B: square++; break // [
  6215. case 0x5D: square--; break // ]
  6216. case 0x7B: curly++; break // {
  6217. case 0x7D: curly--; break // }
  6218. }
  6219. if (c === 0x2f) { // /
  6220. var j = i - 1;
  6221. var p = (void 0);
  6222. // find first non-whitespace prev char
  6223. for (; j >= 0; j--) {
  6224. p = exp.charAt(j);
  6225. if (p !== ' ') { break }
  6226. }
  6227. if (!p || !validDivisionCharRE.test(p)) {
  6228. inRegex = true;
  6229. }
  6230. }
  6231. }
  6232. }
  6233. if (expression === undefined) {
  6234. expression = exp.slice(0, i).trim();
  6235. } else if (lastFilterIndex !== 0) {
  6236. pushFilter();
  6237. }
  6238. function pushFilter () {
  6239. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  6240. lastFilterIndex = i + 1;
  6241. }
  6242. if (filters) {
  6243. for (i = 0; i < filters.length; i++) {
  6244. expression = wrapFilter(expression, filters[i]);
  6245. }
  6246. }
  6247. return expression
  6248. }
  6249. function wrapFilter (exp, filter) {
  6250. var i = filter.indexOf('(');
  6251. if (i < 0) {
  6252. // _f: resolveFilter
  6253. return ("_f(\"" + filter + "\")(" + exp + ")")
  6254. } else {
  6255. var name = filter.slice(0, i);
  6256. var args = filter.slice(i + 1);
  6257. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  6258. }
  6259. }
  6260. /* */
  6261. /* eslint-disable no-unused-vars */
  6262. function baseWarn (msg, range) {
  6263. console.error(("[Vue compiler]: " + msg));
  6264. }
  6265. /* eslint-enable no-unused-vars */
  6266. function pluckModuleFunction (
  6267. modules,
  6268. key
  6269. ) {
  6270. return modules
  6271. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  6272. : []
  6273. }
  6274. function addProp (el, name, value, range, dynamic) {
  6275. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  6276. el.plain = false;
  6277. }
  6278. function addAttr (el, name, value, range, dynamic) {
  6279. var attrs = dynamic
  6280. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  6281. : (el.attrs || (el.attrs = []));
  6282. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  6283. el.plain = false;
  6284. }
  6285. // add a raw attr (use this in preTransforms)
  6286. function addRawAttr (el, name, value, range) {
  6287. el.attrsMap[name] = value;
  6288. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  6289. }
  6290. function addDirective (
  6291. el,
  6292. name,
  6293. rawName,
  6294. value,
  6295. arg,
  6296. isDynamicArg,
  6297. modifiers,
  6298. range
  6299. ) {
  6300. (el.directives || (el.directives = [])).push(rangeSetItem({
  6301. name: name,
  6302. rawName: rawName,
  6303. value: value,
  6304. arg: arg,
  6305. isDynamicArg: isDynamicArg,
  6306. modifiers: modifiers
  6307. }, range));
  6308. el.plain = false;
  6309. }
  6310. function prependModifierMarker (symbol, name, dynamic) {
  6311. return dynamic
  6312. ? ("_p(" + name + ",\"" + symbol + "\")")
  6313. : symbol + name // mark the event as captured
  6314. }
  6315. function addHandler (
  6316. el,
  6317. name,
  6318. value,
  6319. modifiers,
  6320. important,
  6321. warn,
  6322. range,
  6323. dynamic
  6324. ) {
  6325. modifiers = modifiers || emptyObject;
  6326. // warn prevent and passive modifier
  6327. /* istanbul ignore if */
  6328. if (
  6329. warn &&
  6330. modifiers.prevent && modifiers.passive
  6331. ) {
  6332. warn(
  6333. 'passive and prevent can\'t be used together. ' +
  6334. 'Passive handler can\'t prevent default event.',
  6335. range
  6336. );
  6337. }
  6338. // normalize click.right and click.middle since they don't actually fire
  6339. // this is technically browser-specific, but at least for now browsers are
  6340. // the only target envs that have right/middle clicks.
  6341. if (modifiers.right) {
  6342. if (dynamic) {
  6343. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  6344. } else if (name === 'click') {
  6345. name = 'contextmenu';
  6346. delete modifiers.right;
  6347. }
  6348. } else if (modifiers.middle) {
  6349. if (dynamic) {
  6350. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  6351. } else if (name === 'click') {
  6352. name = 'mouseup';
  6353. }
  6354. }
  6355. // check capture modifier
  6356. if (modifiers.capture) {
  6357. delete modifiers.capture;
  6358. name = prependModifierMarker('!', name, dynamic);
  6359. }
  6360. if (modifiers.once) {
  6361. delete modifiers.once;
  6362. name = prependModifierMarker('~', name, dynamic);
  6363. }
  6364. /* istanbul ignore if */
  6365. if (modifiers.passive) {
  6366. delete modifiers.passive;
  6367. name = prependModifierMarker('&', name, dynamic);
  6368. }
  6369. var events;
  6370. if (modifiers.native) {
  6371. delete modifiers.native;
  6372. events = el.nativeEvents || (el.nativeEvents = {});
  6373. } else {
  6374. events = el.events || (el.events = {});
  6375. }
  6376. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  6377. if (modifiers !== emptyObject) {
  6378. newHandler.modifiers = modifiers;
  6379. }
  6380. var handlers = events[name];
  6381. /* istanbul ignore if */
  6382. if (Array.isArray(handlers)) {
  6383. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  6384. } else if (handlers) {
  6385. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  6386. } else {
  6387. events[name] = newHandler;
  6388. }
  6389. el.plain = false;
  6390. }
  6391. function getRawBindingAttr (
  6392. el,
  6393. name
  6394. ) {
  6395. return el.rawAttrsMap[':' + name] ||
  6396. el.rawAttrsMap['v-bind:' + name] ||
  6397. el.rawAttrsMap[name]
  6398. }
  6399. function getBindingAttr (
  6400. el,
  6401. name,
  6402. getStatic
  6403. ) {
  6404. var dynamicValue =
  6405. getAndRemoveAttr(el, ':' + name) ||
  6406. getAndRemoveAttr(el, 'v-bind:' + name);
  6407. if (dynamicValue != null) {
  6408. return parseFilters(dynamicValue)
  6409. } else if (getStatic !== false) {
  6410. var staticValue = getAndRemoveAttr(el, name);
  6411. if (staticValue != null) {
  6412. return JSON.stringify(staticValue)
  6413. }
  6414. }
  6415. }
  6416. // note: this only removes the attr from the Array (attrsList) so that it
  6417. // doesn't get processed by processAttrs.
  6418. // By default it does NOT remove it from the map (attrsMap) because the map is
  6419. // needed during codegen.
  6420. function getAndRemoveAttr (
  6421. el,
  6422. name,
  6423. removeFromMap
  6424. ) {
  6425. var val;
  6426. if ((val = el.attrsMap[name]) != null) {
  6427. var list = el.attrsList;
  6428. for (var i = 0, l = list.length; i < l; i++) {
  6429. if (list[i].name === name) {
  6430. list.splice(i, 1);
  6431. break
  6432. }
  6433. }
  6434. }
  6435. if (removeFromMap) {
  6436. delete el.attrsMap[name];
  6437. }
  6438. return val
  6439. }
  6440. function getAndRemoveAttrByRegex (
  6441. el,
  6442. name
  6443. ) {
  6444. var list = el.attrsList;
  6445. for (var i = 0, l = list.length; i < l; i++) {
  6446. var attr = list[i];
  6447. if (name.test(attr.name)) {
  6448. list.splice(i, 1);
  6449. return attr
  6450. }
  6451. }
  6452. }
  6453. function rangeSetItem (
  6454. item,
  6455. range
  6456. ) {
  6457. if (range) {
  6458. if (range.start != null) {
  6459. item.start = range.start;
  6460. }
  6461. if (range.end != null) {
  6462. item.end = range.end;
  6463. }
  6464. }
  6465. return item
  6466. }
  6467. /* */
  6468. /**
  6469. * Cross-platform code generation for component v-model
  6470. */
  6471. function genComponentModel (
  6472. el,
  6473. value,
  6474. modifiers
  6475. ) {
  6476. var ref = modifiers || {};
  6477. var number = ref.number;
  6478. var trim = ref.trim;
  6479. var baseValueExpression = '$$v';
  6480. var valueExpression = baseValueExpression;
  6481. if (trim) {
  6482. valueExpression =
  6483. "(typeof " + baseValueExpression + " === 'string'" +
  6484. "? " + baseValueExpression + ".trim()" +
  6485. ": " + baseValueExpression + ")";
  6486. }
  6487. if (number) {
  6488. valueExpression = "_n(" + valueExpression + ")";
  6489. }
  6490. var assignment = genAssignmentCode(value, valueExpression);
  6491. el.model = {
  6492. value: ("(" + value + ")"),
  6493. expression: JSON.stringify(value),
  6494. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  6495. };
  6496. }
  6497. /**
  6498. * Cross-platform codegen helper for generating v-model value assignment code.
  6499. */
  6500. function genAssignmentCode (
  6501. value,
  6502. assignment
  6503. ) {
  6504. var res = parseModel(value);
  6505. if (res.key === null) {
  6506. return (value + "=" + assignment)
  6507. } else {
  6508. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  6509. }
  6510. }
  6511. /**
  6512. * Parse a v-model expression into a base path and a final key segment.
  6513. * Handles both dot-path and possible square brackets.
  6514. *
  6515. * Possible cases:
  6516. *
  6517. * - test
  6518. * - test[key]
  6519. * - test[test1[key]]
  6520. * - test["a"][key]
  6521. * - xxx.test[a[a].test1[key]]
  6522. * - test.xxx.a["asa"][test1[key]]
  6523. *
  6524. */
  6525. var len, str, chr, index$1, expressionPos, expressionEndPos;
  6526. function parseModel (val) {
  6527. // Fix https://github.com/vuejs/vue/pull/7730
  6528. // allow v-model="obj.val " (trailing whitespace)
  6529. val = val.trim();
  6530. len = val.length;
  6531. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  6532. index$1 = val.lastIndexOf('.');
  6533. if (index$1 > -1) {
  6534. return {
  6535. exp: val.slice(0, index$1),
  6536. key: '"' + val.slice(index$1 + 1) + '"'
  6537. }
  6538. } else {
  6539. return {
  6540. exp: val,
  6541. key: null
  6542. }
  6543. }
  6544. }
  6545. str = val;
  6546. index$1 = expressionPos = expressionEndPos = 0;
  6547. while (!eof()) {
  6548. chr = next();
  6549. /* istanbul ignore if */
  6550. if (isStringStart(chr)) {
  6551. parseString(chr);
  6552. } else if (chr === 0x5B) {
  6553. parseBracket(chr);
  6554. }
  6555. }
  6556. return {
  6557. exp: val.slice(0, expressionPos),
  6558. key: val.slice(expressionPos + 1, expressionEndPos)
  6559. }
  6560. }
  6561. function next () {
  6562. return str.charCodeAt(++index$1)
  6563. }
  6564. function eof () {
  6565. return index$1 >= len
  6566. }
  6567. function isStringStart (chr) {
  6568. return chr === 0x22 || chr === 0x27
  6569. }
  6570. function parseBracket (chr) {
  6571. var inBracket = 1;
  6572. expressionPos = index$1;
  6573. while (!eof()) {
  6574. chr = next();
  6575. if (isStringStart(chr)) {
  6576. parseString(chr);
  6577. continue
  6578. }
  6579. if (chr === 0x5B) { inBracket++; }
  6580. if (chr === 0x5D) { inBracket--; }
  6581. if (inBracket === 0) {
  6582. expressionEndPos = index$1;
  6583. break
  6584. }
  6585. }
  6586. }
  6587. function parseString (chr) {
  6588. var stringQuote = chr;
  6589. while (!eof()) {
  6590. chr = next();
  6591. if (chr === stringQuote) {
  6592. break
  6593. }
  6594. }
  6595. }
  6596. /* */
  6597. var warn$1;
  6598. // in some cases, the event used has to be determined at runtime
  6599. // so we used some reserved tokens during compile.
  6600. var RANGE_TOKEN = '__r';
  6601. var CHECKBOX_RADIO_TOKEN = '__c';
  6602. function model (
  6603. el,
  6604. dir,
  6605. _warn
  6606. ) {
  6607. warn$1 = _warn;
  6608. var value = dir.value;
  6609. var modifiers = dir.modifiers;
  6610. var tag = el.tag;
  6611. var type = el.attrsMap.type;
  6612. {
  6613. // inputs with type="file" are read only and setting the input's
  6614. // value will throw an error.
  6615. if (tag === 'input' && type === 'file') {
  6616. warn$1(
  6617. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  6618. "File inputs are read only. Use a v-on:change listener instead.",
  6619. el.rawAttrsMap['v-model']
  6620. );
  6621. }
  6622. }
  6623. if (el.component) {
  6624. genComponentModel(el, value, modifiers);
  6625. // component v-model doesn't need extra runtime
  6626. return false
  6627. } else if (tag === 'select') {
  6628. genSelect(el, value, modifiers);
  6629. } else if (tag === 'input' && type === 'checkbox') {
  6630. genCheckboxModel(el, value, modifiers);
  6631. } else if (tag === 'input' && type === 'radio') {
  6632. genRadioModel(el, value, modifiers);
  6633. } else if (tag === 'input' || tag === 'textarea') {
  6634. genDefaultModel(el, value, modifiers);
  6635. } else if (!config.isReservedTag(tag)) {
  6636. genComponentModel(el, value, modifiers);
  6637. // component v-model doesn't need extra runtime
  6638. return false
  6639. } else {
  6640. warn$1(
  6641. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  6642. "v-model is not supported on this element type. " +
  6643. 'If you are working with contenteditable, it\'s recommended to ' +
  6644. 'wrap a library dedicated for that purpose inside a custom component.',
  6645. el.rawAttrsMap['v-model']
  6646. );
  6647. }
  6648. // ensure runtime directive metadata
  6649. return true
  6650. }
  6651. function genCheckboxModel (
  6652. el,
  6653. value,
  6654. modifiers
  6655. ) {
  6656. var number = modifiers && modifiers.number;
  6657. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6658. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  6659. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  6660. addProp(el, 'checked',
  6661. "Array.isArray(" + value + ")" +
  6662. "?_i(" + value + "," + valueBinding + ")>-1" + (
  6663. trueValueBinding === 'true'
  6664. ? (":(" + value + ")")
  6665. : (":_q(" + value + "," + trueValueBinding + ")")
  6666. )
  6667. );
  6668. addHandler(el, 'change',
  6669. "var $$a=" + value + "," +
  6670. '$$el=$event.target,' +
  6671. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  6672. 'if(Array.isArray($$a)){' +
  6673. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  6674. '$$i=_i($$a,$$v);' +
  6675. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  6676. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  6677. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  6678. null, true
  6679. );
  6680. }
  6681. function genRadioModel (
  6682. el,
  6683. value,
  6684. modifiers
  6685. ) {
  6686. var number = modifiers && modifiers.number;
  6687. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6688. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  6689. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  6690. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  6691. }
  6692. function genSelect (
  6693. el,
  6694. value,
  6695. modifiers
  6696. ) {
  6697. var number = modifiers && modifiers.number;
  6698. var selectedVal = "Array.prototype.filter" +
  6699. ".call($event.target.options,function(o){return o.selected})" +
  6700. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  6701. "return " + (number ? '_n(val)' : 'val') + "})";
  6702. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  6703. var code = "var $$selectedVal = " + selectedVal + ";";
  6704. code = code + " " + (genAssignmentCode(value, assignment));
  6705. addHandler(el, 'change', code, null, true);
  6706. }
  6707. function genDefaultModel (
  6708. el,
  6709. value,
  6710. modifiers
  6711. ) {
  6712. var type = el.attrsMap.type;
  6713. // warn if v-bind:value conflicts with v-model
  6714. // except for inputs with v-bind:type
  6715. {
  6716. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  6717. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  6718. if (value$1 && !typeBinding) {
  6719. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  6720. warn$1(
  6721. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  6722. 'because the latter already expands to a value binding internally',
  6723. el.rawAttrsMap[binding]
  6724. );
  6725. }
  6726. }
  6727. var ref = modifiers || {};
  6728. var lazy = ref.lazy;
  6729. var number = ref.number;
  6730. var trim = ref.trim;
  6731. var needCompositionGuard = !lazy && type !== 'range';
  6732. var event = lazy
  6733. ? 'change'
  6734. : type === 'range'
  6735. ? RANGE_TOKEN
  6736. : 'input';
  6737. var valueExpression = '$event.target.value';
  6738. if (trim) {
  6739. valueExpression = "$event.target.value.trim()";
  6740. }
  6741. if (number) {
  6742. valueExpression = "_n(" + valueExpression + ")";
  6743. }
  6744. var code = genAssignmentCode(value, valueExpression);
  6745. if (needCompositionGuard) {
  6746. code = "if($event.target.composing)return;" + code;
  6747. }
  6748. addProp(el, 'value', ("(" + value + ")"));
  6749. addHandler(el, event, code, null, true);
  6750. if (trim || number) {
  6751. addHandler(el, 'blur', '$forceUpdate()');
  6752. }
  6753. }
  6754. /* */
  6755. // normalize v-model event tokens that can only be determined at runtime.
  6756. // it's important to place the event as the first in the array because
  6757. // the whole point is ensuring the v-model callback gets called before
  6758. // user-attached handlers.
  6759. function normalizeEvents (on) {
  6760. /* istanbul ignore if */
  6761. if (isDef(on[RANGE_TOKEN])) {
  6762. // IE input[type=range] only supports `change` event
  6763. var event = isIE ? 'change' : 'input';
  6764. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  6765. delete on[RANGE_TOKEN];
  6766. }
  6767. // This was originally intended to fix #4521 but no longer necessary
  6768. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  6769. /* istanbul ignore if */
  6770. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  6771. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  6772. delete on[CHECKBOX_RADIO_TOKEN];
  6773. }
  6774. }
  6775. var target$1;
  6776. function createOnceHandler$1 (event, handler, capture) {
  6777. var _target = target$1; // save current target element in closure
  6778. return function onceHandler () {
  6779. var res = handler.apply(null, arguments);
  6780. if (res !== null) {
  6781. remove$2(event, onceHandler, capture, _target);
  6782. }
  6783. }
  6784. }
  6785. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  6786. // implementation and does not fire microtasks in between event propagation, so
  6787. // safe to exclude.
  6788. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  6789. function add$1 (
  6790. name,
  6791. handler,
  6792. capture,
  6793. passive
  6794. ) {
  6795. // async edge case #6566: inner click event triggers patch, event handler
  6796. // attached to outer element during patch, and triggered again. This
  6797. // happens because browsers fire microtask ticks between event propagation.
  6798. // the solution is simple: we save the timestamp when a handler is attached,
  6799. // and the handler would only fire if the event passed to it was fired
  6800. // AFTER it was attached.
  6801. if (useMicrotaskFix) {
  6802. var attachedTimestamp = currentFlushTimestamp;
  6803. var original = handler;
  6804. handler = original._wrapper = function (e) {
  6805. if (
  6806. // no bubbling, should always fire.
  6807. // this is just a safety net in case event.timeStamp is unreliable in
  6808. // certain weird environments...
  6809. e.target === e.currentTarget ||
  6810. // event is fired after handler attachment
  6811. e.timeStamp >= attachedTimestamp ||
  6812. // bail for environments that have buggy event.timeStamp implementations
  6813. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  6814. // #9681 QtWebEngine event.timeStamp is negative value
  6815. e.timeStamp <= 0 ||
  6816. // #9448 bail if event is fired in another document in a multi-page
  6817. // electron/nw.js app, since event.timeStamp will be using a different
  6818. // starting reference
  6819. e.target.ownerDocument !== document
  6820. ) {
  6821. return original.apply(this, arguments)
  6822. }
  6823. };
  6824. }
  6825. target$1.addEventListener(
  6826. name,
  6827. handler,
  6828. supportsPassive
  6829. ? { capture: capture, passive: passive }
  6830. : capture
  6831. );
  6832. }
  6833. function remove$2 (
  6834. name,
  6835. handler,
  6836. capture,
  6837. _target
  6838. ) {
  6839. (_target || target$1).removeEventListener(
  6840. name,
  6841. handler._wrapper || handler,
  6842. capture
  6843. );
  6844. }
  6845. function updateDOMListeners (oldVnode, vnode) {
  6846. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  6847. return
  6848. }
  6849. var on = vnode.data.on || {};
  6850. var oldOn = oldVnode.data.on || {};
  6851. target$1 = vnode.elm;
  6852. normalizeEvents(on);
  6853. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  6854. target$1 = undefined;
  6855. }
  6856. var events = {
  6857. create: updateDOMListeners,
  6858. update: updateDOMListeners
  6859. };
  6860. /* */
  6861. var svgContainer;
  6862. function updateDOMProps (oldVnode, vnode) {
  6863. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  6864. return
  6865. }
  6866. var key, cur;
  6867. var elm = vnode.elm;
  6868. var oldProps = oldVnode.data.domProps || {};
  6869. var props = vnode.data.domProps || {};
  6870. // clone observed objects, as the user probably wants to mutate it
  6871. if (isDef(props.__ob__)) {
  6872. props = vnode.data.domProps = extend({}, props);
  6873. }
  6874. for (key in oldProps) {
  6875. if (!(key in props)) {
  6876. elm[key] = '';
  6877. }
  6878. }
  6879. for (key in props) {
  6880. cur = props[key];
  6881. // ignore children if the node has textContent or innerHTML,
  6882. // as these will throw away existing DOM nodes and cause removal errors
  6883. // on subsequent patches (#3360)
  6884. if (key === 'textContent' || key === 'innerHTML') {
  6885. if (vnode.children) { vnode.children.length = 0; }
  6886. if (cur === oldProps[key]) { continue }
  6887. // #6601 work around Chrome version <= 55 bug where single textNode
  6888. // replaced by innerHTML/textContent retains its parentNode property
  6889. if (elm.childNodes.length === 1) {
  6890. elm.removeChild(elm.childNodes[0]);
  6891. }
  6892. }
  6893. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  6894. // store value as _value as well since
  6895. // non-string values will be stringified
  6896. elm._value = cur;
  6897. // avoid resetting cursor position when value is the same
  6898. var strCur = isUndef(cur) ? '' : String(cur);
  6899. if (shouldUpdateValue(elm, strCur)) {
  6900. elm.value = strCur;
  6901. }
  6902. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  6903. // IE doesn't support innerHTML for SVG elements
  6904. svgContainer = svgContainer || document.createElement('div');
  6905. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  6906. var svg = svgContainer.firstChild;
  6907. while (elm.firstChild) {
  6908. elm.removeChild(elm.firstChild);
  6909. }
  6910. while (svg.firstChild) {
  6911. elm.appendChild(svg.firstChild);
  6912. }
  6913. } else if (
  6914. // skip the update if old and new VDOM state is the same.
  6915. // `value` is handled separately because the DOM value may be temporarily
  6916. // out of sync with VDOM state due to focus, composition and modifiers.
  6917. // This #4521 by skipping the unnecesarry `checked` update.
  6918. cur !== oldProps[key]
  6919. ) {
  6920. // some property updates can throw
  6921. // e.g. `value` on <progress> w/ non-finite value
  6922. try {
  6923. elm[key] = cur;
  6924. } catch (e) {}
  6925. }
  6926. }
  6927. }
  6928. // check platforms/web/util/attrs.js acceptValue
  6929. function shouldUpdateValue (elm, checkVal) {
  6930. return (!elm.composing && (
  6931. elm.tagName === 'OPTION' ||
  6932. isNotInFocusAndDirty(elm, checkVal) ||
  6933. isDirtyWithModifiers(elm, checkVal)
  6934. ))
  6935. }
  6936. function isNotInFocusAndDirty (elm, checkVal) {
  6937. // return true when textbox (.number and .trim) loses focus and its value is
  6938. // not equal to the updated value
  6939. var notInFocus = true;
  6940. // #6157
  6941. // work around IE bug when accessing document.activeElement in an iframe
  6942. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  6943. return notInFocus && elm.value !== checkVal
  6944. }
  6945. function isDirtyWithModifiers (elm, newVal) {
  6946. var value = elm.value;
  6947. var modifiers = elm._vModifiers; // injected by v-model runtime
  6948. if (isDef(modifiers)) {
  6949. if (modifiers.number) {
  6950. return toNumber(value) !== toNumber(newVal)
  6951. }
  6952. if (modifiers.trim) {
  6953. return value.trim() !== newVal.trim()
  6954. }
  6955. }
  6956. return value !== newVal
  6957. }
  6958. var domProps = {
  6959. create: updateDOMProps,
  6960. update: updateDOMProps
  6961. };
  6962. /* */
  6963. var parseStyleText = cached(function (cssText) {
  6964. var res = {};
  6965. var listDelimiter = /;(?![^(]*\))/g;
  6966. var propertyDelimiter = /:(.+)/;
  6967. cssText.split(listDelimiter).forEach(function (item) {
  6968. if (item) {
  6969. var tmp = item.split(propertyDelimiter);
  6970. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6971. }
  6972. });
  6973. return res
  6974. });
  6975. // merge static and dynamic style data on the same vnode
  6976. function normalizeStyleData (data) {
  6977. var style = normalizeStyleBinding(data.style);
  6978. // static style is pre-processed into an object during compilation
  6979. // and is always a fresh object, so it's safe to merge into it
  6980. return data.staticStyle
  6981. ? extend(data.staticStyle, style)
  6982. : style
  6983. }
  6984. // normalize possible array / string values into Object
  6985. function normalizeStyleBinding (bindingStyle) {
  6986. if (Array.isArray(bindingStyle)) {
  6987. return toObject(bindingStyle)
  6988. }
  6989. if (typeof bindingStyle === 'string') {
  6990. return parseStyleText(bindingStyle)
  6991. }
  6992. return bindingStyle
  6993. }
  6994. /**
  6995. * parent component style should be after child's
  6996. * so that parent component's style could override it
  6997. */
  6998. function getStyle (vnode, checkChild) {
  6999. var res = {};
  7000. var styleData;
  7001. if (checkChild) {
  7002. var childNode = vnode;
  7003. while (childNode.componentInstance) {
  7004. childNode = childNode.componentInstance._vnode;
  7005. if (
  7006. childNode && childNode.data &&
  7007. (styleData = normalizeStyleData(childNode.data))
  7008. ) {
  7009. extend(res, styleData);
  7010. }
  7011. }
  7012. }
  7013. if ((styleData = normalizeStyleData(vnode.data))) {
  7014. extend(res, styleData);
  7015. }
  7016. var parentNode = vnode;
  7017. while ((parentNode = parentNode.parent)) {
  7018. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  7019. extend(res, styleData);
  7020. }
  7021. }
  7022. return res
  7023. }
  7024. /* */
  7025. var cssVarRE = /^--/;
  7026. var importantRE = /\s*!important$/;
  7027. var setProp = function (el, name, val) {
  7028. /* istanbul ignore if */
  7029. if (cssVarRE.test(name)) {
  7030. el.style.setProperty(name, val);
  7031. } else if (importantRE.test(val)) {
  7032. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  7033. } else {
  7034. var normalizedName = normalize(name);
  7035. if (Array.isArray(val)) {
  7036. // Support values array created by autoprefixer, e.g.
  7037. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  7038. // Set them one by one, and the browser will only set those it can recognize
  7039. for (var i = 0, len = val.length; i < len; i++) {
  7040. el.style[normalizedName] = val[i];
  7041. }
  7042. } else {
  7043. el.style[normalizedName] = val;
  7044. }
  7045. }
  7046. };
  7047. var vendorNames = ['Webkit', 'Moz', 'ms'];
  7048. var emptyStyle;
  7049. var normalize = cached(function (prop) {
  7050. emptyStyle = emptyStyle || document.createElement('div').style;
  7051. prop = camelize(prop);
  7052. if (prop !== 'filter' && (prop in emptyStyle)) {
  7053. return prop
  7054. }
  7055. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  7056. for (var i = 0; i < vendorNames.length; i++) {
  7057. var name = vendorNames[i] + capName;
  7058. if (name in emptyStyle) {
  7059. return name
  7060. }
  7061. }
  7062. });
  7063. function updateStyle (oldVnode, vnode) {
  7064. var data = vnode.data;
  7065. var oldData = oldVnode.data;
  7066. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  7067. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  7068. ) {
  7069. return
  7070. }
  7071. var cur, name;
  7072. var el = vnode.elm;
  7073. var oldStaticStyle = oldData.staticStyle;
  7074. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  7075. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  7076. var oldStyle = oldStaticStyle || oldStyleBinding;
  7077. var style = normalizeStyleBinding(vnode.data.style) || {};
  7078. // store normalized style under a different key for next diff
  7079. // make sure to clone it if it's reactive, since the user likely wants
  7080. // to mutate it.
  7081. vnode.data.normalizedStyle = isDef(style.__ob__)
  7082. ? extend({}, style)
  7083. : style;
  7084. var newStyle = getStyle(vnode, true);
  7085. for (name in oldStyle) {
  7086. if (isUndef(newStyle[name])) {
  7087. setProp(el, name, '');
  7088. }
  7089. }
  7090. for (name in newStyle) {
  7091. cur = newStyle[name];
  7092. if (cur !== oldStyle[name]) {
  7093. // ie9 setting to null has no effect, must use empty string
  7094. setProp(el, name, cur == null ? '' : cur);
  7095. }
  7096. }
  7097. }
  7098. var style = {
  7099. create: updateStyle,
  7100. update: updateStyle
  7101. };
  7102. /* */
  7103. var whitespaceRE = /\s+/;
  7104. /**
  7105. * Add class with compatibility for SVG since classList is not supported on
  7106. * SVG elements in IE
  7107. */
  7108. function addClass (el, cls) {
  7109. /* istanbul ignore if */
  7110. if (!cls || !(cls = cls.trim())) {
  7111. return
  7112. }
  7113. /* istanbul ignore else */
  7114. if (el.classList) {
  7115. if (cls.indexOf(' ') > -1) {
  7116. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  7117. } else {
  7118. el.classList.add(cls);
  7119. }
  7120. } else {
  7121. var cur = " " + (el.getAttribute('class') || '') + " ";
  7122. if (cur.indexOf(' ' + cls + ' ') < 0) {
  7123. el.setAttribute('class', (cur + cls).trim());
  7124. }
  7125. }
  7126. }
  7127. /**
  7128. * Remove class with compatibility for SVG since classList is not supported on
  7129. * SVG elements in IE
  7130. */
  7131. function removeClass (el, cls) {
  7132. /* istanbul ignore if */
  7133. if (!cls || !(cls = cls.trim())) {
  7134. return
  7135. }
  7136. /* istanbul ignore else */
  7137. if (el.classList) {
  7138. if (cls.indexOf(' ') > -1) {
  7139. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  7140. } else {
  7141. el.classList.remove(cls);
  7142. }
  7143. if (!el.classList.length) {
  7144. el.removeAttribute('class');
  7145. }
  7146. } else {
  7147. var cur = " " + (el.getAttribute('class') || '') + " ";
  7148. var tar = ' ' + cls + ' ';
  7149. while (cur.indexOf(tar) >= 0) {
  7150. cur = cur.replace(tar, ' ');
  7151. }
  7152. cur = cur.trim();
  7153. if (cur) {
  7154. el.setAttribute('class', cur);
  7155. } else {
  7156. el.removeAttribute('class');
  7157. }
  7158. }
  7159. }
  7160. /* */
  7161. function resolveTransition (def$$1) {
  7162. if (!def$$1) {
  7163. return
  7164. }
  7165. /* istanbul ignore else */
  7166. if (typeof def$$1 === 'object') {
  7167. var res = {};
  7168. if (def$$1.css !== false) {
  7169. extend(res, autoCssTransition(def$$1.name || 'v'));
  7170. }
  7171. extend(res, def$$1);
  7172. return res
  7173. } else if (typeof def$$1 === 'string') {
  7174. return autoCssTransition(def$$1)
  7175. }
  7176. }
  7177. var autoCssTransition = cached(function (name) {
  7178. return {
  7179. enterClass: (name + "-enter"),
  7180. enterToClass: (name + "-enter-to"),
  7181. enterActiveClass: (name + "-enter-active"),
  7182. leaveClass: (name + "-leave"),
  7183. leaveToClass: (name + "-leave-to"),
  7184. leaveActiveClass: (name + "-leave-active")
  7185. }
  7186. });
  7187. var hasTransition = inBrowser && !isIE9;
  7188. var TRANSITION = 'transition';
  7189. var ANIMATION = 'animation';
  7190. // Transition property/event sniffing
  7191. var transitionProp = 'transition';
  7192. var transitionEndEvent = 'transitionend';
  7193. var animationProp = 'animation';
  7194. var animationEndEvent = 'animationend';
  7195. if (hasTransition) {
  7196. /* istanbul ignore if */
  7197. if (window.ontransitionend === undefined &&
  7198. window.onwebkittransitionend !== undefined
  7199. ) {
  7200. transitionProp = 'WebkitTransition';
  7201. transitionEndEvent = 'webkitTransitionEnd';
  7202. }
  7203. if (window.onanimationend === undefined &&
  7204. window.onwebkitanimationend !== undefined
  7205. ) {
  7206. animationProp = 'WebkitAnimation';
  7207. animationEndEvent = 'webkitAnimationEnd';
  7208. }
  7209. }
  7210. // binding to window is necessary to make hot reload work in IE in strict mode
  7211. var raf = inBrowser
  7212. ? window.requestAnimationFrame
  7213. ? window.requestAnimationFrame.bind(window)
  7214. : setTimeout
  7215. : /* istanbul ignore next */ function (fn) { return fn(); };
  7216. function nextFrame (fn) {
  7217. raf(function () {
  7218. raf(fn);
  7219. });
  7220. }
  7221. function addTransitionClass (el, cls) {
  7222. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  7223. if (transitionClasses.indexOf(cls) < 0) {
  7224. transitionClasses.push(cls);
  7225. addClass(el, cls);
  7226. }
  7227. }
  7228. function removeTransitionClass (el, cls) {
  7229. if (el._transitionClasses) {
  7230. remove(el._transitionClasses, cls);
  7231. }
  7232. removeClass(el, cls);
  7233. }
  7234. function whenTransitionEnds (
  7235. el,
  7236. expectedType,
  7237. cb
  7238. ) {
  7239. var ref = getTransitionInfo(el, expectedType);
  7240. var type = ref.type;
  7241. var timeout = ref.timeout;
  7242. var propCount = ref.propCount;
  7243. if (!type) { return cb() }
  7244. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  7245. var ended = 0;
  7246. var end = function () {
  7247. el.removeEventListener(event, onEnd);
  7248. cb();
  7249. };
  7250. var onEnd = function (e) {
  7251. if (e.target === el) {
  7252. if (++ended >= propCount) {
  7253. end();
  7254. }
  7255. }
  7256. };
  7257. setTimeout(function () {
  7258. if (ended < propCount) {
  7259. end();
  7260. }
  7261. }, timeout + 1);
  7262. el.addEventListener(event, onEnd);
  7263. }
  7264. var transformRE = /\b(transform|all)(,|$)/;
  7265. function getTransitionInfo (el, expectedType) {
  7266. var styles = window.getComputedStyle(el);
  7267. // JSDOM may return undefined for transition properties
  7268. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  7269. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  7270. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  7271. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  7272. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  7273. var animationTimeout = getTimeout(animationDelays, animationDurations);
  7274. var type;
  7275. var timeout = 0;
  7276. var propCount = 0;
  7277. /* istanbul ignore if */
  7278. if (expectedType === TRANSITION) {
  7279. if (transitionTimeout > 0) {
  7280. type = TRANSITION;
  7281. timeout = transitionTimeout;
  7282. propCount = transitionDurations.length;
  7283. }
  7284. } else if (expectedType === ANIMATION) {
  7285. if (animationTimeout > 0) {
  7286. type = ANIMATION;
  7287. timeout = animationTimeout;
  7288. propCount = animationDurations.length;
  7289. }
  7290. } else {
  7291. timeout = Math.max(transitionTimeout, animationTimeout);
  7292. type = timeout > 0
  7293. ? transitionTimeout > animationTimeout
  7294. ? TRANSITION
  7295. : ANIMATION
  7296. : null;
  7297. propCount = type
  7298. ? type === TRANSITION
  7299. ? transitionDurations.length
  7300. : animationDurations.length
  7301. : 0;
  7302. }
  7303. var hasTransform =
  7304. type === TRANSITION &&
  7305. transformRE.test(styles[transitionProp + 'Property']);
  7306. return {
  7307. type: type,
  7308. timeout: timeout,
  7309. propCount: propCount,
  7310. hasTransform: hasTransform
  7311. }
  7312. }
  7313. function getTimeout (delays, durations) {
  7314. /* istanbul ignore next */
  7315. while (delays.length < durations.length) {
  7316. delays = delays.concat(delays);
  7317. }
  7318. return Math.max.apply(null, durations.map(function (d, i) {
  7319. return toMs(d) + toMs(delays[i])
  7320. }))
  7321. }
  7322. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  7323. // in a locale-dependent way, using a comma instead of a dot.
  7324. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  7325. // as a floor function) causing unexpected behaviors
  7326. function toMs (s) {
  7327. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  7328. }
  7329. /* */
  7330. function enter (vnode, toggleDisplay) {
  7331. var el = vnode.elm;
  7332. // call leave callback now
  7333. if (isDef(el._leaveCb)) {
  7334. el._leaveCb.cancelled = true;
  7335. el._leaveCb();
  7336. }
  7337. var data = resolveTransition(vnode.data.transition);
  7338. if (isUndef(data)) {
  7339. return
  7340. }
  7341. /* istanbul ignore if */
  7342. if (isDef(el._enterCb) || el.nodeType !== 1) {
  7343. return
  7344. }
  7345. var css = data.css;
  7346. var type = data.type;
  7347. var enterClass = data.enterClass;
  7348. var enterToClass = data.enterToClass;
  7349. var enterActiveClass = data.enterActiveClass;
  7350. var appearClass = data.appearClass;
  7351. var appearToClass = data.appearToClass;
  7352. var appearActiveClass = data.appearActiveClass;
  7353. var beforeEnter = data.beforeEnter;
  7354. var enter = data.enter;
  7355. var afterEnter = data.afterEnter;
  7356. var enterCancelled = data.enterCancelled;
  7357. var beforeAppear = data.beforeAppear;
  7358. var appear = data.appear;
  7359. var afterAppear = data.afterAppear;
  7360. var appearCancelled = data.appearCancelled;
  7361. var duration = data.duration;
  7362. // activeInstance will always be the <transition> component managing this
  7363. // transition. One edge case to check is when the <transition> is placed
  7364. // as the root node of a child component. In that case we need to check
  7365. // <transition>'s parent for appear check.
  7366. var context = activeInstance;
  7367. var transitionNode = activeInstance.$vnode;
  7368. while (transitionNode && transitionNode.parent) {
  7369. context = transitionNode.context;
  7370. transitionNode = transitionNode.parent;
  7371. }
  7372. var isAppear = !context._isMounted || !vnode.isRootInsert;
  7373. if (isAppear && !appear && appear !== '') {
  7374. return
  7375. }
  7376. var startClass = isAppear && appearClass
  7377. ? appearClass
  7378. : enterClass;
  7379. var activeClass = isAppear && appearActiveClass
  7380. ? appearActiveClass
  7381. : enterActiveClass;
  7382. var toClass = isAppear && appearToClass
  7383. ? appearToClass
  7384. : enterToClass;
  7385. var beforeEnterHook = isAppear
  7386. ? (beforeAppear || beforeEnter)
  7387. : beforeEnter;
  7388. var enterHook = isAppear
  7389. ? (typeof appear === 'function' ? appear : enter)
  7390. : enter;
  7391. var afterEnterHook = isAppear
  7392. ? (afterAppear || afterEnter)
  7393. : afterEnter;
  7394. var enterCancelledHook = isAppear
  7395. ? (appearCancelled || enterCancelled)
  7396. : enterCancelled;
  7397. var explicitEnterDuration = toNumber(
  7398. isObject(duration)
  7399. ? duration.enter
  7400. : duration
  7401. );
  7402. if (explicitEnterDuration != null) {
  7403. checkDuration(explicitEnterDuration, 'enter', vnode);
  7404. }
  7405. var expectsCSS = css !== false && !isIE9;
  7406. var userWantsControl = getHookArgumentsLength(enterHook);
  7407. var cb = el._enterCb = once(function () {
  7408. if (expectsCSS) {
  7409. removeTransitionClass(el, toClass);
  7410. removeTransitionClass(el, activeClass);
  7411. }
  7412. if (cb.cancelled) {
  7413. if (expectsCSS) {
  7414. removeTransitionClass(el, startClass);
  7415. }
  7416. enterCancelledHook && enterCancelledHook(el);
  7417. } else {
  7418. afterEnterHook && afterEnterHook(el);
  7419. }
  7420. el._enterCb = null;
  7421. });
  7422. if (!vnode.data.show) {
  7423. // remove pending leave element on enter by injecting an insert hook
  7424. mergeVNodeHook(vnode, 'insert', function () {
  7425. var parent = el.parentNode;
  7426. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  7427. if (pendingNode &&
  7428. pendingNode.tag === vnode.tag &&
  7429. pendingNode.elm._leaveCb
  7430. ) {
  7431. pendingNode.elm._leaveCb();
  7432. }
  7433. enterHook && enterHook(el, cb);
  7434. });
  7435. }
  7436. // start enter transition
  7437. beforeEnterHook && beforeEnterHook(el);
  7438. if (expectsCSS) {
  7439. addTransitionClass(el, startClass);
  7440. addTransitionClass(el, activeClass);
  7441. nextFrame(function () {
  7442. removeTransitionClass(el, startClass);
  7443. if (!cb.cancelled) {
  7444. addTransitionClass(el, toClass);
  7445. if (!userWantsControl) {
  7446. if (isValidDuration(explicitEnterDuration)) {
  7447. setTimeout(cb, explicitEnterDuration);
  7448. } else {
  7449. whenTransitionEnds(el, type, cb);
  7450. }
  7451. }
  7452. }
  7453. });
  7454. }
  7455. if (vnode.data.show) {
  7456. toggleDisplay && toggleDisplay();
  7457. enterHook && enterHook(el, cb);
  7458. }
  7459. if (!expectsCSS && !userWantsControl) {
  7460. cb();
  7461. }
  7462. }
  7463. function leave (vnode, rm) {
  7464. var el = vnode.elm;
  7465. // call enter callback now
  7466. if (isDef(el._enterCb)) {
  7467. el._enterCb.cancelled = true;
  7468. el._enterCb();
  7469. }
  7470. var data = resolveTransition(vnode.data.transition);
  7471. if (isUndef(data) || el.nodeType !== 1) {
  7472. return rm()
  7473. }
  7474. /* istanbul ignore if */
  7475. if (isDef(el._leaveCb)) {
  7476. return
  7477. }
  7478. var css = data.css;
  7479. var type = data.type;
  7480. var leaveClass = data.leaveClass;
  7481. var leaveToClass = data.leaveToClass;
  7482. var leaveActiveClass = data.leaveActiveClass;
  7483. var beforeLeave = data.beforeLeave;
  7484. var leave = data.leave;
  7485. var afterLeave = data.afterLeave;
  7486. var leaveCancelled = data.leaveCancelled;
  7487. var delayLeave = data.delayLeave;
  7488. var duration = data.duration;
  7489. var expectsCSS = css !== false && !isIE9;
  7490. var userWantsControl = getHookArgumentsLength(leave);
  7491. var explicitLeaveDuration = toNumber(
  7492. isObject(duration)
  7493. ? duration.leave
  7494. : duration
  7495. );
  7496. if (isDef(explicitLeaveDuration)) {
  7497. checkDuration(explicitLeaveDuration, 'leave', vnode);
  7498. }
  7499. var cb = el._leaveCb = once(function () {
  7500. if (el.parentNode && el.parentNode._pending) {
  7501. el.parentNode._pending[vnode.key] = null;
  7502. }
  7503. if (expectsCSS) {
  7504. removeTransitionClass(el, leaveToClass);
  7505. removeTransitionClass(el, leaveActiveClass);
  7506. }
  7507. if (cb.cancelled) {
  7508. if (expectsCSS) {
  7509. removeTransitionClass(el, leaveClass);
  7510. }
  7511. leaveCancelled && leaveCancelled(el);
  7512. } else {
  7513. rm();
  7514. afterLeave && afterLeave(el);
  7515. }
  7516. el._leaveCb = null;
  7517. });
  7518. if (delayLeave) {
  7519. delayLeave(performLeave);
  7520. } else {
  7521. performLeave();
  7522. }
  7523. function performLeave () {
  7524. // the delayed leave may have already been cancelled
  7525. if (cb.cancelled) {
  7526. return
  7527. }
  7528. // record leaving element
  7529. if (!vnode.data.show && el.parentNode) {
  7530. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  7531. }
  7532. beforeLeave && beforeLeave(el);
  7533. if (expectsCSS) {
  7534. addTransitionClass(el, leaveClass);
  7535. addTransitionClass(el, leaveActiveClass);
  7536. nextFrame(function () {
  7537. removeTransitionClass(el, leaveClass);
  7538. if (!cb.cancelled) {
  7539. addTransitionClass(el, leaveToClass);
  7540. if (!userWantsControl) {
  7541. if (isValidDuration(explicitLeaveDuration)) {
  7542. setTimeout(cb, explicitLeaveDuration);
  7543. } else {
  7544. whenTransitionEnds(el, type, cb);
  7545. }
  7546. }
  7547. }
  7548. });
  7549. }
  7550. leave && leave(el, cb);
  7551. if (!expectsCSS && !userWantsControl) {
  7552. cb();
  7553. }
  7554. }
  7555. }
  7556. // only used in dev mode
  7557. function checkDuration (val, name, vnode) {
  7558. if (typeof val !== 'number') {
  7559. warn(
  7560. "<transition> explicit " + name + " duration is not a valid number - " +
  7561. "got " + (JSON.stringify(val)) + ".",
  7562. vnode.context
  7563. );
  7564. } else if (isNaN(val)) {
  7565. warn(
  7566. "<transition> explicit " + name + " duration is NaN - " +
  7567. 'the duration expression might be incorrect.',
  7568. vnode.context
  7569. );
  7570. }
  7571. }
  7572. function isValidDuration (val) {
  7573. return typeof val === 'number' && !isNaN(val)
  7574. }
  7575. /**
  7576. * Normalize a transition hook's argument length. The hook may be:
  7577. * - a merged hook (invoker) with the original in .fns
  7578. * - a wrapped component method (check ._length)
  7579. * - a plain function (.length)
  7580. */
  7581. function getHookArgumentsLength (fn) {
  7582. if (isUndef(fn)) {
  7583. return false
  7584. }
  7585. var invokerFns = fn.fns;
  7586. if (isDef(invokerFns)) {
  7587. // invoker
  7588. return getHookArgumentsLength(
  7589. Array.isArray(invokerFns)
  7590. ? invokerFns[0]
  7591. : invokerFns
  7592. )
  7593. } else {
  7594. return (fn._length || fn.length) > 1
  7595. }
  7596. }
  7597. function _enter (_, vnode) {
  7598. if (vnode.data.show !== true) {
  7599. enter(vnode);
  7600. }
  7601. }
  7602. var transition = inBrowser ? {
  7603. create: _enter,
  7604. activate: _enter,
  7605. remove: function remove$$1 (vnode, rm) {
  7606. /* istanbul ignore else */
  7607. if (vnode.data.show !== true) {
  7608. leave(vnode, rm);
  7609. } else {
  7610. rm();
  7611. }
  7612. }
  7613. } : {};
  7614. var platformModules = [
  7615. attrs,
  7616. klass,
  7617. events,
  7618. domProps,
  7619. style,
  7620. transition
  7621. ];
  7622. /* */
  7623. // the directive module should be applied last, after all
  7624. // built-in modules have been applied.
  7625. var modules = platformModules.concat(baseModules);
  7626. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  7627. /**
  7628. * Not type checking this file because flow doesn't like attaching
  7629. * properties to Elements.
  7630. */
  7631. /* istanbul ignore if */
  7632. if (isIE9) {
  7633. // http://www.matts411.com/post/internet-explorer-9-oninput/
  7634. document.addEventListener('selectionchange', function () {
  7635. var el = document.activeElement;
  7636. if (el && el.vmodel) {
  7637. trigger(el, 'input');
  7638. }
  7639. });
  7640. }
  7641. var directive = {
  7642. inserted: function inserted (el, binding, vnode, oldVnode) {
  7643. if (vnode.tag === 'select') {
  7644. // #6903
  7645. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  7646. mergeVNodeHook(vnode, 'postpatch', function () {
  7647. directive.componentUpdated(el, binding, vnode);
  7648. });
  7649. } else {
  7650. setSelected(el, binding, vnode.context);
  7651. }
  7652. el._vOptions = [].map.call(el.options, getValue);
  7653. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  7654. el._vModifiers = binding.modifiers;
  7655. if (!binding.modifiers.lazy) {
  7656. el.addEventListener('compositionstart', onCompositionStart);
  7657. el.addEventListener('compositionend', onCompositionEnd);
  7658. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  7659. // switching focus before confirming composition choice
  7660. // this also fixes the issue where some browsers e.g. iOS Chrome
  7661. // fires "change" instead of "input" on autocomplete.
  7662. el.addEventListener('change', onCompositionEnd);
  7663. /* istanbul ignore if */
  7664. if (isIE9) {
  7665. el.vmodel = true;
  7666. }
  7667. }
  7668. }
  7669. },
  7670. componentUpdated: function componentUpdated (el, binding, vnode) {
  7671. if (vnode.tag === 'select') {
  7672. setSelected(el, binding, vnode.context);
  7673. // in case the options rendered by v-for have changed,
  7674. // it's possible that the value is out-of-sync with the rendered options.
  7675. // detect such cases and filter out values that no longer has a matching
  7676. // option in the DOM.
  7677. var prevOptions = el._vOptions;
  7678. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  7679. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  7680. // trigger change event if
  7681. // no matching option found for at least one value
  7682. var needReset = el.multiple
  7683. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  7684. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  7685. if (needReset) {
  7686. trigger(el, 'change');
  7687. }
  7688. }
  7689. }
  7690. }
  7691. };
  7692. function setSelected (el, binding, vm) {
  7693. actuallySetSelected(el, binding, vm);
  7694. /* istanbul ignore if */
  7695. if (isIE || isEdge) {
  7696. setTimeout(function () {
  7697. actuallySetSelected(el, binding, vm);
  7698. }, 0);
  7699. }
  7700. }
  7701. function actuallySetSelected (el, binding, vm) {
  7702. var value = binding.value;
  7703. var isMultiple = el.multiple;
  7704. if (isMultiple && !Array.isArray(value)) {
  7705. warn(
  7706. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  7707. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  7708. vm
  7709. );
  7710. return
  7711. }
  7712. var selected, option;
  7713. for (var i = 0, l = el.options.length; i < l; i++) {
  7714. option = el.options[i];
  7715. if (isMultiple) {
  7716. selected = looseIndexOf(value, getValue(option)) > -1;
  7717. if (option.selected !== selected) {
  7718. option.selected = selected;
  7719. }
  7720. } else {
  7721. if (looseEqual(getValue(option), value)) {
  7722. if (el.selectedIndex !== i) {
  7723. el.selectedIndex = i;
  7724. }
  7725. return
  7726. }
  7727. }
  7728. }
  7729. if (!isMultiple) {
  7730. el.selectedIndex = -1;
  7731. }
  7732. }
  7733. function hasNoMatchingOption (value, options) {
  7734. return options.every(function (o) { return !looseEqual(o, value); })
  7735. }
  7736. function getValue (option) {
  7737. return '_value' in option
  7738. ? option._value
  7739. : option.value
  7740. }
  7741. function onCompositionStart (e) {
  7742. e.target.composing = true;
  7743. }
  7744. function onCompositionEnd (e) {
  7745. // prevent triggering an input event for no reason
  7746. if (!e.target.composing) { return }
  7747. e.target.composing = false;
  7748. trigger(e.target, 'input');
  7749. }
  7750. function trigger (el, type) {
  7751. var e = document.createEvent('HTMLEvents');
  7752. e.initEvent(type, true, true);
  7753. el.dispatchEvent(e);
  7754. }
  7755. /* */
  7756. // recursively search for possible transition defined inside the component root
  7757. function locateNode (vnode) {
  7758. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  7759. ? locateNode(vnode.componentInstance._vnode)
  7760. : vnode
  7761. }
  7762. var show = {
  7763. bind: function bind (el, ref, vnode) {
  7764. var value = ref.value;
  7765. vnode = locateNode(vnode);
  7766. var transition$$1 = vnode.data && vnode.data.transition;
  7767. var originalDisplay = el.__vOriginalDisplay =
  7768. el.style.display === 'none' ? '' : el.style.display;
  7769. if (value && transition$$1) {
  7770. vnode.data.show = true;
  7771. enter(vnode, function () {
  7772. el.style.display = originalDisplay;
  7773. });
  7774. } else {
  7775. el.style.display = value ? originalDisplay : 'none';
  7776. }
  7777. },
  7778. update: function update (el, ref, vnode) {
  7779. var value = ref.value;
  7780. var oldValue = ref.oldValue;
  7781. /* istanbul ignore if */
  7782. if (!value === !oldValue) { return }
  7783. vnode = locateNode(vnode);
  7784. var transition$$1 = vnode.data && vnode.data.transition;
  7785. if (transition$$1) {
  7786. vnode.data.show = true;
  7787. if (value) {
  7788. enter(vnode, function () {
  7789. el.style.display = el.__vOriginalDisplay;
  7790. });
  7791. } else {
  7792. leave(vnode, function () {
  7793. el.style.display = 'none';
  7794. });
  7795. }
  7796. } else {
  7797. el.style.display = value ? el.__vOriginalDisplay : 'none';
  7798. }
  7799. },
  7800. unbind: function unbind (
  7801. el,
  7802. binding,
  7803. vnode,
  7804. oldVnode,
  7805. isDestroy
  7806. ) {
  7807. if (!isDestroy) {
  7808. el.style.display = el.__vOriginalDisplay;
  7809. }
  7810. }
  7811. };
  7812. var platformDirectives = {
  7813. model: directive,
  7814. show: show
  7815. };
  7816. /* */
  7817. var transitionProps = {
  7818. name: String,
  7819. appear: Boolean,
  7820. css: Boolean,
  7821. mode: String,
  7822. type: String,
  7823. enterClass: String,
  7824. leaveClass: String,
  7825. enterToClass: String,
  7826. leaveToClass: String,
  7827. enterActiveClass: String,
  7828. leaveActiveClass: String,
  7829. appearClass: String,
  7830. appearActiveClass: String,
  7831. appearToClass: String,
  7832. duration: [Number, String, Object]
  7833. };
  7834. // in case the child is also an abstract component, e.g. <keep-alive>
  7835. // we want to recursively retrieve the real component to be rendered
  7836. function getRealChild (vnode) {
  7837. var compOptions = vnode && vnode.componentOptions;
  7838. if (compOptions && compOptions.Ctor.options.abstract) {
  7839. return getRealChild(getFirstComponentChild(compOptions.children))
  7840. } else {
  7841. return vnode
  7842. }
  7843. }
  7844. function extractTransitionData (comp) {
  7845. var data = {};
  7846. var options = comp.$options;
  7847. // props
  7848. for (var key in options.propsData) {
  7849. data[key] = comp[key];
  7850. }
  7851. // events.
  7852. // extract listeners and pass them directly to the transition methods
  7853. var listeners = options._parentListeners;
  7854. for (var key$1 in listeners) {
  7855. data[camelize(key$1)] = listeners[key$1];
  7856. }
  7857. return data
  7858. }
  7859. function placeholder (h, rawChild) {
  7860. if (/\d-keep-alive$/.test(rawChild.tag)) {
  7861. return h('keep-alive', {
  7862. props: rawChild.componentOptions.propsData
  7863. })
  7864. }
  7865. }
  7866. function hasParentTransition (vnode) {
  7867. while ((vnode = vnode.parent)) {
  7868. if (vnode.data.transition) {
  7869. return true
  7870. }
  7871. }
  7872. }
  7873. function isSameChild (child, oldChild) {
  7874. return oldChild.key === child.key && oldChild.tag === child.tag
  7875. }
  7876. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  7877. var isVShowDirective = function (d) { return d.name === 'show'; };
  7878. var Transition = {
  7879. name: 'transition',
  7880. props: transitionProps,
  7881. abstract: true,
  7882. render: function render (h) {
  7883. var this$1 = this;
  7884. var children = this.$slots.default;
  7885. if (!children) {
  7886. return
  7887. }
  7888. // filter out text nodes (possible whitespaces)
  7889. children = children.filter(isNotTextNode);
  7890. /* istanbul ignore if */
  7891. if (!children.length) {
  7892. return
  7893. }
  7894. // warn multiple elements
  7895. if (children.length > 1) {
  7896. warn(
  7897. '<transition> can only be used on a single element. Use ' +
  7898. '<transition-group> for lists.',
  7899. this.$parent
  7900. );
  7901. }
  7902. var mode = this.mode;
  7903. // warn invalid mode
  7904. if (mode && mode !== 'in-out' && mode !== 'out-in'
  7905. ) {
  7906. warn(
  7907. 'invalid <transition> mode: ' + mode,
  7908. this.$parent
  7909. );
  7910. }
  7911. var rawChild = children[0];
  7912. // if this is a component root node and the component's
  7913. // parent container node also has transition, skip.
  7914. if (hasParentTransition(this.$vnode)) {
  7915. return rawChild
  7916. }
  7917. // apply transition data to child
  7918. // use getRealChild() to ignore abstract components e.g. keep-alive
  7919. var child = getRealChild(rawChild);
  7920. /* istanbul ignore if */
  7921. if (!child) {
  7922. return rawChild
  7923. }
  7924. if (this._leaving) {
  7925. return placeholder(h, rawChild)
  7926. }
  7927. // ensure a key that is unique to the vnode type and to this transition
  7928. // component instance. This key will be used to remove pending leaving nodes
  7929. // during entering.
  7930. var id = "__transition-" + (this._uid) + "-";
  7931. child.key = child.key == null
  7932. ? child.isComment
  7933. ? id + 'comment'
  7934. : id + child.tag
  7935. : isPrimitive(child.key)
  7936. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  7937. : child.key;
  7938. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  7939. var oldRawChild = this._vnode;
  7940. var oldChild = getRealChild(oldRawChild);
  7941. // mark v-show
  7942. // so that the transition module can hand over the control to the directive
  7943. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  7944. child.data.show = true;
  7945. }
  7946. if (
  7947. oldChild &&
  7948. oldChild.data &&
  7949. !isSameChild(child, oldChild) &&
  7950. !isAsyncPlaceholder(oldChild) &&
  7951. // #6687 component root is a comment node
  7952. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  7953. ) {
  7954. // replace old child transition data with fresh one
  7955. // important for dynamic transitions!
  7956. var oldData = oldChild.data.transition = extend({}, data);
  7957. // handle transition mode
  7958. if (mode === 'out-in') {
  7959. // return placeholder node and queue update when leave finishes
  7960. this._leaving = true;
  7961. mergeVNodeHook(oldData, 'afterLeave', function () {
  7962. this$1._leaving = false;
  7963. this$1.$forceUpdate();
  7964. });
  7965. return placeholder(h, rawChild)
  7966. } else if (mode === 'in-out') {
  7967. if (isAsyncPlaceholder(child)) {
  7968. return oldRawChild
  7969. }
  7970. var delayedLeave;
  7971. var performLeave = function () { delayedLeave(); };
  7972. mergeVNodeHook(data, 'afterEnter', performLeave);
  7973. mergeVNodeHook(data, 'enterCancelled', performLeave);
  7974. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  7975. }
  7976. }
  7977. return rawChild
  7978. }
  7979. };
  7980. /* */
  7981. var props = extend({
  7982. tag: String,
  7983. moveClass: String
  7984. }, transitionProps);
  7985. delete props.mode;
  7986. var TransitionGroup = {
  7987. props: props,
  7988. beforeMount: function beforeMount () {
  7989. var this$1 = this;
  7990. var update = this._update;
  7991. this._update = function (vnode, hydrating) {
  7992. var restoreActiveInstance = setActiveInstance(this$1);
  7993. // force removing pass
  7994. this$1.__patch__(
  7995. this$1._vnode,
  7996. this$1.kept,
  7997. false, // hydrating
  7998. true // removeOnly (!important, avoids unnecessary moves)
  7999. );
  8000. this$1._vnode = this$1.kept;
  8001. restoreActiveInstance();
  8002. update.call(this$1, vnode, hydrating);
  8003. };
  8004. },
  8005. render: function render (h) {
  8006. var tag = this.tag || this.$vnode.data.tag || 'span';
  8007. var map = Object.create(null);
  8008. var prevChildren = this.prevChildren = this.children;
  8009. var rawChildren = this.$slots.default || [];
  8010. var children = this.children = [];
  8011. var transitionData = extractTransitionData(this);
  8012. for (var i = 0; i < rawChildren.length; i++) {
  8013. var c = rawChildren[i];
  8014. if (c.tag) {
  8015. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  8016. children.push(c);
  8017. map[c.key] = c
  8018. ;(c.data || (c.data = {})).transition = transitionData;
  8019. } else {
  8020. var opts = c.componentOptions;
  8021. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  8022. warn(("<transition-group> children must be keyed: <" + name + ">"));
  8023. }
  8024. }
  8025. }
  8026. if (prevChildren) {
  8027. var kept = [];
  8028. var removed = [];
  8029. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  8030. var c$1 = prevChildren[i$1];
  8031. c$1.data.transition = transitionData;
  8032. c$1.data.pos = c$1.elm.getBoundingClientRect();
  8033. if (map[c$1.key]) {
  8034. kept.push(c$1);
  8035. } else {
  8036. removed.push(c$1);
  8037. }
  8038. }
  8039. this.kept = h(tag, null, kept);
  8040. this.removed = removed;
  8041. }
  8042. return h(tag, null, children)
  8043. },
  8044. updated: function updated () {
  8045. var children = this.prevChildren;
  8046. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  8047. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  8048. return
  8049. }
  8050. // we divide the work into three loops to avoid mixing DOM reads and writes
  8051. // in each iteration - which helps prevent layout thrashing.
  8052. children.forEach(callPendingCbs);
  8053. children.forEach(recordPosition);
  8054. children.forEach(applyTranslation);
  8055. // force reflow to put everything in position
  8056. // assign to this to avoid being removed in tree-shaking
  8057. // $flow-disable-line
  8058. this._reflow = document.body.offsetHeight;
  8059. children.forEach(function (c) {
  8060. if (c.data.moved) {
  8061. var el = c.elm;
  8062. var s = el.style;
  8063. addTransitionClass(el, moveClass);
  8064. s.transform = s.WebkitTransform = s.transitionDuration = '';
  8065. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  8066. if (e && e.target !== el) {
  8067. return
  8068. }
  8069. if (!e || /transform$/.test(e.propertyName)) {
  8070. el.removeEventListener(transitionEndEvent, cb);
  8071. el._moveCb = null;
  8072. removeTransitionClass(el, moveClass);
  8073. }
  8074. });
  8075. }
  8076. });
  8077. },
  8078. methods: {
  8079. hasMove: function hasMove (el, moveClass) {
  8080. /* istanbul ignore if */
  8081. if (!hasTransition) {
  8082. return false
  8083. }
  8084. /* istanbul ignore if */
  8085. if (this._hasMove) {
  8086. return this._hasMove
  8087. }
  8088. // Detect whether an element with the move class applied has
  8089. // CSS transitions. Since the element may be inside an entering
  8090. // transition at this very moment, we make a clone of it and remove
  8091. // all other transition classes applied to ensure only the move class
  8092. // is applied.
  8093. var clone = el.cloneNode();
  8094. if (el._transitionClasses) {
  8095. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  8096. }
  8097. addClass(clone, moveClass);
  8098. clone.style.display = 'none';
  8099. this.$el.appendChild(clone);
  8100. var info = getTransitionInfo(clone);
  8101. this.$el.removeChild(clone);
  8102. return (this._hasMove = info.hasTransform)
  8103. }
  8104. }
  8105. };
  8106. function callPendingCbs (c) {
  8107. /* istanbul ignore if */
  8108. if (c.elm._moveCb) {
  8109. c.elm._moveCb();
  8110. }
  8111. /* istanbul ignore if */
  8112. if (c.elm._enterCb) {
  8113. c.elm._enterCb();
  8114. }
  8115. }
  8116. function recordPosition (c) {
  8117. c.data.newPos = c.elm.getBoundingClientRect();
  8118. }
  8119. function applyTranslation (c) {
  8120. var oldPos = c.data.pos;
  8121. var newPos = c.data.newPos;
  8122. var dx = oldPos.left - newPos.left;
  8123. var dy = oldPos.top - newPos.top;
  8124. if (dx || dy) {
  8125. c.data.moved = true;
  8126. var s = c.elm.style;
  8127. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  8128. s.transitionDuration = '0s';
  8129. }
  8130. }
  8131. var platformComponents = {
  8132. Transition: Transition,
  8133. TransitionGroup: TransitionGroup
  8134. };
  8135. /* */
  8136. // install platform specific utils
  8137. Vue.config.mustUseProp = mustUseProp;
  8138. Vue.config.isReservedTag = isReservedTag;
  8139. Vue.config.isReservedAttr = isReservedAttr;
  8140. Vue.config.getTagNamespace = getTagNamespace;
  8141. Vue.config.isUnknownElement = isUnknownElement;
  8142. // install platform runtime directives & components
  8143. extend(Vue.options.directives, platformDirectives);
  8144. extend(Vue.options.components, platformComponents);
  8145. // install platform patch function
  8146. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  8147. // public mount method
  8148. Vue.prototype.$mount = function (
  8149. el,
  8150. hydrating
  8151. ) {
  8152. el = el && inBrowser ? query(el) : undefined;
  8153. return mountComponent(this, el, hydrating)
  8154. };
  8155. // devtools global hook
  8156. /* istanbul ignore next */
  8157. if (inBrowser) {
  8158. setTimeout(function () {
  8159. if (config.devtools) {
  8160. if (devtools) {
  8161. devtools.emit('init', Vue);
  8162. } else {
  8163. console[console.info ? 'info' : 'log'](
  8164. 'Download the Vue Devtools extension for a better development experience:\n' +
  8165. 'https://github.com/vuejs/vue-devtools'
  8166. );
  8167. }
  8168. }
  8169. if (config.productionTip !== false &&
  8170. typeof console !== 'undefined'
  8171. ) {
  8172. console[console.info ? 'info' : 'log'](
  8173. "You are running Vue in development mode.\n" +
  8174. "Make sure to turn on production mode when deploying for production.\n" +
  8175. "See more tips at https://vuejs.org/guide/deployment.html"
  8176. );
  8177. }
  8178. }, 0);
  8179. }
  8180. /* */
  8181. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  8182. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  8183. var buildRegex = cached(function (delimiters) {
  8184. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  8185. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  8186. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  8187. });
  8188. function parseText (
  8189. text,
  8190. delimiters
  8191. ) {
  8192. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  8193. if (!tagRE.test(text)) {
  8194. return
  8195. }
  8196. var tokens = [];
  8197. var rawTokens = [];
  8198. var lastIndex = tagRE.lastIndex = 0;
  8199. var match, index, tokenValue;
  8200. while ((match = tagRE.exec(text))) {
  8201. index = match.index;
  8202. // push text token
  8203. if (index > lastIndex) {
  8204. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  8205. tokens.push(JSON.stringify(tokenValue));
  8206. }
  8207. // tag token
  8208. var exp = parseFilters(match[1].trim());
  8209. tokens.push(("_s(" + exp + ")"));
  8210. rawTokens.push({ '@binding': exp });
  8211. lastIndex = index + match[0].length;
  8212. }
  8213. if (lastIndex < text.length) {
  8214. rawTokens.push(tokenValue = text.slice(lastIndex));
  8215. tokens.push(JSON.stringify(tokenValue));
  8216. }
  8217. return {
  8218. expression: tokens.join('+'),
  8219. tokens: rawTokens
  8220. }
  8221. }
  8222. /* */
  8223. function transformNode (el, options) {
  8224. var warn = options.warn || baseWarn;
  8225. var staticClass = getAndRemoveAttr(el, 'class');
  8226. if (staticClass) {
  8227. var res = parseText(staticClass, options.delimiters);
  8228. if (res) {
  8229. warn(
  8230. "class=\"" + staticClass + "\": " +
  8231. 'Interpolation inside attributes has been removed. ' +
  8232. 'Use v-bind or the colon shorthand instead. For example, ' +
  8233. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  8234. el.rawAttrsMap['class']
  8235. );
  8236. }
  8237. }
  8238. if (staticClass) {
  8239. el.staticClass = JSON.stringify(staticClass);
  8240. }
  8241. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  8242. if (classBinding) {
  8243. el.classBinding = classBinding;
  8244. }
  8245. }
  8246. function genData (el) {
  8247. var data = '';
  8248. if (el.staticClass) {
  8249. data += "staticClass:" + (el.staticClass) + ",";
  8250. }
  8251. if (el.classBinding) {
  8252. data += "class:" + (el.classBinding) + ",";
  8253. }
  8254. return data
  8255. }
  8256. var klass$1 = {
  8257. staticKeys: ['staticClass'],
  8258. transformNode: transformNode,
  8259. genData: genData
  8260. };
  8261. /* */
  8262. function transformNode$1 (el, options) {
  8263. var warn = options.warn || baseWarn;
  8264. var staticStyle = getAndRemoveAttr(el, 'style');
  8265. if (staticStyle) {
  8266. /* istanbul ignore if */
  8267. {
  8268. var res = parseText(staticStyle, options.delimiters);
  8269. if (res) {
  8270. warn(
  8271. "style=\"" + staticStyle + "\": " +
  8272. 'Interpolation inside attributes has been removed. ' +
  8273. 'Use v-bind or the colon shorthand instead. For example, ' +
  8274. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  8275. el.rawAttrsMap['style']
  8276. );
  8277. }
  8278. }
  8279. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  8280. }
  8281. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  8282. if (styleBinding) {
  8283. el.styleBinding = styleBinding;
  8284. }
  8285. }
  8286. function genData$1 (el) {
  8287. var data = '';
  8288. if (el.staticStyle) {
  8289. data += "staticStyle:" + (el.staticStyle) + ",";
  8290. }
  8291. if (el.styleBinding) {
  8292. data += "style:(" + (el.styleBinding) + "),";
  8293. }
  8294. return data
  8295. }
  8296. var style$1 = {
  8297. staticKeys: ['staticStyle'],
  8298. transformNode: transformNode$1,
  8299. genData: genData$1
  8300. };
  8301. /* */
  8302. var decoder;
  8303. var he = {
  8304. decode: function decode (html) {
  8305. decoder = decoder || document.createElement('div');
  8306. decoder.innerHTML = html;
  8307. return decoder.textContent
  8308. }
  8309. };
  8310. /* */
  8311. var isUnaryTag = makeMap(
  8312. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  8313. 'link,meta,param,source,track,wbr'
  8314. );
  8315. // Elements that you can, intentionally, leave open
  8316. // (and which close themselves)
  8317. var canBeLeftOpenTag = makeMap(
  8318. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  8319. );
  8320. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  8321. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  8322. var isNonPhrasingTag = makeMap(
  8323. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  8324. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  8325. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  8326. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  8327. 'title,tr,track'
  8328. );
  8329. /**
  8330. * Not type-checking this file because it's mostly vendor code.
  8331. */
  8332. // Regular Expressions for parsing tags and attributes
  8333. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  8334. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  8335. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  8336. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  8337. var startTagOpen = new RegExp(("^<" + qnameCapture));
  8338. var startTagClose = /^\s*(\/?)>/;
  8339. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  8340. var doctype = /^<!DOCTYPE [^>]+>/i;
  8341. // #7298: escape - to avoid being pased as HTML comment when inlined in page
  8342. var comment = /^<!\--/;
  8343. var conditionalComment = /^<!\[/;
  8344. // Special Elements (can contain anything)
  8345. var isPlainTextElement = makeMap('script,style,textarea', true);
  8346. var reCache = {};
  8347. var decodingMap = {
  8348. '&lt;': '<',
  8349. '&gt;': '>',
  8350. '&quot;': '"',
  8351. '&amp;': '&',
  8352. '&#10;': '\n',
  8353. '&#9;': '\t',
  8354. '&#39;': "'"
  8355. };
  8356. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  8357. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  8358. // #5992
  8359. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  8360. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  8361. function decodeAttr (value, shouldDecodeNewlines) {
  8362. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  8363. return value.replace(re, function (match) { return decodingMap[match]; })
  8364. }
  8365. function parseHTML (html, options) {
  8366. var stack = [];
  8367. var expectHTML = options.expectHTML;
  8368. var isUnaryTag$$1 = options.isUnaryTag || no;
  8369. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  8370. var index = 0;
  8371. var last, lastTag;
  8372. while (html) {
  8373. last = html;
  8374. // Make sure we're not in a plaintext content element like script/style
  8375. if (!lastTag || !isPlainTextElement(lastTag)) {
  8376. var textEnd = html.indexOf('<');
  8377. if (textEnd === 0) {
  8378. // Comment:
  8379. if (comment.test(html)) {
  8380. var commentEnd = html.indexOf('-->');
  8381. if (commentEnd >= 0) {
  8382. if (options.shouldKeepComment) {
  8383. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  8384. }
  8385. advance(commentEnd + 3);
  8386. continue
  8387. }
  8388. }
  8389. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  8390. if (conditionalComment.test(html)) {
  8391. var conditionalEnd = html.indexOf(']>');
  8392. if (conditionalEnd >= 0) {
  8393. advance(conditionalEnd + 2);
  8394. continue
  8395. }
  8396. }
  8397. // Doctype:
  8398. var doctypeMatch = html.match(doctype);
  8399. if (doctypeMatch) {
  8400. advance(doctypeMatch[0].length);
  8401. continue
  8402. }
  8403. // End tag:
  8404. var endTagMatch = html.match(endTag);
  8405. if (endTagMatch) {
  8406. var curIndex = index;
  8407. advance(endTagMatch[0].length);
  8408. parseEndTag(endTagMatch[1], curIndex, index);
  8409. continue
  8410. }
  8411. // Start tag:
  8412. var startTagMatch = parseStartTag();
  8413. if (startTagMatch) {
  8414. handleStartTag(startTagMatch);
  8415. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  8416. advance(1);
  8417. }
  8418. continue
  8419. }
  8420. }
  8421. var text = (void 0), rest = (void 0), next = (void 0);
  8422. if (textEnd >= 0) {
  8423. rest = html.slice(textEnd);
  8424. while (
  8425. !endTag.test(rest) &&
  8426. !startTagOpen.test(rest) &&
  8427. !comment.test(rest) &&
  8428. !conditionalComment.test(rest)
  8429. ) {
  8430. // < in plain text, be forgiving and treat it as text
  8431. next = rest.indexOf('<', 1);
  8432. if (next < 0) { break }
  8433. textEnd += next;
  8434. rest = html.slice(textEnd);
  8435. }
  8436. text = html.substring(0, textEnd);
  8437. }
  8438. if (textEnd < 0) {
  8439. text = html;
  8440. }
  8441. if (text) {
  8442. advance(text.length);
  8443. }
  8444. if (options.chars && text) {
  8445. options.chars(text, index - text.length, index);
  8446. }
  8447. } else {
  8448. var endTagLength = 0;
  8449. var stackedTag = lastTag.toLowerCase();
  8450. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  8451. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  8452. endTagLength = endTag.length;
  8453. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  8454. text = text
  8455. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  8456. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  8457. }
  8458. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  8459. text = text.slice(1);
  8460. }
  8461. if (options.chars) {
  8462. options.chars(text);
  8463. }
  8464. return ''
  8465. });
  8466. index += html.length - rest$1.length;
  8467. html = rest$1;
  8468. parseEndTag(stackedTag, index - endTagLength, index);
  8469. }
  8470. if (html === last) {
  8471. options.chars && options.chars(html);
  8472. if (!stack.length && options.warn) {
  8473. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  8474. }
  8475. break
  8476. }
  8477. }
  8478. // Clean up any remaining tags
  8479. parseEndTag();
  8480. function advance (n) {
  8481. index += n;
  8482. html = html.substring(n);
  8483. }
  8484. function parseStartTag () {
  8485. var start = html.match(startTagOpen);
  8486. if (start) {
  8487. var match = {
  8488. tagName: start[1],
  8489. attrs: [],
  8490. start: index
  8491. };
  8492. advance(start[0].length);
  8493. var end, attr;
  8494. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  8495. attr.start = index;
  8496. advance(attr[0].length);
  8497. attr.end = index;
  8498. match.attrs.push(attr);
  8499. }
  8500. if (end) {
  8501. match.unarySlash = end[1];
  8502. advance(end[0].length);
  8503. match.end = index;
  8504. return match
  8505. }
  8506. }
  8507. }
  8508. function handleStartTag (match) {
  8509. var tagName = match.tagName;
  8510. var unarySlash = match.unarySlash;
  8511. if (expectHTML) {
  8512. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  8513. parseEndTag(lastTag);
  8514. }
  8515. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  8516. parseEndTag(tagName);
  8517. }
  8518. }
  8519. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  8520. var l = match.attrs.length;
  8521. var attrs = new Array(l);
  8522. for (var i = 0; i < l; i++) {
  8523. var args = match.attrs[i];
  8524. var value = args[3] || args[4] || args[5] || '';
  8525. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  8526. ? options.shouldDecodeNewlinesForHref
  8527. : options.shouldDecodeNewlines;
  8528. attrs[i] = {
  8529. name: args[1],
  8530. value: decodeAttr(value, shouldDecodeNewlines)
  8531. };
  8532. if (options.outputSourceRange) {
  8533. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  8534. attrs[i].end = args.end;
  8535. }
  8536. }
  8537. if (!unary) {
  8538. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  8539. lastTag = tagName;
  8540. }
  8541. if (options.start) {
  8542. options.start(tagName, attrs, unary, match.start, match.end);
  8543. }
  8544. }
  8545. function parseEndTag (tagName, start, end) {
  8546. var pos, lowerCasedTagName;
  8547. if (start == null) { start = index; }
  8548. if (end == null) { end = index; }
  8549. // Find the closest opened tag of the same type
  8550. if (tagName) {
  8551. lowerCasedTagName = tagName.toLowerCase();
  8552. for (pos = stack.length - 1; pos >= 0; pos--) {
  8553. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  8554. break
  8555. }
  8556. }
  8557. } else {
  8558. // If no tag name is provided, clean shop
  8559. pos = 0;
  8560. }
  8561. if (pos >= 0) {
  8562. // Close all the open elements, up the stack
  8563. for (var i = stack.length - 1; i >= pos; i--) {
  8564. if (i > pos || !tagName &&
  8565. options.warn
  8566. ) {
  8567. options.warn(
  8568. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  8569. { start: stack[i].start, end: stack[i].end }
  8570. );
  8571. }
  8572. if (options.end) {
  8573. options.end(stack[i].tag, start, end);
  8574. }
  8575. }
  8576. // Remove the open elements from the stack
  8577. stack.length = pos;
  8578. lastTag = pos && stack[pos - 1].tag;
  8579. } else if (lowerCasedTagName === 'br') {
  8580. if (options.start) {
  8581. options.start(tagName, [], true, start, end);
  8582. }
  8583. } else if (lowerCasedTagName === 'p') {
  8584. if (options.start) {
  8585. options.start(tagName, [], false, start, end);
  8586. }
  8587. if (options.end) {
  8588. options.end(tagName, start, end);
  8589. }
  8590. }
  8591. }
  8592. }
  8593. /* */
  8594. var onRE = /^@|^v-on:/;
  8595. var dirRE = /^v-|^@|^:/;
  8596. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  8597. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  8598. var stripParensRE = /^\(|\)$/g;
  8599. var dynamicArgRE = /^\[.*\]$/;
  8600. var argRE = /:(.*)$/;
  8601. var bindRE = /^:|^\.|^v-bind:/;
  8602. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  8603. var slotRE = /^v-slot(:|$)|^#/;
  8604. var lineBreakRE = /[\r\n]/;
  8605. var whitespaceRE$1 = /\s+/g;
  8606. var invalidAttributeRE = /[\s"'<>\/=]/;
  8607. var decodeHTMLCached = cached(he.decode);
  8608. var emptySlotScopeToken = "_empty_";
  8609. // configurable state
  8610. var warn$2;
  8611. var delimiters;
  8612. var transforms;
  8613. var preTransforms;
  8614. var postTransforms;
  8615. var platformIsPreTag;
  8616. var platformMustUseProp;
  8617. var platformGetTagNamespace;
  8618. var maybeComponent;
  8619. function createASTElement (
  8620. tag,
  8621. attrs,
  8622. parent
  8623. ) {
  8624. return {
  8625. type: 1,
  8626. tag: tag,
  8627. attrsList: attrs,
  8628. attrsMap: makeAttrsMap(attrs),
  8629. rawAttrsMap: {},
  8630. parent: parent,
  8631. children: []
  8632. }
  8633. }
  8634. /**
  8635. * Convert HTML string to AST.
  8636. */
  8637. function parse (
  8638. template,
  8639. options
  8640. ) {
  8641. warn$2 = options.warn || baseWarn;
  8642. platformIsPreTag = options.isPreTag || no;
  8643. platformMustUseProp = options.mustUseProp || no;
  8644. platformGetTagNamespace = options.getTagNamespace || no;
  8645. var isReservedTag = options.isReservedTag || no;
  8646. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  8647. transforms = pluckModuleFunction(options.modules, 'transformNode');
  8648. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  8649. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  8650. delimiters = options.delimiters;
  8651. var stack = [];
  8652. var preserveWhitespace = options.preserveWhitespace !== false;
  8653. var whitespaceOption = options.whitespace;
  8654. var root;
  8655. var currentParent;
  8656. var inVPre = false;
  8657. var inPre = false;
  8658. var warned = false;
  8659. function warnOnce (msg, range) {
  8660. if (!warned) {
  8661. warned = true;
  8662. warn$2(msg, range);
  8663. }
  8664. }
  8665. function closeElement (element) {
  8666. trimEndingWhitespace(element);
  8667. if (!inVPre && !element.processed) {
  8668. element = processElement(element, options);
  8669. }
  8670. // tree management
  8671. if (!stack.length && element !== root) {
  8672. // allow root elements with v-if, v-else-if and v-else
  8673. if (root.if && (element.elseif || element.else)) {
  8674. {
  8675. checkRootConstraints(element);
  8676. }
  8677. addIfCondition(root, {
  8678. exp: element.elseif,
  8679. block: element
  8680. });
  8681. } else {
  8682. warnOnce(
  8683. "Component template should contain exactly one root element. " +
  8684. "If you are using v-if on multiple elements, " +
  8685. "use v-else-if to chain them instead.",
  8686. { start: element.start }
  8687. );
  8688. }
  8689. }
  8690. if (currentParent && !element.forbidden) {
  8691. if (element.elseif || element.else) {
  8692. processIfConditions(element, currentParent);
  8693. } else {
  8694. if (element.slotScope) {
  8695. // scoped slot
  8696. // keep it in the children list so that v-else(-if) conditions can
  8697. // find it as the prev node.
  8698. var name = element.slotTarget || '"default"'
  8699. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  8700. }
  8701. currentParent.children.push(element);
  8702. element.parent = currentParent;
  8703. }
  8704. }
  8705. // final children cleanup
  8706. // filter out scoped slots
  8707. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  8708. // remove trailing whitespace node again
  8709. trimEndingWhitespace(element);
  8710. // check pre state
  8711. if (element.pre) {
  8712. inVPre = false;
  8713. }
  8714. if (platformIsPreTag(element.tag)) {
  8715. inPre = false;
  8716. }
  8717. // apply post-transforms
  8718. for (var i = 0; i < postTransforms.length; i++) {
  8719. postTransforms[i](element, options);
  8720. }
  8721. }
  8722. function trimEndingWhitespace (el) {
  8723. // remove trailing whitespace node
  8724. if (!inPre) {
  8725. var lastNode;
  8726. while (
  8727. (lastNode = el.children[el.children.length - 1]) &&
  8728. lastNode.type === 3 &&
  8729. lastNode.text === ' '
  8730. ) {
  8731. el.children.pop();
  8732. }
  8733. }
  8734. }
  8735. function checkRootConstraints (el) {
  8736. if (el.tag === 'slot' || el.tag === 'template') {
  8737. warnOnce(
  8738. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  8739. 'contain multiple nodes.',
  8740. { start: el.start }
  8741. );
  8742. }
  8743. if (el.attrsMap.hasOwnProperty('v-for')) {
  8744. warnOnce(
  8745. 'Cannot use v-for on stateful component root element because ' +
  8746. 'it renders multiple elements.',
  8747. el.rawAttrsMap['v-for']
  8748. );
  8749. }
  8750. }
  8751. parseHTML(template, {
  8752. warn: warn$2,
  8753. expectHTML: options.expectHTML,
  8754. isUnaryTag: options.isUnaryTag,
  8755. canBeLeftOpenTag: options.canBeLeftOpenTag,
  8756. shouldDecodeNewlines: options.shouldDecodeNewlines,
  8757. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  8758. shouldKeepComment: options.comments,
  8759. outputSourceRange: options.outputSourceRange,
  8760. start: function start (tag, attrs, unary, start$1, end) {
  8761. // check namespace.
  8762. // inherit parent ns if there is one
  8763. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  8764. // handle IE svg bug
  8765. /* istanbul ignore if */
  8766. if (isIE && ns === 'svg') {
  8767. attrs = guardIESVGBug(attrs);
  8768. }
  8769. var element = createASTElement(tag, attrs, currentParent);
  8770. if (ns) {
  8771. element.ns = ns;
  8772. }
  8773. {
  8774. if (options.outputSourceRange) {
  8775. element.start = start$1;
  8776. element.end = end;
  8777. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  8778. cumulated[attr.name] = attr;
  8779. return cumulated
  8780. }, {});
  8781. }
  8782. attrs.forEach(function (attr) {
  8783. if (invalidAttributeRE.test(attr.name)) {
  8784. warn$2(
  8785. "Invalid dynamic argument expression: attribute names cannot contain " +
  8786. "spaces, quotes, <, >, / or =.",
  8787. {
  8788. start: attr.start + attr.name.indexOf("["),
  8789. end: attr.start + attr.name.length
  8790. }
  8791. );
  8792. }
  8793. });
  8794. }
  8795. if (isForbiddenTag(element) && !isServerRendering()) {
  8796. element.forbidden = true;
  8797. warn$2(
  8798. 'Templates should only be responsible for mapping the state to the ' +
  8799. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  8800. "<" + tag + ">" + ', as they will not be parsed.',
  8801. { start: element.start }
  8802. );
  8803. }
  8804. // apply pre-transforms
  8805. for (var i = 0; i < preTransforms.length; i++) {
  8806. element = preTransforms[i](element, options) || element;
  8807. }
  8808. if (!inVPre) {
  8809. processPre(element);
  8810. if (element.pre) {
  8811. inVPre = true;
  8812. }
  8813. }
  8814. if (platformIsPreTag(element.tag)) {
  8815. inPre = true;
  8816. }
  8817. if (inVPre) {
  8818. processRawAttrs(element);
  8819. } else if (!element.processed) {
  8820. // structural directives
  8821. processFor(element);
  8822. processIf(element);
  8823. processOnce(element);
  8824. }
  8825. if (!root) {
  8826. root = element;
  8827. {
  8828. checkRootConstraints(root);
  8829. }
  8830. }
  8831. if (!unary) {
  8832. currentParent = element;
  8833. stack.push(element);
  8834. } else {
  8835. closeElement(element);
  8836. }
  8837. },
  8838. end: function end (tag, start, end$1) {
  8839. var element = stack[stack.length - 1];
  8840. // pop stack
  8841. stack.length -= 1;
  8842. currentParent = stack[stack.length - 1];
  8843. if (options.outputSourceRange) {
  8844. element.end = end$1;
  8845. }
  8846. closeElement(element);
  8847. },
  8848. chars: function chars (text, start, end) {
  8849. if (!currentParent) {
  8850. {
  8851. if (text === template) {
  8852. warnOnce(
  8853. 'Component template requires a root element, rather than just text.',
  8854. { start: start }
  8855. );
  8856. } else if ((text = text.trim())) {
  8857. warnOnce(
  8858. ("text \"" + text + "\" outside root element will be ignored."),
  8859. { start: start }
  8860. );
  8861. }
  8862. }
  8863. return
  8864. }
  8865. // IE textarea placeholder bug
  8866. /* istanbul ignore if */
  8867. if (isIE &&
  8868. currentParent.tag === 'textarea' &&
  8869. currentParent.attrsMap.placeholder === text
  8870. ) {
  8871. return
  8872. }
  8873. var children = currentParent.children;
  8874. if (inPre || text.trim()) {
  8875. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  8876. } else if (!children.length) {
  8877. // remove the whitespace-only node right after an opening tag
  8878. text = '';
  8879. } else if (whitespaceOption) {
  8880. if (whitespaceOption === 'condense') {
  8881. // in condense mode, remove the whitespace node if it contains
  8882. // line break, otherwise condense to a single space
  8883. text = lineBreakRE.test(text) ? '' : ' ';
  8884. } else {
  8885. text = ' ';
  8886. }
  8887. } else {
  8888. text = preserveWhitespace ? ' ' : '';
  8889. }
  8890. if (text) {
  8891. if (!inPre && whitespaceOption === 'condense') {
  8892. // condense consecutive whitespaces into single space
  8893. text = text.replace(whitespaceRE$1, ' ');
  8894. }
  8895. var res;
  8896. var child;
  8897. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  8898. child = {
  8899. type: 2,
  8900. expression: res.expression,
  8901. tokens: res.tokens,
  8902. text: text
  8903. };
  8904. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  8905. child = {
  8906. type: 3,
  8907. text: text
  8908. };
  8909. }
  8910. if (child) {
  8911. if (options.outputSourceRange) {
  8912. child.start = start;
  8913. child.end = end;
  8914. }
  8915. children.push(child);
  8916. }
  8917. }
  8918. },
  8919. comment: function comment (text, start, end) {
  8920. // adding anyting as a sibling to the root node is forbidden
  8921. // comments should still be allowed, but ignored
  8922. if (currentParent) {
  8923. var child = {
  8924. type: 3,
  8925. text: text,
  8926. isComment: true
  8927. };
  8928. if (options.outputSourceRange) {
  8929. child.start = start;
  8930. child.end = end;
  8931. }
  8932. currentParent.children.push(child);
  8933. }
  8934. }
  8935. });
  8936. return root
  8937. }
  8938. function processPre (el) {
  8939. if (getAndRemoveAttr(el, 'v-pre') != null) {
  8940. el.pre = true;
  8941. }
  8942. }
  8943. function processRawAttrs (el) {
  8944. var list = el.attrsList;
  8945. var len = list.length;
  8946. if (len) {
  8947. var attrs = el.attrs = new Array(len);
  8948. for (var i = 0; i < len; i++) {
  8949. attrs[i] = {
  8950. name: list[i].name,
  8951. value: JSON.stringify(list[i].value)
  8952. };
  8953. if (list[i].start != null) {
  8954. attrs[i].start = list[i].start;
  8955. attrs[i].end = list[i].end;
  8956. }
  8957. }
  8958. } else if (!el.pre) {
  8959. // non root node in pre blocks with no attributes
  8960. el.plain = true;
  8961. }
  8962. }
  8963. function processElement (
  8964. element,
  8965. options
  8966. ) {
  8967. processKey(element);
  8968. // determine whether this is a plain element after
  8969. // removing structural attributes
  8970. element.plain = (
  8971. !element.key &&
  8972. !element.scopedSlots &&
  8973. !element.attrsList.length
  8974. );
  8975. processRef(element);
  8976. processSlotContent(element);
  8977. processSlotOutlet(element);
  8978. processComponent(element);
  8979. for (var i = 0; i < transforms.length; i++) {
  8980. element = transforms[i](element, options) || element;
  8981. }
  8982. processAttrs(element);
  8983. return element
  8984. }
  8985. function processKey (el) {
  8986. var exp = getBindingAttr(el, 'key');
  8987. if (exp) {
  8988. {
  8989. if (el.tag === 'template') {
  8990. warn$2(
  8991. "<template> cannot be keyed. Place the key on real elements instead.",
  8992. getRawBindingAttr(el, 'key')
  8993. );
  8994. }
  8995. if (el.for) {
  8996. var iterator = el.iterator2 || el.iterator1;
  8997. var parent = el.parent;
  8998. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  8999. warn$2(
  9000. "Do not use v-for index as key on <transition-group> children, " +
  9001. "this is the same as not using keys.",
  9002. getRawBindingAttr(el, 'key'),
  9003. true /* tip */
  9004. );
  9005. }
  9006. }
  9007. }
  9008. el.key = exp;
  9009. }
  9010. }
  9011. function processRef (el) {
  9012. var ref = getBindingAttr(el, 'ref');
  9013. if (ref) {
  9014. el.ref = ref;
  9015. el.refInFor = checkInFor(el);
  9016. }
  9017. }
  9018. function processFor (el) {
  9019. var exp;
  9020. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  9021. var res = parseFor(exp);
  9022. if (res) {
  9023. extend(el, res);
  9024. } else {
  9025. warn$2(
  9026. ("Invalid v-for expression: " + exp),
  9027. el.rawAttrsMap['v-for']
  9028. );
  9029. }
  9030. }
  9031. }
  9032. function parseFor (exp) {
  9033. var inMatch = exp.match(forAliasRE);
  9034. if (!inMatch) { return }
  9035. var res = {};
  9036. res.for = inMatch[2].trim();
  9037. var alias = inMatch[1].trim().replace(stripParensRE, '');
  9038. var iteratorMatch = alias.match(forIteratorRE);
  9039. if (iteratorMatch) {
  9040. res.alias = alias.replace(forIteratorRE, '').trim();
  9041. res.iterator1 = iteratorMatch[1].trim();
  9042. if (iteratorMatch[2]) {
  9043. res.iterator2 = iteratorMatch[2].trim();
  9044. }
  9045. } else {
  9046. res.alias = alias;
  9047. }
  9048. return res
  9049. }
  9050. function processIf (el) {
  9051. var exp = getAndRemoveAttr(el, 'v-if');
  9052. if (exp) {
  9053. el.if = exp;
  9054. addIfCondition(el, {
  9055. exp: exp,
  9056. block: el
  9057. });
  9058. } else {
  9059. if (getAndRemoveAttr(el, 'v-else') != null) {
  9060. el.else = true;
  9061. }
  9062. var elseif = getAndRemoveAttr(el, 'v-else-if');
  9063. if (elseif) {
  9064. el.elseif = elseif;
  9065. }
  9066. }
  9067. }
  9068. function processIfConditions (el, parent) {
  9069. var prev = findPrevElement(parent.children);
  9070. if (prev && prev.if) {
  9071. addIfCondition(prev, {
  9072. exp: el.elseif,
  9073. block: el
  9074. });
  9075. } else {
  9076. warn$2(
  9077. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  9078. "used on element <" + (el.tag) + "> without corresponding v-if.",
  9079. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  9080. );
  9081. }
  9082. }
  9083. function findPrevElement (children) {
  9084. var i = children.length;
  9085. while (i--) {
  9086. if (children[i].type === 1) {
  9087. return children[i]
  9088. } else {
  9089. if (children[i].text !== ' ') {
  9090. warn$2(
  9091. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  9092. "will be ignored.",
  9093. children[i]
  9094. );
  9095. }
  9096. children.pop();
  9097. }
  9098. }
  9099. }
  9100. function addIfCondition (el, condition) {
  9101. if (!el.ifConditions) {
  9102. el.ifConditions = [];
  9103. }
  9104. el.ifConditions.push(condition);
  9105. }
  9106. function processOnce (el) {
  9107. var once$$1 = getAndRemoveAttr(el, 'v-once');
  9108. if (once$$1 != null) {
  9109. el.once = true;
  9110. }
  9111. }
  9112. // handle content being passed to a component as slot,
  9113. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  9114. function processSlotContent (el) {
  9115. var slotScope;
  9116. if (el.tag === 'template') {
  9117. slotScope = getAndRemoveAttr(el, 'scope');
  9118. /* istanbul ignore if */
  9119. if (slotScope) {
  9120. warn$2(
  9121. "the \"scope\" attribute for scoped slots have been deprecated and " +
  9122. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  9123. "can also be used on plain elements in addition to <template> to " +
  9124. "denote scoped slots.",
  9125. el.rawAttrsMap['scope'],
  9126. true
  9127. );
  9128. }
  9129. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  9130. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  9131. /* istanbul ignore if */
  9132. if (el.attrsMap['v-for']) {
  9133. warn$2(
  9134. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  9135. "(v-for takes higher priority). Use a wrapper <template> for the " +
  9136. "scoped slot to make it clearer.",
  9137. el.rawAttrsMap['slot-scope'],
  9138. true
  9139. );
  9140. }
  9141. el.slotScope = slotScope;
  9142. }
  9143. // slot="xxx"
  9144. var slotTarget = getBindingAttr(el, 'slot');
  9145. if (slotTarget) {
  9146. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  9147. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  9148. // preserve slot as an attribute for native shadow DOM compat
  9149. // only for non-scoped slots.
  9150. if (el.tag !== 'template' && !el.slotScope) {
  9151. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  9152. }
  9153. }
  9154. // 2.6 v-slot syntax
  9155. {
  9156. if (el.tag === 'template') {
  9157. // v-slot on <template>
  9158. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  9159. if (slotBinding) {
  9160. {
  9161. if (el.slotTarget || el.slotScope) {
  9162. warn$2(
  9163. "Unexpected mixed usage of different slot syntaxes.",
  9164. el
  9165. );
  9166. }
  9167. if (el.parent && !maybeComponent(el.parent)) {
  9168. warn$2(
  9169. "<template v-slot> can only appear at the root level inside " +
  9170. "the receiving the component",
  9171. el
  9172. );
  9173. }
  9174. }
  9175. var ref = getSlotName(slotBinding);
  9176. var name = ref.name;
  9177. var dynamic = ref.dynamic;
  9178. el.slotTarget = name;
  9179. el.slotTargetDynamic = dynamic;
  9180. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  9181. }
  9182. } else {
  9183. // v-slot on component, denotes default slot
  9184. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  9185. if (slotBinding$1) {
  9186. {
  9187. if (!maybeComponent(el)) {
  9188. warn$2(
  9189. "v-slot can only be used on components or <template>.",
  9190. slotBinding$1
  9191. );
  9192. }
  9193. if (el.slotScope || el.slotTarget) {
  9194. warn$2(
  9195. "Unexpected mixed usage of different slot syntaxes.",
  9196. el
  9197. );
  9198. }
  9199. if (el.scopedSlots) {
  9200. warn$2(
  9201. "To avoid scope ambiguity, the default slot should also use " +
  9202. "<template> syntax when there are other named slots.",
  9203. slotBinding$1
  9204. );
  9205. }
  9206. }
  9207. // add the component's children to its default slot
  9208. var slots = el.scopedSlots || (el.scopedSlots = {});
  9209. var ref$1 = getSlotName(slotBinding$1);
  9210. var name$1 = ref$1.name;
  9211. var dynamic$1 = ref$1.dynamic;
  9212. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  9213. slotContainer.slotTarget = name$1;
  9214. slotContainer.slotTargetDynamic = dynamic$1;
  9215. slotContainer.children = el.children.filter(function (c) {
  9216. if (!c.slotScope) {
  9217. c.parent = slotContainer;
  9218. return true
  9219. }
  9220. });
  9221. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  9222. // remove children as they are returned from scopedSlots now
  9223. el.children = [];
  9224. // mark el non-plain so data gets generated
  9225. el.plain = false;
  9226. }
  9227. }
  9228. }
  9229. }
  9230. function getSlotName (binding) {
  9231. var name = binding.name.replace(slotRE, '');
  9232. if (!name) {
  9233. if (binding.name[0] !== '#') {
  9234. name = 'default';
  9235. } else {
  9236. warn$2(
  9237. "v-slot shorthand syntax requires a slot name.",
  9238. binding
  9239. );
  9240. }
  9241. }
  9242. return dynamicArgRE.test(name)
  9243. // dynamic [name]
  9244. ? { name: name.slice(1, -1), dynamic: true }
  9245. // static name
  9246. : { name: ("\"" + name + "\""), dynamic: false }
  9247. }
  9248. // handle <slot/> outlets
  9249. function processSlotOutlet (el) {
  9250. if (el.tag === 'slot') {
  9251. el.slotName = getBindingAttr(el, 'name');
  9252. if (el.key) {
  9253. warn$2(
  9254. "`key` does not work on <slot> because slots are abstract outlets " +
  9255. "and can possibly expand into multiple elements. " +
  9256. "Use the key on a wrapping element instead.",
  9257. getRawBindingAttr(el, 'key')
  9258. );
  9259. }
  9260. }
  9261. }
  9262. function processComponent (el) {
  9263. var binding;
  9264. if ((binding = getBindingAttr(el, 'is'))) {
  9265. el.component = binding;
  9266. }
  9267. if (getAndRemoveAttr(el, 'inline-template') != null) {
  9268. el.inlineTemplate = true;
  9269. }
  9270. }
  9271. function processAttrs (el) {
  9272. var list = el.attrsList;
  9273. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  9274. for (i = 0, l = list.length; i < l; i++) {
  9275. name = rawName = list[i].name;
  9276. value = list[i].value;
  9277. if (dirRE.test(name)) {
  9278. // mark element as dynamic
  9279. el.hasBindings = true;
  9280. // modifiers
  9281. modifiers = parseModifiers(name.replace(dirRE, ''));
  9282. // support .foo shorthand syntax for the .prop modifier
  9283. if (modifiers) {
  9284. name = name.replace(modifierRE, '');
  9285. }
  9286. if (bindRE.test(name)) { // v-bind
  9287. name = name.replace(bindRE, '');
  9288. value = parseFilters(value);
  9289. isDynamic = dynamicArgRE.test(name);
  9290. if (isDynamic) {
  9291. name = name.slice(1, -1);
  9292. }
  9293. if (
  9294. value.trim().length === 0
  9295. ) {
  9296. warn$2(
  9297. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  9298. );
  9299. }
  9300. if (modifiers) {
  9301. if (modifiers.prop && !isDynamic) {
  9302. name = camelize(name);
  9303. if (name === 'innerHtml') { name = 'innerHTML'; }
  9304. }
  9305. if (modifiers.camel && !isDynamic) {
  9306. name = camelize(name);
  9307. }
  9308. if (modifiers.sync) {
  9309. syncGen = genAssignmentCode(value, "$event");
  9310. if (!isDynamic) {
  9311. addHandler(
  9312. el,
  9313. ("update:" + (camelize(name))),
  9314. syncGen,
  9315. null,
  9316. false,
  9317. warn$2,
  9318. list[i]
  9319. );
  9320. if (hyphenate(name) !== camelize(name)) {
  9321. addHandler(
  9322. el,
  9323. ("update:" + (hyphenate(name))),
  9324. syncGen,
  9325. null,
  9326. false,
  9327. warn$2,
  9328. list[i]
  9329. );
  9330. }
  9331. } else {
  9332. // handler w/ dynamic event name
  9333. addHandler(
  9334. el,
  9335. ("\"update:\"+(" + name + ")"),
  9336. syncGen,
  9337. null,
  9338. false,
  9339. warn$2,
  9340. list[i],
  9341. true // dynamic
  9342. );
  9343. }
  9344. }
  9345. }
  9346. if ((modifiers && modifiers.prop) || (
  9347. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  9348. )) {
  9349. addProp(el, name, value, list[i], isDynamic);
  9350. } else {
  9351. addAttr(el, name, value, list[i], isDynamic);
  9352. }
  9353. } else if (onRE.test(name)) { // v-on
  9354. name = name.replace(onRE, '');
  9355. isDynamic = dynamicArgRE.test(name);
  9356. if (isDynamic) {
  9357. name = name.slice(1, -1);
  9358. }
  9359. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  9360. } else { // normal directives
  9361. name = name.replace(dirRE, '');
  9362. // parse arg
  9363. var argMatch = name.match(argRE);
  9364. var arg = argMatch && argMatch[1];
  9365. isDynamic = false;
  9366. if (arg) {
  9367. name = name.slice(0, -(arg.length + 1));
  9368. if (dynamicArgRE.test(arg)) {
  9369. arg = arg.slice(1, -1);
  9370. isDynamic = true;
  9371. }
  9372. }
  9373. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  9374. if (name === 'model') {
  9375. checkForAliasModel(el, value);
  9376. }
  9377. }
  9378. } else {
  9379. // literal attribute
  9380. {
  9381. var res = parseText(value, delimiters);
  9382. if (res) {
  9383. warn$2(
  9384. name + "=\"" + value + "\": " +
  9385. 'Interpolation inside attributes has been removed. ' +
  9386. 'Use v-bind or the colon shorthand instead. For example, ' +
  9387. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  9388. list[i]
  9389. );
  9390. }
  9391. }
  9392. addAttr(el, name, JSON.stringify(value), list[i]);
  9393. // #6887 firefox doesn't update muted state if set via attribute
  9394. // even immediately after element creation
  9395. if (!el.component &&
  9396. name === 'muted' &&
  9397. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  9398. addProp(el, name, 'true', list[i]);
  9399. }
  9400. }
  9401. }
  9402. }
  9403. function checkInFor (el) {
  9404. var parent = el;
  9405. while (parent) {
  9406. if (parent.for !== undefined) {
  9407. return true
  9408. }
  9409. parent = parent.parent;
  9410. }
  9411. return false
  9412. }
  9413. function parseModifiers (name) {
  9414. var match = name.match(modifierRE);
  9415. if (match) {
  9416. var ret = {};
  9417. match.forEach(function (m) { ret[m.slice(1)] = true; });
  9418. return ret
  9419. }
  9420. }
  9421. function makeAttrsMap (attrs) {
  9422. var map = {};
  9423. for (var i = 0, l = attrs.length; i < l; i++) {
  9424. if (
  9425. map[attrs[i].name] && !isIE && !isEdge
  9426. ) {
  9427. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  9428. }
  9429. map[attrs[i].name] = attrs[i].value;
  9430. }
  9431. return map
  9432. }
  9433. // for script (e.g. type="x/template") or style, do not decode content
  9434. function isTextTag (el) {
  9435. return el.tag === 'script' || el.tag === 'style'
  9436. }
  9437. function isForbiddenTag (el) {
  9438. return (
  9439. el.tag === 'style' ||
  9440. (el.tag === 'script' && (
  9441. !el.attrsMap.type ||
  9442. el.attrsMap.type === 'text/javascript'
  9443. ))
  9444. )
  9445. }
  9446. var ieNSBug = /^xmlns:NS\d+/;
  9447. var ieNSPrefix = /^NS\d+:/;
  9448. /* istanbul ignore next */
  9449. function guardIESVGBug (attrs) {
  9450. var res = [];
  9451. for (var i = 0; i < attrs.length; i++) {
  9452. var attr = attrs[i];
  9453. if (!ieNSBug.test(attr.name)) {
  9454. attr.name = attr.name.replace(ieNSPrefix, '');
  9455. res.push(attr);
  9456. }
  9457. }
  9458. return res
  9459. }
  9460. function checkForAliasModel (el, value) {
  9461. var _el = el;
  9462. while (_el) {
  9463. if (_el.for && _el.alias === value) {
  9464. warn$2(
  9465. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  9466. "You are binding v-model directly to a v-for iteration alias. " +
  9467. "This will not be able to modify the v-for source array because " +
  9468. "writing to the alias is like modifying a function local variable. " +
  9469. "Consider using an array of objects and use v-model on an object property instead.",
  9470. el.rawAttrsMap['v-model']
  9471. );
  9472. }
  9473. _el = _el.parent;
  9474. }
  9475. }
  9476. /* */
  9477. function preTransformNode (el, options) {
  9478. if (el.tag === 'input') {
  9479. var map = el.attrsMap;
  9480. if (!map['v-model']) {
  9481. return
  9482. }
  9483. var typeBinding;
  9484. if (map[':type'] || map['v-bind:type']) {
  9485. typeBinding = getBindingAttr(el, 'type');
  9486. }
  9487. if (!map.type && !typeBinding && map['v-bind']) {
  9488. typeBinding = "(" + (map['v-bind']) + ").type";
  9489. }
  9490. if (typeBinding) {
  9491. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  9492. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  9493. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  9494. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  9495. // 1. checkbox
  9496. var branch0 = cloneASTElement(el);
  9497. // process for on the main node
  9498. processFor(branch0);
  9499. addRawAttr(branch0, 'type', 'checkbox');
  9500. processElement(branch0, options);
  9501. branch0.processed = true; // prevent it from double-processed
  9502. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  9503. addIfCondition(branch0, {
  9504. exp: branch0.if,
  9505. block: branch0
  9506. });
  9507. // 2. add radio else-if condition
  9508. var branch1 = cloneASTElement(el);
  9509. getAndRemoveAttr(branch1, 'v-for', true);
  9510. addRawAttr(branch1, 'type', 'radio');
  9511. processElement(branch1, options);
  9512. addIfCondition(branch0, {
  9513. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  9514. block: branch1
  9515. });
  9516. // 3. other
  9517. var branch2 = cloneASTElement(el);
  9518. getAndRemoveAttr(branch2, 'v-for', true);
  9519. addRawAttr(branch2, ':type', typeBinding);
  9520. processElement(branch2, options);
  9521. addIfCondition(branch0, {
  9522. exp: ifCondition,
  9523. block: branch2
  9524. });
  9525. if (hasElse) {
  9526. branch0.else = true;
  9527. } else if (elseIfCondition) {
  9528. branch0.elseif = elseIfCondition;
  9529. }
  9530. return branch0
  9531. }
  9532. }
  9533. }
  9534. function cloneASTElement (el) {
  9535. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  9536. }
  9537. var model$1 = {
  9538. preTransformNode: preTransformNode
  9539. };
  9540. var modules$1 = [
  9541. klass$1,
  9542. style$1,
  9543. model$1
  9544. ];
  9545. /* */
  9546. function text (el, dir) {
  9547. if (dir.value) {
  9548. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  9549. }
  9550. }
  9551. /* */
  9552. function html (el, dir) {
  9553. if (dir.value) {
  9554. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  9555. }
  9556. }
  9557. var directives$1 = {
  9558. model: model,
  9559. text: text,
  9560. html: html
  9561. };
  9562. /* */
  9563. var baseOptions = {
  9564. expectHTML: true,
  9565. modules: modules$1,
  9566. directives: directives$1,
  9567. isPreTag: isPreTag,
  9568. isUnaryTag: isUnaryTag,
  9569. mustUseProp: mustUseProp,
  9570. canBeLeftOpenTag: canBeLeftOpenTag,
  9571. isReservedTag: isReservedTag,
  9572. getTagNamespace: getTagNamespace,
  9573. staticKeys: genStaticKeys(modules$1)
  9574. };
  9575. /* */
  9576. var isStaticKey;
  9577. var isPlatformReservedTag;
  9578. var genStaticKeysCached = cached(genStaticKeys$1);
  9579. /**
  9580. * Goal of the optimizer: walk the generated template AST tree
  9581. * and detect sub-trees that are purely static, i.e. parts of
  9582. * the DOM that never needs to change.
  9583. *
  9584. * Once we detect these sub-trees, we can:
  9585. *
  9586. * 1. Hoist them into constants, so that we no longer need to
  9587. * create fresh nodes for them on each re-render;
  9588. * 2. Completely skip them in the patching process.
  9589. */
  9590. function optimize (root, options) {
  9591. if (!root) { return }
  9592. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  9593. isPlatformReservedTag = options.isReservedTag || no;
  9594. // first pass: mark all non-static nodes.
  9595. markStatic$1(root);
  9596. // second pass: mark static roots.
  9597. markStaticRoots(root, false);
  9598. }
  9599. function genStaticKeys$1 (keys) {
  9600. return makeMap(
  9601. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  9602. (keys ? ',' + keys : '')
  9603. )
  9604. }
  9605. function markStatic$1 (node) {
  9606. node.static = isStatic(node);
  9607. if (node.type === 1) {
  9608. // do not make component slot content static. this avoids
  9609. // 1. components not able to mutate slot nodes
  9610. // 2. static slot content fails for hot-reloading
  9611. if (
  9612. !isPlatformReservedTag(node.tag) &&
  9613. node.tag !== 'slot' &&
  9614. node.attrsMap['inline-template'] == null
  9615. ) {
  9616. return
  9617. }
  9618. for (var i = 0, l = node.children.length; i < l; i++) {
  9619. var child = node.children[i];
  9620. markStatic$1(child);
  9621. if (!child.static) {
  9622. node.static = false;
  9623. }
  9624. }
  9625. if (node.ifConditions) {
  9626. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  9627. var block = node.ifConditions[i$1].block;
  9628. markStatic$1(block);
  9629. if (!block.static) {
  9630. node.static = false;
  9631. }
  9632. }
  9633. }
  9634. }
  9635. }
  9636. function markStaticRoots (node, isInFor) {
  9637. if (node.type === 1) {
  9638. if (node.static || node.once) {
  9639. node.staticInFor = isInFor;
  9640. }
  9641. // For a node to qualify as a static root, it should have children that
  9642. // are not just static text. Otherwise the cost of hoisting out will
  9643. // outweigh the benefits and it's better off to just always render it fresh.
  9644. if (node.static && node.children.length && !(
  9645. node.children.length === 1 &&
  9646. node.children[0].type === 3
  9647. )) {
  9648. node.staticRoot = true;
  9649. return
  9650. } else {
  9651. node.staticRoot = false;
  9652. }
  9653. if (node.children) {
  9654. for (var i = 0, l = node.children.length; i < l; i++) {
  9655. markStaticRoots(node.children[i], isInFor || !!node.for);
  9656. }
  9657. }
  9658. if (node.ifConditions) {
  9659. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  9660. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  9661. }
  9662. }
  9663. }
  9664. }
  9665. function isStatic (node) {
  9666. if (node.type === 2) { // expression
  9667. return false
  9668. }
  9669. if (node.type === 3) { // text
  9670. return true
  9671. }
  9672. return !!(node.pre || (
  9673. !node.hasBindings && // no dynamic bindings
  9674. !node.if && !node.for && // not v-if or v-for or v-else
  9675. !isBuiltInTag(node.tag) && // not a built-in
  9676. isPlatformReservedTag(node.tag) && // not a component
  9677. !isDirectChildOfTemplateFor(node) &&
  9678. Object.keys(node).every(isStaticKey)
  9679. ))
  9680. }
  9681. function isDirectChildOfTemplateFor (node) {
  9682. while (node.parent) {
  9683. node = node.parent;
  9684. if (node.tag !== 'template') {
  9685. return false
  9686. }
  9687. if (node.for) {
  9688. return true
  9689. }
  9690. }
  9691. return false
  9692. }
  9693. /* */
  9694. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*(?:[\w$]+)?\s*\(/;
  9695. var fnInvokeRE = /\([^)]*?\);*$/;
  9696. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  9697. // KeyboardEvent.keyCode aliases
  9698. var keyCodes = {
  9699. esc: 27,
  9700. tab: 9,
  9701. enter: 13,
  9702. space: 32,
  9703. up: 38,
  9704. left: 37,
  9705. right: 39,
  9706. down: 40,
  9707. 'delete': [8, 46]
  9708. };
  9709. // KeyboardEvent.key aliases
  9710. var keyNames = {
  9711. // #7880: IE11 and Edge use `Esc` for Escape key name.
  9712. esc: ['Esc', 'Escape'],
  9713. tab: 'Tab',
  9714. enter: 'Enter',
  9715. // #9112: IE11 uses `Spacebar` for Space key name.
  9716. space: [' ', 'Spacebar'],
  9717. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  9718. up: ['Up', 'ArrowUp'],
  9719. left: ['Left', 'ArrowLeft'],
  9720. right: ['Right', 'ArrowRight'],
  9721. down: ['Down', 'ArrowDown'],
  9722. // #9112: IE11 uses `Del` for Delete key name.
  9723. 'delete': ['Backspace', 'Delete', 'Del']
  9724. };
  9725. // #4868: modifiers that prevent the execution of the listener
  9726. // need to explicitly return null so that we can determine whether to remove
  9727. // the listener for .once
  9728. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  9729. var modifierCode = {
  9730. stop: '$event.stopPropagation();',
  9731. prevent: '$event.preventDefault();',
  9732. self: genGuard("$event.target !== $event.currentTarget"),
  9733. ctrl: genGuard("!$event.ctrlKey"),
  9734. shift: genGuard("!$event.shiftKey"),
  9735. alt: genGuard("!$event.altKey"),
  9736. meta: genGuard("!$event.metaKey"),
  9737. left: genGuard("'button' in $event && $event.button !== 0"),
  9738. middle: genGuard("'button' in $event && $event.button !== 1"),
  9739. right: genGuard("'button' in $event && $event.button !== 2")
  9740. };
  9741. function genHandlers (
  9742. events,
  9743. isNative
  9744. ) {
  9745. var prefix = isNative ? 'nativeOn:' : 'on:';
  9746. var staticHandlers = "";
  9747. var dynamicHandlers = "";
  9748. for (var name in events) {
  9749. var handlerCode = genHandler(events[name]);
  9750. if (events[name] && events[name].dynamic) {
  9751. dynamicHandlers += name + "," + handlerCode + ",";
  9752. } else {
  9753. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  9754. }
  9755. }
  9756. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  9757. if (dynamicHandlers) {
  9758. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  9759. } else {
  9760. return prefix + staticHandlers
  9761. }
  9762. }
  9763. function genHandler (handler) {
  9764. if (!handler) {
  9765. return 'function(){}'
  9766. }
  9767. if (Array.isArray(handler)) {
  9768. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  9769. }
  9770. var isMethodPath = simplePathRE.test(handler.value);
  9771. var isFunctionExpression = fnExpRE.test(handler.value);
  9772. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  9773. if (!handler.modifiers) {
  9774. if (isMethodPath || isFunctionExpression) {
  9775. return handler.value
  9776. }
  9777. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  9778. } else {
  9779. var code = '';
  9780. var genModifierCode = '';
  9781. var keys = [];
  9782. for (var key in handler.modifiers) {
  9783. if (modifierCode[key]) {
  9784. genModifierCode += modifierCode[key];
  9785. // left/right
  9786. if (keyCodes[key]) {
  9787. keys.push(key);
  9788. }
  9789. } else if (key === 'exact') {
  9790. var modifiers = (handler.modifiers);
  9791. genModifierCode += genGuard(
  9792. ['ctrl', 'shift', 'alt', 'meta']
  9793. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  9794. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  9795. .join('||')
  9796. );
  9797. } else {
  9798. keys.push(key);
  9799. }
  9800. }
  9801. if (keys.length) {
  9802. code += genKeyFilter(keys);
  9803. }
  9804. // Make sure modifiers like prevent and stop get executed after key filtering
  9805. if (genModifierCode) {
  9806. code += genModifierCode;
  9807. }
  9808. var handlerCode = isMethodPath
  9809. ? ("return " + (handler.value) + "($event)")
  9810. : isFunctionExpression
  9811. ? ("return (" + (handler.value) + ")($event)")
  9812. : isFunctionInvocation
  9813. ? ("return " + (handler.value))
  9814. : handler.value;
  9815. return ("function($event){" + code + handlerCode + "}")
  9816. }
  9817. }
  9818. function genKeyFilter (keys) {
  9819. return (
  9820. // make sure the key filters only apply to KeyboardEvents
  9821. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  9822. // key events that do not have keyCode property...
  9823. "if(!$event.type.indexOf('key')&&" +
  9824. (keys.map(genFilterCode).join('&&')) + ")return null;"
  9825. )
  9826. }
  9827. function genFilterCode (key) {
  9828. var keyVal = parseInt(key, 10);
  9829. if (keyVal) {
  9830. return ("$event.keyCode!==" + keyVal)
  9831. }
  9832. var keyCode = keyCodes[key];
  9833. var keyName = keyNames[key];
  9834. return (
  9835. "_k($event.keyCode," +
  9836. (JSON.stringify(key)) + "," +
  9837. (JSON.stringify(keyCode)) + "," +
  9838. "$event.key," +
  9839. "" + (JSON.stringify(keyName)) +
  9840. ")"
  9841. )
  9842. }
  9843. /* */
  9844. function on (el, dir) {
  9845. if (dir.modifiers) {
  9846. warn("v-on without argument does not support modifiers.");
  9847. }
  9848. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  9849. }
  9850. /* */
  9851. function bind$1 (el, dir) {
  9852. el.wrapData = function (code) {
  9853. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  9854. };
  9855. }
  9856. /* */
  9857. var baseDirectives = {
  9858. on: on,
  9859. bind: bind$1,
  9860. cloak: noop
  9861. };
  9862. /* */
  9863. var CodegenState = function CodegenState (options) {
  9864. this.options = options;
  9865. this.warn = options.warn || baseWarn;
  9866. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  9867. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  9868. this.directives = extend(extend({}, baseDirectives), options.directives);
  9869. var isReservedTag = options.isReservedTag || no;
  9870. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  9871. this.onceId = 0;
  9872. this.staticRenderFns = [];
  9873. this.pre = false;
  9874. };
  9875. function generate (
  9876. ast,
  9877. options
  9878. ) {
  9879. var state = new CodegenState(options);
  9880. var code = ast ? genElement(ast, state) : '_c("div")';
  9881. return {
  9882. render: ("with(this){return " + code + "}"),
  9883. staticRenderFns: state.staticRenderFns
  9884. }
  9885. }
  9886. function genElement (el, state) {
  9887. if (el.parent) {
  9888. el.pre = el.pre || el.parent.pre;
  9889. }
  9890. if (el.staticRoot && !el.staticProcessed) {
  9891. return genStatic(el, state)
  9892. } else if (el.once && !el.onceProcessed) {
  9893. return genOnce(el, state)
  9894. } else if (el.for && !el.forProcessed) {
  9895. return genFor(el, state)
  9896. } else if (el.if && !el.ifProcessed) {
  9897. return genIf(el, state)
  9898. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  9899. return genChildren(el, state) || 'void 0'
  9900. } else if (el.tag === 'slot') {
  9901. return genSlot(el, state)
  9902. } else {
  9903. // component or element
  9904. var code;
  9905. if (el.component) {
  9906. code = genComponent(el.component, el, state);
  9907. } else {
  9908. var data;
  9909. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  9910. data = genData$2(el, state);
  9911. }
  9912. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  9913. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  9914. }
  9915. // module transforms
  9916. for (var i = 0; i < state.transforms.length; i++) {
  9917. code = state.transforms[i](el, code);
  9918. }
  9919. return code
  9920. }
  9921. }
  9922. // hoist static sub-trees out
  9923. function genStatic (el, state) {
  9924. el.staticProcessed = true;
  9925. // Some elements (templates) need to behave differently inside of a v-pre
  9926. // node. All pre nodes are static roots, so we can use this as a location to
  9927. // wrap a state change and reset it upon exiting the pre node.
  9928. var originalPreState = state.pre;
  9929. if (el.pre) {
  9930. state.pre = el.pre;
  9931. }
  9932. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  9933. state.pre = originalPreState;
  9934. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  9935. }
  9936. // v-once
  9937. function genOnce (el, state) {
  9938. el.onceProcessed = true;
  9939. if (el.if && !el.ifProcessed) {
  9940. return genIf(el, state)
  9941. } else if (el.staticInFor) {
  9942. var key = '';
  9943. var parent = el.parent;
  9944. while (parent) {
  9945. if (parent.for) {
  9946. key = parent.key;
  9947. break
  9948. }
  9949. parent = parent.parent;
  9950. }
  9951. if (!key) {
  9952. state.warn(
  9953. "v-once can only be used inside v-for that is keyed. ",
  9954. el.rawAttrsMap['v-once']
  9955. );
  9956. return genElement(el, state)
  9957. }
  9958. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  9959. } else {
  9960. return genStatic(el, state)
  9961. }
  9962. }
  9963. function genIf (
  9964. el,
  9965. state,
  9966. altGen,
  9967. altEmpty
  9968. ) {
  9969. el.ifProcessed = true; // avoid recursion
  9970. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  9971. }
  9972. function genIfConditions (
  9973. conditions,
  9974. state,
  9975. altGen,
  9976. altEmpty
  9977. ) {
  9978. if (!conditions.length) {
  9979. return altEmpty || '_e()'
  9980. }
  9981. var condition = conditions.shift();
  9982. if (condition.exp) {
  9983. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  9984. } else {
  9985. return ("" + (genTernaryExp(condition.block)))
  9986. }
  9987. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  9988. function genTernaryExp (el) {
  9989. return altGen
  9990. ? altGen(el, state)
  9991. : el.once
  9992. ? genOnce(el, state)
  9993. : genElement(el, state)
  9994. }
  9995. }
  9996. function genFor (
  9997. el,
  9998. state,
  9999. altGen,
  10000. altHelper
  10001. ) {
  10002. var exp = el.for;
  10003. var alias = el.alias;
  10004. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  10005. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  10006. if (state.maybeComponent(el) &&
  10007. el.tag !== 'slot' &&
  10008. el.tag !== 'template' &&
  10009. !el.key
  10010. ) {
  10011. state.warn(
  10012. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  10013. "v-for should have explicit keys. " +
  10014. "See https://vuejs.org/guide/list.html#key for more info.",
  10015. el.rawAttrsMap['v-for'],
  10016. true /* tip */
  10017. );
  10018. }
  10019. el.forProcessed = true; // avoid recursion
  10020. return (altHelper || '_l') + "((" + exp + ")," +
  10021. "function(" + alias + iterator1 + iterator2 + "){" +
  10022. "return " + ((altGen || genElement)(el, state)) +
  10023. '})'
  10024. }
  10025. function genData$2 (el, state) {
  10026. var data = '{';
  10027. // directives first.
  10028. // directives may mutate the el's other properties before they are generated.
  10029. var dirs = genDirectives(el, state);
  10030. if (dirs) { data += dirs + ','; }
  10031. // key
  10032. if (el.key) {
  10033. data += "key:" + (el.key) + ",";
  10034. }
  10035. // ref
  10036. if (el.ref) {
  10037. data += "ref:" + (el.ref) + ",";
  10038. }
  10039. if (el.refInFor) {
  10040. data += "refInFor:true,";
  10041. }
  10042. // pre
  10043. if (el.pre) {
  10044. data += "pre:true,";
  10045. }
  10046. // record original tag name for components using "is" attribute
  10047. if (el.component) {
  10048. data += "tag:\"" + (el.tag) + "\",";
  10049. }
  10050. // module data generation functions
  10051. for (var i = 0; i < state.dataGenFns.length; i++) {
  10052. data += state.dataGenFns[i](el);
  10053. }
  10054. // attributes
  10055. if (el.attrs) {
  10056. data += "attrs:" + (genProps(el.attrs)) + ",";
  10057. }
  10058. // DOM props
  10059. if (el.props) {
  10060. data += "domProps:" + (genProps(el.props)) + ",";
  10061. }
  10062. // event handlers
  10063. if (el.events) {
  10064. data += (genHandlers(el.events, false)) + ",";
  10065. }
  10066. if (el.nativeEvents) {
  10067. data += (genHandlers(el.nativeEvents, true)) + ",";
  10068. }
  10069. // slot target
  10070. // only for non-scoped slots
  10071. if (el.slotTarget && !el.slotScope) {
  10072. data += "slot:" + (el.slotTarget) + ",";
  10073. }
  10074. // scoped slots
  10075. if (el.scopedSlots) {
  10076. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  10077. }
  10078. // component v-model
  10079. if (el.model) {
  10080. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  10081. }
  10082. // inline-template
  10083. if (el.inlineTemplate) {
  10084. var inlineTemplate = genInlineTemplate(el, state);
  10085. if (inlineTemplate) {
  10086. data += inlineTemplate + ",";
  10087. }
  10088. }
  10089. data = data.replace(/,$/, '') + '}';
  10090. // v-bind dynamic argument wrap
  10091. // v-bind with dynamic arguments must be applied using the same v-bind object
  10092. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  10093. if (el.dynamicAttrs) {
  10094. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  10095. }
  10096. // v-bind data wrap
  10097. if (el.wrapData) {
  10098. data = el.wrapData(data);
  10099. }
  10100. // v-on data wrap
  10101. if (el.wrapListeners) {
  10102. data = el.wrapListeners(data);
  10103. }
  10104. return data
  10105. }
  10106. function genDirectives (el, state) {
  10107. var dirs = el.directives;
  10108. if (!dirs) { return }
  10109. var res = 'directives:[';
  10110. var hasRuntime = false;
  10111. var i, l, dir, needRuntime;
  10112. for (i = 0, l = dirs.length; i < l; i++) {
  10113. dir = dirs[i];
  10114. needRuntime = true;
  10115. var gen = state.directives[dir.name];
  10116. if (gen) {
  10117. // compile-time directive that manipulates AST.
  10118. // returns true if it also needs a runtime counterpart.
  10119. needRuntime = !!gen(el, dir, state.warn);
  10120. }
  10121. if (needRuntime) {
  10122. hasRuntime = true;
  10123. res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
  10124. }
  10125. }
  10126. if (hasRuntime) {
  10127. return res.slice(0, -1) + ']'
  10128. }
  10129. }
  10130. function genInlineTemplate (el, state) {
  10131. var ast = el.children[0];
  10132. if (el.children.length !== 1 || ast.type !== 1) {
  10133. state.warn(
  10134. 'Inline-template components must have exactly one child element.',
  10135. { start: el.start }
  10136. );
  10137. }
  10138. if (ast && ast.type === 1) {
  10139. var inlineRenderFns = generate(ast, state.options);
  10140. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  10141. }
  10142. }
  10143. function genScopedSlots (
  10144. el,
  10145. slots,
  10146. state
  10147. ) {
  10148. // by default scoped slots are considered "stable", this allows child
  10149. // components with only scoped slots to skip forced updates from parent.
  10150. // but in some cases we have to bail-out of this optimization
  10151. // for example if the slot contains dynamic names, has v-if or v-for on them...
  10152. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  10153. var slot = slots[key];
  10154. return (
  10155. slot.slotTargetDynamic ||
  10156. slot.if ||
  10157. slot.for ||
  10158. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  10159. )
  10160. });
  10161. // #9534: if a component with scoped slots is inside a conditional branch,
  10162. // it's possible for the same component to be reused but with different
  10163. // compiled slot content. To avoid that, we generate a unique key based on
  10164. // the generated code of all the slot contents.
  10165. var needsKey = !!el.if;
  10166. // OR when it is inside another scoped slot or v-for (the reactivity may be
  10167. // disconnected due to the intermediate scope variable)
  10168. // #9438, #9506
  10169. // TODO: this can be further optimized by properly analyzing in-scope bindings
  10170. // and skip force updating ones that do not actually use scope variables.
  10171. if (!needsForceUpdate) {
  10172. var parent = el.parent;
  10173. while (parent) {
  10174. if (
  10175. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  10176. parent.for
  10177. ) {
  10178. needsForceUpdate = true;
  10179. break
  10180. }
  10181. if (parent.if) {
  10182. needsKey = true;
  10183. }
  10184. parent = parent.parent;
  10185. }
  10186. }
  10187. var generatedSlots = Object.keys(slots)
  10188. .map(function (key) { return genScopedSlot(slots[key], state); })
  10189. .join(',');
  10190. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  10191. }
  10192. function hash(str) {
  10193. var hash = 5381;
  10194. var i = str.length;
  10195. while(i) {
  10196. hash = (hash * 33) ^ str.charCodeAt(--i);
  10197. }
  10198. return hash >>> 0
  10199. }
  10200. function containsSlotChild (el) {
  10201. if (el.type === 1) {
  10202. if (el.tag === 'slot') {
  10203. return true
  10204. }
  10205. return el.children.some(containsSlotChild)
  10206. }
  10207. return false
  10208. }
  10209. function genScopedSlot (
  10210. el,
  10211. state
  10212. ) {
  10213. var isLegacySyntax = el.attrsMap['slot-scope'];
  10214. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  10215. return genIf(el, state, genScopedSlot, "null")
  10216. }
  10217. if (el.for && !el.forProcessed) {
  10218. return genFor(el, state, genScopedSlot)
  10219. }
  10220. var slotScope = el.slotScope === emptySlotScopeToken
  10221. ? ""
  10222. : String(el.slotScope);
  10223. var fn = "function(" + slotScope + "){" +
  10224. "return " + (el.tag === 'template'
  10225. ? el.if && isLegacySyntax
  10226. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  10227. : genChildren(el, state) || 'undefined'
  10228. : genElement(el, state)) + "}";
  10229. // reverse proxy v-slot without scope on this.$slots
  10230. var reverseProxy = slotScope ? "" : ",proxy:true";
  10231. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  10232. }
  10233. function genChildren (
  10234. el,
  10235. state,
  10236. checkSkip,
  10237. altGenElement,
  10238. altGenNode
  10239. ) {
  10240. var children = el.children;
  10241. if (children.length) {
  10242. var el$1 = children[0];
  10243. // optimize single v-for
  10244. if (children.length === 1 &&
  10245. el$1.for &&
  10246. el$1.tag !== 'template' &&
  10247. el$1.tag !== 'slot'
  10248. ) {
  10249. var normalizationType = checkSkip
  10250. ? state.maybeComponent(el$1) ? ",1" : ",0"
  10251. : "";
  10252. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  10253. }
  10254. var normalizationType$1 = checkSkip
  10255. ? getNormalizationType(children, state.maybeComponent)
  10256. : 0;
  10257. var gen = altGenNode || genNode;
  10258. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  10259. }
  10260. }
  10261. // determine the normalization needed for the children array.
  10262. // 0: no normalization needed
  10263. // 1: simple normalization needed (possible 1-level deep nested array)
  10264. // 2: full normalization needed
  10265. function getNormalizationType (
  10266. children,
  10267. maybeComponent
  10268. ) {
  10269. var res = 0;
  10270. for (var i = 0; i < children.length; i++) {
  10271. var el = children[i];
  10272. if (el.type !== 1) {
  10273. continue
  10274. }
  10275. if (needsNormalization(el) ||
  10276. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  10277. res = 2;
  10278. break
  10279. }
  10280. if (maybeComponent(el) ||
  10281. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  10282. res = 1;
  10283. }
  10284. }
  10285. return res
  10286. }
  10287. function needsNormalization (el) {
  10288. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  10289. }
  10290. function genNode (node, state) {
  10291. if (node.type === 1) {
  10292. return genElement(node, state)
  10293. } else if (node.type === 3 && node.isComment) {
  10294. return genComment(node)
  10295. } else {
  10296. return genText(node)
  10297. }
  10298. }
  10299. function genText (text) {
  10300. return ("_v(" + (text.type === 2
  10301. ? text.expression // no need for () because already wrapped in _s()
  10302. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  10303. }
  10304. function genComment (comment) {
  10305. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  10306. }
  10307. function genSlot (el, state) {
  10308. var slotName = el.slotName || '"default"';
  10309. var children = genChildren(el, state);
  10310. var res = "_t(" + slotName + (children ? ("," + children) : '');
  10311. var attrs = el.attrs || el.dynamicAttrs
  10312. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  10313. // slot props are camelized
  10314. name: camelize(attr.name),
  10315. value: attr.value,
  10316. dynamic: attr.dynamic
  10317. }); }))
  10318. : null;
  10319. var bind$$1 = el.attrsMap['v-bind'];
  10320. if ((attrs || bind$$1) && !children) {
  10321. res += ",null";
  10322. }
  10323. if (attrs) {
  10324. res += "," + attrs;
  10325. }
  10326. if (bind$$1) {
  10327. res += (attrs ? '' : ',null') + "," + bind$$1;
  10328. }
  10329. return res + ')'
  10330. }
  10331. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  10332. function genComponent (
  10333. componentName,
  10334. el,
  10335. state
  10336. ) {
  10337. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  10338. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  10339. }
  10340. function genProps (props) {
  10341. var staticProps = "";
  10342. var dynamicProps = "";
  10343. for (var i = 0; i < props.length; i++) {
  10344. var prop = props[i];
  10345. var value = transformSpecialNewlines(prop.value);
  10346. if (prop.dynamic) {
  10347. dynamicProps += (prop.name) + "," + value + ",";
  10348. } else {
  10349. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  10350. }
  10351. }
  10352. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  10353. if (dynamicProps) {
  10354. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  10355. } else {
  10356. return staticProps
  10357. }
  10358. }
  10359. // #3895, #4268
  10360. function transformSpecialNewlines (text) {
  10361. return text
  10362. .replace(/\u2028/g, '\\u2028')
  10363. .replace(/\u2029/g, '\\u2029')
  10364. }
  10365. /* */
  10366. // these keywords should not appear inside expressions, but operators like
  10367. // typeof, instanceof and in are allowed
  10368. var prohibitedKeywordRE = new RegExp('\\b' + (
  10369. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  10370. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  10371. 'extends,finally,continue,debugger,function,arguments'
  10372. ).split(',').join('\\b|\\b') + '\\b');
  10373. // these unary operators should not be used as property/method names
  10374. var unaryOperatorsRE = new RegExp('\\b' + (
  10375. 'delete,typeof,void'
  10376. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  10377. // strip strings in expressions
  10378. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  10379. // detect problematic expressions in a template
  10380. function detectErrors (ast, warn) {
  10381. if (ast) {
  10382. checkNode(ast, warn);
  10383. }
  10384. }
  10385. function checkNode (node, warn) {
  10386. if (node.type === 1) {
  10387. for (var name in node.attrsMap) {
  10388. if (dirRE.test(name)) {
  10389. var value = node.attrsMap[name];
  10390. if (value) {
  10391. var range = node.rawAttrsMap[name];
  10392. if (name === 'v-for') {
  10393. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  10394. } else if (onRE.test(name)) {
  10395. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  10396. } else {
  10397. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  10398. }
  10399. }
  10400. }
  10401. }
  10402. if (node.children) {
  10403. for (var i = 0; i < node.children.length; i++) {
  10404. checkNode(node.children[i], warn);
  10405. }
  10406. }
  10407. } else if (node.type === 2) {
  10408. checkExpression(node.expression, node.text, warn, node);
  10409. }
  10410. }
  10411. function checkEvent (exp, text, warn, range) {
  10412. var stipped = exp.replace(stripStringRE, '');
  10413. var keywordMatch = stipped.match(unaryOperatorsRE);
  10414. if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
  10415. warn(
  10416. "avoid using JavaScript unary operator as property name: " +
  10417. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  10418. range
  10419. );
  10420. }
  10421. checkExpression(exp, text, warn, range);
  10422. }
  10423. function checkFor (node, text, warn, range) {
  10424. checkExpression(node.for || '', text, warn, range);
  10425. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  10426. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  10427. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  10428. }
  10429. function checkIdentifier (
  10430. ident,
  10431. type,
  10432. text,
  10433. warn,
  10434. range
  10435. ) {
  10436. if (typeof ident === 'string') {
  10437. try {
  10438. new Function(("var " + ident + "=_"));
  10439. } catch (e) {
  10440. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  10441. }
  10442. }
  10443. }
  10444. function checkExpression (exp, text, warn, range) {
  10445. try {
  10446. new Function(("return " + exp));
  10447. } catch (e) {
  10448. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  10449. if (keywordMatch) {
  10450. warn(
  10451. "avoid using JavaScript keyword as property name: " +
  10452. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  10453. range
  10454. );
  10455. } else {
  10456. warn(
  10457. "invalid expression: " + (e.message) + " in\n\n" +
  10458. " " + exp + "\n\n" +
  10459. " Raw expression: " + (text.trim()) + "\n",
  10460. range
  10461. );
  10462. }
  10463. }
  10464. }
  10465. /* */
  10466. var range = 2;
  10467. function generateCodeFrame (
  10468. source,
  10469. start,
  10470. end
  10471. ) {
  10472. if ( start === void 0 ) start = 0;
  10473. if ( end === void 0 ) end = source.length;
  10474. var lines = source.split(/\r?\n/);
  10475. var count = 0;
  10476. var res = [];
  10477. for (var i = 0; i < lines.length; i++) {
  10478. count += lines[i].length + 1;
  10479. if (count >= start) {
  10480. for (var j = i - range; j <= i + range || end > count; j++) {
  10481. if (j < 0 || j >= lines.length) { continue }
  10482. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  10483. var lineLength = lines[j].length;
  10484. if (j === i) {
  10485. // push underline
  10486. var pad = start - (count - lineLength) + 1;
  10487. var length = end > count ? lineLength - pad : end - start;
  10488. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  10489. } else if (j > i) {
  10490. if (end > count) {
  10491. var length$1 = Math.min(end - count, lineLength);
  10492. res.push(" | " + repeat$1("^", length$1));
  10493. }
  10494. count += lineLength + 1;
  10495. }
  10496. }
  10497. break
  10498. }
  10499. }
  10500. return res.join('\n')
  10501. }
  10502. function repeat$1 (str, n) {
  10503. var result = '';
  10504. if (n > 0) {
  10505. while (true) { // eslint-disable-line
  10506. if (n & 1) { result += str; }
  10507. n >>>= 1;
  10508. if (n <= 0) { break }
  10509. str += str;
  10510. }
  10511. }
  10512. return result
  10513. }
  10514. /* */
  10515. function createFunction (code, errors) {
  10516. try {
  10517. return new Function(code)
  10518. } catch (err) {
  10519. errors.push({ err: err, code: code });
  10520. return noop
  10521. }
  10522. }
  10523. function createCompileToFunctionFn (compile) {
  10524. var cache = Object.create(null);
  10525. return function compileToFunctions (
  10526. template,
  10527. options,
  10528. vm
  10529. ) {
  10530. options = extend({}, options);
  10531. var warn$$1 = options.warn || warn;
  10532. delete options.warn;
  10533. /* istanbul ignore if */
  10534. {
  10535. // detect possible CSP restriction
  10536. try {
  10537. new Function('return 1');
  10538. } catch (e) {
  10539. if (e.toString().match(/unsafe-eval|CSP/)) {
  10540. warn$$1(
  10541. 'It seems you are using the standalone build of Vue.js in an ' +
  10542. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  10543. 'The template compiler cannot work in this environment. Consider ' +
  10544. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  10545. 'templates into render functions.'
  10546. );
  10547. }
  10548. }
  10549. }
  10550. // check cache
  10551. var key = options.delimiters
  10552. ? String(options.delimiters) + template
  10553. : template;
  10554. if (cache[key]) {
  10555. return cache[key]
  10556. }
  10557. // compile
  10558. var compiled = compile(template, options);
  10559. // check compilation errors/tips
  10560. {
  10561. if (compiled.errors && compiled.errors.length) {
  10562. if (options.outputSourceRange) {
  10563. compiled.errors.forEach(function (e) {
  10564. warn$$1(
  10565. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  10566. generateCodeFrame(template, e.start, e.end),
  10567. vm
  10568. );
  10569. });
  10570. } else {
  10571. warn$$1(
  10572. "Error compiling template:\n\n" + template + "\n\n" +
  10573. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  10574. vm
  10575. );
  10576. }
  10577. }
  10578. if (compiled.tips && compiled.tips.length) {
  10579. if (options.outputSourceRange) {
  10580. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  10581. } else {
  10582. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  10583. }
  10584. }
  10585. }
  10586. // turn code into functions
  10587. var res = {};
  10588. var fnGenErrors = [];
  10589. res.render = createFunction(compiled.render, fnGenErrors);
  10590. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  10591. return createFunction(code, fnGenErrors)
  10592. });
  10593. // check function generation errors.
  10594. // this should only happen if there is a bug in the compiler itself.
  10595. // mostly for codegen development use
  10596. /* istanbul ignore if */
  10597. {
  10598. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  10599. warn$$1(
  10600. "Failed to generate render function:\n\n" +
  10601. fnGenErrors.map(function (ref) {
  10602. var err = ref.err;
  10603. var code = ref.code;
  10604. return ((err.toString()) + " in\n\n" + code + "\n");
  10605. }).join('\n'),
  10606. vm
  10607. );
  10608. }
  10609. }
  10610. return (cache[key] = res)
  10611. }
  10612. }
  10613. /* */
  10614. function createCompilerCreator (baseCompile) {
  10615. return function createCompiler (baseOptions) {
  10616. function compile (
  10617. template,
  10618. options
  10619. ) {
  10620. var finalOptions = Object.create(baseOptions);
  10621. var errors = [];
  10622. var tips = [];
  10623. var warn = function (msg, range, tip) {
  10624. (tip ? tips : errors).push(msg);
  10625. };
  10626. if (options) {
  10627. if (options.outputSourceRange) {
  10628. // $flow-disable-line
  10629. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  10630. warn = function (msg, range, tip) {
  10631. var data = { msg: msg };
  10632. if (range) {
  10633. if (range.start != null) {
  10634. data.start = range.start + leadingSpaceLength;
  10635. }
  10636. if (range.end != null) {
  10637. data.end = range.end + leadingSpaceLength;
  10638. }
  10639. }
  10640. (tip ? tips : errors).push(data);
  10641. };
  10642. }
  10643. // merge custom modules
  10644. if (options.modules) {
  10645. finalOptions.modules =
  10646. (baseOptions.modules || []).concat(options.modules);
  10647. }
  10648. // merge custom directives
  10649. if (options.directives) {
  10650. finalOptions.directives = extend(
  10651. Object.create(baseOptions.directives || null),
  10652. options.directives
  10653. );
  10654. }
  10655. // copy other options
  10656. for (var key in options) {
  10657. if (key !== 'modules' && key !== 'directives') {
  10658. finalOptions[key] = options[key];
  10659. }
  10660. }
  10661. }
  10662. finalOptions.warn = warn;
  10663. var compiled = baseCompile(template.trim(), finalOptions);
  10664. {
  10665. detectErrors(compiled.ast, warn);
  10666. }
  10667. compiled.errors = errors;
  10668. compiled.tips = tips;
  10669. return compiled
  10670. }
  10671. return {
  10672. compile: compile,
  10673. compileToFunctions: createCompileToFunctionFn(compile)
  10674. }
  10675. }
  10676. }
  10677. /* */
  10678. // `createCompilerCreator` allows creating compilers that use alternative
  10679. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  10680. // Here we just export a default compiler using the default parts.
  10681. var createCompiler = createCompilerCreator(function baseCompile (
  10682. template,
  10683. options
  10684. ) {
  10685. var ast = parse(template.trim(), options);
  10686. if (options.optimize !== false) {
  10687. optimize(ast, options);
  10688. }
  10689. var code = generate(ast, options);
  10690. return {
  10691. ast: ast,
  10692. render: code.render,
  10693. staticRenderFns: code.staticRenderFns
  10694. }
  10695. });
  10696. /* */
  10697. var ref$1 = createCompiler(baseOptions);
  10698. var compile = ref$1.compile;
  10699. var compileToFunctions = ref$1.compileToFunctions;
  10700. /* */
  10701. // check whether current browser encodes a char inside attribute values
  10702. var div;
  10703. function getShouldDecode (href) {
  10704. div = div || document.createElement('div');
  10705. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  10706. return div.innerHTML.indexOf('&#10;') > 0
  10707. }
  10708. // #3663: IE encodes newlines inside attribute values while other browsers don't
  10709. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  10710. // #6828: chrome encodes content in a[href]
  10711. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  10712. /* */
  10713. var idToTemplate = cached(function (id) {
  10714. var el = query(id);
  10715. return el && el.innerHTML
  10716. });
  10717. var mount = Vue.prototype.$mount;
  10718. Vue.prototype.$mount = function (
  10719. el,
  10720. hydrating
  10721. ) {
  10722. el = el && query(el);
  10723. /* istanbul ignore if */
  10724. if (el === document.body || el === document.documentElement) {
  10725. warn(
  10726. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  10727. );
  10728. return this
  10729. }
  10730. var options = this.$options;
  10731. // resolve template/el and convert to render function
  10732. if (!options.render) {
  10733. var template = options.template;
  10734. if (template) {
  10735. if (typeof template === 'string') {
  10736. if (template.charAt(0) === '#') {
  10737. template = idToTemplate(template);
  10738. /* istanbul ignore if */
  10739. if (!template) {
  10740. warn(
  10741. ("Template element not found or is empty: " + (options.template)),
  10742. this
  10743. );
  10744. }
  10745. }
  10746. } else if (template.nodeType) {
  10747. template = template.innerHTML;
  10748. } else {
  10749. {
  10750. warn('invalid template option:' + template, this);
  10751. }
  10752. return this
  10753. }
  10754. } else if (el) {
  10755. template = getOuterHTML(el);
  10756. }
  10757. if (template) {
  10758. /* istanbul ignore if */
  10759. if (config.performance && mark) {
  10760. mark('compile');
  10761. }
  10762. var ref = compileToFunctions(template, {
  10763. outputSourceRange: "development" !== 'production',
  10764. shouldDecodeNewlines: shouldDecodeNewlines,
  10765. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  10766. delimiters: options.delimiters,
  10767. comments: options.comments
  10768. }, this);
  10769. var render = ref.render;
  10770. var staticRenderFns = ref.staticRenderFns;
  10771. options.render = render;
  10772. options.staticRenderFns = staticRenderFns;
  10773. /* istanbul ignore if */
  10774. if (config.performance && mark) {
  10775. mark('compile end');
  10776. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  10777. }
  10778. }
  10779. }
  10780. return mount.call(this, el, hydrating)
  10781. };
  10782. /**
  10783. * Get outerHTML of elements, taking care
  10784. * of SVG elements in IE as well.
  10785. */
  10786. function getOuterHTML (el) {
  10787. if (el.outerHTML) {
  10788. return el.outerHTML
  10789. } else {
  10790. var container = document.createElement('div');
  10791. container.appendChild(el.cloneNode(true));
  10792. return container.innerHTML
  10793. }
  10794. }
  10795. Vue.compile = compileToFunctions;
  10796. return Vue;
  10797. }));