vue.common.js 241 KB

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