vue-2.4.0.js 258 KB

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