vue.js 403 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400
  1. /*!
  2. * Vue.js v2.6.14
  3. * (c) 2014-2021 Evan You
  4. * Released under the MIT License.
  5. */
  6. (function (global, factory) {
  7. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  8. typeof define === 'function' && define.amd ? define(factory) :
  9. (global = global || self, global.Vue = factory());
  10. }(this, function () {
  11. 'use strict';
  12. /* */
  13. var emptyObject = Object.freeze({});
  14. // These helpers produce better VM code in JS engines due to their
  15. // explicitness and function inlining.
  16. function isUndef(v) {
  17. return v === undefined || v === null
  18. }
  19. function isDef(v) {
  20. return v !== undefined && v !== null
  21. }
  22. function isTrue(v) {
  23. return v === true
  24. }
  25. function isFalse(v) {
  26. return v === false
  27. }
  28. /**
  29. * Check if value is primitive.
  30. */
  31. function isPrimitive(value) {
  32. return (
  33. typeof value === 'string' ||
  34. typeof value === 'number' ||
  35. // $flow-disable-line
  36. typeof value === 'symbol' ||
  37. typeof value === 'boolean'
  38. )
  39. }
  40. /**
  41. * Quick object check - this is primarily used to tell
  42. * Objects from primitive values when we know the value
  43. * is a JSON-compliant type.
  44. */
  45. function isObject(obj) {
  46. return obj !== null && typeof obj === 'object'
  47. }
  48. /**
  49. * Get the raw type string of a value, e.g., [object Object].
  50. */
  51. var _toString = Object.prototype.toString;
  52. function toRawType(value) {
  53. return _toString.call(value).slice(8, -1)
  54. }
  55. /**
  56. * Strict object type check. Only returns true
  57. * for plain JavaScript objects.
  58. */
  59. function isPlainObject(obj) {
  60. return _toString.call(obj) === '[object Object]'
  61. }
  62. function isRegExp(v) {
  63. return _toString.call(v) === '[object RegExp]'
  64. }
  65. /**
  66. * Check if val is a valid array index.
  67. */
  68. function isValidArrayIndex(val) {
  69. var n = parseFloat(String(val));
  70. return n >= 0 && Math.floor(n) === n && isFinite(val)
  71. }
  72. function isPromise(val) {
  73. return (
  74. isDef(val) &&
  75. typeof val.then === 'function' &&
  76. typeof val.catch === 'function'
  77. )
  78. }
  79. /**
  80. * Convert a value to a string that is actually rendered.
  81. */
  82. function toString(val) {
  83. return val == null ?
  84. '' :
  85. Array.isArray(val) || (isPlainObject(val) && val.toString === _toString) ?
  86. JSON.stringify(val, null, 2) :
  87. String(val)
  88. }
  89. /**
  90. * Convert an input value to a number for persistence.
  91. * If the conversion fails, return original string.
  92. */
  93. function toNumber(val) {
  94. var n = parseFloat(val);
  95. return isNaN(n) ? val : n
  96. }
  97. /**
  98. * Make a map and return a function for checking if a key
  99. * is in that map.
  100. */
  101. function makeMap(
  102. str,
  103. expectsLowerCase
  104. ) {
  105. var map = Object.create(null);
  106. var list = str.split(',');
  107. for (var i = 0; i < list.length; i++) {
  108. map[list[i]] = true;
  109. }
  110. return expectsLowerCase ?
  111. function (val) {
  112. return map[val.toLowerCase()];
  113. } :
  114. function (val) {
  115. return map[val];
  116. }
  117. }
  118. /**
  119. * Check if a tag is a built-in tag.
  120. */
  121. var isBuiltInTag = makeMap('slot,component', true);
  122. /**
  123. * Check if an attribute is a reserved attribute.
  124. */
  125. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  126. /**
  127. * Remove an item from an array.
  128. */
  129. function remove(arr, item) {
  130. if (arr.length) {
  131. var index = arr.indexOf(item);
  132. if (index > -1) {
  133. return arr.splice(index, 1)
  134. }
  135. }
  136. }
  137. /**
  138. * Check whether an object has the property.
  139. */
  140. var hasOwnProperty = Object.prototype.hasOwnProperty;
  141. function hasOwn(obj, key) {
  142. return hasOwnProperty.call(obj, key)
  143. }
  144. /**
  145. * Create a cached version of a pure function.
  146. */
  147. function cached(fn) {
  148. var cache = Object.create(null);
  149. return (function cachedFn(str) {
  150. var hit = cache[str];
  151. return hit || (cache[str] = fn(str))
  152. })
  153. }
  154. /**
  155. * Camelize a hyphen-delimited string.
  156. */
  157. var camelizeRE = /-(\w)/g;
  158. var camelize = cached(function (str) {
  159. return str.replace(camelizeRE, function (_, c) {
  160. return c ? c.toUpperCase() : '';
  161. })
  162. });
  163. /**
  164. * Capitalize a string.
  165. */
  166. var capitalize = cached(function (str) {
  167. return str.charAt(0).toUpperCase() + str.slice(1)
  168. });
  169. /**
  170. * Hyphenate a camelCase string.
  171. */
  172. var hyphenateRE = /\B([A-Z])/g;
  173. var hyphenate = cached(function (str) {
  174. return str.replace(hyphenateRE, '-$1').toLowerCase()
  175. });
  176. /**
  177. * Simple bind polyfill for environments that do not support it,
  178. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  179. * since native bind is now performant enough in most browsers.
  180. * But removing it would mean breaking code that was able to run in
  181. * PhantomJS 1.x, so this must be kept for backward compatibility.
  182. */
  183. /* istanbul ignore next */
  184. function polyfillBind(fn, ctx) {
  185. function boundFn(a) {
  186. var l = arguments.length;
  187. return l ?
  188. l > 1 ?
  189. fn.apply(ctx, arguments) :
  190. fn.call(ctx, a) :
  191. fn.call(ctx)
  192. }
  193. boundFn._length = fn.length;
  194. return boundFn
  195. }
  196. function nativeBind(fn, ctx) {
  197. return fn.bind(ctx)
  198. }
  199. var bind = Function.prototype.bind ?
  200. nativeBind :
  201. polyfillBind;
  202. /**
  203. * Convert an Array-like object to a real Array.
  204. */
  205. function toArray(list, start) {
  206. start = start || 0;
  207. var i = list.length - start;
  208. var ret = new Array(i);
  209. while (i--) {
  210. ret[i] = list[i + start];
  211. }
  212. return ret
  213. }
  214. /**
  215. * Mix properties into target object.
  216. */
  217. function extend(to, _from) {
  218. for (var key in _from) {
  219. to[key] = _from[key];
  220. }
  221. return to
  222. }
  223. /**
  224. * Merge an Array of Objects into a single Object.
  225. */
  226. function toObject(arr) {
  227. var res = {};
  228. for (var i = 0; i < arr.length; i++) {
  229. if (arr[i]) {
  230. extend(res, arr[i]);
  231. }
  232. }
  233. return res
  234. }
  235. /* eslint-disable no-unused-vars */
  236. /**
  237. * Perform no operation.
  238. * Stubbing args to make Flow happy without leaving useless transpiled code
  239. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  240. */
  241. function noop(a, b, c) {}
  242. /**
  243. * Always return false.
  244. */
  245. var no = function (a, b, c) {
  246. return false;
  247. };
  248. /* eslint-enable no-unused-vars */
  249. /**
  250. * Return the same value.
  251. */
  252. var identity = function (_) {
  253. return _;
  254. };
  255. /**
  256. * Generate a string containing static keys from compiler modules.
  257. */
  258. function genStaticKeys(modules) {
  259. return modules.reduce(function (keys, m) {
  260. return keys.concat(m.staticKeys || [])
  261. }, []).join(',')
  262. }
  263. /**
  264. * Check if two values are loosely equal - that is,
  265. * if they are plain objects, do they have the same shape?
  266. */
  267. function looseEqual(a, b) {
  268. if (a === b) {
  269. return true
  270. }
  271. var isObjectA = isObject(a);
  272. var isObjectB = isObject(b);
  273. if (isObjectA && isObjectB) {
  274. try {
  275. var isArrayA = Array.isArray(a);
  276. var isArrayB = Array.isArray(b);
  277. if (isArrayA && isArrayB) {
  278. return a.length === b.length && a.every(function (e, i) {
  279. return looseEqual(e, b[i])
  280. })
  281. } else if (a instanceof Date && b instanceof Date) {
  282. return a.getTime() === b.getTime()
  283. } else if (!isArrayA && !isArrayB) {
  284. var keysA = Object.keys(a);
  285. var keysB = Object.keys(b);
  286. return keysA.length === keysB.length && keysA.every(function (key) {
  287. return looseEqual(a[key], b[key])
  288. })
  289. } else {
  290. /* istanbul ignore next */
  291. return false
  292. }
  293. } catch (e) {
  294. /* istanbul ignore next */
  295. return false
  296. }
  297. } else if (!isObjectA && !isObjectB) {
  298. return String(a) === String(b)
  299. } else {
  300. return false
  301. }
  302. }
  303. /**
  304. * Return the first index at which a loosely equal value can be
  305. * found in the array (if value is a plain object, the array must
  306. * contain an object of the same shape), or -1 if it is not present.
  307. */
  308. function looseIndexOf(arr, val) {
  309. for (var i = 0; i < arr.length; i++) {
  310. if (looseEqual(arr[i], val)) {
  311. return i
  312. }
  313. }
  314. return -1
  315. }
  316. /**
  317. * Ensure a function is called only once.
  318. */
  319. function once(fn) {
  320. var called = false;
  321. return function () {
  322. if (!called) {
  323. called = true;
  324. fn.apply(this, arguments);
  325. }
  326. }
  327. }
  328. var SSR_ATTR = 'data-server-rendered';
  329. var ASSET_TYPES = [
  330. 'component',
  331. 'directive',
  332. 'filter'
  333. ];
  334. var LIFECYCLE_HOOKS = [
  335. 'beforeCreate',
  336. 'created',
  337. 'beforeMount',
  338. 'mounted',
  339. 'beforeUpdate',
  340. 'updated',
  341. 'beforeDestroy',
  342. 'destroyed',
  343. 'activated',
  344. 'deactivated',
  345. 'errorCaptured',
  346. 'serverPrefetch'
  347. ];
  348. /* */
  349. var config = ({
  350. /**
  351. * Option merge strategies (used in core/util/options)
  352. */
  353. // $flow-disable-line
  354. optionMergeStrategies: Object.create(null),
  355. /**
  356. * Whether to suppress warnings.
  357. */
  358. silent: false,
  359. /**
  360. * Show production mode tip message on boot?
  361. */
  362. productionTip: "development" !== 'production',
  363. /**
  364. * Whether to enable devtools
  365. */
  366. devtools: "development" !== 'production',
  367. /**
  368. * Whether to record perf
  369. */
  370. performance: false,
  371. /**
  372. * Error handler for watcher errors
  373. */
  374. errorHandler: null,
  375. /**
  376. * Warn handler for watcher warns
  377. */
  378. warnHandler: null,
  379. /**
  380. * Ignore certain custom elements
  381. */
  382. ignoredElements: [],
  383. /**
  384. * Custom user key aliases for v-on
  385. */
  386. // $flow-disable-line
  387. keyCodes: Object.create(null),
  388. /**
  389. * Check if a tag is reserved so that it cannot be registered as a
  390. * component. This is platform-dependent and may be overwritten.
  391. */
  392. isReservedTag: no,
  393. /**
  394. * Check if an attribute is reserved so that it cannot be used as a component
  395. * prop. This is platform-dependent and may be overwritten.
  396. */
  397. isReservedAttr: no,
  398. /**
  399. * Check if a tag is an unknown element.
  400. * Platform-dependent.
  401. */
  402. isUnknownElement: no,
  403. /**
  404. * Get the namespace of an element
  405. */
  406. getTagNamespace: noop,
  407. /**
  408. * Parse the real tag name for the specific platform.
  409. */
  410. parsePlatformTagName: identity,
  411. /**
  412. * Check if an attribute must be bound using property, e.g. value
  413. * Platform-dependent.
  414. */
  415. mustUseProp: no,
  416. /**
  417. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  418. * This will significantly reduce performance if set to false.
  419. */
  420. async: true,
  421. /**
  422. * Exposed for legacy reasons
  423. */
  424. _lifecycleHooks: LIFECYCLE_HOOKS
  425. });
  426. /* */
  427. /**
  428. * unicode letters used for parsing html tags, component names and property paths.
  429. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  430. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  431. */
  432. 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/;
  433. /**
  434. * Check if a string starts with $ or _
  435. */
  436. function isReserved(str) {
  437. var c = (str + '').charCodeAt(0);
  438. return c === 0x24 || c === 0x5F
  439. }
  440. /**
  441. * Define a property.
  442. */
  443. function def(obj, key, val, enumerable) {
  444. Object.defineProperty(obj, key, {
  445. value: val,
  446. enumerable: !!enumerable,
  447. writable: true,
  448. configurable: true
  449. });
  450. }
  451. /**
  452. * Parse simple path.
  453. */
  454. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  455. function parsePath(path) {
  456. if (bailRE.test(path)) {
  457. return
  458. }
  459. var segments = path.split('.');
  460. return function (obj) {
  461. for (var i = 0; i < segments.length; i++) {
  462. if (!obj) {
  463. return
  464. }
  465. obj = obj[segments[i]];
  466. }
  467. return obj
  468. }
  469. }
  470. /* */
  471. // can we use __proto__?
  472. var hasProto = '__proto__' in {};
  473. // Browser environment sniffing
  474. var inBrowser = typeof window !== 'undefined';
  475. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  476. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  477. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  478. var isIE = UA && /msie|trident/.test(UA);
  479. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  480. var isEdge = UA && UA.indexOf('edge/') > 0;
  481. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  482. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  483. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  484. var isPhantomJS = UA && /phantomjs/.test(UA);
  485. var isFF = UA && UA.match(/firefox\/(\d+)/);
  486. // Firefox has a "watch" function on Object.prototype...
  487. var nativeWatch = ({}).watch;
  488. var supportsPassive = false;
  489. if (inBrowser) {
  490. try {
  491. var opts = {};
  492. Object.defineProperty(opts, 'passive', ({
  493. get: function get() {
  494. /* istanbul ignore next */
  495. supportsPassive = true;
  496. }
  497. })); // https://github.com/facebook/flow/issues/285
  498. window.addEventListener('test-passive', null, opts);
  499. } catch (e) {}
  500. }
  501. // this needs to be lazy-evaled because vue may be required before
  502. // vue-server-renderer can set VUE_ENV
  503. var _isServer;
  504. var isServerRendering = function () {
  505. if (_isServer === undefined) {
  506. /* istanbul ignore if */
  507. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  508. // detect presence of vue-server-renderer and avoid
  509. // Webpack shimming the process
  510. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  511. } else {
  512. _isServer = false;
  513. }
  514. }
  515. return _isServer
  516. };
  517. // detect devtools
  518. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  519. /* istanbul ignore next */
  520. function isNative(Ctor) {
  521. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  522. }
  523. var hasSymbol =
  524. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  525. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  526. var _Set;
  527. /* istanbul ignore if */ // $flow-disable-line
  528. if (typeof Set !== 'undefined' && isNative(Set)) {
  529. // use native Set when available.
  530. _Set = Set;
  531. } else {
  532. // a non-standard Set polyfill that only works with primitive keys.
  533. _Set = /*@__PURE__*/ (function () {
  534. function Set() {
  535. this.set = Object.create(null);
  536. }
  537. Set.prototype.has = function has(key) {
  538. return this.set[key] === true
  539. };
  540. Set.prototype.add = function add(key) {
  541. this.set[key] = true;
  542. };
  543. Set.prototype.clear = function clear() {
  544. this.set = Object.create(null);
  545. };
  546. return Set;
  547. }());
  548. }
  549. /* */
  550. var warn = noop;
  551. var tip = noop;
  552. var generateComponentTrace = (noop); // work around flow check
  553. var formatComponentName = (noop);
  554. {
  555. var hasConsole = typeof console !== 'undefined';
  556. var classifyRE = /(?:^|[-_])(\w)/g;
  557. var classify = function (str) {
  558. return str
  559. .replace(classifyRE, function (c) {
  560. return c.toUpperCase();
  561. })
  562. .replace(/[-_]/g, '');
  563. };
  564. warn = function (msg, vm) {
  565. var trace = vm ? generateComponentTrace(vm) : '';
  566. if (config.warnHandler) {
  567. config.warnHandler.call(null, msg, vm, trace);
  568. } else if (hasConsole && (!config.silent)) {
  569. console.error(("[Vue warn]: " + msg + trace));
  570. }
  571. };
  572. tip = function (msg, vm) {
  573. if (hasConsole && (!config.silent)) {
  574. console.warn("[Vue tip]: " + msg + (
  575. vm ? generateComponentTrace(vm) : ''
  576. ));
  577. }
  578. };
  579. formatComponentName = function (vm, includeFile) {
  580. if (vm.$root === vm) {
  581. return '<Root>'
  582. }
  583. var options = typeof vm === 'function' && vm.cid != null ?
  584. vm.options :
  585. vm._isVue ?
  586. vm.$options || vm.constructor.options :
  587. vm;
  588. var name = options.name || options._componentTag;
  589. var file = options.__file;
  590. if (!name && file) {
  591. var match = file.match(/([^/\\]+)\.vue$/);
  592. name = match && match[1];
  593. }
  594. return (
  595. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  596. (file && includeFile !== false ? (" at " + file) : '')
  597. )
  598. };
  599. var repeat = function (str, n) {
  600. var res = '';
  601. while (n) {
  602. if (n % 2 === 1) {
  603. res += str;
  604. }
  605. if (n > 1) {
  606. str += str;
  607. }
  608. n >>= 1;
  609. }
  610. return res
  611. };
  612. generateComponentTrace = function (vm) {
  613. if (vm._isVue && vm.$parent) {
  614. var tree = [];
  615. var currentRecursiveSequence = 0;
  616. while (vm) {
  617. if (tree.length > 0) {
  618. var last = tree[tree.length - 1];
  619. if (last.constructor === vm.constructor) {
  620. currentRecursiveSequence++;
  621. vm = vm.$parent;
  622. continue
  623. } else if (currentRecursiveSequence > 0) {
  624. tree[tree.length - 1] = [last, currentRecursiveSequence];
  625. currentRecursiveSequence = 0;
  626. }
  627. }
  628. tree.push(vm);
  629. vm = vm.$parent;
  630. }
  631. return '\n\nfound in\n\n' + tree
  632. .map(function (vm, i) {
  633. return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm) ?
  634. ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)") :
  635. formatComponentName(vm)));
  636. })
  637. .join('\n')
  638. } else {
  639. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  640. }
  641. };
  642. }
  643. /* */
  644. var uid = 0;
  645. /**
  646. * A dep is an observable that can have multiple
  647. * directives subscribing to it.
  648. */
  649. var Dep = function Dep() {
  650. this.id = uid++;
  651. this.subs = [];
  652. };
  653. Dep.prototype.addSub = function addSub(sub) {
  654. this.subs.push(sub);
  655. };
  656. Dep.prototype.removeSub = function removeSub(sub) {
  657. remove(this.subs, sub);
  658. };
  659. Dep.prototype.depend = function depend() {
  660. if (Dep.target) {
  661. Dep.target.addDep(this);
  662. }
  663. };
  664. Dep.prototype.notify = function notify() {
  665. // stabilize the subscriber list first
  666. var subs = this.subs.slice();
  667. if (!config.async) {
  668. // subs aren't sorted in scheduler if not running async
  669. // we need to sort them now to make sure they fire in correct
  670. // order
  671. subs.sort(function (a, b) {
  672. return a.id - b.id;
  673. });
  674. }
  675. for (var i = 0, l = subs.length; i < l; i++) {
  676. subs[i].update();
  677. }
  678. };
  679. // The current target watcher being evaluated.
  680. // This is globally unique because only one watcher
  681. // can be evaluated at a time.
  682. Dep.target = null;
  683. var targetStack = [];
  684. function pushTarget(target) {
  685. targetStack.push(target);
  686. Dep.target = target;
  687. }
  688. function popTarget() {
  689. targetStack.pop();
  690. Dep.target = targetStack[targetStack.length - 1];
  691. }
  692. /* */
  693. var VNode = function VNode(
  694. tag,
  695. data,
  696. children,
  697. text,
  698. elm,
  699. context,
  700. componentOptions,
  701. asyncFactory
  702. ) {
  703. this.tag = tag;
  704. this.data = data;
  705. this.children = children;
  706. this.text = text;
  707. this.elm = elm;
  708. this.ns = undefined;
  709. this.context = context;
  710. this.fnContext = undefined;
  711. this.fnOptions = undefined;
  712. this.fnScopeId = undefined;
  713. this.key = data && data.key;
  714. this.componentOptions = componentOptions;
  715. this.componentInstance = undefined;
  716. this.parent = undefined;
  717. this.raw = false;
  718. this.isStatic = false;
  719. this.isRootInsert = true;
  720. this.isComment = false;
  721. this.isCloned = false;
  722. this.isOnce = false;
  723. this.asyncFactory = asyncFactory;
  724. this.asyncMeta = undefined;
  725. this.isAsyncPlaceholder = false;
  726. };
  727. var prototypeAccessors = {
  728. child: {
  729. configurable: true
  730. }
  731. };
  732. // DEPRECATED: alias for componentInstance for backwards compat.
  733. /* istanbul ignore next */
  734. prototypeAccessors.child.get = function () {
  735. return this.componentInstance
  736. };
  737. Object.defineProperties(VNode.prototype, prototypeAccessors);
  738. var createEmptyVNode = function (text) {
  739. if (text === void 0) text = '';
  740. var node = new VNode();
  741. node.text = text;
  742. node.isComment = true;
  743. return node
  744. };
  745. function createTextVNode(val) {
  746. return new VNode(undefined, undefined, undefined, String(val))
  747. }
  748. // optimized shallow clone
  749. // used for static nodes and slot nodes because they may be reused across
  750. // multiple renders, cloning them avoids errors when DOM manipulations rely
  751. // on their elm reference.
  752. function cloneVNode(vnode) {
  753. var cloned = new VNode(
  754. vnode.tag,
  755. vnode.data,
  756. // #7975
  757. // clone children array to avoid mutating original in case of cloning
  758. // a child.
  759. vnode.children && vnode.children.slice(),
  760. vnode.text,
  761. vnode.elm,
  762. vnode.context,
  763. vnode.componentOptions,
  764. vnode.asyncFactory
  765. );
  766. cloned.ns = vnode.ns;
  767. cloned.isStatic = vnode.isStatic;
  768. cloned.key = vnode.key;
  769. cloned.isComment = vnode.isComment;
  770. cloned.fnContext = vnode.fnContext;
  771. cloned.fnOptions = vnode.fnOptions;
  772. cloned.fnScopeId = vnode.fnScopeId;
  773. cloned.asyncMeta = vnode.asyncMeta;
  774. cloned.isCloned = true;
  775. return cloned
  776. }
  777. /*
  778. * not type checking this file because flow doesn't play well with
  779. * dynamically accessing methods on Array prototype
  780. */
  781. var arrayProto = Array.prototype;
  782. var arrayMethods = Object.create(arrayProto);
  783. var methodsToPatch = [
  784. 'push',
  785. 'pop',
  786. 'shift',
  787. 'unshift',
  788. 'splice',
  789. 'sort',
  790. 'reverse'
  791. ];
  792. /**
  793. * Intercept mutating methods and emit events
  794. */
  795. methodsToPatch.forEach(function (method) {
  796. // cache original method
  797. var original = arrayProto[method];
  798. def(arrayMethods, method, function mutator() {
  799. var args = [],
  800. len = arguments.length;
  801. while (len--) args[len] = arguments[len];
  802. var result = original.apply(this, args);
  803. var ob = this.__ob__;
  804. var inserted;
  805. switch (method) {
  806. case 'push':
  807. case 'unshift':
  808. inserted = args;
  809. break
  810. case 'splice':
  811. inserted = args.slice(2);
  812. break
  813. }
  814. if (inserted) {
  815. ob.observeArray(inserted);
  816. }
  817. // notify change
  818. ob.dep.notify();
  819. return result
  820. });
  821. });
  822. /* */
  823. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  824. /**
  825. * In some cases we may want to disable observation inside a component's
  826. * update computation.
  827. */
  828. var shouldObserve = true;
  829. function toggleObserving(value) {
  830. shouldObserve = value;
  831. }
  832. /**
  833. * Observer class that is attached to each observed
  834. * object. Once attached, the observer converts the target
  835. * object's property keys into getter/setters that
  836. * collect dependencies and dispatch updates.
  837. */
  838. var Observer = function Observer(value) {
  839. this.value = value;
  840. this.dep = new Dep();
  841. this.vmCount = 0;
  842. def(value, '__ob__', this);
  843. if (Array.isArray(value)) {
  844. if (hasProto) {
  845. protoAugment(value, arrayMethods);
  846. } else {
  847. copyAugment(value, arrayMethods, arrayKeys);
  848. }
  849. this.observeArray(value);
  850. } else {
  851. this.walk(value);
  852. }
  853. };
  854. /**
  855. * Walk through all properties and convert them into
  856. * getter/setters. This method should only be called when
  857. * value type is Object.
  858. */
  859. Observer.prototype.walk = function walk(obj) {
  860. var keys = Object.keys(obj);
  861. for (var i = 0; i < keys.length; i++) {
  862. defineReactive$$1(obj, keys[i]);
  863. }
  864. };
  865. /**
  866. * Observe a list of Array items.
  867. */
  868. Observer.prototype.observeArray = function observeArray(items) {
  869. for (var i = 0, l = items.length; i < l; i++) {
  870. observe(items[i]);
  871. }
  872. };
  873. // helpers
  874. /**
  875. * Augment a target Object or Array by intercepting
  876. * the prototype chain using __proto__
  877. */
  878. function protoAugment(target, src) {
  879. /* eslint-disable no-proto */
  880. target.__proto__ = src;
  881. /* eslint-enable no-proto */
  882. }
  883. /**
  884. * Augment a target Object or Array by defining
  885. * hidden properties.
  886. */
  887. /* istanbul ignore next */
  888. function copyAugment(target, src, keys) {
  889. for (var i = 0, l = keys.length; i < l; i++) {
  890. var key = keys[i];
  891. def(target, key, src[key]);
  892. }
  893. }
  894. /**
  895. * Attempt to create an observer instance for a value,
  896. * returns the new observer if successfully observed,
  897. * or the existing observer if the value already has one.
  898. */
  899. function observe(value, asRootData) {
  900. if (!isObject(value) || value instanceof VNode) {
  901. return
  902. }
  903. var ob;
  904. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  905. ob = value.__ob__;
  906. } else if (
  907. shouldObserve &&
  908. !isServerRendering() &&
  909. (Array.isArray(value) || isPlainObject(value)) &&
  910. Object.isExtensible(value) &&
  911. !value._isVue
  912. ) {
  913. ob = new Observer(value);
  914. }
  915. if (asRootData && ob) {
  916. ob.vmCount++;
  917. }
  918. return ob
  919. }
  920. /**
  921. * Define a reactive property on an Object.
  922. */
  923. function defineReactive$$1(
  924. obj,
  925. key,
  926. val,
  927. customSetter,
  928. shallow
  929. ) {
  930. var dep = new Dep();
  931. var property = Object.getOwnPropertyDescriptor(obj, key);
  932. if (property && property.configurable === false) {
  933. return
  934. }
  935. // cater for pre-defined getter/setters
  936. var getter = property && property.get;
  937. var setter = property && property.set;
  938. if ((!getter || setter) && arguments.length === 2) {
  939. val = obj[key];
  940. }
  941. var childOb = !shallow && observe(val);
  942. Object.defineProperty(obj, key, {
  943. enumerable: true,
  944. configurable: true,
  945. get: function reactiveGetter() {
  946. var value = getter ? getter.call(obj) : val;
  947. if (Dep.target) {
  948. dep.depend();
  949. if (childOb) {
  950. childOb.dep.depend();
  951. if (Array.isArray(value)) {
  952. dependArray(value);
  953. }
  954. }
  955. }
  956. return value
  957. },
  958. set: function reactiveSetter(newVal) {
  959. var value = getter ? getter.call(obj) : val;
  960. /* eslint-disable no-self-compare */
  961. if (newVal === value || (newVal !== newVal && value !== value)) {
  962. return
  963. }
  964. /* eslint-enable no-self-compare */
  965. if (customSetter) {
  966. customSetter();
  967. }
  968. // #7981: for accessor properties without setter
  969. if (getter && !setter) {
  970. return
  971. }
  972. if (setter) {
  973. setter.call(obj, newVal);
  974. } else {
  975. val = newVal;
  976. }
  977. childOb = !shallow && observe(newVal);
  978. dep.notify();
  979. }
  980. });
  981. }
  982. /**
  983. * Set a property on an object. Adds the new property and
  984. * triggers change notification if the property doesn't
  985. * already exist.
  986. */
  987. function set(target, key, val) {
  988. if (isUndef(target) || isPrimitive(target)) {
  989. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  990. }
  991. if (Array.isArray(target) && isValidArrayIndex(key)) {
  992. target.length = Math.max(target.length, key);
  993. target.splice(key, 1, val);
  994. return val
  995. }
  996. if (key in target && !(key in Object.prototype)) {
  997. target[key] = val;
  998. return val
  999. }
  1000. var ob = (target).__ob__;
  1001. if (target._isVue || (ob && ob.vmCount)) {
  1002. warn(
  1003. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  1004. 'at runtime - declare it upfront in the data option.'
  1005. );
  1006. return val
  1007. }
  1008. if (!ob) {
  1009. target[key] = val;
  1010. return val
  1011. }
  1012. defineReactive$$1(ob.value, key, val);
  1013. ob.dep.notify();
  1014. return val
  1015. }
  1016. /**
  1017. * Delete a property and trigger change if necessary.
  1018. */
  1019. function del(target, key) {
  1020. if (isUndef(target) || isPrimitive(target)) {
  1021. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  1022. }
  1023. if (Array.isArray(target) && isValidArrayIndex(key)) {
  1024. target.splice(key, 1);
  1025. return
  1026. }
  1027. var ob = (target).__ob__;
  1028. if (target._isVue || (ob && ob.vmCount)) {
  1029. warn(
  1030. 'Avoid deleting properties on a Vue instance or its root $data ' +
  1031. '- just set it to null.'
  1032. );
  1033. return
  1034. }
  1035. if (!hasOwn(target, key)) {
  1036. return
  1037. }
  1038. delete target[key];
  1039. if (!ob) {
  1040. return
  1041. }
  1042. ob.dep.notify();
  1043. }
  1044. /**
  1045. * Collect dependencies on array elements when the array is touched, since
  1046. * we cannot intercept array element access like property getters.
  1047. */
  1048. function dependArray(value) {
  1049. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  1050. e = value[i];
  1051. e && e.__ob__ && e.__ob__.dep.depend();
  1052. if (Array.isArray(e)) {
  1053. dependArray(e);
  1054. }
  1055. }
  1056. }
  1057. /* */
  1058. /**
  1059. * Option overwriting strategies are functions that handle
  1060. * how to merge a parent option value and a child option
  1061. * value into the final value.
  1062. */
  1063. var strats = config.optionMergeStrategies;
  1064. /**
  1065. * Options with restrictions
  1066. */
  1067. {
  1068. strats.el = strats.propsData = function (parent, child, vm, key) {
  1069. if (!vm) {
  1070. warn(
  1071. "option \"" + key + "\" can only be used during instance " +
  1072. 'creation with the `new` keyword.'
  1073. );
  1074. }
  1075. return defaultStrat(parent, child)
  1076. };
  1077. }
  1078. /**
  1079. * Helper that recursively merges two data objects together.
  1080. */
  1081. function mergeData(to, from) {
  1082. if (!from) {
  1083. return to
  1084. }
  1085. var key, toVal, fromVal;
  1086. var keys = hasSymbol ?
  1087. Reflect.ownKeys(from) :
  1088. Object.keys(from);
  1089. for (var i = 0; i < keys.length; i++) {
  1090. key = keys[i];
  1091. // in case the object is already observed...
  1092. if (key === '__ob__') {
  1093. continue
  1094. }
  1095. toVal = to[key];
  1096. fromVal = from[key];
  1097. if (!hasOwn(to, key)) {
  1098. set(to, key, fromVal);
  1099. } else if (
  1100. toVal !== fromVal &&
  1101. isPlainObject(toVal) &&
  1102. isPlainObject(fromVal)
  1103. ) {
  1104. mergeData(toVal, fromVal);
  1105. }
  1106. }
  1107. return to
  1108. }
  1109. /**
  1110. * Data
  1111. */
  1112. function mergeDataOrFn(
  1113. parentVal,
  1114. childVal,
  1115. vm
  1116. ) {
  1117. if (!vm) {
  1118. // in a Vue.extend merge, both should be functions
  1119. if (!childVal) {
  1120. return parentVal
  1121. }
  1122. if (!parentVal) {
  1123. return childVal
  1124. }
  1125. // when parentVal & childVal are both present,
  1126. // we need to return a function that returns the
  1127. // merged result of both functions... no need to
  1128. // check if parentVal is a function here because
  1129. // it has to be a function to pass previous merges.
  1130. return function mergedDataFn() {
  1131. return mergeData(
  1132. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  1133. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  1134. )
  1135. }
  1136. } else {
  1137. return function mergedInstanceDataFn() {
  1138. // instance merge
  1139. var instanceData = typeof childVal === 'function' ?
  1140. childVal.call(vm, vm) :
  1141. childVal;
  1142. var defaultData = typeof parentVal === 'function' ?
  1143. parentVal.call(vm, vm) :
  1144. parentVal;
  1145. if (instanceData) {
  1146. return mergeData(instanceData, defaultData)
  1147. } else {
  1148. return defaultData
  1149. }
  1150. }
  1151. }
  1152. }
  1153. strats.data = function (
  1154. parentVal,
  1155. childVal,
  1156. vm
  1157. ) {
  1158. if (!vm) {
  1159. if (childVal && typeof childVal !== 'function') {
  1160. warn(
  1161. 'The "data" option should be a function ' +
  1162. 'that returns a per-instance value in component ' +
  1163. 'definitions.',
  1164. vm
  1165. );
  1166. return parentVal
  1167. }
  1168. return mergeDataOrFn(parentVal, childVal)
  1169. }
  1170. return mergeDataOrFn(parentVal, childVal, vm)
  1171. };
  1172. /**
  1173. * Hooks and props are merged as arrays.
  1174. */
  1175. function mergeHook(
  1176. parentVal,
  1177. childVal
  1178. ) {
  1179. var res = childVal ?
  1180. parentVal ?
  1181. parentVal.concat(childVal) :
  1182. Array.isArray(childVal) ?
  1183. childVal :
  1184. [childVal] :
  1185. parentVal;
  1186. return res ?
  1187. dedupeHooks(res) :
  1188. res
  1189. }
  1190. function dedupeHooks(hooks) {
  1191. var res = [];
  1192. for (var i = 0; i < hooks.length; i++) {
  1193. if (res.indexOf(hooks[i]) === -1) {
  1194. res.push(hooks[i]);
  1195. }
  1196. }
  1197. return res
  1198. }
  1199. LIFECYCLE_HOOKS.forEach(function (hook) {
  1200. strats[hook] = mergeHook;
  1201. });
  1202. /**
  1203. * Assets
  1204. *
  1205. * When a vm is present (instance creation), we need to do
  1206. * a three-way merge between constructor options, instance
  1207. * options and parent options.
  1208. */
  1209. function mergeAssets(
  1210. parentVal,
  1211. childVal,
  1212. vm,
  1213. key
  1214. ) {
  1215. var res = Object.create(parentVal || null);
  1216. if (childVal) {
  1217. assertObjectType(key, childVal, vm);
  1218. return extend(res, childVal)
  1219. } else {
  1220. return res
  1221. }
  1222. }
  1223. ASSET_TYPES.forEach(function (type) {
  1224. strats[type + 's'] = mergeAssets;
  1225. });
  1226. /**
  1227. * Watchers.
  1228. *
  1229. * Watchers hashes should not overwrite one
  1230. * another, so we merge them as arrays.
  1231. */
  1232. strats.watch = function (
  1233. parentVal,
  1234. childVal,
  1235. vm,
  1236. key
  1237. ) {
  1238. // work around Firefox's Object.prototype.watch...
  1239. if (parentVal === nativeWatch) {
  1240. parentVal = undefined;
  1241. }
  1242. if (childVal === nativeWatch) {
  1243. childVal = undefined;
  1244. }
  1245. /* istanbul ignore if */
  1246. if (!childVal) {
  1247. return Object.create(parentVal || null)
  1248. } {
  1249. assertObjectType(key, childVal, vm);
  1250. }
  1251. if (!parentVal) {
  1252. return childVal
  1253. }
  1254. var ret = {};
  1255. extend(ret, parentVal);
  1256. for (var key$1 in childVal) {
  1257. var parent = ret[key$1];
  1258. var child = childVal[key$1];
  1259. if (parent && !Array.isArray(parent)) {
  1260. parent = [parent];
  1261. }
  1262. ret[key$1] = parent ?
  1263. parent.concat(child) :
  1264. Array.isArray(child) ? child : [child];
  1265. }
  1266. return ret
  1267. };
  1268. /**
  1269. * Other object hashes.
  1270. */
  1271. strats.props =
  1272. strats.methods =
  1273. strats.inject =
  1274. strats.computed = function (
  1275. parentVal,
  1276. childVal,
  1277. vm,
  1278. key
  1279. ) {
  1280. if (childVal && "development" !== 'production') {
  1281. assertObjectType(key, childVal, vm);
  1282. }
  1283. if (!parentVal) {
  1284. return childVal
  1285. }
  1286. var ret = Object.create(null);
  1287. extend(ret, parentVal);
  1288. if (childVal) {
  1289. extend(ret, childVal);
  1290. }
  1291. return ret
  1292. };
  1293. strats.provide = mergeDataOrFn;
  1294. /**
  1295. * Default strategy.
  1296. */
  1297. var defaultStrat = function (parentVal, childVal) {
  1298. return childVal === undefined ?
  1299. parentVal :
  1300. childVal
  1301. };
  1302. /**
  1303. * Validate component names
  1304. */
  1305. function checkComponents(options) {
  1306. for (var key in options.components) {
  1307. validateComponentName(key);
  1308. }
  1309. }
  1310. function validateComponentName(name) {
  1311. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  1312. warn(
  1313. 'Invalid component name: "' + name + '". Component names ' +
  1314. 'should conform to valid custom element name in html5 specification.'
  1315. );
  1316. }
  1317. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  1318. warn(
  1319. 'Do not use built-in or reserved HTML elements as component ' +
  1320. 'id: ' + name
  1321. );
  1322. }
  1323. }
  1324. /**
  1325. * Ensure all props option syntax are normalized into the
  1326. * Object-based format.
  1327. */
  1328. function normalizeProps(options, vm) {
  1329. var props = options.props;
  1330. if (!props) {
  1331. return
  1332. }
  1333. var res = {};
  1334. var i, val, name;
  1335. if (Array.isArray(props)) {
  1336. i = props.length;
  1337. while (i--) {
  1338. val = props[i];
  1339. if (typeof val === 'string') {
  1340. name = camelize(val);
  1341. res[name] = {
  1342. type: null
  1343. };
  1344. } else {
  1345. warn('props must be strings when using array syntax.');
  1346. }
  1347. }
  1348. } else if (isPlainObject(props)) {
  1349. for (var key in props) {
  1350. val = props[key];
  1351. name = camelize(key);
  1352. res[name] = isPlainObject(val) ?
  1353. val :
  1354. {
  1355. type: val
  1356. };
  1357. }
  1358. } else {
  1359. warn(
  1360. "Invalid value for option \"props\": expected an Array or an Object, " +
  1361. "but got " + (toRawType(props)) + ".",
  1362. vm
  1363. );
  1364. }
  1365. options.props = res;
  1366. }
  1367. /**
  1368. * Normalize all injections into Object-based format
  1369. */
  1370. function normalizeInject(options, vm) {
  1371. var inject = options.inject;
  1372. if (!inject) {
  1373. return
  1374. }
  1375. var normalized = options.inject = {};
  1376. if (Array.isArray(inject)) {
  1377. for (var i = 0; i < inject.length; i++) {
  1378. normalized[inject[i]] = {
  1379. from: inject[i]
  1380. };
  1381. }
  1382. } else if (isPlainObject(inject)) {
  1383. for (var key in inject) {
  1384. var val = inject[key];
  1385. normalized[key] = isPlainObject(val) ?
  1386. extend({
  1387. from: key
  1388. }, val) :
  1389. {
  1390. from: val
  1391. };
  1392. }
  1393. } else {
  1394. warn(
  1395. "Invalid value for option \"inject\": expected an Array or an Object, " +
  1396. "but got " + (toRawType(inject)) + ".",
  1397. vm
  1398. );
  1399. }
  1400. }
  1401. /**
  1402. * Normalize raw function directives into object format.
  1403. */
  1404. function normalizeDirectives(options) {
  1405. var dirs = options.directives;
  1406. if (dirs) {
  1407. for (var key in dirs) {
  1408. var def$$1 = dirs[key];
  1409. if (typeof def$$1 === 'function') {
  1410. dirs[key] = {
  1411. bind: def$$1,
  1412. update: def$$1
  1413. };
  1414. }
  1415. }
  1416. }
  1417. }
  1418. function assertObjectType(name, value, vm) {
  1419. if (!isPlainObject(value)) {
  1420. warn(
  1421. "Invalid value for option \"" + name + "\": expected an Object, " +
  1422. "but got " + (toRawType(value)) + ".",
  1423. vm
  1424. );
  1425. }
  1426. }
  1427. /**
  1428. * Merge two option objects into a new one.
  1429. * Core utility used in both instantiation and inheritance.
  1430. */
  1431. function mergeOptions(
  1432. parent,
  1433. child,
  1434. vm
  1435. ) {
  1436. {
  1437. checkComponents(child);
  1438. }
  1439. if (typeof child === 'function') {
  1440. child = child.options;
  1441. }
  1442. normalizeProps(child, vm);
  1443. normalizeInject(child, vm);
  1444. normalizeDirectives(child);
  1445. // Apply extends and mixins on the child options,
  1446. // but only if it is a raw options object that isn't
  1447. // the result of another mergeOptions call.
  1448. // Only merged options has the _base property.
  1449. if (!child._base) {
  1450. if (child.extends) {
  1451. parent = mergeOptions(parent, child.extends, vm);
  1452. }
  1453. if (child.mixins) {
  1454. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1455. parent = mergeOptions(parent, child.mixins[i], vm);
  1456. }
  1457. }
  1458. }
  1459. var options = {};
  1460. var key;
  1461. for (key in parent) {
  1462. mergeField(key);
  1463. }
  1464. for (key in child) {
  1465. if (!hasOwn(parent, key)) {
  1466. mergeField(key);
  1467. }
  1468. }
  1469. function mergeField(key) {
  1470. var strat = strats[key] || defaultStrat;
  1471. options[key] = strat(parent[key], child[key], vm, key);
  1472. }
  1473. return options
  1474. }
  1475. /**
  1476. * Resolve an asset.
  1477. * This function is used because child instances need access
  1478. * to assets defined in its ancestor chain.
  1479. */
  1480. function resolveAsset(
  1481. options,
  1482. type,
  1483. id,
  1484. warnMissing
  1485. ) {
  1486. /* istanbul ignore if */
  1487. if (typeof id !== 'string') {
  1488. return
  1489. }
  1490. var assets = options[type];
  1491. // check local registration variations first
  1492. if (hasOwn(assets, id)) {
  1493. return assets[id]
  1494. }
  1495. var camelizedId = camelize(id);
  1496. if (hasOwn(assets, camelizedId)) {
  1497. return assets[camelizedId]
  1498. }
  1499. var PascalCaseId = capitalize(camelizedId);
  1500. if (hasOwn(assets, PascalCaseId)) {
  1501. return assets[PascalCaseId]
  1502. }
  1503. // fallback to prototype chain
  1504. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  1505. if (warnMissing && !res) {
  1506. warn(
  1507. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  1508. options
  1509. );
  1510. }
  1511. return res
  1512. }
  1513. /* */
  1514. function validateProp(
  1515. key,
  1516. propOptions,
  1517. propsData,
  1518. vm
  1519. ) {
  1520. var prop = propOptions[key];
  1521. var absent = !hasOwn(propsData, key);
  1522. var value = propsData[key];
  1523. // boolean casting
  1524. var booleanIndex = getTypeIndex(Boolean, prop.type);
  1525. if (booleanIndex > -1) {
  1526. if (absent && !hasOwn(prop, 'default')) {
  1527. value = false;
  1528. } else if (value === '' || value === hyphenate(key)) {
  1529. // only cast empty string / same name to boolean if
  1530. // boolean has higher priority
  1531. var stringIndex = getTypeIndex(String, prop.type);
  1532. if (stringIndex < 0 || booleanIndex < stringIndex) {
  1533. value = true;
  1534. }
  1535. }
  1536. }
  1537. // check default value
  1538. if (value === undefined) {
  1539. value = getPropDefaultValue(vm, prop, key);
  1540. // since the default value is a fresh copy,
  1541. // make sure to observe it.
  1542. var prevShouldObserve = shouldObserve;
  1543. toggleObserving(true);
  1544. observe(value);
  1545. toggleObserving(prevShouldObserve);
  1546. } {
  1547. assertProp(prop, key, value, vm, absent);
  1548. }
  1549. return value
  1550. }
  1551. /**
  1552. * Get the default value of a prop.
  1553. */
  1554. function getPropDefaultValue(vm, prop, key) {
  1555. // no default, return undefined
  1556. if (!hasOwn(prop, 'default')) {
  1557. return undefined
  1558. }
  1559. var def = prop.default;
  1560. // warn against non-factory defaults for Object & Array
  1561. if (isObject(def)) {
  1562. warn(
  1563. 'Invalid default value for prop "' + key + '": ' +
  1564. 'Props with type Object/Array must use a factory function ' +
  1565. 'to return the default value.',
  1566. vm
  1567. );
  1568. }
  1569. // the raw prop value was also undefined from previous render,
  1570. // return previous default value to avoid unnecessary watcher trigger
  1571. if (vm && vm.$options.propsData &&
  1572. vm.$options.propsData[key] === undefined &&
  1573. vm._props[key] !== undefined
  1574. ) {
  1575. return vm._props[key]
  1576. }
  1577. // call factory function for non-Function types
  1578. // a value is Function if its prototype is function even across different execution context
  1579. return typeof def === 'function' && getType(prop.type) !== 'Function' ?
  1580. def.call(vm) :
  1581. def
  1582. }
  1583. /**
  1584. * Assert whether a prop is valid.
  1585. */
  1586. function assertProp(
  1587. prop,
  1588. name,
  1589. value,
  1590. vm,
  1591. absent
  1592. ) {
  1593. if (prop.required && absent) {
  1594. warn(
  1595. 'Missing required prop: "' + name + '"',
  1596. vm
  1597. );
  1598. return
  1599. }
  1600. if (value == null && !prop.required) {
  1601. return
  1602. }
  1603. var type = prop.type;
  1604. var valid = !type || type === true;
  1605. var expectedTypes = [];
  1606. if (type) {
  1607. if (!Array.isArray(type)) {
  1608. type = [type];
  1609. }
  1610. for (var i = 0; i < type.length && !valid; i++) {
  1611. var assertedType = assertType(value, type[i], vm);
  1612. expectedTypes.push(assertedType.expectedType || '');
  1613. valid = assertedType.valid;
  1614. }
  1615. }
  1616. var haveExpectedTypes = expectedTypes.some(function (t) {
  1617. return t;
  1618. });
  1619. if (!valid && haveExpectedTypes) {
  1620. warn(
  1621. getInvalidTypeMessage(name, value, expectedTypes),
  1622. vm
  1623. );
  1624. return
  1625. }
  1626. var validator = prop.validator;
  1627. if (validator) {
  1628. if (!validator(value)) {
  1629. warn(
  1630. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  1631. vm
  1632. );
  1633. }
  1634. }
  1635. }
  1636. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/;
  1637. function assertType(value, type, vm) {
  1638. var valid;
  1639. var expectedType = getType(type);
  1640. if (simpleCheckRE.test(expectedType)) {
  1641. var t = typeof value;
  1642. valid = t === expectedType.toLowerCase();
  1643. // for primitive wrapper objects
  1644. if (!valid && t === 'object') {
  1645. valid = value instanceof type;
  1646. }
  1647. } else if (expectedType === 'Object') {
  1648. valid = isPlainObject(value);
  1649. } else if (expectedType === 'Array') {
  1650. valid = Array.isArray(value);
  1651. } else {
  1652. try {
  1653. valid = value instanceof type;
  1654. } catch (e) {
  1655. warn('Invalid prop type: "' + String(type) + '" is not a constructor', vm);
  1656. valid = false;
  1657. }
  1658. }
  1659. return {
  1660. valid: valid,
  1661. expectedType: expectedType
  1662. }
  1663. }
  1664. var functionTypeCheckRE = /^\s*function (\w+)/;
  1665. /**
  1666. * Use function string name to check built-in types,
  1667. * because a simple equality check will fail when running
  1668. * across different vms / iframes.
  1669. */
  1670. function getType(fn) {
  1671. var match = fn && fn.toString().match(functionTypeCheckRE);
  1672. return match ? match[1] : ''
  1673. }
  1674. function isSameType(a, b) {
  1675. return getType(a) === getType(b)
  1676. }
  1677. function getTypeIndex(type, expectedTypes) {
  1678. if (!Array.isArray(expectedTypes)) {
  1679. return isSameType(expectedTypes, type) ? 0 : -1
  1680. }
  1681. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  1682. if (isSameType(expectedTypes[i], type)) {
  1683. return i
  1684. }
  1685. }
  1686. return -1
  1687. }
  1688. function getInvalidTypeMessage(name, value, expectedTypes) {
  1689. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  1690. " Expected " + (expectedTypes.map(capitalize).join(', '));
  1691. var expectedType = expectedTypes[0];
  1692. var receivedType = toRawType(value);
  1693. // check if we need to specify expected value
  1694. if (
  1695. expectedTypes.length === 1 &&
  1696. isExplicable(expectedType) &&
  1697. isExplicable(typeof value) &&
  1698. !isBoolean(expectedType, receivedType)
  1699. ) {
  1700. message += " with value " + (styleValue(value, expectedType));
  1701. }
  1702. message += ", got " + receivedType + " ";
  1703. // check if we need to specify received value
  1704. if (isExplicable(receivedType)) {
  1705. message += "with value " + (styleValue(value, receivedType)) + ".";
  1706. }
  1707. return message
  1708. }
  1709. function styleValue(value, type) {
  1710. if (type === 'String') {
  1711. return ("\"" + value + "\"")
  1712. } else if (type === 'Number') {
  1713. return ("" + (Number(value)))
  1714. } else {
  1715. return ("" + value)
  1716. }
  1717. }
  1718. var EXPLICABLE_TYPES = ['string', 'number', 'boolean'];
  1719. function isExplicable(value) {
  1720. return EXPLICABLE_TYPES.some(function (elem) {
  1721. return value.toLowerCase() === elem;
  1722. })
  1723. }
  1724. function isBoolean() {
  1725. var args = [],
  1726. len = arguments.length;
  1727. while (len--) args[len] = arguments[len];
  1728. return args.some(function (elem) {
  1729. return elem.toLowerCase() === 'boolean';
  1730. })
  1731. }
  1732. /* */
  1733. function handleError(err, vm, info) {
  1734. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  1735. // See: https://github.com/vuejs/vuex/issues/1505
  1736. pushTarget();
  1737. try {
  1738. if (vm) {
  1739. var cur = vm;
  1740. while ((cur = cur.$parent)) {
  1741. var hooks = cur.$options.errorCaptured;
  1742. if (hooks) {
  1743. for (var i = 0; i < hooks.length; i++) {
  1744. try {
  1745. var capture = hooks[i].call(cur, err, vm, info) === false;
  1746. if (capture) {
  1747. return
  1748. }
  1749. } catch (e) {
  1750. globalHandleError(e, cur, 'errorCaptured hook');
  1751. }
  1752. }
  1753. }
  1754. }
  1755. }
  1756. globalHandleError(err, vm, info);
  1757. } finally {
  1758. popTarget();
  1759. }
  1760. }
  1761. function invokeWithErrorHandling(
  1762. handler,
  1763. context,
  1764. args,
  1765. vm,
  1766. info
  1767. ) {
  1768. var res;
  1769. try {
  1770. res = args ? handler.apply(context, args) : handler.call(context);
  1771. if (res && !res._isVue && isPromise(res) && !res._handled) {
  1772. res.catch(function (e) {
  1773. return handleError(e, vm, info + " (Promise/async)");
  1774. });
  1775. // issue #9511
  1776. // avoid catch triggering multiple times when nested calls
  1777. res._handled = true;
  1778. }
  1779. } catch (e) {
  1780. handleError(e, vm, info);
  1781. }
  1782. return res
  1783. }
  1784. function globalHandleError(err, vm, info) {
  1785. if (config.errorHandler) {
  1786. try {
  1787. return config.errorHandler.call(null, err, vm, info)
  1788. } catch (e) {
  1789. // if the user intentionally throws the original error in the handler,
  1790. // do not log it twice
  1791. if (e !== err) {
  1792. logError(e, null, 'config.errorHandler');
  1793. }
  1794. }
  1795. }
  1796. logError(err, vm, info);
  1797. }
  1798. function logError(err, vm, info) {
  1799. {
  1800. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  1801. }
  1802. /* istanbul ignore else */
  1803. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  1804. console.error(err);
  1805. } else {
  1806. throw err
  1807. }
  1808. }
  1809. /* */
  1810. var isUsingMicroTask = false;
  1811. var callbacks = [];
  1812. var pending = false;
  1813. function flushCallbacks() {
  1814. pending = false;
  1815. var copies = callbacks.slice(0);
  1816. callbacks.length = 0;
  1817. for (var i = 0; i < copies.length; i++) {
  1818. copies[i]();
  1819. }
  1820. }
  1821. // Here we have async deferring wrappers using microtasks.
  1822. // In 2.5 we used (macro) tasks (in combination with microtasks).
  1823. // However, it has subtle problems when state is changed right before repaint
  1824. // (e.g. #6813, out-in transitions).
  1825. // Also, using (macro) tasks in event handler would cause some weird behaviors
  1826. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  1827. // So we now use microtasks everywhere, again.
  1828. // A major drawback of this tradeoff is that there are some scenarios
  1829. // where microtasks have too high a priority and fire in between supposedly
  1830. // sequential events (e.g. #4521, #6690, which have workarounds)
  1831. // or even between bubbling of the same event (#6566).
  1832. var timerFunc;
  1833. // The nextTick behavior leverages the microtask queue, which can be accessed
  1834. // via either native Promise.then or MutationObserver.
  1835. // MutationObserver has wider support, however it is seriously bugged in
  1836. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  1837. // completely stops working after triggering a few times... so, if native
  1838. // Promise is available, we will use it:
  1839. /* istanbul ignore next, $flow-disable-line */
  1840. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  1841. var p = Promise.resolve();
  1842. timerFunc = function () {
  1843. p.then(flushCallbacks);
  1844. // In problematic UIWebViews, Promise.then doesn't completely break, but
  1845. // it can get stuck in a weird state where callbacks are pushed into the
  1846. // microtask queue but the queue isn't being flushed, until the browser
  1847. // needs to do some other work, e.g. handle a timer. Therefore we can
  1848. // "force" the microtask queue to be flushed by adding an empty timer.
  1849. if (isIOS) {
  1850. setTimeout(noop);
  1851. }
  1852. };
  1853. isUsingMicroTask = true;
  1854. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  1855. isNative(MutationObserver) ||
  1856. // PhantomJS and iOS 7.x
  1857. MutationObserver.toString() === '[object MutationObserverConstructor]'
  1858. )) {
  1859. // Use MutationObserver where native Promise is not available,
  1860. // e.g. PhantomJS, iOS7, Android 4.4
  1861. // (#6466 MutationObserver is unreliable in IE11)
  1862. var counter = 1;
  1863. var observer = new MutationObserver(flushCallbacks);
  1864. var textNode = document.createTextNode(String(counter));
  1865. observer.observe(textNode, {
  1866. characterData: true
  1867. });
  1868. timerFunc = function () {
  1869. counter = (counter + 1) % 2;
  1870. textNode.data = String(counter);
  1871. };
  1872. isUsingMicroTask = true;
  1873. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  1874. // Fallback to setImmediate.
  1875. // Technically it leverages the (macro) task queue,
  1876. // but it is still a better choice than setTimeout.
  1877. timerFunc = function () {
  1878. setImmediate(flushCallbacks);
  1879. };
  1880. } else {
  1881. // Fallback to setTimeout.
  1882. timerFunc = function () {
  1883. setTimeout(flushCallbacks, 0);
  1884. };
  1885. }
  1886. function nextTick(cb, ctx) {
  1887. var _resolve;
  1888. callbacks.push(function () {
  1889. if (cb) {
  1890. try {
  1891. cb.call(ctx);
  1892. } catch (e) {
  1893. handleError(e, ctx, 'nextTick');
  1894. }
  1895. } else if (_resolve) {
  1896. _resolve(ctx);
  1897. }
  1898. });
  1899. if (!pending) {
  1900. pending = true;
  1901. timerFunc();
  1902. }
  1903. // $flow-disable-line
  1904. if (!cb && typeof Promise !== 'undefined') {
  1905. return new Promise(function (resolve) {
  1906. _resolve = resolve;
  1907. })
  1908. }
  1909. }
  1910. /* */
  1911. var mark;
  1912. var measure;
  1913. {
  1914. var perf = inBrowser && window.performance;
  1915. /* istanbul ignore if */
  1916. if (
  1917. perf &&
  1918. perf.mark &&
  1919. perf.measure &&
  1920. perf.clearMarks &&
  1921. perf.clearMeasures
  1922. ) {
  1923. mark = function (tag) {
  1924. return perf.mark(tag);
  1925. };
  1926. measure = function (name, startTag, endTag) {
  1927. perf.measure(name, startTag, endTag);
  1928. perf.clearMarks(startTag);
  1929. perf.clearMarks(endTag);
  1930. // perf.clearMeasures(name)
  1931. };
  1932. }
  1933. }
  1934. /* not type checking this file because flow doesn't play well with Proxy */
  1935. var initProxy;
  1936. {
  1937. var allowedGlobals = makeMap(
  1938. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  1939. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  1940. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' +
  1941. 'require' // for Webpack/Browserify
  1942. );
  1943. var warnNonPresent = function (target, key) {
  1944. warn(
  1945. "Property or method \"" + key + "\" is not defined on the instance but " +
  1946. 'referenced during render. Make sure that this property is reactive, ' +
  1947. 'either in the data option, or for class-based components, by ' +
  1948. 'initializing the property. ' +
  1949. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  1950. target
  1951. );
  1952. };
  1953. var warnReservedPrefix = function (target, key) {
  1954. warn(
  1955. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  1956. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  1957. 'prevent conflicts with Vue internals. ' +
  1958. 'See: https://vuejs.org/v2/api/#data',
  1959. target
  1960. );
  1961. };
  1962. var hasProxy =
  1963. typeof Proxy !== 'undefined' && isNative(Proxy);
  1964. if (hasProxy) {
  1965. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  1966. config.keyCodes = new Proxy(config.keyCodes, {
  1967. set: function set(target, key, value) {
  1968. if (isBuiltInModifier(key)) {
  1969. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  1970. return false
  1971. } else {
  1972. target[key] = value;
  1973. return true
  1974. }
  1975. }
  1976. });
  1977. }
  1978. var hasHandler = {
  1979. has: function has(target, key) {
  1980. var has = key in target;
  1981. var isAllowed = allowedGlobals(key) ||
  1982. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  1983. if (!has && !isAllowed) {
  1984. if (key in target.$data) {
  1985. warnReservedPrefix(target, key);
  1986. } else {
  1987. warnNonPresent(target, key);
  1988. }
  1989. }
  1990. return has || !isAllowed
  1991. }
  1992. };
  1993. var getHandler = {
  1994. get: function get(target, key) {
  1995. if (typeof key === 'string' && !(key in target)) {
  1996. if (key in target.$data) {
  1997. warnReservedPrefix(target, key);
  1998. } else {
  1999. warnNonPresent(target, key);
  2000. }
  2001. }
  2002. return target[key]
  2003. }
  2004. };
  2005. initProxy = function initProxy(vm) {
  2006. if (hasProxy) {
  2007. // determine which proxy handler to use
  2008. var options = vm.$options;
  2009. var handlers = options.render && options.render._withStripped ?
  2010. getHandler :
  2011. hasHandler;
  2012. vm._renderProxy = new Proxy(vm, handlers);
  2013. } else {
  2014. vm._renderProxy = vm;
  2015. }
  2016. };
  2017. }
  2018. /* */
  2019. var seenObjects = new _Set();
  2020. /**
  2021. * Recursively traverse an object to evoke all converted
  2022. * getters, so that every nested property inside the object
  2023. * is collected as a "deep" dependency.
  2024. */
  2025. function traverse(val) {
  2026. _traverse(val, seenObjects);
  2027. seenObjects.clear();
  2028. }
  2029. function _traverse(val, seen) {
  2030. var i, keys;
  2031. var isA = Array.isArray(val);
  2032. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  2033. return
  2034. }
  2035. if (val.__ob__) {
  2036. var depId = val.__ob__.dep.id;
  2037. if (seen.has(depId)) {
  2038. return
  2039. }
  2040. seen.add(depId);
  2041. }
  2042. if (isA) {
  2043. i = val.length;
  2044. while (i--) {
  2045. _traverse(val[i], seen);
  2046. }
  2047. } else {
  2048. keys = Object.keys(val);
  2049. i = keys.length;
  2050. while (i--) {
  2051. _traverse(val[keys[i]], seen);
  2052. }
  2053. }
  2054. }
  2055. /* */
  2056. var normalizeEvent = cached(function (name) {
  2057. var passive = name.charAt(0) === '&';
  2058. name = passive ? name.slice(1) : name;
  2059. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  2060. name = once$$1 ? name.slice(1) : name;
  2061. var capture = name.charAt(0) === '!';
  2062. name = capture ? name.slice(1) : name;
  2063. return {
  2064. name: name,
  2065. once: once$$1,
  2066. capture: capture,
  2067. passive: passive
  2068. }
  2069. });
  2070. function createFnInvoker(fns, vm) {
  2071. function invoker() {
  2072. var arguments$1 = arguments;
  2073. var fns = invoker.fns;
  2074. if (Array.isArray(fns)) {
  2075. var cloned = fns.slice();
  2076. for (var i = 0; i < cloned.length; i++) {
  2077. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  2078. }
  2079. } else {
  2080. // return handler return value for single handlers
  2081. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  2082. }
  2083. }
  2084. invoker.fns = fns;
  2085. return invoker
  2086. }
  2087. function updateListeners(
  2088. on,
  2089. oldOn,
  2090. add,
  2091. remove$$1,
  2092. createOnceHandler,
  2093. vm
  2094. ) {
  2095. var name, def$$1, cur, old, event;
  2096. for (name in on) {
  2097. def$$1 = cur = on[name];
  2098. old = oldOn[name];
  2099. event = normalizeEvent(name);
  2100. if (isUndef(cur)) {
  2101. warn(
  2102. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  2103. vm
  2104. );
  2105. } else if (isUndef(old)) {
  2106. if (isUndef(cur.fns)) {
  2107. cur = on[name] = createFnInvoker(cur, vm);
  2108. }
  2109. if (isTrue(event.once)) {
  2110. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  2111. }
  2112. add(event.name, cur, event.capture, event.passive, event.params);
  2113. } else if (cur !== old) {
  2114. old.fns = cur;
  2115. on[name] = old;
  2116. }
  2117. }
  2118. for (name in oldOn) {
  2119. if (isUndef(on[name])) {
  2120. event = normalizeEvent(name);
  2121. remove$$1(event.name, oldOn[name], event.capture);
  2122. }
  2123. }
  2124. }
  2125. /* */
  2126. function mergeVNodeHook(def, hookKey, hook) {
  2127. if (def instanceof VNode) {
  2128. def = def.data.hook || (def.data.hook = {});
  2129. }
  2130. var invoker;
  2131. var oldHook = def[hookKey];
  2132. function wrappedHook() {
  2133. hook.apply(this, arguments);
  2134. // important: remove merged hook to ensure it's called only once
  2135. // and prevent memory leak
  2136. remove(invoker.fns, wrappedHook);
  2137. }
  2138. if (isUndef(oldHook)) {
  2139. // no existing hook
  2140. invoker = createFnInvoker([wrappedHook]);
  2141. } else {
  2142. /* istanbul ignore if */
  2143. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  2144. // already a merged invoker
  2145. invoker = oldHook;
  2146. invoker.fns.push(wrappedHook);
  2147. } else {
  2148. // existing plain hook
  2149. invoker = createFnInvoker([oldHook, wrappedHook]);
  2150. }
  2151. }
  2152. invoker.merged = true;
  2153. def[hookKey] = invoker;
  2154. }
  2155. /* */
  2156. function extractPropsFromVNodeData(
  2157. data,
  2158. Ctor,
  2159. tag
  2160. ) {
  2161. // we are only extracting raw values here.
  2162. // validation and default values are handled in the child
  2163. // component itself.
  2164. var propOptions = Ctor.options.props;
  2165. if (isUndef(propOptions)) {
  2166. return
  2167. }
  2168. var res = {};
  2169. var attrs = data.attrs;
  2170. var props = data.props;
  2171. if (isDef(attrs) || isDef(props)) {
  2172. for (var key in propOptions) {
  2173. var altKey = hyphenate(key); {
  2174. var keyInLowerCase = key.toLowerCase();
  2175. if (
  2176. key !== keyInLowerCase &&
  2177. attrs && hasOwn(attrs, keyInLowerCase)
  2178. ) {
  2179. tip(
  2180. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  2181. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  2182. " \"" + key + "\". " +
  2183. "Note that HTML attributes are case-insensitive and camelCased " +
  2184. "props need to use their kebab-case equivalents when using in-DOM " +
  2185. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  2186. );
  2187. }
  2188. }
  2189. checkProp(res, props, key, altKey, true) ||
  2190. checkProp(res, attrs, key, altKey, false);
  2191. }
  2192. }
  2193. return res
  2194. }
  2195. function checkProp(
  2196. res,
  2197. hash,
  2198. key,
  2199. altKey,
  2200. preserve
  2201. ) {
  2202. if (isDef(hash)) {
  2203. if (hasOwn(hash, key)) {
  2204. res[key] = hash[key];
  2205. if (!preserve) {
  2206. delete hash[key];
  2207. }
  2208. return true
  2209. } else if (hasOwn(hash, altKey)) {
  2210. res[key] = hash[altKey];
  2211. if (!preserve) {
  2212. delete hash[altKey];
  2213. }
  2214. return true
  2215. }
  2216. }
  2217. return false
  2218. }
  2219. /* */
  2220. // The template compiler attempts to minimize the need for normalization by
  2221. // statically analyzing the template at compile time.
  2222. //
  2223. // For plain HTML markup, normalization can be completely skipped because the
  2224. // generated render function is guaranteed to return Array<VNode>. There are
  2225. // two cases where extra normalization is needed:
  2226. // 1. When the children contains components - because a functional component
  2227. // may return an Array instead of a single root. In this case, just a simple
  2228. // normalization is needed - if any child is an Array, we flatten the whole
  2229. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  2230. // because functional components already normalize their own children.
  2231. function simpleNormalizeChildren(children) {
  2232. for (var i = 0; i < children.length; i++) {
  2233. if (Array.isArray(children[i])) {
  2234. return Array.prototype.concat.apply([], children)
  2235. }
  2236. }
  2237. return children
  2238. }
  2239. // 2. When the children contains constructs that always generated nested Arrays,
  2240. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  2241. // with hand-written render functions / JSX. In such cases a full normalization
  2242. // is needed to cater to all possible types of children values.
  2243. function normalizeChildren(children) {
  2244. return isPrimitive(children) ?
  2245. [createTextVNode(children)] :
  2246. Array.isArray(children) ?
  2247. normalizeArrayChildren(children) :
  2248. undefined
  2249. }
  2250. function isTextNode(node) {
  2251. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  2252. }
  2253. function normalizeArrayChildren(children, nestedIndex) {
  2254. var res = [];
  2255. var i, c, lastIndex, last;
  2256. for (i = 0; i < children.length; i++) {
  2257. c = children[i];
  2258. if (isUndef(c) || typeof c === 'boolean') {
  2259. continue
  2260. }
  2261. lastIndex = res.length - 1;
  2262. last = res[lastIndex];
  2263. // nested
  2264. if (Array.isArray(c)) {
  2265. if (c.length > 0) {
  2266. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  2267. // merge adjacent text nodes
  2268. if (isTextNode(c[0]) && isTextNode(last)) {
  2269. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  2270. c.shift();
  2271. }
  2272. res.push.apply(res, c);
  2273. }
  2274. } else if (isPrimitive(c)) {
  2275. if (isTextNode(last)) {
  2276. // merge adjacent text nodes
  2277. // this is necessary for SSR hydration because text nodes are
  2278. // essentially merged when rendered to HTML strings
  2279. res[lastIndex] = createTextVNode(last.text + c);
  2280. } else if (c !== '') {
  2281. // convert primitive to vnode
  2282. res.push(createTextVNode(c));
  2283. }
  2284. } else {
  2285. if (isTextNode(c) && isTextNode(last)) {
  2286. // merge adjacent text nodes
  2287. res[lastIndex] = createTextVNode(last.text + c.text);
  2288. } else {
  2289. // default key for nested array children (likely generated by v-for)
  2290. if (isTrue(children._isVList) &&
  2291. isDef(c.tag) &&
  2292. isUndef(c.key) &&
  2293. isDef(nestedIndex)) {
  2294. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  2295. }
  2296. res.push(c);
  2297. }
  2298. }
  2299. }
  2300. return res
  2301. }
  2302. /* */
  2303. function initProvide(vm) {
  2304. var provide = vm.$options.provide;
  2305. if (provide) {
  2306. vm._provided = typeof provide === 'function' ?
  2307. provide.call(vm) :
  2308. provide;
  2309. }
  2310. }
  2311. function initInjections(vm) {
  2312. var result = resolveInject(vm.$options.inject, vm);
  2313. if (result) {
  2314. toggleObserving(false);
  2315. Object.keys(result).forEach(function (key) {
  2316. /* istanbul ignore else */
  2317. {
  2318. defineReactive$$1(vm, key, result[key], function () {
  2319. warn(
  2320. "Avoid mutating an injected value directly since the changes will be " +
  2321. "overwritten whenever the provided component re-renders. " +
  2322. "injection being mutated: \"" + key + "\"",
  2323. vm
  2324. );
  2325. });
  2326. }
  2327. });
  2328. toggleObserving(true);
  2329. }
  2330. }
  2331. function resolveInject(inject, vm) {
  2332. if (inject) {
  2333. // inject is :any because flow is not smart enough to figure out cached
  2334. var result = Object.create(null);
  2335. var keys = hasSymbol ?
  2336. Reflect.ownKeys(inject) :
  2337. Object.keys(inject);
  2338. for (var i = 0; i < keys.length; i++) {
  2339. var key = keys[i];
  2340. // #6574 in case the inject object is observed...
  2341. if (key === '__ob__') {
  2342. continue
  2343. }
  2344. var provideKey = inject[key].from;
  2345. var source = vm;
  2346. while (source) {
  2347. if (source._provided && hasOwn(source._provided, provideKey)) {
  2348. result[key] = source._provided[provideKey];
  2349. break
  2350. }
  2351. source = source.$parent;
  2352. }
  2353. if (!source) {
  2354. if ('default' in inject[key]) {
  2355. var provideDefault = inject[key].default;
  2356. result[key] = typeof provideDefault === 'function' ?
  2357. provideDefault.call(vm) :
  2358. provideDefault;
  2359. } else {
  2360. warn(("Injection \"" + key + "\" not found"), vm);
  2361. }
  2362. }
  2363. }
  2364. return result
  2365. }
  2366. }
  2367. /* */
  2368. /**
  2369. * Runtime helper for resolving raw children VNodes into a slot object.
  2370. */
  2371. function resolveSlots(
  2372. children,
  2373. context
  2374. ) {
  2375. if (!children || !children.length) {
  2376. return {}
  2377. }
  2378. var slots = {};
  2379. for (var i = 0, l = children.length; i < l; i++) {
  2380. var child = children[i];
  2381. var data = child.data;
  2382. // remove slot attribute if the node is resolved as a Vue slot node
  2383. if (data && data.attrs && data.attrs.slot) {
  2384. delete data.attrs.slot;
  2385. }
  2386. // named slots should only be respected if the vnode was rendered in the
  2387. // same context.
  2388. if ((child.context === context || child.fnContext === context) &&
  2389. data && data.slot != null
  2390. ) {
  2391. var name = data.slot;
  2392. var slot = (slots[name] || (slots[name] = []));
  2393. if (child.tag === 'template') {
  2394. slot.push.apply(slot, child.children || []);
  2395. } else {
  2396. slot.push(child);
  2397. }
  2398. } else {
  2399. (slots.default || (slots.default = [])).push(child);
  2400. }
  2401. }
  2402. // ignore slots that contains only whitespace
  2403. for (var name$1 in slots) {
  2404. if (slots[name$1].every(isWhitespace)) {
  2405. delete slots[name$1];
  2406. }
  2407. }
  2408. return slots
  2409. }
  2410. function isWhitespace(node) {
  2411. return (node.isComment && !node.asyncFactory) || node.text === ' '
  2412. }
  2413. /* */
  2414. function isAsyncPlaceholder(node) {
  2415. return node.isComment && node.asyncFactory
  2416. }
  2417. /* */
  2418. function normalizeScopedSlots(
  2419. slots,
  2420. normalSlots,
  2421. prevSlots
  2422. ) {
  2423. var res;
  2424. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  2425. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  2426. var key = slots && slots.$key;
  2427. if (!slots) {
  2428. res = {};
  2429. } else if (slots._normalized) {
  2430. // fast path 1: child component re-render only, parent did not change
  2431. return slots._normalized
  2432. } else if (
  2433. isStable &&
  2434. prevSlots &&
  2435. prevSlots !== emptyObject &&
  2436. key === prevSlots.$key &&
  2437. !hasNormalSlots &&
  2438. !prevSlots.$hasNormal
  2439. ) {
  2440. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  2441. // only need to normalize once
  2442. return prevSlots
  2443. } else {
  2444. res = {};
  2445. for (var key$1 in slots) {
  2446. if (slots[key$1] && key$1[0] !== '$') {
  2447. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  2448. }
  2449. }
  2450. }
  2451. // expose normal slots on scopedSlots
  2452. for (var key$2 in normalSlots) {
  2453. if (!(key$2 in res)) {
  2454. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  2455. }
  2456. }
  2457. // avoriaz seems to mock a non-extensible $scopedSlots object
  2458. // and when that is passed down this would cause an error
  2459. if (slots && Object.isExtensible(slots)) {
  2460. (slots)._normalized = res;
  2461. }
  2462. def(res, '$stable', isStable);
  2463. def(res, '$key', key);
  2464. def(res, '$hasNormal', hasNormalSlots);
  2465. return res
  2466. }
  2467. function normalizeScopedSlot(normalSlots, key, fn) {
  2468. var normalized = function () {
  2469. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  2470. res = res && typeof res === 'object' && !Array.isArray(res) ?
  2471. [res] // single vnode
  2472. :
  2473. normalizeChildren(res);
  2474. var vnode = res && res[0];
  2475. return res && (
  2476. !vnode ||
  2477. (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
  2478. ) ? undefined :
  2479. res
  2480. };
  2481. // this is a slot using the new v-slot syntax without scope. although it is
  2482. // compiled as a scoped slot, render fn users would expect it to be present
  2483. // on this.$slots because the usage is semantically a normal slot.
  2484. if (fn.proxy) {
  2485. Object.defineProperty(normalSlots, key, {
  2486. get: normalized,
  2487. enumerable: true,
  2488. configurable: true
  2489. });
  2490. }
  2491. return normalized
  2492. }
  2493. function proxyNormalSlot(slots, key) {
  2494. return function () {
  2495. return slots[key];
  2496. }
  2497. }
  2498. /* */
  2499. /**
  2500. * Runtime helper for rendering v-for lists.
  2501. */
  2502. function renderList(
  2503. val,
  2504. render
  2505. ) {
  2506. var ret, i, l, keys, key;
  2507. if (Array.isArray(val) || typeof val === 'string') {
  2508. ret = new Array(val.length);
  2509. for (i = 0, l = val.length; i < l; i++) {
  2510. ret[i] = render(val[i], i);
  2511. }
  2512. } else if (typeof val === 'number') {
  2513. ret = new Array(val);
  2514. for (i = 0; i < val; i++) {
  2515. ret[i] = render(i + 1, i);
  2516. }
  2517. } else if (isObject(val)) {
  2518. if (hasSymbol && val[Symbol.iterator]) {
  2519. ret = [];
  2520. var iterator = val[Symbol.iterator]();
  2521. var result = iterator.next();
  2522. while (!result.done) {
  2523. ret.push(render(result.value, ret.length));
  2524. result = iterator.next();
  2525. }
  2526. } else {
  2527. keys = Object.keys(val);
  2528. ret = new Array(keys.length);
  2529. for (i = 0, l = keys.length; i < l; i++) {
  2530. key = keys[i];
  2531. ret[i] = render(val[key], key, i);
  2532. }
  2533. }
  2534. }
  2535. if (!isDef(ret)) {
  2536. ret = [];
  2537. }
  2538. (ret)._isVList = true;
  2539. return ret
  2540. }
  2541. /* */
  2542. /**
  2543. * Runtime helper for rendering <slot>
  2544. */
  2545. function renderSlot(
  2546. name,
  2547. fallbackRender,
  2548. props,
  2549. bindObject
  2550. ) {
  2551. var scopedSlotFn = this.$scopedSlots[name];
  2552. var nodes;
  2553. if (scopedSlotFn) {
  2554. // scoped slot
  2555. props = props || {};
  2556. if (bindObject) {
  2557. if (!isObject(bindObject)) {
  2558. warn('slot v-bind without argument expects an Object', this);
  2559. }
  2560. props = extend(extend({}, bindObject), props);
  2561. }
  2562. nodes =
  2563. scopedSlotFn(props) ||
  2564. (typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender);
  2565. } else {
  2566. nodes =
  2567. this.$slots[name] ||
  2568. (typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender);
  2569. }
  2570. var target = props && props.slot;
  2571. if (target) {
  2572. return this.$createElement('template', {
  2573. slot: target
  2574. }, nodes)
  2575. } else {
  2576. return nodes
  2577. }
  2578. }
  2579. /* */
  2580. /**
  2581. * Runtime helper for resolving filters
  2582. */
  2583. function resolveFilter(id) {
  2584. return resolveAsset(this.$options, 'filters', id, true) || identity
  2585. }
  2586. /* */
  2587. function isKeyNotMatch(expect, actual) {
  2588. if (Array.isArray(expect)) {
  2589. return expect.indexOf(actual) === -1
  2590. } else {
  2591. return expect !== actual
  2592. }
  2593. }
  2594. /**
  2595. * Runtime helper for checking keyCodes from config.
  2596. * exposed as Vue.prototype._k
  2597. * passing in eventKeyName as last argument separately for backwards compat
  2598. */
  2599. function checkKeyCodes(
  2600. eventKeyCode,
  2601. key,
  2602. builtInKeyCode,
  2603. eventKeyName,
  2604. builtInKeyName
  2605. ) {
  2606. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  2607. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  2608. return isKeyNotMatch(builtInKeyName, eventKeyName)
  2609. } else if (mappedKeyCode) {
  2610. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  2611. } else if (eventKeyName) {
  2612. return hyphenate(eventKeyName) !== key
  2613. }
  2614. return eventKeyCode === undefined
  2615. }
  2616. /* */
  2617. /**
  2618. * Runtime helper for merging v-bind="object" into a VNode's data.
  2619. */
  2620. function bindObjectProps(
  2621. data,
  2622. tag,
  2623. value,
  2624. asProp,
  2625. isSync
  2626. ) {
  2627. if (value) {
  2628. if (!isObject(value)) {
  2629. warn(
  2630. 'v-bind without argument expects an Object or Array value',
  2631. this
  2632. );
  2633. } else {
  2634. if (Array.isArray(value)) {
  2635. value = toObject(value);
  2636. }
  2637. var hash;
  2638. var loop = function (key) {
  2639. if (
  2640. key === 'class' ||
  2641. key === 'style' ||
  2642. isReservedAttribute(key)
  2643. ) {
  2644. hash = data;
  2645. } else {
  2646. var type = data.attrs && data.attrs.type;
  2647. hash = asProp || config.mustUseProp(tag, type, key) ?
  2648. data.domProps || (data.domProps = {}) :
  2649. data.attrs || (data.attrs = {});
  2650. }
  2651. var camelizedKey = camelize(key);
  2652. var hyphenatedKey = hyphenate(key);
  2653. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  2654. hash[key] = value[key];
  2655. if (isSync) {
  2656. var on = data.on || (data.on = {});
  2657. on[("update:" + key)] = function ($event) {
  2658. value[key] = $event;
  2659. };
  2660. }
  2661. }
  2662. };
  2663. for (var key in value) loop(key);
  2664. }
  2665. }
  2666. return data
  2667. }
  2668. /* */
  2669. /**
  2670. * Runtime helper for rendering static trees.
  2671. */
  2672. function renderStatic(
  2673. index,
  2674. isInFor
  2675. ) {
  2676. var cached = this._staticTrees || (this._staticTrees = []);
  2677. var tree = cached[index];
  2678. // if has already-rendered static tree and not inside v-for,
  2679. // we can reuse the same tree.
  2680. if (tree && !isInFor) {
  2681. return tree
  2682. }
  2683. // otherwise, render a fresh tree.
  2684. tree = cached[index] = this.$options.staticRenderFns[index].call(
  2685. this._renderProxy,
  2686. null,
  2687. this // for render fns generated for functional component templates
  2688. );
  2689. markStatic(tree, ("__static__" + index), false);
  2690. return tree
  2691. }
  2692. /**
  2693. * Runtime helper for v-once.
  2694. * Effectively it means marking the node as static with a unique key.
  2695. */
  2696. function markOnce(
  2697. tree,
  2698. index,
  2699. key
  2700. ) {
  2701. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  2702. return tree
  2703. }
  2704. function markStatic(
  2705. tree,
  2706. key,
  2707. isOnce
  2708. ) {
  2709. if (Array.isArray(tree)) {
  2710. for (var i = 0; i < tree.length; i++) {
  2711. if (tree[i] && typeof tree[i] !== 'string') {
  2712. markStaticNode(tree[i], (key + "_" + i), isOnce);
  2713. }
  2714. }
  2715. } else {
  2716. markStaticNode(tree, key, isOnce);
  2717. }
  2718. }
  2719. function markStaticNode(node, key, isOnce) {
  2720. node.isStatic = true;
  2721. node.key = key;
  2722. node.isOnce = isOnce;
  2723. }
  2724. /* */
  2725. function bindObjectListeners(data, value) {
  2726. if (value) {
  2727. if (!isPlainObject(value)) {
  2728. warn(
  2729. 'v-on without argument expects an Object value',
  2730. this
  2731. );
  2732. } else {
  2733. var on = data.on = data.on ? extend({}, data.on) : {};
  2734. for (var key in value) {
  2735. var existing = on[key];
  2736. var ours = value[key];
  2737. on[key] = existing ? [].concat(existing, ours) : ours;
  2738. }
  2739. }
  2740. }
  2741. return data
  2742. }
  2743. /* */
  2744. function resolveScopedSlots(
  2745. fns, // see flow/vnode
  2746. res,
  2747. // the following are added in 2.6
  2748. hasDynamicKeys,
  2749. contentHashKey
  2750. ) {
  2751. res = res || {
  2752. $stable: !hasDynamicKeys
  2753. };
  2754. for (var i = 0; i < fns.length; i++) {
  2755. var slot = fns[i];
  2756. if (Array.isArray(slot)) {
  2757. resolveScopedSlots(slot, res, hasDynamicKeys);
  2758. } else if (slot) {
  2759. // marker for reverse proxying v-slot without scope on this.$slots
  2760. if (slot.proxy) {
  2761. slot.fn.proxy = true;
  2762. }
  2763. res[slot.key] = slot.fn;
  2764. }
  2765. }
  2766. if (contentHashKey) {
  2767. (res).$key = contentHashKey;
  2768. }
  2769. return res
  2770. }
  2771. /* */
  2772. function bindDynamicKeys(baseObj, values) {
  2773. for (var i = 0; i < values.length; i += 2) {
  2774. var key = values[i];
  2775. if (typeof key === 'string' && key) {
  2776. baseObj[values[i]] = values[i + 1];
  2777. } else if (key !== '' && key !== null) {
  2778. // null is a special value for explicitly removing a binding
  2779. warn(
  2780. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  2781. this
  2782. );
  2783. }
  2784. }
  2785. return baseObj
  2786. }
  2787. // helper to dynamically append modifier runtime markers to event names.
  2788. // ensure only append when value is already string, otherwise it will be cast
  2789. // to string and cause the type check to miss.
  2790. function prependModifier(value, symbol) {
  2791. return typeof value === 'string' ? symbol + value : value
  2792. }
  2793. /* */
  2794. function installRenderHelpers(target) {
  2795. target._o = markOnce;
  2796. target._n = toNumber;
  2797. target._s = toString;
  2798. target._l = renderList;
  2799. target._t = renderSlot;
  2800. target._q = looseEqual;
  2801. target._i = looseIndexOf;
  2802. target._m = renderStatic;
  2803. target._f = resolveFilter;
  2804. target._k = checkKeyCodes;
  2805. target._b = bindObjectProps;
  2806. target._v = createTextVNode;
  2807. target._e = createEmptyVNode;
  2808. target._u = resolveScopedSlots;
  2809. target._g = bindObjectListeners;
  2810. target._d = bindDynamicKeys;
  2811. target._p = prependModifier;
  2812. }
  2813. /* */
  2814. function FunctionalRenderContext(
  2815. data,
  2816. props,
  2817. children,
  2818. parent,
  2819. Ctor
  2820. ) {
  2821. var this$1 = this;
  2822. var options = Ctor.options;
  2823. // ensure the createElement function in functional components
  2824. // gets a unique context - this is necessary for correct named slot check
  2825. var contextVm;
  2826. if (hasOwn(parent, '_uid')) {
  2827. contextVm = Object.create(parent);
  2828. // $flow-disable-line
  2829. contextVm._original = parent;
  2830. } else {
  2831. // the context vm passed in is a functional context as well.
  2832. // in this case we want to make sure we are able to get a hold to the
  2833. // real context instance.
  2834. contextVm = parent;
  2835. // $flow-disable-line
  2836. parent = parent._original;
  2837. }
  2838. var isCompiled = isTrue(options._compiled);
  2839. var needNormalization = !isCompiled;
  2840. this.data = data;
  2841. this.props = props;
  2842. this.children = children;
  2843. this.parent = parent;
  2844. this.listeners = data.on || emptyObject;
  2845. this.injections = resolveInject(options.inject, parent);
  2846. this.slots = function () {
  2847. if (!this$1.$slots) {
  2848. normalizeScopedSlots(
  2849. data.scopedSlots,
  2850. this$1.$slots = resolveSlots(children, parent)
  2851. );
  2852. }
  2853. return this$1.$slots
  2854. };
  2855. Object.defineProperty(this, 'scopedSlots', ({
  2856. enumerable: true,
  2857. get: function get() {
  2858. return normalizeScopedSlots(data.scopedSlots, this.slots())
  2859. }
  2860. }));
  2861. // support for compiled functional template
  2862. if (isCompiled) {
  2863. // exposing $options for renderStatic()
  2864. this.$options = options;
  2865. // pre-resolve slots for renderSlot()
  2866. this.$slots = this.slots();
  2867. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  2868. }
  2869. if (options._scopeId) {
  2870. this._c = function (a, b, c, d) {
  2871. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  2872. if (vnode && !Array.isArray(vnode)) {
  2873. vnode.fnScopeId = options._scopeId;
  2874. vnode.fnContext = parent;
  2875. }
  2876. return vnode
  2877. };
  2878. } else {
  2879. this._c = function (a, b, c, d) {
  2880. return createElement(contextVm, a, b, c, d, needNormalization);
  2881. };
  2882. }
  2883. }
  2884. installRenderHelpers(FunctionalRenderContext.prototype);
  2885. function createFunctionalComponent(
  2886. Ctor,
  2887. propsData,
  2888. data,
  2889. contextVm,
  2890. children
  2891. ) {
  2892. var options = Ctor.options;
  2893. var props = {};
  2894. var propOptions = options.props;
  2895. if (isDef(propOptions)) {
  2896. for (var key in propOptions) {
  2897. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  2898. }
  2899. } else {
  2900. if (isDef(data.attrs)) {
  2901. mergeProps(props, data.attrs);
  2902. }
  2903. if (isDef(data.props)) {
  2904. mergeProps(props, data.props);
  2905. }
  2906. }
  2907. var renderContext = new FunctionalRenderContext(
  2908. data,
  2909. props,
  2910. children,
  2911. contextVm,
  2912. Ctor
  2913. );
  2914. var vnode = options.render.call(null, renderContext._c, renderContext);
  2915. if (vnode instanceof VNode) {
  2916. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  2917. } else if (Array.isArray(vnode)) {
  2918. var vnodes = normalizeChildren(vnode) || [];
  2919. var res = new Array(vnodes.length);
  2920. for (var i = 0; i < vnodes.length; i++) {
  2921. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  2922. }
  2923. return res
  2924. }
  2925. }
  2926. function cloneAndMarkFunctionalResult(vnode, data, contextVm, options, renderContext) {
  2927. // #7817 clone node before setting fnContext, otherwise if the node is reused
  2928. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  2929. // that should not be matched to match.
  2930. var clone = cloneVNode(vnode);
  2931. clone.fnContext = contextVm;
  2932. clone.fnOptions = options; {
  2933. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  2934. }
  2935. if (data.slot) {
  2936. (clone.data || (clone.data = {})).slot = data.slot;
  2937. }
  2938. return clone
  2939. }
  2940. function mergeProps(to, from) {
  2941. for (var key in from) {
  2942. to[camelize(key)] = from[key];
  2943. }
  2944. }
  2945. /* */
  2946. /* */
  2947. /* */
  2948. /* */
  2949. // inline hooks to be invoked on component VNodes during patch
  2950. var componentVNodeHooks = {
  2951. init: function init(vnode, hydrating) {
  2952. if (
  2953. vnode.componentInstance &&
  2954. !vnode.componentInstance._isDestroyed &&
  2955. vnode.data.keepAlive
  2956. ) {
  2957. // kept-alive components, treat as a patch
  2958. var mountedNode = vnode; // work around flow
  2959. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  2960. } else {
  2961. var child = vnode.componentInstance = createComponentInstanceForVnode(
  2962. vnode,
  2963. activeInstance
  2964. );
  2965. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  2966. }
  2967. },
  2968. prepatch: function prepatch(oldVnode, vnode) {
  2969. var options = vnode.componentOptions;
  2970. var child = vnode.componentInstance = oldVnode.componentInstance;
  2971. updateChildComponent(
  2972. child,
  2973. options.propsData, // updated props
  2974. options.listeners, // updated listeners
  2975. vnode, // new parent vnode
  2976. options.children // new children
  2977. );
  2978. },
  2979. insert: function insert(vnode) {
  2980. var context = vnode.context;
  2981. var componentInstance = vnode.componentInstance;
  2982. if (!componentInstance._isMounted) {
  2983. componentInstance._isMounted = true;
  2984. callHook(componentInstance, 'mounted');
  2985. }
  2986. if (vnode.data.keepAlive) {
  2987. if (context._isMounted) {
  2988. // vue-router#1212
  2989. // During updates, a kept-alive component's child components may
  2990. // change, so directly walking the tree here may call activated hooks
  2991. // on incorrect children. Instead we push them into a queue which will
  2992. // be processed after the whole patch process ended.
  2993. queueActivatedComponent(componentInstance);
  2994. } else {
  2995. activateChildComponent(componentInstance, true /* direct */ );
  2996. }
  2997. }
  2998. },
  2999. destroy: function destroy(vnode) {
  3000. var componentInstance = vnode.componentInstance;
  3001. if (!componentInstance._isDestroyed) {
  3002. if (!vnode.data.keepAlive) {
  3003. componentInstance.$destroy();
  3004. } else {
  3005. deactivateChildComponent(componentInstance, true /* direct */ );
  3006. }
  3007. }
  3008. }
  3009. };
  3010. var hooksToMerge = Object.keys(componentVNodeHooks);
  3011. function createComponent(
  3012. Ctor,
  3013. data,
  3014. context,
  3015. children,
  3016. tag
  3017. ) {
  3018. if (isUndef(Ctor)) {
  3019. return
  3020. }
  3021. var baseCtor = context.$options._base;
  3022. // plain options object: turn it into a constructor
  3023. if (isObject(Ctor)) {
  3024. Ctor = baseCtor.extend(Ctor);
  3025. }
  3026. // if at this stage it's not a constructor or an async component factory,
  3027. // reject.
  3028. if (typeof Ctor !== 'function') {
  3029. {
  3030. warn(("Invalid Component definition: " + (String(Ctor))), context);
  3031. }
  3032. return
  3033. }
  3034. // async component
  3035. var asyncFactory;
  3036. if (isUndef(Ctor.cid)) {
  3037. asyncFactory = Ctor;
  3038. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  3039. if (Ctor === undefined) {
  3040. // return a placeholder node for async component, which is rendered
  3041. // as a comment node but preserves all the raw information for the node.
  3042. // the information will be used for async server-rendering and hydration.
  3043. return createAsyncPlaceholder(
  3044. asyncFactory,
  3045. data,
  3046. context,
  3047. children,
  3048. tag
  3049. )
  3050. }
  3051. }
  3052. data = data || {};
  3053. // resolve constructor options in case global mixins are applied after
  3054. // component constructor creation
  3055. resolveConstructorOptions(Ctor);
  3056. // transform component v-model data into props & events
  3057. if (isDef(data.model)) {
  3058. transformModel(Ctor.options, data);
  3059. }
  3060. // extract props
  3061. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  3062. // functional component
  3063. if (isTrue(Ctor.options.functional)) {
  3064. return createFunctionalComponent(Ctor, propsData, data, context, children)
  3065. }
  3066. // extract listeners, since these needs to be treated as
  3067. // child component listeners instead of DOM listeners
  3068. var listeners = data.on;
  3069. // replace with listeners with .native modifier
  3070. // so it gets processed during parent component patch.
  3071. data.on = data.nativeOn;
  3072. if (isTrue(Ctor.options.abstract)) {
  3073. // abstract components do not keep anything
  3074. // other than props & listeners & slot
  3075. // work around flow
  3076. var slot = data.slot;
  3077. data = {};
  3078. if (slot) {
  3079. data.slot = slot;
  3080. }
  3081. }
  3082. // install component management hooks onto the placeholder node
  3083. installComponentHooks(data);
  3084. // return a placeholder vnode
  3085. var name = Ctor.options.name || tag;
  3086. var vnode = new VNode(
  3087. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  3088. data, undefined, undefined, undefined, context, {
  3089. Ctor: Ctor,
  3090. propsData: propsData,
  3091. listeners: listeners,
  3092. tag: tag,
  3093. children: children
  3094. },
  3095. asyncFactory
  3096. );
  3097. return vnode
  3098. }
  3099. function createComponentInstanceForVnode(
  3100. // we know it's MountedComponentVNode but flow doesn't
  3101. vnode,
  3102. // activeInstance in lifecycle state
  3103. parent
  3104. ) {
  3105. var options = {
  3106. _isComponent: true,
  3107. _parentVnode: vnode,
  3108. parent: parent
  3109. };
  3110. // check inline-template render functions
  3111. var inlineTemplate = vnode.data.inlineTemplate;
  3112. if (isDef(inlineTemplate)) {
  3113. options.render = inlineTemplate.render;
  3114. options.staticRenderFns = inlineTemplate.staticRenderFns;
  3115. }
  3116. return new vnode.componentOptions.Ctor(options)
  3117. }
  3118. function installComponentHooks(data) {
  3119. var hooks = data.hook || (data.hook = {});
  3120. for (var i = 0; i < hooksToMerge.length; i++) {
  3121. var key = hooksToMerge[i];
  3122. var existing = hooks[key];
  3123. var toMerge = componentVNodeHooks[key];
  3124. if (existing !== toMerge && !(existing && existing._merged)) {
  3125. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  3126. }
  3127. }
  3128. }
  3129. function mergeHook$1(f1, f2) {
  3130. var merged = function (a, b) {
  3131. // flow complains about extra args which is why we use any
  3132. f1(a, b);
  3133. f2(a, b);
  3134. };
  3135. merged._merged = true;
  3136. return merged
  3137. }
  3138. // transform component v-model info (value and callback) into
  3139. // prop and event handler respectively.
  3140. function transformModel(options, data) {
  3141. var prop = (options.model && options.model.prop) || 'value';
  3142. var event = (options.model && options.model.event) || 'input';
  3143. (data.attrs || (data.attrs = {}))[prop] = data.model.value;
  3144. var on = data.on || (data.on = {});
  3145. var existing = on[event];
  3146. var callback = data.model.callback;
  3147. if (isDef(existing)) {
  3148. if (
  3149. Array.isArray(existing) ?
  3150. existing.indexOf(callback) === -1 :
  3151. existing !== callback
  3152. ) {
  3153. on[event] = [callback].concat(existing);
  3154. }
  3155. } else {
  3156. on[event] = callback;
  3157. }
  3158. }
  3159. /* */
  3160. var SIMPLE_NORMALIZE = 1;
  3161. var ALWAYS_NORMALIZE = 2;
  3162. // wrapper function for providing a more flexible interface
  3163. // without getting yelled at by flow
  3164. function createElement(
  3165. context,
  3166. tag,
  3167. data,
  3168. children,
  3169. normalizationType,
  3170. alwaysNormalize
  3171. ) {
  3172. if (Array.isArray(data) || isPrimitive(data)) {
  3173. normalizationType = children;
  3174. children = data;
  3175. data = undefined;
  3176. }
  3177. if (isTrue(alwaysNormalize)) {
  3178. normalizationType = ALWAYS_NORMALIZE;
  3179. }
  3180. return _createElement(context, tag, data, children, normalizationType)
  3181. }
  3182. function _createElement(
  3183. context,
  3184. tag,
  3185. data,
  3186. children,
  3187. normalizationType
  3188. ) {
  3189. if (isDef(data) && isDef((data).__ob__)) {
  3190. warn(
  3191. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  3192. 'Always create fresh vnode data objects in each render!',
  3193. context
  3194. );
  3195. return createEmptyVNode()
  3196. }
  3197. // object syntax in v-bind
  3198. if (isDef(data) && isDef(data.is)) {
  3199. tag = data.is;
  3200. }
  3201. if (!tag) {
  3202. // in case of component :is set to falsy value
  3203. return createEmptyVNode()
  3204. }
  3205. // warn against non-primitive key
  3206. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)) {
  3207. {
  3208. warn(
  3209. 'Avoid using non-primitive value as key, ' +
  3210. 'use string/number value instead.',
  3211. context
  3212. );
  3213. }
  3214. }
  3215. // support single function children as default scoped slot
  3216. if (Array.isArray(children) &&
  3217. typeof children[0] === 'function'
  3218. ) {
  3219. data = data || {};
  3220. data.scopedSlots = {
  3221. default: children[0]
  3222. };
  3223. children.length = 0;
  3224. }
  3225. if (normalizationType === ALWAYS_NORMALIZE) {
  3226. children = normalizeChildren(children);
  3227. } else if (normalizationType === SIMPLE_NORMALIZE) {
  3228. children = simpleNormalizeChildren(children);
  3229. }
  3230. var vnode, ns;
  3231. if (typeof tag === 'string') {
  3232. var Ctor;
  3233. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  3234. if (config.isReservedTag(tag)) {
  3235. // platform built-in elements
  3236. if (isDef(data) && isDef(data.nativeOn) && data.tag !== 'component') {
  3237. warn(
  3238. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  3239. context
  3240. );
  3241. }
  3242. vnode = new VNode(
  3243. config.parsePlatformTagName(tag), data, children,
  3244. undefined, undefined, context
  3245. );
  3246. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  3247. // component
  3248. vnode = createComponent(Ctor, data, context, children, tag);
  3249. } else {
  3250. // unknown or unlisted namespaced elements
  3251. // check at runtime because it may get assigned a namespace when its
  3252. // parent normalizes children
  3253. vnode = new VNode(
  3254. tag, data, children,
  3255. undefined, undefined, context
  3256. );
  3257. }
  3258. } else {
  3259. // direct component options / constructor
  3260. vnode = createComponent(tag, data, context, children);
  3261. }
  3262. if (Array.isArray(vnode)) {
  3263. return vnode
  3264. } else if (isDef(vnode)) {
  3265. if (isDef(ns)) {
  3266. applyNS(vnode, ns);
  3267. }
  3268. if (isDef(data)) {
  3269. registerDeepBindings(data);
  3270. }
  3271. return vnode
  3272. } else {
  3273. return createEmptyVNode()
  3274. }
  3275. }
  3276. function applyNS(vnode, ns, force) {
  3277. vnode.ns = ns;
  3278. if (vnode.tag === 'foreignObject') {
  3279. // use default namespace inside foreignObject
  3280. ns = undefined;
  3281. force = true;
  3282. }
  3283. if (isDef(vnode.children)) {
  3284. for (var i = 0, l = vnode.children.length; i < l; i++) {
  3285. var child = vnode.children[i];
  3286. if (isDef(child.tag) && (
  3287. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  3288. applyNS(child, ns, force);
  3289. }
  3290. }
  3291. }
  3292. }
  3293. // ref #5318
  3294. // necessary to ensure parent re-render when deep bindings like :style and
  3295. // :class are used on slot nodes
  3296. function registerDeepBindings(data) {
  3297. if (isObject(data.style)) {
  3298. traverse(data.style);
  3299. }
  3300. if (isObject(data.class)) {
  3301. traverse(data.class);
  3302. }
  3303. }
  3304. /* */
  3305. function initRender(vm) {
  3306. vm._vnode = null; // the root of the child tree
  3307. vm._staticTrees = null; // v-once cached trees
  3308. var options = vm.$options;
  3309. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  3310. var renderContext = parentVnode && parentVnode.context;
  3311. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  3312. vm.$scopedSlots = emptyObject;
  3313. // bind the createElement fn to this instance
  3314. // so that we get proper render context inside it.
  3315. // args order: tag, data, children, normalizationType, alwaysNormalize
  3316. // internal version is used by render functions compiled from templates
  3317. vm._c = function (a, b, c, d) {
  3318. return createElement(vm, a, b, c, d, false);
  3319. };
  3320. // normalization is always applied for the public version, used in
  3321. // user-written render functions.
  3322. vm.$createElement = function (a, b, c, d) {
  3323. return createElement(vm, a, b, c, d, true);
  3324. };
  3325. // $attrs & $listeners are exposed for easier HOC creation.
  3326. // they need to be reactive so that HOCs using them are always updated
  3327. var parentData = parentVnode && parentVnode.data;
  3328. /* istanbul ignore else */
  3329. {
  3330. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  3331. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  3332. }, true);
  3333. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  3334. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  3335. }, true);
  3336. }
  3337. }
  3338. var currentRenderingInstance = null;
  3339. function renderMixin(Vue) {
  3340. // install runtime convenience helpers
  3341. installRenderHelpers(Vue.prototype);
  3342. Vue.prototype.$nextTick = function (fn) {
  3343. return nextTick(fn, this)
  3344. };
  3345. Vue.prototype._render = function () {
  3346. var vm = this;
  3347. var ref = vm.$options;
  3348. var render = ref.render;
  3349. var _parentVnode = ref._parentVnode;
  3350. if (_parentVnode) {
  3351. vm.$scopedSlots = normalizeScopedSlots(
  3352. _parentVnode.data.scopedSlots,
  3353. vm.$slots,
  3354. vm.$scopedSlots
  3355. );
  3356. }
  3357. // set parent vnode. this allows render functions to have access
  3358. // to the data on the placeholder node.
  3359. vm.$vnode = _parentVnode;
  3360. // render self
  3361. var vnode;
  3362. try {
  3363. // There's no need to maintain a stack because all render fns are called
  3364. // separately from one another. Nested component's render fns are called
  3365. // when parent component is patched.
  3366. currentRenderingInstance = vm;
  3367. vnode = render.call(vm._renderProxy, vm.$createElement);
  3368. } catch (e) {
  3369. handleError(e, vm, "render");
  3370. // return error render result,
  3371. // or previous vnode to prevent render error causing blank component
  3372. /* istanbul ignore else */
  3373. if (vm.$options.renderError) {
  3374. try {
  3375. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  3376. } catch (e) {
  3377. handleError(e, vm, "renderError");
  3378. vnode = vm._vnode;
  3379. }
  3380. } else {
  3381. vnode = vm._vnode;
  3382. }
  3383. } finally {
  3384. currentRenderingInstance = null;
  3385. }
  3386. // if the returned array contains only a single node, allow it
  3387. if (Array.isArray(vnode) && vnode.length === 1) {
  3388. vnode = vnode[0];
  3389. }
  3390. // return empty vnode in case the render function errored out
  3391. if (!(vnode instanceof VNode)) {
  3392. if (Array.isArray(vnode)) {
  3393. warn(
  3394. 'Multiple root nodes returned from render function. Render function ' +
  3395. 'should return a single root node.',
  3396. vm
  3397. );
  3398. }
  3399. vnode = createEmptyVNode();
  3400. }
  3401. // set parent
  3402. vnode.parent = _parentVnode;
  3403. return vnode
  3404. };
  3405. }
  3406. /* */
  3407. function ensureCtor(comp, base) {
  3408. if (
  3409. comp.__esModule ||
  3410. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  3411. ) {
  3412. comp = comp.default;
  3413. }
  3414. return isObject(comp) ?
  3415. base.extend(comp) :
  3416. comp
  3417. }
  3418. function createAsyncPlaceholder(
  3419. factory,
  3420. data,
  3421. context,
  3422. children,
  3423. tag
  3424. ) {
  3425. var node = createEmptyVNode();
  3426. node.asyncFactory = factory;
  3427. node.asyncMeta = {
  3428. data: data,
  3429. context: context,
  3430. children: children,
  3431. tag: tag
  3432. };
  3433. return node
  3434. }
  3435. function resolveAsyncComponent(
  3436. factory,
  3437. baseCtor
  3438. ) {
  3439. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  3440. return factory.errorComp
  3441. }
  3442. if (isDef(factory.resolved)) {
  3443. return factory.resolved
  3444. }
  3445. var owner = currentRenderingInstance;
  3446. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  3447. // already pending
  3448. factory.owners.push(owner);
  3449. }
  3450. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  3451. return factory.loadingComp
  3452. }
  3453. if (owner && !isDef(factory.owners)) {
  3454. var owners = factory.owners = [owner];
  3455. var sync = true;
  3456. var timerLoading = null;
  3457. var timerTimeout = null
  3458. ;
  3459. (owner).$on('hook:destroyed', function () {
  3460. return remove(owners, owner);
  3461. });
  3462. var forceRender = function (renderCompleted) {
  3463. for (var i = 0, l = owners.length; i < l; i++) {
  3464. (owners[i]).$forceUpdate();
  3465. }
  3466. if (renderCompleted) {
  3467. owners.length = 0;
  3468. if (timerLoading !== null) {
  3469. clearTimeout(timerLoading);
  3470. timerLoading = null;
  3471. }
  3472. if (timerTimeout !== null) {
  3473. clearTimeout(timerTimeout);
  3474. timerTimeout = null;
  3475. }
  3476. }
  3477. };
  3478. var resolve = once(function (res) {
  3479. // cache resolved
  3480. factory.resolved = ensureCtor(res, baseCtor);
  3481. // invoke callbacks only if this is not a synchronous resolve
  3482. // (async resolves are shimmed as synchronous during SSR)
  3483. if (!sync) {
  3484. forceRender(true);
  3485. } else {
  3486. owners.length = 0;
  3487. }
  3488. });
  3489. var reject = once(function (reason) {
  3490. warn(
  3491. "Failed to resolve async component: " + (String(factory)) +
  3492. (reason ? ("\nReason: " + reason) : '')
  3493. );
  3494. if (isDef(factory.errorComp)) {
  3495. factory.error = true;
  3496. forceRender(true);
  3497. }
  3498. });
  3499. var res = factory(resolve, reject);
  3500. if (isObject(res)) {
  3501. if (isPromise(res)) {
  3502. // () => Promise
  3503. if (isUndef(factory.resolved)) {
  3504. res.then(resolve, reject);
  3505. }
  3506. } else if (isPromise(res.component)) {
  3507. res.component.then(resolve, reject);
  3508. if (isDef(res.error)) {
  3509. factory.errorComp = ensureCtor(res.error, baseCtor);
  3510. }
  3511. if (isDef(res.loading)) {
  3512. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  3513. if (res.delay === 0) {
  3514. factory.loading = true;
  3515. } else {
  3516. timerLoading = setTimeout(function () {
  3517. timerLoading = null;
  3518. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  3519. factory.loading = true;
  3520. forceRender(false);
  3521. }
  3522. }, res.delay || 200);
  3523. }
  3524. }
  3525. if (isDef(res.timeout)) {
  3526. timerTimeout = setTimeout(function () {
  3527. timerTimeout = null;
  3528. if (isUndef(factory.resolved)) {
  3529. reject(
  3530. "timeout (" + (res.timeout) + "ms)"
  3531. );
  3532. }
  3533. }, res.timeout);
  3534. }
  3535. }
  3536. }
  3537. sync = false;
  3538. // return in case resolved synchronously
  3539. return factory.loading ?
  3540. factory.loadingComp :
  3541. factory.resolved
  3542. }
  3543. }
  3544. /* */
  3545. function getFirstComponentChild(children) {
  3546. if (Array.isArray(children)) {
  3547. for (var i = 0; i < children.length; i++) {
  3548. var c = children[i];
  3549. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  3550. return c
  3551. }
  3552. }
  3553. }
  3554. }
  3555. /* */
  3556. /* */
  3557. function initEvents(vm) {
  3558. vm._events = Object.create(null);
  3559. vm._hasHookEvent = false;
  3560. // init parent attached events
  3561. var listeners = vm.$options._parentListeners;
  3562. if (listeners) {
  3563. updateComponentListeners(vm, listeners);
  3564. }
  3565. }
  3566. var target;
  3567. function add(event, fn) {
  3568. target.$on(event, fn);
  3569. }
  3570. function remove$1(event, fn) {
  3571. target.$off(event, fn);
  3572. }
  3573. function createOnceHandler(event, fn) {
  3574. var _target = target;
  3575. return function onceHandler() {
  3576. var res = fn.apply(null, arguments);
  3577. if (res !== null) {
  3578. _target.$off(event, onceHandler);
  3579. }
  3580. }
  3581. }
  3582. function updateComponentListeners(
  3583. vm,
  3584. listeners,
  3585. oldListeners
  3586. ) {
  3587. target = vm;
  3588. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  3589. target = undefined;
  3590. }
  3591. function eventsMixin(Vue) {
  3592. var hookRE = /^hook:/;
  3593. Vue.prototype.$on = function (event, fn) {
  3594. var vm = this;
  3595. if (Array.isArray(event)) {
  3596. for (var i = 0, l = event.length; i < l; i++) {
  3597. vm.$on(event[i], fn);
  3598. }
  3599. } else {
  3600. (vm._events[event] || (vm._events[event] = [])).push(fn);
  3601. // optimize hook:event cost by using a boolean flag marked at registration
  3602. // instead of a hash lookup
  3603. if (hookRE.test(event)) {
  3604. vm._hasHookEvent = true;
  3605. }
  3606. }
  3607. return vm
  3608. };
  3609. Vue.prototype.$once = function (event, fn) {
  3610. var vm = this;
  3611. function on() {
  3612. vm.$off(event, on);
  3613. fn.apply(vm, arguments);
  3614. }
  3615. on.fn = fn;
  3616. vm.$on(event, on);
  3617. return vm
  3618. };
  3619. Vue.prototype.$off = function (event, fn) {
  3620. var vm = this;
  3621. // all
  3622. if (!arguments.length) {
  3623. vm._events = Object.create(null);
  3624. return vm
  3625. }
  3626. // array of events
  3627. if (Array.isArray(event)) {
  3628. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  3629. vm.$off(event[i$1], fn);
  3630. }
  3631. return vm
  3632. }
  3633. // specific event
  3634. var cbs = vm._events[event];
  3635. if (!cbs) {
  3636. return vm
  3637. }
  3638. if (!fn) {
  3639. vm._events[event] = null;
  3640. return vm
  3641. }
  3642. // specific handler
  3643. var cb;
  3644. var i = cbs.length;
  3645. while (i--) {
  3646. cb = cbs[i];
  3647. if (cb === fn || cb.fn === fn) {
  3648. cbs.splice(i, 1);
  3649. break
  3650. }
  3651. }
  3652. return vm
  3653. };
  3654. Vue.prototype.$emit = function (event) {
  3655. var vm = this; {
  3656. var lowerCaseEvent = event.toLowerCase();
  3657. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  3658. tip(
  3659. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  3660. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  3661. "Note that HTML attributes are case-insensitive and you cannot use " +
  3662. "v-on to listen to camelCase events when using in-DOM templates. " +
  3663. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  3664. );
  3665. }
  3666. }
  3667. var cbs = vm._events[event];
  3668. if (cbs) {
  3669. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  3670. var args = toArray(arguments, 1);
  3671. var info = "event handler for \"" + event + "\"";
  3672. for (var i = 0, l = cbs.length; i < l; i++) {
  3673. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  3674. }
  3675. }
  3676. return vm
  3677. };
  3678. }
  3679. /* */
  3680. var activeInstance = null;
  3681. var isUpdatingChildComponent = false;
  3682. function setActiveInstance(vm) {
  3683. var prevActiveInstance = activeInstance;
  3684. activeInstance = vm;
  3685. return function () {
  3686. activeInstance = prevActiveInstance;
  3687. }
  3688. }
  3689. function initLifecycle(vm) {
  3690. var options = vm.$options;
  3691. // locate first non-abstract parent
  3692. var parent = options.parent;
  3693. if (parent && !options.abstract) {
  3694. while (parent.$options.abstract && parent.$parent) {
  3695. parent = parent.$parent;
  3696. }
  3697. parent.$children.push(vm);
  3698. }
  3699. vm.$parent = parent;
  3700. vm.$root = parent ? parent.$root : vm;
  3701. vm.$children = [];
  3702. vm.$refs = {};
  3703. vm._watcher = null;
  3704. vm._inactive = null;
  3705. vm._directInactive = false;
  3706. vm._isMounted = false;
  3707. vm._isDestroyed = false;
  3708. vm._isBeingDestroyed = false;
  3709. }
  3710. function lifecycleMixin(Vue) {
  3711. Vue.prototype._update = function (vnode, hydrating) {
  3712. var vm = this;
  3713. var prevEl = vm.$el;
  3714. var prevVnode = vm._vnode;
  3715. var restoreActiveInstance = setActiveInstance(vm);
  3716. vm._vnode = vnode;
  3717. // Vue.prototype.__patch__ is injected in entry points
  3718. // based on the rendering backend used.
  3719. if (!prevVnode) {
  3720. // initial render
  3721. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */ );
  3722. } else {
  3723. // updates
  3724. vm.$el = vm.__patch__(prevVnode, vnode);
  3725. }
  3726. restoreActiveInstance();
  3727. // update __vue__ reference
  3728. if (prevEl) {
  3729. prevEl.__vue__ = null;
  3730. }
  3731. if (vm.$el) {
  3732. vm.$el.__vue__ = vm;
  3733. }
  3734. // if parent is an HOC, update its $el as well
  3735. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  3736. vm.$parent.$el = vm.$el;
  3737. }
  3738. // updated hook is called by the scheduler to ensure that children are
  3739. // updated in a parent's updated hook.
  3740. };
  3741. Vue.prototype.$forceUpdate = function () {
  3742. var vm = this;
  3743. if (vm._watcher) {
  3744. vm._watcher.update();
  3745. }
  3746. };
  3747. Vue.prototype.$destroy = function () {
  3748. var vm = this;
  3749. if (vm._isBeingDestroyed) {
  3750. return
  3751. }
  3752. callHook(vm, 'beforeDestroy');
  3753. vm._isBeingDestroyed = true;
  3754. // remove self from parent
  3755. var parent = vm.$parent;
  3756. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  3757. remove(parent.$children, vm);
  3758. }
  3759. // teardown watchers
  3760. if (vm._watcher) {
  3761. vm._watcher.teardown();
  3762. }
  3763. var i = vm._watchers.length;
  3764. while (i--) {
  3765. vm._watchers[i].teardown();
  3766. }
  3767. // remove reference from data ob
  3768. // frozen object may not have observer.
  3769. if (vm._data.__ob__) {
  3770. vm._data.__ob__.vmCount--;
  3771. }
  3772. // call the last hook...
  3773. vm._isDestroyed = true;
  3774. // invoke destroy hooks on current rendered tree
  3775. vm.__patch__(vm._vnode, null);
  3776. // fire destroyed hook
  3777. callHook(vm, 'destroyed');
  3778. // turn off all instance listeners.
  3779. vm.$off();
  3780. // remove __vue__ reference
  3781. if (vm.$el) {
  3782. vm.$el.__vue__ = null;
  3783. }
  3784. // release circular reference (#6759)
  3785. if (vm.$vnode) {
  3786. vm.$vnode.parent = null;
  3787. }
  3788. };
  3789. }
  3790. function mountComponent(
  3791. vm,
  3792. el,
  3793. hydrating
  3794. ) {
  3795. vm.$el = el;
  3796. if (!vm.$options.render) {
  3797. vm.$options.render = createEmptyVNode; {
  3798. /* istanbul ignore if */
  3799. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  3800. vm.$options.el || el) {
  3801. warn(
  3802. 'You are using the runtime-only build of Vue where the template ' +
  3803. 'compiler is not available. Either pre-compile the templates into ' +
  3804. 'render functions, or use the compiler-included build.',
  3805. vm
  3806. );
  3807. } else {
  3808. warn(
  3809. 'Failed to mount component: template or render function not defined.',
  3810. vm
  3811. );
  3812. }
  3813. }
  3814. }
  3815. callHook(vm, 'beforeMount');
  3816. var updateComponent;
  3817. /* istanbul ignore if */
  3818. if (config.performance && mark) {
  3819. updateComponent = function () {
  3820. var name = vm._name;
  3821. var id = vm._uid;
  3822. var startTag = "vue-perf-start:" + id;
  3823. var endTag = "vue-perf-end:" + id;
  3824. mark(startTag);
  3825. var vnode = vm._render();
  3826. mark(endTag);
  3827. measure(("vue " + name + " render"), startTag, endTag);
  3828. mark(startTag);
  3829. vm._update(vnode, hydrating);
  3830. mark(endTag);
  3831. measure(("vue " + name + " patch"), startTag, endTag);
  3832. };
  3833. } else {
  3834. updateComponent = function () {
  3835. vm._update(vm._render(), hydrating);
  3836. };
  3837. }
  3838. // we set this to vm._watcher inside the watcher's constructor
  3839. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  3840. // component's mounted hook), which relies on vm._watcher being already defined
  3841. new Watcher(vm, updateComponent, noop, {
  3842. before: function before() {
  3843. if (vm._isMounted && !vm._isDestroyed) {
  3844. callHook(vm, 'beforeUpdate');
  3845. }
  3846. }
  3847. }, true /* isRenderWatcher */ );
  3848. hydrating = false;
  3849. // manually mounted instance, call mounted on self
  3850. // mounted is called for render-created child components in its inserted hook
  3851. if (vm.$vnode == null) {
  3852. vm._isMounted = true;
  3853. callHook(vm, 'mounted');
  3854. }
  3855. return vm
  3856. }
  3857. function updateChildComponent(
  3858. vm,
  3859. propsData,
  3860. listeners,
  3861. parentVnode,
  3862. renderChildren
  3863. ) {
  3864. {
  3865. isUpdatingChildComponent = true;
  3866. }
  3867. // determine whether component has slot children
  3868. // we need to do this before overwriting $options._renderChildren.
  3869. // check if there are dynamic scopedSlots (hand-written or compiled but with
  3870. // dynamic slot names). Static scoped slots compiled from template has the
  3871. // "$stable" marker.
  3872. var newScopedSlots = parentVnode.data.scopedSlots;
  3873. var oldScopedSlots = vm.$scopedSlots;
  3874. var hasDynamicScopedSlot = !!(
  3875. (newScopedSlots && !newScopedSlots.$stable) ||
  3876. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  3877. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
  3878. (!newScopedSlots && vm.$scopedSlots.$key)
  3879. );
  3880. // Any static slot children from the parent may have changed during parent's
  3881. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  3882. // update is necessary to ensure correctness.
  3883. var needsForceUpdate = !!(
  3884. renderChildren || // has new static slots
  3885. vm.$options._renderChildren || // has old static slots
  3886. hasDynamicScopedSlot
  3887. );
  3888. vm.$options._parentVnode = parentVnode;
  3889. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  3890. if (vm._vnode) { // update child tree's parent
  3891. vm._vnode.parent = parentVnode;
  3892. }
  3893. vm.$options._renderChildren = renderChildren;
  3894. // update $attrs and $listeners hash
  3895. // these are also reactive so they may trigger child update if the child
  3896. // used them during render
  3897. vm.$attrs = parentVnode.data.attrs || emptyObject;
  3898. vm.$listeners = listeners || emptyObject;
  3899. // update props
  3900. if (propsData && vm.$options.props) {
  3901. toggleObserving(false);
  3902. var props = vm._props;
  3903. var propKeys = vm.$options._propKeys || [];
  3904. for (var i = 0; i < propKeys.length; i++) {
  3905. var key = propKeys[i];
  3906. var propOptions = vm.$options.props; // wtf flow?
  3907. props[key] = validateProp(key, propOptions, propsData, vm);
  3908. }
  3909. toggleObserving(true);
  3910. // keep a copy of raw propsData
  3911. vm.$options.propsData = propsData;
  3912. }
  3913. // update listeners
  3914. listeners = listeners || emptyObject;
  3915. var oldListeners = vm.$options._parentListeners;
  3916. vm.$options._parentListeners = listeners;
  3917. updateComponentListeners(vm, listeners, oldListeners);
  3918. // resolve slots + force update if has children
  3919. if (needsForceUpdate) {
  3920. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  3921. vm.$forceUpdate();
  3922. }
  3923. {
  3924. isUpdatingChildComponent = false;
  3925. }
  3926. }
  3927. function isInInactiveTree(vm) {
  3928. while (vm && (vm = vm.$parent)) {
  3929. if (vm._inactive) {
  3930. return true
  3931. }
  3932. }
  3933. return false
  3934. }
  3935. function activateChildComponent(vm, direct) {
  3936. if (direct) {
  3937. vm._directInactive = false;
  3938. if (isInInactiveTree(vm)) {
  3939. return
  3940. }
  3941. } else if (vm._directInactive) {
  3942. return
  3943. }
  3944. if (vm._inactive || vm._inactive === null) {
  3945. vm._inactive = false;
  3946. for (var i = 0; i < vm.$children.length; i++) {
  3947. activateChildComponent(vm.$children[i]);
  3948. }
  3949. callHook(vm, 'activated');
  3950. }
  3951. }
  3952. function deactivateChildComponent(vm, direct) {
  3953. if (direct) {
  3954. vm._directInactive = true;
  3955. if (isInInactiveTree(vm)) {
  3956. return
  3957. }
  3958. }
  3959. if (!vm._inactive) {
  3960. vm._inactive = true;
  3961. for (var i = 0; i < vm.$children.length; i++) {
  3962. deactivateChildComponent(vm.$children[i]);
  3963. }
  3964. callHook(vm, 'deactivated');
  3965. }
  3966. }
  3967. function callHook(vm, hook) {
  3968. // #7573 disable dep collection when invoking lifecycle hooks
  3969. pushTarget();
  3970. var handlers = vm.$options[hook];
  3971. var info = hook + " hook";
  3972. if (handlers) {
  3973. for (var i = 0, j = handlers.length; i < j; i++) {
  3974. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  3975. }
  3976. }
  3977. if (vm._hasHookEvent) {
  3978. vm.$emit('hook:' + hook);
  3979. }
  3980. popTarget();
  3981. }
  3982. /* */
  3983. var MAX_UPDATE_COUNT = 100;
  3984. var queue = [];
  3985. var activatedChildren = [];
  3986. var has = {};
  3987. var circular = {};
  3988. var waiting = false;
  3989. var flushing = false;
  3990. var index = 0;
  3991. /**
  3992. * Reset the scheduler's state.
  3993. */
  3994. function resetSchedulerState() {
  3995. index = queue.length = activatedChildren.length = 0;
  3996. has = {}; {
  3997. circular = {};
  3998. }
  3999. waiting = flushing = false;
  4000. }
  4001. // Async edge case #6566 requires saving the timestamp when event listeners are
  4002. // attached. However, calling performance.now() has a perf overhead especially
  4003. // if the page has thousands of event listeners. Instead, we take a timestamp
  4004. // every time the scheduler flushes and use that for all event listeners
  4005. // attached during that flush.
  4006. var currentFlushTimestamp = 0;
  4007. // Async edge case fix requires storing an event listener's attach timestamp.
  4008. var getNow = Date.now;
  4009. // Determine what event timestamp the browser is using. Annoyingly, the
  4010. // timestamp can either be hi-res (relative to page load) or low-res
  4011. // (relative to UNIX epoch), so in order to compare time we have to use the
  4012. // same timestamp type when saving the flush timestamp.
  4013. // All IE versions use low-res event timestamps, and have problematic clock
  4014. // implementations (#9632)
  4015. if (inBrowser && !isIE) {
  4016. var performance = window.performance;
  4017. if (
  4018. performance &&
  4019. typeof performance.now === 'function' &&
  4020. getNow() > document.createEvent('Event').timeStamp
  4021. ) {
  4022. // if the event timestamp, although evaluated AFTER the Date.now(), is
  4023. // smaller than it, it means the event is using a hi-res timestamp,
  4024. // and we need to use the hi-res version for event listener timestamps as
  4025. // well.
  4026. getNow = function () {
  4027. return performance.now();
  4028. };
  4029. }
  4030. }
  4031. /**
  4032. * Flush both queues and run the watchers.
  4033. */
  4034. function flushSchedulerQueue() {
  4035. currentFlushTimestamp = getNow();
  4036. flushing = true;
  4037. var watcher, id;
  4038. // Sort queue before flush.
  4039. // This ensures that:
  4040. // 1. Components are updated from parent to child. (because parent is always
  4041. // created before the child)
  4042. // 2. A component's user watchers are run before its render watcher (because
  4043. // user watchers are created before the render watcher)
  4044. // 3. If a component is destroyed during a parent component's watcher run,
  4045. // its watchers can be skipped.
  4046. queue.sort(function (a, b) {
  4047. return a.id - b.id;
  4048. });
  4049. // do not cache length because more watchers might be pushed
  4050. // as we run existing watchers
  4051. for (index = 0; index < queue.length; index++) {
  4052. watcher = queue[index];
  4053. if (watcher.before) {
  4054. watcher.before();
  4055. }
  4056. id = watcher.id;
  4057. has[id] = null;
  4058. watcher.run();
  4059. // in dev build, check and stop circular updates.
  4060. if (has[id] != null) {
  4061. circular[id] = (circular[id] || 0) + 1;
  4062. if (circular[id] > MAX_UPDATE_COUNT) {
  4063. warn(
  4064. 'You may have an infinite update loop ' + (
  4065. watcher.user ?
  4066. ("in watcher with expression \"" + (watcher.expression) + "\"") :
  4067. "in a component render function."
  4068. ),
  4069. watcher.vm
  4070. );
  4071. break
  4072. }
  4073. }
  4074. }
  4075. // keep copies of post queues before resetting state
  4076. var activatedQueue = activatedChildren.slice();
  4077. var updatedQueue = queue.slice();
  4078. resetSchedulerState();
  4079. // call component updated and activated hooks
  4080. callActivatedHooks(activatedQueue);
  4081. callUpdatedHooks(updatedQueue);
  4082. // devtool hook
  4083. /* istanbul ignore if */
  4084. if (devtools && config.devtools) {
  4085. devtools.emit('flush');
  4086. }
  4087. }
  4088. function callUpdatedHooks(queue) {
  4089. var i = queue.length;
  4090. while (i--) {
  4091. var watcher = queue[i];
  4092. var vm = watcher.vm;
  4093. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  4094. callHook(vm, 'updated');
  4095. }
  4096. }
  4097. }
  4098. /**
  4099. * Queue a kept-alive component that was activated during patch.
  4100. * The queue will be processed after the entire tree has been patched.
  4101. */
  4102. function queueActivatedComponent(vm) {
  4103. // setting _inactive to false here so that a render function can
  4104. // rely on checking whether it's in an inactive tree (e.g. router-view)
  4105. vm._inactive = false;
  4106. activatedChildren.push(vm);
  4107. }
  4108. function callActivatedHooks(queue) {
  4109. for (var i = 0; i < queue.length; i++) {
  4110. queue[i]._inactive = true;
  4111. activateChildComponent(queue[i], true /* true */ );
  4112. }
  4113. }
  4114. /**
  4115. * Push a watcher into the watcher queue.
  4116. * Jobs with duplicate IDs will be skipped unless it's
  4117. * pushed when the queue is being flushed.
  4118. */
  4119. function queueWatcher(watcher) {
  4120. var id = watcher.id;
  4121. if (has[id] == null) {
  4122. has[id] = true;
  4123. if (!flushing) {
  4124. queue.push(watcher);
  4125. } else {
  4126. // if already flushing, splice the watcher based on its id
  4127. // if already past its id, it will be run next immediately.
  4128. var i = queue.length - 1;
  4129. while (i > index && queue[i].id > watcher.id) {
  4130. i--;
  4131. }
  4132. queue.splice(i + 1, 0, watcher);
  4133. }
  4134. // queue the flush
  4135. if (!waiting) {
  4136. waiting = true;
  4137. if (!config.async) {
  4138. flushSchedulerQueue();
  4139. return
  4140. }
  4141. nextTick(flushSchedulerQueue);
  4142. }
  4143. }
  4144. }
  4145. /* */
  4146. var uid$2 = 0;
  4147. /**
  4148. * A watcher parses an expression, collects dependencies,
  4149. * and fires callback when the expression value changes.
  4150. * This is used for both the $watch() api and directives.
  4151. */
  4152. var Watcher = function Watcher(
  4153. vm,
  4154. expOrFn,
  4155. cb,
  4156. options,
  4157. isRenderWatcher
  4158. ) {
  4159. this.vm = vm;
  4160. if (isRenderWatcher) {
  4161. vm._watcher = this;
  4162. }
  4163. vm._watchers.push(this);
  4164. // options
  4165. if (options) {
  4166. this.deep = !!options.deep;
  4167. this.user = !!options.user;
  4168. this.lazy = !!options.lazy;
  4169. this.sync = !!options.sync;
  4170. this.before = options.before;
  4171. } else {
  4172. this.deep = this.user = this.lazy = this.sync = false;
  4173. }
  4174. this.cb = cb;
  4175. this.id = ++uid$2; // uid for batching
  4176. this.active = true;
  4177. this.dirty = this.lazy; // for lazy watchers
  4178. this.deps = [];
  4179. this.newDeps = [];
  4180. this.depIds = new _Set();
  4181. this.newDepIds = new _Set();
  4182. this.expression = expOrFn.toString();
  4183. // parse expression for getter
  4184. if (typeof expOrFn === 'function') {
  4185. this.getter = expOrFn;
  4186. } else {
  4187. this.getter = parsePath(expOrFn);
  4188. if (!this.getter) {
  4189. this.getter = noop;
  4190. warn(
  4191. "Failed watching path: \"" + expOrFn + "\" " +
  4192. 'Watcher only accepts simple dot-delimited paths. ' +
  4193. 'For full control, use a function instead.',
  4194. vm
  4195. );
  4196. }
  4197. }
  4198. this.value = this.lazy ?
  4199. undefined :
  4200. this.get();
  4201. };
  4202. /**
  4203. * Evaluate the getter, and re-collect dependencies.
  4204. */
  4205. Watcher.prototype.get = function get() {
  4206. pushTarget(this);
  4207. var value;
  4208. var vm = this.vm;
  4209. try {
  4210. value = this.getter.call(vm, vm);
  4211. } catch (e) {
  4212. if (this.user) {
  4213. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  4214. } else {
  4215. throw e
  4216. }
  4217. } finally {
  4218. // "touch" every property so they are all tracked as
  4219. // dependencies for deep watching
  4220. if (this.deep) {
  4221. traverse(value);
  4222. }
  4223. popTarget();
  4224. this.cleanupDeps();
  4225. }
  4226. return value
  4227. };
  4228. /**
  4229. * Add a dependency to this directive.
  4230. */
  4231. Watcher.prototype.addDep = function addDep(dep) {
  4232. var id = dep.id;
  4233. if (!this.newDepIds.has(id)) {
  4234. this.newDepIds.add(id);
  4235. this.newDeps.push(dep);
  4236. if (!this.depIds.has(id)) {
  4237. dep.addSub(this);
  4238. }
  4239. }
  4240. };
  4241. /**
  4242. * Clean up for dependency collection.
  4243. */
  4244. Watcher.prototype.cleanupDeps = function cleanupDeps() {
  4245. var i = this.deps.length;
  4246. while (i--) {
  4247. var dep = this.deps[i];
  4248. if (!this.newDepIds.has(dep.id)) {
  4249. dep.removeSub(this);
  4250. }
  4251. }
  4252. var tmp = this.depIds;
  4253. this.depIds = this.newDepIds;
  4254. this.newDepIds = tmp;
  4255. this.newDepIds.clear();
  4256. tmp = this.deps;
  4257. this.deps = this.newDeps;
  4258. this.newDeps = tmp;
  4259. this.newDeps.length = 0;
  4260. };
  4261. /**
  4262. * Subscriber interface.
  4263. * Will be called when a dependency changes.
  4264. */
  4265. Watcher.prototype.update = function update() {
  4266. /* istanbul ignore else */
  4267. if (this.lazy) {
  4268. this.dirty = true;
  4269. } else if (this.sync) {
  4270. this.run();
  4271. } else {
  4272. queueWatcher(this);
  4273. }
  4274. };
  4275. /**
  4276. * Scheduler job interface.
  4277. * Will be called by the scheduler.
  4278. */
  4279. Watcher.prototype.run = function run() {
  4280. if (this.active) {
  4281. var value = this.get();
  4282. if (
  4283. value !== this.value ||
  4284. // Deep watchers and watchers on Object/Arrays should fire even
  4285. // when the value is the same, because the value may
  4286. // have mutated.
  4287. isObject(value) ||
  4288. this.deep
  4289. ) {
  4290. // set new value
  4291. var oldValue = this.value;
  4292. this.value = value;
  4293. if (this.user) {
  4294. var info = "callback for watcher \"" + (this.expression) + "\"";
  4295. invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info);
  4296. } else {
  4297. this.cb.call(this.vm, value, oldValue);
  4298. }
  4299. }
  4300. }
  4301. };
  4302. /**
  4303. * Evaluate the value of the watcher.
  4304. * This only gets called for lazy watchers.
  4305. */
  4306. Watcher.prototype.evaluate = function evaluate() {
  4307. this.value = this.get();
  4308. this.dirty = false;
  4309. };
  4310. /**
  4311. * Depend on all deps collected by this watcher.
  4312. */
  4313. Watcher.prototype.depend = function depend() {
  4314. var i = this.deps.length;
  4315. while (i--) {
  4316. this.deps[i].depend();
  4317. }
  4318. };
  4319. /**
  4320. * Remove self from all dependencies' subscriber list.
  4321. */
  4322. Watcher.prototype.teardown = function teardown() {
  4323. if (this.active) {
  4324. // remove self from vm's watcher list
  4325. // this is a somewhat expensive operation so we skip it
  4326. // if the vm is being destroyed.
  4327. if (!this.vm._isBeingDestroyed) {
  4328. remove(this.vm._watchers, this);
  4329. }
  4330. var i = this.deps.length;
  4331. while (i--) {
  4332. this.deps[i].removeSub(this);
  4333. }
  4334. this.active = false;
  4335. }
  4336. };
  4337. /* */
  4338. var sharedPropertyDefinition = {
  4339. enumerable: true,
  4340. configurable: true,
  4341. get: noop,
  4342. set: noop
  4343. };
  4344. function proxy(target, sourceKey, key) {
  4345. sharedPropertyDefinition.get = function proxyGetter() {
  4346. return this[sourceKey][key]
  4347. };
  4348. sharedPropertyDefinition.set = function proxySetter(val) {
  4349. this[sourceKey][key] = val;
  4350. };
  4351. Object.defineProperty(target, key, sharedPropertyDefinition);
  4352. }
  4353. function initState(vm) {
  4354. vm._watchers = [];
  4355. var opts = vm.$options;
  4356. if (opts.props) {
  4357. initProps(vm, opts.props);
  4358. }
  4359. if (opts.methods) {
  4360. initMethods(vm, opts.methods);
  4361. }
  4362. if (opts.data) {
  4363. initData(vm);
  4364. } else {
  4365. observe(vm._data = {}, true /* asRootData */ );
  4366. }
  4367. if (opts.computed) {
  4368. initComputed(vm, opts.computed);
  4369. }
  4370. if (opts.watch && opts.watch !== nativeWatch) {
  4371. initWatch(vm, opts.watch);
  4372. }
  4373. }
  4374. function initProps(vm, propsOptions) {
  4375. var propsData = vm.$options.propsData || {};
  4376. var props = vm._props = {};
  4377. // cache prop keys so that future props updates can iterate using Array
  4378. // instead of dynamic object key enumeration.
  4379. var keys = vm.$options._propKeys = [];
  4380. var isRoot = !vm.$parent;
  4381. // root instance props should be converted
  4382. if (!isRoot) {
  4383. toggleObserving(false);
  4384. }
  4385. var loop = function (key) {
  4386. keys.push(key);
  4387. var value = validateProp(key, propsOptions, propsData, vm);
  4388. /* istanbul ignore else */
  4389. {
  4390. var hyphenatedKey = hyphenate(key);
  4391. if (isReservedAttribute(hyphenatedKey) ||
  4392. config.isReservedAttr(hyphenatedKey)) {
  4393. warn(
  4394. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  4395. vm
  4396. );
  4397. }
  4398. defineReactive$$1(props, key, value, function () {
  4399. if (!isRoot && !isUpdatingChildComponent) {
  4400. warn(
  4401. "Avoid mutating a prop directly since the value will be " +
  4402. "overwritten whenever the parent component re-renders. " +
  4403. "Instead, use a data or computed property based on the prop's " +
  4404. "value. Prop being mutated: \"" + key + "\"",
  4405. vm
  4406. );
  4407. }
  4408. });
  4409. }
  4410. // static props are already proxied on the component's prototype
  4411. // during Vue.extend(). We only need to proxy props defined at
  4412. // instantiation here.
  4413. if (!(key in vm)) {
  4414. proxy(vm, "_props", key);
  4415. }
  4416. };
  4417. for (var key in propsOptions) loop(key);
  4418. toggleObserving(true);
  4419. }
  4420. function initData(vm) {
  4421. var data = vm.$options.data;
  4422. data = vm._data = typeof data === 'function' ?
  4423. getData(data, vm) :
  4424. data || {};
  4425. if (!isPlainObject(data)) {
  4426. data = {};
  4427. warn(
  4428. 'data functions should return an object:\n' +
  4429. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  4430. vm
  4431. );
  4432. }
  4433. // proxy data on instance
  4434. var keys = Object.keys(data);
  4435. var props = vm.$options.props;
  4436. var methods = vm.$options.methods;
  4437. var i = keys.length;
  4438. while (i--) {
  4439. var key = keys[i]; {
  4440. if (methods && hasOwn(methods, key)) {
  4441. warn(
  4442. ("Method \"" + key + "\" has already been defined as a data property."),
  4443. vm
  4444. );
  4445. }
  4446. }
  4447. if (props && hasOwn(props, key)) {
  4448. warn(
  4449. "The data property \"" + key + "\" is already declared as a prop. " +
  4450. "Use prop default value instead.",
  4451. vm
  4452. );
  4453. } else if (!isReserved(key)) {
  4454. proxy(vm, "_data", key);
  4455. }
  4456. }
  4457. // observe data
  4458. observe(data, true /* asRootData */ );
  4459. }
  4460. function getData(data, vm) {
  4461. // #7573 disable dep collection when invoking data getters
  4462. pushTarget();
  4463. try {
  4464. return data.call(vm, vm)
  4465. } catch (e) {
  4466. handleError(e, vm, "data()");
  4467. return {}
  4468. } finally {
  4469. popTarget();
  4470. }
  4471. }
  4472. var computedWatcherOptions = {
  4473. lazy: true
  4474. };
  4475. function initComputed(vm, computed) {
  4476. // $flow-disable-line
  4477. var watchers = vm._computedWatchers = Object.create(null);
  4478. // computed properties are just getters during SSR
  4479. var isSSR = isServerRendering();
  4480. for (var key in computed) {
  4481. var userDef = computed[key];
  4482. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  4483. if (getter == null) {
  4484. warn(
  4485. ("Getter is missing for computed property \"" + key + "\"."),
  4486. vm
  4487. );
  4488. }
  4489. if (!isSSR) {
  4490. // create internal watcher for the computed property.
  4491. watchers[key] = new Watcher(
  4492. vm,
  4493. getter || noop,
  4494. noop,
  4495. computedWatcherOptions
  4496. );
  4497. }
  4498. // component-defined computed properties are already defined on the
  4499. // component prototype. We only need to define computed properties defined
  4500. // at instantiation here.
  4501. if (!(key in vm)) {
  4502. defineComputed(vm, key, userDef);
  4503. } else {
  4504. if (key in vm.$data) {
  4505. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  4506. } else if (vm.$options.props && key in vm.$options.props) {
  4507. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  4508. } else if (vm.$options.methods && key in vm.$options.methods) {
  4509. warn(("The computed property \"" + key + "\" is already defined as a method."), vm);
  4510. }
  4511. }
  4512. }
  4513. }
  4514. function defineComputed(
  4515. target,
  4516. key,
  4517. userDef
  4518. ) {
  4519. var shouldCache = !isServerRendering();
  4520. if (typeof userDef === 'function') {
  4521. sharedPropertyDefinition.get = shouldCache ?
  4522. createComputedGetter(key) :
  4523. createGetterInvoker(userDef);
  4524. sharedPropertyDefinition.set = noop;
  4525. } else {
  4526. sharedPropertyDefinition.get = userDef.get ?
  4527. shouldCache && userDef.cache !== false ?
  4528. createComputedGetter(key) :
  4529. createGetterInvoker(userDef.get) :
  4530. noop;
  4531. sharedPropertyDefinition.set = userDef.set || noop;
  4532. }
  4533. if (sharedPropertyDefinition.set === noop) {
  4534. sharedPropertyDefinition.set = function () {
  4535. warn(
  4536. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  4537. this
  4538. );
  4539. };
  4540. }
  4541. Object.defineProperty(target, key, sharedPropertyDefinition);
  4542. }
  4543. function createComputedGetter(key) {
  4544. return function computedGetter() {
  4545. var watcher = this._computedWatchers && this._computedWatchers[key];
  4546. if (watcher) {
  4547. if (watcher.dirty) {
  4548. watcher.evaluate();
  4549. }
  4550. if (Dep.target) {
  4551. watcher.depend();
  4552. }
  4553. return watcher.value
  4554. }
  4555. }
  4556. }
  4557. function createGetterInvoker(fn) {
  4558. return function computedGetter() {
  4559. return fn.call(this, this)
  4560. }
  4561. }
  4562. function initMethods(vm, methods) {
  4563. var props = vm.$options.props;
  4564. for (var key in methods) {
  4565. {
  4566. if (typeof methods[key] !== 'function') {
  4567. warn(
  4568. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  4569. "Did you reference the function correctly?",
  4570. vm
  4571. );
  4572. }
  4573. if (props && hasOwn(props, key)) {
  4574. warn(
  4575. ("Method \"" + key + "\" has already been defined as a prop."),
  4576. vm
  4577. );
  4578. }
  4579. if ((key in vm) && isReserved(key)) {
  4580. warn(
  4581. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  4582. "Avoid defining component methods that start with _ or $."
  4583. );
  4584. }
  4585. }
  4586. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  4587. }
  4588. }
  4589. function initWatch(vm, watch) {
  4590. for (var key in watch) {
  4591. var handler = watch[key];
  4592. if (Array.isArray(handler)) {
  4593. for (var i = 0; i < handler.length; i++) {
  4594. createWatcher(vm, key, handler[i]);
  4595. }
  4596. } else {
  4597. createWatcher(vm, key, handler);
  4598. }
  4599. }
  4600. }
  4601. function createWatcher(
  4602. vm,
  4603. expOrFn,
  4604. handler,
  4605. options
  4606. ) {
  4607. if (isPlainObject(handler)) {
  4608. options = handler;
  4609. handler = handler.handler;
  4610. }
  4611. if (typeof handler === 'string') {
  4612. handler = vm[handler];
  4613. }
  4614. return vm.$watch(expOrFn, handler, options)
  4615. }
  4616. function stateMixin(Vue) {
  4617. // flow somehow has problems with directly declared definition object
  4618. // when using Object.defineProperty, so we have to procedurally build up
  4619. // the object here.
  4620. var dataDef = {};
  4621. dataDef.get = function () {
  4622. return this._data
  4623. };
  4624. var propsDef = {};
  4625. propsDef.get = function () {
  4626. return this._props
  4627. }; {
  4628. dataDef.set = function () {
  4629. warn(
  4630. 'Avoid replacing instance root $data. ' +
  4631. 'Use nested data properties instead.',
  4632. this
  4633. );
  4634. };
  4635. propsDef.set = function () {
  4636. warn("$props is readonly.", this);
  4637. };
  4638. }
  4639. Object.defineProperty(Vue.prototype, '$data', dataDef);
  4640. Object.defineProperty(Vue.prototype, '$props', propsDef);
  4641. Vue.prototype.$set = set;
  4642. Vue.prototype.$delete = del;
  4643. Vue.prototype.$watch = function (
  4644. expOrFn,
  4645. cb,
  4646. options
  4647. ) {
  4648. var vm = this;
  4649. if (isPlainObject(cb)) {
  4650. return createWatcher(vm, expOrFn, cb, options)
  4651. }
  4652. options = options || {};
  4653. options.user = true;
  4654. var watcher = new Watcher(vm, expOrFn, cb, options);
  4655. if (options.immediate) {
  4656. var info = "callback for immediate watcher \"" + (watcher.expression) + "\"";
  4657. pushTarget();
  4658. invokeWithErrorHandling(cb, vm, [watcher.value], vm, info);
  4659. popTarget();
  4660. }
  4661. return function unwatchFn() {
  4662. watcher.teardown();
  4663. }
  4664. };
  4665. }
  4666. /* */
  4667. var uid$3 = 0;
  4668. function initMixin(Vue) {
  4669. Vue.prototype._init = function (options) {
  4670. var vm = this;
  4671. // a uid
  4672. vm._uid = uid$3++;
  4673. var startTag, endTag;
  4674. /* istanbul ignore if */
  4675. if (config.performance && mark) {
  4676. startTag = "vue-perf-start:" + (vm._uid);
  4677. endTag = "vue-perf-end:" + (vm._uid);
  4678. mark(startTag);
  4679. }
  4680. // a flag to avoid this being observed
  4681. vm._isVue = true;
  4682. // merge options
  4683. if (options && options._isComponent) {
  4684. // optimize internal component instantiation
  4685. // since dynamic options merging is pretty slow, and none of the
  4686. // internal component options needs special treatment.
  4687. initInternalComponent(vm, options);
  4688. } else {
  4689. vm.$options = mergeOptions(
  4690. resolveConstructorOptions(vm.constructor),
  4691. options || {},
  4692. vm
  4693. );
  4694. }
  4695. /* istanbul ignore else */
  4696. {
  4697. initProxy(vm);
  4698. }
  4699. // expose real self
  4700. vm._self = vm;
  4701. initLifecycle(vm);
  4702. initEvents(vm);
  4703. initRender(vm);
  4704. callHook(vm, 'beforeCreate');
  4705. initInjections(vm); // resolve injections before data/props
  4706. initState(vm);
  4707. initProvide(vm); // resolve provide after data/props
  4708. callHook(vm, 'created');
  4709. /* istanbul ignore if */
  4710. if (config.performance && mark) {
  4711. vm._name = formatComponentName(vm, false);
  4712. mark(endTag);
  4713. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  4714. }
  4715. if (vm.$options.el) {
  4716. vm.$mount(vm.$options.el);
  4717. }
  4718. };
  4719. }
  4720. function initInternalComponent(vm, options) {
  4721. var opts = vm.$options = Object.create(vm.constructor.options);
  4722. // doing this because it's faster than dynamic enumeration.
  4723. var parentVnode = options._parentVnode;
  4724. opts.parent = options.parent;
  4725. opts._parentVnode = parentVnode;
  4726. var vnodeComponentOptions = parentVnode.componentOptions;
  4727. opts.propsData = vnodeComponentOptions.propsData;
  4728. opts._parentListeners = vnodeComponentOptions.listeners;
  4729. opts._renderChildren = vnodeComponentOptions.children;
  4730. opts._componentTag = vnodeComponentOptions.tag;
  4731. if (options.render) {
  4732. opts.render = options.render;
  4733. opts.staticRenderFns = options.staticRenderFns;
  4734. }
  4735. }
  4736. function resolveConstructorOptions(Ctor) {
  4737. var options = Ctor.options;
  4738. if (Ctor.super) {
  4739. var superOptions = resolveConstructorOptions(Ctor.super);
  4740. var cachedSuperOptions = Ctor.superOptions;
  4741. if (superOptions !== cachedSuperOptions) {
  4742. // super option changed,
  4743. // need to resolve new options.
  4744. Ctor.superOptions = superOptions;
  4745. // check if there are any late-modified/attached options (#4976)
  4746. var modifiedOptions = resolveModifiedOptions(Ctor);
  4747. // update base extend options
  4748. if (modifiedOptions) {
  4749. extend(Ctor.extendOptions, modifiedOptions);
  4750. }
  4751. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4752. if (options.name) {
  4753. options.components[options.name] = Ctor;
  4754. }
  4755. }
  4756. }
  4757. return options
  4758. }
  4759. function resolveModifiedOptions(Ctor) {
  4760. var modified;
  4761. var latest = Ctor.options;
  4762. var sealed = Ctor.sealedOptions;
  4763. for (var key in latest) {
  4764. if (latest[key] !== sealed[key]) {
  4765. if (!modified) {
  4766. modified = {};
  4767. }
  4768. modified[key] = latest[key];
  4769. }
  4770. }
  4771. return modified
  4772. }
  4773. function Vue(options) {
  4774. if (!(this instanceof Vue)) {
  4775. warn('Vue is a constructor and should be called with the `new` keyword');
  4776. }
  4777. this._init(options);
  4778. }
  4779. initMixin(Vue);
  4780. stateMixin(Vue);
  4781. eventsMixin(Vue);
  4782. lifecycleMixin(Vue);
  4783. renderMixin(Vue);
  4784. /* */
  4785. function initUse(Vue) {
  4786. Vue.use = function (plugin) {
  4787. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  4788. if (installedPlugins.indexOf(plugin) > -1) {
  4789. return this
  4790. }
  4791. // additional parameters
  4792. var args = toArray(arguments, 1);
  4793. args.unshift(this);
  4794. if (typeof plugin.install === 'function') {
  4795. plugin.install.apply(plugin, args);
  4796. } else if (typeof plugin === 'function') {
  4797. plugin.apply(null, args);
  4798. }
  4799. installedPlugins.push(plugin);
  4800. return this
  4801. };
  4802. }
  4803. /* */
  4804. function initMixin$1(Vue) {
  4805. Vue.mixin = function (mixin) {
  4806. this.options = mergeOptions(this.options, mixin);
  4807. return this
  4808. };
  4809. }
  4810. /* */
  4811. function initExtend(Vue) {
  4812. /**
  4813. * Each instance constructor, including Vue, has a unique
  4814. * cid. This enables us to create wrapped "child
  4815. * constructors" for prototypal inheritance and cache them.
  4816. */
  4817. Vue.cid = 0;
  4818. var cid = 1;
  4819. /**
  4820. * Class inheritance
  4821. */
  4822. Vue.extend = function (extendOptions) {
  4823. extendOptions = extendOptions || {};
  4824. var Super = this;
  4825. var SuperId = Super.cid;
  4826. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  4827. if (cachedCtors[SuperId]) {
  4828. return cachedCtors[SuperId]
  4829. }
  4830. var name = extendOptions.name || Super.options.name;
  4831. if (name) {
  4832. validateComponentName(name);
  4833. }
  4834. var Sub = function VueComponent(options) {
  4835. this._init(options);
  4836. };
  4837. Sub.prototype = Object.create(Super.prototype);
  4838. Sub.prototype.constructor = Sub;
  4839. Sub.cid = cid++;
  4840. Sub.options = mergeOptions(
  4841. Super.options,
  4842. extendOptions
  4843. );
  4844. Sub['super'] = Super;
  4845. // For props and computed properties, we define the proxy getters on
  4846. // the Vue instances at extension time, on the extended prototype. This
  4847. // avoids Object.defineProperty calls for each instance created.
  4848. if (Sub.options.props) {
  4849. initProps$1(Sub);
  4850. }
  4851. if (Sub.options.computed) {
  4852. initComputed$1(Sub);
  4853. }
  4854. // allow further extension/mixin/plugin usage
  4855. Sub.extend = Super.extend;
  4856. Sub.mixin = Super.mixin;
  4857. Sub.use = Super.use;
  4858. // create asset registers, so extended classes
  4859. // can have their private assets too.
  4860. ASSET_TYPES.forEach(function (type) {
  4861. Sub[type] = Super[type];
  4862. });
  4863. // enable recursive self-lookup
  4864. if (name) {
  4865. Sub.options.components[name] = Sub;
  4866. }
  4867. // keep a reference to the super options at extension time.
  4868. // later at instantiation we can check if Super's options have
  4869. // been updated.
  4870. Sub.superOptions = Super.options;
  4871. Sub.extendOptions = extendOptions;
  4872. Sub.sealedOptions = extend({}, Sub.options);
  4873. // cache constructor
  4874. cachedCtors[SuperId] = Sub;
  4875. return Sub
  4876. };
  4877. }
  4878. function initProps$1(Comp) {
  4879. var props = Comp.options.props;
  4880. for (var key in props) {
  4881. proxy(Comp.prototype, "_props", key);
  4882. }
  4883. }
  4884. function initComputed$1(Comp) {
  4885. var computed = Comp.options.computed;
  4886. for (var key in computed) {
  4887. defineComputed(Comp.prototype, key, computed[key]);
  4888. }
  4889. }
  4890. /* */
  4891. function initAssetRegisters(Vue) {
  4892. /**
  4893. * Create asset registration methods.
  4894. */
  4895. ASSET_TYPES.forEach(function (type) {
  4896. Vue[type] = function (
  4897. id,
  4898. definition
  4899. ) {
  4900. if (!definition) {
  4901. return this.options[type + 's'][id]
  4902. } else {
  4903. /* istanbul ignore if */
  4904. if (type === 'component') {
  4905. validateComponentName(id);
  4906. }
  4907. if (type === 'component' && isPlainObject(definition)) {
  4908. definition.name = definition.name || id;
  4909. definition = this.options._base.extend(definition);
  4910. }
  4911. if (type === 'directive' && typeof definition === 'function') {
  4912. definition = {
  4913. bind: definition,
  4914. update: definition
  4915. };
  4916. }
  4917. this.options[type + 's'][id] = definition;
  4918. return definition
  4919. }
  4920. };
  4921. });
  4922. }
  4923. /* */
  4924. function getComponentName(opts) {
  4925. return opts && (opts.Ctor.options.name || opts.tag)
  4926. }
  4927. function matches(pattern, name) {
  4928. if (Array.isArray(pattern)) {
  4929. return pattern.indexOf(name) > -1
  4930. } else if (typeof pattern === 'string') {
  4931. return pattern.split(',').indexOf(name) > -1
  4932. } else if (isRegExp(pattern)) {
  4933. return pattern.test(name)
  4934. }
  4935. /* istanbul ignore next */
  4936. return false
  4937. }
  4938. function pruneCache(keepAliveInstance, filter) {
  4939. var cache = keepAliveInstance.cache;
  4940. var keys = keepAliveInstance.keys;
  4941. var _vnode = keepAliveInstance._vnode;
  4942. for (var key in cache) {
  4943. var entry = cache[key];
  4944. if (entry) {
  4945. var name = entry.name;
  4946. if (name && !filter(name)) {
  4947. pruneCacheEntry(cache, key, keys, _vnode);
  4948. }
  4949. }
  4950. }
  4951. }
  4952. function pruneCacheEntry(
  4953. cache,
  4954. key,
  4955. keys,
  4956. current
  4957. ) {
  4958. var entry = cache[key];
  4959. if (entry && (!current || entry.tag !== current.tag)) {
  4960. entry.componentInstance.$destroy();
  4961. }
  4962. cache[key] = null;
  4963. remove(keys, key);
  4964. }
  4965. var patternTypes = [String, RegExp, Array];
  4966. var KeepAlive = {
  4967. name: 'keep-alive',
  4968. abstract: true,
  4969. props: {
  4970. include: patternTypes,
  4971. exclude: patternTypes,
  4972. max: [String, Number]
  4973. },
  4974. methods: {
  4975. cacheVNode: function cacheVNode() {
  4976. var ref = this;
  4977. var cache = ref.cache;
  4978. var keys = ref.keys;
  4979. var vnodeToCache = ref.vnodeToCache;
  4980. var keyToCache = ref.keyToCache;
  4981. if (vnodeToCache) {
  4982. var tag = vnodeToCache.tag;
  4983. var componentInstance = vnodeToCache.componentInstance;
  4984. var componentOptions = vnodeToCache.componentOptions;
  4985. cache[keyToCache] = {
  4986. name: getComponentName(componentOptions),
  4987. tag: tag,
  4988. componentInstance: componentInstance,
  4989. };
  4990. keys.push(keyToCache);
  4991. // prune oldest entry
  4992. if (this.max && keys.length > parseInt(this.max)) {
  4993. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  4994. }
  4995. this.vnodeToCache = null;
  4996. }
  4997. }
  4998. },
  4999. created: function created() {
  5000. this.cache = Object.create(null);
  5001. this.keys = [];
  5002. },
  5003. destroyed: function destroyed() {
  5004. for (var key in this.cache) {
  5005. pruneCacheEntry(this.cache, key, this.keys);
  5006. }
  5007. },
  5008. mounted: function mounted() {
  5009. var this$1 = this;
  5010. this.cacheVNode();
  5011. this.$watch('include', function (val) {
  5012. pruneCache(this$1, function (name) {
  5013. return matches(val, name);
  5014. });
  5015. });
  5016. this.$watch('exclude', function (val) {
  5017. pruneCache(this$1, function (name) {
  5018. return !matches(val, name);
  5019. });
  5020. });
  5021. },
  5022. updated: function updated() {
  5023. this.cacheVNode();
  5024. },
  5025. render: function render() {
  5026. var slot = this.$slots.default;
  5027. var vnode = getFirstComponentChild(slot);
  5028. var componentOptions = vnode && vnode.componentOptions;
  5029. if (componentOptions) {
  5030. // check pattern
  5031. var name = getComponentName(componentOptions);
  5032. var ref = this;
  5033. var include = ref.include;
  5034. var exclude = ref.exclude;
  5035. if (
  5036. // not included
  5037. (include && (!name || !matches(include, name))) ||
  5038. // excluded
  5039. (exclude && name && matches(exclude, name))
  5040. ) {
  5041. return vnode
  5042. }
  5043. var ref$1 = this;
  5044. var cache = ref$1.cache;
  5045. var keys = ref$1.keys;
  5046. var key = vnode.key == null
  5047. // same constructor may get registered as different local components
  5048. // so cid alone is not enough (#3269)
  5049. ?
  5050. componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '') :
  5051. vnode.key;
  5052. if (cache[key]) {
  5053. vnode.componentInstance = cache[key].componentInstance;
  5054. // make current key freshest
  5055. remove(keys, key);
  5056. keys.push(key);
  5057. } else {
  5058. // delay setting the cache until update
  5059. this.vnodeToCache = vnode;
  5060. this.keyToCache = key;
  5061. }
  5062. vnode.data.keepAlive = true;
  5063. }
  5064. return vnode || (slot && slot[0])
  5065. }
  5066. };
  5067. var builtInComponents = {
  5068. KeepAlive: KeepAlive
  5069. };
  5070. /* */
  5071. function initGlobalAPI(Vue) {
  5072. // config
  5073. var configDef = {};
  5074. configDef.get = function () {
  5075. return config;
  5076. }; {
  5077. configDef.set = function () {
  5078. warn(
  5079. 'Do not replace the Vue.config object, set individual fields instead.'
  5080. );
  5081. };
  5082. }
  5083. Object.defineProperty(Vue, 'config', configDef);
  5084. // exposed util methods.
  5085. // NOTE: these are not considered part of the public API - avoid relying on
  5086. // them unless you are aware of the risk.
  5087. Vue.util = {
  5088. warn: warn,
  5089. extend: extend,
  5090. mergeOptions: mergeOptions,
  5091. defineReactive: defineReactive$$1
  5092. };
  5093. Vue.set = set;
  5094. Vue.delete = del;
  5095. Vue.nextTick = nextTick;
  5096. // 2.6 explicit observable API
  5097. Vue.observable = function (obj) {
  5098. observe(obj);
  5099. return obj
  5100. };
  5101. Vue.options = Object.create(null);
  5102. ASSET_TYPES.forEach(function (type) {
  5103. Vue.options[type + 's'] = Object.create(null);
  5104. });
  5105. // this is used to identify the "base" constructor to extend all plain-object
  5106. // components with in Weex's multi-instance scenarios.
  5107. Vue.options._base = Vue;
  5108. extend(Vue.options.components, builtInComponents);
  5109. initUse(Vue);
  5110. initMixin$1(Vue);
  5111. initExtend(Vue);
  5112. initAssetRegisters(Vue);
  5113. }
  5114. initGlobalAPI(Vue);
  5115. Object.defineProperty(Vue.prototype, '$isServer', {
  5116. get: isServerRendering
  5117. });
  5118. Object.defineProperty(Vue.prototype, '$ssrContext', {
  5119. get: function get() {
  5120. /* istanbul ignore next */
  5121. return this.$vnode && this.$vnode.ssrContext
  5122. }
  5123. });
  5124. // expose FunctionalRenderContext for ssr runtime helper installation
  5125. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  5126. value: FunctionalRenderContext
  5127. });
  5128. Vue.version = '2.6.14';
  5129. /* */
  5130. // these are reserved for web because they are directly compiled away
  5131. // during template compilation
  5132. var isReservedAttr = makeMap('style,class');
  5133. // attributes that should be using props for binding
  5134. var acceptValue = makeMap('input,textarea,option,select,progress');
  5135. var mustUseProp = function (tag, type, attr) {
  5136. return (
  5137. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  5138. (attr === 'selected' && tag === 'option') ||
  5139. (attr === 'checked' && tag === 'input') ||
  5140. (attr === 'muted' && tag === 'video')
  5141. )
  5142. };
  5143. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  5144. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  5145. var convertEnumeratedValue = function (key, value) {
  5146. return isFalsyAttrValue(value) || value === 'false' ?
  5147. 'false'
  5148. // allow arbitrary string value for contenteditable
  5149. :
  5150. key === 'contenteditable' && isValidContentEditableValue(value) ?
  5151. value :
  5152. 'true'
  5153. };
  5154. var isBooleanAttr = makeMap(
  5155. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  5156. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  5157. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  5158. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  5159. 'required,reversed,scoped,seamless,selected,sortable,' +
  5160. 'truespeed,typemustmatch,visible'
  5161. );
  5162. var xlinkNS = 'http://www.w3.org/1999/xlink';
  5163. var isXlink = function (name) {
  5164. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  5165. };
  5166. var getXlinkProp = function (name) {
  5167. return isXlink(name) ? name.slice(6, name.length) : ''
  5168. };
  5169. var isFalsyAttrValue = function (val) {
  5170. return val == null || val === false
  5171. };
  5172. /* */
  5173. function genClassForVnode(vnode) {
  5174. var data = vnode.data;
  5175. var parentNode = vnode;
  5176. var childNode = vnode;
  5177. while (isDef(childNode.componentInstance)) {
  5178. childNode = childNode.componentInstance._vnode;
  5179. if (childNode && childNode.data) {
  5180. data = mergeClassData(childNode.data, data);
  5181. }
  5182. }
  5183. while (isDef(parentNode = parentNode.parent)) {
  5184. if (parentNode && parentNode.data) {
  5185. data = mergeClassData(data, parentNode.data);
  5186. }
  5187. }
  5188. return renderClass(data.staticClass, data.class)
  5189. }
  5190. function mergeClassData(child, parent) {
  5191. return {
  5192. staticClass: concat(child.staticClass, parent.staticClass),
  5193. class: isDef(child.class) ?
  5194. [child.class, parent.class] :
  5195. parent.class
  5196. }
  5197. }
  5198. function renderClass(
  5199. staticClass,
  5200. dynamicClass
  5201. ) {
  5202. if (isDef(staticClass) || isDef(dynamicClass)) {
  5203. return concat(staticClass, stringifyClass(dynamicClass))
  5204. }
  5205. /* istanbul ignore next */
  5206. return ''
  5207. }
  5208. function concat(a, b) {
  5209. return a ? b ? (a + ' ' + b) : a : (b || '')
  5210. }
  5211. function stringifyClass(value) {
  5212. if (Array.isArray(value)) {
  5213. return stringifyArray(value)
  5214. }
  5215. if (isObject(value)) {
  5216. return stringifyObject(value)
  5217. }
  5218. if (typeof value === 'string') {
  5219. return value
  5220. }
  5221. /* istanbul ignore next */
  5222. return ''
  5223. }
  5224. function stringifyArray(value) {
  5225. var res = '';
  5226. var stringified;
  5227. for (var i = 0, l = value.length; i < l; i++) {
  5228. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  5229. if (res) {
  5230. res += ' ';
  5231. }
  5232. res += stringified;
  5233. }
  5234. }
  5235. return res
  5236. }
  5237. function stringifyObject(value) {
  5238. var res = '';
  5239. for (var key in value) {
  5240. if (value[key]) {
  5241. if (res) {
  5242. res += ' ';
  5243. }
  5244. res += key;
  5245. }
  5246. }
  5247. return res
  5248. }
  5249. /* */
  5250. var namespaceMap = {
  5251. svg: 'http://www.w3.org/2000/svg',
  5252. math: 'http://www.w3.org/1998/Math/MathML'
  5253. };
  5254. var isHTMLTag = makeMap(
  5255. 'html,body,base,head,link,meta,style,title,' +
  5256. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  5257. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  5258. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  5259. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  5260. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  5261. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  5262. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  5263. 'output,progress,select,textarea,' +
  5264. 'details,dialog,menu,menuitem,summary,' +
  5265. 'content,element,shadow,template,blockquote,iframe,tfoot'
  5266. );
  5267. // this map is intentionally selective, only covering SVG elements that may
  5268. // contain child elements.
  5269. var isSVG = makeMap(
  5270. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  5271. 'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  5272. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  5273. true
  5274. );
  5275. var isPreTag = function (tag) {
  5276. return tag === 'pre';
  5277. };
  5278. var isReservedTag = function (tag) {
  5279. return isHTMLTag(tag) || isSVG(tag)
  5280. };
  5281. function getTagNamespace(tag) {
  5282. if (isSVG(tag)) {
  5283. return 'svg'
  5284. }
  5285. // basic support for MathML
  5286. // note it doesn't support other MathML elements being component roots
  5287. if (tag === 'math') {
  5288. return 'math'
  5289. }
  5290. }
  5291. var unknownElementCache = Object.create(null);
  5292. function isUnknownElement(tag) {
  5293. /* istanbul ignore if */
  5294. if (!inBrowser) {
  5295. return true
  5296. }
  5297. if (isReservedTag(tag)) {
  5298. return false
  5299. }
  5300. tag = tag.toLowerCase();
  5301. /* istanbul ignore if */
  5302. if (unknownElementCache[tag] != null) {
  5303. return unknownElementCache[tag]
  5304. }
  5305. var el = document.createElement(tag);
  5306. if (tag.indexOf('-') > -1) {
  5307. // http://stackoverflow.com/a/28210364/1070244
  5308. return (unknownElementCache[tag] = (
  5309. el.constructor === window.HTMLUnknownElement ||
  5310. el.constructor === window.HTMLElement
  5311. ))
  5312. } else {
  5313. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  5314. }
  5315. }
  5316. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  5317. /* */
  5318. /**
  5319. * Query an element selector if it's not an element already.
  5320. */
  5321. function query(el) {
  5322. if (typeof el === 'string') {
  5323. var selected = document.querySelector(el);
  5324. if (!selected) {
  5325. warn(
  5326. 'Cannot find element: ' + el
  5327. );
  5328. return document.createElement('div')
  5329. }
  5330. return selected
  5331. } else {
  5332. return el
  5333. }
  5334. }
  5335. /* */
  5336. function createElement$1(tagName, vnode) {
  5337. var elm = document.createElement(tagName);
  5338. if (tagName !== 'select') {
  5339. return elm
  5340. }
  5341. // false or null will remove the attribute but undefined will not
  5342. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  5343. elm.setAttribute('multiple', 'multiple');
  5344. }
  5345. return elm
  5346. }
  5347. function createElementNS(namespace, tagName) {
  5348. return document.createElementNS(namespaceMap[namespace], tagName)
  5349. }
  5350. function createTextNode(text) {
  5351. return document.createTextNode(text)
  5352. }
  5353. function createComment(text) {
  5354. return document.createComment(text)
  5355. }
  5356. function insertBefore(parentNode, newNode, referenceNode) {
  5357. parentNode.insertBefore(newNode, referenceNode);
  5358. }
  5359. function removeChild(node, child) {
  5360. node.removeChild(child);
  5361. }
  5362. function appendChild(node, child) {
  5363. node.appendChild(child);
  5364. }
  5365. function parentNode(node) {
  5366. return node.parentNode
  5367. }
  5368. function nextSibling(node) {
  5369. return node.nextSibling
  5370. }
  5371. function tagName(node) {
  5372. return node.tagName
  5373. }
  5374. function setTextContent(node, text) {
  5375. node.textContent = text;
  5376. }
  5377. function setStyleScope(node, scopeId) {
  5378. node.setAttribute(scopeId, '');
  5379. }
  5380. var nodeOps = /*#__PURE__*/ Object.freeze({
  5381. createElement: createElement$1,
  5382. createElementNS: createElementNS,
  5383. createTextNode: createTextNode,
  5384. createComment: createComment,
  5385. insertBefore: insertBefore,
  5386. removeChild: removeChild,
  5387. appendChild: appendChild,
  5388. parentNode: parentNode,
  5389. nextSibling: nextSibling,
  5390. tagName: tagName,
  5391. setTextContent: setTextContent,
  5392. setStyleScope: setStyleScope
  5393. });
  5394. /* */
  5395. var ref = {
  5396. create: function create(_, vnode) {
  5397. registerRef(vnode);
  5398. },
  5399. update: function update(oldVnode, vnode) {
  5400. if (oldVnode.data.ref !== vnode.data.ref) {
  5401. registerRef(oldVnode, true);
  5402. registerRef(vnode);
  5403. }
  5404. },
  5405. destroy: function destroy(vnode) {
  5406. registerRef(vnode, true);
  5407. }
  5408. };
  5409. function registerRef(vnode, isRemoval) {
  5410. var key = vnode.data.ref;
  5411. if (!isDef(key)) {
  5412. return
  5413. }
  5414. var vm = vnode.context;
  5415. var ref = vnode.componentInstance || vnode.elm;
  5416. var refs = vm.$refs;
  5417. if (isRemoval) {
  5418. if (Array.isArray(refs[key])) {
  5419. remove(refs[key], ref);
  5420. } else if (refs[key] === ref) {
  5421. refs[key] = undefined;
  5422. }
  5423. } else {
  5424. if (vnode.data.refInFor) {
  5425. if (!Array.isArray(refs[key])) {
  5426. refs[key] = [ref];
  5427. } else if (refs[key].indexOf(ref) < 0) {
  5428. // $flow-disable-line
  5429. refs[key].push(ref);
  5430. }
  5431. } else {
  5432. refs[key] = ref;
  5433. }
  5434. }
  5435. }
  5436. /**
  5437. * Virtual DOM patching algorithm based on Snabbdom by
  5438. * Simon Friis Vindum (@paldepind)
  5439. * Licensed under the MIT License
  5440. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  5441. *
  5442. * modified by Evan You (@yyx990803)
  5443. *
  5444. * Not type-checking this because this file is perf-critical and the cost
  5445. * of making flow understand it is not worth it.
  5446. */
  5447. var emptyNode = new VNode('', {}, []);
  5448. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  5449. function sameVnode(a, b) {
  5450. return (
  5451. a.key === b.key &&
  5452. a.asyncFactory === b.asyncFactory && (
  5453. (
  5454. a.tag === b.tag &&
  5455. a.isComment === b.isComment &&
  5456. isDef(a.data) === isDef(b.data) &&
  5457. sameInputType(a, b)
  5458. ) || (
  5459. isTrue(a.isAsyncPlaceholder) &&
  5460. isUndef(b.asyncFactory.error)
  5461. )
  5462. )
  5463. )
  5464. }
  5465. function sameInputType(a, b) {
  5466. if (a.tag !== 'input') {
  5467. return true
  5468. }
  5469. var i;
  5470. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  5471. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  5472. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  5473. }
  5474. function createKeyToOldIdx(children, beginIdx, endIdx) {
  5475. var i, key;
  5476. var map = {};
  5477. for (i = beginIdx; i <= endIdx; ++i) {
  5478. key = children[i].key;
  5479. if (isDef(key)) {
  5480. map[key] = i;
  5481. }
  5482. }
  5483. return map
  5484. }
  5485. function createPatchFunction(backend) {
  5486. var i, j;
  5487. var cbs = {};
  5488. var modules = backend.modules;
  5489. var nodeOps = backend.nodeOps;
  5490. for (i = 0; i < hooks.length; ++i) {
  5491. cbs[hooks[i]] = [];
  5492. for (j = 0; j < modules.length; ++j) {
  5493. if (isDef(modules[j][hooks[i]])) {
  5494. cbs[hooks[i]].push(modules[j][hooks[i]]);
  5495. }
  5496. }
  5497. }
  5498. function emptyNodeAt(elm) {
  5499. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  5500. }
  5501. function createRmCb(childElm, listeners) {
  5502. function remove$$1() {
  5503. if (--remove$$1.listeners === 0) {
  5504. removeNode(childElm);
  5505. }
  5506. }
  5507. remove$$1.listeners = listeners;
  5508. return remove$$1
  5509. }
  5510. function removeNode(el) {
  5511. var parent = nodeOps.parentNode(el);
  5512. // element may have already been removed due to v-html / v-text
  5513. if (isDef(parent)) {
  5514. nodeOps.removeChild(parent, el);
  5515. }
  5516. }
  5517. function isUnknownElement$$1(vnode, inVPre) {
  5518. return (
  5519. !inVPre &&
  5520. !vnode.ns &&
  5521. !(
  5522. config.ignoredElements.length &&
  5523. config.ignoredElements.some(function (ignore) {
  5524. return isRegExp(ignore) ?
  5525. ignore.test(vnode.tag) :
  5526. ignore === vnode.tag
  5527. })
  5528. ) &&
  5529. config.isUnknownElement(vnode.tag)
  5530. )
  5531. }
  5532. var creatingElmInVPre = 0;
  5533. function createElm(
  5534. vnode,
  5535. insertedVnodeQueue,
  5536. parentElm,
  5537. refElm,
  5538. nested,
  5539. ownerArray,
  5540. index
  5541. ) {
  5542. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5543. // This vnode was used in a previous render!
  5544. // now it's used as a new node, overwriting its elm would cause
  5545. // potential patch errors down the road when it's used as an insertion
  5546. // reference node. Instead, we clone the node on-demand before creating
  5547. // associated DOM element for it.
  5548. vnode = ownerArray[index] = cloneVNode(vnode);
  5549. }
  5550. vnode.isRootInsert = !nested; // for transition enter check
  5551. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  5552. return
  5553. }
  5554. var data = vnode.data;
  5555. var children = vnode.children;
  5556. var tag = vnode.tag;
  5557. if (isDef(tag)) {
  5558. {
  5559. if (data && data.pre) {
  5560. creatingElmInVPre++;
  5561. }
  5562. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  5563. warn(
  5564. 'Unknown custom element: <' + tag + '> - did you ' +
  5565. 'register the component correctly? For recursive components, ' +
  5566. 'make sure to provide the "name" option.',
  5567. vnode.context
  5568. );
  5569. }
  5570. }
  5571. vnode.elm = vnode.ns ?
  5572. nodeOps.createElementNS(vnode.ns, tag) :
  5573. nodeOps.createElement(tag, vnode);
  5574. setScope(vnode);
  5575. /* istanbul ignore if */
  5576. {
  5577. createChildren(vnode, children, insertedVnodeQueue);
  5578. if (isDef(data)) {
  5579. invokeCreateHooks(vnode, insertedVnodeQueue);
  5580. }
  5581. insert(parentElm, vnode.elm, refElm);
  5582. }
  5583. if (data && data.pre) {
  5584. creatingElmInVPre--;
  5585. }
  5586. } else if (isTrue(vnode.isComment)) {
  5587. vnode.elm = nodeOps.createComment(vnode.text);
  5588. insert(parentElm, vnode.elm, refElm);
  5589. } else {
  5590. vnode.elm = nodeOps.createTextNode(vnode.text);
  5591. insert(parentElm, vnode.elm, refElm);
  5592. }
  5593. }
  5594. function createComponent(vnode, insertedVnodeQueue, parentElm, refElm) {
  5595. var i = vnode.data;
  5596. if (isDef(i)) {
  5597. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  5598. if (isDef(i = i.hook) && isDef(i = i.init)) {
  5599. i(vnode, false /* hydrating */ );
  5600. }
  5601. // after calling the init hook, if the vnode is a child component
  5602. // it should've created a child instance and mounted it. the child
  5603. // component also has set the placeholder vnode's elm.
  5604. // in that case we can just return the element and be done.
  5605. if (isDef(vnode.componentInstance)) {
  5606. initComponent(vnode, insertedVnodeQueue);
  5607. insert(parentElm, vnode.elm, refElm);
  5608. if (isTrue(isReactivated)) {
  5609. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  5610. }
  5611. return true
  5612. }
  5613. }
  5614. }
  5615. function initComponent(vnode, insertedVnodeQueue) {
  5616. if (isDef(vnode.data.pendingInsert)) {
  5617. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  5618. vnode.data.pendingInsert = null;
  5619. }
  5620. vnode.elm = vnode.componentInstance.$el;
  5621. if (isPatchable(vnode)) {
  5622. invokeCreateHooks(vnode, insertedVnodeQueue);
  5623. setScope(vnode);
  5624. } else {
  5625. // empty component root.
  5626. // skip all element-related modules except for ref (#3455)
  5627. registerRef(vnode);
  5628. // make sure to invoke the insert hook
  5629. insertedVnodeQueue.push(vnode);
  5630. }
  5631. }
  5632. function reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm) {
  5633. var i;
  5634. // hack for #4339: a reactivated component with inner transition
  5635. // does not trigger because the inner node's created hooks are not called
  5636. // again. It's not ideal to involve module-specific logic in here but
  5637. // there doesn't seem to be a better way to do it.
  5638. var innerNode = vnode;
  5639. while (innerNode.componentInstance) {
  5640. innerNode = innerNode.componentInstance._vnode;
  5641. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  5642. for (i = 0; i < cbs.activate.length; ++i) {
  5643. cbs.activate[i](emptyNode, innerNode);
  5644. }
  5645. insertedVnodeQueue.push(innerNode);
  5646. break
  5647. }
  5648. }
  5649. // unlike a newly created component,
  5650. // a reactivated keep-alive component doesn't insert itself
  5651. insert(parentElm, vnode.elm, refElm);
  5652. }
  5653. function insert(parent, elm, ref$$1) {
  5654. if (isDef(parent)) {
  5655. if (isDef(ref$$1)) {
  5656. if (nodeOps.parentNode(ref$$1) === parent) {
  5657. nodeOps.insertBefore(parent, elm, ref$$1);
  5658. }
  5659. } else {
  5660. nodeOps.appendChild(parent, elm);
  5661. }
  5662. }
  5663. }
  5664. function createChildren(vnode, children, insertedVnodeQueue) {
  5665. if (Array.isArray(children)) {
  5666. {
  5667. checkDuplicateKeys(children);
  5668. }
  5669. for (var i = 0; i < children.length; ++i) {
  5670. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  5671. }
  5672. } else if (isPrimitive(vnode.text)) {
  5673. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  5674. }
  5675. }
  5676. function isPatchable(vnode) {
  5677. while (vnode.componentInstance) {
  5678. vnode = vnode.componentInstance._vnode;
  5679. }
  5680. return isDef(vnode.tag)
  5681. }
  5682. function invokeCreateHooks(vnode, insertedVnodeQueue) {
  5683. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5684. cbs.create[i$1](emptyNode, vnode);
  5685. }
  5686. i = vnode.data.hook; // Reuse variable
  5687. if (isDef(i)) {
  5688. if (isDef(i.create)) {
  5689. i.create(emptyNode, vnode);
  5690. }
  5691. if (isDef(i.insert)) {
  5692. insertedVnodeQueue.push(vnode);
  5693. }
  5694. }
  5695. }
  5696. // set scope id attribute for scoped CSS.
  5697. // this is implemented as a special case to avoid the overhead
  5698. // of going through the normal attribute patching process.
  5699. function setScope(vnode) {
  5700. var i;
  5701. if (isDef(i = vnode.fnScopeId)) {
  5702. nodeOps.setStyleScope(vnode.elm, i);
  5703. } else {
  5704. var ancestor = vnode;
  5705. while (ancestor) {
  5706. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  5707. nodeOps.setStyleScope(vnode.elm, i);
  5708. }
  5709. ancestor = ancestor.parent;
  5710. }
  5711. }
  5712. // for slot content they should also get the scopeId from the host instance.
  5713. if (isDef(i = activeInstance) &&
  5714. i !== vnode.context &&
  5715. i !== vnode.fnContext &&
  5716. isDef(i = i.$options._scopeId)
  5717. ) {
  5718. nodeOps.setStyleScope(vnode.elm, i);
  5719. }
  5720. }
  5721. function addVnodes(parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  5722. for (; startIdx <= endIdx; ++startIdx) {
  5723. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  5724. }
  5725. }
  5726. function invokeDestroyHook(vnode) {
  5727. var i, j;
  5728. var data = vnode.data;
  5729. if (isDef(data)) {
  5730. if (isDef(i = data.hook) && isDef(i = i.destroy)) {
  5731. i(vnode);
  5732. }
  5733. for (i = 0; i < cbs.destroy.length; ++i) {
  5734. cbs.destroy[i](vnode);
  5735. }
  5736. }
  5737. if (isDef(i = vnode.children)) {
  5738. for (j = 0; j < vnode.children.length; ++j) {
  5739. invokeDestroyHook(vnode.children[j]);
  5740. }
  5741. }
  5742. }
  5743. function removeVnodes(vnodes, startIdx, endIdx) {
  5744. for (; startIdx <= endIdx; ++startIdx) {
  5745. var ch = vnodes[startIdx];
  5746. if (isDef(ch)) {
  5747. if (isDef(ch.tag)) {
  5748. removeAndInvokeRemoveHook(ch);
  5749. invokeDestroyHook(ch);
  5750. } else { // Text node
  5751. removeNode(ch.elm);
  5752. }
  5753. }
  5754. }
  5755. }
  5756. function removeAndInvokeRemoveHook(vnode, rm) {
  5757. if (isDef(rm) || isDef(vnode.data)) {
  5758. var i;
  5759. var listeners = cbs.remove.length + 1;
  5760. if (isDef(rm)) {
  5761. // we have a recursively passed down rm callback
  5762. // increase the listeners count
  5763. rm.listeners += listeners;
  5764. } else {
  5765. // directly removing
  5766. rm = createRmCb(vnode.elm, listeners);
  5767. }
  5768. // recursively invoke hooks on child component root node
  5769. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  5770. removeAndInvokeRemoveHook(i, rm);
  5771. }
  5772. for (i = 0; i < cbs.remove.length; ++i) {
  5773. cbs.remove[i](vnode, rm);
  5774. }
  5775. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  5776. i(vnode, rm);
  5777. } else {
  5778. rm();
  5779. }
  5780. } else {
  5781. removeNode(vnode.elm);
  5782. }
  5783. }
  5784. function updateChildren(parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  5785. var oldStartIdx = 0;
  5786. var newStartIdx = 0;
  5787. var oldEndIdx = oldCh.length - 1;
  5788. var oldStartVnode = oldCh[0];
  5789. var oldEndVnode = oldCh[oldEndIdx];
  5790. var newEndIdx = newCh.length - 1;
  5791. var newStartVnode = newCh[0];
  5792. var newEndVnode = newCh[newEndIdx];
  5793. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  5794. // removeOnly is a special flag used only by <transition-group>
  5795. // to ensure removed elements stay in correct relative positions
  5796. // during leaving transitions
  5797. var canMove = !removeOnly;
  5798. {
  5799. checkDuplicateKeys(newCh);
  5800. }
  5801. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  5802. if (isUndef(oldStartVnode)) {
  5803. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  5804. } else if (isUndef(oldEndVnode)) {
  5805. oldEndVnode = oldCh[--oldEndIdx];
  5806. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  5807. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5808. oldStartVnode = oldCh[++oldStartIdx];
  5809. newStartVnode = newCh[++newStartIdx];
  5810. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  5811. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5812. oldEndVnode = oldCh[--oldEndIdx];
  5813. newEndVnode = newCh[--newEndIdx];
  5814. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  5815. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5816. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  5817. oldStartVnode = oldCh[++oldStartIdx];
  5818. newEndVnode = newCh[--newEndIdx];
  5819. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  5820. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5821. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  5822. oldEndVnode = oldCh[--oldEndIdx];
  5823. newStartVnode = newCh[++newStartIdx];
  5824. } else {
  5825. if (isUndef(oldKeyToIdx)) {
  5826. oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
  5827. }
  5828. idxInOld = isDef(newStartVnode.key) ?
  5829. oldKeyToIdx[newStartVnode.key] :
  5830. findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  5831. if (isUndef(idxInOld)) { // New element
  5832. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5833. } else {
  5834. vnodeToMove = oldCh[idxInOld];
  5835. if (sameVnode(vnodeToMove, newStartVnode)) {
  5836. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5837. oldCh[idxInOld] = undefined;
  5838. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  5839. } else {
  5840. // same key but different element. treat as new element
  5841. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5842. }
  5843. }
  5844. newStartVnode = newCh[++newStartIdx];
  5845. }
  5846. }
  5847. if (oldStartIdx > oldEndIdx) {
  5848. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  5849. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  5850. } else if (newStartIdx > newEndIdx) {
  5851. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  5852. }
  5853. }
  5854. function checkDuplicateKeys(children) {
  5855. var seenKeys = {};
  5856. for (var i = 0; i < children.length; i++) {
  5857. var vnode = children[i];
  5858. var key = vnode.key;
  5859. if (isDef(key)) {
  5860. if (seenKeys[key]) {
  5861. warn(
  5862. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  5863. vnode.context
  5864. );
  5865. } else {
  5866. seenKeys[key] = true;
  5867. }
  5868. }
  5869. }
  5870. }
  5871. function findIdxInOld(node, oldCh, start, end) {
  5872. for (var i = start; i < end; i++) {
  5873. var c = oldCh[i];
  5874. if (isDef(c) && sameVnode(node, c)) {
  5875. return i
  5876. }
  5877. }
  5878. }
  5879. function patchVnode(
  5880. oldVnode,
  5881. vnode,
  5882. insertedVnodeQueue,
  5883. ownerArray,
  5884. index,
  5885. removeOnly
  5886. ) {
  5887. if (oldVnode === vnode) {
  5888. return
  5889. }
  5890. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5891. // clone reused vnode
  5892. vnode = ownerArray[index] = cloneVNode(vnode);
  5893. }
  5894. var elm = vnode.elm = oldVnode.elm;
  5895. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  5896. if (isDef(vnode.asyncFactory.resolved)) {
  5897. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  5898. } else {
  5899. vnode.isAsyncPlaceholder = true;
  5900. }
  5901. return
  5902. }
  5903. // reuse element for static trees.
  5904. // note we only do this if the vnode is cloned -
  5905. // if the new node is not cloned it means the render functions have been
  5906. // reset by the hot-reload-api and we need to do a proper re-render.
  5907. if (isTrue(vnode.isStatic) &&
  5908. isTrue(oldVnode.isStatic) &&
  5909. vnode.key === oldVnode.key &&
  5910. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  5911. ) {
  5912. vnode.componentInstance = oldVnode.componentInstance;
  5913. return
  5914. }
  5915. var i;
  5916. var data = vnode.data;
  5917. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  5918. i(oldVnode, vnode);
  5919. }
  5920. var oldCh = oldVnode.children;
  5921. var ch = vnode.children;
  5922. if (isDef(data) && isPatchable(vnode)) {
  5923. for (i = 0; i < cbs.update.length; ++i) {
  5924. cbs.update[i](oldVnode, vnode);
  5925. }
  5926. if (isDef(i = data.hook) && isDef(i = i.update)) {
  5927. i(oldVnode, vnode);
  5928. }
  5929. }
  5930. if (isUndef(vnode.text)) {
  5931. if (isDef(oldCh) && isDef(ch)) {
  5932. if (oldCh !== ch) {
  5933. updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly);
  5934. }
  5935. } else if (isDef(ch)) {
  5936. {
  5937. checkDuplicateKeys(ch);
  5938. }
  5939. if (isDef(oldVnode.text)) {
  5940. nodeOps.setTextContent(elm, '');
  5941. }
  5942. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  5943. } else if (isDef(oldCh)) {
  5944. removeVnodes(oldCh, 0, oldCh.length - 1);
  5945. } else if (isDef(oldVnode.text)) {
  5946. nodeOps.setTextContent(elm, '');
  5947. }
  5948. } else if (oldVnode.text !== vnode.text) {
  5949. nodeOps.setTextContent(elm, vnode.text);
  5950. }
  5951. if (isDef(data)) {
  5952. if (isDef(i = data.hook) && isDef(i = i.postpatch)) {
  5953. i(oldVnode, vnode);
  5954. }
  5955. }
  5956. }
  5957. function invokeInsertHook(vnode, queue, initial) {
  5958. // delay insert hooks for component root nodes, invoke them after the
  5959. // element is really inserted
  5960. if (isTrue(initial) && isDef(vnode.parent)) {
  5961. vnode.parent.data.pendingInsert = queue;
  5962. } else {
  5963. for (var i = 0; i < queue.length; ++i) {
  5964. queue[i].data.hook.insert(queue[i]);
  5965. }
  5966. }
  5967. }
  5968. var hydrationBailed = false;
  5969. // list of modules that can skip create hook during hydration because they
  5970. // are already rendered on the client or has no need for initialization
  5971. // Note: style is excluded because it relies on initial clone for future
  5972. // deep updates (#7063).
  5973. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  5974. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  5975. function hydrate(elm, vnode, insertedVnodeQueue, inVPre) {
  5976. var i;
  5977. var tag = vnode.tag;
  5978. var data = vnode.data;
  5979. var children = vnode.children;
  5980. inVPre = inVPre || (data && data.pre);
  5981. vnode.elm = elm;
  5982. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  5983. vnode.isAsyncPlaceholder = true;
  5984. return true
  5985. }
  5986. // assert node match
  5987. {
  5988. if (!assertNodeMatch(elm, vnode, inVPre)) {
  5989. return false
  5990. }
  5991. }
  5992. if (isDef(data)) {
  5993. if (isDef(i = data.hook) && isDef(i = i.init)) {
  5994. i(vnode, true /* hydrating */ );
  5995. }
  5996. if (isDef(i = vnode.componentInstance)) {
  5997. // child component. it should have hydrated its own tree.
  5998. initComponent(vnode, insertedVnodeQueue);
  5999. return true
  6000. }
  6001. }
  6002. if (isDef(tag)) {
  6003. if (isDef(children)) {
  6004. // empty element, allow client to pick up and populate children
  6005. if (!elm.hasChildNodes()) {
  6006. createChildren(vnode, children, insertedVnodeQueue);
  6007. } else {
  6008. // v-html and domProps: innerHTML
  6009. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  6010. if (i !== elm.innerHTML) {
  6011. /* istanbul ignore if */
  6012. if (typeof console !== 'undefined' &&
  6013. !hydrationBailed
  6014. ) {
  6015. hydrationBailed = true;
  6016. console.warn('Parent: ', elm);
  6017. console.warn('server innerHTML: ', i);
  6018. console.warn('client innerHTML: ', elm.innerHTML);
  6019. }
  6020. return false
  6021. }
  6022. } else {
  6023. // iterate and compare children lists
  6024. var childrenMatch = true;
  6025. var childNode = elm.firstChild;
  6026. for (var i$1 = 0; i$1 < children.length; i$1++) {
  6027. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  6028. childrenMatch = false;
  6029. break
  6030. }
  6031. childNode = childNode.nextSibling;
  6032. }
  6033. // if childNode is not null, it means the actual childNodes list is
  6034. // longer than the virtual children list.
  6035. if (!childrenMatch || childNode) {
  6036. /* istanbul ignore if */
  6037. if (typeof console !== 'undefined' &&
  6038. !hydrationBailed
  6039. ) {
  6040. hydrationBailed = true;
  6041. console.warn('Parent: ', elm);
  6042. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  6043. }
  6044. return false
  6045. }
  6046. }
  6047. }
  6048. }
  6049. if (isDef(data)) {
  6050. var fullInvoke = false;
  6051. for (var key in data) {
  6052. if (!isRenderedModule(key)) {
  6053. fullInvoke = true;
  6054. invokeCreateHooks(vnode, insertedVnodeQueue);
  6055. break
  6056. }
  6057. }
  6058. if (!fullInvoke && data['class']) {
  6059. // ensure collecting deps for deep class bindings for future updates
  6060. traverse(data['class']);
  6061. }
  6062. }
  6063. } else if (elm.data !== vnode.text) {
  6064. elm.data = vnode.text;
  6065. }
  6066. return true
  6067. }
  6068. function assertNodeMatch(node, vnode, inVPre) {
  6069. if (isDef(vnode.tag)) {
  6070. return vnode.tag.indexOf('vue-component') === 0 || (
  6071. !isUnknownElement$$1(vnode, inVPre) &&
  6072. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  6073. )
  6074. } else {
  6075. return node.nodeType === (vnode.isComment ? 8 : 3)
  6076. }
  6077. }
  6078. return function patch(oldVnode, vnode, hydrating, removeOnly) {
  6079. if (isUndef(vnode)) {
  6080. if (isDef(oldVnode)) {
  6081. invokeDestroyHook(oldVnode);
  6082. }
  6083. return
  6084. }
  6085. var isInitialPatch = false;
  6086. var insertedVnodeQueue = [];
  6087. if (isUndef(oldVnode)) {
  6088. // empty mount (likely as component), create new root element
  6089. isInitialPatch = true;
  6090. createElm(vnode, insertedVnodeQueue);
  6091. } else {
  6092. var isRealElement = isDef(oldVnode.nodeType);
  6093. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  6094. // patch existing root node
  6095. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  6096. } else {
  6097. if (isRealElement) {
  6098. // mounting to a real element
  6099. // check if this is server-rendered content and if we can perform
  6100. // a successful hydration.
  6101. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  6102. oldVnode.removeAttribute(SSR_ATTR);
  6103. hydrating = true;
  6104. }
  6105. if (isTrue(hydrating)) {
  6106. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  6107. invokeInsertHook(vnode, insertedVnodeQueue, true);
  6108. return oldVnode
  6109. } else {
  6110. warn(
  6111. 'The client-side rendered virtual DOM tree is not matching ' +
  6112. 'server-rendered content. This is likely caused by incorrect ' +
  6113. 'HTML markup, for example nesting block-level elements inside ' +
  6114. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  6115. 'full client-side render.'
  6116. );
  6117. }
  6118. }
  6119. // either not server-rendered, or hydration failed.
  6120. // create an empty node and replace it
  6121. oldVnode = emptyNodeAt(oldVnode);
  6122. }
  6123. // replacing existing element
  6124. var oldElm = oldVnode.elm;
  6125. var parentElm = nodeOps.parentNode(oldElm);
  6126. // create new node
  6127. createElm(
  6128. vnode,
  6129. insertedVnodeQueue,
  6130. // extremely rare edge case: do not insert if old element is in a
  6131. // leaving transition. Only happens when combining transition +
  6132. // keep-alive + HOCs. (#4590)
  6133. oldElm._leaveCb ? null : parentElm,
  6134. nodeOps.nextSibling(oldElm)
  6135. );
  6136. // update parent placeholder node element, recursively
  6137. if (isDef(vnode.parent)) {
  6138. var ancestor = vnode.parent;
  6139. var patchable = isPatchable(vnode);
  6140. while (ancestor) {
  6141. for (var i = 0; i < cbs.destroy.length; ++i) {
  6142. cbs.destroy[i](ancestor);
  6143. }
  6144. ancestor.elm = vnode.elm;
  6145. if (patchable) {
  6146. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  6147. cbs.create[i$1](emptyNode, ancestor);
  6148. }
  6149. // #6513
  6150. // invoke insert hooks that may have been merged by create hooks.
  6151. // e.g. for directives that uses the "inserted" hook.
  6152. var insert = ancestor.data.hook.insert;
  6153. if (insert.merged) {
  6154. // start at index 1 to avoid re-invoking component mounted hook
  6155. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  6156. insert.fns[i$2]();
  6157. }
  6158. }
  6159. } else {
  6160. registerRef(ancestor);
  6161. }
  6162. ancestor = ancestor.parent;
  6163. }
  6164. }
  6165. // destroy old node
  6166. if (isDef(parentElm)) {
  6167. removeVnodes([oldVnode], 0, 0);
  6168. } else if (isDef(oldVnode.tag)) {
  6169. invokeDestroyHook(oldVnode);
  6170. }
  6171. }
  6172. }
  6173. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  6174. return vnode.elm
  6175. }
  6176. }
  6177. /* */
  6178. var directives = {
  6179. create: updateDirectives,
  6180. update: updateDirectives,
  6181. destroy: function unbindDirectives(vnode) {
  6182. updateDirectives(vnode, emptyNode);
  6183. }
  6184. };
  6185. function updateDirectives(oldVnode, vnode) {
  6186. if (oldVnode.data.directives || vnode.data.directives) {
  6187. _update(oldVnode, vnode);
  6188. }
  6189. }
  6190. function _update(oldVnode, vnode) {
  6191. var isCreate = oldVnode === emptyNode;
  6192. var isDestroy = vnode === emptyNode;
  6193. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  6194. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  6195. var dirsWithInsert = [];
  6196. var dirsWithPostpatch = [];
  6197. var key, oldDir, dir;
  6198. for (key in newDirs) {
  6199. oldDir = oldDirs[key];
  6200. dir = newDirs[key];
  6201. if (!oldDir) {
  6202. // new directive, bind
  6203. callHook$1(dir, 'bind', vnode, oldVnode);
  6204. if (dir.def && dir.def.inserted) {
  6205. dirsWithInsert.push(dir);
  6206. }
  6207. } else {
  6208. // existing directive, update
  6209. dir.oldValue = oldDir.value;
  6210. dir.oldArg = oldDir.arg;
  6211. callHook$1(dir, 'update', vnode, oldVnode);
  6212. if (dir.def && dir.def.componentUpdated) {
  6213. dirsWithPostpatch.push(dir);
  6214. }
  6215. }
  6216. }
  6217. if (dirsWithInsert.length) {
  6218. var callInsert = function () {
  6219. for (var i = 0; i < dirsWithInsert.length; i++) {
  6220. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  6221. }
  6222. };
  6223. if (isCreate) {
  6224. mergeVNodeHook(vnode, 'insert', callInsert);
  6225. } else {
  6226. callInsert();
  6227. }
  6228. }
  6229. if (dirsWithPostpatch.length) {
  6230. mergeVNodeHook(vnode, 'postpatch', function () {
  6231. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  6232. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  6233. }
  6234. });
  6235. }
  6236. if (!isCreate) {
  6237. for (key in oldDirs) {
  6238. if (!newDirs[key]) {
  6239. // no longer present, unbind
  6240. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  6241. }
  6242. }
  6243. }
  6244. }
  6245. var emptyModifiers = Object.create(null);
  6246. function normalizeDirectives$1(
  6247. dirs,
  6248. vm
  6249. ) {
  6250. var res = Object.create(null);
  6251. if (!dirs) {
  6252. // $flow-disable-line
  6253. return res
  6254. }
  6255. var i, dir;
  6256. for (i = 0; i < dirs.length; i++) {
  6257. dir = dirs[i];
  6258. if (!dir.modifiers) {
  6259. // $flow-disable-line
  6260. dir.modifiers = emptyModifiers;
  6261. }
  6262. res[getRawDirName(dir)] = dir;
  6263. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  6264. }
  6265. // $flow-disable-line
  6266. return res
  6267. }
  6268. function getRawDirName(dir) {
  6269. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  6270. }
  6271. function callHook$1(dir, hook, vnode, oldVnode, isDestroy) {
  6272. var fn = dir.def && dir.def[hook];
  6273. if (fn) {
  6274. try {
  6275. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  6276. } catch (e) {
  6277. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  6278. }
  6279. }
  6280. }
  6281. var baseModules = [
  6282. ref,
  6283. directives
  6284. ];
  6285. /* */
  6286. function updateAttrs(oldVnode, vnode) {
  6287. var opts = vnode.componentOptions;
  6288. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  6289. return
  6290. }
  6291. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  6292. return
  6293. }
  6294. var key, cur, old;
  6295. var elm = vnode.elm;
  6296. var oldAttrs = oldVnode.data.attrs || {};
  6297. var attrs = vnode.data.attrs || {};
  6298. // clone observed objects, as the user probably wants to mutate it
  6299. if (isDef(attrs.__ob__)) {
  6300. attrs = vnode.data.attrs = extend({}, attrs);
  6301. }
  6302. for (key in attrs) {
  6303. cur = attrs[key];
  6304. old = oldAttrs[key];
  6305. if (old !== cur) {
  6306. setAttr(elm, key, cur, vnode.data.pre);
  6307. }
  6308. }
  6309. // #4391: in IE9, setting type can reset value for input[type=radio]
  6310. // #6666: IE/Edge forces progress value down to 1 before setting a max
  6311. /* istanbul ignore if */
  6312. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  6313. setAttr(elm, 'value', attrs.value);
  6314. }
  6315. for (key in oldAttrs) {
  6316. if (isUndef(attrs[key])) {
  6317. if (isXlink(key)) {
  6318. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6319. } else if (!isEnumeratedAttr(key)) {
  6320. elm.removeAttribute(key);
  6321. }
  6322. }
  6323. }
  6324. }
  6325. function setAttr(el, key, value, isInPre) {
  6326. if (isInPre || el.tagName.indexOf('-') > -1) {
  6327. baseSetAttr(el, key, value);
  6328. } else if (isBooleanAttr(key)) {
  6329. // set attribute for blank value
  6330. // e.g. <option disabled>Select one</option>
  6331. if (isFalsyAttrValue(value)) {
  6332. el.removeAttribute(key);
  6333. } else {
  6334. // technically allowfullscreen is a boolean attribute for <iframe>,
  6335. // but Flash expects a value of "true" when used on <embed> tag
  6336. value = key === 'allowfullscreen' && el.tagName === 'EMBED' ?
  6337. 'true' :
  6338. key;
  6339. el.setAttribute(key, value);
  6340. }
  6341. } else if (isEnumeratedAttr(key)) {
  6342. el.setAttribute(key, convertEnumeratedValue(key, value));
  6343. } else if (isXlink(key)) {
  6344. if (isFalsyAttrValue(value)) {
  6345. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6346. } else {
  6347. el.setAttributeNS(xlinkNS, key, value);
  6348. }
  6349. } else {
  6350. baseSetAttr(el, key, value);
  6351. }
  6352. }
  6353. function baseSetAttr(el, key, value) {
  6354. if (isFalsyAttrValue(value)) {
  6355. el.removeAttribute(key);
  6356. } else {
  6357. // #7138: IE10 & 11 fires input event when setting placeholder on
  6358. // <textarea>... block the first input event and remove the blocker
  6359. // immediately.
  6360. /* istanbul ignore if */
  6361. if (
  6362. isIE && !isIE9 &&
  6363. el.tagName === 'TEXTAREA' &&
  6364. key === 'placeholder' && value !== '' && !el.__ieph
  6365. ) {
  6366. var blocker = function (e) {
  6367. e.stopImmediatePropagation();
  6368. el.removeEventListener('input', blocker);
  6369. };
  6370. el.addEventListener('input', blocker);
  6371. // $flow-disable-line
  6372. el.__ieph = true; /* IE placeholder patched */
  6373. }
  6374. el.setAttribute(key, value);
  6375. }
  6376. }
  6377. var attrs = {
  6378. create: updateAttrs,
  6379. update: updateAttrs
  6380. };
  6381. /* */
  6382. function updateClass(oldVnode, vnode) {
  6383. var el = vnode.elm;
  6384. var data = vnode.data;
  6385. var oldData = oldVnode.data;
  6386. if (
  6387. isUndef(data.staticClass) &&
  6388. isUndef(data.class) && (
  6389. isUndef(oldData) || (
  6390. isUndef(oldData.staticClass) &&
  6391. isUndef(oldData.class)
  6392. )
  6393. )
  6394. ) {
  6395. return
  6396. }
  6397. var cls = genClassForVnode(vnode);
  6398. // handle transition classes
  6399. var transitionClass = el._transitionClasses;
  6400. if (isDef(transitionClass)) {
  6401. cls = concat(cls, stringifyClass(transitionClass));
  6402. }
  6403. // set the class
  6404. if (cls !== el._prevClass) {
  6405. el.setAttribute('class', cls);
  6406. el._prevClass = cls;
  6407. }
  6408. }
  6409. var klass = {
  6410. create: updateClass,
  6411. update: updateClass
  6412. };
  6413. /* */
  6414. var validDivisionCharRE = /[\w).+\-_$\]]/;
  6415. function parseFilters(exp) {
  6416. var inSingle = false;
  6417. var inDouble = false;
  6418. var inTemplateString = false;
  6419. var inRegex = false;
  6420. var curly = 0;
  6421. var square = 0;
  6422. var paren = 0;
  6423. var lastFilterIndex = 0;
  6424. var c, prev, i, expression, filters;
  6425. for (i = 0; i < exp.length; i++) {
  6426. prev = c;
  6427. c = exp.charCodeAt(i);
  6428. if (inSingle) {
  6429. if (c === 0x27 && prev !== 0x5C) {
  6430. inSingle = false;
  6431. }
  6432. } else if (inDouble) {
  6433. if (c === 0x22 && prev !== 0x5C) {
  6434. inDouble = false;
  6435. }
  6436. } else if (inTemplateString) {
  6437. if (c === 0x60 && prev !== 0x5C) {
  6438. inTemplateString = false;
  6439. }
  6440. } else if (inRegex) {
  6441. if (c === 0x2f && prev !== 0x5C) {
  6442. inRegex = false;
  6443. }
  6444. } else if (
  6445. c === 0x7C && // pipe
  6446. exp.charCodeAt(i + 1) !== 0x7C &&
  6447. exp.charCodeAt(i - 1) !== 0x7C &&
  6448. !curly && !square && !paren
  6449. ) {
  6450. if (expression === undefined) {
  6451. // first filter, end of expression
  6452. lastFilterIndex = i + 1;
  6453. expression = exp.slice(0, i).trim();
  6454. } else {
  6455. pushFilter();
  6456. }
  6457. } else {
  6458. switch (c) {
  6459. case 0x22:
  6460. inDouble = true;
  6461. break // "
  6462. case 0x27:
  6463. inSingle = true;
  6464. break // '
  6465. case 0x60:
  6466. inTemplateString = true;
  6467. break // `
  6468. case 0x28:
  6469. paren++;
  6470. break // (
  6471. case 0x29:
  6472. paren--;
  6473. break // )
  6474. case 0x5B:
  6475. square++;
  6476. break // [
  6477. case 0x5D:
  6478. square--;
  6479. break // ]
  6480. case 0x7B:
  6481. curly++;
  6482. break // {
  6483. case 0x7D:
  6484. curly--;
  6485. break // }
  6486. }
  6487. if (c === 0x2f) { // /
  6488. var j = i - 1;
  6489. var p = (void 0);
  6490. // find first non-whitespace prev char
  6491. for (; j >= 0; j--) {
  6492. p = exp.charAt(j);
  6493. if (p !== ' ') {
  6494. break
  6495. }
  6496. }
  6497. if (!p || !validDivisionCharRE.test(p)) {
  6498. inRegex = true;
  6499. }
  6500. }
  6501. }
  6502. }
  6503. if (expression === undefined) {
  6504. expression = exp.slice(0, i).trim();
  6505. } else if (lastFilterIndex !== 0) {
  6506. pushFilter();
  6507. }
  6508. function pushFilter() {
  6509. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  6510. lastFilterIndex = i + 1;
  6511. }
  6512. if (filters) {
  6513. for (i = 0; i < filters.length; i++) {
  6514. expression = wrapFilter(expression, filters[i]);
  6515. }
  6516. }
  6517. return expression
  6518. }
  6519. function wrapFilter(exp, filter) {
  6520. var i = filter.indexOf('(');
  6521. if (i < 0) {
  6522. // _f: resolveFilter
  6523. return ("_f(\"" + filter + "\")(" + exp + ")")
  6524. } else {
  6525. var name = filter.slice(0, i);
  6526. var args = filter.slice(i + 1);
  6527. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  6528. }
  6529. }
  6530. /* */
  6531. /* eslint-disable no-unused-vars */
  6532. function baseWarn(msg, range) {
  6533. console.error(("[Vue compiler]: " + msg));
  6534. }
  6535. /* eslint-enable no-unused-vars */
  6536. function pluckModuleFunction(
  6537. modules,
  6538. key
  6539. ) {
  6540. return modules ?
  6541. modules.map(function (m) {
  6542. return m[key];
  6543. }).filter(function (_) {
  6544. return _;
  6545. }) :
  6546. []
  6547. }
  6548. function addProp(el, name, value, range, dynamic) {
  6549. (el.props || (el.props = [])).push(rangeSetItem({
  6550. name: name,
  6551. value: value,
  6552. dynamic: dynamic
  6553. }, range));
  6554. el.plain = false;
  6555. }
  6556. function addAttr(el, name, value, range, dynamic) {
  6557. var attrs = dynamic ?
  6558. (el.dynamicAttrs || (el.dynamicAttrs = [])) :
  6559. (el.attrs || (el.attrs = []));
  6560. attrs.push(rangeSetItem({
  6561. name: name,
  6562. value: value,
  6563. dynamic: dynamic
  6564. }, range));
  6565. el.plain = false;
  6566. }
  6567. // add a raw attr (use this in preTransforms)
  6568. function addRawAttr(el, name, value, range) {
  6569. el.attrsMap[name] = value;
  6570. el.attrsList.push(rangeSetItem({
  6571. name: name,
  6572. value: value
  6573. }, range));
  6574. }
  6575. function addDirective(
  6576. el,
  6577. name,
  6578. rawName,
  6579. value,
  6580. arg,
  6581. isDynamicArg,
  6582. modifiers,
  6583. range
  6584. ) {
  6585. (el.directives || (el.directives = [])).push(rangeSetItem({
  6586. name: name,
  6587. rawName: rawName,
  6588. value: value,
  6589. arg: arg,
  6590. isDynamicArg: isDynamicArg,
  6591. modifiers: modifiers
  6592. }, range));
  6593. el.plain = false;
  6594. }
  6595. function prependModifierMarker(symbol, name, dynamic) {
  6596. return dynamic ?
  6597. ("_p(" + name + ",\"" + symbol + "\")") :
  6598. symbol + name // mark the event as captured
  6599. }
  6600. function addHandler(
  6601. el,
  6602. name,
  6603. value,
  6604. modifiers,
  6605. important,
  6606. warn,
  6607. range,
  6608. dynamic
  6609. ) {
  6610. modifiers = modifiers || emptyObject;
  6611. // warn prevent and passive modifier
  6612. /* istanbul ignore if */
  6613. if (
  6614. warn &&
  6615. modifiers.prevent && modifiers.passive
  6616. ) {
  6617. warn(
  6618. 'passive and prevent can\'t be used together. ' +
  6619. 'Passive handler can\'t prevent default event.',
  6620. range
  6621. );
  6622. }
  6623. // normalize click.right and click.middle since they don't actually fire
  6624. // this is technically browser-specific, but at least for now browsers are
  6625. // the only target envs that have right/middle clicks.
  6626. if (modifiers.right) {
  6627. if (dynamic) {
  6628. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  6629. } else if (name === 'click') {
  6630. name = 'contextmenu';
  6631. delete modifiers.right;
  6632. }
  6633. } else if (modifiers.middle) {
  6634. if (dynamic) {
  6635. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  6636. } else if (name === 'click') {
  6637. name = 'mouseup';
  6638. }
  6639. }
  6640. // check capture modifier
  6641. if (modifiers.capture) {
  6642. delete modifiers.capture;
  6643. name = prependModifierMarker('!', name, dynamic);
  6644. }
  6645. if (modifiers.once) {
  6646. delete modifiers.once;
  6647. name = prependModifierMarker('~', name, dynamic);
  6648. }
  6649. /* istanbul ignore if */
  6650. if (modifiers.passive) {
  6651. delete modifiers.passive;
  6652. name = prependModifierMarker('&', name, dynamic);
  6653. }
  6654. var events;
  6655. if (modifiers.native) {
  6656. delete modifiers.native;
  6657. events = el.nativeEvents || (el.nativeEvents = {});
  6658. } else {
  6659. events = el.events || (el.events = {});
  6660. }
  6661. var newHandler = rangeSetItem({
  6662. value: value.trim(),
  6663. dynamic: dynamic
  6664. }, range);
  6665. if (modifiers !== emptyObject) {
  6666. newHandler.modifiers = modifiers;
  6667. }
  6668. var handlers = events[name];
  6669. /* istanbul ignore if */
  6670. if (Array.isArray(handlers)) {
  6671. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  6672. } else if (handlers) {
  6673. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  6674. } else {
  6675. events[name] = newHandler;
  6676. }
  6677. el.plain = false;
  6678. }
  6679. function getRawBindingAttr(
  6680. el,
  6681. name
  6682. ) {
  6683. return el.rawAttrsMap[':' + name] ||
  6684. el.rawAttrsMap['v-bind:' + name] ||
  6685. el.rawAttrsMap[name]
  6686. }
  6687. function getBindingAttr(
  6688. el,
  6689. name,
  6690. getStatic
  6691. ) {
  6692. var dynamicValue =
  6693. getAndRemoveAttr(el, ':' + name) ||
  6694. getAndRemoveAttr(el, 'v-bind:' + name);
  6695. if (dynamicValue != null) {
  6696. return parseFilters(dynamicValue)
  6697. } else if (getStatic !== false) {
  6698. var staticValue = getAndRemoveAttr(el, name);
  6699. if (staticValue != null) {
  6700. return JSON.stringify(staticValue)
  6701. }
  6702. }
  6703. }
  6704. // note: this only removes the attr from the Array (attrsList) so that it
  6705. // doesn't get processed by processAttrs.
  6706. // By default it does NOT remove it from the map (attrsMap) because the map is
  6707. // needed during codegen.
  6708. function getAndRemoveAttr(
  6709. el,
  6710. name,
  6711. removeFromMap
  6712. ) {
  6713. var val;
  6714. if ((val = el.attrsMap[name]) != null) {
  6715. var list = el.attrsList;
  6716. for (var i = 0, l = list.length; i < l; i++) {
  6717. if (list[i].name === name) {
  6718. list.splice(i, 1);
  6719. break
  6720. }
  6721. }
  6722. }
  6723. if (removeFromMap) {
  6724. delete el.attrsMap[name];
  6725. }
  6726. return val
  6727. }
  6728. function getAndRemoveAttrByRegex(
  6729. el,
  6730. name
  6731. ) {
  6732. var list = el.attrsList;
  6733. for (var i = 0, l = list.length; i < l; i++) {
  6734. var attr = list[i];
  6735. if (name.test(attr.name)) {
  6736. list.splice(i, 1);
  6737. return attr
  6738. }
  6739. }
  6740. }
  6741. function rangeSetItem(
  6742. item,
  6743. range
  6744. ) {
  6745. if (range) {
  6746. if (range.start != null) {
  6747. item.start = range.start;
  6748. }
  6749. if (range.end != null) {
  6750. item.end = range.end;
  6751. }
  6752. }
  6753. return item
  6754. }
  6755. /* */
  6756. /**
  6757. * Cross-platform code generation for component v-model
  6758. */
  6759. function genComponentModel(
  6760. el,
  6761. value,
  6762. modifiers
  6763. ) {
  6764. var ref = modifiers || {};
  6765. var number = ref.number;
  6766. var trim = ref.trim;
  6767. var baseValueExpression = '$$v';
  6768. var valueExpression = baseValueExpression;
  6769. if (trim) {
  6770. valueExpression =
  6771. "(typeof " + baseValueExpression + " === 'string'" +
  6772. "? " + baseValueExpression + ".trim()" +
  6773. ": " + baseValueExpression + ")";
  6774. }
  6775. if (number) {
  6776. valueExpression = "_n(" + valueExpression + ")";
  6777. }
  6778. var assignment = genAssignmentCode(value, valueExpression);
  6779. el.model = {
  6780. value: ("(" + value + ")"),
  6781. expression: JSON.stringify(value),
  6782. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  6783. };
  6784. }
  6785. /**
  6786. * Cross-platform codegen helper for generating v-model value assignment code.
  6787. */
  6788. function genAssignmentCode(
  6789. value,
  6790. assignment
  6791. ) {
  6792. var res = parseModel(value);
  6793. if (res.key === null) {
  6794. return (value + "=" + assignment)
  6795. } else {
  6796. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  6797. }
  6798. }
  6799. /**
  6800. * Parse a v-model expression into a base path and a final key segment.
  6801. * Handles both dot-path and possible square brackets.
  6802. *
  6803. * Possible cases:
  6804. *
  6805. * - test
  6806. * - test[key]
  6807. * - test[test1[key]]
  6808. * - test["a"][key]
  6809. * - xxx.test[a[a].test1[key]]
  6810. * - test.xxx.a["asa"][test1[key]]
  6811. *
  6812. */
  6813. var len, str, chr, index$1, expressionPos, expressionEndPos;
  6814. function parseModel(val) {
  6815. // Fix https://github.com/vuejs/vue/pull/7730
  6816. // allow v-model="obj.val " (trailing whitespace)
  6817. val = val.trim();
  6818. len = val.length;
  6819. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  6820. index$1 = val.lastIndexOf('.');
  6821. if (index$1 > -1) {
  6822. return {
  6823. exp: val.slice(0, index$1),
  6824. key: '"' + val.slice(index$1 + 1) + '"'
  6825. }
  6826. } else {
  6827. return {
  6828. exp: val,
  6829. key: null
  6830. }
  6831. }
  6832. }
  6833. str = val;
  6834. index$1 = expressionPos = expressionEndPos = 0;
  6835. while (!eof()) {
  6836. chr = next();
  6837. /* istanbul ignore if */
  6838. if (isStringStart(chr)) {
  6839. parseString(chr);
  6840. } else if (chr === 0x5B) {
  6841. parseBracket(chr);
  6842. }
  6843. }
  6844. return {
  6845. exp: val.slice(0, expressionPos),
  6846. key: val.slice(expressionPos + 1, expressionEndPos)
  6847. }
  6848. }
  6849. function next() {
  6850. return str.charCodeAt(++index$1)
  6851. }
  6852. function eof() {
  6853. return index$1 >= len
  6854. }
  6855. function isStringStart(chr) {
  6856. return chr === 0x22 || chr === 0x27
  6857. }
  6858. function parseBracket(chr) {
  6859. var inBracket = 1;
  6860. expressionPos = index$1;
  6861. while (!eof()) {
  6862. chr = next();
  6863. if (isStringStart(chr)) {
  6864. parseString(chr);
  6865. continue
  6866. }
  6867. if (chr === 0x5B) {
  6868. inBracket++;
  6869. }
  6870. if (chr === 0x5D) {
  6871. inBracket--;
  6872. }
  6873. if (inBracket === 0) {
  6874. expressionEndPos = index$1;
  6875. break
  6876. }
  6877. }
  6878. }
  6879. function parseString(chr) {
  6880. var stringQuote = chr;
  6881. while (!eof()) {
  6882. chr = next();
  6883. if (chr === stringQuote) {
  6884. break
  6885. }
  6886. }
  6887. }
  6888. /* */
  6889. var warn$1;
  6890. // in some cases, the event used has to be determined at runtime
  6891. // so we used some reserved tokens during compile.
  6892. var RANGE_TOKEN = '__r';
  6893. var CHECKBOX_RADIO_TOKEN = '__c';
  6894. function model(
  6895. el,
  6896. dir,
  6897. _warn
  6898. ) {
  6899. warn$1 = _warn;
  6900. var value = dir.value;
  6901. var modifiers = dir.modifiers;
  6902. var tag = el.tag;
  6903. var type = el.attrsMap.type;
  6904. {
  6905. // inputs with type="file" are read only and setting the input's
  6906. // value will throw an error.
  6907. if (tag === 'input' && type === 'file') {
  6908. warn$1(
  6909. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  6910. "File inputs are read only. Use a v-on:change listener instead.",
  6911. el.rawAttrsMap['v-model']
  6912. );
  6913. }
  6914. }
  6915. if (el.component) {
  6916. genComponentModel(el, value, modifiers);
  6917. // component v-model doesn't need extra runtime
  6918. return false
  6919. } else if (tag === 'select') {
  6920. genSelect(el, value, modifiers);
  6921. } else if (tag === 'input' && type === 'checkbox') {
  6922. genCheckboxModel(el, value, modifiers);
  6923. } else if (tag === 'input' && type === 'radio') {
  6924. genRadioModel(el, value, modifiers);
  6925. } else if (tag === 'input' || tag === 'textarea') {
  6926. genDefaultModel(el, value, modifiers);
  6927. } else if (!config.isReservedTag(tag)) {
  6928. genComponentModel(el, value, modifiers);
  6929. // component v-model doesn't need extra runtime
  6930. return false
  6931. } else {
  6932. warn$1(
  6933. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  6934. "v-model is not supported on this element type. " +
  6935. 'If you are working with contenteditable, it\'s recommended to ' +
  6936. 'wrap a library dedicated for that purpose inside a custom component.',
  6937. el.rawAttrsMap['v-model']
  6938. );
  6939. }
  6940. // ensure runtime directive metadata
  6941. return true
  6942. }
  6943. function genCheckboxModel(
  6944. el,
  6945. value,
  6946. modifiers
  6947. ) {
  6948. var number = modifiers && modifiers.number;
  6949. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6950. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  6951. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  6952. addProp(el, 'checked',
  6953. "Array.isArray(" + value + ")" +
  6954. "?_i(" + value + "," + valueBinding + ")>-1" + (
  6955. trueValueBinding === 'true' ?
  6956. (":(" + value + ")") :
  6957. (":_q(" + value + "," + trueValueBinding + ")")
  6958. )
  6959. );
  6960. addHandler(el, 'change',
  6961. "var $$a=" + value + "," +
  6962. '$$el=$event.target,' +
  6963. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  6964. 'if(Array.isArray($$a)){' +
  6965. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  6966. '$$i=_i($$a,$$v);' +
  6967. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  6968. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  6969. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  6970. null, true
  6971. );
  6972. }
  6973. function genRadioModel(
  6974. el,
  6975. value,
  6976. modifiers
  6977. ) {
  6978. var number = modifiers && modifiers.number;
  6979. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6980. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  6981. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  6982. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  6983. }
  6984. function genSelect(
  6985. el,
  6986. value,
  6987. modifiers
  6988. ) {
  6989. var number = modifiers && modifiers.number;
  6990. var selectedVal = "Array.prototype.filter" +
  6991. ".call($event.target.options,function(o){return o.selected})" +
  6992. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  6993. "return " + (number ? '_n(val)' : 'val') + "})";
  6994. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  6995. var code = "var $$selectedVal = " + selectedVal + ";";
  6996. code = code + " " + (genAssignmentCode(value, assignment));
  6997. addHandler(el, 'change', code, null, true);
  6998. }
  6999. function genDefaultModel(
  7000. el,
  7001. value,
  7002. modifiers
  7003. ) {
  7004. var type = el.attrsMap.type;
  7005. // warn if v-bind:value conflicts with v-model
  7006. // except for inputs with v-bind:type
  7007. {
  7008. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  7009. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  7010. if (value$1 && !typeBinding) {
  7011. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  7012. warn$1(
  7013. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  7014. 'because the latter already expands to a value binding internally',
  7015. el.rawAttrsMap[binding]
  7016. );
  7017. }
  7018. }
  7019. var ref = modifiers || {};
  7020. var lazy = ref.lazy;
  7021. var number = ref.number;
  7022. var trim = ref.trim;
  7023. var needCompositionGuard = !lazy && type !== 'range';
  7024. var event = lazy ?
  7025. 'change' :
  7026. type === 'range' ?
  7027. RANGE_TOKEN :
  7028. 'input';
  7029. var valueExpression = '$event.target.value';
  7030. if (trim) {
  7031. valueExpression = "$event.target.value.trim()";
  7032. }
  7033. if (number) {
  7034. valueExpression = "_n(" + valueExpression + ")";
  7035. }
  7036. var code = genAssignmentCode(value, valueExpression);
  7037. if (needCompositionGuard) {
  7038. code = "if($event.target.composing)return;" + code;
  7039. }
  7040. addProp(el, 'value', ("(" + value + ")"));
  7041. addHandler(el, event, code, null, true);
  7042. if (trim || number) {
  7043. addHandler(el, 'blur', '$forceUpdate()');
  7044. }
  7045. }
  7046. /* */
  7047. // normalize v-model event tokens that can only be determined at runtime.
  7048. // it's important to place the event as the first in the array because
  7049. // the whole point is ensuring the v-model callback gets called before
  7050. // user-attached handlers.
  7051. function normalizeEvents(on) {
  7052. /* istanbul ignore if */
  7053. if (isDef(on[RANGE_TOKEN])) {
  7054. // IE input[type=range] only supports `change` event
  7055. var event = isIE ? 'change' : 'input';
  7056. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  7057. delete on[RANGE_TOKEN];
  7058. }
  7059. // This was originally intended to fix #4521 but no longer necessary
  7060. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  7061. /* istanbul ignore if */
  7062. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  7063. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  7064. delete on[CHECKBOX_RADIO_TOKEN];
  7065. }
  7066. }
  7067. var target$1;
  7068. function createOnceHandler$1(event, handler, capture) {
  7069. var _target = target$1; // save current target element in closure
  7070. return function onceHandler() {
  7071. var res = handler.apply(null, arguments);
  7072. if (res !== null) {
  7073. remove$2(event, onceHandler, capture, _target);
  7074. }
  7075. }
  7076. }
  7077. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  7078. // implementation and does not fire microtasks in between event propagation, so
  7079. // safe to exclude.
  7080. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  7081. function add$1(
  7082. name,
  7083. handler,
  7084. capture,
  7085. passive
  7086. ) {
  7087. // async edge case #6566: inner click event triggers patch, event handler
  7088. // attached to outer element during patch, and triggered again. This
  7089. // happens because browsers fire microtask ticks between event propagation.
  7090. // the solution is simple: we save the timestamp when a handler is attached,
  7091. // and the handler would only fire if the event passed to it was fired
  7092. // AFTER it was attached.
  7093. if (useMicrotaskFix) {
  7094. var attachedTimestamp = currentFlushTimestamp;
  7095. var original = handler;
  7096. handler = original._wrapper = function (e) {
  7097. if (
  7098. // no bubbling, should always fire.
  7099. // this is just a safety net in case event.timeStamp is unreliable in
  7100. // certain weird environments...
  7101. e.target === e.currentTarget ||
  7102. // event is fired after handler attachment
  7103. e.timeStamp >= attachedTimestamp ||
  7104. // bail for environments that have buggy event.timeStamp implementations
  7105. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  7106. // #9681 QtWebEngine event.timeStamp is negative value
  7107. e.timeStamp <= 0 ||
  7108. // #9448 bail if event is fired in another document in a multi-page
  7109. // electron/nw.js app, since event.timeStamp will be using a different
  7110. // starting reference
  7111. e.target.ownerDocument !== document
  7112. ) {
  7113. return original.apply(this, arguments)
  7114. }
  7115. };
  7116. }
  7117. target$1.addEventListener(
  7118. name,
  7119. handler,
  7120. supportsPassive ?
  7121. {
  7122. capture: capture,
  7123. passive: passive
  7124. } :
  7125. capture
  7126. );
  7127. }
  7128. function remove$2(
  7129. name,
  7130. handler,
  7131. capture,
  7132. _target
  7133. ) {
  7134. (_target || target$1).removeEventListener(
  7135. name,
  7136. handler._wrapper || handler,
  7137. capture
  7138. );
  7139. }
  7140. function updateDOMListeners(oldVnode, vnode) {
  7141. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  7142. return
  7143. }
  7144. var on = vnode.data.on || {};
  7145. var oldOn = oldVnode.data.on || {};
  7146. target$1 = vnode.elm;
  7147. normalizeEvents(on);
  7148. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  7149. target$1 = undefined;
  7150. }
  7151. var events = {
  7152. create: updateDOMListeners,
  7153. update: updateDOMListeners
  7154. };
  7155. /* */
  7156. var svgContainer;
  7157. function updateDOMProps(oldVnode, vnode) {
  7158. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  7159. return
  7160. }
  7161. var key, cur;
  7162. var elm = vnode.elm;
  7163. var oldProps = oldVnode.data.domProps || {};
  7164. var props = vnode.data.domProps || {};
  7165. // clone observed objects, as the user probably wants to mutate it
  7166. if (isDef(props.__ob__)) {
  7167. props = vnode.data.domProps = extend({}, props);
  7168. }
  7169. for (key in oldProps) {
  7170. if (!(key in props)) {
  7171. elm[key] = '';
  7172. }
  7173. }
  7174. for (key in props) {
  7175. cur = props[key];
  7176. // ignore children if the node has textContent or innerHTML,
  7177. // as these will throw away existing DOM nodes and cause removal errors
  7178. // on subsequent patches (#3360)
  7179. if (key === 'textContent' || key === 'innerHTML') {
  7180. if (vnode.children) {
  7181. vnode.children.length = 0;
  7182. }
  7183. if (cur === oldProps[key]) {
  7184. continue
  7185. }
  7186. // #6601 work around Chrome version <= 55 bug where single textNode
  7187. // replaced by innerHTML/textContent retains its parentNode property
  7188. if (elm.childNodes.length === 1) {
  7189. elm.removeChild(elm.childNodes[0]);
  7190. }
  7191. }
  7192. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  7193. // store value as _value as well since
  7194. // non-string values will be stringified
  7195. elm._value = cur;
  7196. // avoid resetting cursor position when value is the same
  7197. var strCur = isUndef(cur) ? '' : String(cur);
  7198. if (shouldUpdateValue(elm, strCur)) {
  7199. elm.value = strCur;
  7200. }
  7201. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  7202. // IE doesn't support innerHTML for SVG elements
  7203. svgContainer = svgContainer || document.createElement('div');
  7204. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  7205. var svg = svgContainer.firstChild;
  7206. while (elm.firstChild) {
  7207. elm.removeChild(elm.firstChild);
  7208. }
  7209. while (svg.firstChild) {
  7210. elm.appendChild(svg.firstChild);
  7211. }
  7212. } else if (
  7213. // skip the update if old and new VDOM state is the same.
  7214. // `value` is handled separately because the DOM value may be temporarily
  7215. // out of sync with VDOM state due to focus, composition and modifiers.
  7216. // This #4521 by skipping the unnecessary `checked` update.
  7217. cur !== oldProps[key]
  7218. ) {
  7219. // some property updates can throw
  7220. // e.g. `value` on <progress> w/ non-finite value
  7221. try {
  7222. elm[key] = cur;
  7223. } catch (e) {}
  7224. }
  7225. }
  7226. }
  7227. // check platforms/web/util/attrs.js acceptValue
  7228. function shouldUpdateValue(elm, checkVal) {
  7229. return (!elm.composing && (
  7230. elm.tagName === 'OPTION' ||
  7231. isNotInFocusAndDirty(elm, checkVal) ||
  7232. isDirtyWithModifiers(elm, checkVal)
  7233. ))
  7234. }
  7235. function isNotInFocusAndDirty(elm, checkVal) {
  7236. // return true when textbox (.number and .trim) loses focus and its value is
  7237. // not equal to the updated value
  7238. var notInFocus = true;
  7239. // #6157
  7240. // work around IE bug when accessing document.activeElement in an iframe
  7241. try {
  7242. notInFocus = document.activeElement !== elm;
  7243. } catch (e) {}
  7244. return notInFocus && elm.value !== checkVal
  7245. }
  7246. function isDirtyWithModifiers(elm, newVal) {
  7247. var value = elm.value;
  7248. var modifiers = elm._vModifiers; // injected by v-model runtime
  7249. if (isDef(modifiers)) {
  7250. if (modifiers.number) {
  7251. return toNumber(value) !== toNumber(newVal)
  7252. }
  7253. if (modifiers.trim) {
  7254. return value.trim() !== newVal.trim()
  7255. }
  7256. }
  7257. return value !== newVal
  7258. }
  7259. var domProps = {
  7260. create: updateDOMProps,
  7261. update: updateDOMProps
  7262. };
  7263. /* */
  7264. var parseStyleText = cached(function (cssText) {
  7265. var res = {};
  7266. var listDelimiter = /;(?![^(]*\))/g;
  7267. var propertyDelimiter = /:(.+)/;
  7268. cssText.split(listDelimiter).forEach(function (item) {
  7269. if (item) {
  7270. var tmp = item.split(propertyDelimiter);
  7271. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  7272. }
  7273. });
  7274. return res
  7275. });
  7276. // merge static and dynamic style data on the same vnode
  7277. function normalizeStyleData(data) {
  7278. var style = normalizeStyleBinding(data.style);
  7279. // static style is pre-processed into an object during compilation
  7280. // and is always a fresh object, so it's safe to merge into it
  7281. return data.staticStyle ?
  7282. extend(data.staticStyle, style) :
  7283. style
  7284. }
  7285. // normalize possible array / string values into Object
  7286. function normalizeStyleBinding(bindingStyle) {
  7287. if (Array.isArray(bindingStyle)) {
  7288. return toObject(bindingStyle)
  7289. }
  7290. if (typeof bindingStyle === 'string') {
  7291. return parseStyleText(bindingStyle)
  7292. }
  7293. return bindingStyle
  7294. }
  7295. /**
  7296. * parent component style should be after child's
  7297. * so that parent component's style could override it
  7298. */
  7299. function getStyle(vnode, checkChild) {
  7300. var res = {};
  7301. var styleData;
  7302. if (checkChild) {
  7303. var childNode = vnode;
  7304. while (childNode.componentInstance) {
  7305. childNode = childNode.componentInstance._vnode;
  7306. if (
  7307. childNode && childNode.data &&
  7308. (styleData = normalizeStyleData(childNode.data))
  7309. ) {
  7310. extend(res, styleData);
  7311. }
  7312. }
  7313. }
  7314. if ((styleData = normalizeStyleData(vnode.data))) {
  7315. extend(res, styleData);
  7316. }
  7317. var parentNode = vnode;
  7318. while ((parentNode = parentNode.parent)) {
  7319. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  7320. extend(res, styleData);
  7321. }
  7322. }
  7323. return res
  7324. }
  7325. /* */
  7326. var cssVarRE = /^--/;
  7327. var importantRE = /\s*!important$/;
  7328. var setProp = function (el, name, val) {
  7329. /* istanbul ignore if */
  7330. if (cssVarRE.test(name)) {
  7331. el.style.setProperty(name, val);
  7332. } else if (importantRE.test(val)) {
  7333. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  7334. } else {
  7335. var normalizedName = normalize(name);
  7336. if (Array.isArray(val)) {
  7337. // Support values array created by autoprefixer, e.g.
  7338. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  7339. // Set them one by one, and the browser will only set those it can recognize
  7340. for (var i = 0, len = val.length; i < len; i++) {
  7341. el.style[normalizedName] = val[i];
  7342. }
  7343. } else {
  7344. el.style[normalizedName] = val;
  7345. }
  7346. }
  7347. };
  7348. var vendorNames = ['Webkit', 'Moz', 'ms'];
  7349. var emptyStyle;
  7350. var normalize = cached(function (prop) {
  7351. emptyStyle = emptyStyle || document.createElement('div').style;
  7352. prop = camelize(prop);
  7353. if (prop !== 'filter' && (prop in emptyStyle)) {
  7354. return prop
  7355. }
  7356. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  7357. for (var i = 0; i < vendorNames.length; i++) {
  7358. var name = vendorNames[i] + capName;
  7359. if (name in emptyStyle) {
  7360. return name
  7361. }
  7362. }
  7363. });
  7364. function updateStyle(oldVnode, vnode) {
  7365. var data = vnode.data;
  7366. var oldData = oldVnode.data;
  7367. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  7368. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  7369. ) {
  7370. return
  7371. }
  7372. var cur, name;
  7373. var el = vnode.elm;
  7374. var oldStaticStyle = oldData.staticStyle;
  7375. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  7376. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  7377. var oldStyle = oldStaticStyle || oldStyleBinding;
  7378. var style = normalizeStyleBinding(vnode.data.style) || {};
  7379. // store normalized style under a different key for next diff
  7380. // make sure to clone it if it's reactive, since the user likely wants
  7381. // to mutate it.
  7382. vnode.data.normalizedStyle = isDef(style.__ob__) ?
  7383. extend({}, style) :
  7384. style;
  7385. var newStyle = getStyle(vnode, true);
  7386. for (name in oldStyle) {
  7387. if (isUndef(newStyle[name])) {
  7388. setProp(el, name, '');
  7389. }
  7390. }
  7391. for (name in newStyle) {
  7392. cur = newStyle[name];
  7393. if (cur !== oldStyle[name]) {
  7394. // ie9 setting to null has no effect, must use empty string
  7395. setProp(el, name, cur == null ? '' : cur);
  7396. }
  7397. }
  7398. }
  7399. var style = {
  7400. create: updateStyle,
  7401. update: updateStyle
  7402. };
  7403. /* */
  7404. var whitespaceRE = /\s+/;
  7405. /**
  7406. * Add class with compatibility for SVG since classList is not supported on
  7407. * SVG elements in IE
  7408. */
  7409. function addClass(el, cls) {
  7410. /* istanbul ignore if */
  7411. if (!cls || !(cls = cls.trim())) {
  7412. return
  7413. }
  7414. /* istanbul ignore else */
  7415. if (el.classList) {
  7416. if (cls.indexOf(' ') > -1) {
  7417. cls.split(whitespaceRE).forEach(function (c) {
  7418. return el.classList.add(c);
  7419. });
  7420. } else {
  7421. el.classList.add(cls);
  7422. }
  7423. } else {
  7424. var cur = " " + (el.getAttribute('class') || '') + " ";
  7425. if (cur.indexOf(' ' + cls + ' ') < 0) {
  7426. el.setAttribute('class', (cur + cls).trim());
  7427. }
  7428. }
  7429. }
  7430. /**
  7431. * Remove class with compatibility for SVG since classList is not supported on
  7432. * SVG elements in IE
  7433. */
  7434. function removeClass(el, cls) {
  7435. /* istanbul ignore if */
  7436. if (!cls || !(cls = cls.trim())) {
  7437. return
  7438. }
  7439. /* istanbul ignore else */
  7440. if (el.classList) {
  7441. if (cls.indexOf(' ') > -1) {
  7442. cls.split(whitespaceRE).forEach(function (c) {
  7443. return el.classList.remove(c);
  7444. });
  7445. } else {
  7446. el.classList.remove(cls);
  7447. }
  7448. if (!el.classList.length) {
  7449. el.removeAttribute('class');
  7450. }
  7451. } else {
  7452. var cur = " " + (el.getAttribute('class') || '') + " ";
  7453. var tar = ' ' + cls + ' ';
  7454. while (cur.indexOf(tar) >= 0) {
  7455. cur = cur.replace(tar, ' ');
  7456. }
  7457. cur = cur.trim();
  7458. if (cur) {
  7459. el.setAttribute('class', cur);
  7460. } else {
  7461. el.removeAttribute('class');
  7462. }
  7463. }
  7464. }
  7465. /* */
  7466. function resolveTransition(def$$1) {
  7467. if (!def$$1) {
  7468. return
  7469. }
  7470. /* istanbul ignore else */
  7471. if (typeof def$$1 === 'object') {
  7472. var res = {};
  7473. if (def$$1.css !== false) {
  7474. extend(res, autoCssTransition(def$$1.name || 'v'));
  7475. }
  7476. extend(res, def$$1);
  7477. return res
  7478. } else if (typeof def$$1 === 'string') {
  7479. return autoCssTransition(def$$1)
  7480. }
  7481. }
  7482. var autoCssTransition = cached(function (name) {
  7483. return {
  7484. enterClass: (name + "-enter"),
  7485. enterToClass: (name + "-enter-to"),
  7486. enterActiveClass: (name + "-enter-active"),
  7487. leaveClass: (name + "-leave"),
  7488. leaveToClass: (name + "-leave-to"),
  7489. leaveActiveClass: (name + "-leave-active")
  7490. }
  7491. });
  7492. var hasTransition = inBrowser && !isIE9;
  7493. var TRANSITION = 'transition';
  7494. var ANIMATION = 'animation';
  7495. // Transition property/event sniffing
  7496. var transitionProp = 'transition';
  7497. var transitionEndEvent = 'transitionend';
  7498. var animationProp = 'animation';
  7499. var animationEndEvent = 'animationend';
  7500. if (hasTransition) {
  7501. /* istanbul ignore if */
  7502. if (window.ontransitionend === undefined &&
  7503. window.onwebkittransitionend !== undefined
  7504. ) {
  7505. transitionProp = 'WebkitTransition';
  7506. transitionEndEvent = 'webkitTransitionEnd';
  7507. }
  7508. if (window.onanimationend === undefined &&
  7509. window.onwebkitanimationend !== undefined
  7510. ) {
  7511. animationProp = 'WebkitAnimation';
  7512. animationEndEvent = 'webkitAnimationEnd';
  7513. }
  7514. }
  7515. // binding to window is necessary to make hot reload work in IE in strict mode
  7516. var raf = inBrowser ?
  7517. window.requestAnimationFrame ?
  7518. window.requestAnimationFrame.bind(window) :
  7519. setTimeout :
  7520. /* istanbul ignore next */ function (fn) {
  7521. return fn();
  7522. };
  7523. function nextFrame(fn) {
  7524. raf(function () {
  7525. raf(fn);
  7526. });
  7527. }
  7528. function addTransitionClass(el, cls) {
  7529. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  7530. if (transitionClasses.indexOf(cls) < 0) {
  7531. transitionClasses.push(cls);
  7532. addClass(el, cls);
  7533. }
  7534. }
  7535. function removeTransitionClass(el, cls) {
  7536. if (el._transitionClasses) {
  7537. remove(el._transitionClasses, cls);
  7538. }
  7539. removeClass(el, cls);
  7540. }
  7541. function whenTransitionEnds(
  7542. el,
  7543. expectedType,
  7544. cb
  7545. ) {
  7546. var ref = getTransitionInfo(el, expectedType);
  7547. var type = ref.type;
  7548. var timeout = ref.timeout;
  7549. var propCount = ref.propCount;
  7550. if (!type) {
  7551. return cb()
  7552. }
  7553. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  7554. var ended = 0;
  7555. var end = function () {
  7556. el.removeEventListener(event, onEnd);
  7557. cb();
  7558. };
  7559. var onEnd = function (e) {
  7560. if (e.target === el) {
  7561. if (++ended >= propCount) {
  7562. end();
  7563. }
  7564. }
  7565. };
  7566. setTimeout(function () {
  7567. if (ended < propCount) {
  7568. end();
  7569. }
  7570. }, timeout + 1);
  7571. el.addEventListener(event, onEnd);
  7572. }
  7573. var transformRE = /\b(transform|all)(,|$)/;
  7574. function getTransitionInfo(el, expectedType) {
  7575. var styles = window.getComputedStyle(el);
  7576. // JSDOM may return undefined for transition properties
  7577. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  7578. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  7579. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  7580. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  7581. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  7582. var animationTimeout = getTimeout(animationDelays, animationDurations);
  7583. var type;
  7584. var timeout = 0;
  7585. var propCount = 0;
  7586. /* istanbul ignore if */
  7587. if (expectedType === TRANSITION) {
  7588. if (transitionTimeout > 0) {
  7589. type = TRANSITION;
  7590. timeout = transitionTimeout;
  7591. propCount = transitionDurations.length;
  7592. }
  7593. } else if (expectedType === ANIMATION) {
  7594. if (animationTimeout > 0) {
  7595. type = ANIMATION;
  7596. timeout = animationTimeout;
  7597. propCount = animationDurations.length;
  7598. }
  7599. } else {
  7600. timeout = Math.max(transitionTimeout, animationTimeout);
  7601. type = timeout > 0 ?
  7602. transitionTimeout > animationTimeout ?
  7603. TRANSITION :
  7604. ANIMATION :
  7605. null;
  7606. propCount = type ?
  7607. type === TRANSITION ?
  7608. transitionDurations.length :
  7609. animationDurations.length :
  7610. 0;
  7611. }
  7612. var hasTransform =
  7613. type === TRANSITION &&
  7614. transformRE.test(styles[transitionProp + 'Property']);
  7615. return {
  7616. type: type,
  7617. timeout: timeout,
  7618. propCount: propCount,
  7619. hasTransform: hasTransform
  7620. }
  7621. }
  7622. function getTimeout(delays, durations) {
  7623. /* istanbul ignore next */
  7624. while (delays.length < durations.length) {
  7625. delays = delays.concat(delays);
  7626. }
  7627. return Math.max.apply(null, durations.map(function (d, i) {
  7628. return toMs(d) + toMs(delays[i])
  7629. }))
  7630. }
  7631. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  7632. // in a locale-dependent way, using a comma instead of a dot.
  7633. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  7634. // as a floor function) causing unexpected behaviors
  7635. function toMs(s) {
  7636. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  7637. }
  7638. /* */
  7639. function enter(vnode, toggleDisplay) {
  7640. var el = vnode.elm;
  7641. // call leave callback now
  7642. if (isDef(el._leaveCb)) {
  7643. el._leaveCb.cancelled = true;
  7644. el._leaveCb();
  7645. }
  7646. var data = resolveTransition(vnode.data.transition);
  7647. if (isUndef(data)) {
  7648. return
  7649. }
  7650. /* istanbul ignore if */
  7651. if (isDef(el._enterCb) || el.nodeType !== 1) {
  7652. return
  7653. }
  7654. var css = data.css;
  7655. var type = data.type;
  7656. var enterClass = data.enterClass;
  7657. var enterToClass = data.enterToClass;
  7658. var enterActiveClass = data.enterActiveClass;
  7659. var appearClass = data.appearClass;
  7660. var appearToClass = data.appearToClass;
  7661. var appearActiveClass = data.appearActiveClass;
  7662. var beforeEnter = data.beforeEnter;
  7663. var enter = data.enter;
  7664. var afterEnter = data.afterEnter;
  7665. var enterCancelled = data.enterCancelled;
  7666. var beforeAppear = data.beforeAppear;
  7667. var appear = data.appear;
  7668. var afterAppear = data.afterAppear;
  7669. var appearCancelled = data.appearCancelled;
  7670. var duration = data.duration;
  7671. // activeInstance will always be the <transition> component managing this
  7672. // transition. One edge case to check is when the <transition> is placed
  7673. // as the root node of a child component. In that case we need to check
  7674. // <transition>'s parent for appear check.
  7675. var context = activeInstance;
  7676. var transitionNode = activeInstance.$vnode;
  7677. while (transitionNode && transitionNode.parent) {
  7678. context = transitionNode.context;
  7679. transitionNode = transitionNode.parent;
  7680. }
  7681. var isAppear = !context._isMounted || !vnode.isRootInsert;
  7682. if (isAppear && !appear && appear !== '') {
  7683. return
  7684. }
  7685. var startClass = isAppear && appearClass ?
  7686. appearClass :
  7687. enterClass;
  7688. var activeClass = isAppear && appearActiveClass ?
  7689. appearActiveClass :
  7690. enterActiveClass;
  7691. var toClass = isAppear && appearToClass ?
  7692. appearToClass :
  7693. enterToClass;
  7694. var beforeEnterHook = isAppear ?
  7695. (beforeAppear || beforeEnter) :
  7696. beforeEnter;
  7697. var enterHook = isAppear ?
  7698. (typeof appear === 'function' ? appear : enter) :
  7699. enter;
  7700. var afterEnterHook = isAppear ?
  7701. (afterAppear || afterEnter) :
  7702. afterEnter;
  7703. var enterCancelledHook = isAppear ?
  7704. (appearCancelled || enterCancelled) :
  7705. enterCancelled;
  7706. var explicitEnterDuration = toNumber(
  7707. isObject(duration) ?
  7708. duration.enter :
  7709. duration
  7710. );
  7711. if (explicitEnterDuration != null) {
  7712. checkDuration(explicitEnterDuration, 'enter', vnode);
  7713. }
  7714. var expectsCSS = css !== false && !isIE9;
  7715. var userWantsControl = getHookArgumentsLength(enterHook);
  7716. var cb = el._enterCb = once(function () {
  7717. if (expectsCSS) {
  7718. removeTransitionClass(el, toClass);
  7719. removeTransitionClass(el, activeClass);
  7720. }
  7721. if (cb.cancelled) {
  7722. if (expectsCSS) {
  7723. removeTransitionClass(el, startClass);
  7724. }
  7725. enterCancelledHook && enterCancelledHook(el);
  7726. } else {
  7727. afterEnterHook && afterEnterHook(el);
  7728. }
  7729. el._enterCb = null;
  7730. });
  7731. if (!vnode.data.show) {
  7732. // remove pending leave element on enter by injecting an insert hook
  7733. mergeVNodeHook(vnode, 'insert', function () {
  7734. var parent = el.parentNode;
  7735. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  7736. if (pendingNode &&
  7737. pendingNode.tag === vnode.tag &&
  7738. pendingNode.elm._leaveCb
  7739. ) {
  7740. pendingNode.elm._leaveCb();
  7741. }
  7742. enterHook && enterHook(el, cb);
  7743. });
  7744. }
  7745. // start enter transition
  7746. beforeEnterHook && beforeEnterHook(el);
  7747. if (expectsCSS) {
  7748. addTransitionClass(el, startClass);
  7749. addTransitionClass(el, activeClass);
  7750. nextFrame(function () {
  7751. removeTransitionClass(el, startClass);
  7752. if (!cb.cancelled) {
  7753. addTransitionClass(el, toClass);
  7754. if (!userWantsControl) {
  7755. if (isValidDuration(explicitEnterDuration)) {
  7756. setTimeout(cb, explicitEnterDuration);
  7757. } else {
  7758. whenTransitionEnds(el, type, cb);
  7759. }
  7760. }
  7761. }
  7762. });
  7763. }
  7764. if (vnode.data.show) {
  7765. toggleDisplay && toggleDisplay();
  7766. enterHook && enterHook(el, cb);
  7767. }
  7768. if (!expectsCSS && !userWantsControl) {
  7769. cb();
  7770. }
  7771. }
  7772. function leave(vnode, rm) {
  7773. var el = vnode.elm;
  7774. // call enter callback now
  7775. if (isDef(el._enterCb)) {
  7776. el._enterCb.cancelled = true;
  7777. el._enterCb();
  7778. }
  7779. var data = resolveTransition(vnode.data.transition);
  7780. if (isUndef(data) || el.nodeType !== 1) {
  7781. return rm()
  7782. }
  7783. /* istanbul ignore if */
  7784. if (isDef(el._leaveCb)) {
  7785. return
  7786. }
  7787. var css = data.css;
  7788. var type = data.type;
  7789. var leaveClass = data.leaveClass;
  7790. var leaveToClass = data.leaveToClass;
  7791. var leaveActiveClass = data.leaveActiveClass;
  7792. var beforeLeave = data.beforeLeave;
  7793. var leave = data.leave;
  7794. var afterLeave = data.afterLeave;
  7795. var leaveCancelled = data.leaveCancelled;
  7796. var delayLeave = data.delayLeave;
  7797. var duration = data.duration;
  7798. var expectsCSS = css !== false && !isIE9;
  7799. var userWantsControl = getHookArgumentsLength(leave);
  7800. var explicitLeaveDuration = toNumber(
  7801. isObject(duration) ?
  7802. duration.leave :
  7803. duration
  7804. );
  7805. if (isDef(explicitLeaveDuration)) {
  7806. checkDuration(explicitLeaveDuration, 'leave', vnode);
  7807. }
  7808. var cb = el._leaveCb = once(function () {
  7809. if (el.parentNode && el.parentNode._pending) {
  7810. el.parentNode._pending[vnode.key] = null;
  7811. }
  7812. if (expectsCSS) {
  7813. removeTransitionClass(el, leaveToClass);
  7814. removeTransitionClass(el, leaveActiveClass);
  7815. }
  7816. if (cb.cancelled) {
  7817. if (expectsCSS) {
  7818. removeTransitionClass(el, leaveClass);
  7819. }
  7820. leaveCancelled && leaveCancelled(el);
  7821. } else {
  7822. rm();
  7823. afterLeave && afterLeave(el);
  7824. }
  7825. el._leaveCb = null;
  7826. });
  7827. if (delayLeave) {
  7828. delayLeave(performLeave);
  7829. } else {
  7830. performLeave();
  7831. }
  7832. function performLeave() {
  7833. // the delayed leave may have already been cancelled
  7834. if (cb.cancelled) {
  7835. return
  7836. }
  7837. // record leaving element
  7838. if (!vnode.data.show && el.parentNode) {
  7839. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  7840. }
  7841. beforeLeave && beforeLeave(el);
  7842. if (expectsCSS) {
  7843. addTransitionClass(el, leaveClass);
  7844. addTransitionClass(el, leaveActiveClass);
  7845. nextFrame(function () {
  7846. removeTransitionClass(el, leaveClass);
  7847. if (!cb.cancelled) {
  7848. addTransitionClass(el, leaveToClass);
  7849. if (!userWantsControl) {
  7850. if (isValidDuration(explicitLeaveDuration)) {
  7851. setTimeout(cb, explicitLeaveDuration);
  7852. } else {
  7853. whenTransitionEnds(el, type, cb);
  7854. }
  7855. }
  7856. }
  7857. });
  7858. }
  7859. leave && leave(el, cb);
  7860. if (!expectsCSS && !userWantsControl) {
  7861. cb();
  7862. }
  7863. }
  7864. }
  7865. // only used in dev mode
  7866. function checkDuration(val, name, vnode) {
  7867. if (typeof val !== 'number') {
  7868. warn(
  7869. "<transition> explicit " + name + " duration is not a valid number - " +
  7870. "got " + (JSON.stringify(val)) + ".",
  7871. vnode.context
  7872. );
  7873. } else if (isNaN(val)) {
  7874. warn(
  7875. "<transition> explicit " + name + " duration is NaN - " +
  7876. 'the duration expression might be incorrect.',
  7877. vnode.context
  7878. );
  7879. }
  7880. }
  7881. function isValidDuration(val) {
  7882. return typeof val === 'number' && !isNaN(val)
  7883. }
  7884. /**
  7885. * Normalize a transition hook's argument length. The hook may be:
  7886. * - a merged hook (invoker) with the original in .fns
  7887. * - a wrapped component method (check ._length)
  7888. * - a plain function (.length)
  7889. */
  7890. function getHookArgumentsLength(fn) {
  7891. if (isUndef(fn)) {
  7892. return false
  7893. }
  7894. var invokerFns = fn.fns;
  7895. if (isDef(invokerFns)) {
  7896. // invoker
  7897. return getHookArgumentsLength(
  7898. Array.isArray(invokerFns) ?
  7899. invokerFns[0] :
  7900. invokerFns
  7901. )
  7902. } else {
  7903. return (fn._length || fn.length) > 1
  7904. }
  7905. }
  7906. function _enter(_, vnode) {
  7907. if (vnode.data.show !== true) {
  7908. enter(vnode);
  7909. }
  7910. }
  7911. var transition = inBrowser ? {
  7912. create: _enter,
  7913. activate: _enter,
  7914. remove: function remove$$1(vnode, rm) {
  7915. /* istanbul ignore else */
  7916. if (vnode.data.show !== true) {
  7917. leave(vnode, rm);
  7918. } else {
  7919. rm();
  7920. }
  7921. }
  7922. } : {};
  7923. var platformModules = [
  7924. attrs,
  7925. klass,
  7926. events,
  7927. domProps,
  7928. style,
  7929. transition
  7930. ];
  7931. /* */
  7932. // the directive module should be applied last, after all
  7933. // built-in modules have been applied.
  7934. var modules = platformModules.concat(baseModules);
  7935. var patch = createPatchFunction({
  7936. nodeOps: nodeOps,
  7937. modules: modules
  7938. });
  7939. /**
  7940. * Not type checking this file because flow doesn't like attaching
  7941. * properties to Elements.
  7942. */
  7943. /* istanbul ignore if */
  7944. if (isIE9) {
  7945. // http://www.matts411.com/post/internet-explorer-9-oninput/
  7946. document.addEventListener('selectionchange', function () {
  7947. var el = document.activeElement;
  7948. if (el && el.vmodel) {
  7949. trigger(el, 'input');
  7950. }
  7951. });
  7952. }
  7953. var directive = {
  7954. inserted: function inserted(el, binding, vnode, oldVnode) {
  7955. if (vnode.tag === 'select') {
  7956. // #6903
  7957. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  7958. mergeVNodeHook(vnode, 'postpatch', function () {
  7959. directive.componentUpdated(el, binding, vnode);
  7960. });
  7961. } else {
  7962. setSelected(el, binding, vnode.context);
  7963. }
  7964. el._vOptions = [].map.call(el.options, getValue);
  7965. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  7966. el._vModifiers = binding.modifiers;
  7967. if (!binding.modifiers.lazy) {
  7968. el.addEventListener('compositionstart', onCompositionStart);
  7969. el.addEventListener('compositionend', onCompositionEnd);
  7970. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  7971. // switching focus before confirming composition choice
  7972. // this also fixes the issue where some browsers e.g. iOS Chrome
  7973. // fires "change" instead of "input" on autocomplete.
  7974. el.addEventListener('change', onCompositionEnd);
  7975. /* istanbul ignore if */
  7976. if (isIE9) {
  7977. el.vmodel = true;
  7978. }
  7979. }
  7980. }
  7981. },
  7982. componentUpdated: function componentUpdated(el, binding, vnode) {
  7983. if (vnode.tag === 'select') {
  7984. setSelected(el, binding, vnode.context);
  7985. // in case the options rendered by v-for have changed,
  7986. // it's possible that the value is out-of-sync with the rendered options.
  7987. // detect such cases and filter out values that no longer has a matching
  7988. // option in the DOM.
  7989. var prevOptions = el._vOptions;
  7990. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  7991. if (curOptions.some(function (o, i) {
  7992. return !looseEqual(o, prevOptions[i]);
  7993. })) {
  7994. // trigger change event if
  7995. // no matching option found for at least one value
  7996. var needReset = el.multiple ?
  7997. binding.value.some(function (v) {
  7998. return hasNoMatchingOption(v, curOptions);
  7999. }) :
  8000. binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  8001. if (needReset) {
  8002. trigger(el, 'change');
  8003. }
  8004. }
  8005. }
  8006. }
  8007. };
  8008. function setSelected(el, binding, vm) {
  8009. actuallySetSelected(el, binding, vm);
  8010. /* istanbul ignore if */
  8011. if (isIE || isEdge) {
  8012. setTimeout(function () {
  8013. actuallySetSelected(el, binding, vm);
  8014. }, 0);
  8015. }
  8016. }
  8017. function actuallySetSelected(el, binding, vm) {
  8018. var value = binding.value;
  8019. var isMultiple = el.multiple;
  8020. if (isMultiple && !Array.isArray(value)) {
  8021. warn(
  8022. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  8023. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  8024. vm
  8025. );
  8026. return
  8027. }
  8028. var selected, option;
  8029. for (var i = 0, l = el.options.length; i < l; i++) {
  8030. option = el.options[i];
  8031. if (isMultiple) {
  8032. selected = looseIndexOf(value, getValue(option)) > -1;
  8033. if (option.selected !== selected) {
  8034. option.selected = selected;
  8035. }
  8036. } else {
  8037. if (looseEqual(getValue(option), value)) {
  8038. if (el.selectedIndex !== i) {
  8039. el.selectedIndex = i;
  8040. }
  8041. return
  8042. }
  8043. }
  8044. }
  8045. if (!isMultiple) {
  8046. el.selectedIndex = -1;
  8047. }
  8048. }
  8049. function hasNoMatchingOption(value, options) {
  8050. return options.every(function (o) {
  8051. return !looseEqual(o, value);
  8052. })
  8053. }
  8054. function getValue(option) {
  8055. return '_value' in option ?
  8056. option._value :
  8057. option.value
  8058. }
  8059. function onCompositionStart(e) {
  8060. e.target.composing = true;
  8061. }
  8062. function onCompositionEnd(e) {
  8063. // prevent triggering an input event for no reason
  8064. if (!e.target.composing) {
  8065. return
  8066. }
  8067. e.target.composing = false;
  8068. trigger(e.target, 'input');
  8069. }
  8070. function trigger(el, type) {
  8071. var e = document.createEvent('HTMLEvents');
  8072. e.initEvent(type, true, true);
  8073. el.dispatchEvent(e);
  8074. }
  8075. /* */
  8076. // recursively search for possible transition defined inside the component root
  8077. function locateNode(vnode) {
  8078. return vnode.componentInstance && (!vnode.data || !vnode.data.transition) ?
  8079. locateNode(vnode.componentInstance._vnode) :
  8080. vnode
  8081. }
  8082. var show = {
  8083. bind: function bind(el, ref, vnode) {
  8084. var value = ref.value;
  8085. vnode = locateNode(vnode);
  8086. var transition$$1 = vnode.data && vnode.data.transition;
  8087. var originalDisplay = el.__vOriginalDisplay =
  8088. el.style.display === 'none' ? '' : el.style.display;
  8089. if (value && transition$$1) {
  8090. vnode.data.show = true;
  8091. enter(vnode, function () {
  8092. el.style.display = originalDisplay;
  8093. });
  8094. } else {
  8095. el.style.display = value ? originalDisplay : 'none';
  8096. }
  8097. },
  8098. update: function update(el, ref, vnode) {
  8099. var value = ref.value;
  8100. var oldValue = ref.oldValue;
  8101. /* istanbul ignore if */
  8102. if (!value === !oldValue) {
  8103. return
  8104. }
  8105. vnode = locateNode(vnode);
  8106. var transition$$1 = vnode.data && vnode.data.transition;
  8107. if (transition$$1) {
  8108. vnode.data.show = true;
  8109. if (value) {
  8110. enter(vnode, function () {
  8111. el.style.display = el.__vOriginalDisplay;
  8112. });
  8113. } else {
  8114. leave(vnode, function () {
  8115. el.style.display = 'none';
  8116. });
  8117. }
  8118. } else {
  8119. el.style.display = value ? el.__vOriginalDisplay : 'none';
  8120. }
  8121. },
  8122. unbind: function unbind(
  8123. el,
  8124. binding,
  8125. vnode,
  8126. oldVnode,
  8127. isDestroy
  8128. ) {
  8129. if (!isDestroy) {
  8130. el.style.display = el.__vOriginalDisplay;
  8131. }
  8132. }
  8133. };
  8134. var platformDirectives = {
  8135. model: directive,
  8136. show: show
  8137. };
  8138. /* */
  8139. var transitionProps = {
  8140. name: String,
  8141. appear: Boolean,
  8142. css: Boolean,
  8143. mode: String,
  8144. type: String,
  8145. enterClass: String,
  8146. leaveClass: String,
  8147. enterToClass: String,
  8148. leaveToClass: String,
  8149. enterActiveClass: String,
  8150. leaveActiveClass: String,
  8151. appearClass: String,
  8152. appearActiveClass: String,
  8153. appearToClass: String,
  8154. duration: [Number, String, Object]
  8155. };
  8156. // in case the child is also an abstract component, e.g. <keep-alive>
  8157. // we want to recursively retrieve the real component to be rendered
  8158. function getRealChild(vnode) {
  8159. var compOptions = vnode && vnode.componentOptions;
  8160. if (compOptions && compOptions.Ctor.options.abstract) {
  8161. return getRealChild(getFirstComponentChild(compOptions.children))
  8162. } else {
  8163. return vnode
  8164. }
  8165. }
  8166. function extractTransitionData(comp) {
  8167. var data = {};
  8168. var options = comp.$options;
  8169. // props
  8170. for (var key in options.propsData) {
  8171. data[key] = comp[key];
  8172. }
  8173. // events.
  8174. // extract listeners and pass them directly to the transition methods
  8175. var listeners = options._parentListeners;
  8176. for (var key$1 in listeners) {
  8177. data[camelize(key$1)] = listeners[key$1];
  8178. }
  8179. return data
  8180. }
  8181. function placeholder(h, rawChild) {
  8182. if (/\d-keep-alive$/.test(rawChild.tag)) {
  8183. return h('keep-alive', {
  8184. props: rawChild.componentOptions.propsData
  8185. })
  8186. }
  8187. }
  8188. function hasParentTransition(vnode) {
  8189. while ((vnode = vnode.parent)) {
  8190. if (vnode.data.transition) {
  8191. return true
  8192. }
  8193. }
  8194. }
  8195. function isSameChild(child, oldChild) {
  8196. return oldChild.key === child.key && oldChild.tag === child.tag
  8197. }
  8198. var isNotTextNode = function (c) {
  8199. return c.tag || isAsyncPlaceholder(c);
  8200. };
  8201. var isVShowDirective = function (d) {
  8202. return d.name === 'show';
  8203. };
  8204. var Transition = {
  8205. name: 'transition',
  8206. props: transitionProps,
  8207. abstract: true,
  8208. render: function render(h) {
  8209. var this$1 = this;
  8210. var children = this.$slots.default;
  8211. if (!children) {
  8212. return
  8213. }
  8214. // filter out text nodes (possible whitespaces)
  8215. children = children.filter(isNotTextNode);
  8216. /* istanbul ignore if */
  8217. if (!children.length) {
  8218. return
  8219. }
  8220. // warn multiple elements
  8221. if (children.length > 1) {
  8222. warn(
  8223. '<transition> can only be used on a single element. Use ' +
  8224. '<transition-group> for lists.',
  8225. this.$parent
  8226. );
  8227. }
  8228. var mode = this.mode;
  8229. // warn invalid mode
  8230. if (mode && mode !== 'in-out' && mode !== 'out-in') {
  8231. warn(
  8232. 'invalid <transition> mode: ' + mode,
  8233. this.$parent
  8234. );
  8235. }
  8236. var rawChild = children[0];
  8237. // if this is a component root node and the component's
  8238. // parent container node also has transition, skip.
  8239. if (hasParentTransition(this.$vnode)) {
  8240. return rawChild
  8241. }
  8242. // apply transition data to child
  8243. // use getRealChild() to ignore abstract components e.g. keep-alive
  8244. var child = getRealChild(rawChild);
  8245. /* istanbul ignore if */
  8246. if (!child) {
  8247. return rawChild
  8248. }
  8249. if (this._leaving) {
  8250. return placeholder(h, rawChild)
  8251. }
  8252. // ensure a key that is unique to the vnode type and to this transition
  8253. // component instance. This key will be used to remove pending leaving nodes
  8254. // during entering.
  8255. var id = "__transition-" + (this._uid) + "-";
  8256. child.key = child.key == null ?
  8257. child.isComment ?
  8258. id + 'comment' :
  8259. id + child.tag :
  8260. isPrimitive(child.key) ?
  8261. (String(child.key).indexOf(id) === 0 ? child.key : id + child.key) :
  8262. child.key;
  8263. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  8264. var oldRawChild = this._vnode;
  8265. var oldChild = getRealChild(oldRawChild);
  8266. // mark v-show
  8267. // so that the transition module can hand over the control to the directive
  8268. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  8269. child.data.show = true;
  8270. }
  8271. if (
  8272. oldChild &&
  8273. oldChild.data &&
  8274. !isSameChild(child, oldChild) &&
  8275. !isAsyncPlaceholder(oldChild) &&
  8276. // #6687 component root is a comment node
  8277. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  8278. ) {
  8279. // replace old child transition data with fresh one
  8280. // important for dynamic transitions!
  8281. var oldData = oldChild.data.transition = extend({}, data);
  8282. // handle transition mode
  8283. if (mode === 'out-in') {
  8284. // return placeholder node and queue update when leave finishes
  8285. this._leaving = true;
  8286. mergeVNodeHook(oldData, 'afterLeave', function () {
  8287. this$1._leaving = false;
  8288. this$1.$forceUpdate();
  8289. });
  8290. return placeholder(h, rawChild)
  8291. } else if (mode === 'in-out') {
  8292. if (isAsyncPlaceholder(child)) {
  8293. return oldRawChild
  8294. }
  8295. var delayedLeave;
  8296. var performLeave = function () {
  8297. delayedLeave();
  8298. };
  8299. mergeVNodeHook(data, 'afterEnter', performLeave);
  8300. mergeVNodeHook(data, 'enterCancelled', performLeave);
  8301. mergeVNodeHook(oldData, 'delayLeave', function (leave) {
  8302. delayedLeave = leave;
  8303. });
  8304. }
  8305. }
  8306. return rawChild
  8307. }
  8308. };
  8309. /* */
  8310. var props = extend({
  8311. tag: String,
  8312. moveClass: String
  8313. }, transitionProps);
  8314. delete props.mode;
  8315. var TransitionGroup = {
  8316. props: props,
  8317. beforeMount: function beforeMount() {
  8318. var this$1 = this;
  8319. var update = this._update;
  8320. this._update = function (vnode, hydrating) {
  8321. var restoreActiveInstance = setActiveInstance(this$1);
  8322. // force removing pass
  8323. this$1.__patch__(
  8324. this$1._vnode,
  8325. this$1.kept,
  8326. false, // hydrating
  8327. true // removeOnly (!important, avoids unnecessary moves)
  8328. );
  8329. this$1._vnode = this$1.kept;
  8330. restoreActiveInstance();
  8331. update.call(this$1, vnode, hydrating);
  8332. };
  8333. },
  8334. render: function render(h) {
  8335. var tag = this.tag || this.$vnode.data.tag || 'span';
  8336. var map = Object.create(null);
  8337. var prevChildren = this.prevChildren = this.children;
  8338. var rawChildren = this.$slots.default || [];
  8339. var children = this.children = [];
  8340. var transitionData = extractTransitionData(this);
  8341. for (var i = 0; i < rawChildren.length; i++) {
  8342. var c = rawChildren[i];
  8343. if (c.tag) {
  8344. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  8345. children.push(c);
  8346. map[c.key] = c;
  8347. (c.data || (c.data = {})).transition = transitionData;
  8348. } else {
  8349. var opts = c.componentOptions;
  8350. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  8351. warn(("<transition-group> children must be keyed: <" + name + ">"));
  8352. }
  8353. }
  8354. }
  8355. if (prevChildren) {
  8356. var kept = [];
  8357. var removed = [];
  8358. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  8359. var c$1 = prevChildren[i$1];
  8360. c$1.data.transition = transitionData;
  8361. c$1.data.pos = c$1.elm.getBoundingClientRect();
  8362. if (map[c$1.key]) {
  8363. kept.push(c$1);
  8364. } else {
  8365. removed.push(c$1);
  8366. }
  8367. }
  8368. this.kept = h(tag, null, kept);
  8369. this.removed = removed;
  8370. }
  8371. return h(tag, null, children)
  8372. },
  8373. updated: function updated() {
  8374. var children = this.prevChildren;
  8375. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  8376. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  8377. return
  8378. }
  8379. // we divide the work into three loops to avoid mixing DOM reads and writes
  8380. // in each iteration - which helps prevent layout thrashing.
  8381. children.forEach(callPendingCbs);
  8382. children.forEach(recordPosition);
  8383. children.forEach(applyTranslation);
  8384. // force reflow to put everything in position
  8385. // assign to this to avoid being removed in tree-shaking
  8386. // $flow-disable-line
  8387. this._reflow = document.body.offsetHeight;
  8388. children.forEach(function (c) {
  8389. if (c.data.moved) {
  8390. var el = c.elm;
  8391. var s = el.style;
  8392. addTransitionClass(el, moveClass);
  8393. s.transform = s.WebkitTransform = s.transitionDuration = '';
  8394. el.addEventListener(transitionEndEvent, el._moveCb = function cb(e) {
  8395. if (e && e.target !== el) {
  8396. return
  8397. }
  8398. if (!e || /transform$/.test(e.propertyName)) {
  8399. el.removeEventListener(transitionEndEvent, cb);
  8400. el._moveCb = null;
  8401. removeTransitionClass(el, moveClass);
  8402. }
  8403. });
  8404. }
  8405. });
  8406. },
  8407. methods: {
  8408. hasMove: function hasMove(el, moveClass) {
  8409. /* istanbul ignore if */
  8410. if (!hasTransition) {
  8411. return false
  8412. }
  8413. /* istanbul ignore if */
  8414. if (this._hasMove) {
  8415. return this._hasMove
  8416. }
  8417. // Detect whether an element with the move class applied has
  8418. // CSS transitions. Since the element may be inside an entering
  8419. // transition at this very moment, we make a clone of it and remove
  8420. // all other transition classes applied to ensure only the move class
  8421. // is applied.
  8422. var clone = el.cloneNode();
  8423. if (el._transitionClasses) {
  8424. el._transitionClasses.forEach(function (cls) {
  8425. removeClass(clone, cls);
  8426. });
  8427. }
  8428. addClass(clone, moveClass);
  8429. clone.style.display = 'none';
  8430. this.$el.appendChild(clone);
  8431. var info = getTransitionInfo(clone);
  8432. this.$el.removeChild(clone);
  8433. return (this._hasMove = info.hasTransform)
  8434. }
  8435. }
  8436. };
  8437. function callPendingCbs(c) {
  8438. /* istanbul ignore if */
  8439. if (c.elm._moveCb) {
  8440. c.elm._moveCb();
  8441. }
  8442. /* istanbul ignore if */
  8443. if (c.elm._enterCb) {
  8444. c.elm._enterCb();
  8445. }
  8446. }
  8447. function recordPosition(c) {
  8448. c.data.newPos = c.elm.getBoundingClientRect();
  8449. }
  8450. function applyTranslation(c) {
  8451. var oldPos = c.data.pos;
  8452. var newPos = c.data.newPos;
  8453. var dx = oldPos.left - newPos.left;
  8454. var dy = oldPos.top - newPos.top;
  8455. if (dx || dy) {
  8456. c.data.moved = true;
  8457. var s = c.elm.style;
  8458. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  8459. s.transitionDuration = '0s';
  8460. }
  8461. }
  8462. var platformComponents = {
  8463. Transition: Transition,
  8464. TransitionGroup: TransitionGroup
  8465. };
  8466. /* */
  8467. // install platform specific utils
  8468. Vue.config.mustUseProp = mustUseProp;
  8469. Vue.config.isReservedTag = isReservedTag;
  8470. Vue.config.isReservedAttr = isReservedAttr;
  8471. Vue.config.getTagNamespace = getTagNamespace;
  8472. Vue.config.isUnknownElement = isUnknownElement;
  8473. // install platform runtime directives & components
  8474. extend(Vue.options.directives, platformDirectives);
  8475. extend(Vue.options.components, platformComponents);
  8476. // install platform patch function
  8477. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  8478. // public mount method
  8479. Vue.prototype.$mount = function (
  8480. el,
  8481. hydrating
  8482. ) {
  8483. el = el && inBrowser ? query(el) : undefined;
  8484. return mountComponent(this, el, hydrating)
  8485. };
  8486. // devtools global hook
  8487. /* istanbul ignore next */
  8488. if (inBrowser) {
  8489. setTimeout(function () {
  8490. if (config.devtools) {
  8491. if (devtools) {
  8492. devtools.emit('init', Vue);
  8493. } else {
  8494. console[console.info ? 'info' : 'log'](
  8495. 'Download the Vue Devtools extension for a better development experience:\n' +
  8496. 'https://github.com/vuejs/vue-devtools'
  8497. );
  8498. }
  8499. }
  8500. if (config.productionTip !== false &&
  8501. typeof console !== 'undefined'
  8502. ) {
  8503. console[console.info ? 'info' : 'log'](
  8504. "You are running Vue in development mode.\n" +
  8505. "Make sure to turn on production mode when deploying for production.\n" +
  8506. "See more tips at https://vuejs.org/guide/deployment.html"
  8507. );
  8508. }
  8509. }, 0);
  8510. }
  8511. /* */
  8512. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  8513. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  8514. var buildRegex = cached(function (delimiters) {
  8515. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  8516. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  8517. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  8518. });
  8519. function parseText(
  8520. text,
  8521. delimiters
  8522. ) {
  8523. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  8524. if (!tagRE.test(text)) {
  8525. return
  8526. }
  8527. var tokens = [];
  8528. var rawTokens = [];
  8529. var lastIndex = tagRE.lastIndex = 0;
  8530. var match, index, tokenValue;
  8531. while ((match = tagRE.exec(text))) {
  8532. index = match.index;
  8533. // push text token
  8534. if (index > lastIndex) {
  8535. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  8536. tokens.push(JSON.stringify(tokenValue));
  8537. }
  8538. // tag token
  8539. var exp = parseFilters(match[1].trim());
  8540. tokens.push(("_s(" + exp + ")"));
  8541. rawTokens.push({
  8542. '@binding': exp
  8543. });
  8544. lastIndex = index + match[0].length;
  8545. }
  8546. if (lastIndex < text.length) {
  8547. rawTokens.push(tokenValue = text.slice(lastIndex));
  8548. tokens.push(JSON.stringify(tokenValue));
  8549. }
  8550. return {
  8551. expression: tokens.join('+'),
  8552. tokens: rawTokens
  8553. }
  8554. }
  8555. /* */
  8556. function transformNode(el, options) {
  8557. var warn = options.warn || baseWarn;
  8558. var staticClass = getAndRemoveAttr(el, 'class');
  8559. if (staticClass) {
  8560. var res = parseText(staticClass, options.delimiters);
  8561. if (res) {
  8562. warn(
  8563. "class=\"" + staticClass + "\": " +
  8564. 'Interpolation inside attributes has been removed. ' +
  8565. 'Use v-bind or the colon shorthand instead. For example, ' +
  8566. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  8567. el.rawAttrsMap['class']
  8568. );
  8569. }
  8570. }
  8571. if (staticClass) {
  8572. el.staticClass = JSON.stringify(staticClass);
  8573. }
  8574. var classBinding = getBindingAttr(el, 'class', false /* getStatic */ );
  8575. if (classBinding) {
  8576. el.classBinding = classBinding;
  8577. }
  8578. }
  8579. function genData(el) {
  8580. var data = '';
  8581. if (el.staticClass) {
  8582. data += "staticClass:" + (el.staticClass) + ",";
  8583. }
  8584. if (el.classBinding) {
  8585. data += "class:" + (el.classBinding) + ",";
  8586. }
  8587. return data
  8588. }
  8589. var klass$1 = {
  8590. staticKeys: ['staticClass'],
  8591. transformNode: transformNode,
  8592. genData: genData
  8593. };
  8594. /* */
  8595. function transformNode$1(el, options) {
  8596. var warn = options.warn || baseWarn;
  8597. var staticStyle = getAndRemoveAttr(el, 'style');
  8598. if (staticStyle) {
  8599. /* istanbul ignore if */
  8600. {
  8601. var res = parseText(staticStyle, options.delimiters);
  8602. if (res) {
  8603. warn(
  8604. "style=\"" + staticStyle + "\": " +
  8605. 'Interpolation inside attributes has been removed. ' +
  8606. 'Use v-bind or the colon shorthand instead. For example, ' +
  8607. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  8608. el.rawAttrsMap['style']
  8609. );
  8610. }
  8611. }
  8612. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  8613. }
  8614. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */ );
  8615. if (styleBinding) {
  8616. el.styleBinding = styleBinding;
  8617. }
  8618. }
  8619. function genData$1(el) {
  8620. var data = '';
  8621. if (el.staticStyle) {
  8622. data += "staticStyle:" + (el.staticStyle) + ",";
  8623. }
  8624. if (el.styleBinding) {
  8625. data += "style:(" + (el.styleBinding) + "),";
  8626. }
  8627. return data
  8628. }
  8629. var style$1 = {
  8630. staticKeys: ['staticStyle'],
  8631. transformNode: transformNode$1,
  8632. genData: genData$1
  8633. };
  8634. /* */
  8635. var decoder;
  8636. var he = {
  8637. decode: function decode(html) {
  8638. decoder = decoder || document.createElement('div');
  8639. decoder.innerHTML = html;
  8640. return decoder.textContent
  8641. }
  8642. };
  8643. /* */
  8644. var isUnaryTag = makeMap(
  8645. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  8646. 'link,meta,param,source,track,wbr'
  8647. );
  8648. // Elements that you can, intentionally, leave open
  8649. // (and which close themselves)
  8650. var canBeLeftOpenTag = makeMap(
  8651. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  8652. );
  8653. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  8654. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  8655. var isNonPhrasingTag = makeMap(
  8656. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  8657. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  8658. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  8659. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  8660. 'title,tr,track'
  8661. );
  8662. /**
  8663. * Not type-checking this file because it's mostly vendor code.
  8664. */
  8665. // Regular Expressions for parsing tags and attributes
  8666. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  8667. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  8668. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  8669. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  8670. var startTagOpen = new RegExp(("^<" + qnameCapture));
  8671. var startTagClose = /^\s*(\/?)>/;
  8672. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  8673. var doctype = /^<!DOCTYPE [^>]+>/i;
  8674. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  8675. var comment = /^<!\--/;
  8676. var conditionalComment = /^<!\[/;
  8677. // Special Elements (can contain anything)
  8678. var isPlainTextElement = makeMap('script,style,textarea', true);
  8679. var reCache = {};
  8680. var decodingMap = {
  8681. '&lt;': '<',
  8682. '&gt;': '>',
  8683. '&quot;': '"',
  8684. '&amp;': '&',
  8685. '&#10;': '\n',
  8686. '&#9;': '\t',
  8687. '&#39;': "'"
  8688. };
  8689. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  8690. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  8691. // #5992
  8692. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  8693. var shouldIgnoreFirstNewline = function (tag, html) {
  8694. return tag && isIgnoreNewlineTag(tag) && html[0] === '\n';
  8695. };
  8696. function decodeAttr(value, shouldDecodeNewlines) {
  8697. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  8698. return value.replace(re, function (match) {
  8699. return decodingMap[match];
  8700. })
  8701. }
  8702. function parseHTML(html, options) {
  8703. var stack = [];
  8704. var expectHTML = options.expectHTML;
  8705. var isUnaryTag$$1 = options.isUnaryTag || no;
  8706. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  8707. var index = 0;
  8708. var last, lastTag;
  8709. while (html) {
  8710. last = html;
  8711. // Make sure we're not in a plaintext content element like script/style
  8712. if (!lastTag || !isPlainTextElement(lastTag)) {
  8713. var textEnd = html.indexOf('<');
  8714. if (textEnd === 0) {
  8715. // Comment:
  8716. if (comment.test(html)) {
  8717. var commentEnd = html.indexOf('-->');
  8718. if (commentEnd >= 0) {
  8719. if (options.shouldKeepComment) {
  8720. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  8721. }
  8722. advance(commentEnd + 3);
  8723. continue
  8724. }
  8725. }
  8726. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  8727. if (conditionalComment.test(html)) {
  8728. var conditionalEnd = html.indexOf(']>');
  8729. if (conditionalEnd >= 0) {
  8730. advance(conditionalEnd + 2);
  8731. continue
  8732. }
  8733. }
  8734. // Doctype:
  8735. var doctypeMatch = html.match(doctype);
  8736. if (doctypeMatch) {
  8737. advance(doctypeMatch[0].length);
  8738. continue
  8739. }
  8740. // End tag:
  8741. var endTagMatch = html.match(endTag);
  8742. if (endTagMatch) {
  8743. var curIndex = index;
  8744. advance(endTagMatch[0].length);
  8745. parseEndTag(endTagMatch[1], curIndex, index);
  8746. continue
  8747. }
  8748. // Start tag:
  8749. var startTagMatch = parseStartTag();
  8750. if (startTagMatch) {
  8751. handleStartTag(startTagMatch);
  8752. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  8753. advance(1);
  8754. }
  8755. continue
  8756. }
  8757. }
  8758. var text = (void 0),
  8759. rest = (void 0),
  8760. next = (void 0);
  8761. if (textEnd >= 0) {
  8762. rest = html.slice(textEnd);
  8763. while (
  8764. !endTag.test(rest) &&
  8765. !startTagOpen.test(rest) &&
  8766. !comment.test(rest) &&
  8767. !conditionalComment.test(rest)
  8768. ) {
  8769. // < in plain text, be forgiving and treat it as text
  8770. next = rest.indexOf('<', 1);
  8771. if (next < 0) {
  8772. break
  8773. }
  8774. textEnd += next;
  8775. rest = html.slice(textEnd);
  8776. }
  8777. text = html.substring(0, textEnd);
  8778. }
  8779. if (textEnd < 0) {
  8780. text = html;
  8781. }
  8782. if (text) {
  8783. advance(text.length);
  8784. }
  8785. if (options.chars && text) {
  8786. options.chars(text, index - text.length, index);
  8787. }
  8788. } else {
  8789. var endTagLength = 0;
  8790. var stackedTag = lastTag.toLowerCase();
  8791. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  8792. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  8793. endTagLength = endTag.length;
  8794. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  8795. text = text
  8796. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  8797. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  8798. }
  8799. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  8800. text = text.slice(1);
  8801. }
  8802. if (options.chars) {
  8803. options.chars(text);
  8804. }
  8805. return ''
  8806. });
  8807. index += html.length - rest$1.length;
  8808. html = rest$1;
  8809. parseEndTag(stackedTag, index - endTagLength, index);
  8810. }
  8811. if (html === last) {
  8812. options.chars && options.chars(html);
  8813. if (!stack.length && options.warn) {
  8814. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), {
  8815. start: index + html.length
  8816. });
  8817. }
  8818. break
  8819. }
  8820. }
  8821. // Clean up any remaining tags
  8822. parseEndTag();
  8823. function advance(n) {
  8824. index += n;
  8825. html = html.substring(n);
  8826. }
  8827. function parseStartTag() {
  8828. var start = html.match(startTagOpen);
  8829. if (start) {
  8830. var match = {
  8831. tagName: start[1],
  8832. attrs: [],
  8833. start: index
  8834. };
  8835. advance(start[0].length);
  8836. var end, attr;
  8837. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  8838. attr.start = index;
  8839. advance(attr[0].length);
  8840. attr.end = index;
  8841. match.attrs.push(attr);
  8842. }
  8843. if (end) {
  8844. match.unarySlash = end[1];
  8845. advance(end[0].length);
  8846. match.end = index;
  8847. return match
  8848. }
  8849. }
  8850. }
  8851. function handleStartTag(match) {
  8852. var tagName = match.tagName;
  8853. var unarySlash = match.unarySlash;
  8854. if (expectHTML) {
  8855. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  8856. parseEndTag(lastTag);
  8857. }
  8858. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  8859. parseEndTag(tagName);
  8860. }
  8861. }
  8862. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  8863. var l = match.attrs.length;
  8864. var attrs = new Array(l);
  8865. for (var i = 0; i < l; i++) {
  8866. var args = match.attrs[i];
  8867. var value = args[3] || args[4] || args[5] || '';
  8868. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href' ?
  8869. options.shouldDecodeNewlinesForHref :
  8870. options.shouldDecodeNewlines;
  8871. attrs[i] = {
  8872. name: args[1],
  8873. value: decodeAttr(value, shouldDecodeNewlines)
  8874. };
  8875. if (options.outputSourceRange) {
  8876. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  8877. attrs[i].end = args.end;
  8878. }
  8879. }
  8880. if (!unary) {
  8881. stack.push({
  8882. tag: tagName,
  8883. lowerCasedTag: tagName.toLowerCase(),
  8884. attrs: attrs,
  8885. start: match.start,
  8886. end: match.end
  8887. });
  8888. lastTag = tagName;
  8889. }
  8890. if (options.start) {
  8891. options.start(tagName, attrs, unary, match.start, match.end);
  8892. }
  8893. }
  8894. function parseEndTag(tagName, start, end) {
  8895. var pos, lowerCasedTagName;
  8896. if (start == null) {
  8897. start = index;
  8898. }
  8899. if (end == null) {
  8900. end = index;
  8901. }
  8902. // Find the closest opened tag of the same type
  8903. if (tagName) {
  8904. lowerCasedTagName = tagName.toLowerCase();
  8905. for (pos = stack.length - 1; pos >= 0; pos--) {
  8906. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  8907. break
  8908. }
  8909. }
  8910. } else {
  8911. // If no tag name is provided, clean shop
  8912. pos = 0;
  8913. }
  8914. if (pos >= 0) {
  8915. // Close all the open elements, up the stack
  8916. for (var i = stack.length - 1; i >= pos; i--) {
  8917. if (i > pos || !tagName &&
  8918. options.warn
  8919. ) {
  8920. options.warn(
  8921. ("tag <" + (stack[i].tag) + "> has no matching end tag."), {
  8922. start: stack[i].start,
  8923. end: stack[i].end
  8924. }
  8925. );
  8926. }
  8927. if (options.end) {
  8928. options.end(stack[i].tag, start, end);
  8929. }
  8930. }
  8931. // Remove the open elements from the stack
  8932. stack.length = pos;
  8933. lastTag = pos && stack[pos - 1].tag;
  8934. } else if (lowerCasedTagName === 'br') {
  8935. if (options.start) {
  8936. options.start(tagName, [], true, start, end);
  8937. }
  8938. } else if (lowerCasedTagName === 'p') {
  8939. if (options.start) {
  8940. options.start(tagName, [], false, start, end);
  8941. }
  8942. if (options.end) {
  8943. options.end(tagName, start, end);
  8944. }
  8945. }
  8946. }
  8947. }
  8948. /* */
  8949. var onRE = /^@|^v-on:/;
  8950. var dirRE = /^v-|^@|^:|^#/;
  8951. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  8952. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  8953. var stripParensRE = /^\(|\)$/g;
  8954. var dynamicArgRE = /^\[.*\]$/;
  8955. var argRE = /:(.*)$/;
  8956. var bindRE = /^:|^\.|^v-bind:/;
  8957. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  8958. var slotRE = /^v-slot(:|$)|^#/;
  8959. var lineBreakRE = /[\r\n]/;
  8960. var whitespaceRE$1 = /[ \f\t\r\n]+/g;
  8961. var invalidAttributeRE = /[\s"'<>\/=]/;
  8962. var decodeHTMLCached = cached(he.decode);
  8963. var emptySlotScopeToken = "_empty_";
  8964. // configurable state
  8965. var warn$2;
  8966. var delimiters;
  8967. var transforms;
  8968. var preTransforms;
  8969. var postTransforms;
  8970. var platformIsPreTag;
  8971. var platformMustUseProp;
  8972. var platformGetTagNamespace;
  8973. var maybeComponent;
  8974. function createASTElement(
  8975. tag,
  8976. attrs,
  8977. parent
  8978. ) {
  8979. return {
  8980. type: 1,
  8981. tag: tag,
  8982. attrsList: attrs,
  8983. attrsMap: makeAttrsMap(attrs),
  8984. rawAttrsMap: {},
  8985. parent: parent,
  8986. children: []
  8987. }
  8988. }
  8989. /**
  8990. * Convert HTML string to AST.
  8991. */
  8992. function parse(
  8993. template,
  8994. options
  8995. ) {
  8996. warn$2 = options.warn || baseWarn;
  8997. platformIsPreTag = options.isPreTag || no;
  8998. platformMustUseProp = options.mustUseProp || no;
  8999. platformGetTagNamespace = options.getTagNamespace || no;
  9000. var isReservedTag = options.isReservedTag || no;
  9001. maybeComponent = function (el) {
  9002. return !!(
  9003. el.component ||
  9004. el.attrsMap[':is'] ||
  9005. el.attrsMap['v-bind:is'] ||
  9006. !(el.attrsMap.is ? isReservedTag(el.attrsMap.is) : isReservedTag(el.tag))
  9007. );
  9008. };
  9009. transforms = pluckModuleFunction(options.modules, 'transformNode');
  9010. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  9011. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  9012. delimiters = options.delimiters;
  9013. var stack = [];
  9014. var preserveWhitespace = options.preserveWhitespace !== false;
  9015. var whitespaceOption = options.whitespace;
  9016. var root;
  9017. var currentParent;
  9018. var inVPre = false;
  9019. var inPre = false;
  9020. var warned = false;
  9021. function warnOnce(msg, range) {
  9022. if (!warned) {
  9023. warned = true;
  9024. warn$2(msg, range);
  9025. }
  9026. }
  9027. function closeElement(element) {
  9028. trimEndingWhitespace(element);
  9029. if (!inVPre && !element.processed) {
  9030. element = processElement(element, options);
  9031. }
  9032. // tree management
  9033. if (!stack.length && element !== root) {
  9034. // allow root elements with v-if, v-else-if and v-else
  9035. if (root.if && (element.elseif || element.else)) {
  9036. {
  9037. checkRootConstraints(element);
  9038. }
  9039. addIfCondition(root, {
  9040. exp: element.elseif,
  9041. block: element
  9042. });
  9043. } else {
  9044. warnOnce(
  9045. "Component template should contain exactly one root element. " +
  9046. "If you are using v-if on multiple elements, " +
  9047. "use v-else-if to chain them instead.", {
  9048. start: element.start
  9049. }
  9050. );
  9051. }
  9052. }
  9053. if (currentParent && !element.forbidden) {
  9054. if (element.elseif || element.else) {
  9055. processIfConditions(element, currentParent);
  9056. } else {
  9057. if (element.slotScope) {
  9058. // scoped slot
  9059. // keep it in the children list so that v-else(-if) conditions can
  9060. // find it as the prev node.
  9061. var name = element.slotTarget || '"default"';
  9062. (currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  9063. }
  9064. currentParent.children.push(element);
  9065. element.parent = currentParent;
  9066. }
  9067. }
  9068. // final children cleanup
  9069. // filter out scoped slots
  9070. element.children = element.children.filter(function (c) {
  9071. return !(c).slotScope;
  9072. });
  9073. // remove trailing whitespace node again
  9074. trimEndingWhitespace(element);
  9075. // check pre state
  9076. if (element.pre) {
  9077. inVPre = false;
  9078. }
  9079. if (platformIsPreTag(element.tag)) {
  9080. inPre = false;
  9081. }
  9082. // apply post-transforms
  9083. for (var i = 0; i < postTransforms.length; i++) {
  9084. postTransforms[i](element, options);
  9085. }
  9086. }
  9087. function trimEndingWhitespace(el) {
  9088. // remove trailing whitespace node
  9089. if (!inPre) {
  9090. var lastNode;
  9091. while (
  9092. (lastNode = el.children[el.children.length - 1]) &&
  9093. lastNode.type === 3 &&
  9094. lastNode.text === ' '
  9095. ) {
  9096. el.children.pop();
  9097. }
  9098. }
  9099. }
  9100. function checkRootConstraints(el) {
  9101. if (el.tag === 'slot' || el.tag === 'template') {
  9102. warnOnce(
  9103. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  9104. 'contain multiple nodes.', {
  9105. start: el.start
  9106. }
  9107. );
  9108. }
  9109. if (el.attrsMap.hasOwnProperty('v-for')) {
  9110. warnOnce(
  9111. 'Cannot use v-for on stateful component root element because ' +
  9112. 'it renders multiple elements.',
  9113. el.rawAttrsMap['v-for']
  9114. );
  9115. }
  9116. }
  9117. parseHTML(template, {
  9118. warn: warn$2,
  9119. expectHTML: options.expectHTML,
  9120. isUnaryTag: options.isUnaryTag,
  9121. canBeLeftOpenTag: options.canBeLeftOpenTag,
  9122. shouldDecodeNewlines: options.shouldDecodeNewlines,
  9123. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  9124. shouldKeepComment: options.comments,
  9125. outputSourceRange: options.outputSourceRange,
  9126. start: function start(tag, attrs, unary, start$1, end) {
  9127. // check namespace.
  9128. // inherit parent ns if there is one
  9129. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  9130. // handle IE svg bug
  9131. /* istanbul ignore if */
  9132. if (isIE && ns === 'svg') {
  9133. attrs = guardIESVGBug(attrs);
  9134. }
  9135. var element = createASTElement(tag, attrs, currentParent);
  9136. if (ns) {
  9137. element.ns = ns;
  9138. }
  9139. {
  9140. if (options.outputSourceRange) {
  9141. element.start = start$1;
  9142. element.end = end;
  9143. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  9144. cumulated[attr.name] = attr;
  9145. return cumulated
  9146. }, {});
  9147. }
  9148. attrs.forEach(function (attr) {
  9149. if (invalidAttributeRE.test(attr.name)) {
  9150. warn$2(
  9151. "Invalid dynamic argument expression: attribute names cannot contain " +
  9152. "spaces, quotes, <, >, / or =.", {
  9153. start: attr.start + attr.name.indexOf("["),
  9154. end: attr.start + attr.name.length
  9155. }
  9156. );
  9157. }
  9158. });
  9159. }
  9160. if (isForbiddenTag(element) && !isServerRendering()) {
  9161. element.forbidden = true;
  9162. warn$2(
  9163. 'Templates should only be responsible for mapping the state to the ' +
  9164. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  9165. "<" + tag + ">" + ', as they will not be parsed.', {
  9166. start: element.start
  9167. }
  9168. );
  9169. }
  9170. // apply pre-transforms
  9171. for (var i = 0; i < preTransforms.length; i++) {
  9172. element = preTransforms[i](element, options) || element;
  9173. }
  9174. if (!inVPre) {
  9175. processPre(element);
  9176. if (element.pre) {
  9177. inVPre = true;
  9178. }
  9179. }
  9180. if (platformIsPreTag(element.tag)) {
  9181. inPre = true;
  9182. }
  9183. if (inVPre) {
  9184. processRawAttrs(element);
  9185. } else if (!element.processed) {
  9186. // structural directives
  9187. processFor(element);
  9188. processIf(element);
  9189. processOnce(element);
  9190. }
  9191. if (!root) {
  9192. root = element; {
  9193. checkRootConstraints(root);
  9194. }
  9195. }
  9196. if (!unary) {
  9197. currentParent = element;
  9198. stack.push(element);
  9199. } else {
  9200. closeElement(element);
  9201. }
  9202. },
  9203. end: function end(tag, start, end$1) {
  9204. var element = stack[stack.length - 1];
  9205. // pop stack
  9206. stack.length -= 1;
  9207. currentParent = stack[stack.length - 1];
  9208. if (options.outputSourceRange) {
  9209. element.end = end$1;
  9210. }
  9211. closeElement(element);
  9212. },
  9213. chars: function chars(text, start, end) {
  9214. if (!currentParent) {
  9215. {
  9216. if (text === template) {
  9217. warnOnce(
  9218. 'Component template requires a root element, rather than just text.', {
  9219. start: start
  9220. }
  9221. );
  9222. } else if ((text = text.trim())) {
  9223. warnOnce(
  9224. ("text \"" + text + "\" outside root element will be ignored."), {
  9225. start: start
  9226. }
  9227. );
  9228. }
  9229. }
  9230. return
  9231. }
  9232. // IE textarea placeholder bug
  9233. /* istanbul ignore if */
  9234. if (isIE &&
  9235. currentParent.tag === 'textarea' &&
  9236. currentParent.attrsMap.placeholder === text
  9237. ) {
  9238. return
  9239. }
  9240. var children = currentParent.children;
  9241. if (inPre || text.trim()) {
  9242. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  9243. } else if (!children.length) {
  9244. // remove the whitespace-only node right after an opening tag
  9245. text = '';
  9246. } else if (whitespaceOption) {
  9247. if (whitespaceOption === 'condense') {
  9248. // in condense mode, remove the whitespace node if it contains
  9249. // line break, otherwise condense to a single space
  9250. text = lineBreakRE.test(text) ? '' : ' ';
  9251. } else {
  9252. text = ' ';
  9253. }
  9254. } else {
  9255. text = preserveWhitespace ? ' ' : '';
  9256. }
  9257. if (text) {
  9258. if (!inPre && whitespaceOption === 'condense') {
  9259. // condense consecutive whitespaces into single space
  9260. text = text.replace(whitespaceRE$1, ' ');
  9261. }
  9262. var res;
  9263. var child;
  9264. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  9265. child = {
  9266. type: 2,
  9267. expression: res.expression,
  9268. tokens: res.tokens,
  9269. text: text
  9270. };
  9271. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  9272. child = {
  9273. type: 3,
  9274. text: text
  9275. };
  9276. }
  9277. if (child) {
  9278. if (options.outputSourceRange) {
  9279. child.start = start;
  9280. child.end = end;
  9281. }
  9282. children.push(child);
  9283. }
  9284. }
  9285. },
  9286. comment: function comment(text, start, end) {
  9287. // adding anything as a sibling to the root node is forbidden
  9288. // comments should still be allowed, but ignored
  9289. if (currentParent) {
  9290. var child = {
  9291. type: 3,
  9292. text: text,
  9293. isComment: true
  9294. };
  9295. if (options.outputSourceRange) {
  9296. child.start = start;
  9297. child.end = end;
  9298. }
  9299. currentParent.children.push(child);
  9300. }
  9301. }
  9302. });
  9303. return root
  9304. }
  9305. function processPre(el) {
  9306. if (getAndRemoveAttr(el, 'v-pre') != null) {
  9307. el.pre = true;
  9308. }
  9309. }
  9310. function processRawAttrs(el) {
  9311. var list = el.attrsList;
  9312. var len = list.length;
  9313. if (len) {
  9314. var attrs = el.attrs = new Array(len);
  9315. for (var i = 0; i < len; i++) {
  9316. attrs[i] = {
  9317. name: list[i].name,
  9318. value: JSON.stringify(list[i].value)
  9319. };
  9320. if (list[i].start != null) {
  9321. attrs[i].start = list[i].start;
  9322. attrs[i].end = list[i].end;
  9323. }
  9324. }
  9325. } else if (!el.pre) {
  9326. // non root node in pre blocks with no attributes
  9327. el.plain = true;
  9328. }
  9329. }
  9330. function processElement(
  9331. element,
  9332. options
  9333. ) {
  9334. processKey(element);
  9335. // determine whether this is a plain element after
  9336. // removing structural attributes
  9337. element.plain = (
  9338. !element.key &&
  9339. !element.scopedSlots &&
  9340. !element.attrsList.length
  9341. );
  9342. processRef(element);
  9343. processSlotContent(element);
  9344. processSlotOutlet(element);
  9345. processComponent(element);
  9346. for (var i = 0; i < transforms.length; i++) {
  9347. element = transforms[i](element, options) || element;
  9348. }
  9349. processAttrs(element);
  9350. return element
  9351. }
  9352. function processKey(el) {
  9353. var exp = getBindingAttr(el, 'key');
  9354. if (exp) {
  9355. {
  9356. if (el.tag === 'template') {
  9357. warn$2(
  9358. "<template> cannot be keyed. Place the key on real elements instead.",
  9359. getRawBindingAttr(el, 'key')
  9360. );
  9361. }
  9362. if (el.for) {
  9363. var iterator = el.iterator2 || el.iterator1;
  9364. var parent = el.parent;
  9365. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  9366. warn$2(
  9367. "Do not use v-for index as key on <transition-group> children, " +
  9368. "this is the same as not using keys.",
  9369. getRawBindingAttr(el, 'key'),
  9370. true /* tip */
  9371. );
  9372. }
  9373. }
  9374. }
  9375. el.key = exp;
  9376. }
  9377. }
  9378. function processRef(el) {
  9379. var ref = getBindingAttr(el, 'ref');
  9380. if (ref) {
  9381. el.ref = ref;
  9382. el.refInFor = checkInFor(el);
  9383. }
  9384. }
  9385. function processFor(el) {
  9386. var exp;
  9387. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  9388. var res = parseFor(exp);
  9389. if (res) {
  9390. extend(el, res);
  9391. } else {
  9392. warn$2(
  9393. ("Invalid v-for expression: " + exp),
  9394. el.rawAttrsMap['v-for']
  9395. );
  9396. }
  9397. }
  9398. }
  9399. function parseFor(exp) {
  9400. var inMatch = exp.match(forAliasRE);
  9401. if (!inMatch) {
  9402. return
  9403. }
  9404. var res = {};
  9405. res.for = inMatch[2].trim();
  9406. var alias = inMatch[1].trim().replace(stripParensRE, '');
  9407. var iteratorMatch = alias.match(forIteratorRE);
  9408. if (iteratorMatch) {
  9409. res.alias = alias.replace(forIteratorRE, '').trim();
  9410. res.iterator1 = iteratorMatch[1].trim();
  9411. if (iteratorMatch[2]) {
  9412. res.iterator2 = iteratorMatch[2].trim();
  9413. }
  9414. } else {
  9415. res.alias = alias;
  9416. }
  9417. return res
  9418. }
  9419. function processIf(el) {
  9420. var exp = getAndRemoveAttr(el, 'v-if');
  9421. if (exp) {
  9422. el.if = exp;
  9423. addIfCondition(el, {
  9424. exp: exp,
  9425. block: el
  9426. });
  9427. } else {
  9428. if (getAndRemoveAttr(el, 'v-else') != null) {
  9429. el.else = true;
  9430. }
  9431. var elseif = getAndRemoveAttr(el, 'v-else-if');
  9432. if (elseif) {
  9433. el.elseif = elseif;
  9434. }
  9435. }
  9436. }
  9437. function processIfConditions(el, parent) {
  9438. var prev = findPrevElement(parent.children);
  9439. if (prev && prev.if) {
  9440. addIfCondition(prev, {
  9441. exp: el.elseif,
  9442. block: el
  9443. });
  9444. } else {
  9445. warn$2(
  9446. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  9447. "used on element <" + (el.tag) + "> without corresponding v-if.",
  9448. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  9449. );
  9450. }
  9451. }
  9452. function findPrevElement(children) {
  9453. var i = children.length;
  9454. while (i--) {
  9455. if (children[i].type === 1) {
  9456. return children[i]
  9457. } else {
  9458. if (children[i].text !== ' ') {
  9459. warn$2(
  9460. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  9461. "will be ignored.",
  9462. children[i]
  9463. );
  9464. }
  9465. children.pop();
  9466. }
  9467. }
  9468. }
  9469. function addIfCondition(el, condition) {
  9470. if (!el.ifConditions) {
  9471. el.ifConditions = [];
  9472. }
  9473. el.ifConditions.push(condition);
  9474. }
  9475. function processOnce(el) {
  9476. var once$$1 = getAndRemoveAttr(el, 'v-once');
  9477. if (once$$1 != null) {
  9478. el.once = true;
  9479. }
  9480. }
  9481. // handle content being passed to a component as slot,
  9482. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  9483. function processSlotContent(el) {
  9484. var slotScope;
  9485. if (el.tag === 'template') {
  9486. slotScope = getAndRemoveAttr(el, 'scope');
  9487. /* istanbul ignore if */
  9488. if (slotScope) {
  9489. warn$2(
  9490. "the \"scope\" attribute for scoped slots have been deprecated and " +
  9491. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  9492. "can also be used on plain elements in addition to <template> to " +
  9493. "denote scoped slots.",
  9494. el.rawAttrsMap['scope'],
  9495. true
  9496. );
  9497. }
  9498. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  9499. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  9500. /* istanbul ignore if */
  9501. if (el.attrsMap['v-for']) {
  9502. warn$2(
  9503. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  9504. "(v-for takes higher priority). Use a wrapper <template> for the " +
  9505. "scoped slot to make it clearer.",
  9506. el.rawAttrsMap['slot-scope'],
  9507. true
  9508. );
  9509. }
  9510. el.slotScope = slotScope;
  9511. }
  9512. // slot="xxx"
  9513. var slotTarget = getBindingAttr(el, 'slot');
  9514. if (slotTarget) {
  9515. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  9516. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  9517. // preserve slot as an attribute for native shadow DOM compat
  9518. // only for non-scoped slots.
  9519. if (el.tag !== 'template' && !el.slotScope) {
  9520. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  9521. }
  9522. }
  9523. // 2.6 v-slot syntax
  9524. {
  9525. if (el.tag === 'template') {
  9526. // v-slot on <template>
  9527. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  9528. if (slotBinding) {
  9529. {
  9530. if (el.slotTarget || el.slotScope) {
  9531. warn$2(
  9532. "Unexpected mixed usage of different slot syntaxes.",
  9533. el
  9534. );
  9535. }
  9536. if (el.parent && !maybeComponent(el.parent)) {
  9537. warn$2(
  9538. "<template v-slot> can only appear at the root level inside " +
  9539. "the receiving component",
  9540. el
  9541. );
  9542. }
  9543. }
  9544. var ref = getSlotName(slotBinding);
  9545. var name = ref.name;
  9546. var dynamic = ref.dynamic;
  9547. el.slotTarget = name;
  9548. el.slotTargetDynamic = dynamic;
  9549. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  9550. }
  9551. } else {
  9552. // v-slot on component, denotes default slot
  9553. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  9554. if (slotBinding$1) {
  9555. {
  9556. if (!maybeComponent(el)) {
  9557. warn$2(
  9558. "v-slot can only be used on components or <template>.",
  9559. slotBinding$1
  9560. );
  9561. }
  9562. if (el.slotScope || el.slotTarget) {
  9563. warn$2(
  9564. "Unexpected mixed usage of different slot syntaxes.",
  9565. el
  9566. );
  9567. }
  9568. if (el.scopedSlots) {
  9569. warn$2(
  9570. "To avoid scope ambiguity, the default slot should also use " +
  9571. "<template> syntax when there are other named slots.",
  9572. slotBinding$1
  9573. );
  9574. }
  9575. }
  9576. // add the component's children to its default slot
  9577. var slots = el.scopedSlots || (el.scopedSlots = {});
  9578. var ref$1 = getSlotName(slotBinding$1);
  9579. var name$1 = ref$1.name;
  9580. var dynamic$1 = ref$1.dynamic;
  9581. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  9582. slotContainer.slotTarget = name$1;
  9583. slotContainer.slotTargetDynamic = dynamic$1;
  9584. slotContainer.children = el.children.filter(function (c) {
  9585. if (!c.slotScope) {
  9586. c.parent = slotContainer;
  9587. return true
  9588. }
  9589. });
  9590. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  9591. // remove children as they are returned from scopedSlots now
  9592. el.children = [];
  9593. // mark el non-plain so data gets generated
  9594. el.plain = false;
  9595. }
  9596. }
  9597. }
  9598. }
  9599. function getSlotName(binding) {
  9600. var name = binding.name.replace(slotRE, '');
  9601. if (!name) {
  9602. if (binding.name[0] !== '#') {
  9603. name = 'default';
  9604. } else {
  9605. warn$2(
  9606. "v-slot shorthand syntax requires a slot name.",
  9607. binding
  9608. );
  9609. }
  9610. }
  9611. return dynamicArgRE.test(name)
  9612. // dynamic [name]
  9613. ?
  9614. {
  9615. name: name.slice(1, -1),
  9616. dynamic: true
  9617. }
  9618. // static name
  9619. :
  9620. {
  9621. name: ("\"" + name + "\""),
  9622. dynamic: false
  9623. }
  9624. }
  9625. // handle <slot/> outlets
  9626. function processSlotOutlet(el) {
  9627. if (el.tag === 'slot') {
  9628. el.slotName = getBindingAttr(el, 'name');
  9629. if (el.key) {
  9630. warn$2(
  9631. "`key` does not work on <slot> because slots are abstract outlets " +
  9632. "and can possibly expand into multiple elements. " +
  9633. "Use the key on a wrapping element instead.",
  9634. getRawBindingAttr(el, 'key')
  9635. );
  9636. }
  9637. }
  9638. }
  9639. function processComponent(el) {
  9640. var binding;
  9641. if ((binding = getBindingAttr(el, 'is'))) {
  9642. el.component = binding;
  9643. }
  9644. if (getAndRemoveAttr(el, 'inline-template') != null) {
  9645. el.inlineTemplate = true;
  9646. }
  9647. }
  9648. function processAttrs(el) {
  9649. var list = el.attrsList;
  9650. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  9651. for (i = 0, l = list.length; i < l; i++) {
  9652. name = rawName = list[i].name;
  9653. value = list[i].value;
  9654. if (dirRE.test(name)) {
  9655. // mark element as dynamic
  9656. el.hasBindings = true;
  9657. // modifiers
  9658. modifiers = parseModifiers(name.replace(dirRE, ''));
  9659. // support .foo shorthand syntax for the .prop modifier
  9660. if (modifiers) {
  9661. name = name.replace(modifierRE, '');
  9662. }
  9663. if (bindRE.test(name)) { // v-bind
  9664. name = name.replace(bindRE, '');
  9665. value = parseFilters(value);
  9666. isDynamic = dynamicArgRE.test(name);
  9667. if (isDynamic) {
  9668. name = name.slice(1, -1);
  9669. }
  9670. if (
  9671. value.trim().length === 0
  9672. ) {
  9673. warn$2(
  9674. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  9675. );
  9676. }
  9677. if (modifiers) {
  9678. if (modifiers.prop && !isDynamic) {
  9679. name = camelize(name);
  9680. if (name === 'innerHtml') {
  9681. name = 'innerHTML';
  9682. }
  9683. }
  9684. if (modifiers.camel && !isDynamic) {
  9685. name = camelize(name);
  9686. }
  9687. if (modifiers.sync) {
  9688. syncGen = genAssignmentCode(value, "$event");
  9689. if (!isDynamic) {
  9690. addHandler(
  9691. el,
  9692. ("update:" + (camelize(name))),
  9693. syncGen,
  9694. null,
  9695. false,
  9696. warn$2,
  9697. list[i]
  9698. );
  9699. if (hyphenate(name) !== camelize(name)) {
  9700. addHandler(
  9701. el,
  9702. ("update:" + (hyphenate(name))),
  9703. syncGen,
  9704. null,
  9705. false,
  9706. warn$2,
  9707. list[i]
  9708. );
  9709. }
  9710. } else {
  9711. // handler w/ dynamic event name
  9712. addHandler(
  9713. el,
  9714. ("\"update:\"+(" + name + ")"),
  9715. syncGen,
  9716. null,
  9717. false,
  9718. warn$2,
  9719. list[i],
  9720. true // dynamic
  9721. );
  9722. }
  9723. }
  9724. }
  9725. if ((modifiers && modifiers.prop) || (
  9726. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  9727. )) {
  9728. addProp(el, name, value, list[i], isDynamic);
  9729. } else {
  9730. addAttr(el, name, value, list[i], isDynamic);
  9731. }
  9732. } else if (onRE.test(name)) { // v-on
  9733. name = name.replace(onRE, '');
  9734. isDynamic = dynamicArgRE.test(name);
  9735. if (isDynamic) {
  9736. name = name.slice(1, -1);
  9737. }
  9738. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  9739. } else { // normal directives
  9740. name = name.replace(dirRE, '');
  9741. // parse arg
  9742. var argMatch = name.match(argRE);
  9743. var arg = argMatch && argMatch[1];
  9744. isDynamic = false;
  9745. if (arg) {
  9746. name = name.slice(0, -(arg.length + 1));
  9747. if (dynamicArgRE.test(arg)) {
  9748. arg = arg.slice(1, -1);
  9749. isDynamic = true;
  9750. }
  9751. }
  9752. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  9753. if (name === 'model') {
  9754. checkForAliasModel(el, value);
  9755. }
  9756. }
  9757. } else {
  9758. // literal attribute
  9759. {
  9760. var res = parseText(value, delimiters);
  9761. if (res) {
  9762. warn$2(
  9763. name + "=\"" + value + "\": " +
  9764. 'Interpolation inside attributes has been removed. ' +
  9765. 'Use v-bind or the colon shorthand instead. For example, ' +
  9766. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  9767. list[i]
  9768. );
  9769. }
  9770. }
  9771. addAttr(el, name, JSON.stringify(value), list[i]);
  9772. // #6887 firefox doesn't update muted state if set via attribute
  9773. // even immediately after element creation
  9774. if (!el.component &&
  9775. name === 'muted' &&
  9776. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  9777. addProp(el, name, 'true', list[i]);
  9778. }
  9779. }
  9780. }
  9781. }
  9782. function checkInFor(el) {
  9783. var parent = el;
  9784. while (parent) {
  9785. if (parent.for !== undefined) {
  9786. return true
  9787. }
  9788. parent = parent.parent;
  9789. }
  9790. return false
  9791. }
  9792. function parseModifiers(name) {
  9793. var match = name.match(modifierRE);
  9794. if (match) {
  9795. var ret = {};
  9796. match.forEach(function (m) {
  9797. ret[m.slice(1)] = true;
  9798. });
  9799. return ret
  9800. }
  9801. }
  9802. function makeAttrsMap(attrs) {
  9803. var map = {};
  9804. for (var i = 0, l = attrs.length; i < l; i++) {
  9805. if (
  9806. map[attrs[i].name] && !isIE && !isEdge
  9807. ) {
  9808. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  9809. }
  9810. map[attrs[i].name] = attrs[i].value;
  9811. }
  9812. return map
  9813. }
  9814. // for script (e.g. type="x/template") or style, do not decode content
  9815. function isTextTag(el) {
  9816. return el.tag === 'script' || el.tag === 'style'
  9817. }
  9818. function isForbiddenTag(el) {
  9819. return (
  9820. el.tag === 'style' ||
  9821. (el.tag === 'script' && (
  9822. !el.attrsMap.type ||
  9823. el.attrsMap.type === 'text/javascript'
  9824. ))
  9825. )
  9826. }
  9827. var ieNSBug = /^xmlns:NS\d+/;
  9828. var ieNSPrefix = /^NS\d+:/;
  9829. /* istanbul ignore next */
  9830. function guardIESVGBug(attrs) {
  9831. var res = [];
  9832. for (var i = 0; i < attrs.length; i++) {
  9833. var attr = attrs[i];
  9834. if (!ieNSBug.test(attr.name)) {
  9835. attr.name = attr.name.replace(ieNSPrefix, '');
  9836. res.push(attr);
  9837. }
  9838. }
  9839. return res
  9840. }
  9841. function checkForAliasModel(el, value) {
  9842. var _el = el;
  9843. while (_el) {
  9844. if (_el.for && _el.alias === value) {
  9845. warn$2(
  9846. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  9847. "You are binding v-model directly to a v-for iteration alias. " +
  9848. "This will not be able to modify the v-for source array because " +
  9849. "writing to the alias is like modifying a function local variable. " +
  9850. "Consider using an array of objects and use v-model on an object property instead.",
  9851. el.rawAttrsMap['v-model']
  9852. );
  9853. }
  9854. _el = _el.parent;
  9855. }
  9856. }
  9857. /* */
  9858. function preTransformNode(el, options) {
  9859. if (el.tag === 'input') {
  9860. var map = el.attrsMap;
  9861. if (!map['v-model']) {
  9862. return
  9863. }
  9864. var typeBinding;
  9865. if (map[':type'] || map['v-bind:type']) {
  9866. typeBinding = getBindingAttr(el, 'type');
  9867. }
  9868. if (!map.type && !typeBinding && map['v-bind']) {
  9869. typeBinding = "(" + (map['v-bind']) + ").type";
  9870. }
  9871. if (typeBinding) {
  9872. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  9873. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  9874. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  9875. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  9876. // 1. checkbox
  9877. var branch0 = cloneASTElement(el);
  9878. // process for on the main node
  9879. processFor(branch0);
  9880. addRawAttr(branch0, 'type', 'checkbox');
  9881. processElement(branch0, options);
  9882. branch0.processed = true; // prevent it from double-processed
  9883. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  9884. addIfCondition(branch0, {
  9885. exp: branch0.if,
  9886. block: branch0
  9887. });
  9888. // 2. add radio else-if condition
  9889. var branch1 = cloneASTElement(el);
  9890. getAndRemoveAttr(branch1, 'v-for', true);
  9891. addRawAttr(branch1, 'type', 'radio');
  9892. processElement(branch1, options);
  9893. addIfCondition(branch0, {
  9894. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  9895. block: branch1
  9896. });
  9897. // 3. other
  9898. var branch2 = cloneASTElement(el);
  9899. getAndRemoveAttr(branch2, 'v-for', true);
  9900. addRawAttr(branch2, ':type', typeBinding);
  9901. processElement(branch2, options);
  9902. addIfCondition(branch0, {
  9903. exp: ifCondition,
  9904. block: branch2
  9905. });
  9906. if (hasElse) {
  9907. branch0.else = true;
  9908. } else if (elseIfCondition) {
  9909. branch0.elseif = elseIfCondition;
  9910. }
  9911. return branch0
  9912. }
  9913. }
  9914. }
  9915. function cloneASTElement(el) {
  9916. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  9917. }
  9918. var model$1 = {
  9919. preTransformNode: preTransformNode
  9920. };
  9921. var modules$1 = [
  9922. klass$1,
  9923. style$1,
  9924. model$1
  9925. ];
  9926. /* */
  9927. function text(el, dir) {
  9928. if (dir.value) {
  9929. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  9930. }
  9931. }
  9932. /* */
  9933. function html(el, dir) {
  9934. if (dir.value) {
  9935. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  9936. }
  9937. }
  9938. var directives$1 = {
  9939. model: model,
  9940. text: text,
  9941. html: html
  9942. };
  9943. /* */
  9944. var baseOptions = {
  9945. expectHTML: true,
  9946. modules: modules$1,
  9947. directives: directives$1,
  9948. isPreTag: isPreTag,
  9949. isUnaryTag: isUnaryTag,
  9950. mustUseProp: mustUseProp,
  9951. canBeLeftOpenTag: canBeLeftOpenTag,
  9952. isReservedTag: isReservedTag,
  9953. getTagNamespace: getTagNamespace,
  9954. staticKeys: genStaticKeys(modules$1)
  9955. };
  9956. /* */
  9957. var isStaticKey;
  9958. var isPlatformReservedTag;
  9959. var genStaticKeysCached = cached(genStaticKeys$1);
  9960. /**
  9961. * Goal of the optimizer: walk the generated template AST tree
  9962. * and detect sub-trees that are purely static, i.e. parts of
  9963. * the DOM that never needs to change.
  9964. *
  9965. * Once we detect these sub-trees, we can:
  9966. *
  9967. * 1. Hoist them into constants, so that we no longer need to
  9968. * create fresh nodes for them on each re-render;
  9969. * 2. Completely skip them in the patching process.
  9970. */
  9971. function optimize(root, options) {
  9972. if (!root) {
  9973. return
  9974. }
  9975. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  9976. isPlatformReservedTag = options.isReservedTag || no;
  9977. // first pass: mark all non-static nodes.
  9978. markStatic$1(root);
  9979. // second pass: mark static roots.
  9980. markStaticRoots(root, false);
  9981. }
  9982. function genStaticKeys$1(keys) {
  9983. return makeMap(
  9984. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  9985. (keys ? ',' + keys : '')
  9986. )
  9987. }
  9988. function markStatic$1(node) {
  9989. node.static = isStatic(node);
  9990. if (node.type === 1) {
  9991. // do not make component slot content static. this avoids
  9992. // 1. components not able to mutate slot nodes
  9993. // 2. static slot content fails for hot-reloading
  9994. if (
  9995. !isPlatformReservedTag(node.tag) &&
  9996. node.tag !== 'slot' &&
  9997. node.attrsMap['inline-template'] == null
  9998. ) {
  9999. return
  10000. }
  10001. for (var i = 0, l = node.children.length; i < l; i++) {
  10002. var child = node.children[i];
  10003. markStatic$1(child);
  10004. if (!child.static) {
  10005. node.static = false;
  10006. }
  10007. }
  10008. if (node.ifConditions) {
  10009. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  10010. var block = node.ifConditions[i$1].block;
  10011. markStatic$1(block);
  10012. if (!block.static) {
  10013. node.static = false;
  10014. }
  10015. }
  10016. }
  10017. }
  10018. }
  10019. function markStaticRoots(node, isInFor) {
  10020. if (node.type === 1) {
  10021. if (node.static || node.once) {
  10022. node.staticInFor = isInFor;
  10023. }
  10024. // For a node to qualify as a static root, it should have children that
  10025. // are not just static text. Otherwise the cost of hoisting out will
  10026. // outweigh the benefits and it's better off to just always render it fresh.
  10027. if (node.static && node.children.length && !(
  10028. node.children.length === 1 &&
  10029. node.children[0].type === 3
  10030. )) {
  10031. node.staticRoot = true;
  10032. return
  10033. } else {
  10034. node.staticRoot = false;
  10035. }
  10036. if (node.children) {
  10037. for (var i = 0, l = node.children.length; i < l; i++) {
  10038. markStaticRoots(node.children[i], isInFor || !!node.for);
  10039. }
  10040. }
  10041. if (node.ifConditions) {
  10042. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  10043. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  10044. }
  10045. }
  10046. }
  10047. }
  10048. function isStatic(node) {
  10049. if (node.type === 2) { // expression
  10050. return false
  10051. }
  10052. if (node.type === 3) { // text
  10053. return true
  10054. }
  10055. return !!(node.pre || (
  10056. !node.hasBindings && // no dynamic bindings
  10057. !node.if && !node.for && // not v-if or v-for or v-else
  10058. !isBuiltInTag(node.tag) && // not a built-in
  10059. isPlatformReservedTag(node.tag) && // not a component
  10060. !isDirectChildOfTemplateFor(node) &&
  10061. Object.keys(node).every(isStaticKey)
  10062. ))
  10063. }
  10064. function isDirectChildOfTemplateFor(node) {
  10065. while (node.parent) {
  10066. node = node.parent;
  10067. if (node.tag !== 'template') {
  10068. return false
  10069. }
  10070. if (node.for) {
  10071. return true
  10072. }
  10073. }
  10074. return false
  10075. }
  10076. /* */
  10077. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  10078. var fnInvokeRE = /\([^)]*?\);*$/;
  10079. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  10080. // KeyboardEvent.keyCode aliases
  10081. var keyCodes = {
  10082. esc: 27,
  10083. tab: 9,
  10084. enter: 13,
  10085. space: 32,
  10086. up: 38,
  10087. left: 37,
  10088. right: 39,
  10089. down: 40,
  10090. 'delete': [8, 46]
  10091. };
  10092. // KeyboardEvent.key aliases
  10093. var keyNames = {
  10094. // #7880: IE11 and Edge use `Esc` for Escape key name.
  10095. esc: ['Esc', 'Escape'],
  10096. tab: 'Tab',
  10097. enter: 'Enter',
  10098. // #9112: IE11 uses `Spacebar` for Space key name.
  10099. space: [' ', 'Spacebar'],
  10100. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  10101. up: ['Up', 'ArrowUp'],
  10102. left: ['Left', 'ArrowLeft'],
  10103. right: ['Right', 'ArrowRight'],
  10104. down: ['Down', 'ArrowDown'],
  10105. // #9112: IE11 uses `Del` for Delete key name.
  10106. 'delete': ['Backspace', 'Delete', 'Del']
  10107. };
  10108. // #4868: modifiers that prevent the execution of the listener
  10109. // need to explicitly return null so that we can determine whether to remove
  10110. // the listener for .once
  10111. var genGuard = function (condition) {
  10112. return ("if(" + condition + ")return null;");
  10113. };
  10114. var modifierCode = {
  10115. stop: '$event.stopPropagation();',
  10116. prevent: '$event.preventDefault();',
  10117. self: genGuard("$event.target !== $event.currentTarget"),
  10118. ctrl: genGuard("!$event.ctrlKey"),
  10119. shift: genGuard("!$event.shiftKey"),
  10120. alt: genGuard("!$event.altKey"),
  10121. meta: genGuard("!$event.metaKey"),
  10122. left: genGuard("'button' in $event && $event.button !== 0"),
  10123. middle: genGuard("'button' in $event && $event.button !== 1"),
  10124. right: genGuard("'button' in $event && $event.button !== 2")
  10125. };
  10126. function genHandlers(
  10127. events,
  10128. isNative
  10129. ) {
  10130. var prefix = isNative ? 'nativeOn:' : 'on:';
  10131. var staticHandlers = "";
  10132. var dynamicHandlers = "";
  10133. for (var name in events) {
  10134. var handlerCode = genHandler(events[name]);
  10135. if (events[name] && events[name].dynamic) {
  10136. dynamicHandlers += name + "," + handlerCode + ",";
  10137. } else {
  10138. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  10139. }
  10140. }
  10141. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  10142. if (dynamicHandlers) {
  10143. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  10144. } else {
  10145. return prefix + staticHandlers
  10146. }
  10147. }
  10148. function genHandler(handler) {
  10149. if (!handler) {
  10150. return 'function(){}'
  10151. }
  10152. if (Array.isArray(handler)) {
  10153. return ("[" + (handler.map(function (handler) {
  10154. return genHandler(handler);
  10155. }).join(',')) + "]")
  10156. }
  10157. var isMethodPath = simplePathRE.test(handler.value);
  10158. var isFunctionExpression = fnExpRE.test(handler.value);
  10159. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  10160. if (!handler.modifiers) {
  10161. if (isMethodPath || isFunctionExpression) {
  10162. return handler.value
  10163. }
  10164. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  10165. } else {
  10166. var code = '';
  10167. var genModifierCode = '';
  10168. var keys = [];
  10169. for (var key in handler.modifiers) {
  10170. if (modifierCode[key]) {
  10171. genModifierCode += modifierCode[key];
  10172. // left/right
  10173. if (keyCodes[key]) {
  10174. keys.push(key);
  10175. }
  10176. } else if (key === 'exact') {
  10177. var modifiers = (handler.modifiers);
  10178. genModifierCode += genGuard(
  10179. ['ctrl', 'shift', 'alt', 'meta']
  10180. .filter(function (keyModifier) {
  10181. return !modifiers[keyModifier];
  10182. })
  10183. .map(function (keyModifier) {
  10184. return ("$event." + keyModifier + "Key");
  10185. })
  10186. .join('||')
  10187. );
  10188. } else {
  10189. keys.push(key);
  10190. }
  10191. }
  10192. if (keys.length) {
  10193. code += genKeyFilter(keys);
  10194. }
  10195. // Make sure modifiers like prevent and stop get executed after key filtering
  10196. if (genModifierCode) {
  10197. code += genModifierCode;
  10198. }
  10199. var handlerCode = isMethodPath ?
  10200. ("return " + (handler.value) + ".apply(null, arguments)") :
  10201. isFunctionExpression ?
  10202. ("return (" + (handler.value) + ").apply(null, arguments)") :
  10203. isFunctionInvocation ?
  10204. ("return " + (handler.value)) :
  10205. handler.value;
  10206. return ("function($event){" + code + handlerCode + "}")
  10207. }
  10208. }
  10209. function genKeyFilter(keys) {
  10210. return (
  10211. // make sure the key filters only apply to KeyboardEvents
  10212. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  10213. // key events that do not have keyCode property...
  10214. "if(!$event.type.indexOf('key')&&" +
  10215. (keys.map(genFilterCode).join('&&')) + ")return null;"
  10216. )
  10217. }
  10218. function genFilterCode(key) {
  10219. var keyVal = parseInt(key, 10);
  10220. if (keyVal) {
  10221. return ("$event.keyCode!==" + keyVal)
  10222. }
  10223. var keyCode = keyCodes[key];
  10224. var keyName = keyNames[key];
  10225. return (
  10226. "_k($event.keyCode," +
  10227. (JSON.stringify(key)) + "," +
  10228. (JSON.stringify(keyCode)) + "," +
  10229. "$event.key," +
  10230. "" + (JSON.stringify(keyName)) +
  10231. ")"
  10232. )
  10233. }
  10234. /* */
  10235. function on(el, dir) {
  10236. if (dir.modifiers) {
  10237. warn("v-on without argument does not support modifiers.");
  10238. }
  10239. el.wrapListeners = function (code) {
  10240. return ("_g(" + code + "," + (dir.value) + ")");
  10241. };
  10242. }
  10243. /* */
  10244. function bind$1(el, dir) {
  10245. el.wrapData = function (code) {
  10246. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  10247. };
  10248. }
  10249. /* */
  10250. var baseDirectives = {
  10251. on: on,
  10252. bind: bind$1,
  10253. cloak: noop
  10254. };
  10255. /* */
  10256. var CodegenState = function CodegenState(options) {
  10257. this.options = options;
  10258. this.warn = options.warn || baseWarn;
  10259. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  10260. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  10261. this.directives = extend(extend({}, baseDirectives), options.directives);
  10262. var isReservedTag = options.isReservedTag || no;
  10263. this.maybeComponent = function (el) {
  10264. return !!el.component || !isReservedTag(el.tag);
  10265. };
  10266. this.onceId = 0;
  10267. this.staticRenderFns = [];
  10268. this.pre = false;
  10269. };
  10270. function generate(
  10271. ast,
  10272. options
  10273. ) {
  10274. var state = new CodegenState(options);
  10275. // fix #11483, Root level <script> tags should not be rendered.
  10276. var code = ast ? (ast.tag === 'script' ? 'null' : genElement(ast, state)) : '_c("div")';
  10277. return {
  10278. render: ("with(this){return " + code + "}"),
  10279. staticRenderFns: state.staticRenderFns
  10280. }
  10281. }
  10282. function genElement(el, state) {
  10283. if (el.parent) {
  10284. el.pre = el.pre || el.parent.pre;
  10285. }
  10286. if (el.staticRoot && !el.staticProcessed) {
  10287. return genStatic(el, state)
  10288. } else if (el.once && !el.onceProcessed) {
  10289. return genOnce(el, state)
  10290. } else if (el.for && !el.forProcessed) {
  10291. return genFor(el, state)
  10292. } else if (el.if && !el.ifProcessed) {
  10293. return genIf(el, state)
  10294. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  10295. return genChildren(el, state) || 'void 0'
  10296. } else if (el.tag === 'slot') {
  10297. return genSlot(el, state)
  10298. } else {
  10299. // component or element
  10300. var code;
  10301. if (el.component) {
  10302. code = genComponent(el.component, el, state);
  10303. } else {
  10304. var data;
  10305. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  10306. data = genData$2(el, state);
  10307. }
  10308. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  10309. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  10310. }
  10311. // module transforms
  10312. for (var i = 0; i < state.transforms.length; i++) {
  10313. code = state.transforms[i](el, code);
  10314. }
  10315. return code
  10316. }
  10317. }
  10318. // hoist static sub-trees out
  10319. function genStatic(el, state) {
  10320. el.staticProcessed = true;
  10321. // Some elements (templates) need to behave differently inside of a v-pre
  10322. // node. All pre nodes are static roots, so we can use this as a location to
  10323. // wrap a state change and reset it upon exiting the pre node.
  10324. var originalPreState = state.pre;
  10325. if (el.pre) {
  10326. state.pre = el.pre;
  10327. }
  10328. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  10329. state.pre = originalPreState;
  10330. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  10331. }
  10332. // v-once
  10333. function genOnce(el, state) {
  10334. el.onceProcessed = true;
  10335. if (el.if && !el.ifProcessed) {
  10336. return genIf(el, state)
  10337. } else if (el.staticInFor) {
  10338. var key = '';
  10339. var parent = el.parent;
  10340. while (parent) {
  10341. if (parent.for) {
  10342. key = parent.key;
  10343. break
  10344. }
  10345. parent = parent.parent;
  10346. }
  10347. if (!key) {
  10348. state.warn(
  10349. "v-once can only be used inside v-for that is keyed. ",
  10350. el.rawAttrsMap['v-once']
  10351. );
  10352. return genElement(el, state)
  10353. }
  10354. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  10355. } else {
  10356. return genStatic(el, state)
  10357. }
  10358. }
  10359. function genIf(
  10360. el,
  10361. state,
  10362. altGen,
  10363. altEmpty
  10364. ) {
  10365. el.ifProcessed = true; // avoid recursion
  10366. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  10367. }
  10368. function genIfConditions(
  10369. conditions,
  10370. state,
  10371. altGen,
  10372. altEmpty
  10373. ) {
  10374. if (!conditions.length) {
  10375. return altEmpty || '_e()'
  10376. }
  10377. var condition = conditions.shift();
  10378. if (condition.exp) {
  10379. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  10380. } else {
  10381. return ("" + (genTernaryExp(condition.block)))
  10382. }
  10383. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  10384. function genTernaryExp(el) {
  10385. return altGen ?
  10386. altGen(el, state) :
  10387. el.once ?
  10388. genOnce(el, state) :
  10389. genElement(el, state)
  10390. }
  10391. }
  10392. function genFor(
  10393. el,
  10394. state,
  10395. altGen,
  10396. altHelper
  10397. ) {
  10398. var exp = el.for;
  10399. var alias = el.alias;
  10400. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  10401. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  10402. if (state.maybeComponent(el) &&
  10403. el.tag !== 'slot' &&
  10404. el.tag !== 'template' &&
  10405. !el.key
  10406. ) {
  10407. state.warn(
  10408. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  10409. "v-for should have explicit keys. " +
  10410. "See https://vuejs.org/guide/list.html#key for more info.",
  10411. el.rawAttrsMap['v-for'],
  10412. true /* tip */
  10413. );
  10414. }
  10415. el.forProcessed = true; // avoid recursion
  10416. return (altHelper || '_l') + "((" + exp + ")," +
  10417. "function(" + alias + iterator1 + iterator2 + "){" +
  10418. "return " + ((altGen || genElement)(el, state)) +
  10419. '})'
  10420. }
  10421. function genData$2(el, state) {
  10422. var data = '{';
  10423. // directives first.
  10424. // directives may mutate the el's other properties before they are generated.
  10425. var dirs = genDirectives(el, state);
  10426. if (dirs) {
  10427. data += dirs + ',';
  10428. }
  10429. // key
  10430. if (el.key) {
  10431. data += "key:" + (el.key) + ",";
  10432. }
  10433. // ref
  10434. if (el.ref) {
  10435. data += "ref:" + (el.ref) + ",";
  10436. }
  10437. if (el.refInFor) {
  10438. data += "refInFor:true,";
  10439. }
  10440. // pre
  10441. if (el.pre) {
  10442. data += "pre:true,";
  10443. }
  10444. // record original tag name for components using "is" attribute
  10445. if (el.component) {
  10446. data += "tag:\"" + (el.tag) + "\",";
  10447. }
  10448. // module data generation functions
  10449. for (var i = 0; i < state.dataGenFns.length; i++) {
  10450. data += state.dataGenFns[i](el);
  10451. }
  10452. // attributes
  10453. if (el.attrs) {
  10454. data += "attrs:" + (genProps(el.attrs)) + ",";
  10455. }
  10456. // DOM props
  10457. if (el.props) {
  10458. data += "domProps:" + (genProps(el.props)) + ",";
  10459. }
  10460. // event handlers
  10461. if (el.events) {
  10462. data += (genHandlers(el.events, false)) + ",";
  10463. }
  10464. if (el.nativeEvents) {
  10465. data += (genHandlers(el.nativeEvents, true)) + ",";
  10466. }
  10467. // slot target
  10468. // only for non-scoped slots
  10469. if (el.slotTarget && !el.slotScope) {
  10470. data += "slot:" + (el.slotTarget) + ",";
  10471. }
  10472. // scoped slots
  10473. if (el.scopedSlots) {
  10474. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  10475. }
  10476. // component v-model
  10477. if (el.model) {
  10478. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  10479. }
  10480. // inline-template
  10481. if (el.inlineTemplate) {
  10482. var inlineTemplate = genInlineTemplate(el, state);
  10483. if (inlineTemplate) {
  10484. data += inlineTemplate + ",";
  10485. }
  10486. }
  10487. data = data.replace(/,$/, '') + '}';
  10488. // v-bind dynamic argument wrap
  10489. // v-bind with dynamic arguments must be applied using the same v-bind object
  10490. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  10491. if (el.dynamicAttrs) {
  10492. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  10493. }
  10494. // v-bind data wrap
  10495. if (el.wrapData) {
  10496. data = el.wrapData(data);
  10497. }
  10498. // v-on data wrap
  10499. if (el.wrapListeners) {
  10500. data = el.wrapListeners(data);
  10501. }
  10502. return data
  10503. }
  10504. function genDirectives(el, state) {
  10505. var dirs = el.directives;
  10506. if (!dirs) {
  10507. return
  10508. }
  10509. var res = 'directives:[';
  10510. var hasRuntime = false;
  10511. var i, l, dir, needRuntime;
  10512. for (i = 0, l = dirs.length; i < l; i++) {
  10513. dir = dirs[i];
  10514. needRuntime = true;
  10515. var gen = state.directives[dir.name];
  10516. if (gen) {
  10517. // compile-time directive that manipulates AST.
  10518. // returns true if it also needs a runtime counterpart.
  10519. needRuntime = !!gen(el, dir, state.warn);
  10520. }
  10521. if (needRuntime) {
  10522. hasRuntime = true;
  10523. 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))) : '') + "},";
  10524. }
  10525. }
  10526. if (hasRuntime) {
  10527. return res.slice(0, -1) + ']'
  10528. }
  10529. }
  10530. function genInlineTemplate(el, state) {
  10531. var ast = el.children[0];
  10532. if (el.children.length !== 1 || ast.type !== 1) {
  10533. state.warn(
  10534. 'Inline-template components must have exactly one child element.', {
  10535. start: el.start
  10536. }
  10537. );
  10538. }
  10539. if (ast && ast.type === 1) {
  10540. var inlineRenderFns = generate(ast, state.options);
  10541. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) {
  10542. return ("function(){" + code + "}");
  10543. }).join(',')) + "]}")
  10544. }
  10545. }
  10546. function genScopedSlots(
  10547. el,
  10548. slots,
  10549. state
  10550. ) {
  10551. // by default scoped slots are considered "stable", this allows child
  10552. // components with only scoped slots to skip forced updates from parent.
  10553. // but in some cases we have to bail-out of this optimization
  10554. // for example if the slot contains dynamic names, has v-if or v-for on them...
  10555. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  10556. var slot = slots[key];
  10557. return (
  10558. slot.slotTargetDynamic ||
  10559. slot.if ||
  10560. slot.for ||
  10561. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  10562. )
  10563. });
  10564. // #9534: if a component with scoped slots is inside a conditional branch,
  10565. // it's possible for the same component to be reused but with different
  10566. // compiled slot content. To avoid that, we generate a unique key based on
  10567. // the generated code of all the slot contents.
  10568. var needsKey = !!el.if;
  10569. // OR when it is inside another scoped slot or v-for (the reactivity may be
  10570. // disconnected due to the intermediate scope variable)
  10571. // #9438, #9506
  10572. // TODO: this can be further optimized by properly analyzing in-scope bindings
  10573. // and skip force updating ones that do not actually use scope variables.
  10574. if (!needsForceUpdate) {
  10575. var parent = el.parent;
  10576. while (parent) {
  10577. if (
  10578. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  10579. parent.for
  10580. ) {
  10581. needsForceUpdate = true;
  10582. break
  10583. }
  10584. if (parent.if) {
  10585. needsKey = true;
  10586. }
  10587. parent = parent.parent;
  10588. }
  10589. }
  10590. var generatedSlots = Object.keys(slots)
  10591. .map(function (key) {
  10592. return genScopedSlot(slots[key], state);
  10593. })
  10594. .join(',');
  10595. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  10596. }
  10597. function hash(str) {
  10598. var hash = 5381;
  10599. var i = str.length;
  10600. while (i) {
  10601. hash = (hash * 33) ^ str.charCodeAt(--i);
  10602. }
  10603. return hash >>> 0
  10604. }
  10605. function containsSlotChild(el) {
  10606. if (el.type === 1) {
  10607. if (el.tag === 'slot') {
  10608. return true
  10609. }
  10610. return el.children.some(containsSlotChild)
  10611. }
  10612. return false
  10613. }
  10614. function genScopedSlot(
  10615. el,
  10616. state
  10617. ) {
  10618. var isLegacySyntax = el.attrsMap['slot-scope'];
  10619. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  10620. return genIf(el, state, genScopedSlot, "null")
  10621. }
  10622. if (el.for && !el.forProcessed) {
  10623. return genFor(el, state, genScopedSlot)
  10624. }
  10625. var slotScope = el.slotScope === emptySlotScopeToken ?
  10626. "" :
  10627. String(el.slotScope);
  10628. var fn = "function(" + slotScope + "){" +
  10629. "return " + (el.tag === 'template' ?
  10630. el.if && isLegacySyntax ?
  10631. ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined") :
  10632. genChildren(el, state) || 'undefined' :
  10633. genElement(el, state)) + "}";
  10634. // reverse proxy v-slot without scope on this.$slots
  10635. var reverseProxy = slotScope ? "" : ",proxy:true";
  10636. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  10637. }
  10638. function genChildren(
  10639. el,
  10640. state,
  10641. checkSkip,
  10642. altGenElement,
  10643. altGenNode
  10644. ) {
  10645. var children = el.children;
  10646. if (children.length) {
  10647. var el$1 = children[0];
  10648. // optimize single v-for
  10649. if (children.length === 1 &&
  10650. el$1.for &&
  10651. el$1.tag !== 'template' &&
  10652. el$1.tag !== 'slot'
  10653. ) {
  10654. var normalizationType = checkSkip ?
  10655. state.maybeComponent(el$1) ? ",1" : ",0" :
  10656. "";
  10657. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  10658. }
  10659. var normalizationType$1 = checkSkip ?
  10660. getNormalizationType(children, state.maybeComponent) :
  10661. 0;
  10662. var gen = altGenNode || genNode;
  10663. return ("[" + (children.map(function (c) {
  10664. return gen(c, state);
  10665. }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  10666. }
  10667. }
  10668. // determine the normalization needed for the children array.
  10669. // 0: no normalization needed
  10670. // 1: simple normalization needed (possible 1-level deep nested array)
  10671. // 2: full normalization needed
  10672. function getNormalizationType(
  10673. children,
  10674. maybeComponent
  10675. ) {
  10676. var res = 0;
  10677. for (var i = 0; i < children.length; i++) {
  10678. var el = children[i];
  10679. if (el.type !== 1) {
  10680. continue
  10681. }
  10682. if (needsNormalization(el) ||
  10683. (el.ifConditions && el.ifConditions.some(function (c) {
  10684. return needsNormalization(c.block);
  10685. }))) {
  10686. res = 2;
  10687. break
  10688. }
  10689. if (maybeComponent(el) ||
  10690. (el.ifConditions && el.ifConditions.some(function (c) {
  10691. return maybeComponent(c.block);
  10692. }))) {
  10693. res = 1;
  10694. }
  10695. }
  10696. return res
  10697. }
  10698. function needsNormalization(el) {
  10699. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  10700. }
  10701. function genNode(node, state) {
  10702. if (node.type === 1) {
  10703. return genElement(node, state)
  10704. } else if (node.type === 3 && node.isComment) {
  10705. return genComment(node)
  10706. } else {
  10707. return genText(node)
  10708. }
  10709. }
  10710. function genText(text) {
  10711. return ("_v(" + (text.type === 2 ?
  10712. text.expression // no need for () because already wrapped in _s()
  10713. :
  10714. transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  10715. }
  10716. function genComment(comment) {
  10717. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  10718. }
  10719. function genSlot(el, state) {
  10720. var slotName = el.slotName || '"default"';
  10721. var children = genChildren(el, state);
  10722. var res = "_t(" + slotName + (children ? (",function(){return " + children + "}") : '');
  10723. var attrs = el.attrs || el.dynamicAttrs ?
  10724. genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) {
  10725. return ({
  10726. // slot props are camelized
  10727. name: camelize(attr.name),
  10728. value: attr.value,
  10729. dynamic: attr.dynamic
  10730. });
  10731. })) :
  10732. null;
  10733. var bind$$1 = el.attrsMap['v-bind'];
  10734. if ((attrs || bind$$1) && !children) {
  10735. res += ",null";
  10736. }
  10737. if (attrs) {
  10738. res += "," + attrs;
  10739. }
  10740. if (bind$$1) {
  10741. res += (attrs ? '' : ',null') + "," + bind$$1;
  10742. }
  10743. return res + ')'
  10744. }
  10745. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  10746. function genComponent(
  10747. componentName,
  10748. el,
  10749. state
  10750. ) {
  10751. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  10752. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  10753. }
  10754. function genProps(props) {
  10755. var staticProps = "";
  10756. var dynamicProps = "";
  10757. for (var i = 0; i < props.length; i++) {
  10758. var prop = props[i];
  10759. var value = transformSpecialNewlines(prop.value);
  10760. if (prop.dynamic) {
  10761. dynamicProps += (prop.name) + "," + value + ",";
  10762. } else {
  10763. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  10764. }
  10765. }
  10766. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  10767. if (dynamicProps) {
  10768. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  10769. } else {
  10770. return staticProps
  10771. }
  10772. }
  10773. // #3895, #4268
  10774. function transformSpecialNewlines(text) {
  10775. return text
  10776. .replace(/\u2028/g, '\\u2028')
  10777. .replace(/\u2029/g, '\\u2029')
  10778. }
  10779. /* */
  10780. // these keywords should not appear inside expressions, but operators like
  10781. // typeof, instanceof and in are allowed
  10782. var prohibitedKeywordRE = new RegExp('\\b' + (
  10783. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  10784. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  10785. 'extends,finally,continue,debugger,function,arguments'
  10786. ).split(',').join('\\b|\\b') + '\\b');
  10787. // these unary operators should not be used as property/method names
  10788. var unaryOperatorsRE = new RegExp('\\b' + (
  10789. 'delete,typeof,void'
  10790. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  10791. // strip strings in expressions
  10792. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  10793. // detect problematic expressions in a template
  10794. function detectErrors(ast, warn) {
  10795. if (ast) {
  10796. checkNode(ast, warn);
  10797. }
  10798. }
  10799. function checkNode(node, warn) {
  10800. if (node.type === 1) {
  10801. for (var name in node.attrsMap) {
  10802. if (dirRE.test(name)) {
  10803. var value = node.attrsMap[name];
  10804. if (value) {
  10805. var range = node.rawAttrsMap[name];
  10806. if (name === 'v-for') {
  10807. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  10808. } else if (name === 'v-slot' || name[0] === '#') {
  10809. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  10810. } else if (onRE.test(name)) {
  10811. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  10812. } else {
  10813. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  10814. }
  10815. }
  10816. }
  10817. }
  10818. if (node.children) {
  10819. for (var i = 0; i < node.children.length; i++) {
  10820. checkNode(node.children[i], warn);
  10821. }
  10822. }
  10823. } else if (node.type === 2) {
  10824. checkExpression(node.expression, node.text, warn, node);
  10825. }
  10826. }
  10827. function checkEvent(exp, text, warn, range) {
  10828. var stripped = exp.replace(stripStringRE, '');
  10829. var keywordMatch = stripped.match(unaryOperatorsRE);
  10830. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  10831. warn(
  10832. "avoid using JavaScript unary operator as property name: " +
  10833. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  10834. range
  10835. );
  10836. }
  10837. checkExpression(exp, text, warn, range);
  10838. }
  10839. function checkFor(node, text, warn, range) {
  10840. checkExpression(node.for || '', text, warn, range);
  10841. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  10842. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  10843. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  10844. }
  10845. function checkIdentifier(
  10846. ident,
  10847. type,
  10848. text,
  10849. warn,
  10850. range
  10851. ) {
  10852. if (typeof ident === 'string') {
  10853. try {
  10854. new Function(("var " + ident + "=_"));
  10855. } catch (e) {
  10856. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  10857. }
  10858. }
  10859. }
  10860. function checkExpression(exp, text, warn, range) {
  10861. try {
  10862. new Function(("return " + exp));
  10863. } catch (e) {
  10864. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  10865. if (keywordMatch) {
  10866. warn(
  10867. "avoid using JavaScript keyword as property name: " +
  10868. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  10869. range
  10870. );
  10871. } else {
  10872. warn(
  10873. "invalid expression: " + (e.message) + " in\n\n" +
  10874. " " + exp + "\n\n" +
  10875. " Raw expression: " + (text.trim()) + "\n",
  10876. range
  10877. );
  10878. }
  10879. }
  10880. }
  10881. function checkFunctionParameterExpression(exp, text, warn, range) {
  10882. try {
  10883. new Function(exp, '');
  10884. } catch (e) {
  10885. warn(
  10886. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  10887. " " + exp + "\n\n" +
  10888. " Raw expression: " + (text.trim()) + "\n",
  10889. range
  10890. );
  10891. }
  10892. }
  10893. /* */
  10894. var range = 2;
  10895. function generateCodeFrame(
  10896. source,
  10897. start,
  10898. end
  10899. ) {
  10900. if (start === void 0) start = 0;
  10901. if (end === void 0) end = source.length;
  10902. var lines = source.split(/\r?\n/);
  10903. var count = 0;
  10904. var res = [];
  10905. for (var i = 0; i < lines.length; i++) {
  10906. count += lines[i].length + 1;
  10907. if (count >= start) {
  10908. for (var j = i - range; j <= i + range || end > count; j++) {
  10909. if (j < 0 || j >= lines.length) {
  10910. continue
  10911. }
  10912. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  10913. var lineLength = lines[j].length;
  10914. if (j === i) {
  10915. // push underline
  10916. var pad = start - (count - lineLength) + 1;
  10917. var length = end > count ? lineLength - pad : end - start;
  10918. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  10919. } else if (j > i) {
  10920. if (end > count) {
  10921. var length$1 = Math.min(end - count, lineLength);
  10922. res.push(" | " + repeat$1("^", length$1));
  10923. }
  10924. count += lineLength + 1;
  10925. }
  10926. }
  10927. break
  10928. }
  10929. }
  10930. return res.join('\n')
  10931. }
  10932. function repeat$1(str, n) {
  10933. var result = '';
  10934. if (n > 0) {
  10935. while (true) { // eslint-disable-line
  10936. if (n & 1) {
  10937. result += str;
  10938. }
  10939. n >>>= 1;
  10940. if (n <= 0) {
  10941. break
  10942. }
  10943. str += str;
  10944. }
  10945. }
  10946. return result
  10947. }
  10948. /* */
  10949. function createFunction(code, errors) {
  10950. try {
  10951. return new Function(code)
  10952. } catch (err) {
  10953. errors.push({
  10954. err: err,
  10955. code: code
  10956. });
  10957. return noop
  10958. }
  10959. }
  10960. function createCompileToFunctionFn(compile) {
  10961. var cache = Object.create(null);
  10962. return function compileToFunctions(
  10963. template,
  10964. options,
  10965. vm
  10966. ) {
  10967. options = extend({}, options);
  10968. var warn$$1 = options.warn || warn;
  10969. delete options.warn;
  10970. /* istanbul ignore if */
  10971. {
  10972. // detect possible CSP restriction
  10973. try {
  10974. new Function('return 1');
  10975. } catch (e) {
  10976. if (e.toString().match(/unsafe-eval|CSP/)) {
  10977. warn$$1(
  10978. 'It seems you are using the standalone build of Vue.js in an ' +
  10979. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  10980. 'The template compiler cannot work in this environment. Consider ' +
  10981. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  10982. 'templates into render functions.'
  10983. );
  10984. }
  10985. }
  10986. }
  10987. // check cache
  10988. var key = options.delimiters ?
  10989. String(options.delimiters) + template :
  10990. template;
  10991. if (cache[key]) {
  10992. return cache[key]
  10993. }
  10994. // compile
  10995. var compiled = compile(template, options);
  10996. // check compilation errors/tips
  10997. {
  10998. if (compiled.errors && compiled.errors.length) {
  10999. if (options.outputSourceRange) {
  11000. compiled.errors.forEach(function (e) {
  11001. warn$$1(
  11002. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  11003. generateCodeFrame(template, e.start, e.end),
  11004. vm
  11005. );
  11006. });
  11007. } else {
  11008. warn$$1(
  11009. "Error compiling template:\n\n" + template + "\n\n" +
  11010. compiled.errors.map(function (e) {
  11011. return ("- " + e);
  11012. }).join('\n') + '\n',
  11013. vm
  11014. );
  11015. }
  11016. }
  11017. if (compiled.tips && compiled.tips.length) {
  11018. if (options.outputSourceRange) {
  11019. compiled.tips.forEach(function (e) {
  11020. return tip(e.msg, vm);
  11021. });
  11022. } else {
  11023. compiled.tips.forEach(function (msg) {
  11024. return tip(msg, vm);
  11025. });
  11026. }
  11027. }
  11028. }
  11029. // turn code into functions
  11030. var res = {};
  11031. var fnGenErrors = [];
  11032. res.render = createFunction(compiled.render, fnGenErrors);
  11033. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  11034. return createFunction(code, fnGenErrors)
  11035. });
  11036. // check function generation errors.
  11037. // this should only happen if there is a bug in the compiler itself.
  11038. // mostly for codegen development use
  11039. /* istanbul ignore if */
  11040. {
  11041. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  11042. warn$$1(
  11043. "Failed to generate render function:\n\n" +
  11044. fnGenErrors.map(function (ref) {
  11045. var err = ref.err;
  11046. var code = ref.code;
  11047. return ((err.toString()) + " in\n\n" + code + "\n");
  11048. }).join('\n'),
  11049. vm
  11050. );
  11051. }
  11052. }
  11053. return (cache[key] = res)
  11054. }
  11055. }
  11056. /* */
  11057. function createCompilerCreator(baseCompile) {
  11058. return function createCompiler(baseOptions) {
  11059. function compile(
  11060. template,
  11061. options
  11062. ) {
  11063. var finalOptions = Object.create(baseOptions);
  11064. var errors = [];
  11065. var tips = [];
  11066. var warn = function (msg, range, tip) {
  11067. (tip ? tips : errors).push(msg);
  11068. };
  11069. if (options) {
  11070. if (options.outputSourceRange) {
  11071. // $flow-disable-line
  11072. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  11073. warn = function (msg, range, tip) {
  11074. var data = {
  11075. msg: msg
  11076. };
  11077. if (range) {
  11078. if (range.start != null) {
  11079. data.start = range.start + leadingSpaceLength;
  11080. }
  11081. if (range.end != null) {
  11082. data.end = range.end + leadingSpaceLength;
  11083. }
  11084. }
  11085. (tip ? tips : errors).push(data);
  11086. };
  11087. }
  11088. // merge custom modules
  11089. if (options.modules) {
  11090. finalOptions.modules =
  11091. (baseOptions.modules || []).concat(options.modules);
  11092. }
  11093. // merge custom directives
  11094. if (options.directives) {
  11095. finalOptions.directives = extend(
  11096. Object.create(baseOptions.directives || null),
  11097. options.directives
  11098. );
  11099. }
  11100. // copy other options
  11101. for (var key in options) {
  11102. if (key !== 'modules' && key !== 'directives') {
  11103. finalOptions[key] = options[key];
  11104. }
  11105. }
  11106. }
  11107. finalOptions.warn = warn;
  11108. var compiled = baseCompile(template.trim(), finalOptions); {
  11109. detectErrors(compiled.ast, warn);
  11110. }
  11111. compiled.errors = errors;
  11112. compiled.tips = tips;
  11113. return compiled
  11114. }
  11115. return {
  11116. compile: compile,
  11117. compileToFunctions: createCompileToFunctionFn(compile)
  11118. }
  11119. }
  11120. }
  11121. /* */
  11122. // `createCompilerCreator` allows creating compilers that use alternative
  11123. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  11124. // Here we just export a default compiler using the default parts.
  11125. var createCompiler = createCompilerCreator(function baseCompile(
  11126. template,
  11127. options
  11128. ) {
  11129. var ast = parse(template.trim(), options);
  11130. if (options.optimize !== false) {
  11131. optimize(ast, options);
  11132. }
  11133. var code = generate(ast, options);
  11134. return {
  11135. ast: ast,
  11136. render: code.render,
  11137. staticRenderFns: code.staticRenderFns
  11138. }
  11139. });
  11140. /* */
  11141. var ref$1 = createCompiler(baseOptions);
  11142. var compile = ref$1.compile;
  11143. var compileToFunctions = ref$1.compileToFunctions;
  11144. /* */
  11145. // check whether current browser encodes a char inside attribute values
  11146. var div;
  11147. function getShouldDecode(href) {
  11148. div = div || document.createElement('div');
  11149. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  11150. return div.innerHTML.indexOf('&#10;') > 0
  11151. }
  11152. // #3663: IE encodes newlines inside attribute values while other browsers don't
  11153. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  11154. // #6828: chrome encodes content in a[href]
  11155. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  11156. /* */
  11157. var idToTemplate = cached(function (id) {
  11158. var el = query(id);
  11159. return el && el.innerHTML
  11160. });
  11161. var mount = Vue.prototype.$mount;
  11162. Vue.prototype.$mount = function (
  11163. el,
  11164. hydrating
  11165. ) {
  11166. el = el && query(el);
  11167. /* istanbul ignore if */
  11168. if (el === document.body || el === document.documentElement) {
  11169. warn(
  11170. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  11171. );
  11172. return this
  11173. }
  11174. var options = this.$options;
  11175. // resolve template/el and convert to render function
  11176. if (!options.render) {
  11177. var template = options.template;
  11178. if (template) {
  11179. if (typeof template === 'string') {
  11180. if (template.charAt(0) === '#') {
  11181. template = idToTemplate(template);
  11182. /* istanbul ignore if */
  11183. if (!template) {
  11184. warn(
  11185. ("Template element not found or is empty: " + (options.template)),
  11186. this
  11187. );
  11188. }
  11189. }
  11190. } else if (template.nodeType) {
  11191. template = template.innerHTML;
  11192. } else {
  11193. {
  11194. warn('invalid template option:' + template, this);
  11195. }
  11196. return this
  11197. }
  11198. } else if (el) {
  11199. template = getOuterHTML(el);
  11200. }
  11201. if (template) {
  11202. /* istanbul ignore if */
  11203. if (config.performance && mark) {
  11204. mark('compile');
  11205. }
  11206. var ref = compileToFunctions(template, {
  11207. outputSourceRange: "development" !== 'production',
  11208. shouldDecodeNewlines: shouldDecodeNewlines,
  11209. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  11210. delimiters: options.delimiters,
  11211. comments: options.comments
  11212. }, this);
  11213. var render = ref.render;
  11214. var staticRenderFns = ref.staticRenderFns;
  11215. options.render = render;
  11216. options.staticRenderFns = staticRenderFns;
  11217. /* istanbul ignore if */
  11218. if (config.performance && mark) {
  11219. mark('compile end');
  11220. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  11221. }
  11222. }
  11223. }
  11224. return mount.call(this, el, hydrating)
  11225. };
  11226. /**
  11227. * Get outerHTML of elements, taking care
  11228. * of SVG elements in IE as well.
  11229. */
  11230. function getOuterHTML(el) {
  11231. if (el.outerHTML) {
  11232. return el.outerHTML
  11233. } else {
  11234. var container = document.createElement('div');
  11235. container.appendChild(el.cloneNode(true));
  11236. return container.innerHTML
  11237. }
  11238. }
  11239. Vue.compile = compileToFunctions;
  11240. return Vue;
  11241. }));