vue.common.js 265 KB

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