vue.common.js 238 KB

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