vue.runtime.js 173 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827
  1. /*!
  2. * Vue.js v2.2.6
  3. * (c) 2014-2017 Evan You
  4. * Released under the MIT License.
  5. */
  6. (function (global, factory) {
  7. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  8. typeof define === 'function' && define.amd ? define(factory) :
  9. (global.Vue = factory());
  10. }(this, (function () { 'use strict';
  11. /* */
  12. /**
  13. * Convert a value to a string that is actually rendered.
  14. */
  15. function _toString (val) {
  16. return val == null
  17. ? ''
  18. : typeof val === 'object'
  19. ? JSON.stringify(val, null, 2)
  20. : String(val)
  21. }
  22. /**
  23. * Convert a input value to a number for persistence.
  24. * If the conversion fails, return original string.
  25. */
  26. function toNumber (val) {
  27. var n = parseFloat(val);
  28. return isNaN(n) ? val : n
  29. }
  30. /**
  31. * Make a map and return a function for checking if a key
  32. * is in that map.
  33. */
  34. function makeMap (
  35. str,
  36. expectsLowerCase
  37. ) {
  38. var map = Object.create(null);
  39. var list = str.split(',');
  40. for (var i = 0; i < list.length; i++) {
  41. map[list[i]] = true;
  42. }
  43. return expectsLowerCase
  44. ? function (val) { return map[val.toLowerCase()]; }
  45. : function (val) { return map[val]; }
  46. }
  47. /**
  48. * Check if a tag is a built-in tag.
  49. */
  50. var isBuiltInTag = makeMap('slot,component', true);
  51. /**
  52. * Remove an item from an array
  53. */
  54. function remove (arr, item) {
  55. if (arr.length) {
  56. var index = arr.indexOf(item);
  57. if (index > -1) {
  58. return arr.splice(index, 1)
  59. }
  60. }
  61. }
  62. /**
  63. * Check whether the object has the property.
  64. */
  65. var hasOwnProperty = Object.prototype.hasOwnProperty;
  66. function hasOwn (obj, key) {
  67. return hasOwnProperty.call(obj, key)
  68. }
  69. /**
  70. * Check if value is primitive
  71. */
  72. function isPrimitive (value) {
  73. return typeof value === 'string' || typeof value === 'number'
  74. }
  75. /**
  76. * Create a cached version of a pure function.
  77. */
  78. function cached (fn) {
  79. var cache = Object.create(null);
  80. return (function cachedFn (str) {
  81. var hit = cache[str];
  82. return hit || (cache[str] = fn(str))
  83. })
  84. }
  85. /**
  86. * Camelize a hyphen-delimited string.
  87. */
  88. var camelizeRE = /-(\w)/g;
  89. var camelize = cached(function (str) {
  90. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  91. });
  92. /**
  93. * Capitalize a string.
  94. */
  95. var capitalize = cached(function (str) {
  96. return str.charAt(0).toUpperCase() + str.slice(1)
  97. });
  98. /**
  99. * Hyphenate a camelCase string.
  100. */
  101. var hyphenateRE = /([^-])([A-Z])/g;
  102. var hyphenate = cached(function (str) {
  103. return str
  104. .replace(hyphenateRE, '$1-$2')
  105. .replace(hyphenateRE, '$1-$2')
  106. .toLowerCase()
  107. });
  108. /**
  109. * Simple bind, faster than native
  110. */
  111. function bind (fn, ctx) {
  112. function boundFn (a) {
  113. var l = arguments.length;
  114. return l
  115. ? l > 1
  116. ? fn.apply(ctx, arguments)
  117. : fn.call(ctx, a)
  118. : fn.call(ctx)
  119. }
  120. // record original fn length
  121. boundFn._length = fn.length;
  122. return boundFn
  123. }
  124. /**
  125. * Convert an Array-like object to a real Array.
  126. */
  127. function toArray (list, start) {
  128. start = start || 0;
  129. var i = list.length - start;
  130. var ret = new Array(i);
  131. while (i--) {
  132. ret[i] = list[i + start];
  133. }
  134. return ret
  135. }
  136. /**
  137. * Mix properties into target object.
  138. */
  139. function extend (to, _from) {
  140. for (var key in _from) {
  141. to[key] = _from[key];
  142. }
  143. return to
  144. }
  145. /**
  146. * Quick object check - this is primarily used to tell
  147. * Objects from primitive values when we know the value
  148. * is a JSON-compliant type.
  149. */
  150. function isObject (obj) {
  151. return obj !== null && typeof obj === 'object'
  152. }
  153. /**
  154. * Strict object type check. Only returns true
  155. * for plain JavaScript objects.
  156. */
  157. var toString = Object.prototype.toString;
  158. var OBJECT_STRING = '[object Object]';
  159. function isPlainObject (obj) {
  160. return toString.call(obj) === OBJECT_STRING
  161. }
  162. /**
  163. * Merge an Array of Objects into a single Object.
  164. */
  165. function toObject (arr) {
  166. var res = {};
  167. for (var i = 0; i < arr.length; i++) {
  168. if (arr[i]) {
  169. extend(res, arr[i]);
  170. }
  171. }
  172. return res
  173. }
  174. /**
  175. * Perform no operation.
  176. */
  177. function noop () {}
  178. /**
  179. * Always return false.
  180. */
  181. var no = function () { return false; };
  182. /**
  183. * Return same value
  184. */
  185. var identity = function (_) { return _; };
  186. /**
  187. * Generate a static keys string from compiler modules.
  188. */
  189. /**
  190. * Check if two values are loosely equal - that is,
  191. * if they are plain objects, do they have the same shape?
  192. */
  193. function looseEqual (a, b) {
  194. var isObjectA = isObject(a);
  195. var isObjectB = isObject(b);
  196. if (isObjectA && isObjectB) {
  197. try {
  198. return JSON.stringify(a) === JSON.stringify(b)
  199. } catch (e) {
  200. // possible circular reference
  201. return a === b
  202. }
  203. } else if (!isObjectA && !isObjectB) {
  204. return String(a) === String(b)
  205. } else {
  206. return false
  207. }
  208. }
  209. function looseIndexOf (arr, val) {
  210. for (var i = 0; i < arr.length; i++) {
  211. if (looseEqual(arr[i], val)) { return i }
  212. }
  213. return -1
  214. }
  215. /**
  216. * Ensure a function is called only once.
  217. */
  218. function once (fn) {
  219. var called = false;
  220. return function () {
  221. if (!called) {
  222. called = true;
  223. fn();
  224. }
  225. }
  226. }
  227. /* */
  228. var config = {
  229. /**
  230. * Option merge strategies (used in core/util/options)
  231. */
  232. optionMergeStrategies: Object.create(null),
  233. /**
  234. * Whether to suppress warnings.
  235. */
  236. silent: false,
  237. /**
  238. * Show production mode tip message on boot?
  239. */
  240. productionTip: "development" !== 'production',
  241. /**
  242. * Whether to enable devtools
  243. */
  244. devtools: "development" !== 'production',
  245. /**
  246. * Whether to record perf
  247. */
  248. performance: false,
  249. /**
  250. * Error handler for watcher errors
  251. */
  252. errorHandler: null,
  253. /**
  254. * Ignore certain custom elements
  255. */
  256. ignoredElements: [],
  257. /**
  258. * Custom user key aliases for v-on
  259. */
  260. keyCodes: Object.create(null),
  261. /**
  262. * Check if a tag is reserved so that it cannot be registered as a
  263. * component. This is platform-dependent and may be overwritten.
  264. */
  265. isReservedTag: no,
  266. /**
  267. * Check if a tag is an unknown element.
  268. * Platform-dependent.
  269. */
  270. isUnknownElement: no,
  271. /**
  272. * Get the namespace of an element
  273. */
  274. getTagNamespace: noop,
  275. /**
  276. * Parse the real tag name for the specific platform.
  277. */
  278. parsePlatformTagName: identity,
  279. /**
  280. * Check if an attribute must be bound using property, e.g. value
  281. * Platform-dependent.
  282. */
  283. mustUseProp: no,
  284. /**
  285. * List of asset types that a component can own.
  286. */
  287. _assetTypes: [
  288. 'component',
  289. 'directive',
  290. 'filter'
  291. ],
  292. /**
  293. * List of lifecycle hooks.
  294. */
  295. _lifecycleHooks: [
  296. 'beforeCreate',
  297. 'created',
  298. 'beforeMount',
  299. 'mounted',
  300. 'beforeUpdate',
  301. 'updated',
  302. 'beforeDestroy',
  303. 'destroyed',
  304. 'activated',
  305. 'deactivated'
  306. ],
  307. /**
  308. * Max circular updates allowed in a scheduler flush cycle.
  309. */
  310. _maxUpdateCount: 100
  311. };
  312. /* */
  313. var emptyObject = Object.freeze({});
  314. /**
  315. * Check if a string starts with $ or _
  316. */
  317. function isReserved (str) {
  318. var c = (str + '').charCodeAt(0);
  319. return c === 0x24 || c === 0x5F
  320. }
  321. /**
  322. * Define a property.
  323. */
  324. function def (obj, key, val, enumerable) {
  325. Object.defineProperty(obj, key, {
  326. value: val,
  327. enumerable: !!enumerable,
  328. writable: true,
  329. configurable: true
  330. });
  331. }
  332. /**
  333. * Parse simple path.
  334. */
  335. var bailRE = /[^\w.$]/;
  336. function parsePath (path) {
  337. if (bailRE.test(path)) {
  338. return
  339. }
  340. var segments = path.split('.');
  341. return function (obj) {
  342. for (var i = 0; i < segments.length; i++) {
  343. if (!obj) { return }
  344. obj = obj[segments[i]];
  345. }
  346. return obj
  347. }
  348. }
  349. /* */
  350. /* globals MutationObserver */
  351. // can we use __proto__?
  352. var hasProto = '__proto__' in {};
  353. // Browser environment sniffing
  354. var inBrowser = typeof window !== 'undefined';
  355. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  356. var isIE = UA && /msie|trident/.test(UA);
  357. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  358. var isEdge = UA && UA.indexOf('edge/') > 0;
  359. var isAndroid = UA && UA.indexOf('android') > 0;
  360. var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
  361. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  362. // this needs to be lazy-evaled because vue may be required before
  363. // vue-server-renderer can set VUE_ENV
  364. var _isServer;
  365. var isServerRendering = function () {
  366. if (_isServer === undefined) {
  367. /* istanbul ignore if */
  368. if (!inBrowser && typeof global !== 'undefined') {
  369. // detect presence of vue-server-renderer and avoid
  370. // Webpack shimming the process
  371. _isServer = global['process'].env.VUE_ENV === 'server';
  372. } else {
  373. _isServer = false;
  374. }
  375. }
  376. return _isServer
  377. };
  378. // detect devtools
  379. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  380. /* istanbul ignore next */
  381. function isNative (Ctor) {
  382. return /native code/.test(Ctor.toString())
  383. }
  384. var hasSymbol =
  385. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  386. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  387. /**
  388. * Defer a task to execute it asynchronously.
  389. */
  390. var nextTick = (function () {
  391. var callbacks = [];
  392. var pending = false;
  393. var timerFunc;
  394. function nextTickHandler () {
  395. pending = false;
  396. var copies = callbacks.slice(0);
  397. callbacks.length = 0;
  398. for (var i = 0; i < copies.length; i++) {
  399. copies[i]();
  400. }
  401. }
  402. // the nextTick behavior leverages the microtask queue, which can be accessed
  403. // via either native Promise.then or MutationObserver.
  404. // MutationObserver has wider support, however it is seriously bugged in
  405. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  406. // completely stops working after triggering a few times... so, if native
  407. // Promise is available, we will use it:
  408. /* istanbul ignore if */
  409. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  410. var p = Promise.resolve();
  411. var logError = function (err) { console.error(err); };
  412. timerFunc = function () {
  413. p.then(nextTickHandler).catch(logError);
  414. // in problematic UIWebViews, Promise.then doesn't completely break, but
  415. // it can get stuck in a weird state where callbacks are pushed into the
  416. // microtask queue but the queue isn't being flushed, until the browser
  417. // needs to do some other work, e.g. handle a timer. Therefore we can
  418. // "force" the microtask queue to be flushed by adding an empty timer.
  419. if (isIOS) { setTimeout(noop); }
  420. };
  421. } else if (typeof MutationObserver !== 'undefined' && (
  422. isNative(MutationObserver) ||
  423. // PhantomJS and iOS 7.x
  424. MutationObserver.toString() === '[object MutationObserverConstructor]'
  425. )) {
  426. // use MutationObserver where native Promise is not available,
  427. // e.g. PhantomJS IE11, iOS7, Android 4.4
  428. var counter = 1;
  429. var observer = new MutationObserver(nextTickHandler);
  430. var textNode = document.createTextNode(String(counter));
  431. observer.observe(textNode, {
  432. characterData: true
  433. });
  434. timerFunc = function () {
  435. counter = (counter + 1) % 2;
  436. textNode.data = String(counter);
  437. };
  438. } else {
  439. // fallback to setTimeout
  440. /* istanbul ignore next */
  441. timerFunc = function () {
  442. setTimeout(nextTickHandler, 0);
  443. };
  444. }
  445. return function queueNextTick (cb, ctx) {
  446. var _resolve;
  447. callbacks.push(function () {
  448. if (cb) { cb.call(ctx); }
  449. if (_resolve) { _resolve(ctx); }
  450. });
  451. if (!pending) {
  452. pending = true;
  453. timerFunc();
  454. }
  455. if (!cb && typeof Promise !== 'undefined') {
  456. return new Promise(function (resolve) {
  457. _resolve = resolve;
  458. })
  459. }
  460. }
  461. })();
  462. var _Set;
  463. /* istanbul ignore if */
  464. if (typeof Set !== 'undefined' && isNative(Set)) {
  465. // use native Set when available.
  466. _Set = Set;
  467. } else {
  468. // a non-standard Set polyfill that only works with primitive keys.
  469. _Set = (function () {
  470. function Set () {
  471. this.set = Object.create(null);
  472. }
  473. Set.prototype.has = function has (key) {
  474. return this.set[key] === true
  475. };
  476. Set.prototype.add = function add (key) {
  477. this.set[key] = true;
  478. };
  479. Set.prototype.clear = function clear () {
  480. this.set = Object.create(null);
  481. };
  482. return Set;
  483. }());
  484. }
  485. var warn = noop;
  486. var tip = noop;
  487. var formatComponentName;
  488. {
  489. var hasConsole = typeof console !== 'undefined';
  490. var classifyRE = /(?:^|[-_])(\w)/g;
  491. var classify = function (str) { return str
  492. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  493. .replace(/[-_]/g, ''); };
  494. warn = function (msg, vm) {
  495. if (hasConsole && (!config.silent)) {
  496. console.error("[Vue warn]: " + msg + " " + (
  497. vm ? formatLocation(formatComponentName(vm)) : ''
  498. ));
  499. }
  500. };
  501. tip = function (msg, vm) {
  502. if (hasConsole && (!config.silent)) {
  503. console.warn("[Vue tip]: " + msg + " " + (
  504. vm ? formatLocation(formatComponentName(vm)) : ''
  505. ));
  506. }
  507. };
  508. formatComponentName = function (vm, includeFile) {
  509. if (vm.$root === vm) {
  510. return '<Root>'
  511. }
  512. var name = typeof vm === 'string'
  513. ? vm
  514. : typeof vm === 'function' && vm.options
  515. ? vm.options.name
  516. : vm._isVue
  517. ? vm.$options.name || vm.$options._componentTag
  518. : vm.name;
  519. var file = vm._isVue && vm.$options.__file;
  520. if (!name && file) {
  521. var match = file.match(/([^/\\]+)\.vue$/);
  522. name = match && match[1];
  523. }
  524. return (
  525. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  526. (file && includeFile !== false ? (" at " + file) : '')
  527. )
  528. };
  529. var formatLocation = function (str) {
  530. if (str === "<Anonymous>") {
  531. str += " - use the \"name\" option for better debugging messages.";
  532. }
  533. return ("\n(found in " + str + ")")
  534. };
  535. }
  536. /* */
  537. var uid$1 = 0;
  538. /**
  539. * A dep is an observable that can have multiple
  540. * directives subscribing to it.
  541. */
  542. var Dep = function Dep () {
  543. this.id = uid$1++;
  544. this.subs = [];
  545. };
  546. Dep.prototype.addSub = function addSub (sub) {
  547. this.subs.push(sub);
  548. };
  549. Dep.prototype.removeSub = function removeSub (sub) {
  550. remove(this.subs, sub);
  551. };
  552. Dep.prototype.depend = function depend () {
  553. if (Dep.target) {
  554. Dep.target.addDep(this);
  555. }
  556. };
  557. Dep.prototype.notify = function notify () {
  558. // stabilize the subscriber list first
  559. var subs = this.subs.slice();
  560. for (var i = 0, l = subs.length; i < l; i++) {
  561. subs[i].update();
  562. }
  563. };
  564. // the current target watcher being evaluated.
  565. // this is globally unique because there could be only one
  566. // watcher being evaluated at any time.
  567. Dep.target = null;
  568. var targetStack = [];
  569. function pushTarget (_target) {
  570. if (Dep.target) { targetStack.push(Dep.target); }
  571. Dep.target = _target;
  572. }
  573. function popTarget () {
  574. Dep.target = targetStack.pop();
  575. }
  576. /*
  577. * not type checking this file because flow doesn't play well with
  578. * dynamically accessing methods on Array prototype
  579. */
  580. var arrayProto = Array.prototype;
  581. var arrayMethods = Object.create(arrayProto);[
  582. 'push',
  583. 'pop',
  584. 'shift',
  585. 'unshift',
  586. 'splice',
  587. 'sort',
  588. 'reverse'
  589. ]
  590. .forEach(function (method) {
  591. // cache original method
  592. var original = arrayProto[method];
  593. def(arrayMethods, method, function mutator () {
  594. var arguments$1 = arguments;
  595. // avoid leaking arguments:
  596. // http://jsperf.com/closure-with-arguments
  597. var i = arguments.length;
  598. var args = new Array(i);
  599. while (i--) {
  600. args[i] = arguments$1[i];
  601. }
  602. var result = original.apply(this, args);
  603. var ob = this.__ob__;
  604. var inserted;
  605. switch (method) {
  606. case 'push':
  607. inserted = args;
  608. break
  609. case 'unshift':
  610. inserted = args;
  611. break
  612. case 'splice':
  613. inserted = args.slice(2);
  614. break
  615. }
  616. if (inserted) { ob.observeArray(inserted); }
  617. // notify change
  618. ob.dep.notify();
  619. return result
  620. });
  621. });
  622. /* */
  623. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  624. /**
  625. * By default, when a reactive property is set, the new value is
  626. * also converted to become reactive. However when passing down props,
  627. * we don't want to force conversion because the value may be a nested value
  628. * under a frozen data structure. Converting it would defeat the optimization.
  629. */
  630. var observerState = {
  631. shouldConvert: true,
  632. isSettingProps: false
  633. };
  634. /**
  635. * Observer class that are attached to each observed
  636. * object. Once attached, the observer converts target
  637. * object's property keys into getter/setters that
  638. * collect dependencies and dispatches updates.
  639. */
  640. var Observer = function Observer (value) {
  641. this.value = value;
  642. this.dep = new Dep();
  643. this.vmCount = 0;
  644. def(value, '__ob__', this);
  645. if (Array.isArray(value)) {
  646. var augment = hasProto
  647. ? protoAugment
  648. : copyAugment;
  649. augment(value, arrayMethods, arrayKeys);
  650. this.observeArray(value);
  651. } else {
  652. this.walk(value);
  653. }
  654. };
  655. /**
  656. * Walk through each property and convert them into
  657. * getter/setters. This method should only be called when
  658. * value type is Object.
  659. */
  660. Observer.prototype.walk = function walk (obj) {
  661. var keys = Object.keys(obj);
  662. for (var i = 0; i < keys.length; i++) {
  663. defineReactive$$1(obj, keys[i], obj[keys[i]]);
  664. }
  665. };
  666. /**
  667. * Observe a list of Array items.
  668. */
  669. Observer.prototype.observeArray = function observeArray (items) {
  670. for (var i = 0, l = items.length; i < l; i++) {
  671. observe(items[i]);
  672. }
  673. };
  674. // helpers
  675. /**
  676. * Augment an target Object or Array by intercepting
  677. * the prototype chain using __proto__
  678. */
  679. function protoAugment (target, src) {
  680. /* eslint-disable no-proto */
  681. target.__proto__ = src;
  682. /* eslint-enable no-proto */
  683. }
  684. /**
  685. * Augment an target Object or Array by defining
  686. * hidden properties.
  687. */
  688. /* istanbul ignore next */
  689. function copyAugment (target, src, keys) {
  690. for (var i = 0, l = keys.length; i < l; i++) {
  691. var key = keys[i];
  692. def(target, key, src[key]);
  693. }
  694. }
  695. /**
  696. * Attempt to create an observer instance for a value,
  697. * returns the new observer if successfully observed,
  698. * or the existing observer if the value already has one.
  699. */
  700. function observe (value, asRootData) {
  701. if (!isObject(value)) {
  702. return
  703. }
  704. var ob;
  705. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  706. ob = value.__ob__;
  707. } else if (
  708. observerState.shouldConvert &&
  709. !isServerRendering() &&
  710. (Array.isArray(value) || isPlainObject(value)) &&
  711. Object.isExtensible(value) &&
  712. !value._isVue
  713. ) {
  714. ob = new Observer(value);
  715. }
  716. if (asRootData && ob) {
  717. ob.vmCount++;
  718. }
  719. return ob
  720. }
  721. /**
  722. * Define a reactive property on an Object.
  723. */
  724. function defineReactive$$1 (
  725. obj,
  726. key,
  727. val,
  728. customSetter
  729. ) {
  730. var dep = new Dep();
  731. var property = Object.getOwnPropertyDescriptor(obj, key);
  732. if (property && property.configurable === false) {
  733. return
  734. }
  735. // cater for pre-defined getter/setters
  736. var getter = property && property.get;
  737. var setter = property && property.set;
  738. var childOb = observe(val);
  739. Object.defineProperty(obj, key, {
  740. enumerable: true,
  741. configurable: true,
  742. get: function reactiveGetter () {
  743. var value = getter ? getter.call(obj) : val;
  744. if (Dep.target) {
  745. dep.depend();
  746. if (childOb) {
  747. childOb.dep.depend();
  748. }
  749. if (Array.isArray(value)) {
  750. dependArray(value);
  751. }
  752. }
  753. return value
  754. },
  755. set: function reactiveSetter (newVal) {
  756. var value = getter ? getter.call(obj) : val;
  757. /* eslint-disable no-self-compare */
  758. if (newVal === value || (newVal !== newVal && value !== value)) {
  759. return
  760. }
  761. /* eslint-enable no-self-compare */
  762. if ("development" !== 'production' && customSetter) {
  763. customSetter();
  764. }
  765. if (setter) {
  766. setter.call(obj, newVal);
  767. } else {
  768. val = newVal;
  769. }
  770. childOb = observe(newVal);
  771. dep.notify();
  772. }
  773. });
  774. }
  775. /**
  776. * Set a property on an object. Adds the new property and
  777. * triggers change notification if the property doesn't
  778. * already exist.
  779. */
  780. function set (target, key, val) {
  781. if (Array.isArray(target) && typeof key === 'number') {
  782. target.length = Math.max(target.length, key);
  783. target.splice(key, 1, val);
  784. return val
  785. }
  786. if (hasOwn(target, key)) {
  787. target[key] = val;
  788. return val
  789. }
  790. var ob = (target ).__ob__;
  791. if (target._isVue || (ob && ob.vmCount)) {
  792. "development" !== 'production' && warn(
  793. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  794. 'at runtime - declare it upfront in the data option.'
  795. );
  796. return val
  797. }
  798. if (!ob) {
  799. target[key] = val;
  800. return val
  801. }
  802. defineReactive$$1(ob.value, key, val);
  803. ob.dep.notify();
  804. return val
  805. }
  806. /**
  807. * Delete a property and trigger change if necessary.
  808. */
  809. function del (target, key) {
  810. if (Array.isArray(target) && typeof key === 'number') {
  811. target.splice(key, 1);
  812. return
  813. }
  814. var ob = (target ).__ob__;
  815. if (target._isVue || (ob && ob.vmCount)) {
  816. "development" !== 'production' && warn(
  817. 'Avoid deleting properties on a Vue instance or its root $data ' +
  818. '- just set it to null.'
  819. );
  820. return
  821. }
  822. if (!hasOwn(target, key)) {
  823. return
  824. }
  825. delete target[key];
  826. if (!ob) {
  827. return
  828. }
  829. ob.dep.notify();
  830. }
  831. /**
  832. * Collect dependencies on array elements when the array is touched, since
  833. * we cannot intercept array element access like property getters.
  834. */
  835. function dependArray (value) {
  836. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  837. e = value[i];
  838. e && e.__ob__ && e.__ob__.dep.depend();
  839. if (Array.isArray(e)) {
  840. dependArray(e);
  841. }
  842. }
  843. }
  844. /* */
  845. /**
  846. * Option overwriting strategies are functions that handle
  847. * how to merge a parent option value and a child option
  848. * value into the final value.
  849. */
  850. var strats = config.optionMergeStrategies;
  851. /**
  852. * Options with restrictions
  853. */
  854. {
  855. strats.el = strats.propsData = function (parent, child, vm, key) {
  856. if (!vm) {
  857. warn(
  858. "option \"" + key + "\" can only be used during instance " +
  859. 'creation with the `new` keyword.'
  860. );
  861. }
  862. return defaultStrat(parent, child)
  863. };
  864. }
  865. /**
  866. * Helper that recursively merges two data objects together.
  867. */
  868. function mergeData (to, from) {
  869. if (!from) { return to }
  870. var key, toVal, fromVal;
  871. var keys = Object.keys(from);
  872. for (var i = 0; i < keys.length; i++) {
  873. key = keys[i];
  874. toVal = to[key];
  875. fromVal = from[key];
  876. if (!hasOwn(to, key)) {
  877. set(to, key, fromVal);
  878. } else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
  879. mergeData(toVal, fromVal);
  880. }
  881. }
  882. return to
  883. }
  884. /**
  885. * Data
  886. */
  887. strats.data = function (
  888. parentVal,
  889. childVal,
  890. vm
  891. ) {
  892. if (!vm) {
  893. // in a Vue.extend merge, both should be functions
  894. if (!childVal) {
  895. return parentVal
  896. }
  897. if (typeof childVal !== 'function') {
  898. "development" !== 'production' && warn(
  899. 'The "data" option should be a function ' +
  900. 'that returns a per-instance value in component ' +
  901. 'definitions.',
  902. vm
  903. );
  904. return parentVal
  905. }
  906. if (!parentVal) {
  907. return childVal
  908. }
  909. // when parentVal & childVal are both present,
  910. // we need to return a function that returns the
  911. // merged result of both functions... no need to
  912. // check if parentVal is a function here because
  913. // it has to be a function to pass previous merges.
  914. return function mergedDataFn () {
  915. return mergeData(
  916. childVal.call(this),
  917. parentVal.call(this)
  918. )
  919. }
  920. } else if (parentVal || childVal) {
  921. return function mergedInstanceDataFn () {
  922. // instance merge
  923. var instanceData = typeof childVal === 'function'
  924. ? childVal.call(vm)
  925. : childVal;
  926. var defaultData = typeof parentVal === 'function'
  927. ? parentVal.call(vm)
  928. : undefined;
  929. if (instanceData) {
  930. return mergeData(instanceData, defaultData)
  931. } else {
  932. return defaultData
  933. }
  934. }
  935. }
  936. };
  937. /**
  938. * Hooks and props are merged as arrays.
  939. */
  940. function mergeHook (
  941. parentVal,
  942. childVal
  943. ) {
  944. return childVal
  945. ? parentVal
  946. ? parentVal.concat(childVal)
  947. : Array.isArray(childVal)
  948. ? childVal
  949. : [childVal]
  950. : parentVal
  951. }
  952. config._lifecycleHooks.forEach(function (hook) {
  953. strats[hook] = mergeHook;
  954. });
  955. /**
  956. * Assets
  957. *
  958. * When a vm is present (instance creation), we need to do
  959. * a three-way merge between constructor options, instance
  960. * options and parent options.
  961. */
  962. function mergeAssets (parentVal, childVal) {
  963. var res = Object.create(parentVal || null);
  964. return childVal
  965. ? extend(res, childVal)
  966. : res
  967. }
  968. config._assetTypes.forEach(function (type) {
  969. strats[type + 's'] = mergeAssets;
  970. });
  971. /**
  972. * Watchers.
  973. *
  974. * Watchers hashes should not overwrite one
  975. * another, so we merge them as arrays.
  976. */
  977. strats.watch = function (parentVal, childVal) {
  978. /* istanbul ignore if */
  979. if (!childVal) { return Object.create(parentVal || null) }
  980. if (!parentVal) { return childVal }
  981. var ret = {};
  982. extend(ret, parentVal);
  983. for (var key in childVal) {
  984. var parent = ret[key];
  985. var child = childVal[key];
  986. if (parent && !Array.isArray(parent)) {
  987. parent = [parent];
  988. }
  989. ret[key] = parent
  990. ? parent.concat(child)
  991. : [child];
  992. }
  993. return ret
  994. };
  995. /**
  996. * Other object hashes.
  997. */
  998. strats.props =
  999. strats.methods =
  1000. strats.computed = function (parentVal, childVal) {
  1001. if (!childVal) { return Object.create(parentVal || null) }
  1002. if (!parentVal) { return childVal }
  1003. var ret = Object.create(null);
  1004. extend(ret, parentVal);
  1005. extend(ret, childVal);
  1006. return ret
  1007. };
  1008. /**
  1009. * Default strategy.
  1010. */
  1011. var defaultStrat = function (parentVal, childVal) {
  1012. return childVal === undefined
  1013. ? parentVal
  1014. : childVal
  1015. };
  1016. /**
  1017. * Validate component names
  1018. */
  1019. function checkComponents (options) {
  1020. for (var key in options.components) {
  1021. var lower = key.toLowerCase();
  1022. if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
  1023. warn(
  1024. 'Do not use built-in or reserved HTML elements as component ' +
  1025. 'id: ' + key
  1026. );
  1027. }
  1028. }
  1029. }
  1030. /**
  1031. * Ensure all props option syntax are normalized into the
  1032. * Object-based format.
  1033. */
  1034. function normalizeProps (options) {
  1035. var props = options.props;
  1036. if (!props) { return }
  1037. var res = {};
  1038. var i, val, name;
  1039. if (Array.isArray(props)) {
  1040. i = props.length;
  1041. while (i--) {
  1042. val = props[i];
  1043. if (typeof val === 'string') {
  1044. name = camelize(val);
  1045. res[name] = { type: null };
  1046. } else {
  1047. warn('props must be strings when using array syntax.');
  1048. }
  1049. }
  1050. } else if (isPlainObject(props)) {
  1051. for (var key in props) {
  1052. val = props[key];
  1053. name = camelize(key);
  1054. res[name] = isPlainObject(val)
  1055. ? val
  1056. : { type: val };
  1057. }
  1058. }
  1059. options.props = res;
  1060. }
  1061. /**
  1062. * Normalize raw function directives into object format.
  1063. */
  1064. function normalizeDirectives (options) {
  1065. var dirs = options.directives;
  1066. if (dirs) {
  1067. for (var key in dirs) {
  1068. var def = dirs[key];
  1069. if (typeof def === 'function') {
  1070. dirs[key] = { bind: def, update: def };
  1071. }
  1072. }
  1073. }
  1074. }
  1075. /**
  1076. * Merge two option objects into a new one.
  1077. * Core utility used in both instantiation and inheritance.
  1078. */
  1079. function mergeOptions (
  1080. parent,
  1081. child,
  1082. vm
  1083. ) {
  1084. {
  1085. checkComponents(child);
  1086. }
  1087. normalizeProps(child);
  1088. normalizeDirectives(child);
  1089. var extendsFrom = child.extends;
  1090. if (extendsFrom) {
  1091. parent = typeof extendsFrom === 'function'
  1092. ? mergeOptions(parent, extendsFrom.options, vm)
  1093. : mergeOptions(parent, extendsFrom, vm);
  1094. }
  1095. if (child.mixins) {
  1096. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1097. var mixin = child.mixins[i];
  1098. if (mixin.prototype instanceof Vue$2) {
  1099. mixin = mixin.options;
  1100. }
  1101. parent = mergeOptions(parent, mixin, vm);
  1102. }
  1103. }
  1104. var options = {};
  1105. var key;
  1106. for (key in parent) {
  1107. mergeField(key);
  1108. }
  1109. for (key in child) {
  1110. if (!hasOwn(parent, key)) {
  1111. mergeField(key);
  1112. }
  1113. }
  1114. function mergeField (key) {
  1115. var strat = strats[key] || defaultStrat;
  1116. options[key] = strat(parent[key], child[key], vm, key);
  1117. }
  1118. return options
  1119. }
  1120. /**
  1121. * Resolve an asset.
  1122. * This function is used because child instances need access
  1123. * to assets defined in its ancestor chain.
  1124. */
  1125. function resolveAsset (
  1126. options,
  1127. type,
  1128. id,
  1129. warnMissing
  1130. ) {
  1131. /* istanbul ignore if */
  1132. if (typeof id !== 'string') {
  1133. return
  1134. }
  1135. var assets = options[type];
  1136. // check local registration variations first
  1137. if (hasOwn(assets, id)) { return assets[id] }
  1138. var camelizedId = camelize(id);
  1139. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  1140. var PascalCaseId = capitalize(camelizedId);
  1141. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  1142. // fallback to prototype chain
  1143. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  1144. if ("development" !== 'production' && warnMissing && !res) {
  1145. warn(
  1146. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  1147. options
  1148. );
  1149. }
  1150. return res
  1151. }
  1152. /* */
  1153. function validateProp (
  1154. key,
  1155. propOptions,
  1156. propsData,
  1157. vm
  1158. ) {
  1159. var prop = propOptions[key];
  1160. var absent = !hasOwn(propsData, key);
  1161. var value = propsData[key];
  1162. // handle boolean props
  1163. if (isType(Boolean, prop.type)) {
  1164. if (absent && !hasOwn(prop, 'default')) {
  1165. value = false;
  1166. } else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) {
  1167. value = true;
  1168. }
  1169. }
  1170. // check default value
  1171. if (value === undefined) {
  1172. value = getPropDefaultValue(vm, prop, key);
  1173. // since the default value is a fresh copy,
  1174. // make sure to observe it.
  1175. var prevShouldConvert = observerState.shouldConvert;
  1176. observerState.shouldConvert = true;
  1177. observe(value);
  1178. observerState.shouldConvert = prevShouldConvert;
  1179. }
  1180. {
  1181. assertProp(prop, key, value, vm, absent);
  1182. }
  1183. return value
  1184. }
  1185. /**
  1186. * Get the default value of a prop.
  1187. */
  1188. function getPropDefaultValue (vm, prop, key) {
  1189. // no default, return undefined
  1190. if (!hasOwn(prop, 'default')) {
  1191. return undefined
  1192. }
  1193. var def = prop.default;
  1194. // warn against non-factory defaults for Object & Array
  1195. if ("development" !== 'production' && isObject(def)) {
  1196. warn(
  1197. 'Invalid default value for prop "' + key + '": ' +
  1198. 'Props with type Object/Array must use a factory function ' +
  1199. 'to return the default value.',
  1200. vm
  1201. );
  1202. }
  1203. // the raw prop value was also undefined from previous render,
  1204. // return previous default value to avoid unnecessary watcher trigger
  1205. if (vm && vm.$options.propsData &&
  1206. vm.$options.propsData[key] === undefined &&
  1207. vm._props[key] !== undefined) {
  1208. return vm._props[key]
  1209. }
  1210. // call factory function for non-Function types
  1211. // a value is Function if its prototype is function even across different execution context
  1212. return typeof def === 'function' && getType(prop.type) !== 'Function'
  1213. ? def.call(vm)
  1214. : def
  1215. }
  1216. /**
  1217. * Assert whether a prop is valid.
  1218. */
  1219. function assertProp (
  1220. prop,
  1221. name,
  1222. value,
  1223. vm,
  1224. absent
  1225. ) {
  1226. if (prop.required && absent) {
  1227. warn(
  1228. 'Missing required prop: "' + name + '"',
  1229. vm
  1230. );
  1231. return
  1232. }
  1233. if (value == null && !prop.required) {
  1234. return
  1235. }
  1236. var type = prop.type;
  1237. var valid = !type || type === true;
  1238. var expectedTypes = [];
  1239. if (type) {
  1240. if (!Array.isArray(type)) {
  1241. type = [type];
  1242. }
  1243. for (var i = 0; i < type.length && !valid; i++) {
  1244. var assertedType = assertType(value, type[i]);
  1245. expectedTypes.push(assertedType.expectedType || '');
  1246. valid = assertedType.valid;
  1247. }
  1248. }
  1249. if (!valid) {
  1250. warn(
  1251. 'Invalid prop: type check failed for prop "' + name + '".' +
  1252. ' Expected ' + expectedTypes.map(capitalize).join(', ') +
  1253. ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',
  1254. vm
  1255. );
  1256. return
  1257. }
  1258. var validator = prop.validator;
  1259. if (validator) {
  1260. if (!validator(value)) {
  1261. warn(
  1262. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  1263. vm
  1264. );
  1265. }
  1266. }
  1267. }
  1268. /**
  1269. * Assert the type of a value
  1270. */
  1271. function assertType (value, type) {
  1272. var valid;
  1273. var expectedType = getType(type);
  1274. if (expectedType === 'String') {
  1275. valid = typeof value === (expectedType = 'string');
  1276. } else if (expectedType === 'Number') {
  1277. valid = typeof value === (expectedType = 'number');
  1278. } else if (expectedType === 'Boolean') {
  1279. valid = typeof value === (expectedType = 'boolean');
  1280. } else if (expectedType === 'Function') {
  1281. valid = typeof value === (expectedType = 'function');
  1282. } else if (expectedType === 'Object') {
  1283. valid = isPlainObject(value);
  1284. } else if (expectedType === 'Array') {
  1285. valid = Array.isArray(value);
  1286. } else {
  1287. valid = value instanceof type;
  1288. }
  1289. return {
  1290. valid: valid,
  1291. expectedType: expectedType
  1292. }
  1293. }
  1294. /**
  1295. * Use function string name to check built-in types,
  1296. * because a simple equality check will fail when running
  1297. * across different vms / iframes.
  1298. */
  1299. function getType (fn) {
  1300. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  1301. return match && match[1]
  1302. }
  1303. function isType (type, fn) {
  1304. if (!Array.isArray(fn)) {
  1305. return getType(fn) === getType(type)
  1306. }
  1307. for (var i = 0, len = fn.length; i < len; i++) {
  1308. if (getType(fn[i]) === getType(type)) {
  1309. return true
  1310. }
  1311. }
  1312. /* istanbul ignore next */
  1313. return false
  1314. }
  1315. function handleError (err, vm, info) {
  1316. if (config.errorHandler) {
  1317. config.errorHandler.call(null, err, vm, info);
  1318. } else {
  1319. {
  1320. warn(("Error in " + info + ":"), vm);
  1321. }
  1322. /* istanbul ignore else */
  1323. if (inBrowser && typeof console !== 'undefined') {
  1324. console.error(err);
  1325. } else {
  1326. throw err
  1327. }
  1328. }
  1329. }
  1330. /* not type checking this file because flow doesn't play well with Proxy */
  1331. var initProxy;
  1332. {
  1333. var allowedGlobals = makeMap(
  1334. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  1335. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  1336. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  1337. 'require' // for Webpack/Browserify
  1338. );
  1339. var warnNonPresent = function (target, key) {
  1340. warn(
  1341. "Property or method \"" + key + "\" is not defined on the instance but " +
  1342. "referenced during render. Make sure to declare reactive data " +
  1343. "properties in the data option.",
  1344. target
  1345. );
  1346. };
  1347. var hasProxy =
  1348. typeof Proxy !== 'undefined' &&
  1349. Proxy.toString().match(/native code/);
  1350. if (hasProxy) {
  1351. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta');
  1352. config.keyCodes = new Proxy(config.keyCodes, {
  1353. set: function set (target, key, value) {
  1354. if (isBuiltInModifier(key)) {
  1355. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  1356. return false
  1357. } else {
  1358. target[key] = value;
  1359. return true
  1360. }
  1361. }
  1362. });
  1363. }
  1364. var hasHandler = {
  1365. has: function has (target, key) {
  1366. var has = key in target;
  1367. var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
  1368. if (!has && !isAllowed) {
  1369. warnNonPresent(target, key);
  1370. }
  1371. return has || !isAllowed
  1372. }
  1373. };
  1374. var getHandler = {
  1375. get: function get (target, key) {
  1376. if (typeof key === 'string' && !(key in target)) {
  1377. warnNonPresent(target, key);
  1378. }
  1379. return target[key]
  1380. }
  1381. };
  1382. initProxy = function initProxy (vm) {
  1383. if (hasProxy) {
  1384. // determine which proxy handler to use
  1385. var options = vm.$options;
  1386. var handlers = options.render && options.render._withStripped
  1387. ? getHandler
  1388. : hasHandler;
  1389. vm._renderProxy = new Proxy(vm, handlers);
  1390. } else {
  1391. vm._renderProxy = vm;
  1392. }
  1393. };
  1394. }
  1395. var mark;
  1396. var measure;
  1397. {
  1398. var perf = inBrowser && window.performance;
  1399. /* istanbul ignore if */
  1400. if (
  1401. perf &&
  1402. perf.mark &&
  1403. perf.measure &&
  1404. perf.clearMarks &&
  1405. perf.clearMeasures
  1406. ) {
  1407. mark = function (tag) { return perf.mark(tag); };
  1408. measure = function (name, startTag, endTag) {
  1409. perf.measure(name, startTag, endTag);
  1410. perf.clearMarks(startTag);
  1411. perf.clearMarks(endTag);
  1412. perf.clearMeasures(name);
  1413. };
  1414. }
  1415. }
  1416. /* */
  1417. var VNode = function VNode (
  1418. tag,
  1419. data,
  1420. children,
  1421. text,
  1422. elm,
  1423. context,
  1424. componentOptions
  1425. ) {
  1426. this.tag = tag;
  1427. this.data = data;
  1428. this.children = children;
  1429. this.text = text;
  1430. this.elm = elm;
  1431. this.ns = undefined;
  1432. this.context = context;
  1433. this.functionalContext = undefined;
  1434. this.key = data && data.key;
  1435. this.componentOptions = componentOptions;
  1436. this.componentInstance = undefined;
  1437. this.parent = undefined;
  1438. this.raw = false;
  1439. this.isStatic = false;
  1440. this.isRootInsert = true;
  1441. this.isComment = false;
  1442. this.isCloned = false;
  1443. this.isOnce = false;
  1444. };
  1445. var prototypeAccessors = { child: {} };
  1446. // DEPRECATED: alias for componentInstance for backwards compat.
  1447. /* istanbul ignore next */
  1448. prototypeAccessors.child.get = function () {
  1449. return this.componentInstance
  1450. };
  1451. Object.defineProperties( VNode.prototype, prototypeAccessors );
  1452. var createEmptyVNode = function () {
  1453. var node = new VNode();
  1454. node.text = '';
  1455. node.isComment = true;
  1456. return node
  1457. };
  1458. function createTextVNode (val) {
  1459. return new VNode(undefined, undefined, undefined, String(val))
  1460. }
  1461. // optimized shallow clone
  1462. // used for static nodes and slot nodes because they may be reused across
  1463. // multiple renders, cloning them avoids errors when DOM manipulations rely
  1464. // on their elm reference.
  1465. function cloneVNode (vnode) {
  1466. var cloned = new VNode(
  1467. vnode.tag,
  1468. vnode.data,
  1469. vnode.children,
  1470. vnode.text,
  1471. vnode.elm,
  1472. vnode.context,
  1473. vnode.componentOptions
  1474. );
  1475. cloned.ns = vnode.ns;
  1476. cloned.isStatic = vnode.isStatic;
  1477. cloned.key = vnode.key;
  1478. cloned.isCloned = true;
  1479. return cloned
  1480. }
  1481. function cloneVNodes (vnodes) {
  1482. var len = vnodes.length;
  1483. var res = new Array(len);
  1484. for (var i = 0; i < len; i++) {
  1485. res[i] = cloneVNode(vnodes[i]);
  1486. }
  1487. return res
  1488. }
  1489. /* */
  1490. var normalizeEvent = cached(function (name) {
  1491. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  1492. name = once$$1 ? name.slice(1) : name;
  1493. var capture = name.charAt(0) === '!';
  1494. name = capture ? name.slice(1) : name;
  1495. return {
  1496. name: name,
  1497. once: once$$1,
  1498. capture: capture
  1499. }
  1500. });
  1501. function createFnInvoker (fns) {
  1502. function invoker () {
  1503. var arguments$1 = arguments;
  1504. var fns = invoker.fns;
  1505. if (Array.isArray(fns)) {
  1506. for (var i = 0; i < fns.length; i++) {
  1507. fns[i].apply(null, arguments$1);
  1508. }
  1509. } else {
  1510. // return handler return value for single handlers
  1511. return fns.apply(null, arguments)
  1512. }
  1513. }
  1514. invoker.fns = fns;
  1515. return invoker
  1516. }
  1517. function updateListeners (
  1518. on,
  1519. oldOn,
  1520. add,
  1521. remove$$1,
  1522. vm
  1523. ) {
  1524. var name, cur, old, event;
  1525. for (name in on) {
  1526. cur = on[name];
  1527. old = oldOn[name];
  1528. event = normalizeEvent(name);
  1529. if (!cur) {
  1530. "development" !== 'production' && warn(
  1531. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  1532. vm
  1533. );
  1534. } else if (!old) {
  1535. if (!cur.fns) {
  1536. cur = on[name] = createFnInvoker(cur);
  1537. }
  1538. add(event.name, cur, event.once, event.capture);
  1539. } else if (cur !== old) {
  1540. old.fns = cur;
  1541. on[name] = old;
  1542. }
  1543. }
  1544. for (name in oldOn) {
  1545. if (!on[name]) {
  1546. event = normalizeEvent(name);
  1547. remove$$1(event.name, oldOn[name], event.capture);
  1548. }
  1549. }
  1550. }
  1551. /* */
  1552. function mergeVNodeHook (def, hookKey, hook) {
  1553. var invoker;
  1554. var oldHook = def[hookKey];
  1555. function wrappedHook () {
  1556. hook.apply(this, arguments);
  1557. // important: remove merged hook to ensure it's called only once
  1558. // and prevent memory leak
  1559. remove(invoker.fns, wrappedHook);
  1560. }
  1561. if (!oldHook) {
  1562. // no existing hook
  1563. invoker = createFnInvoker([wrappedHook]);
  1564. } else {
  1565. /* istanbul ignore if */
  1566. if (oldHook.fns && oldHook.merged) {
  1567. // already a merged invoker
  1568. invoker = oldHook;
  1569. invoker.fns.push(wrappedHook);
  1570. } else {
  1571. // existing plain hook
  1572. invoker = createFnInvoker([oldHook, wrappedHook]);
  1573. }
  1574. }
  1575. invoker.merged = true;
  1576. def[hookKey] = invoker;
  1577. }
  1578. /* */
  1579. // The template compiler attempts to minimize the need for normalization by
  1580. // statically analyzing the template at compile time.
  1581. //
  1582. // For plain HTML markup, normalization can be completely skipped because the
  1583. // generated render function is guaranteed to return Array<VNode>. There are
  1584. // two cases where extra normalization is needed:
  1585. // 1. When the children contains components - because a functional component
  1586. // may return an Array instead of a single root. In this case, just a simple
  1587. // normalization is needed - if any child is an Array, we flatten the whole
  1588. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  1589. // because functional components already normalize their own children.
  1590. function simpleNormalizeChildren (children) {
  1591. for (var i = 0; i < children.length; i++) {
  1592. if (Array.isArray(children[i])) {
  1593. return Array.prototype.concat.apply([], children)
  1594. }
  1595. }
  1596. return children
  1597. }
  1598. // 2. When the children contains constructs that always generated nested Arrays,
  1599. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  1600. // with hand-written render functions / JSX. In such cases a full normalization
  1601. // is needed to cater to all possible types of children values.
  1602. function normalizeChildren (children) {
  1603. return isPrimitive(children)
  1604. ? [createTextVNode(children)]
  1605. : Array.isArray(children)
  1606. ? normalizeArrayChildren(children)
  1607. : undefined
  1608. }
  1609. function normalizeArrayChildren (children, nestedIndex) {
  1610. var res = [];
  1611. var i, c, last;
  1612. for (i = 0; i < children.length; i++) {
  1613. c = children[i];
  1614. if (c == null || typeof c === 'boolean') { continue }
  1615. last = res[res.length - 1];
  1616. // nested
  1617. if (Array.isArray(c)) {
  1618. res.push.apply(res, normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i)));
  1619. } else if (isPrimitive(c)) {
  1620. if (last && last.text) {
  1621. last.text += String(c);
  1622. } else if (c !== '') {
  1623. // convert primitive to vnode
  1624. res.push(createTextVNode(c));
  1625. }
  1626. } else {
  1627. if (c.text && last && last.text) {
  1628. res[res.length - 1] = createTextVNode(last.text + c.text);
  1629. } else {
  1630. // default key for nested array children (likely generated by v-for)
  1631. if (c.tag && c.key == null && nestedIndex != null) {
  1632. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  1633. }
  1634. res.push(c);
  1635. }
  1636. }
  1637. }
  1638. return res
  1639. }
  1640. /* */
  1641. function getFirstComponentChild (children) {
  1642. return children && children.filter(function (c) { return c && c.componentOptions; })[0]
  1643. }
  1644. /* */
  1645. function initEvents (vm) {
  1646. vm._events = Object.create(null);
  1647. vm._hasHookEvent = false;
  1648. // init parent attached events
  1649. var listeners = vm.$options._parentListeners;
  1650. if (listeners) {
  1651. updateComponentListeners(vm, listeners);
  1652. }
  1653. }
  1654. var target;
  1655. function add (event, fn, once$$1) {
  1656. if (once$$1) {
  1657. target.$once(event, fn);
  1658. } else {
  1659. target.$on(event, fn);
  1660. }
  1661. }
  1662. function remove$1 (event, fn) {
  1663. target.$off(event, fn);
  1664. }
  1665. function updateComponentListeners (
  1666. vm,
  1667. listeners,
  1668. oldListeners
  1669. ) {
  1670. target = vm;
  1671. updateListeners(listeners, oldListeners || {}, add, remove$1, vm);
  1672. }
  1673. function eventsMixin (Vue) {
  1674. var hookRE = /^hook:/;
  1675. Vue.prototype.$on = function (event, fn) {
  1676. var this$1 = this;
  1677. var vm = this;
  1678. if (Array.isArray(event)) {
  1679. for (var i = 0, l = event.length; i < l; i++) {
  1680. this$1.$on(event[i], fn);
  1681. }
  1682. } else {
  1683. (vm._events[event] || (vm._events[event] = [])).push(fn);
  1684. // optimize hook:event cost by using a boolean flag marked at registration
  1685. // instead of a hash lookup
  1686. if (hookRE.test(event)) {
  1687. vm._hasHookEvent = true;
  1688. }
  1689. }
  1690. return vm
  1691. };
  1692. Vue.prototype.$once = function (event, fn) {
  1693. var vm = this;
  1694. function on () {
  1695. vm.$off(event, on);
  1696. fn.apply(vm, arguments);
  1697. }
  1698. on.fn = fn;
  1699. vm.$on(event, on);
  1700. return vm
  1701. };
  1702. Vue.prototype.$off = function (event, fn) {
  1703. var this$1 = this;
  1704. var vm = this;
  1705. // all
  1706. if (!arguments.length) {
  1707. vm._events = Object.create(null);
  1708. return vm
  1709. }
  1710. // array of events
  1711. if (Array.isArray(event)) {
  1712. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  1713. this$1.$off(event[i$1], fn);
  1714. }
  1715. return vm
  1716. }
  1717. // specific event
  1718. var cbs = vm._events[event];
  1719. if (!cbs) {
  1720. return vm
  1721. }
  1722. if (arguments.length === 1) {
  1723. vm._events[event] = null;
  1724. return vm
  1725. }
  1726. // specific handler
  1727. var cb;
  1728. var i = cbs.length;
  1729. while (i--) {
  1730. cb = cbs[i];
  1731. if (cb === fn || cb.fn === fn) {
  1732. cbs.splice(i, 1);
  1733. break
  1734. }
  1735. }
  1736. return vm
  1737. };
  1738. Vue.prototype.$emit = function (event) {
  1739. var vm = this;
  1740. {
  1741. var lowerCaseEvent = event.toLowerCase();
  1742. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  1743. tip(
  1744. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  1745. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  1746. "Note that HTML attributes are case-insensitive and you cannot use " +
  1747. "v-on to listen to camelCase events when using in-DOM templates. " +
  1748. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  1749. );
  1750. }
  1751. }
  1752. var cbs = vm._events[event];
  1753. if (cbs) {
  1754. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  1755. var args = toArray(arguments, 1);
  1756. for (var i = 0, l = cbs.length; i < l; i++) {
  1757. cbs[i].apply(vm, args);
  1758. }
  1759. }
  1760. return vm
  1761. };
  1762. }
  1763. /* */
  1764. /**
  1765. * Runtime helper for resolving raw children VNodes into a slot object.
  1766. */
  1767. function resolveSlots (
  1768. children,
  1769. context
  1770. ) {
  1771. var slots = {};
  1772. if (!children) {
  1773. return slots
  1774. }
  1775. var defaultSlot = [];
  1776. var name, child;
  1777. for (var i = 0, l = children.length; i < l; i++) {
  1778. child = children[i];
  1779. // named slots should only be respected if the vnode was rendered in the
  1780. // same context.
  1781. if ((child.context === context || child.functionalContext === context) &&
  1782. child.data && (name = child.data.slot)) {
  1783. var slot = (slots[name] || (slots[name] = []));
  1784. if (child.tag === 'template') {
  1785. slot.push.apply(slot, child.children);
  1786. } else {
  1787. slot.push(child);
  1788. }
  1789. } else {
  1790. defaultSlot.push(child);
  1791. }
  1792. }
  1793. // ignore whitespace
  1794. if (!defaultSlot.every(isWhitespace)) {
  1795. slots.default = defaultSlot;
  1796. }
  1797. return slots
  1798. }
  1799. function isWhitespace (node) {
  1800. return node.isComment || node.text === ' '
  1801. }
  1802. function resolveScopedSlots (
  1803. fns
  1804. ) {
  1805. var res = {};
  1806. for (var i = 0; i < fns.length; i++) {
  1807. res[fns[i][0]] = fns[i][1];
  1808. }
  1809. return res
  1810. }
  1811. /* */
  1812. var activeInstance = null;
  1813. function initLifecycle (vm) {
  1814. var options = vm.$options;
  1815. // locate first non-abstract parent
  1816. var parent = options.parent;
  1817. if (parent && !options.abstract) {
  1818. while (parent.$options.abstract && parent.$parent) {
  1819. parent = parent.$parent;
  1820. }
  1821. parent.$children.push(vm);
  1822. }
  1823. vm.$parent = parent;
  1824. vm.$root = parent ? parent.$root : vm;
  1825. vm.$children = [];
  1826. vm.$refs = {};
  1827. vm._watcher = null;
  1828. vm._inactive = null;
  1829. vm._directInactive = false;
  1830. vm._isMounted = false;
  1831. vm._isDestroyed = false;
  1832. vm._isBeingDestroyed = false;
  1833. }
  1834. function lifecycleMixin (Vue) {
  1835. Vue.prototype._update = function (vnode, hydrating) {
  1836. var vm = this;
  1837. if (vm._isMounted) {
  1838. callHook(vm, 'beforeUpdate');
  1839. }
  1840. var prevEl = vm.$el;
  1841. var prevVnode = vm._vnode;
  1842. var prevActiveInstance = activeInstance;
  1843. activeInstance = vm;
  1844. vm._vnode = vnode;
  1845. // Vue.prototype.__patch__ is injected in entry points
  1846. // based on the rendering backend used.
  1847. if (!prevVnode) {
  1848. // initial render
  1849. vm.$el = vm.__patch__(
  1850. vm.$el, vnode, hydrating, false /* removeOnly */,
  1851. vm.$options._parentElm,
  1852. vm.$options._refElm
  1853. );
  1854. } else {
  1855. // updates
  1856. vm.$el = vm.__patch__(prevVnode, vnode);
  1857. }
  1858. activeInstance = prevActiveInstance;
  1859. // update __vue__ reference
  1860. if (prevEl) {
  1861. prevEl.__vue__ = null;
  1862. }
  1863. if (vm.$el) {
  1864. vm.$el.__vue__ = vm;
  1865. }
  1866. // if parent is an HOC, update its $el as well
  1867. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  1868. vm.$parent.$el = vm.$el;
  1869. }
  1870. // updated hook is called by the scheduler to ensure that children are
  1871. // updated in a parent's updated hook.
  1872. };
  1873. Vue.prototype.$forceUpdate = function () {
  1874. var vm = this;
  1875. if (vm._watcher) {
  1876. vm._watcher.update();
  1877. }
  1878. };
  1879. Vue.prototype.$destroy = function () {
  1880. var vm = this;
  1881. if (vm._isBeingDestroyed) {
  1882. return
  1883. }
  1884. callHook(vm, 'beforeDestroy');
  1885. vm._isBeingDestroyed = true;
  1886. // remove self from parent
  1887. var parent = vm.$parent;
  1888. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  1889. remove(parent.$children, vm);
  1890. }
  1891. // teardown watchers
  1892. if (vm._watcher) {
  1893. vm._watcher.teardown();
  1894. }
  1895. var i = vm._watchers.length;
  1896. while (i--) {
  1897. vm._watchers[i].teardown();
  1898. }
  1899. // remove reference from data ob
  1900. // frozen object may not have observer.
  1901. if (vm._data.__ob__) {
  1902. vm._data.__ob__.vmCount--;
  1903. }
  1904. // call the last hook...
  1905. vm._isDestroyed = true;
  1906. // invoke destroy hooks on current rendered tree
  1907. vm.__patch__(vm._vnode, null);
  1908. // fire destroyed hook
  1909. callHook(vm, 'destroyed');
  1910. // turn off all instance listeners.
  1911. vm.$off();
  1912. // remove __vue__ reference
  1913. if (vm.$el) {
  1914. vm.$el.__vue__ = null;
  1915. }
  1916. // remove reference to DOM nodes (prevents leak)
  1917. vm.$options._parentElm = vm.$options._refElm = null;
  1918. };
  1919. }
  1920. function mountComponent (
  1921. vm,
  1922. el,
  1923. hydrating
  1924. ) {
  1925. vm.$el = el;
  1926. if (!vm.$options.render) {
  1927. vm.$options.render = createEmptyVNode;
  1928. {
  1929. /* istanbul ignore if */
  1930. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  1931. vm.$options.el || el) {
  1932. warn(
  1933. 'You are using the runtime-only build of Vue where the template ' +
  1934. 'compiler is not available. Either pre-compile the templates into ' +
  1935. 'render functions, or use the compiler-included build.',
  1936. vm
  1937. );
  1938. } else {
  1939. warn(
  1940. 'Failed to mount component: template or render function not defined.',
  1941. vm
  1942. );
  1943. }
  1944. }
  1945. }
  1946. callHook(vm, 'beforeMount');
  1947. var updateComponent;
  1948. /* istanbul ignore if */
  1949. if ("development" !== 'production' && config.performance && mark) {
  1950. updateComponent = function () {
  1951. var name = vm._name;
  1952. var id = vm._uid;
  1953. var startTag = "vue-perf-start:" + id;
  1954. var endTag = "vue-perf-end:" + id;
  1955. mark(startTag);
  1956. var vnode = vm._render();
  1957. mark(endTag);
  1958. measure((name + " render"), startTag, endTag);
  1959. mark(startTag);
  1960. vm._update(vnode, hydrating);
  1961. mark(endTag);
  1962. measure((name + " patch"), startTag, endTag);
  1963. };
  1964. } else {
  1965. updateComponent = function () {
  1966. vm._update(vm._render(), hydrating);
  1967. };
  1968. }
  1969. vm._watcher = new Watcher(vm, updateComponent, noop);
  1970. hydrating = false;
  1971. // manually mounted instance, call mounted on self
  1972. // mounted is called for render-created child components in its inserted hook
  1973. if (vm.$vnode == null) {
  1974. vm._isMounted = true;
  1975. callHook(vm, 'mounted');
  1976. }
  1977. return vm
  1978. }
  1979. function updateChildComponent (
  1980. vm,
  1981. propsData,
  1982. listeners,
  1983. parentVnode,
  1984. renderChildren
  1985. ) {
  1986. // determine whether component has slot children
  1987. // we need to do this before overwriting $options._renderChildren
  1988. var hasChildren = !!(
  1989. renderChildren || // has new static slots
  1990. vm.$options._renderChildren || // has old static slots
  1991. parentVnode.data.scopedSlots || // has new scoped slots
  1992. vm.$scopedSlots !== emptyObject // has old scoped slots
  1993. );
  1994. vm.$options._parentVnode = parentVnode;
  1995. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  1996. if (vm._vnode) { // update child tree's parent
  1997. vm._vnode.parent = parentVnode;
  1998. }
  1999. vm.$options._renderChildren = renderChildren;
  2000. // update props
  2001. if (propsData && vm.$options.props) {
  2002. observerState.shouldConvert = false;
  2003. {
  2004. observerState.isSettingProps = true;
  2005. }
  2006. var props = vm._props;
  2007. var propKeys = vm.$options._propKeys || [];
  2008. for (var i = 0; i < propKeys.length; i++) {
  2009. var key = propKeys[i];
  2010. props[key] = validateProp(key, vm.$options.props, propsData, vm);
  2011. }
  2012. observerState.shouldConvert = true;
  2013. {
  2014. observerState.isSettingProps = false;
  2015. }
  2016. // keep a copy of raw propsData
  2017. vm.$options.propsData = propsData;
  2018. }
  2019. // update listeners
  2020. if (listeners) {
  2021. var oldListeners = vm.$options._parentListeners;
  2022. vm.$options._parentListeners = listeners;
  2023. updateComponentListeners(vm, listeners, oldListeners);
  2024. }
  2025. // resolve slots + force update if has children
  2026. if (hasChildren) {
  2027. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  2028. vm.$forceUpdate();
  2029. }
  2030. }
  2031. function isInInactiveTree (vm) {
  2032. while (vm && (vm = vm.$parent)) {
  2033. if (vm._inactive) { return true }
  2034. }
  2035. return false
  2036. }
  2037. function activateChildComponent (vm, direct) {
  2038. if (direct) {
  2039. vm._directInactive = false;
  2040. if (isInInactiveTree(vm)) {
  2041. return
  2042. }
  2043. } else if (vm._directInactive) {
  2044. return
  2045. }
  2046. if (vm._inactive || vm._inactive == null) {
  2047. vm._inactive = false;
  2048. for (var i = 0; i < vm.$children.length; i++) {
  2049. activateChildComponent(vm.$children[i]);
  2050. }
  2051. callHook(vm, 'activated');
  2052. }
  2053. }
  2054. function deactivateChildComponent (vm, direct) {
  2055. if (direct) {
  2056. vm._directInactive = true;
  2057. if (isInInactiveTree(vm)) {
  2058. return
  2059. }
  2060. }
  2061. if (!vm._inactive) {
  2062. vm._inactive = true;
  2063. for (var i = 0; i < vm.$children.length; i++) {
  2064. deactivateChildComponent(vm.$children[i]);
  2065. }
  2066. callHook(vm, 'deactivated');
  2067. }
  2068. }
  2069. function callHook (vm, hook) {
  2070. var handlers = vm.$options[hook];
  2071. if (handlers) {
  2072. for (var i = 0, j = handlers.length; i < j; i++) {
  2073. try {
  2074. handlers[i].call(vm);
  2075. } catch (e) {
  2076. handleError(e, vm, (hook + " hook"));
  2077. }
  2078. }
  2079. }
  2080. if (vm._hasHookEvent) {
  2081. vm.$emit('hook:' + hook);
  2082. }
  2083. }
  2084. /* */
  2085. var queue = [];
  2086. var has = {};
  2087. var circular = {};
  2088. var waiting = false;
  2089. var flushing = false;
  2090. var index = 0;
  2091. /**
  2092. * Reset the scheduler's state.
  2093. */
  2094. function resetSchedulerState () {
  2095. queue.length = 0;
  2096. has = {};
  2097. {
  2098. circular = {};
  2099. }
  2100. waiting = flushing = false;
  2101. }
  2102. /**
  2103. * Flush both queues and run the watchers.
  2104. */
  2105. function flushSchedulerQueue () {
  2106. flushing = true;
  2107. var watcher, id, vm;
  2108. // Sort queue before flush.
  2109. // This ensures that:
  2110. // 1. Components are updated from parent to child. (because parent is always
  2111. // created before the child)
  2112. // 2. A component's user watchers are run before its render watcher (because
  2113. // user watchers are created before the render watcher)
  2114. // 3. If a component is destroyed during a parent component's watcher run,
  2115. // its watchers can be skipped.
  2116. queue.sort(function (a, b) { return a.id - b.id; });
  2117. // do not cache length because more watchers might be pushed
  2118. // as we run existing watchers
  2119. for (index = 0; index < queue.length; index++) {
  2120. watcher = queue[index];
  2121. id = watcher.id;
  2122. has[id] = null;
  2123. watcher.run();
  2124. // in dev build, check and stop circular updates.
  2125. if ("development" !== 'production' && has[id] != null) {
  2126. circular[id] = (circular[id] || 0) + 1;
  2127. if (circular[id] > config._maxUpdateCount) {
  2128. warn(
  2129. 'You may have an infinite update loop ' + (
  2130. watcher.user
  2131. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  2132. : "in a component render function."
  2133. ),
  2134. watcher.vm
  2135. );
  2136. break
  2137. }
  2138. }
  2139. }
  2140. // reset scheduler before updated hook called
  2141. var oldQueue = queue.slice();
  2142. resetSchedulerState();
  2143. // call updated hooks
  2144. index = oldQueue.length;
  2145. while (index--) {
  2146. watcher = oldQueue[index];
  2147. vm = watcher.vm;
  2148. if (vm._watcher === watcher && vm._isMounted) {
  2149. callHook(vm, 'updated');
  2150. }
  2151. }
  2152. // devtool hook
  2153. /* istanbul ignore if */
  2154. if (devtools && config.devtools) {
  2155. devtools.emit('flush');
  2156. }
  2157. }
  2158. /**
  2159. * Push a watcher into the watcher queue.
  2160. * Jobs with duplicate IDs will be skipped unless it's
  2161. * pushed when the queue is being flushed.
  2162. */
  2163. function queueWatcher (watcher) {
  2164. var id = watcher.id;
  2165. if (has[id] == null) {
  2166. has[id] = true;
  2167. if (!flushing) {
  2168. queue.push(watcher);
  2169. } else {
  2170. // if already flushing, splice the watcher based on its id
  2171. // if already past its id, it will be run next immediately.
  2172. var i = queue.length - 1;
  2173. while (i >= 0 && queue[i].id > watcher.id) {
  2174. i--;
  2175. }
  2176. queue.splice(Math.max(i, index) + 1, 0, watcher);
  2177. }
  2178. // queue the flush
  2179. if (!waiting) {
  2180. waiting = true;
  2181. nextTick(flushSchedulerQueue);
  2182. }
  2183. }
  2184. }
  2185. /* */
  2186. var uid$2 = 0;
  2187. /**
  2188. * A watcher parses an expression, collects dependencies,
  2189. * and fires callback when the expression value changes.
  2190. * This is used for both the $watch() api and directives.
  2191. */
  2192. var Watcher = function Watcher (
  2193. vm,
  2194. expOrFn,
  2195. cb,
  2196. options
  2197. ) {
  2198. this.vm = vm;
  2199. vm._watchers.push(this);
  2200. // options
  2201. if (options) {
  2202. this.deep = !!options.deep;
  2203. this.user = !!options.user;
  2204. this.lazy = !!options.lazy;
  2205. this.sync = !!options.sync;
  2206. } else {
  2207. this.deep = this.user = this.lazy = this.sync = false;
  2208. }
  2209. this.cb = cb;
  2210. this.id = ++uid$2; // uid for batching
  2211. this.active = true;
  2212. this.dirty = this.lazy; // for lazy watchers
  2213. this.deps = [];
  2214. this.newDeps = [];
  2215. this.depIds = new _Set();
  2216. this.newDepIds = new _Set();
  2217. this.expression = expOrFn.toString();
  2218. // parse expression for getter
  2219. if (typeof expOrFn === 'function') {
  2220. this.getter = expOrFn;
  2221. } else {
  2222. this.getter = parsePath(expOrFn);
  2223. if (!this.getter) {
  2224. this.getter = function () {};
  2225. "development" !== 'production' && warn(
  2226. "Failed watching path: \"" + expOrFn + "\" " +
  2227. 'Watcher only accepts simple dot-delimited paths. ' +
  2228. 'For full control, use a function instead.',
  2229. vm
  2230. );
  2231. }
  2232. }
  2233. this.value = this.lazy
  2234. ? undefined
  2235. : this.get();
  2236. };
  2237. /**
  2238. * Evaluate the getter, and re-collect dependencies.
  2239. */
  2240. Watcher.prototype.get = function get () {
  2241. pushTarget(this);
  2242. var value;
  2243. var vm = this.vm;
  2244. if (this.user) {
  2245. try {
  2246. value = this.getter.call(vm, vm);
  2247. } catch (e) {
  2248. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  2249. }
  2250. } else {
  2251. value = this.getter.call(vm, vm);
  2252. }
  2253. // "touch" every property so they are all tracked as
  2254. // dependencies for deep watching
  2255. if (this.deep) {
  2256. traverse(value);
  2257. }
  2258. popTarget();
  2259. this.cleanupDeps();
  2260. return value
  2261. };
  2262. /**
  2263. * Add a dependency to this directive.
  2264. */
  2265. Watcher.prototype.addDep = function addDep (dep) {
  2266. var id = dep.id;
  2267. if (!this.newDepIds.has(id)) {
  2268. this.newDepIds.add(id);
  2269. this.newDeps.push(dep);
  2270. if (!this.depIds.has(id)) {
  2271. dep.addSub(this);
  2272. }
  2273. }
  2274. };
  2275. /**
  2276. * Clean up for dependency collection.
  2277. */
  2278. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  2279. var this$1 = this;
  2280. var i = this.deps.length;
  2281. while (i--) {
  2282. var dep = this$1.deps[i];
  2283. if (!this$1.newDepIds.has(dep.id)) {
  2284. dep.removeSub(this$1);
  2285. }
  2286. }
  2287. var tmp = this.depIds;
  2288. this.depIds = this.newDepIds;
  2289. this.newDepIds = tmp;
  2290. this.newDepIds.clear();
  2291. tmp = this.deps;
  2292. this.deps = this.newDeps;
  2293. this.newDeps = tmp;
  2294. this.newDeps.length = 0;
  2295. };
  2296. /**
  2297. * Subscriber interface.
  2298. * Will be called when a dependency changes.
  2299. */
  2300. Watcher.prototype.update = function update () {
  2301. /* istanbul ignore else */
  2302. if (this.lazy) {
  2303. this.dirty = true;
  2304. } else if (this.sync) {
  2305. this.run();
  2306. } else {
  2307. queueWatcher(this);
  2308. }
  2309. };
  2310. /**
  2311. * Scheduler job interface.
  2312. * Will be called by the scheduler.
  2313. */
  2314. Watcher.prototype.run = function run () {
  2315. if (this.active) {
  2316. var value = this.get();
  2317. if (
  2318. value !== this.value ||
  2319. // Deep watchers and watchers on Object/Arrays should fire even
  2320. // when the value is the same, because the value may
  2321. // have mutated.
  2322. isObject(value) ||
  2323. this.deep
  2324. ) {
  2325. // set new value
  2326. var oldValue = this.value;
  2327. this.value = value;
  2328. if (this.user) {
  2329. try {
  2330. this.cb.call(this.vm, value, oldValue);
  2331. } catch (e) {
  2332. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  2333. }
  2334. } else {
  2335. this.cb.call(this.vm, value, oldValue);
  2336. }
  2337. }
  2338. }
  2339. };
  2340. /**
  2341. * Evaluate the value of the watcher.
  2342. * This only gets called for lazy watchers.
  2343. */
  2344. Watcher.prototype.evaluate = function evaluate () {
  2345. this.value = this.get();
  2346. this.dirty = false;
  2347. };
  2348. /**
  2349. * Depend on all deps collected by this watcher.
  2350. */
  2351. Watcher.prototype.depend = function depend () {
  2352. var this$1 = this;
  2353. var i = this.deps.length;
  2354. while (i--) {
  2355. this$1.deps[i].depend();
  2356. }
  2357. };
  2358. /**
  2359. * Remove self from all dependencies' subscriber list.
  2360. */
  2361. Watcher.prototype.teardown = function teardown () {
  2362. var this$1 = this;
  2363. if (this.active) {
  2364. // remove self from vm's watcher list
  2365. // this is a somewhat expensive operation so we skip it
  2366. // if the vm is being destroyed.
  2367. if (!this.vm._isBeingDestroyed) {
  2368. remove(this.vm._watchers, this);
  2369. }
  2370. var i = this.deps.length;
  2371. while (i--) {
  2372. this$1.deps[i].removeSub(this$1);
  2373. }
  2374. this.active = false;
  2375. }
  2376. };
  2377. /**
  2378. * Recursively traverse an object to evoke all converted
  2379. * getters, so that every nested property inside the object
  2380. * is collected as a "deep" dependency.
  2381. */
  2382. var seenObjects = new _Set();
  2383. function traverse (val) {
  2384. seenObjects.clear();
  2385. _traverse(val, seenObjects);
  2386. }
  2387. function _traverse (val, seen) {
  2388. var i, keys;
  2389. var isA = Array.isArray(val);
  2390. if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
  2391. return
  2392. }
  2393. if (val.__ob__) {
  2394. var depId = val.__ob__.dep.id;
  2395. if (seen.has(depId)) {
  2396. return
  2397. }
  2398. seen.add(depId);
  2399. }
  2400. if (isA) {
  2401. i = val.length;
  2402. while (i--) { _traverse(val[i], seen); }
  2403. } else {
  2404. keys = Object.keys(val);
  2405. i = keys.length;
  2406. while (i--) { _traverse(val[keys[i]], seen); }
  2407. }
  2408. }
  2409. /* */
  2410. var sharedPropertyDefinition = {
  2411. enumerable: true,
  2412. configurable: true,
  2413. get: noop,
  2414. set: noop
  2415. };
  2416. function proxy (target, sourceKey, key) {
  2417. sharedPropertyDefinition.get = function proxyGetter () {
  2418. return this[sourceKey][key]
  2419. };
  2420. sharedPropertyDefinition.set = function proxySetter (val) {
  2421. this[sourceKey][key] = val;
  2422. };
  2423. Object.defineProperty(target, key, sharedPropertyDefinition);
  2424. }
  2425. function initState (vm) {
  2426. vm._watchers = [];
  2427. var opts = vm.$options;
  2428. if (opts.props) { initProps(vm, opts.props); }
  2429. if (opts.methods) { initMethods(vm, opts.methods); }
  2430. if (opts.data) {
  2431. initData(vm);
  2432. } else {
  2433. observe(vm._data = {}, true /* asRootData */);
  2434. }
  2435. if (opts.computed) { initComputed(vm, opts.computed); }
  2436. if (opts.watch) { initWatch(vm, opts.watch); }
  2437. }
  2438. var isReservedProp = { key: 1, ref: 1, slot: 1 };
  2439. function initProps (vm, propsOptions) {
  2440. var propsData = vm.$options.propsData || {};
  2441. var props = vm._props = {};
  2442. // cache prop keys so that future props updates can iterate using Array
  2443. // instead of dynamic object key enumeration.
  2444. var keys = vm.$options._propKeys = [];
  2445. var isRoot = !vm.$parent;
  2446. // root instance props should be converted
  2447. observerState.shouldConvert = isRoot;
  2448. var loop = function ( key ) {
  2449. keys.push(key);
  2450. var value = validateProp(key, propsOptions, propsData, vm);
  2451. /* istanbul ignore else */
  2452. {
  2453. if (isReservedProp[key]) {
  2454. warn(
  2455. ("\"" + key + "\" is a reserved attribute and cannot be used as component prop."),
  2456. vm
  2457. );
  2458. }
  2459. defineReactive$$1(props, key, value, function () {
  2460. if (vm.$parent && !observerState.isSettingProps) {
  2461. warn(
  2462. "Avoid mutating a prop directly since the value will be " +
  2463. "overwritten whenever the parent component re-renders. " +
  2464. "Instead, use a data or computed property based on the prop's " +
  2465. "value. Prop being mutated: \"" + key + "\"",
  2466. vm
  2467. );
  2468. }
  2469. });
  2470. }
  2471. // static props are already proxied on the component's prototype
  2472. // during Vue.extend(). We only need to proxy props defined at
  2473. // instantiation here.
  2474. if (!(key in vm)) {
  2475. proxy(vm, "_props", key);
  2476. }
  2477. };
  2478. for (var key in propsOptions) loop( key );
  2479. observerState.shouldConvert = true;
  2480. }
  2481. function initData (vm) {
  2482. var data = vm.$options.data;
  2483. data = vm._data = typeof data === 'function'
  2484. ? getData(data, vm)
  2485. : data || {};
  2486. if (!isPlainObject(data)) {
  2487. data = {};
  2488. "development" !== 'production' && warn(
  2489. 'data functions should return an object:\n' +
  2490. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  2491. vm
  2492. );
  2493. }
  2494. // proxy data on instance
  2495. var keys = Object.keys(data);
  2496. var props = vm.$options.props;
  2497. var i = keys.length;
  2498. while (i--) {
  2499. if (props && hasOwn(props, keys[i])) {
  2500. "development" !== 'production' && warn(
  2501. "The data property \"" + (keys[i]) + "\" is already declared as a prop. " +
  2502. "Use prop default value instead.",
  2503. vm
  2504. );
  2505. } else if (!isReserved(keys[i])) {
  2506. proxy(vm, "_data", keys[i]);
  2507. }
  2508. }
  2509. // observe data
  2510. observe(data, true /* asRootData */);
  2511. }
  2512. function getData (data, vm) {
  2513. try {
  2514. return data.call(vm)
  2515. } catch (e) {
  2516. handleError(e, vm, "data()");
  2517. return {}
  2518. }
  2519. }
  2520. var computedWatcherOptions = { lazy: true };
  2521. function initComputed (vm, computed) {
  2522. var watchers = vm._computedWatchers = Object.create(null);
  2523. for (var key in computed) {
  2524. var userDef = computed[key];
  2525. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  2526. {
  2527. if (getter === undefined) {
  2528. warn(
  2529. ("No getter function has been defined for computed property \"" + key + "\"."),
  2530. vm
  2531. );
  2532. getter = noop;
  2533. }
  2534. }
  2535. // create internal watcher for the computed property.
  2536. watchers[key] = new Watcher(vm, getter, noop, computedWatcherOptions);
  2537. // component-defined computed properties are already defined on the
  2538. // component prototype. We only need to define computed properties defined
  2539. // at instantiation here.
  2540. if (!(key in vm)) {
  2541. defineComputed(vm, key, userDef);
  2542. }
  2543. }
  2544. }
  2545. function defineComputed (target, key, userDef) {
  2546. if (typeof userDef === 'function') {
  2547. sharedPropertyDefinition.get = createComputedGetter(key);
  2548. sharedPropertyDefinition.set = noop;
  2549. } else {
  2550. sharedPropertyDefinition.get = userDef.get
  2551. ? userDef.cache !== false
  2552. ? createComputedGetter(key)
  2553. : userDef.get
  2554. : noop;
  2555. sharedPropertyDefinition.set = userDef.set
  2556. ? userDef.set
  2557. : noop;
  2558. }
  2559. Object.defineProperty(target, key, sharedPropertyDefinition);
  2560. }
  2561. function createComputedGetter (key) {
  2562. return function computedGetter () {
  2563. var watcher = this._computedWatchers && this._computedWatchers[key];
  2564. if (watcher) {
  2565. if (watcher.dirty) {
  2566. watcher.evaluate();
  2567. }
  2568. if (Dep.target) {
  2569. watcher.depend();
  2570. }
  2571. return watcher.value
  2572. }
  2573. }
  2574. }
  2575. function initMethods (vm, methods) {
  2576. var props = vm.$options.props;
  2577. for (var key in methods) {
  2578. vm[key] = methods[key] == null ? noop : bind(methods[key], vm);
  2579. {
  2580. if (methods[key] == null) {
  2581. warn(
  2582. "method \"" + key + "\" has an undefined value in the component definition. " +
  2583. "Did you reference the function correctly?",
  2584. vm
  2585. );
  2586. }
  2587. if (props && hasOwn(props, key)) {
  2588. warn(
  2589. ("method \"" + key + "\" has already been defined as a prop."),
  2590. vm
  2591. );
  2592. }
  2593. }
  2594. }
  2595. }
  2596. function initWatch (vm, watch) {
  2597. for (var key in watch) {
  2598. var handler = watch[key];
  2599. if (Array.isArray(handler)) {
  2600. for (var i = 0; i < handler.length; i++) {
  2601. createWatcher(vm, key, handler[i]);
  2602. }
  2603. } else {
  2604. createWatcher(vm, key, handler);
  2605. }
  2606. }
  2607. }
  2608. function createWatcher (vm, key, handler) {
  2609. var options;
  2610. if (isPlainObject(handler)) {
  2611. options = handler;
  2612. handler = handler.handler;
  2613. }
  2614. if (typeof handler === 'string') {
  2615. handler = vm[handler];
  2616. }
  2617. vm.$watch(key, handler, options);
  2618. }
  2619. function stateMixin (Vue) {
  2620. // flow somehow has problems with directly declared definition object
  2621. // when using Object.defineProperty, so we have to procedurally build up
  2622. // the object here.
  2623. var dataDef = {};
  2624. dataDef.get = function () { return this._data };
  2625. var propsDef = {};
  2626. propsDef.get = function () { return this._props };
  2627. {
  2628. dataDef.set = function (newData) {
  2629. warn(
  2630. 'Avoid replacing instance root $data. ' +
  2631. 'Use nested data properties instead.',
  2632. this
  2633. );
  2634. };
  2635. propsDef.set = function () {
  2636. warn("$props is readonly.", this);
  2637. };
  2638. }
  2639. Object.defineProperty(Vue.prototype, '$data', dataDef);
  2640. Object.defineProperty(Vue.prototype, '$props', propsDef);
  2641. Vue.prototype.$set = set;
  2642. Vue.prototype.$delete = del;
  2643. Vue.prototype.$watch = function (
  2644. expOrFn,
  2645. cb,
  2646. options
  2647. ) {
  2648. var vm = this;
  2649. options = options || {};
  2650. options.user = true;
  2651. var watcher = new Watcher(vm, expOrFn, cb, options);
  2652. if (options.immediate) {
  2653. cb.call(vm, watcher.value);
  2654. }
  2655. return function unwatchFn () {
  2656. watcher.teardown();
  2657. }
  2658. };
  2659. }
  2660. /* */
  2661. // hooks to be invoked on component VNodes during patch
  2662. var componentVNodeHooks = {
  2663. init: function init (
  2664. vnode,
  2665. hydrating,
  2666. parentElm,
  2667. refElm
  2668. ) {
  2669. if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) {
  2670. var child = vnode.componentInstance = createComponentInstanceForVnode(
  2671. vnode,
  2672. activeInstance,
  2673. parentElm,
  2674. refElm
  2675. );
  2676. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  2677. } else if (vnode.data.keepAlive) {
  2678. // kept-alive components, treat as a patch
  2679. var mountedNode = vnode; // work around flow
  2680. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  2681. }
  2682. },
  2683. prepatch: function prepatch (oldVnode, vnode) {
  2684. var options = vnode.componentOptions;
  2685. var child = vnode.componentInstance = oldVnode.componentInstance;
  2686. updateChildComponent(
  2687. child,
  2688. options.propsData, // updated props
  2689. options.listeners, // updated listeners
  2690. vnode, // new parent vnode
  2691. options.children // new children
  2692. );
  2693. },
  2694. insert: function insert (vnode) {
  2695. if (!vnode.componentInstance._isMounted) {
  2696. vnode.componentInstance._isMounted = true;
  2697. callHook(vnode.componentInstance, 'mounted');
  2698. }
  2699. if (vnode.data.keepAlive) {
  2700. activateChildComponent(vnode.componentInstance, true /* direct */);
  2701. }
  2702. },
  2703. destroy: function destroy (vnode) {
  2704. if (!vnode.componentInstance._isDestroyed) {
  2705. if (!vnode.data.keepAlive) {
  2706. vnode.componentInstance.$destroy();
  2707. } else {
  2708. deactivateChildComponent(vnode.componentInstance, true /* direct */);
  2709. }
  2710. }
  2711. }
  2712. };
  2713. var hooksToMerge = Object.keys(componentVNodeHooks);
  2714. function createComponent (
  2715. Ctor,
  2716. data,
  2717. context,
  2718. children,
  2719. tag
  2720. ) {
  2721. if (!Ctor) {
  2722. return
  2723. }
  2724. var baseCtor = context.$options._base;
  2725. if (isObject(Ctor)) {
  2726. Ctor = baseCtor.extend(Ctor);
  2727. }
  2728. if (typeof Ctor !== 'function') {
  2729. {
  2730. warn(("Invalid Component definition: " + (String(Ctor))), context);
  2731. }
  2732. return
  2733. }
  2734. // async component
  2735. if (!Ctor.cid) {
  2736. if (Ctor.resolved) {
  2737. Ctor = Ctor.resolved;
  2738. } else {
  2739. Ctor = resolveAsyncComponent(Ctor, baseCtor, function () {
  2740. // it's ok to queue this on every render because
  2741. // $forceUpdate is buffered by the scheduler.
  2742. context.$forceUpdate();
  2743. });
  2744. if (!Ctor) {
  2745. // return nothing if this is indeed an async component
  2746. // wait for the callback to trigger parent update.
  2747. return
  2748. }
  2749. }
  2750. }
  2751. // resolve constructor options in case global mixins are applied after
  2752. // component constructor creation
  2753. resolveConstructorOptions(Ctor);
  2754. data = data || {};
  2755. // transform component v-model data into props & events
  2756. if (data.model) {
  2757. transformModel(Ctor.options, data);
  2758. }
  2759. // extract props
  2760. var propsData = extractProps(data, Ctor, tag);
  2761. // functional component
  2762. if (Ctor.options.functional) {
  2763. return createFunctionalComponent(Ctor, propsData, data, context, children)
  2764. }
  2765. // extract listeners, since these needs to be treated as
  2766. // child component listeners instead of DOM listeners
  2767. var listeners = data.on;
  2768. // replace with listeners with .native modifier
  2769. data.on = data.nativeOn;
  2770. if (Ctor.options.abstract) {
  2771. // abstract components do not keep anything
  2772. // other than props & listeners
  2773. data = {};
  2774. }
  2775. // merge component management hooks onto the placeholder node
  2776. mergeHooks(data);
  2777. // return a placeholder vnode
  2778. var name = Ctor.options.name || tag;
  2779. var vnode = new VNode(
  2780. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  2781. data, undefined, undefined, undefined, context,
  2782. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }
  2783. );
  2784. return vnode
  2785. }
  2786. function createFunctionalComponent (
  2787. Ctor,
  2788. propsData,
  2789. data,
  2790. context,
  2791. children
  2792. ) {
  2793. var props = {};
  2794. var propOptions = Ctor.options.props;
  2795. if (propOptions) {
  2796. for (var key in propOptions) {
  2797. props[key] = validateProp(key, propOptions, propsData);
  2798. }
  2799. }
  2800. // ensure the createElement function in functional components
  2801. // gets a unique context - this is necessary for correct named slot check
  2802. var _context = Object.create(context);
  2803. var h = function (a, b, c, d) { return createElement(_context, a, b, c, d, true); };
  2804. var vnode = Ctor.options.render.call(null, h, {
  2805. props: props,
  2806. data: data,
  2807. parent: context,
  2808. children: children,
  2809. slots: function () { return resolveSlots(children, context); }
  2810. });
  2811. if (vnode instanceof VNode) {
  2812. vnode.functionalContext = context;
  2813. if (data.slot) {
  2814. (vnode.data || (vnode.data = {})).slot = data.slot;
  2815. }
  2816. }
  2817. return vnode
  2818. }
  2819. function createComponentInstanceForVnode (
  2820. vnode, // we know it's MountedComponentVNode but flow doesn't
  2821. parent, // activeInstance in lifecycle state
  2822. parentElm,
  2823. refElm
  2824. ) {
  2825. var vnodeComponentOptions = vnode.componentOptions;
  2826. var options = {
  2827. _isComponent: true,
  2828. parent: parent,
  2829. propsData: vnodeComponentOptions.propsData,
  2830. _componentTag: vnodeComponentOptions.tag,
  2831. _parentVnode: vnode,
  2832. _parentListeners: vnodeComponentOptions.listeners,
  2833. _renderChildren: vnodeComponentOptions.children,
  2834. _parentElm: parentElm || null,
  2835. _refElm: refElm || null
  2836. };
  2837. // check inline-template render functions
  2838. var inlineTemplate = vnode.data.inlineTemplate;
  2839. if (inlineTemplate) {
  2840. options.render = inlineTemplate.render;
  2841. options.staticRenderFns = inlineTemplate.staticRenderFns;
  2842. }
  2843. return new vnodeComponentOptions.Ctor(options)
  2844. }
  2845. function resolveAsyncComponent (
  2846. factory,
  2847. baseCtor,
  2848. cb
  2849. ) {
  2850. if (factory.requested) {
  2851. // pool callbacks
  2852. factory.pendingCallbacks.push(cb);
  2853. } else {
  2854. factory.requested = true;
  2855. var cbs = factory.pendingCallbacks = [cb];
  2856. var sync = true;
  2857. var resolve = function (res) {
  2858. if (isObject(res)) {
  2859. res = baseCtor.extend(res);
  2860. }
  2861. // cache resolved
  2862. factory.resolved = res;
  2863. // invoke callbacks only if this is not a synchronous resolve
  2864. // (async resolves are shimmed as synchronous during SSR)
  2865. if (!sync) {
  2866. for (var i = 0, l = cbs.length; i < l; i++) {
  2867. cbs[i](res);
  2868. }
  2869. }
  2870. };
  2871. var reject = function (reason) {
  2872. "development" !== 'production' && warn(
  2873. "Failed to resolve async component: " + (String(factory)) +
  2874. (reason ? ("\nReason: " + reason) : '')
  2875. );
  2876. };
  2877. var res = factory(resolve, reject);
  2878. // handle promise
  2879. if (res && typeof res.then === 'function' && !factory.resolved) {
  2880. res.then(resolve, reject);
  2881. }
  2882. sync = false;
  2883. // return in case resolved synchronously
  2884. return factory.resolved
  2885. }
  2886. }
  2887. function extractProps (data, Ctor, tag) {
  2888. // we are only extracting raw values here.
  2889. // validation and default values are handled in the child
  2890. // component itself.
  2891. var propOptions = Ctor.options.props;
  2892. if (!propOptions) {
  2893. return
  2894. }
  2895. var res = {};
  2896. var attrs = data.attrs;
  2897. var props = data.props;
  2898. var domProps = data.domProps;
  2899. if (attrs || props || domProps) {
  2900. for (var key in propOptions) {
  2901. var altKey = hyphenate(key);
  2902. {
  2903. var keyInLowerCase = key.toLowerCase();
  2904. if (
  2905. key !== keyInLowerCase &&
  2906. attrs && attrs.hasOwnProperty(keyInLowerCase)
  2907. ) {
  2908. tip(
  2909. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  2910. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  2911. " \"" + key + "\". " +
  2912. "Note that HTML attributes are case-insensitive and camelCased " +
  2913. "props need to use their kebab-case equivalents when using in-DOM " +
  2914. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  2915. );
  2916. }
  2917. }
  2918. checkProp(res, props, key, altKey, true) ||
  2919. checkProp(res, attrs, key, altKey) ||
  2920. checkProp(res, domProps, key, altKey);
  2921. }
  2922. }
  2923. return res
  2924. }
  2925. function checkProp (
  2926. res,
  2927. hash,
  2928. key,
  2929. altKey,
  2930. preserve
  2931. ) {
  2932. if (hash) {
  2933. if (hasOwn(hash, key)) {
  2934. res[key] = hash[key];
  2935. if (!preserve) {
  2936. delete hash[key];
  2937. }
  2938. return true
  2939. } else if (hasOwn(hash, altKey)) {
  2940. res[key] = hash[altKey];
  2941. if (!preserve) {
  2942. delete hash[altKey];
  2943. }
  2944. return true
  2945. }
  2946. }
  2947. return false
  2948. }
  2949. function mergeHooks (data) {
  2950. if (!data.hook) {
  2951. data.hook = {};
  2952. }
  2953. for (var i = 0; i < hooksToMerge.length; i++) {
  2954. var key = hooksToMerge[i];
  2955. var fromParent = data.hook[key];
  2956. var ours = componentVNodeHooks[key];
  2957. data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
  2958. }
  2959. }
  2960. function mergeHook$1 (one, two) {
  2961. return function (a, b, c, d) {
  2962. one(a, b, c, d);
  2963. two(a, b, c, d);
  2964. }
  2965. }
  2966. // transform component v-model info (value and callback) into
  2967. // prop and event handler respectively.
  2968. function transformModel (options, data) {
  2969. var prop = (options.model && options.model.prop) || 'value';
  2970. var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value;
  2971. var on = data.on || (data.on = {});
  2972. if (on[event]) {
  2973. on[event] = [data.model.callback].concat(on[event]);
  2974. } else {
  2975. on[event] = data.model.callback;
  2976. }
  2977. }
  2978. /* */
  2979. var SIMPLE_NORMALIZE = 1;
  2980. var ALWAYS_NORMALIZE = 2;
  2981. // wrapper function for providing a more flexible interface
  2982. // without getting yelled at by flow
  2983. function createElement (
  2984. context,
  2985. tag,
  2986. data,
  2987. children,
  2988. normalizationType,
  2989. alwaysNormalize
  2990. ) {
  2991. if (Array.isArray(data) || isPrimitive(data)) {
  2992. normalizationType = children;
  2993. children = data;
  2994. data = undefined;
  2995. }
  2996. if (alwaysNormalize) { normalizationType = ALWAYS_NORMALIZE; }
  2997. return _createElement(context, tag, data, children, normalizationType)
  2998. }
  2999. function _createElement (
  3000. context,
  3001. tag,
  3002. data,
  3003. children,
  3004. normalizationType
  3005. ) {
  3006. if (data && data.__ob__) {
  3007. "development" !== 'production' && warn(
  3008. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  3009. 'Always create fresh vnode data objects in each render!',
  3010. context
  3011. );
  3012. return createEmptyVNode()
  3013. }
  3014. if (!tag) {
  3015. // in case of component :is set to falsy value
  3016. return createEmptyVNode()
  3017. }
  3018. // support single function children as default scoped slot
  3019. if (Array.isArray(children) &&
  3020. typeof children[0] === 'function') {
  3021. data = data || {};
  3022. data.scopedSlots = { default: children[0] };
  3023. children.length = 0;
  3024. }
  3025. if (normalizationType === ALWAYS_NORMALIZE) {
  3026. children = normalizeChildren(children);
  3027. } else if (normalizationType === SIMPLE_NORMALIZE) {
  3028. children = simpleNormalizeChildren(children);
  3029. }
  3030. var vnode, ns;
  3031. if (typeof tag === 'string') {
  3032. var Ctor;
  3033. ns = config.getTagNamespace(tag);
  3034. if (config.isReservedTag(tag)) {
  3035. // platform built-in elements
  3036. vnode = new VNode(
  3037. config.parsePlatformTagName(tag), data, children,
  3038. undefined, undefined, context
  3039. );
  3040. } else if ((Ctor = resolveAsset(context.$options, 'components', tag))) {
  3041. // component
  3042. vnode = createComponent(Ctor, data, context, children, tag);
  3043. } else {
  3044. // unknown or unlisted namespaced elements
  3045. // check at runtime because it may get assigned a namespace when its
  3046. // parent normalizes children
  3047. vnode = new VNode(
  3048. tag, data, children,
  3049. undefined, undefined, context
  3050. );
  3051. }
  3052. } else {
  3053. // direct component options / constructor
  3054. vnode = createComponent(tag, data, context, children);
  3055. }
  3056. if (vnode) {
  3057. if (ns) { applyNS(vnode, ns); }
  3058. return vnode
  3059. } else {
  3060. return createEmptyVNode()
  3061. }
  3062. }
  3063. function applyNS (vnode, ns) {
  3064. vnode.ns = ns;
  3065. if (vnode.tag === 'foreignObject') {
  3066. // use default namespace inside foreignObject
  3067. return
  3068. }
  3069. if (vnode.children) {
  3070. for (var i = 0, l = vnode.children.length; i < l; i++) {
  3071. var child = vnode.children[i];
  3072. if (child.tag && !child.ns) {
  3073. applyNS(child, ns);
  3074. }
  3075. }
  3076. }
  3077. }
  3078. /* */
  3079. /**
  3080. * Runtime helper for rendering v-for lists.
  3081. */
  3082. function renderList (
  3083. val,
  3084. render
  3085. ) {
  3086. var ret, i, l, keys, key;
  3087. if (Array.isArray(val) || typeof val === 'string') {
  3088. ret = new Array(val.length);
  3089. for (i = 0, l = val.length; i < l; i++) {
  3090. ret[i] = render(val[i], i);
  3091. }
  3092. } else if (typeof val === 'number') {
  3093. ret = new Array(val);
  3094. for (i = 0; i < val; i++) {
  3095. ret[i] = render(i + 1, i);
  3096. }
  3097. } else if (isObject(val)) {
  3098. keys = Object.keys(val);
  3099. ret = new Array(keys.length);
  3100. for (i = 0, l = keys.length; i < l; i++) {
  3101. key = keys[i];
  3102. ret[i] = render(val[key], key, i);
  3103. }
  3104. }
  3105. return ret
  3106. }
  3107. /* */
  3108. /**
  3109. * Runtime helper for rendering <slot>
  3110. */
  3111. function renderSlot (
  3112. name,
  3113. fallback,
  3114. props,
  3115. bindObject
  3116. ) {
  3117. var scopedSlotFn = this.$scopedSlots[name];
  3118. if (scopedSlotFn) { // scoped slot
  3119. props = props || {};
  3120. if (bindObject) {
  3121. extend(props, bindObject);
  3122. }
  3123. return scopedSlotFn(props) || fallback
  3124. } else {
  3125. var slotNodes = this.$slots[name];
  3126. // warn duplicate slot usage
  3127. if (slotNodes && "development" !== 'production') {
  3128. slotNodes._rendered && warn(
  3129. "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
  3130. "- this will likely cause render errors.",
  3131. this
  3132. );
  3133. slotNodes._rendered = true;
  3134. }
  3135. return slotNodes || fallback
  3136. }
  3137. }
  3138. /* */
  3139. /**
  3140. * Runtime helper for resolving filters
  3141. */
  3142. function resolveFilter (id) {
  3143. return resolveAsset(this.$options, 'filters', id, true) || identity
  3144. }
  3145. /* */
  3146. /**
  3147. * Runtime helper for checking keyCodes from config.
  3148. */
  3149. function checkKeyCodes (
  3150. eventKeyCode,
  3151. key,
  3152. builtInAlias
  3153. ) {
  3154. var keyCodes = config.keyCodes[key] || builtInAlias;
  3155. if (Array.isArray(keyCodes)) {
  3156. return keyCodes.indexOf(eventKeyCode) === -1
  3157. } else {
  3158. return keyCodes !== eventKeyCode
  3159. }
  3160. }
  3161. /* */
  3162. /**
  3163. * Runtime helper for merging v-bind="object" into a VNode's data.
  3164. */
  3165. function bindObjectProps (
  3166. data,
  3167. tag,
  3168. value,
  3169. asProp
  3170. ) {
  3171. if (value) {
  3172. if (!isObject(value)) {
  3173. "development" !== 'production' && warn(
  3174. 'v-bind without argument expects an Object or Array value',
  3175. this
  3176. );
  3177. } else {
  3178. if (Array.isArray(value)) {
  3179. value = toObject(value);
  3180. }
  3181. var hash;
  3182. for (var key in value) {
  3183. if (key === 'class' || key === 'style') {
  3184. hash = data;
  3185. } else {
  3186. var type = data.attrs && data.attrs.type;
  3187. hash = asProp || config.mustUseProp(tag, type, key)
  3188. ? data.domProps || (data.domProps = {})
  3189. : data.attrs || (data.attrs = {});
  3190. }
  3191. if (!(key in hash)) {
  3192. hash[key] = value[key];
  3193. }
  3194. }
  3195. }
  3196. }
  3197. return data
  3198. }
  3199. /* */
  3200. /**
  3201. * Runtime helper for rendering static trees.
  3202. */
  3203. function renderStatic (
  3204. index,
  3205. isInFor
  3206. ) {
  3207. var tree = this._staticTrees[index];
  3208. // if has already-rendered static tree and not inside v-for,
  3209. // we can reuse the same tree by doing a shallow clone.
  3210. if (tree && !isInFor) {
  3211. return Array.isArray(tree)
  3212. ? cloneVNodes(tree)
  3213. : cloneVNode(tree)
  3214. }
  3215. // otherwise, render a fresh tree.
  3216. tree = this._staticTrees[index] =
  3217. this.$options.staticRenderFns[index].call(this._renderProxy);
  3218. markStatic(tree, ("__static__" + index), false);
  3219. return tree
  3220. }
  3221. /**
  3222. * Runtime helper for v-once.
  3223. * Effectively it means marking the node as static with a unique key.
  3224. */
  3225. function markOnce (
  3226. tree,
  3227. index,
  3228. key
  3229. ) {
  3230. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  3231. return tree
  3232. }
  3233. function markStatic (
  3234. tree,
  3235. key,
  3236. isOnce
  3237. ) {
  3238. if (Array.isArray(tree)) {
  3239. for (var i = 0; i < tree.length; i++) {
  3240. if (tree[i] && typeof tree[i] !== 'string') {
  3241. markStaticNode(tree[i], (key + "_" + i), isOnce);
  3242. }
  3243. }
  3244. } else {
  3245. markStaticNode(tree, key, isOnce);
  3246. }
  3247. }
  3248. function markStaticNode (node, key, isOnce) {
  3249. node.isStatic = true;
  3250. node.key = key;
  3251. node.isOnce = isOnce;
  3252. }
  3253. /* */
  3254. function initRender (vm) {
  3255. vm.$vnode = null; // the placeholder node in parent tree
  3256. vm._vnode = null; // the root of the child tree
  3257. vm._staticTrees = null;
  3258. var parentVnode = vm.$options._parentVnode;
  3259. var renderContext = parentVnode && parentVnode.context;
  3260. vm.$slots = resolveSlots(vm.$options._renderChildren, renderContext);
  3261. vm.$scopedSlots = emptyObject;
  3262. // bind the createElement fn to this instance
  3263. // so that we get proper render context inside it.
  3264. // args order: tag, data, children, normalizationType, alwaysNormalize
  3265. // internal version is used by render functions compiled from templates
  3266. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  3267. // normalization is always applied for the public version, used in
  3268. // user-written render functions.
  3269. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  3270. }
  3271. function renderMixin (Vue) {
  3272. Vue.prototype.$nextTick = function (fn) {
  3273. return nextTick(fn, this)
  3274. };
  3275. Vue.prototype._render = function () {
  3276. var vm = this;
  3277. var ref = vm.$options;
  3278. var render = ref.render;
  3279. var staticRenderFns = ref.staticRenderFns;
  3280. var _parentVnode = ref._parentVnode;
  3281. if (vm._isMounted) {
  3282. // clone slot nodes on re-renders
  3283. for (var key in vm.$slots) {
  3284. vm.$slots[key] = cloneVNodes(vm.$slots[key]);
  3285. }
  3286. }
  3287. vm.$scopedSlots = (_parentVnode && _parentVnode.data.scopedSlots) || emptyObject;
  3288. if (staticRenderFns && !vm._staticTrees) {
  3289. vm._staticTrees = [];
  3290. }
  3291. // set parent vnode. this allows render functions to have access
  3292. // to the data on the placeholder node.
  3293. vm.$vnode = _parentVnode;
  3294. // render self
  3295. var vnode;
  3296. try {
  3297. vnode = render.call(vm._renderProxy, vm.$createElement);
  3298. } catch (e) {
  3299. handleError(e, vm, "render function");
  3300. // return error render result,
  3301. // or previous vnode to prevent render error causing blank component
  3302. /* istanbul ignore else */
  3303. {
  3304. vnode = vm.$options.renderError
  3305. ? vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e)
  3306. : vm._vnode;
  3307. }
  3308. }
  3309. // return empty vnode in case the render function errored out
  3310. if (!(vnode instanceof VNode)) {
  3311. if ("development" !== 'production' && Array.isArray(vnode)) {
  3312. warn(
  3313. 'Multiple root nodes returned from render function. Render function ' +
  3314. 'should return a single root node.',
  3315. vm
  3316. );
  3317. }
  3318. vnode = createEmptyVNode();
  3319. }
  3320. // set parent
  3321. vnode.parent = _parentVnode;
  3322. return vnode
  3323. };
  3324. // internal render helpers.
  3325. // these are exposed on the instance prototype to reduce generated render
  3326. // code size.
  3327. Vue.prototype._o = markOnce;
  3328. Vue.prototype._n = toNumber;
  3329. Vue.prototype._s = _toString;
  3330. Vue.prototype._l = renderList;
  3331. Vue.prototype._t = renderSlot;
  3332. Vue.prototype._q = looseEqual;
  3333. Vue.prototype._i = looseIndexOf;
  3334. Vue.prototype._m = renderStatic;
  3335. Vue.prototype._f = resolveFilter;
  3336. Vue.prototype._k = checkKeyCodes;
  3337. Vue.prototype._b = bindObjectProps;
  3338. Vue.prototype._v = createTextVNode;
  3339. Vue.prototype._e = createEmptyVNode;
  3340. Vue.prototype._u = resolveScopedSlots;
  3341. }
  3342. /* */
  3343. function initProvide (vm) {
  3344. var provide = vm.$options.provide;
  3345. if (provide) {
  3346. vm._provided = typeof provide === 'function'
  3347. ? provide.call(vm)
  3348. : provide;
  3349. }
  3350. }
  3351. function initInjections (vm) {
  3352. var inject = vm.$options.inject;
  3353. if (inject) {
  3354. // inject is :any because flow is not smart enough to figure out cached
  3355. // isArray here
  3356. var isArray = Array.isArray(inject);
  3357. var keys = isArray
  3358. ? inject
  3359. : hasSymbol
  3360. ? Reflect.ownKeys(inject)
  3361. : Object.keys(inject);
  3362. var loop = function ( i ) {
  3363. var key = keys[i];
  3364. var provideKey = isArray ? key : inject[key];
  3365. var source = vm;
  3366. while (source) {
  3367. if (source._provided && provideKey in source._provided) {
  3368. /* istanbul ignore else */
  3369. {
  3370. defineReactive$$1(vm, key, source._provided[provideKey], function () {
  3371. warn(
  3372. "Avoid mutating an injected value directly since the changes will be " +
  3373. "overwritten whenever the provided component re-renders. " +
  3374. "injection being mutated: \"" + key + "\"",
  3375. vm
  3376. );
  3377. });
  3378. }
  3379. break
  3380. }
  3381. source = source.$parent;
  3382. }
  3383. };
  3384. for (var i = 0; i < keys.length; i++) loop( i );
  3385. }
  3386. }
  3387. /* */
  3388. var uid = 0;
  3389. function initMixin (Vue) {
  3390. Vue.prototype._init = function (options) {
  3391. var vm = this;
  3392. // a uid
  3393. vm._uid = uid++;
  3394. var startTag, endTag;
  3395. /* istanbul ignore if */
  3396. if ("development" !== 'production' && config.performance && mark) {
  3397. startTag = "vue-perf-init:" + (vm._uid);
  3398. endTag = "vue-perf-end:" + (vm._uid);
  3399. mark(startTag);
  3400. }
  3401. // a flag to avoid this being observed
  3402. vm._isVue = true;
  3403. // merge options
  3404. if (options && options._isComponent) {
  3405. // optimize internal component instantiation
  3406. // since dynamic options merging is pretty slow, and none of the
  3407. // internal component options needs special treatment.
  3408. initInternalComponent(vm, options);
  3409. } else {
  3410. vm.$options = mergeOptions(
  3411. resolveConstructorOptions(vm.constructor),
  3412. options || {},
  3413. vm
  3414. );
  3415. }
  3416. /* istanbul ignore else */
  3417. {
  3418. initProxy(vm);
  3419. }
  3420. // expose real self
  3421. vm._self = vm;
  3422. initLifecycle(vm);
  3423. initEvents(vm);
  3424. initRender(vm);
  3425. callHook(vm, 'beforeCreate');
  3426. initInjections(vm); // resolve injections before data/props
  3427. initState(vm);
  3428. initProvide(vm); // resolve provide after data/props
  3429. callHook(vm, 'created');
  3430. /* istanbul ignore if */
  3431. if ("development" !== 'production' && config.performance && mark) {
  3432. vm._name = formatComponentName(vm, false);
  3433. mark(endTag);
  3434. measure(((vm._name) + " init"), startTag, endTag);
  3435. }
  3436. if (vm.$options.el) {
  3437. vm.$mount(vm.$options.el);
  3438. }
  3439. };
  3440. }
  3441. function initInternalComponent (vm, options) {
  3442. var opts = vm.$options = Object.create(vm.constructor.options);
  3443. // doing this because it's faster than dynamic enumeration.
  3444. opts.parent = options.parent;
  3445. opts.propsData = options.propsData;
  3446. opts._parentVnode = options._parentVnode;
  3447. opts._parentListeners = options._parentListeners;
  3448. opts._renderChildren = options._renderChildren;
  3449. opts._componentTag = options._componentTag;
  3450. opts._parentElm = options._parentElm;
  3451. opts._refElm = options._refElm;
  3452. if (options.render) {
  3453. opts.render = options.render;
  3454. opts.staticRenderFns = options.staticRenderFns;
  3455. }
  3456. }
  3457. function resolveConstructorOptions (Ctor) {
  3458. var options = Ctor.options;
  3459. if (Ctor.super) {
  3460. var superOptions = resolveConstructorOptions(Ctor.super);
  3461. var cachedSuperOptions = Ctor.superOptions;
  3462. if (superOptions !== cachedSuperOptions) {
  3463. // super option changed,
  3464. // need to resolve new options.
  3465. Ctor.superOptions = superOptions;
  3466. // check if there are any late-modified/attached options (#4976)
  3467. var modifiedOptions = resolveModifiedOptions(Ctor);
  3468. // update base extend options
  3469. if (modifiedOptions) {
  3470. extend(Ctor.extendOptions, modifiedOptions);
  3471. }
  3472. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  3473. if (options.name) {
  3474. options.components[options.name] = Ctor;
  3475. }
  3476. }
  3477. }
  3478. return options
  3479. }
  3480. function resolveModifiedOptions (Ctor) {
  3481. var modified;
  3482. var latest = Ctor.options;
  3483. var sealed = Ctor.sealedOptions;
  3484. for (var key in latest) {
  3485. if (latest[key] !== sealed[key]) {
  3486. if (!modified) { modified = {}; }
  3487. modified[key] = dedupe(latest[key], sealed[key]);
  3488. }
  3489. }
  3490. return modified
  3491. }
  3492. function dedupe (latest, sealed) {
  3493. // compare latest and sealed to ensure lifecycle hooks won't be duplicated
  3494. // between merges
  3495. if (Array.isArray(latest)) {
  3496. var res = [];
  3497. sealed = Array.isArray(sealed) ? sealed : [sealed];
  3498. for (var i = 0; i < latest.length; i++) {
  3499. if (sealed.indexOf(latest[i]) < 0) {
  3500. res.push(latest[i]);
  3501. }
  3502. }
  3503. return res
  3504. } else {
  3505. return latest
  3506. }
  3507. }
  3508. function Vue$2 (options) {
  3509. if ("development" !== 'production' &&
  3510. !(this instanceof Vue$2)) {
  3511. warn('Vue is a constructor and should be called with the `new` keyword');
  3512. }
  3513. this._init(options);
  3514. }
  3515. initMixin(Vue$2);
  3516. stateMixin(Vue$2);
  3517. eventsMixin(Vue$2);
  3518. lifecycleMixin(Vue$2);
  3519. renderMixin(Vue$2);
  3520. /* */
  3521. function initUse (Vue) {
  3522. Vue.use = function (plugin) {
  3523. /* istanbul ignore if */
  3524. if (plugin.installed) {
  3525. return
  3526. }
  3527. // additional parameters
  3528. var args = toArray(arguments, 1);
  3529. args.unshift(this);
  3530. if (typeof plugin.install === 'function') {
  3531. plugin.install.apply(plugin, args);
  3532. } else if (typeof plugin === 'function') {
  3533. plugin.apply(null, args);
  3534. }
  3535. plugin.installed = true;
  3536. return this
  3537. };
  3538. }
  3539. /* */
  3540. function initMixin$1 (Vue) {
  3541. Vue.mixin = function (mixin) {
  3542. this.options = mergeOptions(this.options, mixin);
  3543. };
  3544. }
  3545. /* */
  3546. function initExtend (Vue) {
  3547. /**
  3548. * Each instance constructor, including Vue, has a unique
  3549. * cid. This enables us to create wrapped "child
  3550. * constructors" for prototypal inheritance and cache them.
  3551. */
  3552. Vue.cid = 0;
  3553. var cid = 1;
  3554. /**
  3555. * Class inheritance
  3556. */
  3557. Vue.extend = function (extendOptions) {
  3558. extendOptions = extendOptions || {};
  3559. var Super = this;
  3560. var SuperId = Super.cid;
  3561. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  3562. if (cachedCtors[SuperId]) {
  3563. return cachedCtors[SuperId]
  3564. }
  3565. var name = extendOptions.name || Super.options.name;
  3566. {
  3567. if (!/^[a-zA-Z][\w-]*$/.test(name)) {
  3568. warn(
  3569. 'Invalid component name: "' + name + '". Component names ' +
  3570. 'can only contain alphanumeric characters and the hyphen, ' +
  3571. 'and must start with a letter.'
  3572. );
  3573. }
  3574. }
  3575. var Sub = function VueComponent (options) {
  3576. this._init(options);
  3577. };
  3578. Sub.prototype = Object.create(Super.prototype);
  3579. Sub.prototype.constructor = Sub;
  3580. Sub.cid = cid++;
  3581. Sub.options = mergeOptions(
  3582. Super.options,
  3583. extendOptions
  3584. );
  3585. Sub['super'] = Super;
  3586. // For props and computed properties, we define the proxy getters on
  3587. // the Vue instances at extension time, on the extended prototype. This
  3588. // avoids Object.defineProperty calls for each instance created.
  3589. if (Sub.options.props) {
  3590. initProps$1(Sub);
  3591. }
  3592. if (Sub.options.computed) {
  3593. initComputed$1(Sub);
  3594. }
  3595. // allow further extension/mixin/plugin usage
  3596. Sub.extend = Super.extend;
  3597. Sub.mixin = Super.mixin;
  3598. Sub.use = Super.use;
  3599. // create asset registers, so extended classes
  3600. // can have their private assets too.
  3601. config._assetTypes.forEach(function (type) {
  3602. Sub[type] = Super[type];
  3603. });
  3604. // enable recursive self-lookup
  3605. if (name) {
  3606. Sub.options.components[name] = Sub;
  3607. }
  3608. // keep a reference to the super options at extension time.
  3609. // later at instantiation we can check if Super's options have
  3610. // been updated.
  3611. Sub.superOptions = Super.options;
  3612. Sub.extendOptions = extendOptions;
  3613. Sub.sealedOptions = extend({}, Sub.options);
  3614. // cache constructor
  3615. cachedCtors[SuperId] = Sub;
  3616. return Sub
  3617. };
  3618. }
  3619. function initProps$1 (Comp) {
  3620. var props = Comp.options.props;
  3621. for (var key in props) {
  3622. proxy(Comp.prototype, "_props", key);
  3623. }
  3624. }
  3625. function initComputed$1 (Comp) {
  3626. var computed = Comp.options.computed;
  3627. for (var key in computed) {
  3628. defineComputed(Comp.prototype, key, computed[key]);
  3629. }
  3630. }
  3631. /* */
  3632. function initAssetRegisters (Vue) {
  3633. /**
  3634. * Create asset registration methods.
  3635. */
  3636. config._assetTypes.forEach(function (type) {
  3637. Vue[type] = function (
  3638. id,
  3639. definition
  3640. ) {
  3641. if (!definition) {
  3642. return this.options[type + 's'][id]
  3643. } else {
  3644. /* istanbul ignore if */
  3645. {
  3646. if (type === 'component' && config.isReservedTag(id)) {
  3647. warn(
  3648. 'Do not use built-in or reserved HTML elements as component ' +
  3649. 'id: ' + id
  3650. );
  3651. }
  3652. }
  3653. if (type === 'component' && isPlainObject(definition)) {
  3654. definition.name = definition.name || id;
  3655. definition = this.options._base.extend(definition);
  3656. }
  3657. if (type === 'directive' && typeof definition === 'function') {
  3658. definition = { bind: definition, update: definition };
  3659. }
  3660. this.options[type + 's'][id] = definition;
  3661. return definition
  3662. }
  3663. };
  3664. });
  3665. }
  3666. /* */
  3667. var patternTypes = [String, RegExp];
  3668. function getComponentName (opts) {
  3669. return opts && (opts.Ctor.options.name || opts.tag)
  3670. }
  3671. function matches (pattern, name) {
  3672. if (typeof pattern === 'string') {
  3673. return pattern.split(',').indexOf(name) > -1
  3674. } else if (pattern instanceof RegExp) {
  3675. return pattern.test(name)
  3676. }
  3677. /* istanbul ignore next */
  3678. return false
  3679. }
  3680. function pruneCache (cache, filter) {
  3681. for (var key in cache) {
  3682. var cachedNode = cache[key];
  3683. if (cachedNode) {
  3684. var name = getComponentName(cachedNode.componentOptions);
  3685. if (name && !filter(name)) {
  3686. pruneCacheEntry(cachedNode);
  3687. cache[key] = null;
  3688. }
  3689. }
  3690. }
  3691. }
  3692. function pruneCacheEntry (vnode) {
  3693. if (vnode) {
  3694. if (!vnode.componentInstance._inactive) {
  3695. callHook(vnode.componentInstance, 'deactivated');
  3696. }
  3697. vnode.componentInstance.$destroy();
  3698. }
  3699. }
  3700. var KeepAlive = {
  3701. name: 'keep-alive',
  3702. abstract: true,
  3703. props: {
  3704. include: patternTypes,
  3705. exclude: patternTypes
  3706. },
  3707. created: function created () {
  3708. this.cache = Object.create(null);
  3709. },
  3710. destroyed: function destroyed () {
  3711. var this$1 = this;
  3712. for (var key in this$1.cache) {
  3713. pruneCacheEntry(this$1.cache[key]);
  3714. }
  3715. },
  3716. watch: {
  3717. include: function include (val) {
  3718. pruneCache(this.cache, function (name) { return matches(val, name); });
  3719. },
  3720. exclude: function exclude (val) {
  3721. pruneCache(this.cache, function (name) { return !matches(val, name); });
  3722. }
  3723. },
  3724. render: function render () {
  3725. var vnode = getFirstComponentChild(this.$slots.default);
  3726. var componentOptions = vnode && vnode.componentOptions;
  3727. if (componentOptions) {
  3728. // check pattern
  3729. var name = getComponentName(componentOptions);
  3730. if (name && (
  3731. (this.include && !matches(this.include, name)) ||
  3732. (this.exclude && matches(this.exclude, name))
  3733. )) {
  3734. return vnode
  3735. }
  3736. var key = vnode.key == null
  3737. // same constructor may get registered as different local components
  3738. // so cid alone is not enough (#3269)
  3739. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  3740. : vnode.key;
  3741. if (this.cache[key]) {
  3742. vnode.componentInstance = this.cache[key].componentInstance;
  3743. } else {
  3744. this.cache[key] = vnode;
  3745. }
  3746. vnode.data.keepAlive = true;
  3747. }
  3748. return vnode
  3749. }
  3750. };
  3751. var builtInComponents = {
  3752. KeepAlive: KeepAlive
  3753. };
  3754. /* */
  3755. function initGlobalAPI (Vue) {
  3756. // config
  3757. var configDef = {};
  3758. configDef.get = function () { return config; };
  3759. {
  3760. configDef.set = function () {
  3761. warn(
  3762. 'Do not replace the Vue.config object, set individual fields instead.'
  3763. );
  3764. };
  3765. }
  3766. Object.defineProperty(Vue, 'config', configDef);
  3767. // exposed util methods.
  3768. // NOTE: these are not considered part of the public API - avoid relying on
  3769. // them unless you are aware of the risk.
  3770. Vue.util = {
  3771. warn: warn,
  3772. extend: extend,
  3773. mergeOptions: mergeOptions,
  3774. defineReactive: defineReactive$$1
  3775. };
  3776. Vue.set = set;
  3777. Vue.delete = del;
  3778. Vue.nextTick = nextTick;
  3779. Vue.options = Object.create(null);
  3780. config._assetTypes.forEach(function (type) {
  3781. Vue.options[type + 's'] = Object.create(null);
  3782. });
  3783. // this is used to identify the "base" constructor to extend all plain-object
  3784. // components with in Weex's multi-instance scenarios.
  3785. Vue.options._base = Vue;
  3786. extend(Vue.options.components, builtInComponents);
  3787. initUse(Vue);
  3788. initMixin$1(Vue);
  3789. initExtend(Vue);
  3790. initAssetRegisters(Vue);
  3791. }
  3792. initGlobalAPI(Vue$2);
  3793. Object.defineProperty(Vue$2.prototype, '$isServer', {
  3794. get: isServerRendering
  3795. });
  3796. Vue$2.version = '2.2.6';
  3797. /* */
  3798. // attributes that should be using props for binding
  3799. var acceptValue = makeMap('input,textarea,option,select');
  3800. var mustUseProp = function (tag, type, attr) {
  3801. return (
  3802. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  3803. (attr === 'selected' && tag === 'option') ||
  3804. (attr === 'checked' && tag === 'input') ||
  3805. (attr === 'muted' && tag === 'video')
  3806. )
  3807. };
  3808. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  3809. var isBooleanAttr = makeMap(
  3810. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  3811. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  3812. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  3813. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  3814. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  3815. 'truespeed,typemustmatch,visible'
  3816. );
  3817. var xlinkNS = 'http://www.w3.org/1999/xlink';
  3818. var isXlink = function (name) {
  3819. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  3820. };
  3821. var getXlinkProp = function (name) {
  3822. return isXlink(name) ? name.slice(6, name.length) : ''
  3823. };
  3824. var isFalsyAttrValue = function (val) {
  3825. return val == null || val === false
  3826. };
  3827. /* */
  3828. function genClassForVnode (vnode) {
  3829. var data = vnode.data;
  3830. var parentNode = vnode;
  3831. var childNode = vnode;
  3832. while (childNode.componentInstance) {
  3833. childNode = childNode.componentInstance._vnode;
  3834. if (childNode.data) {
  3835. data = mergeClassData(childNode.data, data);
  3836. }
  3837. }
  3838. while ((parentNode = parentNode.parent)) {
  3839. if (parentNode.data) {
  3840. data = mergeClassData(data, parentNode.data);
  3841. }
  3842. }
  3843. return genClassFromData(data)
  3844. }
  3845. function mergeClassData (child, parent) {
  3846. return {
  3847. staticClass: concat(child.staticClass, parent.staticClass),
  3848. class: child.class
  3849. ? [child.class, parent.class]
  3850. : parent.class
  3851. }
  3852. }
  3853. function genClassFromData (data) {
  3854. var dynamicClass = data.class;
  3855. var staticClass = data.staticClass;
  3856. if (staticClass || dynamicClass) {
  3857. return concat(staticClass, stringifyClass(dynamicClass))
  3858. }
  3859. /* istanbul ignore next */
  3860. return ''
  3861. }
  3862. function concat (a, b) {
  3863. return a ? b ? (a + ' ' + b) : a : (b || '')
  3864. }
  3865. function stringifyClass (value) {
  3866. var res = '';
  3867. if (!value) {
  3868. return res
  3869. }
  3870. if (typeof value === 'string') {
  3871. return value
  3872. }
  3873. if (Array.isArray(value)) {
  3874. var stringified;
  3875. for (var i = 0, l = value.length; i < l; i++) {
  3876. if (value[i]) {
  3877. if ((stringified = stringifyClass(value[i]))) {
  3878. res += stringified + ' ';
  3879. }
  3880. }
  3881. }
  3882. return res.slice(0, -1)
  3883. }
  3884. if (isObject(value)) {
  3885. for (var key in value) {
  3886. if (value[key]) { res += key + ' '; }
  3887. }
  3888. return res.slice(0, -1)
  3889. }
  3890. /* istanbul ignore next */
  3891. return res
  3892. }
  3893. /* */
  3894. var namespaceMap = {
  3895. svg: 'http://www.w3.org/2000/svg',
  3896. math: 'http://www.w3.org/1998/Math/MathML'
  3897. };
  3898. var isHTMLTag = makeMap(
  3899. 'html,body,base,head,link,meta,style,title,' +
  3900. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  3901. 'div,dd,dl,dt,figcaption,figure,hr,img,li,main,ol,p,pre,ul,' +
  3902. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  3903. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  3904. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  3905. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  3906. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  3907. 'output,progress,select,textarea,' +
  3908. 'details,dialog,menu,menuitem,summary,' +
  3909. 'content,element,shadow,template'
  3910. );
  3911. // this map is intentionally selective, only covering SVG elements that may
  3912. // contain child elements.
  3913. var isSVG = makeMap(
  3914. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  3915. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  3916. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  3917. true
  3918. );
  3919. var isReservedTag = function (tag) {
  3920. return isHTMLTag(tag) || isSVG(tag)
  3921. };
  3922. function getTagNamespace (tag) {
  3923. if (isSVG(tag)) {
  3924. return 'svg'
  3925. }
  3926. // basic support for MathML
  3927. // note it doesn't support other MathML elements being component roots
  3928. if (tag === 'math') {
  3929. return 'math'
  3930. }
  3931. }
  3932. var unknownElementCache = Object.create(null);
  3933. function isUnknownElement (tag) {
  3934. /* istanbul ignore if */
  3935. if (!inBrowser) {
  3936. return true
  3937. }
  3938. if (isReservedTag(tag)) {
  3939. return false
  3940. }
  3941. tag = tag.toLowerCase();
  3942. /* istanbul ignore if */
  3943. if (unknownElementCache[tag] != null) {
  3944. return unknownElementCache[tag]
  3945. }
  3946. var el = document.createElement(tag);
  3947. if (tag.indexOf('-') > -1) {
  3948. // http://stackoverflow.com/a/28210364/1070244
  3949. return (unknownElementCache[tag] = (
  3950. el.constructor === window.HTMLUnknownElement ||
  3951. el.constructor === window.HTMLElement
  3952. ))
  3953. } else {
  3954. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  3955. }
  3956. }
  3957. /* */
  3958. /**
  3959. * Query an element selector if it's not an element already.
  3960. */
  3961. function query (el) {
  3962. if (typeof el === 'string') {
  3963. var selected = document.querySelector(el);
  3964. if (!selected) {
  3965. "development" !== 'production' && warn(
  3966. 'Cannot find element: ' + el
  3967. );
  3968. return document.createElement('div')
  3969. }
  3970. return selected
  3971. } else {
  3972. return el
  3973. }
  3974. }
  3975. /* */
  3976. function createElement$1 (tagName, vnode) {
  3977. var elm = document.createElement(tagName);
  3978. if (tagName !== 'select') {
  3979. return elm
  3980. }
  3981. // false or null will remove the attribute but undefined will not
  3982. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  3983. elm.setAttribute('multiple', 'multiple');
  3984. }
  3985. return elm
  3986. }
  3987. function createElementNS (namespace, tagName) {
  3988. return document.createElementNS(namespaceMap[namespace], tagName)
  3989. }
  3990. function createTextNode (text) {
  3991. return document.createTextNode(text)
  3992. }
  3993. function createComment (text) {
  3994. return document.createComment(text)
  3995. }
  3996. function insertBefore (parentNode, newNode, referenceNode) {
  3997. parentNode.insertBefore(newNode, referenceNode);
  3998. }
  3999. function removeChild (node, child) {
  4000. node.removeChild(child);
  4001. }
  4002. function appendChild (node, child) {
  4003. node.appendChild(child);
  4004. }
  4005. function parentNode (node) {
  4006. return node.parentNode
  4007. }
  4008. function nextSibling (node) {
  4009. return node.nextSibling
  4010. }
  4011. function tagName (node) {
  4012. return node.tagName
  4013. }
  4014. function setTextContent (node, text) {
  4015. node.textContent = text;
  4016. }
  4017. function setAttribute (node, key, val) {
  4018. node.setAttribute(key, val);
  4019. }
  4020. var nodeOps = Object.freeze({
  4021. createElement: createElement$1,
  4022. createElementNS: createElementNS,
  4023. createTextNode: createTextNode,
  4024. createComment: createComment,
  4025. insertBefore: insertBefore,
  4026. removeChild: removeChild,
  4027. appendChild: appendChild,
  4028. parentNode: parentNode,
  4029. nextSibling: nextSibling,
  4030. tagName: tagName,
  4031. setTextContent: setTextContent,
  4032. setAttribute: setAttribute
  4033. });
  4034. /* */
  4035. var ref = {
  4036. create: function create (_, vnode) {
  4037. registerRef(vnode);
  4038. },
  4039. update: function update (oldVnode, vnode) {
  4040. if (oldVnode.data.ref !== vnode.data.ref) {
  4041. registerRef(oldVnode, true);
  4042. registerRef(vnode);
  4043. }
  4044. },
  4045. destroy: function destroy (vnode) {
  4046. registerRef(vnode, true);
  4047. }
  4048. };
  4049. function registerRef (vnode, isRemoval) {
  4050. var key = vnode.data.ref;
  4051. if (!key) { return }
  4052. var vm = vnode.context;
  4053. var ref = vnode.componentInstance || vnode.elm;
  4054. var refs = vm.$refs;
  4055. if (isRemoval) {
  4056. if (Array.isArray(refs[key])) {
  4057. remove(refs[key], ref);
  4058. } else if (refs[key] === ref) {
  4059. refs[key] = undefined;
  4060. }
  4061. } else {
  4062. if (vnode.data.refInFor) {
  4063. if (Array.isArray(refs[key]) && refs[key].indexOf(ref) < 0) {
  4064. refs[key].push(ref);
  4065. } else {
  4066. refs[key] = [ref];
  4067. }
  4068. } else {
  4069. refs[key] = ref;
  4070. }
  4071. }
  4072. }
  4073. /**
  4074. * Virtual DOM patching algorithm based on Snabbdom by
  4075. * Simon Friis Vindum (@paldepind)
  4076. * Licensed under the MIT License
  4077. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  4078. *
  4079. * modified by Evan You (@yyx990803)
  4080. *
  4081. /*
  4082. * Not type-checking this because this file is perf-critical and the cost
  4083. * of making flow understand it is not worth it.
  4084. */
  4085. var emptyNode = new VNode('', {}, []);
  4086. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  4087. function isUndef (v) {
  4088. return v === undefined || v === null
  4089. }
  4090. function isDef (v) {
  4091. return v !== undefined && v !== null
  4092. }
  4093. function isTrue (v) {
  4094. return v === true
  4095. }
  4096. function sameVnode (a, b) {
  4097. return (
  4098. a.key === b.key &&
  4099. a.tag === b.tag &&
  4100. a.isComment === b.isComment &&
  4101. isDef(a.data) === isDef(b.data) &&
  4102. sameInputType(a, b)
  4103. )
  4104. }
  4105. // Some browsers do not support dynamically changing type for <input>
  4106. // so they need to be treated as different nodes
  4107. function sameInputType (a, b) {
  4108. if (a.tag !== 'input') { return true }
  4109. var i;
  4110. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  4111. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  4112. return typeA === typeB
  4113. }
  4114. function createKeyToOldIdx (children, beginIdx, endIdx) {
  4115. var i, key;
  4116. var map = {};
  4117. for (i = beginIdx; i <= endIdx; ++i) {
  4118. key = children[i].key;
  4119. if (isDef(key)) { map[key] = i; }
  4120. }
  4121. return map
  4122. }
  4123. function createPatchFunction (backend) {
  4124. var i, j;
  4125. var cbs = {};
  4126. var modules = backend.modules;
  4127. var nodeOps = backend.nodeOps;
  4128. for (i = 0; i < hooks.length; ++i) {
  4129. cbs[hooks[i]] = [];
  4130. for (j = 0; j < modules.length; ++j) {
  4131. if (isDef(modules[j][hooks[i]])) {
  4132. cbs[hooks[i]].push(modules[j][hooks[i]]);
  4133. }
  4134. }
  4135. }
  4136. function emptyNodeAt (elm) {
  4137. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  4138. }
  4139. function createRmCb (childElm, listeners) {
  4140. function remove$$1 () {
  4141. if (--remove$$1.listeners === 0) {
  4142. removeNode(childElm);
  4143. }
  4144. }
  4145. remove$$1.listeners = listeners;
  4146. return remove$$1
  4147. }
  4148. function removeNode (el) {
  4149. var parent = nodeOps.parentNode(el);
  4150. // element may have already been removed due to v-html / v-text
  4151. if (isDef(parent)) {
  4152. nodeOps.removeChild(parent, el);
  4153. }
  4154. }
  4155. var inPre = 0;
  4156. function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
  4157. vnode.isRootInsert = !nested; // for transition enter check
  4158. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  4159. return
  4160. }
  4161. var data = vnode.data;
  4162. var children = vnode.children;
  4163. var tag = vnode.tag;
  4164. if (isDef(tag)) {
  4165. {
  4166. if (data && data.pre) {
  4167. inPre++;
  4168. }
  4169. if (
  4170. !inPre &&
  4171. !vnode.ns &&
  4172. !(config.ignoredElements.length && config.ignoredElements.indexOf(tag) > -1) &&
  4173. config.isUnknownElement(tag)
  4174. ) {
  4175. warn(
  4176. 'Unknown custom element: <' + tag + '> - did you ' +
  4177. 'register the component correctly? For recursive components, ' +
  4178. 'make sure to provide the "name" option.',
  4179. vnode.context
  4180. );
  4181. }
  4182. }
  4183. vnode.elm = vnode.ns
  4184. ? nodeOps.createElementNS(vnode.ns, tag)
  4185. : nodeOps.createElement(tag, vnode);
  4186. setScope(vnode);
  4187. /* istanbul ignore if */
  4188. {
  4189. createChildren(vnode, children, insertedVnodeQueue);
  4190. if (isDef(data)) {
  4191. invokeCreateHooks(vnode, insertedVnodeQueue);
  4192. }
  4193. insert(parentElm, vnode.elm, refElm);
  4194. }
  4195. if ("development" !== 'production' && data && data.pre) {
  4196. inPre--;
  4197. }
  4198. } else if (isTrue(vnode.isComment)) {
  4199. vnode.elm = nodeOps.createComment(vnode.text);
  4200. insert(parentElm, vnode.elm, refElm);
  4201. } else {
  4202. vnode.elm = nodeOps.createTextNode(vnode.text);
  4203. insert(parentElm, vnode.elm, refElm);
  4204. }
  4205. }
  4206. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  4207. var i = vnode.data;
  4208. if (isDef(i)) {
  4209. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  4210. if (isDef(i = i.hook) && isDef(i = i.init)) {
  4211. i(vnode, false /* hydrating */, parentElm, refElm);
  4212. }
  4213. // after calling the init hook, if the vnode is a child component
  4214. // it should've created a child instance and mounted it. the child
  4215. // component also has set the placeholder vnode's elm.
  4216. // in that case we can just return the element and be done.
  4217. if (isDef(vnode.componentInstance)) {
  4218. initComponent(vnode, insertedVnodeQueue);
  4219. if (isTrue(isReactivated)) {
  4220. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  4221. }
  4222. return true
  4223. }
  4224. }
  4225. }
  4226. function initComponent (vnode, insertedVnodeQueue) {
  4227. if (isDef(vnode.data.pendingInsert)) {
  4228. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  4229. }
  4230. vnode.elm = vnode.componentInstance.$el;
  4231. if (isPatchable(vnode)) {
  4232. invokeCreateHooks(vnode, insertedVnodeQueue);
  4233. setScope(vnode);
  4234. } else {
  4235. // empty component root.
  4236. // skip all element-related modules except for ref (#3455)
  4237. registerRef(vnode);
  4238. // make sure to invoke the insert hook
  4239. insertedVnodeQueue.push(vnode);
  4240. }
  4241. }
  4242. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  4243. var i;
  4244. // hack for #4339: a reactivated component with inner transition
  4245. // does not trigger because the inner node's created hooks are not called
  4246. // again. It's not ideal to involve module-specific logic in here but
  4247. // there doesn't seem to be a better way to do it.
  4248. var innerNode = vnode;
  4249. while (innerNode.componentInstance) {
  4250. innerNode = innerNode.componentInstance._vnode;
  4251. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  4252. for (i = 0; i < cbs.activate.length; ++i) {
  4253. cbs.activate[i](emptyNode, innerNode);
  4254. }
  4255. insertedVnodeQueue.push(innerNode);
  4256. break
  4257. }
  4258. }
  4259. // unlike a newly created component,
  4260. // a reactivated keep-alive component doesn't insert itself
  4261. insert(parentElm, vnode.elm, refElm);
  4262. }
  4263. function insert (parent, elm, ref) {
  4264. if (isDef(parent)) {
  4265. if (isDef(ref)) {
  4266. nodeOps.insertBefore(parent, elm, ref);
  4267. } else {
  4268. nodeOps.appendChild(parent, elm);
  4269. }
  4270. }
  4271. }
  4272. function createChildren (vnode, children, insertedVnodeQueue) {
  4273. if (Array.isArray(children)) {
  4274. for (var i = 0; i < children.length; ++i) {
  4275. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true);
  4276. }
  4277. } else if (isPrimitive(vnode.text)) {
  4278. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(vnode.text));
  4279. }
  4280. }
  4281. function isPatchable (vnode) {
  4282. while (vnode.componentInstance) {
  4283. vnode = vnode.componentInstance._vnode;
  4284. }
  4285. return isDef(vnode.tag)
  4286. }
  4287. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  4288. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  4289. cbs.create[i$1](emptyNode, vnode);
  4290. }
  4291. i = vnode.data.hook; // Reuse variable
  4292. if (isDef(i)) {
  4293. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  4294. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  4295. }
  4296. }
  4297. // set scope id attribute for scoped CSS.
  4298. // this is implemented as a special case to avoid the overhead
  4299. // of going through the normal attribute patching process.
  4300. function setScope (vnode) {
  4301. var i;
  4302. var ancestor = vnode;
  4303. while (ancestor) {
  4304. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  4305. nodeOps.setAttribute(vnode.elm, i, '');
  4306. }
  4307. ancestor = ancestor.parent;
  4308. }
  4309. // for slot content they should also get the scopeId from the host instance.
  4310. if (isDef(i = activeInstance) &&
  4311. i !== vnode.context &&
  4312. isDef(i = i.$options._scopeId)) {
  4313. nodeOps.setAttribute(vnode.elm, i, '');
  4314. }
  4315. }
  4316. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  4317. for (; startIdx <= endIdx; ++startIdx) {
  4318. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm);
  4319. }
  4320. }
  4321. function invokeDestroyHook (vnode) {
  4322. var i, j;
  4323. var data = vnode.data;
  4324. if (isDef(data)) {
  4325. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  4326. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  4327. }
  4328. if (isDef(i = vnode.children)) {
  4329. for (j = 0; j < vnode.children.length; ++j) {
  4330. invokeDestroyHook(vnode.children[j]);
  4331. }
  4332. }
  4333. }
  4334. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  4335. for (; startIdx <= endIdx; ++startIdx) {
  4336. var ch = vnodes[startIdx];
  4337. if (isDef(ch)) {
  4338. if (isDef(ch.tag)) {
  4339. removeAndInvokeRemoveHook(ch);
  4340. invokeDestroyHook(ch);
  4341. } else { // Text node
  4342. removeNode(ch.elm);
  4343. }
  4344. }
  4345. }
  4346. }
  4347. function removeAndInvokeRemoveHook (vnode, rm) {
  4348. if (isDef(rm) || isDef(vnode.data)) {
  4349. var listeners = cbs.remove.length + 1;
  4350. if (isDef(rm)) {
  4351. // we have a recursively passed down rm callback
  4352. // increase the listeners count
  4353. rm.listeners += listeners;
  4354. } else {
  4355. // directly removing
  4356. rm = createRmCb(vnode.elm, listeners);
  4357. }
  4358. // recursively invoke hooks on child component root node
  4359. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  4360. removeAndInvokeRemoveHook(i, rm);
  4361. }
  4362. for (i = 0; i < cbs.remove.length; ++i) {
  4363. cbs.remove[i](vnode, rm);
  4364. }
  4365. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  4366. i(vnode, rm);
  4367. } else {
  4368. rm();
  4369. }
  4370. } else {
  4371. removeNode(vnode.elm);
  4372. }
  4373. }
  4374. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  4375. var oldStartIdx = 0;
  4376. var newStartIdx = 0;
  4377. var oldEndIdx = oldCh.length - 1;
  4378. var oldStartVnode = oldCh[0];
  4379. var oldEndVnode = oldCh[oldEndIdx];
  4380. var newEndIdx = newCh.length - 1;
  4381. var newStartVnode = newCh[0];
  4382. var newEndVnode = newCh[newEndIdx];
  4383. var oldKeyToIdx, idxInOld, elmToMove, refElm;
  4384. // removeOnly is a special flag used only by <transition-group>
  4385. // to ensure removed elements stay in correct relative positions
  4386. // during leaving transitions
  4387. var canMove = !removeOnly;
  4388. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  4389. if (isUndef(oldStartVnode)) {
  4390. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  4391. } else if (isUndef(oldEndVnode)) {
  4392. oldEndVnode = oldCh[--oldEndIdx];
  4393. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  4394. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
  4395. oldStartVnode = oldCh[++oldStartIdx];
  4396. newStartVnode = newCh[++newStartIdx];
  4397. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  4398. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
  4399. oldEndVnode = oldCh[--oldEndIdx];
  4400. newEndVnode = newCh[--newEndIdx];
  4401. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  4402. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
  4403. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  4404. oldStartVnode = oldCh[++oldStartIdx];
  4405. newEndVnode = newCh[--newEndIdx];
  4406. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  4407. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
  4408. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  4409. oldEndVnode = oldCh[--oldEndIdx];
  4410. newStartVnode = newCh[++newStartIdx];
  4411. } else {
  4412. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  4413. idxInOld = isDef(newStartVnode.key) ? oldKeyToIdx[newStartVnode.key] : null;
  4414. if (isUndef(idxInOld)) { // New element
  4415. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  4416. newStartVnode = newCh[++newStartIdx];
  4417. } else {
  4418. elmToMove = oldCh[idxInOld];
  4419. /* istanbul ignore if */
  4420. if ("development" !== 'production' && !elmToMove) {
  4421. warn(
  4422. 'It seems there are duplicate keys that is causing an update error. ' +
  4423. 'Make sure each v-for item has a unique key.'
  4424. );
  4425. }
  4426. if (sameVnode(elmToMove, newStartVnode)) {
  4427. patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
  4428. oldCh[idxInOld] = undefined;
  4429. canMove && nodeOps.insertBefore(parentElm, newStartVnode.elm, oldStartVnode.elm);
  4430. newStartVnode = newCh[++newStartIdx];
  4431. } else {
  4432. // same key but different element. treat as new element
  4433. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  4434. newStartVnode = newCh[++newStartIdx];
  4435. }
  4436. }
  4437. }
  4438. }
  4439. if (oldStartIdx > oldEndIdx) {
  4440. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  4441. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  4442. } else if (newStartIdx > newEndIdx) {
  4443. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  4444. }
  4445. }
  4446. function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
  4447. if (oldVnode === vnode) {
  4448. return
  4449. }
  4450. // reuse element for static trees.
  4451. // note we only do this if the vnode is cloned -
  4452. // if the new node is not cloned it means the render functions have been
  4453. // reset by the hot-reload-api and we need to do a proper re-render.
  4454. if (isTrue(vnode.isStatic) &&
  4455. isTrue(oldVnode.isStatic) &&
  4456. vnode.key === oldVnode.key &&
  4457. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))) {
  4458. vnode.elm = oldVnode.elm;
  4459. vnode.componentInstance = oldVnode.componentInstance;
  4460. return
  4461. }
  4462. var i;
  4463. var data = vnode.data;
  4464. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  4465. i(oldVnode, vnode);
  4466. }
  4467. var elm = vnode.elm = oldVnode.elm;
  4468. var oldCh = oldVnode.children;
  4469. var ch = vnode.children;
  4470. if (isDef(data) && isPatchable(vnode)) {
  4471. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  4472. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  4473. }
  4474. if (isUndef(vnode.text)) {
  4475. if (isDef(oldCh) && isDef(ch)) {
  4476. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  4477. } else if (isDef(ch)) {
  4478. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  4479. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  4480. } else if (isDef(oldCh)) {
  4481. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  4482. } else if (isDef(oldVnode.text)) {
  4483. nodeOps.setTextContent(elm, '');
  4484. }
  4485. } else if (oldVnode.text !== vnode.text) {
  4486. nodeOps.setTextContent(elm, vnode.text);
  4487. }
  4488. if (isDef(data)) {
  4489. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  4490. }
  4491. }
  4492. function invokeInsertHook (vnode, queue, initial) {
  4493. // delay insert hooks for component root nodes, invoke them after the
  4494. // element is really inserted
  4495. if (isTrue(initial) && isDef(vnode.parent)) {
  4496. vnode.parent.data.pendingInsert = queue;
  4497. } else {
  4498. for (var i = 0; i < queue.length; ++i) {
  4499. queue[i].data.hook.insert(queue[i]);
  4500. }
  4501. }
  4502. }
  4503. var bailed = false;
  4504. // list of modules that can skip create hook during hydration because they
  4505. // are already rendered on the client or has no need for initialization
  4506. var isRenderedModule = makeMap('attrs,style,class,staticClass,staticStyle,key');
  4507. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  4508. function hydrate (elm, vnode, insertedVnodeQueue) {
  4509. {
  4510. if (!assertNodeMatch(elm, vnode)) {
  4511. return false
  4512. }
  4513. }
  4514. vnode.elm = elm;
  4515. var tag = vnode.tag;
  4516. var data = vnode.data;
  4517. var children = vnode.children;
  4518. if (isDef(data)) {
  4519. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  4520. if (isDef(i = vnode.componentInstance)) {
  4521. // child component. it should have hydrated its own tree.
  4522. initComponent(vnode, insertedVnodeQueue);
  4523. return true
  4524. }
  4525. }
  4526. if (isDef(tag)) {
  4527. if (isDef(children)) {
  4528. // empty element, allow client to pick up and populate children
  4529. if (!elm.hasChildNodes()) {
  4530. createChildren(vnode, children, insertedVnodeQueue);
  4531. } else {
  4532. var childrenMatch = true;
  4533. var childNode = elm.firstChild;
  4534. for (var i$1 = 0; i$1 < children.length; i$1++) {
  4535. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue)) {
  4536. childrenMatch = false;
  4537. break
  4538. }
  4539. childNode = childNode.nextSibling;
  4540. }
  4541. // if childNode is not null, it means the actual childNodes list is
  4542. // longer than the virtual children list.
  4543. if (!childrenMatch || childNode) {
  4544. if ("development" !== 'production' &&
  4545. typeof console !== 'undefined' &&
  4546. !bailed) {
  4547. bailed = true;
  4548. console.warn('Parent: ', elm);
  4549. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  4550. }
  4551. return false
  4552. }
  4553. }
  4554. }
  4555. if (isDef(data)) {
  4556. for (var key in data) {
  4557. if (!isRenderedModule(key)) {
  4558. invokeCreateHooks(vnode, insertedVnodeQueue);
  4559. break
  4560. }
  4561. }
  4562. }
  4563. } else if (elm.data !== vnode.text) {
  4564. elm.data = vnode.text;
  4565. }
  4566. return true
  4567. }
  4568. function assertNodeMatch (node, vnode) {
  4569. if (isDef(vnode.tag)) {
  4570. return (
  4571. vnode.tag.indexOf('vue-component') === 0 ||
  4572. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  4573. )
  4574. } else {
  4575. return node.nodeType === (vnode.isComment ? 8 : 3)
  4576. }
  4577. }
  4578. return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) {
  4579. if (isUndef(vnode)) {
  4580. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  4581. return
  4582. }
  4583. var isInitialPatch = false;
  4584. var insertedVnodeQueue = [];
  4585. if (isUndef(oldVnode)) {
  4586. // empty mount (likely as component), create new root element
  4587. isInitialPatch = true;
  4588. createElm(vnode, insertedVnodeQueue, parentElm, refElm);
  4589. } else {
  4590. var isRealElement = isDef(oldVnode.nodeType);
  4591. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  4592. // patch existing root node
  4593. patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
  4594. } else {
  4595. if (isRealElement) {
  4596. // mounting to a real element
  4597. // check if this is server-rendered content and if we can perform
  4598. // a successful hydration.
  4599. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute('server-rendered')) {
  4600. oldVnode.removeAttribute('server-rendered');
  4601. hydrating = true;
  4602. }
  4603. if (isTrue(hydrating)) {
  4604. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  4605. invokeInsertHook(vnode, insertedVnodeQueue, true);
  4606. return oldVnode
  4607. } else {
  4608. warn(
  4609. 'The client-side rendered virtual DOM tree is not matching ' +
  4610. 'server-rendered content. This is likely caused by incorrect ' +
  4611. 'HTML markup, for example nesting block-level elements inside ' +
  4612. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  4613. 'full client-side render.'
  4614. );
  4615. }
  4616. }
  4617. // either not server-rendered, or hydration failed.
  4618. // create an empty node and replace it
  4619. oldVnode = emptyNodeAt(oldVnode);
  4620. }
  4621. // replacing existing element
  4622. var oldElm = oldVnode.elm;
  4623. var parentElm$1 = nodeOps.parentNode(oldElm);
  4624. createElm(
  4625. vnode,
  4626. insertedVnodeQueue,
  4627. // extremely rare edge case: do not insert if old element is in a
  4628. // leaving transition. Only happens when combining transition +
  4629. // keep-alive + HOCs. (#4590)
  4630. oldElm._leaveCb ? null : parentElm$1,
  4631. nodeOps.nextSibling(oldElm)
  4632. );
  4633. if (isDef(vnode.parent)) {
  4634. // component root element replaced.
  4635. // update parent placeholder node element, recursively
  4636. var ancestor = vnode.parent;
  4637. while (ancestor) {
  4638. ancestor.elm = vnode.elm;
  4639. ancestor = ancestor.parent;
  4640. }
  4641. if (isPatchable(vnode)) {
  4642. for (var i = 0; i < cbs.create.length; ++i) {
  4643. cbs.create[i](emptyNode, vnode.parent);
  4644. }
  4645. }
  4646. }
  4647. if (isDef(parentElm$1)) {
  4648. removeVnodes(parentElm$1, [oldVnode], 0, 0);
  4649. } else if (isDef(oldVnode.tag)) {
  4650. invokeDestroyHook(oldVnode);
  4651. }
  4652. }
  4653. }
  4654. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  4655. return vnode.elm
  4656. }
  4657. }
  4658. /* */
  4659. var directives = {
  4660. create: updateDirectives,
  4661. update: updateDirectives,
  4662. destroy: function unbindDirectives (vnode) {
  4663. updateDirectives(vnode, emptyNode);
  4664. }
  4665. };
  4666. function updateDirectives (oldVnode, vnode) {
  4667. if (oldVnode.data.directives || vnode.data.directives) {
  4668. _update(oldVnode, vnode);
  4669. }
  4670. }
  4671. function _update (oldVnode, vnode) {
  4672. var isCreate = oldVnode === emptyNode;
  4673. var isDestroy = vnode === emptyNode;
  4674. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  4675. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  4676. var dirsWithInsert = [];
  4677. var dirsWithPostpatch = [];
  4678. var key, oldDir, dir;
  4679. for (key in newDirs) {
  4680. oldDir = oldDirs[key];
  4681. dir = newDirs[key];
  4682. if (!oldDir) {
  4683. // new directive, bind
  4684. callHook$1(dir, 'bind', vnode, oldVnode);
  4685. if (dir.def && dir.def.inserted) {
  4686. dirsWithInsert.push(dir);
  4687. }
  4688. } else {
  4689. // existing directive, update
  4690. dir.oldValue = oldDir.value;
  4691. callHook$1(dir, 'update', vnode, oldVnode);
  4692. if (dir.def && dir.def.componentUpdated) {
  4693. dirsWithPostpatch.push(dir);
  4694. }
  4695. }
  4696. }
  4697. if (dirsWithInsert.length) {
  4698. var callInsert = function () {
  4699. for (var i = 0; i < dirsWithInsert.length; i++) {
  4700. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  4701. }
  4702. };
  4703. if (isCreate) {
  4704. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', callInsert);
  4705. } else {
  4706. callInsert();
  4707. }
  4708. }
  4709. if (dirsWithPostpatch.length) {
  4710. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'postpatch', function () {
  4711. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  4712. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  4713. }
  4714. });
  4715. }
  4716. if (!isCreate) {
  4717. for (key in oldDirs) {
  4718. if (!newDirs[key]) {
  4719. // no longer present, unbind
  4720. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  4721. }
  4722. }
  4723. }
  4724. }
  4725. var emptyModifiers = Object.create(null);
  4726. function normalizeDirectives$1 (
  4727. dirs,
  4728. vm
  4729. ) {
  4730. var res = Object.create(null);
  4731. if (!dirs) {
  4732. return res
  4733. }
  4734. var i, dir;
  4735. for (i = 0; i < dirs.length; i++) {
  4736. dir = dirs[i];
  4737. if (!dir.modifiers) {
  4738. dir.modifiers = emptyModifiers;
  4739. }
  4740. res[getRawDirName(dir)] = dir;
  4741. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  4742. }
  4743. return res
  4744. }
  4745. function getRawDirName (dir) {
  4746. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  4747. }
  4748. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  4749. var fn = dir.def && dir.def[hook];
  4750. if (fn) {
  4751. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  4752. }
  4753. }
  4754. var baseModules = [
  4755. ref,
  4756. directives
  4757. ];
  4758. /* */
  4759. function updateAttrs (oldVnode, vnode) {
  4760. if (!oldVnode.data.attrs && !vnode.data.attrs) {
  4761. return
  4762. }
  4763. var key, cur, old;
  4764. var elm = vnode.elm;
  4765. var oldAttrs = oldVnode.data.attrs || {};
  4766. var attrs = vnode.data.attrs || {};
  4767. // clone observed objects, as the user probably wants to mutate it
  4768. if (attrs.__ob__) {
  4769. attrs = vnode.data.attrs = extend({}, attrs);
  4770. }
  4771. for (key in attrs) {
  4772. cur = attrs[key];
  4773. old = oldAttrs[key];
  4774. if (old !== cur) {
  4775. setAttr(elm, key, cur);
  4776. }
  4777. }
  4778. // #4391: in IE9, setting type can reset value for input[type=radio]
  4779. /* istanbul ignore if */
  4780. if (isIE9 && attrs.value !== oldAttrs.value) {
  4781. setAttr(elm, 'value', attrs.value);
  4782. }
  4783. for (key in oldAttrs) {
  4784. if (attrs[key] == null) {
  4785. if (isXlink(key)) {
  4786. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  4787. } else if (!isEnumeratedAttr(key)) {
  4788. elm.removeAttribute(key);
  4789. }
  4790. }
  4791. }
  4792. }
  4793. function setAttr (el, key, value) {
  4794. if (isBooleanAttr(key)) {
  4795. // set attribute for blank value
  4796. // e.g. <option disabled>Select one</option>
  4797. if (isFalsyAttrValue(value)) {
  4798. el.removeAttribute(key);
  4799. } else {
  4800. el.setAttribute(key, key);
  4801. }
  4802. } else if (isEnumeratedAttr(key)) {
  4803. el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
  4804. } else if (isXlink(key)) {
  4805. if (isFalsyAttrValue(value)) {
  4806. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  4807. } else {
  4808. el.setAttributeNS(xlinkNS, key, value);
  4809. }
  4810. } else {
  4811. if (isFalsyAttrValue(value)) {
  4812. el.removeAttribute(key);
  4813. } else {
  4814. el.setAttribute(key, value);
  4815. }
  4816. }
  4817. }
  4818. var attrs = {
  4819. create: updateAttrs,
  4820. update: updateAttrs
  4821. };
  4822. /* */
  4823. function updateClass (oldVnode, vnode) {
  4824. var el = vnode.elm;
  4825. var data = vnode.data;
  4826. var oldData = oldVnode.data;
  4827. if (!data.staticClass && !data.class &&
  4828. (!oldData || (!oldData.staticClass && !oldData.class))) {
  4829. return
  4830. }
  4831. var cls = genClassForVnode(vnode);
  4832. // handle transition classes
  4833. var transitionClass = el._transitionClasses;
  4834. if (transitionClass) {
  4835. cls = concat(cls, stringifyClass(transitionClass));
  4836. }
  4837. // set the class
  4838. if (cls !== el._prevClass) {
  4839. el.setAttribute('class', cls);
  4840. el._prevClass = cls;
  4841. }
  4842. }
  4843. var klass = {
  4844. create: updateClass,
  4845. update: updateClass
  4846. };
  4847. /* */
  4848. var validDivisionCharRE = /[\w).+\-_$\]]/;
  4849. function wrapFilter (exp, filter) {
  4850. var i = filter.indexOf('(');
  4851. if (i < 0) {
  4852. // _f: resolveFilter
  4853. return ("_f(\"" + filter + "\")(" + exp + ")")
  4854. } else {
  4855. var name = filter.slice(0, i);
  4856. var args = filter.slice(i + 1);
  4857. return ("_f(\"" + name + "\")(" + exp + "," + args)
  4858. }
  4859. }
  4860. /* */
  4861. /* */
  4862. /**
  4863. * Cross-platform code generation for component v-model
  4864. */
  4865. /**
  4866. * Cross-platform codegen helper for generating v-model value assignment code.
  4867. */
  4868. /**
  4869. * parse directive model to do the array update transform. a[idx] = val => $$a.splice($$idx, 1, val)
  4870. *
  4871. * for loop possible cases:
  4872. *
  4873. * - test
  4874. * - test[idx]
  4875. * - test[test1[idx]]
  4876. * - test["a"][idx]
  4877. * - xxx.test[a[a].test1[idx]]
  4878. * - test.xxx.a["asa"][test1[idx]]
  4879. *
  4880. */
  4881. var str;
  4882. var index$1;
  4883. /* */
  4884. // in some cases, the event used has to be determined at runtime
  4885. // so we used some reserved tokens during compile.
  4886. var RANGE_TOKEN = '__r';
  4887. var CHECKBOX_RADIO_TOKEN = '__c';
  4888. /* */
  4889. // normalize v-model event tokens that can only be determined at runtime.
  4890. // it's important to place the event as the first in the array because
  4891. // the whole point is ensuring the v-model callback gets called before
  4892. // user-attached handlers.
  4893. function normalizeEvents (on) {
  4894. var event;
  4895. /* istanbul ignore if */
  4896. if (on[RANGE_TOKEN]) {
  4897. // IE input[type=range] only supports `change` event
  4898. event = isIE ? 'change' : 'input';
  4899. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  4900. delete on[RANGE_TOKEN];
  4901. }
  4902. if (on[CHECKBOX_RADIO_TOKEN]) {
  4903. // Chrome fires microtasks in between click/change, leads to #4521
  4904. event = isChrome ? 'click' : 'change';
  4905. on[event] = [].concat(on[CHECKBOX_RADIO_TOKEN], on[event] || []);
  4906. delete on[CHECKBOX_RADIO_TOKEN];
  4907. }
  4908. }
  4909. var target$1;
  4910. function add$1 (
  4911. event,
  4912. handler,
  4913. once,
  4914. capture
  4915. ) {
  4916. if (once) {
  4917. var oldHandler = handler;
  4918. var _target = target$1; // save current target element in closure
  4919. handler = function (ev) {
  4920. var res = arguments.length === 1
  4921. ? oldHandler(ev)
  4922. : oldHandler.apply(null, arguments);
  4923. if (res !== null) {
  4924. remove$2(event, handler, capture, _target);
  4925. }
  4926. };
  4927. }
  4928. target$1.addEventListener(event, handler, capture);
  4929. }
  4930. function remove$2 (
  4931. event,
  4932. handler,
  4933. capture,
  4934. _target
  4935. ) {
  4936. (_target || target$1).removeEventListener(event, handler, capture);
  4937. }
  4938. function updateDOMListeners (oldVnode, vnode) {
  4939. if (!oldVnode.data.on && !vnode.data.on) {
  4940. return
  4941. }
  4942. var on = vnode.data.on || {};
  4943. var oldOn = oldVnode.data.on || {};
  4944. target$1 = vnode.elm;
  4945. normalizeEvents(on);
  4946. updateListeners(on, oldOn, add$1, remove$2, vnode.context);
  4947. }
  4948. var events = {
  4949. create: updateDOMListeners,
  4950. update: updateDOMListeners
  4951. };
  4952. /* */
  4953. function updateDOMProps (oldVnode, vnode) {
  4954. if (!oldVnode.data.domProps && !vnode.data.domProps) {
  4955. return
  4956. }
  4957. var key, cur;
  4958. var elm = vnode.elm;
  4959. var oldProps = oldVnode.data.domProps || {};
  4960. var props = vnode.data.domProps || {};
  4961. // clone observed objects, as the user probably wants to mutate it
  4962. if (props.__ob__) {
  4963. props = vnode.data.domProps = extend({}, props);
  4964. }
  4965. for (key in oldProps) {
  4966. if (props[key] == null) {
  4967. elm[key] = '';
  4968. }
  4969. }
  4970. for (key in props) {
  4971. cur = props[key];
  4972. // ignore children if the node has textContent or innerHTML,
  4973. // as these will throw away existing DOM nodes and cause removal errors
  4974. // on subsequent patches (#3360)
  4975. if (key === 'textContent' || key === 'innerHTML') {
  4976. if (vnode.children) { vnode.children.length = 0; }
  4977. if (cur === oldProps[key]) { continue }
  4978. }
  4979. if (key === 'value') {
  4980. // store value as _value as well since
  4981. // non-string values will be stringified
  4982. elm._value = cur;
  4983. // avoid resetting cursor position when value is the same
  4984. var strCur = cur == null ? '' : String(cur);
  4985. if (shouldUpdateValue(elm, vnode, strCur)) {
  4986. elm.value = strCur;
  4987. }
  4988. } else {
  4989. elm[key] = cur;
  4990. }
  4991. }
  4992. }
  4993. // check platforms/web/util/attrs.js acceptValue
  4994. function shouldUpdateValue (
  4995. elm,
  4996. vnode,
  4997. checkVal
  4998. ) {
  4999. return (!elm.composing && (
  5000. vnode.tag === 'option' ||
  5001. isDirty(elm, checkVal) ||
  5002. isInputChanged(elm, checkVal)
  5003. ))
  5004. }
  5005. function isDirty (elm, checkVal) {
  5006. // return true when textbox (.number and .trim) loses focus and its value is not equal to the updated value
  5007. return document.activeElement !== elm && elm.value !== checkVal
  5008. }
  5009. function isInputChanged (elm, newVal) {
  5010. var value = elm.value;
  5011. var modifiers = elm._vModifiers; // injected by v-model runtime
  5012. if ((modifiers && modifiers.number) || elm.type === 'number') {
  5013. return toNumber(value) !== toNumber(newVal)
  5014. }
  5015. if (modifiers && modifiers.trim) {
  5016. return value.trim() !== newVal.trim()
  5017. }
  5018. return value !== newVal
  5019. }
  5020. var domProps = {
  5021. create: updateDOMProps,
  5022. update: updateDOMProps
  5023. };
  5024. /* */
  5025. var parseStyleText = cached(function (cssText) {
  5026. var res = {};
  5027. var listDelimiter = /;(?![^(]*\))/g;
  5028. var propertyDelimiter = /:(.+)/;
  5029. cssText.split(listDelimiter).forEach(function (item) {
  5030. if (item) {
  5031. var tmp = item.split(propertyDelimiter);
  5032. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  5033. }
  5034. });
  5035. return res
  5036. });
  5037. // merge static and dynamic style data on the same vnode
  5038. function normalizeStyleData (data) {
  5039. var style = normalizeStyleBinding(data.style);
  5040. // static style is pre-processed into an object during compilation
  5041. // and is always a fresh object, so it's safe to merge into it
  5042. return data.staticStyle
  5043. ? extend(data.staticStyle, style)
  5044. : style
  5045. }
  5046. // normalize possible array / string values into Object
  5047. function normalizeStyleBinding (bindingStyle) {
  5048. if (Array.isArray(bindingStyle)) {
  5049. return toObject(bindingStyle)
  5050. }
  5051. if (typeof bindingStyle === 'string') {
  5052. return parseStyleText(bindingStyle)
  5053. }
  5054. return bindingStyle
  5055. }
  5056. /**
  5057. * parent component style should be after child's
  5058. * so that parent component's style could override it
  5059. */
  5060. function getStyle (vnode, checkChild) {
  5061. var res = {};
  5062. var styleData;
  5063. if (checkChild) {
  5064. var childNode = vnode;
  5065. while (childNode.componentInstance) {
  5066. childNode = childNode.componentInstance._vnode;
  5067. if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
  5068. extend(res, styleData);
  5069. }
  5070. }
  5071. }
  5072. if ((styleData = normalizeStyleData(vnode.data))) {
  5073. extend(res, styleData);
  5074. }
  5075. var parentNode = vnode;
  5076. while ((parentNode = parentNode.parent)) {
  5077. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  5078. extend(res, styleData);
  5079. }
  5080. }
  5081. return res
  5082. }
  5083. /* */
  5084. var cssVarRE = /^--/;
  5085. var importantRE = /\s*!important$/;
  5086. var setProp = function (el, name, val) {
  5087. /* istanbul ignore if */
  5088. if (cssVarRE.test(name)) {
  5089. el.style.setProperty(name, val);
  5090. } else if (importantRE.test(val)) {
  5091. el.style.setProperty(name, val.replace(importantRE, ''), 'important');
  5092. } else {
  5093. el.style[normalize(name)] = val;
  5094. }
  5095. };
  5096. var prefixes = ['Webkit', 'Moz', 'ms'];
  5097. var testEl;
  5098. var normalize = cached(function (prop) {
  5099. testEl = testEl || document.createElement('div');
  5100. prop = camelize(prop);
  5101. if (prop !== 'filter' && (prop in testEl.style)) {
  5102. return prop
  5103. }
  5104. var upper = prop.charAt(0).toUpperCase() + prop.slice(1);
  5105. for (var i = 0; i < prefixes.length; i++) {
  5106. var prefixed = prefixes[i] + upper;
  5107. if (prefixed in testEl.style) {
  5108. return prefixed
  5109. }
  5110. }
  5111. });
  5112. function updateStyle (oldVnode, vnode) {
  5113. var data = vnode.data;
  5114. var oldData = oldVnode.data;
  5115. if (!data.staticStyle && !data.style &&
  5116. !oldData.staticStyle && !oldData.style) {
  5117. return
  5118. }
  5119. var cur, name;
  5120. var el = vnode.elm;
  5121. var oldStaticStyle = oldVnode.data.staticStyle;
  5122. var oldStyleBinding = oldVnode.data.style || {};
  5123. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  5124. var oldStyle = oldStaticStyle || oldStyleBinding;
  5125. var style = normalizeStyleBinding(vnode.data.style) || {};
  5126. vnode.data.style = style.__ob__ ? extend({}, style) : style;
  5127. var newStyle = getStyle(vnode, true);
  5128. for (name in oldStyle) {
  5129. if (newStyle[name] == null) {
  5130. setProp(el, name, '');
  5131. }
  5132. }
  5133. for (name in newStyle) {
  5134. cur = newStyle[name];
  5135. if (cur !== oldStyle[name]) {
  5136. // ie9 setting to null has no effect, must use empty string
  5137. setProp(el, name, cur == null ? '' : cur);
  5138. }
  5139. }
  5140. }
  5141. var style = {
  5142. create: updateStyle,
  5143. update: updateStyle
  5144. };
  5145. /* */
  5146. /**
  5147. * Add class with compatibility for SVG since classList is not supported on
  5148. * SVG elements in IE
  5149. */
  5150. function addClass (el, cls) {
  5151. /* istanbul ignore if */
  5152. if (!cls || !(cls = cls.trim())) {
  5153. return
  5154. }
  5155. /* istanbul ignore else */
  5156. if (el.classList) {
  5157. if (cls.indexOf(' ') > -1) {
  5158. cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
  5159. } else {
  5160. el.classList.add(cls);
  5161. }
  5162. } else {
  5163. var cur = " " + (el.getAttribute('class') || '') + " ";
  5164. if (cur.indexOf(' ' + cls + ' ') < 0) {
  5165. el.setAttribute('class', (cur + cls).trim());
  5166. }
  5167. }
  5168. }
  5169. /**
  5170. * Remove class with compatibility for SVG since classList is not supported on
  5171. * SVG elements in IE
  5172. */
  5173. function removeClass (el, cls) {
  5174. /* istanbul ignore if */
  5175. if (!cls || !(cls = cls.trim())) {
  5176. return
  5177. }
  5178. /* istanbul ignore else */
  5179. if (el.classList) {
  5180. if (cls.indexOf(' ') > -1) {
  5181. cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
  5182. } else {
  5183. el.classList.remove(cls);
  5184. }
  5185. } else {
  5186. var cur = " " + (el.getAttribute('class') || '') + " ";
  5187. var tar = ' ' + cls + ' ';
  5188. while (cur.indexOf(tar) >= 0) {
  5189. cur = cur.replace(tar, ' ');
  5190. }
  5191. el.setAttribute('class', cur.trim());
  5192. }
  5193. }
  5194. /* */
  5195. function resolveTransition (def$$1) {
  5196. if (!def$$1) {
  5197. return
  5198. }
  5199. /* istanbul ignore else */
  5200. if (typeof def$$1 === 'object') {
  5201. var res = {};
  5202. if (def$$1.css !== false) {
  5203. extend(res, autoCssTransition(def$$1.name || 'v'));
  5204. }
  5205. extend(res, def$$1);
  5206. return res
  5207. } else if (typeof def$$1 === 'string') {
  5208. return autoCssTransition(def$$1)
  5209. }
  5210. }
  5211. var autoCssTransition = cached(function (name) {
  5212. return {
  5213. enterClass: (name + "-enter"),
  5214. enterToClass: (name + "-enter-to"),
  5215. enterActiveClass: (name + "-enter-active"),
  5216. leaveClass: (name + "-leave"),
  5217. leaveToClass: (name + "-leave-to"),
  5218. leaveActiveClass: (name + "-leave-active")
  5219. }
  5220. });
  5221. var hasTransition = inBrowser && !isIE9;
  5222. var TRANSITION = 'transition';
  5223. var ANIMATION = 'animation';
  5224. // Transition property/event sniffing
  5225. var transitionProp = 'transition';
  5226. var transitionEndEvent = 'transitionend';
  5227. var animationProp = 'animation';
  5228. var animationEndEvent = 'animationend';
  5229. if (hasTransition) {
  5230. /* istanbul ignore if */
  5231. if (window.ontransitionend === undefined &&
  5232. window.onwebkittransitionend !== undefined) {
  5233. transitionProp = 'WebkitTransition';
  5234. transitionEndEvent = 'webkitTransitionEnd';
  5235. }
  5236. if (window.onanimationend === undefined &&
  5237. window.onwebkitanimationend !== undefined) {
  5238. animationProp = 'WebkitAnimation';
  5239. animationEndEvent = 'webkitAnimationEnd';
  5240. }
  5241. }
  5242. // binding to window is necessary to make hot reload work in IE in strict mode
  5243. var raf = inBrowser && window.requestAnimationFrame
  5244. ? window.requestAnimationFrame.bind(window)
  5245. : setTimeout;
  5246. function nextFrame (fn) {
  5247. raf(function () {
  5248. raf(fn);
  5249. });
  5250. }
  5251. function addTransitionClass (el, cls) {
  5252. (el._transitionClasses || (el._transitionClasses = [])).push(cls);
  5253. addClass(el, cls);
  5254. }
  5255. function removeTransitionClass (el, cls) {
  5256. if (el._transitionClasses) {
  5257. remove(el._transitionClasses, cls);
  5258. }
  5259. removeClass(el, cls);
  5260. }
  5261. function whenTransitionEnds (
  5262. el,
  5263. expectedType,
  5264. cb
  5265. ) {
  5266. var ref = getTransitionInfo(el, expectedType);
  5267. var type = ref.type;
  5268. var timeout = ref.timeout;
  5269. var propCount = ref.propCount;
  5270. if (!type) { return cb() }
  5271. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  5272. var ended = 0;
  5273. var end = function () {
  5274. el.removeEventListener(event, onEnd);
  5275. cb();
  5276. };
  5277. var onEnd = function (e) {
  5278. if (e.target === el) {
  5279. if (++ended >= propCount) {
  5280. end();
  5281. }
  5282. }
  5283. };
  5284. setTimeout(function () {
  5285. if (ended < propCount) {
  5286. end();
  5287. }
  5288. }, timeout + 1);
  5289. el.addEventListener(event, onEnd);
  5290. }
  5291. var transformRE = /\b(transform|all)(,|$)/;
  5292. function getTransitionInfo (el, expectedType) {
  5293. var styles = window.getComputedStyle(el);
  5294. var transitionDelays = styles[transitionProp + 'Delay'].split(', ');
  5295. var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
  5296. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  5297. var animationDelays = styles[animationProp + 'Delay'].split(', ');
  5298. var animationDurations = styles[animationProp + 'Duration'].split(', ');
  5299. var animationTimeout = getTimeout(animationDelays, animationDurations);
  5300. var type;
  5301. var timeout = 0;
  5302. var propCount = 0;
  5303. /* istanbul ignore if */
  5304. if (expectedType === TRANSITION) {
  5305. if (transitionTimeout > 0) {
  5306. type = TRANSITION;
  5307. timeout = transitionTimeout;
  5308. propCount = transitionDurations.length;
  5309. }
  5310. } else if (expectedType === ANIMATION) {
  5311. if (animationTimeout > 0) {
  5312. type = ANIMATION;
  5313. timeout = animationTimeout;
  5314. propCount = animationDurations.length;
  5315. }
  5316. } else {
  5317. timeout = Math.max(transitionTimeout, animationTimeout);
  5318. type = timeout > 0
  5319. ? transitionTimeout > animationTimeout
  5320. ? TRANSITION
  5321. : ANIMATION
  5322. : null;
  5323. propCount = type
  5324. ? type === TRANSITION
  5325. ? transitionDurations.length
  5326. : animationDurations.length
  5327. : 0;
  5328. }
  5329. var hasTransform =
  5330. type === TRANSITION &&
  5331. transformRE.test(styles[transitionProp + 'Property']);
  5332. return {
  5333. type: type,
  5334. timeout: timeout,
  5335. propCount: propCount,
  5336. hasTransform: hasTransform
  5337. }
  5338. }
  5339. function getTimeout (delays, durations) {
  5340. /* istanbul ignore next */
  5341. while (delays.length < durations.length) {
  5342. delays = delays.concat(delays);
  5343. }
  5344. return Math.max.apply(null, durations.map(function (d, i) {
  5345. return toMs(d) + toMs(delays[i])
  5346. }))
  5347. }
  5348. function toMs (s) {
  5349. return Number(s.slice(0, -1)) * 1000
  5350. }
  5351. /* */
  5352. function enter (vnode, toggleDisplay) {
  5353. var el = vnode.elm;
  5354. // call leave callback now
  5355. if (el._leaveCb) {
  5356. el._leaveCb.cancelled = true;
  5357. el._leaveCb();
  5358. }
  5359. var data = resolveTransition(vnode.data.transition);
  5360. if (!data) {
  5361. return
  5362. }
  5363. /* istanbul ignore if */
  5364. if (el._enterCb || el.nodeType !== 1) {
  5365. return
  5366. }
  5367. var css = data.css;
  5368. var type = data.type;
  5369. var enterClass = data.enterClass;
  5370. var enterToClass = data.enterToClass;
  5371. var enterActiveClass = data.enterActiveClass;
  5372. var appearClass = data.appearClass;
  5373. var appearToClass = data.appearToClass;
  5374. var appearActiveClass = data.appearActiveClass;
  5375. var beforeEnter = data.beforeEnter;
  5376. var enter = data.enter;
  5377. var afterEnter = data.afterEnter;
  5378. var enterCancelled = data.enterCancelled;
  5379. var beforeAppear = data.beforeAppear;
  5380. var appear = data.appear;
  5381. var afterAppear = data.afterAppear;
  5382. var appearCancelled = data.appearCancelled;
  5383. var duration = data.duration;
  5384. // activeInstance will always be the <transition> component managing this
  5385. // transition. One edge case to check is when the <transition> is placed
  5386. // as the root node of a child component. In that case we need to check
  5387. // <transition>'s parent for appear check.
  5388. var context = activeInstance;
  5389. var transitionNode = activeInstance.$vnode;
  5390. while (transitionNode && transitionNode.parent) {
  5391. transitionNode = transitionNode.parent;
  5392. context = transitionNode.context;
  5393. }
  5394. var isAppear = !context._isMounted || !vnode.isRootInsert;
  5395. if (isAppear && !appear && appear !== '') {
  5396. return
  5397. }
  5398. var startClass = isAppear && appearClass
  5399. ? appearClass
  5400. : enterClass;
  5401. var activeClass = isAppear && appearActiveClass
  5402. ? appearActiveClass
  5403. : enterActiveClass;
  5404. var toClass = isAppear && appearToClass
  5405. ? appearToClass
  5406. : enterToClass;
  5407. var beforeEnterHook = isAppear
  5408. ? (beforeAppear || beforeEnter)
  5409. : beforeEnter;
  5410. var enterHook = isAppear
  5411. ? (typeof appear === 'function' ? appear : enter)
  5412. : enter;
  5413. var afterEnterHook = isAppear
  5414. ? (afterAppear || afterEnter)
  5415. : afterEnter;
  5416. var enterCancelledHook = isAppear
  5417. ? (appearCancelled || enterCancelled)
  5418. : enterCancelled;
  5419. var explicitEnterDuration = toNumber(
  5420. isObject(duration)
  5421. ? duration.enter
  5422. : duration
  5423. );
  5424. if ("development" !== 'production' && explicitEnterDuration != null) {
  5425. checkDuration(explicitEnterDuration, 'enter', vnode);
  5426. }
  5427. var expectsCSS = css !== false && !isIE9;
  5428. var userWantsControl = getHookArgumentsLength(enterHook);
  5429. var cb = el._enterCb = once(function () {
  5430. if (expectsCSS) {
  5431. removeTransitionClass(el, toClass);
  5432. removeTransitionClass(el, activeClass);
  5433. }
  5434. if (cb.cancelled) {
  5435. if (expectsCSS) {
  5436. removeTransitionClass(el, startClass);
  5437. }
  5438. enterCancelledHook && enterCancelledHook(el);
  5439. } else {
  5440. afterEnterHook && afterEnterHook(el);
  5441. }
  5442. el._enterCb = null;
  5443. });
  5444. if (!vnode.data.show) {
  5445. // remove pending leave element on enter by injecting an insert hook
  5446. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () {
  5447. var parent = el.parentNode;
  5448. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  5449. if (pendingNode &&
  5450. pendingNode.tag === vnode.tag &&
  5451. pendingNode.elm._leaveCb) {
  5452. pendingNode.elm._leaveCb();
  5453. }
  5454. enterHook && enterHook(el, cb);
  5455. });
  5456. }
  5457. // start enter transition
  5458. beforeEnterHook && beforeEnterHook(el);
  5459. if (expectsCSS) {
  5460. addTransitionClass(el, startClass);
  5461. addTransitionClass(el, activeClass);
  5462. nextFrame(function () {
  5463. addTransitionClass(el, toClass);
  5464. removeTransitionClass(el, startClass);
  5465. if (!cb.cancelled && !userWantsControl) {
  5466. if (isValidDuration(explicitEnterDuration)) {
  5467. setTimeout(cb, explicitEnterDuration);
  5468. } else {
  5469. whenTransitionEnds(el, type, cb);
  5470. }
  5471. }
  5472. });
  5473. }
  5474. if (vnode.data.show) {
  5475. toggleDisplay && toggleDisplay();
  5476. enterHook && enterHook(el, cb);
  5477. }
  5478. if (!expectsCSS && !userWantsControl) {
  5479. cb();
  5480. }
  5481. }
  5482. function leave (vnode, rm) {
  5483. var el = vnode.elm;
  5484. // call enter callback now
  5485. if (el._enterCb) {
  5486. el._enterCb.cancelled = true;
  5487. el._enterCb();
  5488. }
  5489. var data = resolveTransition(vnode.data.transition);
  5490. if (!data) {
  5491. return rm()
  5492. }
  5493. /* istanbul ignore if */
  5494. if (el._leaveCb || el.nodeType !== 1) {
  5495. return
  5496. }
  5497. var css = data.css;
  5498. var type = data.type;
  5499. var leaveClass = data.leaveClass;
  5500. var leaveToClass = data.leaveToClass;
  5501. var leaveActiveClass = data.leaveActiveClass;
  5502. var beforeLeave = data.beforeLeave;
  5503. var leave = data.leave;
  5504. var afterLeave = data.afterLeave;
  5505. var leaveCancelled = data.leaveCancelled;
  5506. var delayLeave = data.delayLeave;
  5507. var duration = data.duration;
  5508. var expectsCSS = css !== false && !isIE9;
  5509. var userWantsControl = getHookArgumentsLength(leave);
  5510. var explicitLeaveDuration = toNumber(
  5511. isObject(duration)
  5512. ? duration.leave
  5513. : duration
  5514. );
  5515. if ("development" !== 'production' && explicitLeaveDuration != null) {
  5516. checkDuration(explicitLeaveDuration, 'leave', vnode);
  5517. }
  5518. var cb = el._leaveCb = once(function () {
  5519. if (el.parentNode && el.parentNode._pending) {
  5520. el.parentNode._pending[vnode.key] = null;
  5521. }
  5522. if (expectsCSS) {
  5523. removeTransitionClass(el, leaveToClass);
  5524. removeTransitionClass(el, leaveActiveClass);
  5525. }
  5526. if (cb.cancelled) {
  5527. if (expectsCSS) {
  5528. removeTransitionClass(el, leaveClass);
  5529. }
  5530. leaveCancelled && leaveCancelled(el);
  5531. } else {
  5532. rm();
  5533. afterLeave && afterLeave(el);
  5534. }
  5535. el._leaveCb = null;
  5536. });
  5537. if (delayLeave) {
  5538. delayLeave(performLeave);
  5539. } else {
  5540. performLeave();
  5541. }
  5542. function performLeave () {
  5543. // the delayed leave may have already been cancelled
  5544. if (cb.cancelled) {
  5545. return
  5546. }
  5547. // record leaving element
  5548. if (!vnode.data.show) {
  5549. (el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] = vnode;
  5550. }
  5551. beforeLeave && beforeLeave(el);
  5552. if (expectsCSS) {
  5553. addTransitionClass(el, leaveClass);
  5554. addTransitionClass(el, leaveActiveClass);
  5555. nextFrame(function () {
  5556. addTransitionClass(el, leaveToClass);
  5557. removeTransitionClass(el, leaveClass);
  5558. if (!cb.cancelled && !userWantsControl) {
  5559. if (isValidDuration(explicitLeaveDuration)) {
  5560. setTimeout(cb, explicitLeaveDuration);
  5561. } else {
  5562. whenTransitionEnds(el, type, cb);
  5563. }
  5564. }
  5565. });
  5566. }
  5567. leave && leave(el, cb);
  5568. if (!expectsCSS && !userWantsControl) {
  5569. cb();
  5570. }
  5571. }
  5572. }
  5573. // only used in dev mode
  5574. function checkDuration (val, name, vnode) {
  5575. if (typeof val !== 'number') {
  5576. warn(
  5577. "<transition> explicit " + name + " duration is not a valid number - " +
  5578. "got " + (JSON.stringify(val)) + ".",
  5579. vnode.context
  5580. );
  5581. } else if (isNaN(val)) {
  5582. warn(
  5583. "<transition> explicit " + name + " duration is NaN - " +
  5584. 'the duration expression might be incorrect.',
  5585. vnode.context
  5586. );
  5587. }
  5588. }
  5589. function isValidDuration (val) {
  5590. return typeof val === 'number' && !isNaN(val)
  5591. }
  5592. /**
  5593. * Normalize a transition hook's argument length. The hook may be:
  5594. * - a merged hook (invoker) with the original in .fns
  5595. * - a wrapped component method (check ._length)
  5596. * - a plain function (.length)
  5597. */
  5598. function getHookArgumentsLength (fn) {
  5599. if (!fn) { return false }
  5600. var invokerFns = fn.fns;
  5601. if (invokerFns) {
  5602. // invoker
  5603. return getHookArgumentsLength(
  5604. Array.isArray(invokerFns)
  5605. ? invokerFns[0]
  5606. : invokerFns
  5607. )
  5608. } else {
  5609. return (fn._length || fn.length) > 1
  5610. }
  5611. }
  5612. function _enter (_, vnode) {
  5613. if (!vnode.data.show) {
  5614. enter(vnode);
  5615. }
  5616. }
  5617. var transition = inBrowser ? {
  5618. create: _enter,
  5619. activate: _enter,
  5620. remove: function remove$$1 (vnode, rm) {
  5621. /* istanbul ignore else */
  5622. if (!vnode.data.show) {
  5623. leave(vnode, rm);
  5624. } else {
  5625. rm();
  5626. }
  5627. }
  5628. } : {};
  5629. var platformModules = [
  5630. attrs,
  5631. klass,
  5632. events,
  5633. domProps,
  5634. style,
  5635. transition
  5636. ];
  5637. /* */
  5638. // the directive module should be applied last, after all
  5639. // built-in modules have been applied.
  5640. var modules = platformModules.concat(baseModules);
  5641. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  5642. /**
  5643. * Not type checking this file because flow doesn't like attaching
  5644. * properties to Elements.
  5645. */
  5646. /* istanbul ignore if */
  5647. if (isIE9) {
  5648. // http://www.matts411.com/post/internet-explorer-9-oninput/
  5649. document.addEventListener('selectionchange', function () {
  5650. var el = document.activeElement;
  5651. if (el && el.vmodel) {
  5652. trigger(el, 'input');
  5653. }
  5654. });
  5655. }
  5656. var model$1 = {
  5657. inserted: function inserted (el, binding, vnode) {
  5658. if (vnode.tag === 'select') {
  5659. var cb = function () {
  5660. setSelected(el, binding, vnode.context);
  5661. };
  5662. cb();
  5663. /* istanbul ignore if */
  5664. if (isIE || isEdge) {
  5665. setTimeout(cb, 0);
  5666. }
  5667. } else if (vnode.tag === 'textarea' || el.type === 'text' || el.type === 'password') {
  5668. el._vModifiers = binding.modifiers;
  5669. if (!binding.modifiers.lazy) {
  5670. if (!isAndroid) {
  5671. el.addEventListener('compositionstart', onCompositionStart);
  5672. el.addEventListener('compositionend', onCompositionEnd);
  5673. }
  5674. /* istanbul ignore if */
  5675. if (isIE9) {
  5676. el.vmodel = true;
  5677. }
  5678. }
  5679. }
  5680. },
  5681. componentUpdated: function componentUpdated (el, binding, vnode) {
  5682. if (vnode.tag === 'select') {
  5683. setSelected(el, binding, vnode.context);
  5684. // in case the options rendered by v-for have changed,
  5685. // it's possible that the value is out-of-sync with the rendered options.
  5686. // detect such cases and filter out values that no longer has a matching
  5687. // option in the DOM.
  5688. var needReset = el.multiple
  5689. ? binding.value.some(function (v) { return hasNoMatchingOption(v, el.options); })
  5690. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, el.options);
  5691. if (needReset) {
  5692. trigger(el, 'change');
  5693. }
  5694. }
  5695. }
  5696. };
  5697. function setSelected (el, binding, vm) {
  5698. var value = binding.value;
  5699. var isMultiple = el.multiple;
  5700. if (isMultiple && !Array.isArray(value)) {
  5701. "development" !== 'production' && warn(
  5702. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  5703. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  5704. vm
  5705. );
  5706. return
  5707. }
  5708. var selected, option;
  5709. for (var i = 0, l = el.options.length; i < l; i++) {
  5710. option = el.options[i];
  5711. if (isMultiple) {
  5712. selected = looseIndexOf(value, getValue(option)) > -1;
  5713. if (option.selected !== selected) {
  5714. option.selected = selected;
  5715. }
  5716. } else {
  5717. if (looseEqual(getValue(option), value)) {
  5718. if (el.selectedIndex !== i) {
  5719. el.selectedIndex = i;
  5720. }
  5721. return
  5722. }
  5723. }
  5724. }
  5725. if (!isMultiple) {
  5726. el.selectedIndex = -1;
  5727. }
  5728. }
  5729. function hasNoMatchingOption (value, options) {
  5730. for (var i = 0, l = options.length; i < l; i++) {
  5731. if (looseEqual(getValue(options[i]), value)) {
  5732. return false
  5733. }
  5734. }
  5735. return true
  5736. }
  5737. function getValue (option) {
  5738. return '_value' in option
  5739. ? option._value
  5740. : option.value
  5741. }
  5742. function onCompositionStart (e) {
  5743. e.target.composing = true;
  5744. }
  5745. function onCompositionEnd (e) {
  5746. e.target.composing = false;
  5747. trigger(e.target, 'input');
  5748. }
  5749. function trigger (el, type) {
  5750. var e = document.createEvent('HTMLEvents');
  5751. e.initEvent(type, true, true);
  5752. el.dispatchEvent(e);
  5753. }
  5754. /* */
  5755. // recursively search for possible transition defined inside the component root
  5756. function locateNode (vnode) {
  5757. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  5758. ? locateNode(vnode.componentInstance._vnode)
  5759. : vnode
  5760. }
  5761. var show = {
  5762. bind: function bind (el, ref, vnode) {
  5763. var value = ref.value;
  5764. vnode = locateNode(vnode);
  5765. var transition = vnode.data && vnode.data.transition;
  5766. var originalDisplay = el.__vOriginalDisplay =
  5767. el.style.display === 'none' ? '' : el.style.display;
  5768. if (value && transition && !isIE9) {
  5769. vnode.data.show = true;
  5770. enter(vnode, function () {
  5771. el.style.display = originalDisplay;
  5772. });
  5773. } else {
  5774. el.style.display = value ? originalDisplay : 'none';
  5775. }
  5776. },
  5777. update: function update (el, ref, vnode) {
  5778. var value = ref.value;
  5779. var oldValue = ref.oldValue;
  5780. /* istanbul ignore if */
  5781. if (value === oldValue) { return }
  5782. vnode = locateNode(vnode);
  5783. var transition = vnode.data && vnode.data.transition;
  5784. if (transition && !isIE9) {
  5785. vnode.data.show = true;
  5786. if (value) {
  5787. enter(vnode, function () {
  5788. el.style.display = el.__vOriginalDisplay;
  5789. });
  5790. } else {
  5791. leave(vnode, function () {
  5792. el.style.display = 'none';
  5793. });
  5794. }
  5795. } else {
  5796. el.style.display = value ? el.__vOriginalDisplay : 'none';
  5797. }
  5798. },
  5799. unbind: function unbind (
  5800. el,
  5801. binding,
  5802. vnode,
  5803. oldVnode,
  5804. isDestroy
  5805. ) {
  5806. if (!isDestroy) {
  5807. el.style.display = el.__vOriginalDisplay;
  5808. }
  5809. }
  5810. };
  5811. var platformDirectives = {
  5812. model: model$1,
  5813. show: show
  5814. };
  5815. /* */
  5816. // Provides transition support for a single element/component.
  5817. // supports transition mode (out-in / in-out)
  5818. var transitionProps = {
  5819. name: String,
  5820. appear: Boolean,
  5821. css: Boolean,
  5822. mode: String,
  5823. type: String,
  5824. enterClass: String,
  5825. leaveClass: String,
  5826. enterToClass: String,
  5827. leaveToClass: String,
  5828. enterActiveClass: String,
  5829. leaveActiveClass: String,
  5830. appearClass: String,
  5831. appearActiveClass: String,
  5832. appearToClass: String,
  5833. duration: [Number, String, Object]
  5834. };
  5835. // in case the child is also an abstract component, e.g. <keep-alive>
  5836. // we want to recursively retrieve the real component to be rendered
  5837. function getRealChild (vnode) {
  5838. var compOptions = vnode && vnode.componentOptions;
  5839. if (compOptions && compOptions.Ctor.options.abstract) {
  5840. return getRealChild(getFirstComponentChild(compOptions.children))
  5841. } else {
  5842. return vnode
  5843. }
  5844. }
  5845. function extractTransitionData (comp) {
  5846. var data = {};
  5847. var options = comp.$options;
  5848. // props
  5849. for (var key in options.propsData) {
  5850. data[key] = comp[key];
  5851. }
  5852. // events.
  5853. // extract listeners and pass them directly to the transition methods
  5854. var listeners = options._parentListeners;
  5855. for (var key$1 in listeners) {
  5856. data[camelize(key$1)] = listeners[key$1];
  5857. }
  5858. return data
  5859. }
  5860. function placeholder (h, rawChild) {
  5861. return /\d-keep-alive$/.test(rawChild.tag)
  5862. ? h('keep-alive')
  5863. : null
  5864. }
  5865. function hasParentTransition (vnode) {
  5866. while ((vnode = vnode.parent)) {
  5867. if (vnode.data.transition) {
  5868. return true
  5869. }
  5870. }
  5871. }
  5872. function isSameChild (child, oldChild) {
  5873. return oldChild.key === child.key && oldChild.tag === child.tag
  5874. }
  5875. var Transition = {
  5876. name: 'transition',
  5877. props: transitionProps,
  5878. abstract: true,
  5879. render: function render (h) {
  5880. var this$1 = this;
  5881. var children = this.$slots.default;
  5882. if (!children) {
  5883. return
  5884. }
  5885. // filter out text nodes (possible whitespaces)
  5886. children = children.filter(function (c) { return c.tag; });
  5887. /* istanbul ignore if */
  5888. if (!children.length) {
  5889. return
  5890. }
  5891. // warn multiple elements
  5892. if ("development" !== 'production' && children.length > 1) {
  5893. warn(
  5894. '<transition> can only be used on a single element. Use ' +
  5895. '<transition-group> for lists.',
  5896. this.$parent
  5897. );
  5898. }
  5899. var mode = this.mode;
  5900. // warn invalid mode
  5901. if ("development" !== 'production' &&
  5902. mode && mode !== 'in-out' && mode !== 'out-in') {
  5903. warn(
  5904. 'invalid <transition> mode: ' + mode,
  5905. this.$parent
  5906. );
  5907. }
  5908. var rawChild = children[0];
  5909. // if this is a component root node and the component's
  5910. // parent container node also has transition, skip.
  5911. if (hasParentTransition(this.$vnode)) {
  5912. return rawChild
  5913. }
  5914. // apply transition data to child
  5915. // use getRealChild() to ignore abstract components e.g. keep-alive
  5916. var child = getRealChild(rawChild);
  5917. /* istanbul ignore if */
  5918. if (!child) {
  5919. return rawChild
  5920. }
  5921. if (this._leaving) {
  5922. return placeholder(h, rawChild)
  5923. }
  5924. // ensure a key that is unique to the vnode type and to this transition
  5925. // component instance. This key will be used to remove pending leaving nodes
  5926. // during entering.
  5927. var id = "__transition-" + (this._uid) + "-";
  5928. child.key = child.key == null
  5929. ? id + child.tag
  5930. : isPrimitive(child.key)
  5931. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  5932. : child.key;
  5933. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  5934. var oldRawChild = this._vnode;
  5935. var oldChild = getRealChild(oldRawChild);
  5936. // mark v-show
  5937. // so that the transition module can hand over the control to the directive
  5938. if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
  5939. child.data.show = true;
  5940. }
  5941. if (oldChild && oldChild.data && !isSameChild(child, oldChild)) {
  5942. // replace old child transition data with fresh one
  5943. // important for dynamic transitions!
  5944. var oldData = oldChild && (oldChild.data.transition = extend({}, data));
  5945. // handle transition mode
  5946. if (mode === 'out-in') {
  5947. // return placeholder node and queue update when leave finishes
  5948. this._leaving = true;
  5949. mergeVNodeHook(oldData, 'afterLeave', function () {
  5950. this$1._leaving = false;
  5951. this$1.$forceUpdate();
  5952. });
  5953. return placeholder(h, rawChild)
  5954. } else if (mode === 'in-out') {
  5955. var delayedLeave;
  5956. var performLeave = function () { delayedLeave(); };
  5957. mergeVNodeHook(data, 'afterEnter', performLeave);
  5958. mergeVNodeHook(data, 'enterCancelled', performLeave);
  5959. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  5960. }
  5961. }
  5962. return rawChild
  5963. }
  5964. };
  5965. /* */
  5966. // Provides transition support for list items.
  5967. // supports move transitions using the FLIP technique.
  5968. // Because the vdom's children update algorithm is "unstable" - i.e.
  5969. // it doesn't guarantee the relative positioning of removed elements,
  5970. // we force transition-group to update its children into two passes:
  5971. // in the first pass, we remove all nodes that need to be removed,
  5972. // triggering their leaving transition; in the second pass, we insert/move
  5973. // into the final desired state. This way in the second pass removed
  5974. // nodes will remain where they should be.
  5975. var props = extend({
  5976. tag: String,
  5977. moveClass: String
  5978. }, transitionProps);
  5979. delete props.mode;
  5980. var TransitionGroup = {
  5981. props: props,
  5982. render: function render (h) {
  5983. var tag = this.tag || this.$vnode.data.tag || 'span';
  5984. var map = Object.create(null);
  5985. var prevChildren = this.prevChildren = this.children;
  5986. var rawChildren = this.$slots.default || [];
  5987. var children = this.children = [];
  5988. var transitionData = extractTransitionData(this);
  5989. for (var i = 0; i < rawChildren.length; i++) {
  5990. var c = rawChildren[i];
  5991. if (c.tag) {
  5992. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  5993. children.push(c);
  5994. map[c.key] = c
  5995. ;(c.data || (c.data = {})).transition = transitionData;
  5996. } else {
  5997. var opts = c.componentOptions;
  5998. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  5999. warn(("<transition-group> children must be keyed: <" + name + ">"));
  6000. }
  6001. }
  6002. }
  6003. if (prevChildren) {
  6004. var kept = [];
  6005. var removed = [];
  6006. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  6007. var c$1 = prevChildren[i$1];
  6008. c$1.data.transition = transitionData;
  6009. c$1.data.pos = c$1.elm.getBoundingClientRect();
  6010. if (map[c$1.key]) {
  6011. kept.push(c$1);
  6012. } else {
  6013. removed.push(c$1);
  6014. }
  6015. }
  6016. this.kept = h(tag, null, kept);
  6017. this.removed = removed;
  6018. }
  6019. return h(tag, null, children)
  6020. },
  6021. beforeUpdate: function beforeUpdate () {
  6022. // force removing pass
  6023. this.__patch__(
  6024. this._vnode,
  6025. this.kept,
  6026. false, // hydrating
  6027. true // removeOnly (!important, avoids unnecessary moves)
  6028. );
  6029. this._vnode = this.kept;
  6030. },
  6031. updated: function updated () {
  6032. var children = this.prevChildren;
  6033. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  6034. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  6035. return
  6036. }
  6037. // we divide the work into three loops to avoid mixing DOM reads and writes
  6038. // in each iteration - which helps prevent layout thrashing.
  6039. children.forEach(callPendingCbs);
  6040. children.forEach(recordPosition);
  6041. children.forEach(applyTranslation);
  6042. // force reflow to put everything in position
  6043. var body = document.body;
  6044. var f = body.offsetHeight; // eslint-disable-line
  6045. children.forEach(function (c) {
  6046. if (c.data.moved) {
  6047. var el = c.elm;
  6048. var s = el.style;
  6049. addTransitionClass(el, moveClass);
  6050. s.transform = s.WebkitTransform = s.transitionDuration = '';
  6051. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  6052. if (!e || /transform$/.test(e.propertyName)) {
  6053. el.removeEventListener(transitionEndEvent, cb);
  6054. el._moveCb = null;
  6055. removeTransitionClass(el, moveClass);
  6056. }
  6057. });
  6058. }
  6059. });
  6060. },
  6061. methods: {
  6062. hasMove: function hasMove (el, moveClass) {
  6063. /* istanbul ignore if */
  6064. if (!hasTransition) {
  6065. return false
  6066. }
  6067. if (this._hasMove != null) {
  6068. return this._hasMove
  6069. }
  6070. // Detect whether an element with the move class applied has
  6071. // CSS transitions. Since the element may be inside an entering
  6072. // transition at this very moment, we make a clone of it and remove
  6073. // all other transition classes applied to ensure only the move class
  6074. // is applied.
  6075. var clone = el.cloneNode();
  6076. if (el._transitionClasses) {
  6077. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  6078. }
  6079. addClass(clone, moveClass);
  6080. clone.style.display = 'none';
  6081. this.$el.appendChild(clone);
  6082. var info = getTransitionInfo(clone);
  6083. this.$el.removeChild(clone);
  6084. return (this._hasMove = info.hasTransform)
  6085. }
  6086. }
  6087. };
  6088. function callPendingCbs (c) {
  6089. /* istanbul ignore if */
  6090. if (c.elm._moveCb) {
  6091. c.elm._moveCb();
  6092. }
  6093. /* istanbul ignore if */
  6094. if (c.elm._enterCb) {
  6095. c.elm._enterCb();
  6096. }
  6097. }
  6098. function recordPosition (c) {
  6099. c.data.newPos = c.elm.getBoundingClientRect();
  6100. }
  6101. function applyTranslation (c) {
  6102. var oldPos = c.data.pos;
  6103. var newPos = c.data.newPos;
  6104. var dx = oldPos.left - newPos.left;
  6105. var dy = oldPos.top - newPos.top;
  6106. if (dx || dy) {
  6107. c.data.moved = true;
  6108. var s = c.elm.style;
  6109. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  6110. s.transitionDuration = '0s';
  6111. }
  6112. }
  6113. var platformComponents = {
  6114. Transition: Transition,
  6115. TransitionGroup: TransitionGroup
  6116. };
  6117. /* */
  6118. // install platform specific utils
  6119. Vue$2.config.mustUseProp = mustUseProp;
  6120. Vue$2.config.isReservedTag = isReservedTag;
  6121. Vue$2.config.getTagNamespace = getTagNamespace;
  6122. Vue$2.config.isUnknownElement = isUnknownElement;
  6123. // install platform runtime directives & components
  6124. extend(Vue$2.options.directives, platformDirectives);
  6125. extend(Vue$2.options.components, platformComponents);
  6126. // install platform patch function
  6127. Vue$2.prototype.__patch__ = inBrowser ? patch : noop;
  6128. // public mount method
  6129. Vue$2.prototype.$mount = function (
  6130. el,
  6131. hydrating
  6132. ) {
  6133. el = el && inBrowser ? query(el) : undefined;
  6134. return mountComponent(this, el, hydrating)
  6135. };
  6136. // devtools global hook
  6137. /* istanbul ignore next */
  6138. setTimeout(function () {
  6139. if (config.devtools) {
  6140. if (devtools) {
  6141. devtools.emit('init', Vue$2);
  6142. } else if ("development" !== 'production' && isChrome) {
  6143. console[console.info ? 'info' : 'log'](
  6144. 'Download the Vue Devtools extension for a better development experience:\n' +
  6145. 'https://github.com/vuejs/vue-devtools'
  6146. );
  6147. }
  6148. }
  6149. if ("development" !== 'production' &&
  6150. config.productionTip !== false &&
  6151. inBrowser && typeof console !== 'undefined') {
  6152. console[console.info ? 'info' : 'log'](
  6153. "You are running Vue in development mode.\n" +
  6154. "Make sure to turn on production mode when deploying for production.\n" +
  6155. "See more tips at https://vuejs.org/guide/deployment.html"
  6156. );
  6157. }
  6158. }, 0);
  6159. return Vue$2;
  6160. })));