Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vue.common.dev.js 312KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938
  1. /*!
  2. * Vue.js v2.6.10
  3. * (c) 2014-2019 Evan You
  4. * Released under the MIT License.
  5. */
  6. 'use strict';
  7. /* */
  8. var emptyObject = Object.freeze({});
  9. // These helpers produce better VM code in JS engines due to their
  10. // explicitness and function inlining.
  11. function isUndef (v) {
  12. return v === undefined || v === null
  13. }
  14. function isDef (v) {
  15. return v !== undefined && v !== null
  16. }
  17. function isTrue (v) {
  18. return v === true
  19. }
  20. function isFalse (v) {
  21. return v === false
  22. }
  23. /**
  24. * Check if value is primitive.
  25. */
  26. function isPrimitive (value) {
  27. return (
  28. typeof value === 'string' ||
  29. typeof value === 'number' ||
  30. // $flow-disable-line
  31. typeof value === 'symbol' ||
  32. typeof value === 'boolean'
  33. )
  34. }
  35. /**
  36. * Quick object check - this is primarily used to tell
  37. * Objects from primitive values when we know the value
  38. * is a JSON-compliant type.
  39. */
  40. function isObject (obj) {
  41. return obj !== null && typeof obj === 'object'
  42. }
  43. /**
  44. * Get the raw type string of a value, e.g., [object Object].
  45. */
  46. var _toString = Object.prototype.toString;
  47. function toRawType (value) {
  48. return _toString.call(value).slice(8, -1)
  49. }
  50. /**
  51. * Strict object type check. Only returns true
  52. * for plain JavaScript objects.
  53. */
  54. function isPlainObject (obj) {
  55. return _toString.call(obj) === '[object Object]'
  56. }
  57. function isRegExp (v) {
  58. return _toString.call(v) === '[object RegExp]'
  59. }
  60. /**
  61. * Check if val is a valid array index.
  62. */
  63. function isValidArrayIndex (val) {
  64. var n = parseFloat(String(val));
  65. return n >= 0 && Math.floor(n) === n && isFinite(val)
  66. }
  67. function isPromise (val) {
  68. return (
  69. isDef(val) &&
  70. typeof val.then === 'function' &&
  71. typeof val.catch === 'function'
  72. )
  73. }
  74. /**
  75. * Convert a value to a string that is actually rendered.
  76. */
  77. function toString (val) {
  78. return val == null
  79. ? ''
  80. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  81. ? JSON.stringify(val, null, 2)
  82. : String(val)
  83. }
  84. /**
  85. * Convert an input value to a number for persistence.
  86. * If the conversion fails, return original string.
  87. */
  88. function toNumber (val) {
  89. var n = parseFloat(val);
  90. return isNaN(n) ? val : n
  91. }
  92. /**
  93. * Make a map and return a function for checking if a key
  94. * is in that map.
  95. */
  96. function makeMap (
  97. str,
  98. expectsLowerCase
  99. ) {
  100. var map = Object.create(null);
  101. var list = str.split(',');
  102. for (var i = 0; i < list.length; i++) {
  103. map[list[i]] = true;
  104. }
  105. return expectsLowerCase
  106. ? function (val) { return map[val.toLowerCase()]; }
  107. : function (val) { return map[val]; }
  108. }
  109. /**
  110. * Check if a tag is a built-in tag.
  111. */
  112. var isBuiltInTag = makeMap('slot,component', true);
  113. /**
  114. * Check if an attribute is a reserved attribute.
  115. */
  116. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  117. /**
  118. * Remove an item from an array.
  119. */
  120. function remove (arr, item) {
  121. if (arr.length) {
  122. var index = arr.indexOf(item);
  123. if (index > -1) {
  124. return arr.splice(index, 1)
  125. }
  126. }
  127. }
  128. /**
  129. * Check whether an object has the property.
  130. */
  131. var hasOwnProperty = Object.prototype.hasOwnProperty;
  132. function hasOwn (obj, key) {
  133. return hasOwnProperty.call(obj, key)
  134. }
  135. /**
  136. * Create a cached version of a pure function.
  137. */
  138. function cached (fn) {
  139. var cache = Object.create(null);
  140. return (function cachedFn (str) {
  141. var hit = cache[str];
  142. return hit || (cache[str] = fn(str))
  143. })
  144. }
  145. /**
  146. * Camelize a hyphen-delimited string.
  147. */
  148. var camelizeRE = /-(\w)/g;
  149. var camelize = cached(function (str) {
  150. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  151. });
  152. /**
  153. * Capitalize a string.
  154. */
  155. var capitalize = cached(function (str) {
  156. return str.charAt(0).toUpperCase() + str.slice(1)
  157. });
  158. /**
  159. * Hyphenate a camelCase string.
  160. */
  161. var hyphenateRE = /\B([A-Z])/g;
  162. var hyphenate = cached(function (str) {
  163. return str.replace(hyphenateRE, '-$1').toLowerCase()
  164. });
  165. /**
  166. * Simple bind polyfill for environments that do not support it,
  167. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  168. * since native bind is now performant enough in most browsers.
  169. * But removing it would mean breaking code that was able to run in
  170. * PhantomJS 1.x, so this must be kept for backward compatibility.
  171. */
  172. /* istanbul ignore next */
  173. function polyfillBind (fn, ctx) {
  174. function boundFn (a) {
  175. var l = arguments.length;
  176. return l
  177. ? l > 1
  178. ? fn.apply(ctx, arguments)
  179. : fn.call(ctx, a)
  180. : fn.call(ctx)
  181. }
  182. boundFn._length = fn.length;
  183. return boundFn
  184. }
  185. function nativeBind (fn, ctx) {
  186. return fn.bind(ctx)
  187. }
  188. var bind = Function.prototype.bind
  189. ? nativeBind
  190. : polyfillBind;
  191. /**
  192. * Convert an Array-like object to a real Array.
  193. */
  194. function toArray (list, start) {
  195. start = start || 0;
  196. var i = list.length - start;
  197. var ret = new Array(i);
  198. while (i--) {
  199. ret[i] = list[i + start];
  200. }
  201. return ret
  202. }
  203. /**
  204. * Mix properties into target object.
  205. */
  206. function extend (to, _from) {
  207. for (var key in _from) {
  208. to[key] = _from[key];
  209. }
  210. return to
  211. }
  212. /**
  213. * Merge an Array of Objects into a single Object.
  214. */
  215. function toObject (arr) {
  216. var res = {};
  217. for (var i = 0; i < arr.length; i++) {
  218. if (arr[i]) {
  219. extend(res, arr[i]);
  220. }
  221. }
  222. return res
  223. }
  224. /* eslint-disable no-unused-vars */
  225. /**
  226. * Perform no operation.
  227. * Stubbing args to make Flow happy without leaving useless transpiled code
  228. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  229. */
  230. function noop (a, b, c) {}
  231. /**
  232. * Always return false.
  233. */
  234. var no = function (a, b, c) { return false; };
  235. /* eslint-enable no-unused-vars */
  236. /**
  237. * Return the same value.
  238. */
  239. var identity = function (_) { return _; };
  240. /**
  241. * Generate a string containing static keys from compiler modules.
  242. */
  243. function genStaticKeys (modules) {
  244. return modules.reduce(function (keys, m) {
  245. return keys.concat(m.staticKeys || [])
  246. }, []).join(',')
  247. }
  248. /**
  249. * Check if two values are loosely equal - that is,
  250. * if they are plain objects, do they have the same shape?
  251. */
  252. function looseEqual (a, b) {
  253. if (a === b) { return true }
  254. var isObjectA = isObject(a);
  255. var isObjectB = isObject(b);
  256. if (isObjectA && isObjectB) {
  257. try {
  258. var isArrayA = Array.isArray(a);
  259. var isArrayB = Array.isArray(b);
  260. if (isArrayA && isArrayB) {
  261. return a.length === b.length && a.every(function (e, i) {
  262. return looseEqual(e, b[i])
  263. })
  264. } else if (a instanceof Date && b instanceof Date) {
  265. return a.getTime() === b.getTime()
  266. } else if (!isArrayA && !isArrayB) {
  267. var keysA = Object.keys(a);
  268. var keysB = Object.keys(b);
  269. return keysA.length === keysB.length && keysA.every(function (key) {
  270. return looseEqual(a[key], b[key])
  271. })
  272. } else {
  273. /* istanbul ignore next */
  274. return false
  275. }
  276. } catch (e) {
  277. /* istanbul ignore next */
  278. return false
  279. }
  280. } else if (!isObjectA && !isObjectB) {
  281. return String(a) === String(b)
  282. } else {
  283. return false
  284. }
  285. }
  286. /**
  287. * Return the first index at which a loosely equal value can be
  288. * found in the array (if value is a plain object, the array must
  289. * contain an object of the same shape), or -1 if it is not present.
  290. */
  291. function looseIndexOf (arr, val) {
  292. for (var i = 0; i < arr.length; i++) {
  293. if (looseEqual(arr[i], val)) { return i }
  294. }
  295. return -1
  296. }
  297. /**
  298. * Ensure a function is called only once.
  299. */
  300. function once (fn) {
  301. var called = false;
  302. return function () {
  303. if (!called) {
  304. called = true;
  305. fn.apply(this, arguments);
  306. }
  307. }
  308. }
  309. var SSR_ATTR = 'data-server-rendered';
  310. var ASSET_TYPES = [
  311. 'component',
  312. 'directive',
  313. 'filter'
  314. ];
  315. var LIFECYCLE_HOOKS = [
  316. 'beforeCreate',
  317. 'created',
  318. 'beforeMount',
  319. 'mounted',
  320. 'beforeUpdate',
  321. 'updated',
  322. 'beforeDestroy',
  323. 'destroyed',
  324. 'activated',
  325. 'deactivated',
  326. 'errorCaptured',
  327. 'serverPrefetch'
  328. ];
  329. /* */
  330. var config = ({
  331. /**
  332. * Option merge strategies (used in core/util/options)
  333. */
  334. // $flow-disable-line
  335. optionMergeStrategies: Object.create(null),
  336. /**
  337. * Whether to suppress warnings.
  338. */
  339. silent: false,
  340. /**
  341. * Show production mode tip message on boot?
  342. */
  343. productionTip: "development" !== 'production',
  344. /**
  345. * Whether to enable devtools
  346. */
  347. devtools: "development" !== 'production',
  348. /**
  349. * Whether to record perf
  350. */
  351. performance: false,
  352. /**
  353. * Error handler for watcher errors
  354. */
  355. errorHandler: null,
  356. /**
  357. * Warn handler for watcher warns
  358. */
  359. warnHandler: null,
  360. /**
  361. * Ignore certain custom elements
  362. */
  363. ignoredElements: [],
  364. /**
  365. * Custom user key aliases for v-on
  366. */
  367. // $flow-disable-line
  368. keyCodes: Object.create(null),
  369. /**
  370. * Check if a tag is reserved so that it cannot be registered as a
  371. * component. This is platform-dependent and may be overwritten.
  372. */
  373. isReservedTag: no,
  374. /**
  375. * Check if an attribute is reserved so that it cannot be used as a component
  376. * prop. This is platform-dependent and may be overwritten.
  377. */
  378. isReservedAttr: no,
  379. /**
  380. * Check if a tag is an unknown element.
  381. * Platform-dependent.
  382. */
  383. isUnknownElement: no,
  384. /**
  385. * Get the namespace of an element
  386. */
  387. getTagNamespace: noop,
  388. /**
  389. * Parse the real tag name for the specific platform.
  390. */
  391. parsePlatformTagName: identity,
  392. /**
  393. * Check if an attribute must be bound using property, e.g. value
  394. * Platform-dependent.
  395. */
  396. mustUseProp: no,
  397. /**
  398. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  399. * This will significantly reduce performance if set to false.
  400. */
  401. async: true,
  402. /**
  403. * Exposed for legacy reasons
  404. */
  405. _lifecycleHooks: LIFECYCLE_HOOKS
  406. });
  407. /* */
  408. /**
  409. * unicode letters used for parsing html tags, component names and property paths.
  410. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  411. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  412. */
  413. 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/;
  414. /**
  415. * Check if a string starts with $ or _
  416. */
  417. function isReserved (str) {
  418. var c = (str + '').charCodeAt(0);
  419. return c === 0x24 || c === 0x5F
  420. }
  421. /**
  422. * Define a property.
  423. */
  424. function def (obj, key, val, enumerable) {
  425. Object.defineProperty(obj, key, {
  426. value: val,
  427. enumerable: !!enumerable,
  428. writable: true,
  429. configurable: true
  430. });
  431. }
  432. /**
  433. * Parse simple path.
  434. */
  435. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  436. function parsePath (path) {
  437. if (bailRE.test(path)) {
  438. return
  439. }
  440. var segments = path.split('.');
  441. return function (obj) {
  442. for (var i = 0; i < segments.length; i++) {
  443. if (!obj) { return }
  444. obj = obj[segments[i]];
  445. }
  446. return obj
  447. }
  448. }
  449. /* */
  450. // can we use __proto__?
  451. var hasProto = '__proto__' in {};
  452. // Browser environment sniffing
  453. var inBrowser = typeof window !== 'undefined';
  454. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  455. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  456. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  457. var isIE = UA && /msie|trident/.test(UA);
  458. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  459. var isEdge = UA && UA.indexOf('edge/') > 0;
  460. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  461. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  462. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  463. var isPhantomJS = UA && /phantomjs/.test(UA);
  464. var isFF = UA && UA.match(/firefox\/(\d+)/);
  465. // Firefox has a "watch" function on Object.prototype...
  466. var nativeWatch = ({}).watch;
  467. var supportsPassive = false;
  468. if (inBrowser) {
  469. try {
  470. var opts = {};
  471. Object.defineProperty(opts, 'passive', ({
  472. get: function get () {
  473. /* istanbul ignore next */
  474. supportsPassive = true;
  475. }
  476. })); // https://github.com/facebook/flow/issues/285
  477. window.addEventListener('test-passive', null, opts);
  478. } catch (e) {}
  479. }
  480. // this needs to be lazy-evaled because vue may be required before
  481. // vue-server-renderer can set VUE_ENV
  482. var _isServer;
  483. var isServerRendering = function () {
  484. if (_isServer === undefined) {
  485. /* istanbul ignore if */
  486. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  487. // detect presence of vue-server-renderer and avoid
  488. // Webpack shimming the process
  489. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  490. } else {
  491. _isServer = false;
  492. }
  493. }
  494. return _isServer
  495. };
  496. // detect devtools
  497. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  498. /* istanbul ignore next */
  499. function isNative (Ctor) {
  500. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  501. }
  502. var hasSymbol =
  503. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  504. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  505. var _Set;
  506. /* istanbul ignore if */ // $flow-disable-line
  507. if (typeof Set !== 'undefined' && isNative(Set)) {
  508. // use native Set when available.
  509. _Set = Set;
  510. } else {
  511. // a non-standard Set polyfill that only works with primitive keys.
  512. _Set = /*@__PURE__*/(function () {
  513. function Set () {
  514. this.set = Object.create(null);
  515. }
  516. Set.prototype.has = function has (key) {
  517. return this.set[key] === true
  518. };
  519. Set.prototype.add = function add (key) {
  520. this.set[key] = true;
  521. };
  522. Set.prototype.clear = function clear () {
  523. this.set = Object.create(null);
  524. };
  525. return Set;
  526. }());
  527. }
  528. /* */
  529. var warn = noop;
  530. var tip = noop;
  531. var generateComponentTrace = (noop); // work around flow check
  532. var formatComponentName = (noop);
  533. {
  534. var hasConsole = typeof console !== 'undefined';
  535. var classifyRE = /(?:^|[-_])(\w)/g;
  536. var classify = function (str) { return str
  537. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  538. .replace(/[-_]/g, ''); };
  539. warn = function (msg, vm) {
  540. var trace = vm ? generateComponentTrace(vm) : '';
  541. if (config.warnHandler) {
  542. config.warnHandler.call(null, msg, vm, trace);
  543. } else if (hasConsole && (!config.silent)) {
  544. console.error(("[Vue warn]: " + msg + trace));
  545. }
  546. };
  547. tip = function (msg, vm) {
  548. if (hasConsole && (!config.silent)) {
  549. console.warn("[Vue tip]: " + msg + (
  550. vm ? generateComponentTrace(vm) : ''
  551. ));
  552. }
  553. };
  554. formatComponentName = function (vm, includeFile) {
  555. if (vm.$root === vm) {
  556. return '<Root>'
  557. }
  558. var options = typeof vm === 'function' && vm.cid != null
  559. ? vm.options
  560. : vm._isVue
  561. ? vm.$options || vm.constructor.options
  562. : vm;
  563. var name = options.name || options._componentTag;
  564. var file = options.__file;
  565. if (!name && file) {
  566. var match = file.match(/([^/\\]+)\.vue$/);
  567. name = match && match[1];
  568. }
  569. return (
  570. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  571. (file && includeFile !== false ? (" at " + file) : '')
  572. )
  573. };
  574. var repeat = function (str, n) {
  575. var res = '';
  576. while (n) {
  577. if (n % 2 === 1) { res += str; }
  578. if (n > 1) { str += str; }
  579. n >>= 1;
  580. }
  581. return res
  582. };
  583. generateComponentTrace = function (vm) {
  584. if (vm._isVue && vm.$parent) {
  585. var tree = [];
  586. var currentRecursiveSequence = 0;
  587. while (vm) {
  588. if (tree.length > 0) {
  589. var last = tree[tree.length - 1];
  590. if (last.constructor === vm.constructor) {
  591. currentRecursiveSequence++;
  592. vm = vm.$parent;
  593. continue
  594. } else if (currentRecursiveSequence > 0) {
  595. tree[tree.length - 1] = [last, currentRecursiveSequence];
  596. currentRecursiveSequence = 0;
  597. }
  598. }
  599. tree.push(vm);
  600. vm = vm.$parent;
  601. }
  602. return '\n\nfound in\n\n' + tree
  603. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  604. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  605. : formatComponentName(vm))); })
  606. .join('\n')
  607. } else {
  608. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  609. }
  610. };
  611. }
  612. /* */
  613. var uid = 0;
  614. /**
  615. * A dep is an observable that can have multiple
  616. * directives subscribing to it.
  617. */
  618. var Dep = function Dep () {
  619. this.id = uid++;
  620. this.subs = [];
  621. };
  622. Dep.prototype.addSub = function addSub (sub) {
  623. this.subs.push(sub);
  624. };
  625. Dep.prototype.removeSub = function removeSub (sub) {
  626. remove(this.subs, sub);
  627. };
  628. Dep.prototype.depend = function depend () {
  629. if (Dep.target) {
  630. Dep.target.addDep(this);
  631. }
  632. };
  633. Dep.prototype.notify = function notify () {
  634. // stabilize the subscriber list first
  635. var subs = this.subs.slice();
  636. if (!config.async) {
  637. // subs aren't sorted in scheduler if not running async
  638. // we need to sort them now to make sure they fire in correct
  639. // order
  640. subs.sort(function (a, b) { return a.id - b.id; });
  641. }
  642. for (var i = 0, l = subs.length; i < l; i++) {
  643. subs[i].update();
  644. }
  645. };
  646. // The current target watcher being evaluated.
  647. // This is globally unique because only one watcher
  648. // can be evaluated at a time.
  649. Dep.target = null;
  650. var targetStack = [];
  651. function pushTarget (target) {
  652. targetStack.push(target);
  653. Dep.target = target;
  654. }
  655. function popTarget () {
  656. targetStack.pop();
  657. Dep.target = targetStack[targetStack.length - 1];
  658. }
  659. /* */
  660. var VNode = function VNode (
  661. tag,
  662. data,
  663. children,
  664. text,
  665. elm,
  666. context,
  667. componentOptions,
  668. asyncFactory
  669. ) {
  670. this.tag = tag;
  671. this.data = data;
  672. this.children = children;
  673. this.text = text;
  674. this.elm = elm;
  675. this.ns = undefined;
  676. this.context = context;
  677. this.fnContext = undefined;
  678. this.fnOptions = undefined;
  679. this.fnScopeId = undefined;
  680. this.key = data && data.key;
  681. this.componentOptions = componentOptions;
  682. this.componentInstance = undefined;
  683. this.parent = undefined;
  684. this.raw = false;
  685. this.isStatic = false;
  686. this.isRootInsert = true;
  687. this.isComment = false;
  688. this.isCloned = false;
  689. this.isOnce = false;
  690. this.asyncFactory = asyncFactory;
  691. this.asyncMeta = undefined;
  692. this.isAsyncPlaceholder = false;
  693. };
  694. var prototypeAccessors = { child: { configurable: true } };
  695. // DEPRECATED: alias for componentInstance for backwards compat.
  696. /* istanbul ignore next */
  697. prototypeAccessors.child.get = function () {
  698. return this.componentInstance
  699. };
  700. Object.defineProperties( VNode.prototype, prototypeAccessors );
  701. var createEmptyVNode = function (text) {
  702. if ( text === void 0 ) text = '';
  703. var node = new VNode();
  704. node.text = text;
  705. node.isComment = true;
  706. return node
  707. };
  708. function createTextVNode (val) {
  709. return new VNode(undefined, undefined, undefined, String(val))
  710. }
  711. // optimized shallow clone
  712. // used for static nodes and slot nodes because they may be reused across
  713. // multiple renders, cloning them avoids errors when DOM manipulations rely
  714. // on their elm reference.
  715. function cloneVNode (vnode) {
  716. var cloned = new VNode(
  717. vnode.tag,
  718. vnode.data,
  719. // #7975
  720. // clone children array to avoid mutating original in case of cloning
  721. // a child.
  722. vnode.children && vnode.children.slice(),
  723. vnode.text,
  724. vnode.elm,
  725. vnode.context,
  726. vnode.componentOptions,
  727. vnode.asyncFactory
  728. );
  729. cloned.ns = vnode.ns;
  730. cloned.isStatic = vnode.isStatic;
  731. cloned.key = vnode.key;
  732. cloned.isComment = vnode.isComment;
  733. cloned.fnContext = vnode.fnContext;
  734. cloned.fnOptions = vnode.fnOptions;
  735. cloned.fnScopeId = vnode.fnScopeId;
  736. cloned.asyncMeta = vnode.asyncMeta;
  737. cloned.isCloned = true;
  738. return cloned
  739. }
  740. /*
  741. * not type checking this file because flow doesn't play well with
  742. * dynamically accessing methods on Array prototype
  743. */
  744. var arrayProto = Array.prototype;
  745. var arrayMethods = Object.create(arrayProto);
  746. var methodsToPatch = [
  747. 'push',
  748. 'pop',
  749. 'shift',
  750. 'unshift',
  751. 'splice',
  752. 'sort',
  753. 'reverse'
  754. ];
  755. /**
  756. * Intercept mutating methods and emit events
  757. */
  758. methodsToPatch.forEach(function (method) {
  759. // cache original method
  760. var original = arrayProto[method];
  761. def(arrayMethods, method, function mutator () {
  762. var args = [], len = arguments.length;
  763. while ( len-- ) args[ len ] = arguments[ len ];
  764. var result = original.apply(this, args);
  765. var ob = this.__ob__;
  766. var inserted;
  767. switch (method) {
  768. case 'push':
  769. case 'unshift':
  770. inserted = args;
  771. break
  772. case 'splice':
  773. inserted = args.slice(2);
  774. break
  775. }
  776. if (inserted) { ob.observeArray(inserted); }
  777. // notify change
  778. ob.dep.notify();
  779. return result
  780. });
  781. });
  782. /* */
  783. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  784. /**
  785. * In some cases we may want to disable observation inside a component's
  786. * update computation.
  787. */
  788. var shouldObserve = true;
  789. function toggleObserving (value) {
  790. shouldObserve = value;
  791. }
  792. /**
  793. * Observer class that is attached to each observed
  794. * object. Once attached, the observer converts the target
  795. * object's property keys into getter/setters that
  796. * collect dependencies and dispatch updates.
  797. */
  798. var Observer = function Observer (value) {
  799. this.value = value;
  800. this.dep = new Dep();
  801. this.vmCount = 0;
  802. def(value, '__ob__', this);
  803. if (Array.isArray(value)) {
  804. if (hasProto) {
  805. protoAugment(value, arrayMethods);
  806. } else {
  807. copyAugment(value, arrayMethods, arrayKeys);
  808. }
  809. this.observeArray(value);
  810. } else {
  811. this.walk(value);
  812. }
  813. };
  814. /**
  815. * Walk through all properties and convert them into
  816. * getter/setters. This method should only be called when
  817. * value type is Object.
  818. */
  819. Observer.prototype.walk = function walk (obj) {
  820. var keys = Object.keys(obj);
  821. for (var i = 0; i < keys.length; i++) {
  822. defineReactive$$1(obj, keys[i]);
  823. }
  824. };
  825. /**
  826. * Observe a list of Array items.
  827. */
  828. Observer.prototype.observeArray = function observeArray (items) {
  829. for (var i = 0, l = items.length; i < l; i++) {
  830. observe(items[i]);
  831. }
  832. };
  833. // helpers
  834. /**
  835. * Augment a target Object or Array by intercepting
  836. * the prototype chain using __proto__
  837. */
  838. function protoAugment (target, src) {
  839. /* eslint-disable no-proto */
  840. target.__proto__ = src;
  841. /* eslint-enable no-proto */
  842. }
  843. /**
  844. * Augment a target Object or Array by defining
  845. * hidden properties.
  846. */
  847. /* istanbul ignore next */
  848. function copyAugment (target, src, keys) {
  849. for (var i = 0, l = keys.length; i < l; i++) {
  850. var key = keys[i];
  851. def(target, key, src[key]);
  852. }
  853. }
  854. /**
  855. * Attempt to create an observer instance for a value,
  856. * returns the new observer if successfully observed,
  857. * or the existing observer if the value already has one.
  858. */
  859. function observe (value, asRootData) {
  860. if (!isObject(value) || value instanceof VNode) {
  861. return
  862. }
  863. var ob;
  864. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  865. ob = value.__ob__;
  866. } else if (
  867. shouldObserve &&
  868. !isServerRendering() &&
  869. (Array.isArray(value) || isPlainObject(value)) &&
  870. Object.isExtensible(value) &&
  871. !value._isVue
  872. ) {
  873. ob = new Observer(value);
  874. }
  875. if (asRootData && ob) {
  876. ob.vmCount++;
  877. }
  878. return ob
  879. }
  880. /**
  881. * Define a reactive property on an Object.
  882. */
  883. function defineReactive$$1 (
  884. obj,
  885. key,
  886. val,
  887. customSetter,
  888. shallow
  889. ) {
  890. var dep = new Dep();
  891. var property = Object.getOwnPropertyDescriptor(obj, key);
  892. if (property && property.configurable === false) {
  893. return
  894. }
  895. // cater for pre-defined getter/setters
  896. var getter = property && property.get;
  897. var setter = property && property.set;
  898. if ((!getter || setter) && arguments.length === 2) {
  899. val = obj[key];
  900. }
  901. var childOb = !shallow && observe(val);
  902. Object.defineProperty(obj, key, {
  903. enumerable: true,
  904. configurable: true,
  905. get: function reactiveGetter () {
  906. var value = getter ? getter.call(obj) : val;
  907. if (Dep.target) {
  908. dep.depend();
  909. if (childOb) {
  910. childOb.dep.depend();
  911. if (Array.isArray(value)) {
  912. dependArray(value);
  913. }
  914. }
  915. }
  916. return value
  917. },
  918. set: function reactiveSetter (newVal) {
  919. var value = getter ? getter.call(obj) : val;
  920. /* eslint-disable no-self-compare */
  921. if (newVal === value || (newVal !== newVal && value !== value)) {
  922. return
  923. }
  924. /* eslint-enable no-self-compare */
  925. if (customSetter) {
  926. customSetter();
  927. }
  928. // #7981: for accessor properties without setter
  929. if (getter && !setter) { return }
  930. if (setter) {
  931. setter.call(obj, newVal);
  932. } else {
  933. val = newVal;
  934. }
  935. childOb = !shallow && observe(newVal);
  936. dep.notify();
  937. }
  938. });
  939. }
  940. /**
  941. * Set a property on an object. Adds the new property and
  942. * triggers change notification if the property doesn't
  943. * already exist.
  944. */
  945. function set (target, key, val) {
  946. if (isUndef(target) || isPrimitive(target)
  947. ) {
  948. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  949. }
  950. if (Array.isArray(target) && isValidArrayIndex(key)) {
  951. target.length = Math.max(target.length, key);
  952. target.splice(key, 1, val);
  953. return val
  954. }
  955. if (key in target && !(key in Object.prototype)) {
  956. target[key] = val;
  957. return val
  958. }
  959. var ob = (target).__ob__;
  960. if (target._isVue || (ob && ob.vmCount)) {
  961. warn(
  962. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  963. 'at runtime - declare it upfront in the data option.'
  964. );
  965. return val
  966. }
  967. if (!ob) {
  968. target[key] = val;
  969. return val
  970. }
  971. defineReactive$$1(ob.value, key, val);
  972. ob.dep.notify();
  973. return val
  974. }
  975. /**
  976. * Delete a property and trigger change if necessary.
  977. */
  978. function del (target, key) {
  979. if (isUndef(target) || isPrimitive(target)
  980. ) {
  981. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  982. }
  983. if (Array.isArray(target) && isValidArrayIndex(key)) {
  984. target.splice(key, 1);
  985. return
  986. }
  987. var ob = (target).__ob__;
  988. if (target._isVue || (ob && ob.vmCount)) {
  989. warn(
  990. 'Avoid deleting properties on a Vue instance or its root $data ' +
  991. '- just set it to null.'
  992. );
  993. return
  994. }
  995. if (!hasOwn(target, key)) {
  996. return
  997. }
  998. delete target[key];
  999. if (!ob) {
  1000. return
  1001. }
  1002. ob.dep.notify();
  1003. }
  1004. /**
  1005. * Collect dependencies on array elements when the array is touched, since
  1006. * we cannot intercept array element access like property getters.
  1007. */
  1008. function dependArray (value) {
  1009. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  1010. e = value[i];
  1011. e && e.__ob__ && e.__ob__.dep.depend();
  1012. if (Array.isArray(e)) {
  1013. dependArray(e);
  1014. }
  1015. }
  1016. }
  1017. /* */
  1018. /**
  1019. * Option overwriting strategies are functions that handle
  1020. * how to merge a parent option value and a child option
  1021. * value into the final value.
  1022. */
  1023. var strats = config.optionMergeStrategies;
  1024. /**
  1025. * Options with restrictions
  1026. */
  1027. {
  1028. strats.el = strats.propsData = function (parent, child, vm, key) {
  1029. if (!vm) {
  1030. warn(
  1031. "option \"" + key + "\" can only be used during instance " +
  1032. 'creation with the `new` keyword.'
  1033. );
  1034. }
  1035. return defaultStrat(parent, child)
  1036. };
  1037. }
  1038. /**
  1039. * Helper that recursively merges two data objects together.
  1040. */
  1041. function mergeData (to, from) {
  1042. if (!from) { return to }
  1043. var key, toVal, fromVal;
  1044. var keys = hasSymbol
  1045. ? Reflect.ownKeys(from)
  1046. : Object.keys(from);
  1047. for (var i = 0; i < keys.length; i++) {
  1048. key = keys[i];
  1049. // in case the object is already observed...
  1050. if (key === '__ob__') { continue }
  1051. toVal = to[key];
  1052. fromVal = from[key];
  1053. if (!hasOwn(to, key)) {
  1054. set(to, key, fromVal);
  1055. } else if (
  1056. toVal !== fromVal &&
  1057. isPlainObject(toVal) &&
  1058. isPlainObject(fromVal)
  1059. ) {
  1060. mergeData(toVal, fromVal);
  1061. }
  1062. }
  1063. return to
  1064. }
  1065. /**
  1066. * Data
  1067. */
  1068. function mergeDataOrFn (
  1069. parentVal,
  1070. childVal,
  1071. vm
  1072. ) {
  1073. if (!vm) {
  1074. // in a Vue.extend merge, both should be functions
  1075. if (!childVal) {
  1076. return parentVal
  1077. }
  1078. if (!parentVal) {
  1079. return childVal
  1080. }
  1081. // when parentVal & childVal are both present,
  1082. // we need to return a function that returns the
  1083. // merged result of both functions... no need to
  1084. // check if parentVal is a function here because
  1085. // it has to be a function to pass previous merges.
  1086. return function mergedDataFn () {
  1087. return mergeData(
  1088. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  1089. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  1090. )
  1091. }
  1092. } else {
  1093. return function mergedInstanceDataFn () {
  1094. // instance merge
  1095. var instanceData = typeof childVal === 'function'
  1096. ? childVal.call(vm, vm)
  1097. : childVal;
  1098. var defaultData = typeof parentVal === 'function'
  1099. ? parentVal.call(vm, vm)
  1100. : parentVal;
  1101. if (instanceData) {
  1102. return mergeData(instanceData, defaultData)
  1103. } else {
  1104. return defaultData
  1105. }
  1106. }
  1107. }
  1108. }
  1109. strats.data = function (
  1110. parentVal,
  1111. childVal,
  1112. vm
  1113. ) {
  1114. if (!vm) {
  1115. if (childVal && typeof childVal !== 'function') {
  1116. warn(
  1117. 'The "data" option should be a function ' +
  1118. 'that returns a per-instance value in component ' +
  1119. 'definitions.',
  1120. vm
  1121. );
  1122. return parentVal
  1123. }
  1124. return mergeDataOrFn(parentVal, childVal)
  1125. }
  1126. return mergeDataOrFn(parentVal, childVal, vm)
  1127. };
  1128. /**
  1129. * Hooks and props are merged as arrays.
  1130. */
  1131. function mergeHook (
  1132. parentVal,
  1133. childVal
  1134. ) {
  1135. var res = childVal
  1136. ? parentVal
  1137. ? parentVal.concat(childVal)
  1138. : Array.isArray(childVal)
  1139. ? childVal
  1140. : [childVal]
  1141. : parentVal;
  1142. return res
  1143. ? dedupeHooks(res)
  1144. : res
  1145. }
  1146. function dedupeHooks (hooks) {
  1147. var res = [];
  1148. for (var i = 0; i < hooks.length; i++) {
  1149. if (res.indexOf(hooks[i]) === -1) {
  1150. res.push(hooks[i]);
  1151. }
  1152. }
  1153. return res
  1154. }
  1155. LIFECYCLE_HOOKS.forEach(function (hook) {
  1156. strats[hook] = mergeHook;
  1157. });
  1158. /**
  1159. * Assets
  1160. *
  1161. * When a vm is present (instance creation), we need to do
  1162. * a three-way merge between constructor options, instance
  1163. * options and parent options.
  1164. */
  1165. function mergeAssets (
  1166. parentVal,
  1167. childVal,
  1168. vm,
  1169. key
  1170. ) {
  1171. var res = Object.create(parentVal || null);
  1172. if (childVal) {
  1173. assertObjectType(key, childVal, vm);
  1174. return extend(res, childVal)
  1175. } else {
  1176. return res
  1177. }
  1178. }
  1179. ASSET_TYPES.forEach(function (type) {
  1180. strats[type + 's'] = mergeAssets;
  1181. });
  1182. /**
  1183. * Watchers.
  1184. *
  1185. * Watchers hashes should not overwrite one
  1186. * another, so we merge them as arrays.
  1187. */
  1188. strats.watch = function (
  1189. parentVal,
  1190. childVal,
  1191. vm,
  1192. key
  1193. ) {
  1194. // work around Firefox's Object.prototype.watch...
  1195. if (parentVal === nativeWatch) { parentVal = undefined; }
  1196. if (childVal === nativeWatch) { childVal = undefined; }
  1197. /* istanbul ignore if */
  1198. if (!childVal) { return Object.create(parentVal || null) }
  1199. {
  1200. assertObjectType(key, childVal, vm);
  1201. }
  1202. if (!parentVal) { return childVal }
  1203. var ret = {};
  1204. extend(ret, parentVal);
  1205. for (var key$1 in childVal) {
  1206. var parent = ret[key$1];
  1207. var child = childVal[key$1];
  1208. if (parent && !Array.isArray(parent)) {
  1209. parent = [parent];
  1210. }
  1211. ret[key$1] = parent
  1212. ? parent.concat(child)
  1213. : Array.isArray(child) ? child : [child];
  1214. }
  1215. return ret
  1216. };
  1217. /**
  1218. * Other object hashes.
  1219. */
  1220. strats.props =
  1221. strats.methods =
  1222. strats.inject =
  1223. strats.computed = function (
  1224. parentVal,
  1225. childVal,
  1226. vm,
  1227. key
  1228. ) {
  1229. if (childVal && "development" !== 'production') {
  1230. assertObjectType(key, childVal, vm);
  1231. }
  1232. if (!parentVal) { return childVal }
  1233. var ret = Object.create(null);
  1234. extend(ret, parentVal);
  1235. if (childVal) { extend(ret, childVal); }
  1236. return ret
  1237. };
  1238. strats.provide = mergeDataOrFn;
  1239. /**
  1240. * Default strategy.
  1241. */
  1242. var defaultStrat = function (parentVal, childVal) {
  1243. return childVal === undefined
  1244. ? parentVal
  1245. : childVal
  1246. };
  1247. /**
  1248. * Validate component names
  1249. */
  1250. function checkComponents (options) {
  1251. for (var key in options.components) {
  1252. validateComponentName(key);
  1253. }
  1254. }
  1255. function validateComponentName (name) {
  1256. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  1257. warn(
  1258. 'Invalid component name: "' + name + '". Component names ' +
  1259. 'should conform to valid custom element name in html5 specification.'
  1260. );
  1261. }
  1262. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  1263. warn(
  1264. 'Do not use built-in or reserved HTML elements as component ' +
  1265. 'id: ' + name
  1266. );
  1267. }
  1268. }
  1269. /**
  1270. * Ensure all props option syntax are normalized into the
  1271. * Object-based format.
  1272. */
  1273. function normalizeProps (options, vm) {
  1274. var props = options.props;
  1275. if (!props) { return }
  1276. var res = {};
  1277. var i, val, name;
  1278. if (Array.isArray(props)) {
  1279. i = props.length;
  1280. while (i--) {
  1281. val = props[i];
  1282. if (typeof val === 'string') {
  1283. name = camelize(val);
  1284. res[name] = { type: null };
  1285. } else {
  1286. warn('props must be strings when using array syntax.');
  1287. }
  1288. }
  1289. } else if (isPlainObject(props)) {
  1290. for (var key in props) {
  1291. val = props[key];
  1292. name = camelize(key);
  1293. res[name] = isPlainObject(val)
  1294. ? val
  1295. : { type: val };
  1296. }
  1297. } else {
  1298. warn(
  1299. "Invalid value for option \"props\": expected an Array or an Object, " +
  1300. "but got " + (toRawType(props)) + ".",
  1301. vm
  1302. );
  1303. }
  1304. options.props = res;
  1305. }
  1306. /**
  1307. * Normalize all injections into Object-based format
  1308. */
  1309. function normalizeInject (options, vm) {
  1310. var inject = options.inject;
  1311. if (!inject) { return }
  1312. var normalized = options.inject = {};
  1313. if (Array.isArray(inject)) {
  1314. for (var i = 0; i < inject.length; i++) {
  1315. normalized[inject[i]] = { from: inject[i] };
  1316. }
  1317. } else if (isPlainObject(inject)) {
  1318. for (var key in inject) {
  1319. var val = inject[key];
  1320. normalized[key] = isPlainObject(val)
  1321. ? extend({ from: key }, val)
  1322. : { from: val };
  1323. }
  1324. } else {
  1325. warn(
  1326. "Invalid value for option \"inject\": expected an Array or an Object, " +
  1327. "but got " + (toRawType(inject)) + ".",
  1328. vm
  1329. );
  1330. }
  1331. }
  1332. /**
  1333. * Normalize raw function directives into object format.
  1334. */
  1335. function normalizeDirectives (options) {
  1336. var dirs = options.directives;
  1337. if (dirs) {
  1338. for (var key in dirs) {
  1339. var def$$1 = dirs[key];
  1340. if (typeof def$$1 === 'function') {
  1341. dirs[key] = { bind: def$$1, update: def$$1 };
  1342. }
  1343. }
  1344. }
  1345. }
  1346. function assertObjectType (name, value, vm) {
  1347. if (!isPlainObject(value)) {
  1348. warn(
  1349. "Invalid value for option \"" + name + "\": expected an Object, " +
  1350. "but got " + (toRawType(value)) + ".",
  1351. vm
  1352. );
  1353. }
  1354. }
  1355. /**
  1356. * Merge two option objects into a new one.
  1357. * Core utility used in both instantiation and inheritance.
  1358. */
  1359. function mergeOptions (
  1360. parent,
  1361. child,
  1362. vm
  1363. ) {
  1364. {
  1365. checkComponents(child);
  1366. }
  1367. if (typeof child === 'function') {
  1368. child = child.options;
  1369. }
  1370. normalizeProps(child, vm);
  1371. normalizeInject(child, vm);
  1372. normalizeDirectives(child);
  1373. // Apply extends and mixins on the child options,
  1374. // but only if it is a raw options object that isn't
  1375. // the result of another mergeOptions call.
  1376. // Only merged options has the _base property.
  1377. if (!child._base) {
  1378. if (child.extends) {
  1379. parent = mergeOptions(parent, child.extends, vm);
  1380. }
  1381. if (child.mixins) {
  1382. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1383. parent = mergeOptions(parent, child.mixins[i], vm);
  1384. }
  1385. }
  1386. }
  1387. var options = {};
  1388. var key;
  1389. for (key in parent) {
  1390. mergeField(key);
  1391. }
  1392. for (key in child) {
  1393. if (!hasOwn(parent, key)) {
  1394. mergeField(key);
  1395. }
  1396. }
  1397. function mergeField (key) {
  1398. var strat = strats[key] || defaultStrat;
  1399. options[key] = strat(parent[key], child[key], vm, key);
  1400. }
  1401. return options
  1402. }
  1403. /**
  1404. * Resolve an asset.
  1405. * This function is used because child instances need access
  1406. * to assets defined in its ancestor chain.
  1407. */
  1408. function resolveAsset (
  1409. options,
  1410. type,
  1411. id,
  1412. warnMissing
  1413. ) {
  1414. /* istanbul ignore if */
  1415. if (typeof id !== 'string') {
  1416. return
  1417. }
  1418. var assets = options[type];
  1419. // check local registration variations first
  1420. if (hasOwn(assets, id)) { return assets[id] }
  1421. var camelizedId = camelize(id);
  1422. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  1423. var PascalCaseId = capitalize(camelizedId);
  1424. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  1425. // fallback to prototype chain
  1426. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  1427. if (warnMissing && !res) {
  1428. warn(
  1429. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  1430. options
  1431. );
  1432. }
  1433. return res
  1434. }
  1435. /* */
  1436. function validateProp (
  1437. key,
  1438. propOptions,
  1439. propsData,
  1440. vm
  1441. ) {
  1442. var prop = propOptions[key];
  1443. var absent = !hasOwn(propsData, key);
  1444. var value = propsData[key];
  1445. // boolean casting
  1446. var booleanIndex = getTypeIndex(Boolean, prop.type);
  1447. if (booleanIndex > -1) {
  1448. if (absent && !hasOwn(prop, 'default')) {
  1449. value = false;
  1450. } else if (value === '' || value === hyphenate(key)) {
  1451. // only cast empty string / same name to boolean if
  1452. // boolean has higher priority
  1453. var stringIndex = getTypeIndex(String, prop.type);
  1454. if (stringIndex < 0 || booleanIndex < stringIndex) {
  1455. value = true;
  1456. }
  1457. }
  1458. }
  1459. // check default value
  1460. if (value === undefined) {
  1461. value = getPropDefaultValue(vm, prop, key);
  1462. // since the default value is a fresh copy,
  1463. // make sure to observe it.
  1464. var prevShouldObserve = shouldObserve;
  1465. toggleObserving(true);
  1466. observe(value);
  1467. toggleObserving(prevShouldObserve);
  1468. }
  1469. {
  1470. assertProp(prop, key, value, vm, absent);
  1471. }
  1472. return value
  1473. }
  1474. /**
  1475. * Get the default value of a prop.
  1476. */
  1477. function getPropDefaultValue (vm, prop, key) {
  1478. // no default, return undefined
  1479. if (!hasOwn(prop, 'default')) {
  1480. return undefined
  1481. }
  1482. var def = prop.default;
  1483. // warn against non-factory defaults for Object & Array
  1484. if (isObject(def)) {
  1485. warn(
  1486. 'Invalid default value for prop "' + key + '": ' +
  1487. 'Props with type Object/Array must use a factory function ' +
  1488. 'to return the default value.',
  1489. vm
  1490. );
  1491. }
  1492. // the raw prop value was also undefined from previous render,
  1493. // return previous default value to avoid unnecessary watcher trigger
  1494. if (vm && vm.$options.propsData &&
  1495. vm.$options.propsData[key] === undefined &&
  1496. vm._props[key] !== undefined
  1497. ) {
  1498. return vm._props[key]
  1499. }
  1500. // call factory function for non-Function types
  1501. // a value is Function if its prototype is function even across different execution context
  1502. return typeof def === 'function' && getType(prop.type) !== 'Function'
  1503. ? def.call(vm)
  1504. : def
  1505. }
  1506. /**
  1507. * Assert whether a prop is valid.
  1508. */
  1509. function assertProp (
  1510. prop,
  1511. name,
  1512. value,
  1513. vm,
  1514. absent
  1515. ) {
  1516. if (prop.required && absent) {
  1517. warn(
  1518. 'Missing required prop: "' + name + '"',
  1519. vm
  1520. );
  1521. return
  1522. }
  1523. if (value == null && !prop.required) {
  1524. return
  1525. }
  1526. var type = prop.type;
  1527. var valid = !type || type === true;
  1528. var expectedTypes = [];
  1529. if (type) {
  1530. if (!Array.isArray(type)) {
  1531. type = [type];
  1532. }
  1533. for (var i = 0; i < type.length && !valid; i++) {
  1534. var assertedType = assertType(value, type[i]);
  1535. expectedTypes.push(assertedType.expectedType || '');
  1536. valid = assertedType.valid;
  1537. }
  1538. }
  1539. if (!valid) {
  1540. warn(
  1541. getInvalidTypeMessage(name, value, expectedTypes),
  1542. vm
  1543. );
  1544. return
  1545. }
  1546. var validator = prop.validator;
  1547. if (validator) {
  1548. if (!validator(value)) {
  1549. warn(
  1550. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  1551. vm
  1552. );
  1553. }
  1554. }
  1555. }
  1556. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  1557. function assertType (value, type) {
  1558. var valid;
  1559. var expectedType = getType(type);
  1560. if (simpleCheckRE.test(expectedType)) {
  1561. var t = typeof value;
  1562. valid = t === expectedType.toLowerCase();
  1563. // for primitive wrapper objects
  1564. if (!valid && t === 'object') {
  1565. valid = value instanceof type;
  1566. }
  1567. } else if (expectedType === 'Object') {
  1568. valid = isPlainObject(value);
  1569. } else if (expectedType === 'Array') {
  1570. valid = Array.isArray(value);
  1571. } else {
  1572. valid = value instanceof type;
  1573. }
  1574. return {
  1575. valid: valid,
  1576. expectedType: expectedType
  1577. }
  1578. }
  1579. /**
  1580. * Use function string name to check built-in types,
  1581. * because a simple equality check will fail when running
  1582. * across different vms / iframes.
  1583. */
  1584. function getType (fn) {
  1585. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  1586. return match ? match[1] : ''
  1587. }
  1588. function isSameType (a, b) {
  1589. return getType(a) === getType(b)
  1590. }
  1591. function getTypeIndex (type, expectedTypes) {
  1592. if (!Array.isArray(expectedTypes)) {
  1593. return isSameType(expectedTypes, type) ? 0 : -1
  1594. }
  1595. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  1596. if (isSameType(expectedTypes[i], type)) {
  1597. return i
  1598. }
  1599. }
  1600. return -1
  1601. }
  1602. function getInvalidTypeMessage (name, value, expectedTypes) {
  1603. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  1604. " Expected " + (expectedTypes.map(capitalize).join(', '));
  1605. var expectedType = expectedTypes[0];
  1606. var receivedType = toRawType(value);
  1607. var expectedValue = styleValue(value, expectedType);
  1608. var receivedValue = styleValue(value, receivedType);
  1609. // check if we need to specify expected value
  1610. if (expectedTypes.length === 1 &&
  1611. isExplicable(expectedType) &&
  1612. !isBoolean(expectedType, receivedType)) {
  1613. message += " with value " + expectedValue;
  1614. }
  1615. message += ", got " + receivedType + " ";
  1616. // check if we need to specify received value
  1617. if (isExplicable(receivedType)) {
  1618. message += "with value " + receivedValue + ".";
  1619. }
  1620. return message
  1621. }
  1622. function styleValue (value, type) {
  1623. if (type === 'String') {
  1624. return ("\"" + value + "\"")
  1625. } else if (type === 'Number') {
  1626. return ("" + (Number(value)))
  1627. } else {
  1628. return ("" + value)
  1629. }
  1630. }
  1631. function isExplicable (value) {
  1632. var explicitTypes = ['string', 'number', 'boolean'];
  1633. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  1634. }
  1635. function isBoolean () {
  1636. var args = [], len = arguments.length;
  1637. while ( len-- ) args[ len ] = arguments[ len ];
  1638. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  1639. }
  1640. /* */
  1641. function handleError (err, vm, info) {
  1642. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  1643. // See: https://github.com/vuejs/vuex/issues/1505
  1644. pushTarget();
  1645. try {
  1646. if (vm) {
  1647. var cur = vm;
  1648. while ((cur = cur.$parent)) {
  1649. var hooks = cur.$options.errorCaptured;
  1650. if (hooks) {
  1651. for (var i = 0; i < hooks.length; i++) {
  1652. try {
  1653. var capture = hooks[i].call(cur, err, vm, info) === false;
  1654. if (capture) { return }
  1655. } catch (e) {
  1656. globalHandleError(e, cur, 'errorCaptured hook');
  1657. }
  1658. }
  1659. }
  1660. }
  1661. }
  1662. globalHandleError(err, vm, info);
  1663. } finally {
  1664. popTarget();
  1665. }
  1666. }
  1667. function invokeWithErrorHandling (
  1668. handler,
  1669. context,
  1670. args,
  1671. vm,
  1672. info
  1673. ) {
  1674. var res;
  1675. try {
  1676. res = args ? handler.apply(context, args) : handler.call(context);
  1677. if (res && !res._isVue && isPromise(res) && !res._handled) {
  1678. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  1679. // issue #9511
  1680. // avoid catch triggering multiple times when nested calls
  1681. res._handled = true;
  1682. }
  1683. } catch (e) {
  1684. handleError(e, vm, info);
  1685. }
  1686. return res
  1687. }
  1688. function globalHandleError (err, vm, info) {
  1689. if (config.errorHandler) {
  1690. try {
  1691. return config.errorHandler.call(null, err, vm, info)
  1692. } catch (e) {
  1693. // if the user intentionally throws the original error in the handler,
  1694. // do not log it twice
  1695. if (e !== err) {
  1696. logError(e, null, 'config.errorHandler');
  1697. }
  1698. }
  1699. }
  1700. logError(err, vm, info);
  1701. }
  1702. function logError (err, vm, info) {
  1703. {
  1704. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  1705. }
  1706. /* istanbul ignore else */
  1707. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  1708. console.error(err);
  1709. } else {
  1710. throw err
  1711. }
  1712. }
  1713. /* */
  1714. var isUsingMicroTask = false;
  1715. var callbacks = [];
  1716. var pending = false;
  1717. function flushCallbacks () {
  1718. pending = false;
  1719. var copies = callbacks.slice(0);
  1720. callbacks.length = 0;
  1721. for (var i = 0; i < copies.length; i++) {
  1722. copies[i]();
  1723. }
  1724. }
  1725. // Here we have async deferring wrappers using microtasks.
  1726. // In 2.5 we used (macro) tasks (in combination with microtasks).
  1727. // However, it has subtle problems when state is changed right before repaint
  1728. // (e.g. #6813, out-in transitions).
  1729. // Also, using (macro) tasks in event handler would cause some weird behaviors
  1730. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  1731. // So we now use microtasks everywhere, again.
  1732. // A major drawback of this tradeoff is that there are some scenarios
  1733. // where microtasks have too high a priority and fire in between supposedly
  1734. // sequential events (e.g. #4521, #6690, which have workarounds)
  1735. // or even between bubbling of the same event (#6566).
  1736. var timerFunc;
  1737. // The nextTick behavior leverages the microtask queue, which can be accessed
  1738. // via either native Promise.then or MutationObserver.
  1739. // MutationObserver has wider support, however it is seriously bugged in
  1740. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  1741. // completely stops working after triggering a few times... so, if native
  1742. // Promise is available, we will use it:
  1743. /* istanbul ignore next, $flow-disable-line */
  1744. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  1745. var p = Promise.resolve();
  1746. timerFunc = function () {
  1747. p.then(flushCallbacks);
  1748. // In problematic UIWebViews, Promise.then doesn't completely break, but
  1749. // it can get stuck in a weird state where callbacks are pushed into the
  1750. // microtask queue but the queue isn't being flushed, until the browser
  1751. // needs to do some other work, e.g. handle a timer. Therefore we can
  1752. // "force" the microtask queue to be flushed by adding an empty timer.
  1753. if (isIOS) { setTimeout(noop); }
  1754. };
  1755. isUsingMicroTask = true;
  1756. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  1757. isNative(MutationObserver) ||
  1758. // PhantomJS and iOS 7.x
  1759. MutationObserver.toString() === '[object MutationObserverConstructor]'
  1760. )) {
  1761. // Use MutationObserver where native Promise is not available,
  1762. // e.g. PhantomJS, iOS7, Android 4.4
  1763. // (#6466 MutationObserver is unreliable in IE11)
  1764. var counter = 1;
  1765. var observer = new MutationObserver(flushCallbacks);
  1766. var textNode = document.createTextNode(String(counter));
  1767. observer.observe(textNode, {
  1768. characterData: true
  1769. });
  1770. timerFunc = function () {
  1771. counter = (counter + 1) % 2;
  1772. textNode.data = String(counter);
  1773. };
  1774. isUsingMicroTask = true;
  1775. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  1776. // Fallback to setImmediate.
  1777. // Techinically it leverages the (macro) task queue,
  1778. // but it is still a better choice than setTimeout.
  1779. timerFunc = function () {
  1780. setImmediate(flushCallbacks);
  1781. };
  1782. } else {
  1783. // Fallback to setTimeout.
  1784. timerFunc = function () {
  1785. setTimeout(flushCallbacks, 0);
  1786. };
  1787. }
  1788. function nextTick (cb, ctx) {
  1789. var _resolve;
  1790. callbacks.push(function () {
  1791. if (cb) {
  1792. try {
  1793. cb.call(ctx);
  1794. } catch (e) {
  1795. handleError(e, ctx, 'nextTick');
  1796. }
  1797. } else if (_resolve) {
  1798. _resolve(ctx);
  1799. }
  1800. });
  1801. if (!pending) {
  1802. pending = true;
  1803. timerFunc();
  1804. }
  1805. // $flow-disable-line
  1806. if (!cb && typeof Promise !== 'undefined') {
  1807. return new Promise(function (resolve) {
  1808. _resolve = resolve;
  1809. })
  1810. }
  1811. }
  1812. /* */
  1813. var mark;
  1814. var measure;
  1815. {
  1816. var perf = inBrowser && window.performance;
  1817. /* istanbul ignore if */
  1818. if (
  1819. perf &&
  1820. perf.mark &&
  1821. perf.measure &&
  1822. perf.clearMarks &&
  1823. perf.clearMeasures
  1824. ) {
  1825. mark = function (tag) { return perf.mark(tag); };
  1826. measure = function (name, startTag, endTag) {
  1827. perf.measure(name, startTag, endTag);
  1828. perf.clearMarks(startTag);
  1829. perf.clearMarks(endTag);
  1830. // perf.clearMeasures(name)
  1831. };
  1832. }
  1833. }
  1834. /* not type checking this file because flow doesn't play well with Proxy */
  1835. var initProxy;
  1836. {
  1837. var allowedGlobals = makeMap(
  1838. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  1839. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  1840. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  1841. 'require' // for Webpack/Browserify
  1842. );
  1843. var warnNonPresent = function (target, key) {
  1844. warn(
  1845. "Property or method \"" + key + "\" is not defined on the instance but " +
  1846. 'referenced during render. Make sure that this property is reactive, ' +
  1847. 'either in the data option, or for class-based components, by ' +
  1848. 'initializing the property. ' +
  1849. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  1850. target
  1851. );
  1852. };
  1853. var warnReservedPrefix = function (target, key) {
  1854. warn(
  1855. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  1856. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  1857. 'prevent conflicts with Vue internals' +
  1858. 'See: https://vuejs.org/v2/api/#data',
  1859. target
  1860. );
  1861. };
  1862. var hasProxy =
  1863. typeof Proxy !== 'undefined' && isNative(Proxy);
  1864. if (hasProxy) {
  1865. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  1866. config.keyCodes = new Proxy(config.keyCodes, {
  1867. set: function set (target, key, value) {
  1868. if (isBuiltInModifier(key)) {
  1869. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  1870. return false
  1871. } else {
  1872. target[key] = value;
  1873. return true
  1874. }
  1875. }
  1876. });
  1877. }
  1878. var hasHandler = {
  1879. has: function has (target, key) {
  1880. var has = key in target;
  1881. var isAllowed = allowedGlobals(key) ||
  1882. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  1883. if (!has && !isAllowed) {
  1884. if (key in target.$data) { warnReservedPrefix(target, key); }
  1885. else { warnNonPresent(target, key); }
  1886. }
  1887. return has || !isAllowed
  1888. }
  1889. };
  1890. var getHandler = {
  1891. get: function get (target, key) {
  1892. if (typeof key === 'string' && !(key in target)) {
  1893. if (key in target.$data) { warnReservedPrefix(target, key); }
  1894. else { warnNonPresent(target, key); }
  1895. }
  1896. return target[key]
  1897. }
  1898. };
  1899. initProxy = function initProxy (vm) {
  1900. if (hasProxy) {
  1901. // determine which proxy handler to use
  1902. var options = vm.$options;
  1903. var handlers = options.render && options.render._withStripped
  1904. ? getHandler
  1905. : hasHandler;
  1906. vm._renderProxy = new Proxy(vm, handlers);
  1907. } else {
  1908. vm._renderProxy = vm;
  1909. }
  1910. };
  1911. }
  1912. /* */
  1913. var seenObjects = new _Set();
  1914. /**
  1915. * Recursively traverse an object to evoke all converted
  1916. * getters, so that every nested property inside the object
  1917. * is collected as a "deep" dependency.
  1918. */
  1919. function traverse (val) {
  1920. _traverse(val, seenObjects);
  1921. seenObjects.clear();
  1922. }
  1923. function _traverse (val, seen) {
  1924. var i, keys;
  1925. var isA = Array.isArray(val);
  1926. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  1927. return
  1928. }
  1929. if (val.__ob__) {
  1930. var depId = val.__ob__.dep.id;
  1931. if (seen.has(depId)) {
  1932. return
  1933. }
  1934. seen.add(depId);
  1935. }
  1936. if (isA) {
  1937. i = val.length;
  1938. while (i--) { _traverse(val[i], seen); }
  1939. } else {
  1940. keys = Object.keys(val);
  1941. i = keys.length;
  1942. while (i--) { _traverse(val[keys[i]], seen); }
  1943. }
  1944. }
  1945. /* */
  1946. var normalizeEvent = cached(function (name) {
  1947. var passive = name.charAt(0) === '&';
  1948. name = passive ? name.slice(1) : name;
  1949. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  1950. name = once$$1 ? name.slice(1) : name;
  1951. var capture = name.charAt(0) === '!';
  1952. name = capture ? name.slice(1) : name;
  1953. return {
  1954. name: name,
  1955. once: once$$1,
  1956. capture: capture,
  1957. passive: passive
  1958. }
  1959. });
  1960. function createFnInvoker (fns, vm) {
  1961. function invoker () {
  1962. var arguments$1 = arguments;
  1963. var fns = invoker.fns;
  1964. if (Array.isArray(fns)) {
  1965. var cloned = fns.slice();
  1966. for (var i = 0; i < cloned.length; i++) {
  1967. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  1968. }
  1969. } else {
  1970. // return handler return value for single handlers
  1971. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  1972. }
  1973. }
  1974. invoker.fns = fns;
  1975. return invoker
  1976. }
  1977. function updateListeners (
  1978. on,
  1979. oldOn,
  1980. add,
  1981. remove$$1,
  1982. createOnceHandler,
  1983. vm
  1984. ) {
  1985. var name, def$$1, cur, old, event;
  1986. for (name in on) {
  1987. def$$1 = cur = on[name];
  1988. old = oldOn[name];
  1989. event = normalizeEvent(name);
  1990. if (isUndef(cur)) {
  1991. warn(
  1992. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  1993. vm
  1994. );
  1995. } else if (isUndef(old)) {
  1996. if (isUndef(cur.fns)) {
  1997. cur = on[name] = createFnInvoker(cur, vm);
  1998. }
  1999. if (isTrue(event.once)) {
  2000. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  2001. }
  2002. add(event.name, cur, event.capture, event.passive, event.params);
  2003. } else if (cur !== old) {
  2004. old.fns = cur;
  2005. on[name] = old;
  2006. }
  2007. }
  2008. for (name in oldOn) {
  2009. if (isUndef(on[name])) {
  2010. event = normalizeEvent(name);
  2011. remove$$1(event.name, oldOn[name], event.capture);
  2012. }
  2013. }
  2014. }
  2015. /* */
  2016. function mergeVNodeHook (def, hookKey, hook) {
  2017. if (def instanceof VNode) {
  2018. def = def.data.hook || (def.data.hook = {});
  2019. }
  2020. var invoker;
  2021. var oldHook = def[hookKey];
  2022. function wrappedHook () {
  2023. hook.apply(this, arguments);
  2024. // important: remove merged hook to ensure it's called only once
  2025. // and prevent memory leak
  2026. remove(invoker.fns, wrappedHook);
  2027. }
  2028. if (isUndef(oldHook)) {
  2029. // no existing hook
  2030. invoker = createFnInvoker([wrappedHook]);
  2031. } else {
  2032. /* istanbul ignore if */
  2033. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  2034. // already a merged invoker
  2035. invoker = oldHook;
  2036. invoker.fns.push(wrappedHook);
  2037. } else {
  2038. // existing plain hook
  2039. invoker = createFnInvoker([oldHook, wrappedHook]);
  2040. }
  2041. }
  2042. invoker.merged = true;
  2043. def[hookKey] = invoker;
  2044. }
  2045. /* */
  2046. function extractPropsFromVNodeData (
  2047. data,
  2048. Ctor,
  2049. tag
  2050. ) {
  2051. // we are only extracting raw values here.
  2052. // validation and default values are handled in the child
  2053. // component itself.
  2054. var propOptions = Ctor.options.props;
  2055. if (isUndef(propOptions)) {
  2056. return
  2057. }
  2058. var res = {};
  2059. var attrs = data.attrs;
  2060. var props = data.props;
  2061. if (isDef(attrs) || isDef(props)) {
  2062. for (var key in propOptions) {
  2063. var altKey = hyphenate(key);
  2064. {
  2065. var keyInLowerCase = key.toLowerCase();
  2066. if (
  2067. key !== keyInLowerCase &&
  2068. attrs && hasOwn(attrs, keyInLowerCase)
  2069. ) {
  2070. tip(
  2071. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  2072. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  2073. " \"" + key + "\". " +
  2074. "Note that HTML attributes are case-insensitive and camelCased " +
  2075. "props need to use their kebab-case equivalents when using in-DOM " +
  2076. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  2077. );
  2078. }
  2079. }
  2080. checkProp(res, props, key, altKey, true) ||
  2081. checkProp(res, attrs, key, altKey, false);
  2082. }
  2083. }
  2084. return res
  2085. }
  2086. function checkProp (
  2087. res,
  2088. hash,
  2089. key,
  2090. altKey,
  2091. preserve
  2092. ) {
  2093. if (isDef(hash)) {
  2094. if (hasOwn(hash, key)) {
  2095. res[key] = hash[key];
  2096. if (!preserve) {
  2097. delete hash[key];
  2098. }
  2099. return true
  2100. } else if (hasOwn(hash, altKey)) {
  2101. res[key] = hash[altKey];
  2102. if (!preserve) {
  2103. delete hash[altKey];
  2104. }
  2105. return true
  2106. }
  2107. }
  2108. return false
  2109. }
  2110. /* */
  2111. // The template compiler attempts to minimize the need for normalization by
  2112. // statically analyzing the template at compile time.
  2113. //
  2114. // For plain HTML markup, normalization can be completely skipped because the
  2115. // generated render function is guaranteed to return Array<VNode>. There are
  2116. // two cases where extra normalization is needed:
  2117. // 1. When the children contains components - because a functional component
  2118. // may return an Array instead of a single root. In this case, just a simple
  2119. // normalization is needed - if any child is an Array, we flatten the whole
  2120. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  2121. // because functional components already normalize their own children.
  2122. function simpleNormalizeChildren (children) {
  2123. for (var i = 0; i < children.length; i++) {
  2124. if (Array.isArray(children[i])) {
  2125. return Array.prototype.concat.apply([], children)
  2126. }
  2127. }
  2128. return children
  2129. }
  2130. // 2. When the children contains constructs that always generated nested Arrays,
  2131. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  2132. // with hand-written render functions / JSX. In such cases a full normalization
  2133. // is needed to cater to all possible types of children values.
  2134. function normalizeChildren (children) {
  2135. return isPrimitive(children)
  2136. ? [createTextVNode(children)]
  2137. : Array.isArray(children)
  2138. ? normalizeArrayChildren(children)
  2139. : undefined
  2140. }
  2141. function isTextNode (node) {
  2142. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  2143. }
  2144. function normalizeArrayChildren (children, nestedIndex) {
  2145. var res = [];
  2146. var i, c, lastIndex, last;
  2147. for (i = 0; i < children.length; i++) {
  2148. c = children[i];
  2149. if (isUndef(c) || typeof c === 'boolean') { continue }
  2150. lastIndex = res.length - 1;
  2151. last = res[lastIndex];
  2152. // nested
  2153. if (Array.isArray(c)) {
  2154. if (c.length > 0) {
  2155. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  2156. // merge adjacent text nodes
  2157. if (isTextNode(c[0]) && isTextNode(last)) {
  2158. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  2159. c.shift();
  2160. }
  2161. res.push.apply(res, c);
  2162. }
  2163. } else if (isPrimitive(c)) {
  2164. if (isTextNode(last)) {
  2165. // merge adjacent text nodes
  2166. // this is necessary for SSR hydration because text nodes are
  2167. // essentially merged when rendered to HTML strings
  2168. res[lastIndex] = createTextVNode(last.text + c);
  2169. } else if (c !== '') {
  2170. // convert primitive to vnode
  2171. res.push(createTextVNode(c));
  2172. }
  2173. } else {
  2174. if (isTextNode(c) && isTextNode(last)) {
  2175. // merge adjacent text nodes
  2176. res[lastIndex] = createTextVNode(last.text + c.text);
  2177. } else {
  2178. // default key for nested array children (likely generated by v-for)
  2179. if (isTrue(children._isVList) &&
  2180. isDef(c.tag) &&
  2181. isUndef(c.key) &&
  2182. isDef(nestedIndex)) {
  2183. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  2184. }
  2185. res.push(c);
  2186. }
  2187. }
  2188. }
  2189. return res
  2190. }
  2191. /* */
  2192. function initProvide (vm) {
  2193. var provide = vm.$options.provide;
  2194. if (provide) {
  2195. vm._provided = typeof provide === 'function'
  2196. ? provide.call(vm)
  2197. : provide;
  2198. }
  2199. }
  2200. function initInjections (vm) {
  2201. var result = resolveInject(vm.$options.inject, vm);
  2202. if (result) {
  2203. toggleObserving(false);
  2204. Object.keys(result).forEach(function (key) {
  2205. /* istanbul ignore else */
  2206. {
  2207. defineReactive$$1(vm, key, result[key], function () {
  2208. warn(
  2209. "Avoid mutating an injected value directly since the changes will be " +
  2210. "overwritten whenever the provided component re-renders. " +
  2211. "injection being mutated: \"" + key + "\"",
  2212. vm
  2213. );
  2214. });
  2215. }
  2216. });
  2217. toggleObserving(true);
  2218. }
  2219. }
  2220. function resolveInject (inject, vm) {
  2221. if (inject) {
  2222. // inject is :any because flow is not smart enough to figure out cached
  2223. var result = Object.create(null);
  2224. var keys = hasSymbol
  2225. ? Reflect.ownKeys(inject)
  2226. : Object.keys(inject);
  2227. for (var i = 0; i < keys.length; i++) {
  2228. var key = keys[i];
  2229. // #6574 in case the inject object is observed...
  2230. if (key === '__ob__') { continue }
  2231. var provideKey = inject[key].from;
  2232. var source = vm;
  2233. while (source) {
  2234. if (source._provided && hasOwn(source._provided, provideKey)) {
  2235. result[key] = source._provided[provideKey];
  2236. break
  2237. }
  2238. source = source.$parent;
  2239. }
  2240. if (!source) {
  2241. if ('default' in inject[key]) {
  2242. var provideDefault = inject[key].default;
  2243. result[key] = typeof provideDefault === 'function'
  2244. ? provideDefault.call(vm)
  2245. : provideDefault;
  2246. } else {
  2247. warn(("Injection \"" + key + "\" not found"), vm);
  2248. }
  2249. }
  2250. }
  2251. return result
  2252. }
  2253. }
  2254. /* */
  2255. /**
  2256. * Runtime helper for resolving raw children VNodes into a slot object.
  2257. */
  2258. function resolveSlots (
  2259. children,
  2260. context
  2261. ) {
  2262. if (!children || !children.length) {
  2263. return {}
  2264. }
  2265. var slots = {};
  2266. for (var i = 0, l = children.length; i < l; i++) {
  2267. var child = children[i];
  2268. var data = child.data;
  2269. // remove slot attribute if the node is resolved as a Vue slot node
  2270. if (data && data.attrs && data.attrs.slot) {
  2271. delete data.attrs.slot;
  2272. }
  2273. // named slots should only be respected if the vnode was rendered in the
  2274. // same context.
  2275. if ((child.context === context || child.fnContext === context) &&
  2276. data && data.slot != null
  2277. ) {
  2278. var name = data.slot;
  2279. var slot = (slots[name] || (slots[name] = []));
  2280. if (child.tag === 'template') {
  2281. slot.push.apply(slot, child.children || []);
  2282. } else {
  2283. slot.push(child);
  2284. }
  2285. } else {
  2286. (slots.default || (slots.default = [])).push(child);
  2287. }
  2288. }
  2289. // ignore slots that contains only whitespace
  2290. for (var name$1 in slots) {
  2291. if (slots[name$1].every(isWhitespace)) {
  2292. delete slots[name$1];
  2293. }
  2294. }
  2295. return slots
  2296. }
  2297. function isWhitespace (node) {
  2298. return (node.isComment && !node.asyncFactory) || node.text === ' '
  2299. }
  2300. /* */
  2301. function normalizeScopedSlots (
  2302. slots,
  2303. normalSlots,
  2304. prevSlots
  2305. ) {
  2306. var res;
  2307. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  2308. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  2309. var key = slots && slots.$key;
  2310. if (!slots) {
  2311. res = {};
  2312. } else if (slots._normalized) {
  2313. // fast path 1: child component re-render only, parent did not change
  2314. return slots._normalized
  2315. } else if (
  2316. isStable &&
  2317. prevSlots &&
  2318. prevSlots !== emptyObject &&
  2319. key === prevSlots.$key &&
  2320. !hasNormalSlots &&
  2321. !prevSlots.$hasNormal
  2322. ) {
  2323. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  2324. // only need to normalize once
  2325. return prevSlots
  2326. } else {
  2327. res = {};
  2328. for (var key$1 in slots) {
  2329. if (slots[key$1] && key$1[0] !== '$') {
  2330. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  2331. }
  2332. }
  2333. }
  2334. // expose normal slots on scopedSlots
  2335. for (var key$2 in normalSlots) {
  2336. if (!(key$2 in res)) {
  2337. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  2338. }
  2339. }
  2340. // avoriaz seems to mock a non-extensible $scopedSlots object
  2341. // and when that is passed down this would cause an error
  2342. if (slots && Object.isExtensible(slots)) {
  2343. (slots)._normalized = res;
  2344. }
  2345. def(res, '$stable', isStable);
  2346. def(res, '$key', key);
  2347. def(res, '$hasNormal', hasNormalSlots);
  2348. return res
  2349. }
  2350. function normalizeScopedSlot(normalSlots, key, fn) {
  2351. var normalized = function () {
  2352. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  2353. res = res && typeof res === 'object' && !Array.isArray(res)
  2354. ? [res] // single vnode
  2355. : normalizeChildren(res);
  2356. return res && (
  2357. res.length === 0 ||
  2358. (res.length === 1 && res[0].isComment) // #9658
  2359. ) ? undefined
  2360. : res
  2361. };
  2362. // this is a slot using the new v-slot syntax without scope. although it is
  2363. // compiled as a scoped slot, render fn users would expect it to be present
  2364. // on this.$slots because the usage is semantically a normal slot.
  2365. if (fn.proxy) {
  2366. Object.defineProperty(normalSlots, key, {
  2367. get: normalized,
  2368. enumerable: true,
  2369. configurable: true
  2370. });
  2371. }
  2372. return normalized
  2373. }
  2374. function proxyNormalSlot(slots, key) {
  2375. return function () { return slots[key]; }
  2376. }
  2377. /* */
  2378. /**
  2379. * Runtime helper for rendering v-for lists.
  2380. */
  2381. function renderList (
  2382. val,
  2383. render
  2384. ) {
  2385. var ret, i, l, keys, key;
  2386. if (Array.isArray(val) || typeof val === 'string') {
  2387. ret = new Array(val.length);
  2388. for (i = 0, l = val.length; i < l; i++) {
  2389. ret[i] = render(val[i], i);
  2390. }
  2391. } else if (typeof val === 'number') {
  2392. ret = new Array(val);
  2393. for (i = 0; i < val; i++) {
  2394. ret[i] = render(i + 1, i);
  2395. }
  2396. } else if (isObject(val)) {
  2397. if (hasSymbol && val[Symbol.iterator]) {
  2398. ret = [];
  2399. var iterator = val[Symbol.iterator]();
  2400. var result = iterator.next();
  2401. while (!result.done) {
  2402. ret.push(render(result.value, ret.length));
  2403. result = iterator.next();
  2404. }
  2405. } else {
  2406. keys = Object.keys(val);
  2407. ret = new Array(keys.length);
  2408. for (i = 0, l = keys.length; i < l; i++) {
  2409. key = keys[i];
  2410. ret[i] = render(val[key], key, i);
  2411. }
  2412. }
  2413. }
  2414. if (!isDef(ret)) {
  2415. ret = [];
  2416. }
  2417. (ret)._isVList = true;
  2418. return ret
  2419. }
  2420. /* */
  2421. /**
  2422. * Runtime helper for rendering <slot>
  2423. */
  2424. function renderSlot (
  2425. name,
  2426. fallback,
  2427. props,
  2428. bindObject
  2429. ) {
  2430. var scopedSlotFn = this.$scopedSlots[name];
  2431. var nodes;
  2432. if (scopedSlotFn) { // scoped slot
  2433. props = props || {};
  2434. if (bindObject) {
  2435. if (!isObject(bindObject)) {
  2436. warn(
  2437. 'slot v-bind without argument expects an Object',
  2438. this
  2439. );
  2440. }
  2441. props = extend(extend({}, bindObject), props);
  2442. }
  2443. nodes = scopedSlotFn(props) || fallback;
  2444. } else {
  2445. nodes = this.$slots[name] || fallback;
  2446. }
  2447. var target = props && props.slot;
  2448. if (target) {
  2449. return this.$createElement('template', { slot: target }, nodes)
  2450. } else {
  2451. return nodes
  2452. }
  2453. }
  2454. /* */
  2455. /**
  2456. * Runtime helper for resolving filters
  2457. */
  2458. function resolveFilter (id) {
  2459. return resolveAsset(this.$options, 'filters', id, true) || identity
  2460. }
  2461. /* */
  2462. function isKeyNotMatch (expect, actual) {
  2463. if (Array.isArray(expect)) {
  2464. return expect.indexOf(actual) === -1
  2465. } else {
  2466. return expect !== actual
  2467. }
  2468. }
  2469. /**
  2470. * Runtime helper for checking keyCodes from config.
  2471. * exposed as Vue.prototype._k
  2472. * passing in eventKeyName as last argument separately for backwards compat
  2473. */
  2474. function checkKeyCodes (
  2475. eventKeyCode,
  2476. key,
  2477. builtInKeyCode,
  2478. eventKeyName,
  2479. builtInKeyName
  2480. ) {
  2481. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  2482. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  2483. return isKeyNotMatch(builtInKeyName, eventKeyName)
  2484. } else if (mappedKeyCode) {
  2485. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  2486. } else if (eventKeyName) {
  2487. return hyphenate(eventKeyName) !== key
  2488. }
  2489. }
  2490. /* */
  2491. /**
  2492. * Runtime helper for merging v-bind="object" into a VNode's data.
  2493. */
  2494. function bindObjectProps (
  2495. data,
  2496. tag,
  2497. value,
  2498. asProp,
  2499. isSync
  2500. ) {
  2501. if (value) {
  2502. if (!isObject(value)) {
  2503. warn(
  2504. 'v-bind without argument expects an Object or Array value',
  2505. this
  2506. );
  2507. } else {
  2508. if (Array.isArray(value)) {
  2509. value = toObject(value);
  2510. }
  2511. var hash;
  2512. var loop = function ( key ) {
  2513. if (
  2514. key === 'class' ||
  2515. key === 'style' ||
  2516. isReservedAttribute(key)
  2517. ) {
  2518. hash = data;
  2519. } else {
  2520. var type = data.attrs && data.attrs.type;
  2521. hash = asProp || config.mustUseProp(tag, type, key)
  2522. ? data.domProps || (data.domProps = {})
  2523. : data.attrs || (data.attrs = {});
  2524. }
  2525. var camelizedKey = camelize(key);
  2526. var hyphenatedKey = hyphenate(key);
  2527. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  2528. hash[key] = value[key];
  2529. if (isSync) {
  2530. var on = data.on || (data.on = {});
  2531. on[("update:" + key)] = function ($event) {
  2532. value[key] = $event;
  2533. };
  2534. }
  2535. }
  2536. };
  2537. for (var key in value) loop( key );
  2538. }
  2539. }
  2540. return data
  2541. }
  2542. /* */
  2543. /**
  2544. * Runtime helper for rendering static trees.
  2545. */
  2546. function renderStatic (
  2547. index,
  2548. isInFor
  2549. ) {
  2550. var cached = this._staticTrees || (this._staticTrees = []);
  2551. var tree = cached[index];
  2552. // if has already-rendered static tree and not inside v-for,
  2553. // we can reuse the same tree.
  2554. if (tree && !isInFor) {
  2555. return tree
  2556. }
  2557. // otherwise, render a fresh tree.
  2558. tree = cached[index] = this.$options.staticRenderFns[index].call(
  2559. this._renderProxy,
  2560. null,
  2561. this // for render fns generated for functional component templates
  2562. );
  2563. markStatic(tree, ("__static__" + index), false);
  2564. return tree
  2565. }
  2566. /**
  2567. * Runtime helper for v-once.
  2568. * Effectively it means marking the node as static with a unique key.
  2569. */
  2570. function markOnce (
  2571. tree,
  2572. index,
  2573. key
  2574. ) {
  2575. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  2576. return tree
  2577. }
  2578. function markStatic (
  2579. tree,
  2580. key,
  2581. isOnce
  2582. ) {
  2583. if (Array.isArray(tree)) {
  2584. for (var i = 0; i < tree.length; i++) {
  2585. if (tree[i] && typeof tree[i] !== 'string') {
  2586. markStaticNode(tree[i], (key + "_" + i), isOnce);
  2587. }
  2588. }
  2589. } else {
  2590. markStaticNode(tree, key, isOnce);
  2591. }
  2592. }
  2593. function markStaticNode (node, key, isOnce) {
  2594. node.isStatic = true;
  2595. node.key = key;
  2596. node.isOnce = isOnce;
  2597. }
  2598. /* */
  2599. function bindObjectListeners (data, value) {
  2600. if (value) {
  2601. if (!isPlainObject(value)) {
  2602. warn(
  2603. 'v-on without argument expects an Object value',
  2604. this
  2605. );
  2606. } else {
  2607. var on = data.on = data.on ? extend({}, data.on) : {};
  2608. for (var key in value) {
  2609. var existing = on[key];
  2610. var ours = value[key];
  2611. on[key] = existing ? [].concat(existing, ours) : ours;
  2612. }
  2613. }
  2614. }
  2615. return data
  2616. }
  2617. /* */
  2618. function resolveScopedSlots (
  2619. fns, // see flow/vnode
  2620. res,
  2621. // the following are added in 2.6
  2622. hasDynamicKeys,
  2623. contentHashKey
  2624. ) {
  2625. res = res || { $stable: !hasDynamicKeys };
  2626. for (var i = 0; i < fns.length; i++) {
  2627. var slot = fns[i];
  2628. if (Array.isArray(slot)) {
  2629. resolveScopedSlots(slot, res, hasDynamicKeys);
  2630. } else if (slot) {
  2631. // marker for reverse proxying v-slot without scope on this.$slots
  2632. if (slot.proxy) {
  2633. slot.fn.proxy = true;
  2634. }
  2635. res[slot.key] = slot.fn;
  2636. }
  2637. }
  2638. if (contentHashKey) {
  2639. (res).$key = contentHashKey;
  2640. }
  2641. return res
  2642. }
  2643. /* */
  2644. function bindDynamicKeys (baseObj, values) {
  2645. for (var i = 0; i < values.length; i += 2) {
  2646. var key = values[i];
  2647. if (typeof key === 'string' && key) {
  2648. baseObj[values[i]] = values[i + 1];
  2649. } else if (key !== '' && key !== null) {
  2650. // null is a speical value for explicitly removing a binding
  2651. warn(
  2652. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  2653. this
  2654. );
  2655. }
  2656. }
  2657. return baseObj
  2658. }
  2659. // helper to dynamically append modifier runtime markers to event names.
  2660. // ensure only append when value is already string, otherwise it will be cast
  2661. // to string and cause the type check to miss.
  2662. function prependModifier (value, symbol) {
  2663. return typeof value === 'string' ? symbol + value : value
  2664. }
  2665. /* */
  2666. function installRenderHelpers (target) {
  2667. target._o = markOnce;
  2668. target._n = toNumber;
  2669. target._s = toString;
  2670. target._l = renderList;
  2671. target._t = renderSlot;
  2672. target._q = looseEqual;
  2673. target._i = looseIndexOf;
  2674. target._m = renderStatic;
  2675. target._f = resolveFilter;
  2676. target._k = checkKeyCodes;
  2677. target._b = bindObjectProps;
  2678. target._v = createTextVNode;
  2679. target._e = createEmptyVNode;
  2680. target._u = resolveScopedSlots;
  2681. target._g = bindObjectListeners;
  2682. target._d = bindDynamicKeys;
  2683. target._p = prependModifier;
  2684. }
  2685. /* */
  2686. function FunctionalRenderContext (
  2687. data,
  2688. props,
  2689. children,
  2690. parent,
  2691. Ctor
  2692. ) {
  2693. var this$1 = this;
  2694. var options = Ctor.options;
  2695. // ensure the createElement function in functional components
  2696. // gets a unique context - this is necessary for correct named slot check
  2697. var contextVm;
  2698. if (hasOwn(parent, '_uid')) {
  2699. contextVm = Object.create(parent);
  2700. // $flow-disable-line
  2701. contextVm._original = parent;
  2702. } else {
  2703. // the context vm passed in is a functional context as well.
  2704. // in this case we want to make sure we are able to get a hold to the
  2705. // real context instance.
  2706. contextVm = parent;
  2707. // $flow-disable-line
  2708. parent = parent._original;
  2709. }
  2710. var isCompiled = isTrue(options._compiled);
  2711. var needNormalization = !isCompiled;
  2712. this.data = data;
  2713. this.props = props;
  2714. this.children = children;
  2715. this.parent = parent;
  2716. this.listeners = data.on || emptyObject;
  2717. this.injections = resolveInject(options.inject, parent);
  2718. this.slots = function () {
  2719. if (!this$1.$slots) {
  2720. normalizeScopedSlots(
  2721. data.scopedSlots,
  2722. this$1.$slots = resolveSlots(children, parent)
  2723. );
  2724. }
  2725. return this$1.$slots
  2726. };
  2727. Object.defineProperty(this, 'scopedSlots', ({
  2728. enumerable: true,
  2729. get: function get () {
  2730. return normalizeScopedSlots(data.scopedSlots, this.slots())
  2731. }
  2732. }));
  2733. // support for compiled functional template
  2734. if (isCompiled) {
  2735. // exposing $options for renderStatic()
  2736. this.$options = options;
  2737. // pre-resolve slots for renderSlot()
  2738. this.$slots = this.slots();
  2739. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  2740. }
  2741. if (options._scopeId) {
  2742. this._c = function (a, b, c, d) {
  2743. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  2744. if (vnode && !Array.isArray(vnode)) {
  2745. vnode.fnScopeId = options._scopeId;
  2746. vnode.fnContext = parent;
  2747. }
  2748. return vnode
  2749. };
  2750. } else {
  2751. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  2752. }
  2753. }
  2754. installRenderHelpers(FunctionalRenderContext.prototype);
  2755. function createFunctionalComponent (
  2756. Ctor,
  2757. propsData,
  2758. data,
  2759. contextVm,
  2760. children
  2761. ) {
  2762. var options = Ctor.options;
  2763. var props = {};
  2764. var propOptions = options.props;
  2765. if (isDef(propOptions)) {
  2766. for (var key in propOptions) {
  2767. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  2768. }
  2769. } else {
  2770. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  2771. if (isDef(data.props)) { mergeProps(props, data.props); }
  2772. }
  2773. var renderContext = new FunctionalRenderContext(
  2774. data,
  2775. props,
  2776. children,
  2777. contextVm,
  2778. Ctor
  2779. );
  2780. var vnode = options.render.call(null, renderContext._c, renderContext);
  2781. if (vnode instanceof VNode) {
  2782. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  2783. } else if (Array.isArray(vnode)) {
  2784. var vnodes = normalizeChildren(vnode) || [];
  2785. var res = new Array(vnodes.length);
  2786. for (var i = 0; i < vnodes.length; i++) {
  2787. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  2788. }
  2789. return res
  2790. }
  2791. }
  2792. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  2793. // #7817 clone node before setting fnContext, otherwise if the node is reused
  2794. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  2795. // that should not be matched to match.
  2796. var clone = cloneVNode(vnode);
  2797. clone.fnContext = contextVm;
  2798. clone.fnOptions = options;
  2799. {
  2800. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  2801. }
  2802. if (data.slot) {
  2803. (clone.data || (clone.data = {})).slot = data.slot;
  2804. }
  2805. return clone
  2806. }
  2807. function mergeProps (to, from) {
  2808. for (var key in from) {
  2809. to[camelize(key)] = from[key];
  2810. }
  2811. }
  2812. /* */
  2813. /* */
  2814. /* */
  2815. /* */
  2816. // inline hooks to be invoked on component VNodes during patch
  2817. var componentVNodeHooks = {
  2818. init: function init (vnode, hydrating) {
  2819. if (
  2820. vnode.componentInstance &&
  2821. !vnode.componentInstance._isDestroyed &&
  2822. vnode.data.keepAlive
  2823. ) {
  2824. // kept-alive components, treat as a patch
  2825. var mountedNode = vnode; // work around flow
  2826. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  2827. } else {
  2828. var child = vnode.componentInstance = createComponentInstanceForVnode(
  2829. vnode,
  2830. activeInstance
  2831. );
  2832. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  2833. }
  2834. },
  2835. prepatch: function prepatch (oldVnode, vnode) {
  2836. var options = vnode.componentOptions;
  2837. var child = vnode.componentInstance = oldVnode.componentInstance;
  2838. updateChildComponent(
  2839. child,
  2840. options.propsData, // updated props
  2841. options.listeners, // updated listeners
  2842. vnode, // new parent vnode
  2843. options.children // new children
  2844. );
  2845. },
  2846. insert: function insert (vnode) {
  2847. var context = vnode.context;
  2848. var componentInstance = vnode.componentInstance;
  2849. if (!componentInstance._isMounted) {
  2850. componentInstance._isMounted = true;
  2851. callHook(componentInstance, 'mounted');
  2852. }
  2853. if (vnode.data.keepAlive) {
  2854. if (context._isMounted) {
  2855. // vue-router#1212
  2856. // During updates, a kept-alive component's child components may
  2857. // change, so directly walking the tree here may call activated hooks
  2858. // on incorrect children. Instead we push them into a queue which will
  2859. // be processed after the whole patch process ended.
  2860. queueActivatedComponent(componentInstance);
  2861. } else {
  2862. activateChildComponent(componentInstance, true /* direct */);
  2863. }
  2864. }
  2865. },
  2866. destroy: function destroy (vnode) {
  2867. var componentInstance = vnode.componentInstance;
  2868. if (!componentInstance._isDestroyed) {
  2869. if (!vnode.data.keepAlive) {
  2870. componentInstance.$destroy();
  2871. } else {
  2872. deactivateChildComponent(componentInstance, true /* direct */);
  2873. }
  2874. }
  2875. }
  2876. };
  2877. var hooksToMerge = Object.keys(componentVNodeHooks);
  2878. function createComponent (
  2879. Ctor,
  2880. data,
  2881. context,
  2882. children,
  2883. tag
  2884. ) {
  2885. if (isUndef(Ctor)) {
  2886. return
  2887. }
  2888. var baseCtor = context.$options._base;
  2889. // plain options object: turn it into a constructor
  2890. if (isObject(Ctor)) {
  2891. Ctor = baseCtor.extend(Ctor);
  2892. }
  2893. // if at this stage it's not a constructor or an async component factory,
  2894. // reject.
  2895. if (typeof Ctor !== 'function') {
  2896. {
  2897. warn(("Invalid Component definition: " + (String(Ctor))), context);
  2898. }
  2899. return
  2900. }
  2901. // async component
  2902. var asyncFactory;
  2903. if (isUndef(Ctor.cid)) {
  2904. asyncFactory = Ctor;
  2905. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  2906. if (Ctor === undefined) {
  2907. // return a placeholder node for async component, which is rendered
  2908. // as a comment node but preserves all the raw information for the node.
  2909. // the information will be used for async server-rendering and hydration.
  2910. return createAsyncPlaceholder(
  2911. asyncFactory,
  2912. data,
  2913. context,
  2914. children,
  2915. tag
  2916. )
  2917. }
  2918. }
  2919. data = data || {};
  2920. // resolve constructor options in case global mixins are applied after
  2921. // component constructor creation
  2922. resolveConstructorOptions(Ctor);
  2923. // transform component v-model data into props & events
  2924. if (isDef(data.model)) {
  2925. transformModel(Ctor.options, data);
  2926. }
  2927. // extract props
  2928. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  2929. // functional component
  2930. if (isTrue(Ctor.options.functional)) {
  2931. return createFunctionalComponent(Ctor, propsData, data, context, children)
  2932. }
  2933. // extract listeners, since these needs to be treated as
  2934. // child component listeners instead of DOM listeners
  2935. var listeners = data.on;
  2936. // replace with listeners with .native modifier
  2937. // so it gets processed during parent component patch.
  2938. data.on = data.nativeOn;
  2939. if (isTrue(Ctor.options.abstract)) {
  2940. // abstract components do not keep anything
  2941. // other than props & listeners & slot
  2942. // work around flow
  2943. var slot = data.slot;
  2944. data = {};
  2945. if (slot) {
  2946. data.slot = slot;
  2947. }
  2948. }
  2949. // install component management hooks onto the placeholder node
  2950. installComponentHooks(data);
  2951. // return a placeholder vnode
  2952. var name = Ctor.options.name || tag;
  2953. var vnode = new VNode(
  2954. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  2955. data, undefined, undefined, undefined, context,
  2956. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  2957. asyncFactory
  2958. );
  2959. return vnode
  2960. }
  2961. function createComponentInstanceForVnode (
  2962. vnode, // we know it's MountedComponentVNode but flow doesn't
  2963. parent // activeInstance in lifecycle state
  2964. ) {
  2965. var options = {
  2966. _isComponent: true,
  2967. _parentVnode: vnode,
  2968. parent: parent
  2969. };
  2970. // check inline-template render functions
  2971. var inlineTemplate = vnode.data.inlineTemplate;
  2972. if (isDef(inlineTemplate)) {
  2973. options.render = inlineTemplate.render;
  2974. options.staticRenderFns = inlineTemplate.staticRenderFns;
  2975. }
  2976. return new vnode.componentOptions.Ctor(options)
  2977. }
  2978. function installComponentHooks (data) {
  2979. var hooks = data.hook || (data.hook = {});
  2980. for (var i = 0; i < hooksToMerge.length; i++) {
  2981. var key = hooksToMerge[i];
  2982. var existing = hooks[key];
  2983. var toMerge = componentVNodeHooks[key];
  2984. if (existing !== toMerge && !(existing && existing._merged)) {
  2985. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  2986. }
  2987. }
  2988. }
  2989. function mergeHook$1 (f1, f2) {
  2990. var merged = function (a, b) {
  2991. // flow complains about extra args which is why we use any
  2992. f1(a, b);
  2993. f2(a, b);
  2994. };
  2995. merged._merged = true;
  2996. return merged
  2997. }
  2998. // transform component v-model info (value and callback) into
  2999. // prop and event handler respectively.
  3000. function transformModel (options, data) {
  3001. var prop = (options.model && options.model.prop) || 'value';
  3002. var event = (options.model && options.model.event) || 'input'
  3003. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  3004. var on = data.on || (data.on = {});
  3005. var existing = on[event];
  3006. var callback = data.model.callback;
  3007. if (isDef(existing)) {
  3008. if (
  3009. Array.isArray(existing)
  3010. ? existing.indexOf(callback) === -1
  3011. : existing !== callback
  3012. ) {
  3013. on[event] = [callback].concat(existing);
  3014. }
  3015. } else {
  3016. on[event] = callback;
  3017. }
  3018. }
  3019. /* */
  3020. var SIMPLE_NORMALIZE = 1;
  3021. var ALWAYS_NORMALIZE = 2;
  3022. // wrapper function for providing a more flexible interface
  3023. // without getting yelled at by flow
  3024. function createElement (
  3025. context,
  3026. tag,
  3027. data,
  3028. children,
  3029. normalizationType,
  3030. alwaysNormalize
  3031. ) {
  3032. if (Array.isArray(data) || isPrimitive(data)) {
  3033. normalizationType = children;
  3034. children = data;
  3035. data = undefined;
  3036. }
  3037. if (isTrue(alwaysNormalize)) {
  3038. normalizationType = ALWAYS_NORMALIZE;
  3039. }
  3040. return _createElement(context, tag, data, children, normalizationType)
  3041. }
  3042. function _createElement (
  3043. context,
  3044. tag,
  3045. data,
  3046. children,
  3047. normalizationType
  3048. ) {
  3049. if (isDef(data) && isDef((data).__ob__)) {
  3050. warn(
  3051. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  3052. 'Always create fresh vnode data objects in each render!',
  3053. context
  3054. );
  3055. return createEmptyVNode()
  3056. }
  3057. // object syntax in v-bind
  3058. if (isDef(data) && isDef(data.is)) {
  3059. tag = data.is;
  3060. }
  3061. if (!tag) {
  3062. // in case of component :is set to falsy value
  3063. return createEmptyVNode()
  3064. }
  3065. // warn against non-primitive key
  3066. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  3067. ) {
  3068. {
  3069. warn(
  3070. 'Avoid using non-primitive value as key, ' +
  3071. 'use string/number value instead.',
  3072. context
  3073. );
  3074. }
  3075. }
  3076. // support single function children as default scoped slot
  3077. if (Array.isArray(children) &&
  3078. typeof children[0] === 'function'
  3079. ) {
  3080. data = data || {};
  3081. data.scopedSlots = { default: children[0] };
  3082. children.length = 0;
  3083. }
  3084. if (normalizationType === ALWAYS_NORMALIZE) {
  3085. children = normalizeChildren(children);
  3086. } else if (normalizationType === SIMPLE_NORMALIZE) {
  3087. children = simpleNormalizeChildren(children);
  3088. }
  3089. var vnode, ns;
  3090. if (typeof tag === 'string') {
  3091. var Ctor;
  3092. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  3093. if (config.isReservedTag(tag)) {
  3094. // platform built-in elements
  3095. vnode = new VNode(
  3096. config.parsePlatformTagName(tag), data, children,
  3097. undefined, undefined, context
  3098. );
  3099. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  3100. // component
  3101. vnode = createComponent(Ctor, data, context, children, tag);
  3102. } else {
  3103. // unknown or unlisted namespaced elements
  3104. // check at runtime because it may get assigned a namespace when its
  3105. // parent normalizes children
  3106. vnode = new VNode(
  3107. tag, data, children,
  3108. undefined, undefined, context
  3109. );
  3110. }
  3111. } else {
  3112. // direct component options / constructor
  3113. vnode = createComponent(tag, data, context, children);
  3114. }
  3115. if (Array.isArray(vnode)) {
  3116. return vnode
  3117. } else if (isDef(vnode)) {
  3118. if (isDef(ns)) { applyNS(vnode, ns); }
  3119. if (isDef(data)) { registerDeepBindings(data); }
  3120. return vnode
  3121. } else {
  3122. return createEmptyVNode()
  3123. }
  3124. }
  3125. function applyNS (vnode, ns, force) {
  3126. vnode.ns = ns;
  3127. if (vnode.tag === 'foreignObject') {
  3128. // use default namespace inside foreignObject
  3129. ns = undefined;
  3130. force = true;
  3131. }
  3132. if (isDef(vnode.children)) {
  3133. for (var i = 0, l = vnode.children.length; i < l; i++) {
  3134. var child = vnode.children[i];
  3135. if (isDef(child.tag) && (
  3136. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  3137. applyNS(child, ns, force);
  3138. }
  3139. }
  3140. }
  3141. }
  3142. // ref #5318
  3143. // necessary to ensure parent re-render when deep bindings like :style and
  3144. // :class are used on slot nodes
  3145. function registerDeepBindings (data) {
  3146. if (isObject(data.style)) {
  3147. traverse(data.style);
  3148. }
  3149. if (isObject(data.class)) {
  3150. traverse(data.class);
  3151. }
  3152. }
  3153. /* */
  3154. function initRender (vm) {
  3155. vm._vnode = null; // the root of the child tree
  3156. vm._staticTrees = null; // v-once cached trees
  3157. var options = vm.$options;
  3158. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  3159. var renderContext = parentVnode && parentVnode.context;
  3160. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  3161. vm.$scopedSlots = emptyObject;
  3162. // bind the createElement fn to this instance
  3163. // so that we get proper render context inside it.
  3164. // args order: tag, data, children, normalizationType, alwaysNormalize
  3165. // internal version is used by render functions compiled from templates
  3166. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  3167. // normalization is always applied for the public version, used in
  3168. // user-written render functions.
  3169. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  3170. // $attrs & $listeners are exposed for easier HOC creation.
  3171. // they need to be reactive so that HOCs using them are always updated
  3172. var parentData = parentVnode && parentVnode.data;
  3173. /* istanbul ignore else */
  3174. {
  3175. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  3176. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  3177. }, true);
  3178. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  3179. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  3180. }, true);
  3181. }
  3182. }
  3183. var currentRenderingInstance = null;
  3184. function renderMixin (Vue) {
  3185. // install runtime convenience helpers
  3186. installRenderHelpers(Vue.prototype);
  3187. Vue.prototype.$nextTick = function (fn) {
  3188. return nextTick(fn, this)
  3189. };
  3190. Vue.prototype._render = function () {
  3191. var vm = this;
  3192. var ref = vm.$options;
  3193. var render = ref.render;
  3194. var _parentVnode = ref._parentVnode;
  3195. if (_parentVnode) {
  3196. vm.$scopedSlots = normalizeScopedSlots(
  3197. _parentVnode.data.scopedSlots,
  3198. vm.$slots,
  3199. vm.$scopedSlots
  3200. );
  3201. }
  3202. // set parent vnode. this allows render functions to have access
  3203. // to the data on the placeholder node.
  3204. vm.$vnode = _parentVnode;
  3205. // render self
  3206. var vnode;
  3207. try {
  3208. // There's no need to maintain a stack becaues all render fns are called
  3209. // separately from one another. Nested component's render fns are called
  3210. // when parent component is patched.
  3211. currentRenderingInstance = vm;
  3212. vnode = render.call(vm._renderProxy, vm.$createElement);
  3213. } catch (e) {
  3214. handleError(e, vm, "render");
  3215. // return error render result,
  3216. // or previous vnode to prevent render error causing blank component
  3217. /* istanbul ignore else */
  3218. if (vm.$options.renderError) {
  3219. try {
  3220. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  3221. } catch (e) {
  3222. handleError(e, vm, "renderError");
  3223. vnode = vm._vnode;
  3224. }
  3225. } else {
  3226. vnode = vm._vnode;
  3227. }
  3228. } finally {
  3229. currentRenderingInstance = null;
  3230. }
  3231. // if the returned array contains only a single node, allow it
  3232. if (Array.isArray(vnode) && vnode.length === 1) {
  3233. vnode = vnode[0];
  3234. }
  3235. // return empty vnode in case the render function errored out
  3236. if (!(vnode instanceof VNode)) {
  3237. if (Array.isArray(vnode)) {
  3238. warn(
  3239. 'Multiple root nodes returned from render function. Render function ' +
  3240. 'should return a single root node.',
  3241. vm
  3242. );
  3243. }
  3244. vnode = createEmptyVNode();
  3245. }
  3246. // set parent
  3247. vnode.parent = _parentVnode;
  3248. return vnode
  3249. };
  3250. }
  3251. /* */
  3252. function ensureCtor (comp, base) {
  3253. if (
  3254. comp.__esModule ||
  3255. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  3256. ) {
  3257. comp = comp.default;
  3258. }
  3259. return isObject(comp)
  3260. ? base.extend(comp)
  3261. : comp
  3262. }
  3263. function createAsyncPlaceholder (
  3264. factory,
  3265. data,
  3266. context,
  3267. children,
  3268. tag
  3269. ) {
  3270. var node = createEmptyVNode();
  3271. node.asyncFactory = factory;
  3272. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  3273. return node
  3274. }
  3275. function resolveAsyncComponent (
  3276. factory,
  3277. baseCtor
  3278. ) {
  3279. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  3280. return factory.errorComp
  3281. }
  3282. if (isDef(factory.resolved)) {
  3283. return factory.resolved
  3284. }
  3285. var owner = currentRenderingInstance;
  3286. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  3287. // already pending
  3288. factory.owners.push(owner);
  3289. }
  3290. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  3291. return factory.loadingComp
  3292. }
  3293. if (owner && !isDef(factory.owners)) {
  3294. var owners = factory.owners = [owner];
  3295. var sync = true;
  3296. var timerLoading = null;
  3297. var timerTimeout = null
  3298. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  3299. var forceRender = function (renderCompleted) {
  3300. for (var i = 0, l = owners.length; i < l; i++) {
  3301. (owners[i]).$forceUpdate();
  3302. }
  3303. if (renderCompleted) {
  3304. owners.length = 0;
  3305. if (timerLoading !== null) {
  3306. clearTimeout(timerLoading);
  3307. timerLoading = null;
  3308. }
  3309. if (timerTimeout !== null) {
  3310. clearTimeout(timerTimeout);
  3311. timerTimeout = null;
  3312. }
  3313. }
  3314. };
  3315. var resolve = once(function (res) {
  3316. // cache resolved
  3317. factory.resolved = ensureCtor(res, baseCtor);
  3318. // invoke callbacks only if this is not a synchronous resolve
  3319. // (async resolves are shimmed as synchronous during SSR)
  3320. if (!sync) {
  3321. forceRender(true);
  3322. } else {
  3323. owners.length = 0;
  3324. }
  3325. });
  3326. var reject = once(function (reason) {
  3327. warn(
  3328. "Failed to resolve async component: " + (String(factory)) +
  3329. (reason ? ("\nReason: " + reason) : '')
  3330. );
  3331. if (isDef(factory.errorComp)) {
  3332. factory.error = true;
  3333. forceRender(true);
  3334. }
  3335. });
  3336. var res = factory(resolve, reject);
  3337. if (isObject(res)) {
  3338. if (isPromise(res)) {
  3339. // () => Promise
  3340. if (isUndef(factory.resolved)) {
  3341. res.then(resolve, reject);
  3342. }
  3343. } else if (isPromise(res.component)) {
  3344. res.component.then(resolve, reject);
  3345. if (isDef(res.error)) {
  3346. factory.errorComp = ensureCtor(res.error, baseCtor);
  3347. }
  3348. if (isDef(res.loading)) {
  3349. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  3350. if (res.delay === 0) {
  3351. factory.loading = true;
  3352. } else {
  3353. timerLoading = setTimeout(function () {
  3354. timerLoading = null;
  3355. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  3356. factory.loading = true;
  3357. forceRender(false);
  3358. }
  3359. }, res.delay || 200);
  3360. }
  3361. }
  3362. if (isDef(res.timeout)) {
  3363. timerTimeout = setTimeout(function () {
  3364. timerTimeout = null;
  3365. if (isUndef(factory.resolved)) {
  3366. reject(
  3367. "timeout (" + (res.timeout) + "ms)"
  3368. );
  3369. }
  3370. }, res.timeout);
  3371. }
  3372. }
  3373. }
  3374. sync = false;
  3375. // return in case resolved synchronously
  3376. return factory.loading
  3377. ? factory.loadingComp
  3378. : factory.resolved
  3379. }
  3380. }
  3381. /* */
  3382. function isAsyncPlaceholder (node) {
  3383. return node.isComment && node.asyncFactory
  3384. }
  3385. /* */
  3386. function getFirstComponentChild (children) {
  3387. if (Array.isArray(children)) {
  3388. for (var i = 0; i < children.length; i++) {
  3389. var c = children[i];
  3390. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  3391. return c
  3392. }
  3393. }
  3394. }
  3395. }
  3396. /* */
  3397. /* */
  3398. function initEvents (vm) {
  3399. vm._events = Object.create(null);
  3400. vm._hasHookEvent = false;
  3401. // init parent attached events
  3402. var listeners = vm.$options._parentListeners;
  3403. if (listeners) {
  3404. updateComponentListeners(vm, listeners);
  3405. }
  3406. }
  3407. var target;
  3408. function add (event, fn) {
  3409. target.$on(event, fn);
  3410. }
  3411. function remove$1 (event, fn) {
  3412. target.$off(event, fn);
  3413. }
  3414. function createOnceHandler (event, fn) {
  3415. var _target = target;
  3416. return function onceHandler () {
  3417. var res = fn.apply(null, arguments);
  3418. if (res !== null) {
  3419. _target.$off(event, onceHandler);
  3420. }
  3421. }
  3422. }
  3423. function updateComponentListeners (
  3424. vm,
  3425. listeners,
  3426. oldListeners
  3427. ) {
  3428. target = vm;
  3429. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  3430. target = undefined;
  3431. }
  3432. function eventsMixin (Vue) {
  3433. var hookRE = /^hook:/;
  3434. Vue.prototype.$on = function (event, fn) {
  3435. var vm = this;
  3436. if (Array.isArray(event)) {
  3437. for (var i = 0, l = event.length; i < l; i++) {
  3438. vm.$on(event[i], fn);
  3439. }
  3440. } else {
  3441. (vm._events[event] || (vm._events[event] = [])).push(fn);
  3442. // optimize hook:event cost by using a boolean flag marked at registration
  3443. // instead of a hash lookup
  3444. if (hookRE.test(event)) {
  3445. vm._hasHookEvent = true;
  3446. }
  3447. }
  3448. return vm
  3449. };
  3450. Vue.prototype.$once = function (event, fn) {
  3451. var vm = this;
  3452. function on () {
  3453. vm.$off(event, on);
  3454. fn.apply(vm, arguments);
  3455. }
  3456. on.fn = fn;
  3457. vm.$on(event, on);
  3458. return vm
  3459. };
  3460. Vue.prototype.$off = function (event, fn) {
  3461. var vm = this;
  3462. // all
  3463. if (!arguments.length) {
  3464. vm._events = Object.create(null);
  3465. return vm
  3466. }
  3467. // array of events
  3468. if (Array.isArray(event)) {
  3469. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  3470. vm.$off(event[i$1], fn);
  3471. }
  3472. return vm
  3473. }
  3474. // specific event
  3475. var cbs = vm._events[event];
  3476. if (!cbs) {
  3477. return vm
  3478. }
  3479. if (!fn) {
  3480. vm._events[event] = null;
  3481. return vm
  3482. }
  3483. // specific handler
  3484. var cb;
  3485. var i = cbs.length;
  3486. while (i--) {
  3487. cb = cbs[i];
  3488. if (cb === fn || cb.fn === fn) {
  3489. cbs.splice(i, 1);
  3490. break
  3491. }
  3492. }
  3493. return vm
  3494. };
  3495. Vue.prototype.$emit = function (event) {
  3496. var vm = this;
  3497. {
  3498. var lowerCaseEvent = event.toLowerCase();
  3499. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  3500. tip(
  3501. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  3502. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  3503. "Note that HTML attributes are case-insensitive and you cannot use " +
  3504. "v-on to listen to camelCase events when using in-DOM templates. " +
  3505. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  3506. );
  3507. }
  3508. }
  3509. var cbs = vm._events[event];
  3510. if (cbs) {
  3511. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  3512. var args = toArray(arguments, 1);
  3513. var info = "event handler for \"" + event + "\"";
  3514. for (var i = 0, l = cbs.length; i < l; i++) {
  3515. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  3516. }
  3517. }
  3518. return vm
  3519. };
  3520. }
  3521. /* */
  3522. var activeInstance = null;
  3523. var isUpdatingChildComponent = false;
  3524. function setActiveInstance(vm) {
  3525. var prevActiveInstance = activeInstance;
  3526. activeInstance = vm;
  3527. return function () {
  3528. activeInstance = prevActiveInstance;
  3529. }
  3530. }
  3531. function initLifecycle (vm) {
  3532. var options = vm.$options;
  3533. // locate first non-abstract parent
  3534. var parent = options.parent;
  3535. if (parent && !options.abstract) {
  3536. while (parent.$options.abstract && parent.$parent) {
  3537. parent = parent.$parent;
  3538. }
  3539. parent.$children.push(vm);
  3540. }
  3541. vm.$parent = parent;
  3542. vm.$root = parent ? parent.$root : vm;
  3543. vm.$children = [];
  3544. vm.$refs = {};
  3545. vm._watcher = null;
  3546. vm._inactive = null;
  3547. vm._directInactive = false;
  3548. vm._isMounted = false;
  3549. vm._isDestroyed = false;
  3550. vm._isBeingDestroyed = false;
  3551. }
  3552. function lifecycleMixin (Vue) {
  3553. Vue.prototype._update = function (vnode, hydrating) {
  3554. var vm = this;
  3555. var prevEl = vm.$el;
  3556. var prevVnode = vm._vnode;
  3557. var restoreActiveInstance = setActiveInstance(vm);
  3558. vm._vnode = vnode;
  3559. // Vue.prototype.__patch__ is injected in entry points
  3560. // based on the rendering backend used.
  3561. if (!prevVnode) {
  3562. // initial render
  3563. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  3564. } else {
  3565. // updates
  3566. vm.$el = vm.__patch__(prevVnode, vnode);
  3567. }
  3568. restoreActiveInstance();
  3569. // update __vue__ reference
  3570. if (prevEl) {
  3571. prevEl.__vue__ = null;
  3572. }
  3573. if (vm.$el) {
  3574. vm.$el.__vue__ = vm;
  3575. }
  3576. // if parent is an HOC, update its $el as well
  3577. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  3578. vm.$parent.$el = vm.$el;
  3579. }
  3580. // updated hook is called by the scheduler to ensure that children are
  3581. // updated in a parent's updated hook.
  3582. };
  3583. Vue.prototype.$forceUpdate = function () {
  3584. var vm = this;
  3585. if (vm._watcher) {
  3586. vm._watcher.update();
  3587. }
  3588. };
  3589. Vue.prototype.$destroy = function () {
  3590. var vm = this;
  3591. if (vm._isBeingDestroyed) {
  3592. return
  3593. }
  3594. callHook(vm, 'beforeDestroy');
  3595. vm._isBeingDestroyed = true;
  3596. // remove self from parent
  3597. var parent = vm.$parent;
  3598. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  3599. remove(parent.$children, vm);
  3600. }
  3601. // teardown watchers
  3602. if (vm._watcher) {
  3603. vm._watcher.teardown();
  3604. }
  3605. var i = vm._watchers.length;
  3606. while (i--) {
  3607. vm._watchers[i].teardown();
  3608. }
  3609. // remove reference from data ob
  3610. // frozen object may not have observer.
  3611. if (vm._data.__ob__) {
  3612. vm._data.__ob__.vmCount--;
  3613. }
  3614. // call the last hook...
  3615. vm._isDestroyed = true;
  3616. // invoke destroy hooks on current rendered tree
  3617. vm.__patch__(vm._vnode, null);
  3618. // fire destroyed hook
  3619. callHook(vm, 'destroyed');
  3620. // turn off all instance listeners.
  3621. vm.$off();
  3622. // remove __vue__ reference
  3623. if (vm.$el) {
  3624. vm.$el.__vue__ = null;
  3625. }
  3626. // release circular reference (#6759)
  3627. if (vm.$vnode) {
  3628. vm.$vnode.parent = null;
  3629. }
  3630. };
  3631. }
  3632. function mountComponent (
  3633. vm,
  3634. el,
  3635. hydrating
  3636. ) {
  3637. vm.$el = el;
  3638. if (!vm.$options.render) {
  3639. vm.$options.render = createEmptyVNode;
  3640. {
  3641. /* istanbul ignore if */
  3642. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  3643. vm.$options.el || el) {
  3644. warn(
  3645. 'You are using the runtime-only build of Vue where the template ' +
  3646. 'compiler is not available. Either pre-compile the templates into ' +
  3647. 'render functions, or use the compiler-included build.',
  3648. vm
  3649. );
  3650. } else {
  3651. warn(
  3652. 'Failed to mount component: template or render function not defined.',
  3653. vm
  3654. );
  3655. }
  3656. }
  3657. }
  3658. callHook(vm, 'beforeMount');
  3659. var updateComponent;
  3660. /* istanbul ignore if */
  3661. if (config.performance && mark) {
  3662. updateComponent = function () {
  3663. var name = vm._name;
  3664. var id = vm._uid;
  3665. var startTag = "vue-perf-start:" + id;
  3666. var endTag = "vue-perf-end:" + id;
  3667. mark(startTag);
  3668. var vnode = vm._render();
  3669. mark(endTag);
  3670. measure(("vue " + name + " render"), startTag, endTag);
  3671. mark(startTag);
  3672. vm._update(vnode, hydrating);
  3673. mark(endTag);
  3674. measure(("vue " + name + " patch"), startTag, endTag);
  3675. };
  3676. } else {
  3677. updateComponent = function () {
  3678. vm._update(vm._render(), hydrating);
  3679. };
  3680. }
  3681. // we set this to vm._watcher inside the watcher's constructor
  3682. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  3683. // component's mounted hook), which relies on vm._watcher being already defined
  3684. new Watcher(vm, updateComponent, noop, {
  3685. before: function before () {
  3686. if (vm._isMounted && !vm._isDestroyed) {
  3687. callHook(vm, 'beforeUpdate');
  3688. }
  3689. }
  3690. }, true /* isRenderWatcher */);
  3691. hydrating = false;
  3692. // manually mounted instance, call mounted on self
  3693. // mounted is called for render-created child components in its inserted hook
  3694. if (vm.$vnode == null) {
  3695. vm._isMounted = true;
  3696. callHook(vm, 'mounted');
  3697. }
  3698. return vm
  3699. }
  3700. function updateChildComponent (
  3701. vm,
  3702. propsData,
  3703. listeners,
  3704. parentVnode,
  3705. renderChildren
  3706. ) {
  3707. {
  3708. isUpdatingChildComponent = true;
  3709. }
  3710. // determine whether component has slot children
  3711. // we need to do this before overwriting $options._renderChildren.
  3712. // check if there are dynamic scopedSlots (hand-written or compiled but with
  3713. // dynamic slot names). Static scoped slots compiled from template has the
  3714. // "$stable" marker.
  3715. var newScopedSlots = parentVnode.data.scopedSlots;
  3716. var oldScopedSlots = vm.$scopedSlots;
  3717. var hasDynamicScopedSlot = !!(
  3718. (newScopedSlots && !newScopedSlots.$stable) ||
  3719. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  3720. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  3721. );
  3722. // Any static slot children from the parent may have changed during parent's
  3723. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  3724. // update is necessary to ensure correctness.
  3725. var needsForceUpdate = !!(
  3726. renderChildren || // has new static slots
  3727. vm.$options._renderChildren || // has old static slots
  3728. hasDynamicScopedSlot
  3729. );
  3730. vm.$options._parentVnode = parentVnode;
  3731. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  3732. if (vm._vnode) { // update child tree's parent
  3733. vm._vnode.parent = parentVnode;
  3734. }
  3735. vm.$options._renderChildren = renderChildren;
  3736. // update $attrs and $listeners hash
  3737. // these are also reactive so they may trigger child update if the child
  3738. // used them during render
  3739. vm.$attrs = parentVnode.data.attrs || emptyObject;
  3740. vm.$listeners = listeners || emptyObject;
  3741. // update props
  3742. if (propsData && vm.$options.props) {
  3743. toggleObserving(false);
  3744. var props = vm._props;
  3745. var propKeys = vm.$options._propKeys || [];
  3746. for (var i = 0; i < propKeys.length; i++) {
  3747. var key = propKeys[i];
  3748. var propOptions = vm.$options.props; // wtf flow?
  3749. props[key] = validateProp(key, propOptions, propsData, vm);
  3750. }
  3751. toggleObserving(true);
  3752. // keep a copy of raw propsData
  3753. vm.$options.propsData = propsData;
  3754. }
  3755. // update listeners
  3756. listeners = listeners || emptyObject;
  3757. var oldListeners = vm.$options._parentListeners;
  3758. vm.$options._parentListeners = listeners;
  3759. updateComponentListeners(vm, listeners, oldListeners);
  3760. // resolve slots + force update if has children
  3761. if (needsForceUpdate) {
  3762. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  3763. vm.$forceUpdate();
  3764. }
  3765. {
  3766. isUpdatingChildComponent = false;
  3767. }
  3768. }
  3769. function isInInactiveTree (vm) {
  3770. while (vm && (vm = vm.$parent)) {
  3771. if (vm._inactive) { return true }
  3772. }
  3773. return false
  3774. }
  3775. function activateChildComponent (vm, direct) {
  3776. if (direct) {
  3777. vm._directInactive = false;
  3778. if (isInInactiveTree(vm)) {
  3779. return
  3780. }
  3781. } else if (vm._directInactive) {
  3782. return
  3783. }
  3784. if (vm._inactive || vm._inactive === null) {
  3785. vm._inactive = false;
  3786. for (var i = 0; i < vm.$children.length; i++) {
  3787. activateChildComponent(vm.$children[i]);
  3788. }
  3789. callHook(vm, 'activated');
  3790. }
  3791. }
  3792. function deactivateChildComponent (vm, direct) {
  3793. if (direct) {
  3794. vm._directInactive = true;
  3795. if (isInInactiveTree(vm)) {
  3796. return
  3797. }
  3798. }
  3799. if (!vm._inactive) {
  3800. vm._inactive = true;
  3801. for (var i = 0; i < vm.$children.length; i++) {
  3802. deactivateChildComponent(vm.$children[i]);
  3803. }
  3804. callHook(vm, 'deactivated');
  3805. }
  3806. }
  3807. function callHook (vm, hook) {
  3808. // #7573 disable dep collection when invoking lifecycle hooks
  3809. pushTarget();
  3810. var handlers = vm.$options[hook];
  3811. var info = hook + " hook";
  3812. if (handlers) {
  3813. for (var i = 0, j = handlers.length; i < j; i++) {
  3814. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  3815. }
  3816. }
  3817. if (vm._hasHookEvent) {
  3818. vm.$emit('hook:' + hook);
  3819. }
  3820. popTarget();
  3821. }
  3822. /* */
  3823. var MAX_UPDATE_COUNT = 100;
  3824. var queue = [];
  3825. var activatedChildren = [];
  3826. var has = {};
  3827. var circular = {};
  3828. var waiting = false;
  3829. var flushing = false;
  3830. var index = 0;
  3831. /**
  3832. * Reset the scheduler's state.
  3833. */
  3834. function resetSchedulerState () {
  3835. index = queue.length = activatedChildren.length = 0;
  3836. has = {};
  3837. {
  3838. circular = {};
  3839. }
  3840. waiting = flushing = false;
  3841. }
  3842. // Async edge case #6566 requires saving the timestamp when event listeners are
  3843. // attached. However, calling performance.now() has a perf overhead especially
  3844. // if the page has thousands of event listeners. Instead, we take a timestamp
  3845. // every time the scheduler flushes and use that for all event listeners
  3846. // attached during that flush.
  3847. var currentFlushTimestamp = 0;
  3848. // Async edge case fix requires storing an event listener's attach timestamp.
  3849. var getNow = Date.now;
  3850. // Determine what event timestamp the browser is using. Annoyingly, the
  3851. // timestamp can either be hi-res (relative to page load) or low-res
  3852. // (relative to UNIX epoch), so in order to compare time we have to use the
  3853. // same timestamp type when saving the flush timestamp.
  3854. // All IE versions use low-res event timestamps, and have problematic clock
  3855. // implementations (#9632)
  3856. if (inBrowser && !isIE) {
  3857. var performance = window.performance;
  3858. if (
  3859. performance &&
  3860. typeof performance.now === 'function' &&
  3861. getNow() > document.createEvent('Event').timeStamp
  3862. ) {
  3863. // if the event timestamp, although evaluated AFTER the Date.now(), is
  3864. // smaller than it, it means the event is using a hi-res timestamp,
  3865. // and we need to use the hi-res version for event listener timestamps as
  3866. // well.
  3867. getNow = function () { return performance.now(); };
  3868. }
  3869. }
  3870. /**
  3871. * Flush both queues and run the watchers.
  3872. */
  3873. function flushSchedulerQueue () {
  3874. currentFlushTimestamp = getNow();
  3875. flushing = true;
  3876. var watcher, id;
  3877. // Sort queue before flush.
  3878. // This ensures that:
  3879. // 1. Components are updated from parent to child. (because parent is always
  3880. // created before the child)
  3881. // 2. A component's user watchers are run before its render watcher (because
  3882. // user watchers are created before the render watcher)
  3883. // 3. If a component is destroyed during a parent component's watcher run,
  3884. // its watchers can be skipped.
  3885. queue.sort(function (a, b) { return a.id - b.id; });
  3886. // do not cache length because more watchers might be pushed
  3887. // as we run existing watchers
  3888. for (index = 0; index < queue.length; index++) {
  3889. watcher = queue[index];
  3890. if (watcher.before) {
  3891. watcher.before();
  3892. }
  3893. id = watcher.id;
  3894. has[id] = null;
  3895. watcher.run();
  3896. // in dev build, check and stop circular updates.
  3897. if (has[id] != null) {
  3898. circular[id] = (circular[id] || 0) + 1;
  3899. if (circular[id] > MAX_UPDATE_COUNT) {
  3900. warn(
  3901. 'You may have an infinite update loop ' + (
  3902. watcher.user
  3903. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  3904. : "in a component render function."
  3905. ),
  3906. watcher.vm
  3907. );
  3908. break
  3909. }
  3910. }
  3911. }
  3912. // keep copies of post queues before resetting state
  3913. var activatedQueue = activatedChildren.slice();
  3914. var updatedQueue = queue.slice();
  3915. resetSchedulerState();
  3916. // call component updated and activated hooks
  3917. callActivatedHooks(activatedQueue);
  3918. callUpdatedHooks(updatedQueue);
  3919. // devtool hook
  3920. /* istanbul ignore if */
  3921. if (devtools && config.devtools) {
  3922. devtools.emit('flush');
  3923. }
  3924. }
  3925. function callUpdatedHooks (queue) {
  3926. var i = queue.length;
  3927. while (i--) {
  3928. var watcher = queue[i];
  3929. var vm = watcher.vm;
  3930. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  3931. callHook(vm, 'updated');
  3932. }
  3933. }
  3934. }
  3935. /**
  3936. * Queue a kept-alive component that was activated during patch.
  3937. * The queue will be processed after the entire tree has been patched.
  3938. */
  3939. function queueActivatedComponent (vm) {
  3940. // setting _inactive to false here so that a render function can
  3941. // rely on checking whether it's in an inactive tree (e.g. router-view)
  3942. vm._inactive = false;
  3943. activatedChildren.push(vm);
  3944. }
  3945. function callActivatedHooks (queue) {
  3946. for (var i = 0; i < queue.length; i++) {
  3947. queue[i]._inactive = true;
  3948. activateChildComponent(queue[i], true /* true */);
  3949. }
  3950. }
  3951. /**
  3952. * Push a watcher into the watcher queue.
  3953. * Jobs with duplicate IDs will be skipped unless it's
  3954. * pushed when the queue is being flushed.
  3955. */
  3956. function queueWatcher (watcher) {
  3957. var id = watcher.id;
  3958. if (has[id] == null) {
  3959. has[id] = true;
  3960. if (!flushing) {
  3961. queue.push(watcher);
  3962. } else {
  3963. // if already flushing, splice the watcher based on its id
  3964. // if already past its id, it will be run next immediately.
  3965. var i = queue.length - 1;
  3966. while (i > index && queue[i].id > watcher.id) {
  3967. i--;
  3968. }
  3969. queue.splice(i + 1, 0, watcher);
  3970. }
  3971. // queue the flush
  3972. if (!waiting) {
  3973. waiting = true;
  3974. if (!config.async) {
  3975. flushSchedulerQueue();
  3976. return
  3977. }
  3978. nextTick(flushSchedulerQueue);
  3979. }
  3980. }
  3981. }
  3982. /* */
  3983. var uid$2 = 0;
  3984. /**
  3985. * A watcher parses an expression, collects dependencies,
  3986. * and fires callback when the expression value changes.
  3987. * This is used for both the $watch() api and directives.
  3988. */
  3989. var Watcher = function Watcher (
  3990. vm,
  3991. expOrFn,
  3992. cb,
  3993. options,
  3994. isRenderWatcher
  3995. ) {
  3996. this.vm = vm;
  3997. if (isRenderWatcher) {
  3998. vm._watcher = this;
  3999. }
  4000. vm._watchers.push(this);
  4001. // options
  4002. if (options) {
  4003. this.deep = !!options.deep;
  4004. this.user = !!options.user;
  4005. this.lazy = !!options.lazy;
  4006. this.sync = !!options.sync;
  4007. this.before = options.before;
  4008. } else {
  4009. this.deep = this.user = this.lazy = this.sync = false;
  4010. }
  4011. this.cb = cb;
  4012. this.id = ++uid$2; // uid for batching
  4013. this.active = true;
  4014. this.dirty = this.lazy; // for lazy watchers
  4015. this.deps = [];
  4016. this.newDeps = [];
  4017. this.depIds = new _Set();
  4018. this.newDepIds = new _Set();
  4019. this.expression = expOrFn.toString();
  4020. // parse expression for getter
  4021. if (typeof expOrFn === 'function') {
  4022. this.getter = expOrFn;
  4023. } else {
  4024. this.getter = parsePath(expOrFn);
  4025. if (!this.getter) {
  4026. this.getter = noop;
  4027. warn(
  4028. "Failed watching path: \"" + expOrFn + "\" " +
  4029. 'Watcher only accepts simple dot-delimited paths. ' +
  4030. 'For full control, use a function instead.',
  4031. vm
  4032. );
  4033. }
  4034. }
  4035. this.value = this.lazy
  4036. ? undefined
  4037. : this.get();
  4038. };
  4039. /**
  4040. * Evaluate the getter, and re-collect dependencies.
  4041. */
  4042. Watcher.prototype.get = function get () {
  4043. pushTarget(this);
  4044. var value;
  4045. var vm = this.vm;
  4046. try {
  4047. value = this.getter.call(vm, vm);
  4048. } catch (e) {
  4049. if (this.user) {
  4050. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  4051. } else {
  4052. throw e
  4053. }
  4054. } finally {
  4055. // "touch" every property so they are all tracked as
  4056. // dependencies for deep watching
  4057. if (this.deep) {
  4058. traverse(value);
  4059. }
  4060. popTarget();
  4061. this.cleanupDeps();
  4062. }
  4063. return value
  4064. };
  4065. /**
  4066. * Add a dependency to this directive.
  4067. */
  4068. Watcher.prototype.addDep = function addDep (dep) {
  4069. var id = dep.id;
  4070. if (!this.newDepIds.has(id)) {
  4071. this.newDepIds.add(id);
  4072. this.newDeps.push(dep);
  4073. if (!this.depIds.has(id)) {
  4074. dep.addSub(this);
  4075. }
  4076. }
  4077. };
  4078. /**
  4079. * Clean up for dependency collection.
  4080. */
  4081. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  4082. var i = this.deps.length;
  4083. while (i--) {
  4084. var dep = this.deps[i];
  4085. if (!this.newDepIds.has(dep.id)) {
  4086. dep.removeSub(this);
  4087. }
  4088. }
  4089. var tmp = this.depIds;
  4090. this.depIds = this.newDepIds;
  4091. this.newDepIds = tmp;
  4092. this.newDepIds.clear();
  4093. tmp = this.deps;
  4094. this.deps = this.newDeps;
  4095. this.newDeps = tmp;
  4096. this.newDeps.length = 0;
  4097. };
  4098. /**
  4099. * Subscriber interface.
  4100. * Will be called when a dependency changes.
  4101. */
  4102. Watcher.prototype.update = function update () {
  4103. /* istanbul ignore else */
  4104. if (this.lazy) {
  4105. this.dirty = true;
  4106. } else if (this.sync) {
  4107. this.run();
  4108. } else {
  4109. queueWatcher(this);
  4110. }
  4111. };
  4112. /**
  4113. * Scheduler job interface.
  4114. * Will be called by the scheduler.
  4115. */
  4116. Watcher.prototype.run = function run () {
  4117. if (this.active) {
  4118. var value = this.get();
  4119. if (
  4120. value !== this.value ||
  4121. // Deep watchers and watchers on Object/Arrays should fire even
  4122. // when the value is the same, because the value may
  4123. // have mutated.
  4124. isObject(value) ||
  4125. this.deep
  4126. ) {
  4127. // set new value
  4128. var oldValue = this.value;
  4129. this.value = value;
  4130. if (this.user) {
  4131. try {
  4132. this.cb.call(this.vm, value, oldValue);
  4133. } catch (e) {
  4134. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  4135. }
  4136. } else {
  4137. this.cb.call(this.vm, value, oldValue);
  4138. }
  4139. }
  4140. }
  4141. };
  4142. /**
  4143. * Evaluate the value of the watcher.
  4144. * This only gets called for lazy watchers.
  4145. */
  4146. Watcher.prototype.evaluate = function evaluate () {
  4147. this.value = this.get();
  4148. this.dirty = false;
  4149. };
  4150. /**
  4151. * Depend on all deps collected by this watcher.
  4152. */
  4153. Watcher.prototype.depend = function depend () {
  4154. var i = this.deps.length;
  4155. while (i--) {
  4156. this.deps[i].depend();
  4157. }
  4158. };
  4159. /**
  4160. * Remove self from all dependencies' subscriber list.
  4161. */
  4162. Watcher.prototype.teardown = function teardown () {
  4163. if (this.active) {
  4164. // remove self from vm's watcher list
  4165. // this is a somewhat expensive operation so we skip it
  4166. // if the vm is being destroyed.
  4167. if (!this.vm._isBeingDestroyed) {
  4168. remove(this.vm._watchers, this);
  4169. }
  4170. var i = this.deps.length;
  4171. while (i--) {
  4172. this.deps[i].removeSub(this);
  4173. }
  4174. this.active = false;
  4175. }
  4176. };
  4177. /* */
  4178. var sharedPropertyDefinition = {
  4179. enumerable: true,
  4180. configurable: true,
  4181. get: noop,
  4182. set: noop
  4183. };
  4184. function proxy (target, sourceKey, key) {
  4185. sharedPropertyDefinition.get = function proxyGetter () {
  4186. return this[sourceKey][key]
  4187. };
  4188. sharedPropertyDefinition.set = function proxySetter (val) {
  4189. this[sourceKey][key] = val;
  4190. };
  4191. Object.defineProperty(target, key, sharedPropertyDefinition);
  4192. }
  4193. function initState (vm) {
  4194. vm._watchers = [];
  4195. var opts = vm.$options;
  4196. if (opts.props) { initProps(vm, opts.props); }
  4197. if (opts.methods) { initMethods(vm, opts.methods); }
  4198. if (opts.data) {
  4199. initData(vm);
  4200. } else {
  4201. observe(vm._data = {}, true /* asRootData */);
  4202. }
  4203. if (opts.computed) { initComputed(vm, opts.computed); }
  4204. if (opts.watch && opts.watch !== nativeWatch) {
  4205. initWatch(vm, opts.watch);
  4206. }
  4207. }
  4208. function initProps (vm, propsOptions) {
  4209. var propsData = vm.$options.propsData || {};
  4210. var props = vm._props = {};
  4211. // cache prop keys so that future props updates can iterate using Array
  4212. // instead of dynamic object key enumeration.
  4213. var keys = vm.$options._propKeys = [];
  4214. var isRoot = !vm.$parent;
  4215. // root instance props should be converted
  4216. if (!isRoot) {
  4217. toggleObserving(false);
  4218. }
  4219. var loop = function ( key ) {
  4220. keys.push(key);
  4221. var value = validateProp(key, propsOptions, propsData, vm);
  4222. /* istanbul ignore else */
  4223. {
  4224. var hyphenatedKey = hyphenate(key);
  4225. if (isReservedAttribute(hyphenatedKey) ||
  4226. config.isReservedAttr(hyphenatedKey)) {
  4227. warn(
  4228. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  4229. vm
  4230. );
  4231. }
  4232. defineReactive$$1(props, key, value, function () {
  4233. if (!isRoot && !isUpdatingChildComponent) {
  4234. warn(
  4235. "Avoid mutating a prop directly since the value will be " +
  4236. "overwritten whenever the parent component re-renders. " +
  4237. "Instead, use a data or computed property based on the prop's " +
  4238. "value. Prop being mutated: \"" + key + "\"",
  4239. vm
  4240. );
  4241. }
  4242. });
  4243. }
  4244. // static props are already proxied on the component's prototype
  4245. // during Vue.extend(). We only need to proxy props defined at
  4246. // instantiation here.
  4247. if (!(key in vm)) {
  4248. proxy(vm, "_props", key);
  4249. }
  4250. };
  4251. for (var key in propsOptions) loop( key );
  4252. toggleObserving(true);
  4253. }
  4254. function initData (vm) {
  4255. var data = vm.$options.data;
  4256. data = vm._data = typeof data === 'function'
  4257. ? getData(data, vm)
  4258. : data || {};
  4259. if (!isPlainObject(data)) {
  4260. data = {};
  4261. warn(
  4262. 'data functions should return an object:\n' +
  4263. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  4264. vm
  4265. );
  4266. }
  4267. // proxy data on instance
  4268. var keys = Object.keys(data);
  4269. var props = vm.$options.props;
  4270. var methods = vm.$options.methods;
  4271. var i = keys.length;
  4272. while (i--) {
  4273. var key = keys[i];
  4274. {
  4275. if (methods && hasOwn(methods, key)) {
  4276. warn(
  4277. ("Method \"" + key + "\" has already been defined as a data property."),
  4278. vm
  4279. );
  4280. }
  4281. }
  4282. if (props && hasOwn(props, key)) {
  4283. warn(
  4284. "The data property \"" + key + "\" is already declared as a prop. " +
  4285. "Use prop default value instead.",
  4286. vm
  4287. );
  4288. } else if (!isReserved(key)) {
  4289. proxy(vm, "_data", key);
  4290. }
  4291. }
  4292. // observe data
  4293. observe(data, true /* asRootData */);
  4294. }
  4295. function getData (data, vm) {
  4296. // #7573 disable dep collection when invoking data getters
  4297. pushTarget();
  4298. try {
  4299. return data.call(vm, vm)
  4300. } catch (e) {
  4301. handleError(e, vm, "data()");
  4302. return {}
  4303. } finally {
  4304. popTarget();
  4305. }
  4306. }
  4307. var computedWatcherOptions = { lazy: true };
  4308. function initComputed (vm, computed) {
  4309. // $flow-disable-line
  4310. var watchers = vm._computedWatchers = Object.create(null);
  4311. // computed properties are just getters during SSR
  4312. var isSSR = isServerRendering();
  4313. for (var key in computed) {
  4314. var userDef = computed[key];
  4315. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  4316. if (getter == null) {
  4317. warn(
  4318. ("Getter is missing for computed property \"" + key + "\"."),
  4319. vm
  4320. );
  4321. }
  4322. if (!isSSR) {
  4323. // create internal watcher for the computed property.
  4324. watchers[key] = new Watcher(
  4325. vm,
  4326. getter || noop,
  4327. noop,
  4328. computedWatcherOptions
  4329. );
  4330. }
  4331. // component-defined computed properties are already defined on the
  4332. // component prototype. We only need to define computed properties defined
  4333. // at instantiation here.
  4334. if (!(key in vm)) {
  4335. defineComputed(vm, key, userDef);
  4336. } else {
  4337. if (key in vm.$data) {
  4338. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  4339. } else if (vm.$options.props && key in vm.$options.props) {
  4340. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  4341. }
  4342. }
  4343. }
  4344. }
  4345. function defineComputed (
  4346. target,
  4347. key,
  4348. userDef
  4349. ) {
  4350. var shouldCache = !isServerRendering();
  4351. if (typeof userDef === 'function') {
  4352. sharedPropertyDefinition.get = shouldCache
  4353. ? createComputedGetter(key)
  4354. : createGetterInvoker(userDef);
  4355. sharedPropertyDefinition.set = noop;
  4356. } else {
  4357. sharedPropertyDefinition.get = userDef.get
  4358. ? shouldCache && userDef.cache !== false
  4359. ? createComputedGetter(key)
  4360. : createGetterInvoker(userDef.get)
  4361. : noop;
  4362. sharedPropertyDefinition.set = userDef.set || noop;
  4363. }
  4364. if (sharedPropertyDefinition.set === noop) {
  4365. sharedPropertyDefinition.set = function () {
  4366. warn(
  4367. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  4368. this
  4369. );
  4370. };
  4371. }
  4372. Object.defineProperty(target, key, sharedPropertyDefinition);
  4373. }
  4374. function createComputedGetter (key) {
  4375. return function computedGetter () {
  4376. var watcher = this._computedWatchers && this._computedWatchers[key];
  4377. if (watcher) {
  4378. if (watcher.dirty) {
  4379. watcher.evaluate();
  4380. }
  4381. if (Dep.target) {
  4382. watcher.depend();
  4383. }
  4384. return watcher.value
  4385. }
  4386. }
  4387. }
  4388. function createGetterInvoker(fn) {
  4389. return function computedGetter () {
  4390. return fn.call(this, this)
  4391. }
  4392. }
  4393. function initMethods (vm, methods) {
  4394. var props = vm.$options.props;
  4395. for (var key in methods) {
  4396. {
  4397. if (typeof methods[key] !== 'function') {
  4398. warn(
  4399. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  4400. "Did you reference the function correctly?",
  4401. vm
  4402. );
  4403. }
  4404. if (props && hasOwn(props, key)) {
  4405. warn(
  4406. ("Method \"" + key + "\" has already been defined as a prop."),
  4407. vm
  4408. );
  4409. }
  4410. if ((key in vm) && isReserved(key)) {
  4411. warn(
  4412. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  4413. "Avoid defining component methods that start with _ or $."
  4414. );
  4415. }
  4416. }
  4417. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  4418. }
  4419. }
  4420. function initWatch (vm, watch) {
  4421. for (var key in watch) {
  4422. var handler = watch[key];
  4423. if (Array.isArray(handler)) {
  4424. for (var i = 0; i < handler.length; i++) {
  4425. createWatcher(vm, key, handler[i]);
  4426. }
  4427. } else {
  4428. createWatcher(vm, key, handler);
  4429. }
  4430. }
  4431. }
  4432. function createWatcher (
  4433. vm,
  4434. expOrFn,
  4435. handler,
  4436. options
  4437. ) {
  4438. if (isPlainObject(handler)) {
  4439. options = handler;
  4440. handler = handler.handler;
  4441. }
  4442. if (typeof handler === 'string') {
  4443. handler = vm[handler];
  4444. }
  4445. return vm.$watch(expOrFn, handler, options)
  4446. }
  4447. function stateMixin (Vue) {
  4448. // flow somehow has problems with directly declared definition object
  4449. // when using Object.defineProperty, so we have to procedurally build up
  4450. // the object here.
  4451. var dataDef = {};
  4452. dataDef.get = function () { return this._data };
  4453. var propsDef = {};
  4454. propsDef.get = function () { return this._props };
  4455. {
  4456. dataDef.set = function () {
  4457. warn(
  4458. 'Avoid replacing instance root $data. ' +
  4459. 'Use nested data properties instead.',
  4460. this
  4461. );
  4462. };
  4463. propsDef.set = function () {
  4464. warn("$props is readonly.", this);
  4465. };
  4466. }
  4467. Object.defineProperty(Vue.prototype, '$data', dataDef);
  4468. Object.defineProperty(Vue.prototype, '$props', propsDef);
  4469. Vue.prototype.$set = set;
  4470. Vue.prototype.$delete = del;
  4471. Vue.prototype.$watch = function (
  4472. expOrFn,
  4473. cb,
  4474. options
  4475. ) {
  4476. var vm = this;
  4477. if (isPlainObject(cb)) {
  4478. return createWatcher(vm, expOrFn, cb, options)
  4479. }
  4480. options = options || {};
  4481. options.user = true;
  4482. var watcher = new Watcher(vm, expOrFn, cb, options);
  4483. if (options.immediate) {
  4484. try {
  4485. cb.call(vm, watcher.value);
  4486. } catch (error) {
  4487. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  4488. }
  4489. }
  4490. return function unwatchFn () {
  4491. watcher.teardown();
  4492. }
  4493. };
  4494. }
  4495. /* */
  4496. var uid$3 = 0;
  4497. function initMixin (Vue) {
  4498. Vue.prototype._init = function (options) {
  4499. var vm = this;
  4500. // a uid
  4501. vm._uid = uid$3++;
  4502. var startTag, endTag;
  4503. /* istanbul ignore if */
  4504. if (config.performance && mark) {
  4505. startTag = "vue-perf-start:" + (vm._uid);
  4506. endTag = "vue-perf-end:" + (vm._uid);
  4507. mark(startTag);
  4508. }
  4509. // a flag to avoid this being observed
  4510. vm._isVue = true;
  4511. // merge options
  4512. if (options && options._isComponent) {
  4513. // optimize internal component instantiation
  4514. // since dynamic options merging is pretty slow, and none of the
  4515. // internal component options needs special treatment.
  4516. initInternalComponent(vm, options);
  4517. } else {
  4518. vm.$options = mergeOptions(
  4519. resolveConstructorOptions(vm.constructor),
  4520. options || {},
  4521. vm
  4522. );
  4523. }
  4524. /* istanbul ignore else */
  4525. {
  4526. initProxy(vm);
  4527. }
  4528. // expose real self
  4529. vm._self = vm;
  4530. initLifecycle(vm);
  4531. initEvents(vm);
  4532. initRender(vm);
  4533. callHook(vm, 'beforeCreate');
  4534. initInjections(vm); // resolve injections before data/props
  4535. initState(vm);
  4536. initProvide(vm); // resolve provide after data/props
  4537. callHook(vm, 'created');
  4538. /* istanbul ignore if */
  4539. if (config.performance && mark) {
  4540. vm._name = formatComponentName(vm, false);
  4541. mark(endTag);
  4542. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  4543. }
  4544. if (vm.$options.el) {
  4545. vm.$mount(vm.$options.el);
  4546. }
  4547. };
  4548. }
  4549. function initInternalComponent (vm, options) {
  4550. var opts = vm.$options = Object.create(vm.constructor.options);
  4551. // doing this because it's faster than dynamic enumeration.
  4552. var parentVnode = options._parentVnode;
  4553. opts.parent = options.parent;
  4554. opts._parentVnode = parentVnode;
  4555. var vnodeComponentOptions = parentVnode.componentOptions;
  4556. opts.propsData = vnodeComponentOptions.propsData;
  4557. opts._parentListeners = vnodeComponentOptions.listeners;
  4558. opts._renderChildren = vnodeComponentOptions.children;
  4559. opts._componentTag = vnodeComponentOptions.tag;
  4560. if (options.render) {
  4561. opts.render = options.render;
  4562. opts.staticRenderFns = options.staticRenderFns;
  4563. }
  4564. }
  4565. function resolveConstructorOptions (Ctor) {
  4566. var options = Ctor.options;
  4567. if (Ctor.super) {
  4568. var superOptions = resolveConstructorOptions(Ctor.super);
  4569. var cachedSuperOptions = Ctor.superOptions;
  4570. if (superOptions !== cachedSuperOptions) {
  4571. // super option changed,
  4572. // need to resolve new options.
  4573. Ctor.superOptions = superOptions;
  4574. // check if there are any late-modified/attached options (#4976)
  4575. var modifiedOptions = resolveModifiedOptions(Ctor);
  4576. // update base extend options
  4577. if (modifiedOptions) {
  4578. extend(Ctor.extendOptions, modifiedOptions);
  4579. }
  4580. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4581. if (options.name) {
  4582. options.components[options.name] = Ctor;
  4583. }
  4584. }
  4585. }
  4586. return options
  4587. }
  4588. function resolveModifiedOptions (Ctor) {
  4589. var modified;
  4590. var latest = Ctor.options;
  4591. var sealed = Ctor.sealedOptions;
  4592. for (var key in latest) {
  4593. if (latest[key] !== sealed[key]) {
  4594. if (!modified) { modified = {}; }
  4595. modified[key] = latest[key];
  4596. }
  4597. }
  4598. return modified
  4599. }
  4600. function Vue (options) {
  4601. if (!(this instanceof Vue)
  4602. ) {
  4603. warn('Vue is a constructor and should be called with the `new` keyword');
  4604. }
  4605. this._init(options);
  4606. }
  4607. initMixin(Vue);
  4608. stateMixin(Vue);
  4609. eventsMixin(Vue);
  4610. lifecycleMixin(Vue);
  4611. renderMixin(Vue);
  4612. /* */
  4613. function initUse (Vue) {
  4614. Vue.use = function (plugin) {
  4615. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  4616. if (installedPlugins.indexOf(plugin) > -1) {
  4617. return this
  4618. }
  4619. // additional parameters
  4620. var args = toArray(arguments, 1);
  4621. args.unshift(this);
  4622. if (typeof plugin.install === 'function') {
  4623. plugin.install.apply(plugin, args);
  4624. } else if (typeof plugin === 'function') {
  4625. plugin.apply(null, args);
  4626. }
  4627. installedPlugins.push(plugin);
  4628. return this
  4629. };
  4630. }
  4631. /* */
  4632. function initMixin$1 (Vue) {
  4633. Vue.mixin = function (mixin) {
  4634. this.options = mergeOptions(this.options, mixin);
  4635. return this
  4636. };
  4637. }
  4638. /* */
  4639. function initExtend (Vue) {
  4640. /**
  4641. * Each instance constructor, including Vue, has a unique
  4642. * cid. This enables us to create wrapped "child
  4643. * constructors" for prototypal inheritance and cache them.
  4644. */
  4645. Vue.cid = 0;
  4646. var cid = 1;
  4647. /**
  4648. * Class inheritance
  4649. */
  4650. Vue.extend = function (extendOptions) {
  4651. extendOptions = extendOptions || {};
  4652. var Super = this;
  4653. var SuperId = Super.cid;
  4654. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  4655. if (cachedCtors[SuperId]) {
  4656. return cachedCtors[SuperId]
  4657. }
  4658. var name = extendOptions.name || Super.options.name;
  4659. if (name) {
  4660. validateComponentName(name);
  4661. }
  4662. var Sub = function VueComponent (options) {
  4663. this._init(options);
  4664. };
  4665. Sub.prototype = Object.create(Super.prototype);
  4666. Sub.prototype.constructor = Sub;
  4667. Sub.cid = cid++;
  4668. Sub.options = mergeOptions(
  4669. Super.options,
  4670. extendOptions
  4671. );
  4672. Sub['super'] = Super;
  4673. // For props and computed properties, we define the proxy getters on
  4674. // the Vue instances at extension time, on the extended prototype. This
  4675. // avoids Object.defineProperty calls for each instance created.
  4676. if (Sub.options.props) {
  4677. initProps$1(Sub);
  4678. }
  4679. if (Sub.options.computed) {
  4680. initComputed$1(Sub);
  4681. }
  4682. // allow further extension/mixin/plugin usage
  4683. Sub.extend = Super.extend;
  4684. Sub.mixin = Super.mixin;
  4685. Sub.use = Super.use;
  4686. // create asset registers, so extended classes
  4687. // can have their private assets too.
  4688. ASSET_TYPES.forEach(function (type) {
  4689. Sub[type] = Super[type];
  4690. });
  4691. // enable recursive self-lookup
  4692. if (name) {
  4693. Sub.options.components[name] = Sub;
  4694. }
  4695. // keep a reference to the super options at extension time.
  4696. // later at instantiation we can check if Super's options have
  4697. // been updated.
  4698. Sub.superOptions = Super.options;
  4699. Sub.extendOptions = extendOptions;
  4700. Sub.sealedOptions = extend({}, Sub.options);
  4701. // cache constructor
  4702. cachedCtors[SuperId] = Sub;
  4703. return Sub
  4704. };
  4705. }
  4706. function initProps$1 (Comp) {
  4707. var props = Comp.options.props;
  4708. for (var key in props) {
  4709. proxy(Comp.prototype, "_props", key);
  4710. }
  4711. }
  4712. function initComputed$1 (Comp) {
  4713. var computed = Comp.options.computed;
  4714. for (var key in computed) {
  4715. defineComputed(Comp.prototype, key, computed[key]);
  4716. }
  4717. }
  4718. /* */
  4719. function initAssetRegisters (Vue) {
  4720. /**
  4721. * Create asset registration methods.
  4722. */
  4723. ASSET_TYPES.forEach(function (type) {
  4724. Vue[type] = function (
  4725. id,
  4726. definition
  4727. ) {
  4728. if (!definition) {
  4729. return this.options[type + 's'][id]
  4730. } else {
  4731. /* istanbul ignore if */
  4732. if (type === 'component') {
  4733. validateComponentName(id);
  4734. }
  4735. if (type === 'component' && isPlainObject(definition)) {
  4736. definition.name = definition.name || id;
  4737. definition = this.options._base.extend(definition);
  4738. }
  4739. if (type === 'directive' && typeof definition === 'function') {
  4740. definition = { bind: definition, update: definition };
  4741. }
  4742. this.options[type + 's'][id] = definition;
  4743. return definition
  4744. }
  4745. };
  4746. });
  4747. }
  4748. /* */
  4749. function getComponentName (opts) {
  4750. return opts && (opts.Ctor.options.name || opts.tag)
  4751. }
  4752. function matches (pattern, name) {
  4753. if (Array.isArray(pattern)) {
  4754. return pattern.indexOf(name) > -1
  4755. } else if (typeof pattern === 'string') {
  4756. return pattern.split(',').indexOf(name) > -1
  4757. } else if (isRegExp(pattern)) {
  4758. return pattern.test(name)
  4759. }
  4760. /* istanbul ignore next */
  4761. return false
  4762. }
  4763. function pruneCache (keepAliveInstance, filter) {
  4764. var cache = keepAliveInstance.cache;
  4765. var keys = keepAliveInstance.keys;
  4766. var _vnode = keepAliveInstance._vnode;
  4767. for (var key in cache) {
  4768. var cachedNode = cache[key];
  4769. if (cachedNode) {
  4770. var name = getComponentName(cachedNode.componentOptions);
  4771. if (name && !filter(name)) {
  4772. pruneCacheEntry(cache, key, keys, _vnode);
  4773. }
  4774. }
  4775. }
  4776. }
  4777. function pruneCacheEntry (
  4778. cache,
  4779. key,
  4780. keys,
  4781. current
  4782. ) {
  4783. var cached$$1 = cache[key];
  4784. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  4785. cached$$1.componentInstance.$destroy();
  4786. }
  4787. cache[key] = null;
  4788. remove(keys, key);
  4789. }
  4790. var patternTypes = [String, RegExp, Array];
  4791. var KeepAlive = {
  4792. name: 'keep-alive',
  4793. abstract: true,
  4794. props: {
  4795. include: patternTypes,
  4796. exclude: patternTypes,
  4797. max: [String, Number]
  4798. },
  4799. created: function created () {
  4800. this.cache = Object.create(null);
  4801. this.keys = [];
  4802. },
  4803. destroyed: function destroyed () {
  4804. for (var key in this.cache) {
  4805. pruneCacheEntry(this.cache, key, this.keys);
  4806. }
  4807. },
  4808. mounted: function mounted () {
  4809. var this$1 = this;
  4810. this.$watch('include', function (val) {
  4811. pruneCache(this$1, function (name) { return matches(val, name); });
  4812. });
  4813. this.$watch('exclude', function (val) {
  4814. pruneCache(this$1, function (name) { return !matches(val, name); });
  4815. });
  4816. },
  4817. render: function render () {
  4818. var slot = this.$slots.default;
  4819. var vnode = getFirstComponentChild(slot);
  4820. var componentOptions = vnode && vnode.componentOptions;
  4821. if (componentOptions) {
  4822. // check pattern
  4823. var name = getComponentName(componentOptions);
  4824. var ref = this;
  4825. var include = ref.include;
  4826. var exclude = ref.exclude;
  4827. if (
  4828. // not included
  4829. (include && (!name || !matches(include, name))) ||
  4830. // excluded
  4831. (exclude && name && matches(exclude, name))
  4832. ) {
  4833. return vnode
  4834. }
  4835. var ref$1 = this;
  4836. var cache = ref$1.cache;
  4837. var keys = ref$1.keys;
  4838. var key = vnode.key == null
  4839. // same constructor may get registered as different local components
  4840. // so cid alone is not enough (#3269)
  4841. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  4842. : vnode.key;
  4843. if (cache[key]) {
  4844. vnode.componentInstance = cache[key].componentInstance;
  4845. // make current key freshest
  4846. remove(keys, key);
  4847. keys.push(key);
  4848. } else {
  4849. cache[key] = vnode;
  4850. keys.push(key);
  4851. // prune oldest entry
  4852. if (this.max && keys.length > parseInt(this.max)) {
  4853. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  4854. }
  4855. }
  4856. vnode.data.keepAlive = true;
  4857. }
  4858. return vnode || (slot && slot[0])
  4859. }
  4860. };
  4861. var builtInComponents = {
  4862. KeepAlive: KeepAlive
  4863. };
  4864. /* */
  4865. function initGlobalAPI (Vue) {
  4866. // config
  4867. var configDef = {};
  4868. configDef.get = function () { return config; };
  4869. {
  4870. configDef.set = function () {
  4871. warn(
  4872. 'Do not replace the Vue.config object, set individual fields instead.'
  4873. );
  4874. };
  4875. }
  4876. Object.defineProperty(Vue, 'config', configDef);
  4877. // exposed util methods.
  4878. // NOTE: these are not considered part of the public API - avoid relying on
  4879. // them unless you are aware of the risk.
  4880. Vue.util = {
  4881. warn: warn,
  4882. extend: extend,
  4883. mergeOptions: mergeOptions,
  4884. defineReactive: defineReactive$$1
  4885. };
  4886. Vue.set = set;
  4887. Vue.delete = del;
  4888. Vue.nextTick = nextTick;
  4889. // 2.6 explicit observable API
  4890. Vue.observable = function (obj) {
  4891. observe(obj);
  4892. return obj
  4893. };
  4894. Vue.options = Object.create(null);
  4895. ASSET_TYPES.forEach(function (type) {
  4896. Vue.options[type + 's'] = Object.create(null);
  4897. });
  4898. // this is used to identify the "base" constructor to extend all plain-object
  4899. // components with in Weex's multi-instance scenarios.
  4900. Vue.options._base = Vue;
  4901. extend(Vue.options.components, builtInComponents);
  4902. initUse(Vue);
  4903. initMixin$1(Vue);
  4904. initExtend(Vue);
  4905. initAssetRegisters(Vue);
  4906. }
  4907. initGlobalAPI(Vue);
  4908. Object.defineProperty(Vue.prototype, '$isServer', {
  4909. get: isServerRendering
  4910. });
  4911. Object.defineProperty(Vue.prototype, '$ssrContext', {
  4912. get: function get () {
  4913. /* istanbul ignore next */
  4914. return this.$vnode && this.$vnode.ssrContext
  4915. }
  4916. });
  4917. // expose FunctionalRenderContext for ssr runtime helper installation
  4918. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  4919. value: FunctionalRenderContext
  4920. });
  4921. Vue.version = '2.6.10';
  4922. /* */
  4923. // these are reserved for web because they are directly compiled away
  4924. // during template compilation
  4925. var isReservedAttr = makeMap('style,class');
  4926. // attributes that should be using props for binding
  4927. var acceptValue = makeMap('input,textarea,option,select,progress');
  4928. var mustUseProp = function (tag, type, attr) {
  4929. return (
  4930. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  4931. (attr === 'selected' && tag === 'option') ||
  4932. (attr === 'checked' && tag === 'input') ||
  4933. (attr === 'muted' && tag === 'video')
  4934. )
  4935. };
  4936. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  4937. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  4938. var convertEnumeratedValue = function (key, value) {
  4939. return isFalsyAttrValue(value) || value === 'false'
  4940. ? 'false'
  4941. // allow arbitrary string value for contenteditable
  4942. : key === 'contenteditable' && isValidContentEditableValue(value)
  4943. ? value
  4944. : 'true'
  4945. };
  4946. var isBooleanAttr = makeMap(
  4947. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  4948. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  4949. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  4950. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  4951. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  4952. 'truespeed,typemustmatch,visible'
  4953. );
  4954. var xlinkNS = 'http://www.w3.org/1999/xlink';
  4955. var isXlink = function (name) {
  4956. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  4957. };
  4958. var getXlinkProp = function (name) {
  4959. return isXlink(name) ? name.slice(6, name.length) : ''
  4960. };
  4961. var isFalsyAttrValue = function (val) {
  4962. return val == null || val === false
  4963. };
  4964. /* */
  4965. function genClassForVnode (vnode) {
  4966. var data = vnode.data;
  4967. var parentNode = vnode;
  4968. var childNode = vnode;
  4969. while (isDef(childNode.componentInstance)) {
  4970. childNode = childNode.componentInstance._vnode;
  4971. if (childNode && childNode.data) {
  4972. data = mergeClassData(childNode.data, data);
  4973. }
  4974. }
  4975. while (isDef(parentNode = parentNode.parent)) {
  4976. if (parentNode && parentNode.data) {
  4977. data = mergeClassData(data, parentNode.data);
  4978. }
  4979. }
  4980. return renderClass(data.staticClass, data.class)
  4981. }
  4982. function mergeClassData (child, parent) {
  4983. return {
  4984. staticClass: concat(child.staticClass, parent.staticClass),
  4985. class: isDef(child.class)
  4986. ? [child.class, parent.class]
  4987. : parent.class
  4988. }
  4989. }
  4990. function renderClass (
  4991. staticClass,
  4992. dynamicClass
  4993. ) {
  4994. if (isDef(staticClass) || isDef(dynamicClass)) {
  4995. return concat(staticClass, stringifyClass(dynamicClass))
  4996. }
  4997. /* istanbul ignore next */
  4998. return ''
  4999. }
  5000. function concat (a, b) {
  5001. return a ? b ? (a + ' ' + b) : a : (b || '')
  5002. }
  5003. function stringifyClass (value) {
  5004. if (Array.isArray(value)) {
  5005. return stringifyArray(value)
  5006. }
  5007. if (isObject(value)) {
  5008. return stringifyObject(value)
  5009. }
  5010. if (typeof value === 'string') {
  5011. return value
  5012. }
  5013. /* istanbul ignore next */
  5014. return ''
  5015. }
  5016. function stringifyArray (value) {
  5017. var res = '';
  5018. var stringified;
  5019. for (var i = 0, l = value.length; i < l; i++) {
  5020. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  5021. if (res) { res += ' '; }
  5022. res += stringified;
  5023. }
  5024. }
  5025. return res
  5026. }
  5027. function stringifyObject (value) {
  5028. var res = '';
  5029. for (var key in value) {
  5030. if (value[key]) {
  5031. if (res) { res += ' '; }
  5032. res += key;
  5033. }
  5034. }
  5035. return res
  5036. }
  5037. /* */
  5038. var namespaceMap = {
  5039. svg: 'http://www.w3.org/2000/svg',
  5040. math: 'http://www.w3.org/1998/Math/MathML'
  5041. };
  5042. var isHTMLTag = makeMap(
  5043. 'html,body,base,head,link,meta,style,title,' +
  5044. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  5045. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  5046. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  5047. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  5048. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  5049. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  5050. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  5051. 'output,progress,select,textarea,' +
  5052. 'details,dialog,menu,menuitem,summary,' +
  5053. 'content,element,shadow,template,blockquote,iframe,tfoot'
  5054. );
  5055. // this map is intentionally selective, only covering SVG elements that may
  5056. // contain child elements.
  5057. var isSVG = makeMap(
  5058. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  5059. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  5060. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  5061. true
  5062. );
  5063. var isPreTag = function (tag) { return tag === 'pre'; };
  5064. var isReservedTag = function (tag) {
  5065. return isHTMLTag(tag) || isSVG(tag)
  5066. };
  5067. function getTagNamespace (tag) {
  5068. if (isSVG(tag)) {
  5069. return 'svg'
  5070. }
  5071. // basic support for MathML
  5072. // note it doesn't support other MathML elements being component roots
  5073. if (tag === 'math') {
  5074. return 'math'
  5075. }
  5076. }
  5077. var unknownElementCache = Object.create(null);
  5078. function isUnknownElement (tag) {
  5079. /* istanbul ignore if */
  5080. if (!inBrowser) {
  5081. return true
  5082. }
  5083. if (isReservedTag(tag)) {
  5084. return false
  5085. }
  5086. tag = tag.toLowerCase();
  5087. /* istanbul ignore if */
  5088. if (unknownElementCache[tag] != null) {
  5089. return unknownElementCache[tag]
  5090. }
  5091. var el = document.createElement(tag);
  5092. if (tag.indexOf('-') > -1) {
  5093. // http://stackoverflow.com/a/28210364/1070244
  5094. return (unknownElementCache[tag] = (
  5095. el.constructor === window.HTMLUnknownElement ||
  5096. el.constructor === window.HTMLElement
  5097. ))
  5098. } else {
  5099. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  5100. }
  5101. }
  5102. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  5103. /* */
  5104. /**
  5105. * Query an element selector if it's not an element already.
  5106. */
  5107. function query (el) {
  5108. if (typeof el === 'string') {
  5109. var selected = document.querySelector(el);
  5110. if (!selected) {
  5111. warn(
  5112. 'Cannot find element: ' + el
  5113. );
  5114. return document.createElement('div')
  5115. }
  5116. return selected
  5117. } else {
  5118. return el
  5119. }
  5120. }
  5121. /* */
  5122. function createElement$1 (tagName, vnode) {
  5123. var elm = document.createElement(tagName);
  5124. if (tagName !== 'select') {
  5125. return elm
  5126. }
  5127. // false or null will remove the attribute but undefined will not
  5128. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  5129. elm.setAttribute('multiple', 'multiple');
  5130. }
  5131. return elm
  5132. }
  5133. function createElementNS (namespace, tagName) {
  5134. return document.createElementNS(namespaceMap[namespace], tagName)
  5135. }
  5136. function createTextNode (text) {
  5137. return document.createTextNode(text)
  5138. }
  5139. function createComment (text) {
  5140. return document.createComment(text)
  5141. }
  5142. function insertBefore (parentNode, newNode, referenceNode) {
  5143. parentNode.insertBefore(newNode, referenceNode);
  5144. }
  5145. function removeChild (node, child) {
  5146. node.removeChild(child);
  5147. }
  5148. function appendChild (node, child) {
  5149. node.appendChild(child);
  5150. }
  5151. function parentNode (node) {
  5152. return node.parentNode
  5153. }
  5154. function nextSibling (node) {
  5155. return node.nextSibling
  5156. }
  5157. function tagName (node) {
  5158. return node.tagName
  5159. }
  5160. function setTextContent (node, text) {
  5161. node.textContent = text;
  5162. }
  5163. function setStyleScope (node, scopeId) {
  5164. node.setAttribute(scopeId, '');
  5165. }
  5166. var nodeOps = /*#__PURE__*/Object.freeze({
  5167. createElement: createElement$1,
  5168. createElementNS: createElementNS,
  5169. createTextNode: createTextNode,
  5170. createComment: createComment,
  5171. insertBefore: insertBefore,
  5172. removeChild: removeChild,
  5173. appendChild: appendChild,
  5174. parentNode: parentNode,
  5175. nextSibling: nextSibling,
  5176. tagName: tagName,
  5177. setTextContent: setTextContent,
  5178. setStyleScope: setStyleScope
  5179. });
  5180. /* */
  5181. var ref = {
  5182. create: function create (_, vnode) {
  5183. registerRef(vnode);
  5184. },
  5185. update: function update (oldVnode, vnode) {
  5186. if (oldVnode.data.ref !== vnode.data.ref) {
  5187. registerRef(oldVnode, true);
  5188. registerRef(vnode);
  5189. }
  5190. },
  5191. destroy: function destroy (vnode) {
  5192. registerRef(vnode, true);
  5193. }
  5194. };
  5195. function registerRef (vnode, isRemoval) {
  5196. var key = vnode.data.ref;
  5197. if (!isDef(key)) { return }
  5198. var vm = vnode.context;
  5199. var ref = vnode.componentInstance || vnode.elm;
  5200. var refs = vm.$refs;
  5201. if (isRemoval) {
  5202. if (Array.isArray(refs[key])) {
  5203. remove(refs[key], ref);
  5204. } else if (refs[key] === ref) {
  5205. refs[key] = undefined;
  5206. }
  5207. } else {
  5208. if (vnode.data.refInFor) {
  5209. if (!Array.isArray(refs[key])) {
  5210. refs[key] = [ref];
  5211. } else if (refs[key].indexOf(ref) < 0) {
  5212. // $flow-disable-line
  5213. refs[key].push(ref);
  5214. }
  5215. } else {
  5216. refs[key] = ref;
  5217. }
  5218. }
  5219. }
  5220. /**
  5221. * Virtual DOM patching algorithm based on Snabbdom by
  5222. * Simon Friis Vindum (@paldepind)
  5223. * Licensed under the MIT License
  5224. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  5225. *
  5226. * modified by Evan You (@yyx990803)
  5227. *
  5228. * Not type-checking this because this file is perf-critical and the cost
  5229. * of making flow understand it is not worth it.
  5230. */
  5231. var emptyNode = new VNode('', {}, []);
  5232. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  5233. function sameVnode (a, b) {
  5234. return (
  5235. a.key === b.key && (
  5236. (
  5237. a.tag === b.tag &&
  5238. a.isComment === b.isComment &&
  5239. isDef(a.data) === isDef(b.data) &&
  5240. sameInputType(a, b)
  5241. ) || (
  5242. isTrue(a.isAsyncPlaceholder) &&
  5243. a.asyncFactory === b.asyncFactory &&
  5244. isUndef(b.asyncFactory.error)
  5245. )
  5246. )
  5247. )
  5248. }
  5249. function sameInputType (a, b) {
  5250. if (a.tag !== 'input') { return true }
  5251. var i;
  5252. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  5253. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  5254. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  5255. }
  5256. function createKeyToOldIdx (children, beginIdx, endIdx) {
  5257. var i, key;
  5258. var map = {};
  5259. for (i = beginIdx; i <= endIdx; ++i) {
  5260. key = children[i].key;
  5261. if (isDef(key)) { map[key] = i; }
  5262. }
  5263. return map
  5264. }
  5265. function createPatchFunction (backend) {
  5266. var i, j;
  5267. var cbs = {};
  5268. var modules = backend.modules;
  5269. var nodeOps = backend.nodeOps;
  5270. for (i = 0; i < hooks.length; ++i) {
  5271. cbs[hooks[i]] = [];
  5272. for (j = 0; j < modules.length; ++j) {
  5273. if (isDef(modules[j][hooks[i]])) {
  5274. cbs[hooks[i]].push(modules[j][hooks[i]]);
  5275. }
  5276. }
  5277. }
  5278. function emptyNodeAt (elm) {
  5279. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  5280. }
  5281. function createRmCb (childElm, listeners) {
  5282. function remove$$1 () {
  5283. if (--remove$$1.listeners === 0) {
  5284. removeNode(childElm);
  5285. }
  5286. }
  5287. remove$$1.listeners = listeners;
  5288. return remove$$1
  5289. }
  5290. function removeNode (el) {
  5291. var parent = nodeOps.parentNode(el);
  5292. // element may have already been removed due to v-html / v-text
  5293. if (isDef(parent)) {
  5294. nodeOps.removeChild(parent, el);
  5295. }
  5296. }
  5297. function isUnknownElement$$1 (vnode, inVPre) {
  5298. return (
  5299. !inVPre &&
  5300. !vnode.ns &&
  5301. !(
  5302. config.ignoredElements.length &&
  5303. config.ignoredElements.some(function (ignore) {
  5304. return isRegExp(ignore)
  5305. ? ignore.test(vnode.tag)
  5306. : ignore === vnode.tag
  5307. })
  5308. ) &&
  5309. config.isUnknownElement(vnode.tag)
  5310. )
  5311. }
  5312. var creatingElmInVPre = 0;
  5313. function createElm (
  5314. vnode,
  5315. insertedVnodeQueue,
  5316. parentElm,
  5317. refElm,
  5318. nested,
  5319. ownerArray,
  5320. index
  5321. ) {
  5322. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5323. // This vnode was used in a previous render!
  5324. // now it's used as a new node, overwriting its elm would cause
  5325. // potential patch errors down the road when it's used as an insertion
  5326. // reference node. Instead, we clone the node on-demand before creating
  5327. // associated DOM element for it.
  5328. vnode = ownerArray[index] = cloneVNode(vnode);
  5329. }
  5330. vnode.isRootInsert = !nested; // for transition enter check
  5331. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  5332. return
  5333. }
  5334. var data = vnode.data;
  5335. var children = vnode.children;
  5336. var tag = vnode.tag;
  5337. if (isDef(tag)) {
  5338. {
  5339. if (data && data.pre) {
  5340. creatingElmInVPre++;
  5341. }
  5342. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  5343. warn(
  5344. 'Unknown custom element: <' + tag + '> - did you ' +
  5345. 'register the component correctly? For recursive components, ' +
  5346. 'make sure to provide the "name" option.',
  5347. vnode.context
  5348. );
  5349. }
  5350. }
  5351. vnode.elm = vnode.ns
  5352. ? nodeOps.createElementNS(vnode.ns, tag)
  5353. : nodeOps.createElement(tag, vnode);
  5354. setScope(vnode);
  5355. /* istanbul ignore if */
  5356. {
  5357. createChildren(vnode, children, insertedVnodeQueue);
  5358. if (isDef(data)) {
  5359. invokeCreateHooks(vnode, insertedVnodeQueue);
  5360. }
  5361. insert(parentElm, vnode.elm, refElm);
  5362. }
  5363. if (data && data.pre) {
  5364. creatingElmInVPre--;
  5365. }
  5366. } else if (isTrue(vnode.isComment)) {
  5367. vnode.elm = nodeOps.createComment(vnode.text);
  5368. insert(parentElm, vnode.elm, refElm);
  5369. } else {
  5370. vnode.elm = nodeOps.createTextNode(vnode.text);
  5371. insert(parentElm, vnode.elm, refElm);
  5372. }
  5373. }
  5374. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5375. var i = vnode.data;
  5376. if (isDef(i)) {
  5377. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  5378. if (isDef(i = i.hook) && isDef(i = i.init)) {
  5379. i(vnode, false /* hydrating */);
  5380. }
  5381. // after calling the init hook, if the vnode is a child component
  5382. // it should've created a child instance and mounted it. the child
  5383. // component also has set the placeholder vnode's elm.
  5384. // in that case we can just return the element and be done.
  5385. if (isDef(vnode.componentInstance)) {
  5386. initComponent(vnode, insertedVnodeQueue);
  5387. insert(parentElm, vnode.elm, refElm);
  5388. if (isTrue(isReactivated)) {
  5389. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  5390. }
  5391. return true
  5392. }
  5393. }
  5394. }
  5395. function initComponent (vnode, insertedVnodeQueue) {
  5396. if (isDef(vnode.data.pendingInsert)) {
  5397. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  5398. vnode.data.pendingInsert = null;
  5399. }
  5400. vnode.elm = vnode.componentInstance.$el;
  5401. if (isPatchable(vnode)) {
  5402. invokeCreateHooks(vnode, insertedVnodeQueue);
  5403. setScope(vnode);
  5404. } else {
  5405. // empty component root.
  5406. // skip all element-related modules except for ref (#3455)
  5407. registerRef(vnode);
  5408. // make sure to invoke the insert hook
  5409. insertedVnodeQueue.push(vnode);
  5410. }
  5411. }
  5412. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5413. var i;
  5414. // hack for #4339: a reactivated component with inner transition
  5415. // does not trigger because the inner node's created hooks are not called
  5416. // again. It's not ideal to involve module-specific logic in here but
  5417. // there doesn't seem to be a better way to do it.
  5418. var innerNode = vnode;
  5419. while (innerNode.componentInstance) {
  5420. innerNode = innerNode.componentInstance._vnode;
  5421. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  5422. for (i = 0; i < cbs.activate.length; ++i) {
  5423. cbs.activate[i](emptyNode, innerNode);
  5424. }
  5425. insertedVnodeQueue.push(innerNode);
  5426. break
  5427. }
  5428. }
  5429. // unlike a newly created component,
  5430. // a reactivated keep-alive component doesn't insert itself
  5431. insert(parentElm, vnode.elm, refElm);
  5432. }
  5433. function insert (parent, elm, ref$$1) {
  5434. if (isDef(parent)) {
  5435. if (isDef(ref$$1)) {
  5436. if (nodeOps.parentNode(ref$$1) === parent) {
  5437. nodeOps.insertBefore(parent, elm, ref$$1);
  5438. }
  5439. } else {
  5440. nodeOps.appendChild(parent, elm);
  5441. }
  5442. }
  5443. }
  5444. function createChildren (vnode, children, insertedVnodeQueue) {
  5445. if (Array.isArray(children)) {
  5446. {
  5447. checkDuplicateKeys(children);
  5448. }
  5449. for (var i = 0; i < children.length; ++i) {
  5450. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  5451. }
  5452. } else if (isPrimitive(vnode.text)) {
  5453. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  5454. }
  5455. }
  5456. function isPatchable (vnode) {
  5457. while (vnode.componentInstance) {
  5458. vnode = vnode.componentInstance._vnode;
  5459. }
  5460. return isDef(vnode.tag)
  5461. }
  5462. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  5463. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5464. cbs.create[i$1](emptyNode, vnode);
  5465. }
  5466. i = vnode.data.hook; // Reuse variable
  5467. if (isDef(i)) {
  5468. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  5469. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  5470. }
  5471. }
  5472. // set scope id attribute for scoped CSS.
  5473. // this is implemented as a special case to avoid the overhead
  5474. // of going through the normal attribute patching process.
  5475. function setScope (vnode) {
  5476. var i;
  5477. if (isDef(i = vnode.fnScopeId)) {
  5478. nodeOps.setStyleScope(vnode.elm, i);
  5479. } else {
  5480. var ancestor = vnode;
  5481. while (ancestor) {
  5482. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  5483. nodeOps.setStyleScope(vnode.elm, i);
  5484. }
  5485. ancestor = ancestor.parent;
  5486. }
  5487. }
  5488. // for slot content they should also get the scopeId from the host instance.
  5489. if (isDef(i = activeInstance) &&
  5490. i !== vnode.context &&
  5491. i !== vnode.fnContext &&
  5492. isDef(i = i.$options._scopeId)
  5493. ) {
  5494. nodeOps.setStyleScope(vnode.elm, i);
  5495. }
  5496. }
  5497. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  5498. for (; startIdx <= endIdx; ++startIdx) {
  5499. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  5500. }
  5501. }
  5502. function invokeDestroyHook (vnode) {
  5503. var i, j;
  5504. var data = vnode.data;
  5505. if (isDef(data)) {
  5506. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  5507. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  5508. }
  5509. if (isDef(i = vnode.children)) {
  5510. for (j = 0; j < vnode.children.length; ++j) {
  5511. invokeDestroyHook(vnode.children[j]);
  5512. }
  5513. }
  5514. }
  5515. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  5516. for (; startIdx <= endIdx; ++startIdx) {
  5517. var ch = vnodes[startIdx];
  5518. if (isDef(ch)) {
  5519. if (isDef(ch.tag)) {
  5520. removeAndInvokeRemoveHook(ch);
  5521. invokeDestroyHook(ch);
  5522. } else { // Text node
  5523. removeNode(ch.elm);
  5524. }
  5525. }
  5526. }
  5527. }
  5528. function removeAndInvokeRemoveHook (vnode, rm) {
  5529. if (isDef(rm) || isDef(vnode.data)) {
  5530. var i;
  5531. var listeners = cbs.remove.length + 1;
  5532. if (isDef(rm)) {
  5533. // we have a recursively passed down rm callback
  5534. // increase the listeners count
  5535. rm.listeners += listeners;
  5536. } else {
  5537. // directly removing
  5538. rm = createRmCb(vnode.elm, listeners);
  5539. }
  5540. // recursively invoke hooks on child component root node
  5541. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  5542. removeAndInvokeRemoveHook(i, rm);
  5543. }
  5544. for (i = 0; i < cbs.remove.length; ++i) {
  5545. cbs.remove[i](vnode, rm);
  5546. }
  5547. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  5548. i(vnode, rm);
  5549. } else {
  5550. rm();
  5551. }
  5552. } else {
  5553. removeNode(vnode.elm);
  5554. }
  5555. }
  5556. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  5557. var oldStartIdx = 0;
  5558. var newStartIdx = 0;
  5559. var oldEndIdx = oldCh.length - 1;
  5560. var oldStartVnode = oldCh[0];
  5561. var oldEndVnode = oldCh[oldEndIdx];
  5562. var newEndIdx = newCh.length - 1;
  5563. var newStartVnode = newCh[0];
  5564. var newEndVnode = newCh[newEndIdx];
  5565. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  5566. // removeOnly is a special flag used only by <transition-group>
  5567. // to ensure removed elements stay in correct relative positions
  5568. // during leaving transitions
  5569. var canMove = !removeOnly;
  5570. {
  5571. checkDuplicateKeys(newCh);
  5572. }
  5573. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  5574. if (isUndef(oldStartVnode)) {
  5575. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  5576. } else if (isUndef(oldEndVnode)) {
  5577. oldEndVnode = oldCh[--oldEndIdx];
  5578. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  5579. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5580. oldStartVnode = oldCh[++oldStartIdx];
  5581. newStartVnode = newCh[++newStartIdx];
  5582. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  5583. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5584. oldEndVnode = oldCh[--oldEndIdx];
  5585. newEndVnode = newCh[--newEndIdx];
  5586. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  5587. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5588. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  5589. oldStartVnode = oldCh[++oldStartIdx];
  5590. newEndVnode = newCh[--newEndIdx];
  5591. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  5592. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5593. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  5594. oldEndVnode = oldCh[--oldEndIdx];
  5595. newStartVnode = newCh[++newStartIdx];
  5596. } else {
  5597. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  5598. idxInOld = isDef(newStartVnode.key)
  5599. ? oldKeyToIdx[newStartVnode.key]
  5600. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  5601. if (isUndef(idxInOld)) { // New element
  5602. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5603. } else {
  5604. vnodeToMove = oldCh[idxInOld];
  5605. if (sameVnode(vnodeToMove, newStartVnode)) {
  5606. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5607. oldCh[idxInOld] = undefined;
  5608. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  5609. } else {
  5610. // same key but different element. treat as new element
  5611. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5612. }
  5613. }
  5614. newStartVnode = newCh[++newStartIdx];
  5615. }
  5616. }
  5617. if (oldStartIdx > oldEndIdx) {
  5618. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  5619. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  5620. } else if (newStartIdx > newEndIdx) {
  5621. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  5622. }
  5623. }
  5624. function checkDuplicateKeys (children) {
  5625. var seenKeys = {};
  5626. for (var i = 0; i < children.length; i++) {
  5627. var vnode = children[i];
  5628. var key = vnode.key;
  5629. if (isDef(key)) {
  5630. if (seenKeys[key]) {
  5631. warn(
  5632. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  5633. vnode.context
  5634. );
  5635. } else {
  5636. seenKeys[key] = true;
  5637. }
  5638. }
  5639. }
  5640. }
  5641. function findIdxInOld (node, oldCh, start, end) {
  5642. for (var i = start; i < end; i++) {
  5643. var c = oldCh[i];
  5644. if (isDef(c) && sameVnode(node, c)) { return i }
  5645. }
  5646. }
  5647. function patchVnode (
  5648. oldVnode,
  5649. vnode,
  5650. insertedVnodeQueue,
  5651. ownerArray,
  5652. index,
  5653. removeOnly
  5654. ) {
  5655. if (oldVnode === vnode) {
  5656. return
  5657. }
  5658. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5659. // clone reused vnode
  5660. vnode = ownerArray[index] = cloneVNode(vnode);
  5661. }
  5662. var elm = vnode.elm = oldVnode.elm;
  5663. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  5664. if (isDef(vnode.asyncFactory.resolved)) {
  5665. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  5666. } else {
  5667. vnode.isAsyncPlaceholder = true;
  5668. }
  5669. return
  5670. }
  5671. // reuse element for static trees.
  5672. // note we only do this if the vnode is cloned -
  5673. // if the new node is not cloned it means the render functions have been
  5674. // reset by the hot-reload-api and we need to do a proper re-render.
  5675. if (isTrue(vnode.isStatic) &&
  5676. isTrue(oldVnode.isStatic) &&
  5677. vnode.key === oldVnode.key &&
  5678. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  5679. ) {
  5680. vnode.componentInstance = oldVnode.componentInstance;
  5681. return
  5682. }
  5683. var i;
  5684. var data = vnode.data;
  5685. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  5686. i(oldVnode, vnode);
  5687. }
  5688. var oldCh = oldVnode.children;
  5689. var ch = vnode.children;
  5690. if (isDef(data) && isPatchable(vnode)) {
  5691. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  5692. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  5693. }
  5694. if (isUndef(vnode.text)) {
  5695. if (isDef(oldCh) && isDef(ch)) {
  5696. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  5697. } else if (isDef(ch)) {
  5698. {
  5699. checkDuplicateKeys(ch);
  5700. }
  5701. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  5702. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  5703. } else if (isDef(oldCh)) {
  5704. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  5705. } else if (isDef(oldVnode.text)) {
  5706. nodeOps.setTextContent(elm, '');
  5707. }
  5708. } else if (oldVnode.text !== vnode.text) {
  5709. nodeOps.setTextContent(elm, vnode.text);
  5710. }
  5711. if (isDef(data)) {
  5712. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  5713. }
  5714. }
  5715. function invokeInsertHook (vnode, queue, initial) {
  5716. // delay insert hooks for component root nodes, invoke them after the
  5717. // element is really inserted
  5718. if (isTrue(initial) && isDef(vnode.parent)) {
  5719. vnode.parent.data.pendingInsert = queue;
  5720. } else {
  5721. for (var i = 0; i < queue.length; ++i) {
  5722. queue[i].data.hook.insert(queue[i]);
  5723. }
  5724. }
  5725. }
  5726. var hydrationBailed = false;
  5727. // list of modules that can skip create hook during hydration because they
  5728. // are already rendered on the client or has no need for initialization
  5729. // Note: style is excluded because it relies on initial clone for future
  5730. // deep updates (#7063).
  5731. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  5732. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  5733. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  5734. var i;
  5735. var tag = vnode.tag;
  5736. var data = vnode.data;
  5737. var children = vnode.children;
  5738. inVPre = inVPre || (data && data.pre);
  5739. vnode.elm = elm;
  5740. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  5741. vnode.isAsyncPlaceholder = true;
  5742. return true
  5743. }
  5744. // assert node match
  5745. {
  5746. if (!assertNodeMatch(elm, vnode, inVPre)) {
  5747. return false
  5748. }
  5749. }
  5750. if (isDef(data)) {
  5751. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  5752. if (isDef(i = vnode.componentInstance)) {
  5753. // child component. it should have hydrated its own tree.
  5754. initComponent(vnode, insertedVnodeQueue);
  5755. return true
  5756. }
  5757. }
  5758. if (isDef(tag)) {
  5759. if (isDef(children)) {
  5760. // empty element, allow client to pick up and populate children
  5761. if (!elm.hasChildNodes()) {
  5762. createChildren(vnode, children, insertedVnodeQueue);
  5763. } else {
  5764. // v-html and domProps: innerHTML
  5765. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  5766. if (i !== elm.innerHTML) {
  5767. /* istanbul ignore if */
  5768. if (typeof console !== 'undefined' &&
  5769. !hydrationBailed
  5770. ) {
  5771. hydrationBailed = true;
  5772. console.warn('Parent: ', elm);
  5773. console.warn('server innerHTML: ', i);
  5774. console.warn('client innerHTML: ', elm.innerHTML);
  5775. }
  5776. return false
  5777. }
  5778. } else {
  5779. // iterate and compare children lists
  5780. var childrenMatch = true;
  5781. var childNode = elm.firstChild;
  5782. for (var i$1 = 0; i$1 < children.length; i$1++) {
  5783. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  5784. childrenMatch = false;
  5785. break
  5786. }
  5787. childNode = childNode.nextSibling;
  5788. }
  5789. // if childNode is not null, it means the actual childNodes list is
  5790. // longer than the virtual children list.
  5791. if (!childrenMatch || childNode) {
  5792. /* istanbul ignore if */
  5793. if (typeof console !== 'undefined' &&
  5794. !hydrationBailed
  5795. ) {
  5796. hydrationBailed = true;
  5797. console.warn('Parent: ', elm);
  5798. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  5799. }
  5800. return false
  5801. }
  5802. }
  5803. }
  5804. }
  5805. if (isDef(data)) {
  5806. var fullInvoke = false;
  5807. for (var key in data) {
  5808. if (!isRenderedModule(key)) {
  5809. fullInvoke = true;
  5810. invokeCreateHooks(vnode, insertedVnodeQueue);
  5811. break
  5812. }
  5813. }
  5814. if (!fullInvoke && data['class']) {
  5815. // ensure collecting deps for deep class bindings for future updates
  5816. traverse(data['class']);
  5817. }
  5818. }
  5819. } else if (elm.data !== vnode.text) {
  5820. elm.data = vnode.text;
  5821. }
  5822. return true
  5823. }
  5824. function assertNodeMatch (node, vnode, inVPre) {
  5825. if (isDef(vnode.tag)) {
  5826. return vnode.tag.indexOf('vue-component') === 0 || (
  5827. !isUnknownElement$$1(vnode, inVPre) &&
  5828. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  5829. )
  5830. } else {
  5831. return node.nodeType === (vnode.isComment ? 8 : 3)
  5832. }
  5833. }
  5834. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  5835. if (isUndef(vnode)) {
  5836. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  5837. return
  5838. }
  5839. var isInitialPatch = false;
  5840. var insertedVnodeQueue = [];
  5841. if (isUndef(oldVnode)) {
  5842. // empty mount (likely as component), create new root element
  5843. isInitialPatch = true;
  5844. createElm(vnode, insertedVnodeQueue);
  5845. } else {
  5846. var isRealElement = isDef(oldVnode.nodeType);
  5847. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  5848. // patch existing root node
  5849. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  5850. } else {
  5851. if (isRealElement) {
  5852. // mounting to a real element
  5853. // check if this is server-rendered content and if we can perform
  5854. // a successful hydration.
  5855. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  5856. oldVnode.removeAttribute(SSR_ATTR);
  5857. hydrating = true;
  5858. }
  5859. if (isTrue(hydrating)) {
  5860. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  5861. invokeInsertHook(vnode, insertedVnodeQueue, true);
  5862. return oldVnode
  5863. } else {
  5864. warn(
  5865. 'The client-side rendered virtual DOM tree is not matching ' +
  5866. 'server-rendered content. This is likely caused by incorrect ' +
  5867. 'HTML markup, for example nesting block-level elements inside ' +
  5868. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  5869. 'full client-side render.'
  5870. );
  5871. }
  5872. }
  5873. // either not server-rendered, or hydration failed.
  5874. // create an empty node and replace it
  5875. oldVnode = emptyNodeAt(oldVnode);
  5876. }
  5877. // replacing existing element
  5878. var oldElm = oldVnode.elm;
  5879. var parentElm = nodeOps.parentNode(oldElm);
  5880. // create new node
  5881. createElm(
  5882. vnode,
  5883. insertedVnodeQueue,
  5884. // extremely rare edge case: do not insert if old element is in a
  5885. // leaving transition. Only happens when combining transition +
  5886. // keep-alive + HOCs. (#4590)
  5887. oldElm._leaveCb ? null : parentElm,
  5888. nodeOps.nextSibling(oldElm)
  5889. );
  5890. // update parent placeholder node element, recursively
  5891. if (isDef(vnode.parent)) {
  5892. var ancestor = vnode.parent;
  5893. var patchable = isPatchable(vnode);
  5894. while (ancestor) {
  5895. for (var i = 0; i < cbs.destroy.length; ++i) {
  5896. cbs.destroy[i](ancestor);
  5897. }
  5898. ancestor.elm = vnode.elm;
  5899. if (patchable) {
  5900. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5901. cbs.create[i$1](emptyNode, ancestor);
  5902. }
  5903. // #6513
  5904. // invoke insert hooks that may have been merged by create hooks.
  5905. // e.g. for directives that uses the "inserted" hook.
  5906. var insert = ancestor.data.hook.insert;
  5907. if (insert.merged) {
  5908. // start at index 1 to avoid re-invoking component mounted hook
  5909. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  5910. insert.fns[i$2]();
  5911. }
  5912. }
  5913. } else {
  5914. registerRef(ancestor);
  5915. }
  5916. ancestor = ancestor.parent;
  5917. }
  5918. }
  5919. // destroy old node
  5920. if (isDef(parentElm)) {
  5921. removeVnodes(parentElm, [oldVnode], 0, 0);
  5922. } else if (isDef(oldVnode.tag)) {
  5923. invokeDestroyHook(oldVnode);
  5924. }
  5925. }
  5926. }
  5927. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  5928. return vnode.elm
  5929. }
  5930. }
  5931. /* */
  5932. var directives = {
  5933. create: updateDirectives,
  5934. update: updateDirectives,
  5935. destroy: function unbindDirectives (vnode) {
  5936. updateDirectives(vnode, emptyNode);
  5937. }
  5938. };
  5939. function updateDirectives (oldVnode, vnode) {
  5940. if (oldVnode.data.directives || vnode.data.directives) {
  5941. _update(oldVnode, vnode);
  5942. }
  5943. }
  5944. function _update (oldVnode, vnode) {
  5945. var isCreate = oldVnode === emptyNode;
  5946. var isDestroy = vnode === emptyNode;
  5947. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  5948. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  5949. var dirsWithInsert = [];
  5950. var dirsWithPostpatch = [];
  5951. var key, oldDir, dir;
  5952. for (key in newDirs) {
  5953. oldDir = oldDirs[key];
  5954. dir = newDirs[key];
  5955. if (!oldDir) {
  5956. // new directive, bind
  5957. callHook$1(dir, 'bind', vnode, oldVnode);
  5958. if (dir.def && dir.def.inserted) {
  5959. dirsWithInsert.push(dir);
  5960. }
  5961. } else {
  5962. // existing directive, update
  5963. dir.oldValue = oldDir.value;
  5964. dir.oldArg = oldDir.arg;
  5965. callHook$1(dir, 'update', vnode, oldVnode);
  5966. if (dir.def && dir.def.componentUpdated) {
  5967. dirsWithPostpatch.push(dir);
  5968. }
  5969. }
  5970. }
  5971. if (dirsWithInsert.length) {
  5972. var callInsert = function () {
  5973. for (var i = 0; i < dirsWithInsert.length; i++) {
  5974. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  5975. }
  5976. };
  5977. if (isCreate) {
  5978. mergeVNodeHook(vnode, 'insert', callInsert);
  5979. } else {
  5980. callInsert();
  5981. }
  5982. }
  5983. if (dirsWithPostpatch.length) {
  5984. mergeVNodeHook(vnode, 'postpatch', function () {
  5985. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  5986. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  5987. }
  5988. });
  5989. }
  5990. if (!isCreate) {
  5991. for (key in oldDirs) {
  5992. if (!newDirs[key]) {
  5993. // no longer present, unbind
  5994. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  5995. }
  5996. }
  5997. }
  5998. }
  5999. var emptyModifiers = Object.create(null);
  6000. function normalizeDirectives$1 (
  6001. dirs,
  6002. vm
  6003. ) {
  6004. var res = Object.create(null);
  6005. if (!dirs) {
  6006. // $flow-disable-line
  6007. return res
  6008. }
  6009. var i, dir;
  6010. for (i = 0; i < dirs.length; i++) {
  6011. dir = dirs[i];
  6012. if (!dir.modifiers) {
  6013. // $flow-disable-line
  6014. dir.modifiers = emptyModifiers;
  6015. }
  6016. res[getRawDirName(dir)] = dir;
  6017. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  6018. }
  6019. // $flow-disable-line
  6020. return res
  6021. }
  6022. function getRawDirName (dir) {
  6023. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  6024. }
  6025. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  6026. var fn = dir.def && dir.def[hook];
  6027. if (fn) {
  6028. try {
  6029. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  6030. } catch (e) {
  6031. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  6032. }
  6033. }
  6034. }
  6035. var baseModules = [
  6036. ref,
  6037. directives
  6038. ];
  6039. /* */
  6040. function updateAttrs (oldVnode, vnode) {
  6041. var opts = vnode.componentOptions;
  6042. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  6043. return
  6044. }
  6045. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  6046. return
  6047. }
  6048. var key, cur, old;
  6049. var elm = vnode.elm;
  6050. var oldAttrs = oldVnode.data.attrs || {};
  6051. var attrs = vnode.data.attrs || {};
  6052. // clone observed objects, as the user probably wants to mutate it
  6053. if (isDef(attrs.__ob__)) {
  6054. attrs = vnode.data.attrs = extend({}, attrs);
  6055. }
  6056. for (key in attrs) {
  6057. cur = attrs[key];
  6058. old = oldAttrs[key];
  6059. if (old !== cur) {
  6060. setAttr(elm, key, cur);
  6061. }
  6062. }
  6063. // #4391: in IE9, setting type can reset value for input[type=radio]
  6064. // #6666: IE/Edge forces progress value down to 1 before setting a max
  6065. /* istanbul ignore if */
  6066. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  6067. setAttr(elm, 'value', attrs.value);
  6068. }
  6069. for (key in oldAttrs) {
  6070. if (isUndef(attrs[key])) {
  6071. if (isXlink(key)) {
  6072. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6073. } else if (!isEnumeratedAttr(key)) {
  6074. elm.removeAttribute(key);
  6075. }
  6076. }
  6077. }
  6078. }
  6079. function setAttr (el, key, value) {
  6080. if (el.tagName.indexOf('-') > -1) {
  6081. baseSetAttr(el, key, value);
  6082. } else if (isBooleanAttr(key)) {
  6083. // set attribute for blank value
  6084. // e.g. <option disabled>Select one</option>
  6085. if (isFalsyAttrValue(value)) {
  6086. el.removeAttribute(key);
  6087. } else {
  6088. // technically allowfullscreen is a boolean attribute for <iframe>,
  6089. // but Flash expects a value of "true" when used on <embed> tag
  6090. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  6091. ? 'true'
  6092. : key;
  6093. el.setAttribute(key, value);
  6094. }
  6095. } else if (isEnumeratedAttr(key)) {
  6096. el.setAttribute(key, convertEnumeratedValue(key, value));
  6097. } else if (isXlink(key)) {
  6098. if (isFalsyAttrValue(value)) {
  6099. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6100. } else {
  6101. el.setAttributeNS(xlinkNS, key, value);
  6102. }
  6103. } else {
  6104. baseSetAttr(el, key, value);
  6105. }
  6106. }
  6107. function baseSetAttr (el, key, value) {
  6108. if (isFalsyAttrValue(value)) {
  6109. el.removeAttribute(key);
  6110. } else {
  6111. // #7138: IE10 & 11 fires input event when setting placeholder on
  6112. // <textarea>... block the first input event and remove the blocker
  6113. // immediately.
  6114. /* istanbul ignore if */
  6115. if (
  6116. isIE && !isIE9 &&
  6117. el.tagName === 'TEXTAREA' &&
  6118. key === 'placeholder' && value !== '' && !el.__ieph
  6119. ) {
  6120. var blocker = function (e) {
  6121. e.stopImmediatePropagation();
  6122. el.removeEventListener('input', blocker);
  6123. };
  6124. el.addEventListener('input', blocker);
  6125. // $flow-disable-line
  6126. el.__ieph = true; /* IE placeholder patched */
  6127. }
  6128. el.setAttribute(key, value);
  6129. }
  6130. }
  6131. var attrs = {
  6132. create: updateAttrs,
  6133. update: updateAttrs
  6134. };
  6135. /* */
  6136. function updateClass (oldVnode, vnode) {
  6137. var el = vnode.elm;
  6138. var data = vnode.data;
  6139. var oldData = oldVnode.data;
  6140. if (
  6141. isUndef(data.staticClass) &&
  6142. isUndef(data.class) && (
  6143. isUndef(oldData) || (
  6144. isUndef(oldData.staticClass) &&
  6145. isUndef(oldData.class)
  6146. )
  6147. )
  6148. ) {
  6149. return
  6150. }
  6151. var cls = genClassForVnode(vnode);
  6152. // handle transition classes
  6153. var transitionClass = el._transitionClasses;
  6154. if (isDef(transitionClass)) {
  6155. cls = concat(cls, stringifyClass(transitionClass));
  6156. }
  6157. // set the class
  6158. if (cls !== el._prevClass) {
  6159. el.setAttribute('class', cls);
  6160. el._prevClass = cls;
  6161. }
  6162. }
  6163. var klass = {
  6164. create: updateClass,
  6165. update: updateClass
  6166. };
  6167. /* */
  6168. var validDivisionCharRE = /[\w).+\-_$\]]/;
  6169. function parseFilters (exp) {
  6170. var inSingle = false;
  6171. var inDouble = false;
  6172. var inTemplateString = false;
  6173. var inRegex = false;
  6174. var curly = 0;
  6175. var square = 0;
  6176. var paren = 0;
  6177. var lastFilterIndex = 0;
  6178. var c, prev, i, expression, filters;
  6179. for (i = 0; i < exp.length; i++) {
  6180. prev = c;
  6181. c = exp.charCodeAt(i);
  6182. if (inSingle) {
  6183. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  6184. } else if (inDouble) {
  6185. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  6186. } else if (inTemplateString) {
  6187. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  6188. } else if (inRegex) {
  6189. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  6190. } else if (
  6191. c === 0x7C && // pipe
  6192. exp.charCodeAt(i + 1) !== 0x7C &&
  6193. exp.charCodeAt(i - 1) !== 0x7C &&
  6194. !curly && !square && !paren
  6195. ) {
  6196. if (expression === undefined) {
  6197. // first filter, end of expression
  6198. lastFilterIndex = i + 1;
  6199. expression = exp.slice(0, i).trim();
  6200. } else {
  6201. pushFilter();
  6202. }
  6203. } else {
  6204. switch (c) {
  6205. case 0x22: inDouble = true; break // "
  6206. case 0x27: inSingle = true; break // '
  6207. case 0x60: inTemplateString = true; break // `
  6208. case 0x28: paren++; break // (
  6209. case 0x29: paren--; break // )
  6210. case 0x5B: square++; break // [
  6211. case 0x5D: square--; break // ]
  6212. case 0x7B: curly++; break // {
  6213. case 0x7D: curly--; break // }
  6214. }
  6215. if (c === 0x2f) { // /
  6216. var j = i - 1;
  6217. var p = (void 0);
  6218. // find first non-whitespace prev char
  6219. for (; j >= 0; j--) {
  6220. p = exp.charAt(j);
  6221. if (p !== ' ') { break }
  6222. }
  6223. if (!p || !validDivisionCharRE.test(p)) {
  6224. inRegex = true;
  6225. }
  6226. }
  6227. }
  6228. }
  6229. if (expression === undefined) {
  6230. expression = exp.slice(0, i).trim();
  6231. } else if (lastFilterIndex !== 0) {
  6232. pushFilter();
  6233. }
  6234. function pushFilter () {
  6235. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  6236. lastFilterIndex = i + 1;
  6237. }
  6238. if (filters) {
  6239. for (i = 0; i < filters.length; i++) {
  6240. expression = wrapFilter(expression, filters[i]);
  6241. }
  6242. }
  6243. return expression
  6244. }
  6245. function wrapFilter (exp, filter) {
  6246. var i = filter.indexOf('(');
  6247. if (i < 0) {
  6248. // _f: resolveFilter
  6249. return ("_f(\"" + filter + "\")(" + exp + ")")
  6250. } else {
  6251. var name = filter.slice(0, i);
  6252. var args = filter.slice(i + 1);
  6253. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  6254. }
  6255. }
  6256. /* */
  6257. /* eslint-disable no-unused-vars */
  6258. function baseWarn (msg, range) {
  6259. console.error(("[Vue compiler]: " + msg));
  6260. }
  6261. /* eslint-enable no-unused-vars */
  6262. function pluckModuleFunction (
  6263. modules,
  6264. key
  6265. ) {
  6266. return modules
  6267. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  6268. : []
  6269. }
  6270. function addProp (el, name, value, range, dynamic) {
  6271. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  6272. el.plain = false;
  6273. }
  6274. function addAttr (el, name, value, range, dynamic) {
  6275. var attrs = dynamic
  6276. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  6277. : (el.attrs || (el.attrs = []));
  6278. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  6279. el.plain = false;
  6280. }
  6281. // add a raw attr (use this in preTransforms)
  6282. function addRawAttr (el, name, value, range) {
  6283. el.attrsMap[name] = value;
  6284. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  6285. }
  6286. function addDirective (
  6287. el,
  6288. name,
  6289. rawName,
  6290. value,
  6291. arg,
  6292. isDynamicArg,
  6293. modifiers,
  6294. range
  6295. ) {
  6296. (el.directives || (el.directives = [])).push(rangeSetItem({
  6297. name: name,
  6298. rawName: rawName,
  6299. value: value,
  6300. arg: arg,
  6301. isDynamicArg: isDynamicArg,
  6302. modifiers: modifiers
  6303. }, range));
  6304. el.plain = false;
  6305. }
  6306. function prependModifierMarker (symbol, name, dynamic) {
  6307. return dynamic
  6308. ? ("_p(" + name + ",\"" + symbol + "\")")
  6309. : symbol + name // mark the event as captured
  6310. }
  6311. function addHandler (
  6312. el,
  6313. name,
  6314. value,
  6315. modifiers,
  6316. important,
  6317. warn,
  6318. range,
  6319. dynamic
  6320. ) {
  6321. modifiers = modifiers || emptyObject;
  6322. // warn prevent and passive modifier
  6323. /* istanbul ignore if */
  6324. if (
  6325. warn &&
  6326. modifiers.prevent && modifiers.passive
  6327. ) {
  6328. warn(
  6329. 'passive and prevent can\'t be used together. ' +
  6330. 'Passive handler can\'t prevent default event.',
  6331. range
  6332. );
  6333. }
  6334. // normalize click.right and click.middle since they don't actually fire
  6335. // this is technically browser-specific, but at least for now browsers are
  6336. // the only target envs that have right/middle clicks.
  6337. if (modifiers.right) {
  6338. if (dynamic) {
  6339. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  6340. } else if (name === 'click') {
  6341. name = 'contextmenu';
  6342. delete modifiers.right;
  6343. }
  6344. } else if (modifiers.middle) {
  6345. if (dynamic) {
  6346. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  6347. } else if (name === 'click') {
  6348. name = 'mouseup';
  6349. }
  6350. }
  6351. // check capture modifier
  6352. if (modifiers.capture) {
  6353. delete modifiers.capture;
  6354. name = prependModifierMarker('!', name, dynamic);
  6355. }
  6356. if (modifiers.once) {
  6357. delete modifiers.once;
  6358. name = prependModifierMarker('~', name, dynamic);
  6359. }
  6360. /* istanbul ignore if */
  6361. if (modifiers.passive) {
  6362. delete modifiers.passive;
  6363. name = prependModifierMarker('&', name, dynamic);
  6364. }
  6365. var events;
  6366. if (modifiers.native) {
  6367. delete modifiers.native;
  6368. events = el.nativeEvents || (el.nativeEvents = {});
  6369. } else {
  6370. events = el.events || (el.events = {});
  6371. }
  6372. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  6373. if (modifiers !== emptyObject) {
  6374. newHandler.modifiers = modifiers;
  6375. }
  6376. var handlers = events[name];
  6377. /* istanbul ignore if */
  6378. if (Array.isArray(handlers)) {
  6379. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  6380. } else if (handlers) {
  6381. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  6382. } else {
  6383. events[name] = newHandler;
  6384. }
  6385. el.plain = false;
  6386. }
  6387. function getRawBindingAttr (
  6388. el,
  6389. name
  6390. ) {
  6391. return el.rawAttrsMap[':' + name] ||
  6392. el.rawAttrsMap['v-bind:' + name] ||
  6393. el.rawAttrsMap[name]
  6394. }
  6395. function getBindingAttr (
  6396. el,
  6397. name,
  6398. getStatic
  6399. ) {
  6400. var dynamicValue =
  6401. getAndRemoveAttr(el, ':' + name) ||
  6402. getAndRemoveAttr(el, 'v-bind:' + name);
  6403. if (dynamicValue != null) {
  6404. return parseFilters(dynamicValue)
  6405. } else if (getStatic !== false) {
  6406. var staticValue = getAndRemoveAttr(el, name);
  6407. if (staticValue != null) {
  6408. return JSON.stringify(staticValue)
  6409. }
  6410. }
  6411. }
  6412. // note: this only removes the attr from the Array (attrsList) so that it
  6413. // doesn't get processed by processAttrs.
  6414. // By default it does NOT remove it from the map (attrsMap) because the map is
  6415. // needed during codegen.
  6416. function getAndRemoveAttr (
  6417. el,
  6418. name,
  6419. removeFromMap
  6420. ) {
  6421. var val;
  6422. if ((val = el.attrsMap[name]) != null) {
  6423. var list = el.attrsList;
  6424. for (var i = 0, l = list.length; i < l; i++) {
  6425. if (list[i].name === name) {
  6426. list.splice(i, 1);
  6427. break
  6428. }
  6429. }
  6430. }
  6431. if (removeFromMap) {
  6432. delete el.attrsMap[name];
  6433. }
  6434. return val
  6435. }
  6436. function getAndRemoveAttrByRegex (
  6437. el,
  6438. name
  6439. ) {
  6440. var list = el.attrsList;
  6441. for (var i = 0, l = list.length; i < l; i++) {
  6442. var attr = list[i];
  6443. if (name.test(attr.name)) {
  6444. list.splice(i, 1);
  6445. return attr
  6446. }
  6447. }
  6448. }
  6449. function rangeSetItem (
  6450. item,
  6451. range
  6452. ) {
  6453. if (range) {
  6454. if (range.start != null) {
  6455. item.start = range.start;
  6456. }
  6457. if (range.end != null) {
  6458. item.end = range.end;
  6459. }
  6460. }
  6461. return item
  6462. }
  6463. /* */
  6464. /**
  6465. * Cross-platform code generation for component v-model
  6466. */
  6467. function genComponentModel (
  6468. el,
  6469. value,
  6470. modifiers
  6471. ) {
  6472. var ref = modifiers || {};
  6473. var number = ref.number;
  6474. var trim = ref.trim;
  6475. var baseValueExpression = '$$v';
  6476. var valueExpression = baseValueExpression;
  6477. if (trim) {
  6478. valueExpression =
  6479. "(typeof " + baseValueExpression + " === 'string'" +
  6480. "? " + baseValueExpression + ".trim()" +
  6481. ": " + baseValueExpression + ")";
  6482. }
  6483. if (number) {
  6484. valueExpression = "_n(" + valueExpression + ")";
  6485. }
  6486. var assignment = genAssignmentCode(value, valueExpression);
  6487. el.model = {
  6488. value: ("(" + value + ")"),
  6489. expression: JSON.stringify(value),
  6490. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  6491. };
  6492. }
  6493. /**
  6494. * Cross-platform codegen helper for generating v-model value assignment code.
  6495. */
  6496. function genAssignmentCode (
  6497. value,
  6498. assignment
  6499. ) {
  6500. var res = parseModel(value);
  6501. if (res.key === null) {
  6502. return (value + "=" + assignment)
  6503. } else {
  6504. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  6505. }
  6506. }
  6507. /**
  6508. * Parse a v-model expression into a base path and a final key segment.
  6509. * Handles both dot-path and possible square brackets.
  6510. *
  6511. * Possible cases:
  6512. *
  6513. * - test
  6514. * - test[key]
  6515. * - test[test1[key]]
  6516. * - test["a"][key]
  6517. * - xxx.test[a[a].test1[key]]
  6518. * - test.xxx.a["asa"][test1[key]]
  6519. *
  6520. */
  6521. var len, str, chr, index$1, expressionPos, expressionEndPos;
  6522. function parseModel (val) {
  6523. // Fix https://github.com/vuejs/vue/pull/7730
  6524. // allow v-model="obj.val " (trailing whitespace)
  6525. val = val.trim();
  6526. len = val.length;
  6527. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  6528. index$1 = val.lastIndexOf('.');
  6529. if (index$1 > -1) {
  6530. return {
  6531. exp: val.slice(0, index$1),
  6532. key: '"' + val.slice(index$1 + 1) + '"'
  6533. }
  6534. } else {
  6535. return {
  6536. exp: val,
  6537. key: null
  6538. }
  6539. }
  6540. }
  6541. str = val;
  6542. index$1 = expressionPos = expressionEndPos = 0;
  6543. while (!eof()) {
  6544. chr = next();
  6545. /* istanbul ignore if */
  6546. if (isStringStart(chr)) {
  6547. parseString(chr);
  6548. } else if (chr === 0x5B) {
  6549. parseBracket(chr);
  6550. }
  6551. }
  6552. return {
  6553. exp: val.slice(0, expressionPos),
  6554. key: val.slice(expressionPos + 1, expressionEndPos)
  6555. }
  6556. }
  6557. function next () {
  6558. return str.charCodeAt(++index$1)
  6559. }
  6560. function eof () {
  6561. return index$1 >= len
  6562. }
  6563. function isStringStart (chr) {
  6564. return chr === 0x22 || chr === 0x27
  6565. }
  6566. function parseBracket (chr) {
  6567. var inBracket = 1;
  6568. expressionPos = index$1;
  6569. while (!eof()) {
  6570. chr = next();
  6571. if (isStringStart(chr)) {
  6572. parseString(chr);
  6573. continue
  6574. }
  6575. if (chr === 0x5B) { inBracket++; }
  6576. if (chr === 0x5D) { inBracket--; }
  6577. if (inBracket === 0) {
  6578. expressionEndPos = index$1;
  6579. break
  6580. }
  6581. }
  6582. }
  6583. function parseString (chr) {
  6584. var stringQuote = chr;
  6585. while (!eof()) {
  6586. chr = next();
  6587. if (chr === stringQuote) {
  6588. break
  6589. }
  6590. }
  6591. }
  6592. /* */
  6593. var warn$1;
  6594. // in some cases, the event used has to be determined at runtime
  6595. // so we used some reserved tokens during compile.
  6596. var RANGE_TOKEN = '__r';
  6597. var CHECKBOX_RADIO_TOKEN = '__c';
  6598. function model (
  6599. el,
  6600. dir,
  6601. _warn
  6602. ) {
  6603. warn$1 = _warn;
  6604. var value = dir.value;
  6605. var modifiers = dir.modifiers;
  6606. var tag = el.tag;
  6607. var type = el.attrsMap.type;
  6608. {
  6609. // inputs with type="file" are read only and setting the input's
  6610. // value will throw an error.
  6611. if (tag === 'input' && type === 'file') {
  6612. warn$1(
  6613. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  6614. "File inputs are read only. Use a v-on:change listener instead.",
  6615. el.rawAttrsMap['v-model']
  6616. );
  6617. }
  6618. }
  6619. if (el.component) {
  6620. genComponentModel(el, value, modifiers);
  6621. // component v-model doesn't need extra runtime
  6622. return false
  6623. } else if (tag === 'select') {
  6624. genSelect(el, value, modifiers);
  6625. } else if (tag === 'input' && type === 'checkbox') {
  6626. genCheckboxModel(el, value, modifiers);
  6627. } else if (tag === 'input' && type === 'radio') {
  6628. genRadioModel(el, value, modifiers);
  6629. } else if (tag === 'input' || tag === 'textarea') {
  6630. genDefaultModel(el, value, modifiers);
  6631. } else if (!config.isReservedTag(tag)) {
  6632. genComponentModel(el, value, modifiers);
  6633. // component v-model doesn't need extra runtime
  6634. return false
  6635. } else {
  6636. warn$1(
  6637. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  6638. "v-model is not supported on this element type. " +
  6639. 'If you are working with contenteditable, it\'s recommended to ' +
  6640. 'wrap a library dedicated for that purpose inside a custom component.',
  6641. el.rawAttrsMap['v-model']
  6642. );
  6643. }
  6644. // ensure runtime directive metadata
  6645. return true
  6646. }
  6647. function genCheckboxModel (
  6648. el,
  6649. value,
  6650. modifiers
  6651. ) {
  6652. var number = modifiers && modifiers.number;
  6653. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6654. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  6655. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  6656. addProp(el, 'checked',
  6657. "Array.isArray(" + value + ")" +
  6658. "?_i(" + value + "," + valueBinding + ")>-1" + (
  6659. trueValueBinding === 'true'
  6660. ? (":(" + value + ")")
  6661. : (":_q(" + value + "," + trueValueBinding + ")")
  6662. )
  6663. );
  6664. addHandler(el, 'change',
  6665. "var $$a=" + value + "," +
  6666. '$$el=$event.target,' +
  6667. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  6668. 'if(Array.isArray($$a)){' +
  6669. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  6670. '$$i=_i($$a,$$v);' +
  6671. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  6672. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  6673. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  6674. null, true
  6675. );
  6676. }
  6677. function genRadioModel (
  6678. el,
  6679. value,
  6680. modifiers
  6681. ) {
  6682. var number = modifiers && modifiers.number;
  6683. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6684. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  6685. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  6686. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  6687. }
  6688. function genSelect (
  6689. el,
  6690. value,
  6691. modifiers
  6692. ) {
  6693. var number = modifiers && modifiers.number;
  6694. var selectedVal = "Array.prototype.filter" +
  6695. ".call($event.target.options,function(o){return o.selected})" +
  6696. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  6697. "return " + (number ? '_n(val)' : 'val') + "})";
  6698. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  6699. var code = "var $$selectedVal = " + selectedVal + ";";
  6700. code = code + " " + (genAssignmentCode(value, assignment));
  6701. addHandler(el, 'change', code, null, true);
  6702. }
  6703. function genDefaultModel (
  6704. el,
  6705. value,
  6706. modifiers
  6707. ) {
  6708. var type = el.attrsMap.type;
  6709. // warn if v-bind:value conflicts with v-model
  6710. // except for inputs with v-bind:type
  6711. {
  6712. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  6713. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  6714. if (value$1 && !typeBinding) {
  6715. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  6716. warn$1(
  6717. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  6718. 'because the latter already expands to a value binding internally',
  6719. el.rawAttrsMap[binding]
  6720. );
  6721. }
  6722. }
  6723. var ref = modifiers || {};
  6724. var lazy = ref.lazy;
  6725. var number = ref.number;
  6726. var trim = ref.trim;
  6727. var needCompositionGuard = !lazy && type !== 'range';
  6728. var event = lazy
  6729. ? 'change'
  6730. : type === 'range'
  6731. ? RANGE_TOKEN
  6732. : 'input';
  6733. var valueExpression = '$event.target.value';
  6734. if (trim) {
  6735. valueExpression = "$event.target.value.trim()";
  6736. }
  6737. if (number) {
  6738. valueExpression = "_n(" + valueExpression + ")";
  6739. }
  6740. var code = genAssignmentCode(value, valueExpression);
  6741. if (needCompositionGuard) {
  6742. code = "if($event.target.composing)return;" + code;
  6743. }
  6744. addProp(el, 'value', ("(" + value + ")"));
  6745. addHandler(el, event, code, null, true);
  6746. if (trim || number) {
  6747. addHandler(el, 'blur', '$forceUpdate()');
  6748. }
  6749. }
  6750. /* */
  6751. // normalize v-model event tokens that can only be determined at runtime.
  6752. // it's important to place the event as the first in the array because
  6753. // the whole point is ensuring the v-model callback gets called before
  6754. // user-attached handlers.
  6755. function normalizeEvents (on) {
  6756. /* istanbul ignore if */
  6757. if (isDef(on[RANGE_TOKEN])) {
  6758. // IE input[type=range] only supports `change` event
  6759. var event = isIE ? 'change' : 'input';
  6760. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  6761. delete on[RANGE_TOKEN];
  6762. }
  6763. // This was originally intended to fix #4521 but no longer necessary
  6764. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  6765. /* istanbul ignore if */
  6766. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  6767. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  6768. delete on[CHECKBOX_RADIO_TOKEN];
  6769. }
  6770. }
  6771. var target$1;
  6772. function createOnceHandler$1 (event, handler, capture) {
  6773. var _target = target$1; // save current target element in closure
  6774. return function onceHandler () {
  6775. var res = handler.apply(null, arguments);
  6776. if (res !== null) {
  6777. remove$2(event, onceHandler, capture, _target);
  6778. }
  6779. }
  6780. }
  6781. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  6782. // implementation and does not fire microtasks in between event propagation, so
  6783. // safe to exclude.
  6784. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  6785. function add$1 (
  6786. name,
  6787. handler,
  6788. capture,
  6789. passive
  6790. ) {
  6791. // async edge case #6566: inner click event triggers patch, event handler
  6792. // attached to outer element during patch, and triggered again. This
  6793. // happens because browsers fire microtask ticks between event propagation.
  6794. // the solution is simple: we save the timestamp when a handler is attached,
  6795. // and the handler would only fire if the event passed to it was fired
  6796. // AFTER it was attached.
  6797. if (useMicrotaskFix) {
  6798. var attachedTimestamp = currentFlushTimestamp;
  6799. var original = handler;
  6800. handler = original._wrapper = function (e) {
  6801. if (
  6802. // no bubbling, should always fire.
  6803. // this is just a safety net in case event.timeStamp is unreliable in
  6804. // certain weird environments...
  6805. e.target === e.currentTarget ||
  6806. // event is fired after handler attachment
  6807. e.timeStamp >= attachedTimestamp ||
  6808. // bail for environments that have buggy event.timeStamp implementations
  6809. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  6810. // #9681 QtWebEngine event.timeStamp is negative value
  6811. e.timeStamp <= 0 ||
  6812. // #9448 bail if event is fired in another document in a multi-page
  6813. // electron/nw.js app, since event.timeStamp will be using a different
  6814. // starting reference
  6815. e.target.ownerDocument !== document
  6816. ) {
  6817. return original.apply(this, arguments)
  6818. }
  6819. };
  6820. }
  6821. target$1.addEventListener(
  6822. name,
  6823. handler,
  6824. supportsPassive
  6825. ? { capture: capture, passive: passive }
  6826. : capture
  6827. );
  6828. }
  6829. function remove$2 (
  6830. name,
  6831. handler,
  6832. capture,
  6833. _target
  6834. ) {
  6835. (_target || target$1).removeEventListener(
  6836. name,
  6837. handler._wrapper || handler,
  6838. capture
  6839. );
  6840. }
  6841. function updateDOMListeners (oldVnode, vnode) {
  6842. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  6843. return
  6844. }
  6845. var on = vnode.data.on || {};
  6846. var oldOn = oldVnode.data.on || {};
  6847. target$1 = vnode.elm;
  6848. normalizeEvents(on);
  6849. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  6850. target$1 = undefined;
  6851. }
  6852. var events = {
  6853. create: updateDOMListeners,
  6854. update: updateDOMListeners
  6855. };
  6856. /* */
  6857. var svgContainer;
  6858. function updateDOMProps (oldVnode, vnode) {
  6859. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  6860. return
  6861. }
  6862. var key, cur;
  6863. var elm = vnode.elm;
  6864. var oldProps = oldVnode.data.domProps || {};
  6865. var props = vnode.data.domProps || {};
  6866. // clone observed objects, as the user probably wants to mutate it
  6867. if (isDef(props.__ob__)) {
  6868. props = vnode.data.domProps = extend({}, props);
  6869. }
  6870. for (key in oldProps) {
  6871. if (!(key in props)) {
  6872. elm[key] = '';
  6873. }
  6874. }
  6875. for (key in props) {
  6876. cur = props[key];
  6877. // ignore children if the node has textContent or innerHTML,
  6878. // as these will throw away existing DOM nodes and cause removal errors
  6879. // on subsequent patches (#3360)
  6880. if (key === 'textContent' || key === 'innerHTML') {
  6881. if (vnode.children) { vnode.children.length = 0; }
  6882. if (cur === oldProps[key]) { continue }
  6883. // #6601 work around Chrome version <= 55 bug where single textNode
  6884. // replaced by innerHTML/textContent retains its parentNode property
  6885. if (elm.childNodes.length === 1) {
  6886. elm.removeChild(elm.childNodes[0]);
  6887. }
  6888. }
  6889. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  6890. // store value as _value as well since
  6891. // non-string values will be stringified
  6892. elm._value = cur;
  6893. // avoid resetting cursor position when value is the same
  6894. var strCur = isUndef(cur) ? '' : String(cur);
  6895. if (shouldUpdateValue(elm, strCur)) {
  6896. elm.value = strCur;
  6897. }
  6898. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  6899. // IE doesn't support innerHTML for SVG elements
  6900. svgContainer = svgContainer || document.createElement('div');
  6901. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  6902. var svg = svgContainer.firstChild;
  6903. while (elm.firstChild) {
  6904. elm.removeChild(elm.firstChild);
  6905. }
  6906. while (svg.firstChild) {
  6907. elm.appendChild(svg.firstChild);
  6908. }
  6909. } else if (
  6910. // skip the update if old and new VDOM state is the same.
  6911. // `value` is handled separately because the DOM value may be temporarily
  6912. // out of sync with VDOM state due to focus, composition and modifiers.
  6913. // This #4521 by skipping the unnecesarry `checked` update.
  6914. cur !== oldProps[key]
  6915. ) {
  6916. // some property updates can throw
  6917. // e.g. `value` on <progress> w/ non-finite value
  6918. try {
  6919. elm[key] = cur;
  6920. } catch (e) {}
  6921. }
  6922. }
  6923. }
  6924. // check platforms/web/util/attrs.js acceptValue
  6925. function shouldUpdateValue (elm, checkVal) {
  6926. return (!elm.composing && (
  6927. elm.tagName === 'OPTION' ||
  6928. isNotInFocusAndDirty(elm, checkVal) ||
  6929. isDirtyWithModifiers(elm, checkVal)
  6930. ))
  6931. }
  6932. function isNotInFocusAndDirty (elm, checkVal) {
  6933. // return true when textbox (.number and .trim) loses focus and its value is
  6934. // not equal to the updated value
  6935. var notInFocus = true;
  6936. // #6157
  6937. // work around IE bug when accessing document.activeElement in an iframe
  6938. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  6939. return notInFocus && elm.value !== checkVal
  6940. }
  6941. function isDirtyWithModifiers (elm, newVal) {
  6942. var value = elm.value;
  6943. var modifiers = elm._vModifiers; // injected by v-model runtime
  6944. if (isDef(modifiers)) {
  6945. if (modifiers.number) {
  6946. return toNumber(value) !== toNumber(newVal)
  6947. }
  6948. if (modifiers.trim) {
  6949. return value.trim() !== newVal.trim()
  6950. }
  6951. }
  6952. return value !== newVal
  6953. }
  6954. var domProps = {
  6955. create: updateDOMProps,
  6956. update: updateDOMProps
  6957. };
  6958. /* */
  6959. var parseStyleText = cached(function (cssText) {
  6960. var res = {};
  6961. var listDelimiter = /;(?![^(]*\))/g;
  6962. var propertyDelimiter = /:(.+)/;
  6963. cssText.split(listDelimiter).forEach(function (item) {
  6964. if (item) {
  6965. var tmp = item.split(propertyDelimiter);
  6966. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6967. }
  6968. });
  6969. return res
  6970. });
  6971. // merge static and dynamic style data on the same vnode
  6972. function normalizeStyleData (data) {
  6973. var style = normalizeStyleBinding(data.style);
  6974. // static style is pre-processed into an object during compilation
  6975. // and is always a fresh object, so it's safe to merge into it
  6976. return data.staticStyle
  6977. ? extend(data.staticStyle, style)
  6978. : style
  6979. }
  6980. // normalize possible array / string values into Object
  6981. function normalizeStyleBinding (bindingStyle) {
  6982. if (Array.isArray(bindingStyle)) {
  6983. return toObject(bindingStyle)
  6984. }
  6985. if (typeof bindingStyle === 'string') {
  6986. return parseStyleText(bindingStyle)
  6987. }
  6988. return bindingStyle
  6989. }
  6990. /**
  6991. * parent component style should be after child's
  6992. * so that parent component's style could override it
  6993. */
  6994. function getStyle (vnode, checkChild) {
  6995. var res = {};
  6996. var styleData;
  6997. if (checkChild) {
  6998. var childNode = vnode;
  6999. while (childNode.componentInstance) {
  7000. childNode = childNode.componentInstance._vnode;
  7001. if (
  7002. childNode && childNode.data &&
  7003. (styleData = normalizeStyleData(childNode.data))
  7004. ) {
  7005. extend(res, styleData);
  7006. }
  7007. }
  7008. }
  7009. if ((styleData = normalizeStyleData(vnode.data))) {
  7010. extend(res, styleData);
  7011. }
  7012. var parentNode = vnode;
  7013. while ((parentNode = parentNode.parent)) {
  7014. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  7015. extend(res, styleData);
  7016. }
  7017. }
  7018. return res
  7019. }
  7020. /* */
  7021. var cssVarRE = /^--/;
  7022. var importantRE = /\s*!important$/;
  7023. var setProp = function (el, name, val) {
  7024. /* istanbul ignore if */
  7025. if (cssVarRE.test(name)) {
  7026. el.style.setProperty(name, val);
  7027. } else if (importantRE.test(val)) {
  7028. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  7029. } else {
  7030. var normalizedName = normalize(name);
  7031. if (Array.isArray(val)) {
  7032. // Support values array created by autoprefixer, e.g.
  7033. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  7034. // Set them one by one, and the browser will only set those it can recognize
  7035. for (var i = 0, len = val.length; i < len; i++) {
  7036. el.style[normalizedName] = val[i];
  7037. }
  7038. } else {
  7039. el.style[normalizedName] = val;
  7040. }
  7041. }
  7042. };
  7043. var vendorNames = ['Webkit', 'Moz', 'ms'];
  7044. var emptyStyle;
  7045. var normalize = cached(function (prop) {
  7046. emptyStyle = emptyStyle || document.createElement('div').style;
  7047. prop = camelize(prop);
  7048. if (prop !== 'filter' && (prop in emptyStyle)) {
  7049. return prop
  7050. }
  7051. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  7052. for (var i = 0; i < vendorNames.length; i++) {
  7053. var name = vendorNames[i] + capName;
  7054. if (name in emptyStyle) {
  7055. return name
  7056. }
  7057. }
  7058. });
  7059. function updateStyle (oldVnode, vnode) {
  7060. var data = vnode.data;
  7061. var oldData = oldVnode.data;
  7062. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  7063. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  7064. ) {
  7065. return
  7066. }
  7067. var cur, name;
  7068. var el = vnode.elm;
  7069. var oldStaticStyle = oldData.staticStyle;
  7070. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  7071. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  7072. var oldStyle = oldStaticStyle || oldStyleBinding;
  7073. var style = normalizeStyleBinding(vnode.data.style) || {};
  7074. // store normalized style under a different key for next diff
  7075. // make sure to clone it if it's reactive, since the user likely wants
  7076. // to mutate it.
  7077. vnode.data.normalizedStyle = isDef(style.__ob__)
  7078. ? extend({}, style)
  7079. : style;
  7080. var newStyle = getStyle(vnode, true);
  7081. for (name in oldStyle) {
  7082. if (isUndef(newStyle[name])) {
  7083. setProp(el, name, '');
  7084. }
  7085. }
  7086. for (name in newStyle) {
  7087. cur = newStyle[name];
  7088. if (cur !== oldStyle[name]) {
  7089. // ie9 setting to null has no effect, must use empty string
  7090. setProp(el, name, cur == null ? '' : cur);
  7091. }
  7092. }
  7093. }
  7094. var style = {
  7095. create: updateStyle,
  7096. update: updateStyle
  7097. };
  7098. /* */
  7099. var whitespaceRE = /\s+/;
  7100. /**
  7101. * Add class with compatibility for SVG since classList is not supported on
  7102. * SVG elements in IE
  7103. */
  7104. function addClass (el, cls) {
  7105. /* istanbul ignore if */
  7106. if (!cls || !(cls = cls.trim())) {
  7107. return
  7108. }
  7109. /* istanbul ignore else */
  7110. if (el.classList) {
  7111. if (cls.indexOf(' ') > -1) {
  7112. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  7113. } else {
  7114. el.classList.add(cls);
  7115. }
  7116. } else {
  7117. var cur = " " + (el.getAttribute('class') || '') + " ";
  7118. if (cur.indexOf(' ' + cls + ' ') < 0) {
  7119. el.setAttribute('class', (cur + cls).trim());
  7120. }
  7121. }
  7122. }
  7123. /**
  7124. * Remove class with compatibility for SVG since classList is not supported on
  7125. * SVG elements in IE
  7126. */
  7127. function removeClass (el, cls) {
  7128. /* istanbul ignore if */
  7129. if (!cls || !(cls = cls.trim())) {
  7130. return
  7131. }
  7132. /* istanbul ignore else */
  7133. if (el.classList) {
  7134. if (cls.indexOf(' ') > -1) {
  7135. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  7136. } else {
  7137. el.classList.remove(cls);
  7138. }
  7139. if (!el.classList.length) {
  7140. el.removeAttribute('class');
  7141. }
  7142. } else {
  7143. var cur = " " + (el.getAttribute('class') || '') + " ";
  7144. var tar = ' ' + cls + ' ';
  7145. while (cur.indexOf(tar) >= 0) {
  7146. cur = cur.replace(tar, ' ');
  7147. }
  7148. cur = cur.trim();
  7149. if (cur) {
  7150. el.setAttribute('class', cur);
  7151. } else {
  7152. el.removeAttribute('class');
  7153. }
  7154. }
  7155. }
  7156. /* */
  7157. function resolveTransition (def$$1) {
  7158. if (!def$$1) {
  7159. return
  7160. }
  7161. /* istanbul ignore else */
  7162. if (typeof def$$1 === 'object') {
  7163. var res = {};
  7164. if (def$$1.css !== false) {
  7165. extend(res, autoCssTransition(def$$1.name || 'v'));
  7166. }
  7167. extend(res, def$$1);
  7168. return res
  7169. } else if (typeof def$$1 === 'string') {
  7170. return autoCssTransition(def$$1)
  7171. }
  7172. }
  7173. var autoCssTransition = cached(function (name) {
  7174. return {
  7175. enterClass: (name + "-enter"),
  7176. enterToClass: (name + "-enter-to"),
  7177. enterActiveClass: (name + "-enter-active"),
  7178. leaveClass: (name + "-leave"),
  7179. leaveToClass: (name + "-leave-to"),
  7180. leaveActiveClass: (name + "-leave-active")
  7181. }
  7182. });
  7183. var hasTransition = inBrowser && !isIE9;
  7184. var TRANSITION = 'transition';
  7185. var ANIMATION = 'animation';
  7186. // Transition property/event sniffing
  7187. var transitionProp = 'transition';
  7188. var transitionEndEvent = 'transitionend';
  7189. var animationProp = 'animation';
  7190. var animationEndEvent = 'animationend';
  7191. if (hasTransition) {
  7192. /* istanbul ignore if */
  7193. if (window.ontransitionend === undefined &&
  7194. window.onwebkittransitionend !== undefined
  7195. ) {
  7196. transitionProp = 'WebkitTransition';
  7197. transitionEndEvent = 'webkitTransitionEnd';
  7198. }
  7199. if (window.onanimationend === undefined &&
  7200. window.onwebkitanimationend !== undefined
  7201. ) {
  7202. animationProp = 'WebkitAnimation';
  7203. animationEndEvent = 'webkitAnimationEnd';
  7204. }
  7205. }
  7206. // binding to window is necessary to make hot reload work in IE in strict mode
  7207. var raf = inBrowser
  7208. ? window.requestAnimationFrame
  7209. ? window.requestAnimationFrame.bind(window)
  7210. : setTimeout
  7211. : /* istanbul ignore next */ function (fn) { return fn(); };
  7212. function nextFrame (fn) {
  7213. raf(function () {
  7214. raf(fn);
  7215. });
  7216. }
  7217. function addTransitionClass (el, cls) {
  7218. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  7219. if (transitionClasses.indexOf(cls) < 0) {
  7220. transitionClasses.push(cls);
  7221. addClass(el, cls);
  7222. }
  7223. }
  7224. function removeTransitionClass (el, cls) {
  7225. if (el._transitionClasses) {
  7226. remove(el._transitionClasses, cls);
  7227. }
  7228. removeClass(el, cls);
  7229. }
  7230. function whenTransitionEnds (
  7231. el,
  7232. expectedType,
  7233. cb
  7234. ) {
  7235. var ref = getTransitionInfo(el, expectedType);
  7236. var type = ref.type;
  7237. var timeout = ref.timeout;
  7238. var propCount = ref.propCount;
  7239. if (!type) { return cb() }
  7240. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  7241. var ended = 0;
  7242. var end = function () {
  7243. el.removeEventListener(event, onEnd);
  7244. cb();
  7245. };
  7246. var onEnd = function (e) {
  7247. if (e.target === el) {
  7248. if (++ended >= propCount) {
  7249. end();
  7250. }
  7251. }
  7252. };
  7253. setTimeout(function () {
  7254. if (ended < propCount) {
  7255. end();
  7256. }
  7257. }, timeout + 1);
  7258. el.addEventListener(event, onEnd);
  7259. }
  7260. var transformRE = /\b(transform|all)(,|$)/;
  7261. function getTransitionInfo (el, expectedType) {
  7262. var styles = window.getComputedStyle(el);
  7263. // JSDOM may return undefined for transition properties
  7264. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  7265. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  7266. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  7267. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  7268. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  7269. var animationTimeout = getTimeout(animationDelays, animationDurations);
  7270. var type;
  7271. var timeout = 0;
  7272. var propCount = 0;
  7273. /* istanbul ignore if */
  7274. if (expectedType === TRANSITION) {
  7275. if (transitionTimeout > 0) {
  7276. type = TRANSITION;
  7277. timeout = transitionTimeout;
  7278. propCount = transitionDurations.length;
  7279. }
  7280. } else if (expectedType === ANIMATION) {
  7281. if (animationTimeout > 0) {
  7282. type = ANIMATION;
  7283. timeout = animationTimeout;
  7284. propCount = animationDurations.length;
  7285. }
  7286. } else {
  7287. timeout = Math.max(transitionTimeout, animationTimeout);
  7288. type = timeout > 0
  7289. ? transitionTimeout > animationTimeout
  7290. ? TRANSITION
  7291. : ANIMATION
  7292. : null;
  7293. propCount = type
  7294. ? type === TRANSITION
  7295. ? transitionDurations.length
  7296. : animationDurations.length
  7297. : 0;
  7298. }
  7299. var hasTransform =
  7300. type === TRANSITION &&
  7301. transformRE.test(styles[transitionProp + 'Property']);
  7302. return {
  7303. type: type,
  7304. timeout: timeout,
  7305. propCount: propCount,
  7306. hasTransform: hasTransform
  7307. }
  7308. }
  7309. function getTimeout (delays, durations) {
  7310. /* istanbul ignore next */
  7311. while (delays.length < durations.length) {
  7312. delays = delays.concat(delays);
  7313. }
  7314. return Math.max.apply(null, durations.map(function (d, i) {
  7315. return toMs(d) + toMs(delays[i])
  7316. }))
  7317. }
  7318. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  7319. // in a locale-dependent way, using a comma instead of a dot.
  7320. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  7321. // as a floor function) causing unexpected behaviors
  7322. function toMs (s) {
  7323. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  7324. }
  7325. /* */
  7326. function enter (vnode, toggleDisplay) {
  7327. var el = vnode.elm;
  7328. // call leave callback now
  7329. if (isDef(el._leaveCb)) {
  7330. el._leaveCb.cancelled = true;
  7331. el._leaveCb();
  7332. }
  7333. var data = resolveTransition(vnode.data.transition);
  7334. if (isUndef(data)) {
  7335. return
  7336. }
  7337. /* istanbul ignore if */
  7338. if (isDef(el._enterCb) || el.nodeType !== 1) {
  7339. return
  7340. }
  7341. var css = data.css;
  7342. var type = data.type;
  7343. var enterClass = data.enterClass;
  7344. var enterToClass = data.enterToClass;
  7345. var enterActiveClass = data.enterActiveClass;
  7346. var appearClass = data.appearClass;
  7347. var appearToClass = data.appearToClass;
  7348. var appearActiveClass = data.appearActiveClass;
  7349. var beforeEnter = data.beforeEnter;
  7350. var enter = data.enter;
  7351. var afterEnter = data.afterEnter;
  7352. var enterCancelled = data.enterCancelled;
  7353. var beforeAppear = data.beforeAppear;
  7354. var appear = data.appear;
  7355. var afterAppear = data.afterAppear;
  7356. var appearCancelled = data.appearCancelled;
  7357. var duration = data.duration;
  7358. // activeInstance will always be the <transition> component managing this
  7359. // transition. One edge case to check is when the <transition> is placed
  7360. // as the root node of a child component. In that case we need to check
  7361. // <transition>'s parent for appear check.
  7362. var context = activeInstance;
  7363. var transitionNode = activeInstance.$vnode;
  7364. while (transitionNode && transitionNode.parent) {
  7365. context = transitionNode.context;
  7366. transitionNode = transitionNode.parent;
  7367. }
  7368. var isAppear = !context._isMounted || !vnode.isRootInsert;
  7369. if (isAppear && !appear && appear !== '') {
  7370. return
  7371. }
  7372. var startClass = isAppear && appearClass
  7373. ? appearClass
  7374. : enterClass;
  7375. var activeClass = isAppear && appearActiveClass
  7376. ? appearActiveClass
  7377. : enterActiveClass;
  7378. var toClass = isAppear && appearToClass
  7379. ? appearToClass
  7380. : enterToClass;
  7381. var beforeEnterHook = isAppear
  7382. ? (beforeAppear || beforeEnter)
  7383. : beforeEnter;
  7384. var enterHook = isAppear
  7385. ? (typeof appear === 'function' ? appear : enter)
  7386. : enter;
  7387. var afterEnterHook = isAppear
  7388. ? (afterAppear || afterEnter)
  7389. : afterEnter;
  7390. var enterCancelledHook = isAppear
  7391. ? (appearCancelled || enterCancelled)
  7392. : enterCancelled;
  7393. var explicitEnterDuration = toNumber(
  7394. isObject(duration)
  7395. ? duration.enter
  7396. : duration
  7397. );
  7398. if (explicitEnterDuration != null) {
  7399. checkDuration(explicitEnterDuration, 'enter', vnode);
  7400. }
  7401. var expectsCSS = css !== false && !isIE9;
  7402. var userWantsControl = getHookArgumentsLength(enterHook);
  7403. var cb = el._enterCb = once(function () {
  7404. if (expectsCSS) {
  7405. removeTransitionClass(el, toClass);
  7406. removeTransitionClass(el, activeClass);
  7407. }
  7408. if (cb.cancelled) {
  7409. if (expectsCSS) {
  7410. removeTransitionClass(el, startClass);
  7411. }
  7412. enterCancelledHook && enterCancelledHook(el);
  7413. } else {
  7414. afterEnterHook && afterEnterHook(el);
  7415. }
  7416. el._enterCb = null;
  7417. });
  7418. if (!vnode.data.show) {
  7419. // remove pending leave element on enter by injecting an insert hook
  7420. mergeVNodeHook(vnode, 'insert', function () {
  7421. var parent = el.parentNode;
  7422. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  7423. if (pendingNode &&
  7424. pendingNode.tag === vnode.tag &&
  7425. pendingNode.elm._leaveCb
  7426. ) {
  7427. pendingNode.elm._leaveCb();
  7428. }
  7429. enterHook && enterHook(el, cb);
  7430. });
  7431. }
  7432. // start enter transition
  7433. beforeEnterHook && beforeEnterHook(el);
  7434. if (expectsCSS) {
  7435. addTransitionClass(el, startClass);
  7436. addTransitionClass(el, activeClass);
  7437. nextFrame(function () {
  7438. removeTransitionClass(el, startClass);
  7439. if (!cb.cancelled) {
  7440. addTransitionClass(el, toClass);
  7441. if (!userWantsControl) {
  7442. if (isValidDuration(explicitEnterDuration)) {
  7443. setTimeout(cb, explicitEnterDuration);
  7444. } else {
  7445. whenTransitionEnds(el, type, cb);
  7446. }
  7447. }
  7448. }
  7449. });
  7450. }
  7451. if (vnode.data.show) {
  7452. toggleDisplay && toggleDisplay();
  7453. enterHook && enterHook(el, cb);
  7454. }
  7455. if (!expectsCSS && !userWantsControl) {
  7456. cb();
  7457. }
  7458. }
  7459. function leave (vnode, rm) {
  7460. var el = vnode.elm;
  7461. // call enter callback now
  7462. if (isDef(el._enterCb)) {
  7463. el._enterCb.cancelled = true;
  7464. el._enterCb();
  7465. }
  7466. var data = resolveTransition(vnode.data.transition);
  7467. if (isUndef(data) || el.nodeType !== 1) {
  7468. return rm()
  7469. }
  7470. /* istanbul ignore if */
  7471. if (isDef(el._leaveCb)) {
  7472. return
  7473. }
  7474. var css = data.css;
  7475. var type = data.type;
  7476. var leaveClass = data.leaveClass;
  7477. var leaveToClass = data.leaveToClass;
  7478. var leaveActiveClass = data.leaveActiveClass;
  7479. var beforeLeave = data.beforeLeave;
  7480. var leave = data.leave;
  7481. var afterLeave = data.afterLeave;
  7482. var leaveCancelled = data.leaveCancelled;
  7483. var delayLeave = data.delayLeave;
  7484. var duration = data.duration;
  7485. var expectsCSS = css !== false && !isIE9;
  7486. var userWantsControl = getHookArgumentsLength(leave);
  7487. var explicitLeaveDuration = toNumber(
  7488. isObject(duration)
  7489. ? duration.leave
  7490. : duration
  7491. );
  7492. if (isDef(explicitLeaveDuration)) {
  7493. checkDuration(explicitLeaveDuration, 'leave', vnode);
  7494. }
  7495. var cb = el._leaveCb = once(function () {
  7496. if (el.parentNode && el.parentNode._pending) {
  7497. el.parentNode._pending[vnode.key] = null;
  7498. }
  7499. if (expectsCSS) {
  7500. removeTransitionClass(el, leaveToClass);
  7501. removeTransitionClass(el, leaveActiveClass);
  7502. }
  7503. if (cb.cancelled) {
  7504. if (expectsCSS) {
  7505. removeTransitionClass(el, leaveClass);
  7506. }
  7507. leaveCancelled && leaveCancelled(el);
  7508. } else {
  7509. rm();
  7510. afterLeave && afterLeave(el);
  7511. }
  7512. el._leaveCb = null;
  7513. });
  7514. if (delayLeave) {
  7515. delayLeave(performLeave);
  7516. } else {
  7517. performLeave();
  7518. }
  7519. function performLeave () {
  7520. // the delayed leave may have already been cancelled
  7521. if (cb.cancelled) {
  7522. return
  7523. }
  7524. // record leaving element
  7525. if (!vnode.data.show && el.parentNode) {
  7526. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  7527. }
  7528. beforeLeave && beforeLeave(el);
  7529. if (expectsCSS) {
  7530. addTransitionClass(el, leaveClass);
  7531. addTransitionClass(el, leaveActiveClass);
  7532. nextFrame(function () {
  7533. removeTransitionClass(el, leaveClass);
  7534. if (!cb.cancelled) {
  7535. addTransitionClass(el, leaveToClass);
  7536. if (!userWantsControl) {
  7537. if (isValidDuration(explicitLeaveDuration)) {
  7538. setTimeout(cb, explicitLeaveDuration);
  7539. } else {
  7540. whenTransitionEnds(el, type, cb);
  7541. }
  7542. }
  7543. }
  7544. });
  7545. }
  7546. leave && leave(el, cb);
  7547. if (!expectsCSS && !userWantsControl) {
  7548. cb();
  7549. }
  7550. }
  7551. }
  7552. // only used in dev mode
  7553. function checkDuration (val, name, vnode) {
  7554. if (typeof val !== 'number') {
  7555. warn(
  7556. "<transition> explicit " + name + " duration is not a valid number - " +
  7557. "got " + (JSON.stringify(val)) + ".",
  7558. vnode.context
  7559. );
  7560. } else if (isNaN(val)) {
  7561. warn(
  7562. "<transition> explicit " + name + " duration is NaN - " +
  7563. 'the duration expression might be incorrect.',
  7564. vnode.context
  7565. );
  7566. }
  7567. }
  7568. function isValidDuration (val) {
  7569. return typeof val === 'number' && !isNaN(val)
  7570. }
  7571. /**
  7572. * Normalize a transition hook's argument length. The hook may be:
  7573. * - a merged hook (invoker) with the original in .fns
  7574. * - a wrapped component method (check ._length)
  7575. * - a plain function (.length)
  7576. */
  7577. function getHookArgumentsLength (fn) {
  7578. if (isUndef(fn)) {
  7579. return false
  7580. }
  7581. var invokerFns = fn.fns;
  7582. if (isDef(invokerFns)) {
  7583. // invoker
  7584. return getHookArgumentsLength(
  7585. Array.isArray(invokerFns)
  7586. ? invokerFns[0]
  7587. : invokerFns
  7588. )
  7589. } else {
  7590. return (fn._length || fn.length) > 1
  7591. }
  7592. }
  7593. function _enter (_, vnode) {
  7594. if (vnode.data.show !== true) {
  7595. enter(vnode);
  7596. }
  7597. }
  7598. var transition = inBrowser ? {
  7599. create: _enter,
  7600. activate: _enter,
  7601. remove: function remove$$1 (vnode, rm) {
  7602. /* istanbul ignore else */
  7603. if (vnode.data.show !== true) {
  7604. leave(vnode, rm);
  7605. } else {
  7606. rm();
  7607. }
  7608. }
  7609. } : {};
  7610. var platformModules = [
  7611. attrs,
  7612. klass,
  7613. events,
  7614. domProps,
  7615. style,
  7616. transition
  7617. ];
  7618. /* */
  7619. // the directive module should be applied last, after all
  7620. // built-in modules have been applied.
  7621. var modules = platformModules.concat(baseModules);
  7622. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  7623. /**
  7624. * Not type checking this file because flow doesn't like attaching
  7625. * properties to Elements.
  7626. */
  7627. /* istanbul ignore if */
  7628. if (isIE9) {
  7629. // http://www.matts411.com/post/internet-explorer-9-oninput/
  7630. document.addEventListener('selectionchange', function () {
  7631. var el = document.activeElement;
  7632. if (el && el.vmodel) {
  7633. trigger(el, 'input');
  7634. }
  7635. });
  7636. }
  7637. var directive = {
  7638. inserted: function inserted (el, binding, vnode, oldVnode) {
  7639. if (vnode.tag === 'select') {
  7640. // #6903
  7641. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  7642. mergeVNodeHook(vnode, 'postpatch', function () {
  7643. directive.componentUpdated(el, binding, vnode);
  7644. });
  7645. } else {
  7646. setSelected(el, binding, vnode.context);
  7647. }
  7648. el._vOptions = [].map.call(el.options, getValue);
  7649. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  7650. el._vModifiers = binding.modifiers;
  7651. if (!binding.modifiers.lazy) {
  7652. el.addEventListener('compositionstart', onCompositionStart);
  7653. el.addEventListener('compositionend', onCompositionEnd);
  7654. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  7655. // switching focus before confirming composition choice
  7656. // this also fixes the issue where some browsers e.g. iOS Chrome
  7657. // fires "change" instead of "input" on autocomplete.
  7658. el.addEventListener('change', onCompositionEnd);
  7659. /* istanbul ignore if */
  7660. if (isIE9) {
  7661. el.vmodel = true;
  7662. }
  7663. }
  7664. }
  7665. },
  7666. componentUpdated: function componentUpdated (el, binding, vnode) {
  7667. if (vnode.tag === 'select') {
  7668. setSelected(el, binding, vnode.context);
  7669. // in case the options rendered by v-for have changed,
  7670. // it's possible that the value is out-of-sync with the rendered options.
  7671. // detect such cases and filter out values that no longer has a matching
  7672. // option in the DOM.
  7673. var prevOptions = el._vOptions;
  7674. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  7675. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  7676. // trigger change event if
  7677. // no matching option found for at least one value
  7678. var needReset = el.multiple
  7679. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  7680. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  7681. if (needReset) {
  7682. trigger(el, 'change');
  7683. }
  7684. }
  7685. }
  7686. }
  7687. };
  7688. function setSelected (el, binding, vm) {
  7689. actuallySetSelected(el, binding, vm);
  7690. /* istanbul ignore if */
  7691. if (isIE || isEdge) {
  7692. setTimeout(function () {
  7693. actuallySetSelected(el, binding, vm);
  7694. }, 0);
  7695. }
  7696. }
  7697. function actuallySetSelected (el, binding, vm) {
  7698. var value = binding.value;
  7699. var isMultiple = el.multiple;
  7700. if (isMultiple && !Array.isArray(value)) {
  7701. warn(
  7702. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  7703. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  7704. vm
  7705. );
  7706. return
  7707. }
  7708. var selected, option;
  7709. for (var i = 0, l = el.options.length; i < l; i++) {
  7710. option = el.options[i];
  7711. if (isMultiple) {
  7712. selected = looseIndexOf(value, getValue(option)) > -1;
  7713. if (option.selected !== selected) {
  7714. option.selected = selected;
  7715. }
  7716. } else {
  7717. if (looseEqual(getValue(option), value)) {
  7718. if (el.selectedIndex !== i) {
  7719. el.selectedIndex = i;
  7720. }
  7721. return
  7722. }
  7723. }
  7724. }
  7725. if (!isMultiple) {
  7726. el.selectedIndex = -1;
  7727. }
  7728. }
  7729. function hasNoMatchingOption (value, options) {
  7730. return options.every(function (o) { return !looseEqual(o, value); })
  7731. }
  7732. function getValue (option) {
  7733. return '_value' in option
  7734. ? option._value
  7735. : option.value
  7736. }
  7737. function onCompositionStart (e) {
  7738. e.target.composing = true;
  7739. }
  7740. function onCompositionEnd (e) {
  7741. // prevent triggering an input event for no reason
  7742. if (!e.target.composing) { return }
  7743. e.target.composing = false;
  7744. trigger(e.target, 'input');
  7745. }
  7746. function trigger (el, type) {
  7747. var e = document.createEvent('HTMLEvents');
  7748. e.initEvent(type, true, true);
  7749. el.dispatchEvent(e);
  7750. }
  7751. /* */
  7752. // recursively search for possible transition defined inside the component root
  7753. function locateNode (vnode) {
  7754. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  7755. ? locateNode(vnode.componentInstance._vnode)
  7756. : vnode
  7757. }
  7758. var show = {
  7759. bind: function bind (el, ref, vnode) {
  7760. var value = ref.value;
  7761. vnode = locateNode(vnode);
  7762. var transition$$1 = vnode.data && vnode.data.transition;
  7763. var originalDisplay = el.__vOriginalDisplay =
  7764. el.style.display === 'none' ? '' : el.style.display;
  7765. if (value && transition$$1) {
  7766. vnode.data.show = true;
  7767. enter(vnode, function () {
  7768. el.style.display = originalDisplay;
  7769. });
  7770. } else {
  7771. el.style.display = value ? originalDisplay : 'none';
  7772. }
  7773. },
  7774. update: function update (el, ref, vnode) {
  7775. var value = ref.value;
  7776. var oldValue = ref.oldValue;
  7777. /* istanbul ignore if */
  7778. if (!value === !oldValue) { return }
  7779. vnode = locateNode(vnode);
  7780. var transition$$1 = vnode.data && vnode.data.transition;
  7781. if (transition$$1) {
  7782. vnode.data.show = true;
  7783. if (value) {
  7784. enter(vnode, function () {
  7785. el.style.display = el.__vOriginalDisplay;
  7786. });
  7787. } else {
  7788. leave(vnode, function () {
  7789. el.style.display = 'none';
  7790. });
  7791. }
  7792. } else {
  7793. el.style.display = value ? el.__vOriginalDisplay : 'none';
  7794. }
  7795. },
  7796. unbind: function unbind (
  7797. el,
  7798. binding,
  7799. vnode,
  7800. oldVnode,
  7801. isDestroy
  7802. ) {
  7803. if (!isDestroy) {
  7804. el.style.display = el.__vOriginalDisplay;
  7805. }
  7806. }
  7807. };
  7808. var platformDirectives = {
  7809. model: directive,
  7810. show: show
  7811. };
  7812. /* */
  7813. var transitionProps = {
  7814. name: String,
  7815. appear: Boolean,
  7816. css: Boolean,
  7817. mode: String,
  7818. type: String,
  7819. enterClass: String,
  7820. leaveClass: String,
  7821. enterToClass: String,
  7822. leaveToClass: String,
  7823. enterActiveClass: String,
  7824. leaveActiveClass: String,
  7825. appearClass: String,
  7826. appearActiveClass: String,
  7827. appearToClass: String,
  7828. duration: [Number, String, Object]
  7829. };
  7830. // in case the child is also an abstract component, e.g. <keep-alive>
  7831. // we want to recursively retrieve the real component to be rendered
  7832. function getRealChild (vnode) {
  7833. var compOptions = vnode && vnode.componentOptions;
  7834. if (compOptions && compOptions.Ctor.options.abstract) {
  7835. return getRealChild(getFirstComponentChild(compOptions.children))
  7836. } else {
  7837. return vnode
  7838. }
  7839. }
  7840. function extractTransitionData (comp) {
  7841. var data = {};
  7842. var options = comp.$options;
  7843. // props
  7844. for (var key in options.propsData) {
  7845. data[key] = comp[key];
  7846. }
  7847. // events.
  7848. // extract listeners and pass them directly to the transition methods
  7849. var listeners = options._parentListeners;
  7850. for (var key$1 in listeners) {
  7851. data[camelize(key$1)] = listeners[key$1];
  7852. }
  7853. return data
  7854. }
  7855. function placeholder (h, rawChild) {
  7856. if (/\d-keep-alive$/.test(rawChild.tag)) {
  7857. return h('keep-alive', {
  7858. props: rawChild.componentOptions.propsData
  7859. })
  7860. }
  7861. }
  7862. function hasParentTransition (vnode) {
  7863. while ((vnode = vnode.parent)) {
  7864. if (vnode.data.transition) {
  7865. return true
  7866. }
  7867. }
  7868. }
  7869. function isSameChild (child, oldChild) {
  7870. return oldChild.key === child.key && oldChild.tag === child.tag
  7871. }
  7872. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  7873. var isVShowDirective = function (d) { return d.name === 'show'; };
  7874. var Transition = {
  7875. name: 'transition',
  7876. props: transitionProps,
  7877. abstract: true,
  7878. render: function render (h) {
  7879. var this$1 = this;
  7880. var children = this.$slots.default;
  7881. if (!children) {
  7882. return
  7883. }
  7884. // filter out text nodes (possible whitespaces)
  7885. children = children.filter(isNotTextNode);
  7886. /* istanbul ignore if */
  7887. if (!children.length) {
  7888. return
  7889. }
  7890. // warn multiple elements
  7891. if (children.length > 1) {
  7892. warn(
  7893. '<transition> can only be used on a single element. Use ' +
  7894. '<transition-group> for lists.',
  7895. this.$parent
  7896. );
  7897. }
  7898. var mode = this.mode;
  7899. // warn invalid mode
  7900. if (mode && mode !== 'in-out' && mode !== 'out-in'
  7901. ) {
  7902. warn(
  7903. 'invalid <transition> mode: ' + mode,
  7904. this.$parent
  7905. );
  7906. }
  7907. var rawChild = children[0];
  7908. // if this is a component root node and the component's
  7909. // parent container node also has transition, skip.
  7910. if (hasParentTransition(this.$vnode)) {
  7911. return rawChild
  7912. }
  7913. // apply transition data to child
  7914. // use getRealChild() to ignore abstract components e.g. keep-alive
  7915. var child = getRealChild(rawChild);
  7916. /* istanbul ignore if */
  7917. if (!child) {
  7918. return rawChild
  7919. }
  7920. if (this._leaving) {
  7921. return placeholder(h, rawChild)
  7922. }
  7923. // ensure a key that is unique to the vnode type and to this transition
  7924. // component instance. This key will be used to remove pending leaving nodes
  7925. // during entering.
  7926. var id = "__transition-" + (this._uid) + "-";
  7927. child.key = child.key == null
  7928. ? child.isComment
  7929. ? id + 'comment'
  7930. : id + child.tag
  7931. : isPrimitive(child.key)
  7932. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  7933. : child.key;
  7934. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  7935. var oldRawChild = this._vnode;
  7936. var oldChild = getRealChild(oldRawChild);
  7937. // mark v-show
  7938. // so that the transition module can hand over the control to the directive
  7939. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  7940. child.data.show = true;
  7941. }
  7942. if (
  7943. oldChild &&
  7944. oldChild.data &&
  7945. !isSameChild(child, oldChild) &&
  7946. !isAsyncPlaceholder(oldChild) &&
  7947. // #6687 component root is a comment node
  7948. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  7949. ) {
  7950. // replace old child transition data with fresh one
  7951. // important for dynamic transitions!
  7952. var oldData = oldChild.data.transition = extend({}, data);
  7953. // handle transition mode
  7954. if (mode === 'out-in') {
  7955. // return placeholder node and queue update when leave finishes
  7956. this._leaving = true;
  7957. mergeVNodeHook(oldData, 'afterLeave', function () {
  7958. this$1._leaving = false;
  7959. this$1.$forceUpdate();
  7960. });
  7961. return placeholder(h, rawChild)
  7962. } else if (mode === 'in-out') {
  7963. if (isAsyncPlaceholder(child)) {
  7964. return oldRawChild
  7965. }
  7966. var delayedLeave;
  7967. var performLeave = function () { delayedLeave(); };
  7968. mergeVNodeHook(data, 'afterEnter', performLeave);
  7969. mergeVNodeHook(data, 'enterCancelled', performLeave);
  7970. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  7971. }
  7972. }
  7973. return rawChild
  7974. }
  7975. };
  7976. /* */
  7977. var props = extend({
  7978. tag: String,
  7979. moveClass: String
  7980. }, transitionProps);
  7981. delete props.mode;
  7982. var TransitionGroup = {
  7983. props: props,
  7984. beforeMount: function beforeMount () {
  7985. var this$1 = this;
  7986. var update = this._update;
  7987. this._update = function (vnode, hydrating) {
  7988. var restoreActiveInstance = setActiveInstance(this$1);
  7989. // force removing pass
  7990. this$1.__patch__(
  7991. this$1._vnode,
  7992. this$1.kept,
  7993. false, // hydrating
  7994. true // removeOnly (!important, avoids unnecessary moves)
  7995. );
  7996. this$1._vnode = this$1.kept;
  7997. restoreActiveInstance();
  7998. update.call(this$1, vnode, hydrating);
  7999. };
  8000. },
  8001. render: function render (h) {
  8002. var tag = this.tag || this.$vnode.data.tag || 'span';
  8003. var map = Object.create(null);
  8004. var prevChildren = this.prevChildren = this.children;
  8005. var rawChildren = this.$slots.default || [];
  8006. var children = this.children = [];
  8007. var transitionData = extractTransitionData(this);
  8008. for (var i = 0; i < rawChildren.length; i++) {
  8009. var c = rawChildren[i];
  8010. if (c.tag) {
  8011. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  8012. children.push(c);
  8013. map[c.key] = c
  8014. ;(c.data || (c.data = {})).transition = transitionData;
  8015. } else {
  8016. var opts = c.componentOptions;
  8017. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  8018. warn(("<transition-group> children must be keyed: <" + name + ">"));
  8019. }
  8020. }
  8021. }
  8022. if (prevChildren) {
  8023. var kept = [];
  8024. var removed = [];
  8025. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  8026. var c$1 = prevChildren[i$1];
  8027. c$1.data.transition = transitionData;
  8028. c$1.data.pos = c$1.elm.getBoundingClientRect();
  8029. if (map[c$1.key]) {
  8030. kept.push(c$1);
  8031. } else {
  8032. removed.push(c$1);
  8033. }
  8034. }
  8035. this.kept = h(tag, null, kept);
  8036. this.removed = removed;
  8037. }
  8038. return h(tag, null, children)
  8039. },
  8040. updated: function updated () {
  8041. var children = this.prevChildren;
  8042. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  8043. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  8044. return
  8045. }
  8046. // we divide the work into three loops to avoid mixing DOM reads and writes
  8047. // in each iteration - which helps prevent layout thrashing.
  8048. children.forEach(callPendingCbs);
  8049. children.forEach(recordPosition);
  8050. children.forEach(applyTranslation);
  8051. // force reflow to put everything in position
  8052. // assign to this to avoid being removed in tree-shaking
  8053. // $flow-disable-line
  8054. this._reflow = document.body.offsetHeight;
  8055. children.forEach(function (c) {
  8056. if (c.data.moved) {
  8057. var el = c.elm;
  8058. var s = el.style;
  8059. addTransitionClass(el, moveClass);
  8060. s.transform = s.WebkitTransform = s.transitionDuration = '';
  8061. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  8062. if (e && e.target !== el) {
  8063. return
  8064. }
  8065. if (!e || /transform$/.test(e.propertyName)) {
  8066. el.removeEventListener(transitionEndEvent, cb);
  8067. el._moveCb = null;
  8068. removeTransitionClass(el, moveClass);
  8069. }
  8070. });
  8071. }
  8072. });
  8073. },
  8074. methods: {
  8075. hasMove: function hasMove (el, moveClass) {
  8076. /* istanbul ignore if */
  8077. if (!hasTransition) {
  8078. return false
  8079. }
  8080. /* istanbul ignore if */
  8081. if (this._hasMove) {
  8082. return this._hasMove
  8083. }
  8084. // Detect whether an element with the move class applied has
  8085. // CSS transitions. Since the element may be inside an entering
  8086. // transition at this very moment, we make a clone of it and remove
  8087. // all other transition classes applied to ensure only the move class
  8088. // is applied.
  8089. var clone = el.cloneNode();
  8090. if (el._transitionClasses) {
  8091. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  8092. }
  8093. addClass(clone, moveClass);
  8094. clone.style.display = 'none';
  8095. this.$el.appendChild(clone);
  8096. var info = getTransitionInfo(clone);
  8097. this.$el.removeChild(clone);
  8098. return (this._hasMove = info.hasTransform)
  8099. }
  8100. }
  8101. };
  8102. function callPendingCbs (c) {
  8103. /* istanbul ignore if */
  8104. if (c.elm._moveCb) {
  8105. c.elm._moveCb();
  8106. }
  8107. /* istanbul ignore if */
  8108. if (c.elm._enterCb) {
  8109. c.elm._enterCb();
  8110. }
  8111. }
  8112. function recordPosition (c) {
  8113. c.data.newPos = c.elm.getBoundingClientRect();
  8114. }
  8115. function applyTranslation (c) {
  8116. var oldPos = c.data.pos;
  8117. var newPos = c.data.newPos;
  8118. var dx = oldPos.left - newPos.left;
  8119. var dy = oldPos.top - newPos.top;
  8120. if (dx || dy) {
  8121. c.data.moved = true;
  8122. var s = c.elm.style;
  8123. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  8124. s.transitionDuration = '0s';
  8125. }
  8126. }
  8127. var platformComponents = {
  8128. Transition: Transition,
  8129. TransitionGroup: TransitionGroup
  8130. };
  8131. /* */
  8132. // install platform specific utils
  8133. Vue.config.mustUseProp = mustUseProp;
  8134. Vue.config.isReservedTag = isReservedTag;
  8135. Vue.config.isReservedAttr = isReservedAttr;
  8136. Vue.config.getTagNamespace = getTagNamespace;
  8137. Vue.config.isUnknownElement = isUnknownElement;
  8138. // install platform runtime directives & components
  8139. extend(Vue.options.directives, platformDirectives);
  8140. extend(Vue.options.components, platformComponents);
  8141. // install platform patch function
  8142. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  8143. // public mount method
  8144. Vue.prototype.$mount = function (
  8145. el,
  8146. hydrating
  8147. ) {
  8148. el = el && inBrowser ? query(el) : undefined;
  8149. return mountComponent(this, el, hydrating)
  8150. };
  8151. // devtools global hook
  8152. /* istanbul ignore next */
  8153. if (inBrowser) {
  8154. setTimeout(function () {
  8155. if (config.devtools) {
  8156. if (devtools) {
  8157. devtools.emit('init', Vue);
  8158. } else {
  8159. console[console.info ? 'info' : 'log'](
  8160. 'Download the Vue Devtools extension for a better development experience:\n' +
  8161. 'https://github.com/vuejs/vue-devtools'
  8162. );
  8163. }
  8164. }
  8165. if (config.productionTip !== false &&
  8166. typeof console !== 'undefined'
  8167. ) {
  8168. console[console.info ? 'info' : 'log'](
  8169. "You are running Vue in development mode.\n" +
  8170. "Make sure to turn on production mode when deploying for production.\n" +
  8171. "See more tips at https://vuejs.org/guide/deployment.html"
  8172. );
  8173. }
  8174. }, 0);
  8175. }
  8176. /* */
  8177. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  8178. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  8179. var buildRegex = cached(function (delimiters) {
  8180. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  8181. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  8182. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  8183. });
  8184. function parseText (
  8185. text,
  8186. delimiters
  8187. ) {
  8188. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  8189. if (!tagRE.test(text)) {
  8190. return
  8191. }
  8192. var tokens = [];
  8193. var rawTokens = [];
  8194. var lastIndex = tagRE.lastIndex = 0;
  8195. var match, index, tokenValue;
  8196. while ((match = tagRE.exec(text))) {
  8197. index = match.index;
  8198. // push text token
  8199. if (index > lastIndex) {
  8200. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  8201. tokens.push(JSON.stringify(tokenValue));
  8202. }
  8203. // tag token
  8204. var exp = parseFilters(match[1].trim());
  8205. tokens.push(("_s(" + exp + ")"));
  8206. rawTokens.push({ '@binding': exp });
  8207. lastIndex = index + match[0].length;
  8208. }
  8209. if (lastIndex < text.length) {
  8210. rawTokens.push(tokenValue = text.slice(lastIndex));
  8211. tokens.push(JSON.stringify(tokenValue));
  8212. }
  8213. return {
  8214. expression: tokens.join('+'),
  8215. tokens: rawTokens
  8216. }
  8217. }
  8218. /* */
  8219. function transformNode (el, options) {
  8220. var warn = options.warn || baseWarn;
  8221. var staticClass = getAndRemoveAttr(el, 'class');
  8222. if (staticClass) {
  8223. var res = parseText(staticClass, options.delimiters);
  8224. if (res) {
  8225. warn(
  8226. "class=\"" + staticClass + "\": " +
  8227. 'Interpolation inside attributes has been removed. ' +
  8228. 'Use v-bind or the colon shorthand instead. For example, ' +
  8229. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  8230. el.rawAttrsMap['class']
  8231. );
  8232. }
  8233. }
  8234. if (staticClass) {
  8235. el.staticClass = JSON.stringify(staticClass);
  8236. }
  8237. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  8238. if (classBinding) {
  8239. el.classBinding = classBinding;
  8240. }
  8241. }
  8242. function genData (el) {
  8243. var data = '';
  8244. if (el.staticClass) {
  8245. data += "staticClass:" + (el.staticClass) + ",";
  8246. }
  8247. if (el.classBinding) {
  8248. data += "class:" + (el.classBinding) + ",";
  8249. }
  8250. return data
  8251. }
  8252. var klass$1 = {
  8253. staticKeys: ['staticClass'],
  8254. transformNode: transformNode,
  8255. genData: genData
  8256. };
  8257. /* */
  8258. function transformNode$1 (el, options) {
  8259. var warn = options.warn || baseWarn;
  8260. var staticStyle = getAndRemoveAttr(el, 'style');
  8261. if (staticStyle) {
  8262. /* istanbul ignore if */
  8263. {
  8264. var res = parseText(staticStyle, options.delimiters);
  8265. if (res) {
  8266. warn(
  8267. "style=\"" + staticStyle + "\": " +
  8268. 'Interpolation inside attributes has been removed. ' +
  8269. 'Use v-bind or the colon shorthand instead. For example, ' +
  8270. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  8271. el.rawAttrsMap['style']
  8272. );
  8273. }
  8274. }
  8275. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  8276. }
  8277. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  8278. if (styleBinding) {
  8279. el.styleBinding = styleBinding;
  8280. }
  8281. }
  8282. function genData$1 (el) {
  8283. var data = '';
  8284. if (el.staticStyle) {
  8285. data += "staticStyle:" + (el.staticStyle) + ",";
  8286. }
  8287. if (el.styleBinding) {
  8288. data += "style:(" + (el.styleBinding) + "),";
  8289. }
  8290. return data
  8291. }
  8292. var style$1 = {
  8293. staticKeys: ['staticStyle'],
  8294. transformNode: transformNode$1,
  8295. genData: genData$1
  8296. };
  8297. /* */
  8298. var decoder;
  8299. var he = {
  8300. decode: function decode (html) {
  8301. decoder = decoder || document.createElement('div');
  8302. decoder.innerHTML = html;
  8303. return decoder.textContent
  8304. }
  8305. };
  8306. /* */
  8307. var isUnaryTag = makeMap(
  8308. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  8309. 'link,meta,param,source,track,wbr'
  8310. );
  8311. // Elements that you can, intentionally, leave open
  8312. // (and which close themselves)
  8313. var canBeLeftOpenTag = makeMap(
  8314. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  8315. );
  8316. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  8317. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  8318. var isNonPhrasingTag = makeMap(
  8319. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  8320. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  8321. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  8322. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  8323. 'title,tr,track'
  8324. );
  8325. /**
  8326. * Not type-checking this file because it's mostly vendor code.
  8327. */
  8328. // Regular Expressions for parsing tags and attributes
  8329. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  8330. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  8331. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  8332. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  8333. var startTagOpen = new RegExp(("^<" + qnameCapture));
  8334. var startTagClose = /^\s*(\/?)>/;
  8335. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  8336. var doctype = /^<!DOCTYPE [^>]+>/i;
  8337. // #7298: escape - to avoid being pased as HTML comment when inlined in page
  8338. var comment = /^<!\--/;
  8339. var conditionalComment = /^<!\[/;
  8340. // Special Elements (can contain anything)
  8341. var isPlainTextElement = makeMap('script,style,textarea', true);
  8342. var reCache = {};
  8343. var decodingMap = {
  8344. '&lt;': '<',
  8345. '&gt;': '>',
  8346. '&quot;': '"',
  8347. '&amp;': '&',
  8348. '&#10;': '\n',
  8349. '&#9;': '\t',
  8350. '&#39;': "'"
  8351. };
  8352. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  8353. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  8354. // #5992
  8355. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  8356. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  8357. function decodeAttr (value, shouldDecodeNewlines) {
  8358. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  8359. return value.replace(re, function (match) { return decodingMap[match]; })
  8360. }
  8361. function parseHTML (html, options) {
  8362. var stack = [];
  8363. var expectHTML = options.expectHTML;
  8364. var isUnaryTag$$1 = options.isUnaryTag || no;
  8365. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  8366. var index = 0;
  8367. var last, lastTag;
  8368. while (html) {
  8369. last = html;
  8370. // Make sure we're not in a plaintext content element like script/style
  8371. if (!lastTag || !isPlainTextElement(lastTag)) {
  8372. var textEnd = html.indexOf('<');
  8373. if (textEnd === 0) {
  8374. // Comment:
  8375. if (comment.test(html)) {
  8376. var commentEnd = html.indexOf('-->');
  8377. if (commentEnd >= 0) {
  8378. if (options.shouldKeepComment) {
  8379. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  8380. }
  8381. advance(commentEnd + 3);
  8382. continue
  8383. }
  8384. }
  8385. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  8386. if (conditionalComment.test(html)) {
  8387. var conditionalEnd = html.indexOf(']>');
  8388. if (conditionalEnd >= 0) {
  8389. advance(conditionalEnd + 2);
  8390. continue
  8391. }
  8392. }
  8393. // Doctype:
  8394. var doctypeMatch = html.match(doctype);
  8395. if (doctypeMatch) {
  8396. advance(doctypeMatch[0].length);
  8397. continue
  8398. }
  8399. // End tag:
  8400. var endTagMatch = html.match(endTag);
  8401. if (endTagMatch) {
  8402. var curIndex = index;
  8403. advance(endTagMatch[0].length);
  8404. parseEndTag(endTagMatch[1], curIndex, index);
  8405. continue
  8406. }
  8407. // Start tag:
  8408. var startTagMatch = parseStartTag();
  8409. if (startTagMatch) {
  8410. handleStartTag(startTagMatch);
  8411. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  8412. advance(1);
  8413. }
  8414. continue
  8415. }
  8416. }
  8417. var text = (void 0), rest = (void 0), next = (void 0);
  8418. if (textEnd >= 0) {
  8419. rest = html.slice(textEnd);
  8420. while (
  8421. !endTag.test(rest) &&
  8422. !startTagOpen.test(rest) &&
  8423. !comment.test(rest) &&
  8424. !conditionalComment.test(rest)
  8425. ) {
  8426. // < in plain text, be forgiving and treat it as text
  8427. next = rest.indexOf('<', 1);
  8428. if (next < 0) { break }
  8429. textEnd += next;
  8430. rest = html.slice(textEnd);
  8431. }
  8432. text = html.substring(0, textEnd);
  8433. }
  8434. if (textEnd < 0) {
  8435. text = html;
  8436. }
  8437. if (text) {
  8438. advance(text.length);
  8439. }
  8440. if (options.chars && text) {
  8441. options.chars(text, index - text.length, index);
  8442. }
  8443. } else {
  8444. var endTagLength = 0;
  8445. var stackedTag = lastTag.toLowerCase();
  8446. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  8447. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  8448. endTagLength = endTag.length;
  8449. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  8450. text = text
  8451. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  8452. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  8453. }
  8454. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  8455. text = text.slice(1);
  8456. }
  8457. if (options.chars) {
  8458. options.chars(text);
  8459. }
  8460. return ''
  8461. });
  8462. index += html.length - rest$1.length;
  8463. html = rest$1;
  8464. parseEndTag(stackedTag, index - endTagLength, index);
  8465. }
  8466. if (html === last) {
  8467. options.chars && options.chars(html);
  8468. if (!stack.length && options.warn) {
  8469. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  8470. }
  8471. break
  8472. }
  8473. }
  8474. // Clean up any remaining tags
  8475. parseEndTag();
  8476. function advance (n) {
  8477. index += n;
  8478. html = html.substring(n);
  8479. }
  8480. function parseStartTag () {
  8481. var start = html.match(startTagOpen);
  8482. if (start) {
  8483. var match = {
  8484. tagName: start[1],
  8485. attrs: [],
  8486. start: index
  8487. };
  8488. advance(start[0].length);
  8489. var end, attr;
  8490. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  8491. attr.start = index;
  8492. advance(attr[0].length);
  8493. attr.end = index;
  8494. match.attrs.push(attr);
  8495. }
  8496. if (end) {
  8497. match.unarySlash = end[1];
  8498. advance(end[0].length);
  8499. match.end = index;
  8500. return match
  8501. }
  8502. }
  8503. }
  8504. function handleStartTag (match) {
  8505. var tagName = match.tagName;
  8506. var unarySlash = match.unarySlash;
  8507. if (expectHTML) {
  8508. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  8509. parseEndTag(lastTag);
  8510. }
  8511. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  8512. parseEndTag(tagName);
  8513. }
  8514. }
  8515. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  8516. var l = match.attrs.length;
  8517. var attrs = new Array(l);
  8518. for (var i = 0; i < l; i++) {
  8519. var args = match.attrs[i];
  8520. var value = args[3] || args[4] || args[5] || '';
  8521. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  8522. ? options.shouldDecodeNewlinesForHref
  8523. : options.shouldDecodeNewlines;
  8524. attrs[i] = {
  8525. name: args[1],
  8526. value: decodeAttr(value, shouldDecodeNewlines)
  8527. };
  8528. if (options.outputSourceRange) {
  8529. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  8530. attrs[i].end = args.end;
  8531. }
  8532. }
  8533. if (!unary) {
  8534. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  8535. lastTag = tagName;
  8536. }
  8537. if (options.start) {
  8538. options.start(tagName, attrs, unary, match.start, match.end);
  8539. }
  8540. }
  8541. function parseEndTag (tagName, start, end) {
  8542. var pos, lowerCasedTagName;
  8543. if (start == null) { start = index; }
  8544. if (end == null) { end = index; }
  8545. // Find the closest opened tag of the same type
  8546. if (tagName) {
  8547. lowerCasedTagName = tagName.toLowerCase();
  8548. for (pos = stack.length - 1; pos >= 0; pos--) {
  8549. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  8550. break
  8551. }
  8552. }
  8553. } else {
  8554. // If no tag name is provided, clean shop
  8555. pos = 0;
  8556. }
  8557. if (pos >= 0) {
  8558. // Close all the open elements, up the stack
  8559. for (var i = stack.length - 1; i >= pos; i--) {
  8560. if (i > pos || !tagName &&
  8561. options.warn
  8562. ) {
  8563. options.warn(
  8564. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  8565. { start: stack[i].start, end: stack[i].end }
  8566. );
  8567. }
  8568. if (options.end) {
  8569. options.end(stack[i].tag, start, end);
  8570. }
  8571. }
  8572. // Remove the open elements from the stack
  8573. stack.length = pos;
  8574. lastTag = pos && stack[pos - 1].tag;
  8575. } else if (lowerCasedTagName === 'br') {
  8576. if (options.start) {
  8577. options.start(tagName, [], true, start, end);
  8578. }
  8579. } else if (lowerCasedTagName === 'p') {
  8580. if (options.start) {
  8581. options.start(tagName, [], false, start, end);
  8582. }
  8583. if (options.end) {
  8584. options.end(tagName, start, end);
  8585. }
  8586. }
  8587. }
  8588. }
  8589. /* */
  8590. var onRE = /^@|^v-on:/;
  8591. var dirRE = /^v-|^@|^:/;
  8592. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  8593. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  8594. var stripParensRE = /^\(|\)$/g;
  8595. var dynamicArgRE = /^\[.*\]$/;
  8596. var argRE = /:(.*)$/;
  8597. var bindRE = /^:|^\.|^v-bind:/;
  8598. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  8599. var slotRE = /^v-slot(:|$)|^#/;
  8600. var lineBreakRE = /[\r\n]/;
  8601. var whitespaceRE$1 = /\s+/g;
  8602. var invalidAttributeRE = /[\s"'<>\/=]/;
  8603. var decodeHTMLCached = cached(he.decode);
  8604. var emptySlotScopeToken = "_empty_";
  8605. // configurable state
  8606. var warn$2;
  8607. var delimiters;
  8608. var transforms;
  8609. var preTransforms;
  8610. var postTransforms;
  8611. var platformIsPreTag;
  8612. var platformMustUseProp;
  8613. var platformGetTagNamespace;
  8614. var maybeComponent;
  8615. function createASTElement (
  8616. tag,
  8617. attrs,
  8618. parent
  8619. ) {
  8620. return {
  8621. type: 1,
  8622. tag: tag,
  8623. attrsList: attrs,
  8624. attrsMap: makeAttrsMap(attrs),
  8625. rawAttrsMap: {},
  8626. parent: parent,
  8627. children: []
  8628. }
  8629. }
  8630. /**
  8631. * Convert HTML string to AST.
  8632. */
  8633. function parse (
  8634. template,
  8635. options
  8636. ) {
  8637. warn$2 = options.warn || baseWarn;
  8638. platformIsPreTag = options.isPreTag || no;
  8639. platformMustUseProp = options.mustUseProp || no;
  8640. platformGetTagNamespace = options.getTagNamespace || no;
  8641. var isReservedTag = options.isReservedTag || no;
  8642. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  8643. transforms = pluckModuleFunction(options.modules, 'transformNode');
  8644. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  8645. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  8646. delimiters = options.delimiters;
  8647. var stack = [];
  8648. var preserveWhitespace = options.preserveWhitespace !== false;
  8649. var whitespaceOption = options.whitespace;
  8650. var root;
  8651. var currentParent;
  8652. var inVPre = false;
  8653. var inPre = false;
  8654. var warned = false;
  8655. function warnOnce (msg, range) {
  8656. if (!warned) {
  8657. warned = true;
  8658. warn$2(msg, range);
  8659. }
  8660. }
  8661. function closeElement (element) {
  8662. trimEndingWhitespace(element);
  8663. if (!inVPre && !element.processed) {
  8664. element = processElement(element, options);
  8665. }
  8666. // tree management
  8667. if (!stack.length && element !== root) {
  8668. // allow root elements with v-if, v-else-if and v-else
  8669. if (root.if && (element.elseif || element.else)) {
  8670. {
  8671. checkRootConstraints(element);
  8672. }
  8673. addIfCondition(root, {
  8674. exp: element.elseif,
  8675. block: element
  8676. });
  8677. } else {
  8678. warnOnce(
  8679. "Component template should contain exactly one root element. " +
  8680. "If you are using v-if on multiple elements, " +
  8681. "use v-else-if to chain them instead.",
  8682. { start: element.start }
  8683. );
  8684. }
  8685. }
  8686. if (currentParent && !element.forbidden) {
  8687. if (element.elseif || element.else) {
  8688. processIfConditions(element, currentParent);
  8689. } else {
  8690. if (element.slotScope) {
  8691. // scoped slot
  8692. // keep it in the children list so that v-else(-if) conditions can
  8693. // find it as the prev node.
  8694. var name = element.slotTarget || '"default"'
  8695. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  8696. }
  8697. currentParent.children.push(element);
  8698. element.parent = currentParent;
  8699. }
  8700. }
  8701. // final children cleanup
  8702. // filter out scoped slots
  8703. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  8704. // remove trailing whitespace node again
  8705. trimEndingWhitespace(element);
  8706. // check pre state
  8707. if (element.pre) {
  8708. inVPre = false;
  8709. }
  8710. if (platformIsPreTag(element.tag)) {
  8711. inPre = false;
  8712. }
  8713. // apply post-transforms
  8714. for (var i = 0; i < postTransforms.length; i++) {
  8715. postTransforms[i](element, options);
  8716. }
  8717. }
  8718. function trimEndingWhitespace (el) {
  8719. // remove trailing whitespace node
  8720. if (!inPre) {
  8721. var lastNode;
  8722. while (
  8723. (lastNode = el.children[el.children.length - 1]) &&
  8724. lastNode.type === 3 &&
  8725. lastNode.text === ' '
  8726. ) {
  8727. el.children.pop();
  8728. }
  8729. }
  8730. }
  8731. function checkRootConstraints (el) {
  8732. if (el.tag === 'slot' || el.tag === 'template') {
  8733. warnOnce(
  8734. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  8735. 'contain multiple nodes.',
  8736. { start: el.start }
  8737. );
  8738. }
  8739. if (el.attrsMap.hasOwnProperty('v-for')) {
  8740. warnOnce(
  8741. 'Cannot use v-for on stateful component root element because ' +
  8742. 'it renders multiple elements.',
  8743. el.rawAttrsMap['v-for']
  8744. );
  8745. }
  8746. }
  8747. parseHTML(template, {
  8748. warn: warn$2,
  8749. expectHTML: options.expectHTML,
  8750. isUnaryTag: options.isUnaryTag,
  8751. canBeLeftOpenTag: options.canBeLeftOpenTag,
  8752. shouldDecodeNewlines: options.shouldDecodeNewlines,
  8753. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  8754. shouldKeepComment: options.comments,
  8755. outputSourceRange: options.outputSourceRange,
  8756. start: function start (tag, attrs, unary, start$1, end) {
  8757. // check namespace.
  8758. // inherit parent ns if there is one
  8759. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  8760. // handle IE svg bug
  8761. /* istanbul ignore if */
  8762. if (isIE && ns === 'svg') {
  8763. attrs = guardIESVGBug(attrs);
  8764. }
  8765. var element = createASTElement(tag, attrs, currentParent);
  8766. if (ns) {
  8767. element.ns = ns;
  8768. }
  8769. {
  8770. if (options.outputSourceRange) {
  8771. element.start = start$1;
  8772. element.end = end;
  8773. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  8774. cumulated[attr.name] = attr;
  8775. return cumulated
  8776. }, {});
  8777. }
  8778. attrs.forEach(function (attr) {
  8779. if (invalidAttributeRE.test(attr.name)) {
  8780. warn$2(
  8781. "Invalid dynamic argument expression: attribute names cannot contain " +
  8782. "spaces, quotes, <, >, / or =.",
  8783. {
  8784. start: attr.start + attr.name.indexOf("["),
  8785. end: attr.start + attr.name.length
  8786. }
  8787. );
  8788. }
  8789. });
  8790. }
  8791. if (isForbiddenTag(element) && !isServerRendering()) {
  8792. element.forbidden = true;
  8793. warn$2(
  8794. 'Templates should only be responsible for mapping the state to the ' +
  8795. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  8796. "<" + tag + ">" + ', as they will not be parsed.',
  8797. { start: element.start }
  8798. );
  8799. }
  8800. // apply pre-transforms
  8801. for (var i = 0; i < preTransforms.length; i++) {
  8802. element = preTransforms[i](element, options) || element;
  8803. }
  8804. if (!inVPre) {
  8805. processPre(element);
  8806. if (element.pre) {
  8807. inVPre = true;
  8808. }
  8809. }
  8810. if (platformIsPreTag(element.tag)) {
  8811. inPre = true;
  8812. }
  8813. if (inVPre) {
  8814. processRawAttrs(element);
  8815. } else if (!element.processed) {
  8816. // structural directives
  8817. processFor(element);
  8818. processIf(element);
  8819. processOnce(element);
  8820. }
  8821. if (!root) {
  8822. root = element;
  8823. {
  8824. checkRootConstraints(root);
  8825. }
  8826. }
  8827. if (!unary) {
  8828. currentParent = element;
  8829. stack.push(element);
  8830. } else {
  8831. closeElement(element);
  8832. }
  8833. },
  8834. end: function end (tag, start, end$1) {
  8835. var element = stack[stack.length - 1];
  8836. // pop stack
  8837. stack.length -= 1;
  8838. currentParent = stack[stack.length - 1];
  8839. if (options.outputSourceRange) {
  8840. element.end = end$1;
  8841. }
  8842. closeElement(element);
  8843. },
  8844. chars: function chars (text, start, end) {
  8845. if (!currentParent) {
  8846. {
  8847. if (text === template) {
  8848. warnOnce(
  8849. 'Component template requires a root element, rather than just text.',
  8850. { start: start }
  8851. );
  8852. } else if ((text = text.trim())) {
  8853. warnOnce(
  8854. ("text \"" + text + "\" outside root element will be ignored."),
  8855. { start: start }
  8856. );
  8857. }
  8858. }
  8859. return
  8860. }
  8861. // IE textarea placeholder bug
  8862. /* istanbul ignore if */
  8863. if (isIE &&
  8864. currentParent.tag === 'textarea' &&
  8865. currentParent.attrsMap.placeholder === text
  8866. ) {
  8867. return
  8868. }
  8869. var children = currentParent.children;
  8870. if (inPre || text.trim()) {
  8871. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  8872. } else if (!children.length) {
  8873. // remove the whitespace-only node right after an opening tag
  8874. text = '';
  8875. } else if (whitespaceOption) {
  8876. if (whitespaceOption === 'condense') {
  8877. // in condense mode, remove the whitespace node if it contains
  8878. // line break, otherwise condense to a single space
  8879. text = lineBreakRE.test(text) ? '' : ' ';
  8880. } else {
  8881. text = ' ';
  8882. }
  8883. } else {
  8884. text = preserveWhitespace ? ' ' : '';
  8885. }
  8886. if (text) {
  8887. if (!inPre && whitespaceOption === 'condense') {
  8888. // condense consecutive whitespaces into single space
  8889. text = text.replace(whitespaceRE$1, ' ');
  8890. }
  8891. var res;
  8892. var child;
  8893. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  8894. child = {
  8895. type: 2,
  8896. expression: res.expression,
  8897. tokens: res.tokens,
  8898. text: text
  8899. };
  8900. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  8901. child = {
  8902. type: 3,
  8903. text: text
  8904. };
  8905. }
  8906. if (child) {
  8907. if (options.outputSourceRange) {
  8908. child.start = start;
  8909. child.end = end;
  8910. }
  8911. children.push(child);
  8912. }
  8913. }
  8914. },
  8915. comment: function comment (text, start, end) {
  8916. // adding anyting as a sibling to the root node is forbidden
  8917. // comments should still be allowed, but ignored
  8918. if (currentParent) {
  8919. var child = {
  8920. type: 3,
  8921. text: text,
  8922. isComment: true
  8923. };
  8924. if (options.outputSourceRange) {
  8925. child.start = start;
  8926. child.end = end;
  8927. }
  8928. currentParent.children.push(child);
  8929. }
  8930. }
  8931. });
  8932. return root
  8933. }
  8934. function processPre (el) {
  8935. if (getAndRemoveAttr(el, 'v-pre') != null) {
  8936. el.pre = true;
  8937. }
  8938. }
  8939. function processRawAttrs (el) {
  8940. var list = el.attrsList;
  8941. var len = list.length;
  8942. if (len) {
  8943. var attrs = el.attrs = new Array(len);
  8944. for (var i = 0; i < len; i++) {
  8945. attrs[i] = {
  8946. name: list[i].name,
  8947. value: JSON.stringify(list[i].value)
  8948. };
  8949. if (list[i].start != null) {
  8950. attrs[i].start = list[i].start;
  8951. attrs[i].end = list[i].end;
  8952. }
  8953. }
  8954. } else if (!el.pre) {
  8955. // non root node in pre blocks with no attributes
  8956. el.plain = true;
  8957. }
  8958. }
  8959. function processElement (
  8960. element,
  8961. options
  8962. ) {
  8963. processKey(element);
  8964. // determine whether this is a plain element after
  8965. // removing structural attributes
  8966. element.plain = (
  8967. !element.key &&
  8968. !element.scopedSlots &&
  8969. !element.attrsList.length
  8970. );
  8971. processRef(element);
  8972. processSlotContent(element);
  8973. processSlotOutlet(element);
  8974. processComponent(element);
  8975. for (var i = 0; i < transforms.length; i++) {
  8976. element = transforms[i](element, options) || element;
  8977. }
  8978. processAttrs(element);
  8979. return element
  8980. }
  8981. function processKey (el) {
  8982. var exp = getBindingAttr(el, 'key');
  8983. if (exp) {
  8984. {
  8985. if (el.tag === 'template') {
  8986. warn$2(
  8987. "<template> cannot be keyed. Place the key on real elements instead.",
  8988. getRawBindingAttr(el, 'key')
  8989. );
  8990. }
  8991. if (el.for) {
  8992. var iterator = el.iterator2 || el.iterator1;
  8993. var parent = el.parent;
  8994. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  8995. warn$2(
  8996. "Do not use v-for index as key on <transition-group> children, " +
  8997. "this is the same as not using keys.",
  8998. getRawBindingAttr(el, 'key'),
  8999. true /* tip */
  9000. );
  9001. }
  9002. }
  9003. }
  9004. el.key = exp;
  9005. }
  9006. }
  9007. function processRef (el) {
  9008. var ref = getBindingAttr(el, 'ref');
  9009. if (ref) {
  9010. el.ref = ref;
  9011. el.refInFor = checkInFor(el);
  9012. }
  9013. }
  9014. function processFor (el) {
  9015. var exp;
  9016. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  9017. var res = parseFor(exp);
  9018. if (res) {
  9019. extend(el, res);
  9020. } else {
  9021. warn$2(
  9022. ("Invalid v-for expression: " + exp),
  9023. el.rawAttrsMap['v-for']
  9024. );
  9025. }
  9026. }
  9027. }
  9028. function parseFor (exp) {
  9029. var inMatch = exp.match(forAliasRE);
  9030. if (!inMatch) { return }
  9031. var res = {};
  9032. res.for = inMatch[2].trim();
  9033. var alias = inMatch[1].trim().replace(stripParensRE, '');
  9034. var iteratorMatch = alias.match(forIteratorRE);
  9035. if (iteratorMatch) {
  9036. res.alias = alias.replace(forIteratorRE, '').trim();
  9037. res.iterator1 = iteratorMatch[1].trim();
  9038. if (iteratorMatch[2]) {
  9039. res.iterator2 = iteratorMatch[2].trim();
  9040. }
  9041. } else {
  9042. res.alias = alias;
  9043. }
  9044. return res
  9045. }
  9046. function processIf (el) {
  9047. var exp = getAndRemoveAttr(el, 'v-if');
  9048. if (exp) {
  9049. el.if = exp;
  9050. addIfCondition(el, {
  9051. exp: exp,
  9052. block: el
  9053. });
  9054. } else {
  9055. if (getAndRemoveAttr(el, 'v-else') != null) {
  9056. el.else = true;
  9057. }
  9058. var elseif = getAndRemoveAttr(el, 'v-else-if');
  9059. if (elseif) {
  9060. el.elseif = elseif;
  9061. }
  9062. }
  9063. }
  9064. function processIfConditions (el, parent) {
  9065. var prev = findPrevElement(parent.children);
  9066. if (prev && prev.if) {
  9067. addIfCondition(prev, {
  9068. exp: el.elseif,
  9069. block: el
  9070. });
  9071. } else {
  9072. warn$2(
  9073. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  9074. "used on element <" + (el.tag) + "> without corresponding v-if.",
  9075. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  9076. );
  9077. }
  9078. }
  9079. function findPrevElement (children) {
  9080. var i = children.length;
  9081. while (i--) {
  9082. if (children[i].type === 1) {
  9083. return children[i]
  9084. } else {
  9085. if (children[i].text !== ' ') {
  9086. warn$2(
  9087. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  9088. "will be ignored.",
  9089. children[i]
  9090. );
  9091. }
  9092. children.pop();
  9093. }
  9094. }
  9095. }
  9096. function addIfCondition (el, condition) {
  9097. if (!el.ifConditions) {
  9098. el.ifConditions = [];
  9099. }
  9100. el.ifConditions.push(condition);
  9101. }
  9102. function processOnce (el) {
  9103. var once$$1 = getAndRemoveAttr(el, 'v-once');
  9104. if (once$$1 != null) {
  9105. el.once = true;
  9106. }
  9107. }
  9108. // handle content being passed to a component as slot,
  9109. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  9110. function processSlotContent (el) {
  9111. var slotScope;
  9112. if (el.tag === 'template') {
  9113. slotScope = getAndRemoveAttr(el, 'scope');
  9114. /* istanbul ignore if */
  9115. if (slotScope) {
  9116. warn$2(
  9117. "the \"scope\" attribute for scoped slots have been deprecated and " +
  9118. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  9119. "can also be used on plain elements in addition to <template> to " +
  9120. "denote scoped slots.",
  9121. el.rawAttrsMap['scope'],
  9122. true
  9123. );
  9124. }
  9125. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  9126. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  9127. /* istanbul ignore if */
  9128. if (el.attrsMap['v-for']) {
  9129. warn$2(
  9130. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  9131. "(v-for takes higher priority). Use a wrapper <template> for the " +
  9132. "scoped slot to make it clearer.",
  9133. el.rawAttrsMap['slot-scope'],
  9134. true
  9135. );
  9136. }
  9137. el.slotScope = slotScope;
  9138. }
  9139. // slot="xxx"
  9140. var slotTarget = getBindingAttr(el, 'slot');
  9141. if (slotTarget) {
  9142. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  9143. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  9144. // preserve slot as an attribute for native shadow DOM compat
  9145. // only for non-scoped slots.
  9146. if (el.tag !== 'template' && !el.slotScope) {
  9147. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  9148. }
  9149. }
  9150. // 2.6 v-slot syntax
  9151. {
  9152. if (el.tag === 'template') {
  9153. // v-slot on <template>
  9154. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  9155. if (slotBinding) {
  9156. {
  9157. if (el.slotTarget || el.slotScope) {
  9158. warn$2(
  9159. "Unexpected mixed usage of different slot syntaxes.",
  9160. el
  9161. );
  9162. }
  9163. if (el.parent && !maybeComponent(el.parent)) {
  9164. warn$2(
  9165. "<template v-slot> can only appear at the root level inside " +
  9166. "the receiving the component",
  9167. el
  9168. );
  9169. }
  9170. }
  9171. var ref = getSlotName(slotBinding);
  9172. var name = ref.name;
  9173. var dynamic = ref.dynamic;
  9174. el.slotTarget = name;
  9175. el.slotTargetDynamic = dynamic;
  9176. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  9177. }
  9178. } else {
  9179. // v-slot on component, denotes default slot
  9180. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  9181. if (slotBinding$1) {
  9182. {
  9183. if (!maybeComponent(el)) {
  9184. warn$2(
  9185. "v-slot can only be used on components or <template>.",
  9186. slotBinding$1
  9187. );
  9188. }
  9189. if (el.slotScope || el.slotTarget) {
  9190. warn$2(
  9191. "Unexpected mixed usage of different slot syntaxes.",
  9192. el
  9193. );
  9194. }
  9195. if (el.scopedSlots) {
  9196. warn$2(
  9197. "To avoid scope ambiguity, the default slot should also use " +
  9198. "<template> syntax when there are other named slots.",
  9199. slotBinding$1
  9200. );
  9201. }
  9202. }
  9203. // add the component's children to its default slot
  9204. var slots = el.scopedSlots || (el.scopedSlots = {});
  9205. var ref$1 = getSlotName(slotBinding$1);
  9206. var name$1 = ref$1.name;
  9207. var dynamic$1 = ref$1.dynamic;
  9208. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  9209. slotContainer.slotTarget = name$1;
  9210. slotContainer.slotTargetDynamic = dynamic$1;
  9211. slotContainer.children = el.children.filter(function (c) {
  9212. if (!c.slotScope) {
  9213. c.parent = slotContainer;
  9214. return true
  9215. }
  9216. });
  9217. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  9218. // remove children as they are returned from scopedSlots now
  9219. el.children = [];
  9220. // mark el non-plain so data gets generated
  9221. el.plain = false;
  9222. }
  9223. }
  9224. }
  9225. }
  9226. function getSlotName (binding) {
  9227. var name = binding.name.replace(slotRE, '');
  9228. if (!name) {
  9229. if (binding.name[0] !== '#') {
  9230. name = 'default';
  9231. } else {
  9232. warn$2(
  9233. "v-slot shorthand syntax requires a slot name.",
  9234. binding
  9235. );
  9236. }
  9237. }
  9238. return dynamicArgRE.test(name)
  9239. // dynamic [name]
  9240. ? { name: name.slice(1, -1), dynamic: true }
  9241. // static name
  9242. : { name: ("\"" + name + "\""), dynamic: false }
  9243. }
  9244. // handle <slot/> outlets
  9245. function processSlotOutlet (el) {
  9246. if (el.tag === 'slot') {
  9247. el.slotName = getBindingAttr(el, 'name');
  9248. if (el.key) {
  9249. warn$2(
  9250. "`key` does not work on <slot> because slots are abstract outlets " +
  9251. "and can possibly expand into multiple elements. " +
  9252. "Use the key on a wrapping element instead.",
  9253. getRawBindingAttr(el, 'key')
  9254. );
  9255. }
  9256. }
  9257. }
  9258. function processComponent (el) {
  9259. var binding;
  9260. if ((binding = getBindingAttr(el, 'is'))) {
  9261. el.component = binding;
  9262. }
  9263. if (getAndRemoveAttr(el, 'inline-template') != null) {
  9264. el.inlineTemplate = true;
  9265. }
  9266. }
  9267. function processAttrs (el) {
  9268. var list = el.attrsList;
  9269. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  9270. for (i = 0, l = list.length; i < l; i++) {
  9271. name = rawName = list[i].name;
  9272. value = list[i].value;
  9273. if (dirRE.test(name)) {
  9274. // mark element as dynamic
  9275. el.hasBindings = true;
  9276. // modifiers
  9277. modifiers = parseModifiers(name.replace(dirRE, ''));
  9278. // support .foo shorthand syntax for the .prop modifier
  9279. if (modifiers) {
  9280. name = name.replace(modifierRE, '');
  9281. }
  9282. if (bindRE.test(name)) { // v-bind
  9283. name = name.replace(bindRE, '');
  9284. value = parseFilters(value);
  9285. isDynamic = dynamicArgRE.test(name);
  9286. if (isDynamic) {
  9287. name = name.slice(1, -1);
  9288. }
  9289. if (
  9290. value.trim().length === 0
  9291. ) {
  9292. warn$2(
  9293. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  9294. );
  9295. }
  9296. if (modifiers) {
  9297. if (modifiers.prop && !isDynamic) {
  9298. name = camelize(name);
  9299. if (name === 'innerHtml') { name = 'innerHTML'; }
  9300. }
  9301. if (modifiers.camel && !isDynamic) {
  9302. name = camelize(name);
  9303. }
  9304. if (modifiers.sync) {
  9305. syncGen = genAssignmentCode(value, "$event");
  9306. if (!isDynamic) {
  9307. addHandler(
  9308. el,
  9309. ("update:" + (camelize(name))),
  9310. syncGen,
  9311. null,
  9312. false,
  9313. warn$2,
  9314. list[i]
  9315. );
  9316. if (hyphenate(name) !== camelize(name)) {
  9317. addHandler(
  9318. el,
  9319. ("update:" + (hyphenate(name))),
  9320. syncGen,
  9321. null,
  9322. false,
  9323. warn$2,
  9324. list[i]
  9325. );
  9326. }
  9327. } else {
  9328. // handler w/ dynamic event name
  9329. addHandler(
  9330. el,
  9331. ("\"update:\"+(" + name + ")"),
  9332. syncGen,
  9333. null,
  9334. false,
  9335. warn$2,
  9336. list[i],
  9337. true // dynamic
  9338. );
  9339. }
  9340. }
  9341. }
  9342. if ((modifiers && modifiers.prop) || (
  9343. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  9344. )) {
  9345. addProp(el, name, value, list[i], isDynamic);
  9346. } else {
  9347. addAttr(el, name, value, list[i], isDynamic);
  9348. }
  9349. } else if (onRE.test(name)) { // v-on
  9350. name = name.replace(onRE, '');
  9351. isDynamic = dynamicArgRE.test(name);
  9352. if (isDynamic) {
  9353. name = name.slice(1, -1);
  9354. }
  9355. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  9356. } else { // normal directives
  9357. name = name.replace(dirRE, '');
  9358. // parse arg
  9359. var argMatch = name.match(argRE);
  9360. var arg = argMatch && argMatch[1];
  9361. isDynamic = false;
  9362. if (arg) {
  9363. name = name.slice(0, -(arg.length + 1));
  9364. if (dynamicArgRE.test(arg)) {
  9365. arg = arg.slice(1, -1);
  9366. isDynamic = true;
  9367. }
  9368. }
  9369. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  9370. if (name === 'model') {
  9371. checkForAliasModel(el, value);
  9372. }
  9373. }
  9374. } else {
  9375. // literal attribute
  9376. {
  9377. var res = parseText(value, delimiters);
  9378. if (res) {
  9379. warn$2(
  9380. name + "=\"" + value + "\": " +
  9381. 'Interpolation inside attributes has been removed. ' +
  9382. 'Use v-bind or the colon shorthand instead. For example, ' +
  9383. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  9384. list[i]
  9385. );
  9386. }
  9387. }
  9388. addAttr(el, name, JSON.stringify(value), list[i]);
  9389. // #6887 firefox doesn't update muted state if set via attribute
  9390. // even immediately after element creation
  9391. if (!el.component &&
  9392. name === 'muted' &&
  9393. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  9394. addProp(el, name, 'true', list[i]);
  9395. }
  9396. }
  9397. }
  9398. }
  9399. function checkInFor (el) {
  9400. var parent = el;
  9401. while (parent) {
  9402. if (parent.for !== undefined) {
  9403. return true
  9404. }
  9405. parent = parent.parent;
  9406. }
  9407. return false
  9408. }
  9409. function parseModifiers (name) {
  9410. var match = name.match(modifierRE);
  9411. if (match) {
  9412. var ret = {};
  9413. match.forEach(function (m) { ret[m.slice(1)] = true; });
  9414. return ret
  9415. }
  9416. }
  9417. function makeAttrsMap (attrs) {
  9418. var map = {};
  9419. for (var i = 0, l = attrs.length; i < l; i++) {
  9420. if (
  9421. map[attrs[i].name] && !isIE && !isEdge
  9422. ) {
  9423. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  9424. }
  9425. map[attrs[i].name] = attrs[i].value;
  9426. }
  9427. return map
  9428. }
  9429. // for script (e.g. type="x/template") or style, do not decode content
  9430. function isTextTag (el) {
  9431. return el.tag === 'script' || el.tag === 'style'
  9432. }
  9433. function isForbiddenTag (el) {
  9434. return (
  9435. el.tag === 'style' ||
  9436. (el.tag === 'script' && (
  9437. !el.attrsMap.type ||
  9438. el.attrsMap.type === 'text/javascript'
  9439. ))
  9440. )
  9441. }
  9442. var ieNSBug = /^xmlns:NS\d+/;
  9443. var ieNSPrefix = /^NS\d+:/;
  9444. /* istanbul ignore next */
  9445. function guardIESVGBug (attrs) {
  9446. var res = [];
  9447. for (var i = 0; i < attrs.length; i++) {
  9448. var attr = attrs[i];
  9449. if (!ieNSBug.test(attr.name)) {
  9450. attr.name = attr.name.replace(ieNSPrefix, '');
  9451. res.push(attr);
  9452. }
  9453. }
  9454. return res
  9455. }
  9456. function checkForAliasModel (el, value) {
  9457. var _el = el;
  9458. while (_el) {
  9459. if (_el.for && _el.alias === value) {
  9460. warn$2(
  9461. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  9462. "You are binding v-model directly to a v-for iteration alias. " +
  9463. "This will not be able to modify the v-for source array because " +
  9464. "writing to the alias is like modifying a function local variable. " +
  9465. "Consider using an array of objects and use v-model on an object property instead.",
  9466. el.rawAttrsMap['v-model']
  9467. );
  9468. }
  9469. _el = _el.parent;
  9470. }
  9471. }
  9472. /* */
  9473. function preTransformNode (el, options) {
  9474. if (el.tag === 'input') {
  9475. var map = el.attrsMap;
  9476. if (!map['v-model']) {
  9477. return
  9478. }
  9479. var typeBinding;
  9480. if (map[':type'] || map['v-bind:type']) {
  9481. typeBinding = getBindingAttr(el, 'type');
  9482. }
  9483. if (!map.type && !typeBinding && map['v-bind']) {
  9484. typeBinding = "(" + (map['v-bind']) + ").type";
  9485. }
  9486. if (typeBinding) {
  9487. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  9488. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  9489. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  9490. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  9491. // 1. checkbox
  9492. var branch0 = cloneASTElement(el);
  9493. // process for on the main node
  9494. processFor(branch0);
  9495. addRawAttr(branch0, 'type', 'checkbox');
  9496. processElement(branch0, options);
  9497. branch0.processed = true; // prevent it from double-processed
  9498. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  9499. addIfCondition(branch0, {
  9500. exp: branch0.if,
  9501. block: branch0
  9502. });
  9503. // 2. add radio else-if condition
  9504. var branch1 = cloneASTElement(el);
  9505. getAndRemoveAttr(branch1, 'v-for', true);
  9506. addRawAttr(branch1, 'type', 'radio');
  9507. processElement(branch1, options);
  9508. addIfCondition(branch0, {
  9509. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  9510. block: branch1
  9511. });
  9512. // 3. other
  9513. var branch2 = cloneASTElement(el);
  9514. getAndRemoveAttr(branch2, 'v-for', true);
  9515. addRawAttr(branch2, ':type', typeBinding);
  9516. processElement(branch2, options);
  9517. addIfCondition(branch0, {
  9518. exp: ifCondition,
  9519. block: branch2
  9520. });
  9521. if (hasElse) {
  9522. branch0.else = true;
  9523. } else if (elseIfCondition) {
  9524. branch0.elseif = elseIfCondition;
  9525. }
  9526. return branch0
  9527. }
  9528. }
  9529. }
  9530. function cloneASTElement (el) {
  9531. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  9532. }
  9533. var model$1 = {
  9534. preTransformNode: preTransformNode
  9535. };
  9536. var modules$1 = [
  9537. klass$1,
  9538. style$1,
  9539. model$1
  9540. ];
  9541. /* */
  9542. function text (el, dir) {
  9543. if (dir.value) {
  9544. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  9545. }
  9546. }
  9547. /* */
  9548. function html (el, dir) {
  9549. if (dir.value) {
  9550. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  9551. }
  9552. }
  9553. var directives$1 = {
  9554. model: model,
  9555. text: text,
  9556. html: html
  9557. };
  9558. /* */
  9559. var baseOptions = {
  9560. expectHTML: true,
  9561. modules: modules$1,
  9562. directives: directives$1,
  9563. isPreTag: isPreTag,
  9564. isUnaryTag: isUnaryTag,
  9565. mustUseProp: mustUseProp,
  9566. canBeLeftOpenTag: canBeLeftOpenTag,
  9567. isReservedTag: isReservedTag,
  9568. getTagNamespace: getTagNamespace,
  9569. staticKeys: genStaticKeys(modules$1)
  9570. };
  9571. /* */
  9572. var isStaticKey;
  9573. var isPlatformReservedTag;
  9574. var genStaticKeysCached = cached(genStaticKeys$1);
  9575. /**
  9576. * Goal of the optimizer: walk the generated template AST tree
  9577. * and detect sub-trees that are purely static, i.e. parts of
  9578. * the DOM that never needs to change.
  9579. *
  9580. * Once we detect these sub-trees, we can:
  9581. *
  9582. * 1. Hoist them into constants, so that we no longer need to
  9583. * create fresh nodes for them on each re-render;
  9584. * 2. Completely skip them in the patching process.
  9585. */
  9586. function optimize (root, options) {
  9587. if (!root) { return }
  9588. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  9589. isPlatformReservedTag = options.isReservedTag || no;
  9590. // first pass: mark all non-static nodes.
  9591. markStatic$1(root);
  9592. // second pass: mark static roots.
  9593. markStaticRoots(root, false);
  9594. }
  9595. function genStaticKeys$1 (keys) {
  9596. return makeMap(
  9597. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  9598. (keys ? ',' + keys : '')
  9599. )
  9600. }
  9601. function markStatic$1 (node) {
  9602. node.static = isStatic(node);
  9603. if (node.type === 1) {
  9604. // do not make component slot content static. this avoids
  9605. // 1. components not able to mutate slot nodes
  9606. // 2. static slot content fails for hot-reloading
  9607. if (
  9608. !isPlatformReservedTag(node.tag) &&
  9609. node.tag !== 'slot' &&
  9610. node.attrsMap['inline-template'] == null
  9611. ) {
  9612. return
  9613. }
  9614. for (var i = 0, l = node.children.length; i < l; i++) {
  9615. var child = node.children[i];
  9616. markStatic$1(child);
  9617. if (!child.static) {
  9618. node.static = false;
  9619. }
  9620. }
  9621. if (node.ifConditions) {
  9622. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  9623. var block = node.ifConditions[i$1].block;
  9624. markStatic$1(block);
  9625. if (!block.static) {
  9626. node.static = false;
  9627. }
  9628. }
  9629. }
  9630. }
  9631. }
  9632. function markStaticRoots (node, isInFor) {
  9633. if (node.type === 1) {
  9634. if (node.static || node.once) {
  9635. node.staticInFor = isInFor;
  9636. }
  9637. // For a node to qualify as a static root, it should have children that
  9638. // are not just static text. Otherwise the cost of hoisting out will
  9639. // outweigh the benefits and it's better off to just always render it fresh.
  9640. if (node.static && node.children.length && !(
  9641. node.children.length === 1 &&
  9642. node.children[0].type === 3
  9643. )) {
  9644. node.staticRoot = true;
  9645. return
  9646. } else {
  9647. node.staticRoot = false;
  9648. }
  9649. if (node.children) {
  9650. for (var i = 0, l = node.children.length; i < l; i++) {
  9651. markStaticRoots(node.children[i], isInFor || !!node.for);
  9652. }
  9653. }
  9654. if (node.ifConditions) {
  9655. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  9656. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  9657. }
  9658. }
  9659. }
  9660. }
  9661. function isStatic (node) {
  9662. if (node.type === 2) { // expression
  9663. return false
  9664. }
  9665. if (node.type === 3) { // text
  9666. return true
  9667. }
  9668. return !!(node.pre || (
  9669. !node.hasBindings && // no dynamic bindings
  9670. !node.if && !node.for && // not v-if or v-for or v-else
  9671. !isBuiltInTag(node.tag) && // not a built-in
  9672. isPlatformReservedTag(node.tag) && // not a component
  9673. !isDirectChildOfTemplateFor(node) &&
  9674. Object.keys(node).every(isStaticKey)
  9675. ))
  9676. }
  9677. function isDirectChildOfTemplateFor (node) {
  9678. while (node.parent) {
  9679. node = node.parent;
  9680. if (node.tag !== 'template') {
  9681. return false
  9682. }
  9683. if (node.for) {
  9684. return true
  9685. }
  9686. }
  9687. return false
  9688. }
  9689. /* */
  9690. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*(?:[\w$]+)?\s*\(/;
  9691. var fnInvokeRE = /\([^)]*?\);*$/;
  9692. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  9693. // KeyboardEvent.keyCode aliases
  9694. var keyCodes = {
  9695. esc: 27,
  9696. tab: 9,
  9697. enter: 13,
  9698. space: 32,
  9699. up: 38,
  9700. left: 37,
  9701. right: 39,
  9702. down: 40,
  9703. 'delete': [8, 46]
  9704. };
  9705. // KeyboardEvent.key aliases
  9706. var keyNames = {
  9707. // #7880: IE11 and Edge use `Esc` for Escape key name.
  9708. esc: ['Esc', 'Escape'],
  9709. tab: 'Tab',
  9710. enter: 'Enter',
  9711. // #9112: IE11 uses `Spacebar` for Space key name.
  9712. space: [' ', 'Spacebar'],
  9713. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  9714. up: ['Up', 'ArrowUp'],
  9715. left: ['Left', 'ArrowLeft'],
  9716. right: ['Right', 'ArrowRight'],
  9717. down: ['Down', 'ArrowDown'],
  9718. // #9112: IE11 uses `Del` for Delete key name.
  9719. 'delete': ['Backspace', 'Delete', 'Del']
  9720. };
  9721. // #4868: modifiers that prevent the execution of the listener
  9722. // need to explicitly return null so that we can determine whether to remove
  9723. // the listener for .once
  9724. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  9725. var modifierCode = {
  9726. stop: '$event.stopPropagation();',
  9727. prevent: '$event.preventDefault();',
  9728. self: genGuard("$event.target !== $event.currentTarget"),
  9729. ctrl: genGuard("!$event.ctrlKey"),
  9730. shift: genGuard("!$event.shiftKey"),
  9731. alt: genGuard("!$event.altKey"),
  9732. meta: genGuard("!$event.metaKey"),
  9733. left: genGuard("'button' in $event && $event.button !== 0"),
  9734. middle: genGuard("'button' in $event && $event.button !== 1"),
  9735. right: genGuard("'button' in $event && $event.button !== 2")
  9736. };
  9737. function genHandlers (
  9738. events,
  9739. isNative
  9740. ) {
  9741. var prefix = isNative ? 'nativeOn:' : 'on:';
  9742. var staticHandlers = "";
  9743. var dynamicHandlers = "";
  9744. for (var name in events) {
  9745. var handlerCode = genHandler(events[name]);
  9746. if (events[name] && events[name].dynamic) {
  9747. dynamicHandlers += name + "," + handlerCode + ",";
  9748. } else {
  9749. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  9750. }
  9751. }
  9752. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  9753. if (dynamicHandlers) {
  9754. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  9755. } else {
  9756. return prefix + staticHandlers
  9757. }
  9758. }
  9759. function genHandler (handler) {
  9760. if (!handler) {
  9761. return 'function(){}'
  9762. }
  9763. if (Array.isArray(handler)) {
  9764. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  9765. }
  9766. var isMethodPath = simplePathRE.test(handler.value);
  9767. var isFunctionExpression = fnExpRE.test(handler.value);
  9768. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  9769. if (!handler.modifiers) {
  9770. if (isMethodPath || isFunctionExpression) {
  9771. return handler.value
  9772. }
  9773. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  9774. } else {
  9775. var code = '';
  9776. var genModifierCode = '';
  9777. var keys = [];
  9778. for (var key in handler.modifiers) {
  9779. if (modifierCode[key]) {
  9780. genModifierCode += modifierCode[key];
  9781. // left/right
  9782. if (keyCodes[key]) {
  9783. keys.push(key);
  9784. }
  9785. } else if (key === 'exact') {
  9786. var modifiers = (handler.modifiers);
  9787. genModifierCode += genGuard(
  9788. ['ctrl', 'shift', 'alt', 'meta']
  9789. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  9790. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  9791. .join('||')
  9792. );
  9793. } else {
  9794. keys.push(key);
  9795. }
  9796. }
  9797. if (keys.length) {
  9798. code += genKeyFilter(keys);
  9799. }
  9800. // Make sure modifiers like prevent and stop get executed after key filtering
  9801. if (genModifierCode) {
  9802. code += genModifierCode;
  9803. }
  9804. var handlerCode = isMethodPath
  9805. ? ("return " + (handler.value) + "($event)")
  9806. : isFunctionExpression
  9807. ? ("return (" + (handler.value) + ")($event)")
  9808. : isFunctionInvocation
  9809. ? ("return " + (handler.value))
  9810. : handler.value;
  9811. return ("function($event){" + code + handlerCode + "}")
  9812. }
  9813. }
  9814. function genKeyFilter (keys) {
  9815. return (
  9816. // make sure the key filters only apply to KeyboardEvents
  9817. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  9818. // key events that do not have keyCode property...
  9819. "if(!$event.type.indexOf('key')&&" +
  9820. (keys.map(genFilterCode).join('&&')) + ")return null;"
  9821. )
  9822. }
  9823. function genFilterCode (key) {
  9824. var keyVal = parseInt(key, 10);
  9825. if (keyVal) {
  9826. return ("$event.keyCode!==" + keyVal)
  9827. }
  9828. var keyCode = keyCodes[key];
  9829. var keyName = keyNames[key];
  9830. return (
  9831. "_k($event.keyCode," +
  9832. (JSON.stringify(key)) + "," +
  9833. (JSON.stringify(keyCode)) + "," +
  9834. "$event.key," +
  9835. "" + (JSON.stringify(keyName)) +
  9836. ")"
  9837. )
  9838. }
  9839. /* */
  9840. function on (el, dir) {
  9841. if (dir.modifiers) {
  9842. warn("v-on without argument does not support modifiers.");
  9843. }
  9844. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  9845. }
  9846. /* */
  9847. function bind$1 (el, dir) {
  9848. el.wrapData = function (code) {
  9849. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  9850. };
  9851. }
  9852. /* */
  9853. var baseDirectives = {
  9854. on: on,
  9855. bind: bind$1,
  9856. cloak: noop
  9857. };
  9858. /* */
  9859. var CodegenState = function CodegenState (options) {
  9860. this.options = options;
  9861. this.warn = options.warn || baseWarn;
  9862. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  9863. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  9864. this.directives = extend(extend({}, baseDirectives), options.directives);
  9865. var isReservedTag = options.isReservedTag || no;
  9866. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  9867. this.onceId = 0;
  9868. this.staticRenderFns = [];
  9869. this.pre = false;
  9870. };
  9871. function generate (
  9872. ast,
  9873. options
  9874. ) {
  9875. var state = new CodegenState(options);
  9876. var code = ast ? genElement(ast, state) : '_c("div")';
  9877. return {
  9878. render: ("with(this){return " + code + "}"),
  9879. staticRenderFns: state.staticRenderFns
  9880. }
  9881. }
  9882. function genElement (el, state) {
  9883. if (el.parent) {
  9884. el.pre = el.pre || el.parent.pre;
  9885. }
  9886. if (el.staticRoot && !el.staticProcessed) {
  9887. return genStatic(el, state)
  9888. } else if (el.once && !el.onceProcessed) {
  9889. return genOnce(el, state)
  9890. } else if (el.for && !el.forProcessed) {
  9891. return genFor(el, state)
  9892. } else if (el.if && !el.ifProcessed) {
  9893. return genIf(el, state)
  9894. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  9895. return genChildren(el, state) || 'void 0'
  9896. } else if (el.tag === 'slot') {
  9897. return genSlot(el, state)
  9898. } else {
  9899. // component or element
  9900. var code;
  9901. if (el.component) {
  9902. code = genComponent(el.component, el, state);
  9903. } else {
  9904. var data;
  9905. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  9906. data = genData$2(el, state);
  9907. }
  9908. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  9909. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  9910. }
  9911. // module transforms
  9912. for (var i = 0; i < state.transforms.length; i++) {
  9913. code = state.transforms[i](el, code);
  9914. }
  9915. return code
  9916. }
  9917. }
  9918. // hoist static sub-trees out
  9919. function genStatic (el, state) {
  9920. el.staticProcessed = true;
  9921. // Some elements (templates) need to behave differently inside of a v-pre
  9922. // node. All pre nodes are static roots, so we can use this as a location to
  9923. // wrap a state change and reset it upon exiting the pre node.
  9924. var originalPreState = state.pre;
  9925. if (el.pre) {
  9926. state.pre = el.pre;
  9927. }
  9928. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  9929. state.pre = originalPreState;
  9930. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  9931. }
  9932. // v-once
  9933. function genOnce (el, state) {
  9934. el.onceProcessed = true;
  9935. if (el.if && !el.ifProcessed) {
  9936. return genIf(el, state)
  9937. } else if (el.staticInFor) {
  9938. var key = '';
  9939. var parent = el.parent;
  9940. while (parent) {
  9941. if (parent.for) {
  9942. key = parent.key;
  9943. break
  9944. }
  9945. parent = parent.parent;
  9946. }
  9947. if (!key) {
  9948. state.warn(
  9949. "v-once can only be used inside v-for that is keyed. ",
  9950. el.rawAttrsMap['v-once']
  9951. );
  9952. return genElement(el, state)
  9953. }
  9954. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  9955. } else {
  9956. return genStatic(el, state)
  9957. }
  9958. }
  9959. function genIf (
  9960. el,
  9961. state,
  9962. altGen,
  9963. altEmpty
  9964. ) {
  9965. el.ifProcessed = true; // avoid recursion
  9966. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  9967. }
  9968. function genIfConditions (
  9969. conditions,
  9970. state,
  9971. altGen,
  9972. altEmpty
  9973. ) {
  9974. if (!conditions.length) {
  9975. return altEmpty || '_e()'
  9976. }
  9977. var condition = conditions.shift();
  9978. if (condition.exp) {
  9979. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  9980. } else {
  9981. return ("" + (genTernaryExp(condition.block)))
  9982. }
  9983. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  9984. function genTernaryExp (el) {
  9985. return altGen
  9986. ? altGen(el, state)
  9987. : el.once
  9988. ? genOnce(el, state)
  9989. : genElement(el, state)
  9990. }
  9991. }
  9992. function genFor (
  9993. el,
  9994. state,
  9995. altGen,
  9996. altHelper
  9997. ) {
  9998. var exp = el.for;
  9999. var alias = el.alias;
  10000. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  10001. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  10002. if (state.maybeComponent(el) &&
  10003. el.tag !== 'slot' &&
  10004. el.tag !== 'template' &&
  10005. !el.key
  10006. ) {
  10007. state.warn(
  10008. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  10009. "v-for should have explicit keys. " +
  10010. "See https://vuejs.org/guide/list.html#key for more info.",
  10011. el.rawAttrsMap['v-for'],
  10012. true /* tip */
  10013. );
  10014. }
  10015. el.forProcessed = true; // avoid recursion
  10016. return (altHelper || '_l') + "((" + exp + ")," +
  10017. "function(" + alias + iterator1 + iterator2 + "){" +
  10018. "return " + ((altGen || genElement)(el, state)) +
  10019. '})'
  10020. }
  10021. function genData$2 (el, state) {
  10022. var data = '{';
  10023. // directives first.
  10024. // directives may mutate the el's other properties before they are generated.
  10025. var dirs = genDirectives(el, state);
  10026. if (dirs) { data += dirs + ','; }
  10027. // key
  10028. if (el.key) {
  10029. data += "key:" + (el.key) + ",";
  10030. }
  10031. // ref
  10032. if (el.ref) {
  10033. data += "ref:" + (el.ref) + ",";
  10034. }
  10035. if (el.refInFor) {
  10036. data += "refInFor:true,";
  10037. }
  10038. // pre
  10039. if (el.pre) {
  10040. data += "pre:true,";
  10041. }
  10042. // record original tag name for components using "is" attribute
  10043. if (el.component) {
  10044. data += "tag:\"" + (el.tag) + "\",";
  10045. }
  10046. // module data generation functions
  10047. for (var i = 0; i < state.dataGenFns.length; i++) {
  10048. data += state.dataGenFns[i](el);
  10049. }
  10050. // attributes
  10051. if (el.attrs) {
  10052. data += "attrs:" + (genProps(el.attrs)) + ",";
  10053. }
  10054. // DOM props
  10055. if (el.props) {
  10056. data += "domProps:" + (genProps(el.props)) + ",";
  10057. }
  10058. // event handlers
  10059. if (el.events) {
  10060. data += (genHandlers(el.events, false)) + ",";
  10061. }
  10062. if (el.nativeEvents) {
  10063. data += (genHandlers(el.nativeEvents, true)) + ",";
  10064. }
  10065. // slot target
  10066. // only for non-scoped slots
  10067. if (el.slotTarget && !el.slotScope) {
  10068. data += "slot:" + (el.slotTarget) + ",";
  10069. }
  10070. // scoped slots
  10071. if (el.scopedSlots) {
  10072. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  10073. }
  10074. // component v-model
  10075. if (el.model) {
  10076. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  10077. }
  10078. // inline-template
  10079. if (el.inlineTemplate) {
  10080. var inlineTemplate = genInlineTemplate(el, state);
  10081. if (inlineTemplate) {
  10082. data += inlineTemplate + ",";
  10083. }
  10084. }
  10085. data = data.replace(/,$/, '') + '}';
  10086. // v-bind dynamic argument wrap
  10087. // v-bind with dynamic arguments must be applied using the same v-bind object
  10088. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  10089. if (el.dynamicAttrs) {
  10090. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  10091. }
  10092. // v-bind data wrap
  10093. if (el.wrapData) {
  10094. data = el.wrapData(data);
  10095. }
  10096. // v-on data wrap
  10097. if (el.wrapListeners) {
  10098. data = el.wrapListeners(data);
  10099. }
  10100. return data
  10101. }
  10102. function genDirectives (el, state) {
  10103. var dirs = el.directives;
  10104. if (!dirs) { return }
  10105. var res = 'directives:[';
  10106. var hasRuntime = false;
  10107. var i, l, dir, needRuntime;
  10108. for (i = 0, l = dirs.length; i < l; i++) {
  10109. dir = dirs[i];
  10110. needRuntime = true;
  10111. var gen = state.directives[dir.name];
  10112. if (gen) {
  10113. // compile-time directive that manipulates AST.
  10114. // returns true if it also needs a runtime counterpart.
  10115. needRuntime = !!gen(el, dir, state.warn);
  10116. }
  10117. if (needRuntime) {
  10118. hasRuntime = true;
  10119. 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))) : '') + "},";
  10120. }
  10121. }
  10122. if (hasRuntime) {
  10123. return res.slice(0, -1) + ']'
  10124. }
  10125. }
  10126. function genInlineTemplate (el, state) {
  10127. var ast = el.children[0];
  10128. if (el.children.length !== 1 || ast.type !== 1) {
  10129. state.warn(
  10130. 'Inline-template components must have exactly one child element.',
  10131. { start: el.start }
  10132. );
  10133. }
  10134. if (ast && ast.type === 1) {
  10135. var inlineRenderFns = generate(ast, state.options);
  10136. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  10137. }
  10138. }
  10139. function genScopedSlots (
  10140. el,
  10141. slots,
  10142. state
  10143. ) {
  10144. // by default scoped slots are considered "stable", this allows child
  10145. // components with only scoped slots to skip forced updates from parent.
  10146. // but in some cases we have to bail-out of this optimization
  10147. // for example if the slot contains dynamic names, has v-if or v-for on them...
  10148. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  10149. var slot = slots[key];
  10150. return (
  10151. slot.slotTargetDynamic ||
  10152. slot.if ||
  10153. slot.for ||
  10154. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  10155. )
  10156. });
  10157. // #9534: if a component with scoped slots is inside a conditional branch,
  10158. // it's possible for the same component to be reused but with different
  10159. // compiled slot content. To avoid that, we generate a unique key based on
  10160. // the generated code of all the slot contents.
  10161. var needsKey = !!el.if;
  10162. // OR when it is inside another scoped slot or v-for (the reactivity may be
  10163. // disconnected due to the intermediate scope variable)
  10164. // #9438, #9506
  10165. // TODO: this can be further optimized by properly analyzing in-scope bindings
  10166. // and skip force updating ones that do not actually use scope variables.
  10167. if (!needsForceUpdate) {
  10168. var parent = el.parent;
  10169. while (parent) {
  10170. if (
  10171. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  10172. parent.for
  10173. ) {
  10174. needsForceUpdate = true;
  10175. break
  10176. }
  10177. if (parent.if) {
  10178. needsKey = true;
  10179. }
  10180. parent = parent.parent;
  10181. }
  10182. }
  10183. var generatedSlots = Object.keys(slots)
  10184. .map(function (key) { return genScopedSlot(slots[key], state); })
  10185. .join(',');
  10186. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  10187. }
  10188. function hash(str) {
  10189. var hash = 5381;
  10190. var i = str.length;
  10191. while(i) {
  10192. hash = (hash * 33) ^ str.charCodeAt(--i);
  10193. }
  10194. return hash >>> 0
  10195. }
  10196. function containsSlotChild (el) {
  10197. if (el.type === 1) {
  10198. if (el.tag === 'slot') {
  10199. return true
  10200. }
  10201. return el.children.some(containsSlotChild)
  10202. }
  10203. return false
  10204. }
  10205. function genScopedSlot (
  10206. el,
  10207. state
  10208. ) {
  10209. var isLegacySyntax = el.attrsMap['slot-scope'];
  10210. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  10211. return genIf(el, state, genScopedSlot, "null")
  10212. }
  10213. if (el.for && !el.forProcessed) {
  10214. return genFor(el, state, genScopedSlot)
  10215. }
  10216. var slotScope = el.slotScope === emptySlotScopeToken
  10217. ? ""
  10218. : String(el.slotScope);
  10219. var fn = "function(" + slotScope + "){" +
  10220. "return " + (el.tag === 'template'
  10221. ? el.if && isLegacySyntax
  10222. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  10223. : genChildren(el, state) || 'undefined'
  10224. : genElement(el, state)) + "}";
  10225. // reverse proxy v-slot without scope on this.$slots
  10226. var reverseProxy = slotScope ? "" : ",proxy:true";
  10227. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  10228. }
  10229. function genChildren (
  10230. el,
  10231. state,
  10232. checkSkip,
  10233. altGenElement,
  10234. altGenNode
  10235. ) {
  10236. var children = el.children;
  10237. if (children.length) {
  10238. var el$1 = children[0];
  10239. // optimize single v-for
  10240. if (children.length === 1 &&
  10241. el$1.for &&
  10242. el$1.tag !== 'template' &&
  10243. el$1.tag !== 'slot'
  10244. ) {
  10245. var normalizationType = checkSkip
  10246. ? state.maybeComponent(el$1) ? ",1" : ",0"
  10247. : "";
  10248. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  10249. }
  10250. var normalizationType$1 = checkSkip
  10251. ? getNormalizationType(children, state.maybeComponent)
  10252. : 0;
  10253. var gen = altGenNode || genNode;
  10254. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  10255. }
  10256. }
  10257. // determine the normalization needed for the children array.
  10258. // 0: no normalization needed
  10259. // 1: simple normalization needed (possible 1-level deep nested array)
  10260. // 2: full normalization needed
  10261. function getNormalizationType (
  10262. children,
  10263. maybeComponent
  10264. ) {
  10265. var res = 0;
  10266. for (var i = 0; i < children.length; i++) {
  10267. var el = children[i];
  10268. if (el.type !== 1) {
  10269. continue
  10270. }
  10271. if (needsNormalization(el) ||
  10272. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  10273. res = 2;
  10274. break
  10275. }
  10276. if (maybeComponent(el) ||
  10277. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  10278. res = 1;
  10279. }
  10280. }
  10281. return res
  10282. }
  10283. function needsNormalization (el) {
  10284. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  10285. }
  10286. function genNode (node, state) {
  10287. if (node.type === 1) {
  10288. return genElement(node, state)
  10289. } else if (node.type === 3 && node.isComment) {
  10290. return genComment(node)
  10291. } else {
  10292. return genText(node)
  10293. }
  10294. }
  10295. function genText (text) {
  10296. return ("_v(" + (text.type === 2
  10297. ? text.expression // no need for () because already wrapped in _s()
  10298. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  10299. }
  10300. function genComment (comment) {
  10301. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  10302. }
  10303. function genSlot (el, state) {
  10304. var slotName = el.slotName || '"default"';
  10305. var children = genChildren(el, state);
  10306. var res = "_t(" + slotName + (children ? ("," + children) : '');
  10307. var attrs = el.attrs || el.dynamicAttrs
  10308. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  10309. // slot props are camelized
  10310. name: camelize(attr.name),
  10311. value: attr.value,
  10312. dynamic: attr.dynamic
  10313. }); }))
  10314. : null;
  10315. var bind$$1 = el.attrsMap['v-bind'];
  10316. if ((attrs || bind$$1) && !children) {
  10317. res += ",null";
  10318. }
  10319. if (attrs) {
  10320. res += "," + attrs;
  10321. }
  10322. if (bind$$1) {
  10323. res += (attrs ? '' : ',null') + "," + bind$$1;
  10324. }
  10325. return res + ')'
  10326. }
  10327. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  10328. function genComponent (
  10329. componentName,
  10330. el,
  10331. state
  10332. ) {
  10333. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  10334. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  10335. }
  10336. function genProps (props) {
  10337. var staticProps = "";
  10338. var dynamicProps = "";
  10339. for (var i = 0; i < props.length; i++) {
  10340. var prop = props[i];
  10341. var value = transformSpecialNewlines(prop.value);
  10342. if (prop.dynamic) {
  10343. dynamicProps += (prop.name) + "," + value + ",";
  10344. } else {
  10345. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  10346. }
  10347. }
  10348. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  10349. if (dynamicProps) {
  10350. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  10351. } else {
  10352. return staticProps
  10353. }
  10354. }
  10355. // #3895, #4268
  10356. function transformSpecialNewlines (text) {
  10357. return text
  10358. .replace(/\u2028/g, '\\u2028')
  10359. .replace(/\u2029/g, '\\u2029')
  10360. }
  10361. /* */
  10362. // these keywords should not appear inside expressions, but operators like
  10363. // typeof, instanceof and in are allowed
  10364. var prohibitedKeywordRE = new RegExp('\\b' + (
  10365. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  10366. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  10367. 'extends,finally,continue,debugger,function,arguments'
  10368. ).split(',').join('\\b|\\b') + '\\b');
  10369. // these unary operators should not be used as property/method names
  10370. var unaryOperatorsRE = new RegExp('\\b' + (
  10371. 'delete,typeof,void'
  10372. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  10373. // strip strings in expressions
  10374. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  10375. // detect problematic expressions in a template
  10376. function detectErrors (ast, warn) {
  10377. if (ast) {
  10378. checkNode(ast, warn);
  10379. }
  10380. }
  10381. function checkNode (node, warn) {
  10382. if (node.type === 1) {
  10383. for (var name in node.attrsMap) {
  10384. if (dirRE.test(name)) {
  10385. var value = node.attrsMap[name];
  10386. if (value) {
  10387. var range = node.rawAttrsMap[name];
  10388. if (name === 'v-for') {
  10389. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  10390. } else if (onRE.test(name)) {
  10391. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  10392. } else {
  10393. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  10394. }
  10395. }
  10396. }
  10397. }
  10398. if (node.children) {
  10399. for (var i = 0; i < node.children.length; i++) {
  10400. checkNode(node.children[i], warn);
  10401. }
  10402. }
  10403. } else if (node.type === 2) {
  10404. checkExpression(node.expression, node.text, warn, node);
  10405. }
  10406. }
  10407. function checkEvent (exp, text, warn, range) {
  10408. var stipped = exp.replace(stripStringRE, '');
  10409. var keywordMatch = stipped.match(unaryOperatorsRE);
  10410. if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
  10411. warn(
  10412. "avoid using JavaScript unary operator as property name: " +
  10413. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  10414. range
  10415. );
  10416. }
  10417. checkExpression(exp, text, warn, range);
  10418. }
  10419. function checkFor (node, text, warn, range) {
  10420. checkExpression(node.for || '', text, warn, range);
  10421. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  10422. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  10423. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  10424. }
  10425. function checkIdentifier (
  10426. ident,
  10427. type,
  10428. text,
  10429. warn,
  10430. range
  10431. ) {
  10432. if (typeof ident === 'string') {
  10433. try {
  10434. new Function(("var " + ident + "=_"));
  10435. } catch (e) {
  10436. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  10437. }
  10438. }
  10439. }
  10440. function checkExpression (exp, text, warn, range) {
  10441. try {
  10442. new Function(("return " + exp));
  10443. } catch (e) {
  10444. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  10445. if (keywordMatch) {
  10446. warn(
  10447. "avoid using JavaScript keyword as property name: " +
  10448. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  10449. range
  10450. );
  10451. } else {
  10452. warn(
  10453. "invalid expression: " + (e.message) + " in\n\n" +
  10454. " " + exp + "\n\n" +
  10455. " Raw expression: " + (text.trim()) + "\n",
  10456. range
  10457. );
  10458. }
  10459. }
  10460. }
  10461. /* */
  10462. var range = 2;
  10463. function generateCodeFrame (
  10464. source,
  10465. start,
  10466. end
  10467. ) {
  10468. if ( start === void 0 ) start = 0;
  10469. if ( end === void 0 ) end = source.length;
  10470. var lines = source.split(/\r?\n/);
  10471. var count = 0;
  10472. var res = [];
  10473. for (var i = 0; i < lines.length; i++) {
  10474. count += lines[i].length + 1;
  10475. if (count >= start) {
  10476. for (var j = i - range; j <= i + range || end > count; j++) {
  10477. if (j < 0 || j >= lines.length) { continue }
  10478. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  10479. var lineLength = lines[j].length;
  10480. if (j === i) {
  10481. // push underline
  10482. var pad = start - (count - lineLength) + 1;
  10483. var length = end > count ? lineLength - pad : end - start;
  10484. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  10485. } else if (j > i) {
  10486. if (end > count) {
  10487. var length$1 = Math.min(end - count, lineLength);
  10488. res.push(" | " + repeat$1("^", length$1));
  10489. }
  10490. count += lineLength + 1;
  10491. }
  10492. }
  10493. break
  10494. }
  10495. }
  10496. return res.join('\n')
  10497. }
  10498. function repeat$1 (str, n) {
  10499. var result = '';
  10500. if (n > 0) {
  10501. while (true) { // eslint-disable-line
  10502. if (n & 1) { result += str; }
  10503. n >>>= 1;
  10504. if (n <= 0) { break }
  10505. str += str;
  10506. }
  10507. }
  10508. return result
  10509. }
  10510. /* */
  10511. function createFunction (code, errors) {
  10512. try {
  10513. return new Function(code)
  10514. } catch (err) {
  10515. errors.push({ err: err, code: code });
  10516. return noop
  10517. }
  10518. }
  10519. function createCompileToFunctionFn (compile) {
  10520. var cache = Object.create(null);
  10521. return function compileToFunctions (
  10522. template,
  10523. options,
  10524. vm
  10525. ) {
  10526. options = extend({}, options);
  10527. var warn$$1 = options.warn || warn;
  10528. delete options.warn;
  10529. /* istanbul ignore if */
  10530. {
  10531. // detect possible CSP restriction
  10532. try {
  10533. new Function('return 1');
  10534. } catch (e) {
  10535. if (e.toString().match(/unsafe-eval|CSP/)) {
  10536. warn$$1(
  10537. 'It seems you are using the standalone build of Vue.js in an ' +
  10538. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  10539. 'The template compiler cannot work in this environment. Consider ' +
  10540. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  10541. 'templates into render functions.'
  10542. );
  10543. }
  10544. }
  10545. }
  10546. // check cache
  10547. var key = options.delimiters
  10548. ? String(options.delimiters) + template
  10549. : template;
  10550. if (cache[key]) {
  10551. return cache[key]
  10552. }
  10553. // compile
  10554. var compiled = compile(template, options);
  10555. // check compilation errors/tips
  10556. {
  10557. if (compiled.errors && compiled.errors.length) {
  10558. if (options.outputSourceRange) {
  10559. compiled.errors.forEach(function (e) {
  10560. warn$$1(
  10561. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  10562. generateCodeFrame(template, e.start, e.end),
  10563. vm
  10564. );
  10565. });
  10566. } else {
  10567. warn$$1(
  10568. "Error compiling template:\n\n" + template + "\n\n" +
  10569. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  10570. vm
  10571. );
  10572. }
  10573. }
  10574. if (compiled.tips && compiled.tips.length) {
  10575. if (options.outputSourceRange) {
  10576. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  10577. } else {
  10578. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  10579. }
  10580. }
  10581. }
  10582. // turn code into functions
  10583. var res = {};
  10584. var fnGenErrors = [];
  10585. res.render = createFunction(compiled.render, fnGenErrors);
  10586. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  10587. return createFunction(code, fnGenErrors)
  10588. });
  10589. // check function generation errors.
  10590. // this should only happen if there is a bug in the compiler itself.
  10591. // mostly for codegen development use
  10592. /* istanbul ignore if */
  10593. {
  10594. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  10595. warn$$1(
  10596. "Failed to generate render function:\n\n" +
  10597. fnGenErrors.map(function (ref) {
  10598. var err = ref.err;
  10599. var code = ref.code;
  10600. return ((err.toString()) + " in\n\n" + code + "\n");
  10601. }).join('\n'),
  10602. vm
  10603. );
  10604. }
  10605. }
  10606. return (cache[key] = res)
  10607. }
  10608. }
  10609. /* */
  10610. function createCompilerCreator (baseCompile) {
  10611. return function createCompiler (baseOptions) {
  10612. function compile (
  10613. template,
  10614. options
  10615. ) {
  10616. var finalOptions = Object.create(baseOptions);
  10617. var errors = [];
  10618. var tips = [];
  10619. var warn = function (msg, range, tip) {
  10620. (tip ? tips : errors).push(msg);
  10621. };
  10622. if (options) {
  10623. if (options.outputSourceRange) {
  10624. // $flow-disable-line
  10625. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  10626. warn = function (msg, range, tip) {
  10627. var data = { msg: msg };
  10628. if (range) {
  10629. if (range.start != null) {
  10630. data.start = range.start + leadingSpaceLength;
  10631. }
  10632. if (range.end != null) {
  10633. data.end = range.end + leadingSpaceLength;
  10634. }
  10635. }
  10636. (tip ? tips : errors).push(data);
  10637. };
  10638. }
  10639. // merge custom modules
  10640. if (options.modules) {
  10641. finalOptions.modules =
  10642. (baseOptions.modules || []).concat(options.modules);
  10643. }
  10644. // merge custom directives
  10645. if (options.directives) {
  10646. finalOptions.directives = extend(
  10647. Object.create(baseOptions.directives || null),
  10648. options.directives
  10649. );
  10650. }
  10651. // copy other options
  10652. for (var key in options) {
  10653. if (key !== 'modules' && key !== 'directives') {
  10654. finalOptions[key] = options[key];
  10655. }
  10656. }
  10657. }
  10658. finalOptions.warn = warn;
  10659. var compiled = baseCompile(template.trim(), finalOptions);
  10660. {
  10661. detectErrors(compiled.ast, warn);
  10662. }
  10663. compiled.errors = errors;
  10664. compiled.tips = tips;
  10665. return compiled
  10666. }
  10667. return {
  10668. compile: compile,
  10669. compileToFunctions: createCompileToFunctionFn(compile)
  10670. }
  10671. }
  10672. }
  10673. /* */
  10674. // `createCompilerCreator` allows creating compilers that use alternative
  10675. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  10676. // Here we just export a default compiler using the default parts.
  10677. var createCompiler = createCompilerCreator(function baseCompile (
  10678. template,
  10679. options
  10680. ) {
  10681. var ast = parse(template.trim(), options);
  10682. if (options.optimize !== false) {
  10683. optimize(ast, options);
  10684. }
  10685. var code = generate(ast, options);
  10686. return {
  10687. ast: ast,
  10688. render: code.render,
  10689. staticRenderFns: code.staticRenderFns
  10690. }
  10691. });
  10692. /* */
  10693. var ref$1 = createCompiler(baseOptions);
  10694. var compile = ref$1.compile;
  10695. var compileToFunctions = ref$1.compileToFunctions;
  10696. /* */
  10697. // check whether current browser encodes a char inside attribute values
  10698. var div;
  10699. function getShouldDecode (href) {
  10700. div = div || document.createElement('div');
  10701. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  10702. return div.innerHTML.indexOf('&#10;') > 0
  10703. }
  10704. // #3663: IE encodes newlines inside attribute values while other browsers don't
  10705. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  10706. // #6828: chrome encodes content in a[href]
  10707. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  10708. /* */
  10709. var idToTemplate = cached(function (id) {
  10710. var el = query(id);
  10711. return el && el.innerHTML
  10712. });
  10713. var mount = Vue.prototype.$mount;
  10714. Vue.prototype.$mount = function (
  10715. el,
  10716. hydrating
  10717. ) {
  10718. el = el && query(el);
  10719. /* istanbul ignore if */
  10720. if (el === document.body || el === document.documentElement) {
  10721. warn(
  10722. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  10723. );
  10724. return this
  10725. }
  10726. var options = this.$options;
  10727. // resolve template/el and convert to render function
  10728. if (!options.render) {
  10729. var template = options.template;
  10730. if (template) {
  10731. if (typeof template === 'string') {
  10732. if (template.charAt(0) === '#') {
  10733. template = idToTemplate(template);
  10734. /* istanbul ignore if */
  10735. if (!template) {
  10736. warn(
  10737. ("Template element not found or is empty: " + (options.template)),
  10738. this
  10739. );
  10740. }
  10741. }
  10742. } else if (template.nodeType) {
  10743. template = template.innerHTML;
  10744. } else {
  10745. {
  10746. warn('invalid template option:' + template, this);
  10747. }
  10748. return this
  10749. }
  10750. } else if (el) {
  10751. template = getOuterHTML(el);
  10752. }
  10753. if (template) {
  10754. /* istanbul ignore if */
  10755. if (config.performance && mark) {
  10756. mark('compile');
  10757. }
  10758. var ref = compileToFunctions(template, {
  10759. outputSourceRange: "development" !== 'production',
  10760. shouldDecodeNewlines: shouldDecodeNewlines,
  10761. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  10762. delimiters: options.delimiters,
  10763. comments: options.comments
  10764. }, this);
  10765. var render = ref.render;
  10766. var staticRenderFns = ref.staticRenderFns;
  10767. options.render = render;
  10768. options.staticRenderFns = staticRenderFns;
  10769. /* istanbul ignore if */
  10770. if (config.performance && mark) {
  10771. mark('compile end');
  10772. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  10773. }
  10774. }
  10775. }
  10776. return mount.call(this, el, hydrating)
  10777. };
  10778. /**
  10779. * Get outerHTML of elements, taking care
  10780. * of SVG elements in IE as well.
  10781. */
  10782. function getOuterHTML (el) {
  10783. if (el.outerHTML) {
  10784. return el.outerHTML
  10785. } else {
  10786. var container = document.createElement('div');
  10787. container.appendChild(el.cloneNode(true));
  10788. return container.innerHTML
  10789. }
  10790. }
  10791. Vue.compile = compileToFunctions;
  10792. module.exports = Vue;