vue.min.js 272 KB

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