vue.js 334 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965
  1. /*!
  2. * Vue.js v2.6.12
  3. * (c) 2014-2020 Evan You
  4. * Released under the MIT License.
  5. */
  6. (function (global, factory) {
  7. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  8. typeof define === 'function' && define.amd ? define(factory) :
  9. (global = global || self, global.Vue = factory());
  10. }(this, function () { '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. // Technically 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 special 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. if (isDef(data) && isDef(data.nativeOn)) {
  3100. warn(
  3101. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  3102. context
  3103. );
  3104. }
  3105. vnode = new VNode(
  3106. config.parsePlatformTagName(tag), data, children,
  3107. undefined, undefined, context
  3108. );
  3109. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  3110. // component
  3111. vnode = createComponent(Ctor, data, context, children, tag);
  3112. } else {
  3113. // unknown or unlisted namespaced elements
  3114. // check at runtime because it may get assigned a namespace when its
  3115. // parent normalizes children
  3116. vnode = new VNode(
  3117. tag, data, children,
  3118. undefined, undefined, context
  3119. );
  3120. }
  3121. } else {
  3122. // direct component options / constructor
  3123. vnode = createComponent(tag, data, context, children);
  3124. }
  3125. if (Array.isArray(vnode)) {
  3126. return vnode
  3127. } else if (isDef(vnode)) {
  3128. if (isDef(ns)) { applyNS(vnode, ns); }
  3129. if (isDef(data)) { registerDeepBindings(data); }
  3130. return vnode
  3131. } else {
  3132. return createEmptyVNode()
  3133. }
  3134. }
  3135. function applyNS (vnode, ns, force) {
  3136. vnode.ns = ns;
  3137. if (vnode.tag === 'foreignObject') {
  3138. // use default namespace inside foreignObject
  3139. ns = undefined;
  3140. force = true;
  3141. }
  3142. if (isDef(vnode.children)) {
  3143. for (var i = 0, l = vnode.children.length; i < l; i++) {
  3144. var child = vnode.children[i];
  3145. if (isDef(child.tag) && (
  3146. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  3147. applyNS(child, ns, force);
  3148. }
  3149. }
  3150. }
  3151. }
  3152. // ref #5318
  3153. // necessary to ensure parent re-render when deep bindings like :style and
  3154. // :class are used on slot nodes
  3155. function registerDeepBindings (data) {
  3156. if (isObject(data.style)) {
  3157. traverse(data.style);
  3158. }
  3159. if (isObject(data.class)) {
  3160. traverse(data.class);
  3161. }
  3162. }
  3163. /* */
  3164. function initRender (vm) {
  3165. vm._vnode = null; // the root of the child tree
  3166. vm._staticTrees = null; // v-once cached trees
  3167. var options = vm.$options;
  3168. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  3169. var renderContext = parentVnode && parentVnode.context;
  3170. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  3171. vm.$scopedSlots = emptyObject;
  3172. // bind the createElement fn to this instance
  3173. // so that we get proper render context inside it.
  3174. // args order: tag, data, children, normalizationType, alwaysNormalize
  3175. // internal version is used by render functions compiled from templates
  3176. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  3177. // normalization is always applied for the public version, used in
  3178. // user-written render functions.
  3179. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  3180. // $attrs & $listeners are exposed for easier HOC creation.
  3181. // they need to be reactive so that HOCs using them are always updated
  3182. var parentData = parentVnode && parentVnode.data;
  3183. /* istanbul ignore else */
  3184. {
  3185. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  3186. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  3187. }, true);
  3188. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  3189. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  3190. }, true);
  3191. }
  3192. }
  3193. var currentRenderingInstance = null;
  3194. function renderMixin (Vue) {
  3195. // install runtime convenience helpers
  3196. installRenderHelpers(Vue.prototype);
  3197. Vue.prototype.$nextTick = function (fn) {
  3198. return nextTick(fn, this)
  3199. };
  3200. Vue.prototype._render = function () {
  3201. var vm = this;
  3202. var ref = vm.$options;
  3203. var render = ref.render;
  3204. var _parentVnode = ref._parentVnode;
  3205. if (_parentVnode) {
  3206. vm.$scopedSlots = normalizeScopedSlots(
  3207. _parentVnode.data.scopedSlots,
  3208. vm.$slots,
  3209. vm.$scopedSlots
  3210. );
  3211. }
  3212. // set parent vnode. this allows render functions to have access
  3213. // to the data on the placeholder node.
  3214. vm.$vnode = _parentVnode;
  3215. // render self
  3216. var vnode;
  3217. try {
  3218. // There's no need to maintain a stack because all render fns are called
  3219. // separately from one another. Nested component's render fns are called
  3220. // when parent component is patched.
  3221. currentRenderingInstance = vm;
  3222. vnode = render.call(vm._renderProxy, vm.$createElement);
  3223. } catch (e) {
  3224. handleError(e, vm, "render");
  3225. // return error render result,
  3226. // or previous vnode to prevent render error causing blank component
  3227. /* istanbul ignore else */
  3228. if (vm.$options.renderError) {
  3229. try {
  3230. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  3231. } catch (e) {
  3232. handleError(e, vm, "renderError");
  3233. vnode = vm._vnode;
  3234. }
  3235. } else {
  3236. vnode = vm._vnode;
  3237. }
  3238. } finally {
  3239. currentRenderingInstance = null;
  3240. }
  3241. // if the returned array contains only a single node, allow it
  3242. if (Array.isArray(vnode) && vnode.length === 1) {
  3243. vnode = vnode[0];
  3244. }
  3245. // return empty vnode in case the render function errored out
  3246. if (!(vnode instanceof VNode)) {
  3247. if (Array.isArray(vnode)) {
  3248. warn(
  3249. 'Multiple root nodes returned from render function. Render function ' +
  3250. 'should return a single root node.',
  3251. vm
  3252. );
  3253. }
  3254. vnode = createEmptyVNode();
  3255. }
  3256. // set parent
  3257. vnode.parent = _parentVnode;
  3258. return vnode
  3259. };
  3260. }
  3261. /* */
  3262. function ensureCtor (comp, base) {
  3263. if (
  3264. comp.__esModule ||
  3265. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  3266. ) {
  3267. comp = comp.default;
  3268. }
  3269. return isObject(comp)
  3270. ? base.extend(comp)
  3271. : comp
  3272. }
  3273. function createAsyncPlaceholder (
  3274. factory,
  3275. data,
  3276. context,
  3277. children,
  3278. tag
  3279. ) {
  3280. var node = createEmptyVNode();
  3281. node.asyncFactory = factory;
  3282. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  3283. return node
  3284. }
  3285. function resolveAsyncComponent (
  3286. factory,
  3287. baseCtor
  3288. ) {
  3289. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  3290. return factory.errorComp
  3291. }
  3292. if (isDef(factory.resolved)) {
  3293. return factory.resolved
  3294. }
  3295. var owner = currentRenderingInstance;
  3296. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  3297. // already pending
  3298. factory.owners.push(owner);
  3299. }
  3300. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  3301. return factory.loadingComp
  3302. }
  3303. if (owner && !isDef(factory.owners)) {
  3304. var owners = factory.owners = [owner];
  3305. var sync = true;
  3306. var timerLoading = null;
  3307. var timerTimeout = null
  3308. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  3309. var forceRender = function (renderCompleted) {
  3310. for (var i = 0, l = owners.length; i < l; i++) {
  3311. (owners[i]).$forceUpdate();
  3312. }
  3313. if (renderCompleted) {
  3314. owners.length = 0;
  3315. if (timerLoading !== null) {
  3316. clearTimeout(timerLoading);
  3317. timerLoading = null;
  3318. }
  3319. if (timerTimeout !== null) {
  3320. clearTimeout(timerTimeout);
  3321. timerTimeout = null;
  3322. }
  3323. }
  3324. };
  3325. var resolve = once(function (res) {
  3326. // cache resolved
  3327. factory.resolved = ensureCtor(res, baseCtor);
  3328. // invoke callbacks only if this is not a synchronous resolve
  3329. // (async resolves are shimmed as synchronous during SSR)
  3330. if (!sync) {
  3331. forceRender(true);
  3332. } else {
  3333. owners.length = 0;
  3334. }
  3335. });
  3336. var reject = once(function (reason) {
  3337. warn(
  3338. "Failed to resolve async component: " + (String(factory)) +
  3339. (reason ? ("\nReason: " + reason) : '')
  3340. );
  3341. if (isDef(factory.errorComp)) {
  3342. factory.error = true;
  3343. forceRender(true);
  3344. }
  3345. });
  3346. var res = factory(resolve, reject);
  3347. if (isObject(res)) {
  3348. if (isPromise(res)) {
  3349. // () => Promise
  3350. if (isUndef(factory.resolved)) {
  3351. res.then(resolve, reject);
  3352. }
  3353. } else if (isPromise(res.component)) {
  3354. res.component.then(resolve, reject);
  3355. if (isDef(res.error)) {
  3356. factory.errorComp = ensureCtor(res.error, baseCtor);
  3357. }
  3358. if (isDef(res.loading)) {
  3359. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  3360. if (res.delay === 0) {
  3361. factory.loading = true;
  3362. } else {
  3363. timerLoading = setTimeout(function () {
  3364. timerLoading = null;
  3365. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  3366. factory.loading = true;
  3367. forceRender(false);
  3368. }
  3369. }, res.delay || 200);
  3370. }
  3371. }
  3372. if (isDef(res.timeout)) {
  3373. timerTimeout = setTimeout(function () {
  3374. timerTimeout = null;
  3375. if (isUndef(factory.resolved)) {
  3376. reject(
  3377. "timeout (" + (res.timeout) + "ms)"
  3378. );
  3379. }
  3380. }, res.timeout);
  3381. }
  3382. }
  3383. }
  3384. sync = false;
  3385. // return in case resolved synchronously
  3386. return factory.loading
  3387. ? factory.loadingComp
  3388. : factory.resolved
  3389. }
  3390. }
  3391. /* */
  3392. function isAsyncPlaceholder (node) {
  3393. return node.isComment && node.asyncFactory
  3394. }
  3395. /* */
  3396. function getFirstComponentChild (children) {
  3397. if (Array.isArray(children)) {
  3398. for (var i = 0; i < children.length; i++) {
  3399. var c = children[i];
  3400. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  3401. return c
  3402. }
  3403. }
  3404. }
  3405. }
  3406. /* */
  3407. /* */
  3408. function initEvents (vm) {
  3409. vm._events = Object.create(null);
  3410. vm._hasHookEvent = false;
  3411. // init parent attached events
  3412. var listeners = vm.$options._parentListeners;
  3413. if (listeners) {
  3414. updateComponentListeners(vm, listeners);
  3415. }
  3416. }
  3417. var target;
  3418. function add (event, fn) {
  3419. target.$on(event, fn);
  3420. }
  3421. function remove$1 (event, fn) {
  3422. target.$off(event, fn);
  3423. }
  3424. function createOnceHandler (event, fn) {
  3425. var _target = target;
  3426. return function onceHandler () {
  3427. var res = fn.apply(null, arguments);
  3428. if (res !== null) {
  3429. _target.$off(event, onceHandler);
  3430. }
  3431. }
  3432. }
  3433. function updateComponentListeners (
  3434. vm,
  3435. listeners,
  3436. oldListeners
  3437. ) {
  3438. target = vm;
  3439. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  3440. target = undefined;
  3441. }
  3442. function eventsMixin (Vue) {
  3443. var hookRE = /^hook:/;
  3444. Vue.prototype.$on = function (event, fn) {
  3445. var vm = this;
  3446. if (Array.isArray(event)) {
  3447. for (var i = 0, l = event.length; i < l; i++) {
  3448. vm.$on(event[i], fn);
  3449. }
  3450. } else {
  3451. (vm._events[event] || (vm._events[event] = [])).push(fn);
  3452. // optimize hook:event cost by using a boolean flag marked at registration
  3453. // instead of a hash lookup
  3454. if (hookRE.test(event)) {
  3455. vm._hasHookEvent = true;
  3456. }
  3457. }
  3458. return vm
  3459. };
  3460. Vue.prototype.$once = function (event, fn) {
  3461. var vm = this;
  3462. function on () {
  3463. vm.$off(event, on);
  3464. fn.apply(vm, arguments);
  3465. }
  3466. on.fn = fn;
  3467. vm.$on(event, on);
  3468. return vm
  3469. };
  3470. Vue.prototype.$off = function (event, fn) {
  3471. var vm = this;
  3472. // all
  3473. if (!arguments.length) {
  3474. vm._events = Object.create(null);
  3475. return vm
  3476. }
  3477. // array of events
  3478. if (Array.isArray(event)) {
  3479. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  3480. vm.$off(event[i$1], fn);
  3481. }
  3482. return vm
  3483. }
  3484. // specific event
  3485. var cbs = vm._events[event];
  3486. if (!cbs) {
  3487. return vm
  3488. }
  3489. if (!fn) {
  3490. vm._events[event] = null;
  3491. return vm
  3492. }
  3493. // specific handler
  3494. var cb;
  3495. var i = cbs.length;
  3496. while (i--) {
  3497. cb = cbs[i];
  3498. if (cb === fn || cb.fn === fn) {
  3499. cbs.splice(i, 1);
  3500. break
  3501. }
  3502. }
  3503. return vm
  3504. };
  3505. Vue.prototype.$emit = function (event) {
  3506. var vm = this;
  3507. {
  3508. var lowerCaseEvent = event.toLowerCase();
  3509. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  3510. tip(
  3511. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  3512. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  3513. "Note that HTML attributes are case-insensitive and you cannot use " +
  3514. "v-on to listen to camelCase events when using in-DOM templates. " +
  3515. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  3516. );
  3517. }
  3518. }
  3519. var cbs = vm._events[event];
  3520. if (cbs) {
  3521. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  3522. var args = toArray(arguments, 1);
  3523. var info = "event handler for \"" + event + "\"";
  3524. for (var i = 0, l = cbs.length; i < l; i++) {
  3525. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  3526. }
  3527. }
  3528. return vm
  3529. };
  3530. }
  3531. /* */
  3532. var activeInstance = null;
  3533. var isUpdatingChildComponent = false;
  3534. function setActiveInstance(vm) {
  3535. var prevActiveInstance = activeInstance;
  3536. activeInstance = vm;
  3537. return function () {
  3538. activeInstance = prevActiveInstance;
  3539. }
  3540. }
  3541. function initLifecycle (vm) {
  3542. var options = vm.$options;
  3543. // locate first non-abstract parent
  3544. var parent = options.parent;
  3545. if (parent && !options.abstract) {
  3546. while (parent.$options.abstract && parent.$parent) {
  3547. parent = parent.$parent;
  3548. }
  3549. parent.$children.push(vm);
  3550. }
  3551. vm.$parent = parent;
  3552. vm.$root = parent ? parent.$root : vm;
  3553. vm.$children = [];
  3554. vm.$refs = {};
  3555. vm._watcher = null;
  3556. vm._inactive = null;
  3557. vm._directInactive = false;
  3558. vm._isMounted = false;
  3559. vm._isDestroyed = false;
  3560. vm._isBeingDestroyed = false;
  3561. }
  3562. function lifecycleMixin (Vue) {
  3563. Vue.prototype._update = function (vnode, hydrating) {
  3564. var vm = this;
  3565. var prevEl = vm.$el;
  3566. var prevVnode = vm._vnode;
  3567. var restoreActiveInstance = setActiveInstance(vm);
  3568. vm._vnode = vnode;
  3569. // Vue.prototype.__patch__ is injected in entry points
  3570. // based on the rendering backend used.
  3571. if (!prevVnode) {
  3572. // initial render
  3573. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  3574. } else {
  3575. // updates
  3576. vm.$el = vm.__patch__(prevVnode, vnode);
  3577. }
  3578. restoreActiveInstance();
  3579. // update __vue__ reference
  3580. if (prevEl) {
  3581. prevEl.__vue__ = null;
  3582. }
  3583. if (vm.$el) {
  3584. vm.$el.__vue__ = vm;
  3585. }
  3586. // if parent is an HOC, update its $el as well
  3587. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  3588. vm.$parent.$el = vm.$el;
  3589. }
  3590. // updated hook is called by the scheduler to ensure that children are
  3591. // updated in a parent's updated hook.
  3592. };
  3593. Vue.prototype.$forceUpdate = function () {
  3594. var vm = this;
  3595. if (vm._watcher) {
  3596. vm._watcher.update();
  3597. }
  3598. };
  3599. Vue.prototype.$destroy = function () {
  3600. var vm = this;
  3601. if (vm._isBeingDestroyed) {
  3602. return
  3603. }
  3604. callHook(vm, 'beforeDestroy');
  3605. vm._isBeingDestroyed = true;
  3606. // remove self from parent
  3607. var parent = vm.$parent;
  3608. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  3609. remove(parent.$children, vm);
  3610. }
  3611. // teardown watchers
  3612. if (vm._watcher) {
  3613. vm._watcher.teardown();
  3614. }
  3615. var i = vm._watchers.length;
  3616. while (i--) {
  3617. vm._watchers[i].teardown();
  3618. }
  3619. // remove reference from data ob
  3620. // frozen object may not have observer.
  3621. if (vm._data.__ob__) {
  3622. vm._data.__ob__.vmCount--;
  3623. }
  3624. // call the last hook...
  3625. vm._isDestroyed = true;
  3626. // invoke destroy hooks on current rendered tree
  3627. vm.__patch__(vm._vnode, null);
  3628. // fire destroyed hook
  3629. callHook(vm, 'destroyed');
  3630. // turn off all instance listeners.
  3631. vm.$off();
  3632. // remove __vue__ reference
  3633. if (vm.$el) {
  3634. vm.$el.__vue__ = null;
  3635. }
  3636. // release circular reference (#6759)
  3637. if (vm.$vnode) {
  3638. vm.$vnode.parent = null;
  3639. }
  3640. };
  3641. }
  3642. function mountComponent (
  3643. vm,
  3644. el,
  3645. hydrating
  3646. ) {
  3647. vm.$el = el;
  3648. if (!vm.$options.render) {
  3649. vm.$options.render = createEmptyVNode;
  3650. {
  3651. /* istanbul ignore if */
  3652. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  3653. vm.$options.el || el) {
  3654. warn(
  3655. 'You are using the runtime-only build of Vue where the template ' +
  3656. 'compiler is not available. Either pre-compile the templates into ' +
  3657. 'render functions, or use the compiler-included build.',
  3658. vm
  3659. );
  3660. } else {
  3661. warn(
  3662. 'Failed to mount component: template or render function not defined.',
  3663. vm
  3664. );
  3665. }
  3666. }
  3667. }
  3668. callHook(vm, 'beforeMount');
  3669. var updateComponent;
  3670. /* istanbul ignore if */
  3671. if (config.performance && mark) {
  3672. updateComponent = function () {
  3673. var name = vm._name;
  3674. var id = vm._uid;
  3675. var startTag = "vue-perf-start:" + id;
  3676. var endTag = "vue-perf-end:" + id;
  3677. mark(startTag);
  3678. var vnode = vm._render();
  3679. mark(endTag);
  3680. measure(("vue " + name + " render"), startTag, endTag);
  3681. mark(startTag);
  3682. vm._update(vnode, hydrating);
  3683. mark(endTag);
  3684. measure(("vue " + name + " patch"), startTag, endTag);
  3685. };
  3686. } else {
  3687. updateComponent = function () {
  3688. vm._update(vm._render(), hydrating);
  3689. };
  3690. }
  3691. // we set this to vm._watcher inside the watcher's constructor
  3692. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  3693. // component's mounted hook), which relies on vm._watcher being already defined
  3694. new Watcher(vm, updateComponent, noop, {
  3695. before: function before () {
  3696. if (vm._isMounted && !vm._isDestroyed) {
  3697. callHook(vm, 'beforeUpdate');
  3698. }
  3699. }
  3700. }, true /* isRenderWatcher */);
  3701. hydrating = false;
  3702. // manually mounted instance, call mounted on self
  3703. // mounted is called for render-created child components in its inserted hook
  3704. if (vm.$vnode == null) {
  3705. vm._isMounted = true;
  3706. callHook(vm, 'mounted');
  3707. }
  3708. return vm
  3709. }
  3710. function updateChildComponent (
  3711. vm,
  3712. propsData,
  3713. listeners,
  3714. parentVnode,
  3715. renderChildren
  3716. ) {
  3717. {
  3718. isUpdatingChildComponent = true;
  3719. }
  3720. // determine whether component has slot children
  3721. // we need to do this before overwriting $options._renderChildren.
  3722. // check if there are dynamic scopedSlots (hand-written or compiled but with
  3723. // dynamic slot names). Static scoped slots compiled from template has the
  3724. // "$stable" marker.
  3725. var newScopedSlots = parentVnode.data.scopedSlots;
  3726. var oldScopedSlots = vm.$scopedSlots;
  3727. var hasDynamicScopedSlot = !!(
  3728. (newScopedSlots && !newScopedSlots.$stable) ||
  3729. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  3730. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  3731. );
  3732. // Any static slot children from the parent may have changed during parent's
  3733. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  3734. // update is necessary to ensure correctness.
  3735. var needsForceUpdate = !!(
  3736. renderChildren || // has new static slots
  3737. vm.$options._renderChildren || // has old static slots
  3738. hasDynamicScopedSlot
  3739. );
  3740. vm.$options._parentVnode = parentVnode;
  3741. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  3742. if (vm._vnode) { // update child tree's parent
  3743. vm._vnode.parent = parentVnode;
  3744. }
  3745. vm.$options._renderChildren = renderChildren;
  3746. // update $attrs and $listeners hash
  3747. // these are also reactive so they may trigger child update if the child
  3748. // used them during render
  3749. vm.$attrs = parentVnode.data.attrs || emptyObject;
  3750. vm.$listeners = listeners || emptyObject;
  3751. // update props
  3752. if (propsData && vm.$options.props) {
  3753. toggleObserving(false);
  3754. var props = vm._props;
  3755. var propKeys = vm.$options._propKeys || [];
  3756. for (var i = 0; i < propKeys.length; i++) {
  3757. var key = propKeys[i];
  3758. var propOptions = vm.$options.props; // wtf flow?
  3759. props[key] = validateProp(key, propOptions, propsData, vm);
  3760. }
  3761. toggleObserving(true);
  3762. // keep a copy of raw propsData
  3763. vm.$options.propsData = propsData;
  3764. }
  3765. // update listeners
  3766. listeners = listeners || emptyObject;
  3767. var oldListeners = vm.$options._parentListeners;
  3768. vm.$options._parentListeners = listeners;
  3769. updateComponentListeners(vm, listeners, oldListeners);
  3770. // resolve slots + force update if has children
  3771. if (needsForceUpdate) {
  3772. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  3773. vm.$forceUpdate();
  3774. }
  3775. {
  3776. isUpdatingChildComponent = false;
  3777. }
  3778. }
  3779. function isInInactiveTree (vm) {
  3780. while (vm && (vm = vm.$parent)) {
  3781. if (vm._inactive) { return true }
  3782. }
  3783. return false
  3784. }
  3785. function activateChildComponent (vm, direct) {
  3786. if (direct) {
  3787. vm._directInactive = false;
  3788. if (isInInactiveTree(vm)) {
  3789. return
  3790. }
  3791. } else if (vm._directInactive) {
  3792. return
  3793. }
  3794. if (vm._inactive || vm._inactive === null) {
  3795. vm._inactive = false;
  3796. for (var i = 0; i < vm.$children.length; i++) {
  3797. activateChildComponent(vm.$children[i]);
  3798. }
  3799. callHook(vm, 'activated');
  3800. }
  3801. }
  3802. function deactivateChildComponent (vm, direct) {
  3803. if (direct) {
  3804. vm._directInactive = true;
  3805. if (isInInactiveTree(vm)) {
  3806. return
  3807. }
  3808. }
  3809. if (!vm._inactive) {
  3810. vm._inactive = true;
  3811. for (var i = 0; i < vm.$children.length; i++) {
  3812. deactivateChildComponent(vm.$children[i]);
  3813. }
  3814. callHook(vm, 'deactivated');
  3815. }
  3816. }
  3817. function callHook (vm, hook) {
  3818. // #7573 disable dep collection when invoking lifecycle hooks
  3819. pushTarget();
  3820. var handlers = vm.$options[hook];
  3821. var info = hook + " hook";
  3822. if (handlers) {
  3823. for (var i = 0, j = handlers.length; i < j; i++) {
  3824. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  3825. }
  3826. }
  3827. if (vm._hasHookEvent) {
  3828. vm.$emit('hook:' + hook);
  3829. }
  3830. popTarget();
  3831. }
  3832. /* */
  3833. var MAX_UPDATE_COUNT = 100;
  3834. var queue = [];
  3835. var activatedChildren = [];
  3836. var has = {};
  3837. var circular = {};
  3838. var waiting = false;
  3839. var flushing = false;
  3840. var index = 0;
  3841. /**
  3842. * Reset the scheduler's state.
  3843. */
  3844. function resetSchedulerState () {
  3845. index = queue.length = activatedChildren.length = 0;
  3846. has = {};
  3847. {
  3848. circular = {};
  3849. }
  3850. waiting = flushing = false;
  3851. }
  3852. // Async edge case #6566 requires saving the timestamp when event listeners are
  3853. // attached. However, calling performance.now() has a perf overhead especially
  3854. // if the page has thousands of event listeners. Instead, we take a timestamp
  3855. // every time the scheduler flushes and use that for all event listeners
  3856. // attached during that flush.
  3857. var currentFlushTimestamp = 0;
  3858. // Async edge case fix requires storing an event listener's attach timestamp.
  3859. var getNow = Date.now;
  3860. // Determine what event timestamp the browser is using. Annoyingly, the
  3861. // timestamp can either be hi-res (relative to page load) or low-res
  3862. // (relative to UNIX epoch), so in order to compare time we have to use the
  3863. // same timestamp type when saving the flush timestamp.
  3864. // All IE versions use low-res event timestamps, and have problematic clock
  3865. // implementations (#9632)
  3866. if (inBrowser && !isIE) {
  3867. var performance = window.performance;
  3868. if (
  3869. performance &&
  3870. typeof performance.now === 'function' &&
  3871. getNow() > document.createEvent('Event').timeStamp
  3872. ) {
  3873. // if the event timestamp, although evaluated AFTER the Date.now(), is
  3874. // smaller than it, it means the event is using a hi-res timestamp,
  3875. // and we need to use the hi-res version for event listener timestamps as
  3876. // well.
  3877. getNow = function () { return performance.now(); };
  3878. }
  3879. }
  3880. /**
  3881. * Flush both queues and run the watchers.
  3882. */
  3883. function flushSchedulerQueue () {
  3884. currentFlushTimestamp = getNow();
  3885. flushing = true;
  3886. var watcher, id;
  3887. // Sort queue before flush.
  3888. // This ensures that:
  3889. // 1. Components are updated from parent to child. (because parent is always
  3890. // created before the child)
  3891. // 2. A component's user watchers are run before its render watcher (because
  3892. // user watchers are created before the render watcher)
  3893. // 3. If a component is destroyed during a parent component's watcher run,
  3894. // its watchers can be skipped.
  3895. queue.sort(function (a, b) { return a.id - b.id; });
  3896. // do not cache length because more watchers might be pushed
  3897. // as we run existing watchers
  3898. for (index = 0; index < queue.length; index++) {
  3899. watcher = queue[index];
  3900. if (watcher.before) {
  3901. watcher.before();
  3902. }
  3903. id = watcher.id;
  3904. has[id] = null;
  3905. watcher.run();
  3906. // in dev build, check and stop circular updates.
  3907. if (has[id] != null) {
  3908. circular[id] = (circular[id] || 0) + 1;
  3909. if (circular[id] > MAX_UPDATE_COUNT) {
  3910. warn(
  3911. 'You may have an infinite update loop ' + (
  3912. watcher.user
  3913. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  3914. : "in a component render function."
  3915. ),
  3916. watcher.vm
  3917. );
  3918. break
  3919. }
  3920. }
  3921. }
  3922. // keep copies of post queues before resetting state
  3923. var activatedQueue = activatedChildren.slice();
  3924. var updatedQueue = queue.slice();
  3925. resetSchedulerState();
  3926. // call component updated and activated hooks
  3927. callActivatedHooks(activatedQueue);
  3928. callUpdatedHooks(updatedQueue);
  3929. // devtool hook
  3930. /* istanbul ignore if */
  3931. if (devtools && config.devtools) {
  3932. devtools.emit('flush');
  3933. }
  3934. }
  3935. function callUpdatedHooks (queue) {
  3936. var i = queue.length;
  3937. while (i--) {
  3938. var watcher = queue[i];
  3939. var vm = watcher.vm;
  3940. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  3941. callHook(vm, 'updated');
  3942. }
  3943. }
  3944. }
  3945. /**
  3946. * Queue a kept-alive component that was activated during patch.
  3947. * The queue will be processed after the entire tree has been patched.
  3948. */
  3949. function queueActivatedComponent (vm) {
  3950. // setting _inactive to false here so that a render function can
  3951. // rely on checking whether it's in an inactive tree (e.g. router-view)
  3952. vm._inactive = false;
  3953. activatedChildren.push(vm);
  3954. }
  3955. function callActivatedHooks (queue) {
  3956. for (var i = 0; i < queue.length; i++) {
  3957. queue[i]._inactive = true;
  3958. activateChildComponent(queue[i], true /* true */);
  3959. }
  3960. }
  3961. /**
  3962. * Push a watcher into the watcher queue.
  3963. * Jobs with duplicate IDs will be skipped unless it's
  3964. * pushed when the queue is being flushed.
  3965. */
  3966. function queueWatcher (watcher) {
  3967. var id = watcher.id;
  3968. if (has[id] == null) {
  3969. has[id] = true;
  3970. if (!flushing) {
  3971. queue.push(watcher);
  3972. } else {
  3973. // if already flushing, splice the watcher based on its id
  3974. // if already past its id, it will be run next immediately.
  3975. var i = queue.length - 1;
  3976. while (i > index && queue[i].id > watcher.id) {
  3977. i--;
  3978. }
  3979. queue.splice(i + 1, 0, watcher);
  3980. }
  3981. // queue the flush
  3982. if (!waiting) {
  3983. waiting = true;
  3984. if (!config.async) {
  3985. flushSchedulerQueue();
  3986. return
  3987. }
  3988. nextTick(flushSchedulerQueue);
  3989. }
  3990. }
  3991. }
  3992. /* */
  3993. var uid$2 = 0;
  3994. /**
  3995. * A watcher parses an expression, collects dependencies,
  3996. * and fires callback when the expression value changes.
  3997. * This is used for both the $watch() api and directives.
  3998. */
  3999. var Watcher = function Watcher (
  4000. vm,
  4001. expOrFn,
  4002. cb,
  4003. options,
  4004. isRenderWatcher
  4005. ) {
  4006. this.vm = vm;
  4007. if (isRenderWatcher) {
  4008. vm._watcher = this;
  4009. }
  4010. vm._watchers.push(this);
  4011. // options
  4012. if (options) {
  4013. this.deep = !!options.deep;
  4014. this.user = !!options.user;
  4015. this.lazy = !!options.lazy;
  4016. this.sync = !!options.sync;
  4017. this.before = options.before;
  4018. } else {
  4019. this.deep = this.user = this.lazy = this.sync = false;
  4020. }
  4021. this.cb = cb;
  4022. this.id = ++uid$2; // uid for batching
  4023. this.active = true;
  4024. this.dirty = this.lazy; // for lazy watchers
  4025. this.deps = [];
  4026. this.newDeps = [];
  4027. this.depIds = new _Set();
  4028. this.newDepIds = new _Set();
  4029. this.expression = expOrFn.toString();
  4030. // parse expression for getter
  4031. if (typeof expOrFn === 'function') {
  4032. this.getter = expOrFn;
  4033. } else {
  4034. this.getter = parsePath(expOrFn);
  4035. if (!this.getter) {
  4036. this.getter = noop;
  4037. warn(
  4038. "Failed watching path: \"" + expOrFn + "\" " +
  4039. 'Watcher only accepts simple dot-delimited paths. ' +
  4040. 'For full control, use a function instead.',
  4041. vm
  4042. );
  4043. }
  4044. }
  4045. this.value = this.lazy
  4046. ? undefined
  4047. : this.get();
  4048. };
  4049. /**
  4050. * Evaluate the getter, and re-collect dependencies.
  4051. */
  4052. Watcher.prototype.get = function get () {
  4053. pushTarget(this);
  4054. var value;
  4055. var vm = this.vm;
  4056. try {
  4057. value = this.getter.call(vm, vm);
  4058. } catch (e) {
  4059. if (this.user) {
  4060. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  4061. } else {
  4062. throw e
  4063. }
  4064. } finally {
  4065. // "touch" every property so they are all tracked as
  4066. // dependencies for deep watching
  4067. if (this.deep) {
  4068. traverse(value);
  4069. }
  4070. popTarget();
  4071. this.cleanupDeps();
  4072. }
  4073. return value
  4074. };
  4075. /**
  4076. * Add a dependency to this directive.
  4077. */
  4078. Watcher.prototype.addDep = function addDep (dep) {
  4079. var id = dep.id;
  4080. if (!this.newDepIds.has(id)) {
  4081. this.newDepIds.add(id);
  4082. this.newDeps.push(dep);
  4083. if (!this.depIds.has(id)) {
  4084. dep.addSub(this);
  4085. }
  4086. }
  4087. };
  4088. /**
  4089. * Clean up for dependency collection.
  4090. */
  4091. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  4092. var i = this.deps.length;
  4093. while (i--) {
  4094. var dep = this.deps[i];
  4095. if (!this.newDepIds.has(dep.id)) {
  4096. dep.removeSub(this);
  4097. }
  4098. }
  4099. var tmp = this.depIds;
  4100. this.depIds = this.newDepIds;
  4101. this.newDepIds = tmp;
  4102. this.newDepIds.clear();
  4103. tmp = this.deps;
  4104. this.deps = this.newDeps;
  4105. this.newDeps = tmp;
  4106. this.newDeps.length = 0;
  4107. };
  4108. /**
  4109. * Subscriber interface.
  4110. * Will be called when a dependency changes.
  4111. */
  4112. Watcher.prototype.update = function update () {
  4113. /* istanbul ignore else */
  4114. if (this.lazy) {
  4115. this.dirty = true;
  4116. } else if (this.sync) {
  4117. this.run();
  4118. } else {
  4119. queueWatcher(this);
  4120. }
  4121. };
  4122. /**
  4123. * Scheduler job interface.
  4124. * Will be called by the scheduler.
  4125. */
  4126. Watcher.prototype.run = function run () {
  4127. if (this.active) {
  4128. var value = this.get();
  4129. if (
  4130. value !== this.value ||
  4131. // Deep watchers and watchers on Object/Arrays should fire even
  4132. // when the value is the same, because the value may
  4133. // have mutated.
  4134. isObject(value) ||
  4135. this.deep
  4136. ) {
  4137. // set new value
  4138. var oldValue = this.value;
  4139. this.value = value;
  4140. if (this.user) {
  4141. try {
  4142. this.cb.call(this.vm, value, oldValue);
  4143. } catch (e) {
  4144. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  4145. }
  4146. } else {
  4147. this.cb.call(this.vm, value, oldValue);
  4148. }
  4149. }
  4150. }
  4151. };
  4152. /**
  4153. * Evaluate the value of the watcher.
  4154. * This only gets called for lazy watchers.
  4155. */
  4156. Watcher.prototype.evaluate = function evaluate () {
  4157. this.value = this.get();
  4158. this.dirty = false;
  4159. };
  4160. /**
  4161. * Depend on all deps collected by this watcher.
  4162. */
  4163. Watcher.prototype.depend = function depend () {
  4164. var i = this.deps.length;
  4165. while (i--) {
  4166. this.deps[i].depend();
  4167. }
  4168. };
  4169. /**
  4170. * Remove self from all dependencies' subscriber list.
  4171. */
  4172. Watcher.prototype.teardown = function teardown () {
  4173. if (this.active) {
  4174. // remove self from vm's watcher list
  4175. // this is a somewhat expensive operation so we skip it
  4176. // if the vm is being destroyed.
  4177. if (!this.vm._isBeingDestroyed) {
  4178. remove(this.vm._watchers, this);
  4179. }
  4180. var i = this.deps.length;
  4181. while (i--) {
  4182. this.deps[i].removeSub(this);
  4183. }
  4184. this.active = false;
  4185. }
  4186. };
  4187. /* */
  4188. var sharedPropertyDefinition = {
  4189. enumerable: true,
  4190. configurable: true,
  4191. get: noop,
  4192. set: noop
  4193. };
  4194. function proxy (target, sourceKey, key) {
  4195. sharedPropertyDefinition.get = function proxyGetter () {
  4196. return this[sourceKey][key]
  4197. };
  4198. sharedPropertyDefinition.set = function proxySetter (val) {
  4199. this[sourceKey][key] = val;
  4200. };
  4201. Object.defineProperty(target, key, sharedPropertyDefinition);
  4202. }
  4203. function initState (vm) {
  4204. vm._watchers = [];
  4205. var opts = vm.$options;
  4206. if (opts.props) { initProps(vm, opts.props); }
  4207. if (opts.methods) { initMethods(vm, opts.methods); }
  4208. if (opts.data) {
  4209. initData(vm);
  4210. } else {
  4211. observe(vm._data = {}, true /* asRootData */);
  4212. }
  4213. if (opts.computed) { initComputed(vm, opts.computed); }
  4214. if (opts.watch && opts.watch !== nativeWatch) {
  4215. initWatch(vm, opts.watch);
  4216. }
  4217. }
  4218. function initProps (vm, propsOptions) {
  4219. var propsData = vm.$options.propsData || {};
  4220. var props = vm._props = {};
  4221. // cache prop keys so that future props updates can iterate using Array
  4222. // instead of dynamic object key enumeration.
  4223. var keys = vm.$options._propKeys = [];
  4224. var isRoot = !vm.$parent;
  4225. // root instance props should be converted
  4226. if (!isRoot) {
  4227. toggleObserving(false);
  4228. }
  4229. var loop = function ( key ) {
  4230. keys.push(key);
  4231. var value = validateProp(key, propsOptions, propsData, vm);
  4232. /* istanbul ignore else */
  4233. {
  4234. var hyphenatedKey = hyphenate(key);
  4235. if (isReservedAttribute(hyphenatedKey) ||
  4236. config.isReservedAttr(hyphenatedKey)) {
  4237. warn(
  4238. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  4239. vm
  4240. );
  4241. }
  4242. defineReactive$$1(props, key, value, function () {
  4243. if (!isRoot && !isUpdatingChildComponent) {
  4244. warn(
  4245. "Avoid mutating a prop directly since the value will be " +
  4246. "overwritten whenever the parent component re-renders. " +
  4247. "Instead, use a data or computed property based on the prop's " +
  4248. "value. Prop being mutated: \"" + key + "\"",
  4249. vm
  4250. );
  4251. }
  4252. });
  4253. }
  4254. // static props are already proxied on the component's prototype
  4255. // during Vue.extend(). We only need to proxy props defined at
  4256. // instantiation here.
  4257. if (!(key in vm)) {
  4258. proxy(vm, "_props", key);
  4259. }
  4260. };
  4261. for (var key in propsOptions) loop( key );
  4262. toggleObserving(true);
  4263. }
  4264. function initData (vm) {
  4265. var data = vm.$options.data;
  4266. data = vm._data = typeof data === 'function'
  4267. ? getData(data, vm)
  4268. : data || {};
  4269. if (!isPlainObject(data)) {
  4270. data = {};
  4271. warn(
  4272. 'data functions should return an object:\n' +
  4273. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  4274. vm
  4275. );
  4276. }
  4277. // proxy data on instance
  4278. var keys = Object.keys(data);
  4279. var props = vm.$options.props;
  4280. var methods = vm.$options.methods;
  4281. var i = keys.length;
  4282. while (i--) {
  4283. var key = keys[i];
  4284. {
  4285. if (methods && hasOwn(methods, key)) {
  4286. warn(
  4287. ("Method \"" + key + "\" has already been defined as a data property."),
  4288. vm
  4289. );
  4290. }
  4291. }
  4292. if (props && hasOwn(props, key)) {
  4293. warn(
  4294. "The data property \"" + key + "\" is already declared as a prop. " +
  4295. "Use prop default value instead.",
  4296. vm
  4297. );
  4298. } else if (!isReserved(key)) {
  4299. proxy(vm, "_data", key);
  4300. }
  4301. }
  4302. // observe data
  4303. observe(data, true /* asRootData */);
  4304. }
  4305. function getData (data, vm) {
  4306. // #7573 disable dep collection when invoking data getters
  4307. pushTarget();
  4308. try {
  4309. return data.call(vm, vm)
  4310. } catch (e) {
  4311. handleError(e, vm, "data()");
  4312. return {}
  4313. } finally {
  4314. popTarget();
  4315. }
  4316. }
  4317. var computedWatcherOptions = { lazy: true };
  4318. function initComputed (vm, computed) {
  4319. // $flow-disable-line
  4320. var watchers = vm._computedWatchers = Object.create(null);
  4321. // computed properties are just getters during SSR
  4322. var isSSR = isServerRendering();
  4323. for (var key in computed) {
  4324. var userDef = computed[key];
  4325. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  4326. if (getter == null) {
  4327. warn(
  4328. ("Getter is missing for computed property \"" + key + "\"."),
  4329. vm
  4330. );
  4331. }
  4332. if (!isSSR) {
  4333. // create internal watcher for the computed property.
  4334. watchers[key] = new Watcher(
  4335. vm,
  4336. getter || noop,
  4337. noop,
  4338. computedWatcherOptions
  4339. );
  4340. }
  4341. // component-defined computed properties are already defined on the
  4342. // component prototype. We only need to define computed properties defined
  4343. // at instantiation here.
  4344. if (!(key in vm)) {
  4345. defineComputed(vm, key, userDef);
  4346. } else {
  4347. if (key in vm.$data) {
  4348. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  4349. } else if (vm.$options.props && key in vm.$options.props) {
  4350. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  4351. }
  4352. }
  4353. }
  4354. }
  4355. function defineComputed (
  4356. target,
  4357. key,
  4358. userDef
  4359. ) {
  4360. var shouldCache = !isServerRendering();
  4361. if (typeof userDef === 'function') {
  4362. sharedPropertyDefinition.get = shouldCache
  4363. ? createComputedGetter(key)
  4364. : createGetterInvoker(userDef);
  4365. sharedPropertyDefinition.set = noop;
  4366. } else {
  4367. sharedPropertyDefinition.get = userDef.get
  4368. ? shouldCache && userDef.cache !== false
  4369. ? createComputedGetter(key)
  4370. : createGetterInvoker(userDef.get)
  4371. : noop;
  4372. sharedPropertyDefinition.set = userDef.set || noop;
  4373. }
  4374. if (sharedPropertyDefinition.set === noop) {
  4375. sharedPropertyDefinition.set = function () {
  4376. warn(
  4377. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  4378. this
  4379. );
  4380. };
  4381. }
  4382. Object.defineProperty(target, key, sharedPropertyDefinition);
  4383. }
  4384. function createComputedGetter (key) {
  4385. return function computedGetter () {
  4386. var watcher = this._computedWatchers && this._computedWatchers[key];
  4387. if (watcher) {
  4388. if (watcher.dirty) {
  4389. watcher.evaluate();
  4390. }
  4391. if (Dep.target) {
  4392. watcher.depend();
  4393. }
  4394. return watcher.value
  4395. }
  4396. }
  4397. }
  4398. function createGetterInvoker(fn) {
  4399. return function computedGetter () {
  4400. return fn.call(this, this)
  4401. }
  4402. }
  4403. function initMethods (vm, methods) {
  4404. var props = vm.$options.props;
  4405. for (var key in methods) {
  4406. {
  4407. if (typeof methods[key] !== 'function') {
  4408. warn(
  4409. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  4410. "Did you reference the function correctly?",
  4411. vm
  4412. );
  4413. }
  4414. if (props && hasOwn(props, key)) {
  4415. warn(
  4416. ("Method \"" + key + "\" has already been defined as a prop."),
  4417. vm
  4418. );
  4419. }
  4420. if ((key in vm) && isReserved(key)) {
  4421. warn(
  4422. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  4423. "Avoid defining component methods that start with _ or $."
  4424. );
  4425. }
  4426. }
  4427. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  4428. }
  4429. }
  4430. function initWatch (vm, watch) {
  4431. for (var key in watch) {
  4432. var handler = watch[key];
  4433. if (Array.isArray(handler)) {
  4434. for (var i = 0; i < handler.length; i++) {
  4435. createWatcher(vm, key, handler[i]);
  4436. }
  4437. } else {
  4438. createWatcher(vm, key, handler);
  4439. }
  4440. }
  4441. }
  4442. function createWatcher (
  4443. vm,
  4444. expOrFn,
  4445. handler,
  4446. options
  4447. ) {
  4448. if (isPlainObject(handler)) {
  4449. options = handler;
  4450. handler = handler.handler;
  4451. }
  4452. if (typeof handler === 'string') {
  4453. handler = vm[handler];
  4454. }
  4455. return vm.$watch(expOrFn, handler, options)
  4456. }
  4457. function stateMixin (Vue) {
  4458. // flow somehow has problems with directly declared definition object
  4459. // when using Object.defineProperty, so we have to procedurally build up
  4460. // the object here.
  4461. var dataDef = {};
  4462. dataDef.get = function () { return this._data };
  4463. var propsDef = {};
  4464. propsDef.get = function () { return this._props };
  4465. {
  4466. dataDef.set = function () {
  4467. warn(
  4468. 'Avoid replacing instance root $data. ' +
  4469. 'Use nested data properties instead.',
  4470. this
  4471. );
  4472. };
  4473. propsDef.set = function () {
  4474. warn("$props is readonly.", this);
  4475. };
  4476. }
  4477. Object.defineProperty(Vue.prototype, '$data', dataDef);
  4478. Object.defineProperty(Vue.prototype, '$props', propsDef);
  4479. Vue.prototype.$set = set;
  4480. Vue.prototype.$delete = del;
  4481. Vue.prototype.$watch = function (
  4482. expOrFn,
  4483. cb,
  4484. options
  4485. ) {
  4486. var vm = this;
  4487. if (isPlainObject(cb)) {
  4488. return createWatcher(vm, expOrFn, cb, options)
  4489. }
  4490. options = options || {};
  4491. options.user = true;
  4492. var watcher = new Watcher(vm, expOrFn, cb, options);
  4493. if (options.immediate) {
  4494. try {
  4495. cb.call(vm, watcher.value);
  4496. } catch (error) {
  4497. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  4498. }
  4499. }
  4500. return function unwatchFn () {
  4501. watcher.teardown();
  4502. }
  4503. };
  4504. }
  4505. /* */
  4506. var uid$3 = 0;
  4507. function initMixin (Vue) {
  4508. Vue.prototype._init = function (options) {
  4509. var vm = this;
  4510. // a uid
  4511. vm._uid = uid$3++;
  4512. var startTag, endTag;
  4513. /* istanbul ignore if */
  4514. if (config.performance && mark) {
  4515. startTag = "vue-perf-start:" + (vm._uid);
  4516. endTag = "vue-perf-end:" + (vm._uid);
  4517. mark(startTag);
  4518. }
  4519. // a flag to avoid this being observed
  4520. vm._isVue = true;
  4521. // merge options
  4522. if (options && options._isComponent) {
  4523. // optimize internal component instantiation
  4524. // since dynamic options merging is pretty slow, and none of the
  4525. // internal component options needs special treatment.
  4526. initInternalComponent(vm, options);
  4527. } else {
  4528. vm.$options = mergeOptions(
  4529. resolveConstructorOptions(vm.constructor),
  4530. options || {},
  4531. vm
  4532. );
  4533. }
  4534. /* istanbul ignore else */
  4535. {
  4536. initProxy(vm);
  4537. }
  4538. // expose real self
  4539. vm._self = vm;
  4540. initLifecycle(vm);
  4541. initEvents(vm);
  4542. initRender(vm);
  4543. callHook(vm, 'beforeCreate');
  4544. initInjections(vm); // resolve injections before data/props
  4545. initState(vm);
  4546. initProvide(vm); // resolve provide after data/props
  4547. callHook(vm, 'created');
  4548. /* istanbul ignore if */
  4549. if (config.performance && mark) {
  4550. vm._name = formatComponentName(vm, false);
  4551. mark(endTag);
  4552. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  4553. }
  4554. if (vm.$options.el) {
  4555. vm.$mount(vm.$options.el);
  4556. }
  4557. };
  4558. }
  4559. function initInternalComponent (vm, options) {
  4560. var opts = vm.$options = Object.create(vm.constructor.options);
  4561. // doing this because it's faster than dynamic enumeration.
  4562. var parentVnode = options._parentVnode;
  4563. opts.parent = options.parent;
  4564. opts._parentVnode = parentVnode;
  4565. var vnodeComponentOptions = parentVnode.componentOptions;
  4566. opts.propsData = vnodeComponentOptions.propsData;
  4567. opts._parentListeners = vnodeComponentOptions.listeners;
  4568. opts._renderChildren = vnodeComponentOptions.children;
  4569. opts._componentTag = vnodeComponentOptions.tag;
  4570. if (options.render) {
  4571. opts.render = options.render;
  4572. opts.staticRenderFns = options.staticRenderFns;
  4573. }
  4574. }
  4575. function resolveConstructorOptions (Ctor) {
  4576. var options = Ctor.options;
  4577. if (Ctor.super) {
  4578. var superOptions = resolveConstructorOptions(Ctor.super);
  4579. var cachedSuperOptions = Ctor.superOptions;
  4580. if (superOptions !== cachedSuperOptions) {
  4581. // super option changed,
  4582. // need to resolve new options.
  4583. Ctor.superOptions = superOptions;
  4584. // check if there are any late-modified/attached options (#4976)
  4585. var modifiedOptions = resolveModifiedOptions(Ctor);
  4586. // update base extend options
  4587. if (modifiedOptions) {
  4588. extend(Ctor.extendOptions, modifiedOptions);
  4589. }
  4590. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4591. if (options.name) {
  4592. options.components[options.name] = Ctor;
  4593. }
  4594. }
  4595. }
  4596. return options
  4597. }
  4598. function resolveModifiedOptions (Ctor) {
  4599. var modified;
  4600. var latest = Ctor.options;
  4601. var sealed = Ctor.sealedOptions;
  4602. for (var key in latest) {
  4603. if (latest[key] !== sealed[key]) {
  4604. if (!modified) { modified = {}; }
  4605. modified[key] = latest[key];
  4606. }
  4607. }
  4608. return modified
  4609. }
  4610. function Vue (options) {
  4611. if (!(this instanceof Vue)
  4612. ) {
  4613. warn('Vue is a constructor and should be called with the `new` keyword');
  4614. }
  4615. this._init(options);
  4616. }
  4617. initMixin(Vue);
  4618. stateMixin(Vue);
  4619. eventsMixin(Vue);
  4620. lifecycleMixin(Vue);
  4621. renderMixin(Vue);
  4622. /* */
  4623. function initUse (Vue) {
  4624. Vue.use = function (plugin) {
  4625. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  4626. if (installedPlugins.indexOf(plugin) > -1) {
  4627. return this
  4628. }
  4629. // additional parameters
  4630. var args = toArray(arguments, 1);
  4631. args.unshift(this);
  4632. if (typeof plugin.install === 'function') {
  4633. plugin.install.apply(plugin, args);
  4634. } else if (typeof plugin === 'function') {
  4635. plugin.apply(null, args);
  4636. }
  4637. installedPlugins.push(plugin);
  4638. return this
  4639. };
  4640. }
  4641. /* */
  4642. function initMixin$1 (Vue) {
  4643. Vue.mixin = function (mixin) {
  4644. this.options = mergeOptions(this.options, mixin);
  4645. return this
  4646. };
  4647. }
  4648. /* */
  4649. function initExtend (Vue) {
  4650. /**
  4651. * Each instance constructor, including Vue, has a unique
  4652. * cid. This enables us to create wrapped "child
  4653. * constructors" for prototypal inheritance and cache them.
  4654. */
  4655. Vue.cid = 0;
  4656. var cid = 1;
  4657. /**
  4658. * Class inheritance
  4659. */
  4660. Vue.extend = function (extendOptions) {
  4661. extendOptions = extendOptions || {};
  4662. var Super = this;
  4663. var SuperId = Super.cid;
  4664. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  4665. if (cachedCtors[SuperId]) {
  4666. return cachedCtors[SuperId]
  4667. }
  4668. var name = extendOptions.name || Super.options.name;
  4669. if (name) {
  4670. validateComponentName(name);
  4671. }
  4672. var Sub = function VueComponent (options) {
  4673. this._init(options);
  4674. };
  4675. Sub.prototype = Object.create(Super.prototype);
  4676. Sub.prototype.constructor = Sub;
  4677. Sub.cid = cid++;
  4678. Sub.options = mergeOptions(
  4679. Super.options,
  4680. extendOptions
  4681. );
  4682. Sub['super'] = Super;
  4683. // For props and computed properties, we define the proxy getters on
  4684. // the Vue instances at extension time, on the extended prototype. This
  4685. // avoids Object.defineProperty calls for each instance created.
  4686. if (Sub.options.props) {
  4687. initProps$1(Sub);
  4688. }
  4689. if (Sub.options.computed) {
  4690. initComputed$1(Sub);
  4691. }
  4692. // allow further extension/mixin/plugin usage
  4693. Sub.extend = Super.extend;
  4694. Sub.mixin = Super.mixin;
  4695. Sub.use = Super.use;
  4696. // create asset registers, so extended classes
  4697. // can have their private assets too.
  4698. ASSET_TYPES.forEach(function (type) {
  4699. Sub[type] = Super[type];
  4700. });
  4701. // enable recursive self-lookup
  4702. if (name) {
  4703. Sub.options.components[name] = Sub;
  4704. }
  4705. // keep a reference to the super options at extension time.
  4706. // later at instantiation we can check if Super's options have
  4707. // been updated.
  4708. Sub.superOptions = Super.options;
  4709. Sub.extendOptions = extendOptions;
  4710. Sub.sealedOptions = extend({}, Sub.options);
  4711. // cache constructor
  4712. cachedCtors[SuperId] = Sub;
  4713. return Sub
  4714. };
  4715. }
  4716. function initProps$1 (Comp) {
  4717. var props = Comp.options.props;
  4718. for (var key in props) {
  4719. proxy(Comp.prototype, "_props", key);
  4720. }
  4721. }
  4722. function initComputed$1 (Comp) {
  4723. var computed = Comp.options.computed;
  4724. for (var key in computed) {
  4725. defineComputed(Comp.prototype, key, computed[key]);
  4726. }
  4727. }
  4728. /* */
  4729. function initAssetRegisters (Vue) {
  4730. /**
  4731. * Create asset registration methods.
  4732. */
  4733. ASSET_TYPES.forEach(function (type) {
  4734. Vue[type] = function (
  4735. id,
  4736. definition
  4737. ) {
  4738. if (!definition) {
  4739. return this.options[type + 's'][id]
  4740. } else {
  4741. /* istanbul ignore if */
  4742. if (type === 'component') {
  4743. validateComponentName(id);
  4744. }
  4745. if (type === 'component' && isPlainObject(definition)) {
  4746. definition.name = definition.name || id;
  4747. definition = this.options._base.extend(definition);
  4748. }
  4749. if (type === 'directive' && typeof definition === 'function') {
  4750. definition = { bind: definition, update: definition };
  4751. }
  4752. this.options[type + 's'][id] = definition;
  4753. return definition
  4754. }
  4755. };
  4756. });
  4757. }
  4758. /* */
  4759. function getComponentName (opts) {
  4760. return opts && (opts.Ctor.options.name || opts.tag)
  4761. }
  4762. function matches (pattern, name) {
  4763. if (Array.isArray(pattern)) {
  4764. return pattern.indexOf(name) > -1
  4765. } else if (typeof pattern === 'string') {
  4766. return pattern.split(',').indexOf(name) > -1
  4767. } else if (isRegExp(pattern)) {
  4768. return pattern.test(name)
  4769. }
  4770. /* istanbul ignore next */
  4771. return false
  4772. }
  4773. function pruneCache (keepAliveInstance, filter) {
  4774. var cache = keepAliveInstance.cache;
  4775. var keys = keepAliveInstance.keys;
  4776. var _vnode = keepAliveInstance._vnode;
  4777. for (var key in cache) {
  4778. var cachedNode = cache[key];
  4779. if (cachedNode) {
  4780. var name = getComponentName(cachedNode.componentOptions);
  4781. if (name && !filter(name)) {
  4782. pruneCacheEntry(cache, key, keys, _vnode);
  4783. }
  4784. }
  4785. }
  4786. }
  4787. function pruneCacheEntry (
  4788. cache,
  4789. key,
  4790. keys,
  4791. current
  4792. ) {
  4793. var cached$$1 = cache[key];
  4794. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  4795. cached$$1.componentInstance.$destroy();
  4796. }
  4797. cache[key] = null;
  4798. remove(keys, key);
  4799. }
  4800. var patternTypes = [String, RegExp, Array];
  4801. var KeepAlive = {
  4802. name: 'keep-alive',
  4803. abstract: true,
  4804. props: {
  4805. include: patternTypes,
  4806. exclude: patternTypes,
  4807. max: [String, Number]
  4808. },
  4809. created: function created () {
  4810. this.cache = Object.create(null);
  4811. this.keys = [];
  4812. },
  4813. destroyed: function destroyed () {
  4814. for (var key in this.cache) {
  4815. pruneCacheEntry(this.cache, key, this.keys);
  4816. }
  4817. },
  4818. mounted: function mounted () {
  4819. var this$1 = this;
  4820. this.$watch('include', function (val) {
  4821. pruneCache(this$1, function (name) { return matches(val, name); });
  4822. });
  4823. this.$watch('exclude', function (val) {
  4824. pruneCache(this$1, function (name) { return !matches(val, name); });
  4825. });
  4826. },
  4827. render: function render () {
  4828. var slot = this.$slots.default;
  4829. var vnode = getFirstComponentChild(slot);
  4830. var componentOptions = vnode && vnode.componentOptions;
  4831. if (componentOptions) {
  4832. // check pattern
  4833. var name = getComponentName(componentOptions);
  4834. var ref = this;
  4835. var include = ref.include;
  4836. var exclude = ref.exclude;
  4837. if (
  4838. // not included
  4839. (include && (!name || !matches(include, name))) ||
  4840. // excluded
  4841. (exclude && name && matches(exclude, name))
  4842. ) {
  4843. return vnode
  4844. }
  4845. var ref$1 = this;
  4846. var cache = ref$1.cache;
  4847. var keys = ref$1.keys;
  4848. var key = vnode.key == null
  4849. // same constructor may get registered as different local components
  4850. // so cid alone is not enough (#3269)
  4851. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  4852. : vnode.key;
  4853. if (cache[key]) {
  4854. vnode.componentInstance = cache[key].componentInstance;
  4855. // make current key freshest
  4856. remove(keys, key);
  4857. keys.push(key);
  4858. } else {
  4859. cache[key] = vnode;
  4860. keys.push(key);
  4861. // prune oldest entry
  4862. if (this.max && keys.length > parseInt(this.max)) {
  4863. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  4864. }
  4865. }
  4866. vnode.data.keepAlive = true;
  4867. }
  4868. return vnode || (slot && slot[0])
  4869. }
  4870. };
  4871. var builtInComponents = {
  4872. KeepAlive: KeepAlive
  4873. };
  4874. /* */
  4875. function initGlobalAPI (Vue) {
  4876. // config
  4877. var configDef = {};
  4878. configDef.get = function () { return config; };
  4879. {
  4880. configDef.set = function () {
  4881. warn(
  4882. 'Do not replace the Vue.config object, set individual fields instead.'
  4883. );
  4884. };
  4885. }
  4886. Object.defineProperty(Vue, 'config', configDef);
  4887. // exposed util methods.
  4888. // NOTE: these are not considered part of the public API - avoid relying on
  4889. // them unless you are aware of the risk.
  4890. Vue.util = {
  4891. warn: warn,
  4892. extend: extend,
  4893. mergeOptions: mergeOptions,
  4894. defineReactive: defineReactive$$1
  4895. };
  4896. Vue.set = set;
  4897. Vue.delete = del;
  4898. Vue.nextTick = nextTick;
  4899. // 2.6 explicit observable API
  4900. Vue.observable = function (obj) {
  4901. observe(obj);
  4902. return obj
  4903. };
  4904. Vue.options = Object.create(null);
  4905. ASSET_TYPES.forEach(function (type) {
  4906. Vue.options[type + 's'] = Object.create(null);
  4907. });
  4908. // this is used to identify the "base" constructor to extend all plain-object
  4909. // components with in Weex's multi-instance scenarios.
  4910. Vue.options._base = Vue;
  4911. extend(Vue.options.components, builtInComponents);
  4912. initUse(Vue);
  4913. initMixin$1(Vue);
  4914. initExtend(Vue);
  4915. initAssetRegisters(Vue);
  4916. }
  4917. initGlobalAPI(Vue);
  4918. Object.defineProperty(Vue.prototype, '$isServer', {
  4919. get: isServerRendering
  4920. });
  4921. Object.defineProperty(Vue.prototype, '$ssrContext', {
  4922. get: function get () {
  4923. /* istanbul ignore next */
  4924. return this.$vnode && this.$vnode.ssrContext
  4925. }
  4926. });
  4927. // expose FunctionalRenderContext for ssr runtime helper installation
  4928. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  4929. value: FunctionalRenderContext
  4930. });
  4931. Vue.version = '2.6.12';
  4932. /* */
  4933. // these are reserved for web because they are directly compiled away
  4934. // during template compilation
  4935. var isReservedAttr = makeMap('style,class');
  4936. // attributes that should be using props for binding
  4937. var acceptValue = makeMap('input,textarea,option,select,progress');
  4938. var mustUseProp = function (tag, type, attr) {
  4939. return (
  4940. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  4941. (attr === 'selected' && tag === 'option') ||
  4942. (attr === 'checked' && tag === 'input') ||
  4943. (attr === 'muted' && tag === 'video')
  4944. )
  4945. };
  4946. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  4947. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  4948. var convertEnumeratedValue = function (key, value) {
  4949. return isFalsyAttrValue(value) || value === 'false'
  4950. ? 'false'
  4951. // allow arbitrary string value for contenteditable
  4952. : key === 'contenteditable' && isValidContentEditableValue(value)
  4953. ? value
  4954. : 'true'
  4955. };
  4956. var isBooleanAttr = makeMap(
  4957. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  4958. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  4959. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  4960. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  4961. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  4962. 'truespeed,typemustmatch,visible'
  4963. );
  4964. var xlinkNS = 'http://www.w3.org/1999/xlink';
  4965. var isXlink = function (name) {
  4966. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  4967. };
  4968. var getXlinkProp = function (name) {
  4969. return isXlink(name) ? name.slice(6, name.length) : ''
  4970. };
  4971. var isFalsyAttrValue = function (val) {
  4972. return val == null || val === false
  4973. };
  4974. /* */
  4975. function genClassForVnode (vnode) {
  4976. var data = vnode.data;
  4977. var parentNode = vnode;
  4978. var childNode = vnode;
  4979. while (isDef(childNode.componentInstance)) {
  4980. childNode = childNode.componentInstance._vnode;
  4981. if (childNode && childNode.data) {
  4982. data = mergeClassData(childNode.data, data);
  4983. }
  4984. }
  4985. while (isDef(parentNode = parentNode.parent)) {
  4986. if (parentNode && parentNode.data) {
  4987. data = mergeClassData(data, parentNode.data);
  4988. }
  4989. }
  4990. return renderClass(data.staticClass, data.class)
  4991. }
  4992. function mergeClassData (child, parent) {
  4993. return {
  4994. staticClass: concat(child.staticClass, parent.staticClass),
  4995. class: isDef(child.class)
  4996. ? [child.class, parent.class]
  4997. : parent.class
  4998. }
  4999. }
  5000. function renderClass (
  5001. staticClass,
  5002. dynamicClass
  5003. ) {
  5004. if (isDef(staticClass) || isDef(dynamicClass)) {
  5005. return concat(staticClass, stringifyClass(dynamicClass))
  5006. }
  5007. /* istanbul ignore next */
  5008. return ''
  5009. }
  5010. function concat (a, b) {
  5011. return a ? b ? (a + ' ' + b) : a : (b || '')
  5012. }
  5013. function stringifyClass (value) {
  5014. if (Array.isArray(value)) {
  5015. return stringifyArray(value)
  5016. }
  5017. if (isObject(value)) {
  5018. return stringifyObject(value)
  5019. }
  5020. if (typeof value === 'string') {
  5021. return value
  5022. }
  5023. /* istanbul ignore next */
  5024. return ''
  5025. }
  5026. function stringifyArray (value) {
  5027. var res = '';
  5028. var stringified;
  5029. for (var i = 0, l = value.length; i < l; i++) {
  5030. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  5031. if (res) { res += ' '; }
  5032. res += stringified;
  5033. }
  5034. }
  5035. return res
  5036. }
  5037. function stringifyObject (value) {
  5038. var res = '';
  5039. for (var key in value) {
  5040. if (value[key]) {
  5041. if (res) { res += ' '; }
  5042. res += key;
  5043. }
  5044. }
  5045. return res
  5046. }
  5047. /* */
  5048. var namespaceMap = {
  5049. svg: 'http://www.w3.org/2000/svg',
  5050. math: 'http://www.w3.org/1998/Math/MathML'
  5051. };
  5052. var isHTMLTag = makeMap(
  5053. 'html,body,base,head,link,meta,style,title,' +
  5054. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  5055. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  5056. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  5057. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  5058. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  5059. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  5060. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  5061. 'output,progress,select,textarea,' +
  5062. 'details,dialog,menu,menuitem,summary,' +
  5063. 'content,element,shadow,template,blockquote,iframe,tfoot'
  5064. );
  5065. // this map is intentionally selective, only covering SVG elements that may
  5066. // contain child elements.
  5067. var isSVG = makeMap(
  5068. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  5069. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  5070. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  5071. true
  5072. );
  5073. var isPreTag = function (tag) { return tag === 'pre'; };
  5074. var isReservedTag = function (tag) {
  5075. return isHTMLTag(tag) || isSVG(tag)
  5076. };
  5077. function getTagNamespace (tag) {
  5078. if (isSVG(tag)) {
  5079. return 'svg'
  5080. }
  5081. // basic support for MathML
  5082. // note it doesn't support other MathML elements being component roots
  5083. if (tag === 'math') {
  5084. return 'math'
  5085. }
  5086. }
  5087. var unknownElementCache = Object.create(null);
  5088. function isUnknownElement (tag) {
  5089. /* istanbul ignore if */
  5090. if (!inBrowser) {
  5091. return true
  5092. }
  5093. if (isReservedTag(tag)) {
  5094. return false
  5095. }
  5096. tag = tag.toLowerCase();
  5097. /* istanbul ignore if */
  5098. if (unknownElementCache[tag] != null) {
  5099. return unknownElementCache[tag]
  5100. }
  5101. var el = document.createElement(tag);
  5102. if (tag.indexOf('-') > -1) {
  5103. // http://stackoverflow.com/a/28210364/1070244
  5104. return (unknownElementCache[tag] = (
  5105. el.constructor === window.HTMLUnknownElement ||
  5106. el.constructor === window.HTMLElement
  5107. ))
  5108. } else {
  5109. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  5110. }
  5111. }
  5112. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  5113. /* */
  5114. /**
  5115. * Query an element selector if it's not an element already.
  5116. */
  5117. function query (el) {
  5118. if (typeof el === 'string') {
  5119. var selected = document.querySelector(el);
  5120. if (!selected) {
  5121. warn(
  5122. 'Cannot find element: ' + el
  5123. );
  5124. return document.createElement('div')
  5125. }
  5126. return selected
  5127. } else {
  5128. return el
  5129. }
  5130. }
  5131. /* */
  5132. function createElement$1 (tagName, vnode) {
  5133. var elm = document.createElement(tagName);
  5134. if (tagName !== 'select') {
  5135. return elm
  5136. }
  5137. // false or null will remove the attribute but undefined will not
  5138. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  5139. elm.setAttribute('multiple', 'multiple');
  5140. }
  5141. return elm
  5142. }
  5143. function createElementNS (namespace, tagName) {
  5144. return document.createElementNS(namespaceMap[namespace], tagName)
  5145. }
  5146. function createTextNode (text) {
  5147. return document.createTextNode(text)
  5148. }
  5149. function createComment (text) {
  5150. return document.createComment(text)
  5151. }
  5152. function insertBefore (parentNode, newNode, referenceNode) {
  5153. parentNode.insertBefore(newNode, referenceNode);
  5154. }
  5155. function removeChild (node, child) {
  5156. node.removeChild(child);
  5157. }
  5158. function appendChild (node, child) {
  5159. node.appendChild(child);
  5160. }
  5161. function parentNode (node) {
  5162. return node.parentNode
  5163. }
  5164. function nextSibling (node) {
  5165. return node.nextSibling
  5166. }
  5167. function tagName (node) {
  5168. return node.tagName
  5169. }
  5170. function setTextContent (node, text) {
  5171. node.textContent = text;
  5172. }
  5173. function setStyleScope (node, scopeId) {
  5174. node.setAttribute(scopeId, '');
  5175. }
  5176. var nodeOps = /*#__PURE__*/Object.freeze({
  5177. createElement: createElement$1,
  5178. createElementNS: createElementNS,
  5179. createTextNode: createTextNode,
  5180. createComment: createComment,
  5181. insertBefore: insertBefore,
  5182. removeChild: removeChild,
  5183. appendChild: appendChild,
  5184. parentNode: parentNode,
  5185. nextSibling: nextSibling,
  5186. tagName: tagName,
  5187. setTextContent: setTextContent,
  5188. setStyleScope: setStyleScope
  5189. });
  5190. /* */
  5191. var ref = {
  5192. create: function create (_, vnode) {
  5193. registerRef(vnode);
  5194. },
  5195. update: function update (oldVnode, vnode) {
  5196. if (oldVnode.data.ref !== vnode.data.ref) {
  5197. registerRef(oldVnode, true);
  5198. registerRef(vnode);
  5199. }
  5200. },
  5201. destroy: function destroy (vnode) {
  5202. registerRef(vnode, true);
  5203. }
  5204. };
  5205. function registerRef (vnode, isRemoval) {
  5206. var key = vnode.data.ref;
  5207. if (!isDef(key)) { return }
  5208. var vm = vnode.context;
  5209. var ref = vnode.componentInstance || vnode.elm;
  5210. var refs = vm.$refs;
  5211. if (isRemoval) {
  5212. if (Array.isArray(refs[key])) {
  5213. remove(refs[key], ref);
  5214. } else if (refs[key] === ref) {
  5215. refs[key] = undefined;
  5216. }
  5217. } else {
  5218. if (vnode.data.refInFor) {
  5219. if (!Array.isArray(refs[key])) {
  5220. refs[key] = [ref];
  5221. } else if (refs[key].indexOf(ref) < 0) {
  5222. // $flow-disable-line
  5223. refs[key].push(ref);
  5224. }
  5225. } else {
  5226. refs[key] = ref;
  5227. }
  5228. }
  5229. }
  5230. /**
  5231. * Virtual DOM patching algorithm based on Snabbdom by
  5232. * Simon Friis Vindum (@paldepind)
  5233. * Licensed under the MIT License
  5234. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  5235. *
  5236. * modified by Evan You (@yyx990803)
  5237. *
  5238. * Not type-checking this because this file is perf-critical and the cost
  5239. * of making flow understand it is not worth it.
  5240. */
  5241. var emptyNode = new VNode('', {}, []);
  5242. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  5243. function sameVnode (a, b) {
  5244. return (
  5245. a.key === b.key && (
  5246. (
  5247. a.tag === b.tag &&
  5248. a.isComment === b.isComment &&
  5249. isDef(a.data) === isDef(b.data) &&
  5250. sameInputType(a, b)
  5251. ) || (
  5252. isTrue(a.isAsyncPlaceholder) &&
  5253. a.asyncFactory === b.asyncFactory &&
  5254. isUndef(b.asyncFactory.error)
  5255. )
  5256. )
  5257. )
  5258. }
  5259. function sameInputType (a, b) {
  5260. if (a.tag !== 'input') { return true }
  5261. var i;
  5262. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  5263. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  5264. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  5265. }
  5266. function createKeyToOldIdx (children, beginIdx, endIdx) {
  5267. var i, key;
  5268. var map = {};
  5269. for (i = beginIdx; i <= endIdx; ++i) {
  5270. key = children[i].key;
  5271. if (isDef(key)) { map[key] = i; }
  5272. }
  5273. return map
  5274. }
  5275. function createPatchFunction (backend) {
  5276. var i, j;
  5277. var cbs = {};
  5278. var modules = backend.modules;
  5279. var nodeOps = backend.nodeOps;
  5280. for (i = 0; i < hooks.length; ++i) {
  5281. cbs[hooks[i]] = [];
  5282. for (j = 0; j < modules.length; ++j) {
  5283. if (isDef(modules[j][hooks[i]])) {
  5284. cbs[hooks[i]].push(modules[j][hooks[i]]);
  5285. }
  5286. }
  5287. }
  5288. function emptyNodeAt (elm) {
  5289. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  5290. }
  5291. function createRmCb (childElm, listeners) {
  5292. function remove$$1 () {
  5293. if (--remove$$1.listeners === 0) {
  5294. removeNode(childElm);
  5295. }
  5296. }
  5297. remove$$1.listeners = listeners;
  5298. return remove$$1
  5299. }
  5300. function removeNode (el) {
  5301. var parent = nodeOps.parentNode(el);
  5302. // element may have already been removed due to v-html / v-text
  5303. if (isDef(parent)) {
  5304. nodeOps.removeChild(parent, el);
  5305. }
  5306. }
  5307. function isUnknownElement$$1 (vnode, inVPre) {
  5308. return (
  5309. !inVPre &&
  5310. !vnode.ns &&
  5311. !(
  5312. config.ignoredElements.length &&
  5313. config.ignoredElements.some(function (ignore) {
  5314. return isRegExp(ignore)
  5315. ? ignore.test(vnode.tag)
  5316. : ignore === vnode.tag
  5317. })
  5318. ) &&
  5319. config.isUnknownElement(vnode.tag)
  5320. )
  5321. }
  5322. var creatingElmInVPre = 0;
  5323. function createElm (
  5324. vnode,
  5325. insertedVnodeQueue,
  5326. parentElm,
  5327. refElm,
  5328. nested,
  5329. ownerArray,
  5330. index
  5331. ) {
  5332. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5333. // This vnode was used in a previous render!
  5334. // now it's used as a new node, overwriting its elm would cause
  5335. // potential patch errors down the road when it's used as an insertion
  5336. // reference node. Instead, we clone the node on-demand before creating
  5337. // associated DOM element for it.
  5338. vnode = ownerArray[index] = cloneVNode(vnode);
  5339. }
  5340. vnode.isRootInsert = !nested; // for transition enter check
  5341. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  5342. return
  5343. }
  5344. var data = vnode.data;
  5345. var children = vnode.children;
  5346. var tag = vnode.tag;
  5347. if (isDef(tag)) {
  5348. {
  5349. if (data && data.pre) {
  5350. creatingElmInVPre++;
  5351. }
  5352. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  5353. warn(
  5354. 'Unknown custom element: <' + tag + '> - did you ' +
  5355. 'register the component correctly? For recursive components, ' +
  5356. 'make sure to provide the "name" option.',
  5357. vnode.context
  5358. );
  5359. }
  5360. }
  5361. vnode.elm = vnode.ns
  5362. ? nodeOps.createElementNS(vnode.ns, tag)
  5363. : nodeOps.createElement(tag, vnode);
  5364. setScope(vnode);
  5365. /* istanbul ignore if */
  5366. {
  5367. createChildren(vnode, children, insertedVnodeQueue);
  5368. if (isDef(data)) {
  5369. invokeCreateHooks(vnode, insertedVnodeQueue);
  5370. }
  5371. insert(parentElm, vnode.elm, refElm);
  5372. }
  5373. if (data && data.pre) {
  5374. creatingElmInVPre--;
  5375. }
  5376. } else if (isTrue(vnode.isComment)) {
  5377. vnode.elm = nodeOps.createComment(vnode.text);
  5378. insert(parentElm, vnode.elm, refElm);
  5379. } else {
  5380. vnode.elm = nodeOps.createTextNode(vnode.text);
  5381. insert(parentElm, vnode.elm, refElm);
  5382. }
  5383. }
  5384. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5385. var i = vnode.data;
  5386. if (isDef(i)) {
  5387. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  5388. if (isDef(i = i.hook) && isDef(i = i.init)) {
  5389. i(vnode, false /* hydrating */);
  5390. }
  5391. // after calling the init hook, if the vnode is a child component
  5392. // it should've created a child instance and mounted it. the child
  5393. // component also has set the placeholder vnode's elm.
  5394. // in that case we can just return the element and be done.
  5395. if (isDef(vnode.componentInstance)) {
  5396. initComponent(vnode, insertedVnodeQueue);
  5397. insert(parentElm, vnode.elm, refElm);
  5398. if (isTrue(isReactivated)) {
  5399. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  5400. }
  5401. return true
  5402. }
  5403. }
  5404. }
  5405. function initComponent (vnode, insertedVnodeQueue) {
  5406. if (isDef(vnode.data.pendingInsert)) {
  5407. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  5408. vnode.data.pendingInsert = null;
  5409. }
  5410. vnode.elm = vnode.componentInstance.$el;
  5411. if (isPatchable(vnode)) {
  5412. invokeCreateHooks(vnode, insertedVnodeQueue);
  5413. setScope(vnode);
  5414. } else {
  5415. // empty component root.
  5416. // skip all element-related modules except for ref (#3455)
  5417. registerRef(vnode);
  5418. // make sure to invoke the insert hook
  5419. insertedVnodeQueue.push(vnode);
  5420. }
  5421. }
  5422. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5423. var i;
  5424. // hack for #4339: a reactivated component with inner transition
  5425. // does not trigger because the inner node's created hooks are not called
  5426. // again. It's not ideal to involve module-specific logic in here but
  5427. // there doesn't seem to be a better way to do it.
  5428. var innerNode = vnode;
  5429. while (innerNode.componentInstance) {
  5430. innerNode = innerNode.componentInstance._vnode;
  5431. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  5432. for (i = 0; i < cbs.activate.length; ++i) {
  5433. cbs.activate[i](emptyNode, innerNode);
  5434. }
  5435. insertedVnodeQueue.push(innerNode);
  5436. break
  5437. }
  5438. }
  5439. // unlike a newly created component,
  5440. // a reactivated keep-alive component doesn't insert itself
  5441. insert(parentElm, vnode.elm, refElm);
  5442. }
  5443. function insert (parent, elm, ref$$1) {
  5444. if (isDef(parent)) {
  5445. if (isDef(ref$$1)) {
  5446. if (nodeOps.parentNode(ref$$1) === parent) {
  5447. nodeOps.insertBefore(parent, elm, ref$$1);
  5448. }
  5449. } else {
  5450. nodeOps.appendChild(parent, elm);
  5451. }
  5452. }
  5453. }
  5454. function createChildren (vnode, children, insertedVnodeQueue) {
  5455. if (Array.isArray(children)) {
  5456. {
  5457. checkDuplicateKeys(children);
  5458. }
  5459. for (var i = 0; i < children.length; ++i) {
  5460. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  5461. }
  5462. } else if (isPrimitive(vnode.text)) {
  5463. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  5464. }
  5465. }
  5466. function isPatchable (vnode) {
  5467. while (vnode.componentInstance) {
  5468. vnode = vnode.componentInstance._vnode;
  5469. }
  5470. return isDef(vnode.tag)
  5471. }
  5472. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  5473. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5474. cbs.create[i$1](emptyNode, vnode);
  5475. }
  5476. i = vnode.data.hook; // Reuse variable
  5477. if (isDef(i)) {
  5478. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  5479. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  5480. }
  5481. }
  5482. // set scope id attribute for scoped CSS.
  5483. // this is implemented as a special case to avoid the overhead
  5484. // of going through the normal attribute patching process.
  5485. function setScope (vnode) {
  5486. var i;
  5487. if (isDef(i = vnode.fnScopeId)) {
  5488. nodeOps.setStyleScope(vnode.elm, i);
  5489. } else {
  5490. var ancestor = vnode;
  5491. while (ancestor) {
  5492. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  5493. nodeOps.setStyleScope(vnode.elm, i);
  5494. }
  5495. ancestor = ancestor.parent;
  5496. }
  5497. }
  5498. // for slot content they should also get the scopeId from the host instance.
  5499. if (isDef(i = activeInstance) &&
  5500. i !== vnode.context &&
  5501. i !== vnode.fnContext &&
  5502. isDef(i = i.$options._scopeId)
  5503. ) {
  5504. nodeOps.setStyleScope(vnode.elm, i);
  5505. }
  5506. }
  5507. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  5508. for (; startIdx <= endIdx; ++startIdx) {
  5509. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  5510. }
  5511. }
  5512. function invokeDestroyHook (vnode) {
  5513. var i, j;
  5514. var data = vnode.data;
  5515. if (isDef(data)) {
  5516. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  5517. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  5518. }
  5519. if (isDef(i = vnode.children)) {
  5520. for (j = 0; j < vnode.children.length; ++j) {
  5521. invokeDestroyHook(vnode.children[j]);
  5522. }
  5523. }
  5524. }
  5525. function removeVnodes (vnodes, startIdx, endIdx) {
  5526. for (; startIdx <= endIdx; ++startIdx) {
  5527. var ch = vnodes[startIdx];
  5528. if (isDef(ch)) {
  5529. if (isDef(ch.tag)) {
  5530. removeAndInvokeRemoveHook(ch);
  5531. invokeDestroyHook(ch);
  5532. } else { // Text node
  5533. removeNode(ch.elm);
  5534. }
  5535. }
  5536. }
  5537. }
  5538. function removeAndInvokeRemoveHook (vnode, rm) {
  5539. if (isDef(rm) || isDef(vnode.data)) {
  5540. var i;
  5541. var listeners = cbs.remove.length + 1;
  5542. if (isDef(rm)) {
  5543. // we have a recursively passed down rm callback
  5544. // increase the listeners count
  5545. rm.listeners += listeners;
  5546. } else {
  5547. // directly removing
  5548. rm = createRmCb(vnode.elm, listeners);
  5549. }
  5550. // recursively invoke hooks on child component root node
  5551. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  5552. removeAndInvokeRemoveHook(i, rm);
  5553. }
  5554. for (i = 0; i < cbs.remove.length; ++i) {
  5555. cbs.remove[i](vnode, rm);
  5556. }
  5557. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  5558. i(vnode, rm);
  5559. } else {
  5560. rm();
  5561. }
  5562. } else {
  5563. removeNode(vnode.elm);
  5564. }
  5565. }
  5566. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  5567. var oldStartIdx = 0;
  5568. var newStartIdx = 0;
  5569. var oldEndIdx = oldCh.length - 1;
  5570. var oldStartVnode = oldCh[0];
  5571. var oldEndVnode = oldCh[oldEndIdx];
  5572. var newEndIdx = newCh.length - 1;
  5573. var newStartVnode = newCh[0];
  5574. var newEndVnode = newCh[newEndIdx];
  5575. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  5576. // removeOnly is a special flag used only by <transition-group>
  5577. // to ensure removed elements stay in correct relative positions
  5578. // during leaving transitions
  5579. var canMove = !removeOnly;
  5580. {
  5581. checkDuplicateKeys(newCh);
  5582. }
  5583. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  5584. if (isUndef(oldStartVnode)) {
  5585. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  5586. } else if (isUndef(oldEndVnode)) {
  5587. oldEndVnode = oldCh[--oldEndIdx];
  5588. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  5589. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5590. oldStartVnode = oldCh[++oldStartIdx];
  5591. newStartVnode = newCh[++newStartIdx];
  5592. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  5593. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5594. oldEndVnode = oldCh[--oldEndIdx];
  5595. newEndVnode = newCh[--newEndIdx];
  5596. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  5597. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5598. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  5599. oldStartVnode = oldCh[++oldStartIdx];
  5600. newEndVnode = newCh[--newEndIdx];
  5601. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  5602. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5603. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  5604. oldEndVnode = oldCh[--oldEndIdx];
  5605. newStartVnode = newCh[++newStartIdx];
  5606. } else {
  5607. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  5608. idxInOld = isDef(newStartVnode.key)
  5609. ? oldKeyToIdx[newStartVnode.key]
  5610. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  5611. if (isUndef(idxInOld)) { // New element
  5612. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5613. } else {
  5614. vnodeToMove = oldCh[idxInOld];
  5615. if (sameVnode(vnodeToMove, newStartVnode)) {
  5616. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5617. oldCh[idxInOld] = undefined;
  5618. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  5619. } else {
  5620. // same key but different element. treat as new element
  5621. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5622. }
  5623. }
  5624. newStartVnode = newCh[++newStartIdx];
  5625. }
  5626. }
  5627. if (oldStartIdx > oldEndIdx) {
  5628. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  5629. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  5630. } else if (newStartIdx > newEndIdx) {
  5631. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  5632. }
  5633. }
  5634. function checkDuplicateKeys (children) {
  5635. var seenKeys = {};
  5636. for (var i = 0; i < children.length; i++) {
  5637. var vnode = children[i];
  5638. var key = vnode.key;
  5639. if (isDef(key)) {
  5640. if (seenKeys[key]) {
  5641. warn(
  5642. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  5643. vnode.context
  5644. );
  5645. } else {
  5646. seenKeys[key] = true;
  5647. }
  5648. }
  5649. }
  5650. }
  5651. function findIdxInOld (node, oldCh, start, end) {
  5652. for (var i = start; i < end; i++) {
  5653. var c = oldCh[i];
  5654. if (isDef(c) && sameVnode(node, c)) { return i }
  5655. }
  5656. }
  5657. function patchVnode (
  5658. oldVnode,
  5659. vnode,
  5660. insertedVnodeQueue,
  5661. ownerArray,
  5662. index,
  5663. removeOnly
  5664. ) {
  5665. if (oldVnode === vnode) {
  5666. return
  5667. }
  5668. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5669. // clone reused vnode
  5670. vnode = ownerArray[index] = cloneVNode(vnode);
  5671. }
  5672. var elm = vnode.elm = oldVnode.elm;
  5673. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  5674. if (isDef(vnode.asyncFactory.resolved)) {
  5675. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  5676. } else {
  5677. vnode.isAsyncPlaceholder = true;
  5678. }
  5679. return
  5680. }
  5681. // reuse element for static trees.
  5682. // note we only do this if the vnode is cloned -
  5683. // if the new node is not cloned it means the render functions have been
  5684. // reset by the hot-reload-api and we need to do a proper re-render.
  5685. if (isTrue(vnode.isStatic) &&
  5686. isTrue(oldVnode.isStatic) &&
  5687. vnode.key === oldVnode.key &&
  5688. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  5689. ) {
  5690. vnode.componentInstance = oldVnode.componentInstance;
  5691. return
  5692. }
  5693. var i;
  5694. var data = vnode.data;
  5695. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  5696. i(oldVnode, vnode);
  5697. }
  5698. var oldCh = oldVnode.children;
  5699. var ch = vnode.children;
  5700. if (isDef(data) && isPatchable(vnode)) {
  5701. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  5702. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  5703. }
  5704. if (isUndef(vnode.text)) {
  5705. if (isDef(oldCh) && isDef(ch)) {
  5706. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  5707. } else if (isDef(ch)) {
  5708. {
  5709. checkDuplicateKeys(ch);
  5710. }
  5711. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  5712. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  5713. } else if (isDef(oldCh)) {
  5714. removeVnodes(oldCh, 0, oldCh.length - 1);
  5715. } else if (isDef(oldVnode.text)) {
  5716. nodeOps.setTextContent(elm, '');
  5717. }
  5718. } else if (oldVnode.text !== vnode.text) {
  5719. nodeOps.setTextContent(elm, vnode.text);
  5720. }
  5721. if (isDef(data)) {
  5722. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  5723. }
  5724. }
  5725. function invokeInsertHook (vnode, queue, initial) {
  5726. // delay insert hooks for component root nodes, invoke them after the
  5727. // element is really inserted
  5728. if (isTrue(initial) && isDef(vnode.parent)) {
  5729. vnode.parent.data.pendingInsert = queue;
  5730. } else {
  5731. for (var i = 0; i < queue.length; ++i) {
  5732. queue[i].data.hook.insert(queue[i]);
  5733. }
  5734. }
  5735. }
  5736. var hydrationBailed = false;
  5737. // list of modules that can skip create hook during hydration because they
  5738. // are already rendered on the client or has no need for initialization
  5739. // Note: style is excluded because it relies on initial clone for future
  5740. // deep updates (#7063).
  5741. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  5742. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  5743. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  5744. var i;
  5745. var tag = vnode.tag;
  5746. var data = vnode.data;
  5747. var children = vnode.children;
  5748. inVPre = inVPre || (data && data.pre);
  5749. vnode.elm = elm;
  5750. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  5751. vnode.isAsyncPlaceholder = true;
  5752. return true
  5753. }
  5754. // assert node match
  5755. {
  5756. if (!assertNodeMatch(elm, vnode, inVPre)) {
  5757. return false
  5758. }
  5759. }
  5760. if (isDef(data)) {
  5761. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  5762. if (isDef(i = vnode.componentInstance)) {
  5763. // child component. it should have hydrated its own tree.
  5764. initComponent(vnode, insertedVnodeQueue);
  5765. return true
  5766. }
  5767. }
  5768. if (isDef(tag)) {
  5769. if (isDef(children)) {
  5770. // empty element, allow client to pick up and populate children
  5771. if (!elm.hasChildNodes()) {
  5772. createChildren(vnode, children, insertedVnodeQueue);
  5773. } else {
  5774. // v-html and domProps: innerHTML
  5775. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  5776. if (i !== elm.innerHTML) {
  5777. /* istanbul ignore if */
  5778. if (typeof console !== 'undefined' &&
  5779. !hydrationBailed
  5780. ) {
  5781. hydrationBailed = true;
  5782. console.warn('Parent: ', elm);
  5783. console.warn('server innerHTML: ', i);
  5784. console.warn('client innerHTML: ', elm.innerHTML);
  5785. }
  5786. return false
  5787. }
  5788. } else {
  5789. // iterate and compare children lists
  5790. var childrenMatch = true;
  5791. var childNode = elm.firstChild;
  5792. for (var i$1 = 0; i$1 < children.length; i$1++) {
  5793. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  5794. childrenMatch = false;
  5795. break
  5796. }
  5797. childNode = childNode.nextSibling;
  5798. }
  5799. // if childNode is not null, it means the actual childNodes list is
  5800. // longer than the virtual children list.
  5801. if (!childrenMatch || childNode) {
  5802. /* istanbul ignore if */
  5803. if (typeof console !== 'undefined' &&
  5804. !hydrationBailed
  5805. ) {
  5806. hydrationBailed = true;
  5807. console.warn('Parent: ', elm);
  5808. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  5809. }
  5810. return false
  5811. }
  5812. }
  5813. }
  5814. }
  5815. if (isDef(data)) {
  5816. var fullInvoke = false;
  5817. for (var key in data) {
  5818. if (!isRenderedModule(key)) {
  5819. fullInvoke = true;
  5820. invokeCreateHooks(vnode, insertedVnodeQueue);
  5821. break
  5822. }
  5823. }
  5824. if (!fullInvoke && data['class']) {
  5825. // ensure collecting deps for deep class bindings for future updates
  5826. traverse(data['class']);
  5827. }
  5828. }
  5829. } else if (elm.data !== vnode.text) {
  5830. elm.data = vnode.text;
  5831. }
  5832. return true
  5833. }
  5834. function assertNodeMatch (node, vnode, inVPre) {
  5835. if (isDef(vnode.tag)) {
  5836. return vnode.tag.indexOf('vue-component') === 0 || (
  5837. !isUnknownElement$$1(vnode, inVPre) &&
  5838. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  5839. )
  5840. } else {
  5841. return node.nodeType === (vnode.isComment ? 8 : 3)
  5842. }
  5843. }
  5844. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  5845. if (isUndef(vnode)) {
  5846. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  5847. return
  5848. }
  5849. var isInitialPatch = false;
  5850. var insertedVnodeQueue = [];
  5851. if (isUndef(oldVnode)) {
  5852. // empty mount (likely as component), create new root element
  5853. isInitialPatch = true;
  5854. createElm(vnode, insertedVnodeQueue);
  5855. } else {
  5856. var isRealElement = isDef(oldVnode.nodeType);
  5857. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  5858. // patch existing root node
  5859. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  5860. } else {
  5861. if (isRealElement) {
  5862. // mounting to a real element
  5863. // check if this is server-rendered content and if we can perform
  5864. // a successful hydration.
  5865. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  5866. oldVnode.removeAttribute(SSR_ATTR);
  5867. hydrating = true;
  5868. }
  5869. if (isTrue(hydrating)) {
  5870. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  5871. invokeInsertHook(vnode, insertedVnodeQueue, true);
  5872. return oldVnode
  5873. } else {
  5874. warn(
  5875. 'The client-side rendered virtual DOM tree is not matching ' +
  5876. 'server-rendered content. This is likely caused by incorrect ' +
  5877. 'HTML markup, for example nesting block-level elements inside ' +
  5878. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  5879. 'full client-side render.'
  5880. );
  5881. }
  5882. }
  5883. // either not server-rendered, or hydration failed.
  5884. // create an empty node and replace it
  5885. oldVnode = emptyNodeAt(oldVnode);
  5886. }
  5887. // replacing existing element
  5888. var oldElm = oldVnode.elm;
  5889. var parentElm = nodeOps.parentNode(oldElm);
  5890. // create new node
  5891. createElm(
  5892. vnode,
  5893. insertedVnodeQueue,
  5894. // extremely rare edge case: do not insert if old element is in a
  5895. // leaving transition. Only happens when combining transition +
  5896. // keep-alive + HOCs. (#4590)
  5897. oldElm._leaveCb ? null : parentElm,
  5898. nodeOps.nextSibling(oldElm)
  5899. );
  5900. // update parent placeholder node element, recursively
  5901. if (isDef(vnode.parent)) {
  5902. var ancestor = vnode.parent;
  5903. var patchable = isPatchable(vnode);
  5904. while (ancestor) {
  5905. for (var i = 0; i < cbs.destroy.length; ++i) {
  5906. cbs.destroy[i](ancestor);
  5907. }
  5908. ancestor.elm = vnode.elm;
  5909. if (patchable) {
  5910. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5911. cbs.create[i$1](emptyNode, ancestor);
  5912. }
  5913. // #6513
  5914. // invoke insert hooks that may have been merged by create hooks.
  5915. // e.g. for directives that uses the "inserted" hook.
  5916. var insert = ancestor.data.hook.insert;
  5917. if (insert.merged) {
  5918. // start at index 1 to avoid re-invoking component mounted hook
  5919. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  5920. insert.fns[i$2]();
  5921. }
  5922. }
  5923. } else {
  5924. registerRef(ancestor);
  5925. }
  5926. ancestor = ancestor.parent;
  5927. }
  5928. }
  5929. // destroy old node
  5930. if (isDef(parentElm)) {
  5931. removeVnodes([oldVnode], 0, 0);
  5932. } else if (isDef(oldVnode.tag)) {
  5933. invokeDestroyHook(oldVnode);
  5934. }
  5935. }
  5936. }
  5937. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  5938. return vnode.elm
  5939. }
  5940. }
  5941. /* */
  5942. var directives = {
  5943. create: updateDirectives,
  5944. update: updateDirectives,
  5945. destroy: function unbindDirectives (vnode) {
  5946. updateDirectives(vnode, emptyNode);
  5947. }
  5948. };
  5949. function updateDirectives (oldVnode, vnode) {
  5950. if (oldVnode.data.directives || vnode.data.directives) {
  5951. _update(oldVnode, vnode);
  5952. }
  5953. }
  5954. function _update (oldVnode, vnode) {
  5955. var isCreate = oldVnode === emptyNode;
  5956. var isDestroy = vnode === emptyNode;
  5957. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  5958. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  5959. var dirsWithInsert = [];
  5960. var dirsWithPostpatch = [];
  5961. var key, oldDir, dir;
  5962. for (key in newDirs) {
  5963. oldDir = oldDirs[key];
  5964. dir = newDirs[key];
  5965. if (!oldDir) {
  5966. // new directive, bind
  5967. callHook$1(dir, 'bind', vnode, oldVnode);
  5968. if (dir.def && dir.def.inserted) {
  5969. dirsWithInsert.push(dir);
  5970. }
  5971. } else {
  5972. // existing directive, update
  5973. dir.oldValue = oldDir.value;
  5974. dir.oldArg = oldDir.arg;
  5975. callHook$1(dir, 'update', vnode, oldVnode);
  5976. if (dir.def && dir.def.componentUpdated) {
  5977. dirsWithPostpatch.push(dir);
  5978. }
  5979. }
  5980. }
  5981. if (dirsWithInsert.length) {
  5982. var callInsert = function () {
  5983. for (var i = 0; i < dirsWithInsert.length; i++) {
  5984. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  5985. }
  5986. };
  5987. if (isCreate) {
  5988. mergeVNodeHook(vnode, 'insert', callInsert);
  5989. } else {
  5990. callInsert();
  5991. }
  5992. }
  5993. if (dirsWithPostpatch.length) {
  5994. mergeVNodeHook(vnode, 'postpatch', function () {
  5995. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  5996. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  5997. }
  5998. });
  5999. }
  6000. if (!isCreate) {
  6001. for (key in oldDirs) {
  6002. if (!newDirs[key]) {
  6003. // no longer present, unbind
  6004. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  6005. }
  6006. }
  6007. }
  6008. }
  6009. var emptyModifiers = Object.create(null);
  6010. function normalizeDirectives$1 (
  6011. dirs,
  6012. vm
  6013. ) {
  6014. var res = Object.create(null);
  6015. if (!dirs) {
  6016. // $flow-disable-line
  6017. return res
  6018. }
  6019. var i, dir;
  6020. for (i = 0; i < dirs.length; i++) {
  6021. dir = dirs[i];
  6022. if (!dir.modifiers) {
  6023. // $flow-disable-line
  6024. dir.modifiers = emptyModifiers;
  6025. }
  6026. res[getRawDirName(dir)] = dir;
  6027. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  6028. }
  6029. // $flow-disable-line
  6030. return res
  6031. }
  6032. function getRawDirName (dir) {
  6033. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  6034. }
  6035. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  6036. var fn = dir.def && dir.def[hook];
  6037. if (fn) {
  6038. try {
  6039. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  6040. } catch (e) {
  6041. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  6042. }
  6043. }
  6044. }
  6045. var baseModules = [
  6046. ref,
  6047. directives
  6048. ];
  6049. /* */
  6050. function updateAttrs (oldVnode, vnode) {
  6051. var opts = vnode.componentOptions;
  6052. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  6053. return
  6054. }
  6055. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  6056. return
  6057. }
  6058. var key, cur, old;
  6059. var elm = vnode.elm;
  6060. var oldAttrs = oldVnode.data.attrs || {};
  6061. var attrs = vnode.data.attrs || {};
  6062. // clone observed objects, as the user probably wants to mutate it
  6063. if (isDef(attrs.__ob__)) {
  6064. attrs = vnode.data.attrs = extend({}, attrs);
  6065. }
  6066. for (key in attrs) {
  6067. cur = attrs[key];
  6068. old = oldAttrs[key];
  6069. if (old !== cur) {
  6070. setAttr(elm, key, cur);
  6071. }
  6072. }
  6073. // #4391: in IE9, setting type can reset value for input[type=radio]
  6074. // #6666: IE/Edge forces progress value down to 1 before setting a max
  6075. /* istanbul ignore if */
  6076. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  6077. setAttr(elm, 'value', attrs.value);
  6078. }
  6079. for (key in oldAttrs) {
  6080. if (isUndef(attrs[key])) {
  6081. if (isXlink(key)) {
  6082. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6083. } else if (!isEnumeratedAttr(key)) {
  6084. elm.removeAttribute(key);
  6085. }
  6086. }
  6087. }
  6088. }
  6089. function setAttr (el, key, value) {
  6090. if (el.tagName.indexOf('-') > -1) {
  6091. baseSetAttr(el, key, value);
  6092. } else if (isBooleanAttr(key)) {
  6093. // set attribute for blank value
  6094. // e.g. <option disabled>Select one</option>
  6095. if (isFalsyAttrValue(value)) {
  6096. el.removeAttribute(key);
  6097. } else {
  6098. // technically allowfullscreen is a boolean attribute for <iframe>,
  6099. // but Flash expects a value of "true" when used on <embed> tag
  6100. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  6101. ? 'true'
  6102. : key;
  6103. el.setAttribute(key, value);
  6104. }
  6105. } else if (isEnumeratedAttr(key)) {
  6106. el.setAttribute(key, convertEnumeratedValue(key, value));
  6107. } else if (isXlink(key)) {
  6108. if (isFalsyAttrValue(value)) {
  6109. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6110. } else {
  6111. el.setAttributeNS(xlinkNS, key, value);
  6112. }
  6113. } else {
  6114. baseSetAttr(el, key, value);
  6115. }
  6116. }
  6117. function baseSetAttr (el, key, value) {
  6118. if (isFalsyAttrValue(value)) {
  6119. el.removeAttribute(key);
  6120. } else {
  6121. // #7138: IE10 & 11 fires input event when setting placeholder on
  6122. // <textarea>... block the first input event and remove the blocker
  6123. // immediately.
  6124. /* istanbul ignore if */
  6125. if (
  6126. isIE && !isIE9 &&
  6127. el.tagName === 'TEXTAREA' &&
  6128. key === 'placeholder' && value !== '' && !el.__ieph
  6129. ) {
  6130. var blocker = function (e) {
  6131. e.stopImmediatePropagation();
  6132. el.removeEventListener('input', blocker);
  6133. };
  6134. el.addEventListener('input', blocker);
  6135. // $flow-disable-line
  6136. el.__ieph = true; /* IE placeholder patched */
  6137. }
  6138. el.setAttribute(key, value);
  6139. }
  6140. }
  6141. var attrs = {
  6142. create: updateAttrs,
  6143. update: updateAttrs
  6144. };
  6145. /* */
  6146. function updateClass (oldVnode, vnode) {
  6147. var el = vnode.elm;
  6148. var data = vnode.data;
  6149. var oldData = oldVnode.data;
  6150. if (
  6151. isUndef(data.staticClass) &&
  6152. isUndef(data.class) && (
  6153. isUndef(oldData) || (
  6154. isUndef(oldData.staticClass) &&
  6155. isUndef(oldData.class)
  6156. )
  6157. )
  6158. ) {
  6159. return
  6160. }
  6161. var cls = genClassForVnode(vnode);
  6162. // handle transition classes
  6163. var transitionClass = el._transitionClasses;
  6164. if (isDef(transitionClass)) {
  6165. cls = concat(cls, stringifyClass(transitionClass));
  6166. }
  6167. // set the class
  6168. if (cls !== el._prevClass) {
  6169. el.setAttribute('class', cls);
  6170. el._prevClass = cls;
  6171. }
  6172. }
  6173. var klass = {
  6174. create: updateClass,
  6175. update: updateClass
  6176. };
  6177. /* */
  6178. var validDivisionCharRE = /[\w).+\-_$\]]/;
  6179. function parseFilters (exp) {
  6180. var inSingle = false;
  6181. var inDouble = false;
  6182. var inTemplateString = false;
  6183. var inRegex = false;
  6184. var curly = 0;
  6185. var square = 0;
  6186. var paren = 0;
  6187. var lastFilterIndex = 0;
  6188. var c, prev, i, expression, filters;
  6189. for (i = 0; i < exp.length; i++) {
  6190. prev = c;
  6191. c = exp.charCodeAt(i);
  6192. if (inSingle) {
  6193. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  6194. } else if (inDouble) {
  6195. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  6196. } else if (inTemplateString) {
  6197. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  6198. } else if (inRegex) {
  6199. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  6200. } else if (
  6201. c === 0x7C && // pipe
  6202. exp.charCodeAt(i + 1) !== 0x7C &&
  6203. exp.charCodeAt(i - 1) !== 0x7C &&
  6204. !curly && !square && !paren
  6205. ) {
  6206. if (expression === undefined) {
  6207. // first filter, end of expression
  6208. lastFilterIndex = i + 1;
  6209. expression = exp.slice(0, i).trim();
  6210. } else {
  6211. pushFilter();
  6212. }
  6213. } else {
  6214. switch (c) {
  6215. case 0x22: inDouble = true; break // "
  6216. case 0x27: inSingle = true; break // '
  6217. case 0x60: inTemplateString = true; break // `
  6218. case 0x28: paren++; break // (
  6219. case 0x29: paren--; break // )
  6220. case 0x5B: square++; break // [
  6221. case 0x5D: square--; break // ]
  6222. case 0x7B: curly++; break // {
  6223. case 0x7D: curly--; break // }
  6224. }
  6225. if (c === 0x2f) { // /
  6226. var j = i - 1;
  6227. var p = (void 0);
  6228. // find first non-whitespace prev char
  6229. for (; j >= 0; j--) {
  6230. p = exp.charAt(j);
  6231. if (p !== ' ') { break }
  6232. }
  6233. if (!p || !validDivisionCharRE.test(p)) {
  6234. inRegex = true;
  6235. }
  6236. }
  6237. }
  6238. }
  6239. if (expression === undefined) {
  6240. expression = exp.slice(0, i).trim();
  6241. } else if (lastFilterIndex !== 0) {
  6242. pushFilter();
  6243. }
  6244. function pushFilter () {
  6245. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  6246. lastFilterIndex = i + 1;
  6247. }
  6248. if (filters) {
  6249. for (i = 0; i < filters.length; i++) {
  6250. expression = wrapFilter(expression, filters[i]);
  6251. }
  6252. }
  6253. return expression
  6254. }
  6255. function wrapFilter (exp, filter) {
  6256. var i = filter.indexOf('(');
  6257. if (i < 0) {
  6258. // _f: resolveFilter
  6259. return ("_f(\"" + filter + "\")(" + exp + ")")
  6260. } else {
  6261. var name = filter.slice(0, i);
  6262. var args = filter.slice(i + 1);
  6263. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  6264. }
  6265. }
  6266. /* */
  6267. /* eslint-disable no-unused-vars */
  6268. function baseWarn (msg, range) {
  6269. console.error(("[Vue compiler]: " + msg));
  6270. }
  6271. /* eslint-enable no-unused-vars */
  6272. function pluckModuleFunction (
  6273. modules,
  6274. key
  6275. ) {
  6276. return modules
  6277. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  6278. : []
  6279. }
  6280. function addProp (el, name, value, range, dynamic) {
  6281. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  6282. el.plain = false;
  6283. }
  6284. function addAttr (el, name, value, range, dynamic) {
  6285. var attrs = dynamic
  6286. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  6287. : (el.attrs || (el.attrs = []));
  6288. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  6289. el.plain = false;
  6290. }
  6291. // add a raw attr (use this in preTransforms)
  6292. function addRawAttr (el, name, value, range) {
  6293. el.attrsMap[name] = value;
  6294. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  6295. }
  6296. function addDirective (
  6297. el,
  6298. name,
  6299. rawName,
  6300. value,
  6301. arg,
  6302. isDynamicArg,
  6303. modifiers,
  6304. range
  6305. ) {
  6306. (el.directives || (el.directives = [])).push(rangeSetItem({
  6307. name: name,
  6308. rawName: rawName,
  6309. value: value,
  6310. arg: arg,
  6311. isDynamicArg: isDynamicArg,
  6312. modifiers: modifiers
  6313. }, range));
  6314. el.plain = false;
  6315. }
  6316. function prependModifierMarker (symbol, name, dynamic) {
  6317. return dynamic
  6318. ? ("_p(" + name + ",\"" + symbol + "\")")
  6319. : symbol + name // mark the event as captured
  6320. }
  6321. function addHandler (
  6322. el,
  6323. name,
  6324. value,
  6325. modifiers,
  6326. important,
  6327. warn,
  6328. range,
  6329. dynamic
  6330. ) {
  6331. modifiers = modifiers || emptyObject;
  6332. // warn prevent and passive modifier
  6333. /* istanbul ignore if */
  6334. if (
  6335. warn &&
  6336. modifiers.prevent && modifiers.passive
  6337. ) {
  6338. warn(
  6339. 'passive and prevent can\'t be used together. ' +
  6340. 'Passive handler can\'t prevent default event.',
  6341. range
  6342. );
  6343. }
  6344. // normalize click.right and click.middle since they don't actually fire
  6345. // this is technically browser-specific, but at least for now browsers are
  6346. // the only target envs that have right/middle clicks.
  6347. if (modifiers.right) {
  6348. if (dynamic) {
  6349. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  6350. } else if (name === 'click') {
  6351. name = 'contextmenu';
  6352. delete modifiers.right;
  6353. }
  6354. } else if (modifiers.middle) {
  6355. if (dynamic) {
  6356. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  6357. } else if (name === 'click') {
  6358. name = 'mouseup';
  6359. }
  6360. }
  6361. // check capture modifier
  6362. if (modifiers.capture) {
  6363. delete modifiers.capture;
  6364. name = prependModifierMarker('!', name, dynamic);
  6365. }
  6366. if (modifiers.once) {
  6367. delete modifiers.once;
  6368. name = prependModifierMarker('~', name, dynamic);
  6369. }
  6370. /* istanbul ignore if */
  6371. if (modifiers.passive) {
  6372. delete modifiers.passive;
  6373. name = prependModifierMarker('&', name, dynamic);
  6374. }
  6375. var events;
  6376. if (modifiers.native) {
  6377. delete modifiers.native;
  6378. events = el.nativeEvents || (el.nativeEvents = {});
  6379. } else {
  6380. events = el.events || (el.events = {});
  6381. }
  6382. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  6383. if (modifiers !== emptyObject) {
  6384. newHandler.modifiers = modifiers;
  6385. }
  6386. var handlers = events[name];
  6387. /* istanbul ignore if */
  6388. if (Array.isArray(handlers)) {
  6389. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  6390. } else if (handlers) {
  6391. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  6392. } else {
  6393. events[name] = newHandler;
  6394. }
  6395. el.plain = false;
  6396. }
  6397. function getRawBindingAttr (
  6398. el,
  6399. name
  6400. ) {
  6401. return el.rawAttrsMap[':' + name] ||
  6402. el.rawAttrsMap['v-bind:' + name] ||
  6403. el.rawAttrsMap[name]
  6404. }
  6405. function getBindingAttr (
  6406. el,
  6407. name,
  6408. getStatic
  6409. ) {
  6410. var dynamicValue =
  6411. getAndRemoveAttr(el, ':' + name) ||
  6412. getAndRemoveAttr(el, 'v-bind:' + name);
  6413. if (dynamicValue != null) {
  6414. return parseFilters(dynamicValue)
  6415. } else if (getStatic !== false) {
  6416. var staticValue = getAndRemoveAttr(el, name);
  6417. if (staticValue != null) {
  6418. return JSON.stringify(staticValue)
  6419. }
  6420. }
  6421. }
  6422. // note: this only removes the attr from the Array (attrsList) so that it
  6423. // doesn't get processed by processAttrs.
  6424. // By default it does NOT remove it from the map (attrsMap) because the map is
  6425. // needed during codegen.
  6426. function getAndRemoveAttr (
  6427. el,
  6428. name,
  6429. removeFromMap
  6430. ) {
  6431. var val;
  6432. if ((val = el.attrsMap[name]) != null) {
  6433. var list = el.attrsList;
  6434. for (var i = 0, l = list.length; i < l; i++) {
  6435. if (list[i].name === name) {
  6436. list.splice(i, 1);
  6437. break
  6438. }
  6439. }
  6440. }
  6441. if (removeFromMap) {
  6442. delete el.attrsMap[name];
  6443. }
  6444. return val
  6445. }
  6446. function getAndRemoveAttrByRegex (
  6447. el,
  6448. name
  6449. ) {
  6450. var list = el.attrsList;
  6451. for (var i = 0, l = list.length; i < l; i++) {
  6452. var attr = list[i];
  6453. if (name.test(attr.name)) {
  6454. list.splice(i, 1);
  6455. return attr
  6456. }
  6457. }
  6458. }
  6459. function rangeSetItem (
  6460. item,
  6461. range
  6462. ) {
  6463. if (range) {
  6464. if (range.start != null) {
  6465. item.start = range.start;
  6466. }
  6467. if (range.end != null) {
  6468. item.end = range.end;
  6469. }
  6470. }
  6471. return item
  6472. }
  6473. /* */
  6474. /**
  6475. * Cross-platform code generation for component v-model
  6476. */
  6477. function genComponentModel (
  6478. el,
  6479. value,
  6480. modifiers
  6481. ) {
  6482. var ref = modifiers || {};
  6483. var number = ref.number;
  6484. var trim = ref.trim;
  6485. var baseValueExpression = '$$v';
  6486. var valueExpression = baseValueExpression;
  6487. if (trim) {
  6488. valueExpression =
  6489. "(typeof " + baseValueExpression + " === 'string'" +
  6490. "? " + baseValueExpression + ".trim()" +
  6491. ": " + baseValueExpression + ")";
  6492. }
  6493. if (number) {
  6494. valueExpression = "_n(" + valueExpression + ")";
  6495. }
  6496. var assignment = genAssignmentCode(value, valueExpression);
  6497. el.model = {
  6498. value: ("(" + value + ")"),
  6499. expression: JSON.stringify(value),
  6500. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  6501. };
  6502. }
  6503. /**
  6504. * Cross-platform codegen helper for generating v-model value assignment code.
  6505. */
  6506. function genAssignmentCode (
  6507. value,
  6508. assignment
  6509. ) {
  6510. var res = parseModel(value);
  6511. if (res.key === null) {
  6512. return (value + "=" + assignment)
  6513. } else {
  6514. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  6515. }
  6516. }
  6517. /**
  6518. * Parse a v-model expression into a base path and a final key segment.
  6519. * Handles both dot-path and possible square brackets.
  6520. *
  6521. * Possible cases:
  6522. *
  6523. * - test
  6524. * - test[key]
  6525. * - test[test1[key]]
  6526. * - test["a"][key]
  6527. * - xxx.test[a[a].test1[key]]
  6528. * - test.xxx.a["asa"][test1[key]]
  6529. *
  6530. */
  6531. var len, str, chr, index$1, expressionPos, expressionEndPos;
  6532. function parseModel (val) {
  6533. // Fix https://github.com/vuejs/vue/pull/7730
  6534. // allow v-model="obj.val " (trailing whitespace)
  6535. val = val.trim();
  6536. len = val.length;
  6537. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  6538. index$1 = val.lastIndexOf('.');
  6539. if (index$1 > -1) {
  6540. return {
  6541. exp: val.slice(0, index$1),
  6542. key: '"' + val.slice(index$1 + 1) + '"'
  6543. }
  6544. } else {
  6545. return {
  6546. exp: val,
  6547. key: null
  6548. }
  6549. }
  6550. }
  6551. str = val;
  6552. index$1 = expressionPos = expressionEndPos = 0;
  6553. while (!eof()) {
  6554. chr = next();
  6555. /* istanbul ignore if */
  6556. if (isStringStart(chr)) {
  6557. parseString(chr);
  6558. } else if (chr === 0x5B) {
  6559. parseBracket(chr);
  6560. }
  6561. }
  6562. return {
  6563. exp: val.slice(0, expressionPos),
  6564. key: val.slice(expressionPos + 1, expressionEndPos)
  6565. }
  6566. }
  6567. function next () {
  6568. return str.charCodeAt(++index$1)
  6569. }
  6570. function eof () {
  6571. return index$1 >= len
  6572. }
  6573. function isStringStart (chr) {
  6574. return chr === 0x22 || chr === 0x27
  6575. }
  6576. function parseBracket (chr) {
  6577. var inBracket = 1;
  6578. expressionPos = index$1;
  6579. while (!eof()) {
  6580. chr = next();
  6581. if (isStringStart(chr)) {
  6582. parseString(chr);
  6583. continue
  6584. }
  6585. if (chr === 0x5B) { inBracket++; }
  6586. if (chr === 0x5D) { inBracket--; }
  6587. if (inBracket === 0) {
  6588. expressionEndPos = index$1;
  6589. break
  6590. }
  6591. }
  6592. }
  6593. function parseString (chr) {
  6594. var stringQuote = chr;
  6595. while (!eof()) {
  6596. chr = next();
  6597. if (chr === stringQuote) {
  6598. break
  6599. }
  6600. }
  6601. }
  6602. /* */
  6603. var warn$1;
  6604. // in some cases, the event used has to be determined at runtime
  6605. // so we used some reserved tokens during compile.
  6606. var RANGE_TOKEN = '__r';
  6607. var CHECKBOX_RADIO_TOKEN = '__c';
  6608. function model (
  6609. el,
  6610. dir,
  6611. _warn
  6612. ) {
  6613. warn$1 = _warn;
  6614. var value = dir.value;
  6615. var modifiers = dir.modifiers;
  6616. var tag = el.tag;
  6617. var type = el.attrsMap.type;
  6618. {
  6619. // inputs with type="file" are read only and setting the input's
  6620. // value will throw an error.
  6621. if (tag === 'input' && type === 'file') {
  6622. warn$1(
  6623. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  6624. "File inputs are read only. Use a v-on:change listener instead.",
  6625. el.rawAttrsMap['v-model']
  6626. );
  6627. }
  6628. }
  6629. if (el.component) {
  6630. genComponentModel(el, value, modifiers);
  6631. // component v-model doesn't need extra runtime
  6632. return false
  6633. } else if (tag === 'select') {
  6634. genSelect(el, value, modifiers);
  6635. } else if (tag === 'input' && type === 'checkbox') {
  6636. genCheckboxModel(el, value, modifiers);
  6637. } else if (tag === 'input' && type === 'radio') {
  6638. genRadioModel(el, value, modifiers);
  6639. } else if (tag === 'input' || tag === 'textarea') {
  6640. genDefaultModel(el, value, modifiers);
  6641. } else if (!config.isReservedTag(tag)) {
  6642. genComponentModel(el, value, modifiers);
  6643. // component v-model doesn't need extra runtime
  6644. return false
  6645. } else {
  6646. warn$1(
  6647. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  6648. "v-model is not supported on this element type. " +
  6649. 'If you are working with contenteditable, it\'s recommended to ' +
  6650. 'wrap a library dedicated for that purpose inside a custom component.',
  6651. el.rawAttrsMap['v-model']
  6652. );
  6653. }
  6654. // ensure runtime directive metadata
  6655. return true
  6656. }
  6657. function genCheckboxModel (
  6658. el,
  6659. value,
  6660. modifiers
  6661. ) {
  6662. var number = modifiers && modifiers.number;
  6663. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6664. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  6665. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  6666. addProp(el, 'checked',
  6667. "Array.isArray(" + value + ")" +
  6668. "?_i(" + value + "," + valueBinding + ")>-1" + (
  6669. trueValueBinding === 'true'
  6670. ? (":(" + value + ")")
  6671. : (":_q(" + value + "," + trueValueBinding + ")")
  6672. )
  6673. );
  6674. addHandler(el, 'change',
  6675. "var $$a=" + value + "," +
  6676. '$$el=$event.target,' +
  6677. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  6678. 'if(Array.isArray($$a)){' +
  6679. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  6680. '$$i=_i($$a,$$v);' +
  6681. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  6682. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  6683. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  6684. null, true
  6685. );
  6686. }
  6687. function genRadioModel (
  6688. el,
  6689. value,
  6690. modifiers
  6691. ) {
  6692. var number = modifiers && modifiers.number;
  6693. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6694. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  6695. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  6696. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  6697. }
  6698. function genSelect (
  6699. el,
  6700. value,
  6701. modifiers
  6702. ) {
  6703. var number = modifiers && modifiers.number;
  6704. var selectedVal = "Array.prototype.filter" +
  6705. ".call($event.target.options,function(o){return o.selected})" +
  6706. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  6707. "return " + (number ? '_n(val)' : 'val') + "})";
  6708. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  6709. var code = "var $$selectedVal = " + selectedVal + ";";
  6710. code = code + " " + (genAssignmentCode(value, assignment));
  6711. addHandler(el, 'change', code, null, true);
  6712. }
  6713. function genDefaultModel (
  6714. el,
  6715. value,
  6716. modifiers
  6717. ) {
  6718. var type = el.attrsMap.type;
  6719. // warn if v-bind:value conflicts with v-model
  6720. // except for inputs with v-bind:type
  6721. {
  6722. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  6723. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  6724. if (value$1 && !typeBinding) {
  6725. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  6726. warn$1(
  6727. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  6728. 'because the latter already expands to a value binding internally',
  6729. el.rawAttrsMap[binding]
  6730. );
  6731. }
  6732. }
  6733. var ref = modifiers || {};
  6734. var lazy = ref.lazy;
  6735. var number = ref.number;
  6736. var trim = ref.trim;
  6737. var needCompositionGuard = !lazy && type !== 'range';
  6738. var event = lazy
  6739. ? 'change'
  6740. : type === 'range'
  6741. ? RANGE_TOKEN
  6742. : 'input';
  6743. var valueExpression = '$event.target.value';
  6744. if (trim) {
  6745. valueExpression = "$event.target.value.trim()";
  6746. }
  6747. if (number) {
  6748. valueExpression = "_n(" + valueExpression + ")";
  6749. }
  6750. var code = genAssignmentCode(value, valueExpression);
  6751. if (needCompositionGuard) {
  6752. code = "if($event.target.composing)return;" + code;
  6753. }
  6754. addProp(el, 'value', ("(" + value + ")"));
  6755. addHandler(el, event, code, null, true);
  6756. if (trim || number) {
  6757. addHandler(el, 'blur', '$forceUpdate()');
  6758. }
  6759. }
  6760. /* */
  6761. // normalize v-model event tokens that can only be determined at runtime.
  6762. // it's important to place the event as the first in the array because
  6763. // the whole point is ensuring the v-model callback gets called before
  6764. // user-attached handlers.
  6765. function normalizeEvents (on) {
  6766. /* istanbul ignore if */
  6767. if (isDef(on[RANGE_TOKEN])) {
  6768. // IE input[type=range] only supports `change` event
  6769. var event = isIE ? 'change' : 'input';
  6770. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  6771. delete on[RANGE_TOKEN];
  6772. }
  6773. // This was originally intended to fix #4521 but no longer necessary
  6774. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  6775. /* istanbul ignore if */
  6776. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  6777. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  6778. delete on[CHECKBOX_RADIO_TOKEN];
  6779. }
  6780. }
  6781. var target$1;
  6782. function createOnceHandler$1 (event, handler, capture) {
  6783. var _target = target$1; // save current target element in closure
  6784. return function onceHandler () {
  6785. var res = handler.apply(null, arguments);
  6786. if (res !== null) {
  6787. remove$2(event, onceHandler, capture, _target);
  6788. }
  6789. }
  6790. }
  6791. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  6792. // implementation and does not fire microtasks in between event propagation, so
  6793. // safe to exclude.
  6794. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  6795. function add$1 (
  6796. name,
  6797. handler,
  6798. capture,
  6799. passive
  6800. ) {
  6801. // async edge case #6566: inner click event triggers patch, event handler
  6802. // attached to outer element during patch, and triggered again. This
  6803. // happens because browsers fire microtask ticks between event propagation.
  6804. // the solution is simple: we save the timestamp when a handler is attached,
  6805. // and the handler would only fire if the event passed to it was fired
  6806. // AFTER it was attached.
  6807. if (useMicrotaskFix) {
  6808. var attachedTimestamp = currentFlushTimestamp;
  6809. var original = handler;
  6810. handler = original._wrapper = function (e) {
  6811. if (
  6812. // no bubbling, should always fire.
  6813. // this is just a safety net in case event.timeStamp is unreliable in
  6814. // certain weird environments...
  6815. e.target === e.currentTarget ||
  6816. // event is fired after handler attachment
  6817. e.timeStamp >= attachedTimestamp ||
  6818. // bail for environments that have buggy event.timeStamp implementations
  6819. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  6820. // #9681 QtWebEngine event.timeStamp is negative value
  6821. e.timeStamp <= 0 ||
  6822. // #9448 bail if event is fired in another document in a multi-page
  6823. // electron/nw.js app, since event.timeStamp will be using a different
  6824. // starting reference
  6825. e.target.ownerDocument !== document
  6826. ) {
  6827. return original.apply(this, arguments)
  6828. }
  6829. };
  6830. }
  6831. target$1.addEventListener(
  6832. name,
  6833. handler,
  6834. supportsPassive
  6835. ? { capture: capture, passive: passive }
  6836. : capture
  6837. );
  6838. }
  6839. function remove$2 (
  6840. name,
  6841. handler,
  6842. capture,
  6843. _target
  6844. ) {
  6845. (_target || target$1).removeEventListener(
  6846. name,
  6847. handler._wrapper || handler,
  6848. capture
  6849. );
  6850. }
  6851. function updateDOMListeners (oldVnode, vnode) {
  6852. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  6853. return
  6854. }
  6855. var on = vnode.data.on || {};
  6856. var oldOn = oldVnode.data.on || {};
  6857. target$1 = vnode.elm;
  6858. normalizeEvents(on);
  6859. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  6860. target$1 = undefined;
  6861. }
  6862. var events = {
  6863. create: updateDOMListeners,
  6864. update: updateDOMListeners
  6865. };
  6866. /* */
  6867. var svgContainer;
  6868. function updateDOMProps (oldVnode, vnode) {
  6869. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  6870. return
  6871. }
  6872. var key, cur;
  6873. var elm = vnode.elm;
  6874. var oldProps = oldVnode.data.domProps || {};
  6875. var props = vnode.data.domProps || {};
  6876. // clone observed objects, as the user probably wants to mutate it
  6877. if (isDef(props.__ob__)) {
  6878. props = vnode.data.domProps = extend({}, props);
  6879. }
  6880. for (key in oldProps) {
  6881. if (!(key in props)) {
  6882. elm[key] = '';
  6883. }
  6884. }
  6885. for (key in props) {
  6886. cur = props[key];
  6887. // ignore children if the node has textContent or innerHTML,
  6888. // as these will throw away existing DOM nodes and cause removal errors
  6889. // on subsequent patches (#3360)
  6890. if (key === 'textContent' || key === 'innerHTML') {
  6891. if (vnode.children) { vnode.children.length = 0; }
  6892. if (cur === oldProps[key]) { continue }
  6893. // #6601 work around Chrome version <= 55 bug where single textNode
  6894. // replaced by innerHTML/textContent retains its parentNode property
  6895. if (elm.childNodes.length === 1) {
  6896. elm.removeChild(elm.childNodes[0]);
  6897. }
  6898. }
  6899. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  6900. // store value as _value as well since
  6901. // non-string values will be stringified
  6902. elm._value = cur;
  6903. // avoid resetting cursor position when value is the same
  6904. var strCur = isUndef(cur) ? '' : String(cur);
  6905. if (shouldUpdateValue(elm, strCur)) {
  6906. elm.value = strCur;
  6907. }
  6908. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  6909. // IE doesn't support innerHTML for SVG elements
  6910. svgContainer = svgContainer || document.createElement('div');
  6911. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  6912. var svg = svgContainer.firstChild;
  6913. while (elm.firstChild) {
  6914. elm.removeChild(elm.firstChild);
  6915. }
  6916. while (svg.firstChild) {
  6917. elm.appendChild(svg.firstChild);
  6918. }
  6919. } else if (
  6920. // skip the update if old and new VDOM state is the same.
  6921. // `value` is handled separately because the DOM value may be temporarily
  6922. // out of sync with VDOM state due to focus, composition and modifiers.
  6923. // This #4521 by skipping the unnecessary `checked` update.
  6924. cur !== oldProps[key]
  6925. ) {
  6926. // some property updates can throw
  6927. // e.g. `value` on <progress> w/ non-finite value
  6928. try {
  6929. elm[key] = cur;
  6930. } catch (e) {}
  6931. }
  6932. }
  6933. }
  6934. // check platforms/web/util/attrs.js acceptValue
  6935. function shouldUpdateValue (elm, checkVal) {
  6936. return (!elm.composing && (
  6937. elm.tagName === 'OPTION' ||
  6938. isNotInFocusAndDirty(elm, checkVal) ||
  6939. isDirtyWithModifiers(elm, checkVal)
  6940. ))
  6941. }
  6942. function isNotInFocusAndDirty (elm, checkVal) {
  6943. // return true when textbox (.number and .trim) loses focus and its value is
  6944. // not equal to the updated value
  6945. var notInFocus = true;
  6946. // #6157
  6947. // work around IE bug when accessing document.activeElement in an iframe
  6948. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  6949. return notInFocus && elm.value !== checkVal
  6950. }
  6951. function isDirtyWithModifiers (elm, newVal) {
  6952. var value = elm.value;
  6953. var modifiers = elm._vModifiers; // injected by v-model runtime
  6954. if (isDef(modifiers)) {
  6955. if (modifiers.number) {
  6956. return toNumber(value) !== toNumber(newVal)
  6957. }
  6958. if (modifiers.trim) {
  6959. return value.trim() !== newVal.trim()
  6960. }
  6961. }
  6962. return value !== newVal
  6963. }
  6964. var domProps = {
  6965. create: updateDOMProps,
  6966. update: updateDOMProps
  6967. };
  6968. /* */
  6969. var parseStyleText = cached(function (cssText) {
  6970. var res = {};
  6971. var listDelimiter = /;(?![^(]*\))/g;
  6972. var propertyDelimiter = /:(.+)/;
  6973. cssText.split(listDelimiter).forEach(function (item) {
  6974. if (item) {
  6975. var tmp = item.split(propertyDelimiter);
  6976. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6977. }
  6978. });
  6979. return res
  6980. });
  6981. // merge static and dynamic style data on the same vnode
  6982. function normalizeStyleData (data) {
  6983. var style = normalizeStyleBinding(data.style);
  6984. // static style is pre-processed into an object during compilation
  6985. // and is always a fresh object, so it's safe to merge into it
  6986. return data.staticStyle
  6987. ? extend(data.staticStyle, style)
  6988. : style
  6989. }
  6990. // normalize possible array / string values into Object
  6991. function normalizeStyleBinding (bindingStyle) {
  6992. if (Array.isArray(bindingStyle)) {
  6993. return toObject(bindingStyle)
  6994. }
  6995. if (typeof bindingStyle === 'string') {
  6996. return parseStyleText(bindingStyle)
  6997. }
  6998. return bindingStyle
  6999. }
  7000. /**
  7001. * parent component style should be after child's
  7002. * so that parent component's style could override it
  7003. */
  7004. function getStyle (vnode, checkChild) {
  7005. var res = {};
  7006. var styleData;
  7007. if (checkChild) {
  7008. var childNode = vnode;
  7009. while (childNode.componentInstance) {
  7010. childNode = childNode.componentInstance._vnode;
  7011. if (
  7012. childNode && childNode.data &&
  7013. (styleData = normalizeStyleData(childNode.data))
  7014. ) {
  7015. extend(res, styleData);
  7016. }
  7017. }
  7018. }
  7019. if ((styleData = normalizeStyleData(vnode.data))) {
  7020. extend(res, styleData);
  7021. }
  7022. var parentNode = vnode;
  7023. while ((parentNode = parentNode.parent)) {
  7024. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  7025. extend(res, styleData);
  7026. }
  7027. }
  7028. return res
  7029. }
  7030. /* */
  7031. var cssVarRE = /^--/;
  7032. var importantRE = /\s*!important$/;
  7033. var setProp = function (el, name, val) {
  7034. /* istanbul ignore if */
  7035. if (cssVarRE.test(name)) {
  7036. el.style.setProperty(name, val);
  7037. } else if (importantRE.test(val)) {
  7038. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  7039. } else {
  7040. var normalizedName = normalize(name);
  7041. if (Array.isArray(val)) {
  7042. // Support values array created by autoprefixer, e.g.
  7043. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  7044. // Set them one by one, and the browser will only set those it can recognize
  7045. for (var i = 0, len = val.length; i < len; i++) {
  7046. el.style[normalizedName] = val[i];
  7047. }
  7048. } else {
  7049. el.style[normalizedName] = val;
  7050. }
  7051. }
  7052. };
  7053. var vendorNames = ['Webkit', 'Moz', 'ms'];
  7054. var emptyStyle;
  7055. var normalize = cached(function (prop) {
  7056. emptyStyle = emptyStyle || document.createElement('div').style;
  7057. prop = camelize(prop);
  7058. if (prop !== 'filter' && (prop in emptyStyle)) {
  7059. return prop
  7060. }
  7061. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  7062. for (var i = 0; i < vendorNames.length; i++) {
  7063. var name = vendorNames[i] + capName;
  7064. if (name in emptyStyle) {
  7065. return name
  7066. }
  7067. }
  7068. });
  7069. function updateStyle (oldVnode, vnode) {
  7070. var data = vnode.data;
  7071. var oldData = oldVnode.data;
  7072. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  7073. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  7074. ) {
  7075. return
  7076. }
  7077. var cur, name;
  7078. var el = vnode.elm;
  7079. var oldStaticStyle = oldData.staticStyle;
  7080. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  7081. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  7082. var oldStyle = oldStaticStyle || oldStyleBinding;
  7083. var style = normalizeStyleBinding(vnode.data.style) || {};
  7084. // store normalized style under a different key for next diff
  7085. // make sure to clone it if it's reactive, since the user likely wants
  7086. // to mutate it.
  7087. vnode.data.normalizedStyle = isDef(style.__ob__)
  7088. ? extend({}, style)
  7089. : style;
  7090. var newStyle = getStyle(vnode, true);
  7091. for (name in oldStyle) {
  7092. if (isUndef(newStyle[name])) {
  7093. setProp(el, name, '');
  7094. }
  7095. }
  7096. for (name in newStyle) {
  7097. cur = newStyle[name];
  7098. if (cur !== oldStyle[name]) {
  7099. // ie9 setting to null has no effect, must use empty string
  7100. setProp(el, name, cur == null ? '' : cur);
  7101. }
  7102. }
  7103. }
  7104. var style = {
  7105. create: updateStyle,
  7106. update: updateStyle
  7107. };
  7108. /* */
  7109. var whitespaceRE = /\s+/;
  7110. /**
  7111. * Add class with compatibility for SVG since classList is not supported on
  7112. * SVG elements in IE
  7113. */
  7114. function addClass (el, cls) {
  7115. /* istanbul ignore if */
  7116. if (!cls || !(cls = cls.trim())) {
  7117. return
  7118. }
  7119. /* istanbul ignore else */
  7120. if (el.classList) {
  7121. if (cls.indexOf(' ') > -1) {
  7122. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  7123. } else {
  7124. el.classList.add(cls);
  7125. }
  7126. } else {
  7127. var cur = " " + (el.getAttribute('class') || '') + " ";
  7128. if (cur.indexOf(' ' + cls + ' ') < 0) {
  7129. el.setAttribute('class', (cur + cls).trim());
  7130. }
  7131. }
  7132. }
  7133. /**
  7134. * Remove class with compatibility for SVG since classList is not supported on
  7135. * SVG elements in IE
  7136. */
  7137. function removeClass (el, cls) {
  7138. /* istanbul ignore if */
  7139. if (!cls || !(cls = cls.trim())) {
  7140. return
  7141. }
  7142. /* istanbul ignore else */
  7143. if (el.classList) {
  7144. if (cls.indexOf(' ') > -1) {
  7145. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  7146. } else {
  7147. el.classList.remove(cls);
  7148. }
  7149. if (!el.classList.length) {
  7150. el.removeAttribute('class');
  7151. }
  7152. } else {
  7153. var cur = " " + (el.getAttribute('class') || '') + " ";
  7154. var tar = ' ' + cls + ' ';
  7155. while (cur.indexOf(tar) >= 0) {
  7156. cur = cur.replace(tar, ' ');
  7157. }
  7158. cur = cur.trim();
  7159. if (cur) {
  7160. el.setAttribute('class', cur);
  7161. } else {
  7162. el.removeAttribute('class');
  7163. }
  7164. }
  7165. }
  7166. /* */
  7167. function resolveTransition (def$$1) {
  7168. if (!def$$1) {
  7169. return
  7170. }
  7171. /* istanbul ignore else */
  7172. if (typeof def$$1 === 'object') {
  7173. var res = {};
  7174. if (def$$1.css !== false) {
  7175. extend(res, autoCssTransition(def$$1.name || 'v'));
  7176. }
  7177. extend(res, def$$1);
  7178. return res
  7179. } else if (typeof def$$1 === 'string') {
  7180. return autoCssTransition(def$$1)
  7181. }
  7182. }
  7183. var autoCssTransition = cached(function (name) {
  7184. return {
  7185. enterClass: (name + "-enter"),
  7186. enterToClass: (name + "-enter-to"),
  7187. enterActiveClass: (name + "-enter-active"),
  7188. leaveClass: (name + "-leave"),
  7189. leaveToClass: (name + "-leave-to"),
  7190. leaveActiveClass: (name + "-leave-active")
  7191. }
  7192. });
  7193. var hasTransition = inBrowser && !isIE9;
  7194. var TRANSITION = 'transition';
  7195. var ANIMATION = 'animation';
  7196. // Transition property/event sniffing
  7197. var transitionProp = 'transition';
  7198. var transitionEndEvent = 'transitionend';
  7199. var animationProp = 'animation';
  7200. var animationEndEvent = 'animationend';
  7201. if (hasTransition) {
  7202. /* istanbul ignore if */
  7203. if (window.ontransitionend === undefined &&
  7204. window.onwebkittransitionend !== undefined
  7205. ) {
  7206. transitionProp = 'WebkitTransition';
  7207. transitionEndEvent = 'webkitTransitionEnd';
  7208. }
  7209. if (window.onanimationend === undefined &&
  7210. window.onwebkitanimationend !== undefined
  7211. ) {
  7212. animationProp = 'WebkitAnimation';
  7213. animationEndEvent = 'webkitAnimationEnd';
  7214. }
  7215. }
  7216. // binding to window is necessary to make hot reload work in IE in strict mode
  7217. var raf = inBrowser
  7218. ? window.requestAnimationFrame
  7219. ? window.requestAnimationFrame.bind(window)
  7220. : setTimeout
  7221. : /* istanbul ignore next */ function (fn) { return fn(); };
  7222. function nextFrame (fn) {
  7223. raf(function () {
  7224. raf(fn);
  7225. });
  7226. }
  7227. function addTransitionClass (el, cls) {
  7228. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  7229. if (transitionClasses.indexOf(cls) < 0) {
  7230. transitionClasses.push(cls);
  7231. addClass(el, cls);
  7232. }
  7233. }
  7234. function removeTransitionClass (el, cls) {
  7235. if (el._transitionClasses) {
  7236. remove(el._transitionClasses, cls);
  7237. }
  7238. removeClass(el, cls);
  7239. }
  7240. function whenTransitionEnds (
  7241. el,
  7242. expectedType,
  7243. cb
  7244. ) {
  7245. var ref = getTransitionInfo(el, expectedType);
  7246. var type = ref.type;
  7247. var timeout = ref.timeout;
  7248. var propCount = ref.propCount;
  7249. if (!type) { return cb() }
  7250. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  7251. var ended = 0;
  7252. var end = function () {
  7253. el.removeEventListener(event, onEnd);
  7254. cb();
  7255. };
  7256. var onEnd = function (e) {
  7257. if (e.target === el) {
  7258. if (++ended >= propCount) {
  7259. end();
  7260. }
  7261. }
  7262. };
  7263. setTimeout(function () {
  7264. if (ended < propCount) {
  7265. end();
  7266. }
  7267. }, timeout + 1);
  7268. el.addEventListener(event, onEnd);
  7269. }
  7270. var transformRE = /\b(transform|all)(,|$)/;
  7271. function getTransitionInfo (el, expectedType) {
  7272. var styles = window.getComputedStyle(el);
  7273. // JSDOM may return undefined for transition properties
  7274. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  7275. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  7276. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  7277. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  7278. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  7279. var animationTimeout = getTimeout(animationDelays, animationDurations);
  7280. var type;
  7281. var timeout = 0;
  7282. var propCount = 0;
  7283. /* istanbul ignore if */
  7284. if (expectedType === TRANSITION) {
  7285. if (transitionTimeout > 0) {
  7286. type = TRANSITION;
  7287. timeout = transitionTimeout;
  7288. propCount = transitionDurations.length;
  7289. }
  7290. } else if (expectedType === ANIMATION) {
  7291. if (animationTimeout > 0) {
  7292. type = ANIMATION;
  7293. timeout = animationTimeout;
  7294. propCount = animationDurations.length;
  7295. }
  7296. } else {
  7297. timeout = Math.max(transitionTimeout, animationTimeout);
  7298. type = timeout > 0
  7299. ? transitionTimeout > animationTimeout
  7300. ? TRANSITION
  7301. : ANIMATION
  7302. : null;
  7303. propCount = type
  7304. ? type === TRANSITION
  7305. ? transitionDurations.length
  7306. : animationDurations.length
  7307. : 0;
  7308. }
  7309. var hasTransform =
  7310. type === TRANSITION &&
  7311. transformRE.test(styles[transitionProp + 'Property']);
  7312. return {
  7313. type: type,
  7314. timeout: timeout,
  7315. propCount: propCount,
  7316. hasTransform: hasTransform
  7317. }
  7318. }
  7319. function getTimeout (delays, durations) {
  7320. /* istanbul ignore next */
  7321. while (delays.length < durations.length) {
  7322. delays = delays.concat(delays);
  7323. }
  7324. return Math.max.apply(null, durations.map(function (d, i) {
  7325. return toMs(d) + toMs(delays[i])
  7326. }))
  7327. }
  7328. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  7329. // in a locale-dependent way, using a comma instead of a dot.
  7330. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  7331. // as a floor function) causing unexpected behaviors
  7332. function toMs (s) {
  7333. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  7334. }
  7335. /* */
  7336. function enter (vnode, toggleDisplay) {
  7337. var el = vnode.elm;
  7338. // call leave callback now
  7339. if (isDef(el._leaveCb)) {
  7340. el._leaveCb.cancelled = true;
  7341. el._leaveCb();
  7342. }
  7343. var data = resolveTransition(vnode.data.transition);
  7344. if (isUndef(data)) {
  7345. return
  7346. }
  7347. /* istanbul ignore if */
  7348. if (isDef(el._enterCb) || el.nodeType !== 1) {
  7349. return
  7350. }
  7351. var css = data.css;
  7352. var type = data.type;
  7353. var enterClass = data.enterClass;
  7354. var enterToClass = data.enterToClass;
  7355. var enterActiveClass = data.enterActiveClass;
  7356. var appearClass = data.appearClass;
  7357. var appearToClass = data.appearToClass;
  7358. var appearActiveClass = data.appearActiveClass;
  7359. var beforeEnter = data.beforeEnter;
  7360. var enter = data.enter;
  7361. var afterEnter = data.afterEnter;
  7362. var enterCancelled = data.enterCancelled;
  7363. var beforeAppear = data.beforeAppear;
  7364. var appear = data.appear;
  7365. var afterAppear = data.afterAppear;
  7366. var appearCancelled = data.appearCancelled;
  7367. var duration = data.duration;
  7368. // activeInstance will always be the <transition> component managing this
  7369. // transition. One edge case to check is when the <transition> is placed
  7370. // as the root node of a child component. In that case we need to check
  7371. // <transition>'s parent for appear check.
  7372. var context = activeInstance;
  7373. var transitionNode = activeInstance.$vnode;
  7374. while (transitionNode && transitionNode.parent) {
  7375. context = transitionNode.context;
  7376. transitionNode = transitionNode.parent;
  7377. }
  7378. var isAppear = !context._isMounted || !vnode.isRootInsert;
  7379. if (isAppear && !appear && appear !== '') {
  7380. return
  7381. }
  7382. var startClass = isAppear && appearClass
  7383. ? appearClass
  7384. : enterClass;
  7385. var activeClass = isAppear && appearActiveClass
  7386. ? appearActiveClass
  7387. : enterActiveClass;
  7388. var toClass = isAppear && appearToClass
  7389. ? appearToClass
  7390. : enterToClass;
  7391. var beforeEnterHook = isAppear
  7392. ? (beforeAppear || beforeEnter)
  7393. : beforeEnter;
  7394. var enterHook = isAppear
  7395. ? (typeof appear === 'function' ? appear : enter)
  7396. : enter;
  7397. var afterEnterHook = isAppear
  7398. ? (afterAppear || afterEnter)
  7399. : afterEnter;
  7400. var enterCancelledHook = isAppear
  7401. ? (appearCancelled || enterCancelled)
  7402. : enterCancelled;
  7403. var explicitEnterDuration = toNumber(
  7404. isObject(duration)
  7405. ? duration.enter
  7406. : duration
  7407. );
  7408. if (explicitEnterDuration != null) {
  7409. checkDuration(explicitEnterDuration, 'enter', vnode);
  7410. }
  7411. var expectsCSS = css !== false && !isIE9;
  7412. var userWantsControl = getHookArgumentsLength(enterHook);
  7413. var cb = el._enterCb = once(function () {
  7414. if (expectsCSS) {
  7415. removeTransitionClass(el, toClass);
  7416. removeTransitionClass(el, activeClass);
  7417. }
  7418. if (cb.cancelled) {
  7419. if (expectsCSS) {
  7420. removeTransitionClass(el, startClass);
  7421. }
  7422. enterCancelledHook && enterCancelledHook(el);
  7423. } else {
  7424. afterEnterHook && afterEnterHook(el);
  7425. }
  7426. el._enterCb = null;
  7427. });
  7428. if (!vnode.data.show) {
  7429. // remove pending leave element on enter by injecting an insert hook
  7430. mergeVNodeHook(vnode, 'insert', function () {
  7431. var parent = el.parentNode;
  7432. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  7433. if (pendingNode &&
  7434. pendingNode.tag === vnode.tag &&
  7435. pendingNode.elm._leaveCb
  7436. ) {
  7437. pendingNode.elm._leaveCb();
  7438. }
  7439. enterHook && enterHook(el, cb);
  7440. });
  7441. }
  7442. // start enter transition
  7443. beforeEnterHook && beforeEnterHook(el);
  7444. if (expectsCSS) {
  7445. addTransitionClass(el, startClass);
  7446. addTransitionClass(el, activeClass);
  7447. nextFrame(function () {
  7448. removeTransitionClass(el, startClass);
  7449. if (!cb.cancelled) {
  7450. addTransitionClass(el, toClass);
  7451. if (!userWantsControl) {
  7452. if (isValidDuration(explicitEnterDuration)) {
  7453. setTimeout(cb, explicitEnterDuration);
  7454. } else {
  7455. whenTransitionEnds(el, type, cb);
  7456. }
  7457. }
  7458. }
  7459. });
  7460. }
  7461. if (vnode.data.show) {
  7462. toggleDisplay && toggleDisplay();
  7463. enterHook && enterHook(el, cb);
  7464. }
  7465. if (!expectsCSS && !userWantsControl) {
  7466. cb();
  7467. }
  7468. }
  7469. function leave (vnode, rm) {
  7470. var el = vnode.elm;
  7471. // call enter callback now
  7472. if (isDef(el._enterCb)) {
  7473. el._enterCb.cancelled = true;
  7474. el._enterCb();
  7475. }
  7476. var data = resolveTransition(vnode.data.transition);
  7477. if (isUndef(data) || el.nodeType !== 1) {
  7478. return rm()
  7479. }
  7480. /* istanbul ignore if */
  7481. if (isDef(el._leaveCb)) {
  7482. return
  7483. }
  7484. var css = data.css;
  7485. var type = data.type;
  7486. var leaveClass = data.leaveClass;
  7487. var leaveToClass = data.leaveToClass;
  7488. var leaveActiveClass = data.leaveActiveClass;
  7489. var beforeLeave = data.beforeLeave;
  7490. var leave = data.leave;
  7491. var afterLeave = data.afterLeave;
  7492. var leaveCancelled = data.leaveCancelled;
  7493. var delayLeave = data.delayLeave;
  7494. var duration = data.duration;
  7495. var expectsCSS = css !== false && !isIE9;
  7496. var userWantsControl = getHookArgumentsLength(leave);
  7497. var explicitLeaveDuration = toNumber(
  7498. isObject(duration)
  7499. ? duration.leave
  7500. : duration
  7501. );
  7502. if (isDef(explicitLeaveDuration)) {
  7503. checkDuration(explicitLeaveDuration, 'leave', vnode);
  7504. }
  7505. var cb = el._leaveCb = once(function () {
  7506. if (el.parentNode && el.parentNode._pending) {
  7507. el.parentNode._pending[vnode.key] = null;
  7508. }
  7509. if (expectsCSS) {
  7510. removeTransitionClass(el, leaveToClass);
  7511. removeTransitionClass(el, leaveActiveClass);
  7512. }
  7513. if (cb.cancelled) {
  7514. if (expectsCSS) {
  7515. removeTransitionClass(el, leaveClass);
  7516. }
  7517. leaveCancelled && leaveCancelled(el);
  7518. } else {
  7519. rm();
  7520. afterLeave && afterLeave(el);
  7521. }
  7522. el._leaveCb = null;
  7523. });
  7524. if (delayLeave) {
  7525. delayLeave(performLeave);
  7526. } else {
  7527. performLeave();
  7528. }
  7529. function performLeave () {
  7530. // the delayed leave may have already been cancelled
  7531. if (cb.cancelled) {
  7532. return
  7533. }
  7534. // record leaving element
  7535. if (!vnode.data.show && el.parentNode) {
  7536. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  7537. }
  7538. beforeLeave && beforeLeave(el);
  7539. if (expectsCSS) {
  7540. addTransitionClass(el, leaveClass);
  7541. addTransitionClass(el, leaveActiveClass);
  7542. nextFrame(function () {
  7543. removeTransitionClass(el, leaveClass);
  7544. if (!cb.cancelled) {
  7545. addTransitionClass(el, leaveToClass);
  7546. if (!userWantsControl) {
  7547. if (isValidDuration(explicitLeaveDuration)) {
  7548. setTimeout(cb, explicitLeaveDuration);
  7549. } else {
  7550. whenTransitionEnds(el, type, cb);
  7551. }
  7552. }
  7553. }
  7554. });
  7555. }
  7556. leave && leave(el, cb);
  7557. if (!expectsCSS && !userWantsControl) {
  7558. cb();
  7559. }
  7560. }
  7561. }
  7562. // only used in dev mode
  7563. function checkDuration (val, name, vnode) {
  7564. if (typeof val !== 'number') {
  7565. warn(
  7566. "<transition> explicit " + name + " duration is not a valid number - " +
  7567. "got " + (JSON.stringify(val)) + ".",
  7568. vnode.context
  7569. );
  7570. } else if (isNaN(val)) {
  7571. warn(
  7572. "<transition> explicit " + name + " duration is NaN - " +
  7573. 'the duration expression might be incorrect.',
  7574. vnode.context
  7575. );
  7576. }
  7577. }
  7578. function isValidDuration (val) {
  7579. return typeof val === 'number' && !isNaN(val)
  7580. }
  7581. /**
  7582. * Normalize a transition hook's argument length. The hook may be:
  7583. * - a merged hook (invoker) with the original in .fns
  7584. * - a wrapped component method (check ._length)
  7585. * - a plain function (.length)
  7586. */
  7587. function getHookArgumentsLength (fn) {
  7588. if (isUndef(fn)) {
  7589. return false
  7590. }
  7591. var invokerFns = fn.fns;
  7592. if (isDef(invokerFns)) {
  7593. // invoker
  7594. return getHookArgumentsLength(
  7595. Array.isArray(invokerFns)
  7596. ? invokerFns[0]
  7597. : invokerFns
  7598. )
  7599. } else {
  7600. return (fn._length || fn.length) > 1
  7601. }
  7602. }
  7603. function _enter (_, vnode) {
  7604. if (vnode.data.show !== true) {
  7605. enter(vnode);
  7606. }
  7607. }
  7608. var transition = inBrowser ? {
  7609. create: _enter,
  7610. activate: _enter,
  7611. remove: function remove$$1 (vnode, rm) {
  7612. /* istanbul ignore else */
  7613. if (vnode.data.show !== true) {
  7614. leave(vnode, rm);
  7615. } else {
  7616. rm();
  7617. }
  7618. }
  7619. } : {};
  7620. var platformModules = [
  7621. attrs,
  7622. klass,
  7623. events,
  7624. domProps,
  7625. style,
  7626. transition
  7627. ];
  7628. /* */
  7629. // the directive module should be applied last, after all
  7630. // built-in modules have been applied.
  7631. var modules = platformModules.concat(baseModules);
  7632. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  7633. /**
  7634. * Not type checking this file because flow doesn't like attaching
  7635. * properties to Elements.
  7636. */
  7637. /* istanbul ignore if */
  7638. if (isIE9) {
  7639. // http://www.matts411.com/post/internet-explorer-9-oninput/
  7640. document.addEventListener('selectionchange', function () {
  7641. var el = document.activeElement;
  7642. if (el && el.vmodel) {
  7643. trigger(el, 'input');
  7644. }
  7645. });
  7646. }
  7647. var directive = {
  7648. inserted: function inserted (el, binding, vnode, oldVnode) {
  7649. if (vnode.tag === 'select') {
  7650. // #6903
  7651. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  7652. mergeVNodeHook(vnode, 'postpatch', function () {
  7653. directive.componentUpdated(el, binding, vnode);
  7654. });
  7655. } else {
  7656. setSelected(el, binding, vnode.context);
  7657. }
  7658. el._vOptions = [].map.call(el.options, getValue);
  7659. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  7660. el._vModifiers = binding.modifiers;
  7661. if (!binding.modifiers.lazy) {
  7662. el.addEventListener('compositionstart', onCompositionStart);
  7663. el.addEventListener('compositionend', onCompositionEnd);
  7664. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  7665. // switching focus before confirming composition choice
  7666. // this also fixes the issue where some browsers e.g. iOS Chrome
  7667. // fires "change" instead of "input" on autocomplete.
  7668. el.addEventListener('change', onCompositionEnd);
  7669. /* istanbul ignore if */
  7670. if (isIE9) {
  7671. el.vmodel = true;
  7672. }
  7673. }
  7674. }
  7675. },
  7676. componentUpdated: function componentUpdated (el, binding, vnode) {
  7677. if (vnode.tag === 'select') {
  7678. setSelected(el, binding, vnode.context);
  7679. // in case the options rendered by v-for have changed,
  7680. // it's possible that the value is out-of-sync with the rendered options.
  7681. // detect such cases and filter out values that no longer has a matching
  7682. // option in the DOM.
  7683. var prevOptions = el._vOptions;
  7684. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  7685. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  7686. // trigger change event if
  7687. // no matching option found for at least one value
  7688. var needReset = el.multiple
  7689. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  7690. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  7691. if (needReset) {
  7692. trigger(el, 'change');
  7693. }
  7694. }
  7695. }
  7696. }
  7697. };
  7698. function setSelected (el, binding, vm) {
  7699. actuallySetSelected(el, binding, vm);
  7700. /* istanbul ignore if */
  7701. if (isIE || isEdge) {
  7702. setTimeout(function () {
  7703. actuallySetSelected(el, binding, vm);
  7704. }, 0);
  7705. }
  7706. }
  7707. function actuallySetSelected (el, binding, vm) {
  7708. var value = binding.value;
  7709. var isMultiple = el.multiple;
  7710. if (isMultiple && !Array.isArray(value)) {
  7711. warn(
  7712. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  7713. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  7714. vm
  7715. );
  7716. return
  7717. }
  7718. var selected, option;
  7719. for (var i = 0, l = el.options.length; i < l; i++) {
  7720. option = el.options[i];
  7721. if (isMultiple) {
  7722. selected = looseIndexOf(value, getValue(option)) > -1;
  7723. if (option.selected !== selected) {
  7724. option.selected = selected;
  7725. }
  7726. } else {
  7727. if (looseEqual(getValue(option), value)) {
  7728. if (el.selectedIndex !== i) {
  7729. el.selectedIndex = i;
  7730. }
  7731. return
  7732. }
  7733. }
  7734. }
  7735. if (!isMultiple) {
  7736. el.selectedIndex = -1;
  7737. }
  7738. }
  7739. function hasNoMatchingOption (value, options) {
  7740. return options.every(function (o) { return !looseEqual(o, value); })
  7741. }
  7742. function getValue (option) {
  7743. return '_value' in option
  7744. ? option._value
  7745. : option.value
  7746. }
  7747. function onCompositionStart (e) {
  7748. e.target.composing = true;
  7749. }
  7750. function onCompositionEnd (e) {
  7751. // prevent triggering an input event for no reason
  7752. if (!e.target.composing) { return }
  7753. e.target.composing = false;
  7754. trigger(e.target, 'input');
  7755. }
  7756. function trigger (el, type) {
  7757. var e = document.createEvent('HTMLEvents');
  7758. e.initEvent(type, true, true);
  7759. el.dispatchEvent(e);
  7760. }
  7761. /* */
  7762. // recursively search for possible transition defined inside the component root
  7763. function locateNode (vnode) {
  7764. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  7765. ? locateNode(vnode.componentInstance._vnode)
  7766. : vnode
  7767. }
  7768. var show = {
  7769. bind: function bind (el, ref, vnode) {
  7770. var value = ref.value;
  7771. vnode = locateNode(vnode);
  7772. var transition$$1 = vnode.data && vnode.data.transition;
  7773. var originalDisplay = el.__vOriginalDisplay =
  7774. el.style.display === 'none' ? '' : el.style.display;
  7775. if (value && transition$$1) {
  7776. vnode.data.show = true;
  7777. enter(vnode, function () {
  7778. el.style.display = originalDisplay;
  7779. });
  7780. } else {
  7781. el.style.display = value ? originalDisplay : 'none';
  7782. }
  7783. },
  7784. update: function update (el, ref, vnode) {
  7785. var value = ref.value;
  7786. var oldValue = ref.oldValue;
  7787. /* istanbul ignore if */
  7788. if (!value === !oldValue) { return }
  7789. vnode = locateNode(vnode);
  7790. var transition$$1 = vnode.data && vnode.data.transition;
  7791. if (transition$$1) {
  7792. vnode.data.show = true;
  7793. if (value) {
  7794. enter(vnode, function () {
  7795. el.style.display = el.__vOriginalDisplay;
  7796. });
  7797. } else {
  7798. leave(vnode, function () {
  7799. el.style.display = 'none';
  7800. });
  7801. }
  7802. } else {
  7803. el.style.display = value ? el.__vOriginalDisplay : 'none';
  7804. }
  7805. },
  7806. unbind: function unbind (
  7807. el,
  7808. binding,
  7809. vnode,
  7810. oldVnode,
  7811. isDestroy
  7812. ) {
  7813. if (!isDestroy) {
  7814. el.style.display = el.__vOriginalDisplay;
  7815. }
  7816. }
  7817. };
  7818. var platformDirectives = {
  7819. model: directive,
  7820. show: show
  7821. };
  7822. /* */
  7823. var transitionProps = {
  7824. name: String,
  7825. appear: Boolean,
  7826. css: Boolean,
  7827. mode: String,
  7828. type: String,
  7829. enterClass: String,
  7830. leaveClass: String,
  7831. enterToClass: String,
  7832. leaveToClass: String,
  7833. enterActiveClass: String,
  7834. leaveActiveClass: String,
  7835. appearClass: String,
  7836. appearActiveClass: String,
  7837. appearToClass: String,
  7838. duration: [Number, String, Object]
  7839. };
  7840. // in case the child is also an abstract component, e.g. <keep-alive>
  7841. // we want to recursively retrieve the real component to be rendered
  7842. function getRealChild (vnode) {
  7843. var compOptions = vnode && vnode.componentOptions;
  7844. if (compOptions && compOptions.Ctor.options.abstract) {
  7845. return getRealChild(getFirstComponentChild(compOptions.children))
  7846. } else {
  7847. return vnode
  7848. }
  7849. }
  7850. function extractTransitionData (comp) {
  7851. var data = {};
  7852. var options = comp.$options;
  7853. // props
  7854. for (var key in options.propsData) {
  7855. data[key] = comp[key];
  7856. }
  7857. // events.
  7858. // extract listeners and pass them directly to the transition methods
  7859. var listeners = options._parentListeners;
  7860. for (var key$1 in listeners) {
  7861. data[camelize(key$1)] = listeners[key$1];
  7862. }
  7863. return data
  7864. }
  7865. function placeholder (h, rawChild) {
  7866. if (/\d-keep-alive$/.test(rawChild.tag)) {
  7867. return h('keep-alive', {
  7868. props: rawChild.componentOptions.propsData
  7869. })
  7870. }
  7871. }
  7872. function hasParentTransition (vnode) {
  7873. while ((vnode = vnode.parent)) {
  7874. if (vnode.data.transition) {
  7875. return true
  7876. }
  7877. }
  7878. }
  7879. function isSameChild (child, oldChild) {
  7880. return oldChild.key === child.key && oldChild.tag === child.tag
  7881. }
  7882. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  7883. var isVShowDirective = function (d) { return d.name === 'show'; };
  7884. var Transition = {
  7885. name: 'transition',
  7886. props: transitionProps,
  7887. abstract: true,
  7888. render: function render (h) {
  7889. var this$1 = this;
  7890. var children = this.$slots.default;
  7891. if (!children) {
  7892. return
  7893. }
  7894. // filter out text nodes (possible whitespaces)
  7895. children = children.filter(isNotTextNode);
  7896. /* istanbul ignore if */
  7897. if (!children.length) {
  7898. return
  7899. }
  7900. // warn multiple elements
  7901. if (children.length > 1) {
  7902. warn(
  7903. '<transition> can only be used on a single element. Use ' +
  7904. '<transition-group> for lists.',
  7905. this.$parent
  7906. );
  7907. }
  7908. var mode = this.mode;
  7909. // warn invalid mode
  7910. if (mode && mode !== 'in-out' && mode !== 'out-in'
  7911. ) {
  7912. warn(
  7913. 'invalid <transition> mode: ' + mode,
  7914. this.$parent
  7915. );
  7916. }
  7917. var rawChild = children[0];
  7918. // if this is a component root node and the component's
  7919. // parent container node also has transition, skip.
  7920. if (hasParentTransition(this.$vnode)) {
  7921. return rawChild
  7922. }
  7923. // apply transition data to child
  7924. // use getRealChild() to ignore abstract components e.g. keep-alive
  7925. var child = getRealChild(rawChild);
  7926. /* istanbul ignore if */
  7927. if (!child) {
  7928. return rawChild
  7929. }
  7930. if (this._leaving) {
  7931. return placeholder(h, rawChild)
  7932. }
  7933. // ensure a key that is unique to the vnode type and to this transition
  7934. // component instance. This key will be used to remove pending leaving nodes
  7935. // during entering.
  7936. var id = "__transition-" + (this._uid) + "-";
  7937. child.key = child.key == null
  7938. ? child.isComment
  7939. ? id + 'comment'
  7940. : id + child.tag
  7941. : isPrimitive(child.key)
  7942. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  7943. : child.key;
  7944. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  7945. var oldRawChild = this._vnode;
  7946. var oldChild = getRealChild(oldRawChild);
  7947. // mark v-show
  7948. // so that the transition module can hand over the control to the directive
  7949. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  7950. child.data.show = true;
  7951. }
  7952. if (
  7953. oldChild &&
  7954. oldChild.data &&
  7955. !isSameChild(child, oldChild) &&
  7956. !isAsyncPlaceholder(oldChild) &&
  7957. // #6687 component root is a comment node
  7958. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  7959. ) {
  7960. // replace old child transition data with fresh one
  7961. // important for dynamic transitions!
  7962. var oldData = oldChild.data.transition = extend({}, data);
  7963. // handle transition mode
  7964. if (mode === 'out-in') {
  7965. // return placeholder node and queue update when leave finishes
  7966. this._leaving = true;
  7967. mergeVNodeHook(oldData, 'afterLeave', function () {
  7968. this$1._leaving = false;
  7969. this$1.$forceUpdate();
  7970. });
  7971. return placeholder(h, rawChild)
  7972. } else if (mode === 'in-out') {
  7973. if (isAsyncPlaceholder(child)) {
  7974. return oldRawChild
  7975. }
  7976. var delayedLeave;
  7977. var performLeave = function () { delayedLeave(); };
  7978. mergeVNodeHook(data, 'afterEnter', performLeave);
  7979. mergeVNodeHook(data, 'enterCancelled', performLeave);
  7980. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  7981. }
  7982. }
  7983. return rawChild
  7984. }
  7985. };
  7986. /* */
  7987. var props = extend({
  7988. tag: String,
  7989. moveClass: String
  7990. }, transitionProps);
  7991. delete props.mode;
  7992. var TransitionGroup = {
  7993. props: props,
  7994. beforeMount: function beforeMount () {
  7995. var this$1 = this;
  7996. var update = this._update;
  7997. this._update = function (vnode, hydrating) {
  7998. var restoreActiveInstance = setActiveInstance(this$1);
  7999. // force removing pass
  8000. this$1.__patch__(
  8001. this$1._vnode,
  8002. this$1.kept,
  8003. false, // hydrating
  8004. true // removeOnly (!important, avoids unnecessary moves)
  8005. );
  8006. this$1._vnode = this$1.kept;
  8007. restoreActiveInstance();
  8008. update.call(this$1, vnode, hydrating);
  8009. };
  8010. },
  8011. render: function render (h) {
  8012. var tag = this.tag || this.$vnode.data.tag || 'span';
  8013. var map = Object.create(null);
  8014. var prevChildren = this.prevChildren = this.children;
  8015. var rawChildren = this.$slots.default || [];
  8016. var children = this.children = [];
  8017. var transitionData = extractTransitionData(this);
  8018. for (var i = 0; i < rawChildren.length; i++) {
  8019. var c = rawChildren[i];
  8020. if (c.tag) {
  8021. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  8022. children.push(c);
  8023. map[c.key] = c
  8024. ;(c.data || (c.data = {})).transition = transitionData;
  8025. } else {
  8026. var opts = c.componentOptions;
  8027. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  8028. warn(("<transition-group> children must be keyed: <" + name + ">"));
  8029. }
  8030. }
  8031. }
  8032. if (prevChildren) {
  8033. var kept = [];
  8034. var removed = [];
  8035. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  8036. var c$1 = prevChildren[i$1];
  8037. c$1.data.transition = transitionData;
  8038. c$1.data.pos = c$1.elm.getBoundingClientRect();
  8039. if (map[c$1.key]) {
  8040. kept.push(c$1);
  8041. } else {
  8042. removed.push(c$1);
  8043. }
  8044. }
  8045. this.kept = h(tag, null, kept);
  8046. this.removed = removed;
  8047. }
  8048. return h(tag, null, children)
  8049. },
  8050. updated: function updated () {
  8051. var children = this.prevChildren;
  8052. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  8053. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  8054. return
  8055. }
  8056. // we divide the work into three loops to avoid mixing DOM reads and writes
  8057. // in each iteration - which helps prevent layout thrashing.
  8058. children.forEach(callPendingCbs);
  8059. children.forEach(recordPosition);
  8060. children.forEach(applyTranslation);
  8061. // force reflow to put everything in position
  8062. // assign to this to avoid being removed in tree-shaking
  8063. // $flow-disable-line
  8064. this._reflow = document.body.offsetHeight;
  8065. children.forEach(function (c) {
  8066. if (c.data.moved) {
  8067. var el = c.elm;
  8068. var s = el.style;
  8069. addTransitionClass(el, moveClass);
  8070. s.transform = s.WebkitTransform = s.transitionDuration = '';
  8071. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  8072. if (e && e.target !== el) {
  8073. return
  8074. }
  8075. if (!e || /transform$/.test(e.propertyName)) {
  8076. el.removeEventListener(transitionEndEvent, cb);
  8077. el._moveCb = null;
  8078. removeTransitionClass(el, moveClass);
  8079. }
  8080. });
  8081. }
  8082. });
  8083. },
  8084. methods: {
  8085. hasMove: function hasMove (el, moveClass) {
  8086. /* istanbul ignore if */
  8087. if (!hasTransition) {
  8088. return false
  8089. }
  8090. /* istanbul ignore if */
  8091. if (this._hasMove) {
  8092. return this._hasMove
  8093. }
  8094. // Detect whether an element with the move class applied has
  8095. // CSS transitions. Since the element may be inside an entering
  8096. // transition at this very moment, we make a clone of it and remove
  8097. // all other transition classes applied to ensure only the move class
  8098. // is applied.
  8099. var clone = el.cloneNode();
  8100. if (el._transitionClasses) {
  8101. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  8102. }
  8103. addClass(clone, moveClass);
  8104. clone.style.display = 'none';
  8105. this.$el.appendChild(clone);
  8106. var info = getTransitionInfo(clone);
  8107. this.$el.removeChild(clone);
  8108. return (this._hasMove = info.hasTransform)
  8109. }
  8110. }
  8111. };
  8112. function callPendingCbs (c) {
  8113. /* istanbul ignore if */
  8114. if (c.elm._moveCb) {
  8115. c.elm._moveCb();
  8116. }
  8117. /* istanbul ignore if */
  8118. if (c.elm._enterCb) {
  8119. c.elm._enterCb();
  8120. }
  8121. }
  8122. function recordPosition (c) {
  8123. c.data.newPos = c.elm.getBoundingClientRect();
  8124. }
  8125. function applyTranslation (c) {
  8126. var oldPos = c.data.pos;
  8127. var newPos = c.data.newPos;
  8128. var dx = oldPos.left - newPos.left;
  8129. var dy = oldPos.top - newPos.top;
  8130. if (dx || dy) {
  8131. c.data.moved = true;
  8132. var s = c.elm.style;
  8133. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  8134. s.transitionDuration = '0s';
  8135. }
  8136. }
  8137. var platformComponents = {
  8138. Transition: Transition,
  8139. TransitionGroup: TransitionGroup
  8140. };
  8141. /* */
  8142. // install platform specific utils
  8143. Vue.config.mustUseProp = mustUseProp;
  8144. Vue.config.isReservedTag = isReservedTag;
  8145. Vue.config.isReservedAttr = isReservedAttr;
  8146. Vue.config.getTagNamespace = getTagNamespace;
  8147. Vue.config.isUnknownElement = isUnknownElement;
  8148. // install platform runtime directives & components
  8149. extend(Vue.options.directives, platformDirectives);
  8150. extend(Vue.options.components, platformComponents);
  8151. // install platform patch function
  8152. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  8153. // public mount method
  8154. Vue.prototype.$mount = function (
  8155. el,
  8156. hydrating
  8157. ) {
  8158. el = el && inBrowser ? query(el) : undefined;
  8159. return mountComponent(this, el, hydrating)
  8160. };
  8161. // devtools global hook
  8162. /* istanbul ignore next */
  8163. if (inBrowser) {
  8164. setTimeout(function () {
  8165. if (config.devtools) {
  8166. if (devtools) {
  8167. devtools.emit('init', Vue);
  8168. } else {
  8169. console[console.info ? 'info' : 'log'](
  8170. 'Download the Vue Devtools extension for a better development experience:\n' +
  8171. 'https://github.com/vuejs/vue-devtools'
  8172. );
  8173. }
  8174. }
  8175. if (config.productionTip !== false &&
  8176. typeof console !== 'undefined'
  8177. ) {
  8178. console[console.info ? 'info' : 'log'](
  8179. "You are running Vue in development mode.\n" +
  8180. "Make sure to turn on production mode when deploying for production.\n" +
  8181. "See more tips at https://vuejs.org/guide/deployment.html"
  8182. );
  8183. }
  8184. }, 0);
  8185. }
  8186. /* */
  8187. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  8188. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  8189. var buildRegex = cached(function (delimiters) {
  8190. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  8191. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  8192. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  8193. });
  8194. function parseText (
  8195. text,
  8196. delimiters
  8197. ) {
  8198. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  8199. if (!tagRE.test(text)) {
  8200. return
  8201. }
  8202. var tokens = [];
  8203. var rawTokens = [];
  8204. var lastIndex = tagRE.lastIndex = 0;
  8205. var match, index, tokenValue;
  8206. while ((match = tagRE.exec(text))) {
  8207. index = match.index;
  8208. // push text token
  8209. if (index > lastIndex) {
  8210. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  8211. tokens.push(JSON.stringify(tokenValue));
  8212. }
  8213. // tag token
  8214. var exp = parseFilters(match[1].trim());
  8215. tokens.push(("_s(" + exp + ")"));
  8216. rawTokens.push({ '@binding': exp });
  8217. lastIndex = index + match[0].length;
  8218. }
  8219. if (lastIndex < text.length) {
  8220. rawTokens.push(tokenValue = text.slice(lastIndex));
  8221. tokens.push(JSON.stringify(tokenValue));
  8222. }
  8223. return {
  8224. expression: tokens.join('+'),
  8225. tokens: rawTokens
  8226. }
  8227. }
  8228. /* */
  8229. function transformNode (el, options) {
  8230. var warn = options.warn || baseWarn;
  8231. var staticClass = getAndRemoveAttr(el, 'class');
  8232. if (staticClass) {
  8233. var res = parseText(staticClass, options.delimiters);
  8234. if (res) {
  8235. warn(
  8236. "class=\"" + staticClass + "\": " +
  8237. 'Interpolation inside attributes has been removed. ' +
  8238. 'Use v-bind or the colon shorthand instead. For example, ' +
  8239. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  8240. el.rawAttrsMap['class']
  8241. );
  8242. }
  8243. }
  8244. if (staticClass) {
  8245. el.staticClass = JSON.stringify(staticClass);
  8246. }
  8247. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  8248. if (classBinding) {
  8249. el.classBinding = classBinding;
  8250. }
  8251. }
  8252. function genData (el) {
  8253. var data = '';
  8254. if (el.staticClass) {
  8255. data += "staticClass:" + (el.staticClass) + ",";
  8256. }
  8257. if (el.classBinding) {
  8258. data += "class:" + (el.classBinding) + ",";
  8259. }
  8260. return data
  8261. }
  8262. var klass$1 = {
  8263. staticKeys: ['staticClass'],
  8264. transformNode: transformNode,
  8265. genData: genData
  8266. };
  8267. /* */
  8268. function transformNode$1 (el, options) {
  8269. var warn = options.warn || baseWarn;
  8270. var staticStyle = getAndRemoveAttr(el, 'style');
  8271. if (staticStyle) {
  8272. /* istanbul ignore if */
  8273. {
  8274. var res = parseText(staticStyle, options.delimiters);
  8275. if (res) {
  8276. warn(
  8277. "style=\"" + staticStyle + "\": " +
  8278. 'Interpolation inside attributes has been removed. ' +
  8279. 'Use v-bind or the colon shorthand instead. For example, ' +
  8280. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  8281. el.rawAttrsMap['style']
  8282. );
  8283. }
  8284. }
  8285. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  8286. }
  8287. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  8288. if (styleBinding) {
  8289. el.styleBinding = styleBinding;
  8290. }
  8291. }
  8292. function genData$1 (el) {
  8293. var data = '';
  8294. if (el.staticStyle) {
  8295. data += "staticStyle:" + (el.staticStyle) + ",";
  8296. }
  8297. if (el.styleBinding) {
  8298. data += "style:(" + (el.styleBinding) + "),";
  8299. }
  8300. return data
  8301. }
  8302. var style$1 = {
  8303. staticKeys: ['staticStyle'],
  8304. transformNode: transformNode$1,
  8305. genData: genData$1
  8306. };
  8307. /* */
  8308. var decoder;
  8309. var he = {
  8310. decode: function decode (html) {
  8311. decoder = decoder || document.createElement('div');
  8312. decoder.innerHTML = html;
  8313. return decoder.textContent
  8314. }
  8315. };
  8316. /* */
  8317. var isUnaryTag = makeMap(
  8318. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  8319. 'link,meta,param,source,track,wbr'
  8320. );
  8321. // Elements that you can, intentionally, leave open
  8322. // (and which close themselves)
  8323. var canBeLeftOpenTag = makeMap(
  8324. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  8325. );
  8326. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  8327. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  8328. var isNonPhrasingTag = makeMap(
  8329. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  8330. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  8331. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  8332. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  8333. 'title,tr,track'
  8334. );
  8335. /**
  8336. * Not type-checking this file because it's mostly vendor code.
  8337. */
  8338. // Regular Expressions for parsing tags and attributes
  8339. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  8340. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  8341. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  8342. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  8343. var startTagOpen = new RegExp(("^<" + qnameCapture));
  8344. var startTagClose = /^\s*(\/?)>/;
  8345. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  8346. var doctype = /^<!DOCTYPE [^>]+>/i;
  8347. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  8348. var comment = /^<!\--/;
  8349. var conditionalComment = /^<!\[/;
  8350. // Special Elements (can contain anything)
  8351. var isPlainTextElement = makeMap('script,style,textarea', true);
  8352. var reCache = {};
  8353. var decodingMap = {
  8354. '&lt;': '<',
  8355. '&gt;': '>',
  8356. '&quot;': '"',
  8357. '&amp;': '&',
  8358. '&#10;': '\n',
  8359. '&#9;': '\t',
  8360. '&#39;': "'"
  8361. };
  8362. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  8363. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  8364. // #5992
  8365. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  8366. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  8367. function decodeAttr (value, shouldDecodeNewlines) {
  8368. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  8369. return value.replace(re, function (match) { return decodingMap[match]; })
  8370. }
  8371. function parseHTML (html, options) {
  8372. var stack = [];
  8373. var expectHTML = options.expectHTML;
  8374. var isUnaryTag$$1 = options.isUnaryTag || no;
  8375. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  8376. var index = 0;
  8377. var last, lastTag;
  8378. while (html) {
  8379. last = html;
  8380. // Make sure we're not in a plaintext content element like script/style
  8381. if (!lastTag || !isPlainTextElement(lastTag)) {
  8382. var textEnd = html.indexOf('<');
  8383. if (textEnd === 0) {
  8384. // Comment:
  8385. if (comment.test(html)) {
  8386. var commentEnd = html.indexOf('-->');
  8387. if (commentEnd >= 0) {
  8388. if (options.shouldKeepComment) {
  8389. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  8390. }
  8391. advance(commentEnd + 3);
  8392. continue
  8393. }
  8394. }
  8395. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  8396. if (conditionalComment.test(html)) {
  8397. var conditionalEnd = html.indexOf(']>');
  8398. if (conditionalEnd >= 0) {
  8399. advance(conditionalEnd + 2);
  8400. continue
  8401. }
  8402. }
  8403. // Doctype:
  8404. var doctypeMatch = html.match(doctype);
  8405. if (doctypeMatch) {
  8406. advance(doctypeMatch[0].length);
  8407. continue
  8408. }
  8409. // End tag:
  8410. var endTagMatch = html.match(endTag);
  8411. if (endTagMatch) {
  8412. var curIndex = index;
  8413. advance(endTagMatch[0].length);
  8414. parseEndTag(endTagMatch[1], curIndex, index);
  8415. continue
  8416. }
  8417. // Start tag:
  8418. var startTagMatch = parseStartTag();
  8419. if (startTagMatch) {
  8420. handleStartTag(startTagMatch);
  8421. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  8422. advance(1);
  8423. }
  8424. continue
  8425. }
  8426. }
  8427. var text = (void 0), rest = (void 0), next = (void 0);
  8428. if (textEnd >= 0) {
  8429. rest = html.slice(textEnd);
  8430. while (
  8431. !endTag.test(rest) &&
  8432. !startTagOpen.test(rest) &&
  8433. !comment.test(rest) &&
  8434. !conditionalComment.test(rest)
  8435. ) {
  8436. // < in plain text, be forgiving and treat it as text
  8437. next = rest.indexOf('<', 1);
  8438. if (next < 0) { break }
  8439. textEnd += next;
  8440. rest = html.slice(textEnd);
  8441. }
  8442. text = html.substring(0, textEnd);
  8443. }
  8444. if (textEnd < 0) {
  8445. text = html;
  8446. }
  8447. if (text) {
  8448. advance(text.length);
  8449. }
  8450. if (options.chars && text) {
  8451. options.chars(text, index - text.length, index);
  8452. }
  8453. } else {
  8454. var endTagLength = 0;
  8455. var stackedTag = lastTag.toLowerCase();
  8456. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  8457. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  8458. endTagLength = endTag.length;
  8459. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  8460. text = text
  8461. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  8462. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  8463. }
  8464. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  8465. text = text.slice(1);
  8466. }
  8467. if (options.chars) {
  8468. options.chars(text);
  8469. }
  8470. return ''
  8471. });
  8472. index += html.length - rest$1.length;
  8473. html = rest$1;
  8474. parseEndTag(stackedTag, index - endTagLength, index);
  8475. }
  8476. if (html === last) {
  8477. options.chars && options.chars(html);
  8478. if (!stack.length && options.warn) {
  8479. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  8480. }
  8481. break
  8482. }
  8483. }
  8484. // Clean up any remaining tags
  8485. parseEndTag();
  8486. function advance (n) {
  8487. index += n;
  8488. html = html.substring(n);
  8489. }
  8490. function parseStartTag () {
  8491. var start = html.match(startTagOpen);
  8492. if (start) {
  8493. var match = {
  8494. tagName: start[1],
  8495. attrs: [],
  8496. start: index
  8497. };
  8498. advance(start[0].length);
  8499. var end, attr;
  8500. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  8501. attr.start = index;
  8502. advance(attr[0].length);
  8503. attr.end = index;
  8504. match.attrs.push(attr);
  8505. }
  8506. if (end) {
  8507. match.unarySlash = end[1];
  8508. advance(end[0].length);
  8509. match.end = index;
  8510. return match
  8511. }
  8512. }
  8513. }
  8514. function handleStartTag (match) {
  8515. var tagName = match.tagName;
  8516. var unarySlash = match.unarySlash;
  8517. if (expectHTML) {
  8518. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  8519. parseEndTag(lastTag);
  8520. }
  8521. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  8522. parseEndTag(tagName);
  8523. }
  8524. }
  8525. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  8526. var l = match.attrs.length;
  8527. var attrs = new Array(l);
  8528. for (var i = 0; i < l; i++) {
  8529. var args = match.attrs[i];
  8530. var value = args[3] || args[4] || args[5] || '';
  8531. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  8532. ? options.shouldDecodeNewlinesForHref
  8533. : options.shouldDecodeNewlines;
  8534. attrs[i] = {
  8535. name: args[1],
  8536. value: decodeAttr(value, shouldDecodeNewlines)
  8537. };
  8538. if (options.outputSourceRange) {
  8539. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  8540. attrs[i].end = args.end;
  8541. }
  8542. }
  8543. if (!unary) {
  8544. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  8545. lastTag = tagName;
  8546. }
  8547. if (options.start) {
  8548. options.start(tagName, attrs, unary, match.start, match.end);
  8549. }
  8550. }
  8551. function parseEndTag (tagName, start, end) {
  8552. var pos, lowerCasedTagName;
  8553. if (start == null) { start = index; }
  8554. if (end == null) { end = index; }
  8555. // Find the closest opened tag of the same type
  8556. if (tagName) {
  8557. lowerCasedTagName = tagName.toLowerCase();
  8558. for (pos = stack.length - 1; pos >= 0; pos--) {
  8559. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  8560. break
  8561. }
  8562. }
  8563. } else {
  8564. // If no tag name is provided, clean shop
  8565. pos = 0;
  8566. }
  8567. if (pos >= 0) {
  8568. // Close all the open elements, up the stack
  8569. for (var i = stack.length - 1; i >= pos; i--) {
  8570. if (i > pos || !tagName &&
  8571. options.warn
  8572. ) {
  8573. options.warn(
  8574. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  8575. { start: stack[i].start, end: stack[i].end }
  8576. );
  8577. }
  8578. if (options.end) {
  8579. options.end(stack[i].tag, start, end);
  8580. }
  8581. }
  8582. // Remove the open elements from the stack
  8583. stack.length = pos;
  8584. lastTag = pos && stack[pos - 1].tag;
  8585. } else if (lowerCasedTagName === 'br') {
  8586. if (options.start) {
  8587. options.start(tagName, [], true, start, end);
  8588. }
  8589. } else if (lowerCasedTagName === 'p') {
  8590. if (options.start) {
  8591. options.start(tagName, [], false, start, end);
  8592. }
  8593. if (options.end) {
  8594. options.end(tagName, start, end);
  8595. }
  8596. }
  8597. }
  8598. }
  8599. /* */
  8600. var onRE = /^@|^v-on:/;
  8601. var dirRE = /^v-|^@|^:|^#/;
  8602. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  8603. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  8604. var stripParensRE = /^\(|\)$/g;
  8605. var dynamicArgRE = /^\[.*\]$/;
  8606. var argRE = /:(.*)$/;
  8607. var bindRE = /^:|^\.|^v-bind:/;
  8608. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  8609. var slotRE = /^v-slot(:|$)|^#/;
  8610. var lineBreakRE = /[\r\n]/;
  8611. var whitespaceRE$1 = /\s+/g;
  8612. var invalidAttributeRE = /[\s"'<>\/=]/;
  8613. var decodeHTMLCached = cached(he.decode);
  8614. var emptySlotScopeToken = "_empty_";
  8615. // configurable state
  8616. var warn$2;
  8617. var delimiters;
  8618. var transforms;
  8619. var preTransforms;
  8620. var postTransforms;
  8621. var platformIsPreTag;
  8622. var platformMustUseProp;
  8623. var platformGetTagNamespace;
  8624. var maybeComponent;
  8625. function createASTElement (
  8626. tag,
  8627. attrs,
  8628. parent
  8629. ) {
  8630. return {
  8631. type: 1,
  8632. tag: tag,
  8633. attrsList: attrs,
  8634. attrsMap: makeAttrsMap(attrs),
  8635. rawAttrsMap: {},
  8636. parent: parent,
  8637. children: []
  8638. }
  8639. }
  8640. /**
  8641. * Convert HTML string to AST.
  8642. */
  8643. function parse (
  8644. template,
  8645. options
  8646. ) {
  8647. warn$2 = options.warn || baseWarn;
  8648. platformIsPreTag = options.isPreTag || no;
  8649. platformMustUseProp = options.mustUseProp || no;
  8650. platformGetTagNamespace = options.getTagNamespace || no;
  8651. var isReservedTag = options.isReservedTag || no;
  8652. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  8653. transforms = pluckModuleFunction(options.modules, 'transformNode');
  8654. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  8655. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  8656. delimiters = options.delimiters;
  8657. var stack = [];
  8658. var preserveWhitespace = options.preserveWhitespace !== false;
  8659. var whitespaceOption = options.whitespace;
  8660. var root;
  8661. var currentParent;
  8662. var inVPre = false;
  8663. var inPre = false;
  8664. var warned = false;
  8665. function warnOnce (msg, range) {
  8666. if (!warned) {
  8667. warned = true;
  8668. warn$2(msg, range);
  8669. }
  8670. }
  8671. function closeElement (element) {
  8672. trimEndingWhitespace(element);
  8673. if (!inVPre && !element.processed) {
  8674. element = processElement(element, options);
  8675. }
  8676. // tree management
  8677. if (!stack.length && element !== root) {
  8678. // allow root elements with v-if, v-else-if and v-else
  8679. if (root.if && (element.elseif || element.else)) {
  8680. {
  8681. checkRootConstraints(element);
  8682. }
  8683. addIfCondition(root, {
  8684. exp: element.elseif,
  8685. block: element
  8686. });
  8687. } else {
  8688. warnOnce(
  8689. "Component template should contain exactly one root element. " +
  8690. "If you are using v-if on multiple elements, " +
  8691. "use v-else-if to chain them instead.",
  8692. { start: element.start }
  8693. );
  8694. }
  8695. }
  8696. if (currentParent && !element.forbidden) {
  8697. if (element.elseif || element.else) {
  8698. processIfConditions(element, currentParent);
  8699. } else {
  8700. if (element.slotScope) {
  8701. // scoped slot
  8702. // keep it in the children list so that v-else(-if) conditions can
  8703. // find it as the prev node.
  8704. var name = element.slotTarget || '"default"'
  8705. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  8706. }
  8707. currentParent.children.push(element);
  8708. element.parent = currentParent;
  8709. }
  8710. }
  8711. // final children cleanup
  8712. // filter out scoped slots
  8713. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  8714. // remove trailing whitespace node again
  8715. trimEndingWhitespace(element);
  8716. // check pre state
  8717. if (element.pre) {
  8718. inVPre = false;
  8719. }
  8720. if (platformIsPreTag(element.tag)) {
  8721. inPre = false;
  8722. }
  8723. // apply post-transforms
  8724. for (var i = 0; i < postTransforms.length; i++) {
  8725. postTransforms[i](element, options);
  8726. }
  8727. }
  8728. function trimEndingWhitespace (el) {
  8729. // remove trailing whitespace node
  8730. if (!inPre) {
  8731. var lastNode;
  8732. while (
  8733. (lastNode = el.children[el.children.length - 1]) &&
  8734. lastNode.type === 3 &&
  8735. lastNode.text === ' '
  8736. ) {
  8737. el.children.pop();
  8738. }
  8739. }
  8740. }
  8741. function checkRootConstraints (el) {
  8742. if (el.tag === 'slot' || el.tag === 'template') {
  8743. warnOnce(
  8744. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  8745. 'contain multiple nodes.',
  8746. { start: el.start }
  8747. );
  8748. }
  8749. if (el.attrsMap.hasOwnProperty('v-for')) {
  8750. warnOnce(
  8751. 'Cannot use v-for on stateful component root element because ' +
  8752. 'it renders multiple elements.',
  8753. el.rawAttrsMap['v-for']
  8754. );
  8755. }
  8756. }
  8757. parseHTML(template, {
  8758. warn: warn$2,
  8759. expectHTML: options.expectHTML,
  8760. isUnaryTag: options.isUnaryTag,
  8761. canBeLeftOpenTag: options.canBeLeftOpenTag,
  8762. shouldDecodeNewlines: options.shouldDecodeNewlines,
  8763. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  8764. shouldKeepComment: options.comments,
  8765. outputSourceRange: options.outputSourceRange,
  8766. start: function start (tag, attrs, unary, start$1, end) {
  8767. // check namespace.
  8768. // inherit parent ns if there is one
  8769. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  8770. // handle IE svg bug
  8771. /* istanbul ignore if */
  8772. if (isIE && ns === 'svg') {
  8773. attrs = guardIESVGBug(attrs);
  8774. }
  8775. var element = createASTElement(tag, attrs, currentParent);
  8776. if (ns) {
  8777. element.ns = ns;
  8778. }
  8779. {
  8780. if (options.outputSourceRange) {
  8781. element.start = start$1;
  8782. element.end = end;
  8783. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  8784. cumulated[attr.name] = attr;
  8785. return cumulated
  8786. }, {});
  8787. }
  8788. attrs.forEach(function (attr) {
  8789. if (invalidAttributeRE.test(attr.name)) {
  8790. warn$2(
  8791. "Invalid dynamic argument expression: attribute names cannot contain " +
  8792. "spaces, quotes, <, >, / or =.",
  8793. {
  8794. start: attr.start + attr.name.indexOf("["),
  8795. end: attr.start + attr.name.length
  8796. }
  8797. );
  8798. }
  8799. });
  8800. }
  8801. if (isForbiddenTag(element) && !isServerRendering()) {
  8802. element.forbidden = true;
  8803. warn$2(
  8804. 'Templates should only be responsible for mapping the state to the ' +
  8805. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  8806. "<" + tag + ">" + ', as they will not be parsed.',
  8807. { start: element.start }
  8808. );
  8809. }
  8810. // apply pre-transforms
  8811. for (var i = 0; i < preTransforms.length; i++) {
  8812. element = preTransforms[i](element, options) || element;
  8813. }
  8814. if (!inVPre) {
  8815. processPre(element);
  8816. if (element.pre) {
  8817. inVPre = true;
  8818. }
  8819. }
  8820. if (platformIsPreTag(element.tag)) {
  8821. inPre = true;
  8822. }
  8823. if (inVPre) {
  8824. processRawAttrs(element);
  8825. } else if (!element.processed) {
  8826. // structural directives
  8827. processFor(element);
  8828. processIf(element);
  8829. processOnce(element);
  8830. }
  8831. if (!root) {
  8832. root = element;
  8833. {
  8834. checkRootConstraints(root);
  8835. }
  8836. }
  8837. if (!unary) {
  8838. currentParent = element;
  8839. stack.push(element);
  8840. } else {
  8841. closeElement(element);
  8842. }
  8843. },
  8844. end: function end (tag, start, end$1) {
  8845. var element = stack[stack.length - 1];
  8846. // pop stack
  8847. stack.length -= 1;
  8848. currentParent = stack[stack.length - 1];
  8849. if (options.outputSourceRange) {
  8850. element.end = end$1;
  8851. }
  8852. closeElement(element);
  8853. },
  8854. chars: function chars (text, start, end) {
  8855. if (!currentParent) {
  8856. {
  8857. if (text === template) {
  8858. warnOnce(
  8859. 'Component template requires a root element, rather than just text.',
  8860. { start: start }
  8861. );
  8862. } else if ((text = text.trim())) {
  8863. warnOnce(
  8864. ("text \"" + text + "\" outside root element will be ignored."),
  8865. { start: start }
  8866. );
  8867. }
  8868. }
  8869. return
  8870. }
  8871. // IE textarea placeholder bug
  8872. /* istanbul ignore if */
  8873. if (isIE &&
  8874. currentParent.tag === 'textarea' &&
  8875. currentParent.attrsMap.placeholder === text
  8876. ) {
  8877. return
  8878. }
  8879. var children = currentParent.children;
  8880. if (inPre || text.trim()) {
  8881. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  8882. } else if (!children.length) {
  8883. // remove the whitespace-only node right after an opening tag
  8884. text = '';
  8885. } else if (whitespaceOption) {
  8886. if (whitespaceOption === 'condense') {
  8887. // in condense mode, remove the whitespace node if it contains
  8888. // line break, otherwise condense to a single space
  8889. text = lineBreakRE.test(text) ? '' : ' ';
  8890. } else {
  8891. text = ' ';
  8892. }
  8893. } else {
  8894. text = preserveWhitespace ? ' ' : '';
  8895. }
  8896. if (text) {
  8897. if (!inPre && whitespaceOption === 'condense') {
  8898. // condense consecutive whitespaces into single space
  8899. text = text.replace(whitespaceRE$1, ' ');
  8900. }
  8901. var res;
  8902. var child;
  8903. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  8904. child = {
  8905. type: 2,
  8906. expression: res.expression,
  8907. tokens: res.tokens,
  8908. text: text
  8909. };
  8910. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  8911. child = {
  8912. type: 3,
  8913. text: text
  8914. };
  8915. }
  8916. if (child) {
  8917. if (options.outputSourceRange) {
  8918. child.start = start;
  8919. child.end = end;
  8920. }
  8921. children.push(child);
  8922. }
  8923. }
  8924. },
  8925. comment: function comment (text, start, end) {
  8926. // adding anything as a sibling to the root node is forbidden
  8927. // comments should still be allowed, but ignored
  8928. if (currentParent) {
  8929. var child = {
  8930. type: 3,
  8931. text: text,
  8932. isComment: true
  8933. };
  8934. if (options.outputSourceRange) {
  8935. child.start = start;
  8936. child.end = end;
  8937. }
  8938. currentParent.children.push(child);
  8939. }
  8940. }
  8941. });
  8942. return root
  8943. }
  8944. function processPre (el) {
  8945. if (getAndRemoveAttr(el, 'v-pre') != null) {
  8946. el.pre = true;
  8947. }
  8948. }
  8949. function processRawAttrs (el) {
  8950. var list = el.attrsList;
  8951. var len = list.length;
  8952. if (len) {
  8953. var attrs = el.attrs = new Array(len);
  8954. for (var i = 0; i < len; i++) {
  8955. attrs[i] = {
  8956. name: list[i].name,
  8957. value: JSON.stringify(list[i].value)
  8958. };
  8959. if (list[i].start != null) {
  8960. attrs[i].start = list[i].start;
  8961. attrs[i].end = list[i].end;
  8962. }
  8963. }
  8964. } else if (!el.pre) {
  8965. // non root node in pre blocks with no attributes
  8966. el.plain = true;
  8967. }
  8968. }
  8969. function processElement (
  8970. element,
  8971. options
  8972. ) {
  8973. processKey(element);
  8974. // determine whether this is a plain element after
  8975. // removing structural attributes
  8976. element.plain = (
  8977. !element.key &&
  8978. !element.scopedSlots &&
  8979. !element.attrsList.length
  8980. );
  8981. processRef(element);
  8982. processSlotContent(element);
  8983. processSlotOutlet(element);
  8984. processComponent(element);
  8985. for (var i = 0; i < transforms.length; i++) {
  8986. element = transforms[i](element, options) || element;
  8987. }
  8988. processAttrs(element);
  8989. return element
  8990. }
  8991. function processKey (el) {
  8992. var exp = getBindingAttr(el, 'key');
  8993. if (exp) {
  8994. {
  8995. if (el.tag === 'template') {
  8996. warn$2(
  8997. "<template> cannot be keyed. Place the key on real elements instead.",
  8998. getRawBindingAttr(el, 'key')
  8999. );
  9000. }
  9001. if (el.for) {
  9002. var iterator = el.iterator2 || el.iterator1;
  9003. var parent = el.parent;
  9004. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  9005. warn$2(
  9006. "Do not use v-for index as key on <transition-group> children, " +
  9007. "this is the same as not using keys.",
  9008. getRawBindingAttr(el, 'key'),
  9009. true /* tip */
  9010. );
  9011. }
  9012. }
  9013. }
  9014. el.key = exp;
  9015. }
  9016. }
  9017. function processRef (el) {
  9018. var ref = getBindingAttr(el, 'ref');
  9019. if (ref) {
  9020. el.ref = ref;
  9021. el.refInFor = checkInFor(el);
  9022. }
  9023. }
  9024. function processFor (el) {
  9025. var exp;
  9026. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  9027. var res = parseFor(exp);
  9028. if (res) {
  9029. extend(el, res);
  9030. } else {
  9031. warn$2(
  9032. ("Invalid v-for expression: " + exp),
  9033. el.rawAttrsMap['v-for']
  9034. );
  9035. }
  9036. }
  9037. }
  9038. function parseFor (exp) {
  9039. var inMatch = exp.match(forAliasRE);
  9040. if (!inMatch) { return }
  9041. var res = {};
  9042. res.for = inMatch[2].trim();
  9043. var alias = inMatch[1].trim().replace(stripParensRE, '');
  9044. var iteratorMatch = alias.match(forIteratorRE);
  9045. if (iteratorMatch) {
  9046. res.alias = alias.replace(forIteratorRE, '').trim();
  9047. res.iterator1 = iteratorMatch[1].trim();
  9048. if (iteratorMatch[2]) {
  9049. res.iterator2 = iteratorMatch[2].trim();
  9050. }
  9051. } else {
  9052. res.alias = alias;
  9053. }
  9054. return res
  9055. }
  9056. function processIf (el) {
  9057. var exp = getAndRemoveAttr(el, 'v-if');
  9058. if (exp) {
  9059. el.if = exp;
  9060. addIfCondition(el, {
  9061. exp: exp,
  9062. block: el
  9063. });
  9064. } else {
  9065. if (getAndRemoveAttr(el, 'v-else') != null) {
  9066. el.else = true;
  9067. }
  9068. var elseif = getAndRemoveAttr(el, 'v-else-if');
  9069. if (elseif) {
  9070. el.elseif = elseif;
  9071. }
  9072. }
  9073. }
  9074. function processIfConditions (el, parent) {
  9075. var prev = findPrevElement(parent.children);
  9076. if (prev && prev.if) {
  9077. addIfCondition(prev, {
  9078. exp: el.elseif,
  9079. block: el
  9080. });
  9081. } else {
  9082. warn$2(
  9083. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  9084. "used on element <" + (el.tag) + "> without corresponding v-if.",
  9085. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  9086. );
  9087. }
  9088. }
  9089. function findPrevElement (children) {
  9090. var i = children.length;
  9091. while (i--) {
  9092. if (children[i].type === 1) {
  9093. return children[i]
  9094. } else {
  9095. if (children[i].text !== ' ') {
  9096. warn$2(
  9097. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  9098. "will be ignored.",
  9099. children[i]
  9100. );
  9101. }
  9102. children.pop();
  9103. }
  9104. }
  9105. }
  9106. function addIfCondition (el, condition) {
  9107. if (!el.ifConditions) {
  9108. el.ifConditions = [];
  9109. }
  9110. el.ifConditions.push(condition);
  9111. }
  9112. function processOnce (el) {
  9113. var once$$1 = getAndRemoveAttr(el, 'v-once');
  9114. if (once$$1 != null) {
  9115. el.once = true;
  9116. }
  9117. }
  9118. // handle content being passed to a component as slot,
  9119. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  9120. function processSlotContent (el) {
  9121. var slotScope;
  9122. if (el.tag === 'template') {
  9123. slotScope = getAndRemoveAttr(el, 'scope');
  9124. /* istanbul ignore if */
  9125. if (slotScope) {
  9126. warn$2(
  9127. "the \"scope\" attribute for scoped slots have been deprecated and " +
  9128. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  9129. "can also be used on plain elements in addition to <template> to " +
  9130. "denote scoped slots.",
  9131. el.rawAttrsMap['scope'],
  9132. true
  9133. );
  9134. }
  9135. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  9136. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  9137. /* istanbul ignore if */
  9138. if (el.attrsMap['v-for']) {
  9139. warn$2(
  9140. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  9141. "(v-for takes higher priority). Use a wrapper <template> for the " +
  9142. "scoped slot to make it clearer.",
  9143. el.rawAttrsMap['slot-scope'],
  9144. true
  9145. );
  9146. }
  9147. el.slotScope = slotScope;
  9148. }
  9149. // slot="xxx"
  9150. var slotTarget = getBindingAttr(el, 'slot');
  9151. if (slotTarget) {
  9152. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  9153. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  9154. // preserve slot as an attribute for native shadow DOM compat
  9155. // only for non-scoped slots.
  9156. if (el.tag !== 'template' && !el.slotScope) {
  9157. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  9158. }
  9159. }
  9160. // 2.6 v-slot syntax
  9161. {
  9162. if (el.tag === 'template') {
  9163. // v-slot on <template>
  9164. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  9165. if (slotBinding) {
  9166. {
  9167. if (el.slotTarget || el.slotScope) {
  9168. warn$2(
  9169. "Unexpected mixed usage of different slot syntaxes.",
  9170. el
  9171. );
  9172. }
  9173. if (el.parent && !maybeComponent(el.parent)) {
  9174. warn$2(
  9175. "<template v-slot> can only appear at the root level inside " +
  9176. "the receiving component",
  9177. el
  9178. );
  9179. }
  9180. }
  9181. var ref = getSlotName(slotBinding);
  9182. var name = ref.name;
  9183. var dynamic = ref.dynamic;
  9184. el.slotTarget = name;
  9185. el.slotTargetDynamic = dynamic;
  9186. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  9187. }
  9188. } else {
  9189. // v-slot on component, denotes default slot
  9190. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  9191. if (slotBinding$1) {
  9192. {
  9193. if (!maybeComponent(el)) {
  9194. warn$2(
  9195. "v-slot can only be used on components or <template>.",
  9196. slotBinding$1
  9197. );
  9198. }
  9199. if (el.slotScope || el.slotTarget) {
  9200. warn$2(
  9201. "Unexpected mixed usage of different slot syntaxes.",
  9202. el
  9203. );
  9204. }
  9205. if (el.scopedSlots) {
  9206. warn$2(
  9207. "To avoid scope ambiguity, the default slot should also use " +
  9208. "<template> syntax when there are other named slots.",
  9209. slotBinding$1
  9210. );
  9211. }
  9212. }
  9213. // add the component's children to its default slot
  9214. var slots = el.scopedSlots || (el.scopedSlots = {});
  9215. var ref$1 = getSlotName(slotBinding$1);
  9216. var name$1 = ref$1.name;
  9217. var dynamic$1 = ref$1.dynamic;
  9218. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  9219. slotContainer.slotTarget = name$1;
  9220. slotContainer.slotTargetDynamic = dynamic$1;
  9221. slotContainer.children = el.children.filter(function (c) {
  9222. if (!c.slotScope) {
  9223. c.parent = slotContainer;
  9224. return true
  9225. }
  9226. });
  9227. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  9228. // remove children as they are returned from scopedSlots now
  9229. el.children = [];
  9230. // mark el non-plain so data gets generated
  9231. el.plain = false;
  9232. }
  9233. }
  9234. }
  9235. }
  9236. function getSlotName (binding) {
  9237. var name = binding.name.replace(slotRE, '');
  9238. if (!name) {
  9239. if (binding.name[0] !== '#') {
  9240. name = 'default';
  9241. } else {
  9242. warn$2(
  9243. "v-slot shorthand syntax requires a slot name.",
  9244. binding
  9245. );
  9246. }
  9247. }
  9248. return dynamicArgRE.test(name)
  9249. // dynamic [name]
  9250. ? { name: name.slice(1, -1), dynamic: true }
  9251. // static name
  9252. : { name: ("\"" + name + "\""), dynamic: false }
  9253. }
  9254. // handle <slot/> outlets
  9255. function processSlotOutlet (el) {
  9256. if (el.tag === 'slot') {
  9257. el.slotName = getBindingAttr(el, 'name');
  9258. if (el.key) {
  9259. warn$2(
  9260. "`key` does not work on <slot> because slots are abstract outlets " +
  9261. "and can possibly expand into multiple elements. " +
  9262. "Use the key on a wrapping element instead.",
  9263. getRawBindingAttr(el, 'key')
  9264. );
  9265. }
  9266. }
  9267. }
  9268. function processComponent (el) {
  9269. var binding;
  9270. if ((binding = getBindingAttr(el, 'is'))) {
  9271. el.component = binding;
  9272. }
  9273. if (getAndRemoveAttr(el, 'inline-template') != null) {
  9274. el.inlineTemplate = true;
  9275. }
  9276. }
  9277. function processAttrs (el) {
  9278. var list = el.attrsList;
  9279. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  9280. for (i = 0, l = list.length; i < l; i++) {
  9281. name = rawName = list[i].name;
  9282. value = list[i].value;
  9283. if (dirRE.test(name)) {
  9284. // mark element as dynamic
  9285. el.hasBindings = true;
  9286. // modifiers
  9287. modifiers = parseModifiers(name.replace(dirRE, ''));
  9288. // support .foo shorthand syntax for the .prop modifier
  9289. if (modifiers) {
  9290. name = name.replace(modifierRE, '');
  9291. }
  9292. if (bindRE.test(name)) { // v-bind
  9293. name = name.replace(bindRE, '');
  9294. value = parseFilters(value);
  9295. isDynamic = dynamicArgRE.test(name);
  9296. if (isDynamic) {
  9297. name = name.slice(1, -1);
  9298. }
  9299. if (
  9300. value.trim().length === 0
  9301. ) {
  9302. warn$2(
  9303. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  9304. );
  9305. }
  9306. if (modifiers) {
  9307. if (modifiers.prop && !isDynamic) {
  9308. name = camelize(name);
  9309. if (name === 'innerHtml') { name = 'innerHTML'; }
  9310. }
  9311. if (modifiers.camel && !isDynamic) {
  9312. name = camelize(name);
  9313. }
  9314. if (modifiers.sync) {
  9315. syncGen = genAssignmentCode(value, "$event");
  9316. if (!isDynamic) {
  9317. addHandler(
  9318. el,
  9319. ("update:" + (camelize(name))),
  9320. syncGen,
  9321. null,
  9322. false,
  9323. warn$2,
  9324. list[i]
  9325. );
  9326. if (hyphenate(name) !== camelize(name)) {
  9327. addHandler(
  9328. el,
  9329. ("update:" + (hyphenate(name))),
  9330. syncGen,
  9331. null,
  9332. false,
  9333. warn$2,
  9334. list[i]
  9335. );
  9336. }
  9337. } else {
  9338. // handler w/ dynamic event name
  9339. addHandler(
  9340. el,
  9341. ("\"update:\"+(" + name + ")"),
  9342. syncGen,
  9343. null,
  9344. false,
  9345. warn$2,
  9346. list[i],
  9347. true // dynamic
  9348. );
  9349. }
  9350. }
  9351. }
  9352. if ((modifiers && modifiers.prop) || (
  9353. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  9354. )) {
  9355. addProp(el, name, value, list[i], isDynamic);
  9356. } else {
  9357. addAttr(el, name, value, list[i], isDynamic);
  9358. }
  9359. } else if (onRE.test(name)) { // v-on
  9360. name = name.replace(onRE, '');
  9361. isDynamic = dynamicArgRE.test(name);
  9362. if (isDynamic) {
  9363. name = name.slice(1, -1);
  9364. }
  9365. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  9366. } else { // normal directives
  9367. name = name.replace(dirRE, '');
  9368. // parse arg
  9369. var argMatch = name.match(argRE);
  9370. var arg = argMatch && argMatch[1];
  9371. isDynamic = false;
  9372. if (arg) {
  9373. name = name.slice(0, -(arg.length + 1));
  9374. if (dynamicArgRE.test(arg)) {
  9375. arg = arg.slice(1, -1);
  9376. isDynamic = true;
  9377. }
  9378. }
  9379. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  9380. if (name === 'model') {
  9381. checkForAliasModel(el, value);
  9382. }
  9383. }
  9384. } else {
  9385. // literal attribute
  9386. {
  9387. var res = parseText(value, delimiters);
  9388. if (res) {
  9389. warn$2(
  9390. name + "=\"" + value + "\": " +
  9391. 'Interpolation inside attributes has been removed. ' +
  9392. 'Use v-bind or the colon shorthand instead. For example, ' +
  9393. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  9394. list[i]
  9395. );
  9396. }
  9397. }
  9398. addAttr(el, name, JSON.stringify(value), list[i]);
  9399. // #6887 firefox doesn't update muted state if set via attribute
  9400. // even immediately after element creation
  9401. if (!el.component &&
  9402. name === 'muted' &&
  9403. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  9404. addProp(el, name, 'true', list[i]);
  9405. }
  9406. }
  9407. }
  9408. }
  9409. function checkInFor (el) {
  9410. var parent = el;
  9411. while (parent) {
  9412. if (parent.for !== undefined) {
  9413. return true
  9414. }
  9415. parent = parent.parent;
  9416. }
  9417. return false
  9418. }
  9419. function parseModifiers (name) {
  9420. var match = name.match(modifierRE);
  9421. if (match) {
  9422. var ret = {};
  9423. match.forEach(function (m) { ret[m.slice(1)] = true; });
  9424. return ret
  9425. }
  9426. }
  9427. function makeAttrsMap (attrs) {
  9428. var map = {};
  9429. for (var i = 0, l = attrs.length; i < l; i++) {
  9430. if (
  9431. map[attrs[i].name] && !isIE && !isEdge
  9432. ) {
  9433. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  9434. }
  9435. map[attrs[i].name] = attrs[i].value;
  9436. }
  9437. return map
  9438. }
  9439. // for script (e.g. type="x/template") or style, do not decode content
  9440. function isTextTag (el) {
  9441. return el.tag === 'script' || el.tag === 'style'
  9442. }
  9443. function isForbiddenTag (el) {
  9444. return (
  9445. el.tag === 'style' ||
  9446. (el.tag === 'script' && (
  9447. !el.attrsMap.type ||
  9448. el.attrsMap.type === 'text/javascript'
  9449. ))
  9450. )
  9451. }
  9452. var ieNSBug = /^xmlns:NS\d+/;
  9453. var ieNSPrefix = /^NS\d+:/;
  9454. /* istanbul ignore next */
  9455. function guardIESVGBug (attrs) {
  9456. var res = [];
  9457. for (var i = 0; i < attrs.length; i++) {
  9458. var attr = attrs[i];
  9459. if (!ieNSBug.test(attr.name)) {
  9460. attr.name = attr.name.replace(ieNSPrefix, '');
  9461. res.push(attr);
  9462. }
  9463. }
  9464. return res
  9465. }
  9466. function checkForAliasModel (el, value) {
  9467. var _el = el;
  9468. while (_el) {
  9469. if (_el.for && _el.alias === value) {
  9470. warn$2(
  9471. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  9472. "You are binding v-model directly to a v-for iteration alias. " +
  9473. "This will not be able to modify the v-for source array because " +
  9474. "writing to the alias is like modifying a function local variable. " +
  9475. "Consider using an array of objects and use v-model on an object property instead.",
  9476. el.rawAttrsMap['v-model']
  9477. );
  9478. }
  9479. _el = _el.parent;
  9480. }
  9481. }
  9482. /* */
  9483. function preTransformNode (el, options) {
  9484. if (el.tag === 'input') {
  9485. var map = el.attrsMap;
  9486. if (!map['v-model']) {
  9487. return
  9488. }
  9489. var typeBinding;
  9490. if (map[':type'] || map['v-bind:type']) {
  9491. typeBinding = getBindingAttr(el, 'type');
  9492. }
  9493. if (!map.type && !typeBinding && map['v-bind']) {
  9494. typeBinding = "(" + (map['v-bind']) + ").type";
  9495. }
  9496. if (typeBinding) {
  9497. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  9498. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  9499. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  9500. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  9501. // 1. checkbox
  9502. var branch0 = cloneASTElement(el);
  9503. // process for on the main node
  9504. processFor(branch0);
  9505. addRawAttr(branch0, 'type', 'checkbox');
  9506. processElement(branch0, options);
  9507. branch0.processed = true; // prevent it from double-processed
  9508. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  9509. addIfCondition(branch0, {
  9510. exp: branch0.if,
  9511. block: branch0
  9512. });
  9513. // 2. add radio else-if condition
  9514. var branch1 = cloneASTElement(el);
  9515. getAndRemoveAttr(branch1, 'v-for', true);
  9516. addRawAttr(branch1, 'type', 'radio');
  9517. processElement(branch1, options);
  9518. addIfCondition(branch0, {
  9519. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  9520. block: branch1
  9521. });
  9522. // 3. other
  9523. var branch2 = cloneASTElement(el);
  9524. getAndRemoveAttr(branch2, 'v-for', true);
  9525. addRawAttr(branch2, ':type', typeBinding);
  9526. processElement(branch2, options);
  9527. addIfCondition(branch0, {
  9528. exp: ifCondition,
  9529. block: branch2
  9530. });
  9531. if (hasElse) {
  9532. branch0.else = true;
  9533. } else if (elseIfCondition) {
  9534. branch0.elseif = elseIfCondition;
  9535. }
  9536. return branch0
  9537. }
  9538. }
  9539. }
  9540. function cloneASTElement (el) {
  9541. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  9542. }
  9543. var model$1 = {
  9544. preTransformNode: preTransformNode
  9545. };
  9546. var modules$1 = [
  9547. klass$1,
  9548. style$1,
  9549. model$1
  9550. ];
  9551. /* */
  9552. function text (el, dir) {
  9553. if (dir.value) {
  9554. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  9555. }
  9556. }
  9557. /* */
  9558. function html (el, dir) {
  9559. if (dir.value) {
  9560. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  9561. }
  9562. }
  9563. var directives$1 = {
  9564. model: model,
  9565. text: text,
  9566. html: html
  9567. };
  9568. /* */
  9569. var baseOptions = {
  9570. expectHTML: true,
  9571. modules: modules$1,
  9572. directives: directives$1,
  9573. isPreTag: isPreTag,
  9574. isUnaryTag: isUnaryTag,
  9575. mustUseProp: mustUseProp,
  9576. canBeLeftOpenTag: canBeLeftOpenTag,
  9577. isReservedTag: isReservedTag,
  9578. getTagNamespace: getTagNamespace,
  9579. staticKeys: genStaticKeys(modules$1)
  9580. };
  9581. /* */
  9582. var isStaticKey;
  9583. var isPlatformReservedTag;
  9584. var genStaticKeysCached = cached(genStaticKeys$1);
  9585. /**
  9586. * Goal of the optimizer: walk the generated template AST tree
  9587. * and detect sub-trees that are purely static, i.e. parts of
  9588. * the DOM that never needs to change.
  9589. *
  9590. * Once we detect these sub-trees, we can:
  9591. *
  9592. * 1. Hoist them into constants, so that we no longer need to
  9593. * create fresh nodes for them on each re-render;
  9594. * 2. Completely skip them in the patching process.
  9595. */
  9596. function optimize (root, options) {
  9597. if (!root) { return }
  9598. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  9599. isPlatformReservedTag = options.isReservedTag || no;
  9600. // first pass: mark all non-static nodes.
  9601. markStatic$1(root);
  9602. // second pass: mark static roots.
  9603. markStaticRoots(root, false);
  9604. }
  9605. function genStaticKeys$1 (keys) {
  9606. return makeMap(
  9607. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  9608. (keys ? ',' + keys : '')
  9609. )
  9610. }
  9611. function markStatic$1 (node) {
  9612. node.static = isStatic(node);
  9613. if (node.type === 1) {
  9614. // do not make component slot content static. this avoids
  9615. // 1. components not able to mutate slot nodes
  9616. // 2. static slot content fails for hot-reloading
  9617. if (
  9618. !isPlatformReservedTag(node.tag) &&
  9619. node.tag !== 'slot' &&
  9620. node.attrsMap['inline-template'] == null
  9621. ) {
  9622. return
  9623. }
  9624. for (var i = 0, l = node.children.length; i < l; i++) {
  9625. var child = node.children[i];
  9626. markStatic$1(child);
  9627. if (!child.static) {
  9628. node.static = false;
  9629. }
  9630. }
  9631. if (node.ifConditions) {
  9632. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  9633. var block = node.ifConditions[i$1].block;
  9634. markStatic$1(block);
  9635. if (!block.static) {
  9636. node.static = false;
  9637. }
  9638. }
  9639. }
  9640. }
  9641. }
  9642. function markStaticRoots (node, isInFor) {
  9643. if (node.type === 1) {
  9644. if (node.static || node.once) {
  9645. node.staticInFor = isInFor;
  9646. }
  9647. // For a node to qualify as a static root, it should have children that
  9648. // are not just static text. Otherwise the cost of hoisting out will
  9649. // outweigh the benefits and it's better off to just always render it fresh.
  9650. if (node.static && node.children.length && !(
  9651. node.children.length === 1 &&
  9652. node.children[0].type === 3
  9653. )) {
  9654. node.staticRoot = true;
  9655. return
  9656. } else {
  9657. node.staticRoot = false;
  9658. }
  9659. if (node.children) {
  9660. for (var i = 0, l = node.children.length; i < l; i++) {
  9661. markStaticRoots(node.children[i], isInFor || !!node.for);
  9662. }
  9663. }
  9664. if (node.ifConditions) {
  9665. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  9666. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  9667. }
  9668. }
  9669. }
  9670. }
  9671. function isStatic (node) {
  9672. if (node.type === 2) { // expression
  9673. return false
  9674. }
  9675. if (node.type === 3) { // text
  9676. return true
  9677. }
  9678. return !!(node.pre || (
  9679. !node.hasBindings && // no dynamic bindings
  9680. !node.if && !node.for && // not v-if or v-for or v-else
  9681. !isBuiltInTag(node.tag) && // not a built-in
  9682. isPlatformReservedTag(node.tag) && // not a component
  9683. !isDirectChildOfTemplateFor(node) &&
  9684. Object.keys(node).every(isStaticKey)
  9685. ))
  9686. }
  9687. function isDirectChildOfTemplateFor (node) {
  9688. while (node.parent) {
  9689. node = node.parent;
  9690. if (node.tag !== 'template') {
  9691. return false
  9692. }
  9693. if (node.for) {
  9694. return true
  9695. }
  9696. }
  9697. return false
  9698. }
  9699. /* */
  9700. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  9701. var fnInvokeRE = /\([^)]*?\);*$/;
  9702. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  9703. // KeyboardEvent.keyCode aliases
  9704. var keyCodes = {
  9705. esc: 27,
  9706. tab: 9,
  9707. enter: 13,
  9708. space: 32,
  9709. up: 38,
  9710. left: 37,
  9711. right: 39,
  9712. down: 40,
  9713. 'delete': [8, 46]
  9714. };
  9715. // KeyboardEvent.key aliases
  9716. var keyNames = {
  9717. // #7880: IE11 and Edge use `Esc` for Escape key name.
  9718. esc: ['Esc', 'Escape'],
  9719. tab: 'Tab',
  9720. enter: 'Enter',
  9721. // #9112: IE11 uses `Spacebar` for Space key name.
  9722. space: [' ', 'Spacebar'],
  9723. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  9724. up: ['Up', 'ArrowUp'],
  9725. left: ['Left', 'ArrowLeft'],
  9726. right: ['Right', 'ArrowRight'],
  9727. down: ['Down', 'ArrowDown'],
  9728. // #9112: IE11 uses `Del` for Delete key name.
  9729. 'delete': ['Backspace', 'Delete', 'Del']
  9730. };
  9731. // #4868: modifiers that prevent the execution of the listener
  9732. // need to explicitly return null so that we can determine whether to remove
  9733. // the listener for .once
  9734. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  9735. var modifierCode = {
  9736. stop: '$event.stopPropagation();',
  9737. prevent: '$event.preventDefault();',
  9738. self: genGuard("$event.target !== $event.currentTarget"),
  9739. ctrl: genGuard("!$event.ctrlKey"),
  9740. shift: genGuard("!$event.shiftKey"),
  9741. alt: genGuard("!$event.altKey"),
  9742. meta: genGuard("!$event.metaKey"),
  9743. left: genGuard("'button' in $event && $event.button !== 0"),
  9744. middle: genGuard("'button' in $event && $event.button !== 1"),
  9745. right: genGuard("'button' in $event && $event.button !== 2")
  9746. };
  9747. function genHandlers (
  9748. events,
  9749. isNative
  9750. ) {
  9751. var prefix = isNative ? 'nativeOn:' : 'on:';
  9752. var staticHandlers = "";
  9753. var dynamicHandlers = "";
  9754. for (var name in events) {
  9755. var handlerCode = genHandler(events[name]);
  9756. if (events[name] && events[name].dynamic) {
  9757. dynamicHandlers += name + "," + handlerCode + ",";
  9758. } else {
  9759. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  9760. }
  9761. }
  9762. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  9763. if (dynamicHandlers) {
  9764. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  9765. } else {
  9766. return prefix + staticHandlers
  9767. }
  9768. }
  9769. function genHandler (handler) {
  9770. if (!handler) {
  9771. return 'function(){}'
  9772. }
  9773. if (Array.isArray(handler)) {
  9774. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  9775. }
  9776. var isMethodPath = simplePathRE.test(handler.value);
  9777. var isFunctionExpression = fnExpRE.test(handler.value);
  9778. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  9779. if (!handler.modifiers) {
  9780. if (isMethodPath || isFunctionExpression) {
  9781. return handler.value
  9782. }
  9783. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  9784. } else {
  9785. var code = '';
  9786. var genModifierCode = '';
  9787. var keys = [];
  9788. for (var key in handler.modifiers) {
  9789. if (modifierCode[key]) {
  9790. genModifierCode += modifierCode[key];
  9791. // left/right
  9792. if (keyCodes[key]) {
  9793. keys.push(key);
  9794. }
  9795. } else if (key === 'exact') {
  9796. var modifiers = (handler.modifiers);
  9797. genModifierCode += genGuard(
  9798. ['ctrl', 'shift', 'alt', 'meta']
  9799. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  9800. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  9801. .join('||')
  9802. );
  9803. } else {
  9804. keys.push(key);
  9805. }
  9806. }
  9807. if (keys.length) {
  9808. code += genKeyFilter(keys);
  9809. }
  9810. // Make sure modifiers like prevent and stop get executed after key filtering
  9811. if (genModifierCode) {
  9812. code += genModifierCode;
  9813. }
  9814. var handlerCode = isMethodPath
  9815. ? ("return " + (handler.value) + "($event)")
  9816. : isFunctionExpression
  9817. ? ("return (" + (handler.value) + ")($event)")
  9818. : isFunctionInvocation
  9819. ? ("return " + (handler.value))
  9820. : handler.value;
  9821. return ("function($event){" + code + handlerCode + "}")
  9822. }
  9823. }
  9824. function genKeyFilter (keys) {
  9825. return (
  9826. // make sure the key filters only apply to KeyboardEvents
  9827. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  9828. // key events that do not have keyCode property...
  9829. "if(!$event.type.indexOf('key')&&" +
  9830. (keys.map(genFilterCode).join('&&')) + ")return null;"
  9831. )
  9832. }
  9833. function genFilterCode (key) {
  9834. var keyVal = parseInt(key, 10);
  9835. if (keyVal) {
  9836. return ("$event.keyCode!==" + keyVal)
  9837. }
  9838. var keyCode = keyCodes[key];
  9839. var keyName = keyNames[key];
  9840. return (
  9841. "_k($event.keyCode," +
  9842. (JSON.stringify(key)) + "," +
  9843. (JSON.stringify(keyCode)) + "," +
  9844. "$event.key," +
  9845. "" + (JSON.stringify(keyName)) +
  9846. ")"
  9847. )
  9848. }
  9849. /* */
  9850. function on (el, dir) {
  9851. if (dir.modifiers) {
  9852. warn("v-on without argument does not support modifiers.");
  9853. }
  9854. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  9855. }
  9856. /* */
  9857. function bind$1 (el, dir) {
  9858. el.wrapData = function (code) {
  9859. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  9860. };
  9861. }
  9862. /* */
  9863. var baseDirectives = {
  9864. on: on,
  9865. bind: bind$1,
  9866. cloak: noop
  9867. };
  9868. /* */
  9869. var CodegenState = function CodegenState (options) {
  9870. this.options = options;
  9871. this.warn = options.warn || baseWarn;
  9872. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  9873. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  9874. this.directives = extend(extend({}, baseDirectives), options.directives);
  9875. var isReservedTag = options.isReservedTag || no;
  9876. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  9877. this.onceId = 0;
  9878. this.staticRenderFns = [];
  9879. this.pre = false;
  9880. };
  9881. function generate (
  9882. ast,
  9883. options
  9884. ) {
  9885. var state = new CodegenState(options);
  9886. var code = ast ? genElement(ast, state) : '_c("div")';
  9887. return {
  9888. render: ("with(this){return " + code + "}"),
  9889. staticRenderFns: state.staticRenderFns
  9890. }
  9891. }
  9892. function genElement (el, state) {
  9893. if (el.parent) {
  9894. el.pre = el.pre || el.parent.pre;
  9895. }
  9896. if (el.staticRoot && !el.staticProcessed) {
  9897. return genStatic(el, state)
  9898. } else if (el.once && !el.onceProcessed) {
  9899. return genOnce(el, state)
  9900. } else if (el.for && !el.forProcessed) {
  9901. return genFor(el, state)
  9902. } else if (el.if && !el.ifProcessed) {
  9903. return genIf(el, state)
  9904. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  9905. return genChildren(el, state) || 'void 0'
  9906. } else if (el.tag === 'slot') {
  9907. return genSlot(el, state)
  9908. } else {
  9909. // component or element
  9910. var code;
  9911. if (el.component) {
  9912. code = genComponent(el.component, el, state);
  9913. } else {
  9914. var data;
  9915. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  9916. data = genData$2(el, state);
  9917. }
  9918. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  9919. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  9920. }
  9921. // module transforms
  9922. for (var i = 0; i < state.transforms.length; i++) {
  9923. code = state.transforms[i](el, code);
  9924. }
  9925. return code
  9926. }
  9927. }
  9928. // hoist static sub-trees out
  9929. function genStatic (el, state) {
  9930. el.staticProcessed = true;
  9931. // Some elements (templates) need to behave differently inside of a v-pre
  9932. // node. All pre nodes are static roots, so we can use this as a location to
  9933. // wrap a state change and reset it upon exiting the pre node.
  9934. var originalPreState = state.pre;
  9935. if (el.pre) {
  9936. state.pre = el.pre;
  9937. }
  9938. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  9939. state.pre = originalPreState;
  9940. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  9941. }
  9942. // v-once
  9943. function genOnce (el, state) {
  9944. el.onceProcessed = true;
  9945. if (el.if && !el.ifProcessed) {
  9946. return genIf(el, state)
  9947. } else if (el.staticInFor) {
  9948. var key = '';
  9949. var parent = el.parent;
  9950. while (parent) {
  9951. if (parent.for) {
  9952. key = parent.key;
  9953. break
  9954. }
  9955. parent = parent.parent;
  9956. }
  9957. if (!key) {
  9958. state.warn(
  9959. "v-once can only be used inside v-for that is keyed. ",
  9960. el.rawAttrsMap['v-once']
  9961. );
  9962. return genElement(el, state)
  9963. }
  9964. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  9965. } else {
  9966. return genStatic(el, state)
  9967. }
  9968. }
  9969. function genIf (
  9970. el,
  9971. state,
  9972. altGen,
  9973. altEmpty
  9974. ) {
  9975. el.ifProcessed = true; // avoid recursion
  9976. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  9977. }
  9978. function genIfConditions (
  9979. conditions,
  9980. state,
  9981. altGen,
  9982. altEmpty
  9983. ) {
  9984. if (!conditions.length) {
  9985. return altEmpty || '_e()'
  9986. }
  9987. var condition = conditions.shift();
  9988. if (condition.exp) {
  9989. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  9990. } else {
  9991. return ("" + (genTernaryExp(condition.block)))
  9992. }
  9993. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  9994. function genTernaryExp (el) {
  9995. return altGen
  9996. ? altGen(el, state)
  9997. : el.once
  9998. ? genOnce(el, state)
  9999. : genElement(el, state)
  10000. }
  10001. }
  10002. function genFor (
  10003. el,
  10004. state,
  10005. altGen,
  10006. altHelper
  10007. ) {
  10008. var exp = el.for;
  10009. var alias = el.alias;
  10010. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  10011. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  10012. if (state.maybeComponent(el) &&
  10013. el.tag !== 'slot' &&
  10014. el.tag !== 'template' &&
  10015. !el.key
  10016. ) {
  10017. state.warn(
  10018. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  10019. "v-for should have explicit keys. " +
  10020. "See https://vuejs.org/guide/list.html#key for more info.",
  10021. el.rawAttrsMap['v-for'],
  10022. true /* tip */
  10023. );
  10024. }
  10025. el.forProcessed = true; // avoid recursion
  10026. return (altHelper || '_l') + "((" + exp + ")," +
  10027. "function(" + alias + iterator1 + iterator2 + "){" +
  10028. "return " + ((altGen || genElement)(el, state)) +
  10029. '})'
  10030. }
  10031. function genData$2 (el, state) {
  10032. var data = '{';
  10033. // directives first.
  10034. // directives may mutate the el's other properties before they are generated.
  10035. var dirs = genDirectives(el, state);
  10036. if (dirs) { data += dirs + ','; }
  10037. // key
  10038. if (el.key) {
  10039. data += "key:" + (el.key) + ",";
  10040. }
  10041. // ref
  10042. if (el.ref) {
  10043. data += "ref:" + (el.ref) + ",";
  10044. }
  10045. if (el.refInFor) {
  10046. data += "refInFor:true,";
  10047. }
  10048. // pre
  10049. if (el.pre) {
  10050. data += "pre:true,";
  10051. }
  10052. // record original tag name for components using "is" attribute
  10053. if (el.component) {
  10054. data += "tag:\"" + (el.tag) + "\",";
  10055. }
  10056. // module data generation functions
  10057. for (var i = 0; i < state.dataGenFns.length; i++) {
  10058. data += state.dataGenFns[i](el);
  10059. }
  10060. // attributes
  10061. if (el.attrs) {
  10062. data += "attrs:" + (genProps(el.attrs)) + ",";
  10063. }
  10064. // DOM props
  10065. if (el.props) {
  10066. data += "domProps:" + (genProps(el.props)) + ",";
  10067. }
  10068. // event handlers
  10069. if (el.events) {
  10070. data += (genHandlers(el.events, false)) + ",";
  10071. }
  10072. if (el.nativeEvents) {
  10073. data += (genHandlers(el.nativeEvents, true)) + ",";
  10074. }
  10075. // slot target
  10076. // only for non-scoped slots
  10077. if (el.slotTarget && !el.slotScope) {
  10078. data += "slot:" + (el.slotTarget) + ",";
  10079. }
  10080. // scoped slots
  10081. if (el.scopedSlots) {
  10082. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  10083. }
  10084. // component v-model
  10085. if (el.model) {
  10086. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  10087. }
  10088. // inline-template
  10089. if (el.inlineTemplate) {
  10090. var inlineTemplate = genInlineTemplate(el, state);
  10091. if (inlineTemplate) {
  10092. data += inlineTemplate + ",";
  10093. }
  10094. }
  10095. data = data.replace(/,$/, '') + '}';
  10096. // v-bind dynamic argument wrap
  10097. // v-bind with dynamic arguments must be applied using the same v-bind object
  10098. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  10099. if (el.dynamicAttrs) {
  10100. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  10101. }
  10102. // v-bind data wrap
  10103. if (el.wrapData) {
  10104. data = el.wrapData(data);
  10105. }
  10106. // v-on data wrap
  10107. if (el.wrapListeners) {
  10108. data = el.wrapListeners(data);
  10109. }
  10110. return data
  10111. }
  10112. function genDirectives (el, state) {
  10113. var dirs = el.directives;
  10114. if (!dirs) { return }
  10115. var res = 'directives:[';
  10116. var hasRuntime = false;
  10117. var i, l, dir, needRuntime;
  10118. for (i = 0, l = dirs.length; i < l; i++) {
  10119. dir = dirs[i];
  10120. needRuntime = true;
  10121. var gen = state.directives[dir.name];
  10122. if (gen) {
  10123. // compile-time directive that manipulates AST.
  10124. // returns true if it also needs a runtime counterpart.
  10125. needRuntime = !!gen(el, dir, state.warn);
  10126. }
  10127. if (needRuntime) {
  10128. hasRuntime = true;
  10129. 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))) : '') + "},";
  10130. }
  10131. }
  10132. if (hasRuntime) {
  10133. return res.slice(0, -1) + ']'
  10134. }
  10135. }
  10136. function genInlineTemplate (el, state) {
  10137. var ast = el.children[0];
  10138. if (el.children.length !== 1 || ast.type !== 1) {
  10139. state.warn(
  10140. 'Inline-template components must have exactly one child element.',
  10141. { start: el.start }
  10142. );
  10143. }
  10144. if (ast && ast.type === 1) {
  10145. var inlineRenderFns = generate(ast, state.options);
  10146. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  10147. }
  10148. }
  10149. function genScopedSlots (
  10150. el,
  10151. slots,
  10152. state
  10153. ) {
  10154. // by default scoped slots are considered "stable", this allows child
  10155. // components with only scoped slots to skip forced updates from parent.
  10156. // but in some cases we have to bail-out of this optimization
  10157. // for example if the slot contains dynamic names, has v-if or v-for on them...
  10158. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  10159. var slot = slots[key];
  10160. return (
  10161. slot.slotTargetDynamic ||
  10162. slot.if ||
  10163. slot.for ||
  10164. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  10165. )
  10166. });
  10167. // #9534: if a component with scoped slots is inside a conditional branch,
  10168. // it's possible for the same component to be reused but with different
  10169. // compiled slot content. To avoid that, we generate a unique key based on
  10170. // the generated code of all the slot contents.
  10171. var needsKey = !!el.if;
  10172. // OR when it is inside another scoped slot or v-for (the reactivity may be
  10173. // disconnected due to the intermediate scope variable)
  10174. // #9438, #9506
  10175. // TODO: this can be further optimized by properly analyzing in-scope bindings
  10176. // and skip force updating ones that do not actually use scope variables.
  10177. if (!needsForceUpdate) {
  10178. var parent = el.parent;
  10179. while (parent) {
  10180. if (
  10181. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  10182. parent.for
  10183. ) {
  10184. needsForceUpdate = true;
  10185. break
  10186. }
  10187. if (parent.if) {
  10188. needsKey = true;
  10189. }
  10190. parent = parent.parent;
  10191. }
  10192. }
  10193. var generatedSlots = Object.keys(slots)
  10194. .map(function (key) { return genScopedSlot(slots[key], state); })
  10195. .join(',');
  10196. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  10197. }
  10198. function hash(str) {
  10199. var hash = 5381;
  10200. var i = str.length;
  10201. while(i) {
  10202. hash = (hash * 33) ^ str.charCodeAt(--i);
  10203. }
  10204. return hash >>> 0
  10205. }
  10206. function containsSlotChild (el) {
  10207. if (el.type === 1) {
  10208. if (el.tag === 'slot') {
  10209. return true
  10210. }
  10211. return el.children.some(containsSlotChild)
  10212. }
  10213. return false
  10214. }
  10215. function genScopedSlot (
  10216. el,
  10217. state
  10218. ) {
  10219. var isLegacySyntax = el.attrsMap['slot-scope'];
  10220. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  10221. return genIf(el, state, genScopedSlot, "null")
  10222. }
  10223. if (el.for && !el.forProcessed) {
  10224. return genFor(el, state, genScopedSlot)
  10225. }
  10226. var slotScope = el.slotScope === emptySlotScopeToken
  10227. ? ""
  10228. : String(el.slotScope);
  10229. var fn = "function(" + slotScope + "){" +
  10230. "return " + (el.tag === 'template'
  10231. ? el.if && isLegacySyntax
  10232. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  10233. : genChildren(el, state) || 'undefined'
  10234. : genElement(el, state)) + "}";
  10235. // reverse proxy v-slot without scope on this.$slots
  10236. var reverseProxy = slotScope ? "" : ",proxy:true";
  10237. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  10238. }
  10239. function genChildren (
  10240. el,
  10241. state,
  10242. checkSkip,
  10243. altGenElement,
  10244. altGenNode
  10245. ) {
  10246. var children = el.children;
  10247. if (children.length) {
  10248. var el$1 = children[0];
  10249. // optimize single v-for
  10250. if (children.length === 1 &&
  10251. el$1.for &&
  10252. el$1.tag !== 'template' &&
  10253. el$1.tag !== 'slot'
  10254. ) {
  10255. var normalizationType = checkSkip
  10256. ? state.maybeComponent(el$1) ? ",1" : ",0"
  10257. : "";
  10258. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  10259. }
  10260. var normalizationType$1 = checkSkip
  10261. ? getNormalizationType(children, state.maybeComponent)
  10262. : 0;
  10263. var gen = altGenNode || genNode;
  10264. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  10265. }
  10266. }
  10267. // determine the normalization needed for the children array.
  10268. // 0: no normalization needed
  10269. // 1: simple normalization needed (possible 1-level deep nested array)
  10270. // 2: full normalization needed
  10271. function getNormalizationType (
  10272. children,
  10273. maybeComponent
  10274. ) {
  10275. var res = 0;
  10276. for (var i = 0; i < children.length; i++) {
  10277. var el = children[i];
  10278. if (el.type !== 1) {
  10279. continue
  10280. }
  10281. if (needsNormalization(el) ||
  10282. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  10283. res = 2;
  10284. break
  10285. }
  10286. if (maybeComponent(el) ||
  10287. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  10288. res = 1;
  10289. }
  10290. }
  10291. return res
  10292. }
  10293. function needsNormalization (el) {
  10294. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  10295. }
  10296. function genNode (node, state) {
  10297. if (node.type === 1) {
  10298. return genElement(node, state)
  10299. } else if (node.type === 3 && node.isComment) {
  10300. return genComment(node)
  10301. } else {
  10302. return genText(node)
  10303. }
  10304. }
  10305. function genText (text) {
  10306. return ("_v(" + (text.type === 2
  10307. ? text.expression // no need for () because already wrapped in _s()
  10308. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  10309. }
  10310. function genComment (comment) {
  10311. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  10312. }
  10313. function genSlot (el, state) {
  10314. var slotName = el.slotName || '"default"';
  10315. var children = genChildren(el, state);
  10316. var res = "_t(" + slotName + (children ? ("," + children) : '');
  10317. var attrs = el.attrs || el.dynamicAttrs
  10318. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  10319. // slot props are camelized
  10320. name: camelize(attr.name),
  10321. value: attr.value,
  10322. dynamic: attr.dynamic
  10323. }); }))
  10324. : null;
  10325. var bind$$1 = el.attrsMap['v-bind'];
  10326. if ((attrs || bind$$1) && !children) {
  10327. res += ",null";
  10328. }
  10329. if (attrs) {
  10330. res += "," + attrs;
  10331. }
  10332. if (bind$$1) {
  10333. res += (attrs ? '' : ',null') + "," + bind$$1;
  10334. }
  10335. return res + ')'
  10336. }
  10337. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  10338. function genComponent (
  10339. componentName,
  10340. el,
  10341. state
  10342. ) {
  10343. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  10344. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  10345. }
  10346. function genProps (props) {
  10347. var staticProps = "";
  10348. var dynamicProps = "";
  10349. for (var i = 0; i < props.length; i++) {
  10350. var prop = props[i];
  10351. var value = transformSpecialNewlines(prop.value);
  10352. if (prop.dynamic) {
  10353. dynamicProps += (prop.name) + "," + value + ",";
  10354. } else {
  10355. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  10356. }
  10357. }
  10358. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  10359. if (dynamicProps) {
  10360. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  10361. } else {
  10362. return staticProps
  10363. }
  10364. }
  10365. // #3895, #4268
  10366. function transformSpecialNewlines (text) {
  10367. return text
  10368. .replace(/\u2028/g, '\\u2028')
  10369. .replace(/\u2029/g, '\\u2029')
  10370. }
  10371. /* */
  10372. // these keywords should not appear inside expressions, but operators like
  10373. // typeof, instanceof and in are allowed
  10374. var prohibitedKeywordRE = new RegExp('\\b' + (
  10375. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  10376. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  10377. 'extends,finally,continue,debugger,function,arguments'
  10378. ).split(',').join('\\b|\\b') + '\\b');
  10379. // these unary operators should not be used as property/method names
  10380. var unaryOperatorsRE = new RegExp('\\b' + (
  10381. 'delete,typeof,void'
  10382. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  10383. // strip strings in expressions
  10384. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  10385. // detect problematic expressions in a template
  10386. function detectErrors (ast, warn) {
  10387. if (ast) {
  10388. checkNode(ast, warn);
  10389. }
  10390. }
  10391. function checkNode (node, warn) {
  10392. if (node.type === 1) {
  10393. for (var name in node.attrsMap) {
  10394. if (dirRE.test(name)) {
  10395. var value = node.attrsMap[name];
  10396. if (value) {
  10397. var range = node.rawAttrsMap[name];
  10398. if (name === 'v-for') {
  10399. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  10400. } else if (name === 'v-slot' || name[0] === '#') {
  10401. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  10402. } else if (onRE.test(name)) {
  10403. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  10404. } else {
  10405. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  10406. }
  10407. }
  10408. }
  10409. }
  10410. if (node.children) {
  10411. for (var i = 0; i < node.children.length; i++) {
  10412. checkNode(node.children[i], warn);
  10413. }
  10414. }
  10415. } else if (node.type === 2) {
  10416. checkExpression(node.expression, node.text, warn, node);
  10417. }
  10418. }
  10419. function checkEvent (exp, text, warn, range) {
  10420. var stripped = exp.replace(stripStringRE, '');
  10421. var keywordMatch = stripped.match(unaryOperatorsRE);
  10422. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  10423. warn(
  10424. "avoid using JavaScript unary operator as property name: " +
  10425. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  10426. range
  10427. );
  10428. }
  10429. checkExpression(exp, text, warn, range);
  10430. }
  10431. function checkFor (node, text, warn, range) {
  10432. checkExpression(node.for || '', text, warn, range);
  10433. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  10434. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  10435. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  10436. }
  10437. function checkIdentifier (
  10438. ident,
  10439. type,
  10440. text,
  10441. warn,
  10442. range
  10443. ) {
  10444. if (typeof ident === 'string') {
  10445. try {
  10446. new Function(("var " + ident + "=_"));
  10447. } catch (e) {
  10448. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  10449. }
  10450. }
  10451. }
  10452. function checkExpression (exp, text, warn, range) {
  10453. try {
  10454. new Function(("return " + exp));
  10455. } catch (e) {
  10456. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  10457. if (keywordMatch) {
  10458. warn(
  10459. "avoid using JavaScript keyword as property name: " +
  10460. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  10461. range
  10462. );
  10463. } else {
  10464. warn(
  10465. "invalid expression: " + (e.message) + " in\n\n" +
  10466. " " + exp + "\n\n" +
  10467. " Raw expression: " + (text.trim()) + "\n",
  10468. range
  10469. );
  10470. }
  10471. }
  10472. }
  10473. function checkFunctionParameterExpression (exp, text, warn, range) {
  10474. try {
  10475. new Function(exp, '');
  10476. } catch (e) {
  10477. warn(
  10478. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  10479. " " + exp + "\n\n" +
  10480. " Raw expression: " + (text.trim()) + "\n",
  10481. range
  10482. );
  10483. }
  10484. }
  10485. /* */
  10486. var range = 2;
  10487. function generateCodeFrame (
  10488. source,
  10489. start,
  10490. end
  10491. ) {
  10492. if ( start === void 0 ) start = 0;
  10493. if ( end === void 0 ) end = source.length;
  10494. var lines = source.split(/\r?\n/);
  10495. var count = 0;
  10496. var res = [];
  10497. for (var i = 0; i < lines.length; i++) {
  10498. count += lines[i].length + 1;
  10499. if (count >= start) {
  10500. for (var j = i - range; j <= i + range || end > count; j++) {
  10501. if (j < 0 || j >= lines.length) { continue }
  10502. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  10503. var lineLength = lines[j].length;
  10504. if (j === i) {
  10505. // push underline
  10506. var pad = start - (count - lineLength) + 1;
  10507. var length = end > count ? lineLength - pad : end - start;
  10508. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  10509. } else if (j > i) {
  10510. if (end > count) {
  10511. var length$1 = Math.min(end - count, lineLength);
  10512. res.push(" | " + repeat$1("^", length$1));
  10513. }
  10514. count += lineLength + 1;
  10515. }
  10516. }
  10517. break
  10518. }
  10519. }
  10520. return res.join('\n')
  10521. }
  10522. function repeat$1 (str, n) {
  10523. var result = '';
  10524. if (n > 0) {
  10525. while (true) { // eslint-disable-line
  10526. if (n & 1) { result += str; }
  10527. n >>>= 1;
  10528. if (n <= 0) { break }
  10529. str += str;
  10530. }
  10531. }
  10532. return result
  10533. }
  10534. /* */
  10535. function createFunction (code, errors) {
  10536. try {
  10537. return new Function(code)
  10538. } catch (err) {
  10539. errors.push({ err: err, code: code });
  10540. return noop
  10541. }
  10542. }
  10543. function createCompileToFunctionFn (compile) {
  10544. var cache = Object.create(null);
  10545. return function compileToFunctions (
  10546. template,
  10547. options,
  10548. vm
  10549. ) {
  10550. options = extend({}, options);
  10551. var warn$$1 = options.warn || warn;
  10552. delete options.warn;
  10553. /* istanbul ignore if */
  10554. {
  10555. // detect possible CSP restriction
  10556. try {
  10557. new Function('return 1');
  10558. } catch (e) {
  10559. if (e.toString().match(/unsafe-eval|CSP/)) {
  10560. warn$$1(
  10561. 'It seems you are using the standalone build of Vue.js in an ' +
  10562. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  10563. 'The template compiler cannot work in this environment. Consider ' +
  10564. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  10565. 'templates into render functions.'
  10566. );
  10567. }
  10568. }
  10569. }
  10570. // check cache
  10571. var key = options.delimiters
  10572. ? String(options.delimiters) + template
  10573. : template;
  10574. if (cache[key]) {
  10575. return cache[key]
  10576. }
  10577. // compile
  10578. var compiled = compile(template, options);
  10579. // check compilation errors/tips
  10580. {
  10581. if (compiled.errors && compiled.errors.length) {
  10582. if (options.outputSourceRange) {
  10583. compiled.errors.forEach(function (e) {
  10584. warn$$1(
  10585. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  10586. generateCodeFrame(template, e.start, e.end),
  10587. vm
  10588. );
  10589. });
  10590. } else {
  10591. warn$$1(
  10592. "Error compiling template:\n\n" + template + "\n\n" +
  10593. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  10594. vm
  10595. );
  10596. }
  10597. }
  10598. if (compiled.tips && compiled.tips.length) {
  10599. if (options.outputSourceRange) {
  10600. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  10601. } else {
  10602. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  10603. }
  10604. }
  10605. }
  10606. // turn code into functions
  10607. var res = {};
  10608. var fnGenErrors = [];
  10609. res.render = createFunction(compiled.render, fnGenErrors);
  10610. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  10611. return createFunction(code, fnGenErrors)
  10612. });
  10613. // check function generation errors.
  10614. // this should only happen if there is a bug in the compiler itself.
  10615. // mostly for codegen development use
  10616. /* istanbul ignore if */
  10617. {
  10618. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  10619. warn$$1(
  10620. "Failed to generate render function:\n\n" +
  10621. fnGenErrors.map(function (ref) {
  10622. var err = ref.err;
  10623. var code = ref.code;
  10624. return ((err.toString()) + " in\n\n" + code + "\n");
  10625. }).join('\n'),
  10626. vm
  10627. );
  10628. }
  10629. }
  10630. return (cache[key] = res)
  10631. }
  10632. }
  10633. /* */
  10634. function createCompilerCreator (baseCompile) {
  10635. return function createCompiler (baseOptions) {
  10636. function compile (
  10637. template,
  10638. options
  10639. ) {
  10640. var finalOptions = Object.create(baseOptions);
  10641. var errors = [];
  10642. var tips = [];
  10643. var warn = function (msg, range, tip) {
  10644. (tip ? tips : errors).push(msg);
  10645. };
  10646. if (options) {
  10647. if (options.outputSourceRange) {
  10648. // $flow-disable-line
  10649. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  10650. warn = function (msg, range, tip) {
  10651. var data = { msg: msg };
  10652. if (range) {
  10653. if (range.start != null) {
  10654. data.start = range.start + leadingSpaceLength;
  10655. }
  10656. if (range.end != null) {
  10657. data.end = range.end + leadingSpaceLength;
  10658. }
  10659. }
  10660. (tip ? tips : errors).push(data);
  10661. };
  10662. }
  10663. // merge custom modules
  10664. if (options.modules) {
  10665. finalOptions.modules =
  10666. (baseOptions.modules || []).concat(options.modules);
  10667. }
  10668. // merge custom directives
  10669. if (options.directives) {
  10670. finalOptions.directives = extend(
  10671. Object.create(baseOptions.directives || null),
  10672. options.directives
  10673. );
  10674. }
  10675. // copy other options
  10676. for (var key in options) {
  10677. if (key !== 'modules' && key !== 'directives') {
  10678. finalOptions[key] = options[key];
  10679. }
  10680. }
  10681. }
  10682. finalOptions.warn = warn;
  10683. var compiled = baseCompile(template.trim(), finalOptions);
  10684. {
  10685. detectErrors(compiled.ast, warn);
  10686. }
  10687. compiled.errors = errors;
  10688. compiled.tips = tips;
  10689. return compiled
  10690. }
  10691. return {
  10692. compile: compile,
  10693. compileToFunctions: createCompileToFunctionFn(compile)
  10694. }
  10695. }
  10696. }
  10697. /* */
  10698. // `createCompilerCreator` allows creating compilers that use alternative
  10699. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  10700. // Here we just export a default compiler using the default parts.
  10701. var createCompiler = createCompilerCreator(function baseCompile (
  10702. template,
  10703. options
  10704. ) {
  10705. var ast = parse(template.trim(), options);
  10706. if (options.optimize !== false) {
  10707. optimize(ast, options);
  10708. }
  10709. var code = generate(ast, options);
  10710. return {
  10711. ast: ast,
  10712. render: code.render,
  10713. staticRenderFns: code.staticRenderFns
  10714. }
  10715. });
  10716. /* */
  10717. var ref$1 = createCompiler(baseOptions);
  10718. var compile = ref$1.compile;
  10719. var compileToFunctions = ref$1.compileToFunctions;
  10720. /* */
  10721. // check whether current browser encodes a char inside attribute values
  10722. var div;
  10723. function getShouldDecode (href) {
  10724. div = div || document.createElement('div');
  10725. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  10726. return div.innerHTML.indexOf('&#10;') > 0
  10727. }
  10728. // #3663: IE encodes newlines inside attribute values while other browsers don't
  10729. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  10730. // #6828: chrome encodes content in a[href]
  10731. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  10732. /* */
  10733. var idToTemplate = cached(function (id) {
  10734. var el = query(id);
  10735. return el && el.innerHTML
  10736. });
  10737. var mount = Vue.prototype.$mount;
  10738. Vue.prototype.$mount = function (
  10739. el,
  10740. hydrating
  10741. ) {
  10742. el = el && query(el);
  10743. /* istanbul ignore if */
  10744. if (el === document.body || el === document.documentElement) {
  10745. warn(
  10746. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  10747. );
  10748. return this
  10749. }
  10750. var options = this.$options;
  10751. // resolve template/el and convert to render function
  10752. if (!options.render) {
  10753. var template = options.template;
  10754. if (template) {
  10755. if (typeof template === 'string') {
  10756. if (template.charAt(0) === '#') {
  10757. template = idToTemplate(template);
  10758. /* istanbul ignore if */
  10759. if (!template) {
  10760. warn(
  10761. ("Template element not found or is empty: " + (options.template)),
  10762. this
  10763. );
  10764. }
  10765. }
  10766. } else if (template.nodeType) {
  10767. template = template.innerHTML;
  10768. } else {
  10769. {
  10770. warn('invalid template option:' + template, this);
  10771. }
  10772. return this
  10773. }
  10774. } else if (el) {
  10775. template = getOuterHTML(el);
  10776. }
  10777. if (template) {
  10778. /* istanbul ignore if */
  10779. if (config.performance && mark) {
  10780. mark('compile');
  10781. }
  10782. var ref = compileToFunctions(template, {
  10783. outputSourceRange: "development" !== 'production',
  10784. shouldDecodeNewlines: shouldDecodeNewlines,
  10785. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  10786. delimiters: options.delimiters,
  10787. comments: options.comments
  10788. }, this);
  10789. var render = ref.render;
  10790. var staticRenderFns = ref.staticRenderFns;
  10791. options.render = render;
  10792. options.staticRenderFns = staticRenderFns;
  10793. /* istanbul ignore if */
  10794. if (config.performance && mark) {
  10795. mark('compile end');
  10796. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  10797. }
  10798. }
  10799. }
  10800. return mount.call(this, el, hydrating)
  10801. };
  10802. /**
  10803. * Get outerHTML of elements, taking care
  10804. * of SVG elements in IE as well.
  10805. */
  10806. function getOuterHTML (el) {
  10807. if (el.outerHTML) {
  10808. return el.outerHTML
  10809. } else {
  10810. var container = document.createElement('div');
  10811. container.appendChild(el.cloneNode(true));
  10812. return container.innerHTML
  10813. }
  10814. }
  10815. Vue.compile = compileToFunctions;
  10816. return Vue;
  10817. }));