vue.js 259 KB

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