vue.js 283 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948
  1. /*!
  2. * Vue.js v2.5.16
  3. * (c) 2014-2018 Evan You
  4. * Released under the MIT License.
  5. */
  6. (function (global, factory) {
  7. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  8. typeof define === 'function' && define.amd ? define(factory) :
  9. (global.Vue = factory());
  10. }(this, (function () { 'use strict';
  11. /* */
  12. var emptyObject = Object.freeze({});
  13. // these helpers produces better vm code in JS engines due to their
  14. // explicitness and function inlining
  15. function isUndef (v) {
  16. return v === undefined || v === null
  17. }
  18. function isDef (v) {
  19. return v !== undefined && v !== null
  20. }
  21. function isTrue (v) {
  22. return v === true
  23. }
  24. function isFalse (v) {
  25. return v === false
  26. }
  27. /**
  28. * Check if value is primitive
  29. */
  30. function isPrimitive (value) {
  31. return (
  32. typeof value === 'string' ||
  33. typeof value === 'number' ||
  34. // $flow-disable-line
  35. typeof value === 'symbol' ||
  36. typeof value === 'boolean'
  37. )
  38. }
  39. /**
  40. * Quick object check - this is primarily used to tell
  41. * Objects from primitive values when we know the value
  42. * is a JSON-compliant type.
  43. */
  44. function isObject (obj) {
  45. return obj !== null && typeof obj === 'object'
  46. }
  47. /**
  48. * Get the raw type string of a value e.g. [object Object]
  49. */
  50. var _toString = Object.prototype.toString;
  51. function toRawType (value) {
  52. return _toString.call(value).slice(8, -1)
  53. }
  54. /**
  55. * Strict object type check. Only returns true
  56. * for plain JavaScript objects.
  57. */
  58. function isPlainObject (obj) {
  59. return _toString.call(obj) === '[object Object]'
  60. }
  61. function isRegExp (v) {
  62. return _toString.call(v) === '[object RegExp]'
  63. }
  64. /**
  65. * Check if val is a valid array index.
  66. */
  67. function isValidArrayIndex (val) {
  68. var n = parseFloat(String(val));
  69. return n >= 0 && Math.floor(n) === n && isFinite(val)
  70. }
  71. /**
  72. * Convert a value to a string that is actually rendered.
  73. */
  74. function toString (val) {
  75. return val == null
  76. ? ''
  77. : typeof val === 'object'
  78. ? JSON.stringify(val, null, 2)
  79. : String(val)
  80. }
  81. /**
  82. * Convert a input value to a number for persistence.
  83. * If the conversion fails, return original string.
  84. */
  85. function toNumber (val) {
  86. var n = parseFloat(val);
  87. return isNaN(n) ? val : n
  88. }
  89. /**
  90. * Make a map and return a function for checking if a key
  91. * is in that map.
  92. */
  93. function makeMap (
  94. str,
  95. expectsLowerCase
  96. ) {
  97. var map = Object.create(null);
  98. var list = str.split(',');
  99. for (var i = 0; i < list.length; i++) {
  100. map[list[i]] = true;
  101. }
  102. return expectsLowerCase
  103. ? function (val) { return map[val.toLowerCase()]; }
  104. : function (val) { return map[val]; }
  105. }
  106. /**
  107. * Check if a tag is a built-in tag.
  108. */
  109. var isBuiltInTag = makeMap('slot,component', true);
  110. /**
  111. * Check if a attribute is a reserved attribute.
  112. */
  113. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  114. /**
  115. * Remove an item from an array
  116. */
  117. function remove (arr, item) {
  118. if (arr.length) {
  119. var index = arr.indexOf(item);
  120. if (index > -1) {
  121. return arr.splice(index, 1)
  122. }
  123. }
  124. }
  125. /**
  126. * Check whether the object has the property.
  127. */
  128. var hasOwnProperty = Object.prototype.hasOwnProperty;
  129. function hasOwn (obj, key) {
  130. return hasOwnProperty.call(obj, key)
  131. }
  132. /**
  133. * Create a cached version of a pure function.
  134. */
  135. function cached (fn) {
  136. var cache = Object.create(null);
  137. return (function cachedFn (str) {
  138. var hit = cache[str];
  139. return hit || (cache[str] = fn(str))
  140. })
  141. }
  142. /**
  143. * Camelize a hyphen-delimited string.
  144. */
  145. var camelizeRE = /-(\w)/g;
  146. var camelize = cached(function (str) {
  147. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  148. });
  149. /**
  150. * Capitalize a string.
  151. */
  152. var capitalize = cached(function (str) {
  153. return str.charAt(0).toUpperCase() + str.slice(1)
  154. });
  155. /**
  156. * Hyphenate a camelCase string.
  157. */
  158. var hyphenateRE = /\B([A-Z])/g;
  159. var hyphenate = cached(function (str) {
  160. return str.replace(hyphenateRE, '-$1').toLowerCase()
  161. });
  162. /**
  163. * Simple bind polyfill for environments that do not support it... e.g.
  164. * PhantomJS 1.x. Technically we don't need this anymore since native bind is
  165. * now more performant in most browsers, but removing it would be breaking for
  166. * code that was able to run in PhantomJS 1.x, so this must be kept for
  167. * backwards compatibility.
  168. */
  169. /* istanbul ignore next */
  170. function polyfillBind (fn, ctx) {
  171. function boundFn (a) {
  172. var l = arguments.length;
  173. return l
  174. ? l > 1
  175. ? fn.apply(ctx, arguments)
  176. : fn.call(ctx, a)
  177. : fn.call(ctx)
  178. }
  179. boundFn._length = fn.length;
  180. return boundFn
  181. }
  182. function nativeBind (fn, ctx) {
  183. return fn.bind(ctx)
  184. }
  185. var bind = Function.prototype.bind
  186. ? nativeBind
  187. : polyfillBind;
  188. /**
  189. * Convert an Array-like object to a real Array.
  190. */
  191. function toArray (list, start) {
  192. start = start || 0;
  193. var i = list.length - start;
  194. var ret = new Array(i);
  195. while (i--) {
  196. ret[i] = list[i + start];
  197. }
  198. return ret
  199. }
  200. /**
  201. * Mix properties into target object.
  202. */
  203. function extend (to, _from) {
  204. for (var key in _from) {
  205. to[key] = _from[key];
  206. }
  207. return to
  208. }
  209. /**
  210. * Merge an Array of Objects into a single Object.
  211. */
  212. function toObject (arr) {
  213. var res = {};
  214. for (var i = 0; i < arr.length; i++) {
  215. if (arr[i]) {
  216. extend(res, arr[i]);
  217. }
  218. }
  219. return res
  220. }
  221. /**
  222. * Perform no operation.
  223. * Stubbing args to make Flow happy without leaving useless transpiled code
  224. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/)
  225. */
  226. function noop (a, b, c) {}
  227. /**
  228. * Always return false.
  229. */
  230. var no = function (a, b, c) { return false; };
  231. /**
  232. * Return same value
  233. */
  234. var identity = function (_) { return _; };
  235. /**
  236. * Generate a static keys string from compiler modules.
  237. */
  238. function genStaticKeys (modules) {
  239. return modules.reduce(function (keys, m) {
  240. return keys.concat(m.staticKeys || [])
  241. }, []).join(',')
  242. }
  243. /**
  244. * Check if two values are loosely equal - that is,
  245. * if they are plain objects, do they have the same shape?
  246. */
  247. function looseEqual (a, b) {
  248. if (a === b) { return true }
  249. var isObjectA = isObject(a);
  250. var isObjectB = isObject(b);
  251. if (isObjectA && isObjectB) {
  252. try {
  253. var isArrayA = Array.isArray(a);
  254. var isArrayB = Array.isArray(b);
  255. if (isArrayA && isArrayB) {
  256. return a.length === b.length && a.every(function (e, i) {
  257. return looseEqual(e, b[i])
  258. })
  259. } else if (!isArrayA && !isArrayB) {
  260. var keysA = Object.keys(a);
  261. var keysB = Object.keys(b);
  262. return keysA.length === keysB.length && keysA.every(function (key) {
  263. return looseEqual(a[key], b[key])
  264. })
  265. } else {
  266. /* istanbul ignore next */
  267. return false
  268. }
  269. } catch (e) {
  270. /* istanbul ignore next */
  271. return false
  272. }
  273. } else if (!isObjectA && !isObjectB) {
  274. return String(a) === String(b)
  275. } else {
  276. return false
  277. }
  278. }
  279. function looseIndexOf (arr, val) {
  280. for (var i = 0; i < arr.length; i++) {
  281. if (looseEqual(arr[i], val)) { return i }
  282. }
  283. return -1
  284. }
  285. /**
  286. * Ensure a function is called only once.
  287. */
  288. function once (fn) {
  289. var called = false;
  290. return function () {
  291. if (!called) {
  292. called = true;
  293. fn.apply(this, arguments);
  294. }
  295. }
  296. }
  297. var SSR_ATTR = 'data-server-rendered';
  298. var ASSET_TYPES = [
  299. 'component',
  300. 'directive',
  301. 'filter'
  302. ];
  303. var LIFECYCLE_HOOKS = [
  304. 'beforeCreate',
  305. 'created',
  306. 'beforeMount',
  307. 'mounted',
  308. 'beforeUpdate',
  309. 'updated',
  310. 'beforeDestroy',
  311. 'destroyed',
  312. 'activated',
  313. 'deactivated',
  314. 'errorCaptured'
  315. ];
  316. /* */
  317. var config = ({
  318. /**
  319. * Option merge strategies (used in core/util/options)
  320. */
  321. // $flow-disable-line
  322. optionMergeStrategies: Object.create(null),
  323. /**
  324. * Whether to suppress warnings.
  325. */
  326. silent: false,
  327. /**
  328. * Show production mode tip message on boot?
  329. */
  330. productionTip: "development" !== 'production',
  331. /**
  332. * Whether to enable devtools
  333. */
  334. devtools: "development" !== 'production',
  335. /**
  336. * Whether to record perf
  337. */
  338. performance: false,
  339. /**
  340. * Error handler for watcher errors
  341. */
  342. errorHandler: null,
  343. /**
  344. * Warn handler for watcher warns
  345. */
  346. warnHandler: null,
  347. /**
  348. * Ignore certain custom elements
  349. */
  350. ignoredElements: [],
  351. /**
  352. * Custom user key aliases for v-on
  353. */
  354. // $flow-disable-line
  355. keyCodes: Object.create(null),
  356. /**
  357. * Check if a tag is reserved so that it cannot be registered as a
  358. * component. This is platform-dependent and may be overwritten.
  359. */
  360. isReservedTag: no,
  361. /**
  362. * Check if an attribute is reserved so that it cannot be used as a component
  363. * prop. This is platform-dependent and may be overwritten.
  364. */
  365. isReservedAttr: no,
  366. /**
  367. * Check if a tag is an unknown element.
  368. * Platform-dependent.
  369. */
  370. isUnknownElement: no,
  371. /**
  372. * Get the namespace of an element
  373. */
  374. getTagNamespace: noop,
  375. /**
  376. * Parse the real tag name for the specific platform.
  377. */
  378. parsePlatformTagName: identity,
  379. /**
  380. * Check if an attribute must be bound using property, e.g. value
  381. * Platform-dependent.
  382. */
  383. mustUseProp: no,
  384. /**
  385. * Exposed for legacy reasons
  386. */
  387. _lifecycleHooks: LIFECYCLE_HOOKS
  388. })
  389. /* */
  390. /**
  391. * Check if a string starts with $ or _
  392. */
  393. function isReserved (str) {
  394. var c = (str + '').charCodeAt(0);
  395. return c === 0x24 || c === 0x5F
  396. }
  397. /**
  398. * Define a property.
  399. */
  400. function def (obj, key, val, enumerable) {
  401. Object.defineProperty(obj, key, {
  402. value: val,
  403. enumerable: !!enumerable,
  404. writable: true,
  405. configurable: true
  406. });
  407. }
  408. /**
  409. * Parse simple path.
  410. */
  411. var bailRE = /[^\w.$]/;
  412. function parsePath (path) {
  413. if (bailRE.test(path)) {
  414. return
  415. }
  416. var segments = path.split('.');
  417. return function (obj) {
  418. for (var i = 0; i < segments.length; i++) {
  419. if (!obj) { return }
  420. obj = obj[segments[i]];
  421. }
  422. return obj
  423. }
  424. }
  425. /* */
  426. // can we use __proto__?
  427. var hasProto = '__proto__' in {};
  428. // Browser environment sniffing
  429. var inBrowser = typeof window !== 'undefined';
  430. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  431. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  432. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  433. var isIE = UA && /msie|trident/.test(UA);
  434. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  435. var isEdge = UA && UA.indexOf('edge/') > 0;
  436. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  437. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  438. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  439. // Firefox has a "watch" function on Object.prototype...
  440. var nativeWatch = ({}).watch;
  441. var supportsPassive = false;
  442. if (inBrowser) {
  443. try {
  444. var opts = {};
  445. Object.defineProperty(opts, 'passive', ({
  446. get: function get () {
  447. /* istanbul ignore next */
  448. supportsPassive = true;
  449. }
  450. })); // https://github.com/facebook/flow/issues/285
  451. window.addEventListener('test-passive', null, opts);
  452. } catch (e) {}
  453. }
  454. // this needs to be lazy-evaled because vue may be required before
  455. // vue-server-renderer can set VUE_ENV
  456. var _isServer;
  457. var isServerRendering = function () {
  458. if (_isServer === undefined) {
  459. /* istanbul ignore if */
  460. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  461. // detect presence of vue-server-renderer and avoid
  462. // Webpack shimming the process
  463. _isServer = global['process'].env.VUE_ENV === 'server';
  464. } else {
  465. _isServer = false;
  466. }
  467. }
  468. return _isServer
  469. };
  470. // detect devtools
  471. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  472. /* istanbul ignore next */
  473. function isNative (Ctor) {
  474. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  475. }
  476. var hasSymbol =
  477. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  478. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  479. var _Set;
  480. /* istanbul ignore if */ // $flow-disable-line
  481. if (typeof Set !== 'undefined' && isNative(Set)) {
  482. // use native Set when available.
  483. _Set = Set;
  484. } else {
  485. // a non-standard Set polyfill that only works with primitive keys.
  486. _Set = (function () {
  487. function Set () {
  488. this.set = Object.create(null);
  489. }
  490. Set.prototype.has = function has (key) {
  491. return this.set[key] === true
  492. };
  493. Set.prototype.add = function add (key) {
  494. this.set[key] = true;
  495. };
  496. Set.prototype.clear = function clear () {
  497. this.set = Object.create(null);
  498. };
  499. return Set;
  500. }());
  501. }
  502. /* */
  503. var warn = noop;
  504. var tip = noop;
  505. var generateComponentTrace = (noop); // work around flow check
  506. var formatComponentName = (noop);
  507. {
  508. var hasConsole = typeof console !== 'undefined';
  509. var classifyRE = /(?:^|[-_])(\w)/g;
  510. var classify = function (str) { return str
  511. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  512. .replace(/[-_]/g, ''); };
  513. warn = function (msg, vm) {
  514. var trace = vm ? generateComponentTrace(vm) : '';
  515. if (config.warnHandler) {
  516. config.warnHandler.call(null, msg, vm, trace);
  517. } else if (hasConsole && (!config.silent)) {
  518. console.error(("[Vue warn]: " + msg + trace));
  519. }
  520. };
  521. tip = function (msg, vm) {
  522. if (hasConsole && (!config.silent)) {
  523. console.warn("[Vue tip]: " + msg + (
  524. vm ? generateComponentTrace(vm) : ''
  525. ));
  526. }
  527. };
  528. formatComponentName = function (vm, includeFile) {
  529. if (vm.$root === vm) {
  530. return '<Root>'
  531. }
  532. var options = typeof vm === 'function' && vm.cid != null
  533. ? vm.options
  534. : vm._isVue
  535. ? vm.$options || vm.constructor.options
  536. : vm || {};
  537. var name = options.name || options._componentTag;
  538. var file = options.__file;
  539. if (!name && file) {
  540. var match = file.match(/([^/\\]+)\.vue$/);
  541. name = match && match[1];
  542. }
  543. return (
  544. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  545. (file && includeFile !== false ? (" at " + file) : '')
  546. )
  547. };
  548. var repeat = function (str, n) {
  549. var res = '';
  550. while (n) {
  551. if (n % 2 === 1) { res += str; }
  552. if (n > 1) { str += str; }
  553. n >>= 1;
  554. }
  555. return res
  556. };
  557. generateComponentTrace = function (vm) {
  558. if (vm._isVue && vm.$parent) {
  559. var tree = [];
  560. var currentRecursiveSequence = 0;
  561. while (vm) {
  562. if (tree.length > 0) {
  563. var last = tree[tree.length - 1];
  564. if (last.constructor === vm.constructor) {
  565. currentRecursiveSequence++;
  566. vm = vm.$parent;
  567. continue
  568. } else if (currentRecursiveSequence > 0) {
  569. tree[tree.length - 1] = [last, currentRecursiveSequence];
  570. currentRecursiveSequence = 0;
  571. }
  572. }
  573. tree.push(vm);
  574. vm = vm.$parent;
  575. }
  576. return '\n\nfound in\n\n' + tree
  577. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  578. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  579. : formatComponentName(vm))); })
  580. .join('\n')
  581. } else {
  582. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  583. }
  584. };
  585. }
  586. /* */
  587. var uid = 0;
  588. /**
  589. * A dep is an observable that can have multiple
  590. * directives subscribing to it.
  591. */
  592. var Dep = function Dep () {
  593. this.id = uid++;
  594. this.subs = [];
  595. };
  596. Dep.prototype.addSub = function addSub (sub) {
  597. this.subs.push(sub);
  598. };
  599. Dep.prototype.removeSub = function removeSub (sub) {
  600. remove(this.subs, sub);
  601. };
  602. Dep.prototype.depend = function depend () {
  603. if (Dep.target) {
  604. Dep.target.addDep(this);
  605. }
  606. };
  607. Dep.prototype.notify = function notify () {
  608. // stabilize the subscriber list first
  609. var subs = this.subs.slice();
  610. for (var i = 0, l = subs.length; i < l; i++) {
  611. subs[i].update();
  612. }
  613. };
  614. // the current target watcher being evaluated.
  615. // this is globally unique because there could be only one
  616. // watcher being evaluated at any time.
  617. Dep.target = null;
  618. var targetStack = [];
  619. function pushTarget (_target) {
  620. if (Dep.target) { targetStack.push(Dep.target); }
  621. Dep.target = _target;
  622. }
  623. function popTarget () {
  624. Dep.target = targetStack.pop();
  625. }
  626. /* */
  627. var VNode = function VNode (
  628. tag,
  629. data,
  630. children,
  631. text,
  632. elm,
  633. context,
  634. componentOptions,
  635. asyncFactory
  636. ) {
  637. this.tag = tag;
  638. this.data = data;
  639. this.children = children;
  640. this.text = text;
  641. this.elm = elm;
  642. this.ns = undefined;
  643. this.context = context;
  644. this.fnContext = undefined;
  645. this.fnOptions = undefined;
  646. this.fnScopeId = undefined;
  647. this.key = data && data.key;
  648. this.componentOptions = componentOptions;
  649. this.componentInstance = undefined;
  650. this.parent = undefined;
  651. this.raw = false;
  652. this.isStatic = false;
  653. this.isRootInsert = true;
  654. this.isComment = false;
  655. this.isCloned = false;
  656. this.isOnce = false;
  657. this.asyncFactory = asyncFactory;
  658. this.asyncMeta = undefined;
  659. this.isAsyncPlaceholder = false;
  660. };
  661. var prototypeAccessors = { child: { configurable: true } };
  662. // DEPRECATED: alias for componentInstance for backwards compat.
  663. /* istanbul ignore next */
  664. prototypeAccessors.child.get = function () {
  665. return this.componentInstance
  666. };
  667. Object.defineProperties( VNode.prototype, prototypeAccessors );
  668. var createEmptyVNode = function (text) {
  669. if ( text === void 0 ) text = '';
  670. var node = new VNode();
  671. node.text = text;
  672. node.isComment = true;
  673. return node
  674. };
  675. function createTextVNode (val) {
  676. return new VNode(undefined, undefined, undefined, String(val))
  677. }
  678. // optimized shallow clone
  679. // used for static nodes and slot nodes because they may be reused across
  680. // multiple renders, cloning them avoids errors when DOM manipulations rely
  681. // on their elm reference.
  682. function cloneVNode (vnode) {
  683. var cloned = new VNode(
  684. vnode.tag,
  685. vnode.data,
  686. vnode.children,
  687. vnode.text,
  688. vnode.elm,
  689. vnode.context,
  690. vnode.componentOptions,
  691. vnode.asyncFactory
  692. );
  693. cloned.ns = vnode.ns;
  694. cloned.isStatic = vnode.isStatic;
  695. cloned.key = vnode.key;
  696. cloned.isComment = vnode.isComment;
  697. cloned.fnContext = vnode.fnContext;
  698. cloned.fnOptions = vnode.fnOptions;
  699. cloned.fnScopeId = vnode.fnScopeId;
  700. cloned.isCloned = true;
  701. return cloned
  702. }
  703. /*
  704. * not type checking this file because flow doesn't play well with
  705. * dynamically accessing methods on Array prototype
  706. */
  707. var arrayProto = Array.prototype;
  708. var arrayMethods = Object.create(arrayProto);
  709. var methodsToPatch = [
  710. 'push',
  711. 'pop',
  712. 'shift',
  713. 'unshift',
  714. 'splice',
  715. 'sort',
  716. 'reverse'
  717. ];
  718. /**
  719. * Intercept mutating methods and emit events
  720. */
  721. methodsToPatch.forEach(function (method) {
  722. // cache original method
  723. var original = arrayProto[method];
  724. def(arrayMethods, method, function mutator () {
  725. var args = [], len = arguments.length;
  726. while ( len-- ) args[ len ] = arguments[ len ];
  727. var result = original.apply(this, args);
  728. var ob = this.__ob__;
  729. var inserted;
  730. switch (method) {
  731. case 'push':
  732. case 'unshift':
  733. inserted = args;
  734. break
  735. case 'splice':
  736. inserted = args.slice(2);
  737. break
  738. }
  739. if (inserted) { ob.observeArray(inserted); }
  740. // notify change
  741. ob.dep.notify();
  742. return result
  743. });
  744. });
  745. /* */
  746. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  747. /**
  748. * In some cases we may want to disable observation inside a component's
  749. * update computation.
  750. */
  751. var shouldObserve = true;
  752. function toggleObserving (value) {
  753. shouldObserve = value;
  754. }
  755. /**
  756. * Observer class that is attached to each observed
  757. * object. Once attached, the observer converts the target
  758. * object's property keys into getter/setters that
  759. * collect dependencies and dispatch updates.
  760. */
  761. var Observer = function Observer (value) {
  762. this.value = value;
  763. this.dep = new Dep();
  764. this.vmCount = 0;
  765. def(value, '__ob__', this);
  766. if (Array.isArray(value)) {
  767. var augment = hasProto
  768. ? protoAugment
  769. : copyAugment;
  770. augment(value, arrayMethods, arrayKeys);
  771. this.observeArray(value);
  772. } else {
  773. this.walk(value);
  774. }
  775. };
  776. /**
  777. * Walk through each property and convert them into
  778. * getter/setters. This method should only be called when
  779. * value type is Object.
  780. */
  781. Observer.prototype.walk = function walk (obj) {
  782. var keys = Object.keys(obj);
  783. for (var i = 0; i < keys.length; i++) {
  784. defineReactive(obj, keys[i]);
  785. }
  786. };
  787. /**
  788. * Observe a list of Array items.
  789. */
  790. Observer.prototype.observeArray = function observeArray (items) {
  791. for (var i = 0, l = items.length; i < l; i++) {
  792. observe(items[i]);
  793. }
  794. };
  795. // helpers
  796. /**
  797. * Augment an target Object or Array by intercepting
  798. * the prototype chain using __proto__
  799. */
  800. function protoAugment (target, src, keys) {
  801. /* eslint-disable no-proto */
  802. target.__proto__ = src;
  803. /* eslint-enable no-proto */
  804. }
  805. /**
  806. * Augment an target Object or Array by defining
  807. * hidden properties.
  808. */
  809. /* istanbul ignore next */
  810. function copyAugment (target, src, keys) {
  811. for (var i = 0, l = keys.length; i < l; i++) {
  812. var key = keys[i];
  813. def(target, key, src[key]);
  814. }
  815. }
  816. /**
  817. * Attempt to create an observer instance for a value,
  818. * returns the new observer if successfully observed,
  819. * or the existing observer if the value already has one.
  820. */
  821. function observe (value, asRootData) {
  822. if (!isObject(value) || value instanceof VNode) {
  823. return
  824. }
  825. var ob;
  826. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  827. ob = value.__ob__;
  828. } else if (
  829. shouldObserve &&
  830. !isServerRendering() &&
  831. (Array.isArray(value) || isPlainObject(value)) &&
  832. Object.isExtensible(value) &&
  833. !value._isVue
  834. ) {
  835. ob = new Observer(value);
  836. }
  837. if (asRootData && ob) {
  838. ob.vmCount++;
  839. }
  840. return ob
  841. }
  842. /**
  843. * Define a reactive property on an Object.
  844. */
  845. function defineReactive (
  846. obj,
  847. key,
  848. val,
  849. customSetter,
  850. shallow
  851. ) {
  852. var dep = new Dep();
  853. var property = Object.getOwnPropertyDescriptor(obj, key);
  854. if (property && property.configurable === false) {
  855. return
  856. }
  857. // cater for pre-defined getter/setters
  858. var getter = property && property.get;
  859. if (!getter && arguments.length === 2) {
  860. val = obj[key];
  861. }
  862. var setter = property && property.set;
  863. var childOb = !shallow && observe(val);
  864. Object.defineProperty(obj, key, {
  865. enumerable: true,
  866. configurable: true,
  867. get: function reactiveGetter () {
  868. var value = getter ? getter.call(obj) : val;
  869. if (Dep.target) {
  870. dep.depend();
  871. if (childOb) {
  872. childOb.dep.depend();
  873. if (Array.isArray(value)) {
  874. dependArray(value);
  875. }
  876. }
  877. }
  878. return value
  879. },
  880. set: function reactiveSetter (newVal) {
  881. var value = getter ? getter.call(obj) : val;
  882. /* eslint-disable no-self-compare */
  883. if (newVal === value || (newVal !== newVal && value !== value)) {
  884. return
  885. }
  886. /* eslint-enable no-self-compare */
  887. if ("development" !== 'production' && customSetter) {
  888. customSetter();
  889. }
  890. if (setter) {
  891. setter.call(obj, newVal);
  892. } else {
  893. val = newVal;
  894. }
  895. childOb = !shallow && observe(newVal);
  896. dep.notify();
  897. }
  898. });
  899. }
  900. /**
  901. * Set a property on an object. Adds the new property and
  902. * triggers change notification if the property doesn't
  903. * already exist.
  904. */
  905. function set (target, key, val) {
  906. if ("development" !== 'production' &&
  907. (isUndef(target) || isPrimitive(target))
  908. ) {
  909. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  910. }
  911. if (Array.isArray(target) && isValidArrayIndex(key)) {
  912. target.length = Math.max(target.length, key);
  913. target.splice(key, 1, val);
  914. return val
  915. }
  916. if (key in target && !(key in Object.prototype)) {
  917. target[key] = val;
  918. return val
  919. }
  920. var ob = (target).__ob__;
  921. if (target._isVue || (ob && ob.vmCount)) {
  922. "development" !== 'production' && warn(
  923. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  924. 'at runtime - declare it upfront in the data option.'
  925. );
  926. return val
  927. }
  928. if (!ob) {
  929. target[key] = val;
  930. return val
  931. }
  932. defineReactive(ob.value, key, val);
  933. ob.dep.notify();
  934. return val
  935. }
  936. /**
  937. * Delete a property and trigger change if necessary.
  938. */
  939. function del (target, key) {
  940. if ("development" !== 'production' &&
  941. (isUndef(target) || isPrimitive(target))
  942. ) {
  943. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  944. }
  945. if (Array.isArray(target) && isValidArrayIndex(key)) {
  946. target.splice(key, 1);
  947. return
  948. }
  949. var ob = (target).__ob__;
  950. if (target._isVue || (ob && ob.vmCount)) {
  951. "development" !== 'production' && warn(
  952. 'Avoid deleting properties on a Vue instance or its root $data ' +
  953. '- just set it to null.'
  954. );
  955. return
  956. }
  957. if (!hasOwn(target, key)) {
  958. return
  959. }
  960. delete target[key];
  961. if (!ob) {
  962. return
  963. }
  964. ob.dep.notify();
  965. }
  966. /**
  967. * Collect dependencies on array elements when the array is touched, since
  968. * we cannot intercept array element access like property getters.
  969. */
  970. function dependArray (value) {
  971. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  972. e = value[i];
  973. e && e.__ob__ && e.__ob__.dep.depend();
  974. if (Array.isArray(e)) {
  975. dependArray(e);
  976. }
  977. }
  978. }
  979. /* */
  980. /**
  981. * Option overwriting strategies are functions that handle
  982. * how to merge a parent option value and a child option
  983. * value into the final value.
  984. */
  985. var strats = config.optionMergeStrategies;
  986. /**
  987. * Options with restrictions
  988. */
  989. {
  990. strats.el = strats.propsData = function (parent, child, vm, key) {
  991. if (!vm) {
  992. warn(
  993. "option \"" + key + "\" can only be used during instance " +
  994. 'creation with the `new` keyword.'
  995. );
  996. }
  997. return defaultStrat(parent, child)
  998. };
  999. }
  1000. /**
  1001. * Helper that recursively merges two data objects together.
  1002. */
  1003. function mergeData (to, from) {
  1004. if (!from) { return to }
  1005. var key, toVal, fromVal;
  1006. var keys = Object.keys(from);
  1007. for (var i = 0; i < keys.length; i++) {
  1008. key = keys[i];
  1009. toVal = to[key];
  1010. fromVal = from[key];
  1011. if (!hasOwn(to, key)) {
  1012. set(to, key, fromVal);
  1013. } else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
  1014. mergeData(toVal, fromVal);
  1015. }
  1016. }
  1017. return to
  1018. }
  1019. /**
  1020. * Data
  1021. */
  1022. function mergeDataOrFn (
  1023. parentVal,
  1024. childVal,
  1025. vm
  1026. ) {
  1027. if (!vm) {
  1028. // in a Vue.extend merge, both should be functions
  1029. if (!childVal) {
  1030. return parentVal
  1031. }
  1032. if (!parentVal) {
  1033. return childVal
  1034. }
  1035. // when parentVal & childVal are both present,
  1036. // we need to return a function that returns the
  1037. // merged result of both functions... no need to
  1038. // check if parentVal is a function here because
  1039. // it has to be a function to pass previous merges.
  1040. return function mergedDataFn () {
  1041. return mergeData(
  1042. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  1043. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  1044. )
  1045. }
  1046. } else {
  1047. return function mergedInstanceDataFn () {
  1048. // instance merge
  1049. var instanceData = typeof childVal === 'function'
  1050. ? childVal.call(vm, vm)
  1051. : childVal;
  1052. var defaultData = typeof parentVal === 'function'
  1053. ? parentVal.call(vm, vm)
  1054. : parentVal;
  1055. if (instanceData) {
  1056. return mergeData(instanceData, defaultData)
  1057. } else {
  1058. return defaultData
  1059. }
  1060. }
  1061. }
  1062. }
  1063. strats.data = function (
  1064. parentVal,
  1065. childVal,
  1066. vm
  1067. ) {
  1068. if (!vm) {
  1069. if (childVal && typeof childVal !== 'function') {
  1070. "development" !== 'production' && warn(
  1071. 'The "data" option should be a function ' +
  1072. 'that returns a per-instance value in component ' +
  1073. 'definitions.',
  1074. vm
  1075. );
  1076. return parentVal
  1077. }
  1078. return mergeDataOrFn(parentVal, childVal)
  1079. }
  1080. return mergeDataOrFn(parentVal, childVal, vm)
  1081. };
  1082. /**
  1083. * Hooks and props are merged as arrays.
  1084. */
  1085. function mergeHook (
  1086. parentVal,
  1087. childVal
  1088. ) {
  1089. return childVal
  1090. ? parentVal
  1091. ? parentVal.concat(childVal)
  1092. : Array.isArray(childVal)
  1093. ? childVal
  1094. : [childVal]
  1095. : parentVal
  1096. }
  1097. LIFECYCLE_HOOKS.forEach(function (hook) {
  1098. strats[hook] = mergeHook;
  1099. });
  1100. /**
  1101. * Assets
  1102. *
  1103. * When a vm is present (instance creation), we need to do
  1104. * a three-way merge between constructor options, instance
  1105. * options and parent options.
  1106. */
  1107. function mergeAssets (
  1108. parentVal,
  1109. childVal,
  1110. vm,
  1111. key
  1112. ) {
  1113. var res = Object.create(parentVal || null);
  1114. if (childVal) {
  1115. "development" !== 'production' && assertObjectType(key, childVal, vm);
  1116. return extend(res, childVal)
  1117. } else {
  1118. return res
  1119. }
  1120. }
  1121. ASSET_TYPES.forEach(function (type) {
  1122. strats[type + 's'] = mergeAssets;
  1123. });
  1124. /**
  1125. * Watchers.
  1126. *
  1127. * Watchers hashes should not overwrite one
  1128. * another, so we merge them as arrays.
  1129. */
  1130. strats.watch = function (
  1131. parentVal,
  1132. childVal,
  1133. vm,
  1134. key
  1135. ) {
  1136. // work around Firefox's Object.prototype.watch...
  1137. if (parentVal === nativeWatch) { parentVal = undefined; }
  1138. if (childVal === nativeWatch) { childVal = undefined; }
  1139. /* istanbul ignore if */
  1140. if (!childVal) { return Object.create(parentVal || null) }
  1141. {
  1142. assertObjectType(key, childVal, vm);
  1143. }
  1144. if (!parentVal) { return childVal }
  1145. var ret = {};
  1146. extend(ret, parentVal);
  1147. for (var key$1 in childVal) {
  1148. var parent = ret[key$1];
  1149. var child = childVal[key$1];
  1150. if (parent && !Array.isArray(parent)) {
  1151. parent = [parent];
  1152. }
  1153. ret[key$1] = parent
  1154. ? parent.concat(child)
  1155. : Array.isArray(child) ? child : [child];
  1156. }
  1157. return ret
  1158. };
  1159. /**
  1160. * Other object hashes.
  1161. */
  1162. strats.props =
  1163. strats.methods =
  1164. strats.inject =
  1165. strats.computed = function (
  1166. parentVal,
  1167. childVal,
  1168. vm,
  1169. key
  1170. ) {
  1171. if (childVal && "development" !== 'production') {
  1172. assertObjectType(key, childVal, vm);
  1173. }
  1174. if (!parentVal) { return childVal }
  1175. var ret = Object.create(null);
  1176. extend(ret, parentVal);
  1177. if (childVal) { extend(ret, childVal); }
  1178. return ret
  1179. };
  1180. strats.provide = mergeDataOrFn;
  1181. /**
  1182. * Default strategy.
  1183. */
  1184. var defaultStrat = function (parentVal, childVal) {
  1185. return childVal === undefined
  1186. ? parentVal
  1187. : childVal
  1188. };
  1189. /**
  1190. * Validate component names
  1191. */
  1192. function checkComponents (options) {
  1193. for (var key in options.components) {
  1194. validateComponentName(key);
  1195. }
  1196. }
  1197. function validateComponentName (name) {
  1198. if (!/^[a-zA-Z][\w-]*$/.test(name)) {
  1199. warn(
  1200. 'Invalid component name: "' + name + '". Component names ' +
  1201. 'can only contain alphanumeric characters and the hyphen, ' +
  1202. 'and must start with a letter.'
  1203. );
  1204. }
  1205. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  1206. warn(
  1207. 'Do not use built-in or reserved HTML elements as component ' +
  1208. 'id: ' + name
  1209. );
  1210. }
  1211. }
  1212. /**
  1213. * Ensure all props option syntax are normalized into the
  1214. * Object-based format.
  1215. */
  1216. function normalizeProps (options, vm) {
  1217. var props = options.props;
  1218. if (!props) { return }
  1219. var res = {};
  1220. var i, val, name;
  1221. if (Array.isArray(props)) {
  1222. i = props.length;
  1223. while (i--) {
  1224. val = props[i];
  1225. if (typeof val === 'string') {
  1226. name = camelize(val);
  1227. res[name] = { type: null };
  1228. } else {
  1229. warn('props must be strings when using array syntax.');
  1230. }
  1231. }
  1232. } else if (isPlainObject(props)) {
  1233. for (var key in props) {
  1234. val = props[key];
  1235. name = camelize(key);
  1236. res[name] = isPlainObject(val)
  1237. ? val
  1238. : { type: val };
  1239. }
  1240. } else {
  1241. warn(
  1242. "Invalid value for option \"props\": expected an Array or an Object, " +
  1243. "but got " + (toRawType(props)) + ".",
  1244. vm
  1245. );
  1246. }
  1247. options.props = res;
  1248. }
  1249. /**
  1250. * Normalize all injections into Object-based format
  1251. */
  1252. function normalizeInject (options, vm) {
  1253. var inject = options.inject;
  1254. if (!inject) { return }
  1255. var normalized = options.inject = {};
  1256. if (Array.isArray(inject)) {
  1257. for (var i = 0; i < inject.length; i++) {
  1258. normalized[inject[i]] = { from: inject[i] };
  1259. }
  1260. } else if (isPlainObject(inject)) {
  1261. for (var key in inject) {
  1262. var val = inject[key];
  1263. normalized[key] = isPlainObject(val)
  1264. ? extend({ from: key }, val)
  1265. : { from: val };
  1266. }
  1267. } else {
  1268. warn(
  1269. "Invalid value for option \"inject\": expected an Array or an Object, " +
  1270. "but got " + (toRawType(inject)) + ".",
  1271. vm
  1272. );
  1273. }
  1274. }
  1275. /**
  1276. * Normalize raw function directives into object format.
  1277. */
  1278. function normalizeDirectives (options) {
  1279. var dirs = options.directives;
  1280. if (dirs) {
  1281. for (var key in dirs) {
  1282. var def = dirs[key];
  1283. if (typeof def === 'function') {
  1284. dirs[key] = { bind: def, update: def };
  1285. }
  1286. }
  1287. }
  1288. }
  1289. function assertObjectType (name, value, vm) {
  1290. if (!isPlainObject(value)) {
  1291. warn(
  1292. "Invalid value for option \"" + name + "\": expected an Object, " +
  1293. "but got " + (toRawType(value)) + ".",
  1294. vm
  1295. );
  1296. }
  1297. }
  1298. /**
  1299. * Merge two option objects into a new one.
  1300. * Core utility used in both instantiation and inheritance.
  1301. */
  1302. function mergeOptions (
  1303. parent,
  1304. child,
  1305. vm
  1306. ) {
  1307. {
  1308. checkComponents(child);
  1309. }
  1310. if (typeof child === 'function') {
  1311. child = child.options;
  1312. }
  1313. normalizeProps(child, vm);
  1314. normalizeInject(child, vm);
  1315. normalizeDirectives(child);
  1316. var extendsFrom = child.extends;
  1317. if (extendsFrom) {
  1318. parent = mergeOptions(parent, extendsFrom, vm);
  1319. }
  1320. if (child.mixins) {
  1321. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1322. parent = mergeOptions(parent, child.mixins[i], vm);
  1323. }
  1324. }
  1325. var options = {};
  1326. var key;
  1327. for (key in parent) {
  1328. mergeField(key);
  1329. }
  1330. for (key in child) {
  1331. if (!hasOwn(parent, key)) {
  1332. mergeField(key);
  1333. }
  1334. }
  1335. function mergeField (key) {
  1336. var strat = strats[key] || defaultStrat;
  1337. options[key] = strat(parent[key], child[key], vm, key);
  1338. }
  1339. return options
  1340. }
  1341. /**
  1342. * Resolve an asset.
  1343. * This function is used because child instances need access
  1344. * to assets defined in its ancestor chain.
  1345. */
  1346. function resolveAsset (
  1347. options,
  1348. type,
  1349. id,
  1350. warnMissing
  1351. ) {
  1352. /* istanbul ignore if */
  1353. if (typeof id !== 'string') {
  1354. return
  1355. }
  1356. var assets = options[type];
  1357. // check local registration variations first
  1358. if (hasOwn(assets, id)) { return assets[id] }
  1359. var camelizedId = camelize(id);
  1360. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  1361. var PascalCaseId = capitalize(camelizedId);
  1362. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  1363. // fallback to prototype chain
  1364. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  1365. if ("development" !== 'production' && warnMissing && !res) {
  1366. warn(
  1367. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  1368. options
  1369. );
  1370. }
  1371. return res
  1372. }
  1373. /* */
  1374. function validateProp (
  1375. key,
  1376. propOptions,
  1377. propsData,
  1378. vm
  1379. ) {
  1380. var prop = propOptions[key];
  1381. var absent = !hasOwn(propsData, key);
  1382. var value = propsData[key];
  1383. // boolean casting
  1384. var booleanIndex = getTypeIndex(Boolean, prop.type);
  1385. if (booleanIndex > -1) {
  1386. if (absent && !hasOwn(prop, 'default')) {
  1387. value = false;
  1388. } else if (value === '' || value === hyphenate(key)) {
  1389. // only cast empty string / same name to boolean if
  1390. // boolean has higher priority
  1391. var stringIndex = getTypeIndex(String, prop.type);
  1392. if (stringIndex < 0 || booleanIndex < stringIndex) {
  1393. value = true;
  1394. }
  1395. }
  1396. }
  1397. // check default value
  1398. if (value === undefined) {
  1399. value = getPropDefaultValue(vm, prop, key);
  1400. // since the default value is a fresh copy,
  1401. // make sure to observe it.
  1402. var prevShouldObserve = shouldObserve;
  1403. toggleObserving(true);
  1404. observe(value);
  1405. toggleObserving(prevShouldObserve);
  1406. }
  1407. {
  1408. assertProp(prop, key, value, vm, absent);
  1409. }
  1410. return value
  1411. }
  1412. /**
  1413. * Get the default value of a prop.
  1414. */
  1415. function getPropDefaultValue (vm, prop, key) {
  1416. // no default, return undefined
  1417. if (!hasOwn(prop, 'default')) {
  1418. return undefined
  1419. }
  1420. var def = prop.default;
  1421. // warn against non-factory defaults for Object & Array
  1422. if ("development" !== 'production' && isObject(def)) {
  1423. warn(
  1424. 'Invalid default value for prop "' + key + '": ' +
  1425. 'Props with type Object/Array must use a factory function ' +
  1426. 'to return the default value.',
  1427. vm
  1428. );
  1429. }
  1430. // the raw prop value was also undefined from previous render,
  1431. // return previous default value to avoid unnecessary watcher trigger
  1432. if (vm && vm.$options.propsData &&
  1433. vm.$options.propsData[key] === undefined &&
  1434. vm._props[key] !== undefined
  1435. ) {
  1436. return vm._props[key]
  1437. }
  1438. // call factory function for non-Function types
  1439. // a value is Function if its prototype is function even across different execution context
  1440. return typeof def === 'function' && getType(prop.type) !== 'Function'
  1441. ? def.call(vm)
  1442. : def
  1443. }
  1444. /**
  1445. * Assert whether a prop is valid.
  1446. */
  1447. function assertProp (
  1448. prop,
  1449. name,
  1450. value,
  1451. vm,
  1452. absent
  1453. ) {
  1454. if (prop.required && absent) {
  1455. warn(
  1456. 'Missing required prop: "' + name + '"',
  1457. vm
  1458. );
  1459. return
  1460. }
  1461. if (value == null && !prop.required) {
  1462. return
  1463. }
  1464. var type = prop.type;
  1465. var valid = !type || type === true;
  1466. var expectedTypes = [];
  1467. if (type) {
  1468. if (!Array.isArray(type)) {
  1469. type = [type];
  1470. }
  1471. for (var i = 0; i < type.length && !valid; i++) {
  1472. var assertedType = assertType(value, type[i]);
  1473. expectedTypes.push(assertedType.expectedType || '');
  1474. valid = assertedType.valid;
  1475. }
  1476. }
  1477. if (!valid) {
  1478. warn(
  1479. "Invalid prop: type check failed for prop \"" + name + "\"." +
  1480. " Expected " + (expectedTypes.map(capitalize).join(', ')) +
  1481. ", got " + (toRawType(value)) + ".",
  1482. vm
  1483. );
  1484. return
  1485. }
  1486. var validator = prop.validator;
  1487. if (validator) {
  1488. if (!validator(value)) {
  1489. warn(
  1490. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  1491. vm
  1492. );
  1493. }
  1494. }
  1495. }
  1496. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  1497. function assertType (value, type) {
  1498. var valid;
  1499. var expectedType = getType(type);
  1500. if (simpleCheckRE.test(expectedType)) {
  1501. var t = typeof value;
  1502. valid = t === expectedType.toLowerCase();
  1503. // for primitive wrapper objects
  1504. if (!valid && t === 'object') {
  1505. valid = value instanceof type;
  1506. }
  1507. } else if (expectedType === 'Object') {
  1508. valid = isPlainObject(value);
  1509. } else if (expectedType === 'Array') {
  1510. valid = Array.isArray(value);
  1511. } else {
  1512. valid = value instanceof type;
  1513. }
  1514. return {
  1515. valid: valid,
  1516. expectedType: expectedType
  1517. }
  1518. }
  1519. /**
  1520. * Use function string name to check built-in types,
  1521. * because a simple equality check will fail when running
  1522. * across different vms / iframes.
  1523. */
  1524. function getType (fn) {
  1525. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  1526. return match ? match[1] : ''
  1527. }
  1528. function isSameType (a, b) {
  1529. return getType(a) === getType(b)
  1530. }
  1531. function getTypeIndex (type, expectedTypes) {
  1532. if (!Array.isArray(expectedTypes)) {
  1533. return isSameType(expectedTypes, type) ? 0 : -1
  1534. }
  1535. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  1536. if (isSameType(expectedTypes[i], type)) {
  1537. return i
  1538. }
  1539. }
  1540. return -1
  1541. }
  1542. /* */
  1543. function handleError (err, vm, info) {
  1544. if (vm) {
  1545. var cur = vm;
  1546. while ((cur = cur.$parent)) {
  1547. var hooks = cur.$options.errorCaptured;
  1548. if (hooks) {
  1549. for (var i = 0; i < hooks.length; i++) {
  1550. try {
  1551. var capture = hooks[i].call(cur, err, vm, info) === false;
  1552. if (capture) { return }
  1553. } catch (e) {
  1554. globalHandleError(e, cur, 'errorCaptured hook');
  1555. }
  1556. }
  1557. }
  1558. }
  1559. }
  1560. globalHandleError(err, vm, info);
  1561. }
  1562. function globalHandleError (err, vm, info) {
  1563. if (config.errorHandler) {
  1564. try {
  1565. return config.errorHandler.call(null, err, vm, info)
  1566. } catch (e) {
  1567. logError(e, null, 'config.errorHandler');
  1568. }
  1569. }
  1570. logError(err, vm, info);
  1571. }
  1572. function logError (err, vm, info) {
  1573. {
  1574. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  1575. }
  1576. /* istanbul ignore else */
  1577. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  1578. console.error(err);
  1579. } else {
  1580. throw err
  1581. }
  1582. }
  1583. /* */
  1584. /* globals MessageChannel */
  1585. var callbacks = [];
  1586. var pending = false;
  1587. function flushCallbacks () {
  1588. pending = false;
  1589. var copies = callbacks.slice(0);
  1590. callbacks.length = 0;
  1591. for (var i = 0; i < copies.length; i++) {
  1592. copies[i]();
  1593. }
  1594. }
  1595. // Here we have async deferring wrappers using both microtasks and (macro) tasks.
  1596. // In < 2.4 we used microtasks everywhere, but there are some scenarios where
  1597. // microtasks have too high a priority and fire in between supposedly
  1598. // sequential events (e.g. #4521, #6690) or even between bubbling of the same
  1599. // event (#6566). However, using (macro) tasks everywhere also has subtle problems
  1600. // when state is changed right before repaint (e.g. #6813, out-in transitions).
  1601. // Here we use microtask by default, but expose a way to force (macro) task when
  1602. // needed (e.g. in event handlers attached by v-on).
  1603. var microTimerFunc;
  1604. var macroTimerFunc;
  1605. var useMacroTask = false;
  1606. // Determine (macro) task defer implementation.
  1607. // Technically setImmediate should be the ideal choice, but it's only available
  1608. // in IE. The only polyfill that consistently queues the callback after all DOM
  1609. // events triggered in the same loop is by using MessageChannel.
  1610. /* istanbul ignore if */
  1611. if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  1612. macroTimerFunc = function () {
  1613. setImmediate(flushCallbacks);
  1614. };
  1615. } else if (typeof MessageChannel !== 'undefined' && (
  1616. isNative(MessageChannel) ||
  1617. // PhantomJS
  1618. MessageChannel.toString() === '[object MessageChannelConstructor]'
  1619. )) {
  1620. var channel = new MessageChannel();
  1621. var port = channel.port2;
  1622. channel.port1.onmessage = flushCallbacks;
  1623. macroTimerFunc = function () {
  1624. port.postMessage(1);
  1625. };
  1626. } else {
  1627. /* istanbul ignore next */
  1628. macroTimerFunc = function () {
  1629. setTimeout(flushCallbacks, 0);
  1630. };
  1631. }
  1632. // Determine microtask defer implementation.
  1633. /* istanbul ignore next, $flow-disable-line */
  1634. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  1635. var p = Promise.resolve();
  1636. microTimerFunc = function () {
  1637. p.then(flushCallbacks);
  1638. // in problematic UIWebViews, Promise.then doesn't completely break, but
  1639. // it can get stuck in a weird state where callbacks are pushed into the
  1640. // microtask queue but the queue isn't being flushed, until the browser
  1641. // needs to do some other work, e.g. handle a timer. Therefore we can
  1642. // "force" the microtask queue to be flushed by adding an empty timer.
  1643. if (isIOS) { setTimeout(noop); }
  1644. };
  1645. } else {
  1646. // fallback to macro
  1647. microTimerFunc = macroTimerFunc;
  1648. }
  1649. /**
  1650. * Wrap a function so that if any code inside triggers state change,
  1651. * the changes are queued using a (macro) task instead of a microtask.
  1652. */
  1653. function withMacroTask (fn) {
  1654. return fn._withTask || (fn._withTask = function () {
  1655. useMacroTask = true;
  1656. var res = fn.apply(null, arguments);
  1657. useMacroTask = false;
  1658. return res
  1659. })
  1660. }
  1661. function nextTick (cb, ctx) {
  1662. var _resolve;
  1663. callbacks.push(function () {
  1664. if (cb) {
  1665. try {
  1666. cb.call(ctx);
  1667. } catch (e) {
  1668. handleError(e, ctx, 'nextTick');
  1669. }
  1670. } else if (_resolve) {
  1671. _resolve(ctx);
  1672. }
  1673. });
  1674. if (!pending) {
  1675. pending = true;
  1676. if (useMacroTask) {
  1677. macroTimerFunc();
  1678. } else {
  1679. microTimerFunc();
  1680. }
  1681. }
  1682. // $flow-disable-line
  1683. if (!cb && typeof Promise !== 'undefined') {
  1684. return new Promise(function (resolve) {
  1685. _resolve = resolve;
  1686. })
  1687. }
  1688. }
  1689. /* */
  1690. var mark;
  1691. var measure;
  1692. {
  1693. var perf = inBrowser && window.performance;
  1694. /* istanbul ignore if */
  1695. if (
  1696. perf &&
  1697. perf.mark &&
  1698. perf.measure &&
  1699. perf.clearMarks &&
  1700. perf.clearMeasures
  1701. ) {
  1702. mark = function (tag) { return perf.mark(tag); };
  1703. measure = function (name, startTag, endTag) {
  1704. perf.measure(name, startTag, endTag);
  1705. perf.clearMarks(startTag);
  1706. perf.clearMarks(endTag);
  1707. perf.clearMeasures(name);
  1708. };
  1709. }
  1710. }
  1711. /* not type checking this file because flow doesn't play well with Proxy */
  1712. var initProxy;
  1713. {
  1714. var allowedGlobals = makeMap(
  1715. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  1716. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  1717. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  1718. 'require' // for Webpack/Browserify
  1719. );
  1720. var warnNonPresent = function (target, key) {
  1721. warn(
  1722. "Property or method \"" + key + "\" is not defined on the instance but " +
  1723. 'referenced during render. Make sure that this property is reactive, ' +
  1724. 'either in the data option, or for class-based components, by ' +
  1725. 'initializing the property. ' +
  1726. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  1727. target
  1728. );
  1729. };
  1730. var hasProxy =
  1731. typeof Proxy !== 'undefined' && isNative(Proxy);
  1732. if (hasProxy) {
  1733. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  1734. config.keyCodes = new Proxy(config.keyCodes, {
  1735. set: function set (target, key, value) {
  1736. if (isBuiltInModifier(key)) {
  1737. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  1738. return false
  1739. } else {
  1740. target[key] = value;
  1741. return true
  1742. }
  1743. }
  1744. });
  1745. }
  1746. var hasHandler = {
  1747. has: function has (target, key) {
  1748. var has = key in target;
  1749. var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
  1750. if (!has && !isAllowed) {
  1751. warnNonPresent(target, key);
  1752. }
  1753. return has || !isAllowed
  1754. }
  1755. };
  1756. var getHandler = {
  1757. get: function get (target, key) {
  1758. if (typeof key === 'string' && !(key in target)) {
  1759. warnNonPresent(target, key);
  1760. }
  1761. return target[key]
  1762. }
  1763. };
  1764. initProxy = function initProxy (vm) {
  1765. if (hasProxy) {
  1766. // determine which proxy handler to use
  1767. var options = vm.$options;
  1768. var handlers = options.render && options.render._withStripped
  1769. ? getHandler
  1770. : hasHandler;
  1771. vm._renderProxy = new Proxy(vm, handlers);
  1772. } else {
  1773. vm._renderProxy = vm;
  1774. }
  1775. };
  1776. }
  1777. /* */
  1778. var seenObjects = new _Set();
  1779. /**
  1780. * Recursively traverse an object to evoke all converted
  1781. * getters, so that every nested property inside the object
  1782. * is collected as a "deep" dependency.
  1783. */
  1784. function traverse (val) {
  1785. _traverse(val, seenObjects);
  1786. seenObjects.clear();
  1787. }
  1788. function _traverse (val, seen) {
  1789. var i, keys;
  1790. var isA = Array.isArray(val);
  1791. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  1792. return
  1793. }
  1794. if (val.__ob__) {
  1795. var depId = val.__ob__.dep.id;
  1796. if (seen.has(depId)) {
  1797. return
  1798. }
  1799. seen.add(depId);
  1800. }
  1801. if (isA) {
  1802. i = val.length;
  1803. while (i--) { _traverse(val[i], seen); }
  1804. } else {
  1805. keys = Object.keys(val);
  1806. i = keys.length;
  1807. while (i--) { _traverse(val[keys[i]], seen); }
  1808. }
  1809. }
  1810. /* */
  1811. var normalizeEvent = cached(function (name) {
  1812. var passive = name.charAt(0) === '&';
  1813. name = passive ? name.slice(1) : name;
  1814. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  1815. name = once$$1 ? name.slice(1) : name;
  1816. var capture = name.charAt(0) === '!';
  1817. name = capture ? name.slice(1) : name;
  1818. return {
  1819. name: name,
  1820. once: once$$1,
  1821. capture: capture,
  1822. passive: passive
  1823. }
  1824. });
  1825. function createFnInvoker (fns) {
  1826. function invoker () {
  1827. var arguments$1 = arguments;
  1828. var fns = invoker.fns;
  1829. if (Array.isArray(fns)) {
  1830. var cloned = fns.slice();
  1831. for (var i = 0; i < cloned.length; i++) {
  1832. cloned[i].apply(null, arguments$1);
  1833. }
  1834. } else {
  1835. // return handler return value for single handlers
  1836. return fns.apply(null, arguments)
  1837. }
  1838. }
  1839. invoker.fns = fns;
  1840. return invoker
  1841. }
  1842. function updateListeners (
  1843. on,
  1844. oldOn,
  1845. add,
  1846. remove$$1,
  1847. vm
  1848. ) {
  1849. var name, def, cur, old, event;
  1850. for (name in on) {
  1851. def = cur = on[name];
  1852. old = oldOn[name];
  1853. event = normalizeEvent(name);
  1854. /* istanbul ignore if */
  1855. if (isUndef(cur)) {
  1856. "development" !== 'production' && warn(
  1857. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  1858. vm
  1859. );
  1860. } else if (isUndef(old)) {
  1861. if (isUndef(cur.fns)) {
  1862. cur = on[name] = createFnInvoker(cur);
  1863. }
  1864. add(event.name, cur, event.once, event.capture, event.passive, event.params);
  1865. } else if (cur !== old) {
  1866. old.fns = cur;
  1867. on[name] = old;
  1868. }
  1869. }
  1870. for (name in oldOn) {
  1871. if (isUndef(on[name])) {
  1872. event = normalizeEvent(name);
  1873. remove$$1(event.name, oldOn[name], event.capture);
  1874. }
  1875. }
  1876. }
  1877. /* */
  1878. function mergeVNodeHook (def, hookKey, hook) {
  1879. if (def instanceof VNode) {
  1880. def = def.data.hook || (def.data.hook = {});
  1881. }
  1882. var invoker;
  1883. var oldHook = def[hookKey];
  1884. function wrappedHook () {
  1885. hook.apply(this, arguments);
  1886. // important: remove merged hook to ensure it's called only once
  1887. // and prevent memory leak
  1888. remove(invoker.fns, wrappedHook);
  1889. }
  1890. if (isUndef(oldHook)) {
  1891. // no existing hook
  1892. invoker = createFnInvoker([wrappedHook]);
  1893. } else {
  1894. /* istanbul ignore if */
  1895. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  1896. // already a merged invoker
  1897. invoker = oldHook;
  1898. invoker.fns.push(wrappedHook);
  1899. } else {
  1900. // existing plain hook
  1901. invoker = createFnInvoker([oldHook, wrappedHook]);
  1902. }
  1903. }
  1904. invoker.merged = true;
  1905. def[hookKey] = invoker;
  1906. }
  1907. /* */
  1908. function extractPropsFromVNodeData (
  1909. data,
  1910. Ctor,
  1911. tag
  1912. ) {
  1913. // we are only extracting raw values here.
  1914. // validation and default values are handled in the child
  1915. // component itself.
  1916. var propOptions = Ctor.options.props;
  1917. if (isUndef(propOptions)) {
  1918. return
  1919. }
  1920. var res = {};
  1921. var attrs = data.attrs;
  1922. var props = data.props;
  1923. if (isDef(attrs) || isDef(props)) {
  1924. for (var key in propOptions) {
  1925. var altKey = hyphenate(key);
  1926. {
  1927. var keyInLowerCase = key.toLowerCase();
  1928. if (
  1929. key !== keyInLowerCase &&
  1930. attrs && hasOwn(attrs, keyInLowerCase)
  1931. ) {
  1932. tip(
  1933. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  1934. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  1935. " \"" + key + "\". " +
  1936. "Note that HTML attributes are case-insensitive and camelCased " +
  1937. "props need to use their kebab-case equivalents when using in-DOM " +
  1938. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  1939. );
  1940. }
  1941. }
  1942. checkProp(res, props, key, altKey, true) ||
  1943. checkProp(res, attrs, key, altKey, false);
  1944. }
  1945. }
  1946. return res
  1947. }
  1948. function checkProp (
  1949. res,
  1950. hash,
  1951. key,
  1952. altKey,
  1953. preserve
  1954. ) {
  1955. if (isDef(hash)) {
  1956. if (hasOwn(hash, key)) {
  1957. res[key] = hash[key];
  1958. if (!preserve) {
  1959. delete hash[key];
  1960. }
  1961. return true
  1962. } else if (hasOwn(hash, altKey)) {
  1963. res[key] = hash[altKey];
  1964. if (!preserve) {
  1965. delete hash[altKey];
  1966. }
  1967. return true
  1968. }
  1969. }
  1970. return false
  1971. }
  1972. /* */
  1973. // The template compiler attempts to minimize the need for normalization by
  1974. // statically analyzing the template at compile time.
  1975. //
  1976. // For plain HTML markup, normalization can be completely skipped because the
  1977. // generated render function is guaranteed to return Array<VNode>. There are
  1978. // two cases where extra normalization is needed:
  1979. // 1. When the children contains components - because a functional component
  1980. // may return an Array instead of a single root. In this case, just a simple
  1981. // normalization is needed - if any child is an Array, we flatten the whole
  1982. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  1983. // because functional components already normalize their own children.
  1984. function simpleNormalizeChildren (children) {
  1985. for (var i = 0; i < children.length; i++) {
  1986. if (Array.isArray(children[i])) {
  1987. return Array.prototype.concat.apply([], children)
  1988. }
  1989. }
  1990. return children
  1991. }
  1992. // 2. When the children contains constructs that always generated nested Arrays,
  1993. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  1994. // with hand-written render functions / JSX. In such cases a full normalization
  1995. // is needed to cater to all possible types of children values.
  1996. function normalizeChildren (children) {
  1997. return isPrimitive(children)
  1998. ? [createTextVNode(children)]
  1999. : Array.isArray(children)
  2000. ? normalizeArrayChildren(children)
  2001. : undefined
  2002. }
  2003. function isTextNode (node) {
  2004. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  2005. }
  2006. function normalizeArrayChildren (children, nestedIndex) {
  2007. var res = [];
  2008. var i, c, lastIndex, last;
  2009. for (i = 0; i < children.length; i++) {
  2010. c = children[i];
  2011. if (isUndef(c) || typeof c === 'boolean') { continue }
  2012. lastIndex = res.length - 1;
  2013. last = res[lastIndex];
  2014. // nested
  2015. if (Array.isArray(c)) {
  2016. if (c.length > 0) {
  2017. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  2018. // merge adjacent text nodes
  2019. if (isTextNode(c[0]) && isTextNode(last)) {
  2020. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  2021. c.shift();
  2022. }
  2023. res.push.apply(res, c);
  2024. }
  2025. } else if (isPrimitive(c)) {
  2026. if (isTextNode(last)) {
  2027. // merge adjacent text nodes
  2028. // this is necessary for SSR hydration because text nodes are
  2029. // essentially merged when rendered to HTML strings
  2030. res[lastIndex] = createTextVNode(last.text + c);
  2031. } else if (c !== '') {
  2032. // convert primitive to vnode
  2033. res.push(createTextVNode(c));
  2034. }
  2035. } else {
  2036. if (isTextNode(c) && isTextNode(last)) {
  2037. // merge adjacent text nodes
  2038. res[lastIndex] = createTextVNode(last.text + c.text);
  2039. } else {
  2040. // default key for nested array children (likely generated by v-for)
  2041. if (isTrue(children._isVList) &&
  2042. isDef(c.tag) &&
  2043. isUndef(c.key) &&
  2044. isDef(nestedIndex)) {
  2045. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  2046. }
  2047. res.push(c);
  2048. }
  2049. }
  2050. }
  2051. return res
  2052. }
  2053. /* */
  2054. function ensureCtor (comp, base) {
  2055. if (
  2056. comp.__esModule ||
  2057. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  2058. ) {
  2059. comp = comp.default;
  2060. }
  2061. return isObject(comp)
  2062. ? base.extend(comp)
  2063. : comp
  2064. }
  2065. function createAsyncPlaceholder (
  2066. factory,
  2067. data,
  2068. context,
  2069. children,
  2070. tag
  2071. ) {
  2072. var node = createEmptyVNode();
  2073. node.asyncFactory = factory;
  2074. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  2075. return node
  2076. }
  2077. function resolveAsyncComponent (
  2078. factory,
  2079. baseCtor,
  2080. context
  2081. ) {
  2082. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  2083. return factory.errorComp
  2084. }
  2085. if (isDef(factory.resolved)) {
  2086. return factory.resolved
  2087. }
  2088. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  2089. return factory.loadingComp
  2090. }
  2091. if (isDef(factory.contexts)) {
  2092. // already pending
  2093. factory.contexts.push(context);
  2094. } else {
  2095. var contexts = factory.contexts = [context];
  2096. var sync = true;
  2097. var forceRender = function () {
  2098. for (var i = 0, l = contexts.length; i < l; i++) {
  2099. contexts[i].$forceUpdate();
  2100. }
  2101. };
  2102. var resolve = once(function (res) {
  2103. // cache resolved
  2104. factory.resolved = ensureCtor(res, baseCtor);
  2105. // invoke callbacks only if this is not a synchronous resolve
  2106. // (async resolves are shimmed as synchronous during SSR)
  2107. if (!sync) {
  2108. forceRender();
  2109. }
  2110. });
  2111. var reject = once(function (reason) {
  2112. "development" !== 'production' && warn(
  2113. "Failed to resolve async component: " + (String(factory)) +
  2114. (reason ? ("\nReason: " + reason) : '')
  2115. );
  2116. if (isDef(factory.errorComp)) {
  2117. factory.error = true;
  2118. forceRender();
  2119. }
  2120. });
  2121. var res = factory(resolve, reject);
  2122. if (isObject(res)) {
  2123. if (typeof res.then === 'function') {
  2124. // () => Promise
  2125. if (isUndef(factory.resolved)) {
  2126. res.then(resolve, reject);
  2127. }
  2128. } else if (isDef(res.component) && typeof res.component.then === 'function') {
  2129. res.component.then(resolve, reject);
  2130. if (isDef(res.error)) {
  2131. factory.errorComp = ensureCtor(res.error, baseCtor);
  2132. }
  2133. if (isDef(res.loading)) {
  2134. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  2135. if (res.delay === 0) {
  2136. factory.loading = true;
  2137. } else {
  2138. setTimeout(function () {
  2139. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  2140. factory.loading = true;
  2141. forceRender();
  2142. }
  2143. }, res.delay || 200);
  2144. }
  2145. }
  2146. if (isDef(res.timeout)) {
  2147. setTimeout(function () {
  2148. if (isUndef(factory.resolved)) {
  2149. reject(
  2150. "timeout (" + (res.timeout) + "ms)"
  2151. );
  2152. }
  2153. }, res.timeout);
  2154. }
  2155. }
  2156. }
  2157. sync = false;
  2158. // return in case resolved synchronously
  2159. return factory.loading
  2160. ? factory.loadingComp
  2161. : factory.resolved
  2162. }
  2163. }
  2164. /* */
  2165. function isAsyncPlaceholder (node) {
  2166. return node.isComment && node.asyncFactory
  2167. }
  2168. /* */
  2169. function getFirstComponentChild (children) {
  2170. if (Array.isArray(children)) {
  2171. for (var i = 0; i < children.length; i++) {
  2172. var c = children[i];
  2173. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  2174. return c
  2175. }
  2176. }
  2177. }
  2178. }
  2179. /* */
  2180. /* */
  2181. function initEvents (vm) {
  2182. vm._events = Object.create(null);
  2183. vm._hasHookEvent = false;
  2184. // init parent attached events
  2185. var listeners = vm.$options._parentListeners;
  2186. if (listeners) {
  2187. updateComponentListeners(vm, listeners);
  2188. }
  2189. }
  2190. var target;
  2191. function add (event, fn, once) {
  2192. if (once) {
  2193. target.$once(event, fn);
  2194. } else {
  2195. target.$on(event, fn);
  2196. }
  2197. }
  2198. function remove$1 (event, fn) {
  2199. target.$off(event, fn);
  2200. }
  2201. function updateComponentListeners (
  2202. vm,
  2203. listeners,
  2204. oldListeners
  2205. ) {
  2206. target = vm;
  2207. updateListeners(listeners, oldListeners || {}, add, remove$1, vm);
  2208. target = undefined;
  2209. }
  2210. function eventsMixin (Vue) {
  2211. var hookRE = /^hook:/;
  2212. Vue.prototype.$on = function (event, fn) {
  2213. var this$1 = this;
  2214. var vm = this;
  2215. if (Array.isArray(event)) {
  2216. for (var i = 0, l = event.length; i < l; i++) {
  2217. this$1.$on(event[i], fn);
  2218. }
  2219. } else {
  2220. (vm._events[event] || (vm._events[event] = [])).push(fn);
  2221. // optimize hook:event cost by using a boolean flag marked at registration
  2222. // instead of a hash lookup
  2223. if (hookRE.test(event)) {
  2224. vm._hasHookEvent = true;
  2225. }
  2226. }
  2227. return vm
  2228. };
  2229. Vue.prototype.$once = function (event, fn) {
  2230. var vm = this;
  2231. function on () {
  2232. vm.$off(event, on);
  2233. fn.apply(vm, arguments);
  2234. }
  2235. on.fn = fn;
  2236. vm.$on(event, on);
  2237. return vm
  2238. };
  2239. Vue.prototype.$off = function (event, fn) {
  2240. var this$1 = this;
  2241. var vm = this;
  2242. // all
  2243. if (!arguments.length) {
  2244. vm._events = Object.create(null);
  2245. return vm
  2246. }
  2247. // array of events
  2248. if (Array.isArray(event)) {
  2249. for (var i = 0, l = event.length; i < l; i++) {
  2250. this$1.$off(event[i], fn);
  2251. }
  2252. return vm
  2253. }
  2254. // specific event
  2255. var cbs = vm._events[event];
  2256. if (!cbs) {
  2257. return vm
  2258. }
  2259. if (!fn) {
  2260. vm._events[event] = null;
  2261. return vm
  2262. }
  2263. if (fn) {
  2264. // specific handler
  2265. var cb;
  2266. var i$1 = cbs.length;
  2267. while (i$1--) {
  2268. cb = cbs[i$1];
  2269. if (cb === fn || cb.fn === fn) {
  2270. cbs.splice(i$1, 1);
  2271. break
  2272. }
  2273. }
  2274. }
  2275. return vm
  2276. };
  2277. Vue.prototype.$emit = function (event) {
  2278. var vm = this;
  2279. {
  2280. var lowerCaseEvent = event.toLowerCase();
  2281. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  2282. tip(
  2283. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  2284. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  2285. "Note that HTML attributes are case-insensitive and you cannot use " +
  2286. "v-on to listen to camelCase events when using in-DOM templates. " +
  2287. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  2288. );
  2289. }
  2290. }
  2291. var cbs = vm._events[event];
  2292. if (cbs) {
  2293. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  2294. var args = toArray(arguments, 1);
  2295. for (var i = 0, l = cbs.length; i < l; i++) {
  2296. try {
  2297. cbs[i].apply(vm, args);
  2298. } catch (e) {
  2299. handleError(e, vm, ("event handler for \"" + event + "\""));
  2300. }
  2301. }
  2302. }
  2303. return vm
  2304. };
  2305. }
  2306. /* */
  2307. /**
  2308. * Runtime helper for resolving raw children VNodes into a slot object.
  2309. */
  2310. function resolveSlots (
  2311. children,
  2312. context
  2313. ) {
  2314. var slots = {};
  2315. if (!children) {
  2316. return slots
  2317. }
  2318. for (var i = 0, l = children.length; i < l; i++) {
  2319. var child = children[i];
  2320. var data = child.data;
  2321. // remove slot attribute if the node is resolved as a Vue slot node
  2322. if (data && data.attrs && data.attrs.slot) {
  2323. delete data.attrs.slot;
  2324. }
  2325. // named slots should only be respected if the vnode was rendered in the
  2326. // same context.
  2327. if ((child.context === context || child.fnContext === context) &&
  2328. data && data.slot != null
  2329. ) {
  2330. var name = data.slot;
  2331. var slot = (slots[name] || (slots[name] = []));
  2332. if (child.tag === 'template') {
  2333. slot.push.apply(slot, child.children || []);
  2334. } else {
  2335. slot.push(child);
  2336. }
  2337. } else {
  2338. (slots.default || (slots.default = [])).push(child);
  2339. }
  2340. }
  2341. // ignore slots that contains only whitespace
  2342. for (var name$1 in slots) {
  2343. if (slots[name$1].every(isWhitespace)) {
  2344. delete slots[name$1];
  2345. }
  2346. }
  2347. return slots
  2348. }
  2349. function isWhitespace (node) {
  2350. return (node.isComment && !node.asyncFactory) || node.text === ' '
  2351. }
  2352. function resolveScopedSlots (
  2353. fns, // see flow/vnode
  2354. res
  2355. ) {
  2356. res = res || {};
  2357. for (var i = 0; i < fns.length; i++) {
  2358. if (Array.isArray(fns[i])) {
  2359. resolveScopedSlots(fns[i], res);
  2360. } else {
  2361. res[fns[i].key] = fns[i].fn;
  2362. }
  2363. }
  2364. return res
  2365. }
  2366. /* */
  2367. var activeInstance = null;
  2368. var isUpdatingChildComponent = false;
  2369. function initLifecycle (vm) {
  2370. var options = vm.$options;
  2371. // locate first non-abstract parent
  2372. var parent = options.parent;
  2373. if (parent && !options.abstract) {
  2374. while (parent.$options.abstract && parent.$parent) {
  2375. parent = parent.$parent;
  2376. }
  2377. parent.$children.push(vm);
  2378. }
  2379. vm.$parent = parent;
  2380. vm.$root = parent ? parent.$root : vm;
  2381. vm.$children = [];
  2382. vm.$refs = {};
  2383. vm._watcher = null;
  2384. vm._inactive = null;
  2385. vm._directInactive = false;
  2386. vm._isMounted = false;
  2387. vm._isDestroyed = false;
  2388. vm._isBeingDestroyed = false;
  2389. }
  2390. function lifecycleMixin (Vue) {
  2391. Vue.prototype._update = function (vnode, hydrating) {
  2392. var vm = this;
  2393. if (vm._isMounted) {
  2394. callHook(vm, 'beforeUpdate');
  2395. }
  2396. var prevEl = vm.$el;
  2397. var prevVnode = vm._vnode;
  2398. var prevActiveInstance = activeInstance;
  2399. activeInstance = vm;
  2400. vm._vnode = vnode;
  2401. // Vue.prototype.__patch__ is injected in entry points
  2402. // based on the rendering backend used.
  2403. if (!prevVnode) {
  2404. // initial render
  2405. vm.$el = vm.__patch__(
  2406. vm.$el, vnode, hydrating, false /* removeOnly */,
  2407. vm.$options._parentElm,
  2408. vm.$options._refElm
  2409. );
  2410. // no need for the ref nodes after initial patch
  2411. // this prevents keeping a detached DOM tree in memory (#5851)
  2412. vm.$options._parentElm = vm.$options._refElm = null;
  2413. } else {
  2414. // updates
  2415. vm.$el = vm.__patch__(prevVnode, vnode);
  2416. }
  2417. activeInstance = prevActiveInstance;
  2418. // update __vue__ reference
  2419. if (prevEl) {
  2420. prevEl.__vue__ = null;
  2421. }
  2422. if (vm.$el) {
  2423. vm.$el.__vue__ = vm;
  2424. }
  2425. // if parent is an HOC, update its $el as well
  2426. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  2427. vm.$parent.$el = vm.$el;
  2428. }
  2429. // updated hook is called by the scheduler to ensure that children are
  2430. // updated in a parent's updated hook.
  2431. };
  2432. Vue.prototype.$forceUpdate = function () {
  2433. var vm = this;
  2434. if (vm._watcher) {
  2435. vm._watcher.update();
  2436. }
  2437. };
  2438. Vue.prototype.$destroy = function () {
  2439. var vm = this;
  2440. if (vm._isBeingDestroyed) {
  2441. return
  2442. }
  2443. callHook(vm, 'beforeDestroy');
  2444. vm._isBeingDestroyed = true;
  2445. // remove self from parent
  2446. var parent = vm.$parent;
  2447. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  2448. remove(parent.$children, vm);
  2449. }
  2450. // teardown watchers
  2451. if (vm._watcher) {
  2452. vm._watcher.teardown();
  2453. }
  2454. var i = vm._watchers.length;
  2455. while (i--) {
  2456. vm._watchers[i].teardown();
  2457. }
  2458. // remove reference from data ob
  2459. // frozen object may not have observer.
  2460. if (vm._data.__ob__) {
  2461. vm._data.__ob__.vmCount--;
  2462. }
  2463. // call the last hook...
  2464. vm._isDestroyed = true;
  2465. // invoke destroy hooks on current rendered tree
  2466. vm.__patch__(vm._vnode, null);
  2467. // fire destroyed hook
  2468. callHook(vm, 'destroyed');
  2469. // turn off all instance listeners.
  2470. vm.$off();
  2471. // remove __vue__ reference
  2472. if (vm.$el) {
  2473. vm.$el.__vue__ = null;
  2474. }
  2475. // release circular reference (#6759)
  2476. if (vm.$vnode) {
  2477. vm.$vnode.parent = null;
  2478. }
  2479. };
  2480. }
  2481. function mountComponent (
  2482. vm,
  2483. el,
  2484. hydrating
  2485. ) {
  2486. vm.$el = el;
  2487. if (!vm.$options.render) {
  2488. vm.$options.render = createEmptyVNode;
  2489. {
  2490. /* istanbul ignore if */
  2491. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  2492. vm.$options.el || el) {
  2493. warn(
  2494. 'You are using the runtime-only build of Vue where the template ' +
  2495. 'compiler is not available. Either pre-compile the templates into ' +
  2496. 'render functions, or use the compiler-included build.',
  2497. vm
  2498. );
  2499. } else {
  2500. warn(
  2501. 'Failed to mount component: template or render function not defined.',
  2502. vm
  2503. );
  2504. }
  2505. }
  2506. }
  2507. callHook(vm, 'beforeMount');
  2508. var updateComponent;
  2509. /* istanbul ignore if */
  2510. if ("development" !== 'production' && config.performance && mark) {
  2511. updateComponent = function () {
  2512. var name = vm._name;
  2513. var id = vm._uid;
  2514. var startTag = "vue-perf-start:" + id;
  2515. var endTag = "vue-perf-end:" + id;
  2516. mark(startTag);
  2517. var vnode = vm._render();
  2518. mark(endTag);
  2519. measure(("vue " + name + " render"), startTag, endTag);
  2520. mark(startTag);
  2521. vm._update(vnode, hydrating);
  2522. mark(endTag);
  2523. measure(("vue " + name + " patch"), startTag, endTag);
  2524. };
  2525. } else {
  2526. updateComponent = function () {
  2527. vm._update(vm._render(), hydrating);
  2528. };
  2529. }
  2530. // we set this to vm._watcher inside the watcher's constructor
  2531. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  2532. // component's mounted hook), which relies on vm._watcher being already defined
  2533. new Watcher(vm, updateComponent, noop, null, true /* isRenderWatcher */);
  2534. hydrating = false;
  2535. // manually mounted instance, call mounted on self
  2536. // mounted is called for render-created child components in its inserted hook
  2537. if (vm.$vnode == null) {
  2538. vm._isMounted = true;
  2539. callHook(vm, 'mounted');
  2540. }
  2541. return vm
  2542. }
  2543. function updateChildComponent (
  2544. vm,
  2545. propsData,
  2546. listeners,
  2547. parentVnode,
  2548. renderChildren
  2549. ) {
  2550. {
  2551. isUpdatingChildComponent = true;
  2552. }
  2553. // determine whether component has slot children
  2554. // we need to do this before overwriting $options._renderChildren
  2555. var hasChildren = !!(
  2556. renderChildren || // has new static slots
  2557. vm.$options._renderChildren || // has old static slots
  2558. parentVnode.data.scopedSlots || // has new scoped slots
  2559. vm.$scopedSlots !== emptyObject // has old scoped slots
  2560. );
  2561. vm.$options._parentVnode = parentVnode;
  2562. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  2563. if (vm._vnode) { // update child tree's parent
  2564. vm._vnode.parent = parentVnode;
  2565. }
  2566. vm.$options._renderChildren = renderChildren;
  2567. // update $attrs and $listeners hash
  2568. // these are also reactive so they may trigger child update if the child
  2569. // used them during render
  2570. vm.$attrs = parentVnode.data.attrs || emptyObject;
  2571. vm.$listeners = listeners || emptyObject;
  2572. // update props
  2573. if (propsData && vm.$options.props) {
  2574. toggleObserving(false);
  2575. var props = vm._props;
  2576. var propKeys = vm.$options._propKeys || [];
  2577. for (var i = 0; i < propKeys.length; i++) {
  2578. var key = propKeys[i];
  2579. var propOptions = vm.$options.props; // wtf flow?
  2580. props[key] = validateProp(key, propOptions, propsData, vm);
  2581. }
  2582. toggleObserving(true);
  2583. // keep a copy of raw propsData
  2584. vm.$options.propsData = propsData;
  2585. }
  2586. // update listeners
  2587. listeners = listeners || emptyObject;
  2588. var oldListeners = vm.$options._parentListeners;
  2589. vm.$options._parentListeners = listeners;
  2590. updateComponentListeners(vm, listeners, oldListeners);
  2591. // resolve slots + force update if has children
  2592. if (hasChildren) {
  2593. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  2594. vm.$forceUpdate();
  2595. }
  2596. {
  2597. isUpdatingChildComponent = false;
  2598. }
  2599. }
  2600. function isInInactiveTree (vm) {
  2601. while (vm && (vm = vm.$parent)) {
  2602. if (vm._inactive) { return true }
  2603. }
  2604. return false
  2605. }
  2606. function activateChildComponent (vm, direct) {
  2607. if (direct) {
  2608. vm._directInactive = false;
  2609. if (isInInactiveTree(vm)) {
  2610. return
  2611. }
  2612. } else if (vm._directInactive) {
  2613. return
  2614. }
  2615. if (vm._inactive || vm._inactive === null) {
  2616. vm._inactive = false;
  2617. for (var i = 0; i < vm.$children.length; i++) {
  2618. activateChildComponent(vm.$children[i]);
  2619. }
  2620. callHook(vm, 'activated');
  2621. }
  2622. }
  2623. function deactivateChildComponent (vm, direct) {
  2624. if (direct) {
  2625. vm._directInactive = true;
  2626. if (isInInactiveTree(vm)) {
  2627. return
  2628. }
  2629. }
  2630. if (!vm._inactive) {
  2631. vm._inactive = true;
  2632. for (var i = 0; i < vm.$children.length; i++) {
  2633. deactivateChildComponent(vm.$children[i]);
  2634. }
  2635. callHook(vm, 'deactivated');
  2636. }
  2637. }
  2638. function callHook (vm, hook) {
  2639. // #7573 disable dep collection when invoking lifecycle hooks
  2640. pushTarget();
  2641. var handlers = vm.$options[hook];
  2642. if (handlers) {
  2643. for (var i = 0, j = handlers.length; i < j; i++) {
  2644. try {
  2645. handlers[i].call(vm);
  2646. } catch (e) {
  2647. handleError(e, vm, (hook + " hook"));
  2648. }
  2649. }
  2650. }
  2651. if (vm._hasHookEvent) {
  2652. vm.$emit('hook:' + hook);
  2653. }
  2654. popTarget();
  2655. }
  2656. /* */
  2657. var MAX_UPDATE_COUNT = 100;
  2658. var queue = [];
  2659. var activatedChildren = [];
  2660. var has = {};
  2661. var circular = {};
  2662. var waiting = false;
  2663. var flushing = false;
  2664. var index = 0;
  2665. /**
  2666. * Reset the scheduler's state.
  2667. */
  2668. function resetSchedulerState () {
  2669. index = queue.length = activatedChildren.length = 0;
  2670. has = {};
  2671. {
  2672. circular = {};
  2673. }
  2674. waiting = flushing = false;
  2675. }
  2676. /**
  2677. * Flush both queues and run the watchers.
  2678. */
  2679. function flushSchedulerQueue () {
  2680. flushing = true;
  2681. var watcher, id;
  2682. // Sort queue before flush.
  2683. // This ensures that:
  2684. // 1. Components are updated from parent to child. (because parent is always
  2685. // created before the child)
  2686. // 2. A component's user watchers are run before its render watcher (because
  2687. // user watchers are created before the render watcher)
  2688. // 3. If a component is destroyed during a parent component's watcher run,
  2689. // its watchers can be skipped.
  2690. queue.sort(function (a, b) { return a.id - b.id; });
  2691. // do not cache length because more watchers might be pushed
  2692. // as we run existing watchers
  2693. for (index = 0; index < queue.length; index++) {
  2694. watcher = queue[index];
  2695. id = watcher.id;
  2696. has[id] = null;
  2697. watcher.run();
  2698. // in dev build, check and stop circular updates.
  2699. if ("development" !== 'production' && has[id] != null) {
  2700. circular[id] = (circular[id] || 0) + 1;
  2701. if (circular[id] > MAX_UPDATE_COUNT) {
  2702. warn(
  2703. 'You may have an infinite update loop ' + (
  2704. watcher.user
  2705. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  2706. : "in a component render function."
  2707. ),
  2708. watcher.vm
  2709. );
  2710. break
  2711. }
  2712. }
  2713. }
  2714. // keep copies of post queues before resetting state
  2715. var activatedQueue = activatedChildren.slice();
  2716. var updatedQueue = queue.slice();
  2717. resetSchedulerState();
  2718. // call component updated and activated hooks
  2719. callActivatedHooks(activatedQueue);
  2720. callUpdatedHooks(updatedQueue);
  2721. // devtool hook
  2722. /* istanbul ignore if */
  2723. if (devtools && config.devtools) {
  2724. devtools.emit('flush');
  2725. }
  2726. }
  2727. function callUpdatedHooks (queue) {
  2728. var i = queue.length;
  2729. while (i--) {
  2730. var watcher = queue[i];
  2731. var vm = watcher.vm;
  2732. if (vm._watcher === watcher && vm._isMounted) {
  2733. callHook(vm, 'updated');
  2734. }
  2735. }
  2736. }
  2737. /**
  2738. * Queue a kept-alive component that was activated during patch.
  2739. * The queue will be processed after the entire tree has been patched.
  2740. */
  2741. function queueActivatedComponent (vm) {
  2742. // setting _inactive to false here so that a render function can
  2743. // rely on checking whether it's in an inactive tree (e.g. router-view)
  2744. vm._inactive = false;
  2745. activatedChildren.push(vm);
  2746. }
  2747. function callActivatedHooks (queue) {
  2748. for (var i = 0; i < queue.length; i++) {
  2749. queue[i]._inactive = true;
  2750. activateChildComponent(queue[i], true /* true */);
  2751. }
  2752. }
  2753. /**
  2754. * Push a watcher into the watcher queue.
  2755. * Jobs with duplicate IDs will be skipped unless it's
  2756. * pushed when the queue is being flushed.
  2757. */
  2758. function queueWatcher (watcher) {
  2759. var id = watcher.id;
  2760. if (has[id] == null) {
  2761. has[id] = true;
  2762. if (!flushing) {
  2763. queue.push(watcher);
  2764. } else {
  2765. // if already flushing, splice the watcher based on its id
  2766. // if already past its id, it will be run next immediately.
  2767. var i = queue.length - 1;
  2768. while (i > index && queue[i].id > watcher.id) {
  2769. i--;
  2770. }
  2771. queue.splice(i + 1, 0, watcher);
  2772. }
  2773. // queue the flush
  2774. if (!waiting) {
  2775. waiting = true;
  2776. nextTick(flushSchedulerQueue);
  2777. }
  2778. }
  2779. }
  2780. /* */
  2781. var uid$1 = 0;
  2782. /**
  2783. * A watcher parses an expression, collects dependencies,
  2784. * and fires callback when the expression value changes.
  2785. * This is used for both the $watch() api and directives.
  2786. */
  2787. var Watcher = function Watcher (
  2788. vm,
  2789. expOrFn,
  2790. cb,
  2791. options,
  2792. isRenderWatcher
  2793. ) {
  2794. this.vm = vm;
  2795. if (isRenderWatcher) {
  2796. vm._watcher = this;
  2797. }
  2798. vm._watchers.push(this);
  2799. // options
  2800. if (options) {
  2801. this.deep = !!options.deep;
  2802. this.user = !!options.user;
  2803. this.lazy = !!options.lazy;
  2804. this.sync = !!options.sync;
  2805. } else {
  2806. this.deep = this.user = this.lazy = this.sync = false;
  2807. }
  2808. this.cb = cb;
  2809. this.id = ++uid$1; // uid for batching
  2810. this.active = true;
  2811. this.dirty = this.lazy; // for lazy watchers
  2812. this.deps = [];
  2813. this.newDeps = [];
  2814. this.depIds = new _Set();
  2815. this.newDepIds = new _Set();
  2816. this.expression = expOrFn.toString();
  2817. // parse expression for getter
  2818. if (typeof expOrFn === 'function') {
  2819. this.getter = expOrFn;
  2820. } else {
  2821. this.getter = parsePath(expOrFn);
  2822. if (!this.getter) {
  2823. this.getter = function () {};
  2824. "development" !== 'production' && warn(
  2825. "Failed watching path: \"" + expOrFn + "\" " +
  2826. 'Watcher only accepts simple dot-delimited paths. ' +
  2827. 'For full control, use a function instead.',
  2828. vm
  2829. );
  2830. }
  2831. }
  2832. this.value = this.lazy
  2833. ? undefined
  2834. : this.get();
  2835. };
  2836. /**
  2837. * Evaluate the getter, and re-collect dependencies.
  2838. */
  2839. Watcher.prototype.get = function get () {
  2840. pushTarget(this);
  2841. var value;
  2842. var vm = this.vm;
  2843. try {
  2844. value = this.getter.call(vm, vm);
  2845. } catch (e) {
  2846. if (this.user) {
  2847. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  2848. } else {
  2849. throw e
  2850. }
  2851. } finally {
  2852. // "touch" every property so they are all tracked as
  2853. // dependencies for deep watching
  2854. if (this.deep) {
  2855. traverse(value);
  2856. }
  2857. popTarget();
  2858. this.cleanupDeps();
  2859. }
  2860. return value
  2861. };
  2862. /**
  2863. * Add a dependency to this directive.
  2864. */
  2865. Watcher.prototype.addDep = function addDep (dep) {
  2866. var id = dep.id;
  2867. if (!this.newDepIds.has(id)) {
  2868. this.newDepIds.add(id);
  2869. this.newDeps.push(dep);
  2870. if (!this.depIds.has(id)) {
  2871. dep.addSub(this);
  2872. }
  2873. }
  2874. };
  2875. /**
  2876. * Clean up for dependency collection.
  2877. */
  2878. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  2879. var this$1 = this;
  2880. var i = this.deps.length;
  2881. while (i--) {
  2882. var dep = this$1.deps[i];
  2883. if (!this$1.newDepIds.has(dep.id)) {
  2884. dep.removeSub(this$1);
  2885. }
  2886. }
  2887. var tmp = this.depIds;
  2888. this.depIds = this.newDepIds;
  2889. this.newDepIds = tmp;
  2890. this.newDepIds.clear();
  2891. tmp = this.deps;
  2892. this.deps = this.newDeps;
  2893. this.newDeps = tmp;
  2894. this.newDeps.length = 0;
  2895. };
  2896. /**
  2897. * Subscriber interface.
  2898. * Will be called when a dependency changes.
  2899. */
  2900. Watcher.prototype.update = function update () {
  2901. /* istanbul ignore else */
  2902. if (this.lazy) {
  2903. this.dirty = true;
  2904. } else if (this.sync) {
  2905. this.run();
  2906. } else {
  2907. queueWatcher(this);
  2908. }
  2909. };
  2910. /**
  2911. * Scheduler job interface.
  2912. * Will be called by the scheduler.
  2913. */
  2914. Watcher.prototype.run = function run () {
  2915. if (this.active) {
  2916. var value = this.get();
  2917. if (
  2918. value !== this.value ||
  2919. // Deep watchers and watchers on Object/Arrays should fire even
  2920. // when the value is the same, because the value may
  2921. // have mutated.
  2922. isObject(value) ||
  2923. this.deep
  2924. ) {
  2925. // set new value
  2926. var oldValue = this.value;
  2927. this.value = value;
  2928. if (this.user) {
  2929. try {
  2930. this.cb.call(this.vm, value, oldValue);
  2931. } catch (e) {
  2932. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  2933. }
  2934. } else {
  2935. this.cb.call(this.vm, value, oldValue);
  2936. }
  2937. }
  2938. }
  2939. };
  2940. /**
  2941. * Evaluate the value of the watcher.
  2942. * This only gets called for lazy watchers.
  2943. */
  2944. Watcher.prototype.evaluate = function evaluate () {
  2945. this.value = this.get();
  2946. this.dirty = false;
  2947. };
  2948. /**
  2949. * Depend on all deps collected by this watcher.
  2950. */
  2951. Watcher.prototype.depend = function depend () {
  2952. var this$1 = this;
  2953. var i = this.deps.length;
  2954. while (i--) {
  2955. this$1.deps[i].depend();
  2956. }
  2957. };
  2958. /**
  2959. * Remove self from all dependencies' subscriber list.
  2960. */
  2961. Watcher.prototype.teardown = function teardown () {
  2962. var this$1 = this;
  2963. if (this.active) {
  2964. // remove self from vm's watcher list
  2965. // this is a somewhat expensive operation so we skip it
  2966. // if the vm is being destroyed.
  2967. if (!this.vm._isBeingDestroyed) {
  2968. remove(this.vm._watchers, this);
  2969. }
  2970. var i = this.deps.length;
  2971. while (i--) {
  2972. this$1.deps[i].removeSub(this$1);
  2973. }
  2974. this.active = false;
  2975. }
  2976. };
  2977. /* */
  2978. var sharedPropertyDefinition = {
  2979. enumerable: true,
  2980. configurable: true,
  2981. get: noop,
  2982. set: noop
  2983. };
  2984. function proxy (target, sourceKey, key) {
  2985. sharedPropertyDefinition.get = function proxyGetter () {
  2986. return this[sourceKey][key]
  2987. };
  2988. sharedPropertyDefinition.set = function proxySetter (val) {
  2989. this[sourceKey][key] = val;
  2990. };
  2991. Object.defineProperty(target, key, sharedPropertyDefinition);
  2992. }
  2993. function initState (vm) {
  2994. vm._watchers = [];
  2995. var opts = vm.$options;
  2996. if (opts.props) { initProps(vm, opts.props); }
  2997. if (opts.methods) { initMethods(vm, opts.methods); }
  2998. if (opts.data) {
  2999. initData(vm);
  3000. } else {
  3001. observe(vm._data = {}, true /* asRootData */);
  3002. }
  3003. if (opts.computed) { initComputed(vm, opts.computed); }
  3004. if (opts.watch && opts.watch !== nativeWatch) {
  3005. initWatch(vm, opts.watch);
  3006. }
  3007. }
  3008. function initProps (vm, propsOptions) {
  3009. var propsData = vm.$options.propsData || {};
  3010. var props = vm._props = {};
  3011. // cache prop keys so that future props updates can iterate using Array
  3012. // instead of dynamic object key enumeration.
  3013. var keys = vm.$options._propKeys = [];
  3014. var isRoot = !vm.$parent;
  3015. // root instance props should be converted
  3016. if (!isRoot) {
  3017. toggleObserving(false);
  3018. }
  3019. var loop = function ( key ) {
  3020. keys.push(key);
  3021. var value = validateProp(key, propsOptions, propsData, vm);
  3022. /* istanbul ignore else */
  3023. {
  3024. var hyphenatedKey = hyphenate(key);
  3025. if (isReservedAttribute(hyphenatedKey) ||
  3026. config.isReservedAttr(hyphenatedKey)) {
  3027. warn(
  3028. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  3029. vm
  3030. );
  3031. }
  3032. defineReactive(props, key, value, function () {
  3033. if (vm.$parent && !isUpdatingChildComponent) {
  3034. warn(
  3035. "Avoid mutating a prop directly since the value will be " +
  3036. "overwritten whenever the parent component re-renders. " +
  3037. "Instead, use a data or computed property based on the prop's " +
  3038. "value. Prop being mutated: \"" + key + "\"",
  3039. vm
  3040. );
  3041. }
  3042. });
  3043. }
  3044. // static props are already proxied on the component's prototype
  3045. // during Vue.extend(). We only need to proxy props defined at
  3046. // instantiation here.
  3047. if (!(key in vm)) {
  3048. proxy(vm, "_props", key);
  3049. }
  3050. };
  3051. for (var key in propsOptions) loop( key );
  3052. toggleObserving(true);
  3053. }
  3054. function initData (vm) {
  3055. var data = vm.$options.data;
  3056. data = vm._data = typeof data === 'function'
  3057. ? getData(data, vm)
  3058. : data || {};
  3059. if (!isPlainObject(data)) {
  3060. data = {};
  3061. "development" !== 'production' && warn(
  3062. 'data functions should return an object:\n' +
  3063. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  3064. vm
  3065. );
  3066. }
  3067. // proxy data on instance
  3068. var keys = Object.keys(data);
  3069. var props = vm.$options.props;
  3070. var methods = vm.$options.methods;
  3071. var i = keys.length;
  3072. while (i--) {
  3073. var key = keys[i];
  3074. {
  3075. if (methods && hasOwn(methods, key)) {
  3076. warn(
  3077. ("Method \"" + key + "\" has already been defined as a data property."),
  3078. vm
  3079. );
  3080. }
  3081. }
  3082. if (props && hasOwn(props, key)) {
  3083. "development" !== 'production' && warn(
  3084. "The data property \"" + key + "\" is already declared as a prop. " +
  3085. "Use prop default value instead.",
  3086. vm
  3087. );
  3088. } else if (!isReserved(key)) {
  3089. proxy(vm, "_data", key);
  3090. }
  3091. }
  3092. // observe data
  3093. observe(data, true /* asRootData */);
  3094. }
  3095. function getData (data, vm) {
  3096. // #7573 disable dep collection when invoking data getters
  3097. pushTarget();
  3098. try {
  3099. return data.call(vm, vm)
  3100. } catch (e) {
  3101. handleError(e, vm, "data()");
  3102. return {}
  3103. } finally {
  3104. popTarget();
  3105. }
  3106. }
  3107. var computedWatcherOptions = { lazy: true };
  3108. function initComputed (vm, computed) {
  3109. // $flow-disable-line
  3110. var watchers = vm._computedWatchers = Object.create(null);
  3111. // computed properties are just getters during SSR
  3112. var isSSR = isServerRendering();
  3113. for (var key in computed) {
  3114. var userDef = computed[key];
  3115. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  3116. if ("development" !== 'production' && getter == null) {
  3117. warn(
  3118. ("Getter is missing for computed property \"" + key + "\"."),
  3119. vm
  3120. );
  3121. }
  3122. if (!isSSR) {
  3123. // create internal watcher for the computed property.
  3124. watchers[key] = new Watcher(
  3125. vm,
  3126. getter || noop,
  3127. noop,
  3128. computedWatcherOptions
  3129. );
  3130. }
  3131. // component-defined computed properties are already defined on the
  3132. // component prototype. We only need to define computed properties defined
  3133. // at instantiation here.
  3134. if (!(key in vm)) {
  3135. defineComputed(vm, key, userDef);
  3136. } else {
  3137. if (key in vm.$data) {
  3138. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  3139. } else if (vm.$options.props && key in vm.$options.props) {
  3140. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  3141. }
  3142. }
  3143. }
  3144. }
  3145. function defineComputed (
  3146. target,
  3147. key,
  3148. userDef
  3149. ) {
  3150. var shouldCache = !isServerRendering();
  3151. if (typeof userDef === 'function') {
  3152. sharedPropertyDefinition.get = shouldCache
  3153. ? createComputedGetter(key)
  3154. : userDef;
  3155. sharedPropertyDefinition.set = noop;
  3156. } else {
  3157. sharedPropertyDefinition.get = userDef.get
  3158. ? shouldCache && userDef.cache !== false
  3159. ? createComputedGetter(key)
  3160. : userDef.get
  3161. : noop;
  3162. sharedPropertyDefinition.set = userDef.set
  3163. ? userDef.set
  3164. : noop;
  3165. }
  3166. if ("development" !== 'production' &&
  3167. sharedPropertyDefinition.set === noop) {
  3168. sharedPropertyDefinition.set = function () {
  3169. warn(
  3170. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  3171. this
  3172. );
  3173. };
  3174. }
  3175. Object.defineProperty(target, key, sharedPropertyDefinition);
  3176. }
  3177. function createComputedGetter (key) {
  3178. return function computedGetter () {
  3179. var watcher = this._computedWatchers && this._computedWatchers[key];
  3180. if (watcher) {
  3181. if (watcher.dirty) {
  3182. watcher.evaluate();
  3183. }
  3184. if (Dep.target) {
  3185. watcher.depend();
  3186. }
  3187. return watcher.value
  3188. }
  3189. }
  3190. }
  3191. function initMethods (vm, methods) {
  3192. var props = vm.$options.props;
  3193. for (var key in methods) {
  3194. {
  3195. if (methods[key] == null) {
  3196. warn(
  3197. "Method \"" + key + "\" has an undefined value in the component definition. " +
  3198. "Did you reference the function correctly?",
  3199. vm
  3200. );
  3201. }
  3202. if (props && hasOwn(props, key)) {
  3203. warn(
  3204. ("Method \"" + key + "\" has already been defined as a prop."),
  3205. vm
  3206. );
  3207. }
  3208. if ((key in vm) && isReserved(key)) {
  3209. warn(
  3210. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  3211. "Avoid defining component methods that start with _ or $."
  3212. );
  3213. }
  3214. }
  3215. vm[key] = methods[key] == null ? noop : bind(methods[key], vm);
  3216. }
  3217. }
  3218. function initWatch (vm, watch) {
  3219. for (var key in watch) {
  3220. var handler = watch[key];
  3221. if (Array.isArray(handler)) {
  3222. for (var i = 0; i < handler.length; i++) {
  3223. createWatcher(vm, key, handler[i]);
  3224. }
  3225. } else {
  3226. createWatcher(vm, key, handler);
  3227. }
  3228. }
  3229. }
  3230. function createWatcher (
  3231. vm,
  3232. expOrFn,
  3233. handler,
  3234. options
  3235. ) {
  3236. if (isPlainObject(handler)) {
  3237. options = handler;
  3238. handler = handler.handler;
  3239. }
  3240. if (typeof handler === 'string') {
  3241. handler = vm[handler];
  3242. }
  3243. return vm.$watch(expOrFn, handler, options)
  3244. }
  3245. function stateMixin (Vue) {
  3246. // flow somehow has problems with directly declared definition object
  3247. // when using Object.defineProperty, so we have to procedurally build up
  3248. // the object here.
  3249. var dataDef = {};
  3250. dataDef.get = function () { return this._data };
  3251. var propsDef = {};
  3252. propsDef.get = function () { return this._props };
  3253. {
  3254. dataDef.set = function (newData) {
  3255. warn(
  3256. 'Avoid replacing instance root $data. ' +
  3257. 'Use nested data properties instead.',
  3258. this
  3259. );
  3260. };
  3261. propsDef.set = function () {
  3262. warn("$props is readonly.", this);
  3263. };
  3264. }
  3265. Object.defineProperty(Vue.prototype, '$data', dataDef);
  3266. Object.defineProperty(Vue.prototype, '$props', propsDef);
  3267. Vue.prototype.$set = set;
  3268. Vue.prototype.$delete = del;
  3269. Vue.prototype.$watch = function (
  3270. expOrFn,
  3271. cb,
  3272. options
  3273. ) {
  3274. var vm = this;
  3275. if (isPlainObject(cb)) {
  3276. return createWatcher(vm, expOrFn, cb, options)
  3277. }
  3278. options = options || {};
  3279. options.user = true;
  3280. var watcher = new Watcher(vm, expOrFn, cb, options);
  3281. if (options.immediate) {
  3282. cb.call(vm, watcher.value);
  3283. }
  3284. return function unwatchFn () {
  3285. watcher.teardown();
  3286. }
  3287. };
  3288. }
  3289. /* */
  3290. function initProvide (vm) {
  3291. var provide = vm.$options.provide;
  3292. if (provide) {
  3293. vm._provided = typeof provide === 'function'
  3294. ? provide.call(vm)
  3295. : provide;
  3296. }
  3297. }
  3298. function initInjections (vm) {
  3299. var result = resolveInject(vm.$options.inject, vm);
  3300. if (result) {
  3301. toggleObserving(false);
  3302. Object.keys(result).forEach(function (key) {
  3303. /* istanbul ignore else */
  3304. {
  3305. defineReactive(vm, key, result[key], function () {
  3306. warn(
  3307. "Avoid mutating an injected value directly since the changes will be " +
  3308. "overwritten whenever the provided component re-renders. " +
  3309. "injection being mutated: \"" + key + "\"",
  3310. vm
  3311. );
  3312. });
  3313. }
  3314. });
  3315. toggleObserving(true);
  3316. }
  3317. }
  3318. function resolveInject (inject, vm) {
  3319. if (inject) {
  3320. // inject is :any because flow is not smart enough to figure out cached
  3321. var result = Object.create(null);
  3322. var keys = hasSymbol
  3323. ? Reflect.ownKeys(inject).filter(function (key) {
  3324. /* istanbul ignore next */
  3325. return Object.getOwnPropertyDescriptor(inject, key).enumerable
  3326. })
  3327. : Object.keys(inject);
  3328. for (var i = 0; i < keys.length; i++) {
  3329. var key = keys[i];
  3330. var provideKey = inject[key].from;
  3331. var source = vm;
  3332. while (source) {
  3333. if (source._provided && hasOwn(source._provided, provideKey)) {
  3334. result[key] = source._provided[provideKey];
  3335. break
  3336. }
  3337. source = source.$parent;
  3338. }
  3339. if (!source) {
  3340. if ('default' in inject[key]) {
  3341. var provideDefault = inject[key].default;
  3342. result[key] = typeof provideDefault === 'function'
  3343. ? provideDefault.call(vm)
  3344. : provideDefault;
  3345. } else {
  3346. warn(("Injection \"" + key + "\" not found"), vm);
  3347. }
  3348. }
  3349. }
  3350. return result
  3351. }
  3352. }
  3353. /* */
  3354. /**
  3355. * Runtime helper for rendering v-for lists.
  3356. */
  3357. function renderList (
  3358. val,
  3359. render
  3360. ) {
  3361. var ret, i, l, keys, key;
  3362. if (Array.isArray(val) || typeof val === 'string') {
  3363. ret = new Array(val.length);
  3364. for (i = 0, l = val.length; i < l; i++) {
  3365. ret[i] = render(val[i], i);
  3366. }
  3367. } else if (typeof val === 'number') {
  3368. ret = new Array(val);
  3369. for (i = 0; i < val; i++) {
  3370. ret[i] = render(i + 1, i);
  3371. }
  3372. } else if (isObject(val)) {
  3373. keys = Object.keys(val);
  3374. ret = new Array(keys.length);
  3375. for (i = 0, l = keys.length; i < l; i++) {
  3376. key = keys[i];
  3377. ret[i] = render(val[key], key, i);
  3378. }
  3379. }
  3380. if (isDef(ret)) {
  3381. (ret)._isVList = true;
  3382. }
  3383. return ret
  3384. }
  3385. /* */
  3386. /**
  3387. * Runtime helper for rendering <slot>
  3388. */
  3389. function renderSlot (
  3390. name,
  3391. fallback,
  3392. props,
  3393. bindObject
  3394. ) {
  3395. var scopedSlotFn = this.$scopedSlots[name];
  3396. var nodes;
  3397. if (scopedSlotFn) { // scoped slot
  3398. props = props || {};
  3399. if (bindObject) {
  3400. if ("development" !== 'production' && !isObject(bindObject)) {
  3401. warn(
  3402. 'slot v-bind without argument expects an Object',
  3403. this
  3404. );
  3405. }
  3406. props = extend(extend({}, bindObject), props);
  3407. }
  3408. nodes = scopedSlotFn(props) || fallback;
  3409. } else {
  3410. var slotNodes = this.$slots[name];
  3411. // warn duplicate slot usage
  3412. if (slotNodes) {
  3413. if ("development" !== 'production' && slotNodes._rendered) {
  3414. warn(
  3415. "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
  3416. "- this will likely cause render errors.",
  3417. this
  3418. );
  3419. }
  3420. slotNodes._rendered = true;
  3421. }
  3422. nodes = slotNodes || fallback;
  3423. }
  3424. var target = props && props.slot;
  3425. if (target) {
  3426. return this.$createElement('template', { slot: target }, nodes)
  3427. } else {
  3428. return nodes
  3429. }
  3430. }
  3431. /* */
  3432. /**
  3433. * Runtime helper for resolving filters
  3434. */
  3435. function resolveFilter (id) {
  3436. return resolveAsset(this.$options, 'filters', id, true) || identity
  3437. }
  3438. /* */
  3439. function isKeyNotMatch (expect, actual) {
  3440. if (Array.isArray(expect)) {
  3441. return expect.indexOf(actual) === -1
  3442. } else {
  3443. return expect !== actual
  3444. }
  3445. }
  3446. /**
  3447. * Runtime helper for checking keyCodes from config.
  3448. * exposed as Vue.prototype._k
  3449. * passing in eventKeyName as last argument separately for backwards compat
  3450. */
  3451. function checkKeyCodes (
  3452. eventKeyCode,
  3453. key,
  3454. builtInKeyCode,
  3455. eventKeyName,
  3456. builtInKeyName
  3457. ) {
  3458. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  3459. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  3460. return isKeyNotMatch(builtInKeyName, eventKeyName)
  3461. } else if (mappedKeyCode) {
  3462. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  3463. } else if (eventKeyName) {
  3464. return hyphenate(eventKeyName) !== key
  3465. }
  3466. }
  3467. /* */
  3468. /**
  3469. * Runtime helper for merging v-bind="object" into a VNode's data.
  3470. */
  3471. function bindObjectProps (
  3472. data,
  3473. tag,
  3474. value,
  3475. asProp,
  3476. isSync
  3477. ) {
  3478. if (value) {
  3479. if (!isObject(value)) {
  3480. "development" !== 'production' && warn(
  3481. 'v-bind without argument expects an Object or Array value',
  3482. this
  3483. );
  3484. } else {
  3485. if (Array.isArray(value)) {
  3486. value = toObject(value);
  3487. }
  3488. var hash;
  3489. var loop = function ( key ) {
  3490. if (
  3491. key === 'class' ||
  3492. key === 'style' ||
  3493. isReservedAttribute(key)
  3494. ) {
  3495. hash = data;
  3496. } else {
  3497. var type = data.attrs && data.attrs.type;
  3498. hash = asProp || config.mustUseProp(tag, type, key)
  3499. ? data.domProps || (data.domProps = {})
  3500. : data.attrs || (data.attrs = {});
  3501. }
  3502. if (!(key in hash)) {
  3503. hash[key] = value[key];
  3504. if (isSync) {
  3505. var on = data.on || (data.on = {});
  3506. on[("update:" + key)] = function ($event) {
  3507. value[key] = $event;
  3508. };
  3509. }
  3510. }
  3511. };
  3512. for (var key in value) loop( key );
  3513. }
  3514. }
  3515. return data
  3516. }
  3517. /* */
  3518. /**
  3519. * Runtime helper for rendering static trees.
  3520. */
  3521. function renderStatic (
  3522. index,
  3523. isInFor
  3524. ) {
  3525. var cached = this._staticTrees || (this._staticTrees = []);
  3526. var tree = cached[index];
  3527. // if has already-rendered static tree and not inside v-for,
  3528. // we can reuse the same tree.
  3529. if (tree && !isInFor) {
  3530. return tree
  3531. }
  3532. // otherwise, render a fresh tree.
  3533. tree = cached[index] = this.$options.staticRenderFns[index].call(
  3534. this._renderProxy,
  3535. null,
  3536. this // for render fns generated for functional component templates
  3537. );
  3538. markStatic(tree, ("__static__" + index), false);
  3539. return tree
  3540. }
  3541. /**
  3542. * Runtime helper for v-once.
  3543. * Effectively it means marking the node as static with a unique key.
  3544. */
  3545. function markOnce (
  3546. tree,
  3547. index,
  3548. key
  3549. ) {
  3550. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  3551. return tree
  3552. }
  3553. function markStatic (
  3554. tree,
  3555. key,
  3556. isOnce
  3557. ) {
  3558. if (Array.isArray(tree)) {
  3559. for (var i = 0; i < tree.length; i++) {
  3560. if (tree[i] && typeof tree[i] !== 'string') {
  3561. markStaticNode(tree[i], (key + "_" + i), isOnce);
  3562. }
  3563. }
  3564. } else {
  3565. markStaticNode(tree, key, isOnce);
  3566. }
  3567. }
  3568. function markStaticNode (node, key, isOnce) {
  3569. node.isStatic = true;
  3570. node.key = key;
  3571. node.isOnce = isOnce;
  3572. }
  3573. /* */
  3574. function bindObjectListeners (data, value) {
  3575. if (value) {
  3576. if (!isPlainObject(value)) {
  3577. "development" !== 'production' && warn(
  3578. 'v-on without argument expects an Object value',
  3579. this
  3580. );
  3581. } else {
  3582. var on = data.on = data.on ? extend({}, data.on) : {};
  3583. for (var key in value) {
  3584. var existing = on[key];
  3585. var ours = value[key];
  3586. on[key] = existing ? [].concat(existing, ours) : ours;
  3587. }
  3588. }
  3589. }
  3590. return data
  3591. }
  3592. /* */
  3593. function installRenderHelpers (target) {
  3594. target._o = markOnce;
  3595. target._n = toNumber;
  3596. target._s = toString;
  3597. target._l = renderList;
  3598. target._t = renderSlot;
  3599. target._q = looseEqual;
  3600. target._i = looseIndexOf;
  3601. target._m = renderStatic;
  3602. target._f = resolveFilter;
  3603. target._k = checkKeyCodes;
  3604. target._b = bindObjectProps;
  3605. target._v = createTextVNode;
  3606. target._e = createEmptyVNode;
  3607. target._u = resolveScopedSlots;
  3608. target._g = bindObjectListeners;
  3609. }
  3610. /* */
  3611. function FunctionalRenderContext (
  3612. data,
  3613. props,
  3614. children,
  3615. parent,
  3616. Ctor
  3617. ) {
  3618. var options = Ctor.options;
  3619. // ensure the createElement function in functional components
  3620. // gets a unique context - this is necessary for correct named slot check
  3621. var contextVm;
  3622. if (hasOwn(parent, '_uid')) {
  3623. contextVm = Object.create(parent);
  3624. // $flow-disable-line
  3625. contextVm._original = parent;
  3626. } else {
  3627. // the context vm passed in is a functional context as well.
  3628. // in this case we want to make sure we are able to get a hold to the
  3629. // real context instance.
  3630. contextVm = parent;
  3631. // $flow-disable-line
  3632. parent = parent._original;
  3633. }
  3634. var isCompiled = isTrue(options._compiled);
  3635. var needNormalization = !isCompiled;
  3636. this.data = data;
  3637. this.props = props;
  3638. this.children = children;
  3639. this.parent = parent;
  3640. this.listeners = data.on || emptyObject;
  3641. this.injections = resolveInject(options.inject, parent);
  3642. this.slots = function () { return resolveSlots(children, parent); };
  3643. // support for compiled functional template
  3644. if (isCompiled) {
  3645. // exposing $options for renderStatic()
  3646. this.$options = options;
  3647. // pre-resolve slots for renderSlot()
  3648. this.$slots = this.slots();
  3649. this.$scopedSlots = data.scopedSlots || emptyObject;
  3650. }
  3651. if (options._scopeId) {
  3652. this._c = function (a, b, c, d) {
  3653. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  3654. if (vnode && !Array.isArray(vnode)) {
  3655. vnode.fnScopeId = options._scopeId;
  3656. vnode.fnContext = parent;
  3657. }
  3658. return vnode
  3659. };
  3660. } else {
  3661. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  3662. }
  3663. }
  3664. installRenderHelpers(FunctionalRenderContext.prototype);
  3665. function createFunctionalComponent (
  3666. Ctor,
  3667. propsData,
  3668. data,
  3669. contextVm,
  3670. children
  3671. ) {
  3672. var options = Ctor.options;
  3673. var props = {};
  3674. var propOptions = options.props;
  3675. if (isDef(propOptions)) {
  3676. for (var key in propOptions) {
  3677. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  3678. }
  3679. } else {
  3680. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  3681. if (isDef(data.props)) { mergeProps(props, data.props); }
  3682. }
  3683. var renderContext = new FunctionalRenderContext(
  3684. data,
  3685. props,
  3686. children,
  3687. contextVm,
  3688. Ctor
  3689. );
  3690. var vnode = options.render.call(null, renderContext._c, renderContext);
  3691. if (vnode instanceof VNode) {
  3692. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options)
  3693. } else if (Array.isArray(vnode)) {
  3694. var vnodes = normalizeChildren(vnode) || [];
  3695. var res = new Array(vnodes.length);
  3696. for (var i = 0; i < vnodes.length; i++) {
  3697. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options);
  3698. }
  3699. return res
  3700. }
  3701. }
  3702. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options) {
  3703. // #7817 clone node before setting fnContext, otherwise if the node is reused
  3704. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  3705. // that should not be matched to match.
  3706. var clone = cloneVNode(vnode);
  3707. clone.fnContext = contextVm;
  3708. clone.fnOptions = options;
  3709. if (data.slot) {
  3710. (clone.data || (clone.data = {})).slot = data.slot;
  3711. }
  3712. return clone
  3713. }
  3714. function mergeProps (to, from) {
  3715. for (var key in from) {
  3716. to[camelize(key)] = from[key];
  3717. }
  3718. }
  3719. /* */
  3720. // Register the component hook to weex native render engine.
  3721. // The hook will be triggered by native, not javascript.
  3722. // Updates the state of the component to weex native render engine.
  3723. /* */
  3724. // https://github.com/Hanks10100/weex-native-directive/tree/master/component
  3725. // listening on native callback
  3726. /* */
  3727. /* */
  3728. // inline hooks to be invoked on component VNodes during patch
  3729. var componentVNodeHooks = {
  3730. init: function init (
  3731. vnode,
  3732. hydrating,
  3733. parentElm,
  3734. refElm
  3735. ) {
  3736. if (
  3737. vnode.componentInstance &&
  3738. !vnode.componentInstance._isDestroyed &&
  3739. vnode.data.keepAlive
  3740. ) {
  3741. // kept-alive components, treat as a patch
  3742. var mountedNode = vnode; // work around flow
  3743. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  3744. } else {
  3745. var child = vnode.componentInstance = createComponentInstanceForVnode(
  3746. vnode,
  3747. activeInstance,
  3748. parentElm,
  3749. refElm
  3750. );
  3751. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  3752. }
  3753. },
  3754. prepatch: function prepatch (oldVnode, vnode) {
  3755. var options = vnode.componentOptions;
  3756. var child = vnode.componentInstance = oldVnode.componentInstance;
  3757. updateChildComponent(
  3758. child,
  3759. options.propsData, // updated props
  3760. options.listeners, // updated listeners
  3761. vnode, // new parent vnode
  3762. options.children // new children
  3763. );
  3764. },
  3765. insert: function insert (vnode) {
  3766. var context = vnode.context;
  3767. var componentInstance = vnode.componentInstance;
  3768. if (!componentInstance._isMounted) {
  3769. componentInstance._isMounted = true;
  3770. callHook(componentInstance, 'mounted');
  3771. }
  3772. if (vnode.data.keepAlive) {
  3773. if (context._isMounted) {
  3774. // vue-router#1212
  3775. // During updates, a kept-alive component's child components may
  3776. // change, so directly walking the tree here may call activated hooks
  3777. // on incorrect children. Instead we push them into a queue which will
  3778. // be processed after the whole patch process ended.
  3779. queueActivatedComponent(componentInstance);
  3780. } else {
  3781. activateChildComponent(componentInstance, true /* direct */);
  3782. }
  3783. }
  3784. },
  3785. destroy: function destroy (vnode) {
  3786. var componentInstance = vnode.componentInstance;
  3787. if (!componentInstance._isDestroyed) {
  3788. if (!vnode.data.keepAlive) {
  3789. componentInstance.$destroy();
  3790. } else {
  3791. deactivateChildComponent(componentInstance, true /* direct */);
  3792. }
  3793. }
  3794. }
  3795. };
  3796. var hooksToMerge = Object.keys(componentVNodeHooks);
  3797. function createComponent (
  3798. Ctor,
  3799. data,
  3800. context,
  3801. children,
  3802. tag
  3803. ) {
  3804. if (isUndef(Ctor)) {
  3805. return
  3806. }
  3807. var baseCtor = context.$options._base;
  3808. // plain options object: turn it into a constructor
  3809. if (isObject(Ctor)) {
  3810. Ctor = baseCtor.extend(Ctor);
  3811. }
  3812. // if at this stage it's not a constructor or an async component factory,
  3813. // reject.
  3814. if (typeof Ctor !== 'function') {
  3815. {
  3816. warn(("Invalid Component definition: " + (String(Ctor))), context);
  3817. }
  3818. return
  3819. }
  3820. // async component
  3821. var asyncFactory;
  3822. if (isUndef(Ctor.cid)) {
  3823. asyncFactory = Ctor;
  3824. Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context);
  3825. if (Ctor === undefined) {
  3826. // return a placeholder node for async component, which is rendered
  3827. // as a comment node but preserves all the raw information for the node.
  3828. // the information will be used for async server-rendering and hydration.
  3829. return createAsyncPlaceholder(
  3830. asyncFactory,
  3831. data,
  3832. context,
  3833. children,
  3834. tag
  3835. )
  3836. }
  3837. }
  3838. data = data || {};
  3839. // resolve constructor options in case global mixins are applied after
  3840. // component constructor creation
  3841. resolveConstructorOptions(Ctor);
  3842. // transform component v-model data into props & events
  3843. if (isDef(data.model)) {
  3844. transformModel(Ctor.options, data);
  3845. }
  3846. // extract props
  3847. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  3848. // functional component
  3849. if (isTrue(Ctor.options.functional)) {
  3850. return createFunctionalComponent(Ctor, propsData, data, context, children)
  3851. }
  3852. // extract listeners, since these needs to be treated as
  3853. // child component listeners instead of DOM listeners
  3854. var listeners = data.on;
  3855. // replace with listeners with .native modifier
  3856. // so it gets processed during parent component patch.
  3857. data.on = data.nativeOn;
  3858. if (isTrue(Ctor.options.abstract)) {
  3859. // abstract components do not keep anything
  3860. // other than props & listeners & slot
  3861. // work around flow
  3862. var slot = data.slot;
  3863. data = {};
  3864. if (slot) {
  3865. data.slot = slot;
  3866. }
  3867. }
  3868. // install component management hooks onto the placeholder node
  3869. installComponentHooks(data);
  3870. // return a placeholder vnode
  3871. var name = Ctor.options.name || tag;
  3872. var vnode = new VNode(
  3873. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  3874. data, undefined, undefined, undefined, context,
  3875. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  3876. asyncFactory
  3877. );
  3878. // Weex specific: invoke recycle-list optimized @render function for
  3879. // extracting cell-slot template.
  3880. // https://github.com/Hanks10100/weex-native-directive/tree/master/component
  3881. /* istanbul ignore if */
  3882. return vnode
  3883. }
  3884. function createComponentInstanceForVnode (
  3885. vnode, // we know it's MountedComponentVNode but flow doesn't
  3886. parent, // activeInstance in lifecycle state
  3887. parentElm,
  3888. refElm
  3889. ) {
  3890. var options = {
  3891. _isComponent: true,
  3892. parent: parent,
  3893. _parentVnode: vnode,
  3894. _parentElm: parentElm || null,
  3895. _refElm: refElm || null
  3896. };
  3897. // check inline-template render functions
  3898. var inlineTemplate = vnode.data.inlineTemplate;
  3899. if (isDef(inlineTemplate)) {
  3900. options.render = inlineTemplate.render;
  3901. options.staticRenderFns = inlineTemplate.staticRenderFns;
  3902. }
  3903. return new vnode.componentOptions.Ctor(options)
  3904. }
  3905. function installComponentHooks (data) {
  3906. var hooks = data.hook || (data.hook = {});
  3907. for (var i = 0; i < hooksToMerge.length; i++) {
  3908. var key = hooksToMerge[i];
  3909. hooks[key] = componentVNodeHooks[key];
  3910. }
  3911. }
  3912. // transform component v-model info (value and callback) into
  3913. // prop and event handler respectively.
  3914. function transformModel (options, data) {
  3915. var prop = (options.model && options.model.prop) || 'value';
  3916. var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value;
  3917. var on = data.on || (data.on = {});
  3918. if (isDef(on[event])) {
  3919. on[event] = [data.model.callback].concat(on[event]);
  3920. } else {
  3921. on[event] = data.model.callback;
  3922. }
  3923. }
  3924. /* */
  3925. var SIMPLE_NORMALIZE = 1;
  3926. var ALWAYS_NORMALIZE = 2;
  3927. // wrapper function for providing a more flexible interface
  3928. // without getting yelled at by flow
  3929. function createElement (
  3930. context,
  3931. tag,
  3932. data,
  3933. children,
  3934. normalizationType,
  3935. alwaysNormalize
  3936. ) {
  3937. if (Array.isArray(data) || isPrimitive(data)) {
  3938. normalizationType = children;
  3939. children = data;
  3940. data = undefined;
  3941. }
  3942. if (isTrue(alwaysNormalize)) {
  3943. normalizationType = ALWAYS_NORMALIZE;
  3944. }
  3945. return _createElement(context, tag, data, children, normalizationType)
  3946. }
  3947. function _createElement (
  3948. context,
  3949. tag,
  3950. data,
  3951. children,
  3952. normalizationType
  3953. ) {
  3954. if (isDef(data) && isDef((data).__ob__)) {
  3955. "development" !== 'production' && warn(
  3956. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  3957. 'Always create fresh vnode data objects in each render!',
  3958. context
  3959. );
  3960. return createEmptyVNode()
  3961. }
  3962. // object syntax in v-bind
  3963. if (isDef(data) && isDef(data.is)) {
  3964. tag = data.is;
  3965. }
  3966. if (!tag) {
  3967. // in case of component :is set to falsy value
  3968. return createEmptyVNode()
  3969. }
  3970. // warn against non-primitive key
  3971. if ("development" !== 'production' &&
  3972. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  3973. ) {
  3974. {
  3975. warn(
  3976. 'Avoid using non-primitive value as key, ' +
  3977. 'use string/number value instead.',
  3978. context
  3979. );
  3980. }
  3981. }
  3982. // support single function children as default scoped slot
  3983. if (Array.isArray(children) &&
  3984. typeof children[0] === 'function'
  3985. ) {
  3986. data = data || {};
  3987. data.scopedSlots = { default: children[0] };
  3988. children.length = 0;
  3989. }
  3990. if (normalizationType === ALWAYS_NORMALIZE) {
  3991. children = normalizeChildren(children);
  3992. } else if (normalizationType === SIMPLE_NORMALIZE) {
  3993. children = simpleNormalizeChildren(children);
  3994. }
  3995. var vnode, ns;
  3996. if (typeof tag === 'string') {
  3997. var Ctor;
  3998. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  3999. if (config.isReservedTag(tag)) {
  4000. // platform built-in elements
  4001. vnode = new VNode(
  4002. config.parsePlatformTagName(tag), data, children,
  4003. undefined, undefined, context
  4004. );
  4005. } else if (isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  4006. // component
  4007. vnode = createComponent(Ctor, data, context, children, tag);
  4008. } else {
  4009. // unknown or unlisted namespaced elements
  4010. // check at runtime because it may get assigned a namespace when its
  4011. // parent normalizes children
  4012. vnode = new VNode(
  4013. tag, data, children,
  4014. undefined, undefined, context
  4015. );
  4016. }
  4017. } else {
  4018. // direct component options / constructor
  4019. vnode = createComponent(tag, data, context, children);
  4020. }
  4021. if (Array.isArray(vnode)) {
  4022. return vnode
  4023. } else if (isDef(vnode)) {
  4024. if (isDef(ns)) { applyNS(vnode, ns); }
  4025. if (isDef(data)) { registerDeepBindings(data); }
  4026. return vnode
  4027. } else {
  4028. return createEmptyVNode()
  4029. }
  4030. }
  4031. function applyNS (vnode, ns, force) {
  4032. vnode.ns = ns;
  4033. if (vnode.tag === 'foreignObject') {
  4034. // use default namespace inside foreignObject
  4035. ns = undefined;
  4036. force = true;
  4037. }
  4038. if (isDef(vnode.children)) {
  4039. for (var i = 0, l = vnode.children.length; i < l; i++) {
  4040. var child = vnode.children[i];
  4041. if (isDef(child.tag) && (
  4042. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  4043. applyNS(child, ns, force);
  4044. }
  4045. }
  4046. }
  4047. }
  4048. // ref #5318
  4049. // necessary to ensure parent re-render when deep bindings like :style and
  4050. // :class are used on slot nodes
  4051. function registerDeepBindings (data) {
  4052. if (isObject(data.style)) {
  4053. traverse(data.style);
  4054. }
  4055. if (isObject(data.class)) {
  4056. traverse(data.class);
  4057. }
  4058. }
  4059. /* */
  4060. function initRender (vm) {
  4061. vm._vnode = null; // the root of the child tree
  4062. vm._staticTrees = null; // v-once cached trees
  4063. var options = vm.$options;
  4064. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  4065. var renderContext = parentVnode && parentVnode.context;
  4066. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  4067. vm.$scopedSlots = emptyObject;
  4068. // bind the createElement fn to this instance
  4069. // so that we get proper render context inside it.
  4070. // args order: tag, data, children, normalizationType, alwaysNormalize
  4071. // internal version is used by render functions compiled from templates
  4072. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  4073. // normalization is always applied for the public version, used in
  4074. // user-written render functions.
  4075. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  4076. // $attrs & $listeners are exposed for easier HOC creation.
  4077. // they need to be reactive so that HOCs using them are always updated
  4078. var parentData = parentVnode && parentVnode.data;
  4079. /* istanbul ignore else */
  4080. {
  4081. defineReactive(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  4082. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  4083. }, true);
  4084. defineReactive(vm, '$listeners', options._parentListeners || emptyObject, function () {
  4085. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  4086. }, true);
  4087. }
  4088. }
  4089. function renderMixin (Vue) {
  4090. // install runtime convenience helpers
  4091. installRenderHelpers(Vue.prototype);
  4092. Vue.prototype.$nextTick = function (fn) {
  4093. return nextTick(fn, this)
  4094. };
  4095. Vue.prototype._render = function () {
  4096. var vm = this;
  4097. var ref = vm.$options;
  4098. var render = ref.render;
  4099. var _parentVnode = ref._parentVnode;
  4100. // reset _rendered flag on slots for duplicate slot check
  4101. {
  4102. for (var key in vm.$slots) {
  4103. // $flow-disable-line
  4104. vm.$slots[key]._rendered = false;
  4105. }
  4106. }
  4107. if (_parentVnode) {
  4108. vm.$scopedSlots = _parentVnode.data.scopedSlots || emptyObject;
  4109. }
  4110. // set parent vnode. this allows render functions to have access
  4111. // to the data on the placeholder node.
  4112. vm.$vnode = _parentVnode;
  4113. // render self
  4114. var vnode;
  4115. try {
  4116. vnode = render.call(vm._renderProxy, vm.$createElement);
  4117. } catch (e) {
  4118. handleError(e, vm, "render");
  4119. // return error render result,
  4120. // or previous vnode to prevent render error causing blank component
  4121. /* istanbul ignore else */
  4122. {
  4123. if (vm.$options.renderError) {
  4124. try {
  4125. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  4126. } catch (e) {
  4127. handleError(e, vm, "renderError");
  4128. vnode = vm._vnode;
  4129. }
  4130. } else {
  4131. vnode = vm._vnode;
  4132. }
  4133. }
  4134. }
  4135. // return empty vnode in case the render function errored out
  4136. if (!(vnode instanceof VNode)) {
  4137. if ("development" !== 'production' && Array.isArray(vnode)) {
  4138. warn(
  4139. 'Multiple root nodes returned from render function. Render function ' +
  4140. 'should return a single root node.',
  4141. vm
  4142. );
  4143. }
  4144. vnode = createEmptyVNode();
  4145. }
  4146. // set parent
  4147. vnode.parent = _parentVnode;
  4148. return vnode
  4149. };
  4150. }
  4151. /* */
  4152. var uid$3 = 0;
  4153. function initMixin (Vue) {
  4154. Vue.prototype._init = function (options) {
  4155. var vm = this;
  4156. // a uid
  4157. vm._uid = uid$3++;
  4158. var startTag, endTag;
  4159. /* istanbul ignore if */
  4160. if ("development" !== 'production' && config.performance && mark) {
  4161. startTag = "vue-perf-start:" + (vm._uid);
  4162. endTag = "vue-perf-end:" + (vm._uid);
  4163. mark(startTag);
  4164. }
  4165. // a flag to avoid this being observed
  4166. vm._isVue = true;
  4167. // merge options
  4168. if (options && options._isComponent) {
  4169. // optimize internal component instantiation
  4170. // since dynamic options merging is pretty slow, and none of the
  4171. // internal component options needs special treatment.
  4172. initInternalComponent(vm, options);
  4173. } else {
  4174. vm.$options = mergeOptions(
  4175. resolveConstructorOptions(vm.constructor),
  4176. options || {},
  4177. vm
  4178. );
  4179. }
  4180. /* istanbul ignore else */
  4181. {
  4182. initProxy(vm);
  4183. }
  4184. // expose real self
  4185. vm._self = vm;
  4186. initLifecycle(vm);
  4187. initEvents(vm);
  4188. initRender(vm);
  4189. callHook(vm, 'beforeCreate');
  4190. initInjections(vm); // resolve injections before data/props
  4191. initState(vm);
  4192. initProvide(vm); // resolve provide after data/props
  4193. callHook(vm, 'created');
  4194. /* istanbul ignore if */
  4195. if ("development" !== 'production' && config.performance && mark) {
  4196. vm._name = formatComponentName(vm, false);
  4197. mark(endTag);
  4198. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  4199. }
  4200. if (vm.$options.el) {
  4201. vm.$mount(vm.$options.el);
  4202. }
  4203. };
  4204. }
  4205. function initInternalComponent (vm, options) {
  4206. var opts = vm.$options = Object.create(vm.constructor.options);
  4207. // doing this because it's faster than dynamic enumeration.
  4208. var parentVnode = options._parentVnode;
  4209. opts.parent = options.parent;
  4210. opts._parentVnode = parentVnode;
  4211. opts._parentElm = options._parentElm;
  4212. opts._refElm = options._refElm;
  4213. var vnodeComponentOptions = parentVnode.componentOptions;
  4214. opts.propsData = vnodeComponentOptions.propsData;
  4215. opts._parentListeners = vnodeComponentOptions.listeners;
  4216. opts._renderChildren = vnodeComponentOptions.children;
  4217. opts._componentTag = vnodeComponentOptions.tag;
  4218. if (options.render) {
  4219. opts.render = options.render;
  4220. opts.staticRenderFns = options.staticRenderFns;
  4221. }
  4222. }
  4223. function resolveConstructorOptions (Ctor) {
  4224. var options = Ctor.options;
  4225. if (Ctor.super) {
  4226. var superOptions = resolveConstructorOptions(Ctor.super);
  4227. var cachedSuperOptions = Ctor.superOptions;
  4228. if (superOptions !== cachedSuperOptions) {
  4229. // super option changed,
  4230. // need to resolve new options.
  4231. Ctor.superOptions = superOptions;
  4232. // check if there are any late-modified/attached options (#4976)
  4233. var modifiedOptions = resolveModifiedOptions(Ctor);
  4234. // update base extend options
  4235. if (modifiedOptions) {
  4236. extend(Ctor.extendOptions, modifiedOptions);
  4237. }
  4238. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4239. if (options.name) {
  4240. options.components[options.name] = Ctor;
  4241. }
  4242. }
  4243. }
  4244. return options
  4245. }
  4246. function resolveModifiedOptions (Ctor) {
  4247. var modified;
  4248. var latest = Ctor.options;
  4249. var extended = Ctor.extendOptions;
  4250. var sealed = Ctor.sealedOptions;
  4251. for (var key in latest) {
  4252. if (latest[key] !== sealed[key]) {
  4253. if (!modified) { modified = {}; }
  4254. modified[key] = dedupe(latest[key], extended[key], sealed[key]);
  4255. }
  4256. }
  4257. return modified
  4258. }
  4259. function dedupe (latest, extended, sealed) {
  4260. // compare latest and sealed to ensure lifecycle hooks won't be duplicated
  4261. // between merges
  4262. if (Array.isArray(latest)) {
  4263. var res = [];
  4264. sealed = Array.isArray(sealed) ? sealed : [sealed];
  4265. extended = Array.isArray(extended) ? extended : [extended];
  4266. for (var i = 0; i < latest.length; i++) {
  4267. // push original options and not sealed options to exclude duplicated options
  4268. if (extended.indexOf(latest[i]) >= 0 || sealed.indexOf(latest[i]) < 0) {
  4269. res.push(latest[i]);
  4270. }
  4271. }
  4272. return res
  4273. } else {
  4274. return latest
  4275. }
  4276. }
  4277. function Vue (options) {
  4278. if ("development" !== 'production' &&
  4279. !(this instanceof Vue)
  4280. ) {
  4281. warn('Vue is a constructor and should be called with the `new` keyword');
  4282. }
  4283. this._init(options);
  4284. }
  4285. initMixin(Vue);
  4286. stateMixin(Vue);
  4287. eventsMixin(Vue);
  4288. lifecycleMixin(Vue);
  4289. renderMixin(Vue);
  4290. /* */
  4291. function initUse (Vue) {
  4292. Vue.use = function (plugin) {
  4293. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  4294. if (installedPlugins.indexOf(plugin) > -1) {
  4295. return this
  4296. }
  4297. // additional parameters
  4298. var args = toArray(arguments, 1);
  4299. args.unshift(this);
  4300. if (typeof plugin.install === 'function') {
  4301. plugin.install.apply(plugin, args);
  4302. } else if (typeof plugin === 'function') {
  4303. plugin.apply(null, args);
  4304. }
  4305. installedPlugins.push(plugin);
  4306. return this
  4307. };
  4308. }
  4309. /* */
  4310. function initMixin$1 (Vue) {
  4311. Vue.mixin = function (mixin) {
  4312. this.options = mergeOptions(this.options, mixin);
  4313. return this
  4314. };
  4315. }
  4316. /* */
  4317. function initExtend (Vue) {
  4318. /**
  4319. * Each instance constructor, including Vue, has a unique
  4320. * cid. This enables us to create wrapped "child
  4321. * constructors" for prototypal inheritance and cache them.
  4322. */
  4323. Vue.cid = 0;
  4324. var cid = 1;
  4325. /**
  4326. * Class inheritance
  4327. */
  4328. Vue.extend = function (extendOptions) {
  4329. extendOptions = extendOptions || {};
  4330. var Super = this;
  4331. var SuperId = Super.cid;
  4332. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  4333. if (cachedCtors[SuperId]) {
  4334. return cachedCtors[SuperId]
  4335. }
  4336. var name = extendOptions.name || Super.options.name;
  4337. if ("development" !== 'production' && name) {
  4338. validateComponentName(name);
  4339. }
  4340. var Sub = function VueComponent (options) {
  4341. this._init(options);
  4342. };
  4343. Sub.prototype = Object.create(Super.prototype);
  4344. Sub.prototype.constructor = Sub;
  4345. Sub.cid = cid++;
  4346. Sub.options = mergeOptions(
  4347. Super.options,
  4348. extendOptions
  4349. );
  4350. Sub['super'] = Super;
  4351. // For props and computed properties, we define the proxy getters on
  4352. // the Vue instances at extension time, on the extended prototype. This
  4353. // avoids Object.defineProperty calls for each instance created.
  4354. if (Sub.options.props) {
  4355. initProps$1(Sub);
  4356. }
  4357. if (Sub.options.computed) {
  4358. initComputed$1(Sub);
  4359. }
  4360. // allow further extension/mixin/plugin usage
  4361. Sub.extend = Super.extend;
  4362. Sub.mixin = Super.mixin;
  4363. Sub.use = Super.use;
  4364. // create asset registers, so extended classes
  4365. // can have their private assets too.
  4366. ASSET_TYPES.forEach(function (type) {
  4367. Sub[type] = Super[type];
  4368. });
  4369. // enable recursive self-lookup
  4370. if (name) {
  4371. Sub.options.components[name] = Sub;
  4372. }
  4373. // keep a reference to the super options at extension time.
  4374. // later at instantiation we can check if Super's options have
  4375. // been updated.
  4376. Sub.superOptions = Super.options;
  4377. Sub.extendOptions = extendOptions;
  4378. Sub.sealedOptions = extend({}, Sub.options);
  4379. // cache constructor
  4380. cachedCtors[SuperId] = Sub;
  4381. return Sub
  4382. };
  4383. }
  4384. function initProps$1 (Comp) {
  4385. var props = Comp.options.props;
  4386. for (var key in props) {
  4387. proxy(Comp.prototype, "_props", key);
  4388. }
  4389. }
  4390. function initComputed$1 (Comp) {
  4391. var computed = Comp.options.computed;
  4392. for (var key in computed) {
  4393. defineComputed(Comp.prototype, key, computed[key]);
  4394. }
  4395. }
  4396. /* */
  4397. function initAssetRegisters (Vue) {
  4398. /**
  4399. * Create asset registration methods.
  4400. */
  4401. ASSET_TYPES.forEach(function (type) {
  4402. Vue[type] = function (
  4403. id,
  4404. definition
  4405. ) {
  4406. if (!definition) {
  4407. return this.options[type + 's'][id]
  4408. } else {
  4409. /* istanbul ignore if */
  4410. if ("development" !== 'production' && type === 'component') {
  4411. validateComponentName(id);
  4412. }
  4413. if (type === 'component' && isPlainObject(definition)) {
  4414. definition.name = definition.name || id;
  4415. definition = this.options._base.extend(definition);
  4416. }
  4417. if (type === 'directive' && typeof definition === 'function') {
  4418. definition = { bind: definition, update: definition };
  4419. }
  4420. this.options[type + 's'][id] = definition;
  4421. return definition
  4422. }
  4423. };
  4424. });
  4425. }
  4426. /* */
  4427. function getComponentName (opts) {
  4428. return opts && (opts.Ctor.options.name || opts.tag)
  4429. }
  4430. function matches (pattern, name) {
  4431. if (Array.isArray(pattern)) {
  4432. return pattern.indexOf(name) > -1
  4433. } else if (typeof pattern === 'string') {
  4434. return pattern.split(',').indexOf(name) > -1
  4435. } else if (isRegExp(pattern)) {
  4436. return pattern.test(name)
  4437. }
  4438. /* istanbul ignore next */
  4439. return false
  4440. }
  4441. function pruneCache (keepAliveInstance, filter) {
  4442. var cache = keepAliveInstance.cache;
  4443. var keys = keepAliveInstance.keys;
  4444. var _vnode = keepAliveInstance._vnode;
  4445. for (var key in cache) {
  4446. var cachedNode = cache[key];
  4447. if (cachedNode) {
  4448. var name = getComponentName(cachedNode.componentOptions);
  4449. if (name && !filter(name)) {
  4450. pruneCacheEntry(cache, key, keys, _vnode);
  4451. }
  4452. }
  4453. }
  4454. }
  4455. function pruneCacheEntry (
  4456. cache,
  4457. key,
  4458. keys,
  4459. current
  4460. ) {
  4461. var cached$$1 = cache[key];
  4462. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  4463. cached$$1.componentInstance.$destroy();
  4464. }
  4465. cache[key] = null;
  4466. remove(keys, key);
  4467. }
  4468. var patternTypes = [String, RegExp, Array];
  4469. var KeepAlive = {
  4470. name: 'keep-alive',
  4471. abstract: true,
  4472. props: {
  4473. include: patternTypes,
  4474. exclude: patternTypes,
  4475. max: [String, Number]
  4476. },
  4477. created: function created () {
  4478. this.cache = Object.create(null);
  4479. this.keys = [];
  4480. },
  4481. destroyed: function destroyed () {
  4482. var this$1 = this;
  4483. for (var key in this$1.cache) {
  4484. pruneCacheEntry(this$1.cache, key, this$1.keys);
  4485. }
  4486. },
  4487. mounted: function mounted () {
  4488. var this$1 = this;
  4489. this.$watch('include', function (val) {
  4490. pruneCache(this$1, function (name) { return matches(val, name); });
  4491. });
  4492. this.$watch('exclude', function (val) {
  4493. pruneCache(this$1, function (name) { return !matches(val, name); });
  4494. });
  4495. },
  4496. render: function render () {
  4497. var slot = this.$slots.default;
  4498. var vnode = getFirstComponentChild(slot);
  4499. var componentOptions = vnode && vnode.componentOptions;
  4500. if (componentOptions) {
  4501. // check pattern
  4502. var name = getComponentName(componentOptions);
  4503. var ref = this;
  4504. var include = ref.include;
  4505. var exclude = ref.exclude;
  4506. if (
  4507. // not included
  4508. (include && (!name || !matches(include, name))) ||
  4509. // excluded
  4510. (exclude && name && matches(exclude, name))
  4511. ) {
  4512. return vnode
  4513. }
  4514. var ref$1 = this;
  4515. var cache = ref$1.cache;
  4516. var keys = ref$1.keys;
  4517. var key = vnode.key == null
  4518. // same constructor may get registered as different local components
  4519. // so cid alone is not enough (#3269)
  4520. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  4521. : vnode.key;
  4522. if (cache[key]) {
  4523. vnode.componentInstance = cache[key].componentInstance;
  4524. // make current key freshest
  4525. remove(keys, key);
  4526. keys.push(key);
  4527. } else {
  4528. cache[key] = vnode;
  4529. keys.push(key);
  4530. // prune oldest entry
  4531. if (this.max && keys.length > parseInt(this.max)) {
  4532. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  4533. }
  4534. }
  4535. vnode.data.keepAlive = true;
  4536. }
  4537. return vnode || (slot && slot[0])
  4538. }
  4539. }
  4540. var builtInComponents = {
  4541. KeepAlive: KeepAlive
  4542. }
  4543. /* */
  4544. function initGlobalAPI (Vue) {
  4545. // config
  4546. var configDef = {};
  4547. configDef.get = function () { return config; };
  4548. {
  4549. configDef.set = function () {
  4550. warn(
  4551. 'Do not replace the Vue.config object, set individual fields instead.'
  4552. );
  4553. };
  4554. }
  4555. Object.defineProperty(Vue, 'config', configDef);
  4556. // exposed util methods.
  4557. // NOTE: these are not considered part of the public API - avoid relying on
  4558. // them unless you are aware of the risk.
  4559. Vue.util = {
  4560. warn: warn,
  4561. extend: extend,
  4562. mergeOptions: mergeOptions,
  4563. defineReactive: defineReactive
  4564. };
  4565. Vue.set = set;
  4566. Vue.delete = del;
  4567. Vue.nextTick = nextTick;
  4568. Vue.options = Object.create(null);
  4569. ASSET_TYPES.forEach(function (type) {
  4570. Vue.options[type + 's'] = Object.create(null);
  4571. });
  4572. // this is used to identify the "base" constructor to extend all plain-object
  4573. // components with in Weex's multi-instance scenarios.
  4574. Vue.options._base = Vue;
  4575. extend(Vue.options.components, builtInComponents);
  4576. initUse(Vue);
  4577. initMixin$1(Vue);
  4578. initExtend(Vue);
  4579. initAssetRegisters(Vue);
  4580. }
  4581. initGlobalAPI(Vue);
  4582. Object.defineProperty(Vue.prototype, '$isServer', {
  4583. get: isServerRendering
  4584. });
  4585. Object.defineProperty(Vue.prototype, '$ssrContext', {
  4586. get: function get () {
  4587. /* istanbul ignore next */
  4588. return this.$vnode && this.$vnode.ssrContext
  4589. }
  4590. });
  4591. // expose FunctionalRenderContext for ssr runtime helper installation
  4592. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  4593. value: FunctionalRenderContext
  4594. });
  4595. Vue.version = '2.5.16';
  4596. /* */
  4597. // these are reserved for web because they are directly compiled away
  4598. // during template compilation
  4599. var isReservedAttr = makeMap('style,class');
  4600. // attributes that should be using props for binding
  4601. var acceptValue = makeMap('input,textarea,option,select,progress');
  4602. var mustUseProp = function (tag, type, attr) {
  4603. return (
  4604. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  4605. (attr === 'selected' && tag === 'option') ||
  4606. (attr === 'checked' && tag === 'input') ||
  4607. (attr === 'muted' && tag === 'video')
  4608. )
  4609. };
  4610. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  4611. var isBooleanAttr = makeMap(
  4612. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  4613. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  4614. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  4615. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  4616. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  4617. 'truespeed,typemustmatch,visible'
  4618. );
  4619. var xlinkNS = 'http://www.w3.org/1999/xlink';
  4620. var isXlink = function (name) {
  4621. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  4622. };
  4623. var getXlinkProp = function (name) {
  4624. return isXlink(name) ? name.slice(6, name.length) : ''
  4625. };
  4626. var isFalsyAttrValue = function (val) {
  4627. return val == null || val === false
  4628. };
  4629. /* */
  4630. function genClassForVnode (vnode) {
  4631. var data = vnode.data;
  4632. var parentNode = vnode;
  4633. var childNode = vnode;
  4634. while (isDef(childNode.componentInstance)) {
  4635. childNode = childNode.componentInstance._vnode;
  4636. if (childNode && childNode.data) {
  4637. data = mergeClassData(childNode.data, data);
  4638. }
  4639. }
  4640. while (isDef(parentNode = parentNode.parent)) {
  4641. if (parentNode && parentNode.data) {
  4642. data = mergeClassData(data, parentNode.data);
  4643. }
  4644. }
  4645. return renderClass(data.staticClass, data.class)
  4646. }
  4647. function mergeClassData (child, parent) {
  4648. return {
  4649. staticClass: concat(child.staticClass, parent.staticClass),
  4650. class: isDef(child.class)
  4651. ? [child.class, parent.class]
  4652. : parent.class
  4653. }
  4654. }
  4655. function renderClass (
  4656. staticClass,
  4657. dynamicClass
  4658. ) {
  4659. if (isDef(staticClass) || isDef(dynamicClass)) {
  4660. return concat(staticClass, stringifyClass(dynamicClass))
  4661. }
  4662. /* istanbul ignore next */
  4663. return ''
  4664. }
  4665. function concat (a, b) {
  4666. return a ? b ? (a + ' ' + b) : a : (b || '')
  4667. }
  4668. function stringifyClass (value) {
  4669. if (Array.isArray(value)) {
  4670. return stringifyArray(value)
  4671. }
  4672. if (isObject(value)) {
  4673. return stringifyObject(value)
  4674. }
  4675. if (typeof value === 'string') {
  4676. return value
  4677. }
  4678. /* istanbul ignore next */
  4679. return ''
  4680. }
  4681. function stringifyArray (value) {
  4682. var res = '';
  4683. var stringified;
  4684. for (var i = 0, l = value.length; i < l; i++) {
  4685. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  4686. if (res) { res += ' '; }
  4687. res += stringified;
  4688. }
  4689. }
  4690. return res
  4691. }
  4692. function stringifyObject (value) {
  4693. var res = '';
  4694. for (var key in value) {
  4695. if (value[key]) {
  4696. if (res) { res += ' '; }
  4697. res += key;
  4698. }
  4699. }
  4700. return res
  4701. }
  4702. /* */
  4703. var namespaceMap = {
  4704. svg: 'http://www.w3.org/2000/svg',
  4705. math: 'http://www.w3.org/1998/Math/MathML'
  4706. };
  4707. var isHTMLTag = makeMap(
  4708. 'html,body,base,head,link,meta,style,title,' +
  4709. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  4710. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  4711. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  4712. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  4713. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  4714. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  4715. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  4716. 'output,progress,select,textarea,' +
  4717. 'details,dialog,menu,menuitem,summary,' +
  4718. 'content,element,shadow,template,blockquote,iframe,tfoot'
  4719. );
  4720. // this map is intentionally selective, only covering SVG elements that may
  4721. // contain child elements.
  4722. var isSVG = makeMap(
  4723. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  4724. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  4725. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  4726. true
  4727. );
  4728. var isPreTag = function (tag) { return tag === 'pre'; };
  4729. var isReservedTag = function (tag) {
  4730. return isHTMLTag(tag) || isSVG(tag)
  4731. };
  4732. function getTagNamespace (tag) {
  4733. if (isSVG(tag)) {
  4734. return 'svg'
  4735. }
  4736. // basic support for MathML
  4737. // note it doesn't support other MathML elements being component roots
  4738. if (tag === 'math') {
  4739. return 'math'
  4740. }
  4741. }
  4742. var unknownElementCache = Object.create(null);
  4743. function isUnknownElement (tag) {
  4744. /* istanbul ignore if */
  4745. if (!inBrowser) {
  4746. return true
  4747. }
  4748. if (isReservedTag(tag)) {
  4749. return false
  4750. }
  4751. tag = tag.toLowerCase();
  4752. /* istanbul ignore if */
  4753. if (unknownElementCache[tag] != null) {
  4754. return unknownElementCache[tag]
  4755. }
  4756. var el = document.createElement(tag);
  4757. if (tag.indexOf('-') > -1) {
  4758. // http://stackoverflow.com/a/28210364/1070244
  4759. return (unknownElementCache[tag] = (
  4760. el.constructor === window.HTMLUnknownElement ||
  4761. el.constructor === window.HTMLElement
  4762. ))
  4763. } else {
  4764. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  4765. }
  4766. }
  4767. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  4768. /* */
  4769. /**
  4770. * Query an element selector if it's not an element already.
  4771. */
  4772. function query (el) {
  4773. if (typeof el === 'string') {
  4774. var selected = document.querySelector(el);
  4775. if (!selected) {
  4776. "development" !== 'production' && warn(
  4777. 'Cannot find element: ' + el
  4778. );
  4779. return document.createElement('div')
  4780. }
  4781. return selected
  4782. } else {
  4783. return el
  4784. }
  4785. }
  4786. /* */
  4787. function createElement$1 (tagName, vnode) {
  4788. var elm = document.createElement(tagName);
  4789. if (tagName !== 'select') {
  4790. return elm
  4791. }
  4792. // false or null will remove the attribute but undefined will not
  4793. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  4794. elm.setAttribute('multiple', 'multiple');
  4795. }
  4796. return elm
  4797. }
  4798. function createElementNS (namespace, tagName) {
  4799. return document.createElementNS(namespaceMap[namespace], tagName)
  4800. }
  4801. function createTextNode (text) {
  4802. return document.createTextNode(text)
  4803. }
  4804. function createComment (text) {
  4805. return document.createComment(text)
  4806. }
  4807. function insertBefore (parentNode, newNode, referenceNode) {
  4808. parentNode.insertBefore(newNode, referenceNode);
  4809. }
  4810. function removeChild (node, child) {
  4811. node.removeChild(child);
  4812. }
  4813. function appendChild (node, child) {
  4814. node.appendChild(child);
  4815. }
  4816. function parentNode (node) {
  4817. return node.parentNode
  4818. }
  4819. function nextSibling (node) {
  4820. return node.nextSibling
  4821. }
  4822. function tagName (node) {
  4823. return node.tagName
  4824. }
  4825. function setTextContent (node, text) {
  4826. node.textContent = text;
  4827. }
  4828. function setStyleScope (node, scopeId) {
  4829. node.setAttribute(scopeId, '');
  4830. }
  4831. var nodeOps = Object.freeze({
  4832. createElement: createElement$1,
  4833. createElementNS: createElementNS,
  4834. createTextNode: createTextNode,
  4835. createComment: createComment,
  4836. insertBefore: insertBefore,
  4837. removeChild: removeChild,
  4838. appendChild: appendChild,
  4839. parentNode: parentNode,
  4840. nextSibling: nextSibling,
  4841. tagName: tagName,
  4842. setTextContent: setTextContent,
  4843. setStyleScope: setStyleScope
  4844. });
  4845. /* */
  4846. var ref = {
  4847. create: function create (_, vnode) {
  4848. registerRef(vnode);
  4849. },
  4850. update: function update (oldVnode, vnode) {
  4851. if (oldVnode.data.ref !== vnode.data.ref) {
  4852. registerRef(oldVnode, true);
  4853. registerRef(vnode);
  4854. }
  4855. },
  4856. destroy: function destroy (vnode) {
  4857. registerRef(vnode, true);
  4858. }
  4859. }
  4860. function registerRef (vnode, isRemoval) {
  4861. var key = vnode.data.ref;
  4862. if (!isDef(key)) { return }
  4863. var vm = vnode.context;
  4864. var ref = vnode.componentInstance || vnode.elm;
  4865. var refs = vm.$refs;
  4866. if (isRemoval) {
  4867. if (Array.isArray(refs[key])) {
  4868. remove(refs[key], ref);
  4869. } else if (refs[key] === ref) {
  4870. refs[key] = undefined;
  4871. }
  4872. } else {
  4873. if (vnode.data.refInFor) {
  4874. if (!Array.isArray(refs[key])) {
  4875. refs[key] = [ref];
  4876. } else if (refs[key].indexOf(ref) < 0) {
  4877. // $flow-disable-line
  4878. refs[key].push(ref);
  4879. }
  4880. } else {
  4881. refs[key] = ref;
  4882. }
  4883. }
  4884. }
  4885. /**
  4886. * Virtual DOM patching algorithm based on Snabbdom by
  4887. * Simon Friis Vindum (@paldepind)
  4888. * Licensed under the MIT License
  4889. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  4890. *
  4891. * modified by Evan You (@yyx990803)
  4892. *
  4893. * Not type-checking this because this file is perf-critical and the cost
  4894. * of making flow understand it is not worth it.
  4895. */
  4896. var emptyNode = new VNode('', {}, []);
  4897. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  4898. function sameVnode (a, b) {
  4899. return (
  4900. a.key === b.key && (
  4901. (
  4902. a.tag === b.tag &&
  4903. a.isComment === b.isComment &&
  4904. isDef(a.data) === isDef(b.data) &&
  4905. sameInputType(a, b)
  4906. ) || (
  4907. isTrue(a.isAsyncPlaceholder) &&
  4908. a.asyncFactory === b.asyncFactory &&
  4909. isUndef(b.asyncFactory.error)
  4910. )
  4911. )
  4912. )
  4913. }
  4914. function sameInputType (a, b) {
  4915. if (a.tag !== 'input') { return true }
  4916. var i;
  4917. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  4918. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  4919. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  4920. }
  4921. function createKeyToOldIdx (children, beginIdx, endIdx) {
  4922. var i, key;
  4923. var map = {};
  4924. for (i = beginIdx; i <= endIdx; ++i) {
  4925. key = children[i].key;
  4926. if (isDef(key)) { map[key] = i; }
  4927. }
  4928. return map
  4929. }
  4930. function createPatchFunction (backend) {
  4931. var i, j;
  4932. var cbs = {};
  4933. var modules = backend.modules;
  4934. var nodeOps = backend.nodeOps;
  4935. for (i = 0; i < hooks.length; ++i) {
  4936. cbs[hooks[i]] = [];
  4937. for (j = 0; j < modules.length; ++j) {
  4938. if (isDef(modules[j][hooks[i]])) {
  4939. cbs[hooks[i]].push(modules[j][hooks[i]]);
  4940. }
  4941. }
  4942. }
  4943. function emptyNodeAt (elm) {
  4944. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  4945. }
  4946. function createRmCb (childElm, listeners) {
  4947. function remove () {
  4948. if (--remove.listeners === 0) {
  4949. removeNode(childElm);
  4950. }
  4951. }
  4952. remove.listeners = listeners;
  4953. return remove
  4954. }
  4955. function removeNode (el) {
  4956. var parent = nodeOps.parentNode(el);
  4957. // element may have already been removed due to v-html / v-text
  4958. if (isDef(parent)) {
  4959. nodeOps.removeChild(parent, el);
  4960. }
  4961. }
  4962. function isUnknownElement$$1 (vnode, inVPre) {
  4963. return (
  4964. !inVPre &&
  4965. !vnode.ns &&
  4966. !(
  4967. config.ignoredElements.length &&
  4968. config.ignoredElements.some(function (ignore) {
  4969. return isRegExp(ignore)
  4970. ? ignore.test(vnode.tag)
  4971. : ignore === vnode.tag
  4972. })
  4973. ) &&
  4974. config.isUnknownElement(vnode.tag)
  4975. )
  4976. }
  4977. var creatingElmInVPre = 0;
  4978. function createElm (
  4979. vnode,
  4980. insertedVnodeQueue,
  4981. parentElm,
  4982. refElm,
  4983. nested,
  4984. ownerArray,
  4985. index
  4986. ) {
  4987. if (isDef(vnode.elm) && isDef(ownerArray)) {
  4988. // This vnode was used in a previous render!
  4989. // now it's used as a new node, overwriting its elm would cause
  4990. // potential patch errors down the road when it's used as an insertion
  4991. // reference node. Instead, we clone the node on-demand before creating
  4992. // associated DOM element for it.
  4993. vnode = ownerArray[index] = cloneVNode(vnode);
  4994. }
  4995. vnode.isRootInsert = !nested; // for transition enter check
  4996. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  4997. return
  4998. }
  4999. var data = vnode.data;
  5000. var children = vnode.children;
  5001. var tag = vnode.tag;
  5002. if (isDef(tag)) {
  5003. {
  5004. if (data && data.pre) {
  5005. creatingElmInVPre++;
  5006. }
  5007. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  5008. warn(
  5009. 'Unknown custom element: <' + tag + '> - did you ' +
  5010. 'register the component correctly? For recursive components, ' +
  5011. 'make sure to provide the "name" option.',
  5012. vnode.context
  5013. );
  5014. }
  5015. }
  5016. vnode.elm = vnode.ns
  5017. ? nodeOps.createElementNS(vnode.ns, tag)
  5018. : nodeOps.createElement(tag, vnode);
  5019. setScope(vnode);
  5020. /* istanbul ignore if */
  5021. {
  5022. createChildren(vnode, children, insertedVnodeQueue);
  5023. if (isDef(data)) {
  5024. invokeCreateHooks(vnode, insertedVnodeQueue);
  5025. }
  5026. insert(parentElm, vnode.elm, refElm);
  5027. }
  5028. if ("development" !== 'production' && data && data.pre) {
  5029. creatingElmInVPre--;
  5030. }
  5031. } else if (isTrue(vnode.isComment)) {
  5032. vnode.elm = nodeOps.createComment(vnode.text);
  5033. insert(parentElm, vnode.elm, refElm);
  5034. } else {
  5035. vnode.elm = nodeOps.createTextNode(vnode.text);
  5036. insert(parentElm, vnode.elm, refElm);
  5037. }
  5038. }
  5039. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5040. var i = vnode.data;
  5041. if (isDef(i)) {
  5042. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  5043. if (isDef(i = i.hook) && isDef(i = i.init)) {
  5044. i(vnode, false /* hydrating */, parentElm, refElm);
  5045. }
  5046. // after calling the init hook, if the vnode is a child component
  5047. // it should've created a child instance and mounted it. the child
  5048. // component also has set the placeholder vnode's elm.
  5049. // in that case we can just return the element and be done.
  5050. if (isDef(vnode.componentInstance)) {
  5051. initComponent(vnode, insertedVnodeQueue);
  5052. if (isTrue(isReactivated)) {
  5053. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  5054. }
  5055. return true
  5056. }
  5057. }
  5058. }
  5059. function initComponent (vnode, insertedVnodeQueue) {
  5060. if (isDef(vnode.data.pendingInsert)) {
  5061. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  5062. vnode.data.pendingInsert = null;
  5063. }
  5064. vnode.elm = vnode.componentInstance.$el;
  5065. if (isPatchable(vnode)) {
  5066. invokeCreateHooks(vnode, insertedVnodeQueue);
  5067. setScope(vnode);
  5068. } else {
  5069. // empty component root.
  5070. // skip all element-related modules except for ref (#3455)
  5071. registerRef(vnode);
  5072. // make sure to invoke the insert hook
  5073. insertedVnodeQueue.push(vnode);
  5074. }
  5075. }
  5076. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5077. var i;
  5078. // hack for #4339: a reactivated component with inner transition
  5079. // does not trigger because the inner node's created hooks are not called
  5080. // again. It's not ideal to involve module-specific logic in here but
  5081. // there doesn't seem to be a better way to do it.
  5082. var innerNode = vnode;
  5083. while (innerNode.componentInstance) {
  5084. innerNode = innerNode.componentInstance._vnode;
  5085. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  5086. for (i = 0; i < cbs.activate.length; ++i) {
  5087. cbs.activate[i](emptyNode, innerNode);
  5088. }
  5089. insertedVnodeQueue.push(innerNode);
  5090. break
  5091. }
  5092. }
  5093. // unlike a newly created component,
  5094. // a reactivated keep-alive component doesn't insert itself
  5095. insert(parentElm, vnode.elm, refElm);
  5096. }
  5097. function insert (parent, elm, ref$$1) {
  5098. if (isDef(parent)) {
  5099. if (isDef(ref$$1)) {
  5100. if (ref$$1.parentNode === parent) {
  5101. nodeOps.insertBefore(parent, elm, ref$$1);
  5102. }
  5103. } else {
  5104. nodeOps.appendChild(parent, elm);
  5105. }
  5106. }
  5107. }
  5108. function createChildren (vnode, children, insertedVnodeQueue) {
  5109. if (Array.isArray(children)) {
  5110. {
  5111. checkDuplicateKeys(children);
  5112. }
  5113. for (var i = 0; i < children.length; ++i) {
  5114. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  5115. }
  5116. } else if (isPrimitive(vnode.text)) {
  5117. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  5118. }
  5119. }
  5120. function isPatchable (vnode) {
  5121. while (vnode.componentInstance) {
  5122. vnode = vnode.componentInstance._vnode;
  5123. }
  5124. return isDef(vnode.tag)
  5125. }
  5126. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  5127. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5128. cbs.create[i$1](emptyNode, vnode);
  5129. }
  5130. i = vnode.data.hook; // Reuse variable
  5131. if (isDef(i)) {
  5132. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  5133. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  5134. }
  5135. }
  5136. // set scope id attribute for scoped CSS.
  5137. // this is implemented as a special case to avoid the overhead
  5138. // of going through the normal attribute patching process.
  5139. function setScope (vnode) {
  5140. var i;
  5141. if (isDef(i = vnode.fnScopeId)) {
  5142. nodeOps.setStyleScope(vnode.elm, i);
  5143. } else {
  5144. var ancestor = vnode;
  5145. while (ancestor) {
  5146. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  5147. nodeOps.setStyleScope(vnode.elm, i);
  5148. }
  5149. ancestor = ancestor.parent;
  5150. }
  5151. }
  5152. // for slot content they should also get the scopeId from the host instance.
  5153. if (isDef(i = activeInstance) &&
  5154. i !== vnode.context &&
  5155. i !== vnode.fnContext &&
  5156. isDef(i = i.$options._scopeId)
  5157. ) {
  5158. nodeOps.setStyleScope(vnode.elm, i);
  5159. }
  5160. }
  5161. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  5162. for (; startIdx <= endIdx; ++startIdx) {
  5163. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  5164. }
  5165. }
  5166. function invokeDestroyHook (vnode) {
  5167. var i, j;
  5168. var data = vnode.data;
  5169. if (isDef(data)) {
  5170. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  5171. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  5172. }
  5173. if (isDef(i = vnode.children)) {
  5174. for (j = 0; j < vnode.children.length; ++j) {
  5175. invokeDestroyHook(vnode.children[j]);
  5176. }
  5177. }
  5178. }
  5179. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  5180. for (; startIdx <= endIdx; ++startIdx) {
  5181. var ch = vnodes[startIdx];
  5182. if (isDef(ch)) {
  5183. if (isDef(ch.tag)) {
  5184. removeAndInvokeRemoveHook(ch);
  5185. invokeDestroyHook(ch);
  5186. } else { // Text node
  5187. removeNode(ch.elm);
  5188. }
  5189. }
  5190. }
  5191. }
  5192. function removeAndInvokeRemoveHook (vnode, rm) {
  5193. if (isDef(rm) || isDef(vnode.data)) {
  5194. var i;
  5195. var listeners = cbs.remove.length + 1;
  5196. if (isDef(rm)) {
  5197. // we have a recursively passed down rm callback
  5198. // increase the listeners count
  5199. rm.listeners += listeners;
  5200. } else {
  5201. // directly removing
  5202. rm = createRmCb(vnode.elm, listeners);
  5203. }
  5204. // recursively invoke hooks on child component root node
  5205. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  5206. removeAndInvokeRemoveHook(i, rm);
  5207. }
  5208. for (i = 0; i < cbs.remove.length; ++i) {
  5209. cbs.remove[i](vnode, rm);
  5210. }
  5211. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  5212. i(vnode, rm);
  5213. } else {
  5214. rm();
  5215. }
  5216. } else {
  5217. removeNode(vnode.elm);
  5218. }
  5219. }
  5220. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  5221. var oldStartIdx = 0;
  5222. var newStartIdx = 0;
  5223. var oldEndIdx = oldCh.length - 1;
  5224. var oldStartVnode = oldCh[0];
  5225. var oldEndVnode = oldCh[oldEndIdx];
  5226. var newEndIdx = newCh.length - 1;
  5227. var newStartVnode = newCh[0];
  5228. var newEndVnode = newCh[newEndIdx];
  5229. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  5230. // removeOnly is a special flag used only by <transition-group>
  5231. // to ensure removed elements stay in correct relative positions
  5232. // during leaving transitions
  5233. var canMove = !removeOnly;
  5234. {
  5235. checkDuplicateKeys(newCh);
  5236. }
  5237. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  5238. if (isUndef(oldStartVnode)) {
  5239. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  5240. } else if (isUndef(oldEndVnode)) {
  5241. oldEndVnode = oldCh[--oldEndIdx];
  5242. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  5243. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
  5244. oldStartVnode = oldCh[++oldStartIdx];
  5245. newStartVnode = newCh[++newStartIdx];
  5246. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  5247. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
  5248. oldEndVnode = oldCh[--oldEndIdx];
  5249. newEndVnode = newCh[--newEndIdx];
  5250. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  5251. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
  5252. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  5253. oldStartVnode = oldCh[++oldStartIdx];
  5254. newEndVnode = newCh[--newEndIdx];
  5255. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  5256. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
  5257. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  5258. oldEndVnode = oldCh[--oldEndIdx];
  5259. newStartVnode = newCh[++newStartIdx];
  5260. } else {
  5261. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  5262. idxInOld = isDef(newStartVnode.key)
  5263. ? oldKeyToIdx[newStartVnode.key]
  5264. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  5265. if (isUndef(idxInOld)) { // New element
  5266. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5267. } else {
  5268. vnodeToMove = oldCh[idxInOld];
  5269. if (sameVnode(vnodeToMove, newStartVnode)) {
  5270. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue);
  5271. oldCh[idxInOld] = undefined;
  5272. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  5273. } else {
  5274. // same key but different element. treat as new element
  5275. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5276. }
  5277. }
  5278. newStartVnode = newCh[++newStartIdx];
  5279. }
  5280. }
  5281. if (oldStartIdx > oldEndIdx) {
  5282. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  5283. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  5284. } else if (newStartIdx > newEndIdx) {
  5285. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  5286. }
  5287. }
  5288. function checkDuplicateKeys (children) {
  5289. var seenKeys = {};
  5290. for (var i = 0; i < children.length; i++) {
  5291. var vnode = children[i];
  5292. var key = vnode.key;
  5293. if (isDef(key)) {
  5294. if (seenKeys[key]) {
  5295. warn(
  5296. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  5297. vnode.context
  5298. );
  5299. } else {
  5300. seenKeys[key] = true;
  5301. }
  5302. }
  5303. }
  5304. }
  5305. function findIdxInOld (node, oldCh, start, end) {
  5306. for (var i = start; i < end; i++) {
  5307. var c = oldCh[i];
  5308. if (isDef(c) && sameVnode(node, c)) { return i }
  5309. }
  5310. }
  5311. function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
  5312. if (oldVnode === vnode) {
  5313. return
  5314. }
  5315. var elm = vnode.elm = oldVnode.elm;
  5316. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  5317. if (isDef(vnode.asyncFactory.resolved)) {
  5318. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  5319. } else {
  5320. vnode.isAsyncPlaceholder = true;
  5321. }
  5322. return
  5323. }
  5324. // reuse element for static trees.
  5325. // note we only do this if the vnode is cloned -
  5326. // if the new node is not cloned it means the render functions have been
  5327. // reset by the hot-reload-api and we need to do a proper re-render.
  5328. if (isTrue(vnode.isStatic) &&
  5329. isTrue(oldVnode.isStatic) &&
  5330. vnode.key === oldVnode.key &&
  5331. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  5332. ) {
  5333. vnode.componentInstance = oldVnode.componentInstance;
  5334. return
  5335. }
  5336. var i;
  5337. var data = vnode.data;
  5338. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  5339. i(oldVnode, vnode);
  5340. }
  5341. var oldCh = oldVnode.children;
  5342. var ch = vnode.children;
  5343. if (isDef(data) && isPatchable(vnode)) {
  5344. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  5345. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  5346. }
  5347. if (isUndef(vnode.text)) {
  5348. if (isDef(oldCh) && isDef(ch)) {
  5349. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  5350. } else if (isDef(ch)) {
  5351. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  5352. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  5353. } else if (isDef(oldCh)) {
  5354. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  5355. } else if (isDef(oldVnode.text)) {
  5356. nodeOps.setTextContent(elm, '');
  5357. }
  5358. } else if (oldVnode.text !== vnode.text) {
  5359. nodeOps.setTextContent(elm, vnode.text);
  5360. }
  5361. if (isDef(data)) {
  5362. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  5363. }
  5364. }
  5365. function invokeInsertHook (vnode, queue, initial) {
  5366. // delay insert hooks for component root nodes, invoke them after the
  5367. // element is really inserted
  5368. if (isTrue(initial) && isDef(vnode.parent)) {
  5369. vnode.parent.data.pendingInsert = queue;
  5370. } else {
  5371. for (var i = 0; i < queue.length; ++i) {
  5372. queue[i].data.hook.insert(queue[i]);
  5373. }
  5374. }
  5375. }
  5376. var hydrationBailed = false;
  5377. // list of modules that can skip create hook during hydration because they
  5378. // are already rendered on the client or has no need for initialization
  5379. // Note: style is excluded because it relies on initial clone for future
  5380. // deep updates (#7063).
  5381. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  5382. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  5383. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  5384. var i;
  5385. var tag = vnode.tag;
  5386. var data = vnode.data;
  5387. var children = vnode.children;
  5388. inVPre = inVPre || (data && data.pre);
  5389. vnode.elm = elm;
  5390. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  5391. vnode.isAsyncPlaceholder = true;
  5392. return true
  5393. }
  5394. // assert node match
  5395. {
  5396. if (!assertNodeMatch(elm, vnode, inVPre)) {
  5397. return false
  5398. }
  5399. }
  5400. if (isDef(data)) {
  5401. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  5402. if (isDef(i = vnode.componentInstance)) {
  5403. // child component. it should have hydrated its own tree.
  5404. initComponent(vnode, insertedVnodeQueue);
  5405. return true
  5406. }
  5407. }
  5408. if (isDef(tag)) {
  5409. if (isDef(children)) {
  5410. // empty element, allow client to pick up and populate children
  5411. if (!elm.hasChildNodes()) {
  5412. createChildren(vnode, children, insertedVnodeQueue);
  5413. } else {
  5414. // v-html and domProps: innerHTML
  5415. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  5416. if (i !== elm.innerHTML) {
  5417. /* istanbul ignore if */
  5418. if ("development" !== 'production' &&
  5419. typeof console !== 'undefined' &&
  5420. !hydrationBailed
  5421. ) {
  5422. hydrationBailed = true;
  5423. console.warn('Parent: ', elm);
  5424. console.warn('server innerHTML: ', i);
  5425. console.warn('client innerHTML: ', elm.innerHTML);
  5426. }
  5427. return false
  5428. }
  5429. } else {
  5430. // iterate and compare children lists
  5431. var childrenMatch = true;
  5432. var childNode = elm.firstChild;
  5433. for (var i$1 = 0; i$1 < children.length; i$1++) {
  5434. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  5435. childrenMatch = false;
  5436. break
  5437. }
  5438. childNode = childNode.nextSibling;
  5439. }
  5440. // if childNode is not null, it means the actual childNodes list is
  5441. // longer than the virtual children list.
  5442. if (!childrenMatch || childNode) {
  5443. /* istanbul ignore if */
  5444. if ("development" !== 'production' &&
  5445. typeof console !== 'undefined' &&
  5446. !hydrationBailed
  5447. ) {
  5448. hydrationBailed = true;
  5449. console.warn('Parent: ', elm);
  5450. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  5451. }
  5452. return false
  5453. }
  5454. }
  5455. }
  5456. }
  5457. if (isDef(data)) {
  5458. var fullInvoke = false;
  5459. for (var key in data) {
  5460. if (!isRenderedModule(key)) {
  5461. fullInvoke = true;
  5462. invokeCreateHooks(vnode, insertedVnodeQueue);
  5463. break
  5464. }
  5465. }
  5466. if (!fullInvoke && data['class']) {
  5467. // ensure collecting deps for deep class bindings for future updates
  5468. traverse(data['class']);
  5469. }
  5470. }
  5471. } else if (elm.data !== vnode.text) {
  5472. elm.data = vnode.text;
  5473. }
  5474. return true
  5475. }
  5476. function assertNodeMatch (node, vnode, inVPre) {
  5477. if (isDef(vnode.tag)) {
  5478. return vnode.tag.indexOf('vue-component') === 0 || (
  5479. !isUnknownElement$$1(vnode, inVPre) &&
  5480. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  5481. )
  5482. } else {
  5483. return node.nodeType === (vnode.isComment ? 8 : 3)
  5484. }
  5485. }
  5486. return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) {
  5487. if (isUndef(vnode)) {
  5488. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  5489. return
  5490. }
  5491. var isInitialPatch = false;
  5492. var insertedVnodeQueue = [];
  5493. if (isUndef(oldVnode)) {
  5494. // empty mount (likely as component), create new root element
  5495. isInitialPatch = true;
  5496. createElm(vnode, insertedVnodeQueue, parentElm, refElm);
  5497. } else {
  5498. var isRealElement = isDef(oldVnode.nodeType);
  5499. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  5500. // patch existing root node
  5501. patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
  5502. } else {
  5503. if (isRealElement) {
  5504. // mounting to a real element
  5505. // check if this is server-rendered content and if we can perform
  5506. // a successful hydration.
  5507. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  5508. oldVnode.removeAttribute(SSR_ATTR);
  5509. hydrating = true;
  5510. }
  5511. if (isTrue(hydrating)) {
  5512. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  5513. invokeInsertHook(vnode, insertedVnodeQueue, true);
  5514. return oldVnode
  5515. } else {
  5516. warn(
  5517. 'The client-side rendered virtual DOM tree is not matching ' +
  5518. 'server-rendered content. This is likely caused by incorrect ' +
  5519. 'HTML markup, for example nesting block-level elements inside ' +
  5520. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  5521. 'full client-side render.'
  5522. );
  5523. }
  5524. }
  5525. // either not server-rendered, or hydration failed.
  5526. // create an empty node and replace it
  5527. oldVnode = emptyNodeAt(oldVnode);
  5528. }
  5529. // replacing existing element
  5530. var oldElm = oldVnode.elm;
  5531. var parentElm$1 = nodeOps.parentNode(oldElm);
  5532. // create new node
  5533. createElm(
  5534. vnode,
  5535. insertedVnodeQueue,
  5536. // extremely rare edge case: do not insert if old element is in a
  5537. // leaving transition. Only happens when combining transition +
  5538. // keep-alive + HOCs. (#4590)
  5539. oldElm._leaveCb ? null : parentElm$1,
  5540. nodeOps.nextSibling(oldElm)
  5541. );
  5542. // update parent placeholder node element, recursively
  5543. if (isDef(vnode.parent)) {
  5544. var ancestor = vnode.parent;
  5545. var patchable = isPatchable(vnode);
  5546. while (ancestor) {
  5547. for (var i = 0; i < cbs.destroy.length; ++i) {
  5548. cbs.destroy[i](ancestor);
  5549. }
  5550. ancestor.elm = vnode.elm;
  5551. if (patchable) {
  5552. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5553. cbs.create[i$1](emptyNode, ancestor);
  5554. }
  5555. // #6513
  5556. // invoke insert hooks that may have been merged by create hooks.
  5557. // e.g. for directives that uses the "inserted" hook.
  5558. var insert = ancestor.data.hook.insert;
  5559. if (insert.merged) {
  5560. // start at index 1 to avoid re-invoking component mounted hook
  5561. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  5562. insert.fns[i$2]();
  5563. }
  5564. }
  5565. } else {
  5566. registerRef(ancestor);
  5567. }
  5568. ancestor = ancestor.parent;
  5569. }
  5570. }
  5571. // destroy old node
  5572. if (isDef(parentElm$1)) {
  5573. removeVnodes(parentElm$1, [oldVnode], 0, 0);
  5574. } else if (isDef(oldVnode.tag)) {
  5575. invokeDestroyHook(oldVnode);
  5576. }
  5577. }
  5578. }
  5579. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  5580. return vnode.elm
  5581. }
  5582. }
  5583. /* */
  5584. var directives = {
  5585. create: updateDirectives,
  5586. update: updateDirectives,
  5587. destroy: function unbindDirectives (vnode) {
  5588. updateDirectives(vnode, emptyNode);
  5589. }
  5590. }
  5591. function updateDirectives (oldVnode, vnode) {
  5592. if (oldVnode.data.directives || vnode.data.directives) {
  5593. _update(oldVnode, vnode);
  5594. }
  5595. }
  5596. function _update (oldVnode, vnode) {
  5597. var isCreate = oldVnode === emptyNode;
  5598. var isDestroy = vnode === emptyNode;
  5599. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  5600. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  5601. var dirsWithInsert = [];
  5602. var dirsWithPostpatch = [];
  5603. var key, oldDir, dir;
  5604. for (key in newDirs) {
  5605. oldDir = oldDirs[key];
  5606. dir = newDirs[key];
  5607. if (!oldDir) {
  5608. // new directive, bind
  5609. callHook$1(dir, 'bind', vnode, oldVnode);
  5610. if (dir.def && dir.def.inserted) {
  5611. dirsWithInsert.push(dir);
  5612. }
  5613. } else {
  5614. // existing directive, update
  5615. dir.oldValue = oldDir.value;
  5616. callHook$1(dir, 'update', vnode, oldVnode);
  5617. if (dir.def && dir.def.componentUpdated) {
  5618. dirsWithPostpatch.push(dir);
  5619. }
  5620. }
  5621. }
  5622. if (dirsWithInsert.length) {
  5623. var callInsert = function () {
  5624. for (var i = 0; i < dirsWithInsert.length; i++) {
  5625. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  5626. }
  5627. };
  5628. if (isCreate) {
  5629. mergeVNodeHook(vnode, 'insert', callInsert);
  5630. } else {
  5631. callInsert();
  5632. }
  5633. }
  5634. if (dirsWithPostpatch.length) {
  5635. mergeVNodeHook(vnode, 'postpatch', function () {
  5636. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  5637. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  5638. }
  5639. });
  5640. }
  5641. if (!isCreate) {
  5642. for (key in oldDirs) {
  5643. if (!newDirs[key]) {
  5644. // no longer present, unbind
  5645. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  5646. }
  5647. }
  5648. }
  5649. }
  5650. var emptyModifiers = Object.create(null);
  5651. function normalizeDirectives$1 (
  5652. dirs,
  5653. vm
  5654. ) {
  5655. var res = Object.create(null);
  5656. if (!dirs) {
  5657. // $flow-disable-line
  5658. return res
  5659. }
  5660. var i, dir;
  5661. for (i = 0; i < dirs.length; i++) {
  5662. dir = dirs[i];
  5663. if (!dir.modifiers) {
  5664. // $flow-disable-line
  5665. dir.modifiers = emptyModifiers;
  5666. }
  5667. res[getRawDirName(dir)] = dir;
  5668. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  5669. }
  5670. // $flow-disable-line
  5671. return res
  5672. }
  5673. function getRawDirName (dir) {
  5674. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  5675. }
  5676. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  5677. var fn = dir.def && dir.def[hook];
  5678. if (fn) {
  5679. try {
  5680. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  5681. } catch (e) {
  5682. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  5683. }
  5684. }
  5685. }
  5686. var baseModules = [
  5687. ref,
  5688. directives
  5689. ]
  5690. /* */
  5691. function updateAttrs (oldVnode, vnode) {
  5692. var opts = vnode.componentOptions;
  5693. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  5694. return
  5695. }
  5696. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  5697. return
  5698. }
  5699. var key, cur, old;
  5700. var elm = vnode.elm;
  5701. var oldAttrs = oldVnode.data.attrs || {};
  5702. var attrs = vnode.data.attrs || {};
  5703. // clone observed objects, as the user probably wants to mutate it
  5704. if (isDef(attrs.__ob__)) {
  5705. attrs = vnode.data.attrs = extend({}, attrs);
  5706. }
  5707. for (key in attrs) {
  5708. cur = attrs[key];
  5709. old = oldAttrs[key];
  5710. if (old !== cur) {
  5711. setAttr(elm, key, cur);
  5712. }
  5713. }
  5714. // #4391: in IE9, setting type can reset value for input[type=radio]
  5715. // #6666: IE/Edge forces progress value down to 1 before setting a max
  5716. /* istanbul ignore if */
  5717. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  5718. setAttr(elm, 'value', attrs.value);
  5719. }
  5720. for (key in oldAttrs) {
  5721. if (isUndef(attrs[key])) {
  5722. if (isXlink(key)) {
  5723. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  5724. } else if (!isEnumeratedAttr(key)) {
  5725. elm.removeAttribute(key);
  5726. }
  5727. }
  5728. }
  5729. }
  5730. function setAttr (el, key, value) {
  5731. if (el.tagName.indexOf('-') > -1) {
  5732. baseSetAttr(el, key, value);
  5733. } else if (isBooleanAttr(key)) {
  5734. // set attribute for blank value
  5735. // e.g. <option disabled>Select one</option>
  5736. if (isFalsyAttrValue(value)) {
  5737. el.removeAttribute(key);
  5738. } else {
  5739. // technically allowfullscreen is a boolean attribute for <iframe>,
  5740. // but Flash expects a value of "true" when used on <embed> tag
  5741. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  5742. ? 'true'
  5743. : key;
  5744. el.setAttribute(key, value);
  5745. }
  5746. } else if (isEnumeratedAttr(key)) {
  5747. el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
  5748. } else if (isXlink(key)) {
  5749. if (isFalsyAttrValue(value)) {
  5750. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  5751. } else {
  5752. el.setAttributeNS(xlinkNS, key, value);
  5753. }
  5754. } else {
  5755. baseSetAttr(el, key, value);
  5756. }
  5757. }
  5758. function baseSetAttr (el, key, value) {
  5759. if (isFalsyAttrValue(value)) {
  5760. el.removeAttribute(key);
  5761. } else {
  5762. // #7138: IE10 & 11 fires input event when setting placeholder on
  5763. // <textarea>... block the first input event and remove the blocker
  5764. // immediately.
  5765. /* istanbul ignore if */
  5766. if (
  5767. isIE && !isIE9 &&
  5768. el.tagName === 'TEXTAREA' &&
  5769. key === 'placeholder' && !el.__ieph
  5770. ) {
  5771. var blocker = function (e) {
  5772. e.stopImmediatePropagation();
  5773. el.removeEventListener('input', blocker);
  5774. };
  5775. el.addEventListener('input', blocker);
  5776. // $flow-disable-line
  5777. el.__ieph = true; /* IE placeholder patched */
  5778. }
  5779. el.setAttribute(key, value);
  5780. }
  5781. }
  5782. var attrs = {
  5783. create: updateAttrs,
  5784. update: updateAttrs
  5785. }
  5786. /* */
  5787. function updateClass (oldVnode, vnode) {
  5788. var el = vnode.elm;
  5789. var data = vnode.data;
  5790. var oldData = oldVnode.data;
  5791. if (
  5792. isUndef(data.staticClass) &&
  5793. isUndef(data.class) && (
  5794. isUndef(oldData) || (
  5795. isUndef(oldData.staticClass) &&
  5796. isUndef(oldData.class)
  5797. )
  5798. )
  5799. ) {
  5800. return
  5801. }
  5802. var cls = genClassForVnode(vnode);
  5803. // handle transition classes
  5804. var transitionClass = el._transitionClasses;
  5805. if (isDef(transitionClass)) {
  5806. cls = concat(cls, stringifyClass(transitionClass));
  5807. }
  5808. // set the class
  5809. if (cls !== el._prevClass) {
  5810. el.setAttribute('class', cls);
  5811. el._prevClass = cls;
  5812. }
  5813. }
  5814. var klass = {
  5815. create: updateClass,
  5816. update: updateClass
  5817. }
  5818. /* */
  5819. var validDivisionCharRE = /[\w).+\-_$\]]/;
  5820. function parseFilters (exp) {
  5821. var inSingle = false;
  5822. var inDouble = false;
  5823. var inTemplateString = false;
  5824. var inRegex = false;
  5825. var curly = 0;
  5826. var square = 0;
  5827. var paren = 0;
  5828. var lastFilterIndex = 0;
  5829. var c, prev, i, expression, filters;
  5830. for (i = 0; i < exp.length; i++) {
  5831. prev = c;
  5832. c = exp.charCodeAt(i);
  5833. if (inSingle) {
  5834. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  5835. } else if (inDouble) {
  5836. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  5837. } else if (inTemplateString) {
  5838. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  5839. } else if (inRegex) {
  5840. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  5841. } else if (
  5842. c === 0x7C && // pipe
  5843. exp.charCodeAt(i + 1) !== 0x7C &&
  5844. exp.charCodeAt(i - 1) !== 0x7C &&
  5845. !curly && !square && !paren
  5846. ) {
  5847. if (expression === undefined) {
  5848. // first filter, end of expression
  5849. lastFilterIndex = i + 1;
  5850. expression = exp.slice(0, i).trim();
  5851. } else {
  5852. pushFilter();
  5853. }
  5854. } else {
  5855. switch (c) {
  5856. case 0x22: inDouble = true; break // "
  5857. case 0x27: inSingle = true; break // '
  5858. case 0x60: inTemplateString = true; break // `
  5859. case 0x28: paren++; break // (
  5860. case 0x29: paren--; break // )
  5861. case 0x5B: square++; break // [
  5862. case 0x5D: square--; break // ]
  5863. case 0x7B: curly++; break // {
  5864. case 0x7D: curly--; break // }
  5865. }
  5866. if (c === 0x2f) { // /
  5867. var j = i - 1;
  5868. var p = (void 0);
  5869. // find first non-whitespace prev char
  5870. for (; j >= 0; j--) {
  5871. p = exp.charAt(j);
  5872. if (p !== ' ') { break }
  5873. }
  5874. if (!p || !validDivisionCharRE.test(p)) {
  5875. inRegex = true;
  5876. }
  5877. }
  5878. }
  5879. }
  5880. if (expression === undefined) {
  5881. expression = exp.slice(0, i).trim();
  5882. } else if (lastFilterIndex !== 0) {
  5883. pushFilter();
  5884. }
  5885. function pushFilter () {
  5886. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  5887. lastFilterIndex = i + 1;
  5888. }
  5889. if (filters) {
  5890. for (i = 0; i < filters.length; i++) {
  5891. expression = wrapFilter(expression, filters[i]);
  5892. }
  5893. }
  5894. return expression
  5895. }
  5896. function wrapFilter (exp, filter) {
  5897. var i = filter.indexOf('(');
  5898. if (i < 0) {
  5899. // _f: resolveFilter
  5900. return ("_f(\"" + filter + "\")(" + exp + ")")
  5901. } else {
  5902. var name = filter.slice(0, i);
  5903. var args = filter.slice(i + 1);
  5904. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  5905. }
  5906. }
  5907. /* */
  5908. function baseWarn (msg) {
  5909. console.error(("[Vue compiler]: " + msg));
  5910. }
  5911. function pluckModuleFunction (
  5912. modules,
  5913. key
  5914. ) {
  5915. return modules
  5916. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  5917. : []
  5918. }
  5919. function addProp (el, name, value) {
  5920. (el.props || (el.props = [])).push({ name: name, value: value });
  5921. el.plain = false;
  5922. }
  5923. function addAttr (el, name, value) {
  5924. (el.attrs || (el.attrs = [])).push({ name: name, value: value });
  5925. el.plain = false;
  5926. }
  5927. // add a raw attr (use this in preTransforms)
  5928. function addRawAttr (el, name, value) {
  5929. el.attrsMap[name] = value;
  5930. el.attrsList.push({ name: name, value: value });
  5931. }
  5932. function addDirective (
  5933. el,
  5934. name,
  5935. rawName,
  5936. value,
  5937. arg,
  5938. modifiers
  5939. ) {
  5940. (el.directives || (el.directives = [])).push({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers });
  5941. el.plain = false;
  5942. }
  5943. function addHandler (
  5944. el,
  5945. name,
  5946. value,
  5947. modifiers,
  5948. important,
  5949. warn
  5950. ) {
  5951. modifiers = modifiers || emptyObject;
  5952. // warn prevent and passive modifier
  5953. /* istanbul ignore if */
  5954. if (
  5955. "development" !== 'production' && warn &&
  5956. modifiers.prevent && modifiers.passive
  5957. ) {
  5958. warn(
  5959. 'passive and prevent can\'t be used together. ' +
  5960. 'Passive handler can\'t prevent default event.'
  5961. );
  5962. }
  5963. // check capture modifier
  5964. if (modifiers.capture) {
  5965. delete modifiers.capture;
  5966. name = '!' + name; // mark the event as captured
  5967. }
  5968. if (modifiers.once) {
  5969. delete modifiers.once;
  5970. name = '~' + name; // mark the event as once
  5971. }
  5972. /* istanbul ignore if */
  5973. if (modifiers.passive) {
  5974. delete modifiers.passive;
  5975. name = '&' + name; // mark the event as passive
  5976. }
  5977. // normalize click.right and click.middle since they don't actually fire
  5978. // this is technically browser-specific, but at least for now browsers are
  5979. // the only target envs that have right/middle clicks.
  5980. if (name === 'click') {
  5981. if (modifiers.right) {
  5982. name = 'contextmenu';
  5983. delete modifiers.right;
  5984. } else if (modifiers.middle) {
  5985. name = 'mouseup';
  5986. }
  5987. }
  5988. var events;
  5989. if (modifiers.native) {
  5990. delete modifiers.native;
  5991. events = el.nativeEvents || (el.nativeEvents = {});
  5992. } else {
  5993. events = el.events || (el.events = {});
  5994. }
  5995. var newHandler = {
  5996. value: value.trim()
  5997. };
  5998. if (modifiers !== emptyObject) {
  5999. newHandler.modifiers = modifiers;
  6000. }
  6001. var handlers = events[name];
  6002. /* istanbul ignore if */
  6003. if (Array.isArray(handlers)) {
  6004. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  6005. } else if (handlers) {
  6006. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  6007. } else {
  6008. events[name] = newHandler;
  6009. }
  6010. el.plain = false;
  6011. }
  6012. function getBindingAttr (
  6013. el,
  6014. name,
  6015. getStatic
  6016. ) {
  6017. var dynamicValue =
  6018. getAndRemoveAttr(el, ':' + name) ||
  6019. getAndRemoveAttr(el, 'v-bind:' + name);
  6020. if (dynamicValue != null) {
  6021. return parseFilters(dynamicValue)
  6022. } else if (getStatic !== false) {
  6023. var staticValue = getAndRemoveAttr(el, name);
  6024. if (staticValue != null) {
  6025. return JSON.stringify(staticValue)
  6026. }
  6027. }
  6028. }
  6029. // note: this only removes the attr from the Array (attrsList) so that it
  6030. // doesn't get processed by processAttrs.
  6031. // By default it does NOT remove it from the map (attrsMap) because the map is
  6032. // needed during codegen.
  6033. function getAndRemoveAttr (
  6034. el,
  6035. name,
  6036. removeFromMap
  6037. ) {
  6038. var val;
  6039. if ((val = el.attrsMap[name]) != null) {
  6040. var list = el.attrsList;
  6041. for (var i = 0, l = list.length; i < l; i++) {
  6042. if (list[i].name === name) {
  6043. list.splice(i, 1);
  6044. break
  6045. }
  6046. }
  6047. }
  6048. if (removeFromMap) {
  6049. delete el.attrsMap[name];
  6050. }
  6051. return val
  6052. }
  6053. /* */
  6054. /**
  6055. * Cross-platform code generation for component v-model
  6056. */
  6057. function genComponentModel (
  6058. el,
  6059. value,
  6060. modifiers
  6061. ) {
  6062. var ref = modifiers || {};
  6063. var number = ref.number;
  6064. var trim = ref.trim;
  6065. var baseValueExpression = '$$v';
  6066. var valueExpression = baseValueExpression;
  6067. if (trim) {
  6068. valueExpression =
  6069. "(typeof " + baseValueExpression + " === 'string'" +
  6070. "? " + baseValueExpression + ".trim()" +
  6071. ": " + baseValueExpression + ")";
  6072. }
  6073. if (number) {
  6074. valueExpression = "_n(" + valueExpression + ")";
  6075. }
  6076. var assignment = genAssignmentCode(value, valueExpression);
  6077. el.model = {
  6078. value: ("(" + value + ")"),
  6079. expression: ("\"" + value + "\""),
  6080. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  6081. };
  6082. }
  6083. /**
  6084. * Cross-platform codegen helper for generating v-model value assignment code.
  6085. */
  6086. function genAssignmentCode (
  6087. value,
  6088. assignment
  6089. ) {
  6090. var res = parseModel(value);
  6091. if (res.key === null) {
  6092. return (value + "=" + assignment)
  6093. } else {
  6094. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  6095. }
  6096. }
  6097. /**
  6098. * Parse a v-model expression into a base path and a final key segment.
  6099. * Handles both dot-path and possible square brackets.
  6100. *
  6101. * Possible cases:
  6102. *
  6103. * - test
  6104. * - test[key]
  6105. * - test[test1[key]]
  6106. * - test["a"][key]
  6107. * - xxx.test[a[a].test1[key]]
  6108. * - test.xxx.a["asa"][test1[key]]
  6109. *
  6110. */
  6111. var len;
  6112. var str;
  6113. var chr;
  6114. var index$1;
  6115. var expressionPos;
  6116. var expressionEndPos;
  6117. function parseModel (val) {
  6118. // Fix https://github.com/vuejs/vue/pull/7730
  6119. // allow v-model="obj.val " (trailing whitespace)
  6120. val = val.trim();
  6121. len = val.length;
  6122. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  6123. index$1 = val.lastIndexOf('.');
  6124. if (index$1 > -1) {
  6125. return {
  6126. exp: val.slice(0, index$1),
  6127. key: '"' + val.slice(index$1 + 1) + '"'
  6128. }
  6129. } else {
  6130. return {
  6131. exp: val,
  6132. key: null
  6133. }
  6134. }
  6135. }
  6136. str = val;
  6137. index$1 = expressionPos = expressionEndPos = 0;
  6138. while (!eof()) {
  6139. chr = next();
  6140. /* istanbul ignore if */
  6141. if (isStringStart(chr)) {
  6142. parseString(chr);
  6143. } else if (chr === 0x5B) {
  6144. parseBracket(chr);
  6145. }
  6146. }
  6147. return {
  6148. exp: val.slice(0, expressionPos),
  6149. key: val.slice(expressionPos + 1, expressionEndPos)
  6150. }
  6151. }
  6152. function next () {
  6153. return str.charCodeAt(++index$1)
  6154. }
  6155. function eof () {
  6156. return index$1 >= len
  6157. }
  6158. function isStringStart (chr) {
  6159. return chr === 0x22 || chr === 0x27
  6160. }
  6161. function parseBracket (chr) {
  6162. var inBracket = 1;
  6163. expressionPos = index$1;
  6164. while (!eof()) {
  6165. chr = next();
  6166. if (isStringStart(chr)) {
  6167. parseString(chr);
  6168. continue
  6169. }
  6170. if (chr === 0x5B) { inBracket++; }
  6171. if (chr === 0x5D) { inBracket--; }
  6172. if (inBracket === 0) {
  6173. expressionEndPos = index$1;
  6174. break
  6175. }
  6176. }
  6177. }
  6178. function parseString (chr) {
  6179. var stringQuote = chr;
  6180. while (!eof()) {
  6181. chr = next();
  6182. if (chr === stringQuote) {
  6183. break
  6184. }
  6185. }
  6186. }
  6187. /* */
  6188. var warn$1;
  6189. // in some cases, the event used has to be determined at runtime
  6190. // so we used some reserved tokens during compile.
  6191. var RANGE_TOKEN = '__r';
  6192. var CHECKBOX_RADIO_TOKEN = '__c';
  6193. function model (
  6194. el,
  6195. dir,
  6196. _warn
  6197. ) {
  6198. warn$1 = _warn;
  6199. var value = dir.value;
  6200. var modifiers = dir.modifiers;
  6201. var tag = el.tag;
  6202. var type = el.attrsMap.type;
  6203. {
  6204. // inputs with type="file" are read only and setting the input's
  6205. // value will throw an error.
  6206. if (tag === 'input' && type === 'file') {
  6207. warn$1(
  6208. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  6209. "File inputs are read only. Use a v-on:change listener instead."
  6210. );
  6211. }
  6212. }
  6213. if (el.component) {
  6214. genComponentModel(el, value, modifiers);
  6215. // component v-model doesn't need extra runtime
  6216. return false
  6217. } else if (tag === 'select') {
  6218. genSelect(el, value, modifiers);
  6219. } else if (tag === 'input' && type === 'checkbox') {
  6220. genCheckboxModel(el, value, modifiers);
  6221. } else if (tag === 'input' && type === 'radio') {
  6222. genRadioModel(el, value, modifiers);
  6223. } else if (tag === 'input' || tag === 'textarea') {
  6224. genDefaultModel(el, value, modifiers);
  6225. } else if (!config.isReservedTag(tag)) {
  6226. genComponentModel(el, value, modifiers);
  6227. // component v-model doesn't need extra runtime
  6228. return false
  6229. } else {
  6230. warn$1(
  6231. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  6232. "v-model is not supported on this element type. " +
  6233. 'If you are working with contenteditable, it\'s recommended to ' +
  6234. 'wrap a library dedicated for that purpose inside a custom component.'
  6235. );
  6236. }
  6237. // ensure runtime directive metadata
  6238. return true
  6239. }
  6240. function genCheckboxModel (
  6241. el,
  6242. value,
  6243. modifiers
  6244. ) {
  6245. var number = modifiers && modifiers.number;
  6246. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6247. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  6248. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  6249. addProp(el, 'checked',
  6250. "Array.isArray(" + value + ")" +
  6251. "?_i(" + value + "," + valueBinding + ")>-1" + (
  6252. trueValueBinding === 'true'
  6253. ? (":(" + value + ")")
  6254. : (":_q(" + value + "," + trueValueBinding + ")")
  6255. )
  6256. );
  6257. addHandler(el, 'change',
  6258. "var $$a=" + value + "," +
  6259. '$$el=$event.target,' +
  6260. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  6261. 'if(Array.isArray($$a)){' +
  6262. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  6263. '$$i=_i($$a,$$v);' +
  6264. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  6265. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  6266. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  6267. null, true
  6268. );
  6269. }
  6270. function genRadioModel (
  6271. el,
  6272. value,
  6273. modifiers
  6274. ) {
  6275. var number = modifiers && modifiers.number;
  6276. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6277. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  6278. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  6279. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  6280. }
  6281. function genSelect (
  6282. el,
  6283. value,
  6284. modifiers
  6285. ) {
  6286. var number = modifiers && modifiers.number;
  6287. var selectedVal = "Array.prototype.filter" +
  6288. ".call($event.target.options,function(o){return o.selected})" +
  6289. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  6290. "return " + (number ? '_n(val)' : 'val') + "})";
  6291. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  6292. var code = "var $$selectedVal = " + selectedVal + ";";
  6293. code = code + " " + (genAssignmentCode(value, assignment));
  6294. addHandler(el, 'change', code, null, true);
  6295. }
  6296. function genDefaultModel (
  6297. el,
  6298. value,
  6299. modifiers
  6300. ) {
  6301. var type = el.attrsMap.type;
  6302. // warn if v-bind:value conflicts with v-model
  6303. // except for inputs with v-bind:type
  6304. {
  6305. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  6306. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  6307. if (value$1 && !typeBinding) {
  6308. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  6309. warn$1(
  6310. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  6311. 'because the latter already expands to a value binding internally'
  6312. );
  6313. }
  6314. }
  6315. var ref = modifiers || {};
  6316. var lazy = ref.lazy;
  6317. var number = ref.number;
  6318. var trim = ref.trim;
  6319. var needCompositionGuard = !lazy && type !== 'range';
  6320. var event = lazy
  6321. ? 'change'
  6322. : type === 'range'
  6323. ? RANGE_TOKEN
  6324. : 'input';
  6325. var valueExpression = '$event.target.value';
  6326. if (trim) {
  6327. valueExpression = "$event.target.value.trim()";
  6328. }
  6329. if (number) {
  6330. valueExpression = "_n(" + valueExpression + ")";
  6331. }
  6332. var code = genAssignmentCode(value, valueExpression);
  6333. if (needCompositionGuard) {
  6334. code = "if($event.target.composing)return;" + code;
  6335. }
  6336. addProp(el, 'value', ("(" + value + ")"));
  6337. addHandler(el, event, code, null, true);
  6338. if (trim || number) {
  6339. addHandler(el, 'blur', '$forceUpdate()');
  6340. }
  6341. }
  6342. /* */
  6343. // normalize v-model event tokens that can only be determined at runtime.
  6344. // it's important to place the event as the first in the array because
  6345. // the whole point is ensuring the v-model callback gets called before
  6346. // user-attached handlers.
  6347. function normalizeEvents (on) {
  6348. /* istanbul ignore if */
  6349. if (isDef(on[RANGE_TOKEN])) {
  6350. // IE input[type=range] only supports `change` event
  6351. var event = isIE ? 'change' : 'input';
  6352. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  6353. delete on[RANGE_TOKEN];
  6354. }
  6355. // This was originally intended to fix #4521 but no longer necessary
  6356. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  6357. /* istanbul ignore if */
  6358. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  6359. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  6360. delete on[CHECKBOX_RADIO_TOKEN];
  6361. }
  6362. }
  6363. var target$1;
  6364. function createOnceHandler (handler, event, capture) {
  6365. var _target = target$1; // save current target element in closure
  6366. return function onceHandler () {
  6367. var res = handler.apply(null, arguments);
  6368. if (res !== null) {
  6369. remove$2(event, onceHandler, capture, _target);
  6370. }
  6371. }
  6372. }
  6373. function add$1 (
  6374. event,
  6375. handler,
  6376. once$$1,
  6377. capture,
  6378. passive
  6379. ) {
  6380. handler = withMacroTask(handler);
  6381. if (once$$1) { handler = createOnceHandler(handler, event, capture); }
  6382. target$1.addEventListener(
  6383. event,
  6384. handler,
  6385. supportsPassive
  6386. ? { capture: capture, passive: passive }
  6387. : capture
  6388. );
  6389. }
  6390. function remove$2 (
  6391. event,
  6392. handler,
  6393. capture,
  6394. _target
  6395. ) {
  6396. (_target || target$1).removeEventListener(
  6397. event,
  6398. handler._withTask || handler,
  6399. capture
  6400. );
  6401. }
  6402. function updateDOMListeners (oldVnode, vnode) {
  6403. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  6404. return
  6405. }
  6406. var on = vnode.data.on || {};
  6407. var oldOn = oldVnode.data.on || {};
  6408. target$1 = vnode.elm;
  6409. normalizeEvents(on);
  6410. updateListeners(on, oldOn, add$1, remove$2, vnode.context);
  6411. target$1 = undefined;
  6412. }
  6413. var events = {
  6414. create: updateDOMListeners,
  6415. update: updateDOMListeners
  6416. }
  6417. /* */
  6418. function updateDOMProps (oldVnode, vnode) {
  6419. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  6420. return
  6421. }
  6422. var key, cur;
  6423. var elm = vnode.elm;
  6424. var oldProps = oldVnode.data.domProps || {};
  6425. var props = vnode.data.domProps || {};
  6426. // clone observed objects, as the user probably wants to mutate it
  6427. if (isDef(props.__ob__)) {
  6428. props = vnode.data.domProps = extend({}, props);
  6429. }
  6430. for (key in oldProps) {
  6431. if (isUndef(props[key])) {
  6432. elm[key] = '';
  6433. }
  6434. }
  6435. for (key in props) {
  6436. cur = props[key];
  6437. // ignore children if the node has textContent or innerHTML,
  6438. // as these will throw away existing DOM nodes and cause removal errors
  6439. // on subsequent patches (#3360)
  6440. if (key === 'textContent' || key === 'innerHTML') {
  6441. if (vnode.children) { vnode.children.length = 0; }
  6442. if (cur === oldProps[key]) { continue }
  6443. // #6601 work around Chrome version <= 55 bug where single textNode
  6444. // replaced by innerHTML/textContent retains its parentNode property
  6445. if (elm.childNodes.length === 1) {
  6446. elm.removeChild(elm.childNodes[0]);
  6447. }
  6448. }
  6449. if (key === 'value') {
  6450. // store value as _value as well since
  6451. // non-string values will be stringified
  6452. elm._value = cur;
  6453. // avoid resetting cursor position when value is the same
  6454. var strCur = isUndef(cur) ? '' : String(cur);
  6455. if (shouldUpdateValue(elm, strCur)) {
  6456. elm.value = strCur;
  6457. }
  6458. } else {
  6459. elm[key] = cur;
  6460. }
  6461. }
  6462. }
  6463. // check platforms/web/util/attrs.js acceptValue
  6464. function shouldUpdateValue (elm, checkVal) {
  6465. return (!elm.composing && (
  6466. elm.tagName === 'OPTION' ||
  6467. isNotInFocusAndDirty(elm, checkVal) ||
  6468. isDirtyWithModifiers(elm, checkVal)
  6469. ))
  6470. }
  6471. function isNotInFocusAndDirty (elm, checkVal) {
  6472. // return true when textbox (.number and .trim) loses focus and its value is
  6473. // not equal to the updated value
  6474. var notInFocus = true;
  6475. // #6157
  6476. // work around IE bug when accessing document.activeElement in an iframe
  6477. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  6478. return notInFocus && elm.value !== checkVal
  6479. }
  6480. function isDirtyWithModifiers (elm, newVal) {
  6481. var value = elm.value;
  6482. var modifiers = elm._vModifiers; // injected by v-model runtime
  6483. if (isDef(modifiers)) {
  6484. if (modifiers.lazy) {
  6485. // inputs with lazy should only be updated when not in focus
  6486. return false
  6487. }
  6488. if (modifiers.number) {
  6489. return toNumber(value) !== toNumber(newVal)
  6490. }
  6491. if (modifiers.trim) {
  6492. return value.trim() !== newVal.trim()
  6493. }
  6494. }
  6495. return value !== newVal
  6496. }
  6497. var domProps = {
  6498. create: updateDOMProps,
  6499. update: updateDOMProps
  6500. }
  6501. /* */
  6502. var parseStyleText = cached(function (cssText) {
  6503. var res = {};
  6504. var listDelimiter = /;(?![^(]*\))/g;
  6505. var propertyDelimiter = /:(.+)/;
  6506. cssText.split(listDelimiter).forEach(function (item) {
  6507. if (item) {
  6508. var tmp = item.split(propertyDelimiter);
  6509. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6510. }
  6511. });
  6512. return res
  6513. });
  6514. // merge static and dynamic style data on the same vnode
  6515. function normalizeStyleData (data) {
  6516. var style = normalizeStyleBinding(data.style);
  6517. // static style is pre-processed into an object during compilation
  6518. // and is always a fresh object, so it's safe to merge into it
  6519. return data.staticStyle
  6520. ? extend(data.staticStyle, style)
  6521. : style
  6522. }
  6523. // normalize possible array / string values into Object
  6524. function normalizeStyleBinding (bindingStyle) {
  6525. if (Array.isArray(bindingStyle)) {
  6526. return toObject(bindingStyle)
  6527. }
  6528. if (typeof bindingStyle === 'string') {
  6529. return parseStyleText(bindingStyle)
  6530. }
  6531. return bindingStyle
  6532. }
  6533. /**
  6534. * parent component style should be after child's
  6535. * so that parent component's style could override it
  6536. */
  6537. function getStyle (vnode, checkChild) {
  6538. var res = {};
  6539. var styleData;
  6540. if (checkChild) {
  6541. var childNode = vnode;
  6542. while (childNode.componentInstance) {
  6543. childNode = childNode.componentInstance._vnode;
  6544. if (
  6545. childNode && childNode.data &&
  6546. (styleData = normalizeStyleData(childNode.data))
  6547. ) {
  6548. extend(res, styleData);
  6549. }
  6550. }
  6551. }
  6552. if ((styleData = normalizeStyleData(vnode.data))) {
  6553. extend(res, styleData);
  6554. }
  6555. var parentNode = vnode;
  6556. while ((parentNode = parentNode.parent)) {
  6557. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  6558. extend(res, styleData);
  6559. }
  6560. }
  6561. return res
  6562. }
  6563. /* */
  6564. var cssVarRE = /^--/;
  6565. var importantRE = /\s*!important$/;
  6566. var setProp = function (el, name, val) {
  6567. /* istanbul ignore if */
  6568. if (cssVarRE.test(name)) {
  6569. el.style.setProperty(name, val);
  6570. } else if (importantRE.test(val)) {
  6571. el.style.setProperty(name, val.replace(importantRE, ''), 'important');
  6572. } else {
  6573. var normalizedName = normalize(name);
  6574. if (Array.isArray(val)) {
  6575. // Support values array created by autoprefixer, e.g.
  6576. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  6577. // Set them one by one, and the browser will only set those it can recognize
  6578. for (var i = 0, len = val.length; i < len; i++) {
  6579. el.style[normalizedName] = val[i];
  6580. }
  6581. } else {
  6582. el.style[normalizedName] = val;
  6583. }
  6584. }
  6585. };
  6586. var vendorNames = ['Webkit', 'Moz', 'ms'];
  6587. var emptyStyle;
  6588. var normalize = cached(function (prop) {
  6589. emptyStyle = emptyStyle || document.createElement('div').style;
  6590. prop = camelize(prop);
  6591. if (prop !== 'filter' && (prop in emptyStyle)) {
  6592. return prop
  6593. }
  6594. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  6595. for (var i = 0; i < vendorNames.length; i++) {
  6596. var name = vendorNames[i] + capName;
  6597. if (name in emptyStyle) {
  6598. return name
  6599. }
  6600. }
  6601. });
  6602. function updateStyle (oldVnode, vnode) {
  6603. var data = vnode.data;
  6604. var oldData = oldVnode.data;
  6605. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  6606. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  6607. ) {
  6608. return
  6609. }
  6610. var cur, name;
  6611. var el = vnode.elm;
  6612. var oldStaticStyle = oldData.staticStyle;
  6613. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  6614. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  6615. var oldStyle = oldStaticStyle || oldStyleBinding;
  6616. var style = normalizeStyleBinding(vnode.data.style) || {};
  6617. // store normalized style under a different key for next diff
  6618. // make sure to clone it if it's reactive, since the user likely wants
  6619. // to mutate it.
  6620. vnode.data.normalizedStyle = isDef(style.__ob__)
  6621. ? extend({}, style)
  6622. : style;
  6623. var newStyle = getStyle(vnode, true);
  6624. for (name in oldStyle) {
  6625. if (isUndef(newStyle[name])) {
  6626. setProp(el, name, '');
  6627. }
  6628. }
  6629. for (name in newStyle) {
  6630. cur = newStyle[name];
  6631. if (cur !== oldStyle[name]) {
  6632. // ie9 setting to null has no effect, must use empty string
  6633. setProp(el, name, cur == null ? '' : cur);
  6634. }
  6635. }
  6636. }
  6637. var style = {
  6638. create: updateStyle,
  6639. update: updateStyle
  6640. }
  6641. /* */
  6642. /**
  6643. * Add class with compatibility for SVG since classList is not supported on
  6644. * SVG elements in IE
  6645. */
  6646. function addClass (el, cls) {
  6647. /* istanbul ignore if */
  6648. if (!cls || !(cls = cls.trim())) {
  6649. return
  6650. }
  6651. /* istanbul ignore else */
  6652. if (el.classList) {
  6653. if (cls.indexOf(' ') > -1) {
  6654. cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
  6655. } else {
  6656. el.classList.add(cls);
  6657. }
  6658. } else {
  6659. var cur = " " + (el.getAttribute('class') || '') + " ";
  6660. if (cur.indexOf(' ' + cls + ' ') < 0) {
  6661. el.setAttribute('class', (cur + cls).trim());
  6662. }
  6663. }
  6664. }
  6665. /**
  6666. * Remove class with compatibility for SVG since classList is not supported on
  6667. * SVG elements in IE
  6668. */
  6669. function removeClass (el, cls) {
  6670. /* istanbul ignore if */
  6671. if (!cls || !(cls = cls.trim())) {
  6672. return
  6673. }
  6674. /* istanbul ignore else */
  6675. if (el.classList) {
  6676. if (cls.indexOf(' ') > -1) {
  6677. cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
  6678. } else {
  6679. el.classList.remove(cls);
  6680. }
  6681. if (!el.classList.length) {
  6682. el.removeAttribute('class');
  6683. }
  6684. } else {
  6685. var cur = " " + (el.getAttribute('class') || '') + " ";
  6686. var tar = ' ' + cls + ' ';
  6687. while (cur.indexOf(tar) >= 0) {
  6688. cur = cur.replace(tar, ' ');
  6689. }
  6690. cur = cur.trim();
  6691. if (cur) {
  6692. el.setAttribute('class', cur);
  6693. } else {
  6694. el.removeAttribute('class');
  6695. }
  6696. }
  6697. }
  6698. /* */
  6699. function resolveTransition (def) {
  6700. if (!def) {
  6701. return
  6702. }
  6703. /* istanbul ignore else */
  6704. if (typeof def === 'object') {
  6705. var res = {};
  6706. if (def.css !== false) {
  6707. extend(res, autoCssTransition(def.name || 'v'));
  6708. }
  6709. extend(res, def);
  6710. return res
  6711. } else if (typeof def === 'string') {
  6712. return autoCssTransition(def)
  6713. }
  6714. }
  6715. var autoCssTransition = cached(function (name) {
  6716. return {
  6717. enterClass: (name + "-enter"),
  6718. enterToClass: (name + "-enter-to"),
  6719. enterActiveClass: (name + "-enter-active"),
  6720. leaveClass: (name + "-leave"),
  6721. leaveToClass: (name + "-leave-to"),
  6722. leaveActiveClass: (name + "-leave-active")
  6723. }
  6724. });
  6725. var hasTransition = inBrowser && !isIE9;
  6726. var TRANSITION = 'transition';
  6727. var ANIMATION = 'animation';
  6728. // Transition property/event sniffing
  6729. var transitionProp = 'transition';
  6730. var transitionEndEvent = 'transitionend';
  6731. var animationProp = 'animation';
  6732. var animationEndEvent = 'animationend';
  6733. if (hasTransition) {
  6734. /* istanbul ignore if */
  6735. if (window.ontransitionend === undefined &&
  6736. window.onwebkittransitionend !== undefined
  6737. ) {
  6738. transitionProp = 'WebkitTransition';
  6739. transitionEndEvent = 'webkitTransitionEnd';
  6740. }
  6741. if (window.onanimationend === undefined &&
  6742. window.onwebkitanimationend !== undefined
  6743. ) {
  6744. animationProp = 'WebkitAnimation';
  6745. animationEndEvent = 'webkitAnimationEnd';
  6746. }
  6747. }
  6748. // binding to window is necessary to make hot reload work in IE in strict mode
  6749. var raf = inBrowser
  6750. ? window.requestAnimationFrame
  6751. ? window.requestAnimationFrame.bind(window)
  6752. : setTimeout
  6753. : /* istanbul ignore next */ function (fn) { return fn(); };
  6754. function nextFrame (fn) {
  6755. raf(function () {
  6756. raf(fn);
  6757. });
  6758. }
  6759. function addTransitionClass (el, cls) {
  6760. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  6761. if (transitionClasses.indexOf(cls) < 0) {
  6762. transitionClasses.push(cls);
  6763. addClass(el, cls);
  6764. }
  6765. }
  6766. function removeTransitionClass (el, cls) {
  6767. if (el._transitionClasses) {
  6768. remove(el._transitionClasses, cls);
  6769. }
  6770. removeClass(el, cls);
  6771. }
  6772. function whenTransitionEnds (
  6773. el,
  6774. expectedType,
  6775. cb
  6776. ) {
  6777. var ref = getTransitionInfo(el, expectedType);
  6778. var type = ref.type;
  6779. var timeout = ref.timeout;
  6780. var propCount = ref.propCount;
  6781. if (!type) { return cb() }
  6782. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  6783. var ended = 0;
  6784. var end = function () {
  6785. el.removeEventListener(event, onEnd);
  6786. cb();
  6787. };
  6788. var onEnd = function (e) {
  6789. if (e.target === el) {
  6790. if (++ended >= propCount) {
  6791. end();
  6792. }
  6793. }
  6794. };
  6795. setTimeout(function () {
  6796. if (ended < propCount) {
  6797. end();
  6798. }
  6799. }, timeout + 1);
  6800. el.addEventListener(event, onEnd);
  6801. }
  6802. var transformRE = /\b(transform|all)(,|$)/;
  6803. function getTransitionInfo (el, expectedType) {
  6804. var styles = window.getComputedStyle(el);
  6805. var transitionDelays = styles[transitionProp + 'Delay'].split(', ');
  6806. var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
  6807. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  6808. var animationDelays = styles[animationProp + 'Delay'].split(', ');
  6809. var animationDurations = styles[animationProp + 'Duration'].split(', ');
  6810. var animationTimeout = getTimeout(animationDelays, animationDurations);
  6811. var type;
  6812. var timeout = 0;
  6813. var propCount = 0;
  6814. /* istanbul ignore if */
  6815. if (expectedType === TRANSITION) {
  6816. if (transitionTimeout > 0) {
  6817. type = TRANSITION;
  6818. timeout = transitionTimeout;
  6819. propCount = transitionDurations.length;
  6820. }
  6821. } else if (expectedType === ANIMATION) {
  6822. if (animationTimeout > 0) {
  6823. type = ANIMATION;
  6824. timeout = animationTimeout;
  6825. propCount = animationDurations.length;
  6826. }
  6827. } else {
  6828. timeout = Math.max(transitionTimeout, animationTimeout);
  6829. type = timeout > 0
  6830. ? transitionTimeout > animationTimeout
  6831. ? TRANSITION
  6832. : ANIMATION
  6833. : null;
  6834. propCount = type
  6835. ? type === TRANSITION
  6836. ? transitionDurations.length
  6837. : animationDurations.length
  6838. : 0;
  6839. }
  6840. var hasTransform =
  6841. type === TRANSITION &&
  6842. transformRE.test(styles[transitionProp + 'Property']);
  6843. return {
  6844. type: type,
  6845. timeout: timeout,
  6846. propCount: propCount,
  6847. hasTransform: hasTransform
  6848. }
  6849. }
  6850. function getTimeout (delays, durations) {
  6851. /* istanbul ignore next */
  6852. while (delays.length < durations.length) {
  6853. delays = delays.concat(delays);
  6854. }
  6855. return Math.max.apply(null, durations.map(function (d, i) {
  6856. return toMs(d) + toMs(delays[i])
  6857. }))
  6858. }
  6859. function toMs (s) {
  6860. return Number(s.slice(0, -1)) * 1000
  6861. }
  6862. /* */
  6863. function enter (vnode, toggleDisplay) {
  6864. var el = vnode.elm;
  6865. // call leave callback now
  6866. if (isDef(el._leaveCb)) {
  6867. el._leaveCb.cancelled = true;
  6868. el._leaveCb();
  6869. }
  6870. var data = resolveTransition(vnode.data.transition);
  6871. if (isUndef(data)) {
  6872. return
  6873. }
  6874. /* istanbul ignore if */
  6875. if (isDef(el._enterCb) || el.nodeType !== 1) {
  6876. return
  6877. }
  6878. var css = data.css;
  6879. var type = data.type;
  6880. var enterClass = data.enterClass;
  6881. var enterToClass = data.enterToClass;
  6882. var enterActiveClass = data.enterActiveClass;
  6883. var appearClass = data.appearClass;
  6884. var appearToClass = data.appearToClass;
  6885. var appearActiveClass = data.appearActiveClass;
  6886. var beforeEnter = data.beforeEnter;
  6887. var enter = data.enter;
  6888. var afterEnter = data.afterEnter;
  6889. var enterCancelled = data.enterCancelled;
  6890. var beforeAppear = data.beforeAppear;
  6891. var appear = data.appear;
  6892. var afterAppear = data.afterAppear;
  6893. var appearCancelled = data.appearCancelled;
  6894. var duration = data.duration;
  6895. // activeInstance will always be the <transition> component managing this
  6896. // transition. One edge case to check is when the <transition> is placed
  6897. // as the root node of a child component. In that case we need to check
  6898. // <transition>'s parent for appear check.
  6899. var context = activeInstance;
  6900. var transitionNode = activeInstance.$vnode;
  6901. while (transitionNode && transitionNode.parent) {
  6902. transitionNode = transitionNode.parent;
  6903. context = transitionNode.context;
  6904. }
  6905. var isAppear = !context._isMounted || !vnode.isRootInsert;
  6906. if (isAppear && !appear && appear !== '') {
  6907. return
  6908. }
  6909. var startClass = isAppear && appearClass
  6910. ? appearClass
  6911. : enterClass;
  6912. var activeClass = isAppear && appearActiveClass
  6913. ? appearActiveClass
  6914. : enterActiveClass;
  6915. var toClass = isAppear && appearToClass
  6916. ? appearToClass
  6917. : enterToClass;
  6918. var beforeEnterHook = isAppear
  6919. ? (beforeAppear || beforeEnter)
  6920. : beforeEnter;
  6921. var enterHook = isAppear
  6922. ? (typeof appear === 'function' ? appear : enter)
  6923. : enter;
  6924. var afterEnterHook = isAppear
  6925. ? (afterAppear || afterEnter)
  6926. : afterEnter;
  6927. var enterCancelledHook = isAppear
  6928. ? (appearCancelled || enterCancelled)
  6929. : enterCancelled;
  6930. var explicitEnterDuration = toNumber(
  6931. isObject(duration)
  6932. ? duration.enter
  6933. : duration
  6934. );
  6935. if ("development" !== 'production' && explicitEnterDuration != null) {
  6936. checkDuration(explicitEnterDuration, 'enter', vnode);
  6937. }
  6938. var expectsCSS = css !== false && !isIE9;
  6939. var userWantsControl = getHookArgumentsLength(enterHook);
  6940. var cb = el._enterCb = once(function () {
  6941. if (expectsCSS) {
  6942. removeTransitionClass(el, toClass);
  6943. removeTransitionClass(el, activeClass);
  6944. }
  6945. if (cb.cancelled) {
  6946. if (expectsCSS) {
  6947. removeTransitionClass(el, startClass);
  6948. }
  6949. enterCancelledHook && enterCancelledHook(el);
  6950. } else {
  6951. afterEnterHook && afterEnterHook(el);
  6952. }
  6953. el._enterCb = null;
  6954. });
  6955. if (!vnode.data.show) {
  6956. // remove pending leave element on enter by injecting an insert hook
  6957. mergeVNodeHook(vnode, 'insert', function () {
  6958. var parent = el.parentNode;
  6959. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  6960. if (pendingNode &&
  6961. pendingNode.tag === vnode.tag &&
  6962. pendingNode.elm._leaveCb
  6963. ) {
  6964. pendingNode.elm._leaveCb();
  6965. }
  6966. enterHook && enterHook(el, cb);
  6967. });
  6968. }
  6969. // start enter transition
  6970. beforeEnterHook && beforeEnterHook(el);
  6971. if (expectsCSS) {
  6972. addTransitionClass(el, startClass);
  6973. addTransitionClass(el, activeClass);
  6974. nextFrame(function () {
  6975. removeTransitionClass(el, startClass);
  6976. if (!cb.cancelled) {
  6977. addTransitionClass(el, toClass);
  6978. if (!userWantsControl) {
  6979. if (isValidDuration(explicitEnterDuration)) {
  6980. setTimeout(cb, explicitEnterDuration);
  6981. } else {
  6982. whenTransitionEnds(el, type, cb);
  6983. }
  6984. }
  6985. }
  6986. });
  6987. }
  6988. if (vnode.data.show) {
  6989. toggleDisplay && toggleDisplay();
  6990. enterHook && enterHook(el, cb);
  6991. }
  6992. if (!expectsCSS && !userWantsControl) {
  6993. cb();
  6994. }
  6995. }
  6996. function leave (vnode, rm) {
  6997. var el = vnode.elm;
  6998. // call enter callback now
  6999. if (isDef(el._enterCb)) {
  7000. el._enterCb.cancelled = true;
  7001. el._enterCb();
  7002. }
  7003. var data = resolveTransition(vnode.data.transition);
  7004. if (isUndef(data) || el.nodeType !== 1) {
  7005. return rm()
  7006. }
  7007. /* istanbul ignore if */
  7008. if (isDef(el._leaveCb)) {
  7009. return
  7010. }
  7011. var css = data.css;
  7012. var type = data.type;
  7013. var leaveClass = data.leaveClass;
  7014. var leaveToClass = data.leaveToClass;
  7015. var leaveActiveClass = data.leaveActiveClass;
  7016. var beforeLeave = data.beforeLeave;
  7017. var leave = data.leave;
  7018. var afterLeave = data.afterLeave;
  7019. var leaveCancelled = data.leaveCancelled;
  7020. var delayLeave = data.delayLeave;
  7021. var duration = data.duration;
  7022. var expectsCSS = css !== false && !isIE9;
  7023. var userWantsControl = getHookArgumentsLength(leave);
  7024. var explicitLeaveDuration = toNumber(
  7025. isObject(duration)
  7026. ? duration.leave
  7027. : duration
  7028. );
  7029. if ("development" !== 'production' && isDef(explicitLeaveDuration)) {
  7030. checkDuration(explicitLeaveDuration, 'leave', vnode);
  7031. }
  7032. var cb = el._leaveCb = once(function () {
  7033. if (el.parentNode && el.parentNode._pending) {
  7034. el.parentNode._pending[vnode.key] = null;
  7035. }
  7036. if (expectsCSS) {
  7037. removeTransitionClass(el, leaveToClass);
  7038. removeTransitionClass(el, leaveActiveClass);
  7039. }
  7040. if (cb.cancelled) {
  7041. if (expectsCSS) {
  7042. removeTransitionClass(el, leaveClass);
  7043. }
  7044. leaveCancelled && leaveCancelled(el);
  7045. } else {
  7046. rm();
  7047. afterLeave && afterLeave(el);
  7048. }
  7049. el._leaveCb = null;
  7050. });
  7051. if (delayLeave) {
  7052. delayLeave(performLeave);
  7053. } else {
  7054. performLeave();
  7055. }
  7056. function performLeave () {
  7057. // the delayed leave may have already been cancelled
  7058. if (cb.cancelled) {
  7059. return
  7060. }
  7061. // record leaving element
  7062. if (!vnode.data.show) {
  7063. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  7064. }
  7065. beforeLeave && beforeLeave(el);
  7066. if (expectsCSS) {
  7067. addTransitionClass(el, leaveClass);
  7068. addTransitionClass(el, leaveActiveClass);
  7069. nextFrame(function () {
  7070. removeTransitionClass(el, leaveClass);
  7071. if (!cb.cancelled) {
  7072. addTransitionClass(el, leaveToClass);
  7073. if (!userWantsControl) {
  7074. if (isValidDuration(explicitLeaveDuration)) {
  7075. setTimeout(cb, explicitLeaveDuration);
  7076. } else {
  7077. whenTransitionEnds(el, type, cb);
  7078. }
  7079. }
  7080. }
  7081. });
  7082. }
  7083. leave && leave(el, cb);
  7084. if (!expectsCSS && !userWantsControl) {
  7085. cb();
  7086. }
  7087. }
  7088. }
  7089. // only used in dev mode
  7090. function checkDuration (val, name, vnode) {
  7091. if (typeof val !== 'number') {
  7092. warn(
  7093. "<transition> explicit " + name + " duration is not a valid number - " +
  7094. "got " + (JSON.stringify(val)) + ".",
  7095. vnode.context
  7096. );
  7097. } else if (isNaN(val)) {
  7098. warn(
  7099. "<transition> explicit " + name + " duration is NaN - " +
  7100. 'the duration expression might be incorrect.',
  7101. vnode.context
  7102. );
  7103. }
  7104. }
  7105. function isValidDuration (val) {
  7106. return typeof val === 'number' && !isNaN(val)
  7107. }
  7108. /**
  7109. * Normalize a transition hook's argument length. The hook may be:
  7110. * - a merged hook (invoker) with the original in .fns
  7111. * - a wrapped component method (check ._length)
  7112. * - a plain function (.length)
  7113. */
  7114. function getHookArgumentsLength (fn) {
  7115. if (isUndef(fn)) {
  7116. return false
  7117. }
  7118. var invokerFns = fn.fns;
  7119. if (isDef(invokerFns)) {
  7120. // invoker
  7121. return getHookArgumentsLength(
  7122. Array.isArray(invokerFns)
  7123. ? invokerFns[0]
  7124. : invokerFns
  7125. )
  7126. } else {
  7127. return (fn._length || fn.length) > 1
  7128. }
  7129. }
  7130. function _enter (_, vnode) {
  7131. if (vnode.data.show !== true) {
  7132. enter(vnode);
  7133. }
  7134. }
  7135. var transition = inBrowser ? {
  7136. create: _enter,
  7137. activate: _enter,
  7138. remove: function remove$$1 (vnode, rm) {
  7139. /* istanbul ignore else */
  7140. if (vnode.data.show !== true) {
  7141. leave(vnode, rm);
  7142. } else {
  7143. rm();
  7144. }
  7145. }
  7146. } : {}
  7147. var platformModules = [
  7148. attrs,
  7149. klass,
  7150. events,
  7151. domProps,
  7152. style,
  7153. transition
  7154. ]
  7155. /* */
  7156. // the directive module should be applied last, after all
  7157. // built-in modules have been applied.
  7158. var modules = platformModules.concat(baseModules);
  7159. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  7160. /**
  7161. * Not type checking this file because flow doesn't like attaching
  7162. * properties to Elements.
  7163. */
  7164. /* istanbul ignore if */
  7165. if (isIE9) {
  7166. // http://www.matts411.com/post/internet-explorer-9-oninput/
  7167. document.addEventListener('selectionchange', function () {
  7168. var el = document.activeElement;
  7169. if (el && el.vmodel) {
  7170. trigger(el, 'input');
  7171. }
  7172. });
  7173. }
  7174. var directive = {
  7175. inserted: function inserted (el, binding, vnode, oldVnode) {
  7176. if (vnode.tag === 'select') {
  7177. // #6903
  7178. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  7179. mergeVNodeHook(vnode, 'postpatch', function () {
  7180. directive.componentUpdated(el, binding, vnode);
  7181. });
  7182. } else {
  7183. setSelected(el, binding, vnode.context);
  7184. }
  7185. el._vOptions = [].map.call(el.options, getValue);
  7186. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  7187. el._vModifiers = binding.modifiers;
  7188. if (!binding.modifiers.lazy) {
  7189. el.addEventListener('compositionstart', onCompositionStart);
  7190. el.addEventListener('compositionend', onCompositionEnd);
  7191. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  7192. // switching focus before confirming composition choice
  7193. // this also fixes the issue where some browsers e.g. iOS Chrome
  7194. // fires "change" instead of "input" on autocomplete.
  7195. el.addEventListener('change', onCompositionEnd);
  7196. /* istanbul ignore if */
  7197. if (isIE9) {
  7198. el.vmodel = true;
  7199. }
  7200. }
  7201. }
  7202. },
  7203. componentUpdated: function componentUpdated (el, binding, vnode) {
  7204. if (vnode.tag === 'select') {
  7205. setSelected(el, binding, vnode.context);
  7206. // in case the options rendered by v-for have changed,
  7207. // it's possible that the value is out-of-sync with the rendered options.
  7208. // detect such cases and filter out values that no longer has a matching
  7209. // option in the DOM.
  7210. var prevOptions = el._vOptions;
  7211. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  7212. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  7213. // trigger change event if
  7214. // no matching option found for at least one value
  7215. var needReset = el.multiple
  7216. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  7217. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  7218. if (needReset) {
  7219. trigger(el, 'change');
  7220. }
  7221. }
  7222. }
  7223. }
  7224. };
  7225. function setSelected (el, binding, vm) {
  7226. actuallySetSelected(el, binding, vm);
  7227. /* istanbul ignore if */
  7228. if (isIE || isEdge) {
  7229. setTimeout(function () {
  7230. actuallySetSelected(el, binding, vm);
  7231. }, 0);
  7232. }
  7233. }
  7234. function actuallySetSelected (el, binding, vm) {
  7235. var value = binding.value;
  7236. var isMultiple = el.multiple;
  7237. if (isMultiple && !Array.isArray(value)) {
  7238. "development" !== 'production' && warn(
  7239. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  7240. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  7241. vm
  7242. );
  7243. return
  7244. }
  7245. var selected, option;
  7246. for (var i = 0, l = el.options.length; i < l; i++) {
  7247. option = el.options[i];
  7248. if (isMultiple) {
  7249. selected = looseIndexOf(value, getValue(option)) > -1;
  7250. if (option.selected !== selected) {
  7251. option.selected = selected;
  7252. }
  7253. } else {
  7254. if (looseEqual(getValue(option), value)) {
  7255. if (el.selectedIndex !== i) {
  7256. el.selectedIndex = i;
  7257. }
  7258. return
  7259. }
  7260. }
  7261. }
  7262. if (!isMultiple) {
  7263. el.selectedIndex = -1;
  7264. }
  7265. }
  7266. function hasNoMatchingOption (value, options) {
  7267. return options.every(function (o) { return !looseEqual(o, value); })
  7268. }
  7269. function getValue (option) {
  7270. return '_value' in option
  7271. ? option._value
  7272. : option.value
  7273. }
  7274. function onCompositionStart (e) {
  7275. e.target.composing = true;
  7276. }
  7277. function onCompositionEnd (e) {
  7278. // prevent triggering an input event for no reason
  7279. if (!e.target.composing) { return }
  7280. e.target.composing = false;
  7281. trigger(e.target, 'input');
  7282. }
  7283. function trigger (el, type) {
  7284. var e = document.createEvent('HTMLEvents');
  7285. e.initEvent(type, true, true);
  7286. el.dispatchEvent(e);
  7287. }
  7288. /* */
  7289. // recursively search for possible transition defined inside the component root
  7290. function locateNode (vnode) {
  7291. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  7292. ? locateNode(vnode.componentInstance._vnode)
  7293. : vnode
  7294. }
  7295. var show = {
  7296. bind: function bind (el, ref, vnode) {
  7297. var value = ref.value;
  7298. vnode = locateNode(vnode);
  7299. var transition$$1 = vnode.data && vnode.data.transition;
  7300. var originalDisplay = el.__vOriginalDisplay =
  7301. el.style.display === 'none' ? '' : el.style.display;
  7302. if (value && transition$$1) {
  7303. vnode.data.show = true;
  7304. enter(vnode, function () {
  7305. el.style.display = originalDisplay;
  7306. });
  7307. } else {
  7308. el.style.display = value ? originalDisplay : 'none';
  7309. }
  7310. },
  7311. update: function update (el, ref, vnode) {
  7312. var value = ref.value;
  7313. var oldValue = ref.oldValue;
  7314. /* istanbul ignore if */
  7315. if (!value === !oldValue) { return }
  7316. vnode = locateNode(vnode);
  7317. var transition$$1 = vnode.data && vnode.data.transition;
  7318. if (transition$$1) {
  7319. vnode.data.show = true;
  7320. if (value) {
  7321. enter(vnode, function () {
  7322. el.style.display = el.__vOriginalDisplay;
  7323. });
  7324. } else {
  7325. leave(vnode, function () {
  7326. el.style.display = 'none';
  7327. });
  7328. }
  7329. } else {
  7330. el.style.display = value ? el.__vOriginalDisplay : 'none';
  7331. }
  7332. },
  7333. unbind: function unbind (
  7334. el,
  7335. binding,
  7336. vnode,
  7337. oldVnode,
  7338. isDestroy
  7339. ) {
  7340. if (!isDestroy) {
  7341. el.style.display = el.__vOriginalDisplay;
  7342. }
  7343. }
  7344. }
  7345. var platformDirectives = {
  7346. model: directive,
  7347. show: show
  7348. }
  7349. /* */
  7350. // Provides transition support for a single element/component.
  7351. // supports transition mode (out-in / in-out)
  7352. var transitionProps = {
  7353. name: String,
  7354. appear: Boolean,
  7355. css: Boolean,
  7356. mode: String,
  7357. type: String,
  7358. enterClass: String,
  7359. leaveClass: String,
  7360. enterToClass: String,
  7361. leaveToClass: String,
  7362. enterActiveClass: String,
  7363. leaveActiveClass: String,
  7364. appearClass: String,
  7365. appearActiveClass: String,
  7366. appearToClass: String,
  7367. duration: [Number, String, Object]
  7368. };
  7369. // in case the child is also an abstract component, e.g. <keep-alive>
  7370. // we want to recursively retrieve the real component to be rendered
  7371. function getRealChild (vnode) {
  7372. var compOptions = vnode && vnode.componentOptions;
  7373. if (compOptions && compOptions.Ctor.options.abstract) {
  7374. return getRealChild(getFirstComponentChild(compOptions.children))
  7375. } else {
  7376. return vnode
  7377. }
  7378. }
  7379. function extractTransitionData (comp) {
  7380. var data = {};
  7381. var options = comp.$options;
  7382. // props
  7383. for (var key in options.propsData) {
  7384. data[key] = comp[key];
  7385. }
  7386. // events.
  7387. // extract listeners and pass them directly to the transition methods
  7388. var listeners = options._parentListeners;
  7389. for (var key$1 in listeners) {
  7390. data[camelize(key$1)] = listeners[key$1];
  7391. }
  7392. return data
  7393. }
  7394. function placeholder (h, rawChild) {
  7395. if (/\d-keep-alive$/.test(rawChild.tag)) {
  7396. return h('keep-alive', {
  7397. props: rawChild.componentOptions.propsData
  7398. })
  7399. }
  7400. }
  7401. function hasParentTransition (vnode) {
  7402. while ((vnode = vnode.parent)) {
  7403. if (vnode.data.transition) {
  7404. return true
  7405. }
  7406. }
  7407. }
  7408. function isSameChild (child, oldChild) {
  7409. return oldChild.key === child.key && oldChild.tag === child.tag
  7410. }
  7411. var Transition = {
  7412. name: 'transition',
  7413. props: transitionProps,
  7414. abstract: true,
  7415. render: function render (h) {
  7416. var this$1 = this;
  7417. var children = this.$slots.default;
  7418. if (!children) {
  7419. return
  7420. }
  7421. // filter out text nodes (possible whitespaces)
  7422. children = children.filter(function (c) { return c.tag || isAsyncPlaceholder(c); });
  7423. /* istanbul ignore if */
  7424. if (!children.length) {
  7425. return
  7426. }
  7427. // warn multiple elements
  7428. if ("development" !== 'production' && children.length > 1) {
  7429. warn(
  7430. '<transition> can only be used on a single element. Use ' +
  7431. '<transition-group> for lists.',
  7432. this.$parent
  7433. );
  7434. }
  7435. var mode = this.mode;
  7436. // warn invalid mode
  7437. if ("development" !== 'production' &&
  7438. mode && mode !== 'in-out' && mode !== 'out-in'
  7439. ) {
  7440. warn(
  7441. 'invalid <transition> mode: ' + mode,
  7442. this.$parent
  7443. );
  7444. }
  7445. var rawChild = children[0];
  7446. // if this is a component root node and the component's
  7447. // parent container node also has transition, skip.
  7448. if (hasParentTransition(this.$vnode)) {
  7449. return rawChild
  7450. }
  7451. // apply transition data to child
  7452. // use getRealChild() to ignore abstract components e.g. keep-alive
  7453. var child = getRealChild(rawChild);
  7454. /* istanbul ignore if */
  7455. if (!child) {
  7456. return rawChild
  7457. }
  7458. if (this._leaving) {
  7459. return placeholder(h, rawChild)
  7460. }
  7461. // ensure a key that is unique to the vnode type and to this transition
  7462. // component instance. This key will be used to remove pending leaving nodes
  7463. // during entering.
  7464. var id = "__transition-" + (this._uid) + "-";
  7465. child.key = child.key == null
  7466. ? child.isComment
  7467. ? id + 'comment'
  7468. : id + child.tag
  7469. : isPrimitive(child.key)
  7470. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  7471. : child.key;
  7472. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  7473. var oldRawChild = this._vnode;
  7474. var oldChild = getRealChild(oldRawChild);
  7475. // mark v-show
  7476. // so that the transition module can hand over the control to the directive
  7477. if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
  7478. child.data.show = true;
  7479. }
  7480. if (
  7481. oldChild &&
  7482. oldChild.data &&
  7483. !isSameChild(child, oldChild) &&
  7484. !isAsyncPlaceholder(oldChild) &&
  7485. // #6687 component root is a comment node
  7486. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  7487. ) {
  7488. // replace old child transition data with fresh one
  7489. // important for dynamic transitions!
  7490. var oldData = oldChild.data.transition = extend({}, data);
  7491. // handle transition mode
  7492. if (mode === 'out-in') {
  7493. // return placeholder node and queue update when leave finishes
  7494. this._leaving = true;
  7495. mergeVNodeHook(oldData, 'afterLeave', function () {
  7496. this$1._leaving = false;
  7497. this$1.$forceUpdate();
  7498. });
  7499. return placeholder(h, rawChild)
  7500. } else if (mode === 'in-out') {
  7501. if (isAsyncPlaceholder(child)) {
  7502. return oldRawChild
  7503. }
  7504. var delayedLeave;
  7505. var performLeave = function () { delayedLeave(); };
  7506. mergeVNodeHook(data, 'afterEnter', performLeave);
  7507. mergeVNodeHook(data, 'enterCancelled', performLeave);
  7508. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  7509. }
  7510. }
  7511. return rawChild
  7512. }
  7513. }
  7514. /* */
  7515. // Provides transition support for list items.
  7516. // supports move transitions using the FLIP technique.
  7517. // Because the vdom's children update algorithm is "unstable" - i.e.
  7518. // it doesn't guarantee the relative positioning of removed elements,
  7519. // we force transition-group to update its children into two passes:
  7520. // in the first pass, we remove all nodes that need to be removed,
  7521. // triggering their leaving transition; in the second pass, we insert/move
  7522. // into the final desired state. This way in the second pass removed
  7523. // nodes will remain where they should be.
  7524. var props = extend({
  7525. tag: String,
  7526. moveClass: String
  7527. }, transitionProps);
  7528. delete props.mode;
  7529. var TransitionGroup = {
  7530. props: props,
  7531. render: function render (h) {
  7532. var tag = this.tag || this.$vnode.data.tag || 'span';
  7533. var map = Object.create(null);
  7534. var prevChildren = this.prevChildren = this.children;
  7535. var rawChildren = this.$slots.default || [];
  7536. var children = this.children = [];
  7537. var transitionData = extractTransitionData(this);
  7538. for (var i = 0; i < rawChildren.length; i++) {
  7539. var c = rawChildren[i];
  7540. if (c.tag) {
  7541. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  7542. children.push(c);
  7543. map[c.key] = c
  7544. ;(c.data || (c.data = {})).transition = transitionData;
  7545. } else {
  7546. var opts = c.componentOptions;
  7547. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  7548. warn(("<transition-group> children must be keyed: <" + name + ">"));
  7549. }
  7550. }
  7551. }
  7552. if (prevChildren) {
  7553. var kept = [];
  7554. var removed = [];
  7555. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  7556. var c$1 = prevChildren[i$1];
  7557. c$1.data.transition = transitionData;
  7558. c$1.data.pos = c$1.elm.getBoundingClientRect();
  7559. if (map[c$1.key]) {
  7560. kept.push(c$1);
  7561. } else {
  7562. removed.push(c$1);
  7563. }
  7564. }
  7565. this.kept = h(tag, null, kept);
  7566. this.removed = removed;
  7567. }
  7568. return h(tag, null, children)
  7569. },
  7570. beforeUpdate: function beforeUpdate () {
  7571. // force removing pass
  7572. this.__patch__(
  7573. this._vnode,
  7574. this.kept,
  7575. false, // hydrating
  7576. true // removeOnly (!important, avoids unnecessary moves)
  7577. );
  7578. this._vnode = this.kept;
  7579. },
  7580. updated: function updated () {
  7581. var children = this.prevChildren;
  7582. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  7583. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  7584. return
  7585. }
  7586. // we divide the work into three loops to avoid mixing DOM reads and writes
  7587. // in each iteration - which helps prevent layout thrashing.
  7588. children.forEach(callPendingCbs);
  7589. children.forEach(recordPosition);
  7590. children.forEach(applyTranslation);
  7591. // force reflow to put everything in position
  7592. // assign to this to avoid being removed in tree-shaking
  7593. // $flow-disable-line
  7594. this._reflow = document.body.offsetHeight;
  7595. children.forEach(function (c) {
  7596. if (c.data.moved) {
  7597. var el = c.elm;
  7598. var s = el.style;
  7599. addTransitionClass(el, moveClass);
  7600. s.transform = s.WebkitTransform = s.transitionDuration = '';
  7601. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  7602. if (!e || /transform$/.test(e.propertyName)) {
  7603. el.removeEventListener(transitionEndEvent, cb);
  7604. el._moveCb = null;
  7605. removeTransitionClass(el, moveClass);
  7606. }
  7607. });
  7608. }
  7609. });
  7610. },
  7611. methods: {
  7612. hasMove: function hasMove (el, moveClass) {
  7613. /* istanbul ignore if */
  7614. if (!hasTransition) {
  7615. return false
  7616. }
  7617. /* istanbul ignore if */
  7618. if (this._hasMove) {
  7619. return this._hasMove
  7620. }
  7621. // Detect whether an element with the move class applied has
  7622. // CSS transitions. Since the element may be inside an entering
  7623. // transition at this very moment, we make a clone of it and remove
  7624. // all other transition classes applied to ensure only the move class
  7625. // is applied.
  7626. var clone = el.cloneNode();
  7627. if (el._transitionClasses) {
  7628. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  7629. }
  7630. addClass(clone, moveClass);
  7631. clone.style.display = 'none';
  7632. this.$el.appendChild(clone);
  7633. var info = getTransitionInfo(clone);
  7634. this.$el.removeChild(clone);
  7635. return (this._hasMove = info.hasTransform)
  7636. }
  7637. }
  7638. }
  7639. function callPendingCbs (c) {
  7640. /* istanbul ignore if */
  7641. if (c.elm._moveCb) {
  7642. c.elm._moveCb();
  7643. }
  7644. /* istanbul ignore if */
  7645. if (c.elm._enterCb) {
  7646. c.elm._enterCb();
  7647. }
  7648. }
  7649. function recordPosition (c) {
  7650. c.data.newPos = c.elm.getBoundingClientRect();
  7651. }
  7652. function applyTranslation (c) {
  7653. var oldPos = c.data.pos;
  7654. var newPos = c.data.newPos;
  7655. var dx = oldPos.left - newPos.left;
  7656. var dy = oldPos.top - newPos.top;
  7657. if (dx || dy) {
  7658. c.data.moved = true;
  7659. var s = c.elm.style;
  7660. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  7661. s.transitionDuration = '0s';
  7662. }
  7663. }
  7664. var platformComponents = {
  7665. Transition: Transition,
  7666. TransitionGroup: TransitionGroup
  7667. }
  7668. /* */
  7669. // install platform specific utils
  7670. Vue.config.mustUseProp = mustUseProp;
  7671. Vue.config.isReservedTag = isReservedTag;
  7672. Vue.config.isReservedAttr = isReservedAttr;
  7673. Vue.config.getTagNamespace = getTagNamespace;
  7674. Vue.config.isUnknownElement = isUnknownElement;
  7675. // install platform runtime directives & components
  7676. extend(Vue.options.directives, platformDirectives);
  7677. extend(Vue.options.components, platformComponents);
  7678. // install platform patch function
  7679. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  7680. // public mount method
  7681. Vue.prototype.$mount = function (
  7682. el,
  7683. hydrating
  7684. ) {
  7685. el = el && inBrowser ? query(el) : undefined;
  7686. return mountComponent(this, el, hydrating)
  7687. };
  7688. // devtools global hook
  7689. /* istanbul ignore next */
  7690. if (inBrowser) {
  7691. setTimeout(function () {
  7692. if (config.devtools) {
  7693. if (devtools) {
  7694. devtools.emit('init', Vue);
  7695. } else if (
  7696. "development" !== 'production' &&
  7697. "development" !== 'test' &&
  7698. isChrome
  7699. ) {
  7700. console[console.info ? 'info' : 'log'](
  7701. 'Download the Vue Devtools extension for a better development experience:\n' +
  7702. 'https://github.com/vuejs/vue-devtools'
  7703. );
  7704. }
  7705. }
  7706. if ("development" !== 'production' &&
  7707. "development" !== 'test' &&
  7708. config.productionTip !== false &&
  7709. typeof console !== 'undefined'
  7710. ) {
  7711. console[console.info ? 'info' : 'log'](
  7712. "You are running Vue in development mode.\n" +
  7713. "Make sure to turn on production mode when deploying for production.\n" +
  7714. "See more tips at https://vuejs.org/guide/deployment.html"
  7715. );
  7716. }
  7717. }, 0);
  7718. }
  7719. /* */
  7720. var defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g;
  7721. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  7722. var buildRegex = cached(function (delimiters) {
  7723. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  7724. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  7725. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  7726. });
  7727. function parseText (
  7728. text,
  7729. delimiters
  7730. ) {
  7731. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  7732. if (!tagRE.test(text)) {
  7733. return
  7734. }
  7735. var tokens = [];
  7736. var rawTokens = [];
  7737. var lastIndex = tagRE.lastIndex = 0;
  7738. var match, index, tokenValue;
  7739. while ((match = tagRE.exec(text))) {
  7740. index = match.index;
  7741. // push text token
  7742. if (index > lastIndex) {
  7743. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  7744. tokens.push(JSON.stringify(tokenValue));
  7745. }
  7746. // tag token
  7747. var exp = parseFilters(match[1].trim());
  7748. tokens.push(("_s(" + exp + ")"));
  7749. rawTokens.push({ '@binding': exp });
  7750. lastIndex = index + match[0].length;
  7751. }
  7752. if (lastIndex < text.length) {
  7753. rawTokens.push(tokenValue = text.slice(lastIndex));
  7754. tokens.push(JSON.stringify(tokenValue));
  7755. }
  7756. return {
  7757. expression: tokens.join('+'),
  7758. tokens: rawTokens
  7759. }
  7760. }
  7761. /* */
  7762. function transformNode (el, options) {
  7763. var warn = options.warn || baseWarn;
  7764. var staticClass = getAndRemoveAttr(el, 'class');
  7765. if ("development" !== 'production' && staticClass) {
  7766. var res = parseText(staticClass, options.delimiters);
  7767. if (res) {
  7768. warn(
  7769. "class=\"" + staticClass + "\": " +
  7770. 'Interpolation inside attributes has been removed. ' +
  7771. 'Use v-bind or the colon shorthand instead. For example, ' +
  7772. 'instead of <div class="{{ val }}">, use <div :class="val">.'
  7773. );
  7774. }
  7775. }
  7776. if (staticClass) {
  7777. el.staticClass = JSON.stringify(staticClass);
  7778. }
  7779. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  7780. if (classBinding) {
  7781. el.classBinding = classBinding;
  7782. }
  7783. }
  7784. function genData (el) {
  7785. var data = '';
  7786. if (el.staticClass) {
  7787. data += "staticClass:" + (el.staticClass) + ",";
  7788. }
  7789. if (el.classBinding) {
  7790. data += "class:" + (el.classBinding) + ",";
  7791. }
  7792. return data
  7793. }
  7794. var klass$1 = {
  7795. staticKeys: ['staticClass'],
  7796. transformNode: transformNode,
  7797. genData: genData
  7798. }
  7799. /* */
  7800. function transformNode$1 (el, options) {
  7801. var warn = options.warn || baseWarn;
  7802. var staticStyle = getAndRemoveAttr(el, 'style');
  7803. if (staticStyle) {
  7804. /* istanbul ignore if */
  7805. {
  7806. var res = parseText(staticStyle, options.delimiters);
  7807. if (res) {
  7808. warn(
  7809. "style=\"" + staticStyle + "\": " +
  7810. 'Interpolation inside attributes has been removed. ' +
  7811. 'Use v-bind or the colon shorthand instead. For example, ' +
  7812. 'instead of <div style="{{ val }}">, use <div :style="val">.'
  7813. );
  7814. }
  7815. }
  7816. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  7817. }
  7818. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  7819. if (styleBinding) {
  7820. el.styleBinding = styleBinding;
  7821. }
  7822. }
  7823. function genData$1 (el) {
  7824. var data = '';
  7825. if (el.staticStyle) {
  7826. data += "staticStyle:" + (el.staticStyle) + ",";
  7827. }
  7828. if (el.styleBinding) {
  7829. data += "style:(" + (el.styleBinding) + "),";
  7830. }
  7831. return data
  7832. }
  7833. var style$1 = {
  7834. staticKeys: ['staticStyle'],
  7835. transformNode: transformNode$1,
  7836. genData: genData$1
  7837. }
  7838. /* */
  7839. var decoder;
  7840. var he = {
  7841. decode: function decode (html) {
  7842. decoder = decoder || document.createElement('div');
  7843. decoder.innerHTML = html;
  7844. return decoder.textContent
  7845. }
  7846. }
  7847. /* */
  7848. var isUnaryTag = makeMap(
  7849. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  7850. 'link,meta,param,source,track,wbr'
  7851. );
  7852. // Elements that you can, intentionally, leave open
  7853. // (and which close themselves)
  7854. var canBeLeftOpenTag = makeMap(
  7855. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  7856. );
  7857. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  7858. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  7859. var isNonPhrasingTag = makeMap(
  7860. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  7861. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  7862. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  7863. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  7864. 'title,tr,track'
  7865. );
  7866. /**
  7867. * Not type-checking this file because it's mostly vendor code.
  7868. */
  7869. /*!
  7870. * HTML Parser By John Resig (ejohn.org)
  7871. * Modified by Juriy "kangax" Zaytsev
  7872. * Original code by Erik Arvidsson, Mozilla Public License
  7873. * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
  7874. */
  7875. // Regular Expressions for parsing tags and attributes
  7876. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  7877. // could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName
  7878. // but for Vue templates we can enforce a simple charset
  7879. var ncname = '[a-zA-Z_][\\w\\-\\.]*';
  7880. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  7881. var startTagOpen = new RegExp(("^<" + qnameCapture));
  7882. var startTagClose = /^\s*(\/?)>/;
  7883. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  7884. var doctype = /^<!DOCTYPE [^>]+>/i;
  7885. // #7298: escape - to avoid being pased as HTML comment when inlined in page
  7886. var comment = /^<!\--/;
  7887. var conditionalComment = /^<!\[/;
  7888. var IS_REGEX_CAPTURING_BROKEN = false;
  7889. 'x'.replace(/x(.)?/g, function (m, g) {
  7890. IS_REGEX_CAPTURING_BROKEN = g === '';
  7891. });
  7892. // Special Elements (can contain anything)
  7893. var isPlainTextElement = makeMap('script,style,textarea', true);
  7894. var reCache = {};
  7895. var decodingMap = {
  7896. '&lt;': '<',
  7897. '&gt;': '>',
  7898. '&quot;': '"',
  7899. '&amp;': '&',
  7900. '&#10;': '\n',
  7901. '&#9;': '\t'
  7902. };
  7903. var encodedAttr = /&(?:lt|gt|quot|amp);/g;
  7904. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#10|#9);/g;
  7905. // #5992
  7906. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  7907. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  7908. function decodeAttr (value, shouldDecodeNewlines) {
  7909. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  7910. return value.replace(re, function (match) { return decodingMap[match]; })
  7911. }
  7912. function parseHTML (html, options) {
  7913. var stack = [];
  7914. var expectHTML = options.expectHTML;
  7915. var isUnaryTag$$1 = options.isUnaryTag || no;
  7916. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  7917. var index = 0;
  7918. var last, lastTag;
  7919. while (html) {
  7920. last = html;
  7921. // Make sure we're not in a plaintext content element like script/style
  7922. if (!lastTag || !isPlainTextElement(lastTag)) {
  7923. var textEnd = html.indexOf('<');
  7924. if (textEnd === 0) {
  7925. // Comment:
  7926. if (comment.test(html)) {
  7927. var commentEnd = html.indexOf('-->');
  7928. if (commentEnd >= 0) {
  7929. if (options.shouldKeepComment) {
  7930. options.comment(html.substring(4, commentEnd));
  7931. }
  7932. advance(commentEnd + 3);
  7933. continue
  7934. }
  7935. }
  7936. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  7937. if (conditionalComment.test(html)) {
  7938. var conditionalEnd = html.indexOf(']>');
  7939. if (conditionalEnd >= 0) {
  7940. advance(conditionalEnd + 2);
  7941. continue
  7942. }
  7943. }
  7944. // Doctype:
  7945. var doctypeMatch = html.match(doctype);
  7946. if (doctypeMatch) {
  7947. advance(doctypeMatch[0].length);
  7948. continue
  7949. }
  7950. // End tag:
  7951. var endTagMatch = html.match(endTag);
  7952. if (endTagMatch) {
  7953. var curIndex = index;
  7954. advance(endTagMatch[0].length);
  7955. parseEndTag(endTagMatch[1], curIndex, index);
  7956. continue
  7957. }
  7958. // Start tag:
  7959. var startTagMatch = parseStartTag();
  7960. if (startTagMatch) {
  7961. handleStartTag(startTagMatch);
  7962. if (shouldIgnoreFirstNewline(lastTag, html)) {
  7963. advance(1);
  7964. }
  7965. continue
  7966. }
  7967. }
  7968. var text = (void 0), rest = (void 0), next = (void 0);
  7969. if (textEnd >= 0) {
  7970. rest = html.slice(textEnd);
  7971. while (
  7972. !endTag.test(rest) &&
  7973. !startTagOpen.test(rest) &&
  7974. !comment.test(rest) &&
  7975. !conditionalComment.test(rest)
  7976. ) {
  7977. // < in plain text, be forgiving and treat it as text
  7978. next = rest.indexOf('<', 1);
  7979. if (next < 0) { break }
  7980. textEnd += next;
  7981. rest = html.slice(textEnd);
  7982. }
  7983. text = html.substring(0, textEnd);
  7984. advance(textEnd);
  7985. }
  7986. if (textEnd < 0) {
  7987. text = html;
  7988. html = '';
  7989. }
  7990. if (options.chars && text) {
  7991. options.chars(text);
  7992. }
  7993. } else {
  7994. var endTagLength = 0;
  7995. var stackedTag = lastTag.toLowerCase();
  7996. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  7997. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  7998. endTagLength = endTag.length;
  7999. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  8000. text = text
  8001. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  8002. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  8003. }
  8004. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  8005. text = text.slice(1);
  8006. }
  8007. if (options.chars) {
  8008. options.chars(text);
  8009. }
  8010. return ''
  8011. });
  8012. index += html.length - rest$1.length;
  8013. html = rest$1;
  8014. parseEndTag(stackedTag, index - endTagLength, index);
  8015. }
  8016. if (html === last) {
  8017. options.chars && options.chars(html);
  8018. if ("development" !== 'production' && !stack.length && options.warn) {
  8019. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""));
  8020. }
  8021. break
  8022. }
  8023. }
  8024. // Clean up any remaining tags
  8025. parseEndTag();
  8026. function advance (n) {
  8027. index += n;
  8028. html = html.substring(n);
  8029. }
  8030. function parseStartTag () {
  8031. var start = html.match(startTagOpen);
  8032. if (start) {
  8033. var match = {
  8034. tagName: start[1],
  8035. attrs: [],
  8036. start: index
  8037. };
  8038. advance(start[0].length);
  8039. var end, attr;
  8040. while (!(end = html.match(startTagClose)) && (attr = html.match(attribute))) {
  8041. advance(attr[0].length);
  8042. match.attrs.push(attr);
  8043. }
  8044. if (end) {
  8045. match.unarySlash = end[1];
  8046. advance(end[0].length);
  8047. match.end = index;
  8048. return match
  8049. }
  8050. }
  8051. }
  8052. function handleStartTag (match) {
  8053. var tagName = match.tagName;
  8054. var unarySlash = match.unarySlash;
  8055. if (expectHTML) {
  8056. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  8057. parseEndTag(lastTag);
  8058. }
  8059. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  8060. parseEndTag(tagName);
  8061. }
  8062. }
  8063. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  8064. var l = match.attrs.length;
  8065. var attrs = new Array(l);
  8066. for (var i = 0; i < l; i++) {
  8067. var args = match.attrs[i];
  8068. // hackish work around FF bug https://bugzilla.mozilla.org/show_bug.cgi?id=369778
  8069. if (IS_REGEX_CAPTURING_BROKEN && args[0].indexOf('""') === -1) {
  8070. if (args[3] === '') { delete args[3]; }
  8071. if (args[4] === '') { delete args[4]; }
  8072. if (args[5] === '') { delete args[5]; }
  8073. }
  8074. var value = args[3] || args[4] || args[5] || '';
  8075. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  8076. ? options.shouldDecodeNewlinesForHref
  8077. : options.shouldDecodeNewlines;
  8078. attrs[i] = {
  8079. name: args[1],
  8080. value: decodeAttr(value, shouldDecodeNewlines)
  8081. };
  8082. }
  8083. if (!unary) {
  8084. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs });
  8085. lastTag = tagName;
  8086. }
  8087. if (options.start) {
  8088. options.start(tagName, attrs, unary, match.start, match.end);
  8089. }
  8090. }
  8091. function parseEndTag (tagName, start, end) {
  8092. var pos, lowerCasedTagName;
  8093. if (start == null) { start = index; }
  8094. if (end == null) { end = index; }
  8095. if (tagName) {
  8096. lowerCasedTagName = tagName.toLowerCase();
  8097. }
  8098. // Find the closest opened tag of the same type
  8099. if (tagName) {
  8100. for (pos = stack.length - 1; pos >= 0; pos--) {
  8101. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  8102. break
  8103. }
  8104. }
  8105. } else {
  8106. // If no tag name is provided, clean shop
  8107. pos = 0;
  8108. }
  8109. if (pos >= 0) {
  8110. // Close all the open elements, up the stack
  8111. for (var i = stack.length - 1; i >= pos; i--) {
  8112. if ("development" !== 'production' &&
  8113. (i > pos || !tagName) &&
  8114. options.warn
  8115. ) {
  8116. options.warn(
  8117. ("tag <" + (stack[i].tag) + "> has no matching end tag.")
  8118. );
  8119. }
  8120. if (options.end) {
  8121. options.end(stack[i].tag, start, end);
  8122. }
  8123. }
  8124. // Remove the open elements from the stack
  8125. stack.length = pos;
  8126. lastTag = pos && stack[pos - 1].tag;
  8127. } else if (lowerCasedTagName === 'br') {
  8128. if (options.start) {
  8129. options.start(tagName, [], true, start, end);
  8130. }
  8131. } else if (lowerCasedTagName === 'p') {
  8132. if (options.start) {
  8133. options.start(tagName, [], false, start, end);
  8134. }
  8135. if (options.end) {
  8136. options.end(tagName, start, end);
  8137. }
  8138. }
  8139. }
  8140. }
  8141. /* */
  8142. var onRE = /^@|^v-on:/;
  8143. var dirRE = /^v-|^@|^:/;
  8144. var forAliasRE = /([^]*?)\s+(?:in|of)\s+([^]*)/;
  8145. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  8146. var stripParensRE = /^\(|\)$/g;
  8147. var argRE = /:(.*)$/;
  8148. var bindRE = /^:|^v-bind:/;
  8149. var modifierRE = /\.[^.]+/g;
  8150. var decodeHTMLCached = cached(he.decode);
  8151. // configurable state
  8152. var warn$2;
  8153. var delimiters;
  8154. var transforms;
  8155. var preTransforms;
  8156. var postTransforms;
  8157. var platformIsPreTag;
  8158. var platformMustUseProp;
  8159. var platformGetTagNamespace;
  8160. function createASTElement (
  8161. tag,
  8162. attrs,
  8163. parent
  8164. ) {
  8165. return {
  8166. type: 1,
  8167. tag: tag,
  8168. attrsList: attrs,
  8169. attrsMap: makeAttrsMap(attrs),
  8170. parent: parent,
  8171. children: []
  8172. }
  8173. }
  8174. /**
  8175. * Convert HTML string to AST.
  8176. */
  8177. function parse (
  8178. template,
  8179. options
  8180. ) {
  8181. warn$2 = options.warn || baseWarn;
  8182. platformIsPreTag = options.isPreTag || no;
  8183. platformMustUseProp = options.mustUseProp || no;
  8184. platformGetTagNamespace = options.getTagNamespace || no;
  8185. transforms = pluckModuleFunction(options.modules, 'transformNode');
  8186. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  8187. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  8188. delimiters = options.delimiters;
  8189. var stack = [];
  8190. var preserveWhitespace = options.preserveWhitespace !== false;
  8191. var root;
  8192. var currentParent;
  8193. var inVPre = false;
  8194. var inPre = false;
  8195. var warned = false;
  8196. function warnOnce (msg) {
  8197. if (!warned) {
  8198. warned = true;
  8199. warn$2(msg);
  8200. }
  8201. }
  8202. function closeElement (element) {
  8203. // check pre state
  8204. if (element.pre) {
  8205. inVPre = false;
  8206. }
  8207. if (platformIsPreTag(element.tag)) {
  8208. inPre = false;
  8209. }
  8210. // apply post-transforms
  8211. for (var i = 0; i < postTransforms.length; i++) {
  8212. postTransforms[i](element, options);
  8213. }
  8214. }
  8215. parseHTML(template, {
  8216. warn: warn$2,
  8217. expectHTML: options.expectHTML,
  8218. isUnaryTag: options.isUnaryTag,
  8219. canBeLeftOpenTag: options.canBeLeftOpenTag,
  8220. shouldDecodeNewlines: options.shouldDecodeNewlines,
  8221. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  8222. shouldKeepComment: options.comments,
  8223. start: function start (tag, attrs, unary) {
  8224. // check namespace.
  8225. // inherit parent ns if there is one
  8226. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  8227. // handle IE svg bug
  8228. /* istanbul ignore if */
  8229. if (isIE && ns === 'svg') {
  8230. attrs = guardIESVGBug(attrs);
  8231. }
  8232. var element = createASTElement(tag, attrs, currentParent);
  8233. if (ns) {
  8234. element.ns = ns;
  8235. }
  8236. if (isForbiddenTag(element) && !isServerRendering()) {
  8237. element.forbidden = true;
  8238. "development" !== 'production' && warn$2(
  8239. 'Templates should only be responsible for mapping the state to the ' +
  8240. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  8241. "<" + tag + ">" + ', as they will not be parsed.'
  8242. );
  8243. }
  8244. // apply pre-transforms
  8245. for (var i = 0; i < preTransforms.length; i++) {
  8246. element = preTransforms[i](element, options) || element;
  8247. }
  8248. if (!inVPre) {
  8249. processPre(element);
  8250. if (element.pre) {
  8251. inVPre = true;
  8252. }
  8253. }
  8254. if (platformIsPreTag(element.tag)) {
  8255. inPre = true;
  8256. }
  8257. if (inVPre) {
  8258. processRawAttrs(element);
  8259. } else if (!element.processed) {
  8260. // structural directives
  8261. processFor(element);
  8262. processIf(element);
  8263. processOnce(element);
  8264. // element-scope stuff
  8265. processElement(element, options);
  8266. }
  8267. function checkRootConstraints (el) {
  8268. {
  8269. if (el.tag === 'slot' || el.tag === 'template') {
  8270. warnOnce(
  8271. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  8272. 'contain multiple nodes.'
  8273. );
  8274. }
  8275. if (el.attrsMap.hasOwnProperty('v-for')) {
  8276. warnOnce(
  8277. 'Cannot use v-for on stateful component root element because ' +
  8278. 'it renders multiple elements.'
  8279. );
  8280. }
  8281. }
  8282. }
  8283. // tree management
  8284. if (!root) {
  8285. root = element;
  8286. checkRootConstraints(root);
  8287. } else if (!stack.length) {
  8288. // allow root elements with v-if, v-else-if and v-else
  8289. if (root.if && (element.elseif || element.else)) {
  8290. checkRootConstraints(element);
  8291. addIfCondition(root, {
  8292. exp: element.elseif,
  8293. block: element
  8294. });
  8295. } else {
  8296. warnOnce(
  8297. "Component template should contain exactly one root element. " +
  8298. "If you are using v-if on multiple elements, " +
  8299. "use v-else-if to chain them instead."
  8300. );
  8301. }
  8302. }
  8303. if (currentParent && !element.forbidden) {
  8304. if (element.elseif || element.else) {
  8305. processIfConditions(element, currentParent);
  8306. } else if (element.slotScope) { // scoped slot
  8307. currentParent.plain = false;
  8308. var name = element.slotTarget || '"default"';(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  8309. } else {
  8310. currentParent.children.push(element);
  8311. element.parent = currentParent;
  8312. }
  8313. }
  8314. if (!unary) {
  8315. currentParent = element;
  8316. stack.push(element);
  8317. } else {
  8318. closeElement(element);
  8319. }
  8320. },
  8321. end: function end () {
  8322. // remove trailing whitespace
  8323. var element = stack[stack.length - 1];
  8324. var lastNode = element.children[element.children.length - 1];
  8325. if (lastNode && lastNode.type === 3 && lastNode.text === ' ' && !inPre) {
  8326. element.children.pop();
  8327. }
  8328. // pop stack
  8329. stack.length -= 1;
  8330. currentParent = stack[stack.length - 1];
  8331. closeElement(element);
  8332. },
  8333. chars: function chars (text) {
  8334. if (!currentParent) {
  8335. {
  8336. if (text === template) {
  8337. warnOnce(
  8338. 'Component template requires a root element, rather than just text.'
  8339. );
  8340. } else if ((text = text.trim())) {
  8341. warnOnce(
  8342. ("text \"" + text + "\" outside root element will be ignored.")
  8343. );
  8344. }
  8345. }
  8346. return
  8347. }
  8348. // IE textarea placeholder bug
  8349. /* istanbul ignore if */
  8350. if (isIE &&
  8351. currentParent.tag === 'textarea' &&
  8352. currentParent.attrsMap.placeholder === text
  8353. ) {
  8354. return
  8355. }
  8356. var children = currentParent.children;
  8357. text = inPre || text.trim()
  8358. ? isTextTag(currentParent) ? text : decodeHTMLCached(text)
  8359. // only preserve whitespace if its not right after a starting tag
  8360. : preserveWhitespace && children.length ? ' ' : '';
  8361. if (text) {
  8362. var res;
  8363. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  8364. children.push({
  8365. type: 2,
  8366. expression: res.expression,
  8367. tokens: res.tokens,
  8368. text: text
  8369. });
  8370. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  8371. children.push({
  8372. type: 3,
  8373. text: text
  8374. });
  8375. }
  8376. }
  8377. },
  8378. comment: function comment (text) {
  8379. currentParent.children.push({
  8380. type: 3,
  8381. text: text,
  8382. isComment: true
  8383. });
  8384. }
  8385. });
  8386. return root
  8387. }
  8388. function processPre (el) {
  8389. if (getAndRemoveAttr(el, 'v-pre') != null) {
  8390. el.pre = true;
  8391. }
  8392. }
  8393. function processRawAttrs (el) {
  8394. var l = el.attrsList.length;
  8395. if (l) {
  8396. var attrs = el.attrs = new Array(l);
  8397. for (var i = 0; i < l; i++) {
  8398. attrs[i] = {
  8399. name: el.attrsList[i].name,
  8400. value: JSON.stringify(el.attrsList[i].value)
  8401. };
  8402. }
  8403. } else if (!el.pre) {
  8404. // non root node in pre blocks with no attributes
  8405. el.plain = true;
  8406. }
  8407. }
  8408. function processElement (element, options) {
  8409. processKey(element);
  8410. // determine whether this is a plain element after
  8411. // removing structural attributes
  8412. element.plain = !element.key && !element.attrsList.length;
  8413. processRef(element);
  8414. processSlot(element);
  8415. processComponent(element);
  8416. for (var i = 0; i < transforms.length; i++) {
  8417. element = transforms[i](element, options) || element;
  8418. }
  8419. processAttrs(element);
  8420. }
  8421. function processKey (el) {
  8422. var exp = getBindingAttr(el, 'key');
  8423. if (exp) {
  8424. if ("development" !== 'production' && el.tag === 'template') {
  8425. warn$2("<template> cannot be keyed. Place the key on real elements instead.");
  8426. }
  8427. el.key = exp;
  8428. }
  8429. }
  8430. function processRef (el) {
  8431. var ref = getBindingAttr(el, 'ref');
  8432. if (ref) {
  8433. el.ref = ref;
  8434. el.refInFor = checkInFor(el);
  8435. }
  8436. }
  8437. function processFor (el) {
  8438. var exp;
  8439. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  8440. var res = parseFor(exp);
  8441. if (res) {
  8442. extend(el, res);
  8443. } else {
  8444. warn$2(
  8445. ("Invalid v-for expression: " + exp)
  8446. );
  8447. }
  8448. }
  8449. }
  8450. function parseFor (exp) {
  8451. var inMatch = exp.match(forAliasRE);
  8452. if (!inMatch) { return }
  8453. var res = {};
  8454. res.for = inMatch[2].trim();
  8455. var alias = inMatch[1].trim().replace(stripParensRE, '');
  8456. var iteratorMatch = alias.match(forIteratorRE);
  8457. if (iteratorMatch) {
  8458. res.alias = alias.replace(forIteratorRE, '');
  8459. res.iterator1 = iteratorMatch[1].trim();
  8460. if (iteratorMatch[2]) {
  8461. res.iterator2 = iteratorMatch[2].trim();
  8462. }
  8463. } else {
  8464. res.alias = alias;
  8465. }
  8466. return res
  8467. }
  8468. function processIf (el) {
  8469. var exp = getAndRemoveAttr(el, 'v-if');
  8470. if (exp) {
  8471. el.if = exp;
  8472. addIfCondition(el, {
  8473. exp: exp,
  8474. block: el
  8475. });
  8476. } else {
  8477. if (getAndRemoveAttr(el, 'v-else') != null) {
  8478. el.else = true;
  8479. }
  8480. var elseif = getAndRemoveAttr(el, 'v-else-if');
  8481. if (elseif) {
  8482. el.elseif = elseif;
  8483. }
  8484. }
  8485. }
  8486. function processIfConditions (el, parent) {
  8487. var prev = findPrevElement(parent.children);
  8488. if (prev && prev.if) {
  8489. addIfCondition(prev, {
  8490. exp: el.elseif,
  8491. block: el
  8492. });
  8493. } else {
  8494. warn$2(
  8495. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  8496. "used on element <" + (el.tag) + "> without corresponding v-if."
  8497. );
  8498. }
  8499. }
  8500. function findPrevElement (children) {
  8501. var i = children.length;
  8502. while (i--) {
  8503. if (children[i].type === 1) {
  8504. return children[i]
  8505. } else {
  8506. if ("development" !== 'production' && children[i].text !== ' ') {
  8507. warn$2(
  8508. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  8509. "will be ignored."
  8510. );
  8511. }
  8512. children.pop();
  8513. }
  8514. }
  8515. }
  8516. function addIfCondition (el, condition) {
  8517. if (!el.ifConditions) {
  8518. el.ifConditions = [];
  8519. }
  8520. el.ifConditions.push(condition);
  8521. }
  8522. function processOnce (el) {
  8523. var once$$1 = getAndRemoveAttr(el, 'v-once');
  8524. if (once$$1 != null) {
  8525. el.once = true;
  8526. }
  8527. }
  8528. function processSlot (el) {
  8529. if (el.tag === 'slot') {
  8530. el.slotName = getBindingAttr(el, 'name');
  8531. if ("development" !== 'production' && el.key) {
  8532. warn$2(
  8533. "`key` does not work on <slot> because slots are abstract outlets " +
  8534. "and can possibly expand into multiple elements. " +
  8535. "Use the key on a wrapping element instead."
  8536. );
  8537. }
  8538. } else {
  8539. var slotScope;
  8540. if (el.tag === 'template') {
  8541. slotScope = getAndRemoveAttr(el, 'scope');
  8542. /* istanbul ignore if */
  8543. if ("development" !== 'production' && slotScope) {
  8544. warn$2(
  8545. "the \"scope\" attribute for scoped slots have been deprecated and " +
  8546. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  8547. "can also be used on plain elements in addition to <template> to " +
  8548. "denote scoped slots.",
  8549. true
  8550. );
  8551. }
  8552. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  8553. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  8554. /* istanbul ignore if */
  8555. if ("development" !== 'production' && el.attrsMap['v-for']) {
  8556. warn$2(
  8557. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  8558. "(v-for takes higher priority). Use a wrapper <template> for the " +
  8559. "scoped slot to make it clearer.",
  8560. true
  8561. );
  8562. }
  8563. el.slotScope = slotScope;
  8564. }
  8565. var slotTarget = getBindingAttr(el, 'slot');
  8566. if (slotTarget) {
  8567. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  8568. // preserve slot as an attribute for native shadow DOM compat
  8569. // only for non-scoped slots.
  8570. if (el.tag !== 'template' && !el.slotScope) {
  8571. addAttr(el, 'slot', slotTarget);
  8572. }
  8573. }
  8574. }
  8575. }
  8576. function processComponent (el) {
  8577. var binding;
  8578. if ((binding = getBindingAttr(el, 'is'))) {
  8579. el.component = binding;
  8580. }
  8581. if (getAndRemoveAttr(el, 'inline-template') != null) {
  8582. el.inlineTemplate = true;
  8583. }
  8584. }
  8585. function processAttrs (el) {
  8586. var list = el.attrsList;
  8587. var i, l, name, rawName, value, modifiers, isProp;
  8588. for (i = 0, l = list.length; i < l; i++) {
  8589. name = rawName = list[i].name;
  8590. value = list[i].value;
  8591. if (dirRE.test(name)) {
  8592. // mark element as dynamic
  8593. el.hasBindings = true;
  8594. // modifiers
  8595. modifiers = parseModifiers(name);
  8596. if (modifiers) {
  8597. name = name.replace(modifierRE, '');
  8598. }
  8599. if (bindRE.test(name)) { // v-bind
  8600. name = name.replace(bindRE, '');
  8601. value = parseFilters(value);
  8602. isProp = false;
  8603. if (modifiers) {
  8604. if (modifiers.prop) {
  8605. isProp = true;
  8606. name = camelize(name);
  8607. if (name === 'innerHtml') { name = 'innerHTML'; }
  8608. }
  8609. if (modifiers.camel) {
  8610. name = camelize(name);
  8611. }
  8612. if (modifiers.sync) {
  8613. addHandler(
  8614. el,
  8615. ("update:" + (camelize(name))),
  8616. genAssignmentCode(value, "$event")
  8617. );
  8618. }
  8619. }
  8620. if (isProp || (
  8621. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  8622. )) {
  8623. addProp(el, name, value);
  8624. } else {
  8625. addAttr(el, name, value);
  8626. }
  8627. } else if (onRE.test(name)) { // v-on
  8628. name = name.replace(onRE, '');
  8629. addHandler(el, name, value, modifiers, false, warn$2);
  8630. } else { // normal directives
  8631. name = name.replace(dirRE, '');
  8632. // parse arg
  8633. var argMatch = name.match(argRE);
  8634. var arg = argMatch && argMatch[1];
  8635. if (arg) {
  8636. name = name.slice(0, -(arg.length + 1));
  8637. }
  8638. addDirective(el, name, rawName, value, arg, modifiers);
  8639. if ("development" !== 'production' && name === 'model') {
  8640. checkForAliasModel(el, value);
  8641. }
  8642. }
  8643. } else {
  8644. // literal attribute
  8645. {
  8646. var res = parseText(value, delimiters);
  8647. if (res) {
  8648. warn$2(
  8649. name + "=\"" + value + "\": " +
  8650. 'Interpolation inside attributes has been removed. ' +
  8651. 'Use v-bind or the colon shorthand instead. For example, ' +
  8652. 'instead of <div id="{{ val }}">, use <div :id="val">.'
  8653. );
  8654. }
  8655. }
  8656. addAttr(el, name, JSON.stringify(value));
  8657. // #6887 firefox doesn't update muted state if set via attribute
  8658. // even immediately after element creation
  8659. if (!el.component &&
  8660. name === 'muted' &&
  8661. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  8662. addProp(el, name, 'true');
  8663. }
  8664. }
  8665. }
  8666. }
  8667. function checkInFor (el) {
  8668. var parent = el;
  8669. while (parent) {
  8670. if (parent.for !== undefined) {
  8671. return true
  8672. }
  8673. parent = parent.parent;
  8674. }
  8675. return false
  8676. }
  8677. function parseModifiers (name) {
  8678. var match = name.match(modifierRE);
  8679. if (match) {
  8680. var ret = {};
  8681. match.forEach(function (m) { ret[m.slice(1)] = true; });
  8682. return ret
  8683. }
  8684. }
  8685. function makeAttrsMap (attrs) {
  8686. var map = {};
  8687. for (var i = 0, l = attrs.length; i < l; i++) {
  8688. if (
  8689. "development" !== 'production' &&
  8690. map[attrs[i].name] && !isIE && !isEdge
  8691. ) {
  8692. warn$2('duplicate attribute: ' + attrs[i].name);
  8693. }
  8694. map[attrs[i].name] = attrs[i].value;
  8695. }
  8696. return map
  8697. }
  8698. // for script (e.g. type="x/template") or style, do not decode content
  8699. function isTextTag (el) {
  8700. return el.tag === 'script' || el.tag === 'style'
  8701. }
  8702. function isForbiddenTag (el) {
  8703. return (
  8704. el.tag === 'style' ||
  8705. (el.tag === 'script' && (
  8706. !el.attrsMap.type ||
  8707. el.attrsMap.type === 'text/javascript'
  8708. ))
  8709. )
  8710. }
  8711. var ieNSBug = /^xmlns:NS\d+/;
  8712. var ieNSPrefix = /^NS\d+:/;
  8713. /* istanbul ignore next */
  8714. function guardIESVGBug (attrs) {
  8715. var res = [];
  8716. for (var i = 0; i < attrs.length; i++) {
  8717. var attr = attrs[i];
  8718. if (!ieNSBug.test(attr.name)) {
  8719. attr.name = attr.name.replace(ieNSPrefix, '');
  8720. res.push(attr);
  8721. }
  8722. }
  8723. return res
  8724. }
  8725. function checkForAliasModel (el, value) {
  8726. var _el = el;
  8727. while (_el) {
  8728. if (_el.for && _el.alias === value) {
  8729. warn$2(
  8730. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  8731. "You are binding v-model directly to a v-for iteration alias. " +
  8732. "This will not be able to modify the v-for source array because " +
  8733. "writing to the alias is like modifying a function local variable. " +
  8734. "Consider using an array of objects and use v-model on an object property instead."
  8735. );
  8736. }
  8737. _el = _el.parent;
  8738. }
  8739. }
  8740. /* */
  8741. /**
  8742. * Expand input[v-model] with dyanmic type bindings into v-if-else chains
  8743. * Turn this:
  8744. * <input v-model="data[type]" :type="type">
  8745. * into this:
  8746. * <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]">
  8747. * <input v-else-if="type === 'radio'" type="radio" v-model="data[type]">
  8748. * <input v-else :type="type" v-model="data[type]">
  8749. */
  8750. function preTransformNode (el, options) {
  8751. if (el.tag === 'input') {
  8752. var map = el.attrsMap;
  8753. if (!map['v-model']) {
  8754. return
  8755. }
  8756. var typeBinding;
  8757. if (map[':type'] || map['v-bind:type']) {
  8758. typeBinding = getBindingAttr(el, 'type');
  8759. }
  8760. if (!map.type && !typeBinding && map['v-bind']) {
  8761. typeBinding = "(" + (map['v-bind']) + ").type";
  8762. }
  8763. if (typeBinding) {
  8764. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  8765. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  8766. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  8767. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  8768. // 1. checkbox
  8769. var branch0 = cloneASTElement(el);
  8770. // process for on the main node
  8771. processFor(branch0);
  8772. addRawAttr(branch0, 'type', 'checkbox');
  8773. processElement(branch0, options);
  8774. branch0.processed = true; // prevent it from double-processed
  8775. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  8776. addIfCondition(branch0, {
  8777. exp: branch0.if,
  8778. block: branch0
  8779. });
  8780. // 2. add radio else-if condition
  8781. var branch1 = cloneASTElement(el);
  8782. getAndRemoveAttr(branch1, 'v-for', true);
  8783. addRawAttr(branch1, 'type', 'radio');
  8784. processElement(branch1, options);
  8785. addIfCondition(branch0, {
  8786. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  8787. block: branch1
  8788. });
  8789. // 3. other
  8790. var branch2 = cloneASTElement(el);
  8791. getAndRemoveAttr(branch2, 'v-for', true);
  8792. addRawAttr(branch2, ':type', typeBinding);
  8793. processElement(branch2, options);
  8794. addIfCondition(branch0, {
  8795. exp: ifCondition,
  8796. block: branch2
  8797. });
  8798. if (hasElse) {
  8799. branch0.else = true;
  8800. } else if (elseIfCondition) {
  8801. branch0.elseif = elseIfCondition;
  8802. }
  8803. return branch0
  8804. }
  8805. }
  8806. }
  8807. function cloneASTElement (el) {
  8808. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  8809. }
  8810. var model$2 = {
  8811. preTransformNode: preTransformNode
  8812. }
  8813. var modules$1 = [
  8814. klass$1,
  8815. style$1,
  8816. model$2
  8817. ]
  8818. /* */
  8819. function text (el, dir) {
  8820. if (dir.value) {
  8821. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"));
  8822. }
  8823. }
  8824. /* */
  8825. function html (el, dir) {
  8826. if (dir.value) {
  8827. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"));
  8828. }
  8829. }
  8830. var directives$1 = {
  8831. model: model,
  8832. text: text,
  8833. html: html
  8834. }
  8835. /* */
  8836. var baseOptions = {
  8837. expectHTML: true,
  8838. modules: modules$1,
  8839. directives: directives$1,
  8840. isPreTag: isPreTag,
  8841. isUnaryTag: isUnaryTag,
  8842. mustUseProp: mustUseProp,
  8843. canBeLeftOpenTag: canBeLeftOpenTag,
  8844. isReservedTag: isReservedTag,
  8845. getTagNamespace: getTagNamespace,
  8846. staticKeys: genStaticKeys(modules$1)
  8847. };
  8848. /* */
  8849. var isStaticKey;
  8850. var isPlatformReservedTag;
  8851. var genStaticKeysCached = cached(genStaticKeys$1);
  8852. /**
  8853. * Goal of the optimizer: walk the generated template AST tree
  8854. * and detect sub-trees that are purely static, i.e. parts of
  8855. * the DOM that never needs to change.
  8856. *
  8857. * Once we detect these sub-trees, we can:
  8858. *
  8859. * 1. Hoist them into constants, so that we no longer need to
  8860. * create fresh nodes for them on each re-render;
  8861. * 2. Completely skip them in the patching process.
  8862. */
  8863. function optimize (root, options) {
  8864. if (!root) { return }
  8865. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  8866. isPlatformReservedTag = options.isReservedTag || no;
  8867. // first pass: mark all non-static nodes.
  8868. markStatic$1(root);
  8869. // second pass: mark static roots.
  8870. markStaticRoots(root, false);
  8871. }
  8872. function genStaticKeys$1 (keys) {
  8873. return makeMap(
  8874. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs' +
  8875. (keys ? ',' + keys : '')
  8876. )
  8877. }
  8878. function markStatic$1 (node) {
  8879. node.static = isStatic(node);
  8880. if (node.type === 1) {
  8881. // do not make component slot content static. this avoids
  8882. // 1. components not able to mutate slot nodes
  8883. // 2. static slot content fails for hot-reloading
  8884. if (
  8885. !isPlatformReservedTag(node.tag) &&
  8886. node.tag !== 'slot' &&
  8887. node.attrsMap['inline-template'] == null
  8888. ) {
  8889. return
  8890. }
  8891. for (var i = 0, l = node.children.length; i < l; i++) {
  8892. var child = node.children[i];
  8893. markStatic$1(child);
  8894. if (!child.static) {
  8895. node.static = false;
  8896. }
  8897. }
  8898. if (node.ifConditions) {
  8899. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  8900. var block = node.ifConditions[i$1].block;
  8901. markStatic$1(block);
  8902. if (!block.static) {
  8903. node.static = false;
  8904. }
  8905. }
  8906. }
  8907. }
  8908. }
  8909. function markStaticRoots (node, isInFor) {
  8910. if (node.type === 1) {
  8911. if (node.static || node.once) {
  8912. node.staticInFor = isInFor;
  8913. }
  8914. // For a node to qualify as a static root, it should have children that
  8915. // are not just static text. Otherwise the cost of hoisting out will
  8916. // outweigh the benefits and it's better off to just always render it fresh.
  8917. if (node.static && node.children.length && !(
  8918. node.children.length === 1 &&
  8919. node.children[0].type === 3
  8920. )) {
  8921. node.staticRoot = true;
  8922. return
  8923. } else {
  8924. node.staticRoot = false;
  8925. }
  8926. if (node.children) {
  8927. for (var i = 0, l = node.children.length; i < l; i++) {
  8928. markStaticRoots(node.children[i], isInFor || !!node.for);
  8929. }
  8930. }
  8931. if (node.ifConditions) {
  8932. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  8933. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  8934. }
  8935. }
  8936. }
  8937. }
  8938. function isStatic (node) {
  8939. if (node.type === 2) { // expression
  8940. return false
  8941. }
  8942. if (node.type === 3) { // text
  8943. return true
  8944. }
  8945. return !!(node.pre || (
  8946. !node.hasBindings && // no dynamic bindings
  8947. !node.if && !node.for && // not v-if or v-for or v-else
  8948. !isBuiltInTag(node.tag) && // not a built-in
  8949. isPlatformReservedTag(node.tag) && // not a component
  8950. !isDirectChildOfTemplateFor(node) &&
  8951. Object.keys(node).every(isStaticKey)
  8952. ))
  8953. }
  8954. function isDirectChildOfTemplateFor (node) {
  8955. while (node.parent) {
  8956. node = node.parent;
  8957. if (node.tag !== 'template') {
  8958. return false
  8959. }
  8960. if (node.for) {
  8961. return true
  8962. }
  8963. }
  8964. return false
  8965. }
  8966. /* */
  8967. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
  8968. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  8969. // KeyboardEvent.keyCode aliases
  8970. var keyCodes = {
  8971. esc: 27,
  8972. tab: 9,
  8973. enter: 13,
  8974. space: 32,
  8975. up: 38,
  8976. left: 37,
  8977. right: 39,
  8978. down: 40,
  8979. 'delete': [8, 46]
  8980. };
  8981. // KeyboardEvent.key aliases
  8982. var keyNames = {
  8983. esc: 'Escape',
  8984. tab: 'Tab',
  8985. enter: 'Enter',
  8986. space: ' ',
  8987. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  8988. up: ['Up', 'ArrowUp'],
  8989. left: ['Left', 'ArrowLeft'],
  8990. right: ['Right', 'ArrowRight'],
  8991. down: ['Down', 'ArrowDown'],
  8992. 'delete': ['Backspace', 'Delete']
  8993. };
  8994. // #4868: modifiers that prevent the execution of the listener
  8995. // need to explicitly return null so that we can determine whether to remove
  8996. // the listener for .once
  8997. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  8998. var modifierCode = {
  8999. stop: '$event.stopPropagation();',
  9000. prevent: '$event.preventDefault();',
  9001. self: genGuard("$event.target !== $event.currentTarget"),
  9002. ctrl: genGuard("!$event.ctrlKey"),
  9003. shift: genGuard("!$event.shiftKey"),
  9004. alt: genGuard("!$event.altKey"),
  9005. meta: genGuard("!$event.metaKey"),
  9006. left: genGuard("'button' in $event && $event.button !== 0"),
  9007. middle: genGuard("'button' in $event && $event.button !== 1"),
  9008. right: genGuard("'button' in $event && $event.button !== 2")
  9009. };
  9010. function genHandlers (
  9011. events,
  9012. isNative,
  9013. warn
  9014. ) {
  9015. var res = isNative ? 'nativeOn:{' : 'on:{';
  9016. for (var name in events) {
  9017. res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
  9018. }
  9019. return res.slice(0, -1) + '}'
  9020. }
  9021. function genHandler (
  9022. name,
  9023. handler
  9024. ) {
  9025. if (!handler) {
  9026. return 'function(){}'
  9027. }
  9028. if (Array.isArray(handler)) {
  9029. return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
  9030. }
  9031. var isMethodPath = simplePathRE.test(handler.value);
  9032. var isFunctionExpression = fnExpRE.test(handler.value);
  9033. if (!handler.modifiers) {
  9034. if (isMethodPath || isFunctionExpression) {
  9035. return handler.value
  9036. }
  9037. /* istanbul ignore if */
  9038. return ("function($event){" + (handler.value) + "}") // inline statement
  9039. } else {
  9040. var code = '';
  9041. var genModifierCode = '';
  9042. var keys = [];
  9043. for (var key in handler.modifiers) {
  9044. if (modifierCode[key]) {
  9045. genModifierCode += modifierCode[key];
  9046. // left/right
  9047. if (keyCodes[key]) {
  9048. keys.push(key);
  9049. }
  9050. } else if (key === 'exact') {
  9051. var modifiers = (handler.modifiers);
  9052. genModifierCode += genGuard(
  9053. ['ctrl', 'shift', 'alt', 'meta']
  9054. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  9055. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  9056. .join('||')
  9057. );
  9058. } else {
  9059. keys.push(key);
  9060. }
  9061. }
  9062. if (keys.length) {
  9063. code += genKeyFilter(keys);
  9064. }
  9065. // Make sure modifiers like prevent and stop get executed after key filtering
  9066. if (genModifierCode) {
  9067. code += genModifierCode;
  9068. }
  9069. var handlerCode = isMethodPath
  9070. ? ("return " + (handler.value) + "($event)")
  9071. : isFunctionExpression
  9072. ? ("return (" + (handler.value) + ")($event)")
  9073. : handler.value;
  9074. /* istanbul ignore if */
  9075. return ("function($event){" + code + handlerCode + "}")
  9076. }
  9077. }
  9078. function genKeyFilter (keys) {
  9079. return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
  9080. }
  9081. function genFilterCode (key) {
  9082. var keyVal = parseInt(key, 10);
  9083. if (keyVal) {
  9084. return ("$event.keyCode!==" + keyVal)
  9085. }
  9086. var keyCode = keyCodes[key];
  9087. var keyName = keyNames[key];
  9088. return (
  9089. "_k($event.keyCode," +
  9090. (JSON.stringify(key)) + "," +
  9091. (JSON.stringify(keyCode)) + "," +
  9092. "$event.key," +
  9093. "" + (JSON.stringify(keyName)) +
  9094. ")"
  9095. )
  9096. }
  9097. /* */
  9098. function on (el, dir) {
  9099. if ("development" !== 'production' && dir.modifiers) {
  9100. warn("v-on without argument does not support modifiers.");
  9101. }
  9102. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  9103. }
  9104. /* */
  9105. function bind$1 (el, dir) {
  9106. el.wrapData = function (code) {
  9107. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  9108. };
  9109. }
  9110. /* */
  9111. var baseDirectives = {
  9112. on: on,
  9113. bind: bind$1,
  9114. cloak: noop
  9115. }
  9116. /* */
  9117. var CodegenState = function CodegenState (options) {
  9118. this.options = options;
  9119. this.warn = options.warn || baseWarn;
  9120. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  9121. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  9122. this.directives = extend(extend({}, baseDirectives), options.directives);
  9123. var isReservedTag = options.isReservedTag || no;
  9124. this.maybeComponent = function (el) { return !isReservedTag(el.tag); };
  9125. this.onceId = 0;
  9126. this.staticRenderFns = [];
  9127. };
  9128. function generate (
  9129. ast,
  9130. options
  9131. ) {
  9132. var state = new CodegenState(options);
  9133. var code = ast ? genElement(ast, state) : '_c("div")';
  9134. return {
  9135. render: ("with(this){return " + code + "}"),
  9136. staticRenderFns: state.staticRenderFns
  9137. }
  9138. }
  9139. function genElement (el, state) {
  9140. if (el.staticRoot && !el.staticProcessed) {
  9141. return genStatic(el, state)
  9142. } else if (el.once && !el.onceProcessed) {
  9143. return genOnce(el, state)
  9144. } else if (el.for && !el.forProcessed) {
  9145. return genFor(el, state)
  9146. } else if (el.if && !el.ifProcessed) {
  9147. return genIf(el, state)
  9148. } else if (el.tag === 'template' && !el.slotTarget) {
  9149. return genChildren(el, state) || 'void 0'
  9150. } else if (el.tag === 'slot') {
  9151. return genSlot(el, state)
  9152. } else {
  9153. // component or element
  9154. var code;
  9155. if (el.component) {
  9156. code = genComponent(el.component, el, state);
  9157. } else {
  9158. var data = el.plain ? undefined : genData$2(el, state);
  9159. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  9160. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  9161. }
  9162. // module transforms
  9163. for (var i = 0; i < state.transforms.length; i++) {
  9164. code = state.transforms[i](el, code);
  9165. }
  9166. return code
  9167. }
  9168. }
  9169. // hoist static sub-trees out
  9170. function genStatic (el, state) {
  9171. el.staticProcessed = true;
  9172. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  9173. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  9174. }
  9175. // v-once
  9176. function genOnce (el, state) {
  9177. el.onceProcessed = true;
  9178. if (el.if && !el.ifProcessed) {
  9179. return genIf(el, state)
  9180. } else if (el.staticInFor) {
  9181. var key = '';
  9182. var parent = el.parent;
  9183. while (parent) {
  9184. if (parent.for) {
  9185. key = parent.key;
  9186. break
  9187. }
  9188. parent = parent.parent;
  9189. }
  9190. if (!key) {
  9191. "development" !== 'production' && state.warn(
  9192. "v-once can only be used inside v-for that is keyed. "
  9193. );
  9194. return genElement(el, state)
  9195. }
  9196. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  9197. } else {
  9198. return genStatic(el, state)
  9199. }
  9200. }
  9201. function genIf (
  9202. el,
  9203. state,
  9204. altGen,
  9205. altEmpty
  9206. ) {
  9207. el.ifProcessed = true; // avoid recursion
  9208. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  9209. }
  9210. function genIfConditions (
  9211. conditions,
  9212. state,
  9213. altGen,
  9214. altEmpty
  9215. ) {
  9216. if (!conditions.length) {
  9217. return altEmpty || '_e()'
  9218. }
  9219. var condition = conditions.shift();
  9220. if (condition.exp) {
  9221. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  9222. } else {
  9223. return ("" + (genTernaryExp(condition.block)))
  9224. }
  9225. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  9226. function genTernaryExp (el) {
  9227. return altGen
  9228. ? altGen(el, state)
  9229. : el.once
  9230. ? genOnce(el, state)
  9231. : genElement(el, state)
  9232. }
  9233. }
  9234. function genFor (
  9235. el,
  9236. state,
  9237. altGen,
  9238. altHelper
  9239. ) {
  9240. var exp = el.for;
  9241. var alias = el.alias;
  9242. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  9243. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  9244. if ("development" !== 'production' &&
  9245. state.maybeComponent(el) &&
  9246. el.tag !== 'slot' &&
  9247. el.tag !== 'template' &&
  9248. !el.key
  9249. ) {
  9250. state.warn(
  9251. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  9252. "v-for should have explicit keys. " +
  9253. "See https://vuejs.org/guide/list.html#key for more info.",
  9254. true /* tip */
  9255. );
  9256. }
  9257. el.forProcessed = true; // avoid recursion
  9258. return (altHelper || '_l') + "((" + exp + ")," +
  9259. "function(" + alias + iterator1 + iterator2 + "){" +
  9260. "return " + ((altGen || genElement)(el, state)) +
  9261. '})'
  9262. }
  9263. function genData$2 (el, state) {
  9264. var data = '{';
  9265. // directives first.
  9266. // directives may mutate the el's other properties before they are generated.
  9267. var dirs = genDirectives(el, state);
  9268. if (dirs) { data += dirs + ','; }
  9269. // key
  9270. if (el.key) {
  9271. data += "key:" + (el.key) + ",";
  9272. }
  9273. // ref
  9274. if (el.ref) {
  9275. data += "ref:" + (el.ref) + ",";
  9276. }
  9277. if (el.refInFor) {
  9278. data += "refInFor:true,";
  9279. }
  9280. // pre
  9281. if (el.pre) {
  9282. data += "pre:true,";
  9283. }
  9284. // record original tag name for components using "is" attribute
  9285. if (el.component) {
  9286. data += "tag:\"" + (el.tag) + "\",";
  9287. }
  9288. // module data generation functions
  9289. for (var i = 0; i < state.dataGenFns.length; i++) {
  9290. data += state.dataGenFns[i](el);
  9291. }
  9292. // attributes
  9293. if (el.attrs) {
  9294. data += "attrs:{" + (genProps(el.attrs)) + "},";
  9295. }
  9296. // DOM props
  9297. if (el.props) {
  9298. data += "domProps:{" + (genProps(el.props)) + "},";
  9299. }
  9300. // event handlers
  9301. if (el.events) {
  9302. data += (genHandlers(el.events, false, state.warn)) + ",";
  9303. }
  9304. if (el.nativeEvents) {
  9305. data += (genHandlers(el.nativeEvents, true, state.warn)) + ",";
  9306. }
  9307. // slot target
  9308. // only for non-scoped slots
  9309. if (el.slotTarget && !el.slotScope) {
  9310. data += "slot:" + (el.slotTarget) + ",";
  9311. }
  9312. // scoped slots
  9313. if (el.scopedSlots) {
  9314. data += (genScopedSlots(el.scopedSlots, state)) + ",";
  9315. }
  9316. // component v-model
  9317. if (el.model) {
  9318. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  9319. }
  9320. // inline-template
  9321. if (el.inlineTemplate) {
  9322. var inlineTemplate = genInlineTemplate(el, state);
  9323. if (inlineTemplate) {
  9324. data += inlineTemplate + ",";
  9325. }
  9326. }
  9327. data = data.replace(/,$/, '') + '}';
  9328. // v-bind data wrap
  9329. if (el.wrapData) {
  9330. data = el.wrapData(data);
  9331. }
  9332. // v-on data wrap
  9333. if (el.wrapListeners) {
  9334. data = el.wrapListeners(data);
  9335. }
  9336. return data
  9337. }
  9338. function genDirectives (el, state) {
  9339. var dirs = el.directives;
  9340. if (!dirs) { return }
  9341. var res = 'directives:[';
  9342. var hasRuntime = false;
  9343. var i, l, dir, needRuntime;
  9344. for (i = 0, l = dirs.length; i < l; i++) {
  9345. dir = dirs[i];
  9346. needRuntime = true;
  9347. var gen = state.directives[dir.name];
  9348. if (gen) {
  9349. // compile-time directive that manipulates AST.
  9350. // returns true if it also needs a runtime counterpart.
  9351. needRuntime = !!gen(el, dir, state.warn);
  9352. }
  9353. if (needRuntime) {
  9354. hasRuntime = true;
  9355. res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:\"" + (dir.arg) + "\"") : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
  9356. }
  9357. }
  9358. if (hasRuntime) {
  9359. return res.slice(0, -1) + ']'
  9360. }
  9361. }
  9362. function genInlineTemplate (el, state) {
  9363. var ast = el.children[0];
  9364. if ("development" !== 'production' && (
  9365. el.children.length !== 1 || ast.type !== 1
  9366. )) {
  9367. state.warn('Inline-template components must have exactly one child element.');
  9368. }
  9369. if (ast.type === 1) {
  9370. var inlineRenderFns = generate(ast, state.options);
  9371. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  9372. }
  9373. }
  9374. function genScopedSlots (
  9375. slots,
  9376. state
  9377. ) {
  9378. return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
  9379. return genScopedSlot(key, slots[key], state)
  9380. }).join(',')) + "])")
  9381. }
  9382. function genScopedSlot (
  9383. key,
  9384. el,
  9385. state
  9386. ) {
  9387. if (el.for && !el.forProcessed) {
  9388. return genForScopedSlot(key, el, state)
  9389. }
  9390. var fn = "function(" + (String(el.slotScope)) + "){" +
  9391. "return " + (el.tag === 'template'
  9392. ? el.if
  9393. ? ((el.if) + "?" + (genChildren(el, state) || 'undefined') + ":undefined")
  9394. : genChildren(el, state) || 'undefined'
  9395. : genElement(el, state)) + "}";
  9396. return ("{key:" + key + ",fn:" + fn + "}")
  9397. }
  9398. function genForScopedSlot (
  9399. key,
  9400. el,
  9401. state
  9402. ) {
  9403. var exp = el.for;
  9404. var alias = el.alias;
  9405. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  9406. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  9407. el.forProcessed = true; // avoid recursion
  9408. return "_l((" + exp + ")," +
  9409. "function(" + alias + iterator1 + iterator2 + "){" +
  9410. "return " + (genScopedSlot(key, el, state)) +
  9411. '})'
  9412. }
  9413. function genChildren (
  9414. el,
  9415. state,
  9416. checkSkip,
  9417. altGenElement,
  9418. altGenNode
  9419. ) {
  9420. var children = el.children;
  9421. if (children.length) {
  9422. var el$1 = children[0];
  9423. // optimize single v-for
  9424. if (children.length === 1 &&
  9425. el$1.for &&
  9426. el$1.tag !== 'template' &&
  9427. el$1.tag !== 'slot'
  9428. ) {
  9429. return (altGenElement || genElement)(el$1, state)
  9430. }
  9431. var normalizationType = checkSkip
  9432. ? getNormalizationType(children, state.maybeComponent)
  9433. : 0;
  9434. var gen = altGenNode || genNode;
  9435. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType ? ("," + normalizationType) : ''))
  9436. }
  9437. }
  9438. // determine the normalization needed for the children array.
  9439. // 0: no normalization needed
  9440. // 1: simple normalization needed (possible 1-level deep nested array)
  9441. // 2: full normalization needed
  9442. function getNormalizationType (
  9443. children,
  9444. maybeComponent
  9445. ) {
  9446. var res = 0;
  9447. for (var i = 0; i < children.length; i++) {
  9448. var el = children[i];
  9449. if (el.type !== 1) {
  9450. continue
  9451. }
  9452. if (needsNormalization(el) ||
  9453. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  9454. res = 2;
  9455. break
  9456. }
  9457. if (maybeComponent(el) ||
  9458. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  9459. res = 1;
  9460. }
  9461. }
  9462. return res
  9463. }
  9464. function needsNormalization (el) {
  9465. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  9466. }
  9467. function genNode (node, state) {
  9468. if (node.type === 1) {
  9469. return genElement(node, state)
  9470. } if (node.type === 3 && node.isComment) {
  9471. return genComment(node)
  9472. } else {
  9473. return genText(node)
  9474. }
  9475. }
  9476. function genText (text) {
  9477. return ("_v(" + (text.type === 2
  9478. ? text.expression // no need for () because already wrapped in _s()
  9479. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  9480. }
  9481. function genComment (comment) {
  9482. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  9483. }
  9484. function genSlot (el, state) {
  9485. var slotName = el.slotName || '"default"';
  9486. var children = genChildren(el, state);
  9487. var res = "_t(" + slotName + (children ? ("," + children) : '');
  9488. var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}");
  9489. var bind$$1 = el.attrsMap['v-bind'];
  9490. if ((attrs || bind$$1) && !children) {
  9491. res += ",null";
  9492. }
  9493. if (attrs) {
  9494. res += "," + attrs;
  9495. }
  9496. if (bind$$1) {
  9497. res += (attrs ? '' : ',null') + "," + bind$$1;
  9498. }
  9499. return res + ')'
  9500. }
  9501. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  9502. function genComponent (
  9503. componentName,
  9504. el,
  9505. state
  9506. ) {
  9507. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  9508. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  9509. }
  9510. function genProps (props) {
  9511. var res = '';
  9512. for (var i = 0; i < props.length; i++) {
  9513. var prop = props[i];
  9514. /* istanbul ignore if */
  9515. {
  9516. res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
  9517. }
  9518. }
  9519. return res.slice(0, -1)
  9520. }
  9521. // #3895, #4268
  9522. function transformSpecialNewlines (text) {
  9523. return text
  9524. .replace(/\u2028/g, '\\u2028')
  9525. .replace(/\u2029/g, '\\u2029')
  9526. }
  9527. /* */
  9528. // these keywords should not appear inside expressions, but operators like
  9529. // typeof, instanceof and in are allowed
  9530. var prohibitedKeywordRE = new RegExp('\\b' + (
  9531. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  9532. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  9533. 'extends,finally,continue,debugger,function,arguments'
  9534. ).split(',').join('\\b|\\b') + '\\b');
  9535. // these unary operators should not be used as property/method names
  9536. var unaryOperatorsRE = new RegExp('\\b' + (
  9537. 'delete,typeof,void'
  9538. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  9539. // strip strings in expressions
  9540. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  9541. // detect problematic expressions in a template
  9542. function detectErrors (ast) {
  9543. var errors = [];
  9544. if (ast) {
  9545. checkNode(ast, errors);
  9546. }
  9547. return errors
  9548. }
  9549. function checkNode (node, errors) {
  9550. if (node.type === 1) {
  9551. for (var name in node.attrsMap) {
  9552. if (dirRE.test(name)) {
  9553. var value = node.attrsMap[name];
  9554. if (value) {
  9555. if (name === 'v-for') {
  9556. checkFor(node, ("v-for=\"" + value + "\""), errors);
  9557. } else if (onRE.test(name)) {
  9558. checkEvent(value, (name + "=\"" + value + "\""), errors);
  9559. } else {
  9560. checkExpression(value, (name + "=\"" + value + "\""), errors);
  9561. }
  9562. }
  9563. }
  9564. }
  9565. if (node.children) {
  9566. for (var i = 0; i < node.children.length; i++) {
  9567. checkNode(node.children[i], errors);
  9568. }
  9569. }
  9570. } else if (node.type === 2) {
  9571. checkExpression(node.expression, node.text, errors);
  9572. }
  9573. }
  9574. function checkEvent (exp, text, errors) {
  9575. var stipped = exp.replace(stripStringRE, '');
  9576. var keywordMatch = stipped.match(unaryOperatorsRE);
  9577. if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
  9578. errors.push(
  9579. "avoid using JavaScript unary operator as property name: " +
  9580. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
  9581. );
  9582. }
  9583. checkExpression(exp, text, errors);
  9584. }
  9585. function checkFor (node, text, errors) {
  9586. checkExpression(node.for || '', text, errors);
  9587. checkIdentifier(node.alias, 'v-for alias', text, errors);
  9588. checkIdentifier(node.iterator1, 'v-for iterator', text, errors);
  9589. checkIdentifier(node.iterator2, 'v-for iterator', text, errors);
  9590. }
  9591. function checkIdentifier (
  9592. ident,
  9593. type,
  9594. text,
  9595. errors
  9596. ) {
  9597. if (typeof ident === 'string') {
  9598. try {
  9599. new Function(("var " + ident + "=_"));
  9600. } catch (e) {
  9601. errors.push(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())));
  9602. }
  9603. }
  9604. }
  9605. function checkExpression (exp, text, errors) {
  9606. try {
  9607. new Function(("return " + exp));
  9608. } catch (e) {
  9609. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  9610. if (keywordMatch) {
  9611. errors.push(
  9612. "avoid using JavaScript keyword as property name: " +
  9613. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim())
  9614. );
  9615. } else {
  9616. errors.push(
  9617. "invalid expression: " + (e.message) + " in\n\n" +
  9618. " " + exp + "\n\n" +
  9619. " Raw expression: " + (text.trim()) + "\n"
  9620. );
  9621. }
  9622. }
  9623. }
  9624. /* */
  9625. function createFunction (code, errors) {
  9626. try {
  9627. return new Function(code)
  9628. } catch (err) {
  9629. errors.push({ err: err, code: code });
  9630. return noop
  9631. }
  9632. }
  9633. function createCompileToFunctionFn (compile) {
  9634. var cache = Object.create(null);
  9635. return function compileToFunctions (
  9636. template,
  9637. options,
  9638. vm
  9639. ) {
  9640. options = extend({}, options);
  9641. var warn$$1 = options.warn || warn;
  9642. delete options.warn;
  9643. /* istanbul ignore if */
  9644. {
  9645. // detect possible CSP restriction
  9646. try {
  9647. new Function('return 1');
  9648. } catch (e) {
  9649. if (e.toString().match(/unsafe-eval|CSP/)) {
  9650. warn$$1(
  9651. 'It seems you are using the standalone build of Vue.js in an ' +
  9652. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  9653. 'The template compiler cannot work in this environment. Consider ' +
  9654. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  9655. 'templates into render functions.'
  9656. );
  9657. }
  9658. }
  9659. }
  9660. // check cache
  9661. var key = options.delimiters
  9662. ? String(options.delimiters) + template
  9663. : template;
  9664. if (cache[key]) {
  9665. return cache[key]
  9666. }
  9667. // compile
  9668. var compiled = compile(template, options);
  9669. // check compilation errors/tips
  9670. {
  9671. if (compiled.errors && compiled.errors.length) {
  9672. warn$$1(
  9673. "Error compiling template:\n\n" + template + "\n\n" +
  9674. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  9675. vm
  9676. );
  9677. }
  9678. if (compiled.tips && compiled.tips.length) {
  9679. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  9680. }
  9681. }
  9682. // turn code into functions
  9683. var res = {};
  9684. var fnGenErrors = [];
  9685. res.render = createFunction(compiled.render, fnGenErrors);
  9686. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  9687. return createFunction(code, fnGenErrors)
  9688. });
  9689. // check function generation errors.
  9690. // this should only happen if there is a bug in the compiler itself.
  9691. // mostly for codegen development use
  9692. /* istanbul ignore if */
  9693. {
  9694. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  9695. warn$$1(
  9696. "Failed to generate render function:\n\n" +
  9697. fnGenErrors.map(function (ref) {
  9698. var err = ref.err;
  9699. var code = ref.code;
  9700. return ((err.toString()) + " in\n\n" + code + "\n");
  9701. }).join('\n'),
  9702. vm
  9703. );
  9704. }
  9705. }
  9706. return (cache[key] = res)
  9707. }
  9708. }
  9709. /* */
  9710. function createCompilerCreator (baseCompile) {
  9711. return function createCompiler (baseOptions) {
  9712. function compile (
  9713. template,
  9714. options
  9715. ) {
  9716. var finalOptions = Object.create(baseOptions);
  9717. var errors = [];
  9718. var tips = [];
  9719. finalOptions.warn = function (msg, tip) {
  9720. (tip ? tips : errors).push(msg);
  9721. };
  9722. if (options) {
  9723. // merge custom modules
  9724. if (options.modules) {
  9725. finalOptions.modules =
  9726. (baseOptions.modules || []).concat(options.modules);
  9727. }
  9728. // merge custom directives
  9729. if (options.directives) {
  9730. finalOptions.directives = extend(
  9731. Object.create(baseOptions.directives || null),
  9732. options.directives
  9733. );
  9734. }
  9735. // copy other options
  9736. for (var key in options) {
  9737. if (key !== 'modules' && key !== 'directives') {
  9738. finalOptions[key] = options[key];
  9739. }
  9740. }
  9741. }
  9742. var compiled = baseCompile(template, finalOptions);
  9743. {
  9744. errors.push.apply(errors, detectErrors(compiled.ast));
  9745. }
  9746. compiled.errors = errors;
  9747. compiled.tips = tips;
  9748. return compiled
  9749. }
  9750. return {
  9751. compile: compile,
  9752. compileToFunctions: createCompileToFunctionFn(compile)
  9753. }
  9754. }
  9755. }
  9756. /* */
  9757. // `createCompilerCreator` allows creating compilers that use alternative
  9758. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  9759. // Here we just export a default compiler using the default parts.
  9760. var createCompiler = createCompilerCreator(function baseCompile (
  9761. template,
  9762. options
  9763. ) {
  9764. var ast = parse(template.trim(), options);
  9765. if (options.optimize !== false) {
  9766. optimize(ast, options);
  9767. }
  9768. var code = generate(ast, options);
  9769. return {
  9770. ast: ast,
  9771. render: code.render,
  9772. staticRenderFns: code.staticRenderFns
  9773. }
  9774. });
  9775. /* */
  9776. var ref$1 = createCompiler(baseOptions);
  9777. var compileToFunctions = ref$1.compileToFunctions;
  9778. /* */
  9779. // check whether current browser encodes a char inside attribute values
  9780. var div;
  9781. function getShouldDecode (href) {
  9782. div = div || document.createElement('div');
  9783. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  9784. return div.innerHTML.indexOf('&#10;') > 0
  9785. }
  9786. // #3663: IE encodes newlines inside attribute values while other browsers don't
  9787. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  9788. // #6828: chrome encodes content in a[href]
  9789. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  9790. /* */
  9791. var idToTemplate = cached(function (id) {
  9792. var el = query(id);
  9793. return el && el.innerHTML
  9794. });
  9795. var mount = Vue.prototype.$mount;
  9796. Vue.prototype.$mount = function (
  9797. el,
  9798. hydrating
  9799. ) {
  9800. el = el && query(el);
  9801. /* istanbul ignore if */
  9802. if (el === document.body || el === document.documentElement) {
  9803. "development" !== 'production' && warn(
  9804. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  9805. );
  9806. return this
  9807. }
  9808. var options = this.$options;
  9809. // resolve template/el and convert to render function
  9810. if (!options.render) {
  9811. var template = options.template;
  9812. if (template) {
  9813. if (typeof template === 'string') {
  9814. if (template.charAt(0) === '#') {
  9815. template = idToTemplate(template);
  9816. /* istanbul ignore if */
  9817. if ("development" !== 'production' && !template) {
  9818. warn(
  9819. ("Template element not found or is empty: " + (options.template)),
  9820. this
  9821. );
  9822. }
  9823. }
  9824. } else if (template.nodeType) {
  9825. template = template.innerHTML;
  9826. } else {
  9827. {
  9828. warn('invalid template option:' + template, this);
  9829. }
  9830. return this
  9831. }
  9832. } else if (el) {
  9833. template = getOuterHTML(el);
  9834. }
  9835. if (template) {
  9836. /* istanbul ignore if */
  9837. if ("development" !== 'production' && config.performance && mark) {
  9838. mark('compile');
  9839. }
  9840. var ref = compileToFunctions(template, {
  9841. shouldDecodeNewlines: shouldDecodeNewlines,
  9842. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  9843. delimiters: options.delimiters,
  9844. comments: options.comments
  9845. }, this);
  9846. var render = ref.render;
  9847. var staticRenderFns = ref.staticRenderFns;
  9848. options.render = render;
  9849. options.staticRenderFns = staticRenderFns;
  9850. /* istanbul ignore if */
  9851. if ("development" !== 'production' && config.performance && mark) {
  9852. mark('compile end');
  9853. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  9854. }
  9855. }
  9856. }
  9857. return mount.call(this, el, hydrating)
  9858. };
  9859. /**
  9860. * Get outerHTML of elements, taking care
  9861. * of SVG elements in IE as well.
  9862. */
  9863. function getOuterHTML (el) {
  9864. if (el.outerHTML) {
  9865. return el.outerHTML
  9866. } else {
  9867. var container = document.createElement('div');
  9868. container.appendChild(el.cloneNode(true));
  9869. return container.innerHTML
  9870. }
  9871. }
  9872. Vue.compile = compileToFunctions;
  9873. return Vue;
  9874. })));