足力健前端,vue版本

view.runtime.esm.js 223KB

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