vue.runtime.js 206 KB

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