vue.js 260 KB

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