Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vue.runtime.js 205KB

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