1
0

vue.js 425 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932
  1. /*!
  2. * Vue.js v2.7.16
  3. * (c) 2014-2023 Evan You
  4. * Released under the MIT License.
  5. */
  6. (function (global, factory) {
  7. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  8. typeof define === 'function' && define.amd ? define(factory) :
  9. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Vue = factory());
  10. })(this, (function () { 'use strict';
  11. var emptyObject = Object.freeze({});
  12. var isArray = Array.isArray;
  13. // These helpers produce better VM code in JS engines due to their
  14. // explicitness and function inlining.
  15. function isUndef(v) {
  16. return v === undefined || v === null;
  17. }
  18. function isDef(v) {
  19. return v !== undefined && v !== null;
  20. }
  21. function isTrue(v) {
  22. return v === true;
  23. }
  24. function isFalse(v) {
  25. return v === false;
  26. }
  27. /**
  28. * Check if value is primitive.
  29. */
  30. function isPrimitive(value) {
  31. return (typeof value === 'string' ||
  32. typeof value === 'number' ||
  33. // $flow-disable-line
  34. typeof value === 'symbol' ||
  35. typeof value === 'boolean');
  36. }
  37. function isFunction(value) {
  38. return typeof value === 'function';
  39. }
  40. /**
  41. * Quick object check - this is primarily used to tell
  42. * objects from primitive values when we know the value
  43. * is a JSON-compliant type.
  44. */
  45. function isObject(obj) {
  46. return obj !== null && typeof obj === 'object';
  47. }
  48. /**
  49. * Get the raw type string of a value, e.g., [object Object].
  50. */
  51. var _toString = Object.prototype.toString;
  52. function toRawType(value) {
  53. return _toString.call(value).slice(8, -1);
  54. }
  55. /**
  56. * Strict object type check. Only returns true
  57. * for plain JavaScript objects.
  58. */
  59. function isPlainObject(obj) {
  60. return _toString.call(obj) === '[object Object]';
  61. }
  62. function isRegExp(v) {
  63. return _toString.call(v) === '[object RegExp]';
  64. }
  65. /**
  66. * Check if val is a valid array index.
  67. */
  68. function isValidArrayIndex(val) {
  69. var n = parseFloat(String(val));
  70. return n >= 0 && Math.floor(n) === n && isFinite(val);
  71. }
  72. function isPromise(val) {
  73. return (isDef(val) &&
  74. typeof val.then === 'function' &&
  75. typeof val.catch === 'function');
  76. }
  77. /**
  78. * Convert a value to a string that is actually rendered.
  79. */
  80. function toString(val) {
  81. return val == null
  82. ? ''
  83. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  84. ? JSON.stringify(val, replacer, 2)
  85. : String(val);
  86. }
  87. function replacer(_key, val) {
  88. // avoid circular deps from v3
  89. if (val && val.__v_isRef) {
  90. return val.value;
  91. }
  92. return val;
  93. }
  94. /**
  95. * Convert an input value to a number for persistence.
  96. * If the conversion fails, return original string.
  97. */
  98. function toNumber(val) {
  99. var n = parseFloat(val);
  100. return isNaN(n) ? val : n;
  101. }
  102. /**
  103. * Make a map and return a function for checking if a key
  104. * is in that map.
  105. */
  106. function makeMap(str, expectsLowerCase) {
  107. var map = Object.create(null);
  108. var list = str.split(',');
  109. for (var i = 0; i < list.length; i++) {
  110. map[list[i]] = true;
  111. }
  112. return expectsLowerCase ? function (val) { return map[val.toLowerCase()]; } : function (val) { return map[val]; };
  113. }
  114. /**
  115. * Check if a tag is a built-in tag.
  116. */
  117. var isBuiltInTag = makeMap('slot,component', true);
  118. /**
  119. * Check if an attribute is a reserved attribute.
  120. */
  121. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  122. /**
  123. * Remove an item from an array.
  124. */
  125. function remove$2(arr, item) {
  126. var len = arr.length;
  127. if (len) {
  128. // fast path for the only / last item
  129. if (item === arr[len - 1]) {
  130. arr.length = len - 1;
  131. return;
  132. }
  133. var index = arr.indexOf(item);
  134. if (index > -1) {
  135. return arr.splice(index, 1);
  136. }
  137. }
  138. }
  139. /**
  140. * Check whether an object has the property.
  141. */
  142. var hasOwnProperty = Object.prototype.hasOwnProperty;
  143. function hasOwn(obj, key) {
  144. return hasOwnProperty.call(obj, key);
  145. }
  146. /**
  147. * Create a cached version of a pure function.
  148. */
  149. function cached(fn) {
  150. var cache = Object.create(null);
  151. return function cachedFn(str) {
  152. var hit = cache[str];
  153. return hit || (cache[str] = fn(str));
  154. };
  155. }
  156. /**
  157. * Camelize a hyphen-delimited string.
  158. */
  159. var camelizeRE = /-(\w)/g;
  160. var camelize = cached(function (str) {
  161. return str.replace(camelizeRE, function (_, c) { return (c ? c.toUpperCase() : ''); });
  162. });
  163. /**
  164. * Capitalize a string.
  165. */
  166. var capitalize = cached(function (str) {
  167. return str.charAt(0).toUpperCase() + str.slice(1);
  168. });
  169. /**
  170. * Hyphenate a camelCase string.
  171. */
  172. var hyphenateRE = /\B([A-Z])/g;
  173. var hyphenate = cached(function (str) {
  174. return str.replace(hyphenateRE, '-$1').toLowerCase();
  175. });
  176. /**
  177. * Simple bind polyfill for environments that do not support it,
  178. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  179. * since native bind is now performant enough in most browsers.
  180. * But removing it would mean breaking code that was able to run in
  181. * PhantomJS 1.x, so this must be kept for backward compatibility.
  182. */
  183. /* istanbul ignore next */
  184. function polyfillBind(fn, ctx) {
  185. function boundFn(a) {
  186. var l = arguments.length;
  187. return l
  188. ? l > 1
  189. ? fn.apply(ctx, arguments)
  190. : fn.call(ctx, a)
  191. : fn.call(ctx);
  192. }
  193. boundFn._length = fn.length;
  194. return boundFn;
  195. }
  196. function nativeBind(fn, ctx) {
  197. return fn.bind(ctx);
  198. }
  199. // @ts-expect-error bind cannot be `undefined`
  200. var bind$1 = Function.prototype.bind ? nativeBind : polyfillBind;
  201. /**
  202. * Convert an Array-like object to a real Array.
  203. */
  204. function toArray(list, start) {
  205. start = start || 0;
  206. var i = list.length - start;
  207. var ret = new Array(i);
  208. while (i--) {
  209. ret[i] = list[i + start];
  210. }
  211. return ret;
  212. }
  213. /**
  214. * Mix properties into target object.
  215. */
  216. function extend(to, _from) {
  217. for (var key in _from) {
  218. to[key] = _from[key];
  219. }
  220. return to;
  221. }
  222. /**
  223. * Merge an Array of Objects into a single Object.
  224. */
  225. function toObject(arr) {
  226. var res = {};
  227. for (var i = 0; i < arr.length; i++) {
  228. if (arr[i]) {
  229. extend(res, arr[i]);
  230. }
  231. }
  232. return res;
  233. }
  234. /* eslint-disable no-unused-vars */
  235. /**
  236. * Perform no operation.
  237. * Stubbing args to make Flow happy without leaving useless transpiled code
  238. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  239. */
  240. function noop(a, b, c) { }
  241. /**
  242. * Always return false.
  243. */
  244. var no = function (a, b, c) { return false; };
  245. /* eslint-enable no-unused-vars */
  246. /**
  247. * Return the same value.
  248. */
  249. var identity = function (_) { return _; };
  250. /**
  251. * Generate a string containing static keys from compiler modules.
  252. */
  253. function genStaticKeys$1(modules) {
  254. return modules
  255. .reduce(function (keys, m) { return keys.concat(m.staticKeys || []); }, [])
  256. .join(',');
  257. }
  258. /**
  259. * Check if two values are loosely equal - that is,
  260. * if they are plain objects, do they have the same shape?
  261. */
  262. function looseEqual(a, b) {
  263. if (a === b)
  264. return true;
  265. var isObjectA = isObject(a);
  266. var isObjectB = isObject(b);
  267. if (isObjectA && isObjectB) {
  268. try {
  269. var isArrayA = Array.isArray(a);
  270. var isArrayB = Array.isArray(b);
  271. if (isArrayA && isArrayB) {
  272. return (a.length === b.length &&
  273. a.every(function (e, i) {
  274. return looseEqual(e, b[i]);
  275. }));
  276. }
  277. else if (a instanceof Date && b instanceof Date) {
  278. return a.getTime() === b.getTime();
  279. }
  280. else if (!isArrayA && !isArrayB) {
  281. var keysA = Object.keys(a);
  282. var keysB = Object.keys(b);
  283. return (keysA.length === keysB.length &&
  284. keysA.every(function (key) {
  285. return looseEqual(a[key], b[key]);
  286. }));
  287. }
  288. else {
  289. /* istanbul ignore next */
  290. return false;
  291. }
  292. }
  293. catch (e) {
  294. /* istanbul ignore next */
  295. return false;
  296. }
  297. }
  298. else if (!isObjectA && !isObjectB) {
  299. return String(a) === String(b);
  300. }
  301. else {
  302. return false;
  303. }
  304. }
  305. /**
  306. * Return the first index at which a loosely equal value can be
  307. * found in the array (if value is a plain object, the array must
  308. * contain an object of the same shape), or -1 if it is not present.
  309. */
  310. function looseIndexOf(arr, val) {
  311. for (var i = 0; i < arr.length; i++) {
  312. if (looseEqual(arr[i], val))
  313. return i;
  314. }
  315. return -1;
  316. }
  317. /**
  318. * Ensure a function is called only once.
  319. */
  320. function once(fn) {
  321. var called = false;
  322. return function () {
  323. if (!called) {
  324. called = true;
  325. fn.apply(this, arguments);
  326. }
  327. };
  328. }
  329. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is#polyfill
  330. function hasChanged(x, y) {
  331. if (x === y) {
  332. return x === 0 && 1 / x !== 1 / y;
  333. }
  334. else {
  335. return x === x || y === y;
  336. }
  337. }
  338. var SSR_ATTR = 'data-server-rendered';
  339. var ASSET_TYPES = ['component', 'directive', 'filter'];
  340. var LIFECYCLE_HOOKS = [
  341. 'beforeCreate',
  342. 'created',
  343. 'beforeMount',
  344. 'mounted',
  345. 'beforeUpdate',
  346. 'updated',
  347. 'beforeDestroy',
  348. 'destroyed',
  349. 'activated',
  350. 'deactivated',
  351. 'errorCaptured',
  352. 'serverPrefetch',
  353. 'renderTracked',
  354. 'renderTriggered'
  355. ];
  356. var config = {
  357. /**
  358. * Option merge strategies (used in core/util/options)
  359. */
  360. // $flow-disable-line
  361. optionMergeStrategies: Object.create(null),
  362. /**
  363. * Whether to suppress warnings.
  364. */
  365. silent: false,
  366. /**
  367. * Show production mode tip message on boot?
  368. */
  369. productionTip: true,
  370. /**
  371. * Whether to enable devtools
  372. */
  373. devtools: true,
  374. /**
  375. * Whether to record perf
  376. */
  377. performance: false,
  378. /**
  379. * Error handler for watcher errors
  380. */
  381. errorHandler: null,
  382. /**
  383. * Warn handler for watcher warns
  384. */
  385. warnHandler: null,
  386. /**
  387. * Ignore certain custom elements
  388. */
  389. ignoredElements: [],
  390. /**
  391. * Custom user key aliases for v-on
  392. */
  393. // $flow-disable-line
  394. keyCodes: Object.create(null),
  395. /**
  396. * Check if a tag is reserved so that it cannot be registered as a
  397. * component. This is platform-dependent and may be overwritten.
  398. */
  399. isReservedTag: no,
  400. /**
  401. * Check if an attribute is reserved so that it cannot be used as a component
  402. * prop. This is platform-dependent and may be overwritten.
  403. */
  404. isReservedAttr: no,
  405. /**
  406. * Check if a tag is an unknown element.
  407. * Platform-dependent.
  408. */
  409. isUnknownElement: no,
  410. /**
  411. * Get the namespace of an element
  412. */
  413. getTagNamespace: noop,
  414. /**
  415. * Parse the real tag name for the specific platform.
  416. */
  417. parsePlatformTagName: identity,
  418. /**
  419. * Check if an attribute must be bound using property, e.g. value
  420. * Platform-dependent.
  421. */
  422. mustUseProp: no,
  423. /**
  424. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  425. * This will significantly reduce performance if set to false.
  426. */
  427. async: true,
  428. /**
  429. * Exposed for legacy reasons
  430. */
  431. _lifecycleHooks: LIFECYCLE_HOOKS
  432. };
  433. /**
  434. * unicode letters used for parsing html tags, component names and property paths.
  435. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  436. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  437. */
  438. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  439. /**
  440. * Check if a string starts with $ or _
  441. */
  442. function isReserved(str) {
  443. var c = (str + '').charCodeAt(0);
  444. return c === 0x24 || c === 0x5f;
  445. }
  446. /**
  447. * Define a property.
  448. */
  449. function def(obj, key, val, enumerable) {
  450. Object.defineProperty(obj, key, {
  451. value: val,
  452. enumerable: !!enumerable,
  453. writable: true,
  454. configurable: true
  455. });
  456. }
  457. /**
  458. * Parse simple path.
  459. */
  460. var bailRE = new RegExp("[^".concat(unicodeRegExp.source, ".$_\\d]"));
  461. function parsePath(path) {
  462. if (bailRE.test(path)) {
  463. return;
  464. }
  465. var segments = path.split('.');
  466. return function (obj) {
  467. for (var i = 0; i < segments.length; i++) {
  468. if (!obj)
  469. return;
  470. obj = obj[segments[i]];
  471. }
  472. return obj;
  473. };
  474. }
  475. // can we use __proto__?
  476. var hasProto = '__proto__' in {};
  477. // Browser environment sniffing
  478. var inBrowser = typeof window !== 'undefined';
  479. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  480. var isIE = UA && /msie|trident/.test(UA);
  481. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  482. var isEdge = UA && UA.indexOf('edge/') > 0;
  483. UA && UA.indexOf('android') > 0;
  484. var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
  485. UA && /chrome\/\d+/.test(UA) && !isEdge;
  486. UA && /phantomjs/.test(UA);
  487. var isFF = UA && UA.match(/firefox\/(\d+)/);
  488. // Firefox has a "watch" function on Object.prototype...
  489. // @ts-expect-error firebox support
  490. var nativeWatch = {}.watch;
  491. var supportsPassive = false;
  492. if (inBrowser) {
  493. try {
  494. var opts = {};
  495. Object.defineProperty(opts, 'passive', {
  496. get: function () {
  497. /* istanbul ignore next */
  498. supportsPassive = true;
  499. }
  500. }); // https://github.com/facebook/flow/issues/285
  501. window.addEventListener('test-passive', null, opts);
  502. }
  503. catch (e) { }
  504. }
  505. // this needs to be lazy-evaled because vue may be required before
  506. // vue-server-renderer can set VUE_ENV
  507. var _isServer;
  508. var isServerRendering = function () {
  509. if (_isServer === undefined) {
  510. /* istanbul ignore if */
  511. if (!inBrowser && typeof global !== 'undefined') {
  512. // detect presence of vue-server-renderer and avoid
  513. // Webpack shimming the process
  514. _isServer =
  515. global['process'] && global['process'].env.VUE_ENV === 'server';
  516. }
  517. else {
  518. _isServer = false;
  519. }
  520. }
  521. return _isServer;
  522. };
  523. // detect devtools
  524. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  525. /* istanbul ignore next */
  526. function isNative(Ctor) {
  527. return typeof Ctor === 'function' && /native code/.test(Ctor.toString());
  528. }
  529. var hasSymbol = typeof Symbol !== 'undefined' &&
  530. isNative(Symbol) &&
  531. typeof Reflect !== 'undefined' &&
  532. isNative(Reflect.ownKeys);
  533. var _Set; // $flow-disable-line
  534. /* istanbul ignore if */ if (typeof Set !== 'undefined' && isNative(Set)) {
  535. // use native Set when available.
  536. _Set = Set;
  537. }
  538. else {
  539. // a non-standard Set polyfill that only works with primitive keys.
  540. _Set = /** @class */ (function () {
  541. function Set() {
  542. this.set = Object.create(null);
  543. }
  544. Set.prototype.has = function (key) {
  545. return this.set[key] === true;
  546. };
  547. Set.prototype.add = function (key) {
  548. this.set[key] = true;
  549. };
  550. Set.prototype.clear = function () {
  551. this.set = Object.create(null);
  552. };
  553. return Set;
  554. }());
  555. }
  556. var currentInstance = null;
  557. /**
  558. * This is exposed for compatibility with v3 (e.g. some functions in VueUse
  559. * relies on it). Do not use this internally, just use `currentInstance`.
  560. *
  561. * @internal this function needs manual type declaration because it relies
  562. * on previously manually authored types from Vue 2
  563. */
  564. function getCurrentInstance() {
  565. return currentInstance && { proxy: currentInstance };
  566. }
  567. /**
  568. * @internal
  569. */
  570. function setCurrentInstance(vm) {
  571. if (vm === void 0) { vm = null; }
  572. if (!vm)
  573. currentInstance && currentInstance._scope.off();
  574. currentInstance = vm;
  575. vm && vm._scope.on();
  576. }
  577. /**
  578. * @internal
  579. */
  580. var VNode = /** @class */ (function () {
  581. function VNode(tag, data, children, text, elm, context, componentOptions, asyncFactory) {
  582. this.tag = tag;
  583. this.data = data;
  584. this.children = children;
  585. this.text = text;
  586. this.elm = elm;
  587. this.ns = undefined;
  588. this.context = context;
  589. this.fnContext = undefined;
  590. this.fnOptions = undefined;
  591. this.fnScopeId = undefined;
  592. this.key = data && data.key;
  593. this.componentOptions = componentOptions;
  594. this.componentInstance = undefined;
  595. this.parent = undefined;
  596. this.raw = false;
  597. this.isStatic = false;
  598. this.isRootInsert = true;
  599. this.isComment = false;
  600. this.isCloned = false;
  601. this.isOnce = false;
  602. this.asyncFactory = asyncFactory;
  603. this.asyncMeta = undefined;
  604. this.isAsyncPlaceholder = false;
  605. }
  606. Object.defineProperty(VNode.prototype, "child", {
  607. // DEPRECATED: alias for componentInstance for backwards compat.
  608. /* istanbul ignore next */
  609. get: function () {
  610. return this.componentInstance;
  611. },
  612. enumerable: false,
  613. configurable: true
  614. });
  615. return VNode;
  616. }());
  617. var createEmptyVNode = function (text) {
  618. if (text === void 0) { text = ''; }
  619. var node = new VNode();
  620. node.text = text;
  621. node.isComment = true;
  622. return node;
  623. };
  624. function createTextVNode(val) {
  625. return new VNode(undefined, undefined, undefined, String(val));
  626. }
  627. // optimized shallow clone
  628. // used for static nodes and slot nodes because they may be reused across
  629. // multiple renders, cloning them avoids errors when DOM manipulations rely
  630. // on their elm reference.
  631. function cloneVNode(vnode) {
  632. var cloned = new VNode(vnode.tag, vnode.data,
  633. // #7975
  634. // clone children array to avoid mutating original in case of cloning
  635. // a child.
  636. vnode.children && vnode.children.slice(), vnode.text, vnode.elm, vnode.context, vnode.componentOptions, vnode.asyncFactory);
  637. cloned.ns = vnode.ns;
  638. cloned.isStatic = vnode.isStatic;
  639. cloned.key = vnode.key;
  640. cloned.isComment = vnode.isComment;
  641. cloned.fnContext = vnode.fnContext;
  642. cloned.fnOptions = vnode.fnOptions;
  643. cloned.fnScopeId = vnode.fnScopeId;
  644. cloned.asyncMeta = vnode.asyncMeta;
  645. cloned.isCloned = true;
  646. return cloned;
  647. }
  648. /* not type checking this file because flow doesn't play well with Proxy */
  649. var initProxy;
  650. {
  651. var allowedGlobals_1 = makeMap('Infinity,undefined,NaN,isFinite,isNaN,' +
  652. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  653. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' +
  654. 'require' // for Webpack/Browserify
  655. );
  656. var warnNonPresent_1 = function (target, key) {
  657. warn$2("Property or method \"".concat(key, "\" is not defined on the instance but ") +
  658. 'referenced during render. Make sure that this property is reactive, ' +
  659. 'either in the data option, or for class-based components, by ' +
  660. 'initializing the property. ' +
  661. 'See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', target);
  662. };
  663. var warnReservedPrefix_1 = function (target, key) {
  664. warn$2("Property \"".concat(key, "\" must be accessed with \"$data.").concat(key, "\" because ") +
  665. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  666. 'prevent conflicts with Vue internals. ' +
  667. 'See: https://v2.vuejs.org/v2/api/#data', target);
  668. };
  669. var hasProxy_1 = typeof Proxy !== 'undefined' && isNative(Proxy);
  670. if (hasProxy_1) {
  671. var isBuiltInModifier_1 = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  672. config.keyCodes = new Proxy(config.keyCodes, {
  673. set: function (target, key, value) {
  674. if (isBuiltInModifier_1(key)) {
  675. warn$2("Avoid overwriting built-in modifier in config.keyCodes: .".concat(key));
  676. return false;
  677. }
  678. else {
  679. target[key] = value;
  680. return true;
  681. }
  682. }
  683. });
  684. }
  685. var hasHandler_1 = {
  686. has: function (target, key) {
  687. var has = key in target;
  688. var isAllowed = allowedGlobals_1(key) ||
  689. (typeof key === 'string' &&
  690. key.charAt(0) === '_' &&
  691. !(key in target.$data));
  692. if (!has && !isAllowed) {
  693. if (key in target.$data)
  694. warnReservedPrefix_1(target, key);
  695. else
  696. warnNonPresent_1(target, key);
  697. }
  698. return has || !isAllowed;
  699. }
  700. };
  701. var getHandler_1 = {
  702. get: function (target, key) {
  703. if (typeof key === 'string' && !(key in target)) {
  704. if (key in target.$data)
  705. warnReservedPrefix_1(target, key);
  706. else
  707. warnNonPresent_1(target, key);
  708. }
  709. return target[key];
  710. }
  711. };
  712. initProxy = function initProxy(vm) {
  713. if (hasProxy_1) {
  714. // determine which proxy handler to use
  715. var options = vm.$options;
  716. var handlers = options.render && options.render._withStripped ? getHandler_1 : hasHandler_1;
  717. vm._renderProxy = new Proxy(vm, handlers);
  718. }
  719. else {
  720. vm._renderProxy = vm;
  721. }
  722. };
  723. }
  724. /******************************************************************************
  725. Copyright (c) Microsoft Corporation.
  726. Permission to use, copy, modify, and/or distribute this software for any
  727. purpose with or without fee is hereby granted.
  728. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  729. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  730. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  731. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  732. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  733. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  734. PERFORMANCE OF THIS SOFTWARE.
  735. ***************************************************************************** */
  736. var __assign = function() {
  737. __assign = Object.assign || function __assign(t) {
  738. for (var s, i = 1, n = arguments.length; i < n; i++) {
  739. s = arguments[i];
  740. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  741. }
  742. return t;
  743. };
  744. return __assign.apply(this, arguments);
  745. };
  746. typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
  747. var e = new Error(message);
  748. return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
  749. };
  750. var uid$2 = 0;
  751. var pendingCleanupDeps = [];
  752. var cleanupDeps = function () {
  753. for (var i = 0; i < pendingCleanupDeps.length; i++) {
  754. var dep = pendingCleanupDeps[i];
  755. dep.subs = dep.subs.filter(function (s) { return s; });
  756. dep._pending = false;
  757. }
  758. pendingCleanupDeps.length = 0;
  759. };
  760. /**
  761. * A dep is an observable that can have multiple
  762. * directives subscribing to it.
  763. * @internal
  764. */
  765. var Dep = /** @class */ (function () {
  766. function Dep() {
  767. // pending subs cleanup
  768. this._pending = false;
  769. this.id = uid$2++;
  770. this.subs = [];
  771. }
  772. Dep.prototype.addSub = function (sub) {
  773. this.subs.push(sub);
  774. };
  775. Dep.prototype.removeSub = function (sub) {
  776. // #12696 deps with massive amount of subscribers are extremely slow to
  777. // clean up in Chromium
  778. // to workaround this, we unset the sub for now, and clear them on
  779. // next scheduler flush.
  780. this.subs[this.subs.indexOf(sub)] = null;
  781. if (!this._pending) {
  782. this._pending = true;
  783. pendingCleanupDeps.push(this);
  784. }
  785. };
  786. Dep.prototype.depend = function (info) {
  787. if (Dep.target) {
  788. Dep.target.addDep(this);
  789. if (info && Dep.target.onTrack) {
  790. Dep.target.onTrack(__assign({ effect: Dep.target }, info));
  791. }
  792. }
  793. };
  794. Dep.prototype.notify = function (info) {
  795. // stabilize the subscriber list first
  796. var subs = this.subs.filter(function (s) { return s; });
  797. if (!config.async) {
  798. // subs aren't sorted in scheduler if not running async
  799. // we need to sort them now to make sure they fire in correct
  800. // order
  801. subs.sort(function (a, b) { return a.id - b.id; });
  802. }
  803. for (var i = 0, l = subs.length; i < l; i++) {
  804. var sub = subs[i];
  805. if (info) {
  806. sub.onTrigger &&
  807. sub.onTrigger(__assign({ effect: subs[i] }, info));
  808. }
  809. sub.update();
  810. }
  811. };
  812. return Dep;
  813. }());
  814. // The current target watcher being evaluated.
  815. // This is globally unique because only one watcher
  816. // can be evaluated at a time.
  817. Dep.target = null;
  818. var targetStack = [];
  819. function pushTarget(target) {
  820. targetStack.push(target);
  821. Dep.target = target;
  822. }
  823. function popTarget() {
  824. targetStack.pop();
  825. Dep.target = targetStack[targetStack.length - 1];
  826. }
  827. /*
  828. * not type checking this file because flow doesn't play well with
  829. * dynamically accessing methods on Array prototype
  830. */
  831. var arrayProto = Array.prototype;
  832. var arrayMethods = Object.create(arrayProto);
  833. var methodsToPatch = [
  834. 'push',
  835. 'pop',
  836. 'shift',
  837. 'unshift',
  838. 'splice',
  839. 'sort',
  840. 'reverse'
  841. ];
  842. /**
  843. * Intercept mutating methods and emit events
  844. */
  845. methodsToPatch.forEach(function (method) {
  846. // cache original method
  847. var original = arrayProto[method];
  848. def(arrayMethods, method, function mutator() {
  849. var args = [];
  850. for (var _i = 0; _i < arguments.length; _i++) {
  851. args[_i] = arguments[_i];
  852. }
  853. var result = original.apply(this, args);
  854. var ob = this.__ob__;
  855. var inserted;
  856. switch (method) {
  857. case 'push':
  858. case 'unshift':
  859. inserted = args;
  860. break;
  861. case 'splice':
  862. inserted = args.slice(2);
  863. break;
  864. }
  865. if (inserted)
  866. ob.observeArray(inserted);
  867. // notify change
  868. {
  869. ob.dep.notify({
  870. type: "array mutation" /* TriggerOpTypes.ARRAY_MUTATION */,
  871. target: this,
  872. key: method
  873. });
  874. }
  875. return result;
  876. });
  877. });
  878. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  879. var NO_INITIAL_VALUE = {};
  880. /**
  881. * In some cases we may want to disable observation inside a component's
  882. * update computation.
  883. */
  884. var shouldObserve = true;
  885. function toggleObserving(value) {
  886. shouldObserve = value;
  887. }
  888. // ssr mock dep
  889. var mockDep = {
  890. notify: noop,
  891. depend: noop,
  892. addSub: noop,
  893. removeSub: noop
  894. };
  895. /**
  896. * Observer class that is attached to each observed
  897. * object. Once attached, the observer converts the target
  898. * object's property keys into getter/setters that
  899. * collect dependencies and dispatch updates.
  900. */
  901. var Observer = /** @class */ (function () {
  902. function Observer(value, shallow, mock) {
  903. if (shallow === void 0) { shallow = false; }
  904. if (mock === void 0) { mock = false; }
  905. this.value = value;
  906. this.shallow = shallow;
  907. this.mock = mock;
  908. // this.value = value
  909. this.dep = mock ? mockDep : new Dep();
  910. this.vmCount = 0;
  911. def(value, '__ob__', this);
  912. if (isArray(value)) {
  913. if (!mock) {
  914. if (hasProto) {
  915. value.__proto__ = arrayMethods;
  916. /* eslint-enable no-proto */
  917. }
  918. else {
  919. for (var i = 0, l = arrayKeys.length; i < l; i++) {
  920. var key = arrayKeys[i];
  921. def(value, key, arrayMethods[key]);
  922. }
  923. }
  924. }
  925. if (!shallow) {
  926. this.observeArray(value);
  927. }
  928. }
  929. else {
  930. /**
  931. * Walk through all properties and convert them into
  932. * getter/setters. This method should only be called when
  933. * value type is Object.
  934. */
  935. var keys = Object.keys(value);
  936. for (var i = 0; i < keys.length; i++) {
  937. var key = keys[i];
  938. defineReactive(value, key, NO_INITIAL_VALUE, undefined, shallow, mock);
  939. }
  940. }
  941. }
  942. /**
  943. * Observe a list of Array items.
  944. */
  945. Observer.prototype.observeArray = function (value) {
  946. for (var i = 0, l = value.length; i < l; i++) {
  947. observe(value[i], false, this.mock);
  948. }
  949. };
  950. return Observer;
  951. }());
  952. // helpers
  953. /**
  954. * Attempt to create an observer instance for a value,
  955. * returns the new observer if successfully observed,
  956. * or the existing observer if the value already has one.
  957. */
  958. function observe(value, shallow, ssrMockReactivity) {
  959. if (value && hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  960. return value.__ob__;
  961. }
  962. if (shouldObserve &&
  963. (ssrMockReactivity || !isServerRendering()) &&
  964. (isArray(value) || isPlainObject(value)) &&
  965. Object.isExtensible(value) &&
  966. !value.__v_skip /* ReactiveFlags.SKIP */ &&
  967. !isRef(value) &&
  968. !(value instanceof VNode)) {
  969. return new Observer(value, shallow, ssrMockReactivity);
  970. }
  971. }
  972. /**
  973. * Define a reactive property on an Object.
  974. */
  975. function defineReactive(obj, key, val, customSetter, shallow, mock, observeEvenIfShallow) {
  976. if (observeEvenIfShallow === void 0) { observeEvenIfShallow = false; }
  977. var dep = new Dep();
  978. var property = Object.getOwnPropertyDescriptor(obj, key);
  979. if (property && property.configurable === false) {
  980. return;
  981. }
  982. // cater for pre-defined getter/setters
  983. var getter = property && property.get;
  984. var setter = property && property.set;
  985. if ((!getter || setter) &&
  986. (val === NO_INITIAL_VALUE || arguments.length === 2)) {
  987. val = obj[key];
  988. }
  989. var childOb = shallow ? val && val.__ob__ : observe(val, false, mock);
  990. Object.defineProperty(obj, key, {
  991. enumerable: true,
  992. configurable: true,
  993. get: function reactiveGetter() {
  994. var value = getter ? getter.call(obj) : val;
  995. if (Dep.target) {
  996. {
  997. dep.depend({
  998. target: obj,
  999. type: "get" /* TrackOpTypes.GET */,
  1000. key: key
  1001. });
  1002. }
  1003. if (childOb) {
  1004. childOb.dep.depend();
  1005. if (isArray(value)) {
  1006. dependArray(value);
  1007. }
  1008. }
  1009. }
  1010. return isRef(value) && !shallow ? value.value : value;
  1011. },
  1012. set: function reactiveSetter(newVal) {
  1013. var value = getter ? getter.call(obj) : val;
  1014. if (!hasChanged(value, newVal)) {
  1015. return;
  1016. }
  1017. if (customSetter) {
  1018. customSetter();
  1019. }
  1020. if (setter) {
  1021. setter.call(obj, newVal);
  1022. }
  1023. else if (getter) {
  1024. // #7981: for accessor properties without setter
  1025. return;
  1026. }
  1027. else if (!shallow && isRef(value) && !isRef(newVal)) {
  1028. value.value = newVal;
  1029. return;
  1030. }
  1031. else {
  1032. val = newVal;
  1033. }
  1034. childOb = shallow ? newVal && newVal.__ob__ : observe(newVal, false, mock);
  1035. {
  1036. dep.notify({
  1037. type: "set" /* TriggerOpTypes.SET */,
  1038. target: obj,
  1039. key: key,
  1040. newValue: newVal,
  1041. oldValue: value
  1042. });
  1043. }
  1044. }
  1045. });
  1046. return dep;
  1047. }
  1048. function set(target, key, val) {
  1049. if ((isUndef(target) || isPrimitive(target))) {
  1050. warn$2("Cannot set reactive property on undefined, null, or primitive value: ".concat(target));
  1051. }
  1052. if (isReadonly(target)) {
  1053. warn$2("Set operation on key \"".concat(key, "\" failed: target is readonly."));
  1054. return;
  1055. }
  1056. var ob = target.__ob__;
  1057. if (isArray(target) && isValidArrayIndex(key)) {
  1058. target.length = Math.max(target.length, key);
  1059. target.splice(key, 1, val);
  1060. // when mocking for SSR, array methods are not hijacked
  1061. if (ob && !ob.shallow && ob.mock) {
  1062. observe(val, false, true);
  1063. }
  1064. return val;
  1065. }
  1066. if (key in target && !(key in Object.prototype)) {
  1067. target[key] = val;
  1068. return val;
  1069. }
  1070. if (target._isVue || (ob && ob.vmCount)) {
  1071. warn$2('Avoid adding reactive properties to a Vue instance or its root $data ' +
  1072. 'at runtime - declare it upfront in the data option.');
  1073. return val;
  1074. }
  1075. if (!ob) {
  1076. target[key] = val;
  1077. return val;
  1078. }
  1079. defineReactive(ob.value, key, val, undefined, ob.shallow, ob.mock);
  1080. {
  1081. ob.dep.notify({
  1082. type: "add" /* TriggerOpTypes.ADD */,
  1083. target: target,
  1084. key: key,
  1085. newValue: val,
  1086. oldValue: undefined
  1087. });
  1088. }
  1089. return val;
  1090. }
  1091. function del(target, key) {
  1092. if ((isUndef(target) || isPrimitive(target))) {
  1093. warn$2("Cannot delete reactive property on undefined, null, or primitive value: ".concat(target));
  1094. }
  1095. if (isArray(target) && isValidArrayIndex(key)) {
  1096. target.splice(key, 1);
  1097. return;
  1098. }
  1099. var ob = target.__ob__;
  1100. if (target._isVue || (ob && ob.vmCount)) {
  1101. warn$2('Avoid deleting properties on a Vue instance or its root $data ' +
  1102. '- just set it to null.');
  1103. return;
  1104. }
  1105. if (isReadonly(target)) {
  1106. warn$2("Delete operation on key \"".concat(key, "\" failed: target is readonly."));
  1107. return;
  1108. }
  1109. if (!hasOwn(target, key)) {
  1110. return;
  1111. }
  1112. delete target[key];
  1113. if (!ob) {
  1114. return;
  1115. }
  1116. {
  1117. ob.dep.notify({
  1118. type: "delete" /* TriggerOpTypes.DELETE */,
  1119. target: target,
  1120. key: key
  1121. });
  1122. }
  1123. }
  1124. /**
  1125. * Collect dependencies on array elements when the array is touched, since
  1126. * we cannot intercept array element access like property getters.
  1127. */
  1128. function dependArray(value) {
  1129. for (var e = void 0, i = 0, l = value.length; i < l; i++) {
  1130. e = value[i];
  1131. if (e && e.__ob__) {
  1132. e.__ob__.dep.depend();
  1133. }
  1134. if (isArray(e)) {
  1135. dependArray(e);
  1136. }
  1137. }
  1138. }
  1139. function reactive(target) {
  1140. makeReactive(target, false);
  1141. return target;
  1142. }
  1143. /**
  1144. * Return a shallowly-reactive copy of the original object, where only the root
  1145. * level properties are reactive. It also does not auto-unwrap refs (even at the
  1146. * root level).
  1147. */
  1148. function shallowReactive(target) {
  1149. makeReactive(target, true);
  1150. def(target, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true);
  1151. return target;
  1152. }
  1153. function makeReactive(target, shallow) {
  1154. // if trying to observe a readonly proxy, return the readonly version.
  1155. if (!isReadonly(target)) {
  1156. {
  1157. if (isArray(target)) {
  1158. warn$2("Avoid using Array as root value for ".concat(shallow ? "shallowReactive()" : "reactive()", " as it cannot be tracked in watch() or watchEffect(). Use ").concat(shallow ? "shallowRef()" : "ref()", " instead. This is a Vue-2-only limitation."));
  1159. }
  1160. var existingOb = target && target.__ob__;
  1161. if (existingOb && existingOb.shallow !== shallow) {
  1162. warn$2("Target is already a ".concat(existingOb.shallow ? "" : "non-", "shallow reactive object, and cannot be converted to ").concat(shallow ? "" : "non-", "shallow."));
  1163. }
  1164. }
  1165. var ob = observe(target, shallow, isServerRendering() /* ssr mock reactivity */);
  1166. if (!ob) {
  1167. if (target == null || isPrimitive(target)) {
  1168. warn$2("value cannot be made reactive: ".concat(String(target)));
  1169. }
  1170. if (isCollectionType(target)) {
  1171. warn$2("Vue 2 does not support reactive collection types such as Map or Set.");
  1172. }
  1173. }
  1174. }
  1175. }
  1176. function isReactive(value) {
  1177. if (isReadonly(value)) {
  1178. return isReactive(value["__v_raw" /* ReactiveFlags.RAW */]);
  1179. }
  1180. return !!(value && value.__ob__);
  1181. }
  1182. function isShallow(value) {
  1183. return !!(value && value.__v_isShallow);
  1184. }
  1185. function isReadonly(value) {
  1186. return !!(value && value.__v_isReadonly);
  1187. }
  1188. function isProxy(value) {
  1189. return isReactive(value) || isReadonly(value);
  1190. }
  1191. function toRaw(observed) {
  1192. var raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */];
  1193. return raw ? toRaw(raw) : observed;
  1194. }
  1195. function markRaw(value) {
  1196. // non-extensible objects won't be observed anyway
  1197. if (Object.isExtensible(value)) {
  1198. def(value, "__v_skip" /* ReactiveFlags.SKIP */, true);
  1199. }
  1200. return value;
  1201. }
  1202. /**
  1203. * @internal
  1204. */
  1205. function isCollectionType(value) {
  1206. var type = toRawType(value);
  1207. return (type === 'Map' || type === 'WeakMap' || type === 'Set' || type === 'WeakSet');
  1208. }
  1209. /**
  1210. * @internal
  1211. */
  1212. var RefFlag = "__v_isRef";
  1213. function isRef(r) {
  1214. return !!(r && r.__v_isRef === true);
  1215. }
  1216. function ref$1(value) {
  1217. return createRef(value, false);
  1218. }
  1219. function shallowRef(value) {
  1220. return createRef(value, true);
  1221. }
  1222. function createRef(rawValue, shallow) {
  1223. if (isRef(rawValue)) {
  1224. return rawValue;
  1225. }
  1226. var ref = {};
  1227. def(ref, RefFlag, true);
  1228. def(ref, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, shallow);
  1229. def(ref, 'dep', defineReactive(ref, 'value', rawValue, null, shallow, isServerRendering()));
  1230. return ref;
  1231. }
  1232. function triggerRef(ref) {
  1233. if (!ref.dep) {
  1234. warn$2("received object is not a triggerable ref.");
  1235. }
  1236. {
  1237. ref.dep &&
  1238. ref.dep.notify({
  1239. type: "set" /* TriggerOpTypes.SET */,
  1240. target: ref,
  1241. key: 'value'
  1242. });
  1243. }
  1244. }
  1245. function unref(ref) {
  1246. return isRef(ref) ? ref.value : ref;
  1247. }
  1248. function proxyRefs(objectWithRefs) {
  1249. if (isReactive(objectWithRefs)) {
  1250. return objectWithRefs;
  1251. }
  1252. var proxy = {};
  1253. var keys = Object.keys(objectWithRefs);
  1254. for (var i = 0; i < keys.length; i++) {
  1255. proxyWithRefUnwrap(proxy, objectWithRefs, keys[i]);
  1256. }
  1257. return proxy;
  1258. }
  1259. function proxyWithRefUnwrap(target, source, key) {
  1260. Object.defineProperty(target, key, {
  1261. enumerable: true,
  1262. configurable: true,
  1263. get: function () {
  1264. var val = source[key];
  1265. if (isRef(val)) {
  1266. return val.value;
  1267. }
  1268. else {
  1269. var ob = val && val.__ob__;
  1270. if (ob)
  1271. ob.dep.depend();
  1272. return val;
  1273. }
  1274. },
  1275. set: function (value) {
  1276. var oldValue = source[key];
  1277. if (isRef(oldValue) && !isRef(value)) {
  1278. oldValue.value = value;
  1279. }
  1280. else {
  1281. source[key] = value;
  1282. }
  1283. }
  1284. });
  1285. }
  1286. function customRef(factory) {
  1287. var dep = new Dep();
  1288. var _a = factory(function () {
  1289. {
  1290. dep.depend({
  1291. target: ref,
  1292. type: "get" /* TrackOpTypes.GET */,
  1293. key: 'value'
  1294. });
  1295. }
  1296. }, function () {
  1297. {
  1298. dep.notify({
  1299. target: ref,
  1300. type: "set" /* TriggerOpTypes.SET */,
  1301. key: 'value'
  1302. });
  1303. }
  1304. }), get = _a.get, set = _a.set;
  1305. var ref = {
  1306. get value() {
  1307. return get();
  1308. },
  1309. set value(newVal) {
  1310. set(newVal);
  1311. }
  1312. };
  1313. def(ref, RefFlag, true);
  1314. return ref;
  1315. }
  1316. function toRefs(object) {
  1317. if (!isReactive(object)) {
  1318. warn$2("toRefs() expects a reactive object but received a plain one.");
  1319. }
  1320. var ret = isArray(object) ? new Array(object.length) : {};
  1321. for (var key in object) {
  1322. ret[key] = toRef(object, key);
  1323. }
  1324. return ret;
  1325. }
  1326. function toRef(object, key, defaultValue) {
  1327. var val = object[key];
  1328. if (isRef(val)) {
  1329. return val;
  1330. }
  1331. var ref = {
  1332. get value() {
  1333. var val = object[key];
  1334. return val === undefined ? defaultValue : val;
  1335. },
  1336. set value(newVal) {
  1337. object[key] = newVal;
  1338. }
  1339. };
  1340. def(ref, RefFlag, true);
  1341. return ref;
  1342. }
  1343. var rawToReadonlyFlag = "__v_rawToReadonly";
  1344. var rawToShallowReadonlyFlag = "__v_rawToShallowReadonly";
  1345. function readonly(target) {
  1346. return createReadonly(target, false);
  1347. }
  1348. function createReadonly(target, shallow) {
  1349. if (!isPlainObject(target)) {
  1350. {
  1351. if (isArray(target)) {
  1352. warn$2("Vue 2 does not support readonly arrays.");
  1353. }
  1354. else if (isCollectionType(target)) {
  1355. warn$2("Vue 2 does not support readonly collection types such as Map or Set.");
  1356. }
  1357. else {
  1358. warn$2("value cannot be made readonly: ".concat(typeof target));
  1359. }
  1360. }
  1361. return target;
  1362. }
  1363. if (!Object.isExtensible(target)) {
  1364. warn$2("Vue 2 does not support creating readonly proxy for non-extensible object.");
  1365. }
  1366. // already a readonly object
  1367. if (isReadonly(target)) {
  1368. return target;
  1369. }
  1370. // already has a readonly proxy
  1371. var existingFlag = shallow ? rawToShallowReadonlyFlag : rawToReadonlyFlag;
  1372. var existingProxy = target[existingFlag];
  1373. if (existingProxy) {
  1374. return existingProxy;
  1375. }
  1376. var proxy = Object.create(Object.getPrototypeOf(target));
  1377. def(target, existingFlag, proxy);
  1378. def(proxy, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, true);
  1379. def(proxy, "__v_raw" /* ReactiveFlags.RAW */, target);
  1380. if (isRef(target)) {
  1381. def(proxy, RefFlag, true);
  1382. }
  1383. if (shallow || isShallow(target)) {
  1384. def(proxy, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true);
  1385. }
  1386. var keys = Object.keys(target);
  1387. for (var i = 0; i < keys.length; i++) {
  1388. defineReadonlyProperty(proxy, target, keys[i], shallow);
  1389. }
  1390. return proxy;
  1391. }
  1392. function defineReadonlyProperty(proxy, target, key, shallow) {
  1393. Object.defineProperty(proxy, key, {
  1394. enumerable: true,
  1395. configurable: true,
  1396. get: function () {
  1397. var val = target[key];
  1398. return shallow || !isPlainObject(val) ? val : readonly(val);
  1399. },
  1400. set: function () {
  1401. warn$2("Set operation on key \"".concat(key, "\" failed: target is readonly."));
  1402. }
  1403. });
  1404. }
  1405. /**
  1406. * Returns a reactive-copy of the original object, where only the root level
  1407. * properties are readonly, and does NOT unwrap refs nor recursively convert
  1408. * returned properties.
  1409. * This is used for creating the props proxy object for stateful components.
  1410. */
  1411. function shallowReadonly(target) {
  1412. return createReadonly(target, true);
  1413. }
  1414. function computed(getterOrOptions, debugOptions) {
  1415. var getter;
  1416. var setter;
  1417. var onlyGetter = isFunction(getterOrOptions);
  1418. if (onlyGetter) {
  1419. getter = getterOrOptions;
  1420. setter = function () {
  1421. warn$2('Write operation failed: computed value is readonly');
  1422. }
  1423. ;
  1424. }
  1425. else {
  1426. getter = getterOrOptions.get;
  1427. setter = getterOrOptions.set;
  1428. }
  1429. var watcher = isServerRendering()
  1430. ? null
  1431. : new Watcher(currentInstance, getter, noop, { lazy: true });
  1432. if (watcher && debugOptions) {
  1433. watcher.onTrack = debugOptions.onTrack;
  1434. watcher.onTrigger = debugOptions.onTrigger;
  1435. }
  1436. var ref = {
  1437. // some libs rely on the presence effect for checking computed refs
  1438. // from normal refs, but the implementation doesn't matter
  1439. effect: watcher,
  1440. get value() {
  1441. if (watcher) {
  1442. if (watcher.dirty) {
  1443. watcher.evaluate();
  1444. }
  1445. if (Dep.target) {
  1446. if (Dep.target.onTrack) {
  1447. Dep.target.onTrack({
  1448. effect: Dep.target,
  1449. target: ref,
  1450. type: "get" /* TrackOpTypes.GET */,
  1451. key: 'value'
  1452. });
  1453. }
  1454. watcher.depend();
  1455. }
  1456. return watcher.value;
  1457. }
  1458. else {
  1459. return getter();
  1460. }
  1461. },
  1462. set value(newVal) {
  1463. setter(newVal);
  1464. }
  1465. };
  1466. def(ref, RefFlag, true);
  1467. def(ref, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, onlyGetter);
  1468. return ref;
  1469. }
  1470. var mark;
  1471. var measure;
  1472. {
  1473. var perf_1 = inBrowser && window.performance;
  1474. /* istanbul ignore if */
  1475. if (perf_1 &&
  1476. // @ts-ignore
  1477. perf_1.mark &&
  1478. // @ts-ignore
  1479. perf_1.measure &&
  1480. // @ts-ignore
  1481. perf_1.clearMarks &&
  1482. // @ts-ignore
  1483. perf_1.clearMeasures) {
  1484. mark = function (tag) { return perf_1.mark(tag); };
  1485. measure = function (name, startTag, endTag) {
  1486. perf_1.measure(name, startTag, endTag);
  1487. perf_1.clearMarks(startTag);
  1488. perf_1.clearMarks(endTag);
  1489. // perf.clearMeasures(name)
  1490. };
  1491. }
  1492. }
  1493. var normalizeEvent = cached(function (name) {
  1494. var passive = name.charAt(0) === '&';
  1495. name = passive ? name.slice(1) : name;
  1496. var once = name.charAt(0) === '~'; // Prefixed last, checked first
  1497. name = once ? name.slice(1) : name;
  1498. var capture = name.charAt(0) === '!';
  1499. name = capture ? name.slice(1) : name;
  1500. return {
  1501. name: name,
  1502. once: once,
  1503. capture: capture,
  1504. passive: passive
  1505. };
  1506. });
  1507. function createFnInvoker(fns, vm) {
  1508. function invoker() {
  1509. var fns = invoker.fns;
  1510. if (isArray(fns)) {
  1511. var cloned = fns.slice();
  1512. for (var i = 0; i < cloned.length; i++) {
  1513. invokeWithErrorHandling(cloned[i], null, arguments, vm, "v-on handler");
  1514. }
  1515. }
  1516. else {
  1517. // return handler return value for single handlers
  1518. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler");
  1519. }
  1520. }
  1521. invoker.fns = fns;
  1522. return invoker;
  1523. }
  1524. function updateListeners(on, oldOn, add, remove, createOnceHandler, vm) {
  1525. var name, cur, old, event;
  1526. for (name in on) {
  1527. cur = on[name];
  1528. old = oldOn[name];
  1529. event = normalizeEvent(name);
  1530. if (isUndef(cur)) {
  1531. warn$2("Invalid handler for event \"".concat(event.name, "\": got ") + String(cur), vm);
  1532. }
  1533. else if (isUndef(old)) {
  1534. if (isUndef(cur.fns)) {
  1535. cur = on[name] = createFnInvoker(cur, vm);
  1536. }
  1537. if (isTrue(event.once)) {
  1538. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  1539. }
  1540. add(event.name, cur, event.capture, event.passive, event.params);
  1541. }
  1542. else if (cur !== old) {
  1543. old.fns = cur;
  1544. on[name] = old;
  1545. }
  1546. }
  1547. for (name in oldOn) {
  1548. if (isUndef(on[name])) {
  1549. event = normalizeEvent(name);
  1550. remove(event.name, oldOn[name], event.capture);
  1551. }
  1552. }
  1553. }
  1554. function mergeVNodeHook(def, hookKey, hook) {
  1555. if (def instanceof VNode) {
  1556. def = def.data.hook || (def.data.hook = {});
  1557. }
  1558. var invoker;
  1559. var oldHook = def[hookKey];
  1560. function wrappedHook() {
  1561. hook.apply(this, arguments);
  1562. // important: remove merged hook to ensure it's called only once
  1563. // and prevent memory leak
  1564. remove$2(invoker.fns, wrappedHook);
  1565. }
  1566. if (isUndef(oldHook)) {
  1567. // no existing hook
  1568. invoker = createFnInvoker([wrappedHook]);
  1569. }
  1570. else {
  1571. /* istanbul ignore if */
  1572. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  1573. // already a merged invoker
  1574. invoker = oldHook;
  1575. invoker.fns.push(wrappedHook);
  1576. }
  1577. else {
  1578. // existing plain hook
  1579. invoker = createFnInvoker([oldHook, wrappedHook]);
  1580. }
  1581. }
  1582. invoker.merged = true;
  1583. def[hookKey] = invoker;
  1584. }
  1585. function extractPropsFromVNodeData(data, Ctor, tag) {
  1586. // we are only extracting raw values here.
  1587. // validation and default values are handled in the child
  1588. // component itself.
  1589. var propOptions = Ctor.options.props;
  1590. if (isUndef(propOptions)) {
  1591. return;
  1592. }
  1593. var res = {};
  1594. var attrs = data.attrs, props = data.props;
  1595. if (isDef(attrs) || isDef(props)) {
  1596. for (var key in propOptions) {
  1597. var altKey = hyphenate(key);
  1598. {
  1599. var keyInLowerCase = key.toLowerCase();
  1600. if (key !== keyInLowerCase && attrs && hasOwn(attrs, keyInLowerCase)) {
  1601. tip("Prop \"".concat(keyInLowerCase, "\" is passed to component ") +
  1602. "".concat(formatComponentName(
  1603. // @ts-expect-error tag is string
  1604. tag || Ctor), ", but the declared prop name is") +
  1605. " \"".concat(key, "\". ") +
  1606. "Note that HTML attributes are case-insensitive and camelCased " +
  1607. "props need to use their kebab-case equivalents when using in-DOM " +
  1608. "templates. You should probably use \"".concat(altKey, "\" instead of \"").concat(key, "\"."));
  1609. }
  1610. }
  1611. checkProp(res, props, key, altKey, true) ||
  1612. checkProp(res, attrs, key, altKey, false);
  1613. }
  1614. }
  1615. return res;
  1616. }
  1617. function checkProp(res, hash, key, altKey, preserve) {
  1618. if (isDef(hash)) {
  1619. if (hasOwn(hash, key)) {
  1620. res[key] = hash[key];
  1621. if (!preserve) {
  1622. delete hash[key];
  1623. }
  1624. return true;
  1625. }
  1626. else if (hasOwn(hash, altKey)) {
  1627. res[key] = hash[altKey];
  1628. if (!preserve) {
  1629. delete hash[altKey];
  1630. }
  1631. return true;
  1632. }
  1633. }
  1634. return false;
  1635. }
  1636. // The template compiler attempts to minimize the need for normalization by
  1637. // statically analyzing the template at compile time.
  1638. //
  1639. // For plain HTML markup, normalization can be completely skipped because the
  1640. // generated render function is guaranteed to return Array<VNode>. There are
  1641. // two cases where extra normalization is needed:
  1642. // 1. When the children contains components - because a functional component
  1643. // may return an Array instead of a single root. In this case, just a simple
  1644. // normalization is needed - if any child is an Array, we flatten the whole
  1645. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  1646. // because functional components already normalize their own children.
  1647. function simpleNormalizeChildren(children) {
  1648. for (var i = 0; i < children.length; i++) {
  1649. if (isArray(children[i])) {
  1650. return Array.prototype.concat.apply([], children);
  1651. }
  1652. }
  1653. return children;
  1654. }
  1655. // 2. When the children contains constructs that always generated nested Arrays,
  1656. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  1657. // with hand-written render functions / JSX. In such cases a full normalization
  1658. // is needed to cater to all possible types of children values.
  1659. function normalizeChildren(children) {
  1660. return isPrimitive(children)
  1661. ? [createTextVNode(children)]
  1662. : isArray(children)
  1663. ? normalizeArrayChildren(children)
  1664. : undefined;
  1665. }
  1666. function isTextNode(node) {
  1667. return isDef(node) && isDef(node.text) && isFalse(node.isComment);
  1668. }
  1669. function normalizeArrayChildren(children, nestedIndex) {
  1670. var res = [];
  1671. var i, c, lastIndex, last;
  1672. for (i = 0; i < children.length; i++) {
  1673. c = children[i];
  1674. if (isUndef(c) || typeof c === 'boolean')
  1675. continue;
  1676. lastIndex = res.length - 1;
  1677. last = res[lastIndex];
  1678. // nested
  1679. if (isArray(c)) {
  1680. if (c.length > 0) {
  1681. c = normalizeArrayChildren(c, "".concat(nestedIndex || '', "_").concat(i));
  1682. // merge adjacent text nodes
  1683. if (isTextNode(c[0]) && isTextNode(last)) {
  1684. res[lastIndex] = createTextVNode(last.text + c[0].text);
  1685. c.shift();
  1686. }
  1687. res.push.apply(res, c);
  1688. }
  1689. }
  1690. else if (isPrimitive(c)) {
  1691. if (isTextNode(last)) {
  1692. // merge adjacent text nodes
  1693. // this is necessary for SSR hydration because text nodes are
  1694. // essentially merged when rendered to HTML strings
  1695. res[lastIndex] = createTextVNode(last.text + c);
  1696. }
  1697. else if (c !== '') {
  1698. // convert primitive to vnode
  1699. res.push(createTextVNode(c));
  1700. }
  1701. }
  1702. else {
  1703. if (isTextNode(c) && isTextNode(last)) {
  1704. // merge adjacent text nodes
  1705. res[lastIndex] = createTextVNode(last.text + c.text);
  1706. }
  1707. else {
  1708. // default key for nested array children (likely generated by v-for)
  1709. if (isTrue(children._isVList) &&
  1710. isDef(c.tag) &&
  1711. isUndef(c.key) &&
  1712. isDef(nestedIndex)) {
  1713. c.key = "__vlist".concat(nestedIndex, "_").concat(i, "__");
  1714. }
  1715. res.push(c);
  1716. }
  1717. }
  1718. }
  1719. return res;
  1720. }
  1721. var SIMPLE_NORMALIZE = 1;
  1722. var ALWAYS_NORMALIZE = 2;
  1723. // wrapper function for providing a more flexible interface
  1724. // without getting yelled at by flow
  1725. function createElement$1(context, tag, data, children, normalizationType, alwaysNormalize) {
  1726. if (isArray(data) || isPrimitive(data)) {
  1727. normalizationType = children;
  1728. children = data;
  1729. data = undefined;
  1730. }
  1731. if (isTrue(alwaysNormalize)) {
  1732. normalizationType = ALWAYS_NORMALIZE;
  1733. }
  1734. return _createElement(context, tag, data, children, normalizationType);
  1735. }
  1736. function _createElement(context, tag, data, children, normalizationType) {
  1737. if (isDef(data) && isDef(data.__ob__)) {
  1738. warn$2("Avoid using observed data object as vnode data: ".concat(JSON.stringify(data), "\n") + 'Always create fresh vnode data objects in each render!', context);
  1739. return createEmptyVNode();
  1740. }
  1741. // object syntax in v-bind
  1742. if (isDef(data) && isDef(data.is)) {
  1743. tag = data.is;
  1744. }
  1745. if (!tag) {
  1746. // in case of component :is set to falsy value
  1747. return createEmptyVNode();
  1748. }
  1749. // warn against non-primitive key
  1750. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)) {
  1751. warn$2('Avoid using non-primitive value as key, ' +
  1752. 'use string/number value instead.', context);
  1753. }
  1754. // support single function children as default scoped slot
  1755. if (isArray(children) && isFunction(children[0])) {
  1756. data = data || {};
  1757. data.scopedSlots = { default: children[0] };
  1758. children.length = 0;
  1759. }
  1760. if (normalizationType === ALWAYS_NORMALIZE) {
  1761. children = normalizeChildren(children);
  1762. }
  1763. else if (normalizationType === SIMPLE_NORMALIZE) {
  1764. children = simpleNormalizeChildren(children);
  1765. }
  1766. var vnode, ns;
  1767. if (typeof tag === 'string') {
  1768. var Ctor = void 0;
  1769. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  1770. if (config.isReservedTag(tag)) {
  1771. // platform built-in elements
  1772. if (isDef(data) &&
  1773. isDef(data.nativeOn) &&
  1774. data.tag !== 'component') {
  1775. warn$2("The .native modifier for v-on is only valid on components but it was used on <".concat(tag, ">."), context);
  1776. }
  1777. vnode = new VNode(config.parsePlatformTagName(tag), data, children, undefined, undefined, context);
  1778. }
  1779. else if ((!data || !data.pre) &&
  1780. isDef((Ctor = resolveAsset(context.$options, 'components', tag)))) {
  1781. // component
  1782. vnode = createComponent(Ctor, data, context, children, tag);
  1783. }
  1784. else {
  1785. // unknown or unlisted namespaced elements
  1786. // check at runtime because it may get assigned a namespace when its
  1787. // parent normalizes children
  1788. vnode = new VNode(tag, data, children, undefined, undefined, context);
  1789. }
  1790. }
  1791. else {
  1792. // direct component options / constructor
  1793. vnode = createComponent(tag, data, context, children);
  1794. }
  1795. if (isArray(vnode)) {
  1796. return vnode;
  1797. }
  1798. else if (isDef(vnode)) {
  1799. if (isDef(ns))
  1800. applyNS(vnode, ns);
  1801. if (isDef(data))
  1802. registerDeepBindings(data);
  1803. return vnode;
  1804. }
  1805. else {
  1806. return createEmptyVNode();
  1807. }
  1808. }
  1809. function applyNS(vnode, ns, force) {
  1810. vnode.ns = ns;
  1811. if (vnode.tag === 'foreignObject') {
  1812. // use default namespace inside foreignObject
  1813. ns = undefined;
  1814. force = true;
  1815. }
  1816. if (isDef(vnode.children)) {
  1817. for (var i = 0, l = vnode.children.length; i < l; i++) {
  1818. var child = vnode.children[i];
  1819. if (isDef(child.tag) &&
  1820. (isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  1821. applyNS(child, ns, force);
  1822. }
  1823. }
  1824. }
  1825. }
  1826. // ref #5318
  1827. // necessary to ensure parent re-render when deep bindings like :style and
  1828. // :class are used on slot nodes
  1829. function registerDeepBindings(data) {
  1830. if (isObject(data.style)) {
  1831. traverse(data.style);
  1832. }
  1833. if (isObject(data.class)) {
  1834. traverse(data.class);
  1835. }
  1836. }
  1837. /**
  1838. * Runtime helper for rendering v-for lists.
  1839. */
  1840. function renderList(val, render) {
  1841. var ret = null, i, l, keys, key;
  1842. if (isArray(val) || typeof val === 'string') {
  1843. ret = new Array(val.length);
  1844. for (i = 0, l = val.length; i < l; i++) {
  1845. ret[i] = render(val[i], i);
  1846. }
  1847. }
  1848. else if (typeof val === 'number') {
  1849. ret = new Array(val);
  1850. for (i = 0; i < val; i++) {
  1851. ret[i] = render(i + 1, i);
  1852. }
  1853. }
  1854. else if (isObject(val)) {
  1855. if (hasSymbol && val[Symbol.iterator]) {
  1856. ret = [];
  1857. var iterator = val[Symbol.iterator]();
  1858. var result = iterator.next();
  1859. while (!result.done) {
  1860. ret.push(render(result.value, ret.length));
  1861. result = iterator.next();
  1862. }
  1863. }
  1864. else {
  1865. keys = Object.keys(val);
  1866. ret = new Array(keys.length);
  1867. for (i = 0, l = keys.length; i < l; i++) {
  1868. key = keys[i];
  1869. ret[i] = render(val[key], key, i);
  1870. }
  1871. }
  1872. }
  1873. if (!isDef(ret)) {
  1874. ret = [];
  1875. }
  1876. ret._isVList = true;
  1877. return ret;
  1878. }
  1879. /**
  1880. * Runtime helper for rendering <slot>
  1881. */
  1882. function renderSlot(name, fallbackRender, props, bindObject) {
  1883. var scopedSlotFn = this.$scopedSlots[name];
  1884. var nodes;
  1885. if (scopedSlotFn) {
  1886. // scoped slot
  1887. props = props || {};
  1888. if (bindObject) {
  1889. if (!isObject(bindObject)) {
  1890. warn$2('slot v-bind without argument expects an Object', this);
  1891. }
  1892. props = extend(extend({}, bindObject), props);
  1893. }
  1894. nodes =
  1895. scopedSlotFn(props) ||
  1896. (isFunction(fallbackRender) ? fallbackRender() : fallbackRender);
  1897. }
  1898. else {
  1899. nodes =
  1900. this.$slots[name] ||
  1901. (isFunction(fallbackRender) ? fallbackRender() : fallbackRender);
  1902. }
  1903. var target = props && props.slot;
  1904. if (target) {
  1905. return this.$createElement('template', { slot: target }, nodes);
  1906. }
  1907. else {
  1908. return nodes;
  1909. }
  1910. }
  1911. /**
  1912. * Runtime helper for resolving filters
  1913. */
  1914. function resolveFilter(id) {
  1915. return resolveAsset(this.$options, 'filters', id, true) || identity;
  1916. }
  1917. function isKeyNotMatch(expect, actual) {
  1918. if (isArray(expect)) {
  1919. return expect.indexOf(actual) === -1;
  1920. }
  1921. else {
  1922. return expect !== actual;
  1923. }
  1924. }
  1925. /**
  1926. * Runtime helper for checking keyCodes from config.
  1927. * exposed as Vue.prototype._k
  1928. * passing in eventKeyName as last argument separately for backwards compat
  1929. */
  1930. function checkKeyCodes(eventKeyCode, key, builtInKeyCode, eventKeyName, builtInKeyName) {
  1931. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  1932. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  1933. return isKeyNotMatch(builtInKeyName, eventKeyName);
  1934. }
  1935. else if (mappedKeyCode) {
  1936. return isKeyNotMatch(mappedKeyCode, eventKeyCode);
  1937. }
  1938. else if (eventKeyName) {
  1939. return hyphenate(eventKeyName) !== key;
  1940. }
  1941. return eventKeyCode === undefined;
  1942. }
  1943. /**
  1944. * Runtime helper for merging v-bind="object" into a VNode's data.
  1945. */
  1946. function bindObjectProps(data, tag, value, asProp, isSync) {
  1947. if (value) {
  1948. if (!isObject(value)) {
  1949. warn$2('v-bind without argument expects an Object or Array value', this);
  1950. }
  1951. else {
  1952. if (isArray(value)) {
  1953. value = toObject(value);
  1954. }
  1955. var hash = void 0;
  1956. var _loop_1 = function (key) {
  1957. if (key === 'class' || key === 'style' || isReservedAttribute(key)) {
  1958. hash = data;
  1959. }
  1960. else {
  1961. var type = data.attrs && data.attrs.type;
  1962. hash =
  1963. asProp || config.mustUseProp(tag, type, key)
  1964. ? data.domProps || (data.domProps = {})
  1965. : data.attrs || (data.attrs = {});
  1966. }
  1967. var camelizedKey = camelize(key);
  1968. var hyphenatedKey = hyphenate(key);
  1969. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  1970. hash[key] = value[key];
  1971. if (isSync) {
  1972. var on = data.on || (data.on = {});
  1973. on["update:".concat(key)] = function ($event) {
  1974. value[key] = $event;
  1975. };
  1976. }
  1977. }
  1978. };
  1979. for (var key in value) {
  1980. _loop_1(key);
  1981. }
  1982. }
  1983. }
  1984. return data;
  1985. }
  1986. /**
  1987. * Runtime helper for rendering static trees.
  1988. */
  1989. function renderStatic(index, isInFor) {
  1990. var cached = this._staticTrees || (this._staticTrees = []);
  1991. var tree = cached[index];
  1992. // if has already-rendered static tree and not inside v-for,
  1993. // we can reuse the same tree.
  1994. if (tree && !isInFor) {
  1995. return tree;
  1996. }
  1997. // otherwise, render a fresh tree.
  1998. tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, this._c, this // for render fns generated for functional component templates
  1999. );
  2000. markStatic$1(tree, "__static__".concat(index), false);
  2001. return tree;
  2002. }
  2003. /**
  2004. * Runtime helper for v-once.
  2005. * Effectively it means marking the node as static with a unique key.
  2006. */
  2007. function markOnce(tree, index, key) {
  2008. markStatic$1(tree, "__once__".concat(index).concat(key ? "_".concat(key) : ""), true);
  2009. return tree;
  2010. }
  2011. function markStatic$1(tree, key, isOnce) {
  2012. if (isArray(tree)) {
  2013. for (var i = 0; i < tree.length; i++) {
  2014. if (tree[i] && typeof tree[i] !== 'string') {
  2015. markStaticNode(tree[i], "".concat(key, "_").concat(i), isOnce);
  2016. }
  2017. }
  2018. }
  2019. else {
  2020. markStaticNode(tree, key, isOnce);
  2021. }
  2022. }
  2023. function markStaticNode(node, key, isOnce) {
  2024. node.isStatic = true;
  2025. node.key = key;
  2026. node.isOnce = isOnce;
  2027. }
  2028. function bindObjectListeners(data, value) {
  2029. if (value) {
  2030. if (!isPlainObject(value)) {
  2031. warn$2('v-on without argument expects an Object value', this);
  2032. }
  2033. else {
  2034. var on = (data.on = data.on ? extend({}, data.on) : {});
  2035. for (var key in value) {
  2036. var existing = on[key];
  2037. var ours = value[key];
  2038. on[key] = existing ? [].concat(existing, ours) : ours;
  2039. }
  2040. }
  2041. }
  2042. return data;
  2043. }
  2044. function resolveScopedSlots(fns, res,
  2045. // the following are added in 2.6
  2046. hasDynamicKeys, contentHashKey) {
  2047. res = res || { $stable: !hasDynamicKeys };
  2048. for (var i = 0; i < fns.length; i++) {
  2049. var slot = fns[i];
  2050. if (isArray(slot)) {
  2051. resolveScopedSlots(slot, res, hasDynamicKeys);
  2052. }
  2053. else if (slot) {
  2054. // marker for reverse proxying v-slot without scope on this.$slots
  2055. // @ts-expect-error
  2056. if (slot.proxy) {
  2057. // @ts-expect-error
  2058. slot.fn.proxy = true;
  2059. }
  2060. res[slot.key] = slot.fn;
  2061. }
  2062. }
  2063. if (contentHashKey) {
  2064. res.$key = contentHashKey;
  2065. }
  2066. return res;
  2067. }
  2068. // helper to process dynamic keys for dynamic arguments in v-bind and v-on.
  2069. function bindDynamicKeys(baseObj, values) {
  2070. for (var i = 0; i < values.length; i += 2) {
  2071. var key = values[i];
  2072. if (typeof key === 'string' && key) {
  2073. baseObj[values[i]] = values[i + 1];
  2074. }
  2075. else if (key !== '' && key !== null) {
  2076. // null is a special value for explicitly removing a binding
  2077. warn$2("Invalid value for dynamic directive argument (expected string or null): ".concat(key), this);
  2078. }
  2079. }
  2080. return baseObj;
  2081. }
  2082. // helper to dynamically append modifier runtime markers to event names.
  2083. // ensure only append when value is already string, otherwise it will be cast
  2084. // to string and cause the type check to miss.
  2085. function prependModifier(value, symbol) {
  2086. return typeof value === 'string' ? symbol + value : value;
  2087. }
  2088. function installRenderHelpers(target) {
  2089. target._o = markOnce;
  2090. target._n = toNumber;
  2091. target._s = toString;
  2092. target._l = renderList;
  2093. target._t = renderSlot;
  2094. target._q = looseEqual;
  2095. target._i = looseIndexOf;
  2096. target._m = renderStatic;
  2097. target._f = resolveFilter;
  2098. target._k = checkKeyCodes;
  2099. target._b = bindObjectProps;
  2100. target._v = createTextVNode;
  2101. target._e = createEmptyVNode;
  2102. target._u = resolveScopedSlots;
  2103. target._g = bindObjectListeners;
  2104. target._d = bindDynamicKeys;
  2105. target._p = prependModifier;
  2106. }
  2107. /**
  2108. * Runtime helper for resolving raw children VNodes into a slot object.
  2109. */
  2110. function resolveSlots(children, context) {
  2111. if (!children || !children.length) {
  2112. return {};
  2113. }
  2114. var slots = {};
  2115. for (var i = 0, l = children.length; i < l; i++) {
  2116. var child = children[i];
  2117. var data = child.data;
  2118. // remove slot attribute if the node is resolved as a Vue slot node
  2119. if (data && data.attrs && data.attrs.slot) {
  2120. delete data.attrs.slot;
  2121. }
  2122. // named slots should only be respected if the vnode was rendered in the
  2123. // same context.
  2124. if ((child.context === context || child.fnContext === context) &&
  2125. data &&
  2126. data.slot != null) {
  2127. var name_1 = data.slot;
  2128. var slot = slots[name_1] || (slots[name_1] = []);
  2129. if (child.tag === 'template') {
  2130. slot.push.apply(slot, child.children || []);
  2131. }
  2132. else {
  2133. slot.push(child);
  2134. }
  2135. }
  2136. else {
  2137. (slots.default || (slots.default = [])).push(child);
  2138. }
  2139. }
  2140. // ignore slots that contains only whitespace
  2141. for (var name_2 in slots) {
  2142. if (slots[name_2].every(isWhitespace)) {
  2143. delete slots[name_2];
  2144. }
  2145. }
  2146. return slots;
  2147. }
  2148. function isWhitespace(node) {
  2149. return (node.isComment && !node.asyncFactory) || node.text === ' ';
  2150. }
  2151. function isAsyncPlaceholder(node) {
  2152. // @ts-expect-error not really boolean type
  2153. return node.isComment && node.asyncFactory;
  2154. }
  2155. function normalizeScopedSlots(ownerVm, scopedSlots, normalSlots, prevScopedSlots) {
  2156. var res;
  2157. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  2158. var isStable = scopedSlots ? !!scopedSlots.$stable : !hasNormalSlots;
  2159. var key = scopedSlots && scopedSlots.$key;
  2160. if (!scopedSlots) {
  2161. res = {};
  2162. }
  2163. else if (scopedSlots._normalized) {
  2164. // fast path 1: child component re-render only, parent did not change
  2165. return scopedSlots._normalized;
  2166. }
  2167. else if (isStable &&
  2168. prevScopedSlots &&
  2169. prevScopedSlots !== emptyObject &&
  2170. key === prevScopedSlots.$key &&
  2171. !hasNormalSlots &&
  2172. !prevScopedSlots.$hasNormal) {
  2173. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  2174. // only need to normalize once
  2175. return prevScopedSlots;
  2176. }
  2177. else {
  2178. res = {};
  2179. for (var key_1 in scopedSlots) {
  2180. if (scopedSlots[key_1] && key_1[0] !== '$') {
  2181. res[key_1] = normalizeScopedSlot(ownerVm, normalSlots, key_1, scopedSlots[key_1]);
  2182. }
  2183. }
  2184. }
  2185. // expose normal slots on scopedSlots
  2186. for (var key_2 in normalSlots) {
  2187. if (!(key_2 in res)) {
  2188. res[key_2] = proxyNormalSlot(normalSlots, key_2);
  2189. }
  2190. }
  2191. // avoriaz seems to mock a non-extensible $scopedSlots object
  2192. // and when that is passed down this would cause an error
  2193. if (scopedSlots && Object.isExtensible(scopedSlots)) {
  2194. scopedSlots._normalized = res;
  2195. }
  2196. def(res, '$stable', isStable);
  2197. def(res, '$key', key);
  2198. def(res, '$hasNormal', hasNormalSlots);
  2199. return res;
  2200. }
  2201. function normalizeScopedSlot(vm, normalSlots, key, fn) {
  2202. var normalized = function () {
  2203. var cur = currentInstance;
  2204. setCurrentInstance(vm);
  2205. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  2206. res =
  2207. res && typeof res === 'object' && !isArray(res)
  2208. ? [res] // single vnode
  2209. : normalizeChildren(res);
  2210. var vnode = res && res[0];
  2211. setCurrentInstance(cur);
  2212. return res &&
  2213. (!vnode ||
  2214. (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode))) // #9658, #10391
  2215. ? undefined
  2216. : res;
  2217. };
  2218. // this is a slot using the new v-slot syntax without scope. although it is
  2219. // compiled as a scoped slot, render fn users would expect it to be present
  2220. // on this.$slots because the usage is semantically a normal slot.
  2221. if (fn.proxy) {
  2222. Object.defineProperty(normalSlots, key, {
  2223. get: normalized,
  2224. enumerable: true,
  2225. configurable: true
  2226. });
  2227. }
  2228. return normalized;
  2229. }
  2230. function proxyNormalSlot(slots, key) {
  2231. return function () { return slots[key]; };
  2232. }
  2233. function initSetup(vm) {
  2234. var options = vm.$options;
  2235. var setup = options.setup;
  2236. if (setup) {
  2237. var ctx = (vm._setupContext = createSetupContext(vm));
  2238. setCurrentInstance(vm);
  2239. pushTarget();
  2240. var setupResult = invokeWithErrorHandling(setup, null, [vm._props || shallowReactive({}), ctx], vm, "setup");
  2241. popTarget();
  2242. setCurrentInstance();
  2243. if (isFunction(setupResult)) {
  2244. // render function
  2245. // @ts-ignore
  2246. options.render = setupResult;
  2247. }
  2248. else if (isObject(setupResult)) {
  2249. // bindings
  2250. if (setupResult instanceof VNode) {
  2251. warn$2("setup() should not return VNodes directly - " +
  2252. "return a render function instead.");
  2253. }
  2254. vm._setupState = setupResult;
  2255. // __sfc indicates compiled bindings from <script setup>
  2256. if (!setupResult.__sfc) {
  2257. for (var key in setupResult) {
  2258. if (!isReserved(key)) {
  2259. proxyWithRefUnwrap(vm, setupResult, key);
  2260. }
  2261. else {
  2262. warn$2("Avoid using variables that start with _ or $ in setup().");
  2263. }
  2264. }
  2265. }
  2266. else {
  2267. // exposed for compiled render fn
  2268. var proxy = (vm._setupProxy = {});
  2269. for (var key in setupResult) {
  2270. if (key !== '__sfc') {
  2271. proxyWithRefUnwrap(proxy, setupResult, key);
  2272. }
  2273. }
  2274. }
  2275. }
  2276. else if (setupResult !== undefined) {
  2277. warn$2("setup() should return an object. Received: ".concat(setupResult === null ? 'null' : typeof setupResult));
  2278. }
  2279. }
  2280. }
  2281. function createSetupContext(vm) {
  2282. var exposeCalled = false;
  2283. return {
  2284. get attrs() {
  2285. if (!vm._attrsProxy) {
  2286. var proxy = (vm._attrsProxy = {});
  2287. def(proxy, '_v_attr_proxy', true);
  2288. syncSetupProxy(proxy, vm.$attrs, emptyObject, vm, '$attrs');
  2289. }
  2290. return vm._attrsProxy;
  2291. },
  2292. get listeners() {
  2293. if (!vm._listenersProxy) {
  2294. var proxy = (vm._listenersProxy = {});
  2295. syncSetupProxy(proxy, vm.$listeners, emptyObject, vm, '$listeners');
  2296. }
  2297. return vm._listenersProxy;
  2298. },
  2299. get slots() {
  2300. return initSlotsProxy(vm);
  2301. },
  2302. emit: bind$1(vm.$emit, vm),
  2303. expose: function (exposed) {
  2304. {
  2305. if (exposeCalled) {
  2306. warn$2("expose() should be called only once per setup().", vm);
  2307. }
  2308. exposeCalled = true;
  2309. }
  2310. if (exposed) {
  2311. Object.keys(exposed).forEach(function (key) {
  2312. return proxyWithRefUnwrap(vm, exposed, key);
  2313. });
  2314. }
  2315. }
  2316. };
  2317. }
  2318. function syncSetupProxy(to, from, prev, instance, type) {
  2319. var changed = false;
  2320. for (var key in from) {
  2321. if (!(key in to)) {
  2322. changed = true;
  2323. defineProxyAttr(to, key, instance, type);
  2324. }
  2325. else if (from[key] !== prev[key]) {
  2326. changed = true;
  2327. }
  2328. }
  2329. for (var key in to) {
  2330. if (!(key in from)) {
  2331. changed = true;
  2332. delete to[key];
  2333. }
  2334. }
  2335. return changed;
  2336. }
  2337. function defineProxyAttr(proxy, key, instance, type) {
  2338. Object.defineProperty(proxy, key, {
  2339. enumerable: true,
  2340. configurable: true,
  2341. get: function () {
  2342. return instance[type][key];
  2343. }
  2344. });
  2345. }
  2346. function initSlotsProxy(vm) {
  2347. if (!vm._slotsProxy) {
  2348. syncSetupSlots((vm._slotsProxy = {}), vm.$scopedSlots);
  2349. }
  2350. return vm._slotsProxy;
  2351. }
  2352. function syncSetupSlots(to, from) {
  2353. for (var key in from) {
  2354. to[key] = from[key];
  2355. }
  2356. for (var key in to) {
  2357. if (!(key in from)) {
  2358. delete to[key];
  2359. }
  2360. }
  2361. }
  2362. /**
  2363. * @internal use manual type def because public setup context type relies on
  2364. * legacy VNode types
  2365. */
  2366. function useSlots() {
  2367. return getContext().slots;
  2368. }
  2369. /**
  2370. * @internal use manual type def because public setup context type relies on
  2371. * legacy VNode types
  2372. */
  2373. function useAttrs() {
  2374. return getContext().attrs;
  2375. }
  2376. /**
  2377. * Vue 2 only
  2378. * @internal use manual type def because public setup context type relies on
  2379. * legacy VNode types
  2380. */
  2381. function useListeners() {
  2382. return getContext().listeners;
  2383. }
  2384. function getContext() {
  2385. if (!currentInstance) {
  2386. warn$2("useContext() called without active instance.");
  2387. }
  2388. var vm = currentInstance;
  2389. return vm._setupContext || (vm._setupContext = createSetupContext(vm));
  2390. }
  2391. /**
  2392. * Runtime helper for merging default declarations. Imported by compiled code
  2393. * only.
  2394. * @internal
  2395. */
  2396. function mergeDefaults(raw, defaults) {
  2397. var props = isArray(raw)
  2398. ? raw.reduce(function (normalized, p) { return ((normalized[p] = {}), normalized); }, {})
  2399. : raw;
  2400. for (var key in defaults) {
  2401. var opt = props[key];
  2402. if (opt) {
  2403. if (isArray(opt) || isFunction(opt)) {
  2404. props[key] = { type: opt, default: defaults[key] };
  2405. }
  2406. else {
  2407. opt.default = defaults[key];
  2408. }
  2409. }
  2410. else if (opt === null) {
  2411. props[key] = { default: defaults[key] };
  2412. }
  2413. else {
  2414. warn$2("props default key \"".concat(key, "\" has no corresponding declaration."));
  2415. }
  2416. }
  2417. return props;
  2418. }
  2419. function initRender(vm) {
  2420. vm._vnode = null; // the root of the child tree
  2421. vm._staticTrees = null; // v-once cached trees
  2422. var options = vm.$options;
  2423. var parentVnode = (vm.$vnode = options._parentVnode); // the placeholder node in parent tree
  2424. var renderContext = parentVnode && parentVnode.context;
  2425. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  2426. vm.$scopedSlots = parentVnode
  2427. ? normalizeScopedSlots(vm.$parent, parentVnode.data.scopedSlots, vm.$slots)
  2428. : emptyObject;
  2429. // bind the createElement fn to this instance
  2430. // so that we get proper render context inside it.
  2431. // args order: tag, data, children, normalizationType, alwaysNormalize
  2432. // internal version is used by render functions compiled from templates
  2433. // @ts-expect-error
  2434. vm._c = function (a, b, c, d) { return createElement$1(vm, a, b, c, d, false); };
  2435. // normalization is always applied for the public version, used in
  2436. // user-written render functions.
  2437. // @ts-expect-error
  2438. vm.$createElement = function (a, b, c, d) { return createElement$1(vm, a, b, c, d, true); };
  2439. // $attrs & $listeners are exposed for easier HOC creation.
  2440. // they need to be reactive so that HOCs using them are always updated
  2441. var parentData = parentVnode && parentVnode.data;
  2442. /* istanbul ignore else */
  2443. {
  2444. defineReactive(vm, '$attrs', (parentData && parentData.attrs) || emptyObject, function () {
  2445. !isUpdatingChildComponent && warn$2("$attrs is readonly.", vm);
  2446. }, true);
  2447. defineReactive(vm, '$listeners', options._parentListeners || emptyObject, function () {
  2448. !isUpdatingChildComponent && warn$2("$listeners is readonly.", vm);
  2449. }, true);
  2450. }
  2451. }
  2452. var currentRenderingInstance = null;
  2453. function renderMixin(Vue) {
  2454. // install runtime convenience helpers
  2455. installRenderHelpers(Vue.prototype);
  2456. Vue.prototype.$nextTick = function (fn) {
  2457. return nextTick(fn, this);
  2458. };
  2459. Vue.prototype._render = function () {
  2460. var vm = this;
  2461. var _a = vm.$options, render = _a.render, _parentVnode = _a._parentVnode;
  2462. if (_parentVnode && vm._isMounted) {
  2463. vm.$scopedSlots = normalizeScopedSlots(vm.$parent, _parentVnode.data.scopedSlots, vm.$slots, vm.$scopedSlots);
  2464. if (vm._slotsProxy) {
  2465. syncSetupSlots(vm._slotsProxy, vm.$scopedSlots);
  2466. }
  2467. }
  2468. // set parent vnode. this allows render functions to have access
  2469. // to the data on the placeholder node.
  2470. vm.$vnode = _parentVnode;
  2471. // render self
  2472. var prevInst = currentInstance;
  2473. var prevRenderInst = currentRenderingInstance;
  2474. var vnode;
  2475. try {
  2476. setCurrentInstance(vm);
  2477. currentRenderingInstance = vm;
  2478. vnode = render.call(vm._renderProxy, vm.$createElement);
  2479. }
  2480. catch (e) {
  2481. handleError(e, vm, "render");
  2482. // return error render result,
  2483. // or previous vnode to prevent render error causing blank component
  2484. /* istanbul ignore else */
  2485. if (vm.$options.renderError) {
  2486. try {
  2487. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  2488. }
  2489. catch (e) {
  2490. handleError(e, vm, "renderError");
  2491. vnode = vm._vnode;
  2492. }
  2493. }
  2494. else {
  2495. vnode = vm._vnode;
  2496. }
  2497. }
  2498. finally {
  2499. currentRenderingInstance = prevRenderInst;
  2500. setCurrentInstance(prevInst);
  2501. }
  2502. // if the returned array contains only a single node, allow it
  2503. if (isArray(vnode) && vnode.length === 1) {
  2504. vnode = vnode[0];
  2505. }
  2506. // return empty vnode in case the render function errored out
  2507. if (!(vnode instanceof VNode)) {
  2508. if (isArray(vnode)) {
  2509. warn$2('Multiple root nodes returned from render function. Render function ' +
  2510. 'should return a single root node.', vm);
  2511. }
  2512. vnode = createEmptyVNode();
  2513. }
  2514. // set parent
  2515. vnode.parent = _parentVnode;
  2516. return vnode;
  2517. };
  2518. }
  2519. function ensureCtor(comp, base) {
  2520. if (comp.__esModule || (hasSymbol && comp[Symbol.toStringTag] === 'Module')) {
  2521. comp = comp.default;
  2522. }
  2523. return isObject(comp) ? base.extend(comp) : comp;
  2524. }
  2525. function createAsyncPlaceholder(factory, data, context, children, tag) {
  2526. var node = createEmptyVNode();
  2527. node.asyncFactory = factory;
  2528. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  2529. return node;
  2530. }
  2531. function resolveAsyncComponent(factory, baseCtor) {
  2532. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  2533. return factory.errorComp;
  2534. }
  2535. if (isDef(factory.resolved)) {
  2536. return factory.resolved;
  2537. }
  2538. var owner = currentRenderingInstance;
  2539. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  2540. // already pending
  2541. factory.owners.push(owner);
  2542. }
  2543. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  2544. return factory.loadingComp;
  2545. }
  2546. if (owner && !isDef(factory.owners)) {
  2547. var owners_1 = (factory.owners = [owner]);
  2548. var sync_1 = true;
  2549. var timerLoading_1 = null;
  2550. var timerTimeout_1 = null;
  2551. owner.$on('hook:destroyed', function () { return remove$2(owners_1, owner); });
  2552. var forceRender_1 = function (renderCompleted) {
  2553. for (var i = 0, l = owners_1.length; i < l; i++) {
  2554. owners_1[i].$forceUpdate();
  2555. }
  2556. if (renderCompleted) {
  2557. owners_1.length = 0;
  2558. if (timerLoading_1 !== null) {
  2559. clearTimeout(timerLoading_1);
  2560. timerLoading_1 = null;
  2561. }
  2562. if (timerTimeout_1 !== null) {
  2563. clearTimeout(timerTimeout_1);
  2564. timerTimeout_1 = null;
  2565. }
  2566. }
  2567. };
  2568. var resolve = once(function (res) {
  2569. // cache resolved
  2570. factory.resolved = ensureCtor(res, baseCtor);
  2571. // invoke callbacks only if this is not a synchronous resolve
  2572. // (async resolves are shimmed as synchronous during SSR)
  2573. if (!sync_1) {
  2574. forceRender_1(true);
  2575. }
  2576. else {
  2577. owners_1.length = 0;
  2578. }
  2579. });
  2580. var reject_1 = once(function (reason) {
  2581. warn$2("Failed to resolve async component: ".concat(String(factory)) +
  2582. (reason ? "\nReason: ".concat(reason) : ''));
  2583. if (isDef(factory.errorComp)) {
  2584. factory.error = true;
  2585. forceRender_1(true);
  2586. }
  2587. });
  2588. var res_1 = factory(resolve, reject_1);
  2589. if (isObject(res_1)) {
  2590. if (isPromise(res_1)) {
  2591. // () => Promise
  2592. if (isUndef(factory.resolved)) {
  2593. res_1.then(resolve, reject_1);
  2594. }
  2595. }
  2596. else if (isPromise(res_1.component)) {
  2597. res_1.component.then(resolve, reject_1);
  2598. if (isDef(res_1.error)) {
  2599. factory.errorComp = ensureCtor(res_1.error, baseCtor);
  2600. }
  2601. if (isDef(res_1.loading)) {
  2602. factory.loadingComp = ensureCtor(res_1.loading, baseCtor);
  2603. if (res_1.delay === 0) {
  2604. factory.loading = true;
  2605. }
  2606. else {
  2607. // @ts-expect-error NodeJS timeout type
  2608. timerLoading_1 = setTimeout(function () {
  2609. timerLoading_1 = null;
  2610. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  2611. factory.loading = true;
  2612. forceRender_1(false);
  2613. }
  2614. }, res_1.delay || 200);
  2615. }
  2616. }
  2617. if (isDef(res_1.timeout)) {
  2618. // @ts-expect-error NodeJS timeout type
  2619. timerTimeout_1 = setTimeout(function () {
  2620. timerTimeout_1 = null;
  2621. if (isUndef(factory.resolved)) {
  2622. reject_1("timeout (".concat(res_1.timeout, "ms)") );
  2623. }
  2624. }, res_1.timeout);
  2625. }
  2626. }
  2627. }
  2628. sync_1 = false;
  2629. // return in case resolved synchronously
  2630. return factory.loading ? factory.loadingComp : factory.resolved;
  2631. }
  2632. }
  2633. function getFirstComponentChild(children) {
  2634. if (isArray(children)) {
  2635. for (var i = 0; i < children.length; i++) {
  2636. var c = children[i];
  2637. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  2638. return c;
  2639. }
  2640. }
  2641. }
  2642. }
  2643. function initEvents(vm) {
  2644. vm._events = Object.create(null);
  2645. vm._hasHookEvent = false;
  2646. // init parent attached events
  2647. var listeners = vm.$options._parentListeners;
  2648. if (listeners) {
  2649. updateComponentListeners(vm, listeners);
  2650. }
  2651. }
  2652. var target$1;
  2653. function add$1(event, fn) {
  2654. target$1.$on(event, fn);
  2655. }
  2656. function remove$1(event, fn) {
  2657. target$1.$off(event, fn);
  2658. }
  2659. function createOnceHandler$1(event, fn) {
  2660. var _target = target$1;
  2661. return function onceHandler() {
  2662. var res = fn.apply(null, arguments);
  2663. if (res !== null) {
  2664. _target.$off(event, onceHandler);
  2665. }
  2666. };
  2667. }
  2668. function updateComponentListeners(vm, listeners, oldListeners) {
  2669. target$1 = vm;
  2670. updateListeners(listeners, oldListeners || {}, add$1, remove$1, createOnceHandler$1, vm);
  2671. target$1 = undefined;
  2672. }
  2673. function eventsMixin(Vue) {
  2674. var hookRE = /^hook:/;
  2675. Vue.prototype.$on = function (event, fn) {
  2676. var vm = this;
  2677. if (isArray(event)) {
  2678. for (var i = 0, l = event.length; i < l; i++) {
  2679. vm.$on(event[i], fn);
  2680. }
  2681. }
  2682. else {
  2683. (vm._events[event] || (vm._events[event] = [])).push(fn);
  2684. // optimize hook:event cost by using a boolean flag marked at registration
  2685. // instead of a hash lookup
  2686. if (hookRE.test(event)) {
  2687. vm._hasHookEvent = true;
  2688. }
  2689. }
  2690. return vm;
  2691. };
  2692. Vue.prototype.$once = function (event, fn) {
  2693. var vm = this;
  2694. function on() {
  2695. vm.$off(event, on);
  2696. fn.apply(vm, arguments);
  2697. }
  2698. on.fn = fn;
  2699. vm.$on(event, on);
  2700. return vm;
  2701. };
  2702. Vue.prototype.$off = function (event, fn) {
  2703. var vm = this;
  2704. // all
  2705. if (!arguments.length) {
  2706. vm._events = Object.create(null);
  2707. return vm;
  2708. }
  2709. // array of events
  2710. if (isArray(event)) {
  2711. for (var i_1 = 0, l = event.length; i_1 < l; i_1++) {
  2712. vm.$off(event[i_1], fn);
  2713. }
  2714. return vm;
  2715. }
  2716. // specific event
  2717. var cbs = vm._events[event];
  2718. if (!cbs) {
  2719. return vm;
  2720. }
  2721. if (!fn) {
  2722. vm._events[event] = null;
  2723. return vm;
  2724. }
  2725. // specific handler
  2726. var cb;
  2727. var i = cbs.length;
  2728. while (i--) {
  2729. cb = cbs[i];
  2730. if (cb === fn || cb.fn === fn) {
  2731. cbs.splice(i, 1);
  2732. break;
  2733. }
  2734. }
  2735. return vm;
  2736. };
  2737. Vue.prototype.$emit = function (event) {
  2738. var vm = this;
  2739. {
  2740. var lowerCaseEvent = event.toLowerCase();
  2741. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  2742. tip("Event \"".concat(lowerCaseEvent, "\" is emitted in component ") +
  2743. "".concat(formatComponentName(vm), " but the handler is registered for \"").concat(event, "\". ") +
  2744. "Note that HTML attributes are case-insensitive and you cannot use " +
  2745. "v-on to listen to camelCase events when using in-DOM templates. " +
  2746. "You should probably use \"".concat(hyphenate(event), "\" instead of \"").concat(event, "\"."));
  2747. }
  2748. }
  2749. var cbs = vm._events[event];
  2750. if (cbs) {
  2751. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  2752. var args = toArray(arguments, 1);
  2753. var info = "event handler for \"".concat(event, "\"");
  2754. for (var i = 0, l = cbs.length; i < l; i++) {
  2755. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  2756. }
  2757. }
  2758. return vm;
  2759. };
  2760. }
  2761. var activeEffectScope;
  2762. var EffectScope = /** @class */ (function () {
  2763. function EffectScope(detached) {
  2764. if (detached === void 0) { detached = false; }
  2765. this.detached = detached;
  2766. /**
  2767. * @internal
  2768. */
  2769. this.active = true;
  2770. /**
  2771. * @internal
  2772. */
  2773. this.effects = [];
  2774. /**
  2775. * @internal
  2776. */
  2777. this.cleanups = [];
  2778. this.parent = activeEffectScope;
  2779. if (!detached && activeEffectScope) {
  2780. this.index =
  2781. (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
  2782. }
  2783. }
  2784. EffectScope.prototype.run = function (fn) {
  2785. if (this.active) {
  2786. var currentEffectScope = activeEffectScope;
  2787. try {
  2788. activeEffectScope = this;
  2789. return fn();
  2790. }
  2791. finally {
  2792. activeEffectScope = currentEffectScope;
  2793. }
  2794. }
  2795. else {
  2796. warn$2("cannot run an inactive effect scope.");
  2797. }
  2798. };
  2799. /**
  2800. * This should only be called on non-detached scopes
  2801. * @internal
  2802. */
  2803. EffectScope.prototype.on = function () {
  2804. activeEffectScope = this;
  2805. };
  2806. /**
  2807. * This should only be called on non-detached scopes
  2808. * @internal
  2809. */
  2810. EffectScope.prototype.off = function () {
  2811. activeEffectScope = this.parent;
  2812. };
  2813. EffectScope.prototype.stop = function (fromParent) {
  2814. if (this.active) {
  2815. var i = void 0, l = void 0;
  2816. for (i = 0, l = this.effects.length; i < l; i++) {
  2817. this.effects[i].teardown();
  2818. }
  2819. for (i = 0, l = this.cleanups.length; i < l; i++) {
  2820. this.cleanups[i]();
  2821. }
  2822. if (this.scopes) {
  2823. for (i = 0, l = this.scopes.length; i < l; i++) {
  2824. this.scopes[i].stop(true);
  2825. }
  2826. }
  2827. // nested scope, dereference from parent to avoid memory leaks
  2828. if (!this.detached && this.parent && !fromParent) {
  2829. // optimized O(1) removal
  2830. var last = this.parent.scopes.pop();
  2831. if (last && last !== this) {
  2832. this.parent.scopes[this.index] = last;
  2833. last.index = this.index;
  2834. }
  2835. }
  2836. this.parent = undefined;
  2837. this.active = false;
  2838. }
  2839. };
  2840. return EffectScope;
  2841. }());
  2842. function effectScope(detached) {
  2843. return new EffectScope(detached);
  2844. }
  2845. /**
  2846. * @internal
  2847. */
  2848. function recordEffectScope(effect, scope) {
  2849. if (scope === void 0) { scope = activeEffectScope; }
  2850. if (scope && scope.active) {
  2851. scope.effects.push(effect);
  2852. }
  2853. }
  2854. function getCurrentScope() {
  2855. return activeEffectScope;
  2856. }
  2857. function onScopeDispose(fn) {
  2858. if (activeEffectScope) {
  2859. activeEffectScope.cleanups.push(fn);
  2860. }
  2861. else {
  2862. warn$2("onScopeDispose() is called when there is no active effect scope" +
  2863. " to be associated with.");
  2864. }
  2865. }
  2866. var activeInstance = null;
  2867. var isUpdatingChildComponent = false;
  2868. function setActiveInstance(vm) {
  2869. var prevActiveInstance = activeInstance;
  2870. activeInstance = vm;
  2871. return function () {
  2872. activeInstance = prevActiveInstance;
  2873. };
  2874. }
  2875. function initLifecycle(vm) {
  2876. var options = vm.$options;
  2877. // locate first non-abstract parent
  2878. var parent = options.parent;
  2879. if (parent && !options.abstract) {
  2880. while (parent.$options.abstract && parent.$parent) {
  2881. parent = parent.$parent;
  2882. }
  2883. parent.$children.push(vm);
  2884. }
  2885. vm.$parent = parent;
  2886. vm.$root = parent ? parent.$root : vm;
  2887. vm.$children = [];
  2888. vm.$refs = {};
  2889. vm._provided = parent ? parent._provided : Object.create(null);
  2890. vm._watcher = null;
  2891. vm._inactive = null;
  2892. vm._directInactive = false;
  2893. vm._isMounted = false;
  2894. vm._isDestroyed = false;
  2895. vm._isBeingDestroyed = false;
  2896. }
  2897. function lifecycleMixin(Vue) {
  2898. Vue.prototype._update = function (vnode, hydrating) {
  2899. var vm = this;
  2900. var prevEl = vm.$el;
  2901. var prevVnode = vm._vnode;
  2902. var restoreActiveInstance = setActiveInstance(vm);
  2903. vm._vnode = vnode;
  2904. // Vue.prototype.__patch__ is injected in entry points
  2905. // based on the rendering backend used.
  2906. if (!prevVnode) {
  2907. // initial render
  2908. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  2909. }
  2910. else {
  2911. // updates
  2912. vm.$el = vm.__patch__(prevVnode, vnode);
  2913. }
  2914. restoreActiveInstance();
  2915. // update __vue__ reference
  2916. if (prevEl) {
  2917. prevEl.__vue__ = null;
  2918. }
  2919. if (vm.$el) {
  2920. vm.$el.__vue__ = vm;
  2921. }
  2922. // if parent is an HOC, update its $el as well
  2923. var wrapper = vm;
  2924. while (wrapper &&
  2925. wrapper.$vnode &&
  2926. wrapper.$parent &&
  2927. wrapper.$vnode === wrapper.$parent._vnode) {
  2928. wrapper.$parent.$el = wrapper.$el;
  2929. wrapper = wrapper.$parent;
  2930. }
  2931. // updated hook is called by the scheduler to ensure that children are
  2932. // updated in a parent's updated hook.
  2933. };
  2934. Vue.prototype.$forceUpdate = function () {
  2935. var vm = this;
  2936. if (vm._watcher) {
  2937. vm._watcher.update();
  2938. }
  2939. };
  2940. Vue.prototype.$destroy = function () {
  2941. var vm = this;
  2942. if (vm._isBeingDestroyed) {
  2943. return;
  2944. }
  2945. callHook$1(vm, 'beforeDestroy');
  2946. vm._isBeingDestroyed = true;
  2947. // remove self from parent
  2948. var parent = vm.$parent;
  2949. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  2950. remove$2(parent.$children, vm);
  2951. }
  2952. // teardown scope. this includes both the render watcher and other
  2953. // watchers created
  2954. vm._scope.stop();
  2955. // remove reference from data ob
  2956. // frozen object may not have observer.
  2957. if (vm._data.__ob__) {
  2958. vm._data.__ob__.vmCount--;
  2959. }
  2960. // call the last hook...
  2961. vm._isDestroyed = true;
  2962. // invoke destroy hooks on current rendered tree
  2963. vm.__patch__(vm._vnode, null);
  2964. // fire destroyed hook
  2965. callHook$1(vm, 'destroyed');
  2966. // turn off all instance listeners.
  2967. vm.$off();
  2968. // remove __vue__ reference
  2969. if (vm.$el) {
  2970. vm.$el.__vue__ = null;
  2971. }
  2972. // release circular reference (#6759)
  2973. if (vm.$vnode) {
  2974. vm.$vnode.parent = null;
  2975. }
  2976. };
  2977. }
  2978. function mountComponent(vm, el, hydrating) {
  2979. vm.$el = el;
  2980. if (!vm.$options.render) {
  2981. // @ts-expect-error invalid type
  2982. vm.$options.render = createEmptyVNode;
  2983. {
  2984. /* istanbul ignore if */
  2985. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  2986. vm.$options.el ||
  2987. el) {
  2988. warn$2('You are using the runtime-only build of Vue where the template ' +
  2989. 'compiler is not available. Either pre-compile the templates into ' +
  2990. 'render functions, or use the compiler-included build.', vm);
  2991. }
  2992. else {
  2993. warn$2('Failed to mount component: template or render function not defined.', vm);
  2994. }
  2995. }
  2996. }
  2997. callHook$1(vm, 'beforeMount');
  2998. var updateComponent;
  2999. /* istanbul ignore if */
  3000. if (config.performance && mark) {
  3001. updateComponent = function () {
  3002. var name = vm._name;
  3003. var id = vm._uid;
  3004. var startTag = "vue-perf-start:".concat(id);
  3005. var endTag = "vue-perf-end:".concat(id);
  3006. mark(startTag);
  3007. var vnode = vm._render();
  3008. mark(endTag);
  3009. measure("vue ".concat(name, " render"), startTag, endTag);
  3010. mark(startTag);
  3011. vm._update(vnode, hydrating);
  3012. mark(endTag);
  3013. measure("vue ".concat(name, " patch"), startTag, endTag);
  3014. };
  3015. }
  3016. else {
  3017. updateComponent = function () {
  3018. vm._update(vm._render(), hydrating);
  3019. };
  3020. }
  3021. var watcherOptions = {
  3022. before: function () {
  3023. if (vm._isMounted && !vm._isDestroyed) {
  3024. callHook$1(vm, 'beforeUpdate');
  3025. }
  3026. }
  3027. };
  3028. {
  3029. watcherOptions.onTrack = function (e) { return callHook$1(vm, 'renderTracked', [e]); };
  3030. watcherOptions.onTrigger = function (e) { return callHook$1(vm, 'renderTriggered', [e]); };
  3031. }
  3032. // we set this to vm._watcher inside the watcher's constructor
  3033. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  3034. // component's mounted hook), which relies on vm._watcher being already defined
  3035. new Watcher(vm, updateComponent, noop, watcherOptions, true /* isRenderWatcher */);
  3036. hydrating = false;
  3037. // flush buffer for flush: "pre" watchers queued in setup()
  3038. var preWatchers = vm._preWatchers;
  3039. if (preWatchers) {
  3040. for (var i = 0; i < preWatchers.length; i++) {
  3041. preWatchers[i].run();
  3042. }
  3043. }
  3044. // manually mounted instance, call mounted on self
  3045. // mounted is called for render-created child components in its inserted hook
  3046. if (vm.$vnode == null) {
  3047. vm._isMounted = true;
  3048. callHook$1(vm, 'mounted');
  3049. }
  3050. return vm;
  3051. }
  3052. function updateChildComponent(vm, propsData, listeners, parentVnode, renderChildren) {
  3053. {
  3054. isUpdatingChildComponent = true;
  3055. }
  3056. // determine whether component has slot children
  3057. // we need to do this before overwriting $options._renderChildren.
  3058. // check if there are dynamic scopedSlots (hand-written or compiled but with
  3059. // dynamic slot names). Static scoped slots compiled from template has the
  3060. // "$stable" marker.
  3061. var newScopedSlots = parentVnode.data.scopedSlots;
  3062. var oldScopedSlots = vm.$scopedSlots;
  3063. var hasDynamicScopedSlot = !!((newScopedSlots && !newScopedSlots.$stable) ||
  3064. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  3065. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
  3066. (!newScopedSlots && vm.$scopedSlots.$key));
  3067. // Any static slot children from the parent may have changed during parent's
  3068. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  3069. // update is necessary to ensure correctness.
  3070. var needsForceUpdate = !!(renderChildren || // has new static slots
  3071. vm.$options._renderChildren || // has old static slots
  3072. hasDynamicScopedSlot);
  3073. var prevVNode = vm.$vnode;
  3074. vm.$options._parentVnode = parentVnode;
  3075. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  3076. if (vm._vnode) {
  3077. // update child tree's parent
  3078. vm._vnode.parent = parentVnode;
  3079. }
  3080. vm.$options._renderChildren = renderChildren;
  3081. // update $attrs and $listeners hash
  3082. // these are also reactive so they may trigger child update if the child
  3083. // used them during render
  3084. var attrs = parentVnode.data.attrs || emptyObject;
  3085. if (vm._attrsProxy) {
  3086. // force update if attrs are accessed and has changed since it may be
  3087. // passed to a child component.
  3088. if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) {
  3089. needsForceUpdate = true;
  3090. }
  3091. }
  3092. vm.$attrs = attrs;
  3093. // update listeners
  3094. listeners = listeners || emptyObject;
  3095. var prevListeners = vm.$options._parentListeners;
  3096. if (vm._listenersProxy) {
  3097. syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners');
  3098. }
  3099. vm.$listeners = vm.$options._parentListeners = listeners;
  3100. updateComponentListeners(vm, listeners, prevListeners);
  3101. // update props
  3102. if (propsData && vm.$options.props) {
  3103. toggleObserving(false);
  3104. var props = vm._props;
  3105. var propKeys = vm.$options._propKeys || [];
  3106. for (var i = 0; i < propKeys.length; i++) {
  3107. var key = propKeys[i];
  3108. var propOptions = vm.$options.props; // wtf flow?
  3109. props[key] = validateProp(key, propOptions, propsData, vm);
  3110. }
  3111. toggleObserving(true);
  3112. // keep a copy of raw propsData
  3113. vm.$options.propsData = propsData;
  3114. }
  3115. // resolve slots + force update if has children
  3116. if (needsForceUpdate) {
  3117. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  3118. vm.$forceUpdate();
  3119. }
  3120. {
  3121. isUpdatingChildComponent = false;
  3122. }
  3123. }
  3124. function isInInactiveTree(vm) {
  3125. while (vm && (vm = vm.$parent)) {
  3126. if (vm._inactive)
  3127. return true;
  3128. }
  3129. return false;
  3130. }
  3131. function activateChildComponent(vm, direct) {
  3132. if (direct) {
  3133. vm._directInactive = false;
  3134. if (isInInactiveTree(vm)) {
  3135. return;
  3136. }
  3137. }
  3138. else if (vm._directInactive) {
  3139. return;
  3140. }
  3141. if (vm._inactive || vm._inactive === null) {
  3142. vm._inactive = false;
  3143. for (var i = 0; i < vm.$children.length; i++) {
  3144. activateChildComponent(vm.$children[i]);
  3145. }
  3146. callHook$1(vm, 'activated');
  3147. }
  3148. }
  3149. function deactivateChildComponent(vm, direct) {
  3150. if (direct) {
  3151. vm._directInactive = true;
  3152. if (isInInactiveTree(vm)) {
  3153. return;
  3154. }
  3155. }
  3156. if (!vm._inactive) {
  3157. vm._inactive = true;
  3158. for (var i = 0; i < vm.$children.length; i++) {
  3159. deactivateChildComponent(vm.$children[i]);
  3160. }
  3161. callHook$1(vm, 'deactivated');
  3162. }
  3163. }
  3164. function callHook$1(vm, hook, args, setContext) {
  3165. if (setContext === void 0) { setContext = true; }
  3166. // #7573 disable dep collection when invoking lifecycle hooks
  3167. pushTarget();
  3168. var prevInst = currentInstance;
  3169. var prevScope = getCurrentScope();
  3170. setContext && setCurrentInstance(vm);
  3171. var handlers = vm.$options[hook];
  3172. var info = "".concat(hook, " hook");
  3173. if (handlers) {
  3174. for (var i = 0, j = handlers.length; i < j; i++) {
  3175. invokeWithErrorHandling(handlers[i], vm, args || null, vm, info);
  3176. }
  3177. }
  3178. if (vm._hasHookEvent) {
  3179. vm.$emit('hook:' + hook);
  3180. }
  3181. if (setContext) {
  3182. setCurrentInstance(prevInst);
  3183. prevScope && prevScope.on();
  3184. }
  3185. popTarget();
  3186. }
  3187. var MAX_UPDATE_COUNT = 100;
  3188. var queue = [];
  3189. var activatedChildren = [];
  3190. var has = {};
  3191. var circular = {};
  3192. var waiting = false;
  3193. var flushing = false;
  3194. var index$1 = 0;
  3195. /**
  3196. * Reset the scheduler's state.
  3197. */
  3198. function resetSchedulerState() {
  3199. index$1 = queue.length = activatedChildren.length = 0;
  3200. has = {};
  3201. {
  3202. circular = {};
  3203. }
  3204. waiting = flushing = false;
  3205. }
  3206. // Async edge case #6566 requires saving the timestamp when event listeners are
  3207. // attached. However, calling performance.now() has a perf overhead especially
  3208. // if the page has thousands of event listeners. Instead, we take a timestamp
  3209. // every time the scheduler flushes and use that for all event listeners
  3210. // attached during that flush.
  3211. var currentFlushTimestamp = 0;
  3212. // Async edge case fix requires storing an event listener's attach timestamp.
  3213. var getNow = Date.now;
  3214. // Determine what event timestamp the browser is using. Annoyingly, the
  3215. // timestamp can either be hi-res (relative to page load) or low-res
  3216. // (relative to UNIX epoch), so in order to compare time we have to use the
  3217. // same timestamp type when saving the flush timestamp.
  3218. // All IE versions use low-res event timestamps, and have problematic clock
  3219. // implementations (#9632)
  3220. if (inBrowser && !isIE) {
  3221. var performance_1 = window.performance;
  3222. if (performance_1 &&
  3223. typeof performance_1.now === 'function' &&
  3224. getNow() > document.createEvent('Event').timeStamp) {
  3225. // if the event timestamp, although evaluated AFTER the Date.now(), is
  3226. // smaller than it, it means the event is using a hi-res timestamp,
  3227. // and we need to use the hi-res version for event listener timestamps as
  3228. // well.
  3229. getNow = function () { return performance_1.now(); };
  3230. }
  3231. }
  3232. var sortCompareFn = function (a, b) {
  3233. if (a.post) {
  3234. if (!b.post)
  3235. return 1;
  3236. }
  3237. else if (b.post) {
  3238. return -1;
  3239. }
  3240. return a.id - b.id;
  3241. };
  3242. /**
  3243. * Flush both queues and run the watchers.
  3244. */
  3245. function flushSchedulerQueue() {
  3246. currentFlushTimestamp = getNow();
  3247. flushing = true;
  3248. var watcher, id;
  3249. // Sort queue before flush.
  3250. // This ensures that:
  3251. // 1. Components are updated from parent to child. (because parent is always
  3252. // created before the child)
  3253. // 2. A component's user watchers are run before its render watcher (because
  3254. // user watchers are created before the render watcher)
  3255. // 3. If a component is destroyed during a parent component's watcher run,
  3256. // its watchers can be skipped.
  3257. queue.sort(sortCompareFn);
  3258. // do not cache length because more watchers might be pushed
  3259. // as we run existing watchers
  3260. for (index$1 = 0; index$1 < queue.length; index$1++) {
  3261. watcher = queue[index$1];
  3262. if (watcher.before) {
  3263. watcher.before();
  3264. }
  3265. id = watcher.id;
  3266. has[id] = null;
  3267. watcher.run();
  3268. // in dev build, check and stop circular updates.
  3269. if (has[id] != null) {
  3270. circular[id] = (circular[id] || 0) + 1;
  3271. if (circular[id] > MAX_UPDATE_COUNT) {
  3272. warn$2('You may have an infinite update loop ' +
  3273. (watcher.user
  3274. ? "in watcher with expression \"".concat(watcher.expression, "\"")
  3275. : "in a component render function."), watcher.vm);
  3276. break;
  3277. }
  3278. }
  3279. }
  3280. // keep copies of post queues before resetting state
  3281. var activatedQueue = activatedChildren.slice();
  3282. var updatedQueue = queue.slice();
  3283. resetSchedulerState();
  3284. // call component updated and activated hooks
  3285. callActivatedHooks(activatedQueue);
  3286. callUpdatedHooks(updatedQueue);
  3287. cleanupDeps();
  3288. // devtool hook
  3289. /* istanbul ignore if */
  3290. if (devtools && config.devtools) {
  3291. devtools.emit('flush');
  3292. }
  3293. }
  3294. function callUpdatedHooks(queue) {
  3295. var i = queue.length;
  3296. while (i--) {
  3297. var watcher = queue[i];
  3298. var vm = watcher.vm;
  3299. if (vm && vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  3300. callHook$1(vm, 'updated');
  3301. }
  3302. }
  3303. }
  3304. /**
  3305. * Queue a kept-alive component that was activated during patch.
  3306. * The queue will be processed after the entire tree has been patched.
  3307. */
  3308. function queueActivatedComponent(vm) {
  3309. // setting _inactive to false here so that a render function can
  3310. // rely on checking whether it's in an inactive tree (e.g. router-view)
  3311. vm._inactive = false;
  3312. activatedChildren.push(vm);
  3313. }
  3314. function callActivatedHooks(queue) {
  3315. for (var i = 0; i < queue.length; i++) {
  3316. queue[i]._inactive = true;
  3317. activateChildComponent(queue[i], true /* true */);
  3318. }
  3319. }
  3320. /**
  3321. * Push a watcher into the watcher queue.
  3322. * Jobs with duplicate IDs will be skipped unless it's
  3323. * pushed when the queue is being flushed.
  3324. */
  3325. function queueWatcher(watcher) {
  3326. var id = watcher.id;
  3327. if (has[id] != null) {
  3328. return;
  3329. }
  3330. if (watcher === Dep.target && watcher.noRecurse) {
  3331. return;
  3332. }
  3333. has[id] = true;
  3334. if (!flushing) {
  3335. queue.push(watcher);
  3336. }
  3337. else {
  3338. // if already flushing, splice the watcher based on its id
  3339. // if already past its id, it will be run next immediately.
  3340. var i = queue.length - 1;
  3341. while (i > index$1 && queue[i].id > watcher.id) {
  3342. i--;
  3343. }
  3344. queue.splice(i + 1, 0, watcher);
  3345. }
  3346. // queue the flush
  3347. if (!waiting) {
  3348. waiting = true;
  3349. if (!config.async) {
  3350. flushSchedulerQueue();
  3351. return;
  3352. }
  3353. nextTick(flushSchedulerQueue);
  3354. }
  3355. }
  3356. var WATCHER = "watcher";
  3357. var WATCHER_CB = "".concat(WATCHER, " callback");
  3358. var WATCHER_GETTER = "".concat(WATCHER, " getter");
  3359. var WATCHER_CLEANUP = "".concat(WATCHER, " cleanup");
  3360. // Simple effect.
  3361. function watchEffect(effect, options) {
  3362. return doWatch(effect, null, options);
  3363. }
  3364. function watchPostEffect(effect, options) {
  3365. return doWatch(effect, null, (__assign(__assign({}, options), { flush: 'post' }) ));
  3366. }
  3367. function watchSyncEffect(effect, options) {
  3368. return doWatch(effect, null, (__assign(__assign({}, options), { flush: 'sync' }) ));
  3369. }
  3370. // initial value for watchers to trigger on undefined initial values
  3371. var INITIAL_WATCHER_VALUE = {};
  3372. // implementation
  3373. function watch(source, cb, options) {
  3374. if (typeof cb !== 'function') {
  3375. warn$2("`watch(fn, options?)` signature has been moved to a separate API. " +
  3376. "Use `watchEffect(fn, options?)` instead. `watch` now only " +
  3377. "supports `watch(source, cb, options?) signature.");
  3378. }
  3379. return doWatch(source, cb, options);
  3380. }
  3381. function doWatch(source, cb, _a) {
  3382. var _b = _a === void 0 ? emptyObject : _a, immediate = _b.immediate, deep = _b.deep, _c = _b.flush, flush = _c === void 0 ? 'pre' : _c, onTrack = _b.onTrack, onTrigger = _b.onTrigger;
  3383. if (!cb) {
  3384. if (immediate !== undefined) {
  3385. warn$2("watch() \"immediate\" option is only respected when using the " +
  3386. "watch(source, callback, options?) signature.");
  3387. }
  3388. if (deep !== undefined) {
  3389. warn$2("watch() \"deep\" option is only respected when using the " +
  3390. "watch(source, callback, options?) signature.");
  3391. }
  3392. }
  3393. var warnInvalidSource = function (s) {
  3394. warn$2("Invalid watch source: ".concat(s, ". A watch source can only be a getter/effect ") +
  3395. "function, a ref, a reactive object, or an array of these types.");
  3396. };
  3397. var instance = currentInstance;
  3398. var call = function (fn, type, args) {
  3399. if (args === void 0) { args = null; }
  3400. var res = invokeWithErrorHandling(fn, null, args, instance, type);
  3401. if (deep && res && res.__ob__)
  3402. res.__ob__.dep.depend();
  3403. return res;
  3404. };
  3405. var getter;
  3406. var forceTrigger = false;
  3407. var isMultiSource = false;
  3408. if (isRef(source)) {
  3409. getter = function () { return source.value; };
  3410. forceTrigger = isShallow(source);
  3411. }
  3412. else if (isReactive(source)) {
  3413. getter = function () {
  3414. source.__ob__.dep.depend();
  3415. return source;
  3416. };
  3417. deep = true;
  3418. }
  3419. else if (isArray(source)) {
  3420. isMultiSource = true;
  3421. forceTrigger = source.some(function (s) { return isReactive(s) || isShallow(s); });
  3422. getter = function () {
  3423. return source.map(function (s) {
  3424. if (isRef(s)) {
  3425. return s.value;
  3426. }
  3427. else if (isReactive(s)) {
  3428. s.__ob__.dep.depend();
  3429. return traverse(s);
  3430. }
  3431. else if (isFunction(s)) {
  3432. return call(s, WATCHER_GETTER);
  3433. }
  3434. else {
  3435. warnInvalidSource(s);
  3436. }
  3437. });
  3438. };
  3439. }
  3440. else if (isFunction(source)) {
  3441. if (cb) {
  3442. // getter with cb
  3443. getter = function () { return call(source, WATCHER_GETTER); };
  3444. }
  3445. else {
  3446. // no cb -> simple effect
  3447. getter = function () {
  3448. if (instance && instance._isDestroyed) {
  3449. return;
  3450. }
  3451. if (cleanup) {
  3452. cleanup();
  3453. }
  3454. return call(source, WATCHER, [onCleanup]);
  3455. };
  3456. }
  3457. }
  3458. else {
  3459. getter = noop;
  3460. warnInvalidSource(source);
  3461. }
  3462. if (cb && deep) {
  3463. var baseGetter_1 = getter;
  3464. getter = function () { return traverse(baseGetter_1()); };
  3465. }
  3466. var cleanup;
  3467. var onCleanup = function (fn) {
  3468. cleanup = watcher.onStop = function () {
  3469. call(fn, WATCHER_CLEANUP);
  3470. };
  3471. };
  3472. // in SSR there is no need to setup an actual effect, and it should be noop
  3473. // unless it's eager
  3474. if (isServerRendering()) {
  3475. // we will also not call the invalidate callback (+ runner is not set up)
  3476. onCleanup = noop;
  3477. if (!cb) {
  3478. getter();
  3479. }
  3480. else if (immediate) {
  3481. call(cb, WATCHER_CB, [
  3482. getter(),
  3483. isMultiSource ? [] : undefined,
  3484. onCleanup
  3485. ]);
  3486. }
  3487. return noop;
  3488. }
  3489. var watcher = new Watcher(currentInstance, getter, noop, {
  3490. lazy: true
  3491. });
  3492. watcher.noRecurse = !cb;
  3493. var oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
  3494. // overwrite default run
  3495. watcher.run = function () {
  3496. if (!watcher.active) {
  3497. return;
  3498. }
  3499. if (cb) {
  3500. // watch(source, cb)
  3501. var newValue = watcher.get();
  3502. if (deep ||
  3503. forceTrigger ||
  3504. (isMultiSource
  3505. ? newValue.some(function (v, i) {
  3506. return hasChanged(v, oldValue[i]);
  3507. })
  3508. : hasChanged(newValue, oldValue))) {
  3509. // cleanup before running cb again
  3510. if (cleanup) {
  3511. cleanup();
  3512. }
  3513. call(cb, WATCHER_CB, [
  3514. newValue,
  3515. // pass undefined as the old value when it's changed for the first time
  3516. oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
  3517. onCleanup
  3518. ]);
  3519. oldValue = newValue;
  3520. }
  3521. }
  3522. else {
  3523. // watchEffect
  3524. watcher.get();
  3525. }
  3526. };
  3527. if (flush === 'sync') {
  3528. watcher.update = watcher.run;
  3529. }
  3530. else if (flush === 'post') {
  3531. watcher.post = true;
  3532. watcher.update = function () { return queueWatcher(watcher); };
  3533. }
  3534. else {
  3535. // pre
  3536. watcher.update = function () {
  3537. if (instance && instance === currentInstance && !instance._isMounted) {
  3538. // pre-watcher triggered before
  3539. var buffer = instance._preWatchers || (instance._preWatchers = []);
  3540. if (buffer.indexOf(watcher) < 0)
  3541. buffer.push(watcher);
  3542. }
  3543. else {
  3544. queueWatcher(watcher);
  3545. }
  3546. };
  3547. }
  3548. {
  3549. watcher.onTrack = onTrack;
  3550. watcher.onTrigger = onTrigger;
  3551. }
  3552. // initial run
  3553. if (cb) {
  3554. if (immediate) {
  3555. watcher.run();
  3556. }
  3557. else {
  3558. oldValue = watcher.get();
  3559. }
  3560. }
  3561. else if (flush === 'post' && instance) {
  3562. instance.$once('hook:mounted', function () { return watcher.get(); });
  3563. }
  3564. else {
  3565. watcher.get();
  3566. }
  3567. return function () {
  3568. watcher.teardown();
  3569. };
  3570. }
  3571. function provide(key, value) {
  3572. if (!currentInstance) {
  3573. {
  3574. warn$2("provide() can only be used inside setup().");
  3575. }
  3576. }
  3577. else {
  3578. // TS doesn't allow symbol as index type
  3579. resolveProvided(currentInstance)[key] = value;
  3580. }
  3581. }
  3582. function resolveProvided(vm) {
  3583. // by default an instance inherits its parent's provides object
  3584. // but when it needs to provide values of its own, it creates its
  3585. // own provides object using parent provides object as prototype.
  3586. // this way in `inject` we can simply look up injections from direct
  3587. // parent and let the prototype chain do the work.
  3588. var existing = vm._provided;
  3589. var parentProvides = vm.$parent && vm.$parent._provided;
  3590. if (parentProvides === existing) {
  3591. return (vm._provided = Object.create(parentProvides));
  3592. }
  3593. else {
  3594. return existing;
  3595. }
  3596. }
  3597. function inject(key, defaultValue, treatDefaultAsFactory) {
  3598. if (treatDefaultAsFactory === void 0) { treatDefaultAsFactory = false; }
  3599. // fallback to `currentRenderingInstance` so that this can be called in
  3600. // a functional component
  3601. var instance = currentInstance;
  3602. if (instance) {
  3603. // #2400
  3604. // to support `app.use` plugins,
  3605. // fallback to appContext's `provides` if the instance is at root
  3606. var provides = instance.$parent && instance.$parent._provided;
  3607. if (provides && key in provides) {
  3608. // TS doesn't allow symbol as index type
  3609. return provides[key];
  3610. }
  3611. else if (arguments.length > 1) {
  3612. return treatDefaultAsFactory && isFunction(defaultValue)
  3613. ? defaultValue.call(instance)
  3614. : defaultValue;
  3615. }
  3616. else {
  3617. warn$2("injection \"".concat(String(key), "\" not found."));
  3618. }
  3619. }
  3620. else {
  3621. warn$2("inject() can only be used inside setup() or functional components.");
  3622. }
  3623. }
  3624. /**
  3625. * @internal this function needs manual public type declaration because it relies
  3626. * on previously manually authored types from Vue 2
  3627. */
  3628. function h(type, props, children) {
  3629. if (!currentInstance) {
  3630. warn$2("globally imported h() can only be invoked when there is an active " +
  3631. "component instance, e.g. synchronously in a component's render or setup function.");
  3632. }
  3633. return createElement$1(currentInstance, type, props, children, 2, true);
  3634. }
  3635. function handleError(err, vm, info) {
  3636. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  3637. // See: https://github.com/vuejs/vuex/issues/1505
  3638. pushTarget();
  3639. try {
  3640. if (vm) {
  3641. var cur = vm;
  3642. while ((cur = cur.$parent)) {
  3643. var hooks = cur.$options.errorCaptured;
  3644. if (hooks) {
  3645. for (var i = 0; i < hooks.length; i++) {
  3646. try {
  3647. var capture = hooks[i].call(cur, err, vm, info) === false;
  3648. if (capture)
  3649. return;
  3650. }
  3651. catch (e) {
  3652. globalHandleError(e, cur, 'errorCaptured hook');
  3653. }
  3654. }
  3655. }
  3656. }
  3657. }
  3658. globalHandleError(err, vm, info);
  3659. }
  3660. finally {
  3661. popTarget();
  3662. }
  3663. }
  3664. function invokeWithErrorHandling(handler, context, args, vm, info) {
  3665. var res;
  3666. try {
  3667. res = args ? handler.apply(context, args) : handler.call(context);
  3668. if (res && !res._isVue && isPromise(res) && !res._handled) {
  3669. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  3670. res._handled = true;
  3671. }
  3672. }
  3673. catch (e) {
  3674. handleError(e, vm, info);
  3675. }
  3676. return res;
  3677. }
  3678. function globalHandleError(err, vm, info) {
  3679. if (config.errorHandler) {
  3680. try {
  3681. return config.errorHandler.call(null, err, vm, info);
  3682. }
  3683. catch (e) {
  3684. // if the user intentionally throws the original error in the handler,
  3685. // do not log it twice
  3686. if (e !== err) {
  3687. logError(e, null, 'config.errorHandler');
  3688. }
  3689. }
  3690. }
  3691. logError(err, vm, info);
  3692. }
  3693. function logError(err, vm, info) {
  3694. {
  3695. warn$2("Error in ".concat(info, ": \"").concat(err.toString(), "\""), vm);
  3696. }
  3697. /* istanbul ignore else */
  3698. if (inBrowser && typeof console !== 'undefined') {
  3699. console.error(err);
  3700. }
  3701. else {
  3702. throw err;
  3703. }
  3704. }
  3705. /* globals MutationObserver */
  3706. var isUsingMicroTask = false;
  3707. var callbacks = [];
  3708. var pending = false;
  3709. function flushCallbacks() {
  3710. pending = false;
  3711. var copies = callbacks.slice(0);
  3712. callbacks.length = 0;
  3713. for (var i = 0; i < copies.length; i++) {
  3714. copies[i]();
  3715. }
  3716. }
  3717. // Here we have async deferring wrappers using microtasks.
  3718. // In 2.5 we used (macro) tasks (in combination with microtasks).
  3719. // However, it has subtle problems when state is changed right before repaint
  3720. // (e.g. #6813, out-in transitions).
  3721. // Also, using (macro) tasks in event handler would cause some weird behaviors
  3722. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  3723. // So we now use microtasks everywhere, again.
  3724. // A major drawback of this tradeoff is that there are some scenarios
  3725. // where microtasks have too high a priority and fire in between supposedly
  3726. // sequential events (e.g. #4521, #6690, which have workarounds)
  3727. // or even between bubbling of the same event (#6566).
  3728. var timerFunc;
  3729. // The nextTick behavior leverages the microtask queue, which can be accessed
  3730. // via either native Promise.then or MutationObserver.
  3731. // MutationObserver has wider support, however it is seriously bugged in
  3732. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  3733. // completely stops working after triggering a few times... so, if native
  3734. // Promise is available, we will use it:
  3735. /* istanbul ignore next, $flow-disable-line */
  3736. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  3737. var p_1 = Promise.resolve();
  3738. timerFunc = function () {
  3739. p_1.then(flushCallbacks);
  3740. // In problematic UIWebViews, Promise.then doesn't completely break, but
  3741. // it can get stuck in a weird state where callbacks are pushed into the
  3742. // microtask queue but the queue isn't being flushed, until the browser
  3743. // needs to do some other work, e.g. handle a timer. Therefore we can
  3744. // "force" the microtask queue to be flushed by adding an empty timer.
  3745. if (isIOS)
  3746. setTimeout(noop);
  3747. };
  3748. isUsingMicroTask = true;
  3749. }
  3750. else if (!isIE &&
  3751. typeof MutationObserver !== 'undefined' &&
  3752. (isNative(MutationObserver) ||
  3753. // PhantomJS and iOS 7.x
  3754. MutationObserver.toString() === '[object MutationObserverConstructor]')) {
  3755. // Use MutationObserver where native Promise is not available,
  3756. // e.g. PhantomJS, iOS7, Android 4.4
  3757. // (#6466 MutationObserver is unreliable in IE11)
  3758. var counter_1 = 1;
  3759. var observer = new MutationObserver(flushCallbacks);
  3760. var textNode_1 = document.createTextNode(String(counter_1));
  3761. observer.observe(textNode_1, {
  3762. characterData: true
  3763. });
  3764. timerFunc = function () {
  3765. counter_1 = (counter_1 + 1) % 2;
  3766. textNode_1.data = String(counter_1);
  3767. };
  3768. isUsingMicroTask = true;
  3769. }
  3770. else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  3771. // Fallback to setImmediate.
  3772. // Technically it leverages the (macro) task queue,
  3773. // but it is still a better choice than setTimeout.
  3774. timerFunc = function () {
  3775. setImmediate(flushCallbacks);
  3776. };
  3777. }
  3778. else {
  3779. // Fallback to setTimeout.
  3780. timerFunc = function () {
  3781. setTimeout(flushCallbacks, 0);
  3782. };
  3783. }
  3784. /**
  3785. * @internal
  3786. */
  3787. function nextTick(cb, ctx) {
  3788. var _resolve;
  3789. callbacks.push(function () {
  3790. if (cb) {
  3791. try {
  3792. cb.call(ctx);
  3793. }
  3794. catch (e) {
  3795. handleError(e, ctx, 'nextTick');
  3796. }
  3797. }
  3798. else if (_resolve) {
  3799. _resolve(ctx);
  3800. }
  3801. });
  3802. if (!pending) {
  3803. pending = true;
  3804. timerFunc();
  3805. }
  3806. // $flow-disable-line
  3807. if (!cb && typeof Promise !== 'undefined') {
  3808. return new Promise(function (resolve) {
  3809. _resolve = resolve;
  3810. });
  3811. }
  3812. }
  3813. function useCssModule(name) {
  3814. /* istanbul ignore else */
  3815. {
  3816. {
  3817. warn$2("useCssModule() is not supported in the global build.");
  3818. }
  3819. return emptyObject;
  3820. }
  3821. }
  3822. /**
  3823. * Runtime helper for SFC's CSS variable injection feature.
  3824. * @private
  3825. */
  3826. function useCssVars(getter) {
  3827. if (!inBrowser && !false)
  3828. return;
  3829. var instance = currentInstance;
  3830. if (!instance) {
  3831. warn$2("useCssVars is called without current active component instance.");
  3832. return;
  3833. }
  3834. watchPostEffect(function () {
  3835. var el = instance.$el;
  3836. var vars = getter(instance, instance._setupProxy);
  3837. if (el && el.nodeType === 1) {
  3838. var style = el.style;
  3839. for (var key in vars) {
  3840. style.setProperty("--".concat(key), vars[key]);
  3841. }
  3842. }
  3843. });
  3844. }
  3845. /**
  3846. * v3-compatible async component API.
  3847. * @internal the type is manually declared in <root>/types/v3-define-async-component.d.ts
  3848. * because it relies on existing manual types
  3849. */
  3850. function defineAsyncComponent(source) {
  3851. if (isFunction(source)) {
  3852. source = { loader: source };
  3853. }
  3854. var loader = source.loader, loadingComponent = source.loadingComponent, errorComponent = source.errorComponent, _a = source.delay, delay = _a === void 0 ? 200 : _a, timeout = source.timeout, // undefined = never times out
  3855. _b = source.suspensible, // undefined = never times out
  3856. suspensible = _b === void 0 ? false : _b, // in Vue 3 default is true
  3857. userOnError = source.onError;
  3858. if (suspensible) {
  3859. warn$2("The suspensible option for async components is not supported in Vue2. It is ignored.");
  3860. }
  3861. var pendingRequest = null;
  3862. var retries = 0;
  3863. var retry = function () {
  3864. retries++;
  3865. pendingRequest = null;
  3866. return load();
  3867. };
  3868. var load = function () {
  3869. var thisRequest;
  3870. return (pendingRequest ||
  3871. (thisRequest = pendingRequest =
  3872. loader()
  3873. .catch(function (err) {
  3874. err = err instanceof Error ? err : new Error(String(err));
  3875. if (userOnError) {
  3876. return new Promise(function (resolve, reject) {
  3877. var userRetry = function () { return resolve(retry()); };
  3878. var userFail = function () { return reject(err); };
  3879. userOnError(err, userRetry, userFail, retries + 1);
  3880. });
  3881. }
  3882. else {
  3883. throw err;
  3884. }
  3885. })
  3886. .then(function (comp) {
  3887. if (thisRequest !== pendingRequest && pendingRequest) {
  3888. return pendingRequest;
  3889. }
  3890. if (!comp) {
  3891. warn$2("Async component loader resolved to undefined. " +
  3892. "If you are using retry(), make sure to return its return value.");
  3893. }
  3894. // interop module default
  3895. if (comp &&
  3896. (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
  3897. comp = comp.default;
  3898. }
  3899. if (comp && !isObject(comp) && !isFunction(comp)) {
  3900. throw new Error("Invalid async component load result: ".concat(comp));
  3901. }
  3902. return comp;
  3903. })));
  3904. };
  3905. return function () {
  3906. var component = load();
  3907. return {
  3908. component: component,
  3909. delay: delay,
  3910. timeout: timeout,
  3911. error: errorComponent,
  3912. loading: loadingComponent
  3913. };
  3914. };
  3915. }
  3916. function createLifeCycle(hookName) {
  3917. return function (fn, target) {
  3918. if (target === void 0) { target = currentInstance; }
  3919. if (!target) {
  3920. warn$2("".concat(formatName(hookName), " is called when there is no active component instance to be ") +
  3921. "associated with. " +
  3922. "Lifecycle injection APIs can only be used during execution of setup().");
  3923. return;
  3924. }
  3925. return injectHook(target, hookName, fn);
  3926. };
  3927. }
  3928. function formatName(name) {
  3929. if (name === 'beforeDestroy') {
  3930. name = 'beforeUnmount';
  3931. }
  3932. else if (name === 'destroyed') {
  3933. name = 'unmounted';
  3934. }
  3935. return "on".concat(name[0].toUpperCase() + name.slice(1));
  3936. }
  3937. function injectHook(instance, hookName, fn) {
  3938. var options = instance.$options;
  3939. options[hookName] = mergeLifecycleHook(options[hookName], fn);
  3940. }
  3941. var onBeforeMount = createLifeCycle('beforeMount');
  3942. var onMounted = createLifeCycle('mounted');
  3943. var onBeforeUpdate = createLifeCycle('beforeUpdate');
  3944. var onUpdated = createLifeCycle('updated');
  3945. var onBeforeUnmount = createLifeCycle('beforeDestroy');
  3946. var onUnmounted = createLifeCycle('destroyed');
  3947. var onActivated = createLifeCycle('activated');
  3948. var onDeactivated = createLifeCycle('deactivated');
  3949. var onServerPrefetch = createLifeCycle('serverPrefetch');
  3950. var onRenderTracked = createLifeCycle('renderTracked');
  3951. var onRenderTriggered = createLifeCycle('renderTriggered');
  3952. var injectErrorCapturedHook = createLifeCycle('errorCaptured');
  3953. function onErrorCaptured(hook, target) {
  3954. if (target === void 0) { target = currentInstance; }
  3955. injectErrorCapturedHook(hook, target);
  3956. }
  3957. /**
  3958. * Note: also update dist/vue.runtime.mjs when adding new exports to this file.
  3959. */
  3960. var version = '2.7.16';
  3961. /**
  3962. * @internal type is manually declared in <root>/types/v3-define-component.d.ts
  3963. */
  3964. function defineComponent(options) {
  3965. return options;
  3966. }
  3967. var vca = /*#__PURE__*/Object.freeze({
  3968. __proto__: null,
  3969. version: version,
  3970. defineComponent: defineComponent,
  3971. ref: ref$1,
  3972. shallowRef: shallowRef,
  3973. isRef: isRef,
  3974. toRef: toRef,
  3975. toRefs: toRefs,
  3976. unref: unref,
  3977. proxyRefs: proxyRefs,
  3978. customRef: customRef,
  3979. triggerRef: triggerRef,
  3980. reactive: reactive,
  3981. isReactive: isReactive,
  3982. isReadonly: isReadonly,
  3983. isShallow: isShallow,
  3984. isProxy: isProxy,
  3985. shallowReactive: shallowReactive,
  3986. markRaw: markRaw,
  3987. toRaw: toRaw,
  3988. readonly: readonly,
  3989. shallowReadonly: shallowReadonly,
  3990. computed: computed,
  3991. watch: watch,
  3992. watchEffect: watchEffect,
  3993. watchPostEffect: watchPostEffect,
  3994. watchSyncEffect: watchSyncEffect,
  3995. EffectScope: EffectScope,
  3996. effectScope: effectScope,
  3997. onScopeDispose: onScopeDispose,
  3998. getCurrentScope: getCurrentScope,
  3999. provide: provide,
  4000. inject: inject,
  4001. h: h,
  4002. getCurrentInstance: getCurrentInstance,
  4003. useSlots: useSlots,
  4004. useAttrs: useAttrs,
  4005. useListeners: useListeners,
  4006. mergeDefaults: mergeDefaults,
  4007. nextTick: nextTick,
  4008. set: set,
  4009. del: del,
  4010. useCssModule: useCssModule,
  4011. useCssVars: useCssVars,
  4012. defineAsyncComponent: defineAsyncComponent,
  4013. onBeforeMount: onBeforeMount,
  4014. onMounted: onMounted,
  4015. onBeforeUpdate: onBeforeUpdate,
  4016. onUpdated: onUpdated,
  4017. onBeforeUnmount: onBeforeUnmount,
  4018. onUnmounted: onUnmounted,
  4019. onActivated: onActivated,
  4020. onDeactivated: onDeactivated,
  4021. onServerPrefetch: onServerPrefetch,
  4022. onRenderTracked: onRenderTracked,
  4023. onRenderTriggered: onRenderTriggered,
  4024. onErrorCaptured: onErrorCaptured
  4025. });
  4026. var seenObjects = new _Set();
  4027. /**
  4028. * Recursively traverse an object to evoke all converted
  4029. * getters, so that every nested property inside the object
  4030. * is collected as a "deep" dependency.
  4031. */
  4032. function traverse(val) {
  4033. _traverse(val, seenObjects);
  4034. seenObjects.clear();
  4035. return val;
  4036. }
  4037. function _traverse(val, seen) {
  4038. var i, keys;
  4039. var isA = isArray(val);
  4040. if ((!isA && !isObject(val)) ||
  4041. val.__v_skip /* ReactiveFlags.SKIP */ ||
  4042. Object.isFrozen(val) ||
  4043. val instanceof VNode) {
  4044. return;
  4045. }
  4046. if (val.__ob__) {
  4047. var depId = val.__ob__.dep.id;
  4048. if (seen.has(depId)) {
  4049. return;
  4050. }
  4051. seen.add(depId);
  4052. }
  4053. if (isA) {
  4054. i = val.length;
  4055. while (i--)
  4056. _traverse(val[i], seen);
  4057. }
  4058. else if (isRef(val)) {
  4059. _traverse(val.value, seen);
  4060. }
  4061. else {
  4062. keys = Object.keys(val);
  4063. i = keys.length;
  4064. while (i--)
  4065. _traverse(val[keys[i]], seen);
  4066. }
  4067. }
  4068. var uid$1 = 0;
  4069. /**
  4070. * A watcher parses an expression, collects dependencies,
  4071. * and fires callback when the expression value changes.
  4072. * This is used for both the $watch() api and directives.
  4073. * @internal
  4074. */
  4075. var Watcher = /** @class */ (function () {
  4076. function Watcher(vm, expOrFn, cb, options, isRenderWatcher) {
  4077. recordEffectScope(this,
  4078. // if the active effect scope is manually created (not a component scope),
  4079. // prioritize it
  4080. activeEffectScope && !activeEffectScope._vm
  4081. ? activeEffectScope
  4082. : vm
  4083. ? vm._scope
  4084. : undefined);
  4085. if ((this.vm = vm) && isRenderWatcher) {
  4086. vm._watcher = this;
  4087. }
  4088. // options
  4089. if (options) {
  4090. this.deep = !!options.deep;
  4091. this.user = !!options.user;
  4092. this.lazy = !!options.lazy;
  4093. this.sync = !!options.sync;
  4094. this.before = options.before;
  4095. {
  4096. this.onTrack = options.onTrack;
  4097. this.onTrigger = options.onTrigger;
  4098. }
  4099. }
  4100. else {
  4101. this.deep = this.user = this.lazy = this.sync = false;
  4102. }
  4103. this.cb = cb;
  4104. this.id = ++uid$1; // uid for batching
  4105. this.active = true;
  4106. this.post = false;
  4107. this.dirty = this.lazy; // for lazy watchers
  4108. this.deps = [];
  4109. this.newDeps = [];
  4110. this.depIds = new _Set();
  4111. this.newDepIds = new _Set();
  4112. this.expression = expOrFn.toString() ;
  4113. // parse expression for getter
  4114. if (isFunction(expOrFn)) {
  4115. this.getter = expOrFn;
  4116. }
  4117. else {
  4118. this.getter = parsePath(expOrFn);
  4119. if (!this.getter) {
  4120. this.getter = noop;
  4121. warn$2("Failed watching path: \"".concat(expOrFn, "\" ") +
  4122. 'Watcher only accepts simple dot-delimited paths. ' +
  4123. 'For full control, use a function instead.', vm);
  4124. }
  4125. }
  4126. this.value = this.lazy ? undefined : this.get();
  4127. }
  4128. /**
  4129. * Evaluate the getter, and re-collect dependencies.
  4130. */
  4131. Watcher.prototype.get = function () {
  4132. pushTarget(this);
  4133. var value;
  4134. var vm = this.vm;
  4135. try {
  4136. value = this.getter.call(vm, vm);
  4137. }
  4138. catch (e) {
  4139. if (this.user) {
  4140. handleError(e, vm, "getter for watcher \"".concat(this.expression, "\""));
  4141. }
  4142. else {
  4143. throw e;
  4144. }
  4145. }
  4146. finally {
  4147. // "touch" every property so they are all tracked as
  4148. // dependencies for deep watching
  4149. if (this.deep) {
  4150. traverse(value);
  4151. }
  4152. popTarget();
  4153. this.cleanupDeps();
  4154. }
  4155. return value;
  4156. };
  4157. /**
  4158. * Add a dependency to this directive.
  4159. */
  4160. Watcher.prototype.addDep = function (dep) {
  4161. var id = dep.id;
  4162. if (!this.newDepIds.has(id)) {
  4163. this.newDepIds.add(id);
  4164. this.newDeps.push(dep);
  4165. if (!this.depIds.has(id)) {
  4166. dep.addSub(this);
  4167. }
  4168. }
  4169. };
  4170. /**
  4171. * Clean up for dependency collection.
  4172. */
  4173. Watcher.prototype.cleanupDeps = function () {
  4174. var i = this.deps.length;
  4175. while (i--) {
  4176. var dep = this.deps[i];
  4177. if (!this.newDepIds.has(dep.id)) {
  4178. dep.removeSub(this);
  4179. }
  4180. }
  4181. var tmp = this.depIds;
  4182. this.depIds = this.newDepIds;
  4183. this.newDepIds = tmp;
  4184. this.newDepIds.clear();
  4185. tmp = this.deps;
  4186. this.deps = this.newDeps;
  4187. this.newDeps = tmp;
  4188. this.newDeps.length = 0;
  4189. };
  4190. /**
  4191. * Subscriber interface.
  4192. * Will be called when a dependency changes.
  4193. */
  4194. Watcher.prototype.update = function () {
  4195. /* istanbul ignore else */
  4196. if (this.lazy) {
  4197. this.dirty = true;
  4198. }
  4199. else if (this.sync) {
  4200. this.run();
  4201. }
  4202. else {
  4203. queueWatcher(this);
  4204. }
  4205. };
  4206. /**
  4207. * Scheduler job interface.
  4208. * Will be called by the scheduler.
  4209. */
  4210. Watcher.prototype.run = function () {
  4211. if (this.active) {
  4212. var value = this.get();
  4213. if (value !== this.value ||
  4214. // Deep watchers and watchers on Object/Arrays should fire even
  4215. // when the value is the same, because the value may
  4216. // have mutated.
  4217. isObject(value) ||
  4218. this.deep) {
  4219. // set new value
  4220. var oldValue = this.value;
  4221. this.value = value;
  4222. if (this.user) {
  4223. var info = "callback for watcher \"".concat(this.expression, "\"");
  4224. invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info);
  4225. }
  4226. else {
  4227. this.cb.call(this.vm, value, oldValue);
  4228. }
  4229. }
  4230. }
  4231. };
  4232. /**
  4233. * Evaluate the value of the watcher.
  4234. * This only gets called for lazy watchers.
  4235. */
  4236. Watcher.prototype.evaluate = function () {
  4237. this.value = this.get();
  4238. this.dirty = false;
  4239. };
  4240. /**
  4241. * Depend on all deps collected by this watcher.
  4242. */
  4243. Watcher.prototype.depend = function () {
  4244. var i = this.deps.length;
  4245. while (i--) {
  4246. this.deps[i].depend();
  4247. }
  4248. };
  4249. /**
  4250. * Remove self from all dependencies' subscriber list.
  4251. */
  4252. Watcher.prototype.teardown = function () {
  4253. if (this.vm && !this.vm._isBeingDestroyed) {
  4254. remove$2(this.vm._scope.effects, this);
  4255. }
  4256. if (this.active) {
  4257. var i = this.deps.length;
  4258. while (i--) {
  4259. this.deps[i].removeSub(this);
  4260. }
  4261. this.active = false;
  4262. if (this.onStop) {
  4263. this.onStop();
  4264. }
  4265. }
  4266. };
  4267. return Watcher;
  4268. }());
  4269. var sharedPropertyDefinition = {
  4270. enumerable: true,
  4271. configurable: true,
  4272. get: noop,
  4273. set: noop
  4274. };
  4275. function proxy(target, sourceKey, key) {
  4276. sharedPropertyDefinition.get = function proxyGetter() {
  4277. return this[sourceKey][key];
  4278. };
  4279. sharedPropertyDefinition.set = function proxySetter(val) {
  4280. this[sourceKey][key] = val;
  4281. };
  4282. Object.defineProperty(target, key, sharedPropertyDefinition);
  4283. }
  4284. function initState(vm) {
  4285. var opts = vm.$options;
  4286. if (opts.props)
  4287. initProps$1(vm, opts.props);
  4288. // Composition API
  4289. initSetup(vm);
  4290. if (opts.methods)
  4291. initMethods(vm, opts.methods);
  4292. if (opts.data) {
  4293. initData(vm);
  4294. }
  4295. else {
  4296. var ob = observe((vm._data = {}));
  4297. ob && ob.vmCount++;
  4298. }
  4299. if (opts.computed)
  4300. initComputed$1(vm, opts.computed);
  4301. if (opts.watch && opts.watch !== nativeWatch) {
  4302. initWatch(vm, opts.watch);
  4303. }
  4304. }
  4305. function initProps$1(vm, propsOptions) {
  4306. var propsData = vm.$options.propsData || {};
  4307. var props = (vm._props = shallowReactive({}));
  4308. // cache prop keys so that future props updates can iterate using Array
  4309. // instead of dynamic object key enumeration.
  4310. var keys = (vm.$options._propKeys = []);
  4311. var isRoot = !vm.$parent;
  4312. // root instance props should be converted
  4313. if (!isRoot) {
  4314. toggleObserving(false);
  4315. }
  4316. var _loop_1 = function (key) {
  4317. keys.push(key);
  4318. var value = validateProp(key, propsOptions, propsData, vm);
  4319. /* istanbul ignore else */
  4320. {
  4321. var hyphenatedKey = hyphenate(key);
  4322. if (isReservedAttribute(hyphenatedKey) ||
  4323. config.isReservedAttr(hyphenatedKey)) {
  4324. warn$2("\"".concat(hyphenatedKey, "\" is a reserved attribute and cannot be used as component prop."), vm);
  4325. }
  4326. defineReactive(props, key, value, function () {
  4327. if (!isRoot && !isUpdatingChildComponent) {
  4328. warn$2("Avoid mutating a prop directly since the value will be " +
  4329. "overwritten whenever the parent component re-renders. " +
  4330. "Instead, use a data or computed property based on the prop's " +
  4331. "value. Prop being mutated: \"".concat(key, "\""), vm);
  4332. }
  4333. }, true /* shallow */);
  4334. }
  4335. // static props are already proxied on the component's prototype
  4336. // during Vue.extend(). We only need to proxy props defined at
  4337. // instantiation here.
  4338. if (!(key in vm)) {
  4339. proxy(vm, "_props", key);
  4340. }
  4341. };
  4342. for (var key in propsOptions) {
  4343. _loop_1(key);
  4344. }
  4345. toggleObserving(true);
  4346. }
  4347. function initData(vm) {
  4348. var data = vm.$options.data;
  4349. data = vm._data = isFunction(data) ? getData(data, vm) : data || {};
  4350. if (!isPlainObject(data)) {
  4351. data = {};
  4352. warn$2('data functions should return an object:\n' +
  4353. 'https://v2.vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', vm);
  4354. }
  4355. // proxy data on instance
  4356. var keys = Object.keys(data);
  4357. var props = vm.$options.props;
  4358. var methods = vm.$options.methods;
  4359. var i = keys.length;
  4360. while (i--) {
  4361. var key = keys[i];
  4362. {
  4363. if (methods && hasOwn(methods, key)) {
  4364. warn$2("Method \"".concat(key, "\" has already been defined as a data property."), vm);
  4365. }
  4366. }
  4367. if (props && hasOwn(props, key)) {
  4368. warn$2("The data property \"".concat(key, "\" is already declared as a prop. ") +
  4369. "Use prop default value instead.", vm);
  4370. }
  4371. else if (!isReserved(key)) {
  4372. proxy(vm, "_data", key);
  4373. }
  4374. }
  4375. // observe data
  4376. var ob = observe(data);
  4377. ob && ob.vmCount++;
  4378. }
  4379. function getData(data, vm) {
  4380. // #7573 disable dep collection when invoking data getters
  4381. pushTarget();
  4382. try {
  4383. return data.call(vm, vm);
  4384. }
  4385. catch (e) {
  4386. handleError(e, vm, "data()");
  4387. return {};
  4388. }
  4389. finally {
  4390. popTarget();
  4391. }
  4392. }
  4393. var computedWatcherOptions = { lazy: true };
  4394. function initComputed$1(vm, computed) {
  4395. // $flow-disable-line
  4396. var watchers = (vm._computedWatchers = Object.create(null));
  4397. // computed properties are just getters during SSR
  4398. var isSSR = isServerRendering();
  4399. for (var key in computed) {
  4400. var userDef = computed[key];
  4401. var getter = isFunction(userDef) ? userDef : userDef.get;
  4402. if (getter == null) {
  4403. warn$2("Getter is missing for computed property \"".concat(key, "\"."), vm);
  4404. }
  4405. if (!isSSR) {
  4406. // create internal watcher for the computed property.
  4407. watchers[key] = new Watcher(vm, getter || noop, noop, computedWatcherOptions);
  4408. }
  4409. // component-defined computed properties are already defined on the
  4410. // component prototype. We only need to define computed properties defined
  4411. // at instantiation here.
  4412. if (!(key in vm)) {
  4413. defineComputed(vm, key, userDef);
  4414. }
  4415. else {
  4416. if (key in vm.$data) {
  4417. warn$2("The computed property \"".concat(key, "\" is already defined in data."), vm);
  4418. }
  4419. else if (vm.$options.props && key in vm.$options.props) {
  4420. warn$2("The computed property \"".concat(key, "\" is already defined as a prop."), vm);
  4421. }
  4422. else if (vm.$options.methods && key in vm.$options.methods) {
  4423. warn$2("The computed property \"".concat(key, "\" is already defined as a method."), vm);
  4424. }
  4425. }
  4426. }
  4427. }
  4428. function defineComputed(target, key, userDef) {
  4429. var shouldCache = !isServerRendering();
  4430. if (isFunction(userDef)) {
  4431. sharedPropertyDefinition.get = shouldCache
  4432. ? createComputedGetter(key)
  4433. : createGetterInvoker(userDef);
  4434. sharedPropertyDefinition.set = noop;
  4435. }
  4436. else {
  4437. sharedPropertyDefinition.get = userDef.get
  4438. ? shouldCache && userDef.cache !== false
  4439. ? createComputedGetter(key)
  4440. : createGetterInvoker(userDef.get)
  4441. : noop;
  4442. sharedPropertyDefinition.set = userDef.set || noop;
  4443. }
  4444. if (sharedPropertyDefinition.set === noop) {
  4445. sharedPropertyDefinition.set = function () {
  4446. warn$2("Computed property \"".concat(key, "\" was assigned to but it has no setter."), this);
  4447. };
  4448. }
  4449. Object.defineProperty(target, key, sharedPropertyDefinition);
  4450. }
  4451. function createComputedGetter(key) {
  4452. return function computedGetter() {
  4453. var watcher = this._computedWatchers && this._computedWatchers[key];
  4454. if (watcher) {
  4455. if (watcher.dirty) {
  4456. watcher.evaluate();
  4457. }
  4458. if (Dep.target) {
  4459. if (Dep.target.onTrack) {
  4460. Dep.target.onTrack({
  4461. effect: Dep.target,
  4462. target: this,
  4463. type: "get" /* TrackOpTypes.GET */,
  4464. key: key
  4465. });
  4466. }
  4467. watcher.depend();
  4468. }
  4469. return watcher.value;
  4470. }
  4471. };
  4472. }
  4473. function createGetterInvoker(fn) {
  4474. return function computedGetter() {
  4475. return fn.call(this, this);
  4476. };
  4477. }
  4478. function initMethods(vm, methods) {
  4479. var props = vm.$options.props;
  4480. for (var key in methods) {
  4481. {
  4482. if (typeof methods[key] !== 'function') {
  4483. warn$2("Method \"".concat(key, "\" has type \"").concat(typeof methods[key], "\" in the component definition. ") +
  4484. "Did you reference the function correctly?", vm);
  4485. }
  4486. if (props && hasOwn(props, key)) {
  4487. warn$2("Method \"".concat(key, "\" has already been defined as a prop."), vm);
  4488. }
  4489. if (key in vm && isReserved(key)) {
  4490. warn$2("Method \"".concat(key, "\" conflicts with an existing Vue instance method. ") +
  4491. "Avoid defining component methods that start with _ or $.");
  4492. }
  4493. }
  4494. vm[key] = typeof methods[key] !== 'function' ? noop : bind$1(methods[key], vm);
  4495. }
  4496. }
  4497. function initWatch(vm, watch) {
  4498. for (var key in watch) {
  4499. var handler = watch[key];
  4500. if (isArray(handler)) {
  4501. for (var i = 0; i < handler.length; i++) {
  4502. createWatcher(vm, key, handler[i]);
  4503. }
  4504. }
  4505. else {
  4506. createWatcher(vm, key, handler);
  4507. }
  4508. }
  4509. }
  4510. function createWatcher(vm, expOrFn, handler, options) {
  4511. if (isPlainObject(handler)) {
  4512. options = handler;
  4513. handler = handler.handler;
  4514. }
  4515. if (typeof handler === 'string') {
  4516. handler = vm[handler];
  4517. }
  4518. return vm.$watch(expOrFn, handler, options);
  4519. }
  4520. function stateMixin(Vue) {
  4521. // flow somehow has problems with directly declared definition object
  4522. // when using Object.defineProperty, so we have to procedurally build up
  4523. // the object here.
  4524. var dataDef = {};
  4525. dataDef.get = function () {
  4526. return this._data;
  4527. };
  4528. var propsDef = {};
  4529. propsDef.get = function () {
  4530. return this._props;
  4531. };
  4532. {
  4533. dataDef.set = function () {
  4534. warn$2('Avoid replacing instance root $data. ' +
  4535. 'Use nested data properties instead.', this);
  4536. };
  4537. propsDef.set = function () {
  4538. warn$2("$props is readonly.", this);
  4539. };
  4540. }
  4541. Object.defineProperty(Vue.prototype, '$data', dataDef);
  4542. Object.defineProperty(Vue.prototype, '$props', propsDef);
  4543. Vue.prototype.$set = set;
  4544. Vue.prototype.$delete = del;
  4545. Vue.prototype.$watch = function (expOrFn, cb, options) {
  4546. var vm = this;
  4547. if (isPlainObject(cb)) {
  4548. return createWatcher(vm, expOrFn, cb, options);
  4549. }
  4550. options = options || {};
  4551. options.user = true;
  4552. var watcher = new Watcher(vm, expOrFn, cb, options);
  4553. if (options.immediate) {
  4554. var info = "callback for immediate watcher \"".concat(watcher.expression, "\"");
  4555. pushTarget();
  4556. invokeWithErrorHandling(cb, vm, [watcher.value], vm, info);
  4557. popTarget();
  4558. }
  4559. return function unwatchFn() {
  4560. watcher.teardown();
  4561. };
  4562. };
  4563. }
  4564. function initProvide(vm) {
  4565. var provideOption = vm.$options.provide;
  4566. if (provideOption) {
  4567. var provided = isFunction(provideOption)
  4568. ? provideOption.call(vm)
  4569. : provideOption;
  4570. if (!isObject(provided)) {
  4571. return;
  4572. }
  4573. var source = resolveProvided(vm);
  4574. // IE9 doesn't support Object.getOwnPropertyDescriptors so we have to
  4575. // iterate the keys ourselves.
  4576. var keys = hasSymbol ? Reflect.ownKeys(provided) : Object.keys(provided);
  4577. for (var i = 0; i < keys.length; i++) {
  4578. var key = keys[i];
  4579. Object.defineProperty(source, key, Object.getOwnPropertyDescriptor(provided, key));
  4580. }
  4581. }
  4582. }
  4583. function initInjections(vm) {
  4584. var result = resolveInject(vm.$options.inject, vm);
  4585. if (result) {
  4586. toggleObserving(false);
  4587. Object.keys(result).forEach(function (key) {
  4588. /* istanbul ignore else */
  4589. {
  4590. defineReactive(vm, key, result[key], function () {
  4591. warn$2("Avoid mutating an injected value directly since the changes will be " +
  4592. "overwritten whenever the provided component re-renders. " +
  4593. "injection being mutated: \"".concat(key, "\""), vm);
  4594. });
  4595. }
  4596. });
  4597. toggleObserving(true);
  4598. }
  4599. }
  4600. function resolveInject(inject, vm) {
  4601. if (inject) {
  4602. // inject is :any because flow is not smart enough to figure out cached
  4603. var result = Object.create(null);
  4604. var keys = hasSymbol ? Reflect.ownKeys(inject) : Object.keys(inject);
  4605. for (var i = 0; i < keys.length; i++) {
  4606. var key = keys[i];
  4607. // #6574 in case the inject object is observed...
  4608. if (key === '__ob__')
  4609. continue;
  4610. var provideKey = inject[key].from;
  4611. if (provideKey in vm._provided) {
  4612. result[key] = vm._provided[provideKey];
  4613. }
  4614. else if ('default' in inject[key]) {
  4615. var provideDefault = inject[key].default;
  4616. result[key] = isFunction(provideDefault)
  4617. ? provideDefault.call(vm)
  4618. : provideDefault;
  4619. }
  4620. else {
  4621. warn$2("Injection \"".concat(key, "\" not found"), vm);
  4622. }
  4623. }
  4624. return result;
  4625. }
  4626. }
  4627. var uid = 0;
  4628. function initMixin$1(Vue) {
  4629. Vue.prototype._init = function (options) {
  4630. var vm = this;
  4631. // a uid
  4632. vm._uid = uid++;
  4633. var startTag, endTag;
  4634. /* istanbul ignore if */
  4635. if (config.performance && mark) {
  4636. startTag = "vue-perf-start:".concat(vm._uid);
  4637. endTag = "vue-perf-end:".concat(vm._uid);
  4638. mark(startTag);
  4639. }
  4640. // a flag to mark this as a Vue instance without having to do instanceof
  4641. // check
  4642. vm._isVue = true;
  4643. // avoid instances from being observed
  4644. vm.__v_skip = true;
  4645. // effect scope
  4646. vm._scope = new EffectScope(true /* detached */);
  4647. // #13134 edge case where a child component is manually created during the
  4648. // render of a parent component
  4649. vm._scope.parent = undefined;
  4650. vm._scope._vm = true;
  4651. // merge options
  4652. if (options && options._isComponent) {
  4653. // optimize internal component instantiation
  4654. // since dynamic options merging is pretty slow, and none of the
  4655. // internal component options needs special treatment.
  4656. initInternalComponent(vm, options);
  4657. }
  4658. else {
  4659. vm.$options = mergeOptions(resolveConstructorOptions(vm.constructor), options || {}, vm);
  4660. }
  4661. /* istanbul ignore else */
  4662. {
  4663. initProxy(vm);
  4664. }
  4665. // expose real self
  4666. vm._self = vm;
  4667. initLifecycle(vm);
  4668. initEvents(vm);
  4669. initRender(vm);
  4670. callHook$1(vm, 'beforeCreate', undefined, false /* setContext */);
  4671. initInjections(vm); // resolve injections before data/props
  4672. initState(vm);
  4673. initProvide(vm); // resolve provide after data/props
  4674. callHook$1(vm, 'created');
  4675. /* istanbul ignore if */
  4676. if (config.performance && mark) {
  4677. vm._name = formatComponentName(vm, false);
  4678. mark(endTag);
  4679. measure("vue ".concat(vm._name, " init"), startTag, endTag);
  4680. }
  4681. if (vm.$options.el) {
  4682. vm.$mount(vm.$options.el);
  4683. }
  4684. };
  4685. }
  4686. function initInternalComponent(vm, options) {
  4687. var opts = (vm.$options = Object.create(vm.constructor.options));
  4688. // doing this because it's faster than dynamic enumeration.
  4689. var parentVnode = options._parentVnode;
  4690. opts.parent = options.parent;
  4691. opts._parentVnode = parentVnode;
  4692. var vnodeComponentOptions = parentVnode.componentOptions;
  4693. opts.propsData = vnodeComponentOptions.propsData;
  4694. opts._parentListeners = vnodeComponentOptions.listeners;
  4695. opts._renderChildren = vnodeComponentOptions.children;
  4696. opts._componentTag = vnodeComponentOptions.tag;
  4697. if (options.render) {
  4698. opts.render = options.render;
  4699. opts.staticRenderFns = options.staticRenderFns;
  4700. }
  4701. }
  4702. function resolveConstructorOptions(Ctor) {
  4703. var options = Ctor.options;
  4704. if (Ctor.super) {
  4705. var superOptions = resolveConstructorOptions(Ctor.super);
  4706. var cachedSuperOptions = Ctor.superOptions;
  4707. if (superOptions !== cachedSuperOptions) {
  4708. // super option changed,
  4709. // need to resolve new options.
  4710. Ctor.superOptions = superOptions;
  4711. // check if there are any late-modified/attached options (#4976)
  4712. var modifiedOptions = resolveModifiedOptions(Ctor);
  4713. // update base extend options
  4714. if (modifiedOptions) {
  4715. extend(Ctor.extendOptions, modifiedOptions);
  4716. }
  4717. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4718. if (options.name) {
  4719. options.components[options.name] = Ctor;
  4720. }
  4721. }
  4722. }
  4723. return options;
  4724. }
  4725. function resolveModifiedOptions(Ctor) {
  4726. var modified;
  4727. var latest = Ctor.options;
  4728. var sealed = Ctor.sealedOptions;
  4729. for (var key in latest) {
  4730. if (latest[key] !== sealed[key]) {
  4731. if (!modified)
  4732. modified = {};
  4733. modified[key] = latest[key];
  4734. }
  4735. }
  4736. return modified;
  4737. }
  4738. function FunctionalRenderContext(data, props, children, parent, Ctor) {
  4739. var _this = this;
  4740. var options = Ctor.options;
  4741. // ensure the createElement function in functional components
  4742. // gets a unique context - this is necessary for correct named slot check
  4743. var contextVm;
  4744. if (hasOwn(parent, '_uid')) {
  4745. contextVm = Object.create(parent);
  4746. contextVm._original = parent;
  4747. }
  4748. else {
  4749. // the context vm passed in is a functional context as well.
  4750. // in this case we want to make sure we are able to get a hold to the
  4751. // real context instance.
  4752. contextVm = parent;
  4753. // @ts-ignore
  4754. parent = parent._original;
  4755. }
  4756. var isCompiled = isTrue(options._compiled);
  4757. var needNormalization = !isCompiled;
  4758. this.data = data;
  4759. this.props = props;
  4760. this.children = children;
  4761. this.parent = parent;
  4762. this.listeners = data.on || emptyObject;
  4763. this.injections = resolveInject(options.inject, parent);
  4764. this.slots = function () {
  4765. if (!_this.$slots) {
  4766. normalizeScopedSlots(parent, data.scopedSlots, (_this.$slots = resolveSlots(children, parent)));
  4767. }
  4768. return _this.$slots;
  4769. };
  4770. Object.defineProperty(this, 'scopedSlots', {
  4771. enumerable: true,
  4772. get: function () {
  4773. return normalizeScopedSlots(parent, data.scopedSlots, this.slots());
  4774. }
  4775. });
  4776. // support for compiled functional template
  4777. if (isCompiled) {
  4778. // exposing $options for renderStatic()
  4779. this.$options = options;
  4780. // pre-resolve slots for renderSlot()
  4781. this.$slots = this.slots();
  4782. this.$scopedSlots = normalizeScopedSlots(parent, data.scopedSlots, this.$slots);
  4783. }
  4784. if (options._scopeId) {
  4785. this._c = function (a, b, c, d) {
  4786. var vnode = createElement$1(contextVm, a, b, c, d, needNormalization);
  4787. if (vnode && !isArray(vnode)) {
  4788. vnode.fnScopeId = options._scopeId;
  4789. vnode.fnContext = parent;
  4790. }
  4791. return vnode;
  4792. };
  4793. }
  4794. else {
  4795. this._c = function (a, b, c, d) {
  4796. return createElement$1(contextVm, a, b, c, d, needNormalization);
  4797. };
  4798. }
  4799. }
  4800. installRenderHelpers(FunctionalRenderContext.prototype);
  4801. function createFunctionalComponent(Ctor, propsData, data, contextVm, children) {
  4802. var options = Ctor.options;
  4803. var props = {};
  4804. var propOptions = options.props;
  4805. if (isDef(propOptions)) {
  4806. for (var key in propOptions) {
  4807. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  4808. }
  4809. }
  4810. else {
  4811. if (isDef(data.attrs))
  4812. mergeProps(props, data.attrs);
  4813. if (isDef(data.props))
  4814. mergeProps(props, data.props);
  4815. }
  4816. var renderContext = new FunctionalRenderContext(data, props, children, contextVm, Ctor);
  4817. var vnode = options.render.call(null, renderContext._c, renderContext);
  4818. if (vnode instanceof VNode) {
  4819. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext);
  4820. }
  4821. else if (isArray(vnode)) {
  4822. var vnodes = normalizeChildren(vnode) || [];
  4823. var res = new Array(vnodes.length);
  4824. for (var i = 0; i < vnodes.length; i++) {
  4825. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  4826. }
  4827. return res;
  4828. }
  4829. }
  4830. function cloneAndMarkFunctionalResult(vnode, data, contextVm, options, renderContext) {
  4831. // #7817 clone node before setting fnContext, otherwise if the node is reused
  4832. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  4833. // that should not be matched to match.
  4834. var clone = cloneVNode(vnode);
  4835. clone.fnContext = contextVm;
  4836. clone.fnOptions = options;
  4837. {
  4838. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext =
  4839. renderContext;
  4840. }
  4841. if (data.slot) {
  4842. (clone.data || (clone.data = {})).slot = data.slot;
  4843. }
  4844. return clone;
  4845. }
  4846. function mergeProps(to, from) {
  4847. for (var key in from) {
  4848. to[camelize(key)] = from[key];
  4849. }
  4850. }
  4851. function getComponentName(options) {
  4852. return options.name || options.__name || options._componentTag;
  4853. }
  4854. // inline hooks to be invoked on component VNodes during patch
  4855. var componentVNodeHooks = {
  4856. init: function (vnode, hydrating) {
  4857. if (vnode.componentInstance &&
  4858. !vnode.componentInstance._isDestroyed &&
  4859. vnode.data.keepAlive) {
  4860. // kept-alive components, treat as a patch
  4861. var mountedNode = vnode; // work around flow
  4862. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  4863. }
  4864. else {
  4865. var child = (vnode.componentInstance = createComponentInstanceForVnode(vnode, activeInstance));
  4866. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  4867. }
  4868. },
  4869. prepatch: function (oldVnode, vnode) {
  4870. var options = vnode.componentOptions;
  4871. var child = (vnode.componentInstance = oldVnode.componentInstance);
  4872. updateChildComponent(child, options.propsData, // updated props
  4873. options.listeners, // updated listeners
  4874. vnode, // new parent vnode
  4875. options.children // new children
  4876. );
  4877. },
  4878. insert: function (vnode) {
  4879. var context = vnode.context, componentInstance = vnode.componentInstance;
  4880. if (!componentInstance._isMounted) {
  4881. componentInstance._isMounted = true;
  4882. callHook$1(componentInstance, 'mounted');
  4883. }
  4884. if (vnode.data.keepAlive) {
  4885. if (context._isMounted) {
  4886. // vue-router#1212
  4887. // During updates, a kept-alive component's child components may
  4888. // change, so directly walking the tree here may call activated hooks
  4889. // on incorrect children. Instead we push them into a queue which will
  4890. // be processed after the whole patch process ended.
  4891. queueActivatedComponent(componentInstance);
  4892. }
  4893. else {
  4894. activateChildComponent(componentInstance, true /* direct */);
  4895. }
  4896. }
  4897. },
  4898. destroy: function (vnode) {
  4899. var componentInstance = vnode.componentInstance;
  4900. if (!componentInstance._isDestroyed) {
  4901. if (!vnode.data.keepAlive) {
  4902. componentInstance.$destroy();
  4903. }
  4904. else {
  4905. deactivateChildComponent(componentInstance, true /* direct */);
  4906. }
  4907. }
  4908. }
  4909. };
  4910. var hooksToMerge = Object.keys(componentVNodeHooks);
  4911. function createComponent(Ctor, data, context, children, tag) {
  4912. if (isUndef(Ctor)) {
  4913. return;
  4914. }
  4915. var baseCtor = context.$options._base;
  4916. // plain options object: turn it into a constructor
  4917. if (isObject(Ctor)) {
  4918. Ctor = baseCtor.extend(Ctor);
  4919. }
  4920. // if at this stage it's not a constructor or an async component factory,
  4921. // reject.
  4922. if (typeof Ctor !== 'function') {
  4923. {
  4924. warn$2("Invalid Component definition: ".concat(String(Ctor)), context);
  4925. }
  4926. return;
  4927. }
  4928. // async component
  4929. var asyncFactory;
  4930. // @ts-expect-error
  4931. if (isUndef(Ctor.cid)) {
  4932. asyncFactory = Ctor;
  4933. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  4934. if (Ctor === undefined) {
  4935. // return a placeholder node for async component, which is rendered
  4936. // as a comment node but preserves all the raw information for the node.
  4937. // the information will be used for async server-rendering and hydration.
  4938. return createAsyncPlaceholder(asyncFactory, data, context, children, tag);
  4939. }
  4940. }
  4941. data = data || {};
  4942. // resolve constructor options in case global mixins are applied after
  4943. // component constructor creation
  4944. resolveConstructorOptions(Ctor);
  4945. // transform component v-model data into props & events
  4946. if (isDef(data.model)) {
  4947. // @ts-expect-error
  4948. transformModel(Ctor.options, data);
  4949. }
  4950. // extract props
  4951. // @ts-expect-error
  4952. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  4953. // functional component
  4954. // @ts-expect-error
  4955. if (isTrue(Ctor.options.functional)) {
  4956. return createFunctionalComponent(Ctor, propsData, data, context, children);
  4957. }
  4958. // extract listeners, since these needs to be treated as
  4959. // child component listeners instead of DOM listeners
  4960. var listeners = data.on;
  4961. // replace with listeners with .native modifier
  4962. // so it gets processed during parent component patch.
  4963. data.on = data.nativeOn;
  4964. // @ts-expect-error
  4965. if (isTrue(Ctor.options.abstract)) {
  4966. // abstract components do not keep anything
  4967. // other than props & listeners & slot
  4968. // work around flow
  4969. var slot = data.slot;
  4970. data = {};
  4971. if (slot) {
  4972. data.slot = slot;
  4973. }
  4974. }
  4975. // install component management hooks onto the placeholder node
  4976. installComponentHooks(data);
  4977. // return a placeholder vnode
  4978. // @ts-expect-error
  4979. var name = getComponentName(Ctor.options) || tag;
  4980. var vnode = new VNode(
  4981. // @ts-expect-error
  4982. "vue-component-".concat(Ctor.cid).concat(name ? "-".concat(name) : ''), data, undefined, undefined, undefined, context,
  4983. // @ts-expect-error
  4984. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }, asyncFactory);
  4985. return vnode;
  4986. }
  4987. function createComponentInstanceForVnode(
  4988. // we know it's MountedComponentVNode but flow doesn't
  4989. vnode,
  4990. // activeInstance in lifecycle state
  4991. parent) {
  4992. var options = {
  4993. _isComponent: true,
  4994. _parentVnode: vnode,
  4995. parent: parent
  4996. };
  4997. // check inline-template render functions
  4998. var inlineTemplate = vnode.data.inlineTemplate;
  4999. if (isDef(inlineTemplate)) {
  5000. options.render = inlineTemplate.render;
  5001. options.staticRenderFns = inlineTemplate.staticRenderFns;
  5002. }
  5003. return new vnode.componentOptions.Ctor(options);
  5004. }
  5005. function installComponentHooks(data) {
  5006. var hooks = data.hook || (data.hook = {});
  5007. for (var i = 0; i < hooksToMerge.length; i++) {
  5008. var key = hooksToMerge[i];
  5009. var existing = hooks[key];
  5010. var toMerge = componentVNodeHooks[key];
  5011. // @ts-expect-error
  5012. if (existing !== toMerge && !(existing && existing._merged)) {
  5013. hooks[key] = existing ? mergeHook(toMerge, existing) : toMerge;
  5014. }
  5015. }
  5016. }
  5017. function mergeHook(f1, f2) {
  5018. var merged = function (a, b) {
  5019. // flow complains about extra args which is why we use any
  5020. f1(a, b);
  5021. f2(a, b);
  5022. };
  5023. merged._merged = true;
  5024. return merged;
  5025. }
  5026. // transform component v-model info (value and callback) into
  5027. // prop and event handler respectively.
  5028. function transformModel(options, data) {
  5029. var prop = (options.model && options.model.prop) || 'value';
  5030. var event = (options.model && options.model.event) || 'input';
  5031. (data.attrs || (data.attrs = {}))[prop] = data.model.value;
  5032. var on = data.on || (data.on = {});
  5033. var existing = on[event];
  5034. var callback = data.model.callback;
  5035. if (isDef(existing)) {
  5036. if (isArray(existing)
  5037. ? existing.indexOf(callback) === -1
  5038. : existing !== callback) {
  5039. on[event] = [callback].concat(existing);
  5040. }
  5041. }
  5042. else {
  5043. on[event] = callback;
  5044. }
  5045. }
  5046. var warn$2 = noop;
  5047. var tip = noop;
  5048. var generateComponentTrace; // work around flow check
  5049. var formatComponentName;
  5050. {
  5051. var hasConsole_1 = typeof console !== 'undefined';
  5052. var classifyRE_1 = /(?:^|[-_])(\w)/g;
  5053. var classify_1 = function (str) {
  5054. return str.replace(classifyRE_1, function (c) { return c.toUpperCase(); }).replace(/[-_]/g, '');
  5055. };
  5056. warn$2 = function (msg, vm) {
  5057. if (vm === void 0) { vm = currentInstance; }
  5058. var trace = vm ? generateComponentTrace(vm) : '';
  5059. if (config.warnHandler) {
  5060. config.warnHandler.call(null, msg, vm, trace);
  5061. }
  5062. else if (hasConsole_1 && !config.silent) {
  5063. console.error("[Vue warn]: ".concat(msg).concat(trace));
  5064. }
  5065. };
  5066. tip = function (msg, vm) {
  5067. if (hasConsole_1 && !config.silent) {
  5068. console.warn("[Vue tip]: ".concat(msg) + (vm ? generateComponentTrace(vm) : ''));
  5069. }
  5070. };
  5071. formatComponentName = function (vm, includeFile) {
  5072. if (vm.$root === vm) {
  5073. return '<Root>';
  5074. }
  5075. var options = isFunction(vm) && vm.cid != null
  5076. ? vm.options
  5077. : vm._isVue
  5078. ? vm.$options || vm.constructor.options
  5079. : vm;
  5080. var name = getComponentName(options);
  5081. var file = options.__file;
  5082. if (!name && file) {
  5083. var match = file.match(/([^/\\]+)\.vue$/);
  5084. name = match && match[1];
  5085. }
  5086. return ((name ? "<".concat(classify_1(name), ">") : "<Anonymous>") +
  5087. (file && includeFile !== false ? " at ".concat(file) : ''));
  5088. };
  5089. var repeat_1 = function (str, n) {
  5090. var res = '';
  5091. while (n) {
  5092. if (n % 2 === 1)
  5093. res += str;
  5094. if (n > 1)
  5095. str += str;
  5096. n >>= 1;
  5097. }
  5098. return res;
  5099. };
  5100. generateComponentTrace = function (vm) {
  5101. if (vm._isVue && vm.$parent) {
  5102. var tree = [];
  5103. var currentRecursiveSequence = 0;
  5104. while (vm) {
  5105. if (tree.length > 0) {
  5106. var last = tree[tree.length - 1];
  5107. if (last.constructor === vm.constructor) {
  5108. currentRecursiveSequence++;
  5109. vm = vm.$parent;
  5110. continue;
  5111. }
  5112. else if (currentRecursiveSequence > 0) {
  5113. tree[tree.length - 1] = [last, currentRecursiveSequence];
  5114. currentRecursiveSequence = 0;
  5115. }
  5116. }
  5117. tree.push(vm);
  5118. vm = vm.$parent;
  5119. }
  5120. return ('\n\nfound in\n\n' +
  5121. tree
  5122. .map(function (vm, i) {
  5123. return "".concat(i === 0 ? '---> ' : repeat_1(' ', 5 + i * 2)).concat(isArray(vm)
  5124. ? "".concat(formatComponentName(vm[0]), "... (").concat(vm[1], " recursive calls)")
  5125. : formatComponentName(vm));
  5126. })
  5127. .join('\n'));
  5128. }
  5129. else {
  5130. return "\n\n(found in ".concat(formatComponentName(vm), ")");
  5131. }
  5132. };
  5133. }
  5134. /**
  5135. * Option overwriting strategies are functions that handle
  5136. * how to merge a parent option value and a child option
  5137. * value into the final value.
  5138. */
  5139. var strats = config.optionMergeStrategies;
  5140. /**
  5141. * Options with restrictions
  5142. */
  5143. {
  5144. strats.el = strats.propsData = function (parent, child, vm, key) {
  5145. if (!vm) {
  5146. warn$2("option \"".concat(key, "\" can only be used during instance ") +
  5147. 'creation with the `new` keyword.');
  5148. }
  5149. return defaultStrat(parent, child);
  5150. };
  5151. }
  5152. /**
  5153. * Helper that recursively merges two data objects together.
  5154. */
  5155. function mergeData(to, from, recursive) {
  5156. if (recursive === void 0) { recursive = true; }
  5157. if (!from)
  5158. return to;
  5159. var key, toVal, fromVal;
  5160. var keys = hasSymbol
  5161. ? Reflect.ownKeys(from)
  5162. : Object.keys(from);
  5163. for (var i = 0; i < keys.length; i++) {
  5164. key = keys[i];
  5165. // in case the object is already observed...
  5166. if (key === '__ob__')
  5167. continue;
  5168. toVal = to[key];
  5169. fromVal = from[key];
  5170. if (!recursive || !hasOwn(to, key)) {
  5171. set(to, key, fromVal);
  5172. }
  5173. else if (toVal !== fromVal &&
  5174. isPlainObject(toVal) &&
  5175. isPlainObject(fromVal)) {
  5176. mergeData(toVal, fromVal);
  5177. }
  5178. }
  5179. return to;
  5180. }
  5181. /**
  5182. * Data
  5183. */
  5184. function mergeDataOrFn(parentVal, childVal, vm) {
  5185. if (!vm) {
  5186. // in a Vue.extend merge, both should be functions
  5187. if (!childVal) {
  5188. return parentVal;
  5189. }
  5190. if (!parentVal) {
  5191. return childVal;
  5192. }
  5193. // when parentVal & childVal are both present,
  5194. // we need to return a function that returns the
  5195. // merged result of both functions... no need to
  5196. // check if parentVal is a function here because
  5197. // it has to be a function to pass previous merges.
  5198. return function mergedDataFn() {
  5199. return mergeData(isFunction(childVal) ? childVal.call(this, this) : childVal, isFunction(parentVal) ? parentVal.call(this, this) : parentVal);
  5200. };
  5201. }
  5202. else {
  5203. return function mergedInstanceDataFn() {
  5204. // instance merge
  5205. var instanceData = isFunction(childVal)
  5206. ? childVal.call(vm, vm)
  5207. : childVal;
  5208. var defaultData = isFunction(parentVal)
  5209. ? parentVal.call(vm, vm)
  5210. : parentVal;
  5211. if (instanceData) {
  5212. return mergeData(instanceData, defaultData);
  5213. }
  5214. else {
  5215. return defaultData;
  5216. }
  5217. };
  5218. }
  5219. }
  5220. strats.data = function (parentVal, childVal, vm) {
  5221. if (!vm) {
  5222. if (childVal && typeof childVal !== 'function') {
  5223. warn$2('The "data" option should be a function ' +
  5224. 'that returns a per-instance value in component ' +
  5225. 'definitions.', vm);
  5226. return parentVal;
  5227. }
  5228. return mergeDataOrFn(parentVal, childVal);
  5229. }
  5230. return mergeDataOrFn(parentVal, childVal, vm);
  5231. };
  5232. /**
  5233. * Hooks and props are merged as arrays.
  5234. */
  5235. function mergeLifecycleHook(parentVal, childVal) {
  5236. var res = childVal
  5237. ? parentVal
  5238. ? parentVal.concat(childVal)
  5239. : isArray(childVal)
  5240. ? childVal
  5241. : [childVal]
  5242. : parentVal;
  5243. return res ? dedupeHooks(res) : res;
  5244. }
  5245. function dedupeHooks(hooks) {
  5246. var res = [];
  5247. for (var i = 0; i < hooks.length; i++) {
  5248. if (res.indexOf(hooks[i]) === -1) {
  5249. res.push(hooks[i]);
  5250. }
  5251. }
  5252. return res;
  5253. }
  5254. LIFECYCLE_HOOKS.forEach(function (hook) {
  5255. strats[hook] = mergeLifecycleHook;
  5256. });
  5257. /**
  5258. * Assets
  5259. *
  5260. * When a vm is present (instance creation), we need to do
  5261. * a three-way merge between constructor options, instance
  5262. * options and parent options.
  5263. */
  5264. function mergeAssets(parentVal, childVal, vm, key) {
  5265. var res = Object.create(parentVal || null);
  5266. if (childVal) {
  5267. assertObjectType(key, childVal, vm);
  5268. return extend(res, childVal);
  5269. }
  5270. else {
  5271. return res;
  5272. }
  5273. }
  5274. ASSET_TYPES.forEach(function (type) {
  5275. strats[type + 's'] = mergeAssets;
  5276. });
  5277. /**
  5278. * Watchers.
  5279. *
  5280. * Watchers hashes should not overwrite one
  5281. * another, so we merge them as arrays.
  5282. */
  5283. strats.watch = function (parentVal, childVal, vm, key) {
  5284. // work around Firefox's Object.prototype.watch...
  5285. //@ts-expect-error work around
  5286. if (parentVal === nativeWatch)
  5287. parentVal = undefined;
  5288. //@ts-expect-error work around
  5289. if (childVal === nativeWatch)
  5290. childVal = undefined;
  5291. /* istanbul ignore if */
  5292. if (!childVal)
  5293. return Object.create(parentVal || null);
  5294. {
  5295. assertObjectType(key, childVal, vm);
  5296. }
  5297. if (!parentVal)
  5298. return childVal;
  5299. var ret = {};
  5300. extend(ret, parentVal);
  5301. for (var key_1 in childVal) {
  5302. var parent_1 = ret[key_1];
  5303. var child = childVal[key_1];
  5304. if (parent_1 && !isArray(parent_1)) {
  5305. parent_1 = [parent_1];
  5306. }
  5307. ret[key_1] = parent_1 ? parent_1.concat(child) : isArray(child) ? child : [child];
  5308. }
  5309. return ret;
  5310. };
  5311. /**
  5312. * Other object hashes.
  5313. */
  5314. strats.props =
  5315. strats.methods =
  5316. strats.inject =
  5317. strats.computed =
  5318. function (parentVal, childVal, vm, key) {
  5319. if (childVal && true) {
  5320. assertObjectType(key, childVal, vm);
  5321. }
  5322. if (!parentVal)
  5323. return childVal;
  5324. var ret = Object.create(null);
  5325. extend(ret, parentVal);
  5326. if (childVal)
  5327. extend(ret, childVal);
  5328. return ret;
  5329. };
  5330. strats.provide = function (parentVal, childVal) {
  5331. if (!parentVal)
  5332. return childVal;
  5333. return function () {
  5334. var ret = Object.create(null);
  5335. mergeData(ret, isFunction(parentVal) ? parentVal.call(this) : parentVal);
  5336. if (childVal) {
  5337. mergeData(ret, isFunction(childVal) ? childVal.call(this) : childVal, false // non-recursive
  5338. );
  5339. }
  5340. return ret;
  5341. };
  5342. };
  5343. /**
  5344. * Default strategy.
  5345. */
  5346. var defaultStrat = function (parentVal, childVal) {
  5347. return childVal === undefined ? parentVal : childVal;
  5348. };
  5349. /**
  5350. * Validate component names
  5351. */
  5352. function checkComponents(options) {
  5353. for (var key in options.components) {
  5354. validateComponentName(key);
  5355. }
  5356. }
  5357. function validateComponentName(name) {
  5358. if (!new RegExp("^[a-zA-Z][\\-\\.0-9_".concat(unicodeRegExp.source, "]*$")).test(name)) {
  5359. warn$2('Invalid component name: "' +
  5360. name +
  5361. '". Component names ' +
  5362. 'should conform to valid custom element name in html5 specification.');
  5363. }
  5364. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  5365. warn$2('Do not use built-in or reserved HTML elements as component ' +
  5366. 'id: ' +
  5367. name);
  5368. }
  5369. }
  5370. /**
  5371. * Ensure all props option syntax are normalized into the
  5372. * Object-based format.
  5373. */
  5374. function normalizeProps(options, vm) {
  5375. var props = options.props;
  5376. if (!props)
  5377. return;
  5378. var res = {};
  5379. var i, val, name;
  5380. if (isArray(props)) {
  5381. i = props.length;
  5382. while (i--) {
  5383. val = props[i];
  5384. if (typeof val === 'string') {
  5385. name = camelize(val);
  5386. res[name] = { type: null };
  5387. }
  5388. else {
  5389. warn$2('props must be strings when using array syntax.');
  5390. }
  5391. }
  5392. }
  5393. else if (isPlainObject(props)) {
  5394. for (var key in props) {
  5395. val = props[key];
  5396. name = camelize(key);
  5397. res[name] = isPlainObject(val) ? val : { type: val };
  5398. }
  5399. }
  5400. else {
  5401. warn$2("Invalid value for option \"props\": expected an Array or an Object, " +
  5402. "but got ".concat(toRawType(props), "."), vm);
  5403. }
  5404. options.props = res;
  5405. }
  5406. /**
  5407. * Normalize all injections into Object-based format
  5408. */
  5409. function normalizeInject(options, vm) {
  5410. var inject = options.inject;
  5411. if (!inject)
  5412. return;
  5413. var normalized = (options.inject = {});
  5414. if (isArray(inject)) {
  5415. for (var i = 0; i < inject.length; i++) {
  5416. normalized[inject[i]] = { from: inject[i] };
  5417. }
  5418. }
  5419. else if (isPlainObject(inject)) {
  5420. for (var key in inject) {
  5421. var val = inject[key];
  5422. normalized[key] = isPlainObject(val)
  5423. ? extend({ from: key }, val)
  5424. : { from: val };
  5425. }
  5426. }
  5427. else {
  5428. warn$2("Invalid value for option \"inject\": expected an Array or an Object, " +
  5429. "but got ".concat(toRawType(inject), "."), vm);
  5430. }
  5431. }
  5432. /**
  5433. * Normalize raw function directives into object format.
  5434. */
  5435. function normalizeDirectives$1(options) {
  5436. var dirs = options.directives;
  5437. if (dirs) {
  5438. for (var key in dirs) {
  5439. var def = dirs[key];
  5440. if (isFunction(def)) {
  5441. dirs[key] = { bind: def, update: def };
  5442. }
  5443. }
  5444. }
  5445. }
  5446. function assertObjectType(name, value, vm) {
  5447. if (!isPlainObject(value)) {
  5448. warn$2("Invalid value for option \"".concat(name, "\": expected an Object, ") +
  5449. "but got ".concat(toRawType(value), "."), vm);
  5450. }
  5451. }
  5452. /**
  5453. * Merge two option objects into a new one.
  5454. * Core utility used in both instantiation and inheritance.
  5455. */
  5456. function mergeOptions(parent, child, vm) {
  5457. {
  5458. checkComponents(child);
  5459. }
  5460. if (isFunction(child)) {
  5461. // @ts-expect-error
  5462. child = child.options;
  5463. }
  5464. normalizeProps(child, vm);
  5465. normalizeInject(child, vm);
  5466. normalizeDirectives$1(child);
  5467. // Apply extends and mixins on the child options,
  5468. // but only if it is a raw options object that isn't
  5469. // the result of another mergeOptions call.
  5470. // Only merged options has the _base property.
  5471. if (!child._base) {
  5472. if (child.extends) {
  5473. parent = mergeOptions(parent, child.extends, vm);
  5474. }
  5475. if (child.mixins) {
  5476. for (var i = 0, l = child.mixins.length; i < l; i++) {
  5477. parent = mergeOptions(parent, child.mixins[i], vm);
  5478. }
  5479. }
  5480. }
  5481. var options = {};
  5482. var key;
  5483. for (key in parent) {
  5484. mergeField(key);
  5485. }
  5486. for (key in child) {
  5487. if (!hasOwn(parent, key)) {
  5488. mergeField(key);
  5489. }
  5490. }
  5491. function mergeField(key) {
  5492. var strat = strats[key] || defaultStrat;
  5493. options[key] = strat(parent[key], child[key], vm, key);
  5494. }
  5495. return options;
  5496. }
  5497. /**
  5498. * Resolve an asset.
  5499. * This function is used because child instances need access
  5500. * to assets defined in its ancestor chain.
  5501. */
  5502. function resolveAsset(options, type, id, warnMissing) {
  5503. /* istanbul ignore if */
  5504. if (typeof id !== 'string') {
  5505. return;
  5506. }
  5507. var assets = options[type];
  5508. // check local registration variations first
  5509. if (hasOwn(assets, id))
  5510. return assets[id];
  5511. var camelizedId = camelize(id);
  5512. if (hasOwn(assets, camelizedId))
  5513. return assets[camelizedId];
  5514. var PascalCaseId = capitalize(camelizedId);
  5515. if (hasOwn(assets, PascalCaseId))
  5516. return assets[PascalCaseId];
  5517. // fallback to prototype chain
  5518. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  5519. if (warnMissing && !res) {
  5520. warn$2('Failed to resolve ' + type.slice(0, -1) + ': ' + id);
  5521. }
  5522. return res;
  5523. }
  5524. function validateProp(key, propOptions, propsData, vm) {
  5525. var prop = propOptions[key];
  5526. var absent = !hasOwn(propsData, key);
  5527. var value = propsData[key];
  5528. // boolean casting
  5529. var booleanIndex = getTypeIndex(Boolean, prop.type);
  5530. if (booleanIndex > -1) {
  5531. if (absent && !hasOwn(prop, 'default')) {
  5532. value = false;
  5533. }
  5534. else if (value === '' || value === hyphenate(key)) {
  5535. // only cast empty string / same name to boolean if
  5536. // boolean has higher priority
  5537. var stringIndex = getTypeIndex(String, prop.type);
  5538. if (stringIndex < 0 || booleanIndex < stringIndex) {
  5539. value = true;
  5540. }
  5541. }
  5542. }
  5543. // check default value
  5544. if (value === undefined) {
  5545. value = getPropDefaultValue(vm, prop, key);
  5546. // since the default value is a fresh copy,
  5547. // make sure to observe it.
  5548. var prevShouldObserve = shouldObserve;
  5549. toggleObserving(true);
  5550. observe(value);
  5551. toggleObserving(prevShouldObserve);
  5552. }
  5553. {
  5554. assertProp(prop, key, value, vm, absent);
  5555. }
  5556. return value;
  5557. }
  5558. /**
  5559. * Get the default value of a prop.
  5560. */
  5561. function getPropDefaultValue(vm, prop, key) {
  5562. // no default, return undefined
  5563. if (!hasOwn(prop, 'default')) {
  5564. return undefined;
  5565. }
  5566. var def = prop.default;
  5567. // warn against non-factory defaults for Object & Array
  5568. if (isObject(def)) {
  5569. warn$2('Invalid default value for prop "' +
  5570. key +
  5571. '": ' +
  5572. 'Props with type Object/Array must use a factory function ' +
  5573. 'to return the default value.', vm);
  5574. }
  5575. // the raw prop value was also undefined from previous render,
  5576. // return previous default value to avoid unnecessary watcher trigger
  5577. if (vm &&
  5578. vm.$options.propsData &&
  5579. vm.$options.propsData[key] === undefined &&
  5580. vm._props[key] !== undefined) {
  5581. return vm._props[key];
  5582. }
  5583. // call factory function for non-Function types
  5584. // a value is Function if its prototype is function even across different execution context
  5585. return isFunction(def) && getType(prop.type) !== 'Function'
  5586. ? def.call(vm)
  5587. : def;
  5588. }
  5589. /**
  5590. * Assert whether a prop is valid.
  5591. */
  5592. function assertProp(prop, name, value, vm, absent) {
  5593. if (prop.required && absent) {
  5594. warn$2('Missing required prop: "' + name + '"', vm);
  5595. return;
  5596. }
  5597. if (value == null && !prop.required) {
  5598. return;
  5599. }
  5600. var type = prop.type;
  5601. var valid = !type || type === true;
  5602. var expectedTypes = [];
  5603. if (type) {
  5604. if (!isArray(type)) {
  5605. type = [type];
  5606. }
  5607. for (var i = 0; i < type.length && !valid; i++) {
  5608. var assertedType = assertType(value, type[i], vm);
  5609. expectedTypes.push(assertedType.expectedType || '');
  5610. valid = assertedType.valid;
  5611. }
  5612. }
  5613. var haveExpectedTypes = expectedTypes.some(function (t) { return t; });
  5614. if (!valid && haveExpectedTypes) {
  5615. warn$2(getInvalidTypeMessage(name, value, expectedTypes), vm);
  5616. return;
  5617. }
  5618. var validator = prop.validator;
  5619. if (validator) {
  5620. if (!validator(value)) {
  5621. warn$2('Invalid prop: custom validator check failed for prop "' + name + '".', vm);
  5622. }
  5623. }
  5624. }
  5625. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/;
  5626. function assertType(value, type, vm) {
  5627. var valid;
  5628. var expectedType = getType(type);
  5629. if (simpleCheckRE.test(expectedType)) {
  5630. var t = typeof value;
  5631. valid = t === expectedType.toLowerCase();
  5632. // for primitive wrapper objects
  5633. if (!valid && t === 'object') {
  5634. valid = value instanceof type;
  5635. }
  5636. }
  5637. else if (expectedType === 'Object') {
  5638. valid = isPlainObject(value);
  5639. }
  5640. else if (expectedType === 'Array') {
  5641. valid = isArray(value);
  5642. }
  5643. else {
  5644. try {
  5645. valid = value instanceof type;
  5646. }
  5647. catch (e) {
  5648. warn$2('Invalid prop type: "' + String(type) + '" is not a constructor', vm);
  5649. valid = false;
  5650. }
  5651. }
  5652. return {
  5653. valid: valid,
  5654. expectedType: expectedType
  5655. };
  5656. }
  5657. var functionTypeCheckRE = /^\s*function (\w+)/;
  5658. /**
  5659. * Use function string name to check built-in types,
  5660. * because a simple equality check will fail when running
  5661. * across different vms / iframes.
  5662. */
  5663. function getType(fn) {
  5664. var match = fn && fn.toString().match(functionTypeCheckRE);
  5665. return match ? match[1] : '';
  5666. }
  5667. function isSameType(a, b) {
  5668. return getType(a) === getType(b);
  5669. }
  5670. function getTypeIndex(type, expectedTypes) {
  5671. if (!isArray(expectedTypes)) {
  5672. return isSameType(expectedTypes, type) ? 0 : -1;
  5673. }
  5674. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  5675. if (isSameType(expectedTypes[i], type)) {
  5676. return i;
  5677. }
  5678. }
  5679. return -1;
  5680. }
  5681. function getInvalidTypeMessage(name, value, expectedTypes) {
  5682. var message = "Invalid prop: type check failed for prop \"".concat(name, "\".") +
  5683. " Expected ".concat(expectedTypes.map(capitalize).join(', '));
  5684. var expectedType = expectedTypes[0];
  5685. var receivedType = toRawType(value);
  5686. // check if we need to specify expected value
  5687. if (expectedTypes.length === 1 &&
  5688. isExplicable(expectedType) &&
  5689. isExplicable(typeof value) &&
  5690. !isBoolean(expectedType, receivedType)) {
  5691. message += " with value ".concat(styleValue(value, expectedType));
  5692. }
  5693. message += ", got ".concat(receivedType, " ");
  5694. // check if we need to specify received value
  5695. if (isExplicable(receivedType)) {
  5696. message += "with value ".concat(styleValue(value, receivedType), ".");
  5697. }
  5698. return message;
  5699. }
  5700. function styleValue(value, type) {
  5701. if (type === 'String') {
  5702. return "\"".concat(value, "\"");
  5703. }
  5704. else if (type === 'Number') {
  5705. return "".concat(Number(value));
  5706. }
  5707. else {
  5708. return "".concat(value);
  5709. }
  5710. }
  5711. var EXPLICABLE_TYPES = ['string', 'number', 'boolean'];
  5712. function isExplicable(value) {
  5713. return EXPLICABLE_TYPES.some(function (elem) { return value.toLowerCase() === elem; });
  5714. }
  5715. function isBoolean() {
  5716. var args = [];
  5717. for (var _i = 0; _i < arguments.length; _i++) {
  5718. args[_i] = arguments[_i];
  5719. }
  5720. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; });
  5721. }
  5722. function Vue(options) {
  5723. if (!(this instanceof Vue)) {
  5724. warn$2('Vue is a constructor and should be called with the `new` keyword');
  5725. }
  5726. this._init(options);
  5727. }
  5728. //@ts-expect-error Vue has function type
  5729. initMixin$1(Vue);
  5730. //@ts-expect-error Vue has function type
  5731. stateMixin(Vue);
  5732. //@ts-expect-error Vue has function type
  5733. eventsMixin(Vue);
  5734. //@ts-expect-error Vue has function type
  5735. lifecycleMixin(Vue);
  5736. //@ts-expect-error Vue has function type
  5737. renderMixin(Vue);
  5738. function initUse(Vue) {
  5739. Vue.use = function (plugin) {
  5740. var installedPlugins = this._installedPlugins || (this._installedPlugins = []);
  5741. if (installedPlugins.indexOf(plugin) > -1) {
  5742. return this;
  5743. }
  5744. // additional parameters
  5745. var args = toArray(arguments, 1);
  5746. args.unshift(this);
  5747. if (isFunction(plugin.install)) {
  5748. plugin.install.apply(plugin, args);
  5749. }
  5750. else if (isFunction(plugin)) {
  5751. plugin.apply(null, args);
  5752. }
  5753. installedPlugins.push(plugin);
  5754. return this;
  5755. };
  5756. }
  5757. function initMixin(Vue) {
  5758. Vue.mixin = function (mixin) {
  5759. this.options = mergeOptions(this.options, mixin);
  5760. return this;
  5761. };
  5762. }
  5763. function initExtend(Vue) {
  5764. /**
  5765. * Each instance constructor, including Vue, has a unique
  5766. * cid. This enables us to create wrapped "child
  5767. * constructors" for prototypal inheritance and cache them.
  5768. */
  5769. Vue.cid = 0;
  5770. var cid = 1;
  5771. /**
  5772. * Class inheritance
  5773. */
  5774. Vue.extend = function (extendOptions) {
  5775. extendOptions = extendOptions || {};
  5776. var Super = this;
  5777. var SuperId = Super.cid;
  5778. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  5779. if (cachedCtors[SuperId]) {
  5780. return cachedCtors[SuperId];
  5781. }
  5782. var name = getComponentName(extendOptions) || getComponentName(Super.options);
  5783. if (name) {
  5784. validateComponentName(name);
  5785. }
  5786. var Sub = function VueComponent(options) {
  5787. this._init(options);
  5788. };
  5789. Sub.prototype = Object.create(Super.prototype);
  5790. Sub.prototype.constructor = Sub;
  5791. Sub.cid = cid++;
  5792. Sub.options = mergeOptions(Super.options, extendOptions);
  5793. Sub['super'] = Super;
  5794. // For props and computed properties, we define the proxy getters on
  5795. // the Vue instances at extension time, on the extended prototype. This
  5796. // avoids Object.defineProperty calls for each instance created.
  5797. if (Sub.options.props) {
  5798. initProps(Sub);
  5799. }
  5800. if (Sub.options.computed) {
  5801. initComputed(Sub);
  5802. }
  5803. // allow further extension/mixin/plugin usage
  5804. Sub.extend = Super.extend;
  5805. Sub.mixin = Super.mixin;
  5806. Sub.use = Super.use;
  5807. // create asset registers, so extended classes
  5808. // can have their private assets too.
  5809. ASSET_TYPES.forEach(function (type) {
  5810. Sub[type] = Super[type];
  5811. });
  5812. // enable recursive self-lookup
  5813. if (name) {
  5814. Sub.options.components[name] = Sub;
  5815. }
  5816. // keep a reference to the super options at extension time.
  5817. // later at instantiation we can check if Super's options have
  5818. // been updated.
  5819. Sub.superOptions = Super.options;
  5820. Sub.extendOptions = extendOptions;
  5821. Sub.sealedOptions = extend({}, Sub.options);
  5822. // cache constructor
  5823. cachedCtors[SuperId] = Sub;
  5824. return Sub;
  5825. };
  5826. }
  5827. function initProps(Comp) {
  5828. var props = Comp.options.props;
  5829. for (var key in props) {
  5830. proxy(Comp.prototype, "_props", key);
  5831. }
  5832. }
  5833. function initComputed(Comp) {
  5834. var computed = Comp.options.computed;
  5835. for (var key in computed) {
  5836. defineComputed(Comp.prototype, key, computed[key]);
  5837. }
  5838. }
  5839. function initAssetRegisters(Vue) {
  5840. /**
  5841. * Create asset registration methods.
  5842. */
  5843. ASSET_TYPES.forEach(function (type) {
  5844. // @ts-expect-error function is not exact same type
  5845. Vue[type] = function (id, definition) {
  5846. if (!definition) {
  5847. return this.options[type + 's'][id];
  5848. }
  5849. else {
  5850. /* istanbul ignore if */
  5851. if (type === 'component') {
  5852. validateComponentName(id);
  5853. }
  5854. if (type === 'component' && isPlainObject(definition)) {
  5855. // @ts-expect-error
  5856. definition.name = definition.name || id;
  5857. definition = this.options._base.extend(definition);
  5858. }
  5859. if (type === 'directive' && isFunction(definition)) {
  5860. definition = { bind: definition, update: definition };
  5861. }
  5862. this.options[type + 's'][id] = definition;
  5863. return definition;
  5864. }
  5865. };
  5866. });
  5867. }
  5868. function _getComponentName(opts) {
  5869. return opts && (getComponentName(opts.Ctor.options) || opts.tag);
  5870. }
  5871. function matches(pattern, name) {
  5872. if (isArray(pattern)) {
  5873. return pattern.indexOf(name) > -1;
  5874. }
  5875. else if (typeof pattern === 'string') {
  5876. return pattern.split(',').indexOf(name) > -1;
  5877. }
  5878. else if (isRegExp(pattern)) {
  5879. return pattern.test(name);
  5880. }
  5881. /* istanbul ignore next */
  5882. return false;
  5883. }
  5884. function pruneCache(keepAliveInstance, filter) {
  5885. var cache = keepAliveInstance.cache, keys = keepAliveInstance.keys, _vnode = keepAliveInstance._vnode, $vnode = keepAliveInstance.$vnode;
  5886. for (var key in cache) {
  5887. var entry = cache[key];
  5888. if (entry) {
  5889. var name_1 = entry.name;
  5890. if (name_1 && !filter(name_1)) {
  5891. pruneCacheEntry(cache, key, keys, _vnode);
  5892. }
  5893. }
  5894. }
  5895. $vnode.componentOptions.children = undefined;
  5896. }
  5897. function pruneCacheEntry(cache, key, keys, current) {
  5898. var entry = cache[key];
  5899. if (entry && (!current || entry.tag !== current.tag)) {
  5900. // @ts-expect-error can be undefined
  5901. entry.componentInstance.$destroy();
  5902. }
  5903. cache[key] = null;
  5904. remove$2(keys, key);
  5905. }
  5906. var patternTypes = [String, RegExp, Array];
  5907. // TODO defineComponent
  5908. var KeepAlive = {
  5909. name: 'keep-alive',
  5910. abstract: true,
  5911. props: {
  5912. include: patternTypes,
  5913. exclude: patternTypes,
  5914. max: [String, Number]
  5915. },
  5916. methods: {
  5917. cacheVNode: function () {
  5918. var _a = this, cache = _a.cache, keys = _a.keys, vnodeToCache = _a.vnodeToCache, keyToCache = _a.keyToCache;
  5919. if (vnodeToCache) {
  5920. var tag = vnodeToCache.tag, componentInstance = vnodeToCache.componentInstance, componentOptions = vnodeToCache.componentOptions;
  5921. cache[keyToCache] = {
  5922. name: _getComponentName(componentOptions),
  5923. tag: tag,
  5924. componentInstance: componentInstance
  5925. };
  5926. keys.push(keyToCache);
  5927. // prune oldest entry
  5928. if (this.max && keys.length > parseInt(this.max)) {
  5929. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  5930. }
  5931. this.vnodeToCache = null;
  5932. }
  5933. }
  5934. },
  5935. created: function () {
  5936. this.cache = Object.create(null);
  5937. this.keys = [];
  5938. },
  5939. destroyed: function () {
  5940. for (var key in this.cache) {
  5941. pruneCacheEntry(this.cache, key, this.keys);
  5942. }
  5943. },
  5944. mounted: function () {
  5945. var _this = this;
  5946. this.cacheVNode();
  5947. this.$watch('include', function (val) {
  5948. pruneCache(_this, function (name) { return matches(val, name); });
  5949. });
  5950. this.$watch('exclude', function (val) {
  5951. pruneCache(_this, function (name) { return !matches(val, name); });
  5952. });
  5953. },
  5954. updated: function () {
  5955. this.cacheVNode();
  5956. },
  5957. render: function () {
  5958. var slot = this.$slots.default;
  5959. var vnode = getFirstComponentChild(slot);
  5960. var componentOptions = vnode && vnode.componentOptions;
  5961. if (componentOptions) {
  5962. // check pattern
  5963. var name_2 = _getComponentName(componentOptions);
  5964. var _a = this, include = _a.include, exclude = _a.exclude;
  5965. if (
  5966. // not included
  5967. (include && (!name_2 || !matches(include, name_2))) ||
  5968. // excluded
  5969. (exclude && name_2 && matches(exclude, name_2))) {
  5970. return vnode;
  5971. }
  5972. var _b = this, cache = _b.cache, keys = _b.keys;
  5973. var key = vnode.key == null
  5974. ? // same constructor may get registered as different local components
  5975. // so cid alone is not enough (#3269)
  5976. componentOptions.Ctor.cid +
  5977. (componentOptions.tag ? "::".concat(componentOptions.tag) : '')
  5978. : vnode.key;
  5979. if (cache[key]) {
  5980. vnode.componentInstance = cache[key].componentInstance;
  5981. // make current key freshest
  5982. remove$2(keys, key);
  5983. keys.push(key);
  5984. }
  5985. else {
  5986. // delay setting the cache until update
  5987. this.vnodeToCache = vnode;
  5988. this.keyToCache = key;
  5989. }
  5990. // @ts-expect-error can vnode.data can be undefined
  5991. vnode.data.keepAlive = true;
  5992. }
  5993. return vnode || (slot && slot[0]);
  5994. }
  5995. };
  5996. var builtInComponents = {
  5997. KeepAlive: KeepAlive
  5998. };
  5999. function initGlobalAPI(Vue) {
  6000. // config
  6001. var configDef = {};
  6002. configDef.get = function () { return config; };
  6003. {
  6004. configDef.set = function () {
  6005. warn$2('Do not replace the Vue.config object, set individual fields instead.');
  6006. };
  6007. }
  6008. Object.defineProperty(Vue, 'config', configDef);
  6009. // exposed util methods.
  6010. // NOTE: these are not considered part of the public API - avoid relying on
  6011. // them unless you are aware of the risk.
  6012. Vue.util = {
  6013. warn: warn$2,
  6014. extend: extend,
  6015. mergeOptions: mergeOptions,
  6016. defineReactive: defineReactive
  6017. };
  6018. Vue.set = set;
  6019. Vue.delete = del;
  6020. Vue.nextTick = nextTick;
  6021. // 2.6 explicit observable API
  6022. Vue.observable = function (obj) {
  6023. observe(obj);
  6024. return obj;
  6025. };
  6026. Vue.options = Object.create(null);
  6027. ASSET_TYPES.forEach(function (type) {
  6028. Vue.options[type + 's'] = Object.create(null);
  6029. });
  6030. // this is used to identify the "base" constructor to extend all plain-object
  6031. // components with in Weex's multi-instance scenarios.
  6032. Vue.options._base = Vue;
  6033. extend(Vue.options.components, builtInComponents);
  6034. initUse(Vue);
  6035. initMixin(Vue);
  6036. initExtend(Vue);
  6037. initAssetRegisters(Vue);
  6038. }
  6039. initGlobalAPI(Vue);
  6040. Object.defineProperty(Vue.prototype, '$isServer', {
  6041. get: isServerRendering
  6042. });
  6043. Object.defineProperty(Vue.prototype, '$ssrContext', {
  6044. get: function () {
  6045. /* istanbul ignore next */
  6046. return this.$vnode && this.$vnode.ssrContext;
  6047. }
  6048. });
  6049. // expose FunctionalRenderContext for ssr runtime helper installation
  6050. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  6051. value: FunctionalRenderContext
  6052. });
  6053. Vue.version = version;
  6054. // these are reserved for web because they are directly compiled away
  6055. // during template compilation
  6056. var isReservedAttr = makeMap('style,class');
  6057. // attributes that should be using props for binding
  6058. var acceptValue = makeMap('input,textarea,option,select,progress');
  6059. var mustUseProp = function (tag, type, attr) {
  6060. return ((attr === 'value' && acceptValue(tag) && type !== 'button') ||
  6061. (attr === 'selected' && tag === 'option') ||
  6062. (attr === 'checked' && tag === 'input') ||
  6063. (attr === 'muted' && tag === 'video'));
  6064. };
  6065. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  6066. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  6067. var convertEnumeratedValue = function (key, value) {
  6068. return isFalsyAttrValue(value) || value === 'false'
  6069. ? 'false'
  6070. : // allow arbitrary string value for contenteditable
  6071. key === 'contenteditable' && isValidContentEditableValue(value)
  6072. ? value
  6073. : 'true';
  6074. };
  6075. var isBooleanAttr = makeMap('allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  6076. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  6077. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  6078. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  6079. 'required,reversed,scoped,seamless,selected,sortable,' +
  6080. 'truespeed,typemustmatch,visible');
  6081. var xlinkNS = 'http://www.w3.org/1999/xlink';
  6082. var isXlink = function (name) {
  6083. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink';
  6084. };
  6085. var getXlinkProp = function (name) {
  6086. return isXlink(name) ? name.slice(6, name.length) : '';
  6087. };
  6088. var isFalsyAttrValue = function (val) {
  6089. return val == null || val === false;
  6090. };
  6091. function genClassForVnode(vnode) {
  6092. var data = vnode.data;
  6093. var parentNode = vnode;
  6094. var childNode = vnode;
  6095. while (isDef(childNode.componentInstance)) {
  6096. childNode = childNode.componentInstance._vnode;
  6097. if (childNode && childNode.data) {
  6098. data = mergeClassData(childNode.data, data);
  6099. }
  6100. }
  6101. // @ts-expect-error parentNode.parent not VNodeWithData
  6102. while (isDef((parentNode = parentNode.parent))) {
  6103. if (parentNode && parentNode.data) {
  6104. data = mergeClassData(data, parentNode.data);
  6105. }
  6106. }
  6107. return renderClass(data.staticClass, data.class);
  6108. }
  6109. function mergeClassData(child, parent) {
  6110. return {
  6111. staticClass: concat(child.staticClass, parent.staticClass),
  6112. class: isDef(child.class) ? [child.class, parent.class] : parent.class
  6113. };
  6114. }
  6115. function renderClass(staticClass, dynamicClass) {
  6116. if (isDef(staticClass) || isDef(dynamicClass)) {
  6117. return concat(staticClass, stringifyClass(dynamicClass));
  6118. }
  6119. /* istanbul ignore next */
  6120. return '';
  6121. }
  6122. function concat(a, b) {
  6123. return a ? (b ? a + ' ' + b : a) : b || '';
  6124. }
  6125. function stringifyClass(value) {
  6126. if (Array.isArray(value)) {
  6127. return stringifyArray(value);
  6128. }
  6129. if (isObject(value)) {
  6130. return stringifyObject(value);
  6131. }
  6132. if (typeof value === 'string') {
  6133. return value;
  6134. }
  6135. /* istanbul ignore next */
  6136. return '';
  6137. }
  6138. function stringifyArray(value) {
  6139. var res = '';
  6140. var stringified;
  6141. for (var i = 0, l = value.length; i < l; i++) {
  6142. if (isDef((stringified = stringifyClass(value[i]))) && stringified !== '') {
  6143. if (res)
  6144. res += ' ';
  6145. res += stringified;
  6146. }
  6147. }
  6148. return res;
  6149. }
  6150. function stringifyObject(value) {
  6151. var res = '';
  6152. for (var key in value) {
  6153. if (value[key]) {
  6154. if (res)
  6155. res += ' ';
  6156. res += key;
  6157. }
  6158. }
  6159. return res;
  6160. }
  6161. var namespaceMap = {
  6162. svg: 'http://www.w3.org/2000/svg',
  6163. math: 'http://www.w3.org/1998/Math/MathML'
  6164. };
  6165. var isHTMLTag = makeMap('html,body,base,head,link,meta,style,title,' +
  6166. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  6167. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  6168. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  6169. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  6170. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  6171. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  6172. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  6173. 'output,progress,select,textarea,' +
  6174. 'details,dialog,menu,menuitem,summary,' +
  6175. 'content,element,shadow,template,blockquote,iframe,tfoot');
  6176. // this map is intentionally selective, only covering SVG elements that may
  6177. // contain child elements.
  6178. var isSVG = makeMap('svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  6179. 'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  6180. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view', true);
  6181. var isPreTag = function (tag) { return tag === 'pre'; };
  6182. var isReservedTag = function (tag) {
  6183. return isHTMLTag(tag) || isSVG(tag);
  6184. };
  6185. function getTagNamespace(tag) {
  6186. if (isSVG(tag)) {
  6187. return 'svg';
  6188. }
  6189. // basic support for MathML
  6190. // note it doesn't support other MathML elements being component roots
  6191. if (tag === 'math') {
  6192. return 'math';
  6193. }
  6194. }
  6195. var unknownElementCache = Object.create(null);
  6196. function isUnknownElement(tag) {
  6197. /* istanbul ignore if */
  6198. if (!inBrowser) {
  6199. return true;
  6200. }
  6201. if (isReservedTag(tag)) {
  6202. return false;
  6203. }
  6204. tag = tag.toLowerCase();
  6205. /* istanbul ignore if */
  6206. if (unknownElementCache[tag] != null) {
  6207. return unknownElementCache[tag];
  6208. }
  6209. var el = document.createElement(tag);
  6210. if (tag.indexOf('-') > -1) {
  6211. // https://stackoverflow.com/a/28210364/1070244
  6212. return (unknownElementCache[tag] =
  6213. el.constructor === window.HTMLUnknownElement ||
  6214. el.constructor === window.HTMLElement);
  6215. }
  6216. else {
  6217. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()));
  6218. }
  6219. }
  6220. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  6221. /**
  6222. * Query an element selector if it's not an element already.
  6223. */
  6224. function query(el) {
  6225. if (typeof el === 'string') {
  6226. var selected = document.querySelector(el);
  6227. if (!selected) {
  6228. warn$2('Cannot find element: ' + el);
  6229. return document.createElement('div');
  6230. }
  6231. return selected;
  6232. }
  6233. else {
  6234. return el;
  6235. }
  6236. }
  6237. function createElement(tagName, vnode) {
  6238. var elm = document.createElement(tagName);
  6239. if (tagName !== 'select') {
  6240. return elm;
  6241. }
  6242. // false or null will remove the attribute but undefined will not
  6243. if (vnode.data &&
  6244. vnode.data.attrs &&
  6245. vnode.data.attrs.multiple !== undefined) {
  6246. elm.setAttribute('multiple', 'multiple');
  6247. }
  6248. return elm;
  6249. }
  6250. function createElementNS(namespace, tagName) {
  6251. return document.createElementNS(namespaceMap[namespace], tagName);
  6252. }
  6253. function createTextNode(text) {
  6254. return document.createTextNode(text);
  6255. }
  6256. function createComment(text) {
  6257. return document.createComment(text);
  6258. }
  6259. function insertBefore(parentNode, newNode, referenceNode) {
  6260. parentNode.insertBefore(newNode, referenceNode);
  6261. }
  6262. function removeChild(node, child) {
  6263. node.removeChild(child);
  6264. }
  6265. function appendChild(node, child) {
  6266. node.appendChild(child);
  6267. }
  6268. function parentNode(node) {
  6269. return node.parentNode;
  6270. }
  6271. function nextSibling(node) {
  6272. return node.nextSibling;
  6273. }
  6274. function tagName(node) {
  6275. return node.tagName;
  6276. }
  6277. function setTextContent(node, text) {
  6278. node.textContent = text;
  6279. }
  6280. function setStyleScope(node, scopeId) {
  6281. node.setAttribute(scopeId, '');
  6282. }
  6283. var nodeOps = /*#__PURE__*/Object.freeze({
  6284. __proto__: null,
  6285. createElement: createElement,
  6286. createElementNS: createElementNS,
  6287. createTextNode: createTextNode,
  6288. createComment: createComment,
  6289. insertBefore: insertBefore,
  6290. removeChild: removeChild,
  6291. appendChild: appendChild,
  6292. parentNode: parentNode,
  6293. nextSibling: nextSibling,
  6294. tagName: tagName,
  6295. setTextContent: setTextContent,
  6296. setStyleScope: setStyleScope
  6297. });
  6298. var ref = {
  6299. create: function (_, vnode) {
  6300. registerRef(vnode);
  6301. },
  6302. update: function (oldVnode, vnode) {
  6303. if (oldVnode.data.ref !== vnode.data.ref) {
  6304. registerRef(oldVnode, true);
  6305. registerRef(vnode);
  6306. }
  6307. },
  6308. destroy: function (vnode) {
  6309. registerRef(vnode, true);
  6310. }
  6311. };
  6312. function registerRef(vnode, isRemoval) {
  6313. var ref = vnode.data.ref;
  6314. if (!isDef(ref))
  6315. return;
  6316. var vm = vnode.context;
  6317. var refValue = vnode.componentInstance || vnode.elm;
  6318. var value = isRemoval ? null : refValue;
  6319. var $refsValue = isRemoval ? undefined : refValue;
  6320. if (isFunction(ref)) {
  6321. invokeWithErrorHandling(ref, vm, [value], vm, "template ref function");
  6322. return;
  6323. }
  6324. var isFor = vnode.data.refInFor;
  6325. var _isString = typeof ref === 'string' || typeof ref === 'number';
  6326. var _isRef = isRef(ref);
  6327. var refs = vm.$refs;
  6328. if (_isString || _isRef) {
  6329. if (isFor) {
  6330. var existing = _isString ? refs[ref] : ref.value;
  6331. if (isRemoval) {
  6332. isArray(existing) && remove$2(existing, refValue);
  6333. }
  6334. else {
  6335. if (!isArray(existing)) {
  6336. if (_isString) {
  6337. refs[ref] = [refValue];
  6338. setSetupRef(vm, ref, refs[ref]);
  6339. }
  6340. else {
  6341. ref.value = [refValue];
  6342. }
  6343. }
  6344. else if (!existing.includes(refValue)) {
  6345. existing.push(refValue);
  6346. }
  6347. }
  6348. }
  6349. else if (_isString) {
  6350. if (isRemoval && refs[ref] !== refValue) {
  6351. return;
  6352. }
  6353. refs[ref] = $refsValue;
  6354. setSetupRef(vm, ref, value);
  6355. }
  6356. else if (_isRef) {
  6357. if (isRemoval && ref.value !== refValue) {
  6358. return;
  6359. }
  6360. ref.value = value;
  6361. }
  6362. else {
  6363. warn$2("Invalid template ref type: ".concat(typeof ref));
  6364. }
  6365. }
  6366. }
  6367. function setSetupRef(_a, key, val) {
  6368. var _setupState = _a._setupState;
  6369. if (_setupState && hasOwn(_setupState, key)) {
  6370. if (isRef(_setupState[key])) {
  6371. _setupState[key].value = val;
  6372. }
  6373. else {
  6374. _setupState[key] = val;
  6375. }
  6376. }
  6377. }
  6378. /**
  6379. * Virtual DOM patching algorithm based on Snabbdom by
  6380. * Simon Friis Vindum (@paldepind)
  6381. * Licensed under the MIT License
  6382. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  6383. *
  6384. * modified by Evan You (@yyx990803)
  6385. *
  6386. * Not type-checking this because this file is perf-critical and the cost
  6387. * of making flow understand it is not worth it.
  6388. */
  6389. var emptyNode = new VNode('', {}, []);
  6390. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  6391. function sameVnode(a, b) {
  6392. return (a.key === b.key &&
  6393. a.asyncFactory === b.asyncFactory &&
  6394. ((a.tag === b.tag &&
  6395. a.isComment === b.isComment &&
  6396. isDef(a.data) === isDef(b.data) &&
  6397. sameInputType(a, b)) ||
  6398. (isTrue(a.isAsyncPlaceholder) && isUndef(b.asyncFactory.error))));
  6399. }
  6400. function sameInputType(a, b) {
  6401. if (a.tag !== 'input')
  6402. return true;
  6403. var i;
  6404. var typeA = isDef((i = a.data)) && isDef((i = i.attrs)) && i.type;
  6405. var typeB = isDef((i = b.data)) && isDef((i = i.attrs)) && i.type;
  6406. return typeA === typeB || (isTextInputType(typeA) && isTextInputType(typeB));
  6407. }
  6408. function createKeyToOldIdx(children, beginIdx, endIdx) {
  6409. var i, key;
  6410. var map = {};
  6411. for (i = beginIdx; i <= endIdx; ++i) {
  6412. key = children[i].key;
  6413. if (isDef(key))
  6414. map[key] = i;
  6415. }
  6416. return map;
  6417. }
  6418. function createPatchFunction(backend) {
  6419. var i, j;
  6420. var cbs = {};
  6421. var modules = backend.modules, nodeOps = backend.nodeOps;
  6422. for (i = 0; i < hooks.length; ++i) {
  6423. cbs[hooks[i]] = [];
  6424. for (j = 0; j < modules.length; ++j) {
  6425. if (isDef(modules[j][hooks[i]])) {
  6426. cbs[hooks[i]].push(modules[j][hooks[i]]);
  6427. }
  6428. }
  6429. }
  6430. function emptyNodeAt(elm) {
  6431. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm);
  6432. }
  6433. function createRmCb(childElm, listeners) {
  6434. function remove() {
  6435. if (--remove.listeners === 0) {
  6436. removeNode(childElm);
  6437. }
  6438. }
  6439. remove.listeners = listeners;
  6440. return remove;
  6441. }
  6442. function removeNode(el) {
  6443. var parent = nodeOps.parentNode(el);
  6444. // element may have already been removed due to v-html / v-text
  6445. if (isDef(parent)) {
  6446. nodeOps.removeChild(parent, el);
  6447. }
  6448. }
  6449. function isUnknownElement(vnode, inVPre) {
  6450. return (!inVPre &&
  6451. !vnode.ns &&
  6452. !(config.ignoredElements.length &&
  6453. config.ignoredElements.some(function (ignore) {
  6454. return isRegExp(ignore)
  6455. ? ignore.test(vnode.tag)
  6456. : ignore === vnode.tag;
  6457. })) &&
  6458. config.isUnknownElement(vnode.tag));
  6459. }
  6460. var creatingElmInVPre = 0;
  6461. function createElm(vnode, insertedVnodeQueue, parentElm, refElm, nested, ownerArray, index) {
  6462. if (isDef(vnode.elm) && isDef(ownerArray)) {
  6463. // This vnode was used in a previous render!
  6464. // now it's used as a new node, overwriting its elm would cause
  6465. // potential patch errors down the road when it's used as an insertion
  6466. // reference node. Instead, we clone the node on-demand before creating
  6467. // associated DOM element for it.
  6468. vnode = ownerArray[index] = cloneVNode(vnode);
  6469. }
  6470. vnode.isRootInsert = !nested; // for transition enter check
  6471. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  6472. return;
  6473. }
  6474. var data = vnode.data;
  6475. var children = vnode.children;
  6476. var tag = vnode.tag;
  6477. if (isDef(tag)) {
  6478. {
  6479. if (data && data.pre) {
  6480. creatingElmInVPre++;
  6481. }
  6482. if (isUnknownElement(vnode, creatingElmInVPre)) {
  6483. warn$2('Unknown custom element: <' +
  6484. tag +
  6485. '> - did you ' +
  6486. 'register the component correctly? For recursive components, ' +
  6487. 'make sure to provide the "name" option.', vnode.context);
  6488. }
  6489. }
  6490. vnode.elm = vnode.ns
  6491. ? nodeOps.createElementNS(vnode.ns, tag)
  6492. : nodeOps.createElement(tag, vnode);
  6493. setScope(vnode);
  6494. createChildren(vnode, children, insertedVnodeQueue);
  6495. if (isDef(data)) {
  6496. invokeCreateHooks(vnode, insertedVnodeQueue);
  6497. }
  6498. insert(parentElm, vnode.elm, refElm);
  6499. if (data && data.pre) {
  6500. creatingElmInVPre--;
  6501. }
  6502. }
  6503. else if (isTrue(vnode.isComment)) {
  6504. vnode.elm = nodeOps.createComment(vnode.text);
  6505. insert(parentElm, vnode.elm, refElm);
  6506. }
  6507. else {
  6508. vnode.elm = nodeOps.createTextNode(vnode.text);
  6509. insert(parentElm, vnode.elm, refElm);
  6510. }
  6511. }
  6512. function createComponent(vnode, insertedVnodeQueue, parentElm, refElm) {
  6513. var i = vnode.data;
  6514. if (isDef(i)) {
  6515. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  6516. if (isDef((i = i.hook)) && isDef((i = i.init))) {
  6517. i(vnode, false /* hydrating */);
  6518. }
  6519. // after calling the init hook, if the vnode is a child component
  6520. // it should've created a child instance and mounted it. the child
  6521. // component also has set the placeholder vnode's elm.
  6522. // in that case we can just return the element and be done.
  6523. if (isDef(vnode.componentInstance)) {
  6524. initComponent(vnode, insertedVnodeQueue);
  6525. insert(parentElm, vnode.elm, refElm);
  6526. if (isTrue(isReactivated)) {
  6527. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  6528. }
  6529. return true;
  6530. }
  6531. }
  6532. }
  6533. function initComponent(vnode, insertedVnodeQueue) {
  6534. if (isDef(vnode.data.pendingInsert)) {
  6535. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  6536. vnode.data.pendingInsert = null;
  6537. }
  6538. vnode.elm = vnode.componentInstance.$el;
  6539. if (isPatchable(vnode)) {
  6540. invokeCreateHooks(vnode, insertedVnodeQueue);
  6541. setScope(vnode);
  6542. }
  6543. else {
  6544. // empty component root.
  6545. // skip all element-related modules except for ref (#3455)
  6546. registerRef(vnode);
  6547. // make sure to invoke the insert hook
  6548. insertedVnodeQueue.push(vnode);
  6549. }
  6550. }
  6551. function reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm) {
  6552. var i;
  6553. // hack for #4339: a reactivated component with inner transition
  6554. // does not trigger because the inner node's created hooks are not called
  6555. // again. It's not ideal to involve module-specific logic in here but
  6556. // there doesn't seem to be a better way to do it.
  6557. var innerNode = vnode;
  6558. while (innerNode.componentInstance) {
  6559. innerNode = innerNode.componentInstance._vnode;
  6560. if (isDef((i = innerNode.data)) && isDef((i = i.transition))) {
  6561. for (i = 0; i < cbs.activate.length; ++i) {
  6562. cbs.activate[i](emptyNode, innerNode);
  6563. }
  6564. insertedVnodeQueue.push(innerNode);
  6565. break;
  6566. }
  6567. }
  6568. // unlike a newly created component,
  6569. // a reactivated keep-alive component doesn't insert itself
  6570. insert(parentElm, vnode.elm, refElm);
  6571. }
  6572. function insert(parent, elm, ref) {
  6573. if (isDef(parent)) {
  6574. if (isDef(ref)) {
  6575. if (nodeOps.parentNode(ref) === parent) {
  6576. nodeOps.insertBefore(parent, elm, ref);
  6577. }
  6578. }
  6579. else {
  6580. nodeOps.appendChild(parent, elm);
  6581. }
  6582. }
  6583. }
  6584. function createChildren(vnode, children, insertedVnodeQueue) {
  6585. if (isArray(children)) {
  6586. {
  6587. checkDuplicateKeys(children);
  6588. }
  6589. for (var i_1 = 0; i_1 < children.length; ++i_1) {
  6590. createElm(children[i_1], insertedVnodeQueue, vnode.elm, null, true, children, i_1);
  6591. }
  6592. }
  6593. else if (isPrimitive(vnode.text)) {
  6594. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  6595. }
  6596. }
  6597. function isPatchable(vnode) {
  6598. while (vnode.componentInstance) {
  6599. vnode = vnode.componentInstance._vnode;
  6600. }
  6601. return isDef(vnode.tag);
  6602. }
  6603. function invokeCreateHooks(vnode, insertedVnodeQueue) {
  6604. for (var i_2 = 0; i_2 < cbs.create.length; ++i_2) {
  6605. cbs.create[i_2](emptyNode, vnode);
  6606. }
  6607. i = vnode.data.hook; // Reuse variable
  6608. if (isDef(i)) {
  6609. if (isDef(i.create))
  6610. i.create(emptyNode, vnode);
  6611. if (isDef(i.insert))
  6612. insertedVnodeQueue.push(vnode);
  6613. }
  6614. }
  6615. // set scope id attribute for scoped CSS.
  6616. // this is implemented as a special case to avoid the overhead
  6617. // of going through the normal attribute patching process.
  6618. function setScope(vnode) {
  6619. var i;
  6620. if (isDef((i = vnode.fnScopeId))) {
  6621. nodeOps.setStyleScope(vnode.elm, i);
  6622. }
  6623. else {
  6624. var ancestor = vnode;
  6625. while (ancestor) {
  6626. if (isDef((i = ancestor.context)) && isDef((i = i.$options._scopeId))) {
  6627. nodeOps.setStyleScope(vnode.elm, i);
  6628. }
  6629. ancestor = ancestor.parent;
  6630. }
  6631. }
  6632. // for slot content they should also get the scopeId from the host instance.
  6633. if (isDef((i = activeInstance)) &&
  6634. i !== vnode.context &&
  6635. i !== vnode.fnContext &&
  6636. isDef((i = i.$options._scopeId))) {
  6637. nodeOps.setStyleScope(vnode.elm, i);
  6638. }
  6639. }
  6640. function addVnodes(parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  6641. for (; startIdx <= endIdx; ++startIdx) {
  6642. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  6643. }
  6644. }
  6645. function invokeDestroyHook(vnode) {
  6646. var i, j;
  6647. var data = vnode.data;
  6648. if (isDef(data)) {
  6649. if (isDef((i = data.hook)) && isDef((i = i.destroy)))
  6650. i(vnode);
  6651. for (i = 0; i < cbs.destroy.length; ++i)
  6652. cbs.destroy[i](vnode);
  6653. }
  6654. if (isDef((i = vnode.children))) {
  6655. for (j = 0; j < vnode.children.length; ++j) {
  6656. invokeDestroyHook(vnode.children[j]);
  6657. }
  6658. }
  6659. }
  6660. function removeVnodes(vnodes, startIdx, endIdx) {
  6661. for (; startIdx <= endIdx; ++startIdx) {
  6662. var ch = vnodes[startIdx];
  6663. if (isDef(ch)) {
  6664. if (isDef(ch.tag)) {
  6665. removeAndInvokeRemoveHook(ch);
  6666. invokeDestroyHook(ch);
  6667. }
  6668. else {
  6669. // Text node
  6670. removeNode(ch.elm);
  6671. }
  6672. }
  6673. }
  6674. }
  6675. function removeAndInvokeRemoveHook(vnode, rm) {
  6676. if (isDef(rm) || isDef(vnode.data)) {
  6677. var i_3;
  6678. var listeners = cbs.remove.length + 1;
  6679. if (isDef(rm)) {
  6680. // we have a recursively passed down rm callback
  6681. // increase the listeners count
  6682. rm.listeners += listeners;
  6683. }
  6684. else {
  6685. // directly removing
  6686. rm = createRmCb(vnode.elm, listeners);
  6687. }
  6688. // recursively invoke hooks on child component root node
  6689. if (isDef((i_3 = vnode.componentInstance)) &&
  6690. isDef((i_3 = i_3._vnode)) &&
  6691. isDef(i_3.data)) {
  6692. removeAndInvokeRemoveHook(i_3, rm);
  6693. }
  6694. for (i_3 = 0; i_3 < cbs.remove.length; ++i_3) {
  6695. cbs.remove[i_3](vnode, rm);
  6696. }
  6697. if (isDef((i_3 = vnode.data.hook)) && isDef((i_3 = i_3.remove))) {
  6698. i_3(vnode, rm);
  6699. }
  6700. else {
  6701. rm();
  6702. }
  6703. }
  6704. else {
  6705. removeNode(vnode.elm);
  6706. }
  6707. }
  6708. function updateChildren(parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  6709. var oldStartIdx = 0;
  6710. var newStartIdx = 0;
  6711. var oldEndIdx = oldCh.length - 1;
  6712. var oldStartVnode = oldCh[0];
  6713. var oldEndVnode = oldCh[oldEndIdx];
  6714. var newEndIdx = newCh.length - 1;
  6715. var newStartVnode = newCh[0];
  6716. var newEndVnode = newCh[newEndIdx];
  6717. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  6718. // removeOnly is a special flag used only by <transition-group>
  6719. // to ensure removed elements stay in correct relative positions
  6720. // during leaving transitions
  6721. var canMove = !removeOnly;
  6722. {
  6723. checkDuplicateKeys(newCh);
  6724. }
  6725. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  6726. if (isUndef(oldStartVnode)) {
  6727. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  6728. }
  6729. else if (isUndef(oldEndVnode)) {
  6730. oldEndVnode = oldCh[--oldEndIdx];
  6731. }
  6732. else if (sameVnode(oldStartVnode, newStartVnode)) {
  6733. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  6734. oldStartVnode = oldCh[++oldStartIdx];
  6735. newStartVnode = newCh[++newStartIdx];
  6736. }
  6737. else if (sameVnode(oldEndVnode, newEndVnode)) {
  6738. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  6739. oldEndVnode = oldCh[--oldEndIdx];
  6740. newEndVnode = newCh[--newEndIdx];
  6741. }
  6742. else if (sameVnode(oldStartVnode, newEndVnode)) {
  6743. // Vnode moved right
  6744. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  6745. canMove &&
  6746. nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  6747. oldStartVnode = oldCh[++oldStartIdx];
  6748. newEndVnode = newCh[--newEndIdx];
  6749. }
  6750. else if (sameVnode(oldEndVnode, newStartVnode)) {
  6751. // Vnode moved left
  6752. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  6753. canMove &&
  6754. nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  6755. oldEndVnode = oldCh[--oldEndIdx];
  6756. newStartVnode = newCh[++newStartIdx];
  6757. }
  6758. else {
  6759. if (isUndef(oldKeyToIdx))
  6760. oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
  6761. idxInOld = isDef(newStartVnode.key)
  6762. ? oldKeyToIdx[newStartVnode.key]
  6763. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  6764. if (isUndef(idxInOld)) {
  6765. // New element
  6766. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  6767. }
  6768. else {
  6769. vnodeToMove = oldCh[idxInOld];
  6770. if (sameVnode(vnodeToMove, newStartVnode)) {
  6771. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  6772. oldCh[idxInOld] = undefined;
  6773. canMove &&
  6774. nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  6775. }
  6776. else {
  6777. // same key but different element. treat as new element
  6778. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  6779. }
  6780. }
  6781. newStartVnode = newCh[++newStartIdx];
  6782. }
  6783. }
  6784. if (oldStartIdx > oldEndIdx) {
  6785. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  6786. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  6787. }
  6788. else if (newStartIdx > newEndIdx) {
  6789. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  6790. }
  6791. }
  6792. function checkDuplicateKeys(children) {
  6793. var seenKeys = {};
  6794. for (var i_4 = 0; i_4 < children.length; i_4++) {
  6795. var vnode = children[i_4];
  6796. var key = vnode.key;
  6797. if (isDef(key)) {
  6798. if (seenKeys[key]) {
  6799. warn$2("Duplicate keys detected: '".concat(key, "'. This may cause an update error."), vnode.context);
  6800. }
  6801. else {
  6802. seenKeys[key] = true;
  6803. }
  6804. }
  6805. }
  6806. }
  6807. function findIdxInOld(node, oldCh, start, end) {
  6808. for (var i_5 = start; i_5 < end; i_5++) {
  6809. var c = oldCh[i_5];
  6810. if (isDef(c) && sameVnode(node, c))
  6811. return i_5;
  6812. }
  6813. }
  6814. function patchVnode(oldVnode, vnode, insertedVnodeQueue, ownerArray, index, removeOnly) {
  6815. if (oldVnode === vnode) {
  6816. return;
  6817. }
  6818. if (isDef(vnode.elm) && isDef(ownerArray)) {
  6819. // clone reused vnode
  6820. vnode = ownerArray[index] = cloneVNode(vnode);
  6821. }
  6822. var elm = (vnode.elm = oldVnode.elm);
  6823. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  6824. if (isDef(vnode.asyncFactory.resolved)) {
  6825. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  6826. }
  6827. else {
  6828. vnode.isAsyncPlaceholder = true;
  6829. }
  6830. return;
  6831. }
  6832. // reuse element for static trees.
  6833. // note we only do this if the vnode is cloned -
  6834. // if the new node is not cloned it means the render functions have been
  6835. // reset by the hot-reload-api and we need to do a proper re-render.
  6836. if (isTrue(vnode.isStatic) &&
  6837. isTrue(oldVnode.isStatic) &&
  6838. vnode.key === oldVnode.key &&
  6839. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))) {
  6840. vnode.componentInstance = oldVnode.componentInstance;
  6841. return;
  6842. }
  6843. var i;
  6844. var data = vnode.data;
  6845. if (isDef(data) && isDef((i = data.hook)) && isDef((i = i.prepatch))) {
  6846. i(oldVnode, vnode);
  6847. }
  6848. var oldCh = oldVnode.children;
  6849. var ch = vnode.children;
  6850. if (isDef(data) && isPatchable(vnode)) {
  6851. for (i = 0; i < cbs.update.length; ++i)
  6852. cbs.update[i](oldVnode, vnode);
  6853. if (isDef((i = data.hook)) && isDef((i = i.update)))
  6854. i(oldVnode, vnode);
  6855. }
  6856. if (isUndef(vnode.text)) {
  6857. if (isDef(oldCh) && isDef(ch)) {
  6858. if (oldCh !== ch)
  6859. updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly);
  6860. }
  6861. else if (isDef(ch)) {
  6862. {
  6863. checkDuplicateKeys(ch);
  6864. }
  6865. if (isDef(oldVnode.text))
  6866. nodeOps.setTextContent(elm, '');
  6867. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  6868. }
  6869. else if (isDef(oldCh)) {
  6870. removeVnodes(oldCh, 0, oldCh.length - 1);
  6871. }
  6872. else if (isDef(oldVnode.text)) {
  6873. nodeOps.setTextContent(elm, '');
  6874. }
  6875. }
  6876. else if (oldVnode.text !== vnode.text) {
  6877. nodeOps.setTextContent(elm, vnode.text);
  6878. }
  6879. if (isDef(data)) {
  6880. if (isDef((i = data.hook)) && isDef((i = i.postpatch)))
  6881. i(oldVnode, vnode);
  6882. }
  6883. }
  6884. function invokeInsertHook(vnode, queue, initial) {
  6885. // delay insert hooks for component root nodes, invoke them after the
  6886. // element is really inserted
  6887. if (isTrue(initial) && isDef(vnode.parent)) {
  6888. vnode.parent.data.pendingInsert = queue;
  6889. }
  6890. else {
  6891. for (var i_6 = 0; i_6 < queue.length; ++i_6) {
  6892. queue[i_6].data.hook.insert(queue[i_6]);
  6893. }
  6894. }
  6895. }
  6896. var hydrationBailed = false;
  6897. // list of modules that can skip create hook during hydration because they
  6898. // are already rendered on the client or has no need for initialization
  6899. // Note: style is excluded because it relies on initial clone for future
  6900. // deep updates (#7063).
  6901. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  6902. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  6903. function hydrate(elm, vnode, insertedVnodeQueue, inVPre) {
  6904. var i;
  6905. var tag = vnode.tag, data = vnode.data, children = vnode.children;
  6906. inVPre = inVPre || (data && data.pre);
  6907. vnode.elm = elm;
  6908. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  6909. vnode.isAsyncPlaceholder = true;
  6910. return true;
  6911. }
  6912. // assert node match
  6913. {
  6914. if (!assertNodeMatch(elm, vnode, inVPre)) {
  6915. return false;
  6916. }
  6917. }
  6918. if (isDef(data)) {
  6919. if (isDef((i = data.hook)) && isDef((i = i.init)))
  6920. i(vnode, true /* hydrating */);
  6921. if (isDef((i = vnode.componentInstance))) {
  6922. // child component. it should have hydrated its own tree.
  6923. initComponent(vnode, insertedVnodeQueue);
  6924. return true;
  6925. }
  6926. }
  6927. if (isDef(tag)) {
  6928. if (isDef(children)) {
  6929. // empty element, allow client to pick up and populate children
  6930. if (!elm.hasChildNodes()) {
  6931. createChildren(vnode, children, insertedVnodeQueue);
  6932. }
  6933. else {
  6934. // v-html and domProps: innerHTML
  6935. if (isDef((i = data)) &&
  6936. isDef((i = i.domProps)) &&
  6937. isDef((i = i.innerHTML))) {
  6938. if (i !== elm.innerHTML) {
  6939. /* istanbul ignore if */
  6940. if (typeof console !== 'undefined' &&
  6941. !hydrationBailed) {
  6942. hydrationBailed = true;
  6943. console.warn('Parent: ', elm);
  6944. console.warn('server innerHTML: ', i);
  6945. console.warn('client innerHTML: ', elm.innerHTML);
  6946. }
  6947. return false;
  6948. }
  6949. }
  6950. else {
  6951. // iterate and compare children lists
  6952. var childrenMatch = true;
  6953. var childNode = elm.firstChild;
  6954. for (var i_7 = 0; i_7 < children.length; i_7++) {
  6955. if (!childNode ||
  6956. !hydrate(childNode, children[i_7], insertedVnodeQueue, inVPre)) {
  6957. childrenMatch = false;
  6958. break;
  6959. }
  6960. childNode = childNode.nextSibling;
  6961. }
  6962. // if childNode is not null, it means the actual childNodes list is
  6963. // longer than the virtual children list.
  6964. if (!childrenMatch || childNode) {
  6965. /* istanbul ignore if */
  6966. if (typeof console !== 'undefined' &&
  6967. !hydrationBailed) {
  6968. hydrationBailed = true;
  6969. console.warn('Parent: ', elm);
  6970. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  6971. }
  6972. return false;
  6973. }
  6974. }
  6975. }
  6976. }
  6977. if (isDef(data)) {
  6978. var fullInvoke = false;
  6979. for (var key in data) {
  6980. if (!isRenderedModule(key)) {
  6981. fullInvoke = true;
  6982. invokeCreateHooks(vnode, insertedVnodeQueue);
  6983. break;
  6984. }
  6985. }
  6986. if (!fullInvoke && data['class']) {
  6987. // ensure collecting deps for deep class bindings for future updates
  6988. traverse(data['class']);
  6989. }
  6990. }
  6991. }
  6992. else if (elm.data !== vnode.text) {
  6993. elm.data = vnode.text;
  6994. }
  6995. return true;
  6996. }
  6997. function assertNodeMatch(node, vnode, inVPre) {
  6998. if (isDef(vnode.tag)) {
  6999. return (vnode.tag.indexOf('vue-component') === 0 ||
  7000. (!isUnknownElement(vnode, inVPre) &&
  7001. vnode.tag.toLowerCase() ===
  7002. (node.tagName && node.tagName.toLowerCase())));
  7003. }
  7004. else {
  7005. return node.nodeType === (vnode.isComment ? 8 : 3);
  7006. }
  7007. }
  7008. return function patch(oldVnode, vnode, hydrating, removeOnly) {
  7009. if (isUndef(vnode)) {
  7010. if (isDef(oldVnode))
  7011. invokeDestroyHook(oldVnode);
  7012. return;
  7013. }
  7014. var isInitialPatch = false;
  7015. var insertedVnodeQueue = [];
  7016. if (isUndef(oldVnode)) {
  7017. // empty mount (likely as component), create new root element
  7018. isInitialPatch = true;
  7019. createElm(vnode, insertedVnodeQueue);
  7020. }
  7021. else {
  7022. var isRealElement = isDef(oldVnode.nodeType);
  7023. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  7024. // patch existing root node
  7025. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  7026. }
  7027. else {
  7028. if (isRealElement) {
  7029. // mounting to a real element
  7030. // check if this is server-rendered content and if we can perform
  7031. // a successful hydration.
  7032. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  7033. oldVnode.removeAttribute(SSR_ATTR);
  7034. hydrating = true;
  7035. }
  7036. if (isTrue(hydrating)) {
  7037. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  7038. invokeInsertHook(vnode, insertedVnodeQueue, true);
  7039. return oldVnode;
  7040. }
  7041. else {
  7042. warn$2('The client-side rendered virtual DOM tree is not matching ' +
  7043. 'server-rendered content. This is likely caused by incorrect ' +
  7044. 'HTML markup, for example nesting block-level elements inside ' +
  7045. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  7046. 'full client-side render.');
  7047. }
  7048. }
  7049. // either not server-rendered, or hydration failed.
  7050. // create an empty node and replace it
  7051. oldVnode = emptyNodeAt(oldVnode);
  7052. }
  7053. // replacing existing element
  7054. var oldElm = oldVnode.elm;
  7055. var parentElm = nodeOps.parentNode(oldElm);
  7056. // create new node
  7057. createElm(vnode, insertedVnodeQueue,
  7058. // extremely rare edge case: do not insert if old element is in a
  7059. // leaving transition. Only happens when combining transition +
  7060. // keep-alive + HOCs. (#4590)
  7061. oldElm._leaveCb ? null : parentElm, nodeOps.nextSibling(oldElm));
  7062. // update parent placeholder node element, recursively
  7063. if (isDef(vnode.parent)) {
  7064. var ancestor = vnode.parent;
  7065. var patchable = isPatchable(vnode);
  7066. while (ancestor) {
  7067. for (var i_8 = 0; i_8 < cbs.destroy.length; ++i_8) {
  7068. cbs.destroy[i_8](ancestor);
  7069. }
  7070. ancestor.elm = vnode.elm;
  7071. if (patchable) {
  7072. for (var i_9 = 0; i_9 < cbs.create.length; ++i_9) {
  7073. cbs.create[i_9](emptyNode, ancestor);
  7074. }
  7075. // #6513
  7076. // invoke insert hooks that may have been merged by create hooks.
  7077. // e.g. for directives that uses the "inserted" hook.
  7078. var insert_1 = ancestor.data.hook.insert;
  7079. if (insert_1.merged) {
  7080. // start at index 1 to avoid re-invoking component mounted hook
  7081. // clone insert hooks to avoid being mutated during iteration.
  7082. // e.g. for customed directives under transition group.
  7083. var cloned = insert_1.fns.slice(1);
  7084. for (var i_10 = 0; i_10 < cloned.length; i_10++) {
  7085. cloned[i_10]();
  7086. }
  7087. }
  7088. }
  7089. else {
  7090. registerRef(ancestor);
  7091. }
  7092. ancestor = ancestor.parent;
  7093. }
  7094. }
  7095. // destroy old node
  7096. if (isDef(parentElm)) {
  7097. removeVnodes([oldVnode], 0, 0);
  7098. }
  7099. else if (isDef(oldVnode.tag)) {
  7100. invokeDestroyHook(oldVnode);
  7101. }
  7102. }
  7103. }
  7104. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  7105. return vnode.elm;
  7106. };
  7107. }
  7108. var directives$1 = {
  7109. create: updateDirectives,
  7110. update: updateDirectives,
  7111. destroy: function unbindDirectives(vnode) {
  7112. // @ts-expect-error emptyNode is not VNodeWithData
  7113. updateDirectives(vnode, emptyNode);
  7114. }
  7115. };
  7116. function updateDirectives(oldVnode, vnode) {
  7117. if (oldVnode.data.directives || vnode.data.directives) {
  7118. _update(oldVnode, vnode);
  7119. }
  7120. }
  7121. function _update(oldVnode, vnode) {
  7122. var isCreate = oldVnode === emptyNode;
  7123. var isDestroy = vnode === emptyNode;
  7124. var oldDirs = normalizeDirectives(oldVnode.data.directives, oldVnode.context);
  7125. var newDirs = normalizeDirectives(vnode.data.directives, vnode.context);
  7126. var dirsWithInsert = [];
  7127. var dirsWithPostpatch = [];
  7128. var key, oldDir, dir;
  7129. for (key in newDirs) {
  7130. oldDir = oldDirs[key];
  7131. dir = newDirs[key];
  7132. if (!oldDir) {
  7133. // new directive, bind
  7134. callHook(dir, 'bind', vnode, oldVnode);
  7135. if (dir.def && dir.def.inserted) {
  7136. dirsWithInsert.push(dir);
  7137. }
  7138. }
  7139. else {
  7140. // existing directive, update
  7141. dir.oldValue = oldDir.value;
  7142. dir.oldArg = oldDir.arg;
  7143. callHook(dir, 'update', vnode, oldVnode);
  7144. if (dir.def && dir.def.componentUpdated) {
  7145. dirsWithPostpatch.push(dir);
  7146. }
  7147. }
  7148. }
  7149. if (dirsWithInsert.length) {
  7150. var callInsert = function () {
  7151. for (var i = 0; i < dirsWithInsert.length; i++) {
  7152. callHook(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  7153. }
  7154. };
  7155. if (isCreate) {
  7156. mergeVNodeHook(vnode, 'insert', callInsert);
  7157. }
  7158. else {
  7159. callInsert();
  7160. }
  7161. }
  7162. if (dirsWithPostpatch.length) {
  7163. mergeVNodeHook(vnode, 'postpatch', function () {
  7164. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  7165. callHook(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  7166. }
  7167. });
  7168. }
  7169. if (!isCreate) {
  7170. for (key in oldDirs) {
  7171. if (!newDirs[key]) {
  7172. // no longer present, unbind
  7173. callHook(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  7174. }
  7175. }
  7176. }
  7177. }
  7178. var emptyModifiers = Object.create(null);
  7179. function normalizeDirectives(dirs, vm) {
  7180. var res = Object.create(null);
  7181. if (!dirs) {
  7182. // $flow-disable-line
  7183. return res;
  7184. }
  7185. var i, dir;
  7186. for (i = 0; i < dirs.length; i++) {
  7187. dir = dirs[i];
  7188. if (!dir.modifiers) {
  7189. // $flow-disable-line
  7190. dir.modifiers = emptyModifiers;
  7191. }
  7192. res[getRawDirName(dir)] = dir;
  7193. if (vm._setupState && vm._setupState.__sfc) {
  7194. var setupDef = dir.def || resolveAsset(vm, '_setupState', 'v-' + dir.name);
  7195. if (typeof setupDef === 'function') {
  7196. dir.def = {
  7197. bind: setupDef,
  7198. update: setupDef,
  7199. };
  7200. }
  7201. else {
  7202. dir.def = setupDef;
  7203. }
  7204. }
  7205. dir.def = dir.def || resolveAsset(vm.$options, 'directives', dir.name, true);
  7206. }
  7207. // $flow-disable-line
  7208. return res;
  7209. }
  7210. function getRawDirName(dir) {
  7211. return (dir.rawName || "".concat(dir.name, ".").concat(Object.keys(dir.modifiers || {}).join('.')));
  7212. }
  7213. function callHook(dir, hook, vnode, oldVnode, isDestroy) {
  7214. var fn = dir.def && dir.def[hook];
  7215. if (fn) {
  7216. try {
  7217. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  7218. }
  7219. catch (e) {
  7220. handleError(e, vnode.context, "directive ".concat(dir.name, " ").concat(hook, " hook"));
  7221. }
  7222. }
  7223. }
  7224. var baseModules = [ref, directives$1];
  7225. function updateAttrs(oldVnode, vnode) {
  7226. var opts = vnode.componentOptions;
  7227. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  7228. return;
  7229. }
  7230. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  7231. return;
  7232. }
  7233. var key, cur, old;
  7234. var elm = vnode.elm;
  7235. var oldAttrs = oldVnode.data.attrs || {};
  7236. var attrs = vnode.data.attrs || {};
  7237. // clone observed objects, as the user probably wants to mutate it
  7238. if (isDef(attrs.__ob__) || isTrue(attrs._v_attr_proxy)) {
  7239. attrs = vnode.data.attrs = extend({}, attrs);
  7240. }
  7241. for (key in attrs) {
  7242. cur = attrs[key];
  7243. old = oldAttrs[key];
  7244. if (old !== cur) {
  7245. setAttr(elm, key, cur, vnode.data.pre);
  7246. }
  7247. }
  7248. // #4391: in IE9, setting type can reset value for input[type=radio]
  7249. // #6666: IE/Edge forces progress value down to 1 before setting a max
  7250. /* istanbul ignore if */
  7251. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  7252. setAttr(elm, 'value', attrs.value);
  7253. }
  7254. for (key in oldAttrs) {
  7255. if (isUndef(attrs[key])) {
  7256. if (isXlink(key)) {
  7257. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  7258. }
  7259. else if (!isEnumeratedAttr(key)) {
  7260. elm.removeAttribute(key);
  7261. }
  7262. }
  7263. }
  7264. }
  7265. function setAttr(el, key, value, isInPre) {
  7266. if (isInPre || el.tagName.indexOf('-') > -1) {
  7267. baseSetAttr(el, key, value);
  7268. }
  7269. else if (isBooleanAttr(key)) {
  7270. // set attribute for blank value
  7271. // e.g. <option disabled>Select one</option>
  7272. if (isFalsyAttrValue(value)) {
  7273. el.removeAttribute(key);
  7274. }
  7275. else {
  7276. // technically allowfullscreen is a boolean attribute for <iframe>,
  7277. // but Flash expects a value of "true" when used on <embed> tag
  7278. value = key === 'allowfullscreen' && el.tagName === 'EMBED' ? 'true' : key;
  7279. el.setAttribute(key, value);
  7280. }
  7281. }
  7282. else if (isEnumeratedAttr(key)) {
  7283. el.setAttribute(key, convertEnumeratedValue(key, value));
  7284. }
  7285. else if (isXlink(key)) {
  7286. if (isFalsyAttrValue(value)) {
  7287. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  7288. }
  7289. else {
  7290. el.setAttributeNS(xlinkNS, key, value);
  7291. }
  7292. }
  7293. else {
  7294. baseSetAttr(el, key, value);
  7295. }
  7296. }
  7297. function baseSetAttr(el, key, value) {
  7298. if (isFalsyAttrValue(value)) {
  7299. el.removeAttribute(key);
  7300. }
  7301. else {
  7302. // #7138: IE10 & 11 fires input event when setting placeholder on
  7303. // <textarea>... block the first input event and remove the blocker
  7304. // immediately.
  7305. /* istanbul ignore if */
  7306. if (isIE &&
  7307. !isIE9 &&
  7308. el.tagName === 'TEXTAREA' &&
  7309. key === 'placeholder' &&
  7310. value !== '' &&
  7311. !el.__ieph) {
  7312. var blocker_1 = function (e) {
  7313. e.stopImmediatePropagation();
  7314. el.removeEventListener('input', blocker_1);
  7315. };
  7316. el.addEventListener('input', blocker_1);
  7317. // $flow-disable-line
  7318. el.__ieph = true; /* IE placeholder patched */
  7319. }
  7320. el.setAttribute(key, value);
  7321. }
  7322. }
  7323. var attrs = {
  7324. create: updateAttrs,
  7325. update: updateAttrs
  7326. };
  7327. function updateClass(oldVnode, vnode) {
  7328. var el = vnode.elm;
  7329. var data = vnode.data;
  7330. var oldData = oldVnode.data;
  7331. if (isUndef(data.staticClass) &&
  7332. isUndef(data.class) &&
  7333. (isUndef(oldData) ||
  7334. (isUndef(oldData.staticClass) && isUndef(oldData.class)))) {
  7335. return;
  7336. }
  7337. var cls = genClassForVnode(vnode);
  7338. // handle transition classes
  7339. var transitionClass = el._transitionClasses;
  7340. if (isDef(transitionClass)) {
  7341. cls = concat(cls, stringifyClass(transitionClass));
  7342. }
  7343. // set the class
  7344. if (cls !== el._prevClass) {
  7345. el.setAttribute('class', cls);
  7346. el._prevClass = cls;
  7347. }
  7348. }
  7349. var klass$1 = {
  7350. create: updateClass,
  7351. update: updateClass
  7352. };
  7353. var validDivisionCharRE = /[\w).+\-_$\]]/;
  7354. function parseFilters(exp) {
  7355. var inSingle = false;
  7356. var inDouble = false;
  7357. var inTemplateString = false;
  7358. var inRegex = false;
  7359. var curly = 0;
  7360. var square = 0;
  7361. var paren = 0;
  7362. var lastFilterIndex = 0;
  7363. var c, prev, i, expression, filters;
  7364. for (i = 0; i < exp.length; i++) {
  7365. prev = c;
  7366. c = exp.charCodeAt(i);
  7367. if (inSingle) {
  7368. if (c === 0x27 && prev !== 0x5c)
  7369. inSingle = false;
  7370. }
  7371. else if (inDouble) {
  7372. if (c === 0x22 && prev !== 0x5c)
  7373. inDouble = false;
  7374. }
  7375. else if (inTemplateString) {
  7376. if (c === 0x60 && prev !== 0x5c)
  7377. inTemplateString = false;
  7378. }
  7379. else if (inRegex) {
  7380. if (c === 0x2f && prev !== 0x5c)
  7381. inRegex = false;
  7382. }
  7383. else if (c === 0x7c && // pipe
  7384. exp.charCodeAt(i + 1) !== 0x7c &&
  7385. exp.charCodeAt(i - 1) !== 0x7c &&
  7386. !curly &&
  7387. !square &&
  7388. !paren) {
  7389. if (expression === undefined) {
  7390. // first filter, end of expression
  7391. lastFilterIndex = i + 1;
  7392. expression = exp.slice(0, i).trim();
  7393. }
  7394. else {
  7395. pushFilter();
  7396. }
  7397. }
  7398. else {
  7399. switch (c) {
  7400. case 0x22:
  7401. inDouble = true;
  7402. break; // "
  7403. case 0x27:
  7404. inSingle = true;
  7405. break; // '
  7406. case 0x60:
  7407. inTemplateString = true;
  7408. break; // `
  7409. case 0x28:
  7410. paren++;
  7411. break; // (
  7412. case 0x29:
  7413. paren--;
  7414. break; // )
  7415. case 0x5b:
  7416. square++;
  7417. break; // [
  7418. case 0x5d:
  7419. square--;
  7420. break; // ]
  7421. case 0x7b:
  7422. curly++;
  7423. break; // {
  7424. case 0x7d:
  7425. curly--;
  7426. break; // }
  7427. }
  7428. if (c === 0x2f) {
  7429. // /
  7430. var j = i - 1;
  7431. var p
  7432. // find first non-whitespace prev char
  7433. = void 0;
  7434. // find first non-whitespace prev char
  7435. for (; j >= 0; j--) {
  7436. p = exp.charAt(j);
  7437. if (p !== ' ')
  7438. break;
  7439. }
  7440. if (!p || !validDivisionCharRE.test(p)) {
  7441. inRegex = true;
  7442. }
  7443. }
  7444. }
  7445. }
  7446. if (expression === undefined) {
  7447. expression = exp.slice(0, i).trim();
  7448. }
  7449. else if (lastFilterIndex !== 0) {
  7450. pushFilter();
  7451. }
  7452. function pushFilter() {
  7453. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  7454. lastFilterIndex = i + 1;
  7455. }
  7456. if (filters) {
  7457. for (i = 0; i < filters.length; i++) {
  7458. expression = wrapFilter(expression, filters[i]);
  7459. }
  7460. }
  7461. return expression;
  7462. }
  7463. function wrapFilter(exp, filter) {
  7464. var i = filter.indexOf('(');
  7465. if (i < 0) {
  7466. // _f: resolveFilter
  7467. return "_f(\"".concat(filter, "\")(").concat(exp, ")");
  7468. }
  7469. else {
  7470. var name_1 = filter.slice(0, i);
  7471. var args = filter.slice(i + 1);
  7472. return "_f(\"".concat(name_1, "\")(").concat(exp).concat(args !== ')' ? ',' + args : args);
  7473. }
  7474. }
  7475. /* eslint-disable no-unused-vars */
  7476. function baseWarn(msg, range) {
  7477. console.error("[Vue compiler]: ".concat(msg));
  7478. }
  7479. /* eslint-enable no-unused-vars */
  7480. function pluckModuleFunction(modules, key) {
  7481. return modules ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; }) : [];
  7482. }
  7483. function addProp(el, name, value, range, dynamic) {
  7484. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  7485. el.plain = false;
  7486. }
  7487. function addAttr(el, name, value, range, dynamic) {
  7488. var attrs = dynamic
  7489. ? el.dynamicAttrs || (el.dynamicAttrs = [])
  7490. : el.attrs || (el.attrs = []);
  7491. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  7492. el.plain = false;
  7493. }
  7494. // add a raw attr (use this in preTransforms)
  7495. function addRawAttr(el, name, value, range) {
  7496. el.attrsMap[name] = value;
  7497. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  7498. }
  7499. function addDirective(el, name, rawName, value, arg, isDynamicArg, modifiers, range) {
  7500. (el.directives || (el.directives = [])).push(rangeSetItem({
  7501. name: name,
  7502. rawName: rawName,
  7503. value: value,
  7504. arg: arg,
  7505. isDynamicArg: isDynamicArg,
  7506. modifiers: modifiers
  7507. }, range));
  7508. el.plain = false;
  7509. }
  7510. function prependModifierMarker(symbol, name, dynamic) {
  7511. return dynamic ? "_p(".concat(name, ",\"").concat(symbol, "\")") : symbol + name; // mark the event as captured
  7512. }
  7513. function addHandler(el, name, value, modifiers, important, warn, range, dynamic) {
  7514. modifiers = modifiers || emptyObject;
  7515. // warn prevent and passive modifier
  7516. /* istanbul ignore if */
  7517. if (warn && modifiers.prevent && modifiers.passive) {
  7518. warn("passive and prevent can't be used together. " +
  7519. "Passive handler can't prevent default event.", range);
  7520. }
  7521. // normalize click.right and click.middle since they don't actually fire
  7522. // this is technically browser-specific, but at least for now browsers are
  7523. // the only target envs that have right/middle clicks.
  7524. if (modifiers.right) {
  7525. if (dynamic) {
  7526. name = "(".concat(name, ")==='click'?'contextmenu':(").concat(name, ")");
  7527. }
  7528. else if (name === 'click') {
  7529. name = 'contextmenu';
  7530. delete modifiers.right;
  7531. }
  7532. }
  7533. else if (modifiers.middle) {
  7534. if (dynamic) {
  7535. name = "(".concat(name, ")==='click'?'mouseup':(").concat(name, ")");
  7536. }
  7537. else if (name === 'click') {
  7538. name = 'mouseup';
  7539. }
  7540. }
  7541. // check capture modifier
  7542. if (modifiers.capture) {
  7543. delete modifiers.capture;
  7544. name = prependModifierMarker('!', name, dynamic);
  7545. }
  7546. if (modifiers.once) {
  7547. delete modifiers.once;
  7548. name = prependModifierMarker('~', name, dynamic);
  7549. }
  7550. /* istanbul ignore if */
  7551. if (modifiers.passive) {
  7552. delete modifiers.passive;
  7553. name = prependModifierMarker('&', name, dynamic);
  7554. }
  7555. var events;
  7556. if (modifiers.native) {
  7557. delete modifiers.native;
  7558. events = el.nativeEvents || (el.nativeEvents = {});
  7559. }
  7560. else {
  7561. events = el.events || (el.events = {});
  7562. }
  7563. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  7564. if (modifiers !== emptyObject) {
  7565. newHandler.modifiers = modifiers;
  7566. }
  7567. var handlers = events[name];
  7568. /* istanbul ignore if */
  7569. if (Array.isArray(handlers)) {
  7570. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  7571. }
  7572. else if (handlers) {
  7573. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  7574. }
  7575. else {
  7576. events[name] = newHandler;
  7577. }
  7578. el.plain = false;
  7579. }
  7580. function getRawBindingAttr(el, name) {
  7581. return (el.rawAttrsMap[':' + name] ||
  7582. el.rawAttrsMap['v-bind:' + name] ||
  7583. el.rawAttrsMap[name]);
  7584. }
  7585. function getBindingAttr(el, name, getStatic) {
  7586. var dynamicValue = getAndRemoveAttr(el, ':' + name) || getAndRemoveAttr(el, 'v-bind:' + name);
  7587. if (dynamicValue != null) {
  7588. return parseFilters(dynamicValue);
  7589. }
  7590. else if (getStatic !== false) {
  7591. var staticValue = getAndRemoveAttr(el, name);
  7592. if (staticValue != null) {
  7593. return JSON.stringify(staticValue);
  7594. }
  7595. }
  7596. }
  7597. // note: this only removes the attr from the Array (attrsList) so that it
  7598. // doesn't get processed by processAttrs.
  7599. // By default it does NOT remove it from the map (attrsMap) because the map is
  7600. // needed during codegen.
  7601. function getAndRemoveAttr(el, name, removeFromMap) {
  7602. var val;
  7603. if ((val = el.attrsMap[name]) != null) {
  7604. var list = el.attrsList;
  7605. for (var i = 0, l = list.length; i < l; i++) {
  7606. if (list[i].name === name) {
  7607. list.splice(i, 1);
  7608. break;
  7609. }
  7610. }
  7611. }
  7612. if (removeFromMap) {
  7613. delete el.attrsMap[name];
  7614. }
  7615. return val;
  7616. }
  7617. function getAndRemoveAttrByRegex(el, name) {
  7618. var list = el.attrsList;
  7619. for (var i = 0, l = list.length; i < l; i++) {
  7620. var attr = list[i];
  7621. if (name.test(attr.name)) {
  7622. list.splice(i, 1);
  7623. return attr;
  7624. }
  7625. }
  7626. }
  7627. function rangeSetItem(item, range) {
  7628. if (range) {
  7629. if (range.start != null) {
  7630. item.start = range.start;
  7631. }
  7632. if (range.end != null) {
  7633. item.end = range.end;
  7634. }
  7635. }
  7636. return item;
  7637. }
  7638. /**
  7639. * Cross-platform code generation for component v-model
  7640. */
  7641. function genComponentModel(el, value, modifiers) {
  7642. var _a = modifiers || {}, number = _a.number, trim = _a.trim;
  7643. var baseValueExpression = '$$v';
  7644. var valueExpression = baseValueExpression;
  7645. if (trim) {
  7646. valueExpression =
  7647. "(typeof ".concat(baseValueExpression, " === 'string'") +
  7648. "? ".concat(baseValueExpression, ".trim()") +
  7649. ": ".concat(baseValueExpression, ")");
  7650. }
  7651. if (number) {
  7652. valueExpression = "_n(".concat(valueExpression, ")");
  7653. }
  7654. var assignment = genAssignmentCode(value, valueExpression);
  7655. el.model = {
  7656. value: "(".concat(value, ")"),
  7657. expression: JSON.stringify(value),
  7658. callback: "function (".concat(baseValueExpression, ") {").concat(assignment, "}")
  7659. };
  7660. }
  7661. /**
  7662. * Cross-platform codegen helper for generating v-model value assignment code.
  7663. */
  7664. function genAssignmentCode(value, assignment) {
  7665. var res = parseModel(value);
  7666. if (res.key === null) {
  7667. return "".concat(value, "=").concat(assignment);
  7668. }
  7669. else {
  7670. return "$set(".concat(res.exp, ", ").concat(res.key, ", ").concat(assignment, ")");
  7671. }
  7672. }
  7673. /**
  7674. * Parse a v-model expression into a base path and a final key segment.
  7675. * Handles both dot-path and possible square brackets.
  7676. *
  7677. * Possible cases:
  7678. *
  7679. * - test
  7680. * - test[key]
  7681. * - test[test1[key]]
  7682. * - test["a"][key]
  7683. * - xxx.test[a[a].test1[key]]
  7684. * - test.xxx.a["asa"][test1[key]]
  7685. *
  7686. */
  7687. var len, str, chr, index, expressionPos, expressionEndPos;
  7688. function parseModel(val) {
  7689. // Fix https://github.com/vuejs/vue/pull/7730
  7690. // allow v-model="obj.val " (trailing whitespace)
  7691. val = val.trim();
  7692. len = val.length;
  7693. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  7694. index = val.lastIndexOf('.');
  7695. if (index > -1) {
  7696. return {
  7697. exp: val.slice(0, index),
  7698. key: '"' + val.slice(index + 1) + '"'
  7699. };
  7700. }
  7701. else {
  7702. return {
  7703. exp: val,
  7704. key: null
  7705. };
  7706. }
  7707. }
  7708. str = val;
  7709. index = expressionPos = expressionEndPos = 0;
  7710. while (!eof()) {
  7711. chr = next();
  7712. /* istanbul ignore if */
  7713. if (isStringStart(chr)) {
  7714. parseString(chr);
  7715. }
  7716. else if (chr === 0x5b) {
  7717. parseBracket(chr);
  7718. }
  7719. }
  7720. return {
  7721. exp: val.slice(0, expressionPos),
  7722. key: val.slice(expressionPos + 1, expressionEndPos)
  7723. };
  7724. }
  7725. function next() {
  7726. return str.charCodeAt(++index);
  7727. }
  7728. function eof() {
  7729. return index >= len;
  7730. }
  7731. function isStringStart(chr) {
  7732. return chr === 0x22 || chr === 0x27;
  7733. }
  7734. function parseBracket(chr) {
  7735. var inBracket = 1;
  7736. expressionPos = index;
  7737. while (!eof()) {
  7738. chr = next();
  7739. if (isStringStart(chr)) {
  7740. parseString(chr);
  7741. continue;
  7742. }
  7743. if (chr === 0x5b)
  7744. inBracket++;
  7745. if (chr === 0x5d)
  7746. inBracket--;
  7747. if (inBracket === 0) {
  7748. expressionEndPos = index;
  7749. break;
  7750. }
  7751. }
  7752. }
  7753. function parseString(chr) {
  7754. var stringQuote = chr;
  7755. while (!eof()) {
  7756. chr = next();
  7757. if (chr === stringQuote) {
  7758. break;
  7759. }
  7760. }
  7761. }
  7762. var warn$1;
  7763. // in some cases, the event used has to be determined at runtime
  7764. // so we used some reserved tokens during compile.
  7765. var RANGE_TOKEN = '__r';
  7766. var CHECKBOX_RADIO_TOKEN = '__c';
  7767. function model$1(el, dir, _warn) {
  7768. warn$1 = _warn;
  7769. var value = dir.value;
  7770. var modifiers = dir.modifiers;
  7771. var tag = el.tag;
  7772. var type = el.attrsMap.type;
  7773. {
  7774. // inputs with type="file" are read only and setting the input's
  7775. // value will throw an error.
  7776. if (tag === 'input' && type === 'file') {
  7777. warn$1("<".concat(el.tag, " v-model=\"").concat(value, "\" type=\"file\">:\n") +
  7778. "File inputs are read only. Use a v-on:change listener instead.", el.rawAttrsMap['v-model']);
  7779. }
  7780. }
  7781. if (el.component) {
  7782. genComponentModel(el, value, modifiers);
  7783. // component v-model doesn't need extra runtime
  7784. return false;
  7785. }
  7786. else if (tag === 'select') {
  7787. genSelect(el, value, modifiers);
  7788. }
  7789. else if (tag === 'input' && type === 'checkbox') {
  7790. genCheckboxModel(el, value, modifiers);
  7791. }
  7792. else if (tag === 'input' && type === 'radio') {
  7793. genRadioModel(el, value, modifiers);
  7794. }
  7795. else if (tag === 'input' || tag === 'textarea') {
  7796. genDefaultModel(el, value, modifiers);
  7797. }
  7798. else if (!config.isReservedTag(tag)) {
  7799. genComponentModel(el, value, modifiers);
  7800. // component v-model doesn't need extra runtime
  7801. return false;
  7802. }
  7803. else {
  7804. warn$1("<".concat(el.tag, " v-model=\"").concat(value, "\">: ") +
  7805. "v-model is not supported on this element type. " +
  7806. "If you are working with contenteditable, it's recommended to " +
  7807. 'wrap a library dedicated for that purpose inside a custom component.', el.rawAttrsMap['v-model']);
  7808. }
  7809. // ensure runtime directive metadata
  7810. return true;
  7811. }
  7812. function genCheckboxModel(el, value, modifiers) {
  7813. var number = modifiers && modifiers.number;
  7814. var valueBinding = getBindingAttr(el, 'value') || 'null';
  7815. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  7816. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  7817. addProp(el, 'checked', "Array.isArray(".concat(value, ")") +
  7818. "?_i(".concat(value, ",").concat(valueBinding, ")>-1") +
  7819. (trueValueBinding === 'true'
  7820. ? ":(".concat(value, ")")
  7821. : ":_q(".concat(value, ",").concat(trueValueBinding, ")")));
  7822. addHandler(el, 'change', "var $$a=".concat(value, ",") +
  7823. '$$el=$event.target,' +
  7824. "$$c=$$el.checked?(".concat(trueValueBinding, "):(").concat(falseValueBinding, ");") +
  7825. 'if(Array.isArray($$a)){' +
  7826. "var $$v=".concat(number ? '_n(' + valueBinding + ')' : valueBinding, ",") +
  7827. '$$i=_i($$a,$$v);' +
  7828. "if($$el.checked){$$i<0&&(".concat(genAssignmentCode(value, '$$a.concat([$$v])'), ")}") +
  7829. "else{$$i>-1&&(".concat(genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))'), ")}") +
  7830. "}else{".concat(genAssignmentCode(value, '$$c'), "}"), null, true);
  7831. }
  7832. function genRadioModel(el, value, modifiers) {
  7833. var number = modifiers && modifiers.number;
  7834. var valueBinding = getBindingAttr(el, 'value') || 'null';
  7835. valueBinding = number ? "_n(".concat(valueBinding, ")") : valueBinding;
  7836. addProp(el, 'checked', "_q(".concat(value, ",").concat(valueBinding, ")"));
  7837. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  7838. }
  7839. function genSelect(el, value, modifiers) {
  7840. var number = modifiers && modifiers.number;
  7841. var selectedVal = "Array.prototype.filter" +
  7842. ".call($event.target.options,function(o){return o.selected})" +
  7843. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  7844. "return ".concat(number ? '_n(val)' : 'val', "})");
  7845. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  7846. var code = "var $$selectedVal = ".concat(selectedVal, ";");
  7847. code = "".concat(code, " ").concat(genAssignmentCode(value, assignment));
  7848. addHandler(el, 'change', code, null, true);
  7849. }
  7850. function genDefaultModel(el, value, modifiers) {
  7851. var type = el.attrsMap.type;
  7852. // warn if v-bind:value conflicts with v-model
  7853. // except for inputs with v-bind:type
  7854. {
  7855. var value_1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  7856. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  7857. if (value_1 && !typeBinding) {
  7858. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  7859. warn$1("".concat(binding, "=\"").concat(value_1, "\" conflicts with v-model on the same element ") +
  7860. 'because the latter already expands to a value binding internally', el.rawAttrsMap[binding]);
  7861. }
  7862. }
  7863. var _a = modifiers || {}, lazy = _a.lazy, number = _a.number, trim = _a.trim;
  7864. var needCompositionGuard = !lazy && type !== 'range';
  7865. var event = lazy ? 'change' : type === 'range' ? RANGE_TOKEN : 'input';
  7866. var valueExpression = '$event.target.value';
  7867. if (trim) {
  7868. valueExpression = "$event.target.value.trim()";
  7869. }
  7870. if (number) {
  7871. valueExpression = "_n(".concat(valueExpression, ")");
  7872. }
  7873. var code = genAssignmentCode(value, valueExpression);
  7874. if (needCompositionGuard) {
  7875. code = "if($event.target.composing)return;".concat(code);
  7876. }
  7877. addProp(el, 'value', "(".concat(value, ")"));
  7878. addHandler(el, event, code, null, true);
  7879. if (trim || number) {
  7880. addHandler(el, 'blur', '$forceUpdate()');
  7881. }
  7882. }
  7883. // normalize v-model event tokens that can only be determined at runtime.
  7884. // it's important to place the event as the first in the array because
  7885. // the whole point is ensuring the v-model callback gets called before
  7886. // user-attached handlers.
  7887. function normalizeEvents(on) {
  7888. /* istanbul ignore if */
  7889. if (isDef(on[RANGE_TOKEN])) {
  7890. // IE input[type=range] only supports `change` event
  7891. var event_1 = isIE ? 'change' : 'input';
  7892. on[event_1] = [].concat(on[RANGE_TOKEN], on[event_1] || []);
  7893. delete on[RANGE_TOKEN];
  7894. }
  7895. // This was originally intended to fix #4521 but no longer necessary
  7896. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  7897. /* istanbul ignore if */
  7898. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  7899. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  7900. delete on[CHECKBOX_RADIO_TOKEN];
  7901. }
  7902. }
  7903. var target;
  7904. function createOnceHandler(event, handler, capture) {
  7905. var _target = target; // save current target element in closure
  7906. return function onceHandler() {
  7907. var res = handler.apply(null, arguments);
  7908. if (res !== null) {
  7909. remove(event, onceHandler, capture, _target);
  7910. }
  7911. };
  7912. }
  7913. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  7914. // implementation and does not fire microtasks in between event propagation, so
  7915. // safe to exclude.
  7916. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  7917. function add(name, handler, capture, passive) {
  7918. // async edge case #6566: inner click event triggers patch, event handler
  7919. // attached to outer element during patch, and triggered again. This
  7920. // happens because browsers fire microtask ticks between event propagation.
  7921. // the solution is simple: we save the timestamp when a handler is attached,
  7922. // and the handler would only fire if the event passed to it was fired
  7923. // AFTER it was attached.
  7924. if (useMicrotaskFix) {
  7925. var attachedTimestamp_1 = currentFlushTimestamp;
  7926. var original_1 = handler;
  7927. //@ts-expect-error
  7928. handler = original_1._wrapper = function (e) {
  7929. if (
  7930. // no bubbling, should always fire.
  7931. // this is just a safety net in case event.timeStamp is unreliable in
  7932. // certain weird environments...
  7933. e.target === e.currentTarget ||
  7934. // event is fired after handler attachment
  7935. e.timeStamp >= attachedTimestamp_1 ||
  7936. // bail for environments that have buggy event.timeStamp implementations
  7937. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  7938. // #9681 QtWebEngine event.timeStamp is negative value
  7939. e.timeStamp <= 0 ||
  7940. // #9448 bail if event is fired in another document in a multi-page
  7941. // electron/nw.js app, since event.timeStamp will be using a different
  7942. // starting reference
  7943. e.target.ownerDocument !== document) {
  7944. return original_1.apply(this, arguments);
  7945. }
  7946. };
  7947. }
  7948. target.addEventListener(name, handler, supportsPassive ? { capture: capture, passive: passive } : capture);
  7949. }
  7950. function remove(name, handler, capture, _target) {
  7951. (_target || target).removeEventListener(name,
  7952. //@ts-expect-error
  7953. handler._wrapper || handler, capture);
  7954. }
  7955. function updateDOMListeners(oldVnode, vnode) {
  7956. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  7957. return;
  7958. }
  7959. var on = vnode.data.on || {};
  7960. var oldOn = oldVnode.data.on || {};
  7961. // vnode is empty when removing all listeners,
  7962. // and use old vnode dom element
  7963. target = vnode.elm || oldVnode.elm;
  7964. normalizeEvents(on);
  7965. updateListeners(on, oldOn, add, remove, createOnceHandler, vnode.context);
  7966. target = undefined;
  7967. }
  7968. var events = {
  7969. create: updateDOMListeners,
  7970. update: updateDOMListeners,
  7971. // @ts-expect-error emptyNode has actually data
  7972. destroy: function (vnode) { return updateDOMListeners(vnode, emptyNode); }
  7973. };
  7974. var svgContainer;
  7975. function updateDOMProps(oldVnode, vnode) {
  7976. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  7977. return;
  7978. }
  7979. var key, cur;
  7980. var elm = vnode.elm;
  7981. var oldProps = oldVnode.data.domProps || {};
  7982. var props = vnode.data.domProps || {};
  7983. // clone observed objects, as the user probably wants to mutate it
  7984. if (isDef(props.__ob__) || isTrue(props._v_attr_proxy)) {
  7985. props = vnode.data.domProps = extend({}, props);
  7986. }
  7987. for (key in oldProps) {
  7988. if (!(key in props)) {
  7989. elm[key] = '';
  7990. }
  7991. }
  7992. for (key in props) {
  7993. cur = props[key];
  7994. // ignore children if the node has textContent or innerHTML,
  7995. // as these will throw away existing DOM nodes and cause removal errors
  7996. // on subsequent patches (#3360)
  7997. if (key === 'textContent' || key === 'innerHTML') {
  7998. if (vnode.children)
  7999. vnode.children.length = 0;
  8000. if (cur === oldProps[key])
  8001. continue;
  8002. // #6601 work around Chrome version <= 55 bug where single textNode
  8003. // replaced by innerHTML/textContent retains its parentNode property
  8004. if (elm.childNodes.length === 1) {
  8005. elm.removeChild(elm.childNodes[0]);
  8006. }
  8007. }
  8008. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  8009. // store value as _value as well since
  8010. // non-string values will be stringified
  8011. elm._value = cur;
  8012. // avoid resetting cursor position when value is the same
  8013. var strCur = isUndef(cur) ? '' : String(cur);
  8014. if (shouldUpdateValue(elm, strCur)) {
  8015. elm.value = strCur;
  8016. }
  8017. }
  8018. else if (key === 'innerHTML' &&
  8019. isSVG(elm.tagName) &&
  8020. isUndef(elm.innerHTML)) {
  8021. // IE doesn't support innerHTML for SVG elements
  8022. svgContainer = svgContainer || document.createElement('div');
  8023. svgContainer.innerHTML = "<svg>".concat(cur, "</svg>");
  8024. var svg = svgContainer.firstChild;
  8025. while (elm.firstChild) {
  8026. elm.removeChild(elm.firstChild);
  8027. }
  8028. while (svg.firstChild) {
  8029. elm.appendChild(svg.firstChild);
  8030. }
  8031. }
  8032. else if (
  8033. // skip the update if old and new VDOM state is the same.
  8034. // `value` is handled separately because the DOM value may be temporarily
  8035. // out of sync with VDOM state due to focus, composition and modifiers.
  8036. // This #4521 by skipping the unnecessary `checked` update.
  8037. cur !== oldProps[key]) {
  8038. // some property updates can throw
  8039. // e.g. `value` on <progress> w/ non-finite value
  8040. try {
  8041. elm[key] = cur;
  8042. }
  8043. catch (e) { }
  8044. }
  8045. }
  8046. }
  8047. function shouldUpdateValue(elm, checkVal) {
  8048. return (
  8049. //@ts-expect-error
  8050. !elm.composing &&
  8051. (elm.tagName === 'OPTION' ||
  8052. isNotInFocusAndDirty(elm, checkVal) ||
  8053. isDirtyWithModifiers(elm, checkVal)));
  8054. }
  8055. function isNotInFocusAndDirty(elm, checkVal) {
  8056. // return true when textbox (.number and .trim) loses focus and its value is
  8057. // not equal to the updated value
  8058. var notInFocus = true;
  8059. // #6157
  8060. // work around IE bug when accessing document.activeElement in an iframe
  8061. try {
  8062. notInFocus = document.activeElement !== elm;
  8063. }
  8064. catch (e) { }
  8065. return notInFocus && elm.value !== checkVal;
  8066. }
  8067. function isDirtyWithModifiers(elm, newVal) {
  8068. var value = elm.value;
  8069. var modifiers = elm._vModifiers; // injected by v-model runtime
  8070. if (isDef(modifiers)) {
  8071. if (modifiers.number) {
  8072. return toNumber(value) !== toNumber(newVal);
  8073. }
  8074. if (modifiers.trim) {
  8075. return value.trim() !== newVal.trim();
  8076. }
  8077. }
  8078. return value !== newVal;
  8079. }
  8080. var domProps = {
  8081. create: updateDOMProps,
  8082. update: updateDOMProps
  8083. };
  8084. var parseStyleText = cached(function (cssText) {
  8085. var res = {};
  8086. var listDelimiter = /;(?![^(]*\))/g;
  8087. var propertyDelimiter = /:(.+)/;
  8088. cssText.split(listDelimiter).forEach(function (item) {
  8089. if (item) {
  8090. var tmp = item.split(propertyDelimiter);
  8091. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  8092. }
  8093. });
  8094. return res;
  8095. });
  8096. // merge static and dynamic style data on the same vnode
  8097. function normalizeStyleData(data) {
  8098. var style = normalizeStyleBinding(data.style);
  8099. // static style is pre-processed into an object during compilation
  8100. // and is always a fresh object, so it's safe to merge into it
  8101. return data.staticStyle ? extend(data.staticStyle, style) : style;
  8102. }
  8103. // normalize possible array / string values into Object
  8104. function normalizeStyleBinding(bindingStyle) {
  8105. if (Array.isArray(bindingStyle)) {
  8106. return toObject(bindingStyle);
  8107. }
  8108. if (typeof bindingStyle === 'string') {
  8109. return parseStyleText(bindingStyle);
  8110. }
  8111. return bindingStyle;
  8112. }
  8113. /**
  8114. * parent component style should be after child's
  8115. * so that parent component's style could override it
  8116. */
  8117. function getStyle(vnode, checkChild) {
  8118. var res = {};
  8119. var styleData;
  8120. if (checkChild) {
  8121. var childNode = vnode;
  8122. while (childNode.componentInstance) {
  8123. childNode = childNode.componentInstance._vnode;
  8124. if (childNode &&
  8125. childNode.data &&
  8126. (styleData = normalizeStyleData(childNode.data))) {
  8127. extend(res, styleData);
  8128. }
  8129. }
  8130. }
  8131. if ((styleData = normalizeStyleData(vnode.data))) {
  8132. extend(res, styleData);
  8133. }
  8134. var parentNode = vnode;
  8135. // @ts-expect-error parentNode.parent not VNodeWithData
  8136. while ((parentNode = parentNode.parent)) {
  8137. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  8138. extend(res, styleData);
  8139. }
  8140. }
  8141. return res;
  8142. }
  8143. var cssVarRE = /^--/;
  8144. var importantRE = /\s*!important$/;
  8145. var setProp = function (el, name, val) {
  8146. /* istanbul ignore if */
  8147. if (cssVarRE.test(name)) {
  8148. el.style.setProperty(name, val);
  8149. }
  8150. else if (importantRE.test(val)) {
  8151. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  8152. }
  8153. else {
  8154. var normalizedName = normalize(name);
  8155. if (Array.isArray(val)) {
  8156. // Support values array created by autoprefixer, e.g.
  8157. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  8158. // Set them one by one, and the browser will only set those it can recognize
  8159. for (var i = 0, len = val.length; i < len; i++) {
  8160. el.style[normalizedName] = val[i];
  8161. }
  8162. }
  8163. else {
  8164. el.style[normalizedName] = val;
  8165. }
  8166. }
  8167. };
  8168. var vendorNames = ['Webkit', 'Moz', 'ms'];
  8169. var emptyStyle;
  8170. var normalize = cached(function (prop) {
  8171. emptyStyle = emptyStyle || document.createElement('div').style;
  8172. prop = camelize(prop);
  8173. if (prop !== 'filter' && prop in emptyStyle) {
  8174. return prop;
  8175. }
  8176. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  8177. for (var i = 0; i < vendorNames.length; i++) {
  8178. var name_1 = vendorNames[i] + capName;
  8179. if (name_1 in emptyStyle) {
  8180. return name_1;
  8181. }
  8182. }
  8183. });
  8184. function updateStyle(oldVnode, vnode) {
  8185. var data = vnode.data;
  8186. var oldData = oldVnode.data;
  8187. if (isUndef(data.staticStyle) &&
  8188. isUndef(data.style) &&
  8189. isUndef(oldData.staticStyle) &&
  8190. isUndef(oldData.style)) {
  8191. return;
  8192. }
  8193. var cur, name;
  8194. var el = vnode.elm;
  8195. var oldStaticStyle = oldData.staticStyle;
  8196. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  8197. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  8198. var oldStyle = oldStaticStyle || oldStyleBinding;
  8199. var style = normalizeStyleBinding(vnode.data.style) || {};
  8200. // store normalized style under a different key for next diff
  8201. // make sure to clone it if it's reactive, since the user likely wants
  8202. // to mutate it.
  8203. vnode.data.normalizedStyle = isDef(style.__ob__) ? extend({}, style) : style;
  8204. var newStyle = getStyle(vnode, true);
  8205. for (name in oldStyle) {
  8206. if (isUndef(newStyle[name])) {
  8207. setProp(el, name, '');
  8208. }
  8209. }
  8210. for (name in newStyle) {
  8211. cur = newStyle[name];
  8212. // ie9 setting to null has no effect, must use empty string
  8213. setProp(el, name, cur == null ? '' : cur);
  8214. }
  8215. }
  8216. var style$1 = {
  8217. create: updateStyle,
  8218. update: updateStyle
  8219. };
  8220. var whitespaceRE$1 = /\s+/;
  8221. /**
  8222. * Add class with compatibility for SVG since classList is not supported on
  8223. * SVG elements in IE
  8224. */
  8225. function addClass(el, cls) {
  8226. /* istanbul ignore if */
  8227. if (!cls || !(cls = cls.trim())) {
  8228. return;
  8229. }
  8230. /* istanbul ignore else */
  8231. if (el.classList) {
  8232. if (cls.indexOf(' ') > -1) {
  8233. cls.split(whitespaceRE$1).forEach(function (c) { return el.classList.add(c); });
  8234. }
  8235. else {
  8236. el.classList.add(cls);
  8237. }
  8238. }
  8239. else {
  8240. var cur = " ".concat(el.getAttribute('class') || '', " ");
  8241. if (cur.indexOf(' ' + cls + ' ') < 0) {
  8242. el.setAttribute('class', (cur + cls).trim());
  8243. }
  8244. }
  8245. }
  8246. /**
  8247. * Remove class with compatibility for SVG since classList is not supported on
  8248. * SVG elements in IE
  8249. */
  8250. function removeClass(el, cls) {
  8251. /* istanbul ignore if */
  8252. if (!cls || !(cls = cls.trim())) {
  8253. return;
  8254. }
  8255. /* istanbul ignore else */
  8256. if (el.classList) {
  8257. if (cls.indexOf(' ') > -1) {
  8258. cls.split(whitespaceRE$1).forEach(function (c) { return el.classList.remove(c); });
  8259. }
  8260. else {
  8261. el.classList.remove(cls);
  8262. }
  8263. if (!el.classList.length) {
  8264. el.removeAttribute('class');
  8265. }
  8266. }
  8267. else {
  8268. var cur = " ".concat(el.getAttribute('class') || '', " ");
  8269. var tar = ' ' + cls + ' ';
  8270. while (cur.indexOf(tar) >= 0) {
  8271. cur = cur.replace(tar, ' ');
  8272. }
  8273. cur = cur.trim();
  8274. if (cur) {
  8275. el.setAttribute('class', cur);
  8276. }
  8277. else {
  8278. el.removeAttribute('class');
  8279. }
  8280. }
  8281. }
  8282. function resolveTransition(def) {
  8283. if (!def) {
  8284. return;
  8285. }
  8286. /* istanbul ignore else */
  8287. if (typeof def === 'object') {
  8288. var res = {};
  8289. if (def.css !== false) {
  8290. extend(res, autoCssTransition(def.name || 'v'));
  8291. }
  8292. extend(res, def);
  8293. return res;
  8294. }
  8295. else if (typeof def === 'string') {
  8296. return autoCssTransition(def);
  8297. }
  8298. }
  8299. var autoCssTransition = cached(function (name) {
  8300. return {
  8301. enterClass: "".concat(name, "-enter"),
  8302. enterToClass: "".concat(name, "-enter-to"),
  8303. enterActiveClass: "".concat(name, "-enter-active"),
  8304. leaveClass: "".concat(name, "-leave"),
  8305. leaveToClass: "".concat(name, "-leave-to"),
  8306. leaveActiveClass: "".concat(name, "-leave-active")
  8307. };
  8308. });
  8309. var hasTransition = inBrowser && !isIE9;
  8310. var TRANSITION = 'transition';
  8311. var ANIMATION = 'animation';
  8312. // Transition property/event sniffing
  8313. var transitionProp = 'transition';
  8314. var transitionEndEvent = 'transitionend';
  8315. var animationProp = 'animation';
  8316. var animationEndEvent = 'animationend';
  8317. if (hasTransition) {
  8318. /* istanbul ignore if */
  8319. if (window.ontransitionend === undefined &&
  8320. window.onwebkittransitionend !== undefined) {
  8321. transitionProp = 'WebkitTransition';
  8322. transitionEndEvent = 'webkitTransitionEnd';
  8323. }
  8324. if (window.onanimationend === undefined &&
  8325. window.onwebkitanimationend !== undefined) {
  8326. animationProp = 'WebkitAnimation';
  8327. animationEndEvent = 'webkitAnimationEnd';
  8328. }
  8329. }
  8330. // binding to window is necessary to make hot reload work in IE in strict mode
  8331. var raf = inBrowser
  8332. ? window.requestAnimationFrame
  8333. ? window.requestAnimationFrame.bind(window)
  8334. : setTimeout
  8335. : /* istanbul ignore next */ function (/* istanbul ignore next */ fn) { return fn(); };
  8336. function nextFrame(fn) {
  8337. raf(function () {
  8338. // @ts-expect-error
  8339. raf(fn);
  8340. });
  8341. }
  8342. function addTransitionClass(el, cls) {
  8343. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  8344. if (transitionClasses.indexOf(cls) < 0) {
  8345. transitionClasses.push(cls);
  8346. addClass(el, cls);
  8347. }
  8348. }
  8349. function removeTransitionClass(el, cls) {
  8350. if (el._transitionClasses) {
  8351. remove$2(el._transitionClasses, cls);
  8352. }
  8353. removeClass(el, cls);
  8354. }
  8355. function whenTransitionEnds(el, expectedType, cb) {
  8356. var _a = getTransitionInfo(el, expectedType), type = _a.type, timeout = _a.timeout, propCount = _a.propCount;
  8357. if (!type)
  8358. return cb();
  8359. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  8360. var ended = 0;
  8361. var end = function () {
  8362. el.removeEventListener(event, onEnd);
  8363. cb();
  8364. };
  8365. var onEnd = function (e) {
  8366. if (e.target === el) {
  8367. if (++ended >= propCount) {
  8368. end();
  8369. }
  8370. }
  8371. };
  8372. setTimeout(function () {
  8373. if (ended < propCount) {
  8374. end();
  8375. }
  8376. }, timeout + 1);
  8377. el.addEventListener(event, onEnd);
  8378. }
  8379. var transformRE = /\b(transform|all)(,|$)/;
  8380. function getTransitionInfo(el, expectedType) {
  8381. var styles = window.getComputedStyle(el);
  8382. // JSDOM may return undefined for transition properties
  8383. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  8384. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  8385. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  8386. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  8387. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  8388. var animationTimeout = getTimeout(animationDelays, animationDurations);
  8389. var type;
  8390. var timeout = 0;
  8391. var propCount = 0;
  8392. /* istanbul ignore if */
  8393. if (expectedType === TRANSITION) {
  8394. if (transitionTimeout > 0) {
  8395. type = TRANSITION;
  8396. timeout = transitionTimeout;
  8397. propCount = transitionDurations.length;
  8398. }
  8399. }
  8400. else if (expectedType === ANIMATION) {
  8401. if (animationTimeout > 0) {
  8402. type = ANIMATION;
  8403. timeout = animationTimeout;
  8404. propCount = animationDurations.length;
  8405. }
  8406. }
  8407. else {
  8408. timeout = Math.max(transitionTimeout, animationTimeout);
  8409. type =
  8410. timeout > 0
  8411. ? transitionTimeout > animationTimeout
  8412. ? TRANSITION
  8413. : ANIMATION
  8414. : null;
  8415. propCount = type
  8416. ? type === TRANSITION
  8417. ? transitionDurations.length
  8418. : animationDurations.length
  8419. : 0;
  8420. }
  8421. var hasTransform = type === TRANSITION && transformRE.test(styles[transitionProp + 'Property']);
  8422. return {
  8423. type: type,
  8424. timeout: timeout,
  8425. propCount: propCount,
  8426. hasTransform: hasTransform
  8427. };
  8428. }
  8429. function getTimeout(delays, durations) {
  8430. /* istanbul ignore next */
  8431. while (delays.length < durations.length) {
  8432. delays = delays.concat(delays);
  8433. }
  8434. return Math.max.apply(null, durations.map(function (d, i) {
  8435. return toMs(d) + toMs(delays[i]);
  8436. }));
  8437. }
  8438. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  8439. // in a locale-dependent way, using a comma instead of a dot.
  8440. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  8441. // as a floor function) causing unexpected behaviors
  8442. function toMs(s) {
  8443. return Number(s.slice(0, -1).replace(',', '.')) * 1000;
  8444. }
  8445. function enter(vnode, toggleDisplay) {
  8446. var el = vnode.elm;
  8447. // call leave callback now
  8448. if (isDef(el._leaveCb)) {
  8449. el._leaveCb.cancelled = true;
  8450. el._leaveCb();
  8451. }
  8452. var data = resolveTransition(vnode.data.transition);
  8453. if (isUndef(data)) {
  8454. return;
  8455. }
  8456. /* istanbul ignore if */
  8457. if (isDef(el._enterCb) || el.nodeType !== 1) {
  8458. return;
  8459. }
  8460. var css = data.css, type = data.type, enterClass = data.enterClass, enterToClass = data.enterToClass, enterActiveClass = data.enterActiveClass, appearClass = data.appearClass, appearToClass = data.appearToClass, appearActiveClass = data.appearActiveClass, beforeEnter = data.beforeEnter, enter = data.enter, afterEnter = data.afterEnter, enterCancelled = data.enterCancelled, beforeAppear = data.beforeAppear, appear = data.appear, afterAppear = data.afterAppear, appearCancelled = data.appearCancelled, duration = data.duration;
  8461. // activeInstance will always be the <transition> component managing this
  8462. // transition. One edge case to check is when the <transition> is placed
  8463. // as the root node of a child component. In that case we need to check
  8464. // <transition>'s parent for appear check.
  8465. var context = activeInstance;
  8466. var transitionNode = activeInstance.$vnode;
  8467. while (transitionNode && transitionNode.parent) {
  8468. context = transitionNode.context;
  8469. transitionNode = transitionNode.parent;
  8470. }
  8471. var isAppear = !context._isMounted || !vnode.isRootInsert;
  8472. if (isAppear && !appear && appear !== '') {
  8473. return;
  8474. }
  8475. var startClass = isAppear && appearClass ? appearClass : enterClass;
  8476. var activeClass = isAppear && appearActiveClass ? appearActiveClass : enterActiveClass;
  8477. var toClass = isAppear && appearToClass ? appearToClass : enterToClass;
  8478. var beforeEnterHook = isAppear ? beforeAppear || beforeEnter : beforeEnter;
  8479. var enterHook = isAppear ? (isFunction(appear) ? appear : enter) : enter;
  8480. var afterEnterHook = isAppear ? afterAppear || afterEnter : afterEnter;
  8481. var enterCancelledHook = isAppear
  8482. ? appearCancelled || enterCancelled
  8483. : enterCancelled;
  8484. var explicitEnterDuration = toNumber(isObject(duration) ? duration.enter : duration);
  8485. if (explicitEnterDuration != null) {
  8486. checkDuration(explicitEnterDuration, 'enter', vnode);
  8487. }
  8488. var expectsCSS = css !== false && !isIE9;
  8489. var userWantsControl = getHookArgumentsLength(enterHook);
  8490. var cb = (el._enterCb = once(function () {
  8491. if (expectsCSS) {
  8492. removeTransitionClass(el, toClass);
  8493. removeTransitionClass(el, activeClass);
  8494. }
  8495. // @ts-expect-error
  8496. if (cb.cancelled) {
  8497. if (expectsCSS) {
  8498. removeTransitionClass(el, startClass);
  8499. }
  8500. enterCancelledHook && enterCancelledHook(el);
  8501. }
  8502. else {
  8503. afterEnterHook && afterEnterHook(el);
  8504. }
  8505. el._enterCb = null;
  8506. }));
  8507. if (!vnode.data.show) {
  8508. // remove pending leave element on enter by injecting an insert hook
  8509. mergeVNodeHook(vnode, 'insert', function () {
  8510. var parent = el.parentNode;
  8511. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  8512. if (pendingNode &&
  8513. pendingNode.tag === vnode.tag &&
  8514. pendingNode.elm._leaveCb) {
  8515. pendingNode.elm._leaveCb();
  8516. }
  8517. enterHook && enterHook(el, cb);
  8518. });
  8519. }
  8520. // start enter transition
  8521. beforeEnterHook && beforeEnterHook(el);
  8522. if (expectsCSS) {
  8523. addTransitionClass(el, startClass);
  8524. addTransitionClass(el, activeClass);
  8525. nextFrame(function () {
  8526. removeTransitionClass(el, startClass);
  8527. // @ts-expect-error
  8528. if (!cb.cancelled) {
  8529. addTransitionClass(el, toClass);
  8530. if (!userWantsControl) {
  8531. if (isValidDuration(explicitEnterDuration)) {
  8532. setTimeout(cb, explicitEnterDuration);
  8533. }
  8534. else {
  8535. whenTransitionEnds(el, type, cb);
  8536. }
  8537. }
  8538. }
  8539. });
  8540. }
  8541. if (vnode.data.show) {
  8542. toggleDisplay && toggleDisplay();
  8543. enterHook && enterHook(el, cb);
  8544. }
  8545. if (!expectsCSS && !userWantsControl) {
  8546. cb();
  8547. }
  8548. }
  8549. function leave(vnode, rm) {
  8550. var el = vnode.elm;
  8551. // call enter callback now
  8552. if (isDef(el._enterCb)) {
  8553. el._enterCb.cancelled = true;
  8554. el._enterCb();
  8555. }
  8556. var data = resolveTransition(vnode.data.transition);
  8557. if (isUndef(data) || el.nodeType !== 1) {
  8558. return rm();
  8559. }
  8560. /* istanbul ignore if */
  8561. if (isDef(el._leaveCb)) {
  8562. return;
  8563. }
  8564. var css = data.css, type = data.type, leaveClass = data.leaveClass, leaveToClass = data.leaveToClass, leaveActiveClass = data.leaveActiveClass, beforeLeave = data.beforeLeave, leave = data.leave, afterLeave = data.afterLeave, leaveCancelled = data.leaveCancelled, delayLeave = data.delayLeave, duration = data.duration;
  8565. var expectsCSS = css !== false && !isIE9;
  8566. var userWantsControl = getHookArgumentsLength(leave);
  8567. var explicitLeaveDuration = toNumber(isObject(duration) ? duration.leave : duration);
  8568. if (isDef(explicitLeaveDuration)) {
  8569. checkDuration(explicitLeaveDuration, 'leave', vnode);
  8570. }
  8571. var cb = (el._leaveCb = once(function () {
  8572. if (el.parentNode && el.parentNode._pending) {
  8573. el.parentNode._pending[vnode.key] = null;
  8574. }
  8575. if (expectsCSS) {
  8576. removeTransitionClass(el, leaveToClass);
  8577. removeTransitionClass(el, leaveActiveClass);
  8578. }
  8579. // @ts-expect-error
  8580. if (cb.cancelled) {
  8581. if (expectsCSS) {
  8582. removeTransitionClass(el, leaveClass);
  8583. }
  8584. leaveCancelled && leaveCancelled(el);
  8585. }
  8586. else {
  8587. rm();
  8588. afterLeave && afterLeave(el);
  8589. }
  8590. el._leaveCb = null;
  8591. }));
  8592. if (delayLeave) {
  8593. delayLeave(performLeave);
  8594. }
  8595. else {
  8596. performLeave();
  8597. }
  8598. function performLeave() {
  8599. // the delayed leave may have already been cancelled
  8600. // @ts-expect-error
  8601. if (cb.cancelled) {
  8602. return;
  8603. }
  8604. // record leaving element
  8605. if (!vnode.data.show && el.parentNode) {
  8606. (el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] =
  8607. vnode;
  8608. }
  8609. beforeLeave && beforeLeave(el);
  8610. if (expectsCSS) {
  8611. addTransitionClass(el, leaveClass);
  8612. addTransitionClass(el, leaveActiveClass);
  8613. nextFrame(function () {
  8614. removeTransitionClass(el, leaveClass);
  8615. // @ts-expect-error
  8616. if (!cb.cancelled) {
  8617. addTransitionClass(el, leaveToClass);
  8618. if (!userWantsControl) {
  8619. if (isValidDuration(explicitLeaveDuration)) {
  8620. setTimeout(cb, explicitLeaveDuration);
  8621. }
  8622. else {
  8623. whenTransitionEnds(el, type, cb);
  8624. }
  8625. }
  8626. }
  8627. });
  8628. }
  8629. leave && leave(el, cb);
  8630. if (!expectsCSS && !userWantsControl) {
  8631. cb();
  8632. }
  8633. }
  8634. }
  8635. // only used in dev mode
  8636. function checkDuration(val, name, vnode) {
  8637. if (typeof val !== 'number') {
  8638. warn$2("<transition> explicit ".concat(name, " duration is not a valid number - ") +
  8639. "got ".concat(JSON.stringify(val), "."), vnode.context);
  8640. }
  8641. else if (isNaN(val)) {
  8642. warn$2("<transition> explicit ".concat(name, " duration is NaN - ") +
  8643. 'the duration expression might be incorrect.', vnode.context);
  8644. }
  8645. }
  8646. function isValidDuration(val) {
  8647. return typeof val === 'number' && !isNaN(val);
  8648. }
  8649. /**
  8650. * Normalize a transition hook's argument length. The hook may be:
  8651. * - a merged hook (invoker) with the original in .fns
  8652. * - a wrapped component method (check ._length)
  8653. * - a plain function (.length)
  8654. */
  8655. function getHookArgumentsLength(fn) {
  8656. if (isUndef(fn)) {
  8657. return false;
  8658. }
  8659. // @ts-expect-error
  8660. var invokerFns = fn.fns;
  8661. if (isDef(invokerFns)) {
  8662. // invoker
  8663. return getHookArgumentsLength(Array.isArray(invokerFns) ? invokerFns[0] : invokerFns);
  8664. }
  8665. else {
  8666. // @ts-expect-error
  8667. return (fn._length || fn.length) > 1;
  8668. }
  8669. }
  8670. function _enter(_, vnode) {
  8671. if (vnode.data.show !== true) {
  8672. enter(vnode);
  8673. }
  8674. }
  8675. var transition = inBrowser
  8676. ? {
  8677. create: _enter,
  8678. activate: _enter,
  8679. remove: function (vnode, rm) {
  8680. /* istanbul ignore else */
  8681. if (vnode.data.show !== true) {
  8682. // @ts-expect-error
  8683. leave(vnode, rm);
  8684. }
  8685. else {
  8686. rm();
  8687. }
  8688. }
  8689. }
  8690. : {};
  8691. var platformModules = [attrs, klass$1, events, domProps, style$1, transition];
  8692. // the directive module should be applied last, after all
  8693. // built-in modules have been applied.
  8694. var modules$1 = platformModules.concat(baseModules);
  8695. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules$1 });
  8696. /**
  8697. * Not type checking this file because flow doesn't like attaching
  8698. * properties to Elements.
  8699. */
  8700. /* istanbul ignore if */
  8701. if (isIE9) {
  8702. // http://www.matts411.com/post/internet-explorer-9-oninput/
  8703. document.addEventListener('selectionchange', function () {
  8704. var el = document.activeElement;
  8705. // @ts-expect-error
  8706. if (el && el.vmodel) {
  8707. trigger(el, 'input');
  8708. }
  8709. });
  8710. }
  8711. var directive = {
  8712. inserted: function (el, binding, vnode, oldVnode) {
  8713. if (vnode.tag === 'select') {
  8714. // #6903
  8715. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  8716. mergeVNodeHook(vnode, 'postpatch', function () {
  8717. directive.componentUpdated(el, binding, vnode);
  8718. });
  8719. }
  8720. else {
  8721. setSelected(el, binding, vnode.context);
  8722. }
  8723. el._vOptions = [].map.call(el.options, getValue);
  8724. }
  8725. else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  8726. el._vModifiers = binding.modifiers;
  8727. if (!binding.modifiers.lazy) {
  8728. el.addEventListener('compositionstart', onCompositionStart);
  8729. el.addEventListener('compositionend', onCompositionEnd);
  8730. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  8731. // switching focus before confirming composition choice
  8732. // this also fixes the issue where some browsers e.g. iOS Chrome
  8733. // fires "change" instead of "input" on autocomplete.
  8734. el.addEventListener('change', onCompositionEnd);
  8735. /* istanbul ignore if */
  8736. if (isIE9) {
  8737. el.vmodel = true;
  8738. }
  8739. }
  8740. }
  8741. },
  8742. componentUpdated: function (el, binding, vnode) {
  8743. if (vnode.tag === 'select') {
  8744. setSelected(el, binding, vnode.context);
  8745. // in case the options rendered by v-for have changed,
  8746. // it's possible that the value is out-of-sync with the rendered options.
  8747. // detect such cases and filter out values that no longer has a matching
  8748. // option in the DOM.
  8749. var prevOptions_1 = el._vOptions;
  8750. var curOptions_1 = (el._vOptions = [].map.call(el.options, getValue));
  8751. if (curOptions_1.some(function (o, i) { return !looseEqual(o, prevOptions_1[i]); })) {
  8752. // trigger change event if
  8753. // no matching option found for at least one value
  8754. var needReset = el.multiple
  8755. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions_1); })
  8756. : binding.value !== binding.oldValue &&
  8757. hasNoMatchingOption(binding.value, curOptions_1);
  8758. if (needReset) {
  8759. trigger(el, 'change');
  8760. }
  8761. }
  8762. }
  8763. }
  8764. };
  8765. function setSelected(el, binding, vm) {
  8766. actuallySetSelected(el, binding, vm);
  8767. /* istanbul ignore if */
  8768. if (isIE || isEdge) {
  8769. setTimeout(function () {
  8770. actuallySetSelected(el, binding, vm);
  8771. }, 0);
  8772. }
  8773. }
  8774. function actuallySetSelected(el, binding, vm) {
  8775. var value = binding.value;
  8776. var isMultiple = el.multiple;
  8777. if (isMultiple && !Array.isArray(value)) {
  8778. warn$2("<select multiple v-model=\"".concat(binding.expression, "\"> ") +
  8779. "expects an Array value for its binding, but got ".concat(Object.prototype.toString
  8780. .call(value)
  8781. .slice(8, -1)), vm);
  8782. return;
  8783. }
  8784. var selected, option;
  8785. for (var i = 0, l = el.options.length; i < l; i++) {
  8786. option = el.options[i];
  8787. if (isMultiple) {
  8788. selected = looseIndexOf(value, getValue(option)) > -1;
  8789. if (option.selected !== selected) {
  8790. option.selected = selected;
  8791. }
  8792. }
  8793. else {
  8794. if (looseEqual(getValue(option), value)) {
  8795. if (el.selectedIndex !== i) {
  8796. el.selectedIndex = i;
  8797. }
  8798. return;
  8799. }
  8800. }
  8801. }
  8802. if (!isMultiple) {
  8803. el.selectedIndex = -1;
  8804. }
  8805. }
  8806. function hasNoMatchingOption(value, options) {
  8807. return options.every(function (o) { return !looseEqual(o, value); });
  8808. }
  8809. function getValue(option) {
  8810. return '_value' in option ? option._value : option.value;
  8811. }
  8812. function onCompositionStart(e) {
  8813. e.target.composing = true;
  8814. }
  8815. function onCompositionEnd(e) {
  8816. // prevent triggering an input event for no reason
  8817. if (!e.target.composing)
  8818. return;
  8819. e.target.composing = false;
  8820. trigger(e.target, 'input');
  8821. }
  8822. function trigger(el, type) {
  8823. var e = document.createEvent('HTMLEvents');
  8824. e.initEvent(type, true, true);
  8825. el.dispatchEvent(e);
  8826. }
  8827. // recursively search for possible transition defined inside the component root
  8828. function locateNode(vnode) {
  8829. // @ts-expect-error
  8830. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  8831. ? locateNode(vnode.componentInstance._vnode)
  8832. : vnode;
  8833. }
  8834. var show = {
  8835. bind: function (el, _a, vnode) {
  8836. var value = _a.value;
  8837. vnode = locateNode(vnode);
  8838. var transition = vnode.data && vnode.data.transition;
  8839. var originalDisplay = (el.__vOriginalDisplay =
  8840. el.style.display === 'none' ? '' : el.style.display);
  8841. if (value && transition) {
  8842. vnode.data.show = true;
  8843. enter(vnode, function () {
  8844. el.style.display = originalDisplay;
  8845. });
  8846. }
  8847. else {
  8848. el.style.display = value ? originalDisplay : 'none';
  8849. }
  8850. },
  8851. update: function (el, _a, vnode) {
  8852. var value = _a.value, oldValue = _a.oldValue;
  8853. /* istanbul ignore if */
  8854. if (!value === !oldValue)
  8855. return;
  8856. vnode = locateNode(vnode);
  8857. var transition = vnode.data && vnode.data.transition;
  8858. if (transition) {
  8859. vnode.data.show = true;
  8860. if (value) {
  8861. enter(vnode, function () {
  8862. el.style.display = el.__vOriginalDisplay;
  8863. });
  8864. }
  8865. else {
  8866. leave(vnode, function () {
  8867. el.style.display = 'none';
  8868. });
  8869. }
  8870. }
  8871. else {
  8872. el.style.display = value ? el.__vOriginalDisplay : 'none';
  8873. }
  8874. },
  8875. unbind: function (el, binding, vnode, oldVnode, isDestroy) {
  8876. if (!isDestroy) {
  8877. el.style.display = el.__vOriginalDisplay;
  8878. }
  8879. }
  8880. };
  8881. var platformDirectives = {
  8882. model: directive,
  8883. show: show
  8884. };
  8885. // Provides transition support for a single element/component.
  8886. var transitionProps = {
  8887. name: String,
  8888. appear: Boolean,
  8889. css: Boolean,
  8890. mode: String,
  8891. type: String,
  8892. enterClass: String,
  8893. leaveClass: String,
  8894. enterToClass: String,
  8895. leaveToClass: String,
  8896. enterActiveClass: String,
  8897. leaveActiveClass: String,
  8898. appearClass: String,
  8899. appearActiveClass: String,
  8900. appearToClass: String,
  8901. duration: [Number, String, Object]
  8902. };
  8903. // in case the child is also an abstract component, e.g. <keep-alive>
  8904. // we want to recursively retrieve the real component to be rendered
  8905. function getRealChild(vnode) {
  8906. var compOptions = vnode && vnode.componentOptions;
  8907. if (compOptions && compOptions.Ctor.options.abstract) {
  8908. return getRealChild(getFirstComponentChild(compOptions.children));
  8909. }
  8910. else {
  8911. return vnode;
  8912. }
  8913. }
  8914. function extractTransitionData(comp) {
  8915. var data = {};
  8916. var options = comp.$options;
  8917. // props
  8918. for (var key in options.propsData) {
  8919. data[key] = comp[key];
  8920. }
  8921. // events.
  8922. // extract listeners and pass them directly to the transition methods
  8923. var listeners = options._parentListeners;
  8924. for (var key in listeners) {
  8925. data[camelize(key)] = listeners[key];
  8926. }
  8927. return data;
  8928. }
  8929. function placeholder(h, rawChild) {
  8930. // @ts-expect-error
  8931. if (/\d-keep-alive$/.test(rawChild.tag)) {
  8932. return h('keep-alive', {
  8933. props: rawChild.componentOptions.propsData
  8934. });
  8935. }
  8936. }
  8937. function hasParentTransition(vnode) {
  8938. while ((vnode = vnode.parent)) {
  8939. if (vnode.data.transition) {
  8940. return true;
  8941. }
  8942. }
  8943. }
  8944. function isSameChild(child, oldChild) {
  8945. return oldChild.key === child.key && oldChild.tag === child.tag;
  8946. }
  8947. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  8948. var isVShowDirective = function (d) { return d.name === 'show'; };
  8949. var Transition = {
  8950. name: 'transition',
  8951. props: transitionProps,
  8952. abstract: true,
  8953. render: function (h) {
  8954. var _this = this;
  8955. var children = this.$slots.default;
  8956. if (!children) {
  8957. return;
  8958. }
  8959. // filter out text nodes (possible whitespaces)
  8960. children = children.filter(isNotTextNode);
  8961. /* istanbul ignore if */
  8962. if (!children.length) {
  8963. return;
  8964. }
  8965. // warn multiple elements
  8966. if (children.length > 1) {
  8967. warn$2('<transition> can only be used on a single element. Use ' +
  8968. '<transition-group> for lists.', this.$parent);
  8969. }
  8970. var mode = this.mode;
  8971. // warn invalid mode
  8972. if (mode && mode !== 'in-out' && mode !== 'out-in') {
  8973. warn$2('invalid <transition> mode: ' + mode, this.$parent);
  8974. }
  8975. var rawChild = children[0];
  8976. // if this is a component root node and the component's
  8977. // parent container node also has transition, skip.
  8978. if (hasParentTransition(this.$vnode)) {
  8979. return rawChild;
  8980. }
  8981. // apply transition data to child
  8982. // use getRealChild() to ignore abstract components e.g. keep-alive
  8983. var child = getRealChild(rawChild);
  8984. /* istanbul ignore if */
  8985. if (!child) {
  8986. return rawChild;
  8987. }
  8988. if (this._leaving) {
  8989. return placeholder(h, rawChild);
  8990. }
  8991. // ensure a key that is unique to the vnode type and to this transition
  8992. // component instance. This key will be used to remove pending leaving nodes
  8993. // during entering.
  8994. var id = "__transition-".concat(this._uid, "-");
  8995. child.key =
  8996. child.key == null
  8997. ? child.isComment
  8998. ? id + 'comment'
  8999. : id + child.tag
  9000. : isPrimitive(child.key)
  9001. ? String(child.key).indexOf(id) === 0
  9002. ? child.key
  9003. : id + child.key
  9004. : child.key;
  9005. var data = ((child.data || (child.data = {})).transition =
  9006. extractTransitionData(this));
  9007. var oldRawChild = this._vnode;
  9008. var oldChild = getRealChild(oldRawChild);
  9009. // mark v-show
  9010. // so that the transition module can hand over the control to the directive
  9011. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  9012. child.data.show = true;
  9013. }
  9014. if (oldChild &&
  9015. oldChild.data &&
  9016. !isSameChild(child, oldChild) &&
  9017. !isAsyncPlaceholder(oldChild) &&
  9018. // #6687 component root is a comment node
  9019. !(oldChild.componentInstance &&
  9020. oldChild.componentInstance._vnode.isComment)) {
  9021. // replace old child transition data with fresh one
  9022. // important for dynamic transitions!
  9023. var oldData = (oldChild.data.transition = extend({}, data));
  9024. // handle transition mode
  9025. if (mode === 'out-in') {
  9026. // return placeholder node and queue update when leave finishes
  9027. this._leaving = true;
  9028. mergeVNodeHook(oldData, 'afterLeave', function () {
  9029. _this._leaving = false;
  9030. _this.$forceUpdate();
  9031. });
  9032. return placeholder(h, rawChild);
  9033. }
  9034. else if (mode === 'in-out') {
  9035. if (isAsyncPlaceholder(child)) {
  9036. return oldRawChild;
  9037. }
  9038. var delayedLeave_1;
  9039. var performLeave = function () {
  9040. delayedLeave_1();
  9041. };
  9042. mergeVNodeHook(data, 'afterEnter', performLeave);
  9043. mergeVNodeHook(data, 'enterCancelled', performLeave);
  9044. mergeVNodeHook(oldData, 'delayLeave', function (leave) {
  9045. delayedLeave_1 = leave;
  9046. });
  9047. }
  9048. }
  9049. return rawChild;
  9050. }
  9051. };
  9052. // Provides transition support for list items.
  9053. var props = extend({
  9054. tag: String,
  9055. moveClass: String
  9056. }, transitionProps);
  9057. delete props.mode;
  9058. var TransitionGroup = {
  9059. props: props,
  9060. beforeMount: function () {
  9061. var _this = this;
  9062. var update = this._update;
  9063. this._update = function (vnode, hydrating) {
  9064. var restoreActiveInstance = setActiveInstance(_this);
  9065. // force removing pass
  9066. _this.__patch__(_this._vnode, _this.kept, false, // hydrating
  9067. true // removeOnly (!important, avoids unnecessary moves)
  9068. );
  9069. _this._vnode = _this.kept;
  9070. restoreActiveInstance();
  9071. update.call(_this, vnode, hydrating);
  9072. };
  9073. },
  9074. render: function (h) {
  9075. var tag = this.tag || this.$vnode.data.tag || 'span';
  9076. var map = Object.create(null);
  9077. var prevChildren = (this.prevChildren = this.children);
  9078. var rawChildren = this.$slots.default || [];
  9079. var children = (this.children = []);
  9080. var transitionData = extractTransitionData(this);
  9081. for (var i = 0; i < rawChildren.length; i++) {
  9082. var c = rawChildren[i];
  9083. if (c.tag) {
  9084. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  9085. children.push(c);
  9086. map[c.key] = c;
  9087. (c.data || (c.data = {})).transition = transitionData;
  9088. }
  9089. else {
  9090. var opts = c.componentOptions;
  9091. var name_1 = opts
  9092. ? getComponentName(opts.Ctor.options) || opts.tag || ''
  9093. : c.tag;
  9094. warn$2("<transition-group> children must be keyed: <".concat(name_1, ">"));
  9095. }
  9096. }
  9097. }
  9098. if (prevChildren) {
  9099. var kept = [];
  9100. var removed = [];
  9101. for (var i = 0; i < prevChildren.length; i++) {
  9102. var c = prevChildren[i];
  9103. c.data.transition = transitionData;
  9104. // @ts-expect-error .getBoundingClientRect is not typed in Node
  9105. c.data.pos = c.elm.getBoundingClientRect();
  9106. if (map[c.key]) {
  9107. kept.push(c);
  9108. }
  9109. else {
  9110. removed.push(c);
  9111. }
  9112. }
  9113. this.kept = h(tag, null, kept);
  9114. this.removed = removed;
  9115. }
  9116. return h(tag, null, children);
  9117. },
  9118. updated: function () {
  9119. var children = this.prevChildren;
  9120. var moveClass = this.moveClass || (this.name || 'v') + '-move';
  9121. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  9122. return;
  9123. }
  9124. // we divide the work into three loops to avoid mixing DOM reads and writes
  9125. // in each iteration - which helps prevent layout thrashing.
  9126. children.forEach(callPendingCbs);
  9127. children.forEach(recordPosition);
  9128. children.forEach(applyTranslation);
  9129. // force reflow to put everything in position
  9130. // assign to this to avoid being removed in tree-shaking
  9131. // $flow-disable-line
  9132. this._reflow = document.body.offsetHeight;
  9133. children.forEach(function (c) {
  9134. if (c.data.moved) {
  9135. var el_1 = c.elm;
  9136. var s = el_1.style;
  9137. addTransitionClass(el_1, moveClass);
  9138. s.transform = s.WebkitTransform = s.transitionDuration = '';
  9139. el_1.addEventListener(transitionEndEvent, (el_1._moveCb = function cb(e) {
  9140. if (e && e.target !== el_1) {
  9141. return;
  9142. }
  9143. if (!e || /transform$/.test(e.propertyName)) {
  9144. el_1.removeEventListener(transitionEndEvent, cb);
  9145. el_1._moveCb = null;
  9146. removeTransitionClass(el_1, moveClass);
  9147. }
  9148. }));
  9149. }
  9150. });
  9151. },
  9152. methods: {
  9153. hasMove: function (el, moveClass) {
  9154. /* istanbul ignore if */
  9155. if (!hasTransition) {
  9156. return false;
  9157. }
  9158. /* istanbul ignore if */
  9159. if (this._hasMove) {
  9160. return this._hasMove;
  9161. }
  9162. // Detect whether an element with the move class applied has
  9163. // CSS transitions. Since the element may be inside an entering
  9164. // transition at this very moment, we make a clone of it and remove
  9165. // all other transition classes applied to ensure only the move class
  9166. // is applied.
  9167. var clone = el.cloneNode();
  9168. if (el._transitionClasses) {
  9169. el._transitionClasses.forEach(function (cls) {
  9170. removeClass(clone, cls);
  9171. });
  9172. }
  9173. addClass(clone, moveClass);
  9174. clone.style.display = 'none';
  9175. this.$el.appendChild(clone);
  9176. var info = getTransitionInfo(clone);
  9177. this.$el.removeChild(clone);
  9178. return (this._hasMove = info.hasTransform);
  9179. }
  9180. }
  9181. };
  9182. function callPendingCbs(c) {
  9183. /* istanbul ignore if */
  9184. if (c.elm._moveCb) {
  9185. c.elm._moveCb();
  9186. }
  9187. /* istanbul ignore if */
  9188. if (c.elm._enterCb) {
  9189. c.elm._enterCb();
  9190. }
  9191. }
  9192. function recordPosition(c) {
  9193. c.data.newPos = c.elm.getBoundingClientRect();
  9194. }
  9195. function applyTranslation(c) {
  9196. var oldPos = c.data.pos;
  9197. var newPos = c.data.newPos;
  9198. var dx = oldPos.left - newPos.left;
  9199. var dy = oldPos.top - newPos.top;
  9200. if (dx || dy) {
  9201. c.data.moved = true;
  9202. var s = c.elm.style;
  9203. s.transform = s.WebkitTransform = "translate(".concat(dx, "px,").concat(dy, "px)");
  9204. s.transitionDuration = '0s';
  9205. }
  9206. }
  9207. var platformComponents = {
  9208. Transition: Transition,
  9209. TransitionGroup: TransitionGroup
  9210. };
  9211. // install platform specific utils
  9212. Vue.config.mustUseProp = mustUseProp;
  9213. Vue.config.isReservedTag = isReservedTag;
  9214. Vue.config.isReservedAttr = isReservedAttr;
  9215. Vue.config.getTagNamespace = getTagNamespace;
  9216. Vue.config.isUnknownElement = isUnknownElement;
  9217. // install platform runtime directives & components
  9218. extend(Vue.options.directives, platformDirectives);
  9219. extend(Vue.options.components, platformComponents);
  9220. // install platform patch function
  9221. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  9222. // public mount method
  9223. Vue.prototype.$mount = function (el, hydrating) {
  9224. el = el && inBrowser ? query(el) : undefined;
  9225. return mountComponent(this, el, hydrating);
  9226. };
  9227. // devtools global hook
  9228. /* istanbul ignore next */
  9229. if (inBrowser) {
  9230. setTimeout(function () {
  9231. if (config.devtools) {
  9232. if (devtools) {
  9233. devtools.emit('init', Vue);
  9234. }
  9235. else {
  9236. // @ts-expect-error
  9237. console[console.info ? 'info' : 'log']('Download the Vue Devtools extension for a better development experience:\n' +
  9238. 'https://github.com/vuejs/vue-devtools');
  9239. }
  9240. }
  9241. if (config.productionTip !== false &&
  9242. typeof console !== 'undefined') {
  9243. // @ts-expect-error
  9244. console[console.info ? 'info' : 'log']("You are running Vue in development mode.\n" +
  9245. "Make sure to turn on production mode when deploying for production.\n" +
  9246. "See more tips at https://vuejs.org/guide/deployment.html");
  9247. }
  9248. }, 0);
  9249. }
  9250. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  9251. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  9252. var buildRegex = cached(function (delimiters) {
  9253. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  9254. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  9255. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g');
  9256. });
  9257. function parseText(text, delimiters) {
  9258. //@ts-expect-error
  9259. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  9260. if (!tagRE.test(text)) {
  9261. return;
  9262. }
  9263. var tokens = [];
  9264. var rawTokens = [];
  9265. var lastIndex = (tagRE.lastIndex = 0);
  9266. var match, index, tokenValue;
  9267. while ((match = tagRE.exec(text))) {
  9268. index = match.index;
  9269. // push text token
  9270. if (index > lastIndex) {
  9271. rawTokens.push((tokenValue = text.slice(lastIndex, index)));
  9272. tokens.push(JSON.stringify(tokenValue));
  9273. }
  9274. // tag token
  9275. var exp = parseFilters(match[1].trim());
  9276. tokens.push("_s(".concat(exp, ")"));
  9277. rawTokens.push({ '@binding': exp });
  9278. lastIndex = index + match[0].length;
  9279. }
  9280. if (lastIndex < text.length) {
  9281. rawTokens.push((tokenValue = text.slice(lastIndex)));
  9282. tokens.push(JSON.stringify(tokenValue));
  9283. }
  9284. return {
  9285. expression: tokens.join('+'),
  9286. tokens: rawTokens
  9287. };
  9288. }
  9289. function transformNode$1(el, options) {
  9290. var warn = options.warn || baseWarn;
  9291. var staticClass = getAndRemoveAttr(el, 'class');
  9292. if (staticClass) {
  9293. var res = parseText(staticClass, options.delimiters);
  9294. if (res) {
  9295. warn("class=\"".concat(staticClass, "\": ") +
  9296. 'Interpolation inside attributes has been removed. ' +
  9297. 'Use v-bind or the colon shorthand instead. For example, ' +
  9298. 'instead of <div class="{{ val }}">, use <div :class="val">.', el.rawAttrsMap['class']);
  9299. }
  9300. }
  9301. if (staticClass) {
  9302. el.staticClass = JSON.stringify(staticClass.replace(/\s+/g, ' ').trim());
  9303. }
  9304. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  9305. if (classBinding) {
  9306. el.classBinding = classBinding;
  9307. }
  9308. }
  9309. function genData$2(el) {
  9310. var data = '';
  9311. if (el.staticClass) {
  9312. data += "staticClass:".concat(el.staticClass, ",");
  9313. }
  9314. if (el.classBinding) {
  9315. data += "class:".concat(el.classBinding, ",");
  9316. }
  9317. return data;
  9318. }
  9319. var klass = {
  9320. staticKeys: ['staticClass'],
  9321. transformNode: transformNode$1,
  9322. genData: genData$2
  9323. };
  9324. function transformNode(el, options) {
  9325. var warn = options.warn || baseWarn;
  9326. var staticStyle = getAndRemoveAttr(el, 'style');
  9327. if (staticStyle) {
  9328. /* istanbul ignore if */
  9329. {
  9330. var res = parseText(staticStyle, options.delimiters);
  9331. if (res) {
  9332. warn("style=\"".concat(staticStyle, "\": ") +
  9333. 'Interpolation inside attributes has been removed. ' +
  9334. 'Use v-bind or the colon shorthand instead. For example, ' +
  9335. 'instead of <div style="{{ val }}">, use <div :style="val">.', el.rawAttrsMap['style']);
  9336. }
  9337. }
  9338. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  9339. }
  9340. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  9341. if (styleBinding) {
  9342. el.styleBinding = styleBinding;
  9343. }
  9344. }
  9345. function genData$1(el) {
  9346. var data = '';
  9347. if (el.staticStyle) {
  9348. data += "staticStyle:".concat(el.staticStyle, ",");
  9349. }
  9350. if (el.styleBinding) {
  9351. data += "style:(".concat(el.styleBinding, "),");
  9352. }
  9353. return data;
  9354. }
  9355. var style = {
  9356. staticKeys: ['staticStyle'],
  9357. transformNode: transformNode,
  9358. genData: genData$1
  9359. };
  9360. var decoder;
  9361. var he = {
  9362. decode: function (html) {
  9363. decoder = decoder || document.createElement('div');
  9364. decoder.innerHTML = html;
  9365. return decoder.textContent;
  9366. }
  9367. };
  9368. var isUnaryTag = makeMap('area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  9369. 'link,meta,param,source,track,wbr');
  9370. // Elements that you can, intentionally, leave open
  9371. // (and which close themselves)
  9372. var canBeLeftOpenTag = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source');
  9373. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  9374. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  9375. var isNonPhrasingTag = makeMap('address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  9376. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  9377. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  9378. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  9379. 'title,tr,track');
  9380. /**
  9381. * Not type-checking this file because it's mostly vendor code.
  9382. */
  9383. // Regular Expressions for parsing tags and attributes
  9384. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  9385. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  9386. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z".concat(unicodeRegExp.source, "]*");
  9387. var qnameCapture = "((?:".concat(ncname, "\\:)?").concat(ncname, ")");
  9388. var startTagOpen = new RegExp("^<".concat(qnameCapture));
  9389. var startTagClose = /^\s*(\/?)>/;
  9390. var endTag = new RegExp("^<\\/".concat(qnameCapture, "[^>]*>"));
  9391. var doctype = /^<!DOCTYPE [^>]+>/i;
  9392. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  9393. var comment = /^<!\--/;
  9394. var conditionalComment = /^<!\[/;
  9395. // Special Elements (can contain anything)
  9396. var isPlainTextElement = makeMap('script,style,textarea', true);
  9397. var reCache = {};
  9398. var decodingMap = {
  9399. '&lt;': '<',
  9400. '&gt;': '>',
  9401. '&quot;': '"',
  9402. '&amp;': '&',
  9403. '&#10;': '\n',
  9404. '&#9;': '\t',
  9405. '&#39;': "'"
  9406. };
  9407. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  9408. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  9409. // #5992
  9410. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  9411. var shouldIgnoreFirstNewline = function (tag, html) {
  9412. return tag && isIgnoreNewlineTag(tag) && html[0] === '\n';
  9413. };
  9414. function decodeAttr(value, shouldDecodeNewlines) {
  9415. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  9416. return value.replace(re, function (match) { return decodingMap[match]; });
  9417. }
  9418. function parseHTML(html, options) {
  9419. var stack = [];
  9420. var expectHTML = options.expectHTML;
  9421. var isUnaryTag = options.isUnaryTag || no;
  9422. var canBeLeftOpenTag = options.canBeLeftOpenTag || no;
  9423. var index = 0;
  9424. var last, lastTag;
  9425. var _loop_1 = function () {
  9426. last = html;
  9427. // Make sure we're not in a plaintext content element like script/style
  9428. if (!lastTag || !isPlainTextElement(lastTag)) {
  9429. var textEnd = html.indexOf('<');
  9430. if (textEnd === 0) {
  9431. // Comment:
  9432. if (comment.test(html)) {
  9433. var commentEnd = html.indexOf('-->');
  9434. if (commentEnd >= 0) {
  9435. if (options.shouldKeepComment && options.comment) {
  9436. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  9437. }
  9438. advance(commentEnd + 3);
  9439. return "continue";
  9440. }
  9441. }
  9442. // https://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  9443. if (conditionalComment.test(html)) {
  9444. var conditionalEnd = html.indexOf(']>');
  9445. if (conditionalEnd >= 0) {
  9446. advance(conditionalEnd + 2);
  9447. return "continue";
  9448. }
  9449. }
  9450. // Doctype:
  9451. var doctypeMatch = html.match(doctype);
  9452. if (doctypeMatch) {
  9453. advance(doctypeMatch[0].length);
  9454. return "continue";
  9455. }
  9456. // End tag:
  9457. var endTagMatch = html.match(endTag);
  9458. if (endTagMatch) {
  9459. var curIndex = index;
  9460. advance(endTagMatch[0].length);
  9461. parseEndTag(endTagMatch[1], curIndex, index);
  9462. return "continue";
  9463. }
  9464. // Start tag:
  9465. var startTagMatch = parseStartTag();
  9466. if (startTagMatch) {
  9467. handleStartTag(startTagMatch);
  9468. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  9469. advance(1);
  9470. }
  9471. return "continue";
  9472. }
  9473. }
  9474. var text = void 0, rest = void 0, next = void 0;
  9475. if (textEnd >= 0) {
  9476. rest = html.slice(textEnd);
  9477. while (!endTag.test(rest) &&
  9478. !startTagOpen.test(rest) &&
  9479. !comment.test(rest) &&
  9480. !conditionalComment.test(rest)) {
  9481. // < in plain text, be forgiving and treat it as text
  9482. next = rest.indexOf('<', 1);
  9483. if (next < 0)
  9484. break;
  9485. textEnd += next;
  9486. rest = html.slice(textEnd);
  9487. }
  9488. text = html.substring(0, textEnd);
  9489. }
  9490. if (textEnd < 0) {
  9491. text = html;
  9492. }
  9493. if (text) {
  9494. advance(text.length);
  9495. }
  9496. if (options.chars && text) {
  9497. options.chars(text, index - text.length, index);
  9498. }
  9499. }
  9500. else {
  9501. var endTagLength_1 = 0;
  9502. var stackedTag_1 = lastTag.toLowerCase();
  9503. var reStackedTag = reCache[stackedTag_1] ||
  9504. (reCache[stackedTag_1] = new RegExp('([\\s\\S]*?)(</' + stackedTag_1 + '[^>]*>)', 'i'));
  9505. var rest = html.replace(reStackedTag, function (all, text, endTag) {
  9506. endTagLength_1 = endTag.length;
  9507. if (!isPlainTextElement(stackedTag_1) && stackedTag_1 !== 'noscript') {
  9508. text = text
  9509. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  9510. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  9511. }
  9512. if (shouldIgnoreFirstNewline(stackedTag_1, text)) {
  9513. text = text.slice(1);
  9514. }
  9515. if (options.chars) {
  9516. options.chars(text);
  9517. }
  9518. return '';
  9519. });
  9520. index += html.length - rest.length;
  9521. html = rest;
  9522. parseEndTag(stackedTag_1, index - endTagLength_1, index);
  9523. }
  9524. if (html === last) {
  9525. options.chars && options.chars(html);
  9526. if (!stack.length && options.warn) {
  9527. options.warn("Mal-formatted tag at end of template: \"".concat(html, "\""), {
  9528. start: index + html.length
  9529. });
  9530. }
  9531. return "break";
  9532. }
  9533. };
  9534. while (html) {
  9535. var state_1 = _loop_1();
  9536. if (state_1 === "break")
  9537. break;
  9538. }
  9539. // Clean up any remaining tags
  9540. parseEndTag();
  9541. function advance(n) {
  9542. index += n;
  9543. html = html.substring(n);
  9544. }
  9545. function parseStartTag() {
  9546. var start = html.match(startTagOpen);
  9547. if (start) {
  9548. var match = {
  9549. tagName: start[1],
  9550. attrs: [],
  9551. start: index
  9552. };
  9553. advance(start[0].length);
  9554. var end = void 0, attr = void 0;
  9555. while (!(end = html.match(startTagClose)) &&
  9556. (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  9557. attr.start = index;
  9558. advance(attr[0].length);
  9559. attr.end = index;
  9560. match.attrs.push(attr);
  9561. }
  9562. if (end) {
  9563. match.unarySlash = end[1];
  9564. advance(end[0].length);
  9565. match.end = index;
  9566. return match;
  9567. }
  9568. }
  9569. }
  9570. function handleStartTag(match) {
  9571. var tagName = match.tagName;
  9572. var unarySlash = match.unarySlash;
  9573. if (expectHTML) {
  9574. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  9575. parseEndTag(lastTag);
  9576. }
  9577. if (canBeLeftOpenTag(tagName) && lastTag === tagName) {
  9578. parseEndTag(tagName);
  9579. }
  9580. }
  9581. var unary = isUnaryTag(tagName) || !!unarySlash;
  9582. var l = match.attrs.length;
  9583. var attrs = new Array(l);
  9584. for (var i = 0; i < l; i++) {
  9585. var args = match.attrs[i];
  9586. var value = args[3] || args[4] || args[5] || '';
  9587. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  9588. ? options.shouldDecodeNewlinesForHref
  9589. : options.shouldDecodeNewlines;
  9590. attrs[i] = {
  9591. name: args[1],
  9592. value: decodeAttr(value, shouldDecodeNewlines)
  9593. };
  9594. if (options.outputSourceRange) {
  9595. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  9596. attrs[i].end = args.end;
  9597. }
  9598. }
  9599. if (!unary) {
  9600. stack.push({
  9601. tag: tagName,
  9602. lowerCasedTag: tagName.toLowerCase(),
  9603. attrs: attrs,
  9604. start: match.start,
  9605. end: match.end
  9606. });
  9607. lastTag = tagName;
  9608. }
  9609. if (options.start) {
  9610. options.start(tagName, attrs, unary, match.start, match.end);
  9611. }
  9612. }
  9613. function parseEndTag(tagName, start, end) {
  9614. var pos, lowerCasedTagName;
  9615. if (start == null)
  9616. start = index;
  9617. if (end == null)
  9618. end = index;
  9619. // Find the closest opened tag of the same type
  9620. if (tagName) {
  9621. lowerCasedTagName = tagName.toLowerCase();
  9622. for (pos = stack.length - 1; pos >= 0; pos--) {
  9623. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  9624. break;
  9625. }
  9626. }
  9627. }
  9628. else {
  9629. // If no tag name is provided, clean shop
  9630. pos = 0;
  9631. }
  9632. if (pos >= 0) {
  9633. // Close all the open elements, up the stack
  9634. for (var i = stack.length - 1; i >= pos; i--) {
  9635. if ((i > pos || !tagName) && options.warn) {
  9636. options.warn("tag <".concat(stack[i].tag, "> has no matching end tag."), {
  9637. start: stack[i].start,
  9638. end: stack[i].end
  9639. });
  9640. }
  9641. if (options.end) {
  9642. options.end(stack[i].tag, start, end);
  9643. }
  9644. }
  9645. // Remove the open elements from the stack
  9646. stack.length = pos;
  9647. lastTag = pos && stack[pos - 1].tag;
  9648. }
  9649. else if (lowerCasedTagName === 'br') {
  9650. if (options.start) {
  9651. options.start(tagName, [], true, start, end);
  9652. }
  9653. }
  9654. else if (lowerCasedTagName === 'p') {
  9655. if (options.start) {
  9656. options.start(tagName, [], false, start, end);
  9657. }
  9658. if (options.end) {
  9659. options.end(tagName, start, end);
  9660. }
  9661. }
  9662. }
  9663. }
  9664. var onRE = /^@|^v-on:/;
  9665. var dirRE = /^v-|^@|^:|^#/;
  9666. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  9667. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  9668. var stripParensRE = /^\(|\)$/g;
  9669. var dynamicArgRE = /^\[.*\]$/;
  9670. var argRE = /:(.*)$/;
  9671. var bindRE = /^:|^\.|^v-bind:/;
  9672. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  9673. var slotRE = /^v-slot(:|$)|^#/;
  9674. var lineBreakRE = /[\r\n]/;
  9675. var whitespaceRE = /[ \f\t\r\n]+/g;
  9676. var invalidAttributeRE = /[\s"'<>\/=]/;
  9677. var decodeHTMLCached = cached(he.decode);
  9678. var emptySlotScopeToken = "_empty_";
  9679. // configurable state
  9680. var warn;
  9681. var delimiters;
  9682. var transforms;
  9683. var preTransforms;
  9684. var postTransforms;
  9685. var platformIsPreTag;
  9686. var platformMustUseProp;
  9687. var platformGetTagNamespace;
  9688. var maybeComponent;
  9689. function createASTElement(tag, attrs, parent) {
  9690. return {
  9691. type: 1,
  9692. tag: tag,
  9693. attrsList: attrs,
  9694. attrsMap: makeAttrsMap(attrs),
  9695. rawAttrsMap: {},
  9696. parent: parent,
  9697. children: []
  9698. };
  9699. }
  9700. /**
  9701. * Convert HTML string to AST.
  9702. */
  9703. function parse(template, options) {
  9704. warn = options.warn || baseWarn;
  9705. platformIsPreTag = options.isPreTag || no;
  9706. platformMustUseProp = options.mustUseProp || no;
  9707. platformGetTagNamespace = options.getTagNamespace || no;
  9708. var isReservedTag = options.isReservedTag || no;
  9709. maybeComponent = function (el) {
  9710. return !!(el.component ||
  9711. el.attrsMap[':is'] ||
  9712. el.attrsMap['v-bind:is'] ||
  9713. !(el.attrsMap.is ? isReservedTag(el.attrsMap.is) : isReservedTag(el.tag)));
  9714. };
  9715. transforms = pluckModuleFunction(options.modules, 'transformNode');
  9716. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  9717. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  9718. delimiters = options.delimiters;
  9719. var stack = [];
  9720. var preserveWhitespace = options.preserveWhitespace !== false;
  9721. var whitespaceOption = options.whitespace;
  9722. var root;
  9723. var currentParent;
  9724. var inVPre = false;
  9725. var inPre = false;
  9726. var warned = false;
  9727. function warnOnce(msg, range) {
  9728. if (!warned) {
  9729. warned = true;
  9730. warn(msg, range);
  9731. }
  9732. }
  9733. function closeElement(element) {
  9734. trimEndingWhitespace(element);
  9735. if (!inVPre && !element.processed) {
  9736. element = processElement(element, options);
  9737. }
  9738. // tree management
  9739. if (!stack.length && element !== root) {
  9740. // allow root elements with v-if, v-else-if and v-else
  9741. if (root.if && (element.elseif || element.else)) {
  9742. {
  9743. checkRootConstraints(element);
  9744. }
  9745. addIfCondition(root, {
  9746. exp: element.elseif,
  9747. block: element
  9748. });
  9749. }
  9750. else {
  9751. warnOnce("Component template should contain exactly one root element. " +
  9752. "If you are using v-if on multiple elements, " +
  9753. "use v-else-if to chain them instead.", { start: element.start });
  9754. }
  9755. }
  9756. if (currentParent && !element.forbidden) {
  9757. if (element.elseif || element.else) {
  9758. processIfConditions(element, currentParent);
  9759. }
  9760. else {
  9761. if (element.slotScope) {
  9762. // scoped slot
  9763. // keep it in the children list so that v-else(-if) conditions can
  9764. // find it as the prev node.
  9765. var name_1 = element.slotTarget || '"default"';
  9766. (currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name_1] = element;
  9767. }
  9768. currentParent.children.push(element);
  9769. element.parent = currentParent;
  9770. }
  9771. }
  9772. // final children cleanup
  9773. // filter out scoped slots
  9774. element.children = element.children.filter(function (c) { return !c.slotScope; });
  9775. // remove trailing whitespace node again
  9776. trimEndingWhitespace(element);
  9777. // check pre state
  9778. if (element.pre) {
  9779. inVPre = false;
  9780. }
  9781. if (platformIsPreTag(element.tag)) {
  9782. inPre = false;
  9783. }
  9784. // apply post-transforms
  9785. for (var i = 0; i < postTransforms.length; i++) {
  9786. postTransforms[i](element, options);
  9787. }
  9788. }
  9789. function trimEndingWhitespace(el) {
  9790. // remove trailing whitespace node
  9791. if (!inPre) {
  9792. var lastNode = void 0;
  9793. while ((lastNode = el.children[el.children.length - 1]) &&
  9794. lastNode.type === 3 &&
  9795. lastNode.text === ' ') {
  9796. el.children.pop();
  9797. }
  9798. }
  9799. }
  9800. function checkRootConstraints(el) {
  9801. if (el.tag === 'slot' || el.tag === 'template') {
  9802. warnOnce("Cannot use <".concat(el.tag, "> as component root element because it may ") +
  9803. 'contain multiple nodes.', { start: el.start });
  9804. }
  9805. if (el.attrsMap.hasOwnProperty('v-for')) {
  9806. warnOnce('Cannot use v-for on stateful component root element because ' +
  9807. 'it renders multiple elements.', el.rawAttrsMap['v-for']);
  9808. }
  9809. }
  9810. parseHTML(template, {
  9811. warn: warn,
  9812. expectHTML: options.expectHTML,
  9813. isUnaryTag: options.isUnaryTag,
  9814. canBeLeftOpenTag: options.canBeLeftOpenTag,
  9815. shouldDecodeNewlines: options.shouldDecodeNewlines,
  9816. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  9817. shouldKeepComment: options.comments,
  9818. outputSourceRange: options.outputSourceRange,
  9819. start: function (tag, attrs, unary, start, end) {
  9820. // check namespace.
  9821. // inherit parent ns if there is one
  9822. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  9823. // handle IE svg bug
  9824. /* istanbul ignore if */
  9825. if (isIE && ns === 'svg') {
  9826. attrs = guardIESVGBug(attrs);
  9827. }
  9828. var element = createASTElement(tag, attrs, currentParent);
  9829. if (ns) {
  9830. element.ns = ns;
  9831. }
  9832. {
  9833. if (options.outputSourceRange) {
  9834. element.start = start;
  9835. element.end = end;
  9836. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  9837. cumulated[attr.name] = attr;
  9838. return cumulated;
  9839. }, {});
  9840. }
  9841. attrs.forEach(function (attr) {
  9842. if (invalidAttributeRE.test(attr.name)) {
  9843. warn("Invalid dynamic argument expression: attribute names cannot contain " +
  9844. "spaces, quotes, <, >, / or =.", options.outputSourceRange
  9845. ? {
  9846. start: attr.start + attr.name.indexOf("["),
  9847. end: attr.start + attr.name.length
  9848. }
  9849. : undefined);
  9850. }
  9851. });
  9852. }
  9853. if (isForbiddenTag(element) && !isServerRendering()) {
  9854. element.forbidden = true;
  9855. warn('Templates should only be responsible for mapping the state to the ' +
  9856. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  9857. "<".concat(tag, ">") +
  9858. ', as they will not be parsed.', { start: element.start });
  9859. }
  9860. // apply pre-transforms
  9861. for (var i = 0; i < preTransforms.length; i++) {
  9862. element = preTransforms[i](element, options) || element;
  9863. }
  9864. if (!inVPre) {
  9865. processPre(element);
  9866. if (element.pre) {
  9867. inVPre = true;
  9868. }
  9869. }
  9870. if (platformIsPreTag(element.tag)) {
  9871. inPre = true;
  9872. }
  9873. if (inVPre) {
  9874. processRawAttrs(element);
  9875. }
  9876. else if (!element.processed) {
  9877. // structural directives
  9878. processFor(element);
  9879. processIf(element);
  9880. processOnce(element);
  9881. }
  9882. if (!root) {
  9883. root = element;
  9884. {
  9885. checkRootConstraints(root);
  9886. }
  9887. }
  9888. if (!unary) {
  9889. currentParent = element;
  9890. stack.push(element);
  9891. }
  9892. else {
  9893. closeElement(element);
  9894. }
  9895. },
  9896. end: function (tag, start, end) {
  9897. var element = stack[stack.length - 1];
  9898. // pop stack
  9899. stack.length -= 1;
  9900. currentParent = stack[stack.length - 1];
  9901. if (options.outputSourceRange) {
  9902. element.end = end;
  9903. }
  9904. closeElement(element);
  9905. },
  9906. chars: function (text, start, end) {
  9907. if (!currentParent) {
  9908. {
  9909. if (text === template) {
  9910. warnOnce('Component template requires a root element, rather than just text.', { start: start });
  9911. }
  9912. else if ((text = text.trim())) {
  9913. warnOnce("text \"".concat(text, "\" outside root element will be ignored."), {
  9914. start: start
  9915. });
  9916. }
  9917. }
  9918. return;
  9919. }
  9920. // IE textarea placeholder bug
  9921. /* istanbul ignore if */
  9922. if (isIE &&
  9923. currentParent.tag === 'textarea' &&
  9924. currentParent.attrsMap.placeholder === text) {
  9925. return;
  9926. }
  9927. var children = currentParent.children;
  9928. if (inPre || text.trim()) {
  9929. text = isTextTag(currentParent)
  9930. ? text
  9931. : decodeHTMLCached(text);
  9932. }
  9933. else if (!children.length) {
  9934. // remove the whitespace-only node right after an opening tag
  9935. text = '';
  9936. }
  9937. else if (whitespaceOption) {
  9938. if (whitespaceOption === 'condense') {
  9939. // in condense mode, remove the whitespace node if it contains
  9940. // line break, otherwise condense to a single space
  9941. text = lineBreakRE.test(text) ? '' : ' ';
  9942. }
  9943. else {
  9944. text = ' ';
  9945. }
  9946. }
  9947. else {
  9948. text = preserveWhitespace ? ' ' : '';
  9949. }
  9950. if (text) {
  9951. if (!inPre && whitespaceOption === 'condense') {
  9952. // condense consecutive whitespaces into single space
  9953. text = text.replace(whitespaceRE, ' ');
  9954. }
  9955. var res = void 0;
  9956. var child = void 0;
  9957. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  9958. child = {
  9959. type: 2,
  9960. expression: res.expression,
  9961. tokens: res.tokens,
  9962. text: text
  9963. };
  9964. }
  9965. else if (text !== ' ' ||
  9966. !children.length ||
  9967. children[children.length - 1].text !== ' ') {
  9968. child = {
  9969. type: 3,
  9970. text: text
  9971. };
  9972. }
  9973. if (child) {
  9974. if (options.outputSourceRange) {
  9975. child.start = start;
  9976. child.end = end;
  9977. }
  9978. children.push(child);
  9979. }
  9980. }
  9981. },
  9982. comment: function (text, start, end) {
  9983. // adding anything as a sibling to the root node is forbidden
  9984. // comments should still be allowed, but ignored
  9985. if (currentParent) {
  9986. var child = {
  9987. type: 3,
  9988. text: text,
  9989. isComment: true
  9990. };
  9991. if (options.outputSourceRange) {
  9992. child.start = start;
  9993. child.end = end;
  9994. }
  9995. currentParent.children.push(child);
  9996. }
  9997. }
  9998. });
  9999. return root;
  10000. }
  10001. function processPre(el) {
  10002. if (getAndRemoveAttr(el, 'v-pre') != null) {
  10003. el.pre = true;
  10004. }
  10005. }
  10006. function processRawAttrs(el) {
  10007. var list = el.attrsList;
  10008. var len = list.length;
  10009. if (len) {
  10010. var attrs = (el.attrs = new Array(len));
  10011. for (var i = 0; i < len; i++) {
  10012. attrs[i] = {
  10013. name: list[i].name,
  10014. value: JSON.stringify(list[i].value)
  10015. };
  10016. if (list[i].start != null) {
  10017. attrs[i].start = list[i].start;
  10018. attrs[i].end = list[i].end;
  10019. }
  10020. }
  10021. }
  10022. else if (!el.pre) {
  10023. // non root node in pre blocks with no attributes
  10024. el.plain = true;
  10025. }
  10026. }
  10027. function processElement(element, options) {
  10028. processKey(element);
  10029. // determine whether this is a plain element after
  10030. // removing structural attributes
  10031. element.plain =
  10032. !element.key && !element.scopedSlots && !element.attrsList.length;
  10033. processRef(element);
  10034. processSlotContent(element);
  10035. processSlotOutlet(element);
  10036. processComponent(element);
  10037. for (var i = 0; i < transforms.length; i++) {
  10038. element = transforms[i](element, options) || element;
  10039. }
  10040. processAttrs(element);
  10041. return element;
  10042. }
  10043. function processKey(el) {
  10044. var exp = getBindingAttr(el, 'key');
  10045. if (exp) {
  10046. {
  10047. if (el.tag === 'template') {
  10048. warn("<template> cannot be keyed. Place the key on real elements instead.", getRawBindingAttr(el, 'key'));
  10049. }
  10050. if (el.for) {
  10051. var iterator = el.iterator2 || el.iterator1;
  10052. var parent_1 = el.parent;
  10053. if (iterator &&
  10054. iterator === exp &&
  10055. parent_1 &&
  10056. parent_1.tag === 'transition-group') {
  10057. warn("Do not use v-for index as key on <transition-group> children, " +
  10058. "this is the same as not using keys.", getRawBindingAttr(el, 'key'), true /* tip */);
  10059. }
  10060. }
  10061. }
  10062. el.key = exp;
  10063. }
  10064. }
  10065. function processRef(el) {
  10066. var ref = getBindingAttr(el, 'ref');
  10067. if (ref) {
  10068. el.ref = ref;
  10069. el.refInFor = checkInFor(el);
  10070. }
  10071. }
  10072. function processFor(el) {
  10073. var exp;
  10074. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  10075. var res = parseFor(exp);
  10076. if (res) {
  10077. extend(el, res);
  10078. }
  10079. else {
  10080. warn("Invalid v-for expression: ".concat(exp), el.rawAttrsMap['v-for']);
  10081. }
  10082. }
  10083. }
  10084. function parseFor(exp) {
  10085. var inMatch = exp.match(forAliasRE);
  10086. if (!inMatch)
  10087. return;
  10088. var res = {};
  10089. res.for = inMatch[2].trim();
  10090. var alias = inMatch[1].trim().replace(stripParensRE, '');
  10091. var iteratorMatch = alias.match(forIteratorRE);
  10092. if (iteratorMatch) {
  10093. res.alias = alias.replace(forIteratorRE, '').trim();
  10094. res.iterator1 = iteratorMatch[1].trim();
  10095. if (iteratorMatch[2]) {
  10096. res.iterator2 = iteratorMatch[2].trim();
  10097. }
  10098. }
  10099. else {
  10100. res.alias = alias;
  10101. }
  10102. return res;
  10103. }
  10104. function processIf(el) {
  10105. var exp = getAndRemoveAttr(el, 'v-if');
  10106. if (exp) {
  10107. el.if = exp;
  10108. addIfCondition(el, {
  10109. exp: exp,
  10110. block: el
  10111. });
  10112. }
  10113. else {
  10114. if (getAndRemoveAttr(el, 'v-else') != null) {
  10115. el.else = true;
  10116. }
  10117. var elseif = getAndRemoveAttr(el, 'v-else-if');
  10118. if (elseif) {
  10119. el.elseif = elseif;
  10120. }
  10121. }
  10122. }
  10123. function processIfConditions(el, parent) {
  10124. var prev = findPrevElement(parent.children);
  10125. if (prev && prev.if) {
  10126. addIfCondition(prev, {
  10127. exp: el.elseif,
  10128. block: el
  10129. });
  10130. }
  10131. else {
  10132. warn("v-".concat(el.elseif ? 'else-if="' + el.elseif + '"' : 'else', " ") +
  10133. "used on element <".concat(el.tag, "> without corresponding v-if."), el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']);
  10134. }
  10135. }
  10136. function findPrevElement(children) {
  10137. var i = children.length;
  10138. while (i--) {
  10139. if (children[i].type === 1) {
  10140. return children[i];
  10141. }
  10142. else {
  10143. if (children[i].text !== ' ') {
  10144. warn("text \"".concat(children[i].text.trim(), "\" between v-if and v-else(-if) ") +
  10145. "will be ignored.", children[i]);
  10146. }
  10147. children.pop();
  10148. }
  10149. }
  10150. }
  10151. function addIfCondition(el, condition) {
  10152. if (!el.ifConditions) {
  10153. el.ifConditions = [];
  10154. }
  10155. el.ifConditions.push(condition);
  10156. }
  10157. function processOnce(el) {
  10158. var once = getAndRemoveAttr(el, 'v-once');
  10159. if (once != null) {
  10160. el.once = true;
  10161. }
  10162. }
  10163. // handle content being passed to a component as slot,
  10164. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  10165. function processSlotContent(el) {
  10166. var slotScope;
  10167. if (el.tag === 'template') {
  10168. slotScope = getAndRemoveAttr(el, 'scope');
  10169. /* istanbul ignore if */
  10170. if (slotScope) {
  10171. warn("the \"scope\" attribute for scoped slots have been deprecated and " +
  10172. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  10173. "can also be used on plain elements in addition to <template> to " +
  10174. "denote scoped slots.", el.rawAttrsMap['scope'], true);
  10175. }
  10176. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  10177. }
  10178. else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  10179. /* istanbul ignore if */
  10180. if (el.attrsMap['v-for']) {
  10181. warn("Ambiguous combined usage of slot-scope and v-for on <".concat(el.tag, "> ") +
  10182. "(v-for takes higher priority). Use a wrapper <template> for the " +
  10183. "scoped slot to make it clearer.", el.rawAttrsMap['slot-scope'], true);
  10184. }
  10185. el.slotScope = slotScope;
  10186. }
  10187. // slot="xxx"
  10188. var slotTarget = getBindingAttr(el, 'slot');
  10189. if (slotTarget) {
  10190. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  10191. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  10192. // preserve slot as an attribute for native shadow DOM compat
  10193. // only for non-scoped slots.
  10194. if (el.tag !== 'template' && !el.slotScope) {
  10195. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  10196. }
  10197. }
  10198. // 2.6 v-slot syntax
  10199. {
  10200. if (el.tag === 'template') {
  10201. // v-slot on <template>
  10202. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  10203. if (slotBinding) {
  10204. {
  10205. if (el.slotTarget || el.slotScope) {
  10206. warn("Unexpected mixed usage of different slot syntaxes.", el);
  10207. }
  10208. if (el.parent && !maybeComponent(el.parent)) {
  10209. warn("<template v-slot> can only appear at the root level inside " +
  10210. "the receiving component", el);
  10211. }
  10212. }
  10213. var _a = getSlotName(slotBinding), name_2 = _a.name, dynamic = _a.dynamic;
  10214. el.slotTarget = name_2;
  10215. el.slotTargetDynamic = dynamic;
  10216. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  10217. }
  10218. }
  10219. else {
  10220. // v-slot on component, denotes default slot
  10221. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  10222. if (slotBinding) {
  10223. {
  10224. if (!maybeComponent(el)) {
  10225. warn("v-slot can only be used on components or <template>.", slotBinding);
  10226. }
  10227. if (el.slotScope || el.slotTarget) {
  10228. warn("Unexpected mixed usage of different slot syntaxes.", el);
  10229. }
  10230. if (el.scopedSlots) {
  10231. warn("To avoid scope ambiguity, the default slot should also use " +
  10232. "<template> syntax when there are other named slots.", slotBinding);
  10233. }
  10234. }
  10235. // add the component's children to its default slot
  10236. var slots = el.scopedSlots || (el.scopedSlots = {});
  10237. var _b = getSlotName(slotBinding), name_3 = _b.name, dynamic = _b.dynamic;
  10238. var slotContainer_1 = (slots[name_3] = createASTElement('template', [], el));
  10239. slotContainer_1.slotTarget = name_3;
  10240. slotContainer_1.slotTargetDynamic = dynamic;
  10241. slotContainer_1.children = el.children.filter(function (c) {
  10242. if (!c.slotScope) {
  10243. c.parent = slotContainer_1;
  10244. return true;
  10245. }
  10246. });
  10247. slotContainer_1.slotScope = slotBinding.value || emptySlotScopeToken;
  10248. // remove children as they are returned from scopedSlots now
  10249. el.children = [];
  10250. // mark el non-plain so data gets generated
  10251. el.plain = false;
  10252. }
  10253. }
  10254. }
  10255. }
  10256. function getSlotName(binding) {
  10257. var name = binding.name.replace(slotRE, '');
  10258. if (!name) {
  10259. if (binding.name[0] !== '#') {
  10260. name = 'default';
  10261. }
  10262. else {
  10263. warn("v-slot shorthand syntax requires a slot name.", binding);
  10264. }
  10265. }
  10266. return dynamicArgRE.test(name)
  10267. ? // dynamic [name]
  10268. { name: name.slice(1, -1), dynamic: true }
  10269. : // static name
  10270. { name: "\"".concat(name, "\""), dynamic: false };
  10271. }
  10272. // handle <slot/> outlets
  10273. function processSlotOutlet(el) {
  10274. if (el.tag === 'slot') {
  10275. el.slotName = getBindingAttr(el, 'name');
  10276. if (el.key) {
  10277. warn("`key` does not work on <slot> because slots are abstract outlets " +
  10278. "and can possibly expand into multiple elements. " +
  10279. "Use the key on a wrapping element instead.", getRawBindingAttr(el, 'key'));
  10280. }
  10281. }
  10282. }
  10283. function processComponent(el) {
  10284. var binding;
  10285. if ((binding = getBindingAttr(el, 'is'))) {
  10286. el.component = binding;
  10287. }
  10288. if (getAndRemoveAttr(el, 'inline-template') != null) {
  10289. el.inlineTemplate = true;
  10290. }
  10291. }
  10292. function processAttrs(el) {
  10293. var list = el.attrsList;
  10294. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  10295. for (i = 0, l = list.length; i < l; i++) {
  10296. name = rawName = list[i].name;
  10297. value = list[i].value;
  10298. if (dirRE.test(name)) {
  10299. // mark element as dynamic
  10300. el.hasBindings = true;
  10301. // modifiers
  10302. modifiers = parseModifiers(name.replace(dirRE, ''));
  10303. // support .foo shorthand syntax for the .prop modifier
  10304. if (modifiers) {
  10305. name = name.replace(modifierRE, '');
  10306. }
  10307. if (bindRE.test(name)) {
  10308. // v-bind
  10309. name = name.replace(bindRE, '');
  10310. value = parseFilters(value);
  10311. isDynamic = dynamicArgRE.test(name);
  10312. if (isDynamic) {
  10313. name = name.slice(1, -1);
  10314. }
  10315. if (value.trim().length === 0) {
  10316. warn("The value for a v-bind expression cannot be empty. Found in \"v-bind:".concat(name, "\""));
  10317. }
  10318. if (modifiers) {
  10319. if (modifiers.prop && !isDynamic) {
  10320. name = camelize(name);
  10321. if (name === 'innerHtml')
  10322. name = 'innerHTML';
  10323. }
  10324. if (modifiers.camel && !isDynamic) {
  10325. name = camelize(name);
  10326. }
  10327. if (modifiers.sync) {
  10328. syncGen = genAssignmentCode(value, "$event");
  10329. if (!isDynamic) {
  10330. addHandler(el, "update:".concat(camelize(name)), syncGen, null, false, warn, list[i]);
  10331. if (hyphenate(name) !== camelize(name)) {
  10332. addHandler(el, "update:".concat(hyphenate(name)), syncGen, null, false, warn, list[i]);
  10333. }
  10334. }
  10335. else {
  10336. // handler w/ dynamic event name
  10337. addHandler(el, "\"update:\"+(".concat(name, ")"), syncGen, null, false, warn, list[i], true // dynamic
  10338. );
  10339. }
  10340. }
  10341. }
  10342. if ((modifiers && modifiers.prop) ||
  10343. (!el.component && platformMustUseProp(el.tag, el.attrsMap.type, name))) {
  10344. addProp(el, name, value, list[i], isDynamic);
  10345. }
  10346. else {
  10347. addAttr(el, name, value, list[i], isDynamic);
  10348. }
  10349. }
  10350. else if (onRE.test(name)) {
  10351. // v-on
  10352. name = name.replace(onRE, '');
  10353. isDynamic = dynamicArgRE.test(name);
  10354. if (isDynamic) {
  10355. name = name.slice(1, -1);
  10356. }
  10357. addHandler(el, name, value, modifiers, false, warn, list[i], isDynamic);
  10358. }
  10359. else {
  10360. // normal directives
  10361. name = name.replace(dirRE, '');
  10362. // parse arg
  10363. var argMatch = name.match(argRE);
  10364. var arg = argMatch && argMatch[1];
  10365. isDynamic = false;
  10366. if (arg) {
  10367. name = name.slice(0, -(arg.length + 1));
  10368. if (dynamicArgRE.test(arg)) {
  10369. arg = arg.slice(1, -1);
  10370. isDynamic = true;
  10371. }
  10372. }
  10373. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  10374. if (name === 'model') {
  10375. checkForAliasModel(el, value);
  10376. }
  10377. }
  10378. }
  10379. else {
  10380. // literal attribute
  10381. {
  10382. var res = parseText(value, delimiters);
  10383. if (res) {
  10384. warn("".concat(name, "=\"").concat(value, "\": ") +
  10385. 'Interpolation inside attributes has been removed. ' +
  10386. 'Use v-bind or the colon shorthand instead. For example, ' +
  10387. 'instead of <div id="{{ val }}">, use <div :id="val">.', list[i]);
  10388. }
  10389. }
  10390. addAttr(el, name, JSON.stringify(value), list[i]);
  10391. // #6887 firefox doesn't update muted state if set via attribute
  10392. // even immediately after element creation
  10393. if (!el.component &&
  10394. name === 'muted' &&
  10395. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  10396. addProp(el, name, 'true', list[i]);
  10397. }
  10398. }
  10399. }
  10400. }
  10401. function checkInFor(el) {
  10402. var parent = el;
  10403. while (parent) {
  10404. if (parent.for !== undefined) {
  10405. return true;
  10406. }
  10407. parent = parent.parent;
  10408. }
  10409. return false;
  10410. }
  10411. function parseModifiers(name) {
  10412. var match = name.match(modifierRE);
  10413. if (match) {
  10414. var ret_1 = {};
  10415. match.forEach(function (m) {
  10416. ret_1[m.slice(1)] = true;
  10417. });
  10418. return ret_1;
  10419. }
  10420. }
  10421. function makeAttrsMap(attrs) {
  10422. var map = {};
  10423. for (var i = 0, l = attrs.length; i < l; i++) {
  10424. if (map[attrs[i].name] && !isIE && !isEdge) {
  10425. warn('duplicate attribute: ' + attrs[i].name, attrs[i]);
  10426. }
  10427. map[attrs[i].name] = attrs[i].value;
  10428. }
  10429. return map;
  10430. }
  10431. // for script (e.g. type="x/template") or style, do not decode content
  10432. function isTextTag(el) {
  10433. return el.tag === 'script' || el.tag === 'style';
  10434. }
  10435. function isForbiddenTag(el) {
  10436. return (el.tag === 'style' ||
  10437. (el.tag === 'script' &&
  10438. (!el.attrsMap.type || el.attrsMap.type === 'text/javascript')));
  10439. }
  10440. var ieNSBug = /^xmlns:NS\d+/;
  10441. var ieNSPrefix = /^NS\d+:/;
  10442. /* istanbul ignore next */
  10443. function guardIESVGBug(attrs) {
  10444. var res = [];
  10445. for (var i = 0; i < attrs.length; i++) {
  10446. var attr = attrs[i];
  10447. if (!ieNSBug.test(attr.name)) {
  10448. attr.name = attr.name.replace(ieNSPrefix, '');
  10449. res.push(attr);
  10450. }
  10451. }
  10452. return res;
  10453. }
  10454. function checkForAliasModel(el, value) {
  10455. var _el = el;
  10456. while (_el) {
  10457. if (_el.for && _el.alias === value) {
  10458. warn("<".concat(el.tag, " v-model=\"").concat(value, "\">: ") +
  10459. "You are binding v-model directly to a v-for iteration alias. " +
  10460. "This will not be able to modify the v-for source array because " +
  10461. "writing to the alias is like modifying a function local variable. " +
  10462. "Consider using an array of objects and use v-model on an object property instead.", el.rawAttrsMap['v-model']);
  10463. }
  10464. _el = _el.parent;
  10465. }
  10466. }
  10467. /**
  10468. * Expand input[v-model] with dynamic type bindings into v-if-else chains
  10469. * Turn this:
  10470. * <input v-model="data[type]" :type="type">
  10471. * into this:
  10472. * <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]">
  10473. * <input v-else-if="type === 'radio'" type="radio" v-model="data[type]">
  10474. * <input v-else :type="type" v-model="data[type]">
  10475. */
  10476. function preTransformNode(el, options) {
  10477. if (el.tag === 'input') {
  10478. var map = el.attrsMap;
  10479. if (!map['v-model']) {
  10480. return;
  10481. }
  10482. var typeBinding = void 0;
  10483. if (map[':type'] || map['v-bind:type']) {
  10484. typeBinding = getBindingAttr(el, 'type');
  10485. }
  10486. if (!map.type && !typeBinding && map['v-bind']) {
  10487. typeBinding = "(".concat(map['v-bind'], ").type");
  10488. }
  10489. if (typeBinding) {
  10490. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  10491. var ifConditionExtra = ifCondition ? "&&(".concat(ifCondition, ")") : "";
  10492. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  10493. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  10494. // 1. checkbox
  10495. var branch0 = cloneASTElement(el);
  10496. // process for on the main node
  10497. processFor(branch0);
  10498. addRawAttr(branch0, 'type', 'checkbox');
  10499. processElement(branch0, options);
  10500. branch0.processed = true; // prevent it from double-processed
  10501. branch0.if = "(".concat(typeBinding, ")==='checkbox'") + ifConditionExtra;
  10502. addIfCondition(branch0, {
  10503. exp: branch0.if,
  10504. block: branch0
  10505. });
  10506. // 2. add radio else-if condition
  10507. var branch1 = cloneASTElement(el);
  10508. getAndRemoveAttr(branch1, 'v-for', true);
  10509. addRawAttr(branch1, 'type', 'radio');
  10510. processElement(branch1, options);
  10511. addIfCondition(branch0, {
  10512. exp: "(".concat(typeBinding, ")==='radio'") + ifConditionExtra,
  10513. block: branch1
  10514. });
  10515. // 3. other
  10516. var branch2 = cloneASTElement(el);
  10517. getAndRemoveAttr(branch2, 'v-for', true);
  10518. addRawAttr(branch2, ':type', typeBinding);
  10519. processElement(branch2, options);
  10520. addIfCondition(branch0, {
  10521. exp: ifCondition,
  10522. block: branch2
  10523. });
  10524. if (hasElse) {
  10525. branch0.else = true;
  10526. }
  10527. else if (elseIfCondition) {
  10528. branch0.elseif = elseIfCondition;
  10529. }
  10530. return branch0;
  10531. }
  10532. }
  10533. }
  10534. function cloneASTElement(el) {
  10535. return createASTElement(el.tag, el.attrsList.slice(), el.parent);
  10536. }
  10537. var model = {
  10538. preTransformNode: preTransformNode
  10539. };
  10540. var modules = [klass, style, model];
  10541. function text(el, dir) {
  10542. if (dir.value) {
  10543. addProp(el, 'textContent', "_s(".concat(dir.value, ")"), dir);
  10544. }
  10545. }
  10546. function html(el, dir) {
  10547. if (dir.value) {
  10548. addProp(el, 'innerHTML', "_s(".concat(dir.value, ")"), dir);
  10549. }
  10550. }
  10551. var directives = {
  10552. model: model$1,
  10553. text: text,
  10554. html: html
  10555. };
  10556. var baseOptions = {
  10557. expectHTML: true,
  10558. modules: modules,
  10559. directives: directives,
  10560. isPreTag: isPreTag,
  10561. isUnaryTag: isUnaryTag,
  10562. mustUseProp: mustUseProp,
  10563. canBeLeftOpenTag: canBeLeftOpenTag,
  10564. isReservedTag: isReservedTag,
  10565. getTagNamespace: getTagNamespace,
  10566. staticKeys: genStaticKeys$1(modules)
  10567. };
  10568. var isStaticKey;
  10569. var isPlatformReservedTag;
  10570. var genStaticKeysCached = cached(genStaticKeys);
  10571. /**
  10572. * Goal of the optimizer: walk the generated template AST tree
  10573. * and detect sub-trees that are purely static, i.e. parts of
  10574. * the DOM that never needs to change.
  10575. *
  10576. * Once we detect these sub-trees, we can:
  10577. *
  10578. * 1. Hoist them into constants, so that we no longer need to
  10579. * create fresh nodes for them on each re-render;
  10580. * 2. Completely skip them in the patching process.
  10581. */
  10582. function optimize(root, options) {
  10583. if (!root)
  10584. return;
  10585. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  10586. isPlatformReservedTag = options.isReservedTag || no;
  10587. // first pass: mark all non-static nodes.
  10588. markStatic(root);
  10589. // second pass: mark static roots.
  10590. markStaticRoots(root, false);
  10591. }
  10592. function genStaticKeys(keys) {
  10593. return makeMap('type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  10594. (keys ? ',' + keys : ''));
  10595. }
  10596. function markStatic(node) {
  10597. node.static = isStatic(node);
  10598. if (node.type === 1) {
  10599. // do not make component slot content static. this avoids
  10600. // 1. components not able to mutate slot nodes
  10601. // 2. static slot content fails for hot-reloading
  10602. if (!isPlatformReservedTag(node.tag) &&
  10603. node.tag !== 'slot' &&
  10604. node.attrsMap['inline-template'] == null) {
  10605. return;
  10606. }
  10607. for (var i = 0, l = node.children.length; i < l; i++) {
  10608. var child = node.children[i];
  10609. markStatic(child);
  10610. if (!child.static) {
  10611. node.static = false;
  10612. }
  10613. }
  10614. if (node.ifConditions) {
  10615. for (var i = 1, l = node.ifConditions.length; i < l; i++) {
  10616. var block = node.ifConditions[i].block;
  10617. markStatic(block);
  10618. if (!block.static) {
  10619. node.static = false;
  10620. }
  10621. }
  10622. }
  10623. }
  10624. }
  10625. function markStaticRoots(node, isInFor) {
  10626. if (node.type === 1) {
  10627. if (node.static || node.once) {
  10628. node.staticInFor = isInFor;
  10629. }
  10630. // For a node to qualify as a static root, it should have children that
  10631. // are not just static text. Otherwise the cost of hoisting out will
  10632. // outweigh the benefits and it's better off to just always render it fresh.
  10633. if (node.static &&
  10634. node.children.length &&
  10635. !(node.children.length === 1 && node.children[0].type === 3)) {
  10636. node.staticRoot = true;
  10637. return;
  10638. }
  10639. else {
  10640. node.staticRoot = false;
  10641. }
  10642. if (node.children) {
  10643. for (var i = 0, l = node.children.length; i < l; i++) {
  10644. markStaticRoots(node.children[i], isInFor || !!node.for);
  10645. }
  10646. }
  10647. if (node.ifConditions) {
  10648. for (var i = 1, l = node.ifConditions.length; i < l; i++) {
  10649. markStaticRoots(node.ifConditions[i].block, isInFor);
  10650. }
  10651. }
  10652. }
  10653. }
  10654. function isStatic(node) {
  10655. if (node.type === 2) {
  10656. // expression
  10657. return false;
  10658. }
  10659. if (node.type === 3) {
  10660. // text
  10661. return true;
  10662. }
  10663. return !!(node.pre ||
  10664. (!node.hasBindings && // no dynamic bindings
  10665. !node.if &&
  10666. !node.for && // not v-if or v-for or v-else
  10667. !isBuiltInTag(node.tag) && // not a built-in
  10668. isPlatformReservedTag(node.tag) && // not a component
  10669. !isDirectChildOfTemplateFor(node) &&
  10670. Object.keys(node).every(isStaticKey)));
  10671. }
  10672. function isDirectChildOfTemplateFor(node) {
  10673. while (node.parent) {
  10674. node = node.parent;
  10675. if (node.tag !== 'template') {
  10676. return false;
  10677. }
  10678. if (node.for) {
  10679. return true;
  10680. }
  10681. }
  10682. return false;
  10683. }
  10684. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  10685. var fnInvokeRE = /\([^)]*?\);*$/;
  10686. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  10687. // KeyboardEvent.keyCode aliases
  10688. var keyCodes = {
  10689. esc: 27,
  10690. tab: 9,
  10691. enter: 13,
  10692. space: 32,
  10693. up: 38,
  10694. left: 37,
  10695. right: 39,
  10696. down: 40,
  10697. delete: [8, 46]
  10698. };
  10699. // KeyboardEvent.key aliases
  10700. var keyNames = {
  10701. // #7880: IE11 and Edge use `Esc` for Escape key name.
  10702. esc: ['Esc', 'Escape'],
  10703. tab: 'Tab',
  10704. enter: 'Enter',
  10705. // #9112: IE11 uses `Spacebar` for Space key name.
  10706. space: [' ', 'Spacebar'],
  10707. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  10708. up: ['Up', 'ArrowUp'],
  10709. left: ['Left', 'ArrowLeft'],
  10710. right: ['Right', 'ArrowRight'],
  10711. down: ['Down', 'ArrowDown'],
  10712. // #9112: IE11 uses `Del` for Delete key name.
  10713. delete: ['Backspace', 'Delete', 'Del']
  10714. };
  10715. // #4868: modifiers that prevent the execution of the listener
  10716. // need to explicitly return null so that we can determine whether to remove
  10717. // the listener for .once
  10718. var genGuard = function (condition) { return "if(".concat(condition, ")return null;"); };
  10719. var modifierCode = {
  10720. stop: '$event.stopPropagation();',
  10721. prevent: '$event.preventDefault();',
  10722. self: genGuard("$event.target !== $event.currentTarget"),
  10723. ctrl: genGuard("!$event.ctrlKey"),
  10724. shift: genGuard("!$event.shiftKey"),
  10725. alt: genGuard("!$event.altKey"),
  10726. meta: genGuard("!$event.metaKey"),
  10727. left: genGuard("'button' in $event && $event.button !== 0"),
  10728. middle: genGuard("'button' in $event && $event.button !== 1"),
  10729. right: genGuard("'button' in $event && $event.button !== 2")
  10730. };
  10731. function genHandlers(events, isNative) {
  10732. var prefix = isNative ? 'nativeOn:' : 'on:';
  10733. var staticHandlers = "";
  10734. var dynamicHandlers = "";
  10735. for (var name_1 in events) {
  10736. var handlerCode = genHandler(events[name_1]);
  10737. //@ts-expect-error
  10738. if (events[name_1] && events[name_1].dynamic) {
  10739. dynamicHandlers += "".concat(name_1, ",").concat(handlerCode, ",");
  10740. }
  10741. else {
  10742. staticHandlers += "\"".concat(name_1, "\":").concat(handlerCode, ",");
  10743. }
  10744. }
  10745. staticHandlers = "{".concat(staticHandlers.slice(0, -1), "}");
  10746. if (dynamicHandlers) {
  10747. return prefix + "_d(".concat(staticHandlers, ",[").concat(dynamicHandlers.slice(0, -1), "])");
  10748. }
  10749. else {
  10750. return prefix + staticHandlers;
  10751. }
  10752. }
  10753. function genHandler(handler) {
  10754. if (!handler) {
  10755. return 'function(){}';
  10756. }
  10757. if (Array.isArray(handler)) {
  10758. return "[".concat(handler.map(function (handler) { return genHandler(handler); }).join(','), "]");
  10759. }
  10760. var isMethodPath = simplePathRE.test(handler.value);
  10761. var isFunctionExpression = fnExpRE.test(handler.value);
  10762. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  10763. if (!handler.modifiers) {
  10764. if (isMethodPath || isFunctionExpression) {
  10765. return handler.value;
  10766. }
  10767. return "function($event){".concat(isFunctionInvocation ? "return ".concat(handler.value) : handler.value, "}"); // inline statement
  10768. }
  10769. else {
  10770. var code = '';
  10771. var genModifierCode = '';
  10772. var keys = [];
  10773. var _loop_1 = function (key) {
  10774. if (modifierCode[key]) {
  10775. genModifierCode += modifierCode[key];
  10776. // left/right
  10777. if (keyCodes[key]) {
  10778. keys.push(key);
  10779. }
  10780. }
  10781. else if (key === 'exact') {
  10782. var modifiers_1 = handler.modifiers;
  10783. genModifierCode += genGuard(['ctrl', 'shift', 'alt', 'meta']
  10784. .filter(function (keyModifier) { return !modifiers_1[keyModifier]; })
  10785. .map(function (keyModifier) { return "$event.".concat(keyModifier, "Key"); })
  10786. .join('||'));
  10787. }
  10788. else {
  10789. keys.push(key);
  10790. }
  10791. };
  10792. for (var key in handler.modifiers) {
  10793. _loop_1(key);
  10794. }
  10795. if (keys.length) {
  10796. code += genKeyFilter(keys);
  10797. }
  10798. // Make sure modifiers like prevent and stop get executed after key filtering
  10799. if (genModifierCode) {
  10800. code += genModifierCode;
  10801. }
  10802. var handlerCode = isMethodPath
  10803. ? "return ".concat(handler.value, ".apply(null, arguments)")
  10804. : isFunctionExpression
  10805. ? "return (".concat(handler.value, ").apply(null, arguments)")
  10806. : isFunctionInvocation
  10807. ? "return ".concat(handler.value)
  10808. : handler.value;
  10809. return "function($event){".concat(code).concat(handlerCode, "}");
  10810. }
  10811. }
  10812. function genKeyFilter(keys) {
  10813. return (
  10814. // make sure the key filters only apply to KeyboardEvents
  10815. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  10816. // key events that do not have keyCode property...
  10817. "if(!$event.type.indexOf('key')&&" +
  10818. "".concat(keys.map(genFilterCode).join('&&'), ")return null;"));
  10819. }
  10820. function genFilterCode(key) {
  10821. var keyVal = parseInt(key, 10);
  10822. if (keyVal) {
  10823. return "$event.keyCode!==".concat(keyVal);
  10824. }
  10825. var keyCode = keyCodes[key];
  10826. var keyName = keyNames[key];
  10827. return ("_k($event.keyCode," +
  10828. "".concat(JSON.stringify(key), ",") +
  10829. "".concat(JSON.stringify(keyCode), ",") +
  10830. "$event.key," +
  10831. "".concat(JSON.stringify(keyName)) +
  10832. ")");
  10833. }
  10834. function on(el, dir) {
  10835. if (dir.modifiers) {
  10836. warn$2("v-on without argument does not support modifiers.");
  10837. }
  10838. el.wrapListeners = function (code) { return "_g(".concat(code, ",").concat(dir.value, ")"); };
  10839. }
  10840. function bind(el, dir) {
  10841. el.wrapData = function (code) {
  10842. return "_b(".concat(code, ",'").concat(el.tag, "',").concat(dir.value, ",").concat(dir.modifiers && dir.modifiers.prop ? 'true' : 'false').concat(dir.modifiers && dir.modifiers.sync ? ',true' : '', ")");
  10843. };
  10844. }
  10845. var baseDirectives = {
  10846. on: on,
  10847. bind: bind,
  10848. cloak: noop
  10849. };
  10850. var CodegenState = /** @class */ (function () {
  10851. function CodegenState(options) {
  10852. this.options = options;
  10853. this.warn = options.warn || baseWarn;
  10854. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  10855. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  10856. this.directives = extend(extend({}, baseDirectives), options.directives);
  10857. var isReservedTag = options.isReservedTag || no;
  10858. this.maybeComponent = function (el) {
  10859. return !!el.component || !isReservedTag(el.tag);
  10860. };
  10861. this.onceId = 0;
  10862. this.staticRenderFns = [];
  10863. this.pre = false;
  10864. }
  10865. return CodegenState;
  10866. }());
  10867. function generate(ast, options) {
  10868. var state = new CodegenState(options);
  10869. // fix #11483, Root level <script> tags should not be rendered.
  10870. var code = ast
  10871. ? ast.tag === 'script'
  10872. ? 'null'
  10873. : genElement(ast, state)
  10874. : '_c("div")';
  10875. return {
  10876. render: "with(this){return ".concat(code, "}"),
  10877. staticRenderFns: state.staticRenderFns
  10878. };
  10879. }
  10880. function genElement(el, state) {
  10881. if (el.parent) {
  10882. el.pre = el.pre || el.parent.pre;
  10883. }
  10884. if (el.staticRoot && !el.staticProcessed) {
  10885. return genStatic(el, state);
  10886. }
  10887. else if (el.once && !el.onceProcessed) {
  10888. return genOnce(el, state);
  10889. }
  10890. else if (el.for && !el.forProcessed) {
  10891. return genFor(el, state);
  10892. }
  10893. else if (el.if && !el.ifProcessed) {
  10894. return genIf(el, state);
  10895. }
  10896. else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  10897. return genChildren(el, state) || 'void 0';
  10898. }
  10899. else if (el.tag === 'slot') {
  10900. return genSlot(el, state);
  10901. }
  10902. else {
  10903. // component or element
  10904. var code = void 0;
  10905. if (el.component) {
  10906. code = genComponent(el.component, el, state);
  10907. }
  10908. else {
  10909. var data = void 0;
  10910. var maybeComponent = state.maybeComponent(el);
  10911. if (!el.plain || (el.pre && maybeComponent)) {
  10912. data = genData(el, state);
  10913. }
  10914. var tag
  10915. // check if this is a component in <script setup>
  10916. = void 0;
  10917. // check if this is a component in <script setup>
  10918. var bindings = state.options.bindings;
  10919. if (maybeComponent && bindings && bindings.__isScriptSetup !== false) {
  10920. tag = checkBindingType(bindings, el.tag);
  10921. }
  10922. if (!tag)
  10923. tag = "'".concat(el.tag, "'");
  10924. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  10925. code = "_c(".concat(tag).concat(data ? ",".concat(data) : '' // data
  10926. ).concat(children ? ",".concat(children) : '' // children
  10927. , ")");
  10928. }
  10929. // module transforms
  10930. for (var i = 0; i < state.transforms.length; i++) {
  10931. code = state.transforms[i](el, code);
  10932. }
  10933. return code;
  10934. }
  10935. }
  10936. function checkBindingType(bindings, key) {
  10937. var camelName = camelize(key);
  10938. var PascalName = capitalize(camelName);
  10939. var checkType = function (type) {
  10940. if (bindings[key] === type) {
  10941. return key;
  10942. }
  10943. if (bindings[camelName] === type) {
  10944. return camelName;
  10945. }
  10946. if (bindings[PascalName] === type) {
  10947. return PascalName;
  10948. }
  10949. };
  10950. var fromConst = checkType("setup-const" /* BindingTypes.SETUP_CONST */) ||
  10951. checkType("setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */);
  10952. if (fromConst) {
  10953. return fromConst;
  10954. }
  10955. var fromMaybeRef = checkType("setup-let" /* BindingTypes.SETUP_LET */) ||
  10956. checkType("setup-ref" /* BindingTypes.SETUP_REF */) ||
  10957. checkType("setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */);
  10958. if (fromMaybeRef) {
  10959. return fromMaybeRef;
  10960. }
  10961. }
  10962. // hoist static sub-trees out
  10963. function genStatic(el, state) {
  10964. el.staticProcessed = true;
  10965. // Some elements (templates) need to behave differently inside of a v-pre
  10966. // node. All pre nodes are static roots, so we can use this as a location to
  10967. // wrap a state change and reset it upon exiting the pre node.
  10968. var originalPreState = state.pre;
  10969. if (el.pre) {
  10970. state.pre = el.pre;
  10971. }
  10972. state.staticRenderFns.push("with(this){return ".concat(genElement(el, state), "}"));
  10973. state.pre = originalPreState;
  10974. return "_m(".concat(state.staticRenderFns.length - 1).concat(el.staticInFor ? ',true' : '', ")");
  10975. }
  10976. // v-once
  10977. function genOnce(el, state) {
  10978. el.onceProcessed = true;
  10979. if (el.if && !el.ifProcessed) {
  10980. return genIf(el, state);
  10981. }
  10982. else if (el.staticInFor) {
  10983. var key = '';
  10984. var parent_1 = el.parent;
  10985. while (parent_1) {
  10986. if (parent_1.for) {
  10987. key = parent_1.key;
  10988. break;
  10989. }
  10990. parent_1 = parent_1.parent;
  10991. }
  10992. if (!key) {
  10993. state.warn("v-once can only be used inside v-for that is keyed. ", el.rawAttrsMap['v-once']);
  10994. return genElement(el, state);
  10995. }
  10996. return "_o(".concat(genElement(el, state), ",").concat(state.onceId++, ",").concat(key, ")");
  10997. }
  10998. else {
  10999. return genStatic(el, state);
  11000. }
  11001. }
  11002. function genIf(el, state, altGen, altEmpty) {
  11003. el.ifProcessed = true; // avoid recursion
  11004. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty);
  11005. }
  11006. function genIfConditions(conditions, state, altGen, altEmpty) {
  11007. if (!conditions.length) {
  11008. return altEmpty || '_e()';
  11009. }
  11010. var condition = conditions.shift();
  11011. if (condition.exp) {
  11012. return "(".concat(condition.exp, ")?").concat(genTernaryExp(condition.block), ":").concat(genIfConditions(conditions, state, altGen, altEmpty));
  11013. }
  11014. else {
  11015. return "".concat(genTernaryExp(condition.block));
  11016. }
  11017. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  11018. function genTernaryExp(el) {
  11019. return altGen
  11020. ? altGen(el, state)
  11021. : el.once
  11022. ? genOnce(el, state)
  11023. : genElement(el, state);
  11024. }
  11025. }
  11026. function genFor(el, state, altGen, altHelper) {
  11027. var exp = el.for;
  11028. var alias = el.alias;
  11029. var iterator1 = el.iterator1 ? ",".concat(el.iterator1) : '';
  11030. var iterator2 = el.iterator2 ? ",".concat(el.iterator2) : '';
  11031. if (state.maybeComponent(el) &&
  11032. el.tag !== 'slot' &&
  11033. el.tag !== 'template' &&
  11034. !el.key) {
  11035. state.warn("<".concat(el.tag, " v-for=\"").concat(alias, " in ").concat(exp, "\">: component lists rendered with ") +
  11036. "v-for should have explicit keys. " +
  11037. "See https://v2.vuejs.org/v2/guide/list.html#key for more info.", el.rawAttrsMap['v-for'], true /* tip */);
  11038. }
  11039. el.forProcessed = true; // avoid recursion
  11040. return ("".concat(altHelper || '_l', "((").concat(exp, "),") +
  11041. "function(".concat(alias).concat(iterator1).concat(iterator2, "){") +
  11042. "return ".concat((altGen || genElement)(el, state)) +
  11043. '})');
  11044. }
  11045. function genData(el, state) {
  11046. var data = '{';
  11047. // directives first.
  11048. // directives may mutate the el's other properties before they are generated.
  11049. var dirs = genDirectives(el, state);
  11050. if (dirs)
  11051. data += dirs + ',';
  11052. // key
  11053. if (el.key) {
  11054. data += "key:".concat(el.key, ",");
  11055. }
  11056. // ref
  11057. if (el.ref) {
  11058. data += "ref:".concat(el.ref, ",");
  11059. }
  11060. if (el.refInFor) {
  11061. data += "refInFor:true,";
  11062. }
  11063. // pre
  11064. if (el.pre) {
  11065. data += "pre:true,";
  11066. }
  11067. // record original tag name for components using "is" attribute
  11068. if (el.component) {
  11069. data += "tag:\"".concat(el.tag, "\",");
  11070. }
  11071. // module data generation functions
  11072. for (var i = 0; i < state.dataGenFns.length; i++) {
  11073. data += state.dataGenFns[i](el);
  11074. }
  11075. // attributes
  11076. if (el.attrs) {
  11077. data += "attrs:".concat(genProps(el.attrs), ",");
  11078. }
  11079. // DOM props
  11080. if (el.props) {
  11081. data += "domProps:".concat(genProps(el.props), ",");
  11082. }
  11083. // event handlers
  11084. if (el.events) {
  11085. data += "".concat(genHandlers(el.events, false), ",");
  11086. }
  11087. if (el.nativeEvents) {
  11088. data += "".concat(genHandlers(el.nativeEvents, true), ",");
  11089. }
  11090. // slot target
  11091. // only for non-scoped slots
  11092. if (el.slotTarget && !el.slotScope) {
  11093. data += "slot:".concat(el.slotTarget, ",");
  11094. }
  11095. // scoped slots
  11096. if (el.scopedSlots) {
  11097. data += "".concat(genScopedSlots(el, el.scopedSlots, state), ",");
  11098. }
  11099. // component v-model
  11100. if (el.model) {
  11101. data += "model:{value:".concat(el.model.value, ",callback:").concat(el.model.callback, ",expression:").concat(el.model.expression, "},");
  11102. }
  11103. // inline-template
  11104. if (el.inlineTemplate) {
  11105. var inlineTemplate = genInlineTemplate(el, state);
  11106. if (inlineTemplate) {
  11107. data += "".concat(inlineTemplate, ",");
  11108. }
  11109. }
  11110. data = data.replace(/,$/, '') + '}';
  11111. // v-bind dynamic argument wrap
  11112. // v-bind with dynamic arguments must be applied using the same v-bind object
  11113. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  11114. if (el.dynamicAttrs) {
  11115. data = "_b(".concat(data, ",\"").concat(el.tag, "\",").concat(genProps(el.dynamicAttrs), ")");
  11116. }
  11117. // v-bind data wrap
  11118. if (el.wrapData) {
  11119. data = el.wrapData(data);
  11120. }
  11121. // v-on data wrap
  11122. if (el.wrapListeners) {
  11123. data = el.wrapListeners(data);
  11124. }
  11125. return data;
  11126. }
  11127. function genDirectives(el, state) {
  11128. var dirs = el.directives;
  11129. if (!dirs)
  11130. return;
  11131. var res = 'directives:[';
  11132. var hasRuntime = false;
  11133. var i, l, dir, needRuntime;
  11134. for (i = 0, l = dirs.length; i < l; i++) {
  11135. dir = dirs[i];
  11136. needRuntime = true;
  11137. var gen = state.directives[dir.name];
  11138. if (gen) {
  11139. // compile-time directive that manipulates AST.
  11140. // returns true if it also needs a runtime counterpart.
  11141. needRuntime = !!gen(el, dir, state.warn);
  11142. }
  11143. if (needRuntime) {
  11144. hasRuntime = true;
  11145. res += "{name:\"".concat(dir.name, "\",rawName:\"").concat(dir.rawName, "\"").concat(dir.value
  11146. ? ",value:(".concat(dir.value, "),expression:").concat(JSON.stringify(dir.value))
  11147. : '').concat(dir.arg ? ",arg:".concat(dir.isDynamicArg ? dir.arg : "\"".concat(dir.arg, "\"")) : '').concat(dir.modifiers ? ",modifiers:".concat(JSON.stringify(dir.modifiers)) : '', "},");
  11148. }
  11149. }
  11150. if (hasRuntime) {
  11151. return res.slice(0, -1) + ']';
  11152. }
  11153. }
  11154. function genInlineTemplate(el, state) {
  11155. var ast = el.children[0];
  11156. if ((el.children.length !== 1 || ast.type !== 1)) {
  11157. state.warn('Inline-template components must have exactly one child element.', { start: el.start });
  11158. }
  11159. if (ast && ast.type === 1) {
  11160. var inlineRenderFns = generate(ast, state.options);
  11161. return "inlineTemplate:{render:function(){".concat(inlineRenderFns.render, "},staticRenderFns:[").concat(inlineRenderFns.staticRenderFns
  11162. .map(function (code) { return "function(){".concat(code, "}"); })
  11163. .join(','), "]}");
  11164. }
  11165. }
  11166. function genScopedSlots(el, slots, state) {
  11167. // by default scoped slots are considered "stable", this allows child
  11168. // components with only scoped slots to skip forced updates from parent.
  11169. // but in some cases we have to bail-out of this optimization
  11170. // for example if the slot contains dynamic names, has v-if or v-for on them...
  11171. var needsForceUpdate = el.for ||
  11172. Object.keys(slots).some(function (key) {
  11173. var slot = slots[key];
  11174. return (slot.slotTargetDynamic || slot.if || slot.for || containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  11175. );
  11176. });
  11177. // #9534: if a component with scoped slots is inside a conditional branch,
  11178. // it's possible for the same component to be reused but with different
  11179. // compiled slot content. To avoid that, we generate a unique key based on
  11180. // the generated code of all the slot contents.
  11181. var needsKey = !!el.if;
  11182. // OR when it is inside another scoped slot or v-for (the reactivity may be
  11183. // disconnected due to the intermediate scope variable)
  11184. // #9438, #9506
  11185. // TODO: this can be further optimized by properly analyzing in-scope bindings
  11186. // and skip force updating ones that do not actually use scope variables.
  11187. if (!needsForceUpdate) {
  11188. var parent_2 = el.parent;
  11189. while (parent_2) {
  11190. if ((parent_2.slotScope && parent_2.slotScope !== emptySlotScopeToken) ||
  11191. parent_2.for) {
  11192. needsForceUpdate = true;
  11193. break;
  11194. }
  11195. if (parent_2.if) {
  11196. needsKey = true;
  11197. }
  11198. parent_2 = parent_2.parent;
  11199. }
  11200. }
  11201. var generatedSlots = Object.keys(slots)
  11202. .map(function (key) { return genScopedSlot(slots[key], state); })
  11203. .join(',');
  11204. return "scopedSlots:_u([".concat(generatedSlots, "]").concat(needsForceUpdate ? ",null,true" : "").concat(!needsForceUpdate && needsKey ? ",null,false,".concat(hash(generatedSlots)) : "", ")");
  11205. }
  11206. function hash(str) {
  11207. var hash = 5381;
  11208. var i = str.length;
  11209. while (i) {
  11210. hash = (hash * 33) ^ str.charCodeAt(--i);
  11211. }
  11212. return hash >>> 0;
  11213. }
  11214. function containsSlotChild(el) {
  11215. if (el.type === 1) {
  11216. if (el.tag === 'slot') {
  11217. return true;
  11218. }
  11219. return el.children.some(containsSlotChild);
  11220. }
  11221. return false;
  11222. }
  11223. function genScopedSlot(el, state) {
  11224. var isLegacySyntax = el.attrsMap['slot-scope'];
  11225. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  11226. return genIf(el, state, genScopedSlot, "null");
  11227. }
  11228. if (el.for && !el.forProcessed) {
  11229. return genFor(el, state, genScopedSlot);
  11230. }
  11231. var slotScope = el.slotScope === emptySlotScopeToken ? "" : String(el.slotScope);
  11232. var fn = "function(".concat(slotScope, "){") +
  11233. "return ".concat(el.tag === 'template'
  11234. ? el.if && isLegacySyntax
  11235. ? "(".concat(el.if, ")?").concat(genChildren(el, state) || 'undefined', ":undefined")
  11236. : genChildren(el, state) || 'undefined'
  11237. : genElement(el, state), "}");
  11238. // reverse proxy v-slot without scope on this.$slots
  11239. var reverseProxy = slotScope ? "" : ",proxy:true";
  11240. return "{key:".concat(el.slotTarget || "\"default\"", ",fn:").concat(fn).concat(reverseProxy, "}");
  11241. }
  11242. function genChildren(el, state, checkSkip, altGenElement, altGenNode) {
  11243. var children = el.children;
  11244. if (children.length) {
  11245. var el_1 = children[0];
  11246. // optimize single v-for
  11247. if (children.length === 1 &&
  11248. el_1.for &&
  11249. el_1.tag !== 'template' &&
  11250. el_1.tag !== 'slot') {
  11251. var normalizationType_1 = checkSkip
  11252. ? state.maybeComponent(el_1)
  11253. ? ",1"
  11254. : ",0"
  11255. : "";
  11256. return "".concat((altGenElement || genElement)(el_1, state)).concat(normalizationType_1);
  11257. }
  11258. var normalizationType = checkSkip
  11259. ? getNormalizationType(children, state.maybeComponent)
  11260. : 0;
  11261. var gen_1 = altGenNode || genNode;
  11262. return "[".concat(children.map(function (c) { return gen_1(c, state); }).join(','), "]").concat(normalizationType ? ",".concat(normalizationType) : '');
  11263. }
  11264. }
  11265. // determine the normalization needed for the children array.
  11266. // 0: no normalization needed
  11267. // 1: simple normalization needed (possible 1-level deep nested array)
  11268. // 2: full normalization needed
  11269. function getNormalizationType(children, maybeComponent) {
  11270. var res = 0;
  11271. for (var i = 0; i < children.length; i++) {
  11272. var el = children[i];
  11273. if (el.type !== 1) {
  11274. continue;
  11275. }
  11276. if (needsNormalization(el) ||
  11277. (el.ifConditions &&
  11278. el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  11279. res = 2;
  11280. break;
  11281. }
  11282. if (maybeComponent(el) ||
  11283. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  11284. res = 1;
  11285. }
  11286. }
  11287. return res;
  11288. }
  11289. function needsNormalization(el) {
  11290. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot';
  11291. }
  11292. function genNode(node, state) {
  11293. if (node.type === 1) {
  11294. return genElement(node, state);
  11295. }
  11296. else if (node.type === 3 && node.isComment) {
  11297. return genComment(node);
  11298. }
  11299. else {
  11300. return genText(node);
  11301. }
  11302. }
  11303. function genText(text) {
  11304. return "_v(".concat(text.type === 2
  11305. ? text.expression // no need for () because already wrapped in _s()
  11306. : transformSpecialNewlines(JSON.stringify(text.text)), ")");
  11307. }
  11308. function genComment(comment) {
  11309. return "_e(".concat(JSON.stringify(comment.text), ")");
  11310. }
  11311. function genSlot(el, state) {
  11312. var slotName = el.slotName || '"default"';
  11313. var children = genChildren(el, state);
  11314. var res = "_t(".concat(slotName).concat(children ? ",function(){return ".concat(children, "}") : '');
  11315. var attrs = el.attrs || el.dynamicAttrs
  11316. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  11317. // slot props are camelized
  11318. name: camelize(attr.name),
  11319. value: attr.value,
  11320. dynamic: attr.dynamic
  11321. }); }))
  11322. : null;
  11323. var bind = el.attrsMap['v-bind'];
  11324. if ((attrs || bind) && !children) {
  11325. res += ",null";
  11326. }
  11327. if (attrs) {
  11328. res += ",".concat(attrs);
  11329. }
  11330. if (bind) {
  11331. res += "".concat(attrs ? '' : ',null', ",").concat(bind);
  11332. }
  11333. return res + ')';
  11334. }
  11335. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  11336. function genComponent(componentName, el, state) {
  11337. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  11338. return "_c(".concat(componentName, ",").concat(genData(el, state)).concat(children ? ",".concat(children) : '', ")");
  11339. }
  11340. function genProps(props) {
  11341. var staticProps = "";
  11342. var dynamicProps = "";
  11343. for (var i = 0; i < props.length; i++) {
  11344. var prop = props[i];
  11345. var value = transformSpecialNewlines(prop.value);
  11346. if (prop.dynamic) {
  11347. dynamicProps += "".concat(prop.name, ",").concat(value, ",");
  11348. }
  11349. else {
  11350. staticProps += "\"".concat(prop.name, "\":").concat(value, ",");
  11351. }
  11352. }
  11353. staticProps = "{".concat(staticProps.slice(0, -1), "}");
  11354. if (dynamicProps) {
  11355. return "_d(".concat(staticProps, ",[").concat(dynamicProps.slice(0, -1), "])");
  11356. }
  11357. else {
  11358. return staticProps;
  11359. }
  11360. }
  11361. // #3895, #4268
  11362. function transformSpecialNewlines(text) {
  11363. return text.replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
  11364. }
  11365. // these keywords should not appear inside expressions, but operators like
  11366. // typeof, instanceof and in are allowed
  11367. var prohibitedKeywordRE = new RegExp('\\b' +
  11368. ('do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  11369. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  11370. 'extends,finally,continue,debugger,function,arguments')
  11371. .split(',')
  11372. .join('\\b|\\b') +
  11373. '\\b');
  11374. // these unary operators should not be used as property/method names
  11375. var unaryOperatorsRE = new RegExp('\\b' +
  11376. 'delete,typeof,void'.split(',').join('\\s*\\([^\\)]*\\)|\\b') +
  11377. '\\s*\\([^\\)]*\\)');
  11378. // strip strings in expressions
  11379. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  11380. // detect problematic expressions in a template
  11381. function detectErrors(ast, warn) {
  11382. if (ast) {
  11383. checkNode(ast, warn);
  11384. }
  11385. }
  11386. function checkNode(node, warn) {
  11387. if (node.type === 1) {
  11388. for (var name_1 in node.attrsMap) {
  11389. if (dirRE.test(name_1)) {
  11390. var value = node.attrsMap[name_1];
  11391. if (value) {
  11392. var range = node.rawAttrsMap[name_1];
  11393. if (name_1 === 'v-for') {
  11394. checkFor(node, "v-for=\"".concat(value, "\""), warn, range);
  11395. }
  11396. else if (name_1 === 'v-slot' || name_1[0] === '#') {
  11397. checkFunctionParameterExpression(value, "".concat(name_1, "=\"").concat(value, "\""), warn, range);
  11398. }
  11399. else if (onRE.test(name_1)) {
  11400. checkEvent(value, "".concat(name_1, "=\"").concat(value, "\""), warn, range);
  11401. }
  11402. else {
  11403. checkExpression(value, "".concat(name_1, "=\"").concat(value, "\""), warn, range);
  11404. }
  11405. }
  11406. }
  11407. }
  11408. if (node.children) {
  11409. for (var i = 0; i < node.children.length; i++) {
  11410. checkNode(node.children[i], warn);
  11411. }
  11412. }
  11413. }
  11414. else if (node.type === 2) {
  11415. checkExpression(node.expression, node.text, warn, node);
  11416. }
  11417. }
  11418. function checkEvent(exp, text, warn, range) {
  11419. var stripped = exp.replace(stripStringRE, '');
  11420. var keywordMatch = stripped.match(unaryOperatorsRE);
  11421. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  11422. warn("avoid using JavaScript unary operator as property name: " +
  11423. "\"".concat(keywordMatch[0], "\" in expression ").concat(text.trim()), range);
  11424. }
  11425. checkExpression(exp, text, warn, range);
  11426. }
  11427. function checkFor(node, text, warn, range) {
  11428. checkExpression(node.for || '', text, warn, range);
  11429. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  11430. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  11431. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  11432. }
  11433. function checkIdentifier(ident, type, text, warn, range) {
  11434. if (typeof ident === 'string') {
  11435. try {
  11436. new Function("var ".concat(ident, "=_"));
  11437. }
  11438. catch (e) {
  11439. warn("invalid ".concat(type, " \"").concat(ident, "\" in expression: ").concat(text.trim()), range);
  11440. }
  11441. }
  11442. }
  11443. function checkExpression(exp, text, warn, range) {
  11444. try {
  11445. new Function("return ".concat(exp));
  11446. }
  11447. catch (e) {
  11448. var keywordMatch = exp
  11449. .replace(stripStringRE, '')
  11450. .match(prohibitedKeywordRE);
  11451. if (keywordMatch) {
  11452. warn("avoid using JavaScript keyword as property name: " +
  11453. "\"".concat(keywordMatch[0], "\"\n Raw expression: ").concat(text.trim()), range);
  11454. }
  11455. else {
  11456. warn("invalid expression: ".concat(e.message, " in\n\n") +
  11457. " ".concat(exp, "\n\n") +
  11458. " Raw expression: ".concat(text.trim(), "\n"), range);
  11459. }
  11460. }
  11461. }
  11462. function checkFunctionParameterExpression(exp, text, warn, range) {
  11463. try {
  11464. new Function(exp, '');
  11465. }
  11466. catch (e) {
  11467. warn("invalid function parameter expression: ".concat(e.message, " in\n\n") +
  11468. " ".concat(exp, "\n\n") +
  11469. " Raw expression: ".concat(text.trim(), "\n"), range);
  11470. }
  11471. }
  11472. var range = 2;
  11473. function generateCodeFrame(source, start, end) {
  11474. if (start === void 0) { start = 0; }
  11475. if (end === void 0) { end = source.length; }
  11476. var lines = source.split(/\r?\n/);
  11477. var count = 0;
  11478. var res = [];
  11479. for (var i = 0; i < lines.length; i++) {
  11480. count += lines[i].length + 1;
  11481. if (count >= start) {
  11482. for (var j = i - range; j <= i + range || end > count; j++) {
  11483. if (j < 0 || j >= lines.length)
  11484. continue;
  11485. res.push("".concat(j + 1).concat(repeat(" ", 3 - String(j + 1).length), "| ").concat(lines[j]));
  11486. var lineLength = lines[j].length;
  11487. if (j === i) {
  11488. // push underline
  11489. var pad = start - (count - lineLength) + 1;
  11490. var length_1 = end > count ? lineLength - pad : end - start;
  11491. res.push(" | " + repeat(" ", pad) + repeat("^", length_1));
  11492. }
  11493. else if (j > i) {
  11494. if (end > count) {
  11495. var length_2 = Math.min(end - count, lineLength);
  11496. res.push(" | " + repeat("^", length_2));
  11497. }
  11498. count += lineLength + 1;
  11499. }
  11500. }
  11501. break;
  11502. }
  11503. }
  11504. return res.join('\n');
  11505. }
  11506. function repeat(str, n) {
  11507. var result = '';
  11508. if (n > 0) {
  11509. // eslint-disable-next-line no-constant-condition
  11510. while (true) {
  11511. // eslint-disable-line
  11512. if (n & 1)
  11513. result += str;
  11514. n >>>= 1;
  11515. if (n <= 0)
  11516. break;
  11517. str += str;
  11518. }
  11519. }
  11520. return result;
  11521. }
  11522. function createFunction(code, errors) {
  11523. try {
  11524. return new Function(code);
  11525. }
  11526. catch (err) {
  11527. errors.push({ err: err, code: code });
  11528. return noop;
  11529. }
  11530. }
  11531. function createCompileToFunctionFn(compile) {
  11532. var cache = Object.create(null);
  11533. return function compileToFunctions(template, options, vm) {
  11534. options = extend({}, options);
  11535. var warn = options.warn || warn$2;
  11536. delete options.warn;
  11537. /* istanbul ignore if */
  11538. {
  11539. // detect possible CSP restriction
  11540. try {
  11541. new Function('return 1');
  11542. }
  11543. catch (e) {
  11544. if (e.toString().match(/unsafe-eval|CSP/)) {
  11545. warn('It seems you are using the standalone build of Vue.js in an ' +
  11546. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  11547. 'The template compiler cannot work in this environment. Consider ' +
  11548. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  11549. 'templates into render functions.');
  11550. }
  11551. }
  11552. }
  11553. // check cache
  11554. var key = options.delimiters
  11555. ? String(options.delimiters) + template
  11556. : template;
  11557. if (cache[key]) {
  11558. return cache[key];
  11559. }
  11560. // compile
  11561. var compiled = compile(template, options);
  11562. // check compilation errors/tips
  11563. {
  11564. if (compiled.errors && compiled.errors.length) {
  11565. if (options.outputSourceRange) {
  11566. compiled.errors.forEach(function (e) {
  11567. warn("Error compiling template:\n\n".concat(e.msg, "\n\n") +
  11568. generateCodeFrame(template, e.start, e.end), vm);
  11569. });
  11570. }
  11571. else {
  11572. warn("Error compiling template:\n\n".concat(template, "\n\n") +
  11573. compiled.errors.map(function (e) { return "- ".concat(e); }).join('\n') +
  11574. '\n', vm);
  11575. }
  11576. }
  11577. if (compiled.tips && compiled.tips.length) {
  11578. if (options.outputSourceRange) {
  11579. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  11580. }
  11581. else {
  11582. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  11583. }
  11584. }
  11585. }
  11586. // turn code into functions
  11587. var res = {};
  11588. var fnGenErrors = [];
  11589. res.render = createFunction(compiled.render, fnGenErrors);
  11590. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  11591. return createFunction(code, fnGenErrors);
  11592. });
  11593. // check function generation errors.
  11594. // this should only happen if there is a bug in the compiler itself.
  11595. // mostly for codegen development use
  11596. /* istanbul ignore if */
  11597. {
  11598. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  11599. warn("Failed to generate render function:\n\n" +
  11600. fnGenErrors
  11601. .map(function (_a) {
  11602. var err = _a.err, code = _a.code;
  11603. return "".concat(err.toString(), " in\n\n").concat(code, "\n");
  11604. })
  11605. .join('\n'), vm);
  11606. }
  11607. }
  11608. return (cache[key] = res);
  11609. };
  11610. }
  11611. function createCompilerCreator(baseCompile) {
  11612. return function createCompiler(baseOptions) {
  11613. function compile(template, options) {
  11614. var finalOptions = Object.create(baseOptions);
  11615. var errors = [];
  11616. var tips = [];
  11617. var warn = function (msg, range, tip) {
  11618. (tip ? tips : errors).push(msg);
  11619. };
  11620. if (options) {
  11621. if (options.outputSourceRange) {
  11622. // $flow-disable-line
  11623. var leadingSpaceLength_1 = template.match(/^\s*/)[0].length;
  11624. warn = function (msg, range, tip) {
  11625. var data = typeof msg === 'string' ? { msg: msg } : msg;
  11626. if (range) {
  11627. if (range.start != null) {
  11628. data.start = range.start + leadingSpaceLength_1;
  11629. }
  11630. if (range.end != null) {
  11631. data.end = range.end + leadingSpaceLength_1;
  11632. }
  11633. }
  11634. (tip ? tips : errors).push(data);
  11635. };
  11636. }
  11637. // merge custom modules
  11638. if (options.modules) {
  11639. finalOptions.modules = (baseOptions.modules || []).concat(options.modules);
  11640. }
  11641. // merge custom directives
  11642. if (options.directives) {
  11643. finalOptions.directives = extend(Object.create(baseOptions.directives || null), options.directives);
  11644. }
  11645. // copy other options
  11646. for (var key in options) {
  11647. if (key !== 'modules' && key !== 'directives') {
  11648. finalOptions[key] = options[key];
  11649. }
  11650. }
  11651. }
  11652. finalOptions.warn = warn;
  11653. var compiled = baseCompile(template.trim(), finalOptions);
  11654. {
  11655. detectErrors(compiled.ast, warn);
  11656. }
  11657. compiled.errors = errors;
  11658. compiled.tips = tips;
  11659. return compiled;
  11660. }
  11661. return {
  11662. compile: compile,
  11663. compileToFunctions: createCompileToFunctionFn(compile)
  11664. };
  11665. };
  11666. }
  11667. // `createCompilerCreator` allows creating compilers that use alternative
  11668. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  11669. // Here we just export a default compiler using the default parts.
  11670. var createCompiler = createCompilerCreator(function baseCompile(template, options) {
  11671. var ast = parse(template.trim(), options);
  11672. if (options.optimize !== false) {
  11673. optimize(ast, options);
  11674. }
  11675. var code = generate(ast, options);
  11676. return {
  11677. ast: ast,
  11678. render: code.render,
  11679. staticRenderFns: code.staticRenderFns
  11680. };
  11681. });
  11682. var _a = createCompiler(baseOptions), compileToFunctions = _a.compileToFunctions;
  11683. // check whether current browser encodes a char inside attribute values
  11684. var div;
  11685. function getShouldDecode(href) {
  11686. div = div || document.createElement('div');
  11687. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  11688. return div.innerHTML.indexOf('&#10;') > 0;
  11689. }
  11690. // #3663: IE encodes newlines inside attribute values while other browsers don't
  11691. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  11692. // #6828: chrome encodes content in a[href]
  11693. var shouldDecodeNewlinesForHref = inBrowser
  11694. ? getShouldDecode(true)
  11695. : false;
  11696. var idToTemplate = cached(function (id) {
  11697. var el = query(id);
  11698. return el && el.innerHTML;
  11699. });
  11700. var mount = Vue.prototype.$mount;
  11701. Vue.prototype.$mount = function (el, hydrating) {
  11702. el = el && query(el);
  11703. /* istanbul ignore if */
  11704. if (el === document.body || el === document.documentElement) {
  11705. warn$2("Do not mount Vue to <html> or <body> - mount to normal elements instead.");
  11706. return this;
  11707. }
  11708. var options = this.$options;
  11709. // resolve template/el and convert to render function
  11710. if (!options.render) {
  11711. var template = options.template;
  11712. if (template) {
  11713. if (typeof template === 'string') {
  11714. if (template.charAt(0) === '#') {
  11715. template = idToTemplate(template);
  11716. /* istanbul ignore if */
  11717. if (!template) {
  11718. warn$2("Template element not found or is empty: ".concat(options.template), this);
  11719. }
  11720. }
  11721. }
  11722. else if (template.nodeType) {
  11723. template = template.innerHTML;
  11724. }
  11725. else {
  11726. {
  11727. warn$2('invalid template option:' + template, this);
  11728. }
  11729. return this;
  11730. }
  11731. }
  11732. else if (el) {
  11733. // @ts-expect-error
  11734. template = getOuterHTML(el);
  11735. }
  11736. if (template) {
  11737. /* istanbul ignore if */
  11738. if (config.performance && mark) {
  11739. mark('compile');
  11740. }
  11741. var _a = compileToFunctions(template, {
  11742. outputSourceRange: true,
  11743. shouldDecodeNewlines: shouldDecodeNewlines,
  11744. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  11745. delimiters: options.delimiters,
  11746. comments: options.comments
  11747. }, this), render = _a.render, staticRenderFns = _a.staticRenderFns;
  11748. options.render = render;
  11749. options.staticRenderFns = staticRenderFns;
  11750. /* istanbul ignore if */
  11751. if (config.performance && mark) {
  11752. mark('compile end');
  11753. measure("vue ".concat(this._name, " compile"), 'compile', 'compile end');
  11754. }
  11755. }
  11756. }
  11757. return mount.call(this, el, hydrating);
  11758. };
  11759. /**
  11760. * Get outerHTML of elements, taking care
  11761. * of SVG elements in IE as well.
  11762. */
  11763. function getOuterHTML(el) {
  11764. if (el.outerHTML) {
  11765. return el.outerHTML;
  11766. }
  11767. else {
  11768. var container = document.createElement('div');
  11769. container.appendChild(el.cloneNode(true));
  11770. return container.innerHTML;
  11771. }
  11772. }
  11773. Vue.compile = compileToFunctions;
  11774. // export type EffectScheduler = (...args: any[]) => any
  11775. /**
  11776. * @internal since we are not exposing this in Vue 2, it's used only for
  11777. * internal testing.
  11778. */
  11779. function effect(fn, scheduler) {
  11780. var watcher = new Watcher(currentInstance, fn, noop, {
  11781. sync: true
  11782. });
  11783. if (scheduler) {
  11784. watcher.update = function () {
  11785. scheduler(function () { return watcher.run(); });
  11786. };
  11787. }
  11788. }
  11789. extend(Vue, vca);
  11790. Vue.effect = effect;
  11791. return Vue;
  11792. }));